summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2020-05-25 02:04:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2020-05-25 02:04:49 +0000
commit4bc23f0e5eb73d1ea4fc8062da9ad1038a11eca9 (patch)
treef2dfbb0ef9aeabc52143128bb0703f765e541e88 /sys/arch/alpha
parent010d4f32ab0d2b587ae720290863c7b0b512156c (diff)
Add support for write operations to diskstrategy().
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/stand/boot/disk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c
index 6b1cbb79a55..70ef717602f 100644
--- a/sys/arch/alpha/stand/boot/disk.c
+++ b/sys/arch/alpha/stand/boot/disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disk.c,v 1.17 2015/10/01 16:08:19 krw Exp $ */
+/* $OpenBSD: disk.c,v 1.18 2020/05/25 02:04:48 deraadt Exp $ */
/* $NetBSD: disk.c,v 1.6 1997/04/06 08:40:33 cgd Exp $ */
/*
@@ -78,10 +78,14 @@ diskstrategy(void *devdata, int rw, daddr32_t bn, size_t reqcnt, void *addrvoid,
sc = (struct disk_softc *)devdata;
pp = &sc->sc_label.d_partitions[sc->sc_part];
- ret.bits = prom_read(sc->sc_fd, reqcnt, addr, bn + pp->p_offset);
+ if (rw == F_READ)
+ ret.bits = prom_read(sc->sc_fd, reqcnt, addr, bn + pp->p_offset);
+ else
+ ret.bits = prom_write(sc->sc_fd, reqcnt, addr, bn + pp->p_offset);
if (ret.u.status)
return (EIO);
- *cnt = ret.u.retval;
+ if (cnt)
+ *cnt = ret.u.retval;
return (0);
}