From f07c51164e75ffa25b570e2233713b5a2cfa275a Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 11 Oct 2025 18:54:34 -0400 Subject: kern: xhci: Implement controller hard reset Signed-off-by: Ian Moffett --- src/sys/include/io/usb/xhciregs.h | 14 ++++++++++++++ src/sys/include/io/usb/xhcivar.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/sys/include/io') diff --git a/src/sys/include/io/usb/xhciregs.h b/src/sys/include/io/usb/xhciregs.h index f2e572b..f849c54 100644 --- a/src/sys/include/io/usb/xhciregs.h +++ b/src/sys/include/io/usb/xhciregs.h @@ -32,6 +32,7 @@ #include #include +#include /* * XHCI capability registers @@ -69,4 +70,17 @@ struct __packed xhci_opregs { volatile uint32_t reserved2; }; +/* + * USB command register bits + * + * See section 5.4.1 of the xHCI spec + */ +#define USBCMD_HCRST BIT(1) + +/* + * Macros to get various register spaces + */ +#define XHCI_OPBASE(CAPBASE) \ + PTR_OFFSET(CAPBASE, (CAPBASE)->caplength) + #endif /* !_XHCIREGS_H_ */ diff --git a/src/sys/include/io/usb/xhcivar.h b/src/sys/include/io/usb/xhcivar.h index 5067063..c0b3a39 100644 --- a/src/sys/include/io/usb/xhcivar.h +++ b/src/sys/include/io/usb/xhcivar.h @@ -39,7 +39,9 @@ * @io: I/O space */ struct xhci_hcd { - volatile void *io; + struct xhci_capregs *capspace; }; +#define XHCI_TIMEOUT_MSEC 500 + #endif /* !_USB_XHCIVAR_H_ */ -- cgit v1.2.3