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/io/usb/hcd/xhci.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/sys/io') diff --git a/src/sys/io/usb/hcd/xhci.c b/src/sys/io/usb/hcd/xhci.c index f363bcf..0125e96 100644 --- a/src/sys/io/usb/hcd/xhci.c +++ b/src/sys/io/usb/hcd/xhci.c @@ -137,7 +137,8 @@ static int xhci_init_hc(struct xhci_hcd *hcd) { struct xhci_opregs *opregs; - uint32_t usbcmd; + struct xhci_capregs *capspace; + uint32_t usbcmd, hcsparams1; int error; if (hcd == NULL) { @@ -147,6 +148,17 @@ xhci_init_hc(struct xhci_hcd *hcd) if ((error = xhci_reset_hc(hcd)) < 0) { return error; } + + if ((capspace = hcd->capspace) == NULL) { + return -EIO; + } + + /* Get the structural params 1 */ + opregs = XHCI_OPBASE(capspace); + hcsparams1 = mmio_read32(&capspace->hcsparams1); + hcd->max_slots = HCSPARAMS1_MAXSLOTS(hcsparams1); + hcd->max_intrs = HCSPARAMS1_MAXINTRS(hcsparams1); + hcd->max_ports = HCSPARAMS1_MAXPORTS(hcsparams1); return 0; } -- cgit v1.2.3