diff options
author | Ian Moffett <ian@osmora.org> | 2025-05-26 01:49:45 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-05-26 01:50:28 -0400 |
commit | 08d925bce8a18361655a56bf5b38d6f9e9134b8a (patch) | |
tree | 0d5f58926f6b935e5f75d3eee5c6da3c05498e52 /sys | |
parent | d2ae9910bd6d5d4d2bd79cd2c835d6ca1a64364c (diff) |
kernel: ahci: Detect max SATA sector count
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ahci.c | 4 | ||||
-rw-r--r-- | sys/include/dev/ic/ahcivar.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index d88274a..669b936 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -435,6 +435,7 @@ ahci_identify(struct ahci_hba *hba, struct hba_device *dp) struct ahci_cmd_hdr *cmdhdr; struct ahci_cmdtab *cmdtbl; struct ahci_fis_h2d *fis; + uint16_t *p; int cmdslot, status; buf = vm_alloc_frame(1); @@ -475,6 +476,9 @@ ahci_identify(struct ahci_hba *hba, struct hba_device *dp) } ahci_dump_identity(PHYS_TO_VIRT(buf)); + p = (uint16_t *)PHYS_TO_VIRT(buf); + dp->nlba = (p[61] << 16) | p[60]; + pr_trace("max block size: %d\n", dp->nlba); done: vm_free_frame(buf, 1); return status; diff --git a/sys/include/dev/ic/ahcivar.h b/sys/include/dev/ic/ahcivar.h index a23a654..67f2efe 100644 --- a/sys/include/dev/ic/ahcivar.h +++ b/sys/include/dev/ic/ahcivar.h @@ -96,6 +96,7 @@ struct ahci_hba { * @io: Memory mapped port registers * @hba: HBA descriptor * @cmdlist: Command list [p] + * @nlba: Max number of addressable blocks * @fra: FIS receive area [p] * @dev: Device minor number. */ @@ -104,6 +105,7 @@ struct hba_device { struct ahci_hba *hba; struct ahci_cmd_hdr *cmdlist; struct dcdr *dcdr; + uint32_t nlba; void *fra; dev_t dev; }; |