Revert "EHCI USB: process the extended capabilities chain"

This reverts commit 137135a10d.

Change-Id: I6e6ef1933b3b3f5eda7278d37b673eefe2867c2a
This commit is contained in:
Jérôme Duval 2018-03-12 17:01:25 +00:00
parent 137135a10d
commit c91002a1db
2 changed files with 36 additions and 36 deletions

View File

@ -252,53 +252,54 @@ EHCI::EHCI(pci_info *info, Stack *stack)
uint32 extendedCapPointer = ReadCapReg32(EHCI_HCCPARAMS) >> EHCI_ECP_SHIFT;
extendedCapPointer &= EHCI_ECP_MASK;
for (uint32 eec = extendedCapPointer; eec != 0; extendedCapPointer = EHCI_EECP_NEXT(eec)) {
if (extendedCapPointer > 0) {
TRACE("extended capabilities register at %" B_PRIu32 "\n",
extendedCapPointer);
eec = sPCIModule->read_pci_config(fPCIInfo->bus,
uint32 legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus,
fPCIInfo->device, fPCIInfo->function, extendedCapPointer, 4);
if ((legacySupport & EHCI_LEGSUP_CAPID_MASK) == EHCI_LEGSUP_CAPID) {
if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) != 0) {
TRACE_ALWAYS("the host controller is bios owned, claiming"
" ownership\n");
if ((eec & EHCI_LEGSUP_CAPID_MASK) != EHCI_LEGSUP_CAPID)
continue;
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 3, 1, 1);
uint32 legacySupport = eec;
for (int32 i = 0; i < 20; i++) {
legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus,
fPCIInfo->device, fPCIInfo->function,
extendedCapPointer, 4);
if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) != 0) {
TRACE_ALWAYS("the host controller is bios owned, claiming"
" ownership\n");
if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) == 0)
break;
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 3, 1, 1);
for (int32 i = 0; i < 20; i++) {
legacySupport = sPCIModule->read_pci_config(fPCIInfo->bus,
fPCIInfo->device, fPCIInfo->function,
extendedCapPointer, 4);
if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) == 0)
break;
TRACE_ALWAYS("controller is still bios owned, waiting\n");
snooze(50000);
TRACE_ALWAYS("controller is still bios owned, waiting\n");
snooze(50000);
}
}
}
if (legacySupport & EHCI_LEGSUP_BIOSOWNED) {
TRACE_ERROR("bios won't give up control over the host "
"controller (ignoring)\n");
} else if (legacySupport & EHCI_LEGSUP_OSOWNED) {
if (legacySupport & EHCI_LEGSUP_BIOSOWNED) {
TRACE_ERROR("bios won't give up control over the host "
"controller (ignoring)\n");
} else if (legacySupport & EHCI_LEGSUP_OSOWNED) {
TRACE_ALWAYS(
"successfully took ownership of the host controller\n");
}
// Force off the BIOS owned flag, and clear all SMIs. Some BIOSes
// do indicate a successful handover but do not remove their SMIs
// and then freeze the system when interrupts are generated.
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 2, 1, 0);
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 4, 4, 0);
} else {
TRACE_ALWAYS(
"successfully took ownership of the host controller\n");
"extended capability is not a legacy support register\n");
}
// Force off the BIOS owned flag, and clear all SMIs. Some BIOSes
// do indicate a successful handover but do not remove their SMIs
// and then freeze the system when interrupts are generated.
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 2, 1, 0);
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 4, 4, 0);
} else {
TRACE_ALWAYS("no extended capabilities register\n");
}
// disable interrupts

View File

@ -103,7 +103,6 @@
// Extended Capabilities
#define EHCI_ECP_SHIFT 8 // Extended Capability Pointer
#define EHCI_ECP_MASK 0xff
#define EHCI_EECP_NEXT(x) (((x) >> 8) & 0xff)
#define EHCI_LEGSUP_CAPID_MASK 0xff
#define EHCI_LEGSUP_CAPID 0x01
#define EHCI_LEGSUP_OSOWNED (1 << 24) // OS Owned Semaphore