From ec64baba95195e4e124e4c9112fd286677f6fce5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 11 Oct 2025 19:54:48 -0400 Subject: kern: usb: Extract HCSPARAMS1 register fields Signed-off-by: Ian Moffett --- src/sys/include/io/usb/xhciregs.h | 9 +++++++++ src/sys/include/io/usb/xhcivar.h | 6 ++++++ 2 files changed, 15 insertions(+) (limited to 'src/sys/include') diff --git a/src/sys/include/io/usb/xhciregs.h b/src/sys/include/io/usb/xhciregs.h index 85a8630..726d883 100644 --- a/src/sys/include/io/usb/xhciregs.h +++ b/src/sys/include/io/usb/xhciregs.h @@ -84,6 +84,15 @@ struct __packed xhci_opregs { */ #define USBSTS_CNR BIT(11) /* Controller not ready */ +/* + * USB structural parameters 1 register bits + * + * See section 5.3.3 of the xHCI spec + */ +#define HCSPARAMS1_MAXSLOTS(HCSPARAMS1) ((HCSPARAMS1) & 0xFF) +#define HCSPARAMS1_MAXINTRS(HCSPARAMS1) (((HCSPARAMS1) >> 8) & 0x7FF) +#define HCSPARAMS1_MAXPORTS(HCSPARAMS1) (((HCSPARAMS1) >> 24) & 0xFF) + /* * Macros to get various register spaces */ diff --git a/src/sys/include/io/usb/xhcivar.h b/src/sys/include/io/usb/xhcivar.h index c0b3a39..bc5f59b 100644 --- a/src/sys/include/io/usb/xhcivar.h +++ b/src/sys/include/io/usb/xhcivar.h @@ -37,9 +37,15 @@ * Represents the host controller * * @io: I/O space + * @max_slots: Max device slots + * @max_intrs: Max interrupters + * @max_ports: Max ports */ struct xhci_hcd { struct xhci_capregs *capspace; + uint8_t max_slots; + uint32_t max_intrs; + uint32_t max_ports; }; #define XHCI_TIMEOUT_MSEC 500 -- cgit v1.2.3