Skip to content

Commit

Permalink
Revert "EHCI USB: process the extended capabilities chain"
Browse files Browse the repository at this point in the history
This reverts commit 137135a.

Change-Id: I6e6ef1933b3b3f5eda7278d37b673eefe2867c2a
  • Loading branch information
korli committed Mar 12, 2018
1 parent 137135a commit c91002a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
69 changes: 35 additions & 34 deletions src/add-ons/kernel/busses/usb/ehci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

uint32 legacySupport = eec;
sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device,
fPCIInfo->function, extendedCapPointer + 3, 1, 1);

if ((legacySupport & EHCI_LEGSUP_BIOSOWNED) != 0) {
TRACE_ALWAYS("the host controller is bios owned, claiming"
" ownership\n");

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);

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;

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) {
TRACE_ALWAYS(
"successfully took ownership of the host controller\n");
}
}

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) {
// 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
Expand Down
1 change: 0 additions & 1 deletion src/add-ons/kernel/busses/usb/ehci_hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c91002a

Please sign in to comment.