From 38043245f0b186421c355cce327d2567dd19f8e9 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 22 Sep 2025 13:11:08 -0400 Subject: kern: ahci: Keep track of number of command slots Signed-off-by: Ian Moffett --- src/sys/include/io/ic/ahcivar.h | 2 ++ src/sys/io/ic/ahci.c | 1 + 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/sys/include/io/ic/ahcivar.h b/src/sys/include/io/ic/ahcivar.h index a07f75d..c3cb70d 100644 --- a/src/sys/include/io/ic/ahcivar.h +++ b/src/sys/include/io/ic/ahcivar.h @@ -39,6 +39,7 @@ * @io: HBA register space * @pi: Ports implemented * @nport: Number of ports supported + * @nslots: Number of command slots * * XXX: Just because 'n' ports are _supported_ by the HBA does * not mean the host will implement exactly 'n' ports. @@ -47,6 +48,7 @@ struct ahci_hba { volatile struct hba_memspace *io; uint32_t pi; uint32_t nport; + uint8_t nslots; }; /* diff --git a/src/sys/io/ic/ahci.c b/src/sys/io/ic/ahci.c index 5cc675f..9c56993 100644 --- a/src/sys/io/ic/ahci.c +++ b/src/sys/io/ic/ahci.c @@ -285,6 +285,7 @@ ahci_hba_init(struct ahci_hba *hba) cap = mmio_read32(&io->cap); hba->pi = mmio_read32(&io->pi); hba->nport = AHCI_CAP_NP(cap) + 1; + hba->nslots = AHCI_CAP_NCS(cap) + 1; /* Only support 64-bit addressing as of now */ if (AHCI_CAP_S64A(cap) == 0) { -- cgit v1.2.3