From 06bb9887b48a560246ac9c580aff3e1234b3360e Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 30 Oct 2016 08:25:03 -0500 Subject: [PATCH] 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. --- src/add-ons/kernel/busses/usb/xhci.cpp | 3 +++ src/add-ons/kernel/busses/usb/xhci_hardware.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/busses/usb/xhci.cpp b/src/add-ons/kernel/busses/usb/xhci.cpp index 81673f5f6c..c659b4ecc8 100644 --- a/src/add-ons/kernel/busses/usb/xhci.cpp +++ b/src/add-ons/kernel/busses/usb/xhci.cpp @@ -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) { diff --git a/src/add-ons/kernel/busses/usb/xhci_hardware.h b/src/add-ons/kernel/busses/usb/xhci_hardware.h index 23aae2797b..51987f95ef 100644 --- a/src/add-ons/kernel/busses/usb/xhci_hardware.h +++ b/src/add-ons/kernel/busses/usb/xhci_hardware.h @@ -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)