XHCI Legacy

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

XHCI Legacy

Post 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
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: XHCI Legacy

Post 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.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: XHCI Legacy

Post 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?
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: XHCI Legacy

Post by Korona »

Yes.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: XHCI Legacy

Post 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
bigbob
Member
Member
Posts: 122
Joined: Tue Oct 01, 2013 2:50 am
Location: Budapest, Hungary
Contact:

Re: XHCI Legacy

Post 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. :)
Korona
Member
Member
Posts: 1000
Joined: Thu May 17, 2007 1:27 pm
Contact:

Re: XHCI Legacy

Post 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.
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].
Post Reply