xhci: Check and report interface version

* We could also check to make sure it isn't 0xffff and
  bail if it is... not really a solution but helps
  prevent kdl's if our mapped memory is corrupted.
* That seems like more of a hack though, i'd like to
  solve the real problem.
This commit is contained in:
Alexander von Gluck IV 2016-10-30 08:25:03 -05:00
parent 65f5e1e1b2
commit 06bb9887b4
2 changed files with 5 additions and 1 deletions

View File

@ -185,6 +185,8 @@ XHCI::XHCI(pci_info *info, Stack *stack)
TRACE("mapped runtime registers: 0x%p\n", fRuntimeRegisters);
TRACE("mapped doorbell registers: 0x%p\n", fDoorbellRegisters);
TRACE("interface version: 0x%04" B_PRIx32 "\n",
HCI_VERSION(ReadCapReg32(XHCI_HCI_VERSION)));
TRACE("structural parameters1: 0x%08" B_PRIx32 "\n",
ReadCapReg32(XHCI_HCSPARAMS1));
TRACE("structural parameters2: 0x%08" B_PRIx32 "\n",
@ -195,6 +197,7 @@ XHCI::XHCI(pci_info *info, Stack *stack)
ReadCapReg32(XHCI_HCCPARAMS));
uint32 cparams = ReadCapReg32(XHCI_HCCPARAMS);
uint32 eec = 0xffffffff;
uint32 eecp = HCS0_XECP(cparams) << 2;
for (; eecp != 0 && XECP_NEXT(eec); eecp += XECP_NEXT(eec) << 2) {

View File

@ -28,7 +28,8 @@
// Host Controller Capability Registers
#define XHCI_HCI_CAPLENGTH 0x00 // HCI Capability Register Length
#define HCI_CAPLENGTH(p) (((p) >> 0) & 0xff)
#define HCI_VERSION(p) (((p) >> 16) & 0xffff) // HCI Version
#define XHCI_HCI_VERSION 0x02 // HCI Interface Version Number
#define HCI_VERSION(p) (((p) >> 0) & 0xffff)
#define XHCI_HCSPARAMS1 0x04 // Structural Parameters 1
// HCSPARAMS1
#define HCS_MAX_SLOTS(p) (((p) >> 0) & 0xff)