From 08d925bce8a18361655a56bf5b38d6f9e9134b8a Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 26 May 2025 01:49:45 -0400 Subject: kernel: ahci: Detect max SATA sector count Signed-off-by: Ian Moffett --- sys/dev/ic/ahci.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/dev/ic') 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; -- cgit v1.2.3