Don't take ownership by writing the OS-owned semaphore when the BIOS-owned flag

isn't set. I'd tend to say that's a rather odd interpretation of the specified
protocol if a BIOS goes mad if the sem is written to while it doesn't actually
own the controller (it should just be a no-op in that case and directly set the
sem state). But it seems this is what others do as well (FreeBSD, Linux) so we
follow. Thanks to vegardw in #2083 for researching into this and proposing this
fix. Minor other cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35780 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2010-03-07 22:46:11 +00:00
parent 98d5d91cbf
commit 2cf04ca728
1 changed files with 14 additions and 12 deletions

View File

@ -181,22 +181,24 @@ EHCI::EHCI(pci_info *info, Stack *stack)
uint32 legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus, uint32 legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus,
fPCIInfo->device, fPCIInfo->function, extendedCapPointer, 4); fPCIInfo->device, fPCIInfo->function, extendedCapPointer, 4);
if ((legacySupport & EHCI_LEGSUP_CAPID_MASK) == EHCI_LEGSUP_CAPID) { if ((legacySupport & EHCI_LEGSUP_CAPID_MASK) == EHCI_LEGSUP_CAPID) {
if (legacySupport & EHCI_LEGSUP_BIOSOWNED) if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) != 0) {
TRACE_ALWAYS("the host controller is bios owned\n"); TRACE_ALWAYS("the host controller is bios owned, claiming"
" ownership\n");
TRACE_ALWAYS("claiming ownership of the host controller\n");
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 3, 1, 1); fPCIInfo->function, extendedCapPointer + 3, 1, 1);
for (int32 i = 0; i < 20; i++) { for (int32 i = 0; i < 20; i++) {
legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus, legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus,
fPCIInfo->device, fPCIInfo->function, extendedCapPointer, 4); fPCIInfo->device, fPCIInfo->function,
extendedCapPointer, 4);
if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) == 0)
break;
if (legacySupport & EHCI_LEGSUP_BIOSOWNED) {
TRACE_ALWAYS("controller is still bios owned, waiting\n"); TRACE_ALWAYS("controller is still bios owned, waiting\n");
snooze(50000); snooze(50000);
} else }
break;
} }
if (legacySupport & EHCI_LEGSUP_BIOSOWNED) { if (legacySupport & EHCI_LEGSUP_BIOSOWNED) {