From 5fb5b80ca4aed97ef01858bfc19a9e752dd25e83 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 26 May 2025 02:03:44 -0400 Subject: kernel: ahci: Add ahci_dev_bsize() Signed-off-by: Ian Moffett --- sys/dev/ic/ahci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sys/dev/ic') diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index c7ef2cc..d07acd7 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -711,6 +711,21 @@ ahci_dev_write(dev_t dev, struct sio_txn *sio, int flags) return sata_dev_rw(dev, sio, true); } +/* + * Device interface number of blocks + */ +static int +ahci_dev_bsize(dev_t dev) +{ + struct hba_device *dp; + + if ((dp = ahci_get_dev(dev)) == NULL) { + return -ENODEV; + } + + return dp->nlba; +} + /* * Initialize a drive on an HBA port * @@ -1000,6 +1015,7 @@ ahci_init(void) static struct bdevsw ahci_bdevsw = { .read = ahci_dev_read, .write = ahci_dev_write, + .bsize = ahci_dev_bsize }; DRIVER_EXPORT(ahci_init); -- cgit v1.2.3