summaryrefslogtreecommitdiff
path: root/sys/dev/usb/xhci.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-06-06 12:38:39 -0400
committerIan Moffett <ian@osmora.org>2025-06-06 12:38:39 -0400
commitf71d200e8857e3a9d44df9d752b8c6e7f281de84 (patch)
tree5278c9ae10d1661f0848b9241a2be066a27c2ffb /sys/dev/usb/xhci.c
parentd5cfd47668b3ba5de4ba03caef902fee570a5c0b (diff)
kernel: xhci: Allocate n bytes for scratchpad
Allocate in bytes rather than pages to keep things simple and fix broken logic. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev/usb/xhci.c')
-rw-r--r--sys/dev/usb/xhci.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index 2b55f16..46ec4af 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -176,7 +176,7 @@ xhci_init_scratchpads(struct xhci_hc *hc)
struct xhci_caps *caps = XHCI_CAPS(hc->base);
uint16_t max_bufs_lo, max_bufs_hi;
uint16_t max_bufs;
- uint32_t npages;
+ size_t len;
uintptr_t *bufarr, tmp;
max_bufs_lo = XHCI_MAX_SP_LO(caps->hcsparams1);
@@ -190,9 +190,9 @@ xhci_init_scratchpads(struct xhci_hc *hc)
return 0;
}
- npages = (sizeof(uint64_t) * max_bufs) / DEFAULT_PAGESIZE;
- pr_trace("using %d pages for xHC scratchpads\n", npages);
- bufarr = dynalloc_memalign(npages * DEFAULT_PAGESIZE, 0x1000);
+ len = sizeof(uint64_t) * max_bufs;
+ pr_trace("using %d bytes for xHC scratchpads\n", len);
+ bufarr = dynalloc_memalign(len, 0x1000);
if (bufarr == NULL) {
pr_error("failed to allocate scratchpad buffer array\n");
return -1;