OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Nov 21, 2019 5:19 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: XHCI port detection
PostPosted: Wed Sep 11, 2019 2:27 pm 
Offline

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 12
Hello everyone,

I tried to detect ports on XHCI.
On virtual machine (BOCHS) it detects the ports as I expected but on real hardware it gives 0x00 as portstatus and when you go over the limit it shows 0x200.
https://github.com/AdeRegt/SanderOSUSB/ ... dev/xhci.c is the sourcecode.
What am I doing wrong?


Top
 Profile  
 
 Post subject: Re: XHCI port detection
PostPosted: Thu Sep 12, 2019 11:32 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 140
Bochs isnt support XHCI ports. Correct me if I am wrong. Maybe some wrong about PCI progif value with detection(for xhci 0x30)?


Top
 Profile  
 
 Post subject: Re: XHCI port detection
PostPosted: Thu Sep 12, 2019 11:35 am 
Offline

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 12
Bochs actually do support it, with an extension.
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1, gameport=1, usb_xhci=1
usb_xhci: enabled=1, port1="disk:/home/example/Downloads/mikeos-4.6b3/disk_images/mikeos.flp", options1=none, port2=none, options2=none


Top
 Profile  
 
 Post subject: Re: XHCI port detection
PostPosted: Sun Sep 15, 2019 12:46 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 570
Location: USA
Hi,

Yes, Bochs does indeed support, though minimally, xHCI. Please note though, it only support default settings, always on, no BIOS handoff, no SMI, doesn't even know what timing is, and understand only default and commonly used commands and functions. Enough to get most any operating system to recognize it and use a mouse, keyboard, and a thumb drive.

As for real hardware, this is a different story. Throughout all my research, I have found that depending on the manufacturer and style of machine the xHCI is install in, there are numerous inconsistencies when it comes to a "standard" xHCI. For example, some manufacturers wanted to be sure backward compatibility was a top priority. One machine I tested with had hardware that would be 100% compatible with EHCI until you told it to be xHCI using a vendor specific technique. I would see most problems--vendor specific, timing specific, or other specific items--with laptops. Most desktop forms of xHCI hardware would be mostly 100% compatible. When tested, my code would work on all desktop machines using an installed PCI xHCI card, or even one integrated to the Motherboard. However, this same code would fail 50% of the time when tried on laptops and the like.

So, my question for you and any others reading this is, what type of "read hardware" are you using?

Here are my suggestions:
1) Look up the motherboard/hardware specs for that specific machine and see if there are any "bits" in the PCI Configuration Space that you must set to make it 100% compatible.
2) Are there any Machine Specific Register settings you must set to make the xHCI compatible?
3) Do you have to power the card via ACPI?
4) Is the physical port powered? (A bit in one of the xHCI's port status registers)
5) Verify that you are reading from the correct physical address for the port. i.e.: as mentioned before, the Bochs' xHCI address space is a default, one space after another, address space. The physical card for your test machine may be different. If my memory serves, I have seen xHCI's reserve as little as 4k and as much as 16k address space. Does your memory manager/paging manager allow this access? Are you accessing the correct page?
6) Have you done the BIOS hand-off technique yet? If the SMI (System Management Interface) is still active, it may keep you from reading a correct value from the port.
7) Do you have interrupts enabled for the controller? The controller may require a valid interrupt to happen when a physical change has been made, i.e.: a port change status.

There are many other things to consider.

The actual hardware of the xHCI makes transfers much easier, almost ignoring the speed of the device, where as earlier hardware was more specific to the actual speed of the device. However, on the flip-side, the xHCI's setup is much more complicated than earlier hardware.

Anyway, my oppologies to everyone here for my absence. I have been busy with many other things, though I do miss the work and enjoyment of this hobby we have.

Enjoy your weekend,
Ben
- http://www.fysnet.net/osdesign_book_series.htm


Top
 Profile  
 
 Post subject: Re: XHCI port detection
PostPosted: Sun Sep 15, 2019 10:02 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 278
BenLunt wrote:
One machine I tested with had hardware that would be 100% compatible with EHCI until you told it to be xHCI using a vendor specific technique.
Well, that's mildly disconcerting. Was it at least reporting its Prog-IF as 0x20 while in EHCI mode?


Top
 Profile  
 
 Post subject: Re: XHCI port detection
PostPosted: Sun Oct 20, 2019 5:56 am 
Offline

Joined: Tue Aug 30, 2016 1:31 pm
Posts: 12
yes i had same problems with initialising EHCI devices trough the PCI. This was however on a other device.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: MSN [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group