From 4ca8c6169f1e7419aa39b97345b732c91119e353 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 12 Oct 2025 00:24:04 -0400 Subject: kern: ahci: Enable PCI MMIO and bus mastering Signed-off-by: Ian Moffett --- src/sys/io/ic/ahci.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/sys') diff --git a/src/sys/io/ic/ahci.c b/src/sys/io/ic/ahci.c index 95cfbda..2b040d7 100644 --- a/src/sys/io/ic/ahci.c +++ b/src/sys/io/ic/ahci.c @@ -476,6 +476,24 @@ ahci_hba_init(struct ahci_hba *hba) return ahci_init_ports(hba); } +/* + * Initialize bus mastering and MMIO for the host + * bus adapter + */ +static void +ahci_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); +} + /* * Initialize only the AHCI driver's state rather than * the hardware it covers. This is used so we can advertise @@ -529,6 +547,7 @@ ahci_attach(struct pci_adv *adv) return error; } + ahci_pci_init(&dev); root_hba.io = (void *)bs.va_base; return ahci_hba_init(&root_hba); } -- cgit v1.2.3