aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-02-20 10:33:00 -0500
committerIan Moffett <ian@osmora.org>2025-02-20 10:33:00 -0500
commit6018ed09c35b35343cf64133529850ddc8071138 (patch)
tree5444309f08d049df47bf4781db305f67f029ee6f
parent6ba33d4705896501fb0b042c8986742fb4ed7ae7 (diff)
kernel: ahci: Ensure HBA is AHCI aware
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/dev/ic/ahci.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c
index 027ad66..ec7e68a 100644
--- a/sys/dev/ic/ahci.c
+++ b/sys/dev/ic/ahci.c
@@ -117,7 +117,9 @@ ahci_hba_reset(struct ahci_hba *hba)
static int
ahci_hba_init(struct ahci_hba *hba)
{
+ struct hba_memspace *abar = hba->io;
int error;
+ uint32_t tmp;
/*
* God knows what state the HBA is in by the time
@@ -130,6 +132,16 @@ ahci_hba_init(struct ahci_hba *hba)
}
pr_trace("Successfully performed a hard reset.\n");
+
+ /*
+ * The HBA provides backwards compatibility with
+ * legacy ATA mechanisms (e.g., SFF-8038i), therefore
+ * in order for this driver to work we need to ensure
+ * the HBA is AHCI aware.
+ */
+ tmp = mmio_read32(&abar->ghc);
+ tmp |= AHCI_GHC_AE;
+ mmio_write32(&abar->ghc, tmp);
return 0;
}