diff --git a/sys/boot/amd64/Makefile b/sys/boot/amd64/Makefile deleted file mode 100644 index 59940e9b0d5..00000000000 --- a/sys/boot/amd64/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -.include - -SUBDIR= efi boot1.efi - -.include diff --git a/sys/boot/amd64/Makefile.inc b/sys/boot/amd64/Makefile.inc deleted file mode 100644 index 7b10385928b..00000000000 --- a/sys/boot/amd64/Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ -# Common defines for all of /sys/boot/amd64/ -# -# $FreeBSD$ - -BINDIR?= /boot - -# See conf/kern.mk for the correct set of these -CFLAGS+= -ffreestanding -mno-red-zone -CFLAGS+= -mno-mmx -mno-sse -mno-aes -mno-avx -msoft-float -LDFLAGS+= -nostdlib - -.include "../Makefile.inc" diff --git a/sys/boot/efi/Makefile b/sys/boot/efi/Makefile index ce5211393c2..5dfb648815b 100644 --- a/sys/boot/efi/Makefile +++ b/sys/boot/efi/Makefile @@ -2,4 +2,8 @@ SUBDIR= libefi +.if ${MACHINE_CPUARCH} == "amd64" +SUBDIR+= loader boot1 +.endif + .include diff --git a/sys/boot/efi/Makefile.inc b/sys/boot/efi/Makefile.inc index 29ebae4f5e4..58c4726e504 100644 --- a/sys/boot/efi/Makefile.inc +++ b/sys/boot/efi/Makefile.inc @@ -7,7 +7,10 @@ CFLAGS+= -march=i386 .endif # Options used when building app-specific efi components +# See conf/kern.mk for the correct set of these CFLAGS+= -ffreestanding -fshort-wchar -Wformat +CFLAGS+= -mno-red-zone +CFLAGS+= -mno-mmx -mno-sse -mno-aes -mno-avx -msoft-float LDFLAGS+= -nostdlib .include "../Makefile.inc" diff --git a/sys/boot/amd64/boot1.efi/Makefile b/sys/boot/efi/boot1/Makefile similarity index 86% rename from sys/boot/amd64/boot1.efi/Makefile rename to sys/boot/efi/boot1/Makefile index 5453fb66f8d..554df39bf0b 100644 --- a/sys/boot/amd64/boot1.efi/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -17,19 +17,19 @@ SRCS= boot1.c reloc.c start.S CFLAGS+= -fPIC CFLAGS+= -I. -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} +CFLAGS+= -I${.CURDIR}/../include +CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH} CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include CFLAGS+= -I${.CURDIR}/../../.. # Always add MI sources and REGULAR efi loader bits -.PATH: ${.CURDIR}/../efi ${.CURDIR}/../../common +.PATH: ${.CURDIR}/../loader/arch/amd64 ${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common FILES= boot1.efi boot1.efifat FILESMODE_boot1.efi= ${BINMODE} -LDSCRIPT= ${.CURDIR}/../efi/ldscript.${MACHINE_CPUARCH} +LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH} LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared -Wl,-znocombreloc ${PROG}: ${LDSCRIPT} @@ -39,7 +39,7 @@ OBJDUMP?= objdump .if ${MACHINE_CPUARCH} == "amd64" EFI_TARGET= efi-app-x86_64 -.else +.elif ${MACHINE_CPUARCH} == "i386" EFI_TARGET= efi-app-ia32 .endif diff --git a/sys/boot/amd64/boot1.efi/Makefile.fat b/sys/boot/efi/boot1/Makefile.fat similarity index 100% rename from sys/boot/amd64/boot1.efi/Makefile.fat rename to sys/boot/efi/boot1/Makefile.fat diff --git a/sys/boot/amd64/boot1.efi/boot1.c b/sys/boot/efi/boot1/boot1.c similarity index 100% rename from sys/boot/amd64/boot1.efi/boot1.c rename to sys/boot/efi/boot1/boot1.c diff --git a/sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu b/sys/boot/efi/boot1/fat.tmpl.bz2.uu similarity index 100% rename from sys/boot/amd64/boot1.efi/fat.tmpl.bz2.uu rename to sys/boot/efi/boot1/fat.tmpl.bz2.uu diff --git a/sys/boot/amd64/boot1.efi/generate-fat.sh b/sys/boot/efi/boot1/generate-fat.sh similarity index 100% rename from sys/boot/amd64/boot1.efi/generate-fat.sh rename to sys/boot/efi/boot1/generate-fat.sh diff --git a/sys/boot/amd64/efi/Makefile b/sys/boot/efi/loader/Makefile similarity index 79% rename from sys/boot/amd64/efi/Makefile rename to sys/boot/efi/loader/Makefile index 8c39da6083d..e109b72c97c 100644 --- a/sys/boot/amd64/efi/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -12,27 +12,24 @@ MK_SSP= no PROG= loader.sym INTERNALPROG= +.PATH: ${.CURDIR}/../../efi/loader # architecture-specific loader code SRCS= autoload.c \ bootinfo.c \ conf.c \ copy.c \ devicename.c \ - elf64_freebsd.c \ - framebuffer.c \ main.c \ - reloc.c \ vers.c -SRCS+= amd64_tramp.S \ - start.S -.PATH: ${.CURDIR}/../../i386/libi386 -SRCS+= nullconsole.c \ - comconsole.c + +.PATH: ${.CURDIR}/arch/${MACHINE_CPUARCH} +.include "${.CURDIR}/arch/${MACHINE_CPUARCH}/Makefile.inc" CFLAGS+= -fPIC -CFLAGS+= -I. -CFLAGS+= -I${.CURDIR}/../../efi/include -CFLAGS+= -I${.CURDIR}/../../efi/include/${MACHINE_CPUARCH} +CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/arch/${MACHINE_CPUARCH} +CFLAGS+= -I${.CURDIR}/../include +CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH} CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -DNO_PCI @@ -60,14 +57,14 @@ CFLAGS+= -I${.CURDIR}/../../common FILES= loader.efi FILESMODE_loader.efi= ${BINMODE} -LDSCRIPT= ${.CURDIR}/ldscript.${MACHINE_CPUARCH} +LDSCRIPT= ${.CURDIR}/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH} LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared -Wl,-znocombreloc CLEANFILES= vers.c loader.efi NEWVERSWHAT= "EFI loader" ${MACHINE_CPUARCH} -vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version +vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../efi/loader/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} OBJCOPY?= objcopy @@ -75,7 +72,7 @@ OBJDUMP?= objdump .if ${MACHINE_CPUARCH} == "amd64" EFI_TARGET= efi-app-x86_64 -.else +.elif ${MACHINE_CPUARCH} == "i386" EFI_TARGET= efi-app-ia32 .endif @@ -89,7 +86,7 @@ loader.efi: loader.sym -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} -LIBEFI= ${.OBJDIR}/../../efi/libefi/libefi.a +LIBEFI= ${.OBJDIR}/../libefi/libefi.a DPADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND} ${LDSCRIPT} LDADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND} diff --git a/sys/boot/efi/loader/arch/amd64/Makefile.inc b/sys/boot/efi/loader/arch/amd64/Makefile.inc new file mode 100644 index 00000000000..3f2b68e7313 --- /dev/null +++ b/sys/boot/efi/loader/arch/amd64/Makefile.inc @@ -0,0 +1,11 @@ +# $FreeBSD$ + +SRCS+= amd64_tramp.S \ + start.S \ + framebuffer.c \ + elf64_freebsd.c \ + reloc.c + +.PATH: ${.CURDIR}/../../i386/libi386 +SRCS+= nullconsole.c \ + comconsole.c diff --git a/sys/boot/amd64/efi/amd64_tramp.S b/sys/boot/efi/loader/arch/amd64/amd64_tramp.S similarity index 100% rename from sys/boot/amd64/efi/amd64_tramp.S rename to sys/boot/efi/loader/arch/amd64/amd64_tramp.S diff --git a/sys/boot/amd64/efi/elf64_freebsd.c b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c similarity index 93% rename from sys/boot/amd64/efi/elf64_freebsd.c rename to sys/boot/efi/loader/arch/amd64/elf64_freebsd.c index 0fb82b062bb..0c2607295f7 100644 --- a/sys/boot/amd64/efi/elf64_freebsd.c +++ b/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "actypes.h" #include "actbl.h" -#include "x86_efi.h" +#include "loader_efi.h" static EFI_GUID acpi_guid = ACPI_TABLE_GUID; static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID; @@ -57,8 +57,14 @@ extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); static int elf64_exec(struct preloaded_file *amp); static int elf64_obj_exec(struct preloaded_file *amp); -struct file_format amd64_elf = { elf64_loadfile, elf64_exec }; -struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec }; +static struct file_format amd64_elf = { elf64_loadfile, elf64_exec }; +static struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec }; + +struct file_format *file_formats[] = { + &amd64_elf, + &amd64_elf_obj, + NULL +}; #define PG_V 0x001 #define PG_RW 0x002 @@ -168,7 +174,7 @@ elf64_exec(struct preloaded_file *fp) if (err != 0) return(err); - status = BS->ExitBootServices(IH, x86_efi_mapkey); + status = BS->ExitBootServices(IH, efi_mapkey); if (EFI_ERROR(status)) { printf("%s: ExitBootServices() returned 0x%lx\n", __func__, (long)status); @@ -177,7 +183,7 @@ elf64_exec(struct preloaded_file *fp) dev_cleanup(); - trampoline(trampstack, x86_efi_copy_finish, kernend, modulep, PT4, + trampoline(trampstack, efi_copy_finish, kernend, modulep, PT4, ehdr->e_entry); panic("exec returned"); diff --git a/sys/boot/amd64/efi/framebuffer.c b/sys/boot/efi/loader/arch/amd64/framebuffer.c similarity index 100% rename from sys/boot/amd64/efi/framebuffer.c rename to sys/boot/efi/loader/arch/amd64/framebuffer.c diff --git a/sys/boot/amd64/efi/framebuffer.h b/sys/boot/efi/loader/arch/amd64/framebuffer.h similarity index 100% rename from sys/boot/amd64/efi/framebuffer.h rename to sys/boot/efi/loader/arch/amd64/framebuffer.h diff --git a/sys/boot/amd64/efi/ldscript.amd64 b/sys/boot/efi/loader/arch/amd64/ldscript.amd64 similarity index 100% rename from sys/boot/amd64/efi/ldscript.amd64 rename to sys/boot/efi/loader/arch/amd64/ldscript.amd64 diff --git a/sys/boot/amd64/efi/reloc.c b/sys/boot/efi/loader/arch/amd64/reloc.c similarity index 100% rename from sys/boot/amd64/efi/reloc.c rename to sys/boot/efi/loader/arch/amd64/reloc.c diff --git a/sys/boot/amd64/efi/start.S b/sys/boot/efi/loader/arch/amd64/start.S similarity index 100% rename from sys/boot/amd64/efi/start.S rename to sys/boot/efi/loader/arch/amd64/start.S diff --git a/sys/boot/amd64/efi/autoload.c b/sys/boot/efi/loader/autoload.c similarity index 98% rename from sys/boot/amd64/efi/autoload.c rename to sys/boot/efi/loader/autoload.c index efb32d40bc1..694a6da5591 100644 --- a/sys/boot/amd64/efi/autoload.c +++ b/sys/boot/efi/loader/autoload.c @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD$"); int -x86_efi_autoload(void) +efi_autoload(void) { return (0); diff --git a/sys/boot/amd64/efi/bootinfo.c b/sys/boot/efi/loader/bootinfo.c similarity index 97% rename from sys/boot/amd64/efi/bootinfo.c rename to sys/boot/efi/loader/bootinfo.c index ad57202a5f2..599ac5b9791 100644 --- a/sys/boot/amd64/efi/bootinfo.c +++ b/sys/boot/efi/loader/bootinfo.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -45,9 +46,9 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "framebuffer.h" -#include "x86_efi.h" +#include "loader_efi.h" -UINTN x86_efi_mapkey; +UINTN efi_mapkey; static const char howto_switches[] = "aCdrgDmphsv"; static int howto_masks[] = { @@ -260,7 +261,7 @@ bi_load_efi_data(struct preloaded_file *kfp) * one is marked as being loader data. */ sz = 0; - BS->GetMemoryMap(&sz, NULL, &x86_efi_mapkey, &mmsz, &mmver); + BS->GetMemoryMap(&sz, NULL, &efi_mapkey, &mmsz, &mmver); sz += mmsz; sz = (sz + 0xf) & ~0xf; pages = EFI_SIZE_TO_PAGES(sz + efisz); @@ -280,7 +281,7 @@ bi_load_efi_data(struct preloaded_file *kfp) efihdr = (struct efi_map_header *)addr; mm = (void *)((uint8_t *)efihdr + efisz); sz = (EFI_PAGE_SIZE * pages) - efisz; - status = BS->GetMemoryMap(&sz, mm, &x86_efi_mapkey, &mmsz, &mmver); + status = BS->GetMemoryMap(&sz, mm, &efi_mapkey, &mmsz, &mmver); if (EFI_ERROR(status)) { printf("%s: GetMemoryMap() returned 0x%lx\n", __func__, (long)status); @@ -333,7 +334,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) } /* Try reading the /etc/fstab file to select the root device */ - getrootmount(x86_efi_fmtdev((void *)rootdev)); + getrootmount(efi_fmtdev((void *)rootdev)); addr = 0; for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { @@ -375,6 +376,6 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) /* Copy module list and metadata. */ (void)bi_copymodules(addr); - + return (0); } diff --git a/sys/boot/amd64/efi/conf.c b/sys/boot/efi/loader/conf.c similarity index 92% rename from sys/boot/amd64/efi/conf.c rename to sys/boot/efi/loader/conf.c index 97dd352e302..8c063fd370d 100644 --- a/sys/boot/amd64/efi/conf.c +++ b/sys/boot/efi/loader/conf.c @@ -53,15 +53,6 @@ struct netif_driver *netif_drivers[] = { NULL }; -extern struct file_format amd64_elf; -extern struct file_format amd64_elf_obj; - -struct file_format *file_formats[] = { - &amd64_elf, - &amd64_elf_obj, - NULL -}; - extern struct console efi_console; extern struct console comconsole; extern struct console nullconsole; diff --git a/sys/boot/amd64/efi/copy.c b/sys/boot/efi/loader/copy.c similarity index 92% rename from sys/boot/amd64/efi/copy.c rename to sys/boot/efi/loader/copy.c index c3cb4752723..1da3f43688f 100644 --- a/sys/boot/amd64/efi/copy.c +++ b/sys/boot/efi/loader/copy.c @@ -48,7 +48,7 @@ int stage_offset_set = 0; ssize_t stage_offset; int -x86_efi_copy_init(void) +efi_copy_init(void) { EFI_STATUS status; @@ -65,7 +65,7 @@ x86_efi_copy_init(void) } ssize_t -x86_efi_copyin(const void *src, vm_offset_t dest, const size_t len) +efi_copyin(const void *src, vm_offset_t dest, const size_t len) { if (!stage_offset_set) { @@ -83,7 +83,7 @@ x86_efi_copyin(const void *src, vm_offset_t dest, const size_t len) } ssize_t -x86_efi_copyout(const vm_offset_t src, void *dest, const size_t len) +efi_copyout(const vm_offset_t src, void *dest, const size_t len) { /* XXX: Callers do not check for failure. */ @@ -97,7 +97,7 @@ x86_efi_copyout(const vm_offset_t src, void *dest, const size_t len) ssize_t -x86_efi_readin(const int fd, vm_offset_t dest, const size_t len) +efi_readin(const int fd, vm_offset_t dest, const size_t len) { if (dest + stage_offset + len > staging_end) { @@ -108,7 +108,7 @@ x86_efi_readin(const int fd, vm_offset_t dest, const size_t len) } void -x86_efi_copy_finish(void) +efi_copy_finish(void) { uint64_t *src, *dst, *last; diff --git a/sys/boot/amd64/efi/devicename.c b/sys/boot/efi/loader/devicename.c similarity index 89% rename from sys/boot/amd64/efi/devicename.c rename to sys/boot/efi/loader/devicename.c index aa436282269..a9327dcd6b6 100644 --- a/sys/boot/amd64/efi/devicename.c +++ b/sys/boot/efi/loader/devicename.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int x86_efi_parsedev(struct devdesc **, const char *, const char **); +static int efi_parsedev(struct devdesc **, const char *, const char **); /* * Point (dev) at an allocated device specifier for the device matching the @@ -44,7 +44,7 @@ static int x86_efi_parsedev(struct devdesc **, const char *, const char **); * use that. If not, use the default device. */ int -x86_efi_getdev(void **vdev, const char *devspec, const char **path) +efi_getdev(void **vdev, const char *devspec, const char **path) { struct devdesc **dev = (struct devdesc **)vdev; int rv; @@ -54,14 +54,14 @@ x86_efi_getdev(void **vdev, const char *devspec, const char **path) * use the current device instead. */ if (devspec == NULL || *devspec == '/' || !strchr(devspec, ':')) { - rv = x86_efi_parsedev(dev, getenv("currdev"), NULL); + rv = efi_parsedev(dev, getenv("currdev"), NULL); if (rv == 0 && path != NULL) *path = devspec; return (rv); } /* Parse the device name off the beginning of the devspec. */ - return (x86_efi_parsedev(dev, devspec, path)); + return (efi_parsedev(dev, devspec, path)); } /* @@ -78,7 +78,7 @@ x86_efi_getdev(void **vdev, const char *devspec, const char **path) * fs: */ static int -x86_efi_parsedev(struct devdesc **dev, const char *devspec, const char **path) +efi_parsedev(struct devdesc **dev, const char *devspec, const char **path) { struct devdesc *idev; struct devsw *dv; @@ -132,7 +132,7 @@ x86_efi_parsedev(struct devdesc **dev, const char *devspec, const char **path) } char * -x86_efi_fmtdev(void *vdev) +efi_fmtdev(void *vdev) { struct devdesc *dev = (struct devdesc *)vdev; static char buf[32]; /* XXX device length constant? */ @@ -154,12 +154,12 @@ x86_efi_fmtdev(void *vdev) * Set currdev to suit the value being supplied in (value) */ int -x86_efi_setcurrdev(struct env_var *ev, int flags, const void *value) +efi_setcurrdev(struct env_var *ev, int flags, const void *value) { struct devdesc *ncurr; int rv; - rv = x86_efi_parsedev(&ncurr, value, NULL); + rv = efi_parsedev(&ncurr, value, NULL); if (rv != 0) return(rv); diff --git a/sys/boot/amd64/efi/x86_efi.h b/sys/boot/efi/loader/loader_efi.h similarity index 71% rename from sys/boot/amd64/efi/x86_efi.h rename to sys/boot/efi/loader/loader_efi.h index 73a61c84b5d..f98f09426f3 100644 --- a/sys/boot/amd64/efi/x86_efi.h +++ b/sys/boot/efi/loader/loader_efi.h @@ -28,22 +28,24 @@ * $FreeBSD$ */ -#ifndef _X86_EFI_COPY_H_ -#define _X86_EFI_COPY_H_ +#ifndef _LOADER_EFI_COPY_H_ +#define _LOADER_EFI_COPY_H_ -int x86_efi_autoload(void); +int efi_autoload(void); -int x86_efi_getdev(void **vdev, const char *devspec, const char **path); -char *x86_efi_fmtdev(void *vdev); -int x86_efi_setcurrdev(struct env_var *ev, int flags, const void *value); +int efi_getdev(void **vdev, const char *devspec, const char **path); +char *efi_fmtdev(void *vdev); +int efi_setcurrdev(struct env_var *ev, int flags, const void *value); -int x86_efi_copy_init(void); -void x86_efi_copy_finish(void); +int efi_copy_init(void); -ssize_t x86_efi_copyin(const void *src, vm_offset_t dest, const size_t len); -ssize_t x86_efi_copyout(const vm_offset_t src, void *dest, const size_t len); -ssize_t x86_efi_readin(const int fd, vm_offset_t dest, const size_t len); +ssize_t efi_copyin(const void *src, vm_offset_t dest, const size_t len); +ssize_t efi_copyout(const vm_offset_t src, void *dest, const size_t len); +ssize_t efi_readin(const int fd, vm_offset_t dest, const size_t len); +void * efi_translate(vm_offset_t ptr); -extern UINTN x86_efi_mapkey; +extern UINTN efi_mapkey; -#endif /* _X86_EFI_COPY_H_ */ +void efi_copy_finish(void); + +#endif /* _LOADER_EFI_COPY_H_ */ diff --git a/sys/boot/amd64/efi/main.c b/sys/boot/efi/loader/main.c similarity index 96% rename from sys/boot/amd64/efi/main.c rename to sys/boot/efi/loader/main.c index 9d57fb2f2ad..d6b2b53c036 100644 --- a/sys/boot/amd64/efi/main.c +++ b/sys/boot/efi/loader/main.c @@ -36,7 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include "x86_efi.h" +#include "loader_efi.h" extern char bootprog_name[]; extern char bootprog_rev[]; @@ -73,7 +73,7 @@ main(int argc, CHAR16 *argv[]) */ cons_probe(); - if (x86_efi_copy_init()) { + if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); } @@ -115,18 +115,18 @@ main(int argc, CHAR16 *argv[]) */ BS->SetWatchdogTimer(0, 0, 0, NULL); - env_setenv("currdev", EV_VOLATILE, x86_efi_fmtdev(&currdev), - x86_efi_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, x86_efi_fmtdev(&currdev), env_noset, + env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev), + efi_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset, env_nounset); setenv("LINES", "24", 1); /* optional */ - archsw.arch_autoload = x86_efi_autoload; - archsw.arch_getdev = x86_efi_getdev; - archsw.arch_copyin = x86_efi_copyin; - archsw.arch_copyout = x86_efi_copyout; - archsw.arch_readin = x86_efi_readin; + archsw.arch_autoload = efi_autoload; + archsw.arch_getdev = efi_getdev; + archsw.arch_copyin = efi_copyin; + archsw.arch_copyout = efi_copyout; + archsw.arch_readin = efi_readin; interact(NULL); /* doesn't return */ diff --git a/sys/boot/amd64/efi/version b/sys/boot/efi/loader/version similarity index 100% rename from sys/boot/amd64/efi/version rename to sys/boot/efi/loader/version