summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-03-19 23:05:33 +0000
committerpeter <peter@FreeBSD.org>2002-03-19 23:05:33 +0000
commit84239ef763b47e20b2617edffca1d5144397849e (patch)
tree9d0dfc05e7de1519ec50def1c8613563fcb5018d
parentf36956581759863bfd4e05c77c234e512834ebd4 (diff)
downloadFreeBSD-src-84239ef763b47e20b2617edffca1d5144397849e.zip
FreeBSD-src-84239ef763b47e20b2617edffca1d5144397849e.tar.gz
Add EFI write support to loader
-rw-r--r--sys/boot/efi/libefi/efifs.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/sys/boot/efi/libefi/efifs.c b/sys/boot/efi/libefi/efifs.c
index c1eaecf..e459881 100644
--- a/sys/boot/efi/libefi/efifs.c
+++ b/sys/boot/efi/libefi/efifs.c
@@ -129,7 +129,35 @@ efifs_read(struct open_file *f, void *buf, size_t size, size_t *resid)
size -= sz;
bufp += sz;
}
- *resid = size;
+ if (resid)
+ *resid = size;
+ return 0;
+}
+
+static int
+efifs_write(struct open_file *f, void *buf, size_t size, size_t *resid)
+{
+ EFI_FILE *file = f->f_fsdata;
+ EFI_STATUS status;
+ UINTN sz = size;
+ char *bufp;
+
+ bufp = buf;
+ while (size > 0) {
+ sz = size;
+ if (sz > 8192)
+ sz = 8192;
+ status = file->Write(file, &sz, bufp);
+ twiddle();
+ if (EFI_ERROR(status))
+ return EIO;
+ if (sz == 0)
+ break;
+ size -= sz;
+ bufp += sz;
+ }
+ if (resid)
+ *resid = size;
return 0;
}
@@ -246,7 +274,7 @@ struct fs_ops efi_fsops = {
efifs_open,
efifs_close,
efifs_read,
- null_write,
+ efifs_write,
efifs_seek,
efifs_stat,
efifs_readdir
OpenPOWER on IntegriCloud