From eea92b9a330fb12e59dcfbd897729d2bab9b2d13 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 21 May 2025 16:45:02 -0400 Subject: kernel: xhci: Add runtime register offset defines Signed-off-by: Ian Moffett --- sys/dev/usb/xhci.c | 10 +++++----- sys/include/dev/usb/xhciregs.h | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index f5b7a13..9ab109a 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -255,7 +255,7 @@ xhci_init_evring(struct xhci_hc *hc) memset(segtab, 0, DEFAULT_PAGESIZE); /* Set the size of the event ring segment table */ - erst_size = PTR_OFFSET(runtime, 0x28); + erst_size = PTR_OFFSET(runtime, XHCI_RT_ERSTSZ); mmio_write32(erst_size, 1); /* Allocate the event ring segment */ @@ -269,20 +269,20 @@ xhci_init_evring(struct xhci_hc *hc) segtab->size = XHCI_EVRING_LEN; /* Setup the event ring dequeue pointer */ - erdp = PTR_OFFSET(runtime, 0x38); + erdp = PTR_OFFSET(runtime, XHCI_RT_ERDP); mmio_write64(erdp, segtab->base); /* Point ERSTBA to our event ring segment */ - erstba = PTR_OFFSET(runtime, 0x30); + erstba = PTR_OFFSET(runtime, XHCI_RT_ERSTBA); mmio_write64(erstba, VIRT_TO_PHYS(segtab)); hc->evring = PHYS_TO_VIRT(segtab->base); /* Setup interrupt moderation */ - imod = PTR_OFFSET(runtime, 0x24); + imod = PTR_OFFSET(runtime, XHCI_RT_IMOD); mmio_write32(imod, XHCI_IMOD_DEFAULT); /* Enable interrupts */ - iman = PTR_OFFSET(runtime, 0x20); + iman = PTR_OFFSET(runtime, XHCI_RT_IMAN); tmp = mmio_read32(iman); mmio_write32(iman, tmp | XHCI_IMAN_IE); } diff --git a/sys/include/dev/usb/xhciregs.h b/sys/include/dev/usb/xhciregs.h index 69515e4..1cbfd14 100644 --- a/sys/include/dev/usb/xhciregs.h +++ b/sys/include/dev/usb/xhciregs.h @@ -98,6 +98,13 @@ struct xhci_opregs { #define XHCI_RTS(BASE, RTSOFF) PTR_OFFSET(BASE, RTSOFF) #define XHCI_CMD_DB(BASE, DBOFF) PTR_OFFSET(BASE, DBOFF) +/* Runtime register offsets */ +#define XHCI_RT_IMAN 0x20 +#define XHCI_RT_IMOD 0x24 +#define XHCI_RT_ERSTSZ 0x28 +#define XHCI_RT_ERSTBA 0x30 +#define XHCI_RT_ERDP 0x38 + /* Support protocol cap fields */ #define XHCI_PROTO_ID(PROTO) (PROTO & 0xFF) #define XHCI_PROTO_MINOR(PROTO) ((PROTO >> 16) & 0xFF) -- cgit v1.2.3