summaryrefslogtreecommitdiff
path: root/src/sys/io
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-14 20:25:22 -0400
committerIan Moffett <ian@osmora.org>2025-10-14 20:25:22 -0400
commit58af5dfa5771045850be3086a2da18be44d3077a (patch)
tree5bc9c64af8e210531367ce5e6989bb2ef9136da6 /src/sys/io
parentaaa076ff1d68545085fb85ee24d5410b60a123bd (diff)
kern: ahci: Implement DMS read interface
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/io')
-rw-r--r--src/sys/io/ic/ahci.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/sys/io/ic/ahci.c b/src/sys/io/ic/ahci.c
index 48560a8..383e531 100644
--- a/src/sys/io/ic/ahci.c
+++ b/src/sys/io/ic/ahci.c
@@ -387,10 +387,10 @@ ahci_rw(struct ahci_hba *hba, struct ahci_port *port, struct bufargs *bufd)
}
/*
- * DMS write interface
+ * DMS read/write interface
*/
static ssize_t
-sata_write(struct dms_disk *dp, void *p, off_t off, size_t len)
+sata_rw(struct dms_disk *dp, void *p, off_t off, size_t len, bool rw)
{
struct bufargs bd;
struct ahci_port *port;
@@ -417,7 +417,7 @@ sata_write(struct dms_disk *dp, void *p, off_t off, size_t len)
bd.buf = p;
bd.nblocks = real_len / bsize;
bd.lba = real_off / bsize;
- bd.write = 1;
+ bd.write = rw;
error = ahci_rw((void *)port->parent, port, &bd);
if (error < 0) {
@@ -427,6 +427,18 @@ sata_write(struct dms_disk *dp, void *p, off_t off, size_t len)
return real_len;
}
+static ssize_t
+sata_write(struct dms_disk *dp, void *p, off_t off, size_t len)
+{
+ return sata_rw(dp, p, off, len, true);
+}
+
+static ssize_t
+sata_read(struct dms_disk *dp, void *p, off_t off, size_t len)
+{
+ return sata_rw(dp, p, off, len, false);
+}
+
/*
* Stop a running port, turn off the command list engine,
* as well as its FIS receive engine
@@ -877,7 +889,7 @@ ahci_attach(struct pci_adv *adv)
static struct dms_ops dms_ops = {
.write = sata_write,
- .read = NULL
+ .read = sata_read
};
static struct pci_adv driver = {