diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-12 00:24:04 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-12 00:24:04 -0400 |
commit | 4ca8c6169f1e7419aa39b97345b732c91119e353 (patch) | |
tree | 84d33709e7b916f8222450c284d91231072971ab /src/sys/io/ic | |
parent | 2fcbcb7bc7908aace05594afaa13b692292d0ceb (diff) |
kern: ahci: Enable PCI MMIO and bus mastering
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/io/ic')
-rw-r--r-- | src/sys/io/ic/ahci.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 @@ -477,6 +477,24 @@ ahci_hba_init(struct ahci_hba *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 * ourself to the PCI driver. @@ -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); } |