diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2019-07-29 22:33:27 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2019-07-29 22:33:27 +0000 |
commit | f9e1a90d048719cdb2087fa8a4dd79f85c55a9f4 (patch) | |
tree | ddf66053befba18d64b2237e3190d04dd80a12b6 /sys | |
parent | 2d55442798f590cac84ebdab8d90639f49ca7c9f (diff) |
Support disk write in efiboot for armv7 and arm64.
ok patrick deraadt
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efidev.c | 10 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efidev.c | 12 |
2 files changed, 16 insertions, 6 deletions
diff --git a/sys/arch/arm64/stand/efiboot/efidev.c b/sys/arch/arm64/stand/efiboot/efidev.c index a39e2610c9a..dbbbb1c313a 100644 --- a/sys/arch/arm64/stand/efiboot/efidev.c +++ b/sys/arch/arm64/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.4 2019/01/31 14:35:06 patrick Exp $ */ +/* $OpenBSD: efidev.c,v 1.5 2019/07/29 22:33:26 yasuoka Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -100,8 +100,12 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) case F_WRITE: if (ed->blkio->Media->ReadOnly) goto on_eio; - /* XXX not yet */ - goto on_eio; + memcpy(data, buf, nsect * DEV_BSIZE); + status = EFI_CALL(ed->blkio->WriteBlocks, + ed->blkio, ed->mediaid, off, + nsect * DEV_BSIZE, data); + if (EFI_ERROR(status)) + goto on_eio; break; } return (EFI_SUCCESS); diff --git a/sys/arch/armv7/stand/efiboot/efidev.c b/sys/arch/armv7/stand/efiboot/efidev.c index 9a76b9b152d..8591ac2602c 100644 --- a/sys/arch/armv7/stand/efiboot/efidev.c +++ b/sys/arch/armv7/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.2 2016/05/20 11:53:19 kettenis Exp $ */ +/* $OpenBSD: efidev.c,v 1.3 2019/07/29 22:33:26 yasuoka Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -82,8 +82,14 @@ efid_io(int rw, efi_diskinfo_t ed, u_int off, int nsect, void *buf) case F_WRITE: if (ed->blkio->Media->ReadOnly) goto on_eio; - /* XXX not yet */ - goto on_eio; + if (ed->blkio->Media->ReadOnly) + goto on_eio; + memcpy(data, buf, nsect * DEV_BSIZE); + status = EFI_CALL(ed->blkio->WriteBlocks, + ed->blkio, ed->mediaid, off, + nsect * DEV_BSIZE, data); + if (EFI_ERROR(status)) + goto on_eio; break; } return (EFI_SUCCESS); |