From 822b5927a5072283ef787ea13186038ec0f46524 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 10 May 2025 00:00:19 -0400 Subject: kernel: ahci: Ensure bus mastering + MMIO is set Signed-off-by: Ian Moffett --- sys/dev/ic/ahci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sys') 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 #include #include +#include #include #include #include @@ -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; -- cgit v1.2.3