XHCI: If the capability parameters are invalid, bail.

This is the cause of #14557. It seems that OpenBSD does the same thing.
I didn't read the spec yet to determine precisely what this means,
so for now, just do what OpenBSD does and bail.

This only seems to happen with a secondary XHCI controller on that
device, so hopefully most USB ports will still work.
This commit is contained in:
Augustin Cavalier
2019-04-14 22:05:47 -04:00
parent fa84c61a81
commit 716ccf0492
+4
View File
@@ -271,12 +271,16 @@ XHCI::XHCI(pci_info *info, Stack *stack)
TRACE_ALWAYS("structural parameters: 1:0x%08" B_PRIx32 " 2:0x%08"
B_PRIx32 " 3:0x%08" B_PRIx32 "\n", ReadCapReg32(XHCI_HCSPARAMS1),
ReadCapReg32(XHCI_HCSPARAMS2), ReadCapReg32(XHCI_HCSPARAMS3));
uint32 cparams = ReadCapReg32(XHCI_HCCPARAMS);
if (cparams == 0xffffffff)
return;
TRACE_ALWAYS("capability params: 0x%08" B_PRIx32 "\n", cparams);
// if 64 bytes context structures, then 1
fContextSizeShift = HCC_CSZ(cparams);
// Assume ownership of the controller from the BIOS.
uint32 eec = 0xffffffff;
uint32 eecp = HCS0_XECP(cparams) << 2;
for (; eecp != 0 && XECP_NEXT(eec); eecp += XECP_NEXT(eec) << 2) {