summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver
diff options
context:
space:
mode:
authordzwdz2022-12-26 23:22:03 +0100
committerdzwdz2022-12-26 23:22:03 +0100
commit7ea0ddc733285cfa25d6535954de4784b054902a (patch)
tree0ae76ba3dd7628e5304153808962190d37559388 /src/kernel/arch/amd64/driver
parent2041919a2bb6cd8f4ef8ef6565962cfa82bb89f7 (diff)
amd64/ata: write support
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r--src/kernel/arch/amd64/driver/pata.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/kernel/arch/amd64/driver/pata.c b/src/kernel/arch/amd64/driver/pata.c
index 77b654c..3d5e3c6 100644
--- a/src/kernel/arch/amd64/driver/pata.c
+++ b/src/kernel/arch/amd64/driver/pata.c
@@ -56,7 +56,18 @@ static void accept(struct vfs_request *req) {
break;
case VFSOP_WRITE:
- panic_unimplemented();
+ if (id == root_id) {
+ vfsreq_finish_short(req, -EACCES);
+ break;
+ }
+ fs_normslice(&req->offset, &req->input.len, ata_size(id), false);
+ len = min(req->input.len, sizeof wbuf);
+ if (len != 0) {
+ virt_cpy_from(req->caller->pages, wbuf, req->input.buf, len);
+ ata_write(id, wbuf, len, req->offset);
+ }
+ vfsreq_finish_short(req, len);
+ break;
case VFSOP_GETSIZE:
if (id == root_id) {