Page 1 of 1

XHCI Legacy

Posted: Sun Jul 30, 2017 2:28 am
by bigbob
I had some time to work on my XHCI-driver (in intel assembly).
I still don't get the Device Descriptor, but SetAddress returns with OK.

I have a problem with the Legacy Support.
IDs of Extended Capabilities:
VirtualBox: 02 02 (so there are two "Supported Protocol"-entries)
Dell Inspiron 5559: 02 02 C0 01 C6 C7 C2 0A C3 C4 C5

As it can be seen above, there is no ID=1, so VirtualBox provides no Legacy Support.
Lunt says in his book(1st ed. page 9-9) that if the Legacy Support is found, then it must be the first item in the list.
That's why the 01 in case of Dell Inspiron 5559 shouldn't be Legacy Support (!?).
According to the XHCI-specs (7.1): "The USB Legacy Support provided by the xHC is optional normative functionality ...".

The question is how can I turn off Legacy Support, if it is not present in the list of Extended Capabilities?

I have a working EHCI-driver (can read/write files from/to pendrives), so turning off Legacy Support works for me in case of EHCI.

Regards,
rob

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 5:31 am
by Korona
If there is no USB Legacy Support Extended Capability (ID 0x01) then the XHCI does not implement legacy support. Thus it does not need to be turned off. If it is present you need to acquire the OS-BIOS semaphore, similar to EHCI.

I don't see where the spec states that capability 0x01 has to be the first capability.

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 5:58 am
by bigbob
Korona wrote:Thus it does not need to be turned off.
So, does this mean, that BIOS won't interfere, if Legacy-Support is not present in the ExtCaps?

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 7:04 am
by Korona
Yes.

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 12:17 pm
by BenLunt
Korona wrote:I don't see where the spec states that capability 0x01 has to be the first capability.
Section 7.1.1 in version 1.1
"This register is an xHCI extended capability register. It includes a specific function section and a pointer
to the next xHCI Extended Capability. This register is used by pre-OS software (BIOS) and the operating
system to coordinate ownership of the xHC."

It is used as a start for the extended capabilities list and is at offset "xECP + 00h".

Therefore, it is pretty much required to be present. I don't know of any xHCI implementation that does not support Legacy Support, but it has been a few months since I have worked with USB.

Ben
http://www.fysnet.net/the_universal_serial_bus.htm

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 12:35 pm
by bigbob
BenLunt wrote: It is used as a start for the extended capabilities list and is at offset "xECP + 00h".

Therefore, it is pretty much required to be present.
Thanks Ben.
I checked my code many times but it still seems that there is no xhci-Legacy-Support in virtualbox.
As for the Dell-Inspiron, I will check that ID=1 which is not at xECP+00h.

Sooner or later I will have working xHCI-driver. :)

Re: XHCI Legacy

Posted: Sun Jul 30, 2017 2:05 pm
by Korona
BenLunt wrote:It is used as a start for the extended capabilities list and is at offset "xECP + 00h".
Even though that says xECP I think they mean "start of the capability" and not the literal xECP register here. I might be wrong though.

XHCIs on PCI expansion cards will probably not provide legacy support. I don't think there is a PCIe packet that causes the system to enter SMM; therefore those cards should be unable to implement legacy support.