diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-04 17:51:21 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-04 17:51:21 -0400 |
commit | 961fb99ff22f50cfd3912e6458c9d4fbea86dbfb (patch) | |
tree | aa345b44dcfacfc77a1d8dd12e693d51bae5dbf6 /sys/dev | |
parent | 6ab929aa7bc5a3cdf0daba4ba1f0c9f2bbb68c9a (diff) |
kernel: xhci: Fix scratchpad page count
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/xhci.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 5276eea..2b55f16 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -176,6 +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; uintptr_t *bufarr, tmp; max_bufs_lo = XHCI_MAX_SP_LO(caps->hcsparams1); @@ -189,8 +190,9 @@ xhci_init_scratchpads(struct xhci_hc *hc) return 0; } - pr_trace("using %d pages for xHC scratchpads\n"); - bufarr = dynalloc_memalign(sizeof(uintptr_t)*max_bufs, 0x1000); + 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); if (bufarr == NULL) { pr_error("failed to allocate scratchpad buffer array\n"); return -1; |