#tyndur · 2010-07-20

330 Nachrichten · Seite 2 von 2 · Original-CSV herunterladen

  1. pcmattmanWe're kind of stupid like that
  2. pcmattman;)
  3. kwolfYou definitely need to change that some time ;-)
  4. ehenkesfirst: we decided to develop a driver for EHCI w/o having one for UHCI and OHCI
  5. ehenkesthis is possible, the only device nedding UHCI is the ubs-mouse
  6. ehenkesour base for development was the EHCI spec 1.0
  7. ehenkeswe went thru it step-by-step and developed our own code.
  8. ehenkesplease have a look at this forum thread: http://www.c-plusplus.de/forum/viewtopic-var-t-is-253016-and-postdays-is-0-and-postorder-is-asc-and-start-is-81.html
  9. ehenkesI am going to refer to it
  10. pcmattmanRight
  11. ehenkesthe code for EHCI you'll find there: https://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/ehci.c
  12. ehenkesand ...
  13. ehenkeshttps://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/ehciQHqTD.c
  14. ehenkesa little bit tricky is the interrupt handling
  15. ehenkesthe DeactivateLegacySupport
  16. pcmattmanOkay, got the code up
  17. pcmattmanOut of interest, does all this work on real hardware, or just in emulators?
  18. ehenkesreal hardware
  19. Love4Boobiesmay I ask what boxes?
  20. ehenkesThe qH/qTD-transfer is not optimized, we are doing start 'n' stop
  21. ehenkesboxes?
  22. Love4Boobiesas in, what machines
  23. Love4Boobies* did you test on
  24. TobikingIt's working on my laptop with an ich7 chipset
  25. ehenkesok, you need an EHCI, see that during pci-scan
  26. Love4Boobiesoh, thanks, good to know
  27. ehenkesif you are also interested in our USB2.0 part, may I refer to https://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/usb2.c and https://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/usb2_msd.c and https://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/usb_hc.c
  28. ehenkesthe EHCI is the base for high speed usb
  29. ehenkesAt the time being, in our OS we address only root ports nor hubs
  30. pcmattmanSimplifies things a fair bit
  31. ehenkesat real PC you have to be careful with pci configuration to avoid host errors
  32. ehenkesinitEHCIHostController() <--- bus mastering
  33. ehenkeshttp://forum.osdev.org/viewtopic.php?f=1&t=20255&start=0
  34. pcmattmanRight, and on our PC and non-PC targets we've made sure the equivalent is configured correctly
  35. ehenkesand you need this extended buffers in qTD
  36. ehenkescf. allocQTDbuffer in ehciQHqTD.c
  37. ehenkesour weakest point is: performAsyncScheduler at ehciQHqTD.c
  38. ehenkesI'd appreciate if you could help us there to improve, i.e. to find the best path forward
  39. ehenkesbut it is working reliably
  40. pcmattmanChances are we can help out with perhaps even removing the stop/start when doing queue operations in the async schedule
  41. pcmattmanOur current issue is that our driver works in VMware (and other emulators) but completely fails on any real hardware - tested on several PCs and my beagleboard with transaction errors
  42. pcmattmanSpecifically, when setting a device address, the first SETUP transaction completes without error, and then the handshake IN transaction returns a transaction error
  43. pcmattmanYou wouldn't happen to have run into a similar problem before?
  44. ehenkesno, control transfers are easy
  45. TobikingThere was something not really specified if there needs to be an handshake qtd.
  46. ehenkesplease have a look at usbTransferEnumerate in usb2.c
  47. pcmattmanI have it open now
  48. ehenkesas you can see, we start with virtualAsyncList
  49. ehenkesthen we implement the qTD sequence, fix it to the QH
  50. ehenkeswe use setup amd handshake
  51. ehenkesbut I have to admit that I never understodd why we have to send ourselves a handshake ^^
  52. Love4Boobiescheck out the USB 2.0 docs
  53. ehenkesthen we performAsyncScheduler and free all the malloc'd memory space
  54. Love4Boobiesthe function usually send an error of the control request failed
  55. ehenkesMore complicated are the bulk transfers with scsi commands
  56. pcmattmanAnd performAsyncScheduler takes that QH and executes it, handling completion and error states... I see now
  57. ehenkesyes
  58. ehenkestime is important
  59. Love4Boobiesthere is a table in the USB 2.0 docs, showing the corelations between errors reported by host controllers and the actual problem with the function
  60. ehenkesbut the control transfers are fast
  61. Love4BoobiesNAK means device is busy, for example
  62. pcmattmanehenkes: Is there any reason you tie the SETUP to the handshake packet (IN) within one QH (two linked qTDs) rather than do two distinct QH+qTD pairs?
  63. ehenkesyes, we set the NAK counter to 15
  64. ehenkesbut if you set it to 0, it does not matter
  65. TobikingThe QH descriptes an endpoint, and the setup and handshake packet are send to the same endpoint. So I think they should be together
  66. ehenkesfor usb msd with scsi we use two separate QHs: QH_In and QH_Out because we fix it to the endpoints
  67. ehenkesbut with control transfers you send it to the default endpoint0
  68. pcmattmanOkay, that makes sense
  69. ehenkesmigrating from emulators to real hardware, the pci bus master (bit 2) was important, and the IO and MMIO bits (0 and 1)
  70. ehenkesbit 9 (0x0200) "Fast Back-to-Back Enable" was not necessary
  71. TobikingAnd the legacy support, with deactivation of the Interrupts for the BIOS
  72. Love4Boobiesyou guys may want stopping a bit
  73. ehenkesthis was hard at Tobikings notebook
  74. pcmattmanRight, we've got the bus master stuff set up
  75. ehenkesbecause the BIOS did not like to leave the EHCI ^^
  76. Love4BoobiesICH7 does have 64-bit structures...
  77. Love4Boobiesso we'd be able to fix this one
  78. ehenkesand, very important, you need some sleepMilliseconds(...) at real HW
  79. Love4Boobieshowever, matt's problem on the beagleboard is different
  80. Love4Boobiesand I've got similar results on a PC with a VIA chipset
  81. ehenkeswhat's the problem?
  82. Love4BoobiesSETUP works, IN fails
  83. Love4Boobiesexcept I don't get the port disabled, as matt does
  84. ehenkesyou use two separate QHs?
  85. pcmattmanWe do, and that's what I think the problem is
  86. ehenkestoggling is important
  87. Love4Boobieswe do that
  88. ehenkesdo you have the extended buffers at qTD?
  89. Love4Boobiesyou mean the ones with 64-bit addresses?
  90. pcmattmanThe beagleboard doesn't use the 64-bit data structures (checked the capabilities register)
  91. ehenkeshere: http://codepad.org/IgzSHvFc
  92. ehenkesyou need that for 32-bit-HW
  93. pcmattmanThe code however doesn't handle 64-bit data structures if they are enabled, which is probably part of the problem on x86
  94. Love4BoobiesI assume the VIA would also give a Host System Error or something similar, but it doesn't
  95. ehenkesTobiking: can you remember why you introduced these extended buffers into the qTD strutures?
  96. TobikingThe extended buffers are part of the 64 Bit Structures
  97. ehenkesIf you have further questions and need clarification about our source code you are always welcome at #PrettyOS
  98. pcmattmanThanks
  99. pcmattmanAnd thanks for your time, been very beneficial... once we have it figured out we'll be sorting out the asynchronous schedule live queue/dequeue as well, see what we can do to help out :)
  100. ehenkesthank you, I am very interested in discussing EHCI/USB2.0 because at the well-known forums you get nearly no answers.
  101. eddybehenkes: thanks, using structures with 64bit addressed solved part of the problem
  102. eddybthe rest of the problem is the same as for the beagleboard and VIA
  103. eddyboh, ffs
  104. ehenkesI'd be glad to support you a little bit by mastering your challenges
  105. kwolfpcmattman: Back to e1000.... What's so broken about it that it needs a rewrite?
  106. pcmattmanI'm not sure about any of the logic
  107. pcmattmanBut I'll read through the spec first and then come back to the code and see if it makes more sense
  108. eddyban equivalent to my rtl8139 driver :P ?
  109. eddyb(@"not sure about any of the logic")
  110. pcmattmanI'd say after refreshing myself on the spec things'll make a lot more sense
  111. pcmattmanUsually means less rewrite :)
  112. kwolfYou mean the initialisation part or sending/receiving packets?
  113. kwolfOr probably both
  114. pcmattmanI think init is right, mainly send/recv
  115. kwolfWell, your last patch was about the init (getting the MAC) and it's not in yet. So that's certainly an issue, too.
  116. pcmattmanIt seems to get a MAC fine on VMware (82545 chip)
  117. kwolfHm, so why did you work on it? Was it VBox?
  118. pcmattmanI believe it was vbox
  119. kwolfAnd of course nobody ever has really tried on real hardware.
  120. pcmattmanNote that it doesn't send or receive packets on vmware, just gets a MA
  121. kwolfThat kind of supports the theory of broken send/receive ;-)
  122. pcmattman*MAC
  123. kwolfOk, so I'll try to get the patch for VBox cleaned up and applied, and you take care for VMware.
  124. pcmattmanSounds good
  125. kwolfHm, no replies on the mailing list. Seems I need to check out IRC logs to find what the problem with the patch was...
  126. pcmattmanHeh
  127. kwolfI should stop discussing patches in IRC
  128. pcmattmanI'm off, night all
  129. XanClicnight
  130. kwolfNight