#tyndur · 2010-07-20
330 Nachrichten · Seite 2 von 2 · Original-CSV herunterladen
- pcmattmanWe're kind of stupid like that
- pcmattman;)
- kwolfYou definitely need to change that some time ;-)
- ehenkesfirst: we decided to develop a driver for EHCI w/o having one for UHCI and OHCI
- ehenkesthis is possible, the only device nedding UHCI is the ubs-mouse
- ehenkesour base for development was the EHCI spec 1.0
- ehenkeswe went thru it step-by-step and developed our own code.
- 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
- ehenkesI am going to refer to it
- pcmattmanRight
- ehenkesthe code for EHCI you'll find there: https://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/ehci.c
- ehenkesand ...
- ehenkeshttps://prettyos.svn.sourceforge.net/svnroot/prettyos/trunk/Source/kernel/ehciQHqTD.c
- ehenkesa little bit tricky is the interrupt handling
- ehenkesthe DeactivateLegacySupport
- pcmattmanOkay, got the code up
- pcmattmanOut of interest, does all this work on real hardware, or just in emulators?
- ehenkesreal hardware
- Love4Boobiesmay I ask what boxes?
- ehenkesThe qH/qTD-transfer is not optimized, we are doing start 'n' stop
- ehenkesboxes?
- Love4Boobiesas in, what machines
- Love4Boobies* did you test on
- TobikingIt's working on my laptop with an ich7 chipset
- ehenkesok, you need an EHCI, see that during pci-scan
- Love4Boobiesoh, thanks, good to know
- 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
- ehenkesthe EHCI is the base for high speed usb
- ehenkesAt the time being, in our OS we address only root ports nor hubs
- pcmattmanSimplifies things a fair bit
- ehenkesat real PC you have to be careful with pci configuration to avoid host errors
- ehenkesinitEHCIHostController() <--- bus mastering
- ehenkeshttp://forum.osdev.org/viewtopic.php?f=1&t=20255&start=0
- pcmattmanRight, and on our PC and non-PC targets we've made sure the equivalent is configured correctly
- ehenkesand you need this extended buffers in qTD
- ehenkescf. allocQTDbuffer in ehciQHqTD.c
- ehenkesour weakest point is: performAsyncScheduler at ehciQHqTD.c
- ehenkesI'd appreciate if you could help us there to improve, i.e. to find the best path forward
- ehenkesbut it is working reliably
- pcmattmanChances are we can help out with perhaps even removing the stop/start when doing queue operations in the async schedule
- 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
- pcmattmanSpecifically, when setting a device address, the first SETUP transaction completes without error, and then the handshake IN transaction returns a transaction error
- pcmattmanYou wouldn't happen to have run into a similar problem before?
- ehenkesno, control transfers are easy
- TobikingThere was something not really specified if there needs to be an handshake qtd.
- ehenkesplease have a look at usbTransferEnumerate in usb2.c
- pcmattmanI have it open now
- ehenkesas you can see, we start with virtualAsyncList
- ehenkesthen we implement the qTD sequence, fix it to the QH
- ehenkeswe use setup amd handshake
- ehenkesbut I have to admit that I never understodd why we have to send ourselves a handshake ^^
- Love4Boobiescheck out the USB 2.0 docs
- ehenkesthen we performAsyncScheduler and free all the malloc'd memory space
- Love4Boobiesthe function usually send an error of the control request failed
- ehenkesMore complicated are the bulk transfers with scsi commands
- pcmattmanAnd performAsyncScheduler takes that QH and executes it, handling completion and error states... I see now
- ehenkesyes
- ehenkestime is important
- 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
- ehenkesbut the control transfers are fast
- Love4BoobiesNAK means device is busy, for example
- 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?
- ehenkesyes, we set the NAK counter to 15
- ehenkesbut if you set it to 0, it does not matter
- TobikingThe QH descriptes an endpoint, and the setup and handshake packet are send to the same endpoint. So I think they should be together
- ehenkesfor usb msd with scsi we use two separate QHs: QH_In and QH_Out because we fix it to the endpoints
- ehenkesbut with control transfers you send it to the default endpoint0
- pcmattmanOkay, that makes sense
- ehenkesmigrating from emulators to real hardware, the pci bus master (bit 2) was important, and the IO and MMIO bits (0 and 1)
- ehenkesbit 9 (0x0200) "Fast Back-to-Back Enable" was not necessary
- TobikingAnd the legacy support, with deactivation of the Interrupts for the BIOS
- Love4Boobiesyou guys may want stopping a bit
- ehenkesthis was hard at Tobikings notebook
- pcmattmanRight, we've got the bus master stuff set up
- ehenkesbecause the BIOS did not like to leave the EHCI ^^
- Love4BoobiesICH7 does have 64-bit structures...
- Love4Boobiesso we'd be able to fix this one
- ehenkesand, very important, you need some sleepMilliseconds(...) at real HW
- Love4Boobieshowever, matt's problem on the beagleboard is different
- Love4Boobiesand I've got similar results on a PC with a VIA chipset
- ehenkeswhat's the problem?
- Love4BoobiesSETUP works, IN fails
- Love4Boobiesexcept I don't get the port disabled, as matt does
- ehenkesyou use two separate QHs?
- pcmattmanWe do, and that's what I think the problem is
- ehenkestoggling is important
- Love4Boobieswe do that
- ehenkesdo you have the extended buffers at qTD?
- Love4Boobiesyou mean the ones with 64-bit addresses?
- pcmattmanThe beagleboard doesn't use the 64-bit data structures (checked the capabilities register)
- ehenkeshere: http://codepad.org/IgzSHvFc
- ehenkesyou need that for 32-bit-HW
- pcmattmanThe code however doesn't handle 64-bit data structures if they are enabled, which is probably part of the problem on x86
- Love4BoobiesI assume the VIA would also give a Host System Error or something similar, but it doesn't
- ehenkesTobiking: can you remember why you introduced these extended buffers into the qTD strutures?
- TobikingThe extended buffers are part of the 64 Bit Structures
- ehenkesIf you have further questions and need clarification about our source code you are always welcome at #PrettyOS
- pcmattmanThanks
- 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 :)
- ehenkesthank you, I am very interested in discussing EHCI/USB2.0 because at the well-known forums you get nearly no answers.
- eddybehenkes: thanks, using structures with 64bit addressed solved part of the problem
- eddybthe rest of the problem is the same as for the beagleboard and VIA
- eddyboh, ffs
- ehenkesI'd be glad to support you a little bit by mastering your challenges
- kwolfpcmattman: Back to e1000.... What's so broken about it that it needs a rewrite?
- pcmattmanI'm not sure about any of the logic
- pcmattmanBut I'll read through the spec first and then come back to the code and see if it makes more sense
- eddyban equivalent to my rtl8139 driver :P ?
- eddyb(@"not sure about any of the logic")
- pcmattmanI'd say after refreshing myself on the spec things'll make a lot more sense
- pcmattmanUsually means less rewrite :)
- kwolfYou mean the initialisation part or sending/receiving packets?
- kwolfOr probably both
- pcmattmanI think init is right, mainly send/recv
- kwolfWell, your last patch was about the init (getting the MAC) and it's not in yet. So that's certainly an issue, too.
- pcmattmanIt seems to get a MAC fine on VMware (82545 chip)
- kwolfHm, so why did you work on it? Was it VBox?
- pcmattmanI believe it was vbox
- kwolfAnd of course nobody ever has really tried on real hardware.
- pcmattmanNote that it doesn't send or receive packets on vmware, just gets a MA
- kwolfThat kind of supports the theory of broken send/receive ;-)
- pcmattman*MAC
- kwolfOk, so I'll try to get the patch for VBox cleaned up and applied, and you take care for VMware.
- pcmattmanSounds good
- kwolfHm, no replies on the mailing list. Seems I need to check out IRC logs to find what the problem with the patch was...
- pcmattmanHeh
- kwolfI should stop discussing patches in IRC
- pcmattmanI'm off, night all
- XanClicnight
- kwolfNight