summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ahci.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-05-13 23:39:55 -0400
committerIan Moffett <ian@osmora.org>2025-05-14 10:47:48 -0400
commitf470348df79c8dba142deccdbba74682ffc0c972 (patch)
tree9afdfc7eaddb61cbf8e38671816f41dbb0a72c77 /sys/dev/ic/ahci.c
parent97ae9fa52fa25e27e4917e26f7192a78764d54af (diff)
kernel: ahci: Add /ctl/sdx/bsize control filemain
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev/ic/ahci.c')
-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 246adde..8b72cde 100644
--- a/sys/dev/ic/ahci.c
+++ b/sys/dev/ic/ahci.c
@@ -42,6 +42,7 @@
#include <dev/ic/ahcivar.h>
#include <dev/ic/ahciregs.h>
#include <fs/devfs.h>
+#include <fs/ctlfs.h>
#include <vm/dynalloc.h>
#include <vm/physmem.h>
#include <string.h>
@@ -626,6 +627,7 @@ ahci_init_port(struct ahci_hba *hba, uint32_t portno)
struct hba_memspace *abar = hba->io;
struct hba_port *port;
struct hba_device *dp;
+ struct ctlfs_dev dev;
size_t clen, pagesz;
uint32_t lo, hi, ssts;
uint8_t det;
@@ -721,6 +723,16 @@ ahci_init_port(struct ahci_hba *hba, uint32_t portno)
/* Register the device */
dev_register(hba->major, dp->dev, &ahci_bdevsw);
pr_trace("drive @ /dev/%s\n", devname);
+
+ /* Register a control node */
+ dev.mode = 0444;
+ ctlfs_create_node(devname, &dev);
+ pr_trace("drive control @ /ctl/%s/\n", devname);
+
+ /* Register control files */
+ dev.devname = devname;
+ dev.ops = &g_sata_bsize_ops;
+ ctlfs_create_entry("bsize", &dev);
return devfs_create_entry(devname, hba->major, dp->dev, 0444);
}