diff options
author | Ian Moffett <ian@osmora.org> | 2025-05-10 00:00:19 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-05-10 00:34:30 -0400 |
commit | 822b5927a5072283ef787ea13186038ec0f46524 (patch) | |
tree | b903178e0bd0a321c6366f1be3b0ce3ca76bf48f | |
parent | c07c372a7365c8be61e60a99860db960b4bdac95 (diff) |
kernel: ahci: Ensure bus mastering + MMIO is set
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/dev/ic/ahci.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index 37b35ec..d6428c9 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -35,6 +35,7 @@ #include <sys/bitops.h> #include <sys/mmio.h> #include <dev/pci/pci.h> +#include <dev/pci/pciregs.h> #include <dev/timer.h> #include <dev/ic/ahcivar.h> #include <dev/ic/ahciregs.h> @@ -590,6 +591,20 @@ ahci_hba_init(struct ahci_hba *hba) return 0; } +/* + * Init PCI related controller bits + */ +static void +ahci_init_pci(void) +{ + uint32_t tmp; + + /* Enable bus mastering and MMIO */ + tmp = pci_readl(ahci_dev, PCIREG_CMDSTATUS); + tmp |= (PCI_BUS_MASTERING | PCI_MEM_SPACE); + pci_writel(ahci_dev, PCIREG_CMDSTATUS, tmp); +} + static int ahci_init(void) { @@ -642,6 +657,7 @@ ahci_init(void) return status; } + ahci_init_pci(); hba.io = (struct hba_memspace*)abar_vap; ahci_hba_init(&hba); return 0; |