summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-11 20:13:06 -0400
committerIan Moffett <ian@osmora.org>2025-10-11 20:13:52 -0400
commit6f7902208064d7c8c1f3cd559be36a90866005be (patch)
tree471f4bb718dd5194eeb742ebda8ec29b74bc7881
parent159ea725460754aee6df15733ee0da73e230e008 (diff)
kern: pci: Initialize PCI bus mastering + MMIO
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--src/sys/io/usb/hcd/xhci.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sys/io/usb/hcd/xhci.c b/src/sys/io/usb/hcd/xhci.c
index 0125e96..0582aaa 100644
--- a/src/sys/io/usb/hcd/xhci.c
+++ b/src/sys/io/usb/hcd/xhci.c
@@ -35,6 +35,7 @@
#include <os/clkdev.h>
#include <io/usb/xhcivar.h>
#include <io/usb/xhciregs.h>
+#include <io/pci/cam.h>
#include <io/pci/bar.h>
#include <io/pci/pci.h>
#include <os/module.h>
@@ -162,6 +163,20 @@ xhci_init_hc(struct xhci_hcd *hcd)
return 0;
}
+static void
+xhci_pci_init(struct pci_device *devp)
+{
+ uint32_t config;
+
+ if (devp == NULL) {
+ return;
+ }
+
+ config = pci_readl(devp, PCIREG_CMDSTATUS);
+ config |= PCI_BUS_MASTERING | PCI_MEM_SPACE;
+ pci_writel(devp, PCIREG_CMDSTATUS, config);
+}
+
static int
xhci_init(struct module *modp)
{
@@ -202,6 +217,7 @@ xhci_attach(struct pci_adv *ap)
return error;
}
+ xhci_pci_init(&dev);
hcd.capspace = bs.va_base;
return xhci_init_hc(&hcd);
}