diff options
Diffstat (limited to 'stand')
125 files changed, 1364 insertions, 8752 deletions
diff --git a/stand/Makefile.inc b/stand/Makefile.inc index 5d55c4e4a16f..2866ebd20af3 100644 --- a/stand/Makefile.inc +++ b/stand/Makefile.inc @@ -1,5 +1,7 @@ SUBDIR_PARALLEL= yes +PACKAGE= bootloader + # Firmware may not be able to handle branch protection failures MK_BRANCH_PROTECTION= no diff --git a/stand/common/dev_net.c b/stand/common/dev_net.c index 964fa514cac5..d1c48d40691a 100644 --- a/stand/common/dev_net.c +++ b/stand/common/dev_net.c @@ -66,6 +66,10 @@ #include "dev_net.h" #include "bootstrap.h" +#ifndef NETPROTO_DEFAULT +# define NETPROTO_DEFAULT NET_NFS +#endif + static char *netdev_name; static int netdev_sock = -1; static int netdev_opens; @@ -182,6 +186,7 @@ net_open(struct open_file *f, ...) setenv("boot.netif.mtu", mtu, 1); } + DEBUG_PRINTF(1,("%s: netproto=%d\n", __func__, netproto)); } netdev_opens++; dev->d_opendata = &netdev_sock; @@ -193,7 +198,7 @@ net_close(struct open_file *f) { struct devdesc *dev; - DEBUG_PRINTF(1,("%s: opens=%d\n", __func__, netdev_opens)); + DEBUG_PRINTF(2,("%s: opens=%d\n", __func__, netdev_opens)); dev = f->f_devdata; dev->d_opendata = NULL; @@ -303,7 +308,7 @@ net_getparams(int sock) return (EIO); } exit: - if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + if ((rootaddr = net_parse_rootpath()) != htonl(INADDR_NONE)) rootip.s_addr = rootaddr; DEBUG_PRINTF(1,("%s: proto: %d\n", __func__, netproto)); @@ -344,11 +349,17 @@ net_print(int verbose) return (ret); } +bool +is_tftp(void) +{ + return (netproto == NET_TFTP); +} + /* * Parses the rootpath if present * * The rootpath format can be in the form - * <scheme>://ip/path + * <scheme>://ip[:port]/path * <scheme>:/path * * For compatibility with previous behaviour it also accepts as an NFS scheme @@ -363,10 +374,10 @@ net_print(int verbose) uint32_t net_parse_rootpath(void) { - n_long addr = htonl(INADDR_NONE); + n_long addr = 0; size_t i; char ip[FNAME_SIZE]; - char *ptr, *val; + char *ptr, *portp, *val; netproto = NET_NONE; @@ -381,7 +392,7 @@ net_parse_rootpath(void) ptr = rootpath; /* Fallback for compatibility mode */ if (netproto == NET_NONE) { - netproto = NET_NFS; + netproto = NETPROTO_DEFAULT; (void)strsep(&ptr, ":"); if (ptr != NULL) { addr = inet_addr(rootpath); @@ -394,16 +405,21 @@ net_parse_rootpath(void) if (*ptr == '/') { /* we are in the form <scheme>://, we do expect an ip */ ptr++; - /* - * XXX when http will be there we will need to check for - * a port, but right now we do not need it yet - */ + portp = val = strchr(ptr, ':'); + if (val != NULL) { + val++; + rootport = strtol(val, NULL, 10); + } val = strchr(ptr, '/'); if (val != NULL) { + if (portp == NULL) + portp = val; snprintf(ip, sizeof(ip), "%.*s", - (int)((uintptr_t)val - (uintptr_t)ptr), + (int)(portp - ptr), ptr); addr = inet_addr(ip); + DEBUG_PRINTF(1,("ip=%s addr=%#x\n", + ip, addr)); bcopy(val, rootpath, strlen(val) + 1); } } else { @@ -411,6 +427,7 @@ net_parse_rootpath(void) bcopy(ptr, rootpath, strlen(ptr) + 1); } } - + if (addr == 0) + addr = htonl(INADDR_NONE); return (addr); } diff --git a/stand/common/disk.c b/stand/common/disk.c index c1650f0fa1ec..47f882d5a532 100644 --- a/stand/common/disk.c +++ b/stand/common/disk.c @@ -417,7 +417,18 @@ disk_parsedev(struct devdesc **idev, const char *devspec, const char **path) char *cp; struct disk_devdesc *dev; - np = devspec + 4; /* Skip the leading 'disk' */ + /* + * disk names look approximately like: + * v?disk([0-9]+(p[0-9]+|s[a-z])?)?: + * so skip over the initial bit. We don't have access to the devsw + * to check the name. + */ + if (strncmp(devspec, "disk", 4) == 0) + np = devspec + 4; + else if (strncmp(devspec, "vdisk", 5) == 0) + np = devspec + 5; + else + return (EINVAL); unit = -1; /* * If there is path/file info after the device info, then any missing diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index af72ab1a4c99..eb41c51c50b6 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -98,6 +98,7 @@ #if defined(EFI) #include <efi.h> #include <efilib.h> +#include <Protocol/GraphicsOutput.h> #else #include <vbe.h> #endif @@ -232,6 +233,68 @@ gfx_parse_mode_str(char *str, int *x, int *y, int *depth) return (true); } +/* + * Returns true if we set the color from pre-existing environment, false if + * just used existing defaults. + */ +static bool +gfx_fb_evalcolor(const char *envname, teken_color_t *cattr, + ev_sethook_t sethook, ev_unsethook_t unsethook) +{ + const char *ptr; + char env[10]; + int eflags = EV_VOLATILE | EV_NOKENV; + bool from_env = false; + + ptr = getenv(envname); + if (ptr != NULL) { + *cattr = strtol(ptr, NULL, 10); + + /* + * If we can't unset the value, then it's probably hooked + * properly and we can just carry on. Otherwise, we want to + * reinitialize it so that we can hook it for the console that + * we're resetting defaults for. + */ + if (unsetenv(envname) != 0) + return (true); + from_env = true; + + /* + * If we're carrying over an existing value, we *do* want that + * to propagate to the kenv. + */ + eflags &= ~EV_NOKENV; + } + + snprintf(env, sizeof(env), "%d", *cattr); + env_setenv(envname, eflags, env, sethook, unsethook); + + return (from_env); +} + +void +gfx_fb_setcolors(teken_attr_t *attr, ev_sethook_t sethook, + ev_unsethook_t unsethook) +{ + bool need_setattr = false; + + /* + * On first run, we setup an environment hook to process any color + * changes. If the env is already set, we pick up fg and bg color + * values from the environment. + */ + if (gfx_fb_evalcolor("teken.fg_color", &attr->ta_fgcolor, + sethook, unsethook)) + need_setattr = true; + if (gfx_fb_evalcolor("teken.bg_color", &attr->ta_bgcolor, + sethook, unsethook)) + need_setattr = true; + + if (need_setattr) + teken_set_defattr(&gfx_state.tg_teken, attr); +} + static uint32_t rgb_color_map(uint8_t index, uint32_t rmax, int roffset, uint32_t gmax, int goffset, uint32_t bmax, int boffset) @@ -793,7 +856,7 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, int rv; #if defined(EFI) EFI_STATUS status; - EFI_GRAPHICS_OUTPUT *gop = gfx_state.tg_private; + EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = gfx_state.tg_private; EFI_TPL tpl; /* diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h index 17e419d8ffd3..d12bcd76b7fa 100644 --- a/stand/common/gfx_fb.h +++ b/stand/common/gfx_fb.h @@ -277,6 +277,7 @@ void gfx_fb_bezier(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, int gfx_fb_putimage(png_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); bool gfx_parse_mode_str(char *, int *, int *, int *); +void gfx_fb_setcolors(teken_attr_t *, ev_sethook_t, ev_unsethook_t); void term_image_display(teken_gfx_t *, const teken_rect_t *); void reset_font_flags(void); diff --git a/stand/common/misc.c b/stand/common/misc.c index 402213100951..a7c46ad2e74c 100644 --- a/stand/common/misc.c +++ b/stand/common/misc.c @@ -220,3 +220,16 @@ set_currdev(const char *devname) env_setenv("loaddev", EV_VOLATILE | EV_NOHOOK, devname, env_noset, env_nounset); } + +#ifndef LOADER_NET_SUPPORT +/* + * This api is normally provided by dev_net.c + * This stub keeps libsa happy when LOADER_NET_SUPPORT + * is not enabled. + */ +bool +is_tftp(void) +{ + return false; +} +#endif diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c index 313469d32f35..1e39bd858cc2 100644 --- a/stand/common/modinfo.c +++ b/stand/common/modinfo.c @@ -172,6 +172,8 @@ md_copyenv(vm_offset_t start) /* Traverse the environment. */ for (ep = environ; ep != NULL; ep = ep->ev_next) { + if ((ep->ev_flags & EV_NOKENV) != 0) + continue; len = strlen(ep->ev_name); if ((size_t)archsw.arch_copyin(ep->ev_name, addr, len) != len) break; diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index dc1c8f7f44e0..8c43bb62a135 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -21,7 +21,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd June 12, 2025 +.Dd September 2, 2025 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -127,6 +127,9 @@ since those flags apply to all boot loaders. .It Ar boot_verbose Set to "yes" to get the same effect as boot -v or booting verbose from the loader menu. +See the +.Va kern.msgbufsize +tuneable to ensure enough space for the increased number of messages. .It Ar exec Immediately executes a .Xr loader 8 @@ -340,6 +343,9 @@ selects the video console which prevents any input and hides all output replacing it with .Dq spinning character (useful for embedded products and such). +This setting is for the +.Xr loader 8 +only and does not set the kernel output. .It Va screen.font Set font size for framebuffer mode. The default font size is selected based on screen resolution. diff --git a/stand/defs.mk b/stand/defs.mk index 8ef84267b198..504493ebe648 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -38,6 +38,7 @@ MK_UBSAN:= no WARNS?= 1 BOOTSRC= ${SRCTOP}/stand +EDK2INC= ${SYSDIR}/contrib/edk2/Include EFISRC= ${BOOTSRC}/efi EFIINC= ${EFISRC}/include # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is @@ -55,12 +56,11 @@ LIBLUASRC= ${BOOTSRC}/liblua LIBOFWSRC= ${BOOTSRC}/libofw LUASRC= ${SRCTOP}/contrib/lua/src SASRC= ${BOOTSRC}/libsa +SAZFSSRC= ${SASRC}/zfs SYSDIR= ${SRCTOP}/sys UBOOTSRC= ${BOOTSRC}/uboot -ZFSSRC= ${SASRC}/zfs -OZFS= ${SRCTOP}/sys/contrib/openzfs -ZFSOSSRC= ${OZFS}/module/os/freebsd/ -ZFSOSINC= ${OZFS}/include/os/freebsd +ZFSOSSRC= ${ZFSTOP}/module/os/freebsd/ +ZFSOSINC= ${ZFSTOP}/include/os/freebsd LIBCSRC= ${SRCTOP}/lib/libc BOOTOBJ= ${OBJTOP}/stand @@ -207,6 +207,8 @@ LOADER_INTERP?=${LOADER_DEFAULT_INTERP} # Make sure we use the machine link we're about to create CFLAGS+=-I. +.include "${BOOTSRC}/veriexec.mk" + all: ${PROG} CLEANFILES+= teken_state.h diff --git a/stand/efi/acpica/acpi_detect.c b/stand/efi/acpica/acpi_detect.c new file mode 100644 index 000000000000..ca15f9d8dadc --- /dev/null +++ b/stand/efi/acpica/acpi_detect.c @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2014 Ed Maste <emaste@freebsd.org> + * Copyright (c) 2025 Kayla Powell <kpowkitty@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <machine/_inttypes.h> +#include <efi.h> +#include <Guid/Acpi.h> +#include <acpi.h> +#include "acpi_detect.h" + +/* For ACPI rsdp discovery. */ +EFI_GUID acpi = ACPI_TABLE_GUID; +EFI_GUID acpi20 = EFI_ACPI_TABLE_GUID; +ACPI_TABLE_RSDP *rsdp; + +void +acpi_detect(void) +{ + char buf[24]; + int revision; + + feature_enable(FEATURE_EARLY_ACPI); + if ((rsdp = efi_get_table(&acpi20)) == NULL) + if ((rsdp = efi_get_table(&acpi)) == NULL) + return; + + sprintf(buf, "0x%016"PRIxPTR, (uintptr_t)rsdp); + setenv("acpi.rsdp", buf, 1); + revision = rsdp->Revision; + if (revision == 0) + revision = 1; + sprintf(buf, "%d", revision); + setenv("acpi.revision", buf, 1); + strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId)); + buf[sizeof(rsdp->OemId)] = '\0'; + setenv("acpi.oem", buf, 1); + sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress); + setenv("acpi.rsdt", buf, 1); + if (revision >= 2) { + /* XXX extended checksum? */ + sprintf(buf, "0x%016llx", + (unsigned long long)rsdp->XsdtPhysicalAddress); + setenv("acpi.xsdt", buf, 1); + sprintf(buf, "%d", rsdp->Length); + setenv("acpi.xsdt_length", buf, 1); + } +} diff --git a/stand/efi/acpica/include/acpi_detect.h b/stand/efi/acpica/include/acpi_detect.h new file mode 100644 index 000000000000..246e790be9fb --- /dev/null +++ b/stand/efi/acpica/include/acpi_detect.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2025 Kayla Powell <kpowkitty@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef ACPI_DETECT_H +#define ACPI_DETECT_H + +#include <efi.h> +#include <efilib.h> + +struct ACPI_TABLE_RSDP; // forward declaration + +extern EFI_GUID acpi; +extern EFI_GUID acpi20; +extern ACPI_TABLE_RSDP *rsdp; + +void acpi_detect(void); + +#endif diff --git a/stand/efi/boot1/Makefile b/stand/efi/boot1/Makefile index e2966e813504..17fa849beb0b 100644 --- a/stand/efi/boot1/Makefile +++ b/stand/efi/boot1/Makefile @@ -32,7 +32,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-function SRCS+= boot1.c proto.c self_reloc.c start.S ufs_module.c .if ${MK_LOADER_ZFS} != "no" SRCS+= zfs_module.c -CFLAGS.zfs_module.c+= -I${ZFSSRC} +CFLAGS.zfs_module.c+= -I${SAZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS.zfs_module.c+= -I${SYSDIR}/contrib/openzfs/include @@ -44,7 +44,7 @@ CFLAGS.zfs_module.c+= -include ${ZFSOSINC}/spl/sys/ccompile.h CFLAGS+= -DEFI_ZFS_BOOT .endif -CFLAGS+= -I${EFIINC} +CFLAGS+= -I${EFIINC} -I${EDK2INC} CFLAGS+= -I${EFIINCMD} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -DEFI_UFS_BOOT diff --git a/stand/efi/boot1/boot1.c b/stand/efi/boot1/boot1.c index b93c6b425160..cad43206aa6a 100644 --- a/stand/efi/boot1/boot1.c +++ b/stand/efi/boot1/boot1.c @@ -118,7 +118,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load if ((status = BS->LoadImage(TRUE, IH, efi_devpath_last_node(dev->devpath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { printf("Failed to load image provided by %s, size: %zu, (%lu)\n", - mod->name, loadersize, EFI_ERROR_CODE(status)); + mod->name, loadersize, DECODE_ERROR(status)); goto errout; } @@ -126,7 +126,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load (void **)&loaded_image); if (status != EFI_SUCCESS) { printf("Failed to query LoadedImage provided by %s (%lu)\n", - mod->name, EFI_ERROR_CODE(status)); + mod->name, DECODE_ERROR(status)); goto errout; } @@ -152,7 +152,7 @@ try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t load if ((status = BS->StartImage(loaderhandle, NULL, NULL)) != EFI_SUCCESS) { printf("Failed to start image provided by %s (%lu)\n", - mod->name, EFI_ERROR_CODE(status)); + mod->name, DECODE_ERROR(status)); loaded_image->LoadOptionsSize = 0; loaded_image->LoadOptions = NULL; } @@ -254,7 +254,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) { DPRINTF("Failed to get image DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); } else { text = efi_devpath_name(imgpath); if (text != NULL) { @@ -296,12 +296,14 @@ efi_exit(EFI_STATUS s) BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize)); BS->Exit(IH, s, 0, NULL); + __unreachable(); } void -exit(int error __unused) +exit(int error) { - efi_exit(EFI_LOAD_ERROR); + efi_exit(errno_to_efi_status(error)); + __unreachable(); } /* @@ -320,6 +322,7 @@ efi_panic(EFI_STATUS s, const char *fmt, ...) printf("\n"); efi_exit(s); + __unreachable(); } int getchar(void) diff --git a/stand/efi/boot1/proto.c b/stand/efi/boot1/proto.c index f81debd168b9..042a675f543d 100644 --- a/stand/efi/boot1/proto.c +++ b/stand/efi/boot1/proto.c @@ -68,7 +68,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) if (status != EFI_SUCCESS) { DPRINTF("\nFailed to query DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } #ifdef EFI_DEBUG @@ -84,7 +84,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) if (status != EFI_SUCCESS) { DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } diff --git a/stand/efi/boot1/ufs_module.c b/stand/efi/boot1/ufs_module.c index 0bdd5c018b06..e6c7c64c1e19 100644 --- a/stand/efi/boot1/ufs_module.c +++ b/stand/efi/boot1/ufs_module.c @@ -62,7 +62,7 @@ dskread(void *buf, uint64_t lba, int nblk) DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " "status: %lu\n", devinfo->dev, devinfo->dev->Media->MediaId, (uintmax_t)lba, size, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } diff --git a/stand/efi/boot1/zfs_module.c b/stand/efi/boot1/zfs_module.c index 16722b33f0b9..f0cf28e8ce68 100644 --- a/stand/efi/boot1/zfs_module.c +++ b/stand/efi/boot1/zfs_module.c @@ -106,7 +106,7 @@ error: DPRINTF("vdev_read: failed dev: %p, id: %u, lba: %ju, size: %zu," " rb_size: %zu, status: %lu\n", devinfo->dev, devinfo->dev->Media->MediaId, (uintmax_t)lba, bytes, rb_size, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } diff --git a/stand/efi/fdt/Makefile b/stand/efi/fdt/Makefile index bbb380f52184..15a42614a422 100644 --- a/stand/efi/fdt/Makefile +++ b/stand/efi/fdt/Makefile @@ -12,6 +12,7 @@ SRCS= efi_fdt.c # EFI library headers CFLAGS+= -I${EFISRC}/include CFLAGS+= -I${EFISRC}/include/${MACHINE} +CFLAGS+= -I${EDK2INC} # libfdt headers CFLAGS+= -I${FDTSRC} diff --git a/stand/efi/fdt/efi_fdt.c b/stand/efi/fdt/efi_fdt.c index adf830e44182..56e7361a8d9f 100644 --- a/stand/efi/fdt/efi_fdt.c +++ b/stand/efi/fdt/efi_fdt.c @@ -31,6 +31,8 @@ #include <efi.h> #include <efilib.h> #include <fdt_platform.h> +#include <Uefi.h> +#include <Guid/Fdt.h> #include "bootstrap.h" diff --git a/stand/efi/gptboot/proto.c b/stand/efi/gptboot/proto.c index a1825d9c1c15..a6bc0c268dcd 100644 --- a/stand/efi/gptboot/proto.c +++ b/stand/efi/gptboot/proto.c @@ -69,7 +69,7 @@ drvread(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " "status: %lu\n", devinfo->dev, dev->Media->MediaId, (uintmax_t)lba, size, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } @@ -99,7 +99,7 @@ drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " "status: %lu\n", devinfo->dev, dev->Media->MediaId, (uintmax_t)lba, size, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (-1); } diff --git a/stand/efi/include/Guid/MemoryTypeInformation.h b/stand/efi/include/Guid/MemoryTypeInformation.h deleted file mode 100644 index be9c4b5177a9..000000000000 --- a/stand/efi/include/Guid/MemoryTypeInformation.h +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - This file defines: - * Memory Type Information GUID for HOB and Variable. - * Memory Type Information Variable Name. - * Memory Type Information GUID HOB data structure. - - The memory type information HOB and variable can - be used to store the information for each memory type in Variable or HOB. - -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> -This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. -The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MEMORY_TYPE_INFORMATION_GUID_H__ -#define __MEMORY_TYPE_INFORMATION_GUID_H__ - -#define EFI_MEMORY_TYPE_INFORMATION_GUID \ - { 0x4c19049f,0x4137,0x4dd3, { 0x9c,0x10,0x8b,0x97,0xa8,0x3f,0xfd,0xfa } } - -#define EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME "MemoryTypeInformation" - -extern EFI_GUID gEfiMemoryTypeInformationGuid; - -typedef struct { - UINT32 Type; ///< EFI memory type defined in UEFI specification. - UINT32 NumberOfPages; ///< The pages of this type memory. -} EFI_MEMORY_TYPE_INFORMATION; - -#endif diff --git a/stand/efi/include/Guid/MtcVendor.h b/stand/efi/include/Guid/MtcVendor.h deleted file mode 100644 index 3aa774f55477..000000000000 --- a/stand/efi/include/Guid/MtcVendor.h +++ /dev/null @@ -1,31 +0,0 @@ -/** @file - GUID is for MTC variable. - -Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> -This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. -The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __MTC_VENDOR_GUID_H__ -#define __MTC_VENDOR_GUID_H__ - -// -// Vendor GUID of the variable for the high part of monotonic counter (UINT32). -// -#define MTC_VENDOR_GUID \ - { 0xeb704011, 0x1402, 0x11d3, { 0x8e, 0x77, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } } - -// -// Name of the variable for the high part of monotonic counter -// -#define MTC_VARIABLE_NAME "MTC" - -extern EFI_GUID gMtcVendorGuid; - -#endif diff --git a/stand/efi/include/Guid/ZeroGuid.h b/stand/efi/include/Guid/ZeroGuid.h deleted file mode 100644 index 6de8c3821f5f..000000000000 --- a/stand/efi/include/Guid/ZeroGuid.h +++ /dev/null @@ -1,25 +0,0 @@ -/** @file - GUID has all zero values. - -Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> -This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. -The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __ZERO_GUID_H__ -#define __ZERO_GUID_H__ - -#define ZERO_GUID \ - { \ - 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} \ - } - -extern EFI_GUID gZeroGuid; - -#endif diff --git a/stand/efi/include/Protocol/EdidActive.h b/stand/efi/include/Protocol/EdidActive.h deleted file mode 100644 index 1f6ff052a91c..000000000000 --- a/stand/efi/include/Protocol/EdidActive.h +++ /dev/null @@ -1,52 +0,0 @@ -/** @file - EDID Active Protocol from the UEFI 2.0 specification. - - Placed on the video output device child handle that is actively displaying output. - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __EDID_ACTIVE_H__ -#define __EDID_ACTIVE_H__ - -#define EFI_EDID_ACTIVE_PROTOCOL_GUID \ - { \ - 0xbd8c1056, 0x9f36, 0x44ec, {0x92, 0xa8, 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 } \ - } - -/// -/// This protocol contains the EDID information for an active video output device. This is either the -/// EDID information retrieved from the EFI_EDID_OVERRIDE_PROTOCOL if an override is -/// available, or an identical copy of the EDID information from the -/// EFI_EDID_DISCOVERED_PROTOCOL if no overrides are available. -/// -typedef struct { - /// - /// The size, in bytes, of the Edid buffer. 0 if no EDID information - /// is available from the video output device. Otherwise, it must be a - /// minimum of 128 bytes. - /// - UINT32 SizeOfEdid; - - /// - /// A pointer to a read-only array of bytes that contains the EDID - /// information for an active video output device. This pointer is - /// NULL if no EDID information is available for the video output - /// device. The minimum size of a valid Edid buffer is 128 bytes. - /// EDID information is defined in the E-EDID EEPROM - /// specification published by VESA (www.vesa.org). - /// - UINT8 *Edid; -} EFI_EDID_ACTIVE_PROTOCOL; - -extern EFI_GUID gEfiEdidActiveProtocolGuid; - -#endif diff --git a/stand/efi/include/Protocol/EdidDiscovered.h b/stand/efi/include/Protocol/EdidDiscovered.h deleted file mode 100644 index c10b6ee89a82..000000000000 --- a/stand/efi/include/Protocol/EdidDiscovered.h +++ /dev/null @@ -1,50 +0,0 @@ -/** @file - EDID Discovered Protocol from the UEFI 2.0 specification. - - This protocol is placed on the video output device child handle. It represents - the EDID information being used for the output device represented by the child handle. - - Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __EDID_DISCOVERED_H__ -#define __EDID_DISCOVERED_H__ - -#define EFI_EDID_DISCOVERED_PROTOCOL_GUID \ - { \ - 0x1c0c34f6, 0xd380, 0x41fa, {0xa0, 0x49, 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa } \ - } - -/// -/// This protocol contains the EDID information retrieved from a video output device. -/// -typedef struct { - /// - /// The size, in bytes, of the Edid buffer. 0 if no EDID information - /// is available from the video output device. Otherwise, it must be a - /// minimum of 128 bytes. - /// - UINT32 SizeOfEdid; - - /// - /// A pointer to a read-only array of bytes that contains the EDID - /// information for an active video output device. This pointer is - /// NULL if no EDID information is available for the video output - /// device. The minimum size of a valid Edid buffer is 128 bytes. - /// EDID information is defined in the E-EDID EEPROM - /// specification published by VESA (www.vesa.org). - /// - UINT8 *Edid; -} EFI_EDID_DISCOVERED_PROTOCOL; - -extern EFI_GUID gEfiEdidDiscoveredProtocolGuid; - -#endif diff --git a/stand/efi/include/Protocol/EdidOverride.h b/stand/efi/include/Protocol/EdidOverride.h deleted file mode 100644 index 450c95641fce..000000000000 --- a/stand/efi/include/Protocol/EdidOverride.h +++ /dev/null @@ -1,67 +0,0 @@ -/** @file - EDID Override Protocol from the UEFI 2.0 specification. - - Allow platform to provide EDID information to the producer of the Graphics Output - protocol. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __EDID_OVERRIDE_H__ -#define __EDID_OVERRIDE_H__ - -#define EFI_EDID_OVERRIDE_PROTOCOL_GUID \ - { \ - 0x48ecb431, 0xfb72, 0x45c0, {0xa9, 0x22, 0xf4, 0x58, 0xfe, 0x4, 0xb, 0xd5 } \ - } - -typedef struct _EFI_EDID_OVERRIDE_PROTOCOL EFI_EDID_OVERRIDE_PROTOCOL; - -#define EFI_EDID_OVERRIDE_DONT_OVERRIDE 0x01 -#define EFI_EDID_OVERRIDE_ENABLE_HOT_PLUG 0x02 - -/** - Returns policy information and potentially a replacement EDID for the specified video output device. - - @param This The EFI_EDID_OVERRIDE_PROTOCOL instance. - @param ChildHandle A child handle produced by the Graphics Output EFI - driver that represents a video output device. - @param Attributes The attributes associated with ChildHandle video output device. - @param EdidSize A pointer to the size, in bytes, of the Edid buffer. - @param Edid A pointer to callee allocated buffer that contains the EDID that - should be used for ChildHandle. A value of NULL - represents no EDID override for ChildHandle. - - @retval EFI_SUCCESS Valid overrides returned for ChildHandle. - @retval EFI_UNSUPPORTED ChildHandle has no overrides. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID)( - IN EFI_EDID_OVERRIDE_PROTOCOL *This, - IN EFI_HANDLE *ChildHandle, - OUT UINT32 *Attributes, - IN OUT UINTN *EdidSize, - IN OUT UINT8 **Edid - ); - -/// -/// This protocol is produced by the platform to allow the platform to provide -/// EDID information to the producer of the Graphics Output protocol. -/// -struct _EFI_EDID_OVERRIDE_PROTOCOL { - EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID GetEdid; -}; - -extern EFI_GUID gEfiEdidOverrideProtocolGuid; - -#endif diff --git a/stand/efi/include/Protocol/Http.h b/stand/efi/include/Protocol/Http.h deleted file mode 100644 index c88cc9f78847..000000000000 --- a/stand/efi/include/Protocol/Http.h +++ /dev/null @@ -1,522 +0,0 @@ -/** @file - This file defines the EFI HTTP Protocol interface. It is split into - the following two main sections: - HTTP Service Binding Protocol (HTTPSB) - HTTP Protocol (HTTP) - - Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> - (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR> - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - @par Revision Reference: - This Protocol is introduced in UEFI Specification 2.5 - -**/ - -#ifndef __EFI_HTTP_PROTOCOL_H__ -#define __EFI_HTTP_PROTOCOL_H__ - -#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \ - { \ - 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \ - } - -#define EFI_HTTP_PROTOCOL_GUID \ - { \ - 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b } \ - } - -typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL; - -/// -/// EFI_HTTP_VERSION -/// -typedef enum { - HttpVersion10, - HttpVersion11, - HttpVersionUnsupported -} EFI_HTTP_VERSION; - -/// -/// EFI_HTTP_METHOD -/// -typedef enum { - HttpMethodGet, - HttpMethodPost, - HttpMethodPatch, - HttpMethodOptions, - HttpMethodConnect, - HttpMethodHead, - HttpMethodPut, - HttpMethodDelete, - HttpMethodTrace, - HttpMethodMax -} EFI_HTTP_METHOD; - -/// -/// EFI_HTTP_STATUS_CODE -/// -typedef enum { - HTTP_STATUS_UNSUPPORTED_STATUS = 0, - HTTP_STATUS_100_CONTINUE, - HTTP_STATUS_101_SWITCHING_PROTOCOLS, - HTTP_STATUS_200_OK, - HTTP_STATUS_201_CREATED, - HTTP_STATUS_202_ACCEPTED, - HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION, - HTTP_STATUS_204_NO_CONTENT, - HTTP_STATUS_205_RESET_CONTENT, - HTTP_STATUS_206_PARTIAL_CONTENT, - HTTP_STATUS_300_MULTIPLE_CHOICES, - HTTP_STATUS_301_MOVED_PERMANENTLY, - HTTP_STATUS_302_FOUND, - HTTP_STATUS_303_SEE_OTHER, - HTTP_STATUS_304_NOT_MODIFIED, - HTTP_STATUS_305_USE_PROXY, - HTTP_STATUS_307_TEMPORARY_REDIRECT, - HTTP_STATUS_400_BAD_REQUEST, - HTTP_STATUS_401_UNAUTHORIZED, - HTTP_STATUS_402_PAYMENT_REQUIRED, - HTTP_STATUS_403_FORBIDDEN, - HTTP_STATUS_404_NOT_FOUND, - HTTP_STATUS_405_METHOD_NOT_ALLOWED, - HTTP_STATUS_406_NOT_ACCEPTABLE, - HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED, - HTTP_STATUS_408_REQUEST_TIME_OUT, - HTTP_STATUS_409_CONFLICT, - HTTP_STATUS_410_GONE, - HTTP_STATUS_411_LENGTH_REQUIRED, - HTTP_STATUS_412_PRECONDITION_FAILED, - HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE, - HTTP_STATUS_414_REQUEST_URI_TOO_LARGE, - HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE, - HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED, - HTTP_STATUS_417_EXPECTATION_FAILED, - HTTP_STATUS_500_INTERNAL_SERVER_ERROR, - HTTP_STATUS_501_NOT_IMPLEMENTED, - HTTP_STATUS_502_BAD_GATEWAY, - HTTP_STATUS_503_SERVICE_UNAVAILABLE, - HTTP_STATUS_504_GATEWAY_TIME_OUT, - HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED, - HTTP_STATUS_308_PERMANENT_REDIRECT -} EFI_HTTP_STATUS_CODE; - -/// -/// EFI_HTTPv4_ACCESS_POINT -/// -typedef struct { - /// - /// Set to TRUE to instruct the EFI HTTP instance to use the default address - /// information in every TCP connection made by this instance. In addition, when set - /// to TRUE, LocalAddress and LocalSubnet are ignored. - /// - BOOLEAN UseDefaultAddress; - /// - /// If UseDefaultAddress is set to FALSE, this defines the local IP address to be - /// used in every TCP connection opened by this instance. - /// - EFI_IPv4_ADDRESS LocalAddress; - /// - /// If UseDefaultAddress is set to FALSE, this defines the local subnet to be used - /// in every TCP connection opened by this instance. - /// - EFI_IPv4_ADDRESS LocalSubnet; - /// - /// This defines the local port to be used in - /// every TCP connection opened by this instance. - /// - UINT16 LocalPort; -} EFI_HTTPv4_ACCESS_POINT; - -/// -/// EFI_HTTPv6_ACCESS_POINT -/// -typedef struct { - /// - /// Local IP address to be used in every TCP connection opened by this instance. - /// - EFI_IPv6_ADDRESS LocalAddress; - /// - /// Local port to be used in every TCP connection opened by this instance. - /// - UINT16 LocalPort; -} EFI_HTTPv6_ACCESS_POINT; - -/// -/// EFI_HTTP_CONFIG_DATA_ACCESS_POINT -/// - - -typedef struct { - /// - /// HTTP version that this instance will support. - /// - EFI_HTTP_VERSION HttpVersion; - /// - /// Time out (in milliseconds) when blocking for requests. - /// - UINT32 TimeOutMillisec; - /// - /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If - /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE, - /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL. - /// - BOOLEAN LocalAddressIsIPv6; - - union { - /// - /// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and - /// port used by the underlying TCP protocol. - /// - EFI_HTTPv4_ACCESS_POINT *IPv4Node; - /// - /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port - /// used by the underlying TCP protocol. - /// - EFI_HTTPv6_ACCESS_POINT *IPv6Node; - } AccessPoint; -} EFI_HTTP_CONFIG_DATA; - -/// -/// EFI_HTTP_REQUEST_DATA -/// -typedef struct { - /// - /// The HTTP method (e.g. GET, POST) for this HTTP Request. - /// - EFI_HTTP_METHOD Method; - /// - /// The URI of a remote host. From the information in this field, the HTTP instance - /// will be able to determine whether to use HTTP or HTTPS and will also be able to - /// determine the port number to use. If no port number is specified, port 80 (HTTP) - /// is assumed. See RFC 3986 for more details on URI syntax. - /// - CHAR16 *Url; -} EFI_HTTP_REQUEST_DATA; - -/// -/// EFI_HTTP_RESPONSE_DATA -/// -typedef struct { - /// - /// Response status code returned by the remote host. - /// - EFI_HTTP_STATUS_CODE StatusCode; -} EFI_HTTP_RESPONSE_DATA; - -/// -/// EFI_HTTP_HEADER -/// -typedef struct { - /// - /// Null terminated string which describes a field name. See RFC 2616 Section 14 for - /// detailed information about field names. - /// - CHAR8 *FieldName; - /// - /// Null terminated string which describes the corresponding field value. See RFC 2616 - /// Section 14 for detailed information about field values. - /// - CHAR8 *FieldValue; -} EFI_HTTP_HEADER; - -/// -/// EFI_HTTP_MESSAGE -/// -typedef struct { - /// - /// HTTP message data. - /// - union { - /// - /// When the token is used to send a HTTP request, Request is a pointer to storage that - /// contains such data as URL and HTTP method. - /// - EFI_HTTP_REQUEST_DATA *Request; - /// - /// When used to await a response, Response points to storage containing HTTP response - /// status code. - /// - EFI_HTTP_RESPONSE_DATA *Response; - } Data; - /// - /// Number of HTTP header structures in Headers list. On request, this count is - /// provided by the caller. On response, this count is provided by the HTTP driver. - /// - UINTN HeaderCount; - /// - /// Array containing list of HTTP headers. On request, this array is populated by the - /// caller. On response, this array is allocated and populated by the HTTP driver. It - /// is the responsibility of the caller to free this memory on both request and - /// response. - /// - EFI_HTTP_HEADER *Headers; - /// - /// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type. - /// - UINTN BodyLength; - /// - /// Body associated with the HTTP request or response. This can be NULL depending on - /// the HttpMethod type. - /// - VOID *Body; -} EFI_HTTP_MESSAGE; - - -/// -/// EFI_HTTP_TOKEN -/// -typedef struct { - /// - /// This Event will be signaled after the Status field is updated by the EFI HTTP - /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority - /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK. - /// - EFI_EVENT Event; - /// - /// Status will be set to one of the following value if the HTTP request is - /// successfully sent or if an unexpected error occurs: - /// EFI_SUCCESS: The HTTP request was successfully sent to the remote host. - /// EFI_HTTP_ERROR: The response message was successfully received but contains a - /// HTTP error. The response status code is returned in token. - /// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from - /// the transmit queue. - /// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host. - /// EFI_DEVICE_ERROR: An unexpected system or network error occurred. - /// - EFI_STATUS Status; - /// - /// Pointer to storage containing HTTP message data. - /// - EFI_HTTP_MESSAGE *Message; -} EFI_HTTP_TOKEN; - -/** - Returns the operational parameters for the current HTTP child instance. - - The GetModeData() function is used to read the current mode data (operational - parameters) for this HTTP protocol instance. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - @param[out] HttpConfigData Point to buffer for operational parameters of this - HTTP instance. It is the responsibility of the caller - to allocate the memory for HttpConfigData and - HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact, - it is recommended to allocate sufficient memory to record - IPv6Node since it is big enough for all possibilities. - - @retval EFI_SUCCESS Operation succeeded. - @retval EFI_INVALID_PARAMETER This is NULL. - HttpConfigData is NULL. - HttpConfigData->AccessPoint.IPv4Node or - HttpConfigData->AccessPoint.IPv6Node is NULL. - @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_GET_MODE_DATA)( - IN EFI_HTTP_PROTOCOL *This, - OUT EFI_HTTP_CONFIG_DATA *HttpConfigData - ); - -/** - Initialize or brutally reset the operational parameters for this EFI HTTP instance. - - The Configure() function does the following: - When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring - timeout, local address, port, etc. - When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active - connections with remote hosts, canceling all asynchronous tokens, and flush request - and response buffers without informing the appropriate hosts. - - No other EFI HTTP function can be executed by this instance until the Configure() - function is executed and returns successfully. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - @param[in] HttpConfigData Pointer to the configure data to configure the instance. - - @retval EFI_SUCCESS Operation succeeded. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - This is NULL. - HttpConfigData->LocalAddressIsIPv6 is FALSE and - HttpConfigData->AccessPoint.IPv4Node is NULL. - HttpConfigData->LocalAddressIsIPv6 is TRUE and - HttpConfigData->AccessPoint.IPv6Node is NULL. - @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling - Configure() with NULL to reset it. - @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. - @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when - executing Configure(). - @retval EFI_UNSUPPORTED One or more options in ConfigData are not supported - in the implementation. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_CONFIGURE)( - IN EFI_HTTP_PROTOCOL *This, - IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL - ); - -/** - The Request() function queues an HTTP request to this HTTP instance, - similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent - successfully, or if there is an error, Status in token will be updated and Event will - be signaled. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - @param[in] Token Pointer to storage containing HTTP request token. - - @retval EFI_SUCCESS Outgoing data was processed. - @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. - @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. - @retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - This is NULL. - Token is NULL. - Token->Message is NULL. - Token->Message->Body is not NULL, - Token->Message->BodyLength is non-zero, and - Token->Message->Data is NULL, but a previous call to - Request()has not been completed successfully. - @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. - @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_REQUEST) ( - IN EFI_HTTP_PROTOCOL *This, - IN EFI_HTTP_TOKEN *Token - ); - -/** - Abort an asynchronous HTTP request or response token. - - The Cancel() function aborts a pending HTTP request or response transaction. If - Token is not NULL and the token is in transmit or receive queues when it is being - cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will - be signaled. If the token is not in one of the queues, which usually means that the - asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL, - all asynchronous tokens issued by Request() or Response() will be aborted. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - @param[in] Token Point to storage containing HTTP request or response - token. - - @retval EFI_SUCCESS Request and Response queues are successfully flushed. - @retval EFI_INVALID_PARAMETER This is NULL. - @retval EFI_NOT_STARTED This instance hasn't been configured. - @retval EFI_NOT_FOUND The asynchronous request or response token is not - found. - @retval EFI_UNSUPPORTED The implementation does not support this function. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_CANCEL)( - IN EFI_HTTP_PROTOCOL *This, - IN EFI_HTTP_TOKEN *Token - ); - -/** - The Response() function queues an HTTP response to this HTTP instance, similar to - Receive() function in the EFI TCP driver. When the HTTP Response is received successfully, - or if there is an error, Status in token will be updated and Event will be signaled. - - The HTTP driver will queue a receive token to the underlying TCP instance. When data - is received in the underlying TCP instance, the data will be parsed and Token will - be populated with the response data. If the data received from the remote host - contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting - (asynchronously) for more data to be sent from the remote host before signaling - Event in Token. - - It is the responsibility of the caller to allocate a buffer for Body and specify the - size in BodyLength. If the remote host provides a response that contains a content - body, up to BodyLength bytes will be copied from the receive buffer into Body and - BodyLength will be updated with the amount of bytes received and copied to Body. This - allows the client to download a large file in chunks instead of into one contiguous - block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is - non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive - token to underlying TCP instance. If data arrives in the receive buffer, up to - BodyLength bytes of data will be copied to Body. The HTTP driver will then update - BodyLength with the amount of bytes received and copied to Body. - - If the HTTP driver does not have an open underlying TCP connection with the host - specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is - consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain - an open TCP connection between client and host. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - @param[in] Token Pointer to storage containing HTTP response token. - - @retval EFI_SUCCESS Allocation succeeded. - @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been - initialized. - @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: - This is NULL. - Token is NULL. - Token->Message->Headers is NULL. - Token->Message is NULL. - Token->Message->Body is not NULL, - Token->Message->BodyLength is non-zero, and - Token->Message->Data is NULL, but a previous call to - Response() has not been completed successfully. - @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. - @retval EFI_ACCESS_DENIED An open TCP connection is not present with the host - specified by response URL. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_RESPONSE) ( - IN EFI_HTTP_PROTOCOL *This, - IN EFI_HTTP_TOKEN *Token - ); - -/** - The Poll() function can be used by network drivers and applications to increase the - rate that data packets are moved between the communication devices and the transmit - and receive queues. - - In some systems, the periodic timer event in the managed network driver may not poll - the underlying communications device fast enough to transmit and/or receive all data - packets without missing incoming packets or dropping outgoing packets. Drivers and - applications that are experiencing packet loss should try calling the Poll() function - more often. - - @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. - - @retval EFI_SUCCESS Incoming or outgoing data was processed.. - @retval EFI_DEVICE_ERROR An unexpected system or network error occurred - @retval EFI_INVALID_PARAMETER This is NULL. - @retval EFI_NOT_READY No incoming or outgoing data is processed. - @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_HTTP_POLL) ( - IN EFI_HTTP_PROTOCOL *This - ); - -/// -/// The EFI HTTP protocol is designed to be used by EFI drivers and applications to -/// create and transmit HTTP Requests, as well as handle HTTP responses that are -/// returned by a remote host. This EFI protocol uses and relies on an underlying EFI -/// TCP protocol. -/// -struct _EFI_HTTP_PROTOCOL { - EFI_HTTP_GET_MODE_DATA GetModeData; - EFI_HTTP_CONFIGURE Configure; - EFI_HTTP_REQUEST Request; - EFI_HTTP_CANCEL Cancel; - EFI_HTTP_RESPONSE Response; - EFI_HTTP_POLL Poll; -}; - -extern EFI_GUID gEfiHttpServiceBindingProtocolGuid; -extern EFI_GUID gEfiHttpProtocolGuid; - -#endif diff --git a/stand/efi/include/Protocol/Ip4Config2.h b/stand/efi/include/Protocol/Ip4Config2.h deleted file mode 100644 index 41b5abaafa02..000000000000 --- a/stand/efi/include/Protocol/Ip4Config2.h +++ /dev/null @@ -1,323 +0,0 @@ -/** @file - This file provides a definition of the EFI IPv4 Configuration II - Protocol. - -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR> -This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at<BR> -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -@par Revision Reference: -This Protocol is introduced in UEFI Specification 2.5 - -**/ -#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__ -#define __EFI_IP4CONFIG2_PROTOCOL_H__ - -/* #include <Protocol/Ip4.h> */ - -#define EFI_IP4_CONFIG2_PROTOCOL_GUID \ - { \ - 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ - } - -typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL; - - -/// -/// EFI_IP4_CONFIG2_DATA_TYPE -/// -typedef enum { - /// - /// The interface information of the communication device this EFI - /// IPv4 Configuration II Protocol instance manages. This type of - /// data is read only. The corresponding Data is of type - /// EFI_IP4_CONFIG2_INTERFACE_INFO. - /// - Ip4Config2DataTypeInterfaceInfo, - /// - /// The general configuration policy for the EFI IPv4 network stack - /// running on the communication device this EFI IPv4 - /// Configuration II Protocol instance manages. The policy will - /// affect other configuration settings. The corresponding Data is of - /// type EFI_IP4_CONFIG2_POLICY. - /// - Ip4Config2DataTypePolicy, - /// - /// The station addresses set manually for the EFI IPv4 network - /// stack. It is only configurable when the policy is - /// Ip4Config2PolicyStatic. The corresponding Data is of - /// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize - /// is 0 and Data is NULL, the existing configuration is cleared - /// from the EFI IPv4 Configuration II Protocol instance. - /// - Ip4Config2DataTypeManualAddress, - /// - /// The gateway addresses set manually for the EFI IPv4 network - /// stack running on the communication device this EFI IPv4 - /// Configuration II Protocol manages. It is not configurable when - /// the policy is Ip4Config2PolicyDhcp. The gateway - /// addresses must be unicast IPv4 addresses. The corresponding - /// Data is a pointer to an array of EFI_IPv4_ADDRESS instances. - /// When DataSize is 0 and Data is NULL, the existing configuration - /// is cleared from the EFI IPv4 Configuration II Protocol instance. - /// - Ip4Config2DataTypeGateway, - /// - /// The DNS server list for the EFI IPv4 network stack running on - /// the communication device this EFI IPv4 Configuration II - /// Protocol manages. It is not configurable when the policy is - /// Ip4Config2PolicyDhcp. The DNS server addresses must be - /// unicast IPv4 addresses. The corresponding Data is a pointer to - /// an array of EFI_IPv4_ADDRESS instances. When DataSize - /// is 0 and Data is NULL, the existing configuration is cleared - /// from the EFI IPv4 Configuration II Protocol instance. - /// - Ip4Config2DataTypeDnsServer, - Ip4Config2DataTypeMaximum -} EFI_IP4_CONFIG2_DATA_TYPE; - -/// -/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions -/// -#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32 - -/// -/// EFI_IP4_CONFIG2_INTERFACE_INFO -/// -typedef struct { - /// - /// The name of the interface. It is a NULL-terminated Unicode string. - /// - CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]; - /// - /// The interface type of the network interface. See RFC 1700, - /// section "Number Hardware Type". - /// - UINT8 IfType; - /// - /// The size, in bytes, of the network interface's hardware address. - /// - UINT32 HwAddressSize; - /// - /// The hardware address for the network interface. - /// - EFI_MAC_ADDRESS HwAddress; - /// - /// The station IPv4 address of this EFI IPv4 network stack. - /// - EFI_IPv4_ADDRESS StationAddress; - /// - /// The subnet address mask that is associated with the station address. - /// - EFI_IPv4_ADDRESS SubnetMask; - /// - /// Size of the following RouteTable, in bytes. May be zero. - /// - UINT32 RouteTableSize; - /// - /// The route table of the IPv4 network stack runs on this interface. - /// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in - /// EFI_IP4_PROTOCOL.GetModeData(). - /// - EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL; -} EFI_IP4_CONFIG2_INTERFACE_INFO; - -/// -/// EFI_IP4_CONFIG2_POLICY -/// -typedef enum { - /// - /// Under this policy, the Ip4Config2DataTypeManualAddress, - /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration - /// data are required to be set manually. The EFI IPv4 Protocol will get all - /// required configuration such as IPv4 address, subnet mask and - /// gateway settings from the EFI IPv4 Configuration II protocol. - /// - Ip4Config2PolicyStatic, - /// - /// Under this policy, the Ip4Config2DataTypeManualAddress, - /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are - /// not allowed to set via SetData(). All of these configurations are retrieved from DHCP - /// server or other auto-configuration mechanism. - /// - Ip4Config2PolicyDhcp, - Ip4Config2PolicyMax -} EFI_IP4_CONFIG2_POLICY; - -/// -/// EFI_IP4_CONFIG2_MANUAL_ADDRESS -/// -typedef struct { - /// - /// The IPv4 unicast address. - /// - EFI_IPv4_ADDRESS Address; - /// - /// The subnet mask. - /// - EFI_IPv4_ADDRESS SubnetMask; -} EFI_IP4_CONFIG2_MANUAL_ADDRESS; - -/** - Set the configuration for the EFI IPv4 network stack running on the communication device this EFI - IPv4 Configuration II Protocol instance manages. - - This function is used to set the configuration data of type DataType for the EFI IPv4 network stack - running on the communication device this EFI IPv4 Configuration II Protocol instance manages. - The successfully configured data is valid after system reset or power-off. - The DataSize is used to calculate the count of structure instances in the Data for some - DataType that multiple structure instances are allowed. - This function is always non-blocking. When setting some typeof configuration data, an - asynchronous process is invoked to check the correctness of the data, such as doing address conflict - detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to - indicate that such an asynchronous process is invoked and the process is not finished yet. The caller - willing to get the result of the asynchronous process is required to call RegisterDataNotify() - to register an event on the specified configuration data. Once the event is signaled, the caller can call - GetData()to get back the configuration data in order to know the result. For other types of - configuration data that do not require an asynchronous configuration process, the result of the - operation is immediately returned. - - @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. - @param[in] DataType The type of data to set. - @param[in] DataSize Size of the buffer pointed to by Data in bytes. - @param[in] Data The data buffer to set. The type ofthe data buffer is associated - with the DataType. - - @retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set - successfully. - @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: - This is NULL. - One or more fields in Data and DataSize do not match the - requirement of the data type indicated by DataType. - @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration - data can not be set under the current policy. - @retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process. - @retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and - the process is not finished yet. - @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType. - @retval EFI_UNSUPPORTED This DataType is not supported. - @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. - @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CONFIG2_SET_DATA) ( - IN EFI_IP4_CONFIG2_PROTOCOL *This, - IN EFI_IP4_CONFIG2_DATA_TYPE DataType, - IN UINTN DataSize, - IN VOID *Data - ); - -/** - Get the configuration data for the EFI IPv4 network stack running on the communication device this - EFI IPv4 Configuration II Protocol instance manages. - - This function returns the configuration data of type DataType for the EFI IPv4 network stack - running on the communication device this EFI IPv4 Configuration II Protocol instance manages. - The caller is responsible for allocating the buffer usedto return the specified configuration data and - the required size will be returned to the caller if the size of the buffer is too small. - EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in - progress asynchronous configuration process. The caller can call RegisterDataNotify() to - register an event on the specified configuration data. Once the asynchronous configuration process is - finished, the event will be signaled and a subsequent GetData() call will return the specified - configuration data. - - @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. - @param[in] DataType The type of data to get. - @param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size - of buffer required to store the specified configuration data. - @param[in] Data The data buffer in which the configuration data is returned. The - type of the data buffer is associated with the DataType. Ignored - if DataSize is 0. - - @retval EFI_SUCCESS The specified configuration data is got successfully. - @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: - This is NULL. - DataSize is NULL. - Data is NULL if *DataSizeis not zero. - @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data - and the required size is returned in DataSize. - @retval EFI_NOT_READY The specified configuration data is not ready due to an already in - progress asynchronous configuration process. - @retval EFI_NOT_FOUND The specified configuration data is not found. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CONFIG2_GET_DATA) ( - IN EFI_IP4_CONFIG2_PROTOCOL *This, - IN EFI_IP4_CONFIG2_DATA_TYPE DataType, - IN OUT UINTN *DataSize, - IN VOID *Data OPTIONAL - ); - -/** - Register an event that is to be signaled whenever a configuration process on the specified - configuration data is done. - - This function registers an event that is to be signaled whenever a configuration process on the - specified configuration data is done. An event can be registered for different DataType - simultaneously and the caller is responsible for determining which type of configuration data causes - the signaling of the event in such case. - - @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. - @param[in] DataType The type of data to unregister the event for. - @param[in] Event The event to register. - - @retval EFI_SUCCESS The notification event for the specified configuration data is - registered. - @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. - @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported. - @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. - @retval EFI_ACCESS_DENIED The Event is already registered for the DataType. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY) ( - IN EFI_IP4_CONFIG2_PROTOCOL *This, - IN EFI_IP4_CONFIG2_DATA_TYPE DataType, - IN EFI_EVENT Event - ); - -/** - Remove a previously registered event for the specified configuration data. - - This function removes a previously registeredevent for the specified configuration data. - - @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. - @param[in] DataType The type of data to remove the previously registered event for. - @param[in] Event The event to unregister. - - @retval EFI_SUCCESS The event registered for the specified configuration data is removed. - @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. - @retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType. -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY) ( - IN EFI_IP4_CONFIG2_PROTOCOL *This, - IN EFI_IP4_CONFIG2_DATA_TYPE DataType, - IN EFI_EVENT Event - ); - -/// -/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common -/// configurations and the administrator configurable settings for the EFI IPv4 network stack. -/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that -/// the EFI IPv4 network stack runs on. -/// -struct _EFI_IP4_CONFIG2_PROTOCOL { - EFI_IP4_CONFIG2_SET_DATA SetData; - EFI_IP4_CONFIG2_GET_DATA GetData; - EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify; - EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify; -}; - -extern EFI_GUID gEfiIp4Config2ProtocolGuid; - -#endif - diff --git a/stand/efi/include/Protocol/ServiceBinding.h b/stand/efi/include/Protocol/ServiceBinding.h deleted file mode 100644 index ac501515ac67..000000000000 --- a/stand/efi/include/Protocol/ServiceBinding.h +++ /dev/null @@ -1,94 +0,0 @@ -/** @file - UEFI Service Binding Protocol is defined in UEFI specification. - - The file defines the generic Service Binding Protocol functions. - It provides services that are required to create and destroy child - handles that support a given set of protocols. - - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#ifndef __EFI_SERVICE_BINDING_H__ -#define __EFI_SERVICE_BINDING_H__ - -/// -/// Forward reference for pure ANSI compatibility -/// -typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL; - -/** - Creates a child handle and installs a protocol. - - The CreateChild() function installs a protocol on ChildHandle. - If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. - If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle. - - @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. - @param ChildHandle Pointer to the handle of the child to create. If it is NULL, - then a new handle is created. If it is a pointer to an existing UEFI handle, - then the protocol is added to the existing UEFI handle. - - @retval EFI_SUCCES The protocol was added to ChildHandle. - @retval EFI_INVALID_PARAMETER ChildHandle is NULL. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create - the child - @retval other The child handle was not created - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD)( - IN EFI_SERVICE_BINDING_PROTOCOL *This, - IN OUT EFI_HANDLE *ChildHandle - ); - -/** - Destroys a child handle with a protocol installed on it. - - The DestroyChild() function does the opposite of CreateChild(). It removes a protocol - that was installed by CreateChild() from ChildHandle. If the removed protocol is the - last protocol on ChildHandle, then ChildHandle is destroyed. - - @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. - @param ChildHandle Handle of the child to destroy - - @retval EFI_SUCCES The protocol was removed from ChildHandle. - @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed. - @retval EFI_INVALID_PARAMETER Child handle is NULL. - @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle - because its services are being used. - @retval other The child handle was not destroyed - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD)( - IN EFI_SERVICE_BINDING_PROTOCOL *This, - IN EFI_HANDLE ChildHandle - ); - -/// -/// The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy -/// child handles. A driver is responsible for adding protocols to the child handle -/// in CreateChild() and removing protocols in DestroyChild(). It is also required -/// that the CreateChild() function opens the parent protocol BY_CHILD_CONTROLLER -/// to establish the parent-child relationship, and closes the protocol in DestroyChild(). -/// The pseudo code for CreateChild() and DestroyChild() is provided to specify the -/// required behavior, not to specify the required implementation. Each consumer of -/// a software protocol is responsible for calling CreateChild() when it requires the -/// protocol and calling DestroyChild() when it is finished with that protocol. -/// -struct _EFI_SERVICE_BINDING_PROTOCOL { - EFI_SERVICE_BINDING_CREATE_CHILD CreateChild; - EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild; -}; - -#endif diff --git a/stand/efi/include/amd64/efibind.h b/stand/efi/include/amd64/efibind.h deleted file mode 100644 index 1c974ee39f84..000000000000 --- a/stand/efi/include/amd64/efibind.h +++ /dev/null @@ -1,187 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - -#ifdef EFI_NT_EMULATOR - #define POST_CODE(_Data) -#else - #ifdef EFI_DEBUG -#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al - #else - #define POST_CODE(_Data) - #endif -#endif - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#define BREAKPOINT() __asm { int 3 } - -// -// Pointers must be aligned to these address to function -// - -#define MIN_ALIGNMENT_SIZE 4 - -#define ALIGN_VARIABLE(Value ,Adjustment) \ - (UINTN)Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - - -// -// Define macros to build data structure signatures from characters. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifdef __amd64__ -#define EFIAPI __attribute__((ms_abi)) -#endif - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a -//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg("") - -#define VOLATILE volatile - -#define MEMORY_FENCE() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -#ifdef EFI_NT_EMULATOR - -// -// To help ensure proper coding of integrated drivers, they are -// compiled as DLLs. In NT they require a dll init entry pointer. -// The macro puts a stub entry point into the DLL so it will load. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ - EFI_STATUS \ - InitFunction ( \ - EFI_HANDLE ImageHandle, \ - EFI_SYSTEM_TABLE *SystemTable \ - ); \ - \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - __declspec( dllexport ) \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ - } - - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) - -#else // EFI_NT_EMULATOR - -// -// When building similar to FW, link everything together as -// one big module. -// - - #define EFI_DRIVER_ENTRY_POINT(InitFunction) - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) - -#endif // EFI_FW_NT - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif /* __FreeBSD__ */ - -#ifdef _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP -#endif - diff --git a/stand/efi/include/amd64/pe.h b/stand/efi/include/amd64/pe.h index b858ba916c7d..faf8eafde1e9 100644 --- a/stand/efi/include/amd64/pe.h +++ b/stand/efi/include/amd64/pe.h @@ -83,7 +83,7 @@ typedef struct _IMAGE_FILE_HEADER { #define IMAGE_SIZEOF_FILE_HEADER 20 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved external references). #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. diff --git a/stand/efi/include/arm/efibind.h b/stand/efi/include/arm/efibind.h deleted file mode 100644 index a08d26ac84c4..000000000000 --- a/stand/efi/include/arm/efibind.h +++ /dev/null @@ -1,129 +0,0 @@ -/*++ - -Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved. - -This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - EfiBind.h - -Abstract: - - Processor or Compiler specific defines and types for IA-32. - We are using the ANSI C 2000 _t type definitions for basic types. - This it technically a violation of the coding standard, but they - are used to make EfiTypes.h portable. Code other than EfiTypes.h - should never use any ANSI C 2000 _t integer types. - ---*/ - -#ifndef _EFI_BIND_H_ -#define _EFI_BIND_H_ - - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) -#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT - - -// -// Make sure we are using the correct packing rules per EFI specification -// -#ifndef __GNUC__ -#pragma pack() -#endif - - -#define EFIERR(a) (0x80000000 | a) -#define EFI_ERROR_MASK 0x80000000 -#define EFIERR_OEM(a) (0xc0000000 | a) - -// -// Processor specific defines -// -#define EFI_MAX_BIT 0x80000000 -#define MAX_2_BITS 0xC0000000 - -// -// Maximum legal IA-32 address -// -#define EFI_MAX_ADDRESS 0xFFFFFFFF - -// -// Bad pointer value to use in check builds. -// if you see this value you are using uninitialized or free'ed data -// -#define EFI_BAD_POINTER 0xAFAFAFAF -#define EFI_BAD_POINTER_AS_BYTE 0xAF - -#define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); } - -// -// Inject a break point in the code to assist debugging for NT Emulation Environment -// For real hardware, just put in a halt loop. Don't do a while(1) because the -// compiler will optimize away the rest of the function following, so that you run out in -// the weeds if you skip over it with a debugger. -// -#define EFI_BREAKPOINT EFI_DEADLOOP() - - -// -// Memory Fence forces serialization, and is needed to support out of order -// memory transactions. The Memory Fence is mainly used to make sure IO -// transactions complete in a deterministic sequence, and to syncronize locks -// an other MP code. Currently no memory fencing is required. -// -#define MEMORY_FENCE() - -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX. The forward reference is required for -// ANSI compatibility. -// -// The following macro provide a workaround for such cases. -// - - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x -#endif - - -// -// Some C compilers optimize the calling conventions to increase performance. -// EFIAPI is used to make all public APIs follow the standard C calling -// convention. -// -#define EFIAPI - - - -// -// For symbol name in GNU assembly code, an extra "_" is necessary -// -#if defined(__GNUC__) - /// - /// Private worker functions for ASM_PFX() - /// - #define _CONCATENATE(a, b) __CONCATENATE(a, b) - #define __CONCATENATE(a, b) a ## b - - /// - /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix - /// on symbols in assembly language. - /// - #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name) - -#endif - -#define INTERFACE_DECL(x) struct x - -#endif diff --git a/stand/efi/include/arm64/efibind.h b/stand/efi/include/arm64/efibind.h deleted file mode 100644 index c81506f79334..000000000000 --- a/stand/efi/include/arm64/efibind.h +++ /dev/null @@ -1,140 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// BugBug: Code to debug -// -#define BIT63 0x8000000000000000 - -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) -#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// -// Macro's with casts make this much easier to use and read. -// -#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) -#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) -// -// BugBug: End Debug Code!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#define BREAKPOINT() __break(0) - -// -// Pointers must be aligned to these address to function -// you will get an alignment fault if this value is less than 8 -// -#define MIN_ALIGNMENT_SIZE 8 - -#define ALIGN_VARIABLE(Value , Adjustment) \ - (UINTN) Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - -// -// Define macros to create data structure signatures. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg() - -#define VOLATILE volatile - -// -// BugBug: Need to find out if this is portable across compilers. -// -void __mfa (void); -#define MEMORY_FENCE() __mfa() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -// -// When build similar to FW, then link everything together as -// one big module. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) - -#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) -// entry(NULL, ST) - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif diff --git a/stand/efi/include/efi.h b/stand/efi/include/efi.h index b603c3a78205..d1686aa95deb 100644 --- a/stand/efi/include/efi.h +++ b/stand/efi/include/efi.h @@ -43,53 +43,50 @@ Revision History // Basic EFI types of various widths. // -#include <stdint.h> -#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */ -#define ACPI_USE_SYSTEM_INTTYPES 1 /* Tell ACPI we've defined types */ - -typedef uint64_t UINT64; -typedef int64_t INT64; -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef uint8_t UINT8; -typedef int8_t INT8; - -#ifdef __LP64__ -typedef int64_t INTN; -typedef uint64_t UINTN; -#else -typedef int32_t INTN; -typedef uint32_t UINTN; -#endif +#include <sys/efi-edk2.h> +#include <Uefi.h> +#include <Protocol/LoadedImage.h> -#endif +/* old efierr.h */ +#define DECODE_ERROR(a) (unsigned long)(a & ~MAX_BIT) + +/* old efidevp.h */ +#define EFI_DP_TYPE_MASK 0x7F +#define EFI_DP_TYPE_UNPACKED 0x80 + +#define END_DEVICE_PATH_TYPE 0x7f + +#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 +#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) + + +#define DP_IS_END_TYPE(a) +#define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) + +#define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) +#define DevicePathSubType(a) ( (a)->SubType ) +#define DevicePathNodeLength(a) ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8))) +#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) +#define IsDevicePathType(a, t) ( DevicePathType(a) == t ) +#define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE) +#define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) +#define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) +#define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) + + +#define SetDevicePathNodeLength(a,l) { \ + (a)->Length[0] = (UINT8) (l); \ + (a)->Length[1] = (UINT8) ((l) >> 8); \ + } + +#define SetDevicePathEndNode(a) { \ + (a)->Type = END_DEVICE_PATH_TYPE; \ + (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ + (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ + (a)->Length[1] = 0; \ + } -#undef VOID -#define VOID void - - -#include "efibind.h" -#include "efidef.h" -#include "efidevp.h" -#include "efipciio.h" -#include "efiprot.h" -#include "eficon.h" -#include "eficonsctl.h" -#include "efiser.h" -#include "efi_nii.h" -#include "efipxebc.h" -#include "efinet.h" -#include "efiapi.h" -#include "efifs.h" -#include "efierr.h" -#include "efigop.h" -#include "efiip.h" -#include "efiudp.h" -#include "efitcp.h" -#include "efipoint.h" -#include "efiuga.h" +#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) #include <sys/types.h> /* diff --git a/stand/efi/include/efi_driver_utils.h b/stand/efi/include/efi_driver_utils.h index 9f0b6dfd638d..c2e03aa083b0 100644 --- a/stand/efi/include/efi_driver_utils.h +++ b/stand/efi/include/efi_driver_utils.h @@ -27,10 +27,9 @@ #ifndef _EFI_DRIVER_UTILS_H_ #define _EFI_DRIVER_UTILS_H_ -#include <efi.h> -#include <efiprot.h> +#include <Protocol/DriverBinding.h> -extern EFI_STATUS install_driver(EFI_DRIVER_BINDING *driver); -extern EFI_STATUS connect_controllers(EFI_GUID *filter); +EFI_STATUS install_driver(EFI_DRIVER_BINDING_PROTOCOL *driver); +EFI_STATUS connect_controllers(EFI_GUID *filter); #endif diff --git a/stand/efi/include/efiapi.h b/stand/efi/include/efiapi.h deleted file mode 100644 index 6c96c6f707ad..000000000000 --- a/stand/efi/include/efiapi.h +++ /dev/null @@ -1,1195 +0,0 @@ -#ifndef _EFI_API_H -#define _EFI_API_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efiapi.h - -Abstract: - - Global EFI runtime & boot service interfaces - - - - -Revision History - ---*/ - -// -// EFI Specification Revision -// - -#define EFI_SPECIFICATION_MAJOR_REVISION 1 -#define EFI_SPECIFICATION_MINOR_REVISION 10 - -// -// Declare forward referenced data structures -// - -INTERFACE_DECL(_EFI_SYSTEM_TABLE); - -// -// EFI Memory -// - -typedef -EFI_STATUS -(EFIAPI *EFI_ALLOCATE_PAGES) ( - IN EFI_ALLOCATE_TYPE Type, - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN NoPages, - OUT EFI_PHYSICAL_ADDRESS *Memory - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FREE_PAGES) ( - IN EFI_PHYSICAL_ADDRESS Memory, - IN UINTN NoPages - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_MEMORY_MAP) ( - IN OUT UINTN *MemoryMapSize, - IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, - OUT UINTN *MapKey, - OUT UINTN *DescriptorSize, - OUT UINT32 *DescriptorVersion - ); - -#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size)) - - -typedef -EFI_STATUS -(EFIAPI *EFI_ALLOCATE_POOL) ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN Size, - OUT VOID **Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FREE_POOL) ( - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) ( - IN UINTN MemoryMapSize, - IN UINTN DescriptorSize, - IN UINT32 DescriptorVersion, - IN EFI_MEMORY_DESCRIPTOR *VirtualMap - ); - - -#define EFI_OPTIONAL_PTR 0x00000001 -#define EFI_INTERNAL_FNC 0x00000002 // Pointer to internal runtime fnc -#define EFI_INTERNAL_PTR 0x00000004 // Pointer to internal runtime data - - -typedef -EFI_STATUS -(EFIAPI *EFI_CONVERT_POINTER) ( - IN UINTN DebugDisposition, - IN OUT VOID **Address - ); - - -// -// EFI Events -// - - - -#define EVT_TIMER 0x80000000 -#define EVT_RUNTIME 0x40000000 -#define EVT_RUNTIME_CONTEXT 0x20000000 - -#define EVT_NOTIFY_WAIT 0x00000100 -#define EVT_NOTIFY_SIGNAL 0x00000200 - -#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 -#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 - -#define EVT_EFI_SIGNAL_MASK 0x000000FF -#define EVT_EFI_SIGNAL_MAX 2 - -typedef -VOID -(EFIAPI *EFI_EVENT_NOTIFY) ( - IN EFI_EVENT Event, - IN VOID *Context - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CREATE_EVENT) ( - IN UINT32 Type, - IN EFI_TPL NotifyTpl, - IN EFI_EVENT_NOTIFY NotifyFunction, - IN VOID *NotifyContext, - OUT EFI_EVENT *Event - ); - -typedef enum { - TimerCancel, - TimerPeriodic, - TimerRelative, - TimerTypeMax -} EFI_TIMER_DELAY; - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_TIMER) ( - IN EFI_EVENT Event, - IN EFI_TIMER_DELAY Type, - IN UINT64 TriggerTime - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SIGNAL_EVENT) ( - IN EFI_EVENT Event - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_WAIT_FOR_EVENT) ( - IN UINTN NumberOfEvents, - IN EFI_EVENT *Event, - OUT UINTN *Index - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CLOSE_EVENT) ( - IN EFI_EVENT Event - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CHECK_EVENT) ( - IN EFI_EVENT Event - ); - -// -// Task priority level -// - -#define TPL_APPLICATION 4 -#define TPL_CALLBACK 8 -#define TPL_NOTIFY 16 -#define TPL_HIGH_LEVEL 31 - -typedef -EFI_TPL -(EFIAPI *EFI_RAISE_TPL) ( - IN EFI_TPL NewTpl - ); - -typedef -VOID -(EFIAPI *EFI_RESTORE_TPL) ( - IN EFI_TPL OldTpl - ); - - -// -// EFI platform varibles -// - -#define EFI_GLOBAL_VARIABLE \ - { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } - -// Variable attributes -#define EFI_VARIABLE_NON_VOLATILE 0x00000001 -#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 -#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 -#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 -#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 -#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 -#define EFI_VARIABLE_APPEND_WRITE 0x00000040 - -// Variable size limitation -#define EFI_MAXIMUM_VARIABLE_SIZE 1024 - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_VARIABLE) ( - IN CHAR16 *VariableName, - IN EFI_GUID *VendorGuid, - OUT UINT32 *Attributes OPTIONAL, - IN OUT UINTN *DataSize, - OUT VOID *Data - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) ( - IN OUT UINTN *VariableNameSize, - IN OUT CHAR16 *VariableName, - IN OUT EFI_GUID *VendorGuid - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_VARIABLE) ( - IN const CHAR16 *VariableName, - IN EFI_GUID *VendorGuid, - IN UINT32 Attributes, - IN UINTN DataSize, - IN VOID *Data - ); - - -// -// EFI Time -// - -typedef struct { - UINT32 Resolution; // 1e-6 parts per million - UINT32 Accuracy; // hertz - BOOLEAN SetsToZero; // Set clears sub-second time -} EFI_TIME_CAPABILITIES; - - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_TIME) ( - OUT EFI_TIME *Time, - OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_TIME) ( - IN EFI_TIME *Time - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_WAKEUP_TIME) ( - OUT BOOLEAN *Enabled, - OUT BOOLEAN *Pending, - OUT EFI_TIME *Time - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_WAKEUP_TIME) ( - IN BOOLEAN Enable, - IN EFI_TIME *Time OPTIONAL - ); - - -// -// Image functions -// - - -// PE32+ Subsystem type for EFI images - -#if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION) -#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 -#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 -#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 -#endif - -// PE32+ Machine type for EFI images - -#if !defined(EFI_IMAGE_MACHINE_IA32) -#define EFI_IMAGE_MACHINE_IA32 0x014c -#endif - -#if !defined(EFI_IMAGE_MACHINE_EBC) -#define EFI_IMAGE_MACHINE_EBC 0x0EBC -#endif - -// Image Entry prototype - -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( - IN EFI_HANDLE ImageHandle, - IN struct _EFI_SYSTEM_TABLE *SystemTable - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_LOAD) ( - IN BOOLEAN BootPolicy, - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH *FilePath, - IN VOID *SourceBuffer OPTIONAL, - IN UINTN SourceSize, - OUT EFI_HANDLE *ImageHandle - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_START) ( - IN EFI_HANDLE ImageHandle, - OUT UINTN *ExitDataSize, - OUT CHAR16 **ExitData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_EXIT) ( - IN EFI_HANDLE ImageHandle, - IN EFI_STATUS ExitStatus, - IN UINTN ExitDataSize, - IN CHAR16 *ExitData OPTIONAL - ) __dead2; - -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_UNLOAD) ( - IN EFI_HANDLE ImageHandle - ); - - -// Image handle -#define LOADED_IMAGE_PROTOCOL \ - { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } - -#define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000 -typedef struct { - UINT32 Revision; - EFI_HANDLE ParentHandle; - struct _EFI_SYSTEM_TABLE *SystemTable; - - // Source location of image - EFI_HANDLE DeviceHandle; - EFI_DEVICE_PATH *FilePath; - VOID *Reserved; - - // Images load options - UINT32 LoadOptionsSize; - VOID *LoadOptions; - - // Location of where image was loaded - VOID *ImageBase; - UINT64 ImageSize; - EFI_MEMORY_TYPE ImageCodeType; - EFI_MEMORY_TYPE ImageDataType; - - // If the driver image supports a dynamic unload request - EFI_IMAGE_UNLOAD Unload; - -} EFI_LOADED_IMAGE; - - -typedef -EFI_STATUS -(EFIAPI *EFI_EXIT_BOOT_SERVICES) ( - IN EFI_HANDLE ImageHandle, - IN UINTN MapKey - ); - -// -// Misc -// - - -typedef -EFI_STATUS -(EFIAPI *EFI_STALL) ( - IN UINTN Microseconds - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_WATCHDOG_TIMER) ( - IN UINTN Timeout, - IN UINT64 WatchdogCode, - IN UINTN DataSize, - IN CHAR16 *WatchdogData OPTIONAL - ); - - -typedef enum { - EfiResetCold, - EfiResetWarm, - EfiResetShutdown -} EFI_RESET_TYPE; - -typedef -VOID -(EFIAPI *EFI_RESET_SYSTEM) ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL - ) __dead2; - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) ( - OUT UINT64 *Count - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) ( - OUT UINT32 *HighCount - ); - -// -// Protocol handler functions -// - -typedef enum { - EFI_NATIVE_INTERFACE -} EFI_INTERFACE_TYPE; - -typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( - IN OUT EFI_HANDLE *Handle, - IN EFI_GUID *Protocol, - IN EFI_INTERFACE_TYPE InterfaceType, - IN VOID *Interface - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( - IN EFI_HANDLE Handle, - IN EFI_GUID *Protocol, - IN VOID *OldInterface, - IN VOID *NewInterface - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( - IN EFI_HANDLE Handle, - IN EFI_GUID *Protocol, - IN VOID *Interface - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_HANDLE_PROTOCOL) ( - IN EFI_HANDLE Handle, - IN EFI_GUID *Protocol, - OUT VOID **Interface - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( - IN EFI_GUID *Protocol, - IN EFI_EVENT Event, - OUT VOID **Registration - ); - -typedef enum { - AllHandles, - ByRegisterNotify, - ByProtocol -} EFI_LOCATE_SEARCH_TYPE; - -typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE) ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *BufferSize, - OUT EFI_HANDLE *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( - IN EFI_GUID *Protocol, - IN OUT EFI_DEVICE_PATH **DevicePath, - OUT EFI_HANDLE *Device - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( - IN EFI_GUID *Guid, - IN VOID *Table - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_RESERVED_SERVICE) ( - VOID - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CONNECT_CONTROLLER) ( - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE *DriverImageHandle OPTIONAL, - IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL, - IN BOOLEAN Recursive - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISCONNECT_CONTROLLER)( - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE DriverImageHandle, OPTIONAL - IN EFI_HANDLE ChildHandle OPTIONAL - ); - -#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001 -#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002 -#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004 -#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008 -#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010 -#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020 - -typedef -EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL) ( - IN EFI_HANDLE Handle, - IN EFI_GUID *Protocol, - OUT VOID **Interface, - IN EFI_HANDLE ImageHandle, - IN EFI_HANDLE ControllerHandle, OPTIONAL - IN UINT32 Attributes - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CLOSE_PROTOCOL) ( - IN EFI_HANDLE Handle, - IN EFI_GUID *Protocol, - IN EFI_HANDLE ImageHandle, - IN EFI_HANDLE DeviceHandle - ); - -typedef struct { - EFI_HANDLE AgentHandle; - EFI_HANDLE ControllerHandle; - UINT32 Attributes; - UINT32 OpenCount; -} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY; - -typedef -EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( - IN EFI_HANDLE UserHandle, - IN EFI_GUID *Protocol, - IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, - OUT UINTN *EntryCount - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( - IN EFI_HANDLE UserHandle, - OUT EFI_GUID ***ProtocolBuffer, - OUT UINTN *ProtocolBufferCount - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID *Protocol OPTIONAL, - IN VOID *SearchKey OPTIONAL, - IN OUT UINTN *NumberHandles, - OUT EFI_HANDLE **Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_LOCATE_PROTOCOL) ( - EFI_GUID *Protocol, - VOID *Registration, OPTIONAL - VOID **Interface - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( - IN OUT EFI_HANDLE *Handle, - ... - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( - IN EFI_HANDLE Handle, - ... - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_CALCULATE_CRC32) ( - IN VOID *Data, - IN UINTN DataSize, - OUT UINT32 *Crc32 - ); - -typedef -VOID -(EFIAPI *EFI_COPY_MEM) ( - IN VOID *Destination, - IN VOID *Source, - IN UINTN Length - ); - -typedef -VOID -(EFIAPI *EFI_SET_MEM) ( - IN VOID *Buffer, - IN UINTN Size, - IN UINT8 Value - ); - -// -// Standard EFI table header -// - -typedef struct _EFI_TABLE_HEARDER { - UINT64 Signature; - UINT32 Revision; - UINT32 HeaderSize; - UINT32 CRC32; - UINT32 Reserved; -} EFI_TABLE_HEADER; - - -// -// EFI Runtime Serivces Table -// - -#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 -#define EFI_RUNTIME_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) - -typedef struct { - EFI_TABLE_HEADER Hdr; - - // - // Time services - // - - EFI_GET_TIME GetTime; - EFI_SET_TIME SetTime; - EFI_GET_WAKEUP_TIME GetWakeupTime; - EFI_SET_WAKEUP_TIME SetWakeupTime; - - // - // Virtual memory services - // - - EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; - EFI_CONVERT_POINTER ConvertPointer; - - // - // Variable serviers - // - - EFI_GET_VARIABLE GetVariable; - EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; - EFI_SET_VARIABLE SetVariable; - - // - // Misc - // - - EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; - EFI_RESET_SYSTEM ResetSystem; - -} EFI_RUNTIME_SERVICES; - - -// -// EFI Boot Services Table -// - -#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 -#define EFI_BOOT_SERVICES_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) - -typedef struct { - - EFI_TABLE_HEADER Hdr; - - // - // Task priority functions - // - - EFI_RAISE_TPL RaiseTPL; - EFI_RESTORE_TPL RestoreTPL; - - // - // Memory functions - // - - EFI_ALLOCATE_PAGES AllocatePages; - EFI_FREE_PAGES FreePages; - EFI_GET_MEMORY_MAP GetMemoryMap; - EFI_ALLOCATE_POOL AllocatePool; - EFI_FREE_POOL FreePool; - - // - // Event & timer functions - // - - EFI_CREATE_EVENT CreateEvent; - EFI_SET_TIMER SetTimer; - EFI_WAIT_FOR_EVENT WaitForEvent; - EFI_SIGNAL_EVENT SignalEvent; - EFI_CLOSE_EVENT CloseEvent; - EFI_CHECK_EVENT CheckEvent; - - // - // Protocol handler functions - // - - EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; - EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; - EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; - EFI_HANDLE_PROTOCOL HandleProtocol; - VOID *Reserved; - EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; - EFI_LOCATE_HANDLE LocateHandle; - EFI_LOCATE_DEVICE_PATH LocateDevicePath; - EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; - - // - // Image functions - // - - EFI_IMAGE_LOAD LoadImage; - EFI_IMAGE_START StartImage; - EFI_EXIT Exit; - EFI_IMAGE_UNLOAD UnloadImage; - EFI_EXIT_BOOT_SERVICES ExitBootServices; - - // - // Misc functions - // - - EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; - EFI_STALL Stall; - EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; - - // - // DriverSupport Services - // - EFI_CONNECT_CONTROLLER ConnectController; - EFI_DISCONNECT_CONTROLLER DisconnectController; - - // - // Open and Close Protocol Services - // - EFI_OPEN_PROTOCOL OpenProtocol; - EFI_CLOSE_PROTOCOL CloseProtocol; - EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; - - // - // Library Services to reduce size of drivers - // - EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; - EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; - EFI_LOCATE_PROTOCOL LocateProtocol; - - EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; - EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; - - // - // CRC32 services - // - EFI_CALCULATE_CRC32 CalculateCrc32; - - // - // Memory Utility Services - // - EFI_COPY_MEM CopyMem; - EFI_SET_MEM SetMem; - -} EFI_BOOT_SERVICES; - - -// -// EFI Configuration Table and GUID definitions -// - -#define MPS_TABLE_GUID \ - { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define ACPI_TABLE_GUID \ - { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define ACPI_20_TABLE_GUID \ - { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } - -#define SMBIOS_TABLE_GUID \ - { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define SMBIOS3_TABLE_GUID \ - { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} } - -#define SAL_SYSTEM_TABLE_GUID \ - { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define FDT_TABLE_GUID \ - { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } - -#define DXE_SERVICES_TABLE_GUID \ - { 0x5ad34ba, 0x6f02, 0x4214, {0x95, 0x2e, 0x4d, 0xa0, 0x39, 0x8e, 0x2b, 0xb9} } - -#define HOB_LIST_TABLE_GUID \ - { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define LZMA_DECOMPRESSION_GUID \ - { 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x3, 0xcf} } - -#define ARM_MP_CORE_INFO_TABLE_GUID \ - { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} } - -#define ESRT_TABLE_GUID \ - { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80} } - -#define MEMORY_TYPE_INFORMATION_TABLE_GUID \ - { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} } - -#define DEBUG_IMAGE_INFO_TABLE_GUID \ - { 0x49152e77, 0x1ada, 0x4764, {0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b} } - -typedef struct _EFI_CONFIGURATION_TABLE { - EFI_GUID VendorGuid; - VOID *VendorTable; -} EFI_CONFIGURATION_TABLE; - - -// -// EFI System Table -// - - - - -#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -#define EFI_SYSTEM_TABLE_REVISION ((EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)) -#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | 10) -#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | 02) - -typedef struct _EFI_SYSTEM_TABLE { - EFI_TABLE_HEADER Hdr; - - CHAR16 *FirmwareVendor; - UINT32 FirmwareRevision; - - EFI_HANDLE ConsoleInHandle; - SIMPLE_INPUT_INTERFACE *ConIn; - - EFI_HANDLE ConsoleOutHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut; - - EFI_HANDLE StandardErrorHandle; - SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr; - - EFI_RUNTIME_SERVICES *RuntimeServices; - EFI_BOOT_SERVICES *BootServices; - - UINTN NumberOfTableEntries; - EFI_CONFIGURATION_TABLE *ConfigurationTable; - -} EFI_SYSTEM_TABLE; - -/* - * unlisted GUID's.. - */ -#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \ -{ 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7} } - -#define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \ -{ 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe} } - -#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \ -{ 0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_DRIVER_BINDING_PROTOCOL_GUID \ - { 0x18A031AB, 0xB443, 0x4D1A, \ - { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \ - } - -#define EFI_TAPE_IO_PROTOCOL_GUID \ - { 0x1e93e633, 0xd65a, 0x459e, \ - { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \ - } - -#define EFI_SCSI_IO_PROTOCOL_GUID \ - { 0x932f47e6, 0x2362, 0x4002, \ - { 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \ - } - -#define EFI_USB2_HC_PROTOCOL_GUID \ - { 0x3e745226, 0x9818, 0x45b6, \ - { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \ - } - -#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \ - { 0x2755590C, 0x6F3C, 0x42FA, \ - { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \ - } - -#define EFI_DEBUGPORT_PROTOCOL_GUID \ - { 0xEBA4E8D2, 0x3858, 0x41EC, \ - { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ - } - -#define EFI_DECOMPRESS_PROTOCOL_GUID \ - { 0xd8117cfe, 0x94a6, 0x11d4, \ - { 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ - } - -#define EFI_ACPI_TABLE_PROTOCOL_GUID \ - { 0xffe06bdd, 0x6107, 0x46a6, \ - { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c} \ - } - -#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \ - { 0x587e72d7, 0xcc50, 0x4f79, \ - { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } \ - } - -#define EFI_HII_DATABASE_PROTOCOL_GUID \ - { 0xef9fc172, 0xa1b2, 0x4693, \ - { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } \ - } - -#define EFI_HII_STRING_PROTOCOL_GUID \ - { 0xfd96974, 0x23aa, 0x4cdc, \ - { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } \ - } - -#define EFI_HII_IMAGE_PROTOCOL_GUID \ - { 0x31a6406a, 0x6bdf, 0x4e46, \ - { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } \ - } - -#define EFI_HII_FONT_PROTOCOL_GUID \ - { 0xe9ca4775, 0x8657, 0x47fc, \ - { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } \ - } -#define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \ - { 0x330d4706, 0xf2a0, 0x4e4f, \ - { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } \ - } - -#define EFI_COMPONENT_NAME_PROTOCOL_GUID \ -{ 0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \ - { 0x6a7a5cff, 0xe8d9, 0x4f70, \ - { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14} \ - } - -#define EFI_USB_IO_PROTOCOL_GUID \ - { 0x2B2F68D6, 0x0CD2, 0x44cf, \ - { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \ - } -#define EFI_HCDP_TABLE_GUID \ - { 0xf951938d, 0x620b, 0x42ef, \ - { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \ - } - -#define EFI_DEVICE_TREE_GUID \ - { 0xb1b621d5, 0xf19c, 0x41a5, \ - { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \ - } - -#define EFI_VENDOR_APPLE_GUID \ - { 0x2B0585EB, 0xD8B8, 0x49A9, \ - { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ - } - -#define EFI_CONSOLE_IN_DEVICE_GUID \ -{ 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_CONSOLE_OUT_DEVICE_GUID \ -{ 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_STANDARD_ERROR_DEVICE_GUID \ -{ 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \ -{ 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} } - -#define EFI_FORM_BROWSER2_PROTOCOL_GUID \ -{ 0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58} } - -#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3} } - -#define EFI_ARP_PROTOCOL_GUID \ -{ 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c} } - -#define EFI_IP4_CONFIG_PROTOCOL_GUID \ -{ 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e} } - -#define EFI_IP6_CONFIG_PROTOCOL_GUID \ -{ 0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a} } - -#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c} } - -#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \ -{ 0x7ab33a91, 0xace5, 0x4326, {0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16} } - -#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F} } - -#define EFI_MTFTP4_PROTOCOL_GUID \ -{ 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b} } - -#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23} } - -#define EFI_MTFTP6_PROTOCOL_GUID \ -{ 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51} } - -#define EFI_DHCP4_PROTOCOL_GUID \ -{ 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56} } - -#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80} } - -#define EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \ -{ 0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5} } - -#define EFI_DHCP6_PROTOCOL_GUID \ -{ 0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b} } - -#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \ -{ 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77} } - -#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \ -{ 0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe} } - -#define EFI_DISK_INFO_PROTOCOL_GUID \ -{ 0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27} } - -#define EFI_ISA_IO_PROTOCOL_GUID \ -{ 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_VLAN_CONFIG_PROTOCOL_GUID \ -{ 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74} } - -#define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \ -{ 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9} } - -#define EFI_ISA_ACPI_PROTOCOL_GUID \ -{ 0x64a892dc, 0x5561, 0x4536, {0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55} } - -#define EFI_PCI_ENUMERATION_COMPLETE_GUID \ -{ 0x30cfe3e7, 0x3de1, 0x4586, {0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93} } - -#define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \ -{ 0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } - -#define EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID \ -{ 0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63} } - -#define EFI_CAPSULE_ARCH_PROTOCOL_GUID \ -{ 0x5053697e, 0x2cbc, 0x4819, {0x90, 0xd9, 0x05, 0x80, 0xde, 0xee, 0x57, 0x54} } - -#define EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID \ -{0x1da97072, 0xbddc, 0x4b30, {0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} } - -#define EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID \ -{0x27cfac87, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_MP_SERVICES_PROTOCOL_GUID \ -{ 0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} } - -#define EFI_VARIABLE_ARCH_PROTOCOL_GUID \ -{ 0x1e5668e2, 0x8481, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } - -#define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \ -{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } - -#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \ -{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } - -#define EFI_ACPI_SUPPORT_PROTOCOL_GUID \ -{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } - -#define EFI_BDS_ARCH_PROTOCOL_GUID \ -{ 0x665e3ff6, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_METRONOME_ARCH_PROTOCOL_GUID \ -{ 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } - -#define EFI_TIMER_ARCH_PROTOCOL_GUID \ -{ 0x26baccb3, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } - -#define EFI_DPC_PROTOCOL_GUID \ -{ 0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6} } - -#define EFI_PRINT2_PROTOCOL_GUID \ -{ 0xf05976ef, 0x83f1, 0x4f3d, {0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38} } - -#define EFI_RESET_ARCH_PROTOCOL_GUID \ -{ 0x27cfac88, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define EFI_CPU_ARCH_PROTOCOL_GUID \ -{ 0x26baccb1, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } - -#define EFI_CPU_IO2_PROTOCOL_GUID \ -{ 0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} } - -#define EFI_LEGACY_8259_PROTOCOL_GUID \ -{ 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1} } - -#define EFI_SECURITY_ARCH_PROTOCOL_GUID \ -{ 0xa46423e3, 0x4617, 0x49f1, {0xb9, 0xff, 0xd1, 0xbf, 0xa9, 0x11, 0x58, 0x39} } - -#define EFI_SECURITY2_ARCH_PROTOCOL_GUID \ -{ 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68} } - -#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \ -{ 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33} } - -#define EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID \ -{ 0xd2b2b828, 0x826, 0x48a7, {0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0} } - -#define EFI_DATA_HUB_PROTOCOL_GUID \ -{ 0xae80d021, 0x618e, 0x11d4, {0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } - -#define PCD_PROTOCOL_GUID \ -{ 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7} } - -#define EFI_PCD_PROTOCOL_GUID \ -{ 0x13a3f0f6, 0x264a, 0x3ef0, {0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34} } - -#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \ -{ 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } } - -#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \ -{ 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } } - -#define EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID \ -{ 0x7aa35a69, 0x506c, 0x444f, {0xa7, 0xaf, 0x69, 0x4b, 0xf5, 0x6f, 0x71, 0xc8} } - -#define LZMA_COMPRESS_GUID \ -{ 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf} } -#endif diff --git a/stand/efi/include/eficon.h b/stand/efi/include/eficon.h deleted file mode 100644 index 3196ef4b4bf5..000000000000 --- a/stand/efi/include/eficon.h +++ /dev/null @@ -1,526 +0,0 @@ -#ifndef _EFI_CON_H -#define _EFI_CON_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - eficon.h - -Abstract: - - EFI console protocols - - - -Revision History - ---*/ - -// -// Text output protocol -// - -#define SIMPLE_TEXT_OUTPUT_PROTOCOL \ - { 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -INTERFACE_DECL(_SIMPLE_TEXT_OUTPUT_INTERFACE); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_RESET) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_OUTPUT_STRING) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN CHAR16 *String - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_TEST_STRING) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN CHAR16 *String - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_QUERY_MODE) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN UINTN ModeNumber, - OUT UINTN *Columns, - OUT UINTN *Rows - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_MODE) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN UINTN ModeNumber - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_ATTRIBUTE) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN UINTN Attribute - ); - -#define EFI_BLACK 0x00 -#define EFI_BLUE 0x01 -#define EFI_GREEN 0x02 -#define EFI_CYAN (EFI_BLUE | EFI_GREEN) -#define EFI_RED 0x04 -#define EFI_MAGENTA (EFI_BLUE | EFI_RED) -#define EFI_BROWN (EFI_GREEN | EFI_RED) -#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED) -#define EFI_BRIGHT 0x08 -#define EFI_DARKGRAY (EFI_BRIGHT) -#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT) -#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT) -#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT) -#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT) -#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT) -#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT) -#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT) - -#define EFI_TEXT_ATTR(f,b) ((f) | ((b) << 4)) - -#define EFI_BACKGROUND_BLACK 0x00 -#define EFI_BACKGROUND_BLUE 0x10 -#define EFI_BACKGROUND_GREEN 0x20 -#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN) -#define EFI_BACKGROUND_RED 0x40 -#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED) -#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) -#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED) - - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_CLEAR_SCREEN) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN UINTN Column, - IN UINTN Row - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TEXT_ENABLE_CURSOR) ( - IN struct _SIMPLE_TEXT_OUTPUT_INTERFACE *This, - IN BOOLEAN Enable - ); - -typedef struct { - INT32 MaxMode; - // current settings - INT32 Mode; - INT32 Attribute; - INT32 CursorColumn; - INT32 CursorRow; - BOOLEAN CursorVisible; -} SIMPLE_TEXT_OUTPUT_MODE; - -typedef struct _SIMPLE_TEXT_OUTPUT_INTERFACE { - EFI_TEXT_RESET Reset; - - EFI_TEXT_OUTPUT_STRING OutputString; - EFI_TEXT_TEST_STRING TestString; - - EFI_TEXT_QUERY_MODE QueryMode; - EFI_TEXT_SET_MODE SetMode; - EFI_TEXT_SET_ATTRIBUTE SetAttribute; - - EFI_TEXT_CLEAR_SCREEN ClearScreen; - EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition; - EFI_TEXT_ENABLE_CURSOR EnableCursor; - - // Current mode - SIMPLE_TEXT_OUTPUT_MODE *Mode; -} SIMPLE_TEXT_OUTPUT_INTERFACE; - -// -// Define's for required EFI Unicode Box Draw character -// - -#define BOXDRAW_HORIZONTAL 0x2500 -#define BOXDRAW_VERTICAL 0x2502 -#define BOXDRAW_DOWN_RIGHT 0x250c -#define BOXDRAW_DOWN_LEFT 0x2510 -#define BOXDRAW_UP_RIGHT 0x2514 -#define BOXDRAW_UP_LEFT 0x2518 -#define BOXDRAW_VERTICAL_RIGHT 0x251c -#define BOXDRAW_VERTICAL_LEFT 0x2524 -#define BOXDRAW_DOWN_HORIZONTAL 0x252c -#define BOXDRAW_UP_HORIZONTAL 0x2534 -#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c - -#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550 -#define BOXDRAW_DOUBLE_VERTICAL 0x2551 -#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552 -#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553 -#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554 - -#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555 -#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556 -#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557 - -#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558 -#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559 -#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a - -#define BOXDRAW_UP_LEFT_DOUBLE 0x255b -#define BOXDRAW_UP_DOUBLE_LEFT 0x255c -#define BOXDRAW_DOUBLE_UP_LEFT 0x255d - -#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e -#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f -#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560 - -#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561 -#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562 -#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563 - -#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564 -#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565 -#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566 - -#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567 -#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568 -#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569 - -#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a -#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b -#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c - -// -// EFI Required Block Elements Code Chart -// - -#define BLOCKELEMENT_FULL_BLOCK 0x2588 -#define BLOCKELEMENT_LIGHT_SHADE 0x2591 -// -// EFI Required Geometric Shapes Code Chart -// - -#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2 -#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba -#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc -#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4 - -// -// EFI Required Arrow shapes -// - -#define ARROW_UP 0x2191 -#define ARROW_DOWN 0x2193 - -// -// Text input protocol -// - -#define SIMPLE_TEXT_INPUT_PROTOCOL \ - { 0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -INTERFACE_DECL(_SIMPLE_INPUT_INTERFACE); - -typedef struct { - UINT16 ScanCode; - CHAR16 UnicodeChar; -} EFI_INPUT_KEY; - -// -// Baseline unicode control chars -// - -#define CHAR_NULL 0x0000 -#define CHAR_BACKSPACE 0x0008 -#define CHAR_TAB 0x0009 -#define CHAR_LINEFEED 0x000A -#define CHAR_CARRIAGE_RETURN 0x000D - -// -// Scan codes for base line keys -// - -#define SCAN_NULL 0x0000 -#define SCAN_UP 0x0001 -#define SCAN_DOWN 0x0002 -#define SCAN_RIGHT 0x0003 -#define SCAN_LEFT 0x0004 -#define SCAN_HOME 0x0005 -#define SCAN_END 0x0006 -#define SCAN_INSERT 0x0007 -#define SCAN_DELETE 0x0008 -#define SCAN_PAGE_UP 0x0009 -#define SCAN_PAGE_DOWN 0x000A -#define SCAN_F1 0x000B -#define SCAN_F2 0x000C -#define SCAN_F3 0x000D -#define SCAN_F4 0x000E -#define SCAN_F5 0x000F -#define SCAN_F6 0x0010 -#define SCAN_F7 0x0011 -#define SCAN_F8 0x0012 -#define SCAN_F9 0x0013 -#define SCAN_F10 0x0014 -#define SCAN_ESC 0x0017 - -// -// EFI Scan code Ex -// -#define SCAN_F11 0x0015 -#define SCAN_F12 0x0016 -#define SCAN_F13 0x0068 -#define SCAN_F14 0x0069 -#define SCAN_F15 0x006A -#define SCAN_F16 0x006B -#define SCAN_F17 0x006C -#define SCAN_F18 0x006D -#define SCAN_F19 0x006E -#define SCAN_F20 0x006F -#define SCAN_F21 0x0070 -#define SCAN_F22 0x0071 -#define SCAN_F23 0x0072 -#define SCAN_F24 0x0073 -#define SCAN_MUTE 0x007F -#define SCAN_VOLUME_UP 0x0080 -#define SCAN_VOLUME_DOWN 0x0081 -#define SCAN_BRIGHTNESS_UP 0x0100 -#define SCAN_BRIGHTNESS_DOWN 0x0101 -#define SCAN_SUSPEND 0x0102 -#define SCAN_HIBERNATE 0x0103 -#define SCAN_TOGGLE_DISPLAY 0x0104 -#define SCAN_RECOVERY 0x0105 -#define SCAN_EJECT 0x0106 - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_RESET) ( - IN struct _SIMPLE_INPUT_INTERFACE *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_READ_KEY) ( - IN struct _SIMPLE_INPUT_INTERFACE *This, - OUT EFI_INPUT_KEY *Key - ); - -typedef struct _SIMPLE_INPUT_INTERFACE { - EFI_INPUT_RESET Reset; - EFI_INPUT_READ_KEY ReadKeyStroke; - EFI_EVENT WaitForKey; -} SIMPLE_INPUT_INTERFACE; - -#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ - {0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \ - 0x17, 0xa6, 0x25, 0xaa} } - -INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL); - -typedef UINT8 EFI_KEY_TOGGLE_STATE; -// -// Any Shift or Toggle State that is valid should have -// high order bit set. -// -typedef struct EFI_KEY_STATE { - UINT32 KeyShiftState; - EFI_KEY_TOGGLE_STATE KeyToggleState; -} EFI_KEY_STATE; - -typedef struct { - EFI_INPUT_KEY Key; - EFI_KEY_STATE KeyState; -} EFI_KEY_DATA; - -// -// Shift state -// -#define EFI_SHIFT_STATE_VALID 0x80000000 -#define EFI_RIGHT_SHIFT_PRESSED 0x00000001 -#define EFI_LEFT_SHIFT_PRESSED 0x00000002 -#define EFI_RIGHT_CONTROL_PRESSED 0x00000004 -#define EFI_LEFT_CONTROL_PRESSED 0x00000008 -#define EFI_RIGHT_ALT_PRESSED 0x00000010 -#define EFI_LEFT_ALT_PRESSED 0x00000020 -#define EFI_RIGHT_LOGO_PRESSED 0x00000040 -#define EFI_LEFT_LOGO_PRESSED 0x00000080 -#define EFI_MENU_KEY_PRESSED 0x00000100 -#define EFI_SYS_REQ_PRESSED 0x00000200 - -// -// Toggle state -// -#define EFI_TOGGLE_STATE_VALID 0x80 -#define EFI_KEY_STATE_EXPOSED 0x40 -#define EFI_SCROLL_LOCK_ACTIVE 0x01 -#define EFI_NUM_LOCK_ACTIVE 0x02 -#define EFI_CAPS_LOCK_ACTIVE 0x04 - -// -// EFI Key Notfication Function -// -typedef -EFI_STATUS -(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) ( - IN EFI_KEY_DATA *KeyData - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_RESET_EX) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ) -/*++ - - Routine Description: - Reset the input device and optionaly run diagnostics - - Arguments: - This - Protocol instance pointer. - ExtendedVerification - Driver may perform diagnostics on reset. - - Returns: - EFI_SUCCESS - The device was reset. - EFI_DEVICE_ERROR - The device is not functioning properly and could - not be reset. - ---*/ -; - -typedef -EFI_STATUS -(EFIAPI *EFI_INPUT_READ_KEY_EX) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - OUT EFI_KEY_DATA *KeyData - ) -/*++ - - Routine Description: - Reads the next keystroke from the input device. The WaitForKey Event can - be used to test for existence of a keystroke via WaitForEvent () call. - - Arguments: - This - Protocol instance pointer. - KeyData - A pointer to a buffer that is filled in with the keystroke - state data for the key that was pressed. - - Returns: - EFI_SUCCESS - The keystroke information was returned. - EFI_NOT_READY - There was no keystroke data availiable. - EFI_DEVICE_ERROR - The keystroke information was not returned due to - hardware errors. - EFI_INVALID_PARAMETER - KeyData is NULL. ---*/ -; - -typedef -EFI_STATUS -(EFIAPI *EFI_SET_STATE) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_KEY_TOGGLE_STATE *KeyToggleState - ) -/*++ - - Routine Description: - Set certain state for the input device. - - Arguments: - This - Protocol instance pointer. - KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the - state for the input device. - - Returns: - EFI_SUCCESS - The device state was set successfully. - EFI_DEVICE_ERROR - The device is not functioning correctly and could - not have the setting adjusted. - EFI_UNSUPPORTED - The device does not have the ability to set its state. - EFI_INVALID_PARAMETER - KeyToggleState is NULL. - ---*/ -; - -typedef -EFI_STATUS -(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_KEY_DATA *KeyData, - IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, - OUT EFI_HANDLE *NotifyHandle - ) -/*++ - - Routine Description: - Register a notification function for a particular keystroke for the input device. - - Arguments: - This - Protocol instance pointer. - KeyData - A pointer to a buffer that is filled in with the keystroke - information data for the key that was pressed. - KeyNotificationFunction - Points to the function to be called when the key - sequence is typed specified by KeyData. - NotifyHandle - Points to the unique handle assigned to the registered notification. - - Returns: - EFI_SUCCESS - The notification function was registered successfully. - EFI_OUT_OF_RESOURCES - Unable to allocate resources for necessary data structures. - EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. - ---*/ -; - -typedef -EFI_STATUS -(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) ( - IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, - IN EFI_HANDLE NotificationHandle - ) -/*++ - - Routine Description: - Remove a registered notification function from a particular keystroke. - - Arguments: - This - Protocol instance pointer. - NotificationHandle - The handle of the notification function being unregistered. - - Returns: - EFI_SUCCESS - The notification function was unregistered successfully. - EFI_INVALID_PARAMETER - The NotificationHandle is invalid. - EFI_NOT_FOUND - Can not find the matching entry in database. - ---*/ -; - -typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL { - EFI_INPUT_RESET_EX Reset; - EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx; - EFI_EVENT WaitForKeyEx; - EFI_SET_STATE SetState; - EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify; - EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify; -} EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL; - -#endif diff --git a/stand/efi/include/efidebug.h b/stand/efi/include/efidebug.h deleted file mode 100644 index 40a3cd0d5bb2..000000000000 --- a/stand/efi/include/efidebug.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef _EFI_DEBUG_H -#define _EFI_DEBUG_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efidebug.h - -Abstract: - - EFI library debug functions - - - -Revision History - ---*/ - -extern UINTN EFIDebug; - -#if EFI_DEBUG - - #define DBGASSERT(a) DbgAssert(__FILE__, __LINE__, #a) - #define DEBUG(a) DbgPrint a - -#else - - #define DBGASSERT(a) - #define DEBUG(a) - -#endif - -#if EFI_DEBUG_CLEAR_MEMORY - - #define DBGSETMEM(a,l) SetMem(a,l,(CHAR8)BAD_POINTER) - -#else - - #define DBGSETMEM(a,l) - -#endif - -#define D_INIT 0x00000001 // Initialization style messages -#define D_WARN 0x00000002 // Warnings -#define D_LOAD 0x00000004 // Load events -#define D_FS 0x00000008 // EFI File system -#define D_POOL 0x00000010 // Alloc & Free's -#define D_PAGE 0x00000020 // Alloc & Free's -#define D_INFO 0x00000040 // Verbose -#define D_VARIABLE 0x00000100 // Variable -#define D_VAR 0x00000100 // Variable -#define D_BM 0x00000400 // Boot Manager -#define D_BLKIO 0x00001000 // BlkIo Driver -#define D_BLKIO_ULTRA 0x00002000 // BlkIo Driver -#define D_NET 0x00004000 // SNI Driver -#define D_NET_ULTRA 0x00008000 // SNI Driver -#define D_UNDI 0x00010000 // UNDI Driver -#define D_LOADFILE 0x00020000 // UNDI Driver -#define D_EVENT 0x00080000 // Event messages - -#define D_ERROR 0x80000000 // Error - -#define D_RESERVED 0x7ff40A80 // Bits not reserved above - -// -// Current Debug level of the system, value of EFIDebug -// -//#define EFI_DBUG_MASK (D_ERROR | D_WARN | D_LOAD | D_BLKIO | D_INIT) -#define EFI_DBUG_MASK (D_ERROR) - -// -// -// - -#if EFI_DEBUG - - #define ASSERT(a) if(!(a)) DBGASSERT(a) - #define ASSERT_LOCKED(l) if(!(l)->Lock) DBGASSERT(l not locked) - #define ASSERT_STRUCT(p,t) DBGASSERT(t not structure), p - -#else - - #define ASSERT(a) - #define ASSERT_LOCKED(l) - #define ASSERT_STRUCT(p,t) - -#endif - -// -// Prototypes -// - -INTN -DbgAssert ( - CHAR8 *file, - INTN lineno, - CHAR8 *string - ); - -INTN -DbgPrint ( - INTN mask, - CHAR8 *format, - ... - ); - -#endif diff --git a/stand/efi/include/efidef.h b/stand/efi/include/efidef.h deleted file mode 100644 index 7a63fd185874..000000000000 --- a/stand/efi/include/efidef.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef _EFI_DEF_H -#define _EFI_DEF_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efidef.h - -Abstract: - - EFI definitions - - - - -Revision History - ---*/ - -typedef UINT16 CHAR16; -typedef UINT8 CHAR8; -#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */ -typedef UINT8 BOOLEAN; -#endif - -#ifndef TRUE - #define TRUE ((BOOLEAN) 1) - #define FALSE ((BOOLEAN) 0) -#endif - -#ifndef NULL - #define NULL ((VOID *) 0) -#endif - -typedef UINTN EFI_STATUS; -typedef UINT64 EFI_LBA; -typedef UINTN EFI_TPL; -typedef VOID *EFI_HANDLE; -typedef VOID *EFI_EVENT; - - -// -// Prototype argument decoration for EFI parameters to indicate -// their direction -// -// IN - argument is passed into the function -// OUT - argument (pointer) is returned from the function -// OPTIONAL - argument is optional -// - -#ifndef IN - #define IN - #define OUT - #define OPTIONAL - #define CONST const -#endif - - -// -// A GUID -// - -typedef struct { - UINT32 Data1; - UINT16 Data2; - UINT16 Data3; - UINT8 Data4[8]; -} EFI_GUID; - - -// -// Time -// - -typedef struct { - UINT16 Year; // 1998 - 20XX - UINT8 Month; // 1 - 12 - UINT8 Day; // 1 - 31 - UINT8 Hour; // 0 - 23 - UINT8 Minute; // 0 - 59 - UINT8 Second; // 0 - 59 - UINT8 Pad1; - UINT32 Nanosecond; // 0 - 999,999,999 - INT16 TimeZone; // -1440 to 1440 or 2047 - UINT8 Daylight; - UINT8 Pad2; -} EFI_TIME; - -// Bit definitions for EFI_TIME.Daylight -#define EFI_TIME_ADJUST_DAYLIGHT 0x01 -#define EFI_TIME_IN_DAYLIGHT 0x02 - -// Value definition for EFI_TIME.TimeZone -#define EFI_UNSPECIFIED_TIMEZONE 0x07FF - - - -// -// Networking -// - -typedef struct { - UINT8 Addr[4]; -} EFI_IPv4_ADDRESS; - -typedef struct { - UINT8 Addr[16]; -} EFI_IPv6_ADDRESS; - -typedef struct { - UINT8 Addr[32]; -} EFI_MAC_ADDRESS; - -typedef struct { - UINT32 ReceivedQueueTimeoutValue; - UINT32 TransmitQueueTimeoutValue; - UINT16 ProtocolTypeFilter; - BOOLEAN EnableUnicastReceive; - BOOLEAN EnableMulticastReceive; - BOOLEAN EnableBroadcastReceive; - BOOLEAN EnablePromiscuousReceive; - BOOLEAN FlushQueuesOnReset; - BOOLEAN EnableReceiveTimestamps; - BOOLEAN DisableBackgroundPolling; -} EFI_MANAGED_NETWORK_CONFIG_DATA; - -// -// Memory -// - -typedef UINT64 EFI_PHYSICAL_ADDRESS; -typedef UINT64 EFI_VIRTUAL_ADDRESS; - -typedef enum { - AllocateAnyPages, - AllocateMaxAddress, - AllocateAddress, - MaxAllocateType -} EFI_ALLOCATE_TYPE; - -//Preseve the attr on any range supplied. -//ConventialMemory must have WB,SR,SW when supplied. -//When allocating from ConventialMemory always make it WB,SR,SW -//When returning to ConventialMemory always make it WB,SR,SW -//When getting the memory map, or on RT for runtime types - - -typedef enum { - EfiReservedMemoryType, - EfiLoaderCode, - EfiLoaderData, - EfiBootServicesCode, - EfiBootServicesData, - EfiRuntimeServicesCode, - EfiRuntimeServicesData, - EfiConventionalMemory, - EfiUnusableMemory, - EfiACPIReclaimMemory, - EfiACPIMemoryNVS, - EfiMemoryMappedIO, - EfiMemoryMappedIOPortSpace, - EfiPalCode, - EfiPersistentMemory, - EfiMaxMemoryType -} EFI_MEMORY_TYPE; - -// possible caching types for the memory range -#define EFI_MEMORY_UC 0x0000000000000001 -#define EFI_MEMORY_WC 0x0000000000000002 -#define EFI_MEMORY_WT 0x0000000000000004 -#define EFI_MEMORY_WB 0x0000000000000008 -#define EFI_MEMORY_UCE 0x0000000000000010 - -// physical memory protection on range -#define EFI_MEMORY_WP 0x0000000000001000 -#define EFI_MEMORY_RP 0x0000000000002000 -#define EFI_MEMORY_XP 0x0000000000004000 -#define EFI_MEMORY_NV 0x0000000000008000 -#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000 -#define EFI_MEMORY_RO 0x0000000000020000 - -// range requires a runtime mapping -#define EFI_MEMORY_RUNTIME 0x8000000000000000 - -#define EFI_MEMORY_DESCRIPTOR_VERSION 1 -typedef struct { - UINT32 Type; // Field size is 32 bits followed by 32 bit pad - UINT32 Pad; - EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits - EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits - UINT64 NumberOfPages; // Field size is 64 bits - UINT64 Attribute; // Field size is 64 bits -} EFI_MEMORY_DESCRIPTOR; - -// -// International Language -// - -typedef UINT8 ISO_639_2; -#define ISO_639_2_ENTRY_SIZE 3 - -// -// -// - -#define EFI_PAGE_SIZE 4096 -#define EFI_PAGE_MASK 0xFFF -#define EFI_PAGE_SHIFT 12 - -#define EFI_SIZE_TO_PAGES(a) \ - ( ((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0) ) - -#endif diff --git a/stand/efi/include/efidevp.h b/stand/efi/include/efidevp.h deleted file mode 100644 index 5fe42a3e7e8f..000000000000 --- a/stand/efi/include/efidevp.h +++ /dev/null @@ -1,510 +0,0 @@ -#ifndef _DEVPATH_H -#define _DEVPATH_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - devpath.h - -Abstract: - - Defines for parsing the EFI Device Path structures - - - -Revision History - ---*/ - -// -// Device Path structures - Section C -// - -#pragma pack(1) - -typedef struct _EFI_DEVICE_PATH { - UINT8 Type; - UINT8 SubType; - UINT8 Length[2]; -} EFI_DEVICE_PATH; - -#define EFI_DP_TYPE_MASK 0x7F -#define EFI_DP_TYPE_UNPACKED 0x80 - -#define END_DEVICE_PATH_TYPE 0x7f - -#define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff -#define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 -#define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) - - -#define DP_IS_END_TYPE(a) -#define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) - -#define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) -#define DevicePathSubType(a) ( (a)->SubType ) -#define DevicePathNodeLength(a) ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8))) -#define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) -#define IsDevicePathType(a, t) ( DevicePathType(a) == t ) -#define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE) -#define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) -#define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) -#define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) - - -#define SetDevicePathNodeLength(a,l) { \ - (a)->Length[0] = (UINT8) (l); \ - (a)->Length[1] = (UINT8) ((l) >> 8); \ - } - -#define SetDevicePathEndNode(a) { \ - (a)->Type = END_DEVICE_PATH_TYPE; \ - (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ - (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ - (a)->Length[1] = 0; \ - } - -/* - * - */ -#define HARDWARE_DEVICE_PATH 0x01 - -#define HW_PCI_DP 0x01 -typedef struct _PCI_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT8 Function; - UINT8 Device; -} PCI_DEVICE_PATH; - -#define HW_PCCARD_DP 0x02 -typedef struct _PCCARD_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT8 FunctionNumber; -} PCCARD_DEVICE_PATH; - -#define HW_MEMMAP_DP 0x03 -typedef struct _MEMMAP_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 MemoryType; - EFI_PHYSICAL_ADDRESS StartingAddress; - EFI_PHYSICAL_ADDRESS EndingAddress; -} MEMMAP_DEVICE_PATH; - -#define HW_VENDOR_DP 0x04 -typedef struct _VENDOR_DEVICE_PATH { - EFI_DEVICE_PATH Header; - EFI_GUID Guid; -} VENDOR_DEVICE_PATH; - -#define UNKNOWN_DEVICE_GUID \ - { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } - -typedef struct _UKNOWN_DEVICE_VENDOR_DP { - VENDOR_DEVICE_PATH DevicePath; - UINT8 LegacyDriveLetter; -} UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; - -#define HW_CONTROLLER_DP 0x05 -typedef struct _CONTROLLER_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Controller; -} CONTROLLER_DEVICE_PATH; - -/* - * - */ -#define ACPI_DEVICE_PATH 0x02 - -#define ACPI_DP 0x01 -typedef struct _ACPI_HID_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 HID; - UINT32 UID; -} ACPI_HID_DEVICE_PATH; - -#define ACPI_EXTENDED_DP 0x02 -typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 HID; - UINT32 UID; - UINT32 CID; -} ACPI_EXTENDED_HID_DEVICE_PATH; - -#define ACPI_ADR_DP 0x03 -/* ACPI_ADR_DEVICE_PATH not defined */ - -// -// EISA ID Macro -// EISA ID Definition 32-bits -// bits[15:0] - three character compressed ASCII EISA ID. -// bits[31:16] - binary number -// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' -// -#define PNP_EISA_ID_CONST 0x41d0 -#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) -#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) -#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) - -#define PNP_EISA_ID_MASK 0xffff -#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) -/* - * - */ -#define MESSAGING_DEVICE_PATH 0x03 - -#define MSG_ATAPI_DP 0x01 -typedef struct _ATAPI_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT8 PrimarySecondary; - UINT8 SlaveMaster; - UINT16 Lun; -} ATAPI_DEVICE_PATH; - -#define MSG_SCSI_DP 0x02 -typedef struct _SCSI_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT16 Pun; - UINT16 Lun; -} SCSI_DEVICE_PATH; - -#define MSG_FIBRECHANNEL_DP 0x03 -typedef struct _FIBRECHANNEL_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Reserved; - UINT64 WWN; - UINT64 Lun; -} FIBRECHANNEL_DEVICE_PATH; - -#define MSG_1394_DP 0x04 -typedef struct _F1394_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Reserved; - UINT64 Guid; -} F1394_DEVICE_PATH; - -#define MSG_USB_DP 0x05 -typedef struct _USB_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT8 ParentPortNumber; - UINT8 InterfaceNumber; -} USB_DEVICE_PATH; - -#define MSG_USB_CLASS_DP 0x0F -typedef struct _USB_CLASS_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT16 VendorId; - UINT16 ProductId; - UINT8 DeviceClass; - UINT8 DeviceSubClass; - UINT8 DeviceProtocol; -} USB_CLASS_DEVICE_PATH; - -#define MSG_I2O_DP 0x06 -typedef struct _I2O_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Tid; -} I2O_DEVICE_PATH; - -#define MSG_MAC_ADDR_DP 0x0b -typedef struct _MAC_ADDR_DEVICE_PATH { - EFI_DEVICE_PATH Header; - EFI_MAC_ADDRESS MacAddress; - UINT8 IfType; -} MAC_ADDR_DEVICE_PATH; - -#define MSG_IPv4_DP 0x0c -typedef struct _IPv4_DEVICE_PATH { - EFI_DEVICE_PATH Header; - EFI_IPv4_ADDRESS LocalIpAddress; - EFI_IPv4_ADDRESS RemoteIpAddress; - UINT16 LocalPort; - UINT16 RemotePort; - UINT16 Protocol; - BOOLEAN StaticIpAddress; - EFI_IPv4_ADDRESS GatewayIpAddress; - EFI_IPv4_ADDRESS SubnetMask; -} IPv4_DEVICE_PATH; - -#define MSG_IPv6_DP 0x0d -typedef struct _IPv6_DEVICE_PATH { - EFI_DEVICE_PATH Header; - EFI_IPv6_ADDRESS LocalIpAddress; - EFI_IPv6_ADDRESS RemoteIpAddress; - UINT16 LocalPort; - UINT16 RemotePort; - UINT16 Protocol; - BOOLEAN StaticIpAddress; -} IPv6_DEVICE_PATH; - -#define MSG_INFINIBAND_DP 0x09 -typedef struct _INFINIBAND_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 ResourceFlags; - UINT8 PortGid[16]; - UINT64 ServiceId; - UINT64 TargetPortId; - UINT64 DeviceId; -} INFINIBAND_DEVICE_PATH; - -#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01 -#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02 -#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04 -#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08 -#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10 - -#define MSG_UART_DP 0x0e -typedef struct _UART_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 Reserved; - UINT64 BaudRate; - UINT8 DataBits; - UINT8 Parity; - UINT8 StopBits; -} UART_DEVICE_PATH; - -#define MSG_VENDOR_DP 0x0A -/* Use VENDOR_DEVICE_PATH struct */ - -#define DEVICE_PATH_MESSAGING_PC_ANSI \ - { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define DEVICE_PATH_MESSAGING_VT_100 \ - { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define DEVICE_PATH_MESSAGING_VT_100_PLUS \ - { 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} } - -#define DEVICE_PATH_MESSAGING_VT_UTF8 \ - { 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} } - -/* Device Logical Unit SubType. */ -#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11 -typedef struct { - EFI_DEVICE_PATH Header; - /* Logical Unit Number for the interface. */ - UINT8 Lun; -} DEVICE_LOGICAL_UNIT_DEVICE_PATH; - -#define MSG_SATA_DP 0x12 -typedef struct _SATA_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT16 HBAPortNumber; - UINT16 PortMultiplierPortNumber; - UINT16 Lun; -} SATA_DEVICE_PATH; - - -/* DNS Device Path SubType */ -#define MSG_DNS_DP 0x1F -typedef struct { - EFI_DEVICE_PATH Header; - /* Indicates the DNS server address is IPv4 or IPv6 address. */ - UINT8 IsIPv6; - /* Instance of the DNS server address. */ - /* XXX: actually EFI_IP_ADDRESS */ - EFI_IPv4_ADDRESS DnsServerIp[]; -} DNS_DEVICE_PATH; - -/* Uniform Resource Identifiers (URI) Device Path SubType */ -#define MSG_URI_DP 0x18 -typedef struct { - EFI_DEVICE_PATH Header; - /* Instance of the URI pursuant to RFC 3986. */ - CHAR8 Uri[]; -} URI_DEVICE_PATH; - -#define MEDIA_DEVICE_PATH 0x04 - -#define MEDIA_HARDDRIVE_DP 0x01 -typedef struct _HARDDRIVE_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 PartitionNumber; - UINT64 PartitionStart; - UINT64 PartitionSize; - UINT8 Signature[16]; - UINT8 MBRType; - UINT8 SignatureType; -} HARDDRIVE_DEVICE_PATH; - -#define MBR_TYPE_PCAT 0x01 -#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 - -#define SIGNATURE_TYPE_MBR 0x01 -#define SIGNATURE_TYPE_GUID 0x02 - -#define MEDIA_CDROM_DP 0x02 -typedef struct _CDROM_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT32 BootEntry; - UINT64 PartitionStart; - UINT64 PartitionSize; -} CDROM_DEVICE_PATH; - -#define MEDIA_VENDOR_DP 0x03 -/* Use VENDOR_DEVICE_PATH struct */ - -#define MEDIA_FILEPATH_DP 0x04 -typedef struct _FILEPATH_DEVICE_PATH { - EFI_DEVICE_PATH Header; - CHAR16 PathName[1]; -} FILEPATH_DEVICE_PATH; - -#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) - -#define MEDIA_PROTOCOL_DP 0x05 -typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { - EFI_DEVICE_PATH Header; - EFI_GUID Protocol; -} MEDIA_PROTOCOL_DEVICE_PATH; - - -#define BBS_DEVICE_PATH 0x05 -#define BBS_BBS_DP 0x01 -typedef struct _BBS_BBS_DEVICE_PATH { - EFI_DEVICE_PATH Header; - UINT16 DeviceType; - UINT16 StatusFlag; - CHAR8 String[1]; -} BBS_BBS_DEVICE_PATH; - -/* DeviceType definitions - from BBS specification */ -#define BBS_TYPE_FLOPPY 0x01 -#define BBS_TYPE_HARDDRIVE 0x02 -#define BBS_TYPE_CDROM 0x03 -#define BBS_TYPE_PCMCIA 0x04 -#define BBS_TYPE_USB 0x05 -#define BBS_TYPE_EMBEDDED_NETWORK 0x06 -#define BBS_TYPE_DEV 0x80 -#define BBS_TYPE_UNKNOWN 0xFF - -typedef union { - EFI_DEVICE_PATH DevPath; - PCI_DEVICE_PATH Pci; - PCCARD_DEVICE_PATH PcCard; - MEMMAP_DEVICE_PATH MemMap; - VENDOR_DEVICE_PATH Vendor; - UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; - CONTROLLER_DEVICE_PATH Controller; - ACPI_HID_DEVICE_PATH Acpi; - - ATAPI_DEVICE_PATH Atapi; - SCSI_DEVICE_PATH Scsi; - FIBRECHANNEL_DEVICE_PATH FibreChannel; - - F1394_DEVICE_PATH F1394; - USB_DEVICE_PATH Usb; - USB_CLASS_DEVICE_PATH UsbClass; - I2O_DEVICE_PATH I2O; - MAC_ADDR_DEVICE_PATH MacAddr; - IPv4_DEVICE_PATH Ipv4; - IPv6_DEVICE_PATH Ipv6; - INFINIBAND_DEVICE_PATH InfiniBand; - UART_DEVICE_PATH Uart; - - HARDDRIVE_DEVICE_PATH HardDrive; - CDROM_DEVICE_PATH CD; - - FILEPATH_DEVICE_PATH FilePath; - MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; - - BBS_BBS_DEVICE_PATH Bbs; - -} EFI_DEV_PATH; - -typedef union { - EFI_DEVICE_PATH *DevPath; - PCI_DEVICE_PATH *Pci; - PCCARD_DEVICE_PATH *PcCard; - MEMMAP_DEVICE_PATH *MemMap; - VENDOR_DEVICE_PATH *Vendor; - UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; - CONTROLLER_DEVICE_PATH *Controller; - ACPI_HID_DEVICE_PATH *Acpi; - ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; - - ATAPI_DEVICE_PATH *Atapi; - SCSI_DEVICE_PATH *Scsi; - FIBRECHANNEL_DEVICE_PATH *FibreChannel; - - F1394_DEVICE_PATH *F1394; - USB_DEVICE_PATH *Usb; - USB_CLASS_DEVICE_PATH *UsbClass; - I2O_DEVICE_PATH *I2O; - MAC_ADDR_DEVICE_PATH *MacAddr; - IPv4_DEVICE_PATH *Ipv4; - IPv6_DEVICE_PATH *Ipv6; - INFINIBAND_DEVICE_PATH *InfiniBand; - UART_DEVICE_PATH *Uart; - - HARDDRIVE_DEVICE_PATH *HardDrive; - - FILEPATH_DEVICE_PATH *FilePath; - MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; - - CDROM_DEVICE_PATH *CD; - BBS_BBS_DEVICE_PATH *Bbs; - -} EFI_DEV_PATH_PTR; - -#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \ - { 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } } - -#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ - { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } } - -#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \ - { 0x05c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } } - -INTERFACE_DECL(_EFI_DEVICE_PATH_PROTOCOL); - -typedef -CHAR16* -(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) ( - IN struct _EFI_DEVICE_PATH *This, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortCuts - ); - -typedef -CHAR16* -(EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) ( - IN struct _EFI_DEVICE_PATH *This, - IN BOOLEAN DisplayOnly, - IN BOOLEAN AllowShortCuts - ); - -typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL { - EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; - EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; -} EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; - -typedef -struct _EFI_DEVICE_PATH* -(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) ( - IN CONST CHAR16* TextDeviceNode - ); -typedef -struct _EFI_DEVICE_PATH* -(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) ( - IN CONST CHAR16* TextDevicePath - ); - - -typedef struct _EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL { - EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode; - EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath; -} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL; - -#pragma pack() - -#endif diff --git a/stand/efi/include/efierr.h b/stand/efi/include/efierr.h deleted file mode 100644 index 2aa2622a3877..000000000000 --- a/stand/efi/include/efierr.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _EFI_ERR_H -#define _EFI_ERR_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efierr.h - -Abstract: - - EFI error codes - - - - -Revision History - ---*/ - - -#define EFIWARN(a) (a) -#define EFI_ERROR(a) (((INTN) a) < 0) -#define EFI_ERROR_CODE(a) (unsigned long)(a & ~EFI_ERROR_MASK) - - -#define EFI_SUCCESS 0 -#define EFI_LOAD_ERROR EFIERR(1) -#define EFI_INVALID_PARAMETER EFIERR(2) -#define EFI_UNSUPPORTED EFIERR(3) -#define EFI_BAD_BUFFER_SIZE EFIERR(4) -#define EFI_BUFFER_TOO_SMALL EFIERR(5) -#define EFI_NOT_READY EFIERR(6) -#define EFI_DEVICE_ERROR EFIERR(7) -#define EFI_WRITE_PROTECTED EFIERR(8) -#define EFI_OUT_OF_RESOURCES EFIERR(9) -#define EFI_VOLUME_CORRUPTED EFIERR(10) -#define EFI_VOLUME_FULL EFIERR(11) -#define EFI_NO_MEDIA EFIERR(12) -#define EFI_MEDIA_CHANGED EFIERR(13) -#define EFI_NOT_FOUND EFIERR(14) -#define EFI_ACCESS_DENIED EFIERR(15) -#define EFI_NO_RESPONSE EFIERR(16) -#define EFI_NO_MAPPING EFIERR(17) -#define EFI_TIMEOUT EFIERR(18) -#define EFI_NOT_STARTED EFIERR(19) -#define EFI_ALREADY_STARTED EFIERR(20) -#define EFI_ABORTED EFIERR(21) -#define EFI_ICMP_ERROR EFIERR(22) -#define EFI_TFTP_ERROR EFIERR(23) -#define EFI_PROTOCOL_ERROR EFIERR(24) - -#define EFI_WARN_UNKNOWN_GLYPH EFIWARN(1) -#define EFI_WARN_DELETE_FAILURE EFIWARN(2) -#define EFI_WARN_WRITE_FAILURE EFIWARN(3) -#define EFI_WARN_BUFFER_TOO_SMALL EFIWARN(4) - -#endif diff --git a/stand/efi/include/efifpswa.h b/stand/efi/include/efifpswa.h deleted file mode 100644 index ed831d02e51b..000000000000 --- a/stand/efi/include/efifpswa.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _EFI_FPSWA_H -#define _EFI_FPSWA_H - -/* - * EFI FP SWA Driver (Floating Point Software Assist) - */ - -#define EFI_INTEL_FPSWA \ - { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -INTERFACE_DECL(_FPSWA_INTERFACE); - -typedef struct _FPSWA_RET { - UINT64 status; - UINT64 err1; - UINT64 err2; - UINT64 err3; -} FPSWA_RET; - -typedef -FPSWA_RET -(EFIAPI *EFI_FPSWA) ( - IN UINTN TrapType, - IN OUT VOID *Bundle, - IN OUT UINT64 *pipsr, - IN OUT UINT64 *pfsr, - IN OUT UINT64 *pisr, - IN OUT UINT64 *ppreds, - IN OUT UINT64 *pifs, - IN OUT VOID *fp_state - ); - -typedef struct _FPSWA_INTERFACE { - UINT32 Revision; - UINT32 Reserved; - EFI_FPSWA Fpswa; -} FPSWA_INTERFACE; - -#endif diff --git a/stand/efi/include/efifs.h b/stand/efi/include/efifs.h deleted file mode 100644 index 0197449a9399..000000000000 --- a/stand/efi/include/efifs.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef _EFI_FS_H -#define _EFI_FS_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efifs.h - -Abstract: - - EFI File System structures - - - -Revision History - ---*/ - - -// -// EFI Partition header (normally starts in LBA 1) -// - -#define EFI_PARTITION_SIGNATURE 0x5053595320494249 -#define EFI_PARTITION_REVISION 0x00010001 -#define MIN_EFI_PARTITION_BLOCK_SIZE 512 -#define EFI_PARTITION_LBA 1 - -typedef struct _EFI_PARTITION_HEADER { - EFI_TABLE_HEADER Hdr; - UINT32 DirectoryAllocationNumber; - UINT32 BlockSize; - EFI_LBA FirstUsableLba; - EFI_LBA LastUsableLba; - EFI_LBA UnusableSpace; - EFI_LBA FreeSpace; - EFI_LBA RootFile; - EFI_LBA SecutiryFile; -} EFI_PARTITION_HEADER; - - -// -// File header -// - -#define EFI_FILE_HEADER_SIGNATURE 0x454c494620494249 -#define EFI_FILE_HEADER_REVISION 0x00010000 -#define EFI_FILE_STRING_SIZE 260 - -typedef struct _EFI_FILE_HEADER { - EFI_TABLE_HEADER Hdr; - UINT32 Class; - UINT32 LBALOffset; - EFI_LBA Parent; - UINT64 FileSize; - UINT64 FileAttributes; - EFI_TIME FileCreateTime; - EFI_TIME FileModificationTime; - EFI_GUID VendorGuid; - CHAR16 FileString[EFI_FILE_STRING_SIZE]; -} EFI_FILE_HEADER; - - -// -// Return the file's first LBAL which is in the same -// logical block as the file header -// - -#define EFI_FILE_LBAL(a) ((EFI_LBAL *) (((CHAR8 *) (a)) + (a)->LBALOffset)) - -#define EFI_FILE_CLASS_FREE_SPACE 1 -#define EFI_FILE_CLASS_EMPTY 2 -#define EFI_FILE_CLASS_NORMAL 3 - - -// -// Logical Block Address List - the fundemental block -// description structure -// - -#define EFI_LBAL_SIGNATURE 0x4c41424c20494249 -#define EFI_LBAL_REVISION 0x00010000 - -typedef struct _EFI_LBAL { - EFI_TABLE_HEADER Hdr; - UINT32 Class; - EFI_LBA Parent; - EFI_LBA Next; - UINT32 ArraySize; - UINT32 ArrayCount; -} EFI_LBAL; - -// Array size -#define EFI_LBAL_ARRAY_SIZE(lbal,offs,blks) \ - (((blks) - (offs) - (lbal)->Hdr.HeaderSize) / sizeof(EFI_RL)) - -// -// Logical Block run-length -// - -typedef struct { - EFI_LBA Start; - UINT64 Length; -} EFI_RL; - -// -// Return the run-length structure from an LBAL header -// - -#define EFI_LBAL_RL(a) ((EFI_RL*) (((CHAR8 *) (a)) + (a)->Hdr.HeaderSize)) - -#endif diff --git a/stand/efi/include/efigop.h b/stand/efi/include/efigop.h deleted file mode 100644 index e1d4b8163401..000000000000 --- a/stand/efi/include/efigop.h +++ /dev/null @@ -1,120 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efigop.h - -Abstract: - Info about framebuffers - - - - -Revision History - ---*/ - -#ifndef _EFIGOP_H -#define _EFIGOP_H - -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ - { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a} } - -INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT); - -typedef struct { - UINT32 RedMask; - UINT32 GreenMask; - UINT32 BlueMask; - UINT32 ReservedMask; -} EFI_PIXEL_BITMASK; - -typedef enum { - PixelRedGreenBlueReserved8BitPerColor, - PixelBlueGreenRedReserved8BitPerColor, - PixelBitMask, - PixelBltOnly, - PixelFormatMax, -} EFI_GRAPHICS_PIXEL_FORMAT; - -typedef struct { - UINT32 Version; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; - EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; - EFI_PIXEL_BITMASK PixelInformation; - UINT32 PixelsPerScanLine; -} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; - -typedef struct { - UINT32 MaxMode; - UINT32 Mode; - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; - UINTN SizeOfInfo; - EFI_PHYSICAL_ADDRESS FrameBufferBase; - UINTN FrameBufferSize; -} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) ( - IN struct _EFI_GRAPHICS_OUTPUT *This, - IN UINT32 ModeNumber, - OUT UINTN *SizeOfInfo, - OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) ( - IN struct _EFI_GRAPHICS_OUTPUT *This, - IN UINT32 ModeNumber - ); - -typedef struct { - UINT8 Blue; - UINT8 Green; - UINT8 Red; - UINT8 Reserved; -} EFI_GRAPHICS_OUTPUT_BLT_PIXEL; - -typedef enum { - EfiBltVideoFill, - EfiBltVideoToBltBuffer, - EfiBltBufferToVideo, - EfiBltVideoToVideo, - EfiGraphcisOutputBltOperationMax, -} EFI_GRAPHICS_OUTPUT_BLT_OPERATION; - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) ( - IN struct _EFI_GRAPHICS_OUTPUT *This, - IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, - IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta - ); - -typedef struct _EFI_GRAPHICS_OUTPUT { - EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt; - EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; -} EFI_GRAPHICS_OUTPUT; - -#endif /* _EFIGOP_H */ diff --git a/stand/efi/include/efiip.h b/stand/efi/include/efiip.h deleted file mode 100644 index 839507964f75..000000000000 --- a/stand/efi/include/efiip.h +++ /dev/null @@ -1,459 +0,0 @@ -#ifndef _EFI_IP_H -#define _EFI_IP_H - -/*++ -Copyright (c) 2013 Intel Corporation - ---*/ - -#define EFI_IP4_SERVICE_BINDING_PROTOCOL \ - {0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}} - -#define EFI_IP4_PROTOCOL \ - {0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}} - -#define EFI_IP6_SERVICE_BINDING_PROTOCOL \ - {0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}} - -#define EFI_IP6_PROTOCOL \ - {0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}} - -INTERFACE_DECL(_EFI_IP4); -INTERFACE_DECL(_EFI_IP6); - -typedef struct { - EFI_HANDLE InstanceHandle; - EFI_IPv4_ADDRESS Ip4Address; - EFI_IPv4_ADDRESS SubnetMask; -} EFI_IP4_ADDRESS_PAIR; - -typedef struct { - EFI_HANDLE DriverHandle; - UINT32 AddressCount; - EFI_IP4_ADDRESS_PAIR AddressPairs[1]; -} EFI_IP4_VARIABLE_DATA; - -typedef struct { - UINT8 DefaultProtocol; - BOOLEAN AcceptAnyProtocol; - BOOLEAN AcceptIcmpErrors; - BOOLEAN AcceptBroadcast; - BOOLEAN AcceptPromiscuous; - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS StationAddress; - EFI_IPv4_ADDRESS SubnetMask; - UINT8 TypeOfService; - UINT8 TimeToLive; - BOOLEAN DoNotFragment; - BOOLEAN RawData; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; -} EFI_IP4_CONFIG_DATA; - -typedef struct { - EFI_IPv4_ADDRESS SubnetAddress; - EFI_IPv4_ADDRESS SubnetMask; - EFI_IPv4_ADDRESS GatewayAddress; -} EFI_IP4_ROUTE_TABLE; - -typedef struct { - UINT8 Type; - UINT8 Code; -} EFI_IP4_ICMP_TYPE; - -typedef struct { - BOOLEAN IsStarted; - UINT32 MaxPacketSize; - EFI_IP4_CONFIG_DATA ConfigData; - BOOLEAN IsConfigured; - UINT32 GroupCount; - EFI_IPv4_ADDRESS *GroupTable; - UINT32 RouteCount; - EFI_IP4_ROUTE_TABLE *RouteTable; - UINT32 IcmpTypeCount; - EFI_IP4_ICMP_TYPE *IcmpTypeList; -} EFI_IP4_MODE_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_GET_MODE_DATA) ( - IN struct _EFI_IP4 *This, - OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CONFIGURE) ( - IN struct _EFI_IP4 *This, - IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_GROUPS) ( - IN struct _EFI_IP4 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_ROUTES) ( - IN struct _EFI_IP4 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv4_ADDRESS *SubnetAddress, - IN EFI_IPv4_ADDRESS *SubnetMask, - IN EFI_IPv4_ADDRESS *GatewayAddress - ); - -#pragma pack(1) -typedef struct { - UINT8 HeaderLength:4; - UINT8 Version:4; - UINT8 TypeOfService; - UINT16 TotalLength; - UINT16 Identification; - UINT16 Fragmentation; - UINT8 TimeToLive; - UINT8 Protocol; - UINT16 Checksum; - EFI_IPv4_ADDRESS SourceAddress; - EFI_IPv4_ADDRESS DestinationAddress; -} EFI_IP4_HEADER; -#pragma pack() - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_IP4_FRAGMENT_DATA; - -typedef struct { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - UINT32 HeaderLength; - EFI_IP4_HEADER *Header; - UINT32 OptionsLength; - VOID *Options; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_IP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_IP4_RECEIVE_DATA; - -typedef struct { - EFI_IPv4_ADDRESS SourceAddress; - EFI_IPv4_ADDRESS GatewayAddress; - UINT8 Protocol; - UINT8 TypeOfService; - UINT8 TimeToLive; - BOOLEAN DoNotFragment; -} EFI_IP4_OVERRIDE_DATA; - -typedef struct { - EFI_IPv4_ADDRESS DestinationAddress; - EFI_IP4_OVERRIDE_DATA *OverrideData; - UINT32 OptionsLength; - VOID *OptionsBuffer; - UINT32 TotalDataLength; - UINT32 FragmentCount; - EFI_IP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_IP4_TRANSMIT_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_IP4_RECEIVE_DATA *RxData; - EFI_IP4_TRANSMIT_DATA *TxData; - } Packet; -} EFI_IP4_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_TRANSMIT) ( - IN struct _EFI_IP4 *This, - IN EFI_IP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_RECEIVE) ( - IN struct _EFI_IP4 *This, - IN EFI_IP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_CANCEL)( - IN struct _EFI_IP4 *This, - IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP4_POLL) ( - IN struct _EFI_IP4 *This - ); - -typedef struct _EFI_IP4 { - EFI_IP4_GET_MODE_DATA GetModeData; - EFI_IP4_CONFIGURE Configure; - EFI_IP4_GROUPS Groups; - EFI_IP4_ROUTES Routes; - EFI_IP4_TRANSMIT Transmit; - EFI_IP4_RECEIVE Receive; - EFI_IP4_CANCEL Cancel; - EFI_IP4_POLL Poll; -} EFI_IP4; - -typedef struct { - UINT8 DefaultProtocol; - BOOLEAN AcceptAnyProtocol; - BOOLEAN AcceptIcmpErrors; - BOOLEAN AcceptPromiscuous; - EFI_IPv6_ADDRESS DestinationAddress; - EFI_IPv6_ADDRESS StationAddress; - UINT8 TrafficClass; - UINT8 HopLimit; - UINT32 FlowLabel; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; -} EFI_IP6_CONFIG_DATA; - -typedef struct { - EFI_IPv6_ADDRESS Address; - UINT8 PrefixLength; -} EFI_IP6_ADDRESS_INFO; - -typedef struct { - EFI_IPv6_ADDRESS Gateway; - EFI_IPv6_ADDRESS Destination; - UINT8 PrefixLength; -} EFI_IP6_ROUTE_TABLE; - -typedef enum { - EfiNeighborInComplete, - EfiNeighborReachable, - EfiNeighborStale, - EfiNeighborDelay, - EfiNeighborProbe -} EFI_IP6_NEIGHBOR_STATE; - -typedef struct { - EFI_IPv6_ADDRESS Neighbor; - EFI_MAC_ADDRESS LinkAddress; - EFI_IP6_NEIGHBOR_STATE State; -} EFI_IP6_NEIGHBOR_CACHE; - -typedef struct { - UINT8 Type; - UINT8 Code; -} EFI_IP6_ICMP_TYPE; - -//*********************************************************** -// ICMPv6 type definitions for error messages -//*********************************************************** -#define ICMP_V6_DEST_UNREACHABLE 0x1 -#define ICMP_V6_PACKET_TOO_BIG 0x2 -#define ICMP_V6_TIME_EXCEEDED 0x3 -#define ICMP_V6_PARAMETER_PROBLEM 0x4 - -//*********************************************************** -// ICMPv6 type definition for informational messages -//*********************************************************** -#define ICMP_V6_ECHO_REQUEST 0x80 -#define ICMP_V6_ECHO_REPLY 0x81 -#define ICMP_V6_LISTENER_QUERY 0x82 -#define ICMP_V6_LISTENER_REPORT 0x83 -#define ICMP_V6_LISTENER_DONE 0x84 -#define ICMP_V6_ROUTER_SOLICIT 0x85 -#define ICMP_V6_ROUTER_ADVERTISE 0x86 -#define ICMP_V6_NEIGHBOR_SOLICIT 0x87 -#define ICMP_V6_NEIGHBOR_ADVERTISE 0x88 -#define ICMP_V6_REDIRECT 0x89 -#define ICMP_V6_LISTENER_REPORT_2 0x8F - -//*********************************************************** -// ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE -//*********************************************************** -#define ICMP_V6_NO_ROUTE_TO_DEST 0x0 -#define ICMP_V6_COMM_PROHIBITED 0x1 -#define ICMP_V6_BEYOND_SCOPE 0x2 -#define ICMP_V6_ADDR_UNREACHABLE 0x3 -#define ICMP_V6_PORT_UNREACHABLE 0x4 -#define ICMP_V6_SOURCE_ADDR_FAILED 0x5 -#define ICMP_V6_ROUTE_REJECTED 0x6 - -//*********************************************************** -// ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED -//*********************************************************** -#define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0 -#define ICMP_V6_TIMEOUT_REASSEMBLE 0x1 - -//*********************************************************** -// ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM -//*********************************************************** -#define ICMP_V6_ERRONEOUS_HEADER 0x0 -#define ICMP_V6_UNRECOGNIZE_NEXT_HDR 0x1 -#define ICMP_V6_UNRECOGNIZE_OPTION 0x2 - -typedef struct { - BOOLEAN IsStarted; - UINT32 MaxPacketSize; - EFI_IP6_CONFIG_DATA ConfigData; - BOOLEAN IsConfigured; - UINT32 AddressCount; - EFI_IP6_ADDRESS_INFO *AddressList; - UINT32 GroupCount; - EFI_IPv6_ADDRESS *GroupTable; - UINT32 RouteCount; - EFI_IP6_ROUTE_TABLE *RouteTable; - UINT32 NeighborCount; - EFI_IP6_NEIGHBOR_CACHE *NeighborCache; - UINT32 PrefixCount; - EFI_IP6_ADDRESS_INFO *PrefixTable; - UINT32 IcmpTypeCount; - EFI_IP6_ICMP_TYPE *IcmpTypeList; -} EFI_IP6_MODE_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_GET_MODE_DATA) ( - IN struct _EFI_IP6 *This, - OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_CONFIGURE) ( - IN struct _EFI_IP6 *This, - IN EFI_IP6_CONFIG_DATA *Ip6ConfigData OPTIONAL - ); -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_GROUPS) ( - IN struct _EFI_IP6 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv6_ADDRESS *GroupAddress OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_ROUTES) ( - IN struct _EFI_IP6 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv6_ADDRESS *Destination OPTIONAL, - IN UINT8 PrefixLength, - IN EFI_IPv6_ADDRESS *GatewayAddress OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_NEIGHBORS) ( - IN struct _EFI_IP6 *This, - IN BOOLEAN DeleteFlag, - IN EFI_IPv6_ADDRESS *TargetIp6Address, - IN EFI_MAC_ADDRESS *TargetLinkAddress OPTIONAL, - IN UINT32 Timeout, - IN BOOLEAN Override - ); - -typedef struct _EFI_IP6_FRAGMENT_DATA { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_IP6_FRAGMENT_DATA; - -typedef struct _EFI_IP6_OVERRIDE_DATA { - UINT8 Protocol; - UINT8 HopLimit; - UINT32 FlowLabel; -} EFI_IP6_OVERRIDE_DATA; - -typedef struct _EFI_IP6_TRANSMIT_DATA { - EFI_IPv6_ADDRESS DestinationAddress; - EFI_IP6_OVERRIDE_DATA *OverrideData; - UINT32 ExtHdrsLength; - VOID *ExtHdrs; - UINT8 NextHeader; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_IP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_IP6_TRANSMIT_DATA; - -#pragma pack(1) -typedef struct _EFI_IP6_HEADER { - UINT8 TrafficClassH:4; - UINT8 Version:4; - UINT8 FlowLabelH:4; - UINT8 TrafficClassL:4; - UINT16 FlowLabelL; - UINT16 PayloadLength; - UINT8 NextHeader; - UINT8 HopLimit; - EFI_IPv6_ADDRESS SourceAddress; - EFI_IPv6_ADDRESS DestinationAddress; -} EFI_IP6_HEADER; -#pragma pack() - -typedef struct _EFI_IP6_RECEIVE_DATA { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - UINT32 HeaderLength; - EFI_IP6_HEADER *Header; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_IP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_IP6_RECEIVE_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_IP6_RECEIVE_DATA *RxData; - EFI_IP6_TRANSMIT_DATA *TxData; - } Packet; -} EFI_IP6_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_TRANSMIT) ( - IN struct _EFI_IP6 *This, - IN EFI_IP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_RECEIVE) ( - IN struct _EFI_IP6 *This, - IN EFI_IP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_CANCEL)( - IN struct _EFI_IP6 *This, - IN EFI_IP6_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IP6_POLL) ( - IN struct _EFI_IP6 *This - ); - -typedef struct _EFI_IP6 { - EFI_IP6_GET_MODE_DATA GetModeData; - EFI_IP6_CONFIGURE Configure; - EFI_IP6_GROUPS Groups; - EFI_IP6_ROUTES Routes; - EFI_IP6_NEIGHBORS Neighbors; - EFI_IP6_TRANSMIT Transmit; - EFI_IP6_RECEIVE Receive; - EFI_IP6_CANCEL Cancel; - EFI_IP6_POLL Poll; -} EFI_IP6; - -#endif /* _EFI_IP_H */ diff --git a/stand/efi/include/efilib.h b/stand/efi/include/efilib.h index e1920430a7d1..a387c808fe64 100644 --- a/stand/efi/include/efilib.h +++ b/stand/efi/include/efilib.h @@ -32,6 +32,8 @@ #include <stdbool.h> #include <sys/queue.h> +#include <Protocol/BlockIo.h> + extern EFI_HANDLE IH; extern EFI_SYSTEM_TABLE *ST; extern EFI_BOOT_SERVICES *BS; @@ -119,7 +121,7 @@ int parse_uefi_con_out(void); EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab); EFI_STATUS main(int argc, CHAR16 *argv[]); -void efi_exit(EFI_STATUS status) __dead2; +void efi_exit(EFI_STATUS status); /* EFI environment initialization. */ void efi_init_environment(void); diff --git a/stand/efi/include/efinet.h b/stand/efi/include/efinet.h deleted file mode 100644 index d8bcf9a36bcb..000000000000 --- a/stand/efi/include/efinet.h +++ /dev/null @@ -1,347 +0,0 @@ -#ifndef _EFINET_H -#define _EFINET_H - - -/*++ -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - efinet.h - -Abstract: - EFI Simple Network protocol - -Revision History ---*/ - - -/////////////////////////////////////////////////////////////////////////////// -// -// Simple Network Protocol -// - -#define EFI_SIMPLE_NETWORK_PROTOCOL \ - { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } - - -INTERFACE_DECL(_EFI_SIMPLE_NETWORK); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef struct { - // - // Total number of frames received. Includes frames with errors and - // dropped frames. - // - UINT64 RxTotalFrames; - - // - // Number of valid frames received and copied into receive buffers. - // - UINT64 RxGoodFrames; - - // - // Number of frames below the minimum length for the media. - // This would be <64 for ethernet. - // - UINT64 RxUndersizeFrames; - - // - // Number of frames longer than the maxminum length for the - // media. This would be >1500 for ethernet. - // - UINT64 RxOversizeFrames; - - // - // Valid frames that were dropped because receive buffers were full. - // - UINT64 RxDroppedFrames; - - // - // Number of valid unicast frames received and not dropped. - // - UINT64 RxUnicastFrames; - - // - // Number of valid broadcast frames received and not dropped. - // - UINT64 RxBroadcastFrames; - - // - // Number of valid mutlicast frames received and not dropped. - // - UINT64 RxMulticastFrames; - - // - // Number of frames w/ CRC or alignment errors. - // - UINT64 RxCrcErrorFrames; - - // - // Total number of bytes received. Includes frames with errors - // and dropped frames. - // - UINT64 RxTotalBytes; - - // - // Transmit statistics. - // - UINT64 TxTotalFrames; - UINT64 TxGoodFrames; - UINT64 TxUndersizeFrames; - UINT64 TxOversizeFrames; - UINT64 TxDroppedFrames; - UINT64 TxUnicastFrames; - UINT64 TxBroadcastFrames; - UINT64 TxMulticastFrames; - UINT64 TxCrcErrorFrames; - UINT64 TxTotalBytes; - - // - // Number of collisions detection on this subnet. - // - UINT64 Collisions; - - // - // Number of frames destined for unsupported protocol. - // - UINT64 UnsupportedProtocol; - -} EFI_NETWORK_STATISTICS; - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef enum { - EfiSimpleNetworkStopped, - EfiSimpleNetworkStarted, - EfiSimpleNetworkInitialized, - EfiSimpleNetworkMaxState -} EFI_SIMPLE_NETWORK_STATE; - -/////////////////////////////////////////////////////////////////////////////// -// - -#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 -#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 -#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 -#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 -#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 - -/////////////////////////////////////////////////////////////////////////////// -// - -#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 -#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 -#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 -#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 - -/////////////////////////////////////////////////////////////////////////////// -// -#define MAX_MCAST_FILTER_CNT 16 -typedef struct { - UINT32 State; - UINT32 HwAddressSize; - UINT32 MediaHeaderSize; - UINT32 MaxPacketSize; - UINT32 NvRamSize; - UINT32 NvRamAccessSize; - UINT32 ReceiveFilterMask; - UINT32 ReceiveFilterSetting; - UINT32 MaxMCastFilterCount; - UINT32 MCastFilterCount; - EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; - EFI_MAC_ADDRESS CurrentAddress; - EFI_MAC_ADDRESS BroadcastAddress; - EFI_MAC_ADDRESS PermanentAddress; - UINT8 IfType; - BOOLEAN MacAddressChangeable; - BOOLEAN MultipleTxSupported; - BOOLEAN MediaPresentSupported; - BOOLEAN MediaPresent; -} EFI_SIMPLE_NETWORK_MODE; - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_START) ( - IN struct _EFI_SIMPLE_NETWORK *This -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STOP) ( - IN struct _EFI_SIMPLE_NETWORK *This -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN UINTN ExtraRxBufferSize OPTIONAL, - IN UINTN ExtraTxBufferSize OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RESET) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN BOOLEAN ExtendedVerification -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) ( - IN struct _EFI_SIMPLE_NETWORK *This -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN UINT32 Enable, - IN UINT32 Disable, - IN BOOLEAN ResetMCastFilter, - IN UINTN MCastFilterCnt OPTIONAL, - IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN BOOLEAN Reset, - IN EFI_MAC_ADDRESS *New OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN BOOLEAN Reset, - IN OUT UINTN *StatisticsSize OPTIONAL, - OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN BOOLEAN IPv6, - IN EFI_IP_ADDRESS *IP, - OUT EFI_MAC_ADDRESS *MAC -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN BOOLEAN ReadWrite, - IN UINTN Offset, - IN UINTN BufferSize, - IN OUT VOID *Buffer -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) ( - IN struct _EFI_SIMPLE_NETWORK *This, - OUT UINT32 *InterruptStatus OPTIONAL, - OUT VOID **TxBuf OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) ( - IN struct _EFI_SIMPLE_NETWORK *This, - IN UINTN HeaderSize, - IN UINTN BufferSize, - IN VOID *Buffer, - IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, - IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, - IN UINT16 *Protocol OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) ( - IN struct _EFI_SIMPLE_NETWORK *This, - OUT UINTN *HeaderSize OPTIONAL, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer, - OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, - OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, - OUT UINT16 *Protocol OPTIONAL -); - -/////////////////////////////////////////////////////////////////////////////// -// - -#define EFI_SIMPLE_NETWORK_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_SIMPLE_NETWORK { - UINT64 Revision; - EFI_SIMPLE_NETWORK_START Start; - EFI_SIMPLE_NETWORK_STOP Stop; - EFI_SIMPLE_NETWORK_INITIALIZE Initialize; - EFI_SIMPLE_NETWORK_RESET Reset; - EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown; - EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters; - EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress; - EFI_SIMPLE_NETWORK_STATISTICS Statistics; - EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac; - EFI_SIMPLE_NETWORK_NVDATA NvData; - EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; - EFI_SIMPLE_NETWORK_TRANSMIT Transmit; - EFI_SIMPLE_NETWORK_RECEIVE Receive; - EFI_EVENT WaitForPacket; - EFI_SIMPLE_NETWORK_MODE *Mode; -} EFI_SIMPLE_NETWORK; - -#endif /* _EFINET_H */ diff --git a/stand/efi/include/efipart.h b/stand/efi/include/efipart.h deleted file mode 100644 index abad72440657..000000000000 --- a/stand/efi/include/efipart.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _EFI_PART_H -#define _EFI_PART_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efipart.h - -Abstract: - Info about disk partitions and Master Boot Records - - - - -Revision History - ---*/ - -// -// -// - -#define EFI_PARTITION 0xef -#define MBR_SIZE 512 - -#pragma pack(1) - -typedef struct { - UINT8 BootIndicator; - UINT8 StartHead; - UINT8 StartSector; - UINT8 StartTrack; - UINT8 OSIndicator; - UINT8 EndHead; - UINT8 EndSector; - UINT8 EndTrack; - UINT8 StartingLBA[4]; - UINT8 SizeInLBA[4]; -} MBR_PARTITION_RECORD; - -#define EXTRACT_UINT32(D) (UINT32)(D[0] | (D[1] << 8) | (D[2] << 16) | (D[3] << 24)) - -#define MBR_SIGNATURE 0xaa55 -#define MIN_MBR_DEVICE_SIZE 0x80000 -#define MBR_ERRATA_PAD 0x40000 // 128 MB - -#define MAX_MBR_PARTITIONS 4 -typedef struct { - UINT8 BootStrapCode[440]; - UINT8 UniqueMbrSignature[4]; - UINT8 Unknown[2]; - MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS]; - UINT16 Signature; -} MASTER_BOOT_RECORD; -#pragma pack() - - -#endif diff --git a/stand/efi/include/efipoint.h b/stand/efi/include/efipoint.h deleted file mode 100644 index 46e92ffd3b48..000000000000 --- a/stand/efi/include/efipoint.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2014 by John Cronin - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef _EFI_POINT_H -#define _EFI_POINT_H - -#define EFI_SIMPLE_POINTER_PROTOCOL_GUID \ - { 0x31878c87, 0xb75, 0x11d5, { 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } - -INTERFACE_DECL(_EFI_SIMPLE_POINTER); - -typedef struct { - INT32 RelativeMovementX; - INT32 RelativeMovementY; - INT32 RelativeMovementZ; - BOOLEAN LeftButton; - BOOLEAN RightButton; -} EFI_SIMPLE_POINTER_STATE; - -typedef struct { - UINT64 ResolutionX; - UINT64 ResolutionY; - UINT64 ResolutionZ; - BOOLEAN LeftButton; - BOOLEAN RightButton; -} EFI_SIMPLE_POINTER_MODE; - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_POINTER_RESET) ( - IN struct _EFI_SIMPLE_POINTER *This, - IN BOOLEAN ExtendedVerification -); - -typedef -EFI_STATUS -(EFIAPI *EFI_SIMPLE_POINTER_GET_STATE) ( - IN struct _EFI_SIMPLE_POINTER *This, - IN OUT EFI_SIMPLE_POINTER_STATE *State -); - -typedef struct _EFI_SIMPLE_POINTER { - EFI_SIMPLE_POINTER_RESET Reset; - EFI_SIMPLE_POINTER_GET_STATE GetState; - EFI_EVENT WaitForInput; - EFI_SIMPLE_POINTER_MODE *Mode; -} EFI_SIMPLE_POINTER_PROTOCOL; - -#define EFI_ABSOLUTE_POINTER_PROTOCOL_GUID \ - { 0x8D59D32B, 0xC655, 0x4AE9, { 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43 } } - -INTERFACE_DECL(_EFI_ABSOLUTE_POINTER_PROTOCOL); - -typedef struct { - UINT64 AbsoluteMinX; - UINT64 AbsoluteMinY; - UINT64 AbsoluteMinZ; - UINT64 AbsoluteMaxX; - UINT64 AbsoluteMaxY; - UINT64 AbsoluteMaxZ; - UINT32 Attributes; -} EFI_ABSOLUTE_POINTER_MODE; - -typedef struct { - UINT64 CurrentX; - UINT64 CurrentY; - UINT64 CurrentZ; - UINT32 ActiveButtons; -} EFI_ABSOLUTE_POINTER_STATE; - -#define EFI_ABSP_SupportsAltActive 0x00000001 -#define EFI_ABSP_SupportsPressureAsZ 0x00000002 -#define EFI_ABSP_TouchActive 0x00000001 -#define EFI_ABS_AltActive 0x00000002 - -typedef -EFI_STATUS -(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) ( - IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This, - IN BOOLEAN ExtendedVerification -); - -typedef -EFI_STATUS -(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) ( - IN struct _EFI_ABSOLUTE_POINTER_PROTOCOL *This, - IN OUT EFI_ABSOLUTE_POINTER_STATE *State -); - -typedef struct _EFI_ABSOLUTE_POINTER_PROTOCOL { - EFI_ABSOLUTE_POINTER_RESET Reset; - EFI_ABSOLUTE_POINTER_GET_STATE GetState; - EFI_EVENT WaitForInput; - EFI_ABSOLUTE_POINTER_MODE *Mode; -} EFI_ABSOLUTE_POINTER_PROTOCOL; - -#endif diff --git a/stand/efi/include/efiprot.h b/stand/efi/include/efiprot.h deleted file mode 100644 index bcedf8b1f653..000000000000 --- a/stand/efi/include/efiprot.h +++ /dev/null @@ -1,662 +0,0 @@ -#ifndef _EFI_PROT_H -#define _EFI_PROT_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efiprot.h - -Abstract: - - EFI Protocols - - - -Revision History - ---*/ - -#include <efidef.h> - -// -// Device Path protocol -// - -#define DEVICE_PATH_PROTOCOL \ - { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - - -// -// Block IO protocol -// - -#define BLOCK_IO_PROTOCOL \ - { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000 - -INTERFACE_DECL(_EFI_BLOCK_IO); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_RESET) ( - IN struct _EFI_BLOCK_IO *This, - IN BOOLEAN ExtendedVerification - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_READ) ( - IN struct _EFI_BLOCK_IO *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_WRITE) ( - IN struct _EFI_BLOCK_IO *This, - IN UINT32 MediaId, - IN EFI_LBA LBA, - IN UINTN BufferSize, - IN VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_BLOCK_FLUSH) ( - IN struct _EFI_BLOCK_IO *This - ); - - - -typedef struct { - UINT32 MediaId; - BOOLEAN RemovableMedia; - BOOLEAN MediaPresent; - - BOOLEAN LogicalPartition; - BOOLEAN ReadOnly; - BOOLEAN WriteCaching; - - UINT32 BlockSize; - UINT32 IoAlign; - - EFI_LBA LastBlock; -} EFI_BLOCK_IO_MEDIA; - -typedef struct _EFI_BLOCK_IO { - UINT64 Revision; - - EFI_BLOCK_IO_MEDIA *Media; - - EFI_BLOCK_RESET Reset; - EFI_BLOCK_READ ReadBlocks; - EFI_BLOCK_WRITE WriteBlocks; - EFI_BLOCK_FLUSH FlushBlocks; - -} EFI_BLOCK_IO; - - - -// -// Disk Block IO protocol -// - -#define DISK_IO_PROTOCOL \ - { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } -#define EFI_DISK_IO_INTERFACE_REVISION 0x00010000 - -INTERFACE_DECL(_EFI_DISK_IO); - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_READ) ( - IN struct _EFI_DISK_IO *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN UINTN BufferSize, - OUT VOID *Buffer - ); - - -typedef -EFI_STATUS -(EFIAPI *EFI_DISK_WRITE) ( - IN struct _EFI_DISK_IO *This, - IN UINT32 MediaId, - IN UINT64 Offset, - IN UINTN BufferSize, - IN VOID *Buffer - ); - - -typedef struct _EFI_DISK_IO { - UINT64 Revision; - EFI_DISK_READ ReadDisk; - EFI_DISK_WRITE WriteDisk; -} EFI_DISK_IO; - - -// -// Simple file system protocol -// - -#define SIMPLE_FILE_SYSTEM_PROTOCOL \ - { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -INTERFACE_DECL(_EFI_FILE_IO_INTERFACE); -INTERFACE_DECL(_EFI_FILE_HANDLE); - -typedef -EFI_STATUS -(EFIAPI *EFI_VOLUME_OPEN) ( - IN struct _EFI_FILE_IO_INTERFACE *This, - OUT struct _EFI_FILE_HANDLE **Root - ); - -#define EFI_FILE_IO_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_FILE_IO_INTERFACE { - UINT64 Revision; - EFI_VOLUME_OPEN OpenVolume; -} EFI_FILE_IO_INTERFACE; - -// -// -// - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_OPEN) ( - IN struct _EFI_FILE_HANDLE *File, - OUT struct _EFI_FILE_HANDLE **NewHandle, - IN CHAR16 *FileName, - IN UINT64 OpenMode, - IN UINT64 Attributes - ); - -// Open modes -#define EFI_FILE_MODE_READ 0x0000000000000001 -#define EFI_FILE_MODE_WRITE 0x0000000000000002 -#define EFI_FILE_MODE_CREATE 0x8000000000000000 - -// File attributes -#define EFI_FILE_READ_ONLY 0x0000000000000001 -#define EFI_FILE_HIDDEN 0x0000000000000002 -#define EFI_FILE_SYSTEM 0x0000000000000004 -#define EFI_FILE_RESERVIED 0x0000000000000008 -#define EFI_FILE_DIRECTORY 0x0000000000000010 -#define EFI_FILE_ARCHIVE 0x0000000000000020 -#define EFI_FILE_VALID_ATTR 0x0000000000000037 - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_CLOSE) ( - IN struct _EFI_FILE_HANDLE *File - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_DELETE) ( - IN struct _EFI_FILE_HANDLE *File - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_READ) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_WRITE) ( - IN struct _EFI_FILE_HANDLE *File, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_POSITION) ( - IN struct _EFI_FILE_HANDLE *File, - IN UINT64 Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_POSITION) ( - IN struct _EFI_FILE_HANDLE *File, - OUT UINT64 *Position - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_GET_INFO) ( - IN struct _EFI_FILE_HANDLE *File, - IN EFI_GUID *InformationType, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_SET_INFO) ( - IN struct _EFI_FILE_HANDLE *File, - IN EFI_GUID *InformationType, - IN UINTN BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_FILE_FLUSH) ( - IN struct _EFI_FILE_HANDLE *File - ); - - - -#define EFI_FILE_HANDLE_REVISION 0x00010000 -typedef struct _EFI_FILE_HANDLE { - UINT64 Revision; - EFI_FILE_OPEN Open; - EFI_FILE_CLOSE Close; - EFI_FILE_DELETE Delete; - EFI_FILE_READ Read; - EFI_FILE_WRITE Write; - EFI_FILE_GET_POSITION GetPosition; - EFI_FILE_SET_POSITION SetPosition; - EFI_FILE_GET_INFO GetInfo; - EFI_FILE_SET_INFO SetInfo; - EFI_FILE_FLUSH Flush; -} EFI_FILE, *EFI_FILE_HANDLE; - - -// -// File information types -// - -#define EFI_FILE_INFO_ID \ - { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -typedef struct { - UINT64 Size; - UINT64 FileSize; - UINT64 PhysicalSize; - EFI_TIME CreateTime; - EFI_TIME LastAccessTime; - EFI_TIME ModificationTime; - UINT64 Attribute; - CHAR16 FileName[1]; -} EFI_FILE_INFO; - -// -// The FileName field of the EFI_FILE_INFO data structure is variable length. -// Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to -// be the size of the data structure without the FileName field. The following macro -// computes this size correctly no matter how big the FileName array is declared. -// This is required to make the EFI_FILE_INFO data structure ANSI compilant. -// - -#define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName) - -#define EFI_FILE_SYSTEM_INFO_ID \ - { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -typedef struct { - UINT64 Size; - BOOLEAN ReadOnly; - UINT64 VolumeSize; - UINT64 FreeSpace; - UINT32 BlockSize; - CHAR16 VolumeLabel[1]; -} EFI_FILE_SYSTEM_INFO; - -// -// The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length. -// Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs -// to be the size of the data structure without the VolumeLable field. The following macro -// computes this size correctly no matter how big the VolumeLable array is declared. -// This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant. -// - -#define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel) - -#define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \ - { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} } - -typedef struct { - CHAR16 VolumeLabel[1]; -} EFI_FILE_SYSTEM_VOLUME_LABEL_INFO; - -#define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel) - -// -// Load file protocol -// - - -#define LOAD_FILE_PROTOCOL \ - { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} } - -INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE); - -typedef -EFI_STATUS -(EFIAPI *EFI_LOAD_FILE) ( - IN struct _EFI_LOAD_FILE_INTERFACE *This, - IN EFI_DEVICE_PATH *FilePath, - IN BOOLEAN BootPolicy, - IN OUT UINTN *BufferSize, - IN VOID *Buffer OPTIONAL - ); - -typedef struct _EFI_LOAD_FILE_INTERFACE { - EFI_LOAD_FILE LoadFile; -} EFI_LOAD_FILE_INTERFACE; - - -// -// Device IO protocol -// - -#define DEVICE_IO_PROTOCOL \ - { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE); - -typedef enum { - IO_UINT8, - IO_UINT16, - IO_UINT32, - IO_UINT64, -// -// Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO -// - MMIO_COPY_UINT8, - MMIO_COPY_UINT16, - MMIO_COPY_UINT32, - MMIO_COPY_UINT64 -} EFI_IO_WIDTH; - -#define EFI_PCI_ADDRESS(bus,dev,func,reg) \ - ( (UINT64) ( (((UINTN)bus) << 24) + (((UINTN)dev) << 16) + (((UINTN)func) << 8) + ((UINTN)reg) )) - -typedef -EFI_STATUS -(EFIAPI *EFI_DEVICE_IO) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN EFI_IO_WIDTH Width, - IN UINT64 Address, - IN UINTN Count, - IN OUT VOID *Buffer - ); - -typedef struct { - EFI_DEVICE_IO Read; - EFI_DEVICE_IO Write; -} EFI_IO_ACCESS; - -typedef -EFI_STATUS -(EFIAPI *EFI_PCI_DEVICE_PATH) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN UINT64 Address, - IN OUT EFI_DEVICE_PATH **PciDevicePath - ); - -typedef enum { - EfiBusMasterRead, - EfiBusMasterWrite, - EfiBusMasterCommonBuffer -} EFI_IO_OPERATION_TYPE; - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_MAP) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN EFI_IO_OPERATION_TYPE Operation, - IN EFI_PHYSICAL_ADDRESS *HostAddress, - IN OUT UINTN *NumberOfBytes, - OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, - OUT VOID **Mapping - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_UNMAP) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN VOID *Mapping - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_ALLOCATE_BUFFER) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN EFI_ALLOCATE_TYPE Type, - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN Pages, - IN OUT EFI_PHYSICAL_ADDRESS *HostAddress - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_FLUSH) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_IO_FREE_BUFFER) ( - IN struct _EFI_DEVICE_IO_INTERFACE *This, - IN UINTN Pages, - IN EFI_PHYSICAL_ADDRESS HostAddress - ); - -typedef struct _EFI_DEVICE_IO_INTERFACE { - EFI_IO_ACCESS Mem; - EFI_IO_ACCESS Io; - EFI_IO_ACCESS Pci; - EFI_IO_MAP Map; - EFI_PCI_DEVICE_PATH PciDevicePath; - EFI_IO_UNMAP Unmap; - EFI_IO_ALLOCATE_BUFFER AllocateBuffer; - EFI_IO_FLUSH Flush; - EFI_IO_FREE_BUFFER FreeBuffer; -} EFI_DEVICE_IO_INTERFACE; - - -// -// Unicode Collation protocol -// - -#define UNICODE_COLLATION_PROTOCOL \ - { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -#define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff) - -INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE); - -typedef -INTN -(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *s1, - IN CHAR16 *s2 - ); - -typedef -BOOLEAN -(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *String, - IN CHAR16 *Pattern - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_COLLATION_STRLWR) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN OUT CHAR16 *Str - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_COLLATION_STRUPR) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN OUT CHAR16 *Str - ); - -typedef -VOID -(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN UINTN FatSize, - IN CHAR8 *Fat, - OUT CHAR16 *String - ); - -typedef -BOOLEAN -(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) ( - IN struct _EFI_UNICODE_COLLATION_INTERFACE *This, - IN CHAR16 *String, - IN UINTN FatSize, - OUT CHAR8 *Fat - ); - - -typedef struct _EFI_UNICODE_COLLATION_INTERFACE { - - // general - EFI_UNICODE_COLLATION_STRICOLL StriColl; - EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch; - EFI_UNICODE_COLLATION_STRLWR StrLwr; - EFI_UNICODE_COLLATION_STRUPR StrUpr; - - // for supporting fat volumes - EFI_UNICODE_COLLATION_FATTOSTR FatToStr; - EFI_UNICODE_COLLATION_STRTOFAT StrToFat; - - CHAR8 *SupportedLanguages; -} EFI_UNICODE_COLLATION_INTERFACE; - -// -// Driver Binding protocol -// - -#define DRIVER_BINDING_PROTOCOL \ - { 0x18a031ab, 0xb443, 0x4d1a, {0xa5, 0xc0, 0x0c, 0x09, 0x26, 0x1e, 0x9f, 0x71} } - -INTERFACE_DECL(_EFI_DRIVER_BINDING); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_SUPPORTED) ( - IN struct _EFI_DRIVER_BINDING *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH *RemainingPath - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_START) ( - IN struct _EFI_DRIVER_BINDING *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_DEVICE_PATH *RemainingPath - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_DRIVER_BINDING_STOP) ( - IN struct _EFI_DRIVER_BINDING *This, - IN EFI_HANDLE ControllerHandle, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ); - -typedef struct _EFI_DRIVER_BINDING { - EFI_DRIVER_BINDING_SUPPORTED Supported; - EFI_DRIVER_BINDING_START Start; - EFI_DRIVER_BINDING_STOP Stop; - UINT32 Version; - EFI_HANDLE ImageHandle; - EFI_HANDLE DriverBindingHandle; -} EFI_DRIVER_BINDING; - -// -// Component Name Protocol 2 -// - -#define COMPONENT_NAME2_PROTOCOL \ - { 0x6a7a5cff, 0xe8d9, 0x4f70, {0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14 } } - -INTERFACE_DECL(_EFI_COMPONENT_NAME2); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) ( - IN struct _EFI_COMPONENT_NAME2 *This, - IN CHAR8 * Language, - OUT CHAR16 **DriverName - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) ( - IN struct _EFI_COMPONENT_NAME2 *This, - IN EFI_HANDLE ControllerHandle, - IN EFI_HANDLE ChildHandle OPTIONAL, - IN CHAR8 *Language, - OUT CHAR16 **ControllerName - ); - -typedef struct _EFI_COMPONENT_NAME2 { - EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName; - EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName; - CHAR8 **SupportedLanguages; -} EFI_COMPONENT_NAME2; - -// -// RISC-V EFI Boot Protocol -// -// https://github.com/riscv-non-isa/riscv-uefi -// - -#define RISCV_EFI_BOOT_PROTOCOL_GUID \ - { 0xccd15fec, 0x6f73, 0x4eec, {0x83, 0x95, 0x3e, 0x69, 0xe4, 0xb9, 0x40, 0xbf} } - -INTERFACE_DECL(_RISCV_EFI_BOOT_PROTOCOL); - -#define RISCV_EFI_BOOT_PROTOCOL_REVISION 0x00010000 -#define RISCV_EFI_BOOT_PROTOCOL_LATEST_VERSION \ - RISCV_EFI_BOOT_PROTOCOL_REVISION - -typedef -EFI_STATUS -(EFIAPI *EFI_GET_BOOT_HARTID) ( - IN struct _RISCV_EFI_BOOT_PROTOCOL *This, - OUT UINTN *BootHartId - ); - -typedef struct _RISCV_EFI_BOOT_PROTOCOL { - UINT64 Revision; - EFI_GET_BOOT_HARTID GetBootHartId; -} RISCV_EFI_BOOT_PROTOCOL; - -#endif diff --git a/stand/efi/include/efipxebc.h b/stand/efi/include/efipxebc.h deleted file mode 100644 index 80a190d9c150..000000000000 --- a/stand/efi/include/efipxebc.h +++ /dev/null @@ -1,471 +0,0 @@ -#ifndef _EFIPXEBC_H -#define _EFIPXEBC_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efipxebc.h - -Abstract: - - EFI PXE Base Code Protocol - - - -Revision History - ---*/ - -// -// PXE Base Code protocol -// - -#define EFI_PXE_BASE_CODE_PROTOCOL \ - { 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } - -INTERFACE_DECL(_EFI_PXE_BASE_CODE); - -#define DEFAULT_TTL 8 -#define DEFAULT_ToS 0 -// -// Address definitions -// - -typedef union { - UINT32 Addr[4]; - EFI_IPv4_ADDRESS v4; - EFI_IPv6_ADDRESS v6; -} EFI_IP_ADDRESS; - -typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT; - -// -// Packet definitions -// - -typedef struct { - UINT8 BootpOpcode; - UINT8 BootpHwType; - UINT8 BootpHwAddrLen; - UINT8 BootpGateHops; - UINT32 BootpIdent; - UINT16 BootpSeconds; - UINT16 BootpFlags; - UINT8 BootpCiAddr[4]; - UINT8 BootpYiAddr[4]; - UINT8 BootpSiAddr[4]; - UINT8 BootpGiAddr[4]; - UINT8 BootpHwAddr[16]; - UINT8 BootpSrvName[64]; - UINT8 BootpBootFile[128]; - UINT32 DhcpMagik; - UINT8 DhcpOptions[56]; -} EFI_PXE_BASE_CODE_DHCPV4_PACKET; - -// TBD in EFI v1.1 -//typedef struct { -// UINT8 reserved; -//} EFI_PXE_BASE_CODE_DHCPV6_PACKET; - -typedef union { - UINT8 Raw[1472]; - EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; -// EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; -} EFI_PXE_BASE_CODE_PACKET; - -typedef struct { - UINT8 Type; - UINT8 Code; - UINT16 Checksum; - union { - UINT32 reserved; - UINT32 Mtu; - UINT32 Pointer; - struct { - UINT16 Identifier; - UINT16 Sequence; - } Echo; - } u; - UINT8 Data[494]; -} EFI_PXE_BASE_CODE_ICMP_ERROR; - -typedef struct { - UINT8 ErrorCode; - CHAR8 ErrorString[127]; -} EFI_PXE_BASE_CODE_TFTP_ERROR; - -// -// IP Receive Filter definitions -// -#define EFI_PXE_BASE_CODE_MAX_IPCNT 8 -typedef struct { - UINT8 Filters; - UINT8 IpCnt; - UINT16 reserved; - EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT]; -} EFI_PXE_BASE_CODE_IP_FILTER; - -#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001 -#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002 -#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004 -#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008 - -// -// ARP Cache definitions -// - -typedef struct { - EFI_IP_ADDRESS IpAddr; - EFI_MAC_ADDRESS MacAddr; -} EFI_PXE_BASE_CODE_ARP_ENTRY; - -typedef struct { - EFI_IP_ADDRESS IpAddr; - EFI_IP_ADDRESS SubnetMask; - EFI_IP_ADDRESS GwAddr; -} EFI_PXE_BASE_CODE_ROUTE_ENTRY; - -// -// UDP definitions -// - -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001 -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002 -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004 -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008 -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010 -#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020 - -// -// Discover() definitions -// - -#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15 -#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16 -// -// 17 through 32767 are reserved -// 32768 through 65279 are for vendor use -// 65280 through 65534 are reserved -// -#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535 - -#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF -#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000 -#define EFI_PXE_BASE_CODE_BOOT_LAYER_CREDENTIALS 0x8000 - - -typedef struct { - UINT16 Type; - BOOLEAN AcceptAnyResponse; - UINT8 Reserved; - EFI_IP_ADDRESS IpAddr; -} EFI_PXE_BASE_CODE_SRVLIST; - -typedef struct { - BOOLEAN UseMCast; - BOOLEAN UseBCast; - BOOLEAN UseUCast; - BOOLEAN MustUseList; - EFI_IP_ADDRESS ServerMCastIp; - UINT16 IpCnt; - EFI_PXE_BASE_CODE_SRVLIST SrvList[1]; -} EFI_PXE_BASE_CODE_DISCOVER_INFO; - -// -// Mtftp() definitions -// - -typedef enum { - EFI_PXE_BASE_CODE_TFTP_FIRST, - EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, - EFI_PXE_BASE_CODE_TFTP_READ_FILE, - EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, - EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY, - EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE, - EFI_PXE_BASE_CODE_MTFTP_READ_FILE, - EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, - EFI_PXE_BASE_CODE_MTFTP_LAST -} EFI_PXE_BASE_CODE_TFTP_OPCODE; - -typedef struct { - EFI_IP_ADDRESS MCastIp; - EFI_PXE_BASE_CODE_UDP_PORT CPort; - EFI_PXE_BASE_CODE_UDP_PORT SPort; - UINT16 ListenTimeout; - UINT16 TransmitTimeout; -} EFI_PXE_BASE_CODE_MTFTP_INFO; - -// -// PXE Base Code Mode structure -// - -#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 -#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 - -typedef struct { - BOOLEAN Started; - BOOLEAN Ipv6Available; - BOOLEAN Ipv6Supported; - BOOLEAN UsingIpv6; - BOOLEAN BisSupported; - BOOLEAN BisDetected; - BOOLEAN AutoArp; - BOOLEAN SendGUID; - BOOLEAN DhcpDiscoverValid; - BOOLEAN DhcpAckReceived; - BOOLEAN ProxyOfferReceived; - BOOLEAN PxeDiscoverValid; - BOOLEAN PxeReplyReceived; - BOOLEAN PxeBisReplyReceived; - BOOLEAN IcmpErrorReceived; - BOOLEAN TftpErrorReceived; - BOOLEAN MakeCallbacks; - UINT8 TTL; - UINT8 ToS; - EFI_IP_ADDRESS StationIp; - EFI_IP_ADDRESS SubnetMask; - EFI_PXE_BASE_CODE_PACKET DhcpDiscover; - EFI_PXE_BASE_CODE_PACKET DhcpAck; - EFI_PXE_BASE_CODE_PACKET ProxyOffer; - EFI_PXE_BASE_CODE_PACKET PxeDiscover; - EFI_PXE_BASE_CODE_PACKET PxeReply; - EFI_PXE_BASE_CODE_PACKET PxeBisReply; - EFI_PXE_BASE_CODE_IP_FILTER IpFilter; - UINT32 ArpCacheEntries; - EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; - UINT32 RouteTableEntries; - EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; - EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError; - EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; -} EFI_PXE_BASE_CODE_MODE; - -// -// PXE Base Code Interface Function definitions -// - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_START) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN BOOLEAN UseIpv6 - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_STOP) ( - IN struct _EFI_PXE_BASE_CODE *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_DHCP) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN BOOLEAN SortOffers - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN UINT16 Type, - IN UINT16 *Layer, - IN BOOLEAN UseBis, - IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_MTFTP) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, - IN OUT VOID *BufferPtr OPTIONAL, - IN BOOLEAN Overwrite, - IN OUT UINT64 *BufferSize, - IN UINTN *BlockSize OPTIONAL, - IN EFI_IP_ADDRESS *ServerIp, - IN UINT8 *Filename, - IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, - IN BOOLEAN DontUseBuffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN UINT16 OpFlags, - IN EFI_IP_ADDRESS *DestIp, - IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, - IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL - IN EFI_IP_ADDRESS *SrcIp, OPTIONAL - IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL - IN UINTN *HeaderSize, OPTIONAL - IN VOID *HeaderPtr, OPTIONAL - IN UINTN *BufferSize, - IN VOID *BufferPtr - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN UINT16 OpFlags, - IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL - IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL - IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL - IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL - IN UINTN *HeaderSize, OPTIONAL - IN VOID *HeaderPtr, OPTIONAL - IN OUT UINTN *BufferSize, - IN VOID *BufferPtr - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_ARP) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN EFI_IP_ADDRESS *IpAddr, - IN EFI_MAC_ADDRESS *MacAddr OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN BOOLEAN *NewAutoArp, OPTIONAL - IN BOOLEAN *NewSendGUID, OPTIONAL - IN UINT8 *NewTTL, OPTIONAL - IN UINT8 *NewToS, OPTIONAL - IN BOOLEAN *NewMakeCallback OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) ( - IN struct _EFI_PXE_BASE_CODE *This, - IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL - IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) ( - IN struct _EFI_PXE_BASE_CODE *This, - BOOLEAN *NewDhcpDiscoverValid, OPTIONAL - BOOLEAN *NewDhcpAckReceived, OPTIONAL - BOOLEAN *NewProxyOfferReceived, OPTIONAL - BOOLEAN *NewPxeDiscoverValid, OPTIONAL - BOOLEAN *NewPxeReplyReceived, OPTIONAL - BOOLEAN *NewPxeBisReplyReceived,OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL - IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL - ); - -// -// PXE Base Code Protocol structure -// - -#define EFI_PXE_BASE_CODE_INTERFACE_REVISION 0x00010000 - -typedef struct _EFI_PXE_BASE_CODE { - UINT64 Revision; - EFI_PXE_BASE_CODE_START Start; - EFI_PXE_BASE_CODE_STOP Stop; - EFI_PXE_BASE_CODE_DHCP Dhcp; - EFI_PXE_BASE_CODE_DISCOVER Discover; - EFI_PXE_BASE_CODE_MTFTP Mtftp; - EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite; - EFI_PXE_BASE_CODE_UDP_READ UdpRead; - EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter; - EFI_PXE_BASE_CODE_ARP Arp; - EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters; - EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp; - EFI_PXE_BASE_CODE_SET_PACKETS SetPackets; - EFI_PXE_BASE_CODE_MODE *Mode; -} EFI_PXE_BASE_CODE; - -// -// Call Back Definitions -// - -#define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL \ - { 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } - -// -// Revision Number -// - -#define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION 0x00010000 - -INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK); - -typedef enum { - EFI_PXE_BASE_CODE_FUNCTION_FIRST, - EFI_PXE_BASE_CODE_FUNCTION_DHCP, - EFI_PXE_BASE_CODE_FUNCTION_DISCOVER, - EFI_PXE_BASE_CODE_FUNCTION_MTFTP, - EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE, - EFI_PXE_BASE_CODE_FUNCTION_UDP_READ, - EFI_PXE_BASE_CODE_FUNCTION_ARP, - EFI_PXE_BASE_CODE_FUNCTION_IGMP, - EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST -} EFI_PXE_BASE_CODE_FUNCTION; - -typedef enum { - EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, - EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, - EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT, - EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST -} EFI_PXE_BASE_CODE_CALLBACK_STATUS; - -typedef -EFI_PXE_BASE_CODE_CALLBACK_STATUS -(EFIAPI *EFI_PXE_CALLBACK) ( - IN struct _EFI_PXE_BASE_CODE_CALLBACK *This, - IN EFI_PXE_BASE_CODE_FUNCTION Function, - IN BOOLEAN Received, - IN UINT32 PacketLen, - IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL - ); - -typedef struct _EFI_PXE_BASE_CODE_CALLBACK { - UINT64 Revision; - EFI_PXE_CALLBACK Callback; -} EFI_PXE_BASE_CODE_CALLBACK; - -#endif /* _EFIPXEBC_H */ diff --git a/stand/efi/include/efirng.h b/stand/efi/include/efirng.h deleted file mode 100644 index d5a2212ea13f..000000000000 --- a/stand/efi/include/efirng.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright 2006 - 2016 Unified EFI, Inc.<BR> - * Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR> - * This program and the accompanying materials - * are licensed and made available under the terms and conditions of the BSD License - * which accompanies this distribution. The full text of the license may be found at - * http://opensource.org/licenses/bsd-license.php - * - * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - * - */ - -#ifndef _EFIRNG_H -#define _EFIRNG_H - -#define EFI_RNG_PROTOCOL_GUID \ - { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} } - -INTERFACE_DECL(_EFI_RNG_PROTOCOL); - -typedef EFI_GUID EFI_RNG_ALGORITHM; - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_INFO) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN OUT UINTN *RNGAlgorithmListSize, - OUT EFI_RNG_ALGORITHM *RNGAlgorithmList - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_RNG_GET_RNG) ( - IN struct _EFI_RNG_PROTOCOL *This, - IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL - IN UINTN RNGValueLength, - OUT UINT8 *RNGValue - ); - -typedef struct _EFI_RNG_PROTOCOL { - EFI_RNG_GET_INFO GetInfo; - EFI_RNG_GET_RNG GetRNG; -} EFI_RNG_PROTOCOL; - -static EFI_GUID rng_guid = EFI_RNG_PROTOCOL_GUID; - -#endif /* _EFIRNG_H */ diff --git a/stand/efi/include/efiser.h b/stand/efi/include/efiser.h deleted file mode 100644 index 596d2b94db59..000000000000 --- a/stand/efi/include/efiser.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef _EFI_SER_H -#define _EFI_SER_H - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efiser.h - -Abstract: - - EFI serial protocol - -Revision History - ---*/ - -// -// Serial protocol -// - -#define SERIAL_IO_PROTOCOL \ - { 0xBB25CF6F, 0xF1D4, 0x11D2, {0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD} } - -INTERFACE_DECL(_SERIAL_IO_INTERFACE); - -typedef enum { - DefaultParity, - NoParity, - EvenParity, - OddParity, - MarkParity, - SpaceParity -} EFI_PARITY_TYPE; - -typedef enum { - DefaultStopBits, - OneStopBit, // 1 stop bit - OneFiveStopBits, // 1.5 stop bits - TwoStopBits // 2 stop bits -} EFI_STOP_BITS_TYPE; - -#define EFI_SERIAL_CLEAR_TO_SEND 0x0010 // RO -#define EFI_SERIAL_DATA_SET_READY 0x0020 // RO -#define EFI_SERIAL_RING_INDICATE 0x0040 // RO -#define EFI_SERIAL_CARRIER_DETECT 0x0080 // RO -#define EFI_SERIAL_REQUEST_TO_SEND 0x0002 // WO -#define EFI_SERIAL_DATA_TERMINAL_READY 0x0001 // WO -#define EFI_SERIAL_INPUT_BUFFER_EMPTY 0x0100 // RO -#define EFI_SERIAL_OUTPUT_BUFFER_EMPTY 0x0200 // RO -#define EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE 0x1000 // RW -#define EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE 0x2000 // RW -#define EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE 0x4000 // RW - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_RESET) ( - IN struct _SERIAL_IO_INTERFACE *This - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_SET_ATTRIBUTES) ( - IN struct _SERIAL_IO_INTERFACE *This, - IN UINT64 BaudRate, - IN UINT32 ReceiveFifoDepth, - IN UINT32 Timeout, - IN EFI_PARITY_TYPE Parity, - IN UINT8 DataBits, - IN EFI_STOP_BITS_TYPE StopBits - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_SET_CONTROL_BITS) ( - IN struct _SERIAL_IO_INTERFACE *This, - IN UINT32 Control - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_GET_CONTROL_BITS) ( - IN struct _SERIAL_IO_INTERFACE *This, - OUT UINT32 *Control - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_WRITE) ( - IN struct _SERIAL_IO_INTERFACE *This, - IN OUT UINTN *BufferSize, - IN VOID *Buffer - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_SERIAL_READ) ( - IN struct _SERIAL_IO_INTERFACE *This, - IN OUT UINTN *BufferSize, - OUT VOID *Buffer - ); - -typedef struct { - UINT32 ControlMask; - - // current Attributes - UINT32 Timeout; - UINT64 BaudRate; - UINT32 ReceiveFifoDepth; - UINT32 DataBits; - UINT32 Parity; - UINT32 StopBits; -} SERIAL_IO_MODE; - -#define SERIAL_IO_INTERFACE_REVISION 0x00010000 - -typedef struct _SERIAL_IO_INTERFACE { - UINT32 Revision; - EFI_SERIAL_RESET Reset; - EFI_SERIAL_SET_ATTRIBUTES SetAttributes; - EFI_SERIAL_SET_CONTROL_BITS SetControl; - EFI_SERIAL_GET_CONTROL_BITS GetControl; - EFI_SERIAL_WRITE Write; - EFI_SERIAL_READ Read; - - SERIAL_IO_MODE *Mode; -} SERIAL_IO_INTERFACE; - -#endif diff --git a/stand/efi/include/efistdarg.h b/stand/efi/include/efistdarg.h deleted file mode 100644 index f4cf0356563c..000000000000 --- a/stand/efi/include/efistdarg.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _EFISTDARG_H_ -#define _EFISTDARG_H_ - -/*++ - -Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - devpath.h - -Abstract: - - Defines for parsing the EFI Device Path structures - - - -Revision History - ---*/ - -#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(UINTN) - 1) & ~(sizeof(UINTN) - 1) ) - -typedef CHAR8 * va_list; - -#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) -#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) -#define va_end(ap) ( ap = (va_list)0 ) - - -#endif /* _INC_STDARG */ diff --git a/stand/efi/include/efitcp.h b/stand/efi/include/efitcp.h deleted file mode 100644 index 6c5df7fd944d..000000000000 --- a/stand/efi/include/efitcp.h +++ /dev/null @@ -1,391 +0,0 @@ -#ifndef _EFI_TCP_H -#define _EFI_TCP_H - -/*++ -Copyright (c) 2013 Intel Corporation - ---*/ - -#define EFI_TCP4_SERVICE_BINDING_PROTOCOL \ - { 0x00720665, 0x67eb, 0x4a99, {0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c,0x7c, 0xc9}} - -#define EFI_TCP4_PROTOCOL \ - { 0x65530bc7, 0xa359, 0x410f, {0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62}} - -#define EFI_TCP6_SERVICE_BINDING_PROTOCOL \ - { 0xec20eb79, 0x6c1a, 0x4664, {0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64}} - -#define EFI_TCP6_PROTOCOL \ - { 0x46e44855, 0xbd60, 0x4ab7, {0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77}} - -INTERFACE_DECL(_EFI_TCP4); -INTERFACE_DECL(_EFI_TCP6); - -typedef struct { - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS StationAddress; - EFI_IPv4_ADDRESS SubnetMask; - UINT16 StationPort; - EFI_IPv4_ADDRESS RemoteAddress; - UINT16 RemotePort; - BOOLEAN ActiveFlag; -} EFI_TCP4_ACCESS_POINT; - -typedef struct { - UINT32 ReceiveBufferSize; - UINT32 SendBufferSize; - UINT32 MaxSynBackLog; - UINT32 ConnectionTimeout; - UINT32 DataRetries; - UINT32 FinTimeout; - UINT32 TimeWaitTimeout; - UINT32 KeepAliveProbes; - UINT32 KeepAliveTime; - UINT32 KeepAliveInterval; - BOOLEAN EnableNagle; - BOOLEAN EnableTimeStamp; - BOOLEAN EnableWindowScaling; - BOOLEAN EnableSelectiveAck; - BOOLEAN EnablePAthMtuDiscovery; -} EFI_TCP4_OPTION; - -typedef struct { - // Receiving Filters - // I/O parameters - UINT8 TypeOfService; - UINT8 TimeToLive; - - // Access Point - EFI_TCP4_ACCESS_POINT AccessPoint; - - // TCP Control Options - EFI_TCP4_OPTION *ControlOption; -} EFI_TCP4_CONFIG_DATA; - -typedef enum { - Tcp4StateClosed = 0, - Tcp4StateListen = 1, - Tcp4StateSynSent = 2, - Tcp4StateSynReceived = 3, - Tcp4StateEstablished = 4, - Tcp4StateFinWait1 = 5, - Tcp4StateFinWait2 = 6, - Tcp4StateClosing = 7, - Tcp4StateTimeWait = 8, - Tcp4StateCloseWait = 9, - Tcp4StateLastAck = 10 -} EFI_TCP4_CONNECTION_STATE; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_GET_MODE_DATA) ( - IN struct _EFI_TCP4 *This, - OUT EFI_TCP4_CONNECTION_STATE *Tcp4State OPTIONAL, - OUT EFI_TCP4_CONFIG_DATA *Tcp4ConfigData OPTIONAL, - OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CONFIGURE) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CONFIG_DATA *TcpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_ROUTES) ( - IN struct _EFI_TCP4 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv4_ADDRESS *SubnetAddress, - IN EFI_IPv4_ADDRESS *SubnetMask, - IN EFI_IPv4_ADDRESS *GatewayAddress -); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; -} EFI_TCP4_COMPLETION_TOKEN; - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; -} EFI_TCP4_CONNECTION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CONNECT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CONNECTION_TOKEN *ConnectionToken - ); - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - EFI_HANDLE NewChildHandle; -} EFI_TCP4_LISTEN_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_ACCEPT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_LISTEN_TOKEN *ListenToken - ); - -#define EFI_CONNECTION_FIN EFIERR(104) -#define EFI_CONNECTION_RESET EFIERR(105) -#define EFI_CONNECTION_REFUSED EFIERR(106) - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_TCP4_FRAGMENT_DATA; - -typedef struct { - BOOLEAN UrgentFlag; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP4_RECEIVE_DATA; - -typedef struct { - BOOLEAN Push; - BOOLEAN Urgent; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP4_TRANSMIT_DATA; - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - union { - EFI_TCP4_RECEIVE_DATA *RxData; - EFI_TCP4_TRANSMIT_DATA *TxData; - } Packet; -} EFI_TCP4_IO_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_TRANSMIT) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_RECEIVE) ( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_IO_TOKEN *Token - ); - -typedef struct { - EFI_TCP4_COMPLETION_TOKEN CompletionToken; - BOOLEAN AbortOnClose; -} EFI_TCP4_CLOSE_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CLOSE)( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_CLOSE_TOKEN *CloseToken - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_CANCEL)( - IN struct _EFI_TCP4 *This, - IN EFI_TCP4_COMPLETION_TOKEN *Token OPTIONAL -); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP4_POLL) ( - IN struct _EFI_TCP4 *This - ); - -typedef struct _EFI_TCP4 { - EFI_TCP4_GET_MODE_DATA GetModeData; - EFI_TCP4_CONFIGURE Configure; - EFI_TCP4_ROUTES Routes; - EFI_TCP4_CONNECT Connect; - EFI_TCP4_ACCEPT Accept; - EFI_TCP4_TRANSMIT Transmit; - EFI_TCP4_RECEIVE Receive; - EFI_TCP4_CLOSE Close; - EFI_TCP4_CANCEL Cancel; - EFI_TCP4_POLL Poll; -} EFI_TCP4; - -typedef enum { - Tcp6StateClosed = 0, - Tcp6StateListen = 1, - Tcp6StateSynSent = 2, - Tcp6StateSynReceived = 3, - Tcp6StateEstablished = 4, - Tcp6StateFinWait1 = 5, - Tcp6StateFinWait2 = 6, - Tcp6StateClosing = 7, - Tcp6StateTimeWait = 8, - Tcp6StateCloseWait = 9, - Tcp6StateLastAck = 10 -} EFI_TCP6_CONNECTION_STATE; - -typedef struct { - EFI_IPv6_ADDRESS StationAddress; - UINT16 StationPort; - EFI_IPv6_ADDRESS RemoteAddress; - UINT16 RemotePort; - BOOLEAN ActiveFlag; -} EFI_TCP6_ACCESS_POINT; - -typedef struct { - UINT32 ReceiveBufferSize; - UINT32 SendBufferSize; - UINT32 MaxSynBackLog; - UINT32 ConnectionTimeout; - UINT32 DataRetries; - UINT32 FinTimeout; - UINT32 TimeWaitTimeout; - UINT32 KeepAliveProbes; - UINT32 KeepAliveTime; - UINT32 KeepAliveInterval; - BOOLEAN EnableNagle; - BOOLEAN EnableTimeStamp; - BOOLEAN EnableWindbowScaling; - BOOLEAN EnableSelectiveAck; - BOOLEAN EnablePathMtuDiscovery; -} EFI_TCP6_OPTION; - -typedef struct { - UINT8 TrafficClass; - UINT8 HopLimit; - EFI_TCP6_ACCESS_POINT AccessPoint; - EFI_TCP6_OPTION *ControlOption; -} EFI_TCP6_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_GET_MODE_DATA) ( - IN struct _EFI_TCP6 *This, - OUT EFI_TCP6_CONNECTION_STATE *Tcp6State OPTIONAL, - OUT EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL, - OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CONFIGURE) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData OPTIONAL - ); - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; -} EFI_TCP6_COMPLETION_TOKEN; - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; -} EFI_TCP6_CONNECTION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CONNECT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CONNECTION_TOKEN *ConnectionToken - ); - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - EFI_HANDLE NewChildHandle; -} EFI_TCP6_LISTEN_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_ACCEPT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_LISTEN_TOKEN *ListenToken - ); - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_TCP6_FRAGMENT_DATA; - -typedef struct { - BOOLEAN UrgentFlag; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP6_RECEIVE_DATA; - -typedef struct { - BOOLEAN Push; - BOOLEAN Urgent; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_TCP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_TCP6_TRANSMIT_DATA; - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - union { - EFI_TCP6_RECEIVE_DATA *RxData; - EFI_TCP6_TRANSMIT_DATA *TxData; - } Packet; -} EFI_TCP6_IO_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_TRANSMIT) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_IO_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_RECEIVE) ( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_IO_TOKEN *Token - ); - -typedef struct { - EFI_TCP6_COMPLETION_TOKEN CompletionToken; - BOOLEAN AbortOnClose; -} EFI_TCP6_CLOSE_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CLOSE)( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_CLOSE_TOKEN *CloseToken - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_CANCEL)( - IN struct _EFI_TCP6 *This, - IN EFI_TCP6_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_TCP6_POLL) ( - IN struct _EFI_TCP6 *This - ); - -typedef struct _EFI_TCP6 { - EFI_TCP6_GET_MODE_DATA GetModeData; - EFI_TCP6_CONFIGURE Configure; - EFI_TCP6_CONNECT Connect; - EFI_TCP6_ACCEPT Accept; - EFI_TCP6_TRANSMIT Transmit; - EFI_TCP6_RECEIVE Receive; - EFI_TCP6_CLOSE Close; - EFI_TCP6_CANCEL Cancel; - EFI_TCP6_POLL Poll; -} EFI_TCP6; - -#endif /* _EFI_TCP_H */ diff --git a/stand/efi/include/efiudp.h b/stand/efi/include/efiudp.h deleted file mode 100644 index 7c8b467eb9c4..000000000000 --- a/stand/efi/include/efiudp.h +++ /dev/null @@ -1,272 +0,0 @@ -#ifndef _EFI_UDP_H -#define _EFI_UDP_H - - -/*++ -Copyright (c) 2013 Intel Corporation - ---*/ - -#define EFI_UDP4_SERVICE_BINDING_PROTOCOL \ - { 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6} } - -#define EFI_UDP4_PROTOCOL \ - { 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3} } - -#define EFI_UDP6_SERVICE_BINDING_PROTOCOL \ - { 0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54} } - -#define EFI_UDP6_PROTOCOL \ - { 0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3,0x49, 0x55} } - -INTERFACE_DECL(_EFI_UDP4); -INTERFACE_DECL(_EFI_UDP6); - -typedef struct { - BOOLEAN AcceptBroadcast; - BOOLEAN AcceptPromiscuous; - BOOLEAN AcceptAnyPort; - BOOLEAN AllowDuplicatePort; - UINT8 TypeOfService; - UINT8 TimeToLive; - BOOLEAN DoNotFragment; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS StationAddress; - EFI_IPv4_ADDRESS SubnetMask; - UINT16 StationPort; - EFI_IPv4_ADDRESS RemoteAddress; - UINT16 RemotePort; -} EFI_UDP4_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_GET_MODE_DATA) ( - IN struct _EFI_UDP4 *This, - OUT EFI_UDP4_CONFIG_DATA *Udp4ConfigData OPTIONAL, - OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_CONFIGURE) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_GROUPS) ( - IN struct _EFI_UDP4 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_ROUTES) ( - IN struct _EFI_UDP4 *This, - IN BOOLEAN DeleteRoute, - IN EFI_IPv4_ADDRESS *SubnetAddress, - IN EFI_IPv4_ADDRESS *SubnetMask, - IN EFI_IPv4_ADDRESS *GatewayAddress - ); - -#define EFI_NETWORK_UNREACHABLE EFIERR(100) -#define EFI_HOST_UNREACHABLE EFIERR(101) -#define EFI_PROTOCOL_UNREACHABLE EFIERR(102) -#define EFI_PORT_UNREACHABLE EFIERR(103) - -typedef struct { - EFI_IPv4_ADDRESS SourceAddress; - UINT16 SourcePort; - EFI_IPv4_ADDRESS DestinationAddress; - UINT16 DestinationPort; -} EFI_UDP4_SESSION_DATA; - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_UDP4_FRAGMENT_DATA; - -typedef struct { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - EFI_UDP4_SESSION_DATA UdpSession; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP4_RECEIVE_DATA; - -typedef struct { - EFI_UDP4_SESSION_DATA *UdpSessionData; - EFI_IPv4_ADDRESS *GatewayAddress; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP4_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP4_TRANSMIT_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_UDP4_RECEIVE_DATA *RxData; - EFI_UDP4_TRANSMIT_DATA *TxData; - } Packet; -} EFI_UDP4_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_TRANSMIT) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_RECEIVE) ( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_CANCEL)( - IN struct _EFI_UDP4 *This, - IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP4_POLL) ( - IN struct _EFI_UDP4 *This - ); - -typedef struct _EFI_UDP4 { - EFI_UDP4_GET_MODE_DATA GetModeData; - EFI_UDP4_CONFIGURE Configure; - EFI_UDP4_GROUPS Groups; - EFI_UDP4_ROUTES Routes; - EFI_UDP4_TRANSMIT Transmit; - EFI_UDP4_RECEIVE Receive; - EFI_UDP4_CANCEL Cancel; - EFI_UDP4_POLL Poll; -} EFI_UDP4; - -typedef struct { - BOOLEAN AcceptPromiscuous; - BOOLEAN AcceptAnyPort; - BOOLEAN AllowDuplicatePort; - UINT8 TrafficClass; - UINT8 HopLimit; - UINT32 ReceiveTimeout; - UINT32 TransmitTimeout; - EFI_IPv6_ADDRESS StationAddress; - UINT16 StationPort; - EFI_IPv6_ADDRESS RemoteAddress; - UINT16 RemotePort; -} EFI_UDP6_CONFIG_DATA; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_GET_MODE_DATA) ( - IN struct _EFI_UDP6 *This, - OUT EFI_UDP6_CONFIG_DATA *Udp6ConfigData OPTIONAL, - OUT EFI_IP6_MODE_DATA *Ip6ModeData OPTIONAL, - OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, - OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_CONFIGURE) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_CONFIG_DATA *UdpConfigData OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_GROUPS) ( - IN struct _EFI_UDP6 *This, - IN BOOLEAN JoinFlag, - IN EFI_IPv6_ADDRESS *MulticastAddress OPTIONAL - ); - -typedef struct { - EFI_IPv6_ADDRESS SourceAddress; - UINT16 SourcePort; - EFI_IPv6_ADDRESS DestinationAddress; - UINT16 DestinationPort; -} EFI_UDP6_SESSION_DATA; - -typedef struct { - UINT32 FragmentLength; - VOID *FragmentBuffer; -} EFI_UDP6_FRAGMENT_DATA; - -typedef struct { - EFI_TIME TimeStamp; - EFI_EVENT RecycleSignal; - EFI_UDP6_SESSION_DATA UdpSession; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP6_RECEIVE_DATA; - -typedef struct { - EFI_UDP6_SESSION_DATA *UdpSessionData; - UINT32 DataLength; - UINT32 FragmentCount; - EFI_UDP6_FRAGMENT_DATA FragmentTable[1]; -} EFI_UDP6_TRANSMIT_DATA; - -typedef struct { - EFI_EVENT Event; - EFI_STATUS Status; - union { - EFI_UDP6_RECEIVE_DATA *RxData; - EFI_UDP6_TRANSMIT_DATA *TxData; - } Packet; -} EFI_UDP6_COMPLETION_TOKEN; - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_TRANSMIT) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_RECEIVE) ( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_CANCEL)( - IN struct _EFI_UDP6 *This, - IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL - ); - -typedef -EFI_STATUS -(EFIAPI *EFI_UDP6_POLL) ( - IN struct _EFI_UDP6 *This - ); - -typedef struct _EFI_UDP6 { - EFI_UDP6_GET_MODE_DATA GetModeData; - EFI_UDP6_CONFIGURE Configure; - EFI_UDP6_GROUPS Groups; - EFI_UDP6_TRANSMIT Transmit; - EFI_UDP6_RECEIVE Receive; - EFI_UDP6_CANCEL Cancel; - EFI_UDP6_POLL Poll; -} EFI_UDP6; - -#endif /* _EFI_UDP_H */ diff --git a/stand/efi/include/efiuga.h b/stand/efi/include/efiuga.h deleted file mode 100644 index 8c4b40dc84cc..000000000000 --- a/stand/efi/include/efiuga.h +++ /dev/null @@ -1,167 +0,0 @@ -/** @file - UGA Draw protocol from the EFI 1.1 specification. - - Abstraction of a very simple graphics device. - - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> - - This program and the accompanying materials are licensed and made available - under the terms and conditions of the BSD License which accompanies this - distribution. The full text of the license may be found at: - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - File name: UgaDraw.h - -**/ - -#ifndef __UGA_DRAW_H__ -#define __UGA_DRAW_H__ - -#define EFI_UGA_DRAW_PROTOCOL_GUID \ - { 0x982c298b, 0xf4fa, 0x41cb, {0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39} } - -typedef struct _EFI_UGA_DRAW_PROTOCOL EFI_UGA_DRAW_PROTOCOL; - -/** - Return the current video mode information. - - @param This Protocol instance pointer. - @param HorizontalResolution Current video horizontal resolution in pixels - @param VerticalResolution Current video vertical resolution in pixels - @param ColorDepth Current video color depth in bits per pixel - @param RefreshRate Current video refresh rate in Hz. - - @retval EFI_SUCCESS Mode information returned. - @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () - @retval EFI_INVALID_PARAMETER One of the input args was NULL. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_UGA_DRAW_PROTOCOL_GET_MODE) ( - IN EFI_UGA_DRAW_PROTOCOL *This, - OUT UINT32 *HorizontalResolution, - OUT UINT32 *VerticalResolution, - OUT UINT32 *ColorDepth, - OUT UINT32 *RefreshRate - ) -; - -/** - Return the current video mode information. - - @param This Protocol instance pointer. - @param HorizontalResolution Current video horizontal resolution in pixels - @param VerticalResolution Current video vertical resolution in pixels - @param ColorDepth Current video color depth in bits per pixel - @param RefreshRate Current video refresh rate in Hz. - - @retval EFI_SUCCESS Mode information returned. - @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode () - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_UGA_DRAW_PROTOCOL_SET_MODE) ( - IN EFI_UGA_DRAW_PROTOCOL *This, - IN UINT32 HorizontalResolution, - IN UINT32 VerticalResolution, - IN UINT32 ColorDepth, - IN UINT32 RefreshRate - ) -; - -typedef struct { - UINT8 Blue; - UINT8 Green; - UINT8 Red; - UINT8 Reserved; -} EFI_UGA_PIXEL; - -typedef union { - EFI_UGA_PIXEL Pixel; - UINT32 Raw; -} EFI_UGA_PIXEL_UNION; - -typedef enum { - EfiUgaVideoFill, - EfiUgaVideoToBltBuffer, - EfiUgaBltBufferToVideo, - EfiUgaVideoToVideo, - EfiUgaBltMax -} EFI_UGA_BLT_OPERATION; - -/** - Type specifying a pointer to a function to perform an UGA Blt operation. - - The following table defines actions for BltOperations: - - <B>EfiUgaVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - Only one pixel will be used from the BltBuffer. Delta is NOT used. - - <B>EfiUgaVideoToBltBuffer</B> - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes - of a row in the BltBuffer. - - <B>EfiUgaBltBufferToVideo</B> - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the - BltBuffer. - - <B>EfiUgaVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY) - (SourceX + Width, SourceY + Height) .to the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - The BltBuffer and Delta are not used in this mode. - - - @param[in] This - Protocol instance pointer. - @param[in] BltBuffer - Buffer containing data to blit into video buffer. This - buffer has a size of Width*Height*sizeof(EFI_UGA_PIXEL) - @param[in] BltOperation - Operation to perform on BlitBuffer and video memory - @param[in] SourceX - X coordinate of source for the BltBuffer. - @param[in] SourceY - Y coordinate of source for the BltBuffer. - @param[in] DestinationX - X coordinate of destination for the BltBuffer. - @param[in] DestinationY - Y coordinate of destination for the BltBuffer. - @param[in] Width - Width of rectangle in BltBuffer in pixels. - @param[in] Height - Hight of rectangle in BltBuffer in pixels. - @param[in] Delta - OPTIONAL - - @retval EFI_SUCCESS - The Blt operation completed. - @retval EFI_INVALID_PARAMETER - BltOperation is not valid. - @retval EFI_DEVICE_ERROR - A hardware error occurred writing to the video buffer. - ---*/ -typedef -EFI_STATUS -(EFIAPI *EFI_UGA_DRAW_PROTOCOL_BLT) ( - IN EFI_UGA_DRAW_PROTOCOL * This, - IN EFI_UGA_PIXEL * BltBuffer, OPTIONAL - IN EFI_UGA_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta OPTIONAL - ); - -struct _EFI_UGA_DRAW_PROTOCOL { - EFI_UGA_DRAW_PROTOCOL_GET_MODE GetMode; - EFI_UGA_DRAW_PROTOCOL_SET_MODE SetMode; - EFI_UGA_DRAW_PROTOCOL_BLT Blt; -}; - -extern EFI_GUID gEfiUgaDrawProtocolGuid; - -#endif diff --git a/stand/efi/include/efizfs.h b/stand/efi/include/efizfs.h index b29fb8d1af7e..45c2ca1c94aa 100644 --- a/stand/efi/include/efizfs.h +++ b/stand/efi/include/efizfs.h @@ -31,6 +31,13 @@ #define _EFIZFS_H_ #ifdef EFI_ZFS_BOOT +/* + * EFI defines these, but libzfs.h includes stuff which includes stuff which + * include sys/param.h which defines these. This is easier than any of the other + * crazy we can do. + */ +#undef MIN +#undef MAX #include <libzfs.h> typedef STAILQ_HEAD(zfsinfo_list, zfsinfo) zfsinfo_list_t; diff --git a/stand/efi/include/i386/efibind.h b/stand/efi/include/i386/efibind.h deleted file mode 100644 index dac056571c7c..000000000000 --- a/stand/efi/include/i386/efibind.h +++ /dev/null @@ -1,183 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - -#ifdef EFI_NT_EMULATOR - #define POST_CODE(_Data) -#else - #ifdef EFI_DEBUG -#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al - #else - #define POST_CODE(_Data) - #endif -#endif - -#define EFIERR(a) (0x80000000 | a) -#define EFI_ERROR_MASK 0x80000000 -#define EFIERR_OEM(a) (0xc0000000 | a) - - -#define BAD_POINTER 0xFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFF - -#define BREAKPOINT() __asm { int 3 } - -// -// Pointers must be aligned to these address to function -// - -#define MIN_ALIGNMENT_SIZE 4 - -#define ALIGN_VARIABLE(Value ,Adjustment) \ - (UINTN)Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - - -// -// Define macros to build data structure signatures from characters. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a -//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg() - -#define VOLATILE volatile - -#define MEMORY_FENCE() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -#ifdef EFI_NT_EMULATOR - -// -// To help ensure proper coding of integrated drivers, they are -// compiled as DLLs. In NT they require a dll init entry pointer. -// The macro puts a stub entry point into the DLL so it will load. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) \ - EFI_STATUS \ - InitFunction ( \ - EFI_HANDLE ImageHandle, \ - EFI_SYSTEM_TABLE *SystemTable \ - ); \ - \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - __declspec( dllexport ) \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ - } - - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, NULL) - -#else // EFI_NT_EMULATOR - -// -// When build similar to FW, then link everything together as -// one big module. -// - - #define EFI_DRIVER_ENTRY_POINT(InitFunction) - - #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) - -#endif // EFI_FW_NT - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif /* __FreeBSD__ */ - -#ifdef _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP -#endif - diff --git a/stand/efi/include/i386/pe.h b/stand/efi/include/i386/pe.h index c756080fe2d7..226c6c7564a7 100644 --- a/stand/efi/include/i386/pe.h +++ b/stand/efi/include/i386/pe.h @@ -83,7 +83,7 @@ typedef struct _IMAGE_FILE_HEADER { #define IMAGE_SIZEOF_FILE_HEADER 20 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). +#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved external references). #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. diff --git a/stand/efi/include/riscv/efibind.h b/stand/efi/include/riscv/efibind.h deleted file mode 100644 index c81506f79334..000000000000 --- a/stand/efi/include/riscv/efibind.h +++ /dev/null @@ -1,140 +0,0 @@ -/*++ - -Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved -This software and associated documentation (if any) is furnished -under a license and may only be used or copied in accordance -with the terms of the license. Except as permitted by such -license, no part of this software or documentation may be -reproduced, stored in a retrieval system, or transmitted in any -form or by any means without the express written consent of -Intel Corporation. - -Module Name: - - efefind.h - -Abstract: - - EFI to compile bindings - - - - -Revision History - ---*/ - -#pragma pack() - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// BugBug: Code to debug -// -#define BIT63 0x8000000000000000 - -#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63) -#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) ) - -// -// Macro's with casts make this much easier to use and read. -// -#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port))) -#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data)) -// -// BugBug: End Debug Code!!! -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -#define EFIERR(a) (0x8000000000000000 | a) -#define EFI_ERROR_MASK 0x8000000000000000 -#define EFIERR_OEM(a) (0xc000000000000000 | a) - -#define BAD_POINTER 0xFBFBFBFBFBFBFBFB -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - -#define BREAKPOINT() __break(0) - -// -// Pointers must be aligned to these address to function -// you will get an alignment fault if this value is less than 8 -// -#define MIN_ALIGNMENT_SIZE 8 - -#define ALIGN_VARIABLE(Value , Adjustment) \ - (UINTN) Adjustment = 0; \ - if((UINTN)Value % MIN_ALIGNMENT_SIZE) \ - (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \ - Value = (UINTN)Value + (UINTN)Adjustment - -// -// Define macros to create data structure signatures. -// - -#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) -#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) -#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) - -// -// EFIAPI - prototype calling convention for EFI function pointers -// BOOTSERVICE - prototype for implementation of a boot service interface -// RUNTIMESERVICE - prototype for implementation of a runtime service interface -// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service -// RUNTIME_CODE - pragma macro for declaring runtime code -// - -#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options - #ifdef _MSC_EXTENSIONS - #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler - #else - #define EFIAPI // Substitute expresion to force C calling convention - #endif -#endif - -#define BOOTSERVICE -#define RUNTIMESERVICE -#define RUNTIMEFUNCTION - -#define RUNTIME_CODE(a) alloc_text("rtcode", a) -#define BEGIN_RUNTIME_DATA() data_seg("rtdata") -#define END_RUNTIME_DATA() data_seg() - -#define VOLATILE volatile - -// -// BugBug: Need to find out if this is portable across compilers. -// -void __mfa (void); -#define MEMORY_FENCE() __mfa() - -#ifdef EFI_NO_INTERFACE_DECL - #define EFI_FORWARD_DECLARATION(x) - #define EFI_INTERFACE_DECL(x) -#else - #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x - #define EFI_INTERFACE_DECL(x) typedef struct x -#endif - -// -// When build similar to FW, then link everything together as -// one big module. -// - -#define EFI_DRIVER_ENTRY_POINT(InitFunction) - -#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \ - (_if)->LoadInternal(type, name, entry) -// entry(NULL, ST) - -#ifdef __FreeBSD__ -#define INTERFACE_DECL(x) struct x -#else -// -// Some compilers don't support the forward reference construct: -// typedef struct XXXXX -// -// The following macro provide a workaround for such cases. -// -#ifdef NO_INTERFACE_DECL -#define INTERFACE_DECL(x) -#else -#define INTERFACE_DECL(x) typedef struct x -#endif -#endif diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile index 8ce57280d615..4f4586fbf253 100644 --- a/stand/efi/libefi/Makefile +++ b/stand/efi/libefi/Makefile @@ -47,13 +47,13 @@ CFLAGS+= -mgeneral-regs-only .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -fPIC -mno-red-zone .endif -CFLAGS+= -I${EFIINC} +CFLAGS+= -I${EFIINC} -I${EDK2INC} CFLAGS+= -I${EFIINCMD} CFLAGS.efi_console.c+= -I${SRCTOP}/sys/teken -I${SRCTOP}/contrib/pnglite CFLAGS.efi_console.c+= -I${.CURDIR}/../loader CFLAGS.teken.c+= -I${SRCTOP}/sys/teken .if ${MK_LOADER_ZFS} != "no" -CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SAZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common CFLAGS+= -DEFI_ZFS_BOOT diff --git a/stand/efi/libefi/devpath.c b/stand/efi/libefi/devpath.c index db152f8eb9ad..c9928733b5f9 100644 --- a/stand/efi/libefi/devpath.c +++ b/stand/efi/libefi/devpath.c @@ -28,6 +28,8 @@ #include <efichar.h> #include <uuid.h> #include <machine/_inttypes.h> +#include <Protocol/DevicePathToText.h> +#include <Protocol/DevicePathFromText.h> static EFI_GUID ImageDevicePathGUID = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; @@ -71,7 +73,7 @@ efi_close_devpath(EFI_HANDLE handle) status = BS->CloseProtocol(handle, &DevicePathGUID, IH, NULL); if (EFI_ERROR(status)) - printf("CloseProtocol error: %lu\n", EFI_ERROR_CODE(status)); + printf("CloseProtocol error: %lu\n", DECODE_ERROR(status)); } static char * @@ -165,7 +167,7 @@ efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix) break; case HW_CONTROLLER_DP: if (asprintf(&name, "Ctrl(%x)%s", - ((CONTROLLER_DEVICE_PATH *)node)->Controller, tail) < 0) + ((CONTROLLER_DEVICE_PATH *)node)->ControllerNumber, tail) < 0) name = NULL; break; default: diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index cbb4dd01d1fb..46a3c957f151 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -1041,28 +1041,7 @@ cons_update_mode(bool use_gfx_mode) a = teken_get_defattr(&gfx_state.tg_teken); attr = *a; - /* - * On first run, we set up the efi_set_colors() - * callback. If the env is already set, we - * pick up fg and bg color values from the environment. - */ - ptr = getenv("teken.fg_color"); - if (ptr != NULL) { - attr.ta_fgcolor = strtol(ptr, NULL, 10); - ptr = getenv("teken.bg_color"); - attr.ta_bgcolor = strtol(ptr, NULL, 10); - - teken_set_defattr(&gfx_state.tg_teken, &attr); - } else { - snprintf(env, sizeof(env), "%d", - attr.ta_fgcolor); - env_setenv("teken.fg_color", EV_VOLATILE, env, - efi_set_colors, env_nounset); - snprintf(env, sizeof(env), "%d", - attr.ta_bgcolor); - env_setenv("teken.bg_color", EV_VOLATILE, env, - efi_set_colors, env_nounset); - } + gfx_fb_setcolors(&attr, efi_set_colors, env_nounset); } } diff --git a/stand/efi/libefi/efi_driver_utils.c b/stand/efi/libefi/efi_driver_utils.c index adb57f39fdce..6006548e037b 100644 --- a/stand/efi/libefi/efi_driver_utils.c +++ b/stand/efi/libefi/efi_driver_utils.c @@ -24,14 +24,11 @@ * SUCH DAMAGE. */ -#include <stdbool.h> - -#include <efi.h> -#include <efilib.h> - +#include "efi.h" +#include "efilib.h" #include "efi_driver_utils.h" -static EFI_GUID DriverBindingProtocolGUID = DRIVER_BINDING_PROTOCOL; +static EFI_GUID DriverBindingProtocolGUID = EFI_DRIVER_BINDING_PROTOCOL_GUID; EFI_STATUS connect_controllers(EFI_GUID *filter) @@ -71,7 +68,7 @@ connect_controllers(EFI_GUID *filter) } EFI_STATUS -install_driver(EFI_DRIVER_BINDING *driver) +install_driver(EFI_DRIVER_BINDING_PROTOCOL *driver) { EFI_STATUS status; @@ -84,7 +81,7 @@ install_driver(EFI_DRIVER_BINDING *driver) if (EFI_ERROR(status)) { printf("Failed to install driver (%ld)!\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); } return (status); diff --git a/stand/efi/libefi/eficom.c b/stand/efi/libefi/eficom.c index 2aa592da47f4..62069eb01d6c 100644 --- a/stand/efi/libefi/eficom.c +++ b/stand/efi/libefi/eficom.c @@ -30,8 +30,9 @@ #include <efi.h> #include <efilib.h> +#include <Protocol/SerialIo.h> -static EFI_GUID serial = SERIAL_IO_PROTOCOL; +static EFI_GUID serial = EFI_SERIAL_IO_PROTOCOL_GUID; #define COMC_TXWAIT 0x40000 /* transmit timeout */ @@ -510,7 +511,7 @@ comc_port_set(struct env_var *ev, int flags, const void *value) (void**)&sio, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); if (EFI_ERROR(status)) { - printf("OpenProtocol: %lu\n", EFI_ERROR_CODE(status)); + printf("OpenProtocol: %lu\n", DECODE_ERROR(status)); return (CMD_ERROR); } diff --git a/stand/efi/libefi/efienv.c b/stand/efi/libefi/efienv.c index 83da2acc816b..9840eb9fd870 100644 --- a/stand/efi/libefi/efienv.c +++ b/stand/efi/libefi/efienv.c @@ -27,6 +27,7 @@ #include <efi.h> #include <efichar.h> #include <efilib.h> +#include <Guid/GlobalVariable.h> static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID; static EFI_GUID GlobalBootVarGUID = EFI_GLOBAL_VARIABLE; diff --git a/stand/efi/libefi/efihttp.c b/stand/efi/libefi/efihttp.c index fd0ed744047c..b18607410f3b 100644 --- a/stand/efi/libefi/efihttp.c +++ b/stand/efi/libefi/efihttp.c @@ -36,7 +36,6 @@ #include <efi.h> #include <efilib.h> -#include <efiprot.h> #include <Protocol/Http.h> #include <Protocol/Ip4Config2.h> #include <Protocol/ServiceBinding.h> diff --git a/stand/efi/libefi/efinet.c b/stand/efi/libefi/efinet.c index e872110ef08f..d3d975d21268 100644 --- a/stand/efi/libefi/efinet.c +++ b/stand/efi/libefi/efinet.c @@ -36,10 +36,11 @@ #include <efi.h> #include <efilib.h> +#include <Protocol/SimpleNetwork.h> #include "dev_net.h" -static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL; +static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID; static void efinet_end(struct netif *); static ssize_t efinet_get(struct iodesc *, void **, time_t); @@ -122,7 +123,7 @@ efinet_probe(struct netif *nif, void *machdep_hint) if (status != EFI_SUCCESS) { printf("Unable to open network interface %d for " "exclusive access: %lu\n", nif->nif_unit, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (efi_status_to_errno(status)); } @@ -287,7 +288,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) status = OpenProtocolByHandle(h, &sn_guid, (void **)&nif->nif_devdata); if (status != EFI_SUCCESS) { printf("net%d: cannot fetch interface data (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); + nif->nif_unit, DECODE_ERROR(status)); return; } @@ -296,7 +297,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) status = net->Start(net); if (status != EFI_SUCCESS) { printf("net%d: cannot start interface (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); + nif->nif_unit, DECODE_ERROR(status)); return; } } @@ -305,7 +306,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) status = net->Initialize(net, 0, 0); if (status != EFI_SUCCESS) { printf("net%d: cannot init. interface (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); + nif->nif_unit, DECODE_ERROR(status)); return; } } @@ -316,7 +317,7 @@ efinet_init(struct iodesc *desc, void *machdep_hint) status = net->ReceiveFilters(net, mask, 0, FALSE, 0, NULL); if (status != EFI_SUCCESS) printf("net%d: cannot set rx. filters (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); + nif->nif_unit, DECODE_ERROR(status)); #ifdef EFINET_DEBUG dump_mode(net->Mode); diff --git a/stand/efi/libefi/efipart.c b/stand/efi/libefi/efipart.c index 3df6034571f5..c61a7fce2a47 100644 --- a/stand/efi/libefi/efipart.c +++ b/stand/efi/libefi/efipart.c @@ -35,8 +35,9 @@ #include <efi.h> #include <efilib.h> -#include <efiprot.h> #include <efichar.h> +#include <Protocol/DevicePath.h> +#include <Protocol/BlockIo.h> #include <disk.h> static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; @@ -388,7 +389,7 @@ efipart_inithandles(void) status = OpenProtocolByHandle(hin[i], &blkio_guid, (void **)&blkio); if (EFI_ERROR(status)) { - printf("error %lu\n", EFI_ERROR_CODE(status)); + printf("error %lu\n", DECODE_ERROR(status)); continue; } @@ -1033,7 +1034,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks, if (EFI_ERROR(status)) { printf("%s: rw=%d, blk=%ju size=%ju status=%lu\n", __func__, rw, - blk, nblks, EFI_ERROR_CODE(status)); + blk, nblks, DECODE_ERROR(status)); } TSEXIT(); return (efi_status_to_errno(status)); diff --git a/stand/efi/libefi/env.c b/stand/efi/libefi/env.c index 328476a9f68b..6a30788f255b 100644 --- a/stand/efi/libefi/env.c +++ b/stand/efi/libefi/env.c @@ -23,22 +23,112 @@ * SUCH DAMAGE. */ +#include <sys/param.h> #include <stand.h> #include <string.h> #include <efi.h> #include <efichar.h> #include <efilib.h> -#include <efigpt.h> /* Partition GUIDS */ -#include <Guid/MemoryTypeInformation.h> -#include <Guid/MtcVendor.h> -#include <Guid/ZeroGuid.h> +#include <Guid/Acpi.h> +#include <Guid/DxeServices.h> +#include <Guid/DebugImageInfoTable.h> +#include <Guid/GlobalVariable.h> +#include <Guid/Gpt.h> +#include <Guid/Mps.h> +#include <Guid/SmBios.h> +#include <Pi/PiFirmwareFile.h> +#include <Pi/PiFirmwareVolume.h> +#include <Pi/PiMultiPhase.h> +#include <Protocol/AbsolutePointer.h> +#include <Protocol/Arp.h> +#include <Protocol/Bds.h> +#include <Protocol/Capsule.h> +#include <Protocol/ComponentName.h> +#include <Protocol/Cpu.h> +#include <Protocol/CpuIo2.h> +#include <Protocol/Decompress.h> +#include <Protocol/DeviceIo.h> +#include <Protocol/DevicePathToText.h> +#include <Protocol/Dhcp4.h> +#include <Protocol/Dhcp6.h> +#include <Protocol/DiskInfo.h> +#include <Protocol/DiskIo.h> +#include <Protocol/DriverBinding.h> +#include <Protocol/DriverConfiguration2.h> +#include <Protocol/DriverDiagnostics.h> +#include <Protocol/DriverDiagnostics2.h> +#include <Protocol/Ebc.h> +#include <Protocol/EdidActive.h> #include <Protocol/EdidActive.h> #include <Protocol/EdidDiscovered.h> +#include <Protocol/EdidDiscovered.h> +#include <Protocol/FirmwareVolume2.h> +#include <Protocol/FirmwareVolumeBlock.h> +#include <Protocol/FormBrowser2.h> +#include <Protocol/GraphicsOutput.h> +#include <Protocol/HiiConfigRouting.h> +#include <Protocol/HiiDatabase.h> +#include <Protocol/HiiFont.h> +#include <Protocol/HiiImage.h> +#include <Protocol/HiiString.h> +#include <Protocol/IdeControllerInit.h> +#include <Protocol/Ip4.h> +#include <Protocol/Ip4Config.h> +#include <Protocol/LoadFile.h> +#include <Protocol/ManagedNetwork.h> +#include <Protocol/Metronome.h> +#include <Protocol/MonotonicCounter.h> +#include <Protocol/MpService.h> +#include <Protocol/Mtftp4.h> +#include <Protocol/Mtftp6.h> +#include <Protocol/NetworkInterfaceIdentifier.h> +#include <Protocol/Pcd.h> +#include <Protocol/PciEnumerationComplete.h> +#include <Protocol/PciHostBridgeResourceAllocation.h> +#include <Protocol/PciHotPlugInit.h> +#include <Protocol/PciHotPlugRequest.h> +#include <Protocol/PciIo.h> +#include <Protocol/PciOverride.h> +#include <Protocol/PciPlatform.h> +#include <Protocol/PciRootBridgeIo.h> +#include <Protocol/PiPcd.h> +#include <Protocol/PxeBaseCode.h> +#include <Protocol/PxeBaseCodeCallBack.h> +#include <Protocol/Reset.h> +#include <Protocol/Runtime.h> +#include <Protocol/ScsiIo.h> +#include <Protocol/ScsiPassThru.h> +#include <Protocol/ScsiPassThruExt.h> +#include <Protocol/Security.h> +#include <Protocol/Security2.h> +#include <Protocol/SerialIo.h> +#include <Protocol/SimpleFileSystem.h> +#include <Protocol/SimpleNetwork.h> +#include <Protocol/SimplePointer.h> +#include <Protocol/SimpleTextIn.h> +#include <Protocol/SimpleTextInEx.h> +#include <Protocol/SimpleTextOut.h> +#include <Protocol/StatusCode.h> +#include <Protocol/Tcp4.h> +#include <Protocol/Tcp6.h> +#include <Protocol/Timer.h> +#include <Protocol/UgaDraw.h> +#include <Protocol/UgaIo.h> +#include <Protocol/UnicodeCollation.h> +#include <Protocol/Usb2HostController.h> +#include <Protocol/UsbIo.h> +#include <Protocol/Variable.h> +#include <Protocol/VariableWrite.h> +#include <Protocol/VlanConfig.h> +#include <Protocol/WatchdogTimer.h> #include <uuid.h> #include <stdbool.h> -#include <sys/param.h> #include "bootstrap.h" + + +#define ZERO_GUID { 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} } + /* * About ENABLE_UPDATES * @@ -66,64 +156,64 @@ static struct efi_uuid_mapping { /* EFI Systab entry names. */ { .efi_guid_name = "MPS Table", .efi_guid = MPS_TABLE_GUID }, { .efi_guid_name = "ACPI Table", .efi_guid = ACPI_TABLE_GUID }, - { .efi_guid_name = "ACPI 2.0 Table", .efi_guid = ACPI_20_TABLE_GUID }, + { .efi_guid_name = "ACPI 2.0 Table", .efi_guid = EFI_ACPI_20_TABLE_GUID }, { .efi_guid_name = "SMBIOS Table", .efi_guid = SMBIOS_TABLE_GUID }, { .efi_guid_name = "SMBIOS3 Table", .efi_guid = SMBIOS3_TABLE_GUID }, { .efi_guid_name = "DXE Table", .efi_guid = DXE_SERVICES_TABLE_GUID }, - { .efi_guid_name = "HOB List Table", .efi_guid = HOB_LIST_TABLE_GUID }, - { .efi_guid_name = EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME, - .efi_guid = EFI_MEMORY_TYPE_INFORMATION_GUID }, +// { .efi_guid_name = "HOB List Table", .efi_guid = HOB_LIST_TABLE_GUID }, +// { .efi_guid_name = EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME, +// .efi_guid = EFI_MEMORY_TYPE_INFORMATION_GUID }, { .efi_guid_name = "Debug Image Info Table", - .efi_guid = DEBUG_IMAGE_INFO_TABLE_GUID }, - { .efi_guid_name = "FDT Table", .efi_guid = FDT_TABLE_GUID }, + .efi_guid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID }, +// { .efi_guid_name = "FDT Table", .efi_guid = FDT_TABLE_GUID }, /* * Protocol names for debug purposes. * Can be removed along with lsefi command. */ { .efi_guid_name = "device path", .efi_guid = DEVICE_PATH_PROTOCOL }, { .efi_guid_name = "block io", .efi_guid = BLOCK_IO_PROTOCOL }, - { .efi_guid_name = "disk io", .efi_guid = DISK_IO_PROTOCOL }, + { .efi_guid_name = "disk io", .efi_guid = EFI_DISK_IO_PROTOCOL_GUID }, { .efi_guid_name = "disk info", .efi_guid = EFI_DISK_INFO_PROTOCOL_GUID }, { .efi_guid_name = "simple fs", - .efi_guid = SIMPLE_FILE_SYSTEM_PROTOCOL }, + .efi_guid = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID }, { .efi_guid_name = "load file", .efi_guid = LOAD_FILE_PROTOCOL }, { .efi_guid_name = "device io", .efi_guid = DEVICE_IO_PROTOCOL }, { .efi_guid_name = "unicode collation", - .efi_guid = UNICODE_COLLATION_PROTOCOL }, + .efi_guid = EFI_UNICODE_COLLATION_PROTOCOL_GUID }, { .efi_guid_name = "unicode collation2", - .efi_guid = EFI_UNICODE_COLLATION2_PROTOCOL_GUID }, + .efi_guid = EFI_UNICODE_COLLATION_PROTOCOL2_GUID }, { .efi_guid_name = "simple network", - .efi_guid = EFI_SIMPLE_NETWORK_PROTOCOL }, + .efi_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID }, { .efi_guid_name = "simple text output", - .efi_guid = SIMPLE_TEXT_OUTPUT_PROTOCOL }, + .efi_guid = EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID }, { .efi_guid_name = "simple text input", - .efi_guid = SIMPLE_TEXT_INPUT_PROTOCOL }, + .efi_guid = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID }, { .efi_guid_name = "simple text ex input", .efi_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID }, - { .efi_guid_name = "console control", - .efi_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID }, - { .efi_guid_name = "stdin", .efi_guid = EFI_CONSOLE_IN_DEVICE_GUID }, - { .efi_guid_name = "stdout", .efi_guid = EFI_CONSOLE_OUT_DEVICE_GUID }, - { .efi_guid_name = "stderr", - .efi_guid = EFI_STANDARD_ERROR_DEVICE_GUID }, +// { .efi_guid_name = "console control", +// .efi_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID }, +// { .efi_guid_name = "stdin", .efi_guid = EFI_CONSOLE_IN_DEVICE_GUID }, +// { .efi_guid_name = "stdout", .efi_guid = EFI_CONSOLE_OUT_DEVICE_GUID }, +// { .efi_guid_name = "stderr", +// .efi_guid = EFI_STANDARD_ERROR_DEVICE_GUID }, { .efi_guid_name = "GOP", .efi_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID }, { .efi_guid_name = "UGA draw", .efi_guid = EFI_UGA_DRAW_PROTOCOL_GUID }, { .efi_guid_name = "PXE base code", - .efi_guid = EFI_PXE_BASE_CODE_PROTOCOL }, + .efi_guid = EFI_PXE_BASE_CODE_PROTOCOL_GUID }, { .efi_guid_name = "PXE base code callback", - .efi_guid = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL }, - { .efi_guid_name = "serial io", .efi_guid = SERIAL_IO_PROTOCOL }, - { .efi_guid_name = "loaded image", .efi_guid = LOADED_IMAGE_PROTOCOL }, + .efi_guid = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID }, + { .efi_guid_name = "serial io", .efi_guid = EFI_SERIAL_IO_PROTOCOL_GUID }, + { .efi_guid_name = "loaded image", .efi_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID }, { .efi_guid_name = "loaded image device path", .efi_guid = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID }, - { .efi_guid_name = "ISA io", .efi_guid = EFI_ISA_IO_PROTOCOL_GUID }, +// { .efi_guid_name = "ISA io", .efi_guid = EFI_ISA_IO_PROTOCOL_GUID }, { .efi_guid_name = "IDE controller init", .efi_guid = EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID }, - { .efi_guid_name = "ISA ACPI", .efi_guid = EFI_ISA_ACPI_PROTOCOL_GUID }, +// { .efi_guid_name = "ISA ACPI", .efi_guid = EFI_ISA_ACPI_PROTOCOL_GUID }, { .efi_guid_name = "PCI", .efi_guid = EFI_PCI_IO_PROTOCOL_GUID }, - { .efi_guid_name = "PCI root", .efi_guid = EFI_PCI_ROOT_IO_GUID }, +// { .efi_guid_name = "PCI root", .efi_guid = EFI_PCI_ROOT_IO_GUID }, { .efi_guid_name = "PCI enumeration", .efi_guid = EFI_PCI_ENUMERATION_COMPLETE_GUID }, { .efi_guid_name = "Driver diagnostics", @@ -140,42 +230,42 @@ static struct efi_uuid_mapping { .efi_guid = EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID }, { .efi_guid_name = "ARP", .efi_guid = EFI_ARP_PROTOCOL_GUID }, { .efi_guid_name = "IPv4 service binding", - .efi_guid = EFI_IP4_SERVICE_BINDING_PROTOCOL }, - { .efi_guid_name = "IPv4", .efi_guid = EFI_IP4_PROTOCOL }, + .efi_guid = EFI_IP4_SERVICE_BINDING_PROTOCOL_GUID }, + { .efi_guid_name = "IPv4", .efi_guid = EFI_IP4_PROTOCOL_GUID }, { .efi_guid_name = "IPv4 config", .efi_guid = EFI_IP4_CONFIG_PROTOCOL_GUID }, - { .efi_guid_name = "IPv6 service binding", - .efi_guid = EFI_IP6_SERVICE_BINDING_PROTOCOL }, - { .efi_guid_name = "IPv6", .efi_guid = EFI_IP6_PROTOCOL }, - { .efi_guid_name = "IPv6 config", - .efi_guid = EFI_IP6_CONFIG_PROTOCOL_GUID }, - { .efi_guid_name = "UDPv4", .efi_guid = EFI_UDP4_PROTOCOL }, - { .efi_guid_name = "UDPv4 service binding", - .efi_guid = EFI_UDP4_SERVICE_BINDING_PROTOCOL }, - { .efi_guid_name = "UDPv6", .efi_guid = EFI_UDP6_PROTOCOL }, - { .efi_guid_name = "UDPv6 service binding", - .efi_guid = EFI_UDP6_SERVICE_BINDING_PROTOCOL }, - { .efi_guid_name = "TCPv4", .efi_guid = EFI_TCP4_PROTOCOL }, +// { .efi_guid_name = "IPv6 service binding", +// .efi_guid = EFI_IP6_SERVICE_BINDING_PROTOCOL_GUID }, +// { .efi_guid_name = "IPv6", .efi_guid = EFI_IP6_PROTOCOL }, +// { .efi_guid_name = "IPv6 config", +// .efi_guid = EFI_IP6_CONFIG_PROTOCOL_GUID }, +// { .efi_guid_name = "UDPv4", .efi_guid = EFI_UDP4_PROTOCOL }, +// { .efi_guid_name = "UDPv4 service binding", +// .efi_guid = EFI_UDP4_SERVICE_BINDING_PROTOCOL_GUID }, +// { .efi_guid_name = "UDPv6", .efi_guid = EFI_UDP6_PROTOCOL }, +// { .efi_guid_name = "UDPv6 service binding", +// .efi_guid = EFI_UDP6_SERVICE_BINDING_PROTOCOL_GUID }, + { .efi_guid_name = "TCPv4", .efi_guid = EFI_TCP4_PROTOCOL_GUID }, { .efi_guid_name = "TCPv4 service binding", - .efi_guid = EFI_TCP4_SERVICE_BINDING_PROTOCOL }, - { .efi_guid_name = "TCPv6", .efi_guid = EFI_TCP6_PROTOCOL }, + .efi_guid = EFI_TCP4_SERVICE_BINDING_PROTOCOL_GUID }, + { .efi_guid_name = "TCPv6", .efi_guid = EFI_TCP6_PROTOCOL_GUID }, { .efi_guid_name = "TCPv6 service binding", - .efi_guid = EFI_TCP6_SERVICE_BINDING_PROTOCOL }, + .efi_guid = EFI_TCP6_SERVICE_BINDING_PROTOCOL_GUID }, { .efi_guid_name = "EFI System partition", .efi_guid = EFI_PART_TYPE_EFI_SYSTEM_PART_GUID }, { .efi_guid_name = "MBR legacy", .efi_guid = EFI_PART_TYPE_LEGACY_MBR_GUID }, - { .efi_guid_name = "device tree", .efi_guid = EFI_DEVICE_TREE_GUID }, +// { .efi_guid_name = "device tree", .efi_guid = EFI_DEVICE_TREE_GUID }, { .efi_guid_name = "USB io", .efi_guid = EFI_USB_IO_PROTOCOL_GUID }, { .efi_guid_name = "USB2 HC", .efi_guid = EFI_USB2_HC_PROTOCOL_GUID }, { .efi_guid_name = "component name", .efi_guid = EFI_COMPONENT_NAME_PROTOCOL_GUID }, - { .efi_guid_name = "component name2", - .efi_guid = EFI_COMPONENT_NAME2_PROTOCOL_GUID }, +// { .efi_guid_name = "component name2", +// .efi_guid = EFI_COMPONENT_NAME2_PROTOCOL_GUID }, { .efi_guid_name = "driver binding", .efi_guid = EFI_DRIVER_BINDING_PROTOCOL_GUID }, - { .efi_guid_name = "driver configuration", - .efi_guid = EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID }, +// { .efi_guid_name = "driver configuration", +// .efi_guid = EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID }, { .efi_guid_name = "driver configuration2", .efi_guid = EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID }, { .efi_guid_name = "decompress", @@ -183,9 +273,9 @@ static struct efi_uuid_mapping { { .efi_guid_name = "ebc interpreter", .efi_guid = EFI_EBC_INTERPRETER_PROTOCOL_GUID }, { .efi_guid_name = "network interface identifier", - .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL }, + .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID }, { .efi_guid_name = "network interface identifier_31", - .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_31 }, + .efi_guid = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31 }, { .efi_guid_name = "managed network service binding", .efi_guid = EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID }, { .efi_guid_name = "managed network", @@ -201,8 +291,8 @@ static struct efi_uuid_mapping { { .efi_guid_name = "HII image", .efi_guid = EFI_HII_IMAGE_PROTOCOL_GUID }, { .efi_guid_name = "HII font", .efi_guid = EFI_HII_FONT_PROTOCOL_GUID }, - { .efi_guid_name = "HII config", - .efi_guid = EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID }, +// { .efi_guid_name = "HII config", +// .efi_guid = EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID }, { .efi_guid_name = "MTFTP4 service binding", .efi_guid = EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID }, { .efi_guid_name = "MTFTP4", .efi_guid = EFI_MTFTP4_PROTOCOL_GUID }, @@ -224,31 +314,31 @@ static struct efi_uuid_mapping { .efi_guid = EFI_CAPSULE_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "monotonic counter arch", .efi_guid = EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID }, - { .efi_guid_name = "realtime clock arch", - .efi_guid = EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID }, +// { .efi_guid_name = "realtime clock arch", +// .efi_guid = EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "variable arch", .efi_guid = EFI_VARIABLE_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "variable write arch", .efi_guid = EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "watchdog timer arch", .efi_guid = EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID }, - { .efi_guid_name = "ACPI support", - .efi_guid = EFI_ACPI_SUPPORT_PROTOCOL_GUID }, +// { .efi_guid_name = "ACPI support", +// .efi_guid = EFI_ACPI_SUPPORT_PROTOCOL_GUID }, { .efi_guid_name = "BDS arch", .efi_guid = EFI_BDS_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "metronome arch", .efi_guid = EFI_METRONOME_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "timer arch", .efi_guid = EFI_TIMER_ARCH_PROTOCOL_GUID }, - { .efi_guid_name = "DPC", .efi_guid = EFI_DPC_PROTOCOL_GUID }, - { .efi_guid_name = "print2", .efi_guid = EFI_PRINT2_PROTOCOL_GUID }, +// { .efi_guid_name = "DPC", .efi_guid = EFI_DPC_PROTOCOL_GUID }, +// { .efi_guid_name = "print2", .efi_guid = EFI_PRINT2_PROTOCOL_GUID }, { .efi_guid_name = "device path to text", .efi_guid = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID }, { .efi_guid_name = "reset arch", .efi_guid = EFI_RESET_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "CPU arch", .efi_guid = EFI_CPU_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "CPU IO2", .efi_guid = EFI_CPU_IO2_PROTOCOL_GUID }, - { .efi_guid_name = "Legacy 8259", - .efi_guid = EFI_LEGACY_8259_PROTOCOL_GUID }, +// { .efi_guid_name = "Legacy 8259", +// .efi_guid = EFI_LEGACY_8259_PROTOCOL_GUID }, { .efi_guid_name = "Security arch", .efi_guid = EFI_SECURITY_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "Security2 arch", @@ -257,19 +347,19 @@ static struct efi_uuid_mapping { .efi_guid = EFI_RUNTIME_ARCH_PROTOCOL_GUID }, { .efi_guid_name = "status code runtime", .efi_guid = EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID }, - { .efi_guid_name = "data hub", .efi_guid = EFI_DATA_HUB_PROTOCOL_GUID }, +// { .efi_guid_name = "data hub", .efi_guid = EFI_DATA_HUB_PROTOCOL_GUID }, { .efi_guid_name = "PCD", .efi_guid = PCD_PROTOCOL_GUID }, { .efi_guid_name = "EFI PCD", .efi_guid = EFI_PCD_PROTOCOL_GUID }, { .efi_guid_name = "firmware volume block", .efi_guid = EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID }, { .efi_guid_name = "firmware volume2", .efi_guid = EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID }, - { .efi_guid_name = "firmware volume dispatch", - .efi_guid = EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID }, - { .efi_guid_name = "lzma compress", .efi_guid = LZMA_COMPRESS_GUID }, +// { .efi_guid_name = "firmware volume dispatch", +// .efi_guid = EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID }, +// { .efi_guid_name = "lzma compress", .efi_guid = LZMA_COMPRESS_GUID }, { .efi_guid_name = "MP services", .efi_guid = EFI_MP_SERVICES_PROTOCOL_GUID }, - { .efi_guid_name = MTC_VARIABLE_NAME, .efi_guid = MTC_VENDOR_GUID }, +// { .efi_guid_name = MTC_VARIABLE_NAME, .efi_guid = MTC_VENDOR_GUID }, { .efi_guid_name = "RTC", .efi_guid = { 0x378D7B65, 0x8DA9, 0x4773, { 0xB6, 0xE4, 0xA4, 0x78, 0x26, 0xA8, 0x33, 0xE1} } }, { .efi_guid_name = "Active EDID", @@ -441,6 +531,7 @@ efi_memory_type(EFI_MEMORY_TYPE type) } } +#if 0 /* Print memory type table. */ static int efi_print_mem_type(const CHAR16 *varnamearg __unused, uint8_t *data, @@ -463,6 +554,7 @@ efi_print_mem_type(const CHAR16 *varnamearg __unused, uint8_t *data, return (CMD_OK); } +#endif /* * Print FreeBSD variables. @@ -679,7 +771,7 @@ efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag) status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, NULL); if (status != EFI_BUFFER_TOO_SMALL) { printf("Can't get the variable: error %#lx\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (CMD_ERROR); } data = malloc(datasz); @@ -691,7 +783,7 @@ efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag) status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, data); if (status != EFI_SUCCESS) { printf("Can't get the variable: error %#lx\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); free(data); return (CMD_ERROR); } @@ -710,18 +802,21 @@ efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag) else if (strcmp(str, "freebsd") == 0) rv = efi_print_freebsd(varnamearg, data, datasz); else if (strcmp(str, - EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME) == 0) - rv = efi_print_mem_type(varnamearg, data, datasz); - else if (strcmp(str, "47c7b227-c42a-11d2-8e57-00a0c969723b") == 0) rv = efi_print_shell_str(varnamearg, data, datasz); +#if 0 + else if (strcmp(str, + EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME) == 0) + rv = efi_print_mem_type(varnamearg, data, datasz); else if (strcmp(str, MTC_VARIABLE_NAME) == 0) { printf(" = "); printf("%u", *((uint32_t *)data)); /* UINT32 */ rv = CMD_OK; if (pager_output("\n")) rv = CMD_WARN; - } else + } +#endif + else rv = efi_print_other_value(data, datasz); } else if (pager_output("\n")) rv = CMD_WARN; @@ -954,7 +1049,7 @@ command_efi_set(int argc, char *argv[]) strlen(val) + 1, val); if (EFI_ERROR(err)) { printf("Failed to set variable: error %lu\n", - EFI_ERROR_CODE(err)); + DECODE_ERROR(err)); return (CMD_ERROR); } #else @@ -990,7 +1085,7 @@ command_efi_unset(int argc, char *argv[]) err = RS->SetVariable(wvar, &guid, 0, 0, NULL); if (EFI_ERROR(err)) { printf("Failed to unset variable: error %lu\n", - EFI_ERROR_CODE(err)); + DECODE_ERROR(err)); return (CMD_ERROR); } #else diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index ae2ffc475730..addb7652249d 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -30,9 +30,13 @@ SRCS= autoload.c \ gfx_fb.c \ 8x16.c +SRCS+= acpi_detect.c +.PATH: ${EFISRC}/acpica +CFLAGS+= -I${EFISRC}/acpica/include + CFLAGS+= -I${.CURDIR}/../loader .if ${MK_LOADER_ZFS} != "no" -CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SAZFSSRC} CFLAGS+= -I${SYSDIR}/contrib/openzfs/include CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs CFLAGS+= -DEFI_ZFS_BOOT @@ -61,10 +65,12 @@ CWARNFLAGS.main.c+= -Wno-format .PATH: ${.CURDIR}/../loader/arch/${__arch} .include "${.CURDIR}/../loader/arch/${__arch}/Makefile.inc" +CFLAGS+= -Wall CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/arch/${__arch} CFLAGS+= -I${EFISRC}/include CFLAGS+= -I${EFISRC}/include/${__arch} +CFLAGS+= -I${EDK2INC} CFLAGS+= -I${SYSDIR}/contrib/dev/acpica/include CFLAGS+= -I${BOOTSRC}/i386/libi386 CFLAGS+= -DEFI diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/loader/arch/amd64/multiboot2.c index eb7362293406..086dba33895a 100644 --- a/stand/efi/loader/arch/amd64/multiboot2.c +++ b/stand/efi/loader/arch/amd64/multiboot2.c @@ -79,7 +79,6 @@ loadfile(char *filename, uint64_t dest, struct preloaded_file **result) void *multiboot = NULL; ssize_t search_size; struct multiboot_header *header; - char *cmdline; struct mb2hdr hdr; bool keep_bs = false; @@ -344,7 +343,7 @@ exec(struct preloaded_file *fp) EFI_SIZE_TO_PAGES(PAGE_SIZE), &addr); if (EFI_ERROR(status)) { printf("Failed to allocate pages for multiboot2 header: %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); error = ENOMEM; goto error; } @@ -352,7 +351,7 @@ exec(struct preloaded_file *fp) EFI_SIZE_TO_PAGES(128 * 1024), &stack); if (EFI_ERROR(status)) { printf("Failed to allocate pages for Xen stack: %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); error = ENOMEM; goto error; } @@ -495,7 +494,6 @@ static int obj_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) { struct preloaded_file *mfp, *kfp, *rfp; - struct kernel_module *kmp; int error; /* See if there's a multiboot kernel loaded */ diff --git a/stand/efi/loader/arch/amd64/trap.c b/stand/efi/loader/arch/amd64/trap.c index 61feb76e2dca..f79d74bf0322 100644 --- a/stand/efi/loader/arch/amd64/trap.c +++ b/stand/efi/loader/arch/amd64/trap.c @@ -87,7 +87,6 @@ report_exc(struct trapframe *tf) struct frame *fp; uintptr_t pc, base; char buf[80]; - int ret; base = (uintptr_t)boot_img->ImageBase; /* @@ -215,7 +214,7 @@ efi_setup_tss(struct region_descriptor *gdt, uint32_t loader_tss_idx, EFI_SIZE_TO_PAGES(sizeof(struct amd64tss)), &tss_pa); if (EFI_ERROR(status)) { printf("efi_setup_tss: AllocatePages tss error %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (0); } *tss = (struct amd64tss *)tss_pa; @@ -252,7 +251,7 @@ efi_redirect_exceptions(void) EFI_SIZE_TO_PAGES(fw_idt.rd_limit), &lidt_pa); if (EFI_ERROR(status)) { printf("efi_redirect_exceptions: AllocatePages IDT error %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); lidt_pa = 0; return (0); } @@ -260,7 +259,7 @@ efi_redirect_exceptions(void) &exc_stack_pa); if (EFI_ERROR(status)) { printf("efi_redirect_exceptions: AllocatePages stk error %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); exc_stack_pa = 0; free_tables(); return (0); @@ -304,7 +303,7 @@ efi_redirect_exceptions(void) &loader_gdt_pa); if (EFI_ERROR(status)) { printf("efi_setup_tss: AllocatePages gdt error " - "%lu\n", EFI_ERROR_CODE(status)); + "%lu\n", DECODE_ERROR(status)); loader_gdt_pa = 0; free_tables(); return (0); diff --git a/stand/efi/loader/arch/riscv/exec.c b/stand/efi/loader/arch/riscv/exec.c index a53fbd9442b0..8d1a0bd03de0 100644 --- a/stand/efi/loader/arch/riscv/exec.c +++ b/stand/efi/loader/arch/riscv/exec.c @@ -41,10 +41,14 @@ #include "bootstrap.h" #include "loader_efi.h" +#include <Uefi.h> +#include <Protocol/RiscVBootProtocol.h> + static void riscv_set_boot_hart(struct preloaded_file *fp) { - EFI_GUID riscvboot = RISCV_EFI_BOOT_PROTOCOL_GUID; + // No #define in EDK2 for this + EFI_GUID riscvboot = { 0xccd15fec, 0x6f73, 0x4eec, { 0x83, 0x95, 0x3e, 0x69, 0xe4, 0xb9, 0x40, 0xbf }}; RISCV_EFI_BOOT_PROTOCOL *proto; EFI_STATUS status = 0; uint64_t boot_hartid = ULONG_MAX; diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index b8f1a2ffd56c..67b36313c26f 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -67,9 +67,8 @@ static int bi_getboothowto(char *kargs) { -#ifdef EFI - const char *sw, *tmp; - char *opts; +#if defined(EFI) && (defined(__i386__) || defined(__amd64__)) + const char *tmp; int speed, port; char buf[50]; #endif @@ -252,7 +251,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) if (status != EFI_BUFFER_TOO_SMALL) { printf("%s: GetMemoryMap error %lu\n", __func__, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (EINVAL); } @@ -267,7 +266,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) pages, &addr); if (EFI_ERROR(status)) { printf("%s: AllocatePages error %lu\n", __func__, - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (ENOMEM); } @@ -290,7 +289,7 @@ bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) if (retry == 0) { BS->FreePages(addr, pages); - printf("ExitBootServices error %lu\n", EFI_ERROR_CODE(status)); + printf("ExitBootServices error %lu\n", DECODE_ERROR(status)); return (EINVAL); } diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index e4ad865a4acd..d14411d52f10 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -107,7 +107,7 @@ efi_verify_staging_size(unsigned long *nr_pages) if (status != EFI_BUFFER_TOO_SMALL) { printf("Can't read memory map: %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); goto out; } @@ -248,7 +248,7 @@ static int command_staging_slop(int argc, char *argv[]) { char *endp; - u_long new, prev; + u_long new; if (argc > 2) { goto err; @@ -334,7 +334,7 @@ efi_copy_init(void) nr_pages, &staging); if (EFI_ERROR(status)) { printf("failed to allocate staging area: %lu\n", - EFI_ERROR_CODE(status)); + DECODE_ERROR(status)); return (status); } staging_base = staging; @@ -405,7 +405,9 @@ efi_check_space(vm_offset_t end) return (true); } +#if defined(__amd64__) || defined(__i386__) before_staging: +#endif /* Try allocating space before the previous allocation */ if (staging < nr_pages * EFI_PAGE_SIZE) goto expand; diff --git a/stand/efi/loader/efi_main.c b/stand/efi/loader/efi_main.c index 2a5120dc89d7..6945c97c1d90 100644 --- a/stand/efi/loader/efi_main.c +++ b/stand/efi/loader/efi_main.c @@ -43,13 +43,15 @@ efi_exit(EFI_STATUS exit_code) } else { RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); } + __unreachable(); } void exit(int status) { - efi_exit(EFI_LOAD_ERROR); + efi_exit(errno_to_efi_status(status)); + __unreachable(); } static CHAR16 * diff --git a/stand/efi/loader/framebuffer.c b/stand/efi/loader/framebuffer.c index 141a29305f7c..08834aa7106b 100644 --- a/stand/efi/loader/framebuffer.c +++ b/stand/efi/loader/framebuffer.c @@ -32,15 +32,20 @@ #include <efi.h> #include <efilib.h> -#include <efiuga.h> #include <efipciio.h> #include <Protocol/EdidActive.h> #include <Protocol/EdidDiscovered.h> +#include <Protocol/GraphicsOutput.h> +#include <Protocol/UgaDraw.h> #include <machine/metadata.h> #include "bootstrap.h" #include "framebuffer.h" +/* XXX This may be obsolete -- edk2 doesn't define it anywhere */ +#define EFI_CONSOLE_OUT_DEVICE_GUID \ +{ 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + static EFI_GUID conout_guid = EFI_CONSOLE_OUT_DEVICE_GUID; EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; @@ -52,7 +57,7 @@ static EFI_HANDLE gop_handle; /* Cached EDID. */ struct vesa_edid_info *edid_info = NULL; -static EFI_GRAPHICS_OUTPUT *gop; +static EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; static EFI_UGA_DRAW_PROTOCOL *uga; static struct named_resolution { @@ -239,7 +244,7 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOCOL *uga, u_int line, printf("No change detected in frame buffer"); fail: - printf(" -- error %lu\n", EFI_ERROR_CODE(status)); + printf(" -- error %lu\n", DECODE_ERROR(status)); free(data1); return (-1); } @@ -595,7 +600,7 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) */ gop_handle = NULL; for (i = 0; i < nhandles; i++) { - EFI_GRAPHICS_OUTPUT *tgop; + EFI_GRAPHICS_OUTPUT_PROTOCOL *tgop; void *dummy; status = OpenProtocolByHandle(hlist[i], &gop_guid, (void **)&tgop); @@ -630,7 +635,7 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) gfx_state->tg_fb_type = FB_UGA; gfx_state->tg_private = uga; } else { - return (1); + return (efi_status_to_errno(status)); } } @@ -644,9 +649,12 @@ efi_find_framebuffer(teken_gfx_t *gfx_state) break; default: - return (1); + return (EINVAL); } + if (rv != 0) + return (rv); + gfx_state->tg_fb.fb_addr = efifb.fb_addr; gfx_state->tg_fb.fb_size = efifb.fb_size; gfx_state->tg_fb.fb_height = efifb.fb_height; @@ -778,7 +786,7 @@ gop_autoresize(void) if (EFI_ERROR(status)) { snprintf(command_errbuf, sizeof(command_errbuf), "gop_autoresize: Unable to set mode to %u (error=%lu)", - mode, EFI_ERROR_CODE(status)); + mode, DECODE_ERROR(status)); return (CMD_ERROR); } (void) cons_update_mode(true); @@ -881,7 +889,7 @@ command_gop(int argc, char *argv[]) if (EFI_ERROR(status)) { snprintf(command_errbuf, sizeof(command_errbuf), "%s: Unable to set mode to %u (error=%lu)", - argv[0], mode, EFI_ERROR_CODE(status)); + argv[0], mode, DECODE_ERROR(status)); return (CMD_ERROR); } (void) cons_update_mode(true); diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 436676368447..b731136fca4b 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -50,7 +50,14 @@ #include <efi.h> #include <efilib.h> #include <efichar.h> -#include <efirng.h> + +#include <Guid/DebugImageInfoTable.h> +#include <Guid/DxeServices.h> +#include <Guid/Mps.h> +#include <Guid/SmBios.h> +#include <Protocol/Rng.h> +#include <Protocol/SimpleNetwork.h> +#include <Protocol/SimpleTextIn.h> #include <uuid.h> @@ -69,6 +76,8 @@ #include "actypes.h" #include "actbl.h" +#include <acpi_detect.h> + #include "loader_efi.h" struct arch_switch archsw = { /* MI/MD interface boundary */ @@ -83,12 +92,25 @@ struct arch_switch archsw = { /* MI/MD interface boundary */ .arch_zfs_probe = efi_zfs_probe, }; -EFI_GUID acpi = ACPI_TABLE_GUID; -EFI_GUID acpi20 = ACPI_20_TABLE_GUID; +// XXX These are from ???? Maybe ACPI which needs to define them? +// XXX EDK2 doesn't (or didn't as of Feb 2025) +#define HOB_LIST_TABLE_GUID \ + { 0x7739f24c, 0x93d7, 0x11d4, {0x9a, 0x3a, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } +#define LZMA_DECOMPRESSION_GUID \ + { 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x3, 0xcf} } +#define ARM_MP_CORE_INFO_TABLE_GUID \ + { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65, 0x8e, 0xd8, 0x57, 0xe8, 0x34} } +#define ESRT_TABLE_GUID \ + { 0xb122a263, 0x3661, 0x4f68, {0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80} } +#define MEMORY_TYPE_INFORMATION_TABLE_GUID \ + { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} } +#define FDT_TABLE_GUID \ + { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } + EFI_GUID devid = DEVICE_PATH_PROTOCOL; EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; EFI_GUID mps = MPS_TABLE_GUID; -EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL; +EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID; EFI_GUID smbios = SMBIOS_TABLE_GUID; EFI_GUID smbios3 = SMBIOS3_TABLE_GUID; EFI_GUID dxe = DXE_SERVICES_TABLE_GUID; @@ -97,9 +119,10 @@ EFI_GUID lzmadecomp = LZMA_DECOMPRESSION_GUID; EFI_GUID mpcore = ARM_MP_CORE_INFO_TABLE_GUID; EFI_GUID esrt = ESRT_TABLE_GUID; EFI_GUID memtype = MEMORY_TYPE_INFORMATION_TABLE_GUID; -EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID; +EFI_GUID debugimg = EFI_DEBUG_IMAGE_INFO_TABLE_GUID; EFI_GUID fdtdtb = FDT_TABLE_GUID; -EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL; +EFI_GUID inputid = EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID; +EFI_GUID rng_guid = EFI_RNG_PROTOCOL_GUID; /* * Number of seconds to wait for a keystroke before exiting with failure @@ -120,11 +143,6 @@ UINT16 boot_current; */ EFI_LOADED_IMAGE *boot_img; -/* - * RSDP base table. - */ -ACPI_TABLE_RSDP *rsdp; - static bool has_keyboard(void) { @@ -315,9 +333,9 @@ probe_md_currdev(void) static bool try_as_currdev(pdinfo_t *hd, pdinfo_t *pp) { +#ifdef EFI_ZFS_BOOT uint64_t guid; -#ifdef EFI_ZFS_BOOT /* * If there's a zpool on this device, try it as a ZFS * filesystem, which has somewhat different setup than all @@ -505,8 +523,7 @@ match_boot_info(char *boot_info, size_t bisz) * a drop to the OK boot loader prompt is possible. */ static int -find_currdev(bool do_bootmgr, bool is_last, - char *boot_info, size_t boot_info_sz) +find_currdev(bool do_bootmgr, char *boot_info, size_t boot_info_sz) { pdinfo_t *dp, *pp; EFI_DEVICE_PATH *devpath, *copy; @@ -864,7 +881,7 @@ static int check_acpi_spcr(void) { ACPI_TABLE_SPCR *spcr; - int br, db, io, rs, rw, sb, xo, pv, pd; + int br, db, io, rs, rw, xo, pv, pd; uintmax_t mm; const char *dt, *pa; char *val = NULL; @@ -896,7 +913,6 @@ check_acpi_spcr(void) /* Uart settings */ pa = acpi_uart_parity(spcr->Parity); - sb = spcr->StopBits; db = 8; /* @@ -1121,6 +1137,8 @@ read_loader_env(const char *name, char *def_fn, bool once) printf(" Reading loader env vars from %s\n", fn); parse_loader_efi_config(boot_img->DeviceHandle, fn); } + + free(freeme); } caddr_t @@ -1130,39 +1148,6 @@ ptov(uintptr_t x) } static void -acpi_detect(void) -{ - char buf[24]; - int revision; - - feature_enable(FEATURE_EARLY_ACPI); - if ((rsdp = efi_get_table(&acpi20)) == NULL) - if ((rsdp = efi_get_table(&acpi)) == NULL) - return; - - sprintf(buf, "0x%016"PRIxPTR, (uintptr_t)rsdp); - setenv("acpi.rsdp", buf, 1); - revision = rsdp->Revision; - if (revision == 0) - revision = 1; - sprintf(buf, "%d", revision); - setenv("acpi.revision", buf, 1); - strncpy(buf, rsdp->OemId, sizeof(rsdp->OemId)); - buf[sizeof(rsdp->OemId)] = '\0'; - setenv("acpi.oem", buf, 1); - sprintf(buf, "0x%016x", rsdp->RsdtPhysicalAddress); - setenv("acpi.rsdt", buf, 1); - if (revision >= 2) { - /* XXX extended checksum? */ - sprintf(buf, "0x%016llx", - (unsigned long long)rsdp->XsdtPhysicalAddress); - setenv("acpi.xsdt", buf, 1); - sprintf(buf, "%d", rsdp->Length); - setenv("acpi.xsdt_length", buf, 1); - } -} - -static void efi_smbios_detect(void) { VOID *smbios_v2_ptr = NULL; @@ -1201,12 +1186,12 @@ EFI_STATUS main(int argc, CHAR16 *argv[]) { int howto, i, uhowto; - bool has_kbd, is_last; + bool has_kbd; char *s; EFI_DEVICE_PATH *imgpath; CHAR16 *text; EFI_STATUS rv; - size_t sz, bosz = 0, bisz = 0; + size_t sz, bisz = 0; UINT16 boot_order[100]; char boot_info[4096]; char buf[32]; @@ -1404,17 +1389,13 @@ main(int argc, CHAR16 *argv[]) printf(" %04x%s", boot_order[i], boot_order[i] == boot_current ? "[*]" : ""); printf("\n"); - is_last = boot_order[(sz / sizeof(boot_order[0])) - 1] == boot_current; - bosz = sz; } else if (uefi_boot_mgr) { /* * u-boot doesn't set BootOrder, but otherwise participates in the * boot manager protocol. So we fake it here and don't consider it * a failure. */ - bosz = sizeof(boot_order[0]); boot_order[0] = boot_current; - is_last = true; } } @@ -1463,7 +1444,7 @@ main(int argc, CHAR16 *argv[]) * the boot protocol and also allow an escape hatch for users wishing * to try something different. */ - if (find_currdev(uefi_boot_mgr, is_last, boot_info, bisz) != 0) + if (find_currdev(uefi_boot_mgr, boot_info, bisz) != 0) if (uefi_boot_mgr && !interactive_interrupt("Failed to find bootable partition")) return (EFI_NOT_FOUND); @@ -1858,6 +1839,8 @@ command_chain(int argc, char *argv[]) EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; EFI_HANDLE loaderhandle; EFI_LOADED_IMAGE *loaded_image; + UINTN ExitDataSize; + CHAR16 *ExitData = NULL; EFI_STATUS status; struct stat st; struct devdesc *dev; @@ -1973,9 +1956,16 @@ command_chain(int argc, char *argv[]) } dev_cleanup(); - status = BS->StartImage(loaderhandle, NULL, NULL); + + status = BS->StartImage(loaderhandle, &ExitDataSize, &ExitData); if (status != EFI_SUCCESS) { - command_errmsg = "StartImage failed"; + printf("StartImage failed (%lu)", DECODE_ERROR(status)); + if (ExitData != NULL) { + printf(": %S", ExitData); + BS->FreePool(ExitData); + } + putchar('\n'); + command_errmsg = ""; free(loaded_image->LoadOptions); loaded_image->LoadOptions = NULL; status = BS->UnloadImage(loaded_image); diff --git a/stand/fonts/INDEX.fonts b/stand/fonts/INDEX.fonts index 66a6d8a9a3f5..fc035c6b2e4e 100644 --- a/stand/fonts/INDEX.fonts +++ b/stand/fonts/INDEX.fonts @@ -60,9 +60,6 @@ FONT:en:8x16v.fnt 16x32.fnt:en:Terminus BSD Console, size 32 16x32.fnt:da:Terminus BSD-konsol, størrelse 32 16x32.fnt:de:Terminus BSD Console, Größe 32 -32x64.fnt:en:Spleen BSD Console, size 64 -32x64.fnt:da:Spleen BSD-konsol, størrelse 64 -32x64.fnt:de:Spleen BSD Console, Größe 64 # (fset 'langnew # "\M-}\C-p\C-k\C-y\C-m\C-y\M-}") diff --git a/stand/i386/boot2/Makefile b/stand/i386/boot2/Makefile index 313bb8030f3e..94dbd7af29d6 100644 --- a/stand/i386/boot2/Makefile +++ b/stand/i386/boot2/Makefile @@ -33,7 +33,8 @@ CFLAGS+=-fomit-frame-pointer \ CFLAGS.gcc+= -Os \ -fno-asynchronous-unwind-tables \ - --param max-inline-insns-single=100 + --param max-inline-insns-single=100 \ + --param min-pagesize=1024 CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} diff --git a/stand/i386/gptboot/Makefile b/stand/i386/gptboot/Makefile index a829be6c745d..366d82497819 100644 --- a/stand/i386/gptboot/Makefile +++ b/stand/i386/gptboot/Makefile @@ -34,7 +34,8 @@ CFLAGS+=-DBOOTPROG=\"gptboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Wno-pointer-sign -CFLAGS.gcc+= --param max-inline-insns-single=100 +CFLAGS.gcc+= --param max-inline-insns-single=100 \ + --param min-pagesize=1024 LD_FLAGS+=${LD_FLAGS_BIN} diff --git a/stand/i386/gptzfsboot/Makefile b/stand/i386/gptzfsboot/Makefile index 0b67ff8cdaf4..2b3b5422031b 100644 --- a/stand/i386/gptzfsboot/Makefile +++ b/stand/i386/gptzfsboot/Makefile @@ -27,7 +27,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${LDRSRC} \ -I${BOOTSRC}/i386/common \ -I${BOOTSRC}/i386/libi386 \ - -I${ZFSSRC} \ + -I${SAZFSSRC} \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/contrib/openzfs/include \ @@ -46,7 +46,8 @@ CFLAGS.clang+= -Wno-tentative-definition-incomplete-type NO_WCAST_ALIGN= -CFLAGS.gcc+= --param max-inline-insns-single=100 +CFLAGS.gcc+= --param max-inline-insns-single=100 \ + --param min-pagesize=1024 LD_FLAGS+=${LD_FLAGS_BIN} @@ -76,6 +77,6 @@ gptzfsboot.bin: gptzfsboot.out gptzfsboot.out: ${BTXCRT} ${OBJS} ${LD} ${LD_FLAGS} --defsym ORG=${ORG2} -T ${LDSCRIPT} -o ${.TARGET} ${.ALLSRC} ${LIBI386} ${LIBSA32} -zfsboot.o: ${ZFSSRC}/zfsimpl.c +zfsboot.o: ${SAZFSSRC}/zfsimpl.c .include <bsd.prog.mk> diff --git a/stand/i386/isoboot/Makefile b/stand/i386/isoboot/Makefile index 0049e7fd3e0a..bf22e0f21d59 100644 --- a/stand/i386/isoboot/Makefile +++ b/stand/i386/isoboot/Makefile @@ -29,7 +29,8 @@ CFLAGS+=-DBOOTPROG=\"isoboot\" \ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ -Wno-pointer-sign -CFLAGS.gcc+= --param max-inline-insns-single=100 +CFLAGS.gcc+= --param max-inline-insns-single=100 \ + --param min-pagesize=1024 CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} LD_FLAGS+=${LD_FLAGS_BIN} diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index 414803e9af3d..3938bd7822ea 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -956,26 +956,7 @@ cons_update_mode(bool use_gfx_mode) a = teken_get_defattr(&gfx_state.tg_teken); attr = *a; - /* - * On first run, we set up the vidc_set_colors() - * callback. If the env is already set, we - * pick up fg and bg color values from the environment. - */ - ptr = getenv("teken.fg_color"); - if (ptr != NULL) { - attr.ta_fgcolor = strtol(ptr, NULL, 10); - ptr = getenv("teken.bg_color"); - attr.ta_bgcolor = strtol(ptr, NULL, 10); - - teken_set_defattr(&gfx_state.tg_teken, &attr); - } else { - snprintf(env, sizeof(env), "%d", attr.ta_fgcolor); - env_setenv("teken.fg_color", EV_VOLATILE, env, - vidc_set_colors, env_nounset); - snprintf(env, sizeof(env), "%d", attr.ta_bgcolor); - env_setenv("teken.bg_color", EV_VOLATILE, env, - vidc_set_colors, env_nounset); - } + gfx_fb_setcolors(&attr, vidc_set_colors, env_nounset); /* Improve visibility */ if (attr.ta_bgcolor == TC_WHITE) diff --git a/stand/kboot/kboot/Makefile b/stand/kboot/kboot/Makefile index 19bae09df5ea..68bb67096851 100644 --- a/stand/kboot/kboot/Makefile +++ b/stand/kboot/kboot/Makefile @@ -32,7 +32,7 @@ SRCS+= kbootfdt.c .endif .if ${MK_LOADER_ZFS} != "no" -CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SAZFSSRC} CFLAGS+= -I${SYSDIR}/contrib/openzfs/include CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs HAVE_ZFS=yes diff --git a/stand/kboot/kboot/main.c b/stand/kboot/kboot/main.c index a8c725a514be..4a136b42a4a1 100644 --- a/stand/kboot/kboot/main.c +++ b/stand/kboot/kboot/main.c @@ -229,6 +229,7 @@ static struct mapping uintptr_t pa; caddr_t va; } map[MAX_MAP]; +static bool smbios_mmap_file; static int smbios_fd; static int nmap; @@ -238,12 +239,17 @@ caddr_t ptov(uintptr_t pa) uintptr_t pa2; struct mapping *m = map; - pa2 = rounddown(pa, PAGE); + if (smbios_mmap_file) + pa2 = rounddown(pa, PAGE); + else + pa2 = pa; for (int i = 0; i < nmap; i++, m++) { if (m->pa == pa2) { return (m->va + pa - m->pa); } } + if (!smbios_mmap_file) + panic("Out of bounds smbios access"); if (nmap == MAX_MAP) panic("Too many maps for smbios"); @@ -298,6 +304,7 @@ static void find_smbios(void) { char buf[40]; + void *dmi_data; uintptr_t pa; caddr_t va; @@ -306,17 +313,47 @@ find_smbios(void) if (pa == 0) return; + dmi_data = NULL; + smbios_fd = host_open("/sys/firmware/dmi/tables/DMI", O_RDONLY, 0); + if (smbios_fd >= 0) { + struct host_kstat sb; + struct mapping *m; + + if (host_fstat(smbios_fd, &sb) < 0) { + host_close(smbios_fd); + goto try_dev_mem; + } + + dmi_data = malloc(sb.st_size); + if (dmi_data == NULL) { + host_close(smbios_fd); + goto try_dev_mem; + } + + host_read(smbios_fd, dmi_data, sb.st_size); + + m = &map[nmap++]; + m->pa = pa; + m->va = dmi_data; + smbios_mmap_file = false; + } else { +try_dev_mem: + smbios_fd = host_open("/dev/mem", O_RDONLY, 0); + if (smbios_fd < 0) { + printf("Can't open /sys/firmware/dmi/tables/DMI or " + "/dev/mem to read smbios\n"); + return; + } + smbios_mmap_file = true; + } snprintf(buf, sizeof(buf), "%#jx", (uintmax_t)pa); setenv("hint.smbios.0.mem", buf, 1); - smbios_fd = host_open("/dev/mem", O_RDONLY, 0); - if (smbios_fd < 0) { - printf("Can't open /dev/mem to read smbios\n"); - return; - } + va = ptov(pa); printf("Start of smbios at pa %p va %p\n", (void *)pa, va); smbios_detect(va); smbios_cleanup(); + free(dmi_data); host_close(smbios_fd); } diff --git a/stand/liblua/Makefile b/stand/liblua/Makefile index ce7eb89fe494..b1c34ec0a466 100644 --- a/stand/liblua/Makefile +++ b/stand/liblua/Makefile @@ -24,7 +24,7 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c SRCS+= lerrno.c lpager.c lstd.c lutils.c SRCS+= gfx_utils.c -.PATH: ${FLUASRC}/modules +.PATH: ${FLUASRC}/lfs SRCS+= lfs.c .PATH: ${FLUALIB}/libhash SRCS+= lhash.c diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index f5a1acea843e..470c03032f61 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -189,9 +189,9 @@ SRCS+= g_eli_hmac.c pkcs5v2.c .PATH: ${SYSDIR}/crypto/sha2 SRCS+= sha256c.c sha512c.c -# md5 from the kernel -.PATH: ${SYSDIR}/kern +.PATH: ${SYSDIR}/crypto SRCS+= md5c.c +CFLAGS.md5c.c+= -DSTANDALONE_SMALL .if ${DO32:U0} == 0 MAN=libsa.3 diff --git a/stand/libsa/bzipfs.c b/stand/libsa/bzipfs.c index f4002796f0ae..ff7ec16e7dc6 100644 --- a/stand/libsa/bzipfs.c +++ b/stand/libsa/bzipfs.c @@ -68,6 +68,7 @@ static int bzf_stat(struct open_file *f, struct stat *sb); #ifndef REGRESSION struct fs_ops bzipfs_fsops = { .fs_name = "bzip", + .fs_flags = 0, .fo_open = bzf_open, .fo_close = bzf_close, .fo_read = bzf_read, diff --git a/stand/libsa/cd9660.c b/stand/libsa/cd9660.c index 973a7dddcda9..d1da39aa479a 100644 --- a/stand/libsa/cd9660.c +++ b/stand/libsa/cd9660.c @@ -81,6 +81,7 @@ static ISO_SUSP_HEADER *susp_lookup_record(struct open_file *f, struct fs_ops cd9660_fsops = { .fs_name = "cd9660", + .fs_flags = 0, .fo_open = cd9660_open, .fo_close = cd9660_close, .fo_read = cd9660_read, diff --git a/stand/libsa/dosfs.c b/stand/libsa/dosfs.c index aca198cdf6fa..38610d917007 100644 --- a/stand/libsa/dosfs.c +++ b/stand/libsa/dosfs.c @@ -61,6 +61,7 @@ static int dos_unmount(const char *dev, void *data); struct fs_ops dosfs_fsops = { .fs_name = "dosfs", + .fs_flags = 0, .fo_open = dos_open, .fo_close = dos_close, .fo_read = dos_read, diff --git a/stand/libsa/environment.c b/stand/libsa/environment.c index 95ee1718f8d4..d139249a8e84 100644 --- a/stand/libsa/environment.c +++ b/stand/libsa/environment.c @@ -66,6 +66,17 @@ env_setenv(const char *name, int flags, const void *value, if ((ev = env_getenv(name)) != NULL) { /* + * If the new value doesn't have NOKENV set, we'll drop the flag + * if it's set on the entry so that the override propagates + * correctly. We do this *before* sending it to the hook in + * case the hook declines to operate on it (e.g., because the + * value matches what was already set) -- we would still want + * the explicitly set value to propagate. + */ + if (!(flags & EV_NOKENV)) + ev->ev_flags &= ~EV_NOKENV; + + /* * If there's a set hook, let it do the work * (unless we are working for one already). */ @@ -77,7 +88,6 @@ env_setenv(const char *name, int flags, const void *value, free(ev->ev_value); ev->ev_value = NULL; ev->ev_flags &= ~EV_DYNAMIC; - } else { /* @@ -123,12 +133,13 @@ env_setenv(const char *name, int flags, const void *value, /* If we have a new value, use it */ if (flags & EV_VOLATILE) { ev->ev_value = strdup(value); - ev->ev_flags |= EV_DYNAMIC; + flags |= EV_DYNAMIC; } else { ev->ev_value = (char *)value; - ev->ev_flags |= flags & EV_DYNAMIC; } + ev->ev_flags |= flags & (EV_DYNAMIC | EV_NOKENV); + return (0); } diff --git a/stand/libsa/ext2fs.c b/stand/libsa/ext2fs.c index 47812f4543a1..f7096282f156 100644 --- a/stand/libsa/ext2fs.c +++ b/stand/libsa/ext2fs.c @@ -106,6 +106,7 @@ static int dtmap[] = { DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, struct fs_ops ext2fs_fsops = { .fs_name = "ext2fs", + .fs_flags = 0, .fo_open = ext2fs_open, .fo_close = ext2fs_close, .fo_read = ext2fs_read, diff --git a/stand/libsa/globals.c b/stand/libsa/globals.c index 2797045d4faf..6bd3a4243d73 100644 --- a/stand/libsa/globals.c +++ b/stand/libsa/globals.c @@ -17,6 +17,7 @@ u_char bcea[6] = BA; /* broadcast ethernet address */ char rootpath[FNAME_SIZE] = "/"; /* root mount path */ +int rootport; /* port for rootpath server */ char bootfile[FNAME_SIZE]; /* bootp says to boot this */ char hostname[FNAME_SIZE]; /* our hostname */ int hostnamelen; diff --git a/stand/libsa/gzipfs.c b/stand/libsa/gzipfs.c index 6c2b8cac9e34..6b22f750f3ef 100644 --- a/stand/libsa/gzipfs.c +++ b/stand/libsa/gzipfs.c @@ -50,6 +50,7 @@ static int zf_stat(struct open_file *f, struct stat *sb); struct fs_ops gzipfs_fsops = { .fs_name = "zip", + .fs_flags = 0, .fo_open = zf_open, .fo_close = zf_close, .fo_read = zf_read, diff --git a/stand/libsa/ip.c b/stand/libsa/ip.c index 6c7b0844b14d..e9e4f519681d 100644 --- a/stand/libsa/ip.c +++ b/stand/libsa/ip.c @@ -42,6 +42,7 @@ #include <sys/queue.h> #include <string.h> +#include <stdbool.h> #include <net/if.h> #include <netinet/in.h> @@ -89,17 +90,10 @@ sendip(struct iodesc *d, void *pkt, size_t len, uint8_t proto) struct ip *ip; u_char *ea; -#ifdef NET_DEBUG - if (debug) { - printf("sendip: proto: %x d=%p called.\n", proto, (void *)d); - if (d) { - printf("saddr: %s:%d", - inet_ntoa(d->myip), ntohs(d->myport)); - printf(" daddr: %s:%d\n", - inet_ntoa(d->destip), ntohs(d->destport)); - } - } -#endif + DEBUG_PRINTF(1, ("sendip: proto: %x d=%p called.\n", proto, (void *)d)); + DEBUG_PRINTF(1, ("saddr: %s:%d daddr: %s:%d\n", + inet_ntoa(d->myip), ntohs(d->myport), + inet_ntoa(d->destip), ntohs(d->destport))); ip = (struct ip *)pkt - 1; len += sizeof(*ip); @@ -143,139 +137,123 @@ ip_reasm_free(struct ip_reasm *ipr) free(ipr); } -static int +static bool ip_reasm_add(struct ip_reasm *ipr, void *pkt, struct ip *ip) { - struct ip_queue *ipq, *prev, *p; + struct ip_queue *ipq, *p; + uint16_t off_q, off_ip; - if ((ipq = calloc(1, sizeof (*ipq))) == NULL) - return (1); + if ((ipq = calloc(1, sizeof(*ipq))) == NULL) + return (false); ipq->ipq_pkt = pkt; ipq->ipq_hdr = ip; - prev = NULL; STAILQ_FOREACH(p, &ipr->ip_queue, ipq_next) { - if ((ntohs(p->ipq_hdr->ip_off) & IP_OFFMASK) < - (ntohs(ip->ip_off) & IP_OFFMASK)) { - prev = p; - continue; + off_q = ntohs(p->ipq_hdr->ip_off) & IP_OFFMASK; + off_ip = ntohs(ip->ip_off) & IP_OFFMASK; + + if (off_q == off_ip) { /* duplicate */ + free(pkt); + free(ipq); + return (true); } - if (prev == NULL) + + if (off_ip < off_q) { + /* + * Everything in queue has larger offset, + * drop out of loop and insert to HEAD. + */ break; + } + + /* + * p in queue is smaller than ip, check if we need to put + * ip after p or after p->next. + */ + struct ip_queue *next = STAILQ_NEXT(p, ipq_next); + if (next == NULL) { + /* insert after p */ + STAILQ_INSERT_AFTER(&ipr->ip_queue, p, ipq, ipq_next); + return (true); + } - STAILQ_INSERT_AFTER(&ipr->ip_queue, prev, ipq, ipq_next); - return (0); + off_q = ntohs(next->ipq_hdr->ip_off) & IP_OFFMASK; + if (off_ip < off_q) { + /* next fragment offset is larger, insert after p. */ + STAILQ_INSERT_AFTER(&ipr->ip_queue, p, ipq, ipq_next); + return (true); + } + /* next fragment offset is smaller, loop */ } STAILQ_INSERT_HEAD(&ipr->ip_queue, ipq, ipq_next); - return (0); + return (true); } /* * Receive a IP packet and validate it is for us. */ static ssize_t -readipv4(struct iodesc *d, void **pkt, void **payload, time_t tleft, - uint8_t proto) +readipv4(struct iodesc *d, void **pkt, void **payload, ssize_t n) { - ssize_t n; + struct ip *ip = *payload; size_t hlen; struct ether_header *eh; - void *buf; - struct ip *ip; struct udphdr *uh; - uint16_t etype; /* host order */ - char *ptr; + char *ptr = *pkt; struct ip_reasm *ipr; struct ip_queue *ipq, *last; + bool morefrag, isfrag; + uint16_t fragoffset; -#ifdef NET_DEBUG - if (debug) - printf("readip: called\n"); -#endif - - ip = NULL; - ptr = NULL; - n = readether(d, (void **)&ptr, (void **)&buf, tleft, &etype); - if (n == -1 || n < sizeof(*ip) + sizeof(*uh)) { - free(ptr); - return (-1); - } - - /* Ethernet address checks now in readether() */ - - /* Need to respond to ARP requests. */ - if (etype == ETHERTYPE_ARP) { - struct arphdr *ah = buf; - if (ah->ar_op == htons(ARPOP_REQUEST)) { - /* Send ARP reply */ - arp_reply(d, ah); - } + if (n < sizeof(*ip)) { free(ptr); errno = EAGAIN; /* Call me again. */ return (-1); } - if (etype != ETHERTYPE_IP) { -#ifdef NET_DEBUG - if (debug) - printf("readip: not IP. ether_type=%x\n", etype); -#endif - free(ptr); - return (-1); - } - - ip = buf; - /* Check ip header */ - if (ip->ip_v != IPVERSION || /* half char */ - ip->ip_p != proto) { -#ifdef NET_DEBUG - if (debug) { - printf("readip: IP version or proto. ip_v=%d ip_p=%d\n", - ip->ip_v, ip->ip_p); - } -#endif - free(ptr); - return (-1); - } - hlen = ip->ip_hl << 2; if (hlen < sizeof(*ip) || in_cksum(ip, hlen) != 0) { -#ifdef NET_DEBUG - if (debug) - printf("readip: short hdr or bad cksum.\n"); -#endif + DEBUG_PRINTF(1, ("%s: short hdr or bad cksum.\n", __func__)); free(ptr); + errno = EAGAIN; /* Call me again. */ return (-1); } + if (n < ntohs(ip->ip_len)) { -#ifdef NET_DEBUG - if (debug) - printf("readip: bad length %d < %d.\n", - (int)n, ntohs(ip->ip_len)); -#endif + DEBUG_PRINTF(1, ("readip: bad length %zd < %d.\n", + n, ntohs(ip->ip_len))); free(ptr); + errno = EAGAIN; /* Call me again. */ return (-1); } + + fragoffset = (ntohs(ip->ip_off) & IP_OFFMASK) * 8; + morefrag = (ntohs(ip->ip_off) & IP_MF) == 0 ? false : true; + isfrag = morefrag || fragoffset != 0; + + uh = (struct udphdr *)((uintptr_t)ip + sizeof(*ip)); + if (d->myip.s_addr && ip->ip_dst.s_addr != d->myip.s_addr) { -#ifdef NET_DEBUG - if (debug) { - printf("readip: bad saddr %s != ", inet_ntoa(d->myip)); - printf("%s\n", inet_ntoa(ip->ip_dst)); - } -#endif + DEBUG_PRINTF(1, ("%s: not for us: saddr %s (%d) != %s (%d)\n", + __func__, inet_ntoa(d->myip), ntohs(d->myport), + inet_ntoa(ip->ip_dst), ntohs(uh->uh_dport))); free(ptr); + errno = EAGAIN; /* Call me again. */ return (-1); } /* Unfragmented packet. */ - if ((ntohs(ip->ip_off) & IP_MF) == 0 && - (ntohs(ip->ip_off) & IP_OFFMASK) == 0) { - uh = (struct udphdr *)((uintptr_t)ip + sizeof (*ip)); + if (!isfrag) { + DEBUG_PRINTF(1, ("%s: unfragmented saddr %s:%d -> %s:%d\n", + __func__, + inet_ntoa(ip->ip_src), ntohs(uh->uh_sport), + inet_ntoa(ip->ip_dst), ntohs(uh->uh_dport))); /* If there were ip options, make them go away */ if (hlen != sizeof(*ip)) { - bcopy(((u_char *)ip) + hlen, uh, uh->uh_ulen - hlen); + bcopy(((u_char *)ip) + hlen, uh, + ntohs(uh->uh_ulen) - hlen); ip->ip_len = htons(sizeof(*ip)); n -= hlen - sizeof(*ip); } @@ -297,7 +275,7 @@ readipv4(struct iodesc *d, void **pkt, void **payload, time_t tleft, /* Allocate new reassembly entry */ if (ipr == NULL) { - if ((ipr = calloc(1, sizeof (*ipr))) == NULL) { + if ((ipr = calloc(1, sizeof(*ipr))) == NULL) { free(ptr); return (-1); } @@ -309,37 +287,22 @@ readipv4(struct iodesc *d, void **pkt, void **payload, time_t tleft, ipr->ip_ttl = MAXTTL; STAILQ_INIT(&ipr->ip_queue); STAILQ_INSERT_TAIL(&ire_list, ipr, ip_next); + DEBUG_PRINTF(1, ("%s: new reassembly ID=%d %s -> %s\n", + __func__, ntohs(ip->ip_id), inet_ntoa(ip->ip_src), + inet_ntoa(ip->ip_dst))); } - if (ip_reasm_add(ipr, ptr, ip) != 0) { + /* + * NOTE: with ip_reasm_add() ptr will be stored in reassembly + * queue and we can not free it without destroying the queue. + */ + if (!ip_reasm_add(ipr, ptr, ip)) { STAILQ_REMOVE(&ire_list, ipr, ip_reasm, ip_next); free(ipr); free(ptr); return (-1); } - if ((ntohs(ip->ip_off) & IP_MF) == 0) { - ipr->ip_total_size = (8 * (ntohs(ip->ip_off) & IP_OFFMASK)); - ipr->ip_total_size += n + sizeof (*ip); - ipr->ip_total_size += sizeof (struct ether_header); - - ipr->ip_pkt = malloc(ipr->ip_total_size + 2); - if (ipr->ip_pkt == NULL) { - STAILQ_REMOVE(&ire_list, ipr, ip_reasm, ip_next); - ip_reasm_free(ipr); - return (-1); - } - } - - /* - * If we do not have re-assembly buffer ipr->ip_pkt, we are still - * missing fragments, so just restart the read. - */ - if (ipr->ip_pkt == NULL) { - errno = EAGAIN; - return (-1); - } - /* * Walk the packet list in reassembly queue, if we got all the * fragments, build the packet. @@ -347,35 +310,59 @@ readipv4(struct iodesc *d, void **pkt, void **payload, time_t tleft, n = 0; last = NULL; STAILQ_FOREACH(ipq, &ipr->ip_queue, ipq_next) { - if ((ntohs(ipq->ipq_hdr->ip_off) & IP_OFFMASK) != n / 8) { - STAILQ_REMOVE(&ire_list, ipr, ip_reasm, ip_next); - ip_reasm_free(ipr); + fragoffset = (ntohs(ipq->ipq_hdr->ip_off) & IP_OFFMASK) * 8; + if (fragoffset != n) { + DEBUG_PRINTF(1, ("%s: need more fragments %d %s -> ", + __func__, ntohs(ipq->ipq_hdr->ip_id), + inet_ntoa(ipq->ipq_hdr->ip_src))); + DEBUG_PRINTF(1, ("%s offset=%d MF=%d\n", + inet_ntoa(ipq->ipq_hdr->ip_dst), + fragoffset, + (ntohs(ipq->ipq_hdr->ip_off) & IP_MF) != 0)); + errno = EAGAIN; return (-1); } n += ntohs(ipq->ipq_hdr->ip_len) - (ipq->ipq_hdr->ip_hl << 2); last = ipq; } + + /* complete queue has last packet with MF 0 */ if ((ntohs(last->ipq_hdr->ip_off) & IP_MF) != 0) { + DEBUG_PRINTF(1, ("%s: need more fragments %d %s -> ", + __func__, ntohs(last->ipq_hdr->ip_id), + inet_ntoa(last->ipq_hdr->ip_src))); + DEBUG_PRINTF(1, ("%s offset=%d MF=%d\n", + inet_ntoa(last->ipq_hdr->ip_dst), + (ntohs(last->ipq_hdr->ip_off) & IP_OFFMASK) * 8, + (ntohs(last->ipq_hdr->ip_off) & IP_MF) != 0)); errno = EAGAIN; return (-1); } + ipr->ip_total_size = n + sizeof(*ip) + sizeof(struct ether_header); + ipr->ip_pkt = malloc(ipr->ip_total_size + 2); + if (ipr->ip_pkt == NULL) { + STAILQ_REMOVE(&ire_list, ipr, ip_reasm, ip_next); + ip_reasm_free(ipr); + return (-1); + } + ipq = STAILQ_FIRST(&ipr->ip_queue); /* Fabricate ethernet header */ eh = (struct ether_header *)((uintptr_t)ipr->ip_pkt + 2); - bcopy((void *)((uintptr_t)ipq->ipq_pkt + 2), eh, sizeof (*eh)); + bcopy((void *)((uintptr_t)ipq->ipq_pkt + 2), eh, sizeof(*eh)); /* Fabricate IP header */ - ipr->ip_hdr = (struct ip *)((uintptr_t)eh + sizeof (*eh)); - bcopy(ipq->ipq_hdr, ipr->ip_hdr, sizeof (*ipr->ip_hdr)); - ipr->ip_hdr->ip_hl = sizeof (*ipr->ip_hdr) >> 2; + ipr->ip_hdr = (struct ip *)((uintptr_t)eh + sizeof(*eh)); + bcopy(ipq->ipq_hdr, ipr->ip_hdr, sizeof(*ipr->ip_hdr)); + ipr->ip_hdr->ip_hl = sizeof(*ipr->ip_hdr) >> 2; ipr->ip_hdr->ip_len = htons(n); ipr->ip_hdr->ip_sum = 0; - ipr->ip_hdr->ip_sum = in_cksum(ipr->ip_hdr, sizeof (*ipr->ip_hdr)); + ipr->ip_hdr->ip_sum = in_cksum(ipr->ip_hdr, sizeof(*ipr->ip_hdr)); n = 0; - ptr = (char *)((uintptr_t)ipr->ip_hdr + sizeof (*ipr->ip_hdr)); + ptr = (char *)((uintptr_t)ipr->ip_hdr + sizeof(*ipr->ip_hdr)); STAILQ_FOREACH(ipq, &ipr->ip_queue, ipq_next) { char *data; size_t len; @@ -397,6 +384,9 @@ readipv4(struct iodesc *d, void **pkt, void **payload, time_t tleft, STAILQ_REMOVE_HEAD(&ire_list, ip_next); ip_reasm_free(ipr); } + DEBUG_PRINTF(1, ("%s: completed fragments ID=%d %s -> %s\n", + __func__, ntohs(ip->ip_id), inet_ntoa(ip->ip_src), + inet_ntoa(ip->ip_dst))); return (n); } @@ -412,15 +402,63 @@ readip(struct iodesc *d, void **pkt, void **payload, time_t tleft, t = getsecs(); while ((getsecs() - t) < tleft) { + ssize_t n; + uint16_t etype; /* host order */ + void *ptr = NULL; + void *data = NULL; + errno = 0; - ret = readipv4(d, pkt, payload, tleft, proto); - if (ret >= 0) - return (ret); - /* Bubble up the error if it wasn't successful */ - if (errno != EAGAIN) - return (-1); + n = readether(d, &ptr, &data, tleft, &etype); + if (n == -1) { + free(ptr); + continue; + } + /* Ethernet address checks are done in readether() */ + + /* Need to respond to ARP requests. */ + if (etype == ETHERTYPE_ARP) { + struct arphdr *ah = data; + + DEBUG_PRINTF(1, ("%s: ARP request\n", __func__)); + + if (ah->ar_op == htons(ARPOP_REQUEST)) { + /* Send ARP reply */ + arp_reply(d, ah); + } + free(ptr); + continue; /* Get next packet */ + } + + if (etype == ETHERTYPE_IP) { + struct ip *ip = data; + + if (ip->ip_v == IPVERSION && /* half char */ + ip->ip_p == proto) { + errno = 0; + ret = readipv4(d, &ptr, &data, n); + if (ret >= 0) { + *pkt = ptr; + *payload = data; + return (ret); + } + + /* + * Bubble up the error if it wasn't successful + */ + if (errno != EAGAIN) + return (-1); + continue; + } + DEBUG_PRINTF(1, ("%s: IP version or proto. " + "ip_v=%d ip_p=%d\n", + __func__, ip->ip_v, ip->ip_p)); + free(ptr); + continue; + } + free(ptr); } /* We've exhausted tleft; timeout */ errno = ETIMEDOUT; + DEBUG_PRINTF(1, ("%s: timeout\n", __func__)); return (-1); } diff --git a/stand/libsa/libsa.3 b/stand/libsa/libsa.3 index 3e3f70610516..0947f97a0a1f 100644 --- a/stand/libsa/libsa.3 +++ b/stand/libsa/libsa.3 @@ -781,6 +781,10 @@ The same as but for .Xr bzip2 1 Ns -compressed files. +.It Va pkgfs_fsops +File access from a tar file typically streamed via TFTP. +The order of files in the tar file must match the order they are +to be consumed as rewind is not practical. .El .Pp The array of diff --git a/stand/libsa/mount.c b/stand/libsa/mount.c index 73bf6ab8118c..c866dc9c7055 100644 --- a/stand/libsa/mount.c +++ b/stand/libsa/mount.c @@ -107,7 +107,10 @@ mount(const char *dev, const char *path, int flags __unused, void *data) fs = file_system[i]; if (fs->fo_mount == NULL) continue; - + DEBUG_PRINTF(1,("%s: fs=%s path=%s\n", + __func__, fs->fs_name, path)); + if (is_tftp()) + break; if (fs->fo_mount(dev, path, &data) != 0) continue; diff --git a/stand/libsa/net.h b/stand/libsa/net.h index d4823d88f58b..945b6b9ea45f 100644 --- a/stand/libsa/net.h +++ b/stand/libsa/net.h @@ -75,6 +75,7 @@ enum net_proto { extern u_char bcea[6]; extern char rootpath[FNAME_SIZE]; +extern int rootport; extern char bootfile[FNAME_SIZE]; extern char hostname[FNAME_SIZE]; extern int hostnamelen; diff --git a/stand/libsa/nfs.c b/stand/libsa/nfs.c index ee6af8a726c7..f3e9060c9881 100644 --- a/stand/libsa/nfs.c +++ b/stand/libsa/nfs.c @@ -131,6 +131,7 @@ struct nfs_iodesc nfs_root_node; struct fs_ops nfs_fsops = { .fs_name = "nfs", + .fs_flags = 0, .fo_open = nfs_open, .fo_close = nfs_close, .fo_read = nfs_read, diff --git a/stand/libsa/open.c b/stand/libsa/open.c index ccee4aa5c07b..91848aca7dbe 100644 --- a/stand/libsa/open.c +++ b/stand/libsa/open.c @@ -138,6 +138,8 @@ open(const char *fname, int mode) struct fs_ops *fs; struct open_file *f; int fd, i, error, besterror; + bool is_dir; + size_t n; const char *file; TSENTER(); @@ -154,31 +156,42 @@ open(const char *fname, int mode) f->f_devdata = NULL; file = NULL; + if (exclusive_file_system == NULL || + (exclusive_file_system->fs_flags & FS_OPS_NO_DEVOPEN) == 0) { + error = devopen(f, fname, &file); + if (error || + (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) + goto err; + + /* see if we opened a raw device; otherwise, 'file' is the file name. */ + if (file == NULL || *file == '\0') { + f->f_flags |= F_RAW; + f->f_rabuf = NULL; + TSEXIT(); + return (fd); + } + } else + file = fname; + if (exclusive_file_system != NULL) { + /* loader is forcing the filesystem to be used */ fs = exclusive_file_system; - error = (fs->fo_open)(fname, f); + error = (fs->fo_open)(file, f); if (error == 0) goto ok; goto err; } - error = devopen(f, fname, &file); - if (error || - (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) - goto err; - - /* see if we opened a raw device; otherwise, 'file' is the file name. */ - if (file == NULL || *file == '\0') { - f->f_flags |= F_RAW; - f->f_rabuf = NULL; - TSEXIT(); - return (fd); - } - /* pass file name to the different filesystem open routines */ besterror = ENOENT; + n = strlen(file); + is_dir = (n > 0 && file[n - 1] == '/'); for (i = 0; file_system[i] != NULL; i++) { fs = file_system[i]; + if (is_dir && is_tftp()) { + error = EOPNOTSUPP; + goto err; + } error = (fs->fo_open)(file, f); if (error == 0) goto ok; diff --git a/stand/libsa/pkgfs.c b/stand/libsa/pkgfs.c index 32d488de5cfb..6eb3badf7068 100644 --- a/stand/libsa/pkgfs.c +++ b/stand/libsa/pkgfs.c @@ -41,6 +41,7 @@ static off_t pkg_atol(const char *, unsigned); struct fs_ops pkgfs_fsops = { .fs_name = "pkg", + .fs_flags = FS_OPS_NO_DEVOPEN, .fo_open = pkg_open, .fo_close = pkg_close, .fo_read = pkg_read, diff --git a/stand/libsa/smbios.c b/stand/libsa/smbios.c index 32cd198a9537..73b49a111f89 100644 --- a/stand/libsa/smbios.c +++ b/stand/libsa/smbios.c @@ -186,14 +186,17 @@ smbios_sigsearch(const caddr_t addr, const uint32_t len) */ SMBIOS_GET8(cp, 0x0a) != 0 && smbios_checksum(cp, SMBIOS_GET8(cp, 0x06)) == 0) { -#ifdef __ILP32__ +#if __SIZEOF_SIZE_T__ < 8 uint64_t end_addr; end_addr = SMBIOS_GET64(cp, 0x10) + /* Start address. */ SMBIOS_GET32(cp, 0x0c); /* Maximum size. */ - /* Is the table (or part of it) located above 4G? */ - if (end_addr >= (uint64_t)1 << 32) - /* Can't access it with 32-bit addressing. */ + /* + * Is the table (or part of it) located above what we + * can address? + */ + if ((size_t)end_addr != end_addr) + /* Yes, give it up. */ continue; #endif smbios.is_64bit_ep = 1; diff --git a/stand/libsa/splitfs.c b/stand/libsa/splitfs.c index 69912522000e..eb4b3a1feb11 100644 --- a/stand/libsa/splitfs.c +++ b/stand/libsa/splitfs.c @@ -50,6 +50,7 @@ static int splitfs_stat(struct open_file *f, struct stat *sb); struct fs_ops splitfs_fsops = { .fs_name = "split", + .fs_flags = 0, .fo_open = splitfs_open, .fo_close = splitfs_close, .fo_read = splitfs_read, diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 0e99d8778fa6..aaba0aa7fb39 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -94,6 +94,8 @@ __BEGIN_DECLS struct open_file; +#define FS_OPS_NO_DEVOPEN 1 + /* * This structure is used to define file system operations in a file system * independent way. @@ -104,6 +106,7 @@ struct open_file; */ struct fs_ops { const char *fs_name; + int fs_flags; int (*fo_open)(const char *path, struct open_file *f); int (*fo_close)(struct open_file *f); int (*fo_read)(struct open_file *f, void *buf, @@ -349,6 +352,7 @@ extern int pager_file(const char *fname); #define EV_DYNAMIC (1<<0) /* value was dynamically allocated, free if changed/unset */ #define EV_VOLATILE (1<<1) /* value is volatile, make a copy of it */ #define EV_NOHOOK (1<<2) /* don't call hook when setting */ +#define EV_NOKENV (1<<3) /* don't add to kenv (loader-only) */ struct env_var; typedef char *(ev_format_t)(struct env_var *ev); @@ -504,6 +508,9 @@ extern void *reallocf(void *, size_t); */ caddr_t ptov(uintptr_t); +/* dev_net.c */ +bool is_tftp(void); + /* features.c */ typedef void (feature_iter_fn)(void *, const char *, const char *, bool); diff --git a/stand/libsa/tftp.c b/stand/libsa/tftp.c index c6cc8f11a765..656c402683bb 100644 --- a/stand/libsa/tftp.c +++ b/stand/libsa/tftp.c @@ -50,6 +50,10 @@ #include <netinet/in_systm.h> #include <arpa/tftp.h> +#ifdef LOADER_VERIEXEC +#include <verify_file.h> +#endif + #include <string.h> #include "stand.h" @@ -73,6 +77,7 @@ static int tftp_preload(struct open_file *); struct fs_ops tftp_fsops = { .fs_name = "tftp", + .fs_flags = 0, .fo_open = tftp_open, .fo_close = tftp_close, .fo_read = tftp_read, @@ -84,7 +89,6 @@ struct fs_ops tftp_fsops = { }; static int tftpport = 2000; -static int is_open = 0; /* * The legacy TFTP_BLKSIZE value was SEGSIZE(512). @@ -98,10 +102,14 @@ static int is_open = 0; * Jumbo frames in the future. */ #define TFTP_MAX_BLKSIZE 9008 -#define TFTP_TRIES 2 +#define TFTP_TRIES 3 struct tftp_handle { struct iodesc *iodesc; + struct iodesc io; + int id; + ino_t ino; + int port; int currblock; /* contents of lastdata */ unsigned int islastblock:1; /* flag */ unsigned int tries:4; /* number of read attempts */ @@ -177,6 +185,9 @@ tftp_sendack(struct tftp_handle *h, u_short block) wbuf.t.th_block = htons(block); wtail += 2; + DEBUG_PRINTF(5,("%s: myport=%hu xid=%lu, block=%hu\n", + __func__, h->iodesc->myport, h->iodesc->xid, block)); + sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t); } @@ -190,6 +201,7 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, time_t tleft, void *ptr = NULL; ssize_t len; int tftp_error; + unsigned short block; errno = 0; extra = recv_extra; @@ -203,19 +215,22 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, time_t tleft, } extra->rtype = ntohs(t->th_opcode); - switch (ntohs(t->th_opcode)) { + block = ntohs(t->th_block); + DEBUG_PRINTF(6,("%s: myport=%hu xid=%lu, block=%hu, opcode=%hu\n", + __func__, d->myport, d->xid, block, extra->rtype)); + switch (extra->rtype) { case DATA: { int got; - if (htons(t->th_block) < (u_short)d->xid) { + if (block < (u_short)d->xid) { /* * Apparently our ACK was missed, re-send. */ - tftp_sendack(h, htons(t->th_block)); + tftp_sendack(h, block); free(ptr); return (-1); } - if (htons(t->th_block) != (u_short)d->xid) { + if (block != (u_short)d->xid) { /* * Packet from the future, drop this. */ @@ -241,9 +256,7 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, time_t tleft, printf("illegal tftp error %d\n", tftp_error); errno = EIO; } else { -#ifdef TFTP_DEBUG - printf("tftp-error %d\n", tftp_error); -#endif + DEBUG_PRINTF(0, ("tftp-error %d\n", tftp_error)); errno = tftperrors[tftp_error]; } free(ptr); @@ -284,9 +297,7 @@ recvtftp(struct iodesc *d, void **pkt, void **payload, time_t tleft, return (0); } default: -#ifdef TFTP_DEBUG - printf("tftp type %d not handled\n", ntohs(t->th_opcode)); -#endif + DEBUG_PRINTF(0, ("tftp type %hu not handled\n", extra->rtype)); free(ptr); return (-1); } @@ -343,7 +354,7 @@ tftp_makereq(struct tftp_handle *h) bcopy("0", wtail, 2); wtail += 2; - h->iodesc->myport = htons(tftpport + (getsecs() & 0x3ff)); + h->iodesc->myport = htons(h->port + (getsecs() & 0x3ff)); h->iodesc->destport = htons(IPPORT_TFTP); h->iodesc->xid = 1; /* expected block */ @@ -351,11 +362,15 @@ tftp_makereq(struct tftp_handle *h) h->islastblock = 0; h->validsize = 0; + DEBUG_PRINTF(5,("%s: %s: id=%d port=%d myport=%hu xid=1\n", + __func__, h->path, h->id, h->port, ntohs(h->iodesc->myport))); pkt = NULL; recv_extra.tftp_handle = h; res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *)&wbuf.t, &recvtftp, &pkt, (void **)&t, &recv_extra); if (res == -1) { + DEBUG_PRINTF(3,("%s: %s: id=%d errno=%d\n", + __func__, h->path, h->id, errno)); free(pkt); return (errno); } @@ -410,12 +425,18 @@ tftp_getnextblock(struct tftp_handle *h) h->iodesc->xid = h->currblock + 1; /* expected block */ + DEBUG_PRINTF(5,("%s: %s: id=%d port=%d myport=%hu xid=%lu\n", + __func__, h->path, h->id, h->port, + ntohs(h->iodesc->myport), h->iodesc->xid)); + pkt = NULL; recv_extra.tftp_handle = h; res = sendrecv(h->iodesc, &sendudp, &wbuf.t, wtail - (char *)&wbuf.t, &recvtftp, &pkt, (void **)&t, &recv_extra); if (res == -1) { /* 0 is OK! */ + DEBUG_PRINTF(3,("%s: %s: id=%d errno=%d\n", + __func__, h->path, h->id, errno)); free(pkt); return (errno); } @@ -428,21 +449,32 @@ tftp_getnextblock(struct tftp_handle *h) if (res < h->tftp_blksize) h->islastblock = 1; /* EOF */ - if (h->islastblock == 1) { + DEBUG_PRINTF(5,("%s: %s: id=%d res=%d blksz=%d last=%d\n", + __func__, h->path, h->id, res, h->tftp_blksize, h->islastblock)); + + if (h->islastblock) { /* Send an ACK for the last block */ - wbuf.t.th_block = htons((u_short)h->currblock); - sendudp(h->iodesc, &wbuf.t, wtail - (char *)&wbuf.t); + tftp_sendack(h, h->currblock); } return (0); } +/* + * If doing verification we need to handle multiple + * files at the same time. + */ +#define TOPEN_MAX 8 +static struct tftp_handle *handles[TOPEN_MAX]; + static int tftp_open(const char *path, struct open_file *f) { struct devdesc *dev; struct tftp_handle *tftpfile; struct iodesc *io; + static int lx = 0; + int i, x; int res; size_t pathsize; const char *extraslash; @@ -450,24 +482,39 @@ tftp_open(const char *path, struct open_file *f) if (netproto != NET_TFTP) return (EINVAL); - if (f->f_dev->dv_type != DEVT_NET) + if (f->f_dev == NULL || f->f_dev->dv_type != DEVT_NET) return (EINVAL); - if (is_open) + tftpfile = NULL; + for (x = lx + 1, i = 0; i < TOPEN_MAX; i++, x++) { + x %= TOPEN_MAX; + if (handles[x] == NULL) { + handles[x] = tftpfile = calloc(1, sizeof(*tftpfile)); + if (tftpfile == NULL) + return (ENOMEM); + /* id allows us to clear the slot on close */ + tftpfile->id = lx = x; + /* port ensures a different session with server */ + tftpfile->port = (tftpport + (x * tftpport)) & 0xffff; + DEBUG_PRINTF(1, ("%s(%s) id=%d port=%d\n", + __func__, path, tftpfile->id, tftpfile->port)); + break; + } + } + if (tftpfile == NULL) { + DEBUG_PRINTF(1, ("%s: EBUSY\n", __func__)); return (EBUSY); - - tftpfile = calloc(1, sizeof(*tftpfile)); - if (!tftpfile) - return (ENOMEM); - + } tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE; dev = f->f_devdata; - tftpfile->iodesc = io = socktodesc(*(int *)(dev->d_opendata)); + io = socktodesc(*(int *)(dev->d_opendata)); if (io == NULL) { free(tftpfile); return (EINVAL); } + memcpy(&tftpfile->io, io, sizeof(tftpfile->io)); + io = tftpfile->iodesc = &tftpfile->io; io->destip = rootip; tftpfile->off = 0; pathsize = (strlen(rootpath) + 1 + strlen(path) + 1) * sizeof(char); @@ -480,8 +527,11 @@ tftp_open(const char *path, struct open_file *f) extraslash = ""; else extraslash = "/"; - res = snprintf(tftpfile->path, pathsize, "%s%s%s", - rootpath, extraslash, path); + if (rootpath[0] == '/' && rootpath[1] == '\0' && path[0] == '/') + res = strlcpy(tftpfile->path, path, pathsize); + else + res = snprintf(tftpfile->path, pathsize, "%s%s%s", + rootpath, extraslash, path); if (res < 0 || res > pathsize) { free(tftpfile->path); free(tftpfile); @@ -491,13 +541,13 @@ tftp_open(const char *path, struct open_file *f) res = tftp_makereq(tftpfile); if (res) { + handles[tftpfile->id] = NULL; free(tftpfile->path); free(tftpfile->pkt); free(tftpfile); return (res); } f->f_fsdata = tftpfile; - is_open = 1; return (0); } @@ -547,9 +597,7 @@ tftp_read(struct open_file *f, void *addr, size_t size, rc = tftp_getnextblock(tftpfile); if (rc) { /* no answer */ -#ifdef TFTP_DEBUG - printf("tftp: read error\n"); -#endif + DEBUG_PRINTF(0, ("tftp: read error\n")); if (tftpfile->tries > TFTP_TRIES) { return (rc); } else { @@ -568,10 +616,8 @@ tftp_read(struct open_file *f, void *addr, size_t size, inbuffer = tftpfile->validsize - offinblock; if (inbuffer < 0) { -#ifdef TFTP_DEBUG - printf("tftp: invalid offset %d\n", - tftpfile->off); -#endif + DEBUG_PRINTF(0, ("tftp: invalid offset %d\n", + tftpfile->off)); return (EINVAL); } count = (size < inbuffer ? size : inbuffer); @@ -586,15 +632,15 @@ tftp_read(struct open_file *f, void *addr, size_t size, if ((tftpfile->islastblock) && (count == inbuffer)) break; /* EOF */ } else { -#ifdef TFTP_DEBUG - printf("tftp: block %d not found\n", needblock); -#endif + DEBUG_PRINTF(0, ("tftp: block %d not found\n", needblock)); return (EINVAL); } } out: + DEBUG_PRINTF(4, ("%s(%s) res=%ld\n", __func__, tftpfile->path, + (tftpfile->tftp_tsize - tftpfile->off))); if (resid != NULL) *resid = res; return (rc); @@ -610,15 +656,18 @@ tftp_close(struct open_file *f) tftp_senderr(tftpfile, 0, "No error: file closed"); if (tftpfile) { + DEBUG_PRINTF(1, ("%s(%d): %s\n", __func__, + tftpfile->id, tftpfile->path)); + handles[tftpfile->id] = NULL; free(tftpfile->path); free(tftpfile->pkt); free(tftpfile->tftp_cache); free(tftpfile); } - is_open = 0; return (0); } + static int tftp_stat(struct open_file *f, struct stat *sb) { @@ -630,6 +679,29 @@ tftp_stat(struct open_file *f, struct stat *sb) sb->st_uid = 0; sb->st_gid = 0; sb->st_size = tftpfile->tftp_tsize; + sb->st_mtime = 0; +#ifdef LOADER_VERIEXEC + /* libsecureboot needs st_dev and st_ino at minimum; + * we need to fake something that will be close enough to + * unique. + */ + sb->st_dev = (dev_t)tftpfile->iodesc->destip.s_addr; + /* we don't want to compute this more than once */ + if (tftpfile->ino == 0) { + union { + unsigned char digest[SHA_DIGEST_LENGTH]; + ino_t ino; + } u; + + hash_string(tftpfile->path, 0, u.digest, sizeof(u.digest)); + + tftpfile->ino = u.ino & 0x7fffffff; + DEBUG_PRINTF(2,("%s(%s) dev=%lu ino=%lu\n", __func__, + tftpfile->path, (unsigned long)sb->st_dev, + (unsigned long)tftpfile->ino)); + } + sb->st_ino = tftpfile->ino; +#endif return (0); } @@ -827,9 +899,7 @@ tftp_parse_oack(struct tftp_handle *h, char *buf, size_t len) return (-1); } -#ifdef TFTP_DEBUG - printf("tftp_blksize: %u\n", h->tftp_blksize); - printf("tftp_tsize: %lu\n", h->tftp_tsize); -#endif + DEBUG_PRINTF(2, ("tftp_blksize: %u\n", h->tftp_blksize)); + DEBUG_PRINTF(2, ("tftp_tsize: %lu\n", h->tftp_tsize)); return (0); } diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c index e1d540ed2321..868e8d47dbbd 100644 --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -93,6 +93,7 @@ static int ufs_unmount(const char *dev, void *data); struct fs_ops ufs_fsops = { .fs_name = "ufs", + .fs_flags = 0, .fo_open = ufs_open, .fo_close = ufs_close, .fo_read = ufs_read, @@ -890,6 +891,12 @@ ufs_readdir(struct open_file *f, struct dirent *d) if (error) return (error); dp = (struct direct *)buf; + /* + * Check for corrupt directory entry and bail out rather + * than spin forever hoping that the user has other options. + */ + if (dp->d_reclen == 0) + return (0); fp->f_seekp += dp->d_reclen; } while (dp->d_ino == (ino_t)0); diff --git a/stand/libsa/ufsread.c b/stand/libsa/ufsread.c index 0f9b9bb4e2fb..86ac8fbbbab7 100644 --- a/stand/libsa/ufsread.c +++ b/stand/libsa/ufsread.c @@ -108,6 +108,13 @@ fsfind(const char *name, ufs_ino_t * ino) *ino = d.d_ino; return d.d_type; } + /* + * Check for corrupt directory entry and bail out + * rather than spin forever hoping that the user + * has other options. + */ + if (d.d_reclen == 0) + return 0; s += d.d_reclen; } if (n != -1 && ls) diff --git a/stand/libsa/zfs/Makefile.inc b/stand/libsa/zfs/Makefile.inc index 2e9d5679f71f..c747078a115b 100644 --- a/stand/libsa/zfs/Makefile.inc +++ b/stand/libsa/zfs/Makefile.inc @@ -1,12 +1,12 @@ -.PATH: ${ZFSSRC} +.PATH: ${SAZFSSRC} .PATH: ${SYSDIR}/crypto/skein .PATH: ${ZFSOSSRC}/spl -.PATH: ${OZFS}/module/zstd -.PATH: ${OZFS}/module/zstd/lib/common -.PATH: ${OZFS}/module/zstd/lib/compress -.PATH: ${OZFS}/module/zstd/lib/decompress -.PATH: ${OZFS}/module/icp/asm-aarch64/blake3 -.PATH: ${OZFS}/module/icp/algs/blake3 +.PATH: ${ZFSTOP}/module/zstd +.PATH: ${ZFSTOP}/module/zstd/lib/common +.PATH: ${ZFSTOP}/module/zstd/lib/compress +.PATH: ${ZFSTOP}/module/zstd/lib/decompress +.PATH: ${ZFSTOP}/module/icp/asm-aarch64/blake3 +.PATH: ${ZFSTOP}/module/icp/algs/blake3 ZFS_SRC= zfs.c nvlist.c skein.c skein_block.c list.c ZFS_SRC+= zfs_zstd.c ZFS_SRC+= blake3.c blake3_generic.c blake3_impl.c @@ -30,7 +30,7 @@ SRCS+= ${ZFS_SRC} ${ZSTD_SRC} ${ZFS_SRC_AS} # tweak something defined in that file. # -ZFS_EARLY= -I${ZFSSRC}/spl \ +ZFS_EARLY= -I${SAZFSSRC}/spl \ -I${ZFSOSINC} \ -I${ZFSOSINC}/spl \ -I${ZFSOSINC}/zfs @@ -41,7 +41,7 @@ ZFS_EARLY= -I${ZFSSRC}/spl \ # from FreeBSD. # .for i in ${ZFS_SRC} ${ZSTD_SRC} -CFLAGS.$i+= -include ${ZFSOSINC}/spl/sys/ccompile.h -Wformat -Wall -I${OZFS}/include \ +CFLAGS.$i+= -include ${ZFSOSINC}/spl/sys/ccompile.h -Wformat -Wall -I${ZFSTOP}/include \ -DNEED_SOLARIS_BOOLEAN .endfor @@ -76,7 +76,7 @@ CFLAGS.$i+= -U__BMI__ ${NO_WBITWISE_INSTEAD_OF_LOGICAL} CFLAGS.zfs_zstd.c+= -DIN_BASE -DIN_LIBSA -CFLAGS.blake3_impl.c+= -I${OZFS}/module/icp/algs/blake3 -I${OZFS}/module/icp/include -DIN_LIBSA +CFLAGS.blake3_impl.c+= -I${ZFSTOP}/module/icp/algs/blake3 -I${ZFSTOP}/module/icp/include -DIN_LIBSA # Do not unroll skein loops, reduce code size CFLAGS.skein_block.c+= -DSKEIN_LOOP=111 diff --git a/stand/libsa/zfs/spl/sys/zfs_context.h b/stand/libsa/zfs/spl/sys/zfs_context.h index 48f164317611..9f12955dd05f 100644 --- a/stand/libsa/zfs/spl/sys/zfs_context.h +++ b/stand/libsa/zfs/spl/sys/zfs_context.h @@ -20,7 +20,7 @@ #include_next <sys/zfs_context.h> -#define ZFS_MODULE_PARAM_ARGS void +#define SYSCTL_HANDLER_ARGS void /* * Not sure why I need these, but including the canonical stand.h fails because diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index 971d71d098d3..e5920004bd9d 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -107,11 +107,6 @@ typedef struct indirect_vsd { } indirect_vsd_t; /* - * List of all vdevs, chained through v_alllink. - */ -static vdev_list_t zfs_vdevs; - -/* * List of supported read-incompatible ZFS features. Do not add here features * marked as ZFEATURE_FLAG_READONLY_COMPAT, they are irrelevant for read-only! */ @@ -133,6 +128,7 @@ static const char *features_for_read[] = { "org.open-zfs:large_blocks", "org.openzfs:blake3", "org.zfsonlinux:large_dnode", + "com.klarasystems:dynamic_gang_header", NULL }; @@ -146,6 +142,8 @@ static uint64_t dnode_cache_bn; static char *dnode_cache_buf; static int zio_read(const spa_t *spa, const blkptr_t *bp, void *buf); +static int zio_read_impl(const spa_t *spa, const blkptr_t *bp, void *buf, + bool print); static int zfs_get_root(const spa_t *spa, uint64_t *objid); static int zfs_rlookup(const spa_t *spa, uint64_t objnum, char *result); static int zap_lookup(const spa_t *spa, const dnode_phys_t *dnode, @@ -167,7 +165,6 @@ vdev_indirect_mapping_entry_phys_t * static void zfs_init(void) { - STAILQ_INIT(&zfs_vdevs); STAILQ_INIT(&zfs_pools); dnode_cache_buf = malloc(SPA_MAXBLOCKSIZE); @@ -536,7 +533,7 @@ vdev_indirect_mapping_duplicate_adjacent_entries(vdev_t *vd, uint64_t offset, } static vdev_t * -vdev_lookup_top(spa_t *spa, uint64_t vdev) +vdev_lookup_top(const spa_t *spa, uint64_t vdev) { vdev_t *rvd; vdev_list_t *vlist; @@ -839,16 +836,27 @@ vdev_replacing_read(vdev_t *vdev, const blkptr_t *bp, void *buf, return (kid->v_read(kid, bp, buf, offset, bytes)); } +/* + * List of vdevs that were fully initialized from their own label, but later a + * newer label was found that obsoleted the stale label, freeing its + * configuration tree. We keep those vdevs around, since a new configuration + * may include them. + */ +static vdev_list_t orphans = STAILQ_HEAD_INITIALIZER(orphans); + static vdev_t * -vdev_find(uint64_t guid) +vdev_find(vdev_list_t *list, uint64_t guid) { - vdev_t *vdev; + vdev_t *vdev, *safe; - STAILQ_FOREACH(vdev, &zfs_vdevs, v_alllink) + STAILQ_FOREACH_SAFE(vdev, list, v_childlink, safe) { if (vdev->v_guid == guid) return (vdev); + if ((vdev = vdev_find(&vdev->v_children, guid)) != NULL) + return (vdev); + } - return (0); + return (NULL); } static vdev_t * @@ -857,6 +865,11 @@ vdev_create(uint64_t guid, vdev_read_t *_read) vdev_t *vdev; vdev_indirect_config_t *vic; + if ((vdev = vdev_find(&orphans, guid))) { + STAILQ_REMOVE(&orphans, vdev, vdev, v_childlink); + return (vdev); + } + vdev = calloc(1, sizeof(vdev_t)); if (vdev != NULL) { STAILQ_INIT(&vdev->v_children); @@ -871,7 +884,6 @@ vdev_create(uint64_t guid, vdev_read_t *_read) if (_read != NULL) { vic = &vdev->vdev_indirect_config; vic->vic_prev_indirect_vdev = UINT64_MAX; - STAILQ_INSERT_TAIL(&zfs_vdevs, vdev, v_alllink); } } @@ -1035,22 +1047,19 @@ vdev_init(uint64_t guid, const nvlist_t *nvlist, vdev_t **vdevp) * STAILQ_INSERT_AFTER. */ static vdev_t * -vdev_find_previous(vdev_t *top_vdev, vdev_t *vdev) +vdev_find_previous(vdev_t *top_vdev, uint64_t id) { vdev_t *v, *previous; - if (STAILQ_EMPTY(&top_vdev->v_children)) - return (NULL); - previous = NULL; STAILQ_FOREACH(v, &top_vdev->v_children, v_childlink) { - if (v->v_id > vdev->v_id) + if (v->v_id > id) return (previous); - if (v->v_id == vdev->v_id) + if (v->v_id == id) return (v); - if (v->v_id < vdev->v_id) + if (v->v_id < id) previous = v; } return (previous); @@ -1072,7 +1081,7 @@ vdev_child_count(vdev_t *vdev) /* * Insert vdev into top_vdev children list. List is ordered by v_id. */ -static void +static vdev_t * vdev_insert(vdev_t *top_vdev, vdev_t *vdev) { vdev_t *previous; @@ -1085,7 +1094,7 @@ vdev_insert(vdev_t *top_vdev, vdev_t *vdev) * so we can use either STAILQ_INSERT_HEAD or STAILQ_INSERT_AFTER * as STAILQ does not have insert before. */ - previous = vdev_find_previous(top_vdev, vdev); + previous = vdev_find_previous(top_vdev, vdev->v_id); if (previous == NULL) { STAILQ_INSERT_HEAD(&top_vdev->v_children, vdev, v_childlink); @@ -1094,7 +1103,8 @@ vdev_insert(vdev_t *top_vdev, vdev_t *vdev) * This vdev was configured from label config, * do not insert duplicate. */ - return; + free(vdev); + return (previous); } else { STAILQ_INSERT_AFTER(&top_vdev->v_children, previous, vdev, v_childlink); @@ -1103,26 +1113,28 @@ vdev_insert(vdev_t *top_vdev, vdev_t *vdev) count = vdev_child_count(top_vdev); if (top_vdev->v_nchildren < count) top_vdev->v_nchildren = count; + return (vdev); } static int -vdev_from_nvlist(spa_t *spa, uint64_t top_guid, uint64_t txg, - const nvlist_t *nvlist) +vdev_from_nvlist(spa_t *spa, uint64_t top_guid, uint64_t label_guid, + uint64_t txg, const nvlist_t *nvlist) { vdev_t *top_vdev, *vdev; nvlist_t **kids = NULL; int rc, nkids; /* Get top vdev. */ - top_vdev = vdev_find(top_guid); + top_vdev = vdev_find(&spa->spa_root_vdev->v_children, top_guid); if (top_vdev == NULL) { rc = vdev_init(top_guid, nvlist, &top_vdev); if (rc != 0) return (rc); top_vdev->v_spa = spa; top_vdev->v_top = top_vdev; + top_vdev->v_label = label_guid; top_vdev->v_txg = txg; - vdev_insert(spa->spa_root_vdev, top_vdev); + (void )vdev_insert(spa->spa_root_vdev, top_vdev); } /* Add children if there are any. */ @@ -1143,7 +1155,7 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, uint64_t txg, vdev->v_spa = spa; vdev->v_top = top_vdev; - vdev_insert(top_vdev, vdev); + vdev = vdev_insert(top_vdev, vdev); } } else { /* @@ -1162,30 +1174,6 @@ done: return (rc); } -static int -vdev_init_from_label(spa_t *spa, const nvlist_t *nvlist) -{ - uint64_t pool_guid, top_guid, txg; - nvlist_t *vdevs; - int rc; - - if (nvlist_find(nvlist, ZPOOL_CONFIG_POOL_GUID, DATA_TYPE_UINT64, - NULL, &pool_guid, NULL) || - nvlist_find(nvlist, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64, - NULL, &top_guid, NULL) || - nvlist_find(nvlist, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64, - NULL, &txg, NULL) != 0 || - nvlist_find(nvlist, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, - NULL, &vdevs, NULL)) { - printf("ZFS: can't find vdev details\n"); - return (ENOENT); - } - - rc = vdev_from_nvlist(spa, top_guid, txg, vdevs); - nvlist_destroy(vdevs); - return (rc); -} - static void vdev_set_state(vdev_t *vdev) { @@ -1232,14 +1220,14 @@ vdev_set_state(vdev_t *vdev) } static int -vdev_update_from_nvlist(uint64_t top_guid, const nvlist_t *nvlist) +vdev_update_from_nvlist(vdev_t *root, uint64_t top_guid, const nvlist_t *nvlist) { vdev_t *vdev; nvlist_t **kids = NULL; int rc, nkids; /* Update top vdev. */ - vdev = vdev_find(top_guid); + vdev = vdev_find(&root->v_children, top_guid); if (vdev != NULL) vdev_set_initial_state(vdev, nvlist); @@ -1255,7 +1243,7 @@ vdev_update_from_nvlist(uint64_t top_guid, const nvlist_t *nvlist) if (rc != 0) break; - vdev = vdev_find(guid); + vdev = vdev_find(&root->v_children, guid); if (vdev != NULL) vdev_set_initial_state(vdev, kids[i]); } @@ -1271,10 +1259,6 @@ vdev_update_from_nvlist(uint64_t top_guid, const nvlist_t *nvlist) return (rc); } -/* - * Shall not be called on root vdev, that is not linked into zfs_vdevs. - * See comment in vdev_create(). - */ static void vdev_free(struct vdev *vdev) { @@ -1282,8 +1266,10 @@ vdev_free(struct vdev *vdev) STAILQ_FOREACH_SAFE(kid, &vdev->v_children, v_childlink, safe) vdev_free(kid); - STAILQ_REMOVE(&zfs_vdevs, vdev, vdev, v_alllink); - free(vdev); + if (vdev->v_phys_read != NULL) + STAILQ_INSERT_HEAD(&orphans, vdev, v_childlink); + else + free(vdev); } static int @@ -1329,15 +1315,16 @@ vdev_init_from_nvlist(spa_t *spa, const nvlist_t *nvlist) NULL, &guid, NULL); if (rc != 0) break; - vdev = vdev_find(guid); + vdev = vdev_find(&spa->spa_root_vdev->v_children, guid); /* * Top level vdev is missing, create it. * XXXGL: how can this happen? */ if (vdev == NULL) - rc = vdev_from_nvlist(spa, guid, 0, kids[i]); + rc = vdev_from_nvlist(spa, guid, 0, 0, kids[i]); else - rc = vdev_update_from_nvlist(guid, kids[i]); + rc = vdev_update_from_nvlist(spa->spa_root_vdev, guid, + kids[i]); if (rc != 0) break; } @@ -1355,6 +1342,53 @@ vdev_init_from_nvlist(spa_t *spa, const nvlist_t *nvlist) return (rc); } +static bool +nvlist_find_child_guid(const nvlist_t *nvlist, uint64_t guid) +{ + nvlist_t **kids = NULL; + int nkids, i; + bool rv = false; + + if (nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN, DATA_TYPE_NVLIST_ARRAY, + &nkids, &kids, NULL) != 0) + nkids = 0; + + for (i = 0; i < nkids; i++) { + uint64_t kid_guid; + + if (nvlist_find(kids[i], ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, + NULL, &kid_guid, NULL) != 0) + break; + if (kid_guid == guid) + rv = true; + else + rv = nvlist_find_child_guid(kids[i], guid); + if (rv) + break; + } + + for (i = 0; i < nkids; i++) + nvlist_destroy(kids[i]); + free(kids); + + return (rv); +} + +static bool +nvlist_find_vdev_guid(const nvlist_t *nvlist, uint64_t guid) +{ + nvlist_t *vdevs; + bool rv; + + if (nvlist_find(nvlist, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, NULL, + &vdevs, NULL) != 0) + return (false); + rv = nvlist_find_child_guid(vdevs, guid); + nvlist_destroy(vdevs); + + return (rv); +} + static spa_t * spa_find_by_guid(uint64_t guid) { @@ -2023,8 +2057,8 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, { vdev_t vtmp; spa_t *spa; - vdev_t *vdev; - nvlist_t *nvl; + vdev_t *vdev, *top; + nvlist_t *nvl, *vdevs; uint64_t val; uint64_t guid, pool_guid, top_guid, txg; const char *pool_name; @@ -2083,6 +2117,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, if (nvlist_find(nvl, ZPOOL_CONFIG_POOL_TXG, DATA_TYPE_UINT64, NULL, &txg, NULL) != 0 || + txg == 0 || nvlist_find(nvl, ZPOOL_CONFIG_TOP_GUID, DATA_TYPE_UINT64, NULL, &top_guid, NULL) != 0 || nvlist_find(nvl, ZPOOL_CONFIG_POOL_GUID, DATA_TYPE_UINT64, @@ -2092,7 +2127,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, nvlist_find(nvl, ZPOOL_CONFIG_GUID, DATA_TYPE_UINT64, NULL, &guid, NULL) != 0) { /* - * Cache and spare devices end up here - just ignore + * Cache, spare and replaced devices end up here - just ignore * them. */ nvlist_destroy(nvl); @@ -2119,22 +2154,47 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, nvlist_destroy(nvl); return (ENOMEM); } - } else { - struct vdev *kid; - - STAILQ_FOREACH(kid, &spa->spa_root_vdev->v_children, - v_childlink) - if (kid->v_guid == top_guid && kid->v_txg < txg) { - printf("ZFS: pool %s vdev %s ignoring stale " - "label from txg 0x%jx, using 0x%jx@0x%jx\n", - spa->spa_name, kid->v_name, - kid->v_txg, guid, txg); + } + + /* + * Check if configuration is already known. If configuration is known + * and txg numbers don't match, we got 2x2 scenarios here. First, is + * the label being read right now _newer_ than the one read before. + * Second, is the vdev that provided the stale label _present_ in the + * newer configuration. If neither is true, we completely ignore the + * label. + */ + STAILQ_FOREACH(top, &spa->spa_root_vdev->v_children, v_childlink) + if (top->v_guid == top_guid) { + bool newer, present; + + if (top->v_txg == txg) + break; + newer = (top->v_txg < txg); + present = newer ? + nvlist_find_vdev_guid(nvl, top->v_label) : + (vdev_find(&top->v_children, guid) != NULL); + printf("ZFS: pool %s vdev %s %s stale label from " + "0x%jx@0x%jx, %s 0x%jx@0x%jx\n", + spa->spa_name, top->v_name, + present ? "using" : "ignoring", + newer ? top->v_label : guid, + newer ? top->v_txg : txg, + present ? "referred by" : "using", + newer ? guid : top->v_label, + newer ? txg : top->v_txg); + if (newer) { STAILQ_REMOVE(&spa->spa_root_vdev->v_children, - kid, vdev, v_childlink); - vdev_free(kid); + top, vdev, v_childlink); + vdev_free(top); + break; + } else if (present) { break; + } else { + nvlist_destroy(nvl); + return (EIO); } - } + } /* * Get the vdev tree and create our in-core copy of it. @@ -2142,14 +2202,22 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, * be some kind of alias (overlapping slices, dangerously dedicated * disks etc). */ - vdev = vdev_find(guid); + vdev = vdev_find(&spa->spa_root_vdev->v_children, guid); /* Has this vdev already been inited? */ if (vdev && vdev->v_phys_read) { nvlist_destroy(nvl); return (EIO); } - rc = vdev_init_from_label(spa, nvl); + if (nvlist_find(nvl, ZPOOL_CONFIG_VDEV_TREE, DATA_TYPE_NVLIST, NULL, + &vdevs, NULL)) { + printf("ZFS: can't find vdev details\n"); + nvlist_destroy(nvl); + return (ENOENT); + } + + rc = vdev_from_nvlist(spa, top_guid, guid, txg, vdevs); + nvlist_destroy(vdevs); nvlist_destroy(nvl); if (rc != 0) return (rc); @@ -2158,7 +2226,7 @@ vdev_probe(vdev_phys_read_t *_read, vdev_phys_write_t *_write, void *priv, * We should already have created an incomplete vdev for this * vdev. Find it and initialise it with our read proc. */ - vdev = vdev_find(guid); + vdev = vdev_find(&spa->spa_root_vdev->v_children, guid); if (vdev != NULL) { vdev->v_phys_read = _read; vdev->v_phys_write = _write; @@ -2205,45 +2273,77 @@ ilog2(int n) return (-1); } +static inline uint64_t +gbh_nblkptrs(uint64_t size) +{ + ASSERT(IS_P2ALIGNED(size, sizeof(blkptr_t))); + return ((size - sizeof(zio_eck_t)) / sizeof(blkptr_t)); +} + static int zio_read_gang(const spa_t *spa, const blkptr_t *bp, void *buf) { blkptr_t gbh_bp; - zio_gbh_phys_t zio_gb; + void *gbuf; char *pbuf; - int i; + uint64_t gangblocksize; + int err, i; + + gangblocksize = UINT64_MAX; + for (int dva = 0; dva < BP_GET_NDVAS(bp); dva++) { + vdev_t *vd = vdev_lookup_top(spa, + DVA_GET_VDEV(&bp->blk_dva[dva])); + gangblocksize = MIN(gangblocksize, 1ULL << vd->v_ashift); + } /* Artificial BP for gang block header. */ gbh_bp = *bp; - BP_SET_PSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); - BP_SET_LSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); + BP_SET_PSIZE(&gbh_bp, gangblocksize); + BP_SET_LSIZE(&gbh_bp, gangblocksize); BP_SET_CHECKSUM(&gbh_bp, ZIO_CHECKSUM_GANG_HEADER); BP_SET_COMPRESS(&gbh_bp, ZIO_COMPRESS_OFF); for (i = 0; i < SPA_DVAS_PER_BP; i++) DVA_SET_GANG(&gbh_bp.blk_dva[i], 0); + gbuf = malloc(gangblocksize); + if (gbuf == NULL) + return (ENOMEM); /* Read gang header block using the artificial BP. */ - if (zio_read(spa, &gbh_bp, &zio_gb)) + err = zio_read_impl(spa, &gbh_bp, gbuf, false); + if ((err == EIO || err == ECKSUM) && + gangblocksize > SPA_OLD_GANGBLOCKSIZE) { + /* This might be a legacy gang block header, try again. */ + gangblocksize = SPA_OLD_GANGBLOCKSIZE; + BP_SET_PSIZE(&gbh_bp, gangblocksize); + BP_SET_LSIZE(&gbh_bp, gangblocksize); + err = zio_read(spa, &gbh_bp, gbuf); + } + if (err != 0) { + free(gbuf); return (EIO); + } pbuf = buf; - for (i = 0; i < SPA_GBH_NBLKPTRS; i++) { - blkptr_t *gbp = &zio_gb.zg_blkptr[i]; + for (i = 0; i < gbh_nblkptrs(gangblocksize); i++) { + blkptr_t *gbp = &((blkptr_t *)gbuf)[i]; if (BP_IS_HOLE(gbp)) continue; - if (zio_read(spa, gbp, pbuf)) + if (zio_read(spa, gbp, pbuf)) { + free(gbuf); return (EIO); + } pbuf += BP_GET_PSIZE(gbp); } + free(gbuf); if (zio_checksum_verify(spa, bp, buf)) return (EIO); return (0); } static int -zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) +zio_read_impl(const spa_t *spa, const blkptr_t *bp, void *buf, bool print) { int cpfunc = BP_GET_COMPRESS(bp); uint64_t align, size; @@ -2275,7 +2375,7 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) size, buf, BP_GET_LSIZE(bp)); free(pbuf); } - if (error != 0) + if (error != 0 && print) printf("ZFS: i/o error - unable to decompress " "block pointer data, error %d\n", error); return (error); @@ -2329,7 +2429,7 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) BP_GET_PSIZE(bp), buf, BP_GET_LSIZE(bp)); else if (size != BP_GET_PSIZE(bp)) bcopy(pbuf, buf, BP_GET_PSIZE(bp)); - } else { + } else if (print) { printf("zio_read error: %d\n", error); } if (buf != pbuf) @@ -2337,13 +2437,19 @@ zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) if (error == 0) break; } - if (error != 0) + if (error != 0 && print) printf("ZFS: i/o error - all block copies unavailable\n"); return (error); } static int +zio_read(const spa_t *spa, const blkptr_t *bp, void *buf) +{ + return (zio_read_impl(spa, bp, buf, true)); +} + +static int dnode_read(const spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_t buflen) { diff --git a/stand/loader.mk b/stand/loader.mk index 0f2ff31a5343..496252e7a534 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -89,7 +89,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} -CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules +CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/lfs .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" @@ -101,8 +101,6 @@ SRCS+= interp_simple.c .error Unknown interpreter ${LOADER_INTERP} .endif -.include "${BOOTSRC}/veriexec.mk" - .if defined(BOOT_PROMPT_123) CFLAGS+= -DBOOT_PROMPT_123 .endif @@ -154,7 +152,7 @@ CFLAGS+= -DLOADER_MBR_SUPPORT .if ${HAVE_ZFS:Uno} == "yes" CFLAGS+= -DLOADER_ZFS_SUPPORT -CFLAGS+= -I${ZFSSRC} +CFLAGS+= -I${SAZFSSRC} CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common SRCS+= zfs_cmd.c diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index 6832da0a31a5..dda8c3da4c89 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -30,18 +30,6 @@ local core = require("core") local cli = {} -if not pager then - -- shim for the pager module that just doesn't do it. - -- XXX Remove after 12.2 goes EoL. - pager = { - open = function() end, - close = function() end, - output = function(str) - printc(str) - end, - } -end - -- Internal function -- Parses arguments to boot and returns two values: kernel_name, argstr -- Defaults to nil and "" respectively. @@ -247,9 +235,17 @@ cli["disable-device"] = function(...) return end + if #argv > 1 then + print("Too many arguments") + print("usage error: disable-device device") + return + end + d, u = string.match(argv[1], "(%w*%a)(%d+)") - if d ~= nil then + if d ~= nil and u ~= nil then loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + else + print("Cannot parse " .. argv[1] .." into driver and unit number.") end end diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index aee1d3d53579..e47ecd3d23db 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -52,10 +52,11 @@ For instance: local cli = require("cli") cli.foo = function(...) - -- Expand args to command name and the rest of argv. These arguments - -- are pushed directly to the stack by loader, then handed off to - -- cli_execute. cli_execute then passes them on to the invoked - -- function, where they appear as varargs that must be peeled apart into + -- Expand args to command name and the rest of argv. + -- These arguments are pushed directly to the stack by + -- loader, then handed off to cli_execute. cli_execute + -- then passes them on to the invoked function, where + -- they appear as varargs that must be peeled apart into -- their respective components. local _, argv = cli.arguments(...) @@ -63,10 +64,11 @@ cli.foo = function(...) for k, v in ipairs(argv) do print("arg #" .. tostring(k) .. ": '" .. v .. "'") end - -- Perform a loader command directly. This will not get dispatched back - -- to Lua, so it is acceptable to have a function of the exact same name - -- in loader. Lua will have the first chance to handle any commands - -- executed at the loader prompt. + -- Perform a loader command directly. This will not get + -- dispatched back to Lua, so it is acceptable to have a + -- function of the exact same name in loader. Lua will + -- have the first chance to handle any commands executed + -- at the loader prompt. loader.perform("foo") end .Ed diff --git a/stand/lua/config.lua.8 b/stand/lua/config.lua.8 index 7e8863203446..f918ab7ffbeb 100644 --- a/stand/lua/config.lua.8 +++ b/stand/lua/config.lua.8 @@ -66,7 +66,7 @@ as a configuration file .Pc and then process files listed in the .Ev loader_conf_files -variable. Additionnaly, the top-level call to readConf will process files listed in the +variable. Additionally, the top-level call to readConf will process files listed in the .Ev loader_conf_dirs and .Ev local_loader_conf_files diff --git a/stand/lua/core.lua b/stand/lua/core.lua index f42be6fbebb7..ad417e5f97e5 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -413,7 +413,7 @@ end function core.isSingleUserBoot() local single_user = loader.getenv("boot_single") - return single_user ~= nil and single_user:lower() == "yes" + return single_user ~= nil and single_user:lower() ~= "no" end function core.isUEFIBoot() diff --git a/stand/lua/loader.lua.8 b/stand/lua/loader.lua.8 index ffee46526c9f..b750d42e2158 100644 --- a/stand/lua/loader.lua.8 +++ b/stand/lua/loader.lua.8 @@ -90,7 +90,7 @@ Obtains the value of the environment variable returns .Va true if -.Va commmand +.Va command is present in the interpreter as a builtin. Otherwise it returns .Va nil diff --git a/stand/man/boot1.efi.8 b/stand/man/boot1.efi.8 index b6135f8e0e12..2c882a595592 100644 --- a/stand/man/boot1.efi.8 +++ b/stand/man/boot1.efi.8 @@ -1,4 +1,6 @@ .\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 2020 Netflix, Inc .\" .\" Redistribution and use in source and binary forms, with or without diff --git a/stand/man/loader.8 b/stand/man/loader.8 index 4fc3bbb7cff0..484e0a7b300c 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1999 Daniel C. Sobral .\" All rights reserved. .\" Copyright (c) 2021 Warner Losh <imp@FreeBSD.org> @@ -23,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 29, 2021 +.Dd November 14, 2025 .Dt LOADER 8 .Os .Sh NAME @@ -86,6 +89,52 @@ The commands common to all interpreters are described in the .Xr loader_simp 8 .Dq BUILTIN COMMANDS section. +.Pp +The following commands are only available in +.Xr loader_lua 8 +and +.Xr loader_4th 8 : +.Pp +.Bl -tag -width indent -compact +.\" sort the following entries according to the second field +.It Ic boot-conf +Load the +.Nm +config and commence the autoboot sequence. +.Pp +.It Ic read-conf Ar file +Load the specified configuration file. +.Pp +.It Ic reload-conf +Revert any previously applied settings, and reload the configuration. +Set comands that were executed at the command line to override variables +previously +.Cm set +by +.Xr loader.conf 5 +configuration will also be reverted, +along with any module options that were toggled. +.Pp +.It Ic enable-module Ar kmod-name +.It Ic disable-module Ar kmod-name +.It Ic toggle-module Ar kmod-name +Enable, disable, or toggle loading of the kernel module named +.Dq Ar kmod-name . +.Pp +.It Ic show-module-options +Describe all modules the +.Nm +is aware of, and show if they are enabled or not. +.El +.Pp +The following command is only available in +.Xr loader_lua 8 : +.Pp +.Bl -tag -width indent -compact +.It Ic disable-device Ar device +Set a newbus hint to disable the +.Ar device . +.El .Ss BUILTIN ENVIRONMENT VARIABLES The environment variables common to all interpreters are described in the .Xr loader_simp 8 @@ -115,11 +164,11 @@ scripting language changed to Lua by default in The .Nm was written by -.An Michael Smith Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Pp FICL was written by -.An John Sadler Aq john_sadler@alum.mit.edu . +.An John Sadler Aq Mt john_sadler@alum.mit.edu . .Pp -.An Warner Losh Aq imp@FreeBSD.org +.An Warner Losh Aq Mt imp@FreeBSD.org integrated Lua into the tree based on initial work done by Pedro Souza for the 2014 Google Summer of Code. diff --git a/stand/man/loader.efi.8 b/stand/man/loader.efi.8 index c488ac257804..d9a5c827ba71 100644 --- a/stand/man/loader.efi.8 +++ b/stand/man/loader.efi.8 @@ -158,6 +158,7 @@ The serial ports are assigned as follows on IBM PC compatible systems: .It COM3 Ta 0x3e8 Ta Pa /dev/uart2 .It COM4 Ta 0x2e8 Ta Pa /dev/uart3 .El +.Pp Though .Dv COM3 and @@ -191,8 +192,9 @@ of any behavior not covered in this document. .It Fl s Ta Dv boot_single Ta Va RB_SINGLE .It Fl v Ta Dv boot_verbose Ta Va RB_VERBOSE .El +.Pp And the following flags determine the primary console: -.Bl -column -offset indent ".Sy Flags" ".Sy Kernel Flags" ".Sy Kernel Consoles" ".Sy Primary Console" +.Bl -column -offset xxx "Flags" "RB_SERIAL | RB_MULTIPLE" "Kernel Consoles" "Primary Console" .It Sy Flags Ta Sy Kernel Flags Ta Sy Kernel Consoles Ta Sy Primary Console .It none Ta 0 Ta Video Ta Video .It Fl h Ta RB_SERIAL Ta Serial Ta Serial @@ -380,6 +382,7 @@ To check: # mount | grep nda0p1 /dev/nda0p1 on /boot/efi (msdosfs, local) .Ed +.Pp If it's not mounted, you will need to mount it: .Bd -literal -offset indent # mount -t msdosfs /dev/nda0p1 /boot/efi @@ -398,6 +401,7 @@ BootOrder : 0000, 0001, 0003, 0004, 0005, 0006, 0001, 0008, 000A, 000B, 000C, 0 nda0p1:/EFI/FREEBSD/LOADER.EFI /boot/efi//EFI/FREEBSD/LOADER.EFI \&... .Ed +.Pp Often there are several options, depending on the BIOS. The entry that we booted with is marked with a .Sq + @@ -416,6 +420,7 @@ loader, which varies by architecture. .It i386 Ta Pa /EFI/BOOT/BOOTIA32.EFI .It riscv Ta Pa /EFI/BOOT/BOOTRISCV64.EFI .El +.Pp However, care must be taken: some multiple-boot environments rely on a special .Pa bootXXX.efi to function. @@ -436,10 +441,12 @@ above table): .Bd -literal -offset indent # cmp /boot/efi/EFI/FREEBSD/LOADER.EFI /boot/efi/EFI/BOOT/BOOTX64.EFI .Ed +.Pp Copy the loader: .Bd -literal -offset indent # cp /boot/loader.efi /boot/efi/EFI/FREEBSD/LOADER.EFI .Ed +.Pp replacing the all caps part of the example with the proper path. .Pp If ESP path was diff --git a/stand/man/loader_4th.8 b/stand/man/loader_4th.8 index 9e87326f893b..21e907bd8630 100644 --- a/stand/man/loader_4th.8 +++ b/stand/man/loader_4th.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1999 Daniel C. Sobral .\" All rights reserved. .\" @@ -576,8 +579,8 @@ first appeared in The .Nm was written by -.An Michael Smith Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . .Pp .Tn FICL was written by -.An John Sadler Aq john_sadler@alum.mit.edu . +.An John Sadler Aq Mt john_sadler@alum.mit.edu . diff --git a/stand/man/loader_lua.8 b/stand/man/loader_lua.8 index 0aa467237266..c60de9417abc 100644 --- a/stand/man/loader_lua.8 +++ b/stand/man/loader_lua.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1999 Daniel C. Sobral .\" All rights reserved. .\" diff --git a/stand/man/loader_simp.8 b/stand/man/loader_simp.8 index cdacd823b1a5..52cb598fdd89 100644 --- a/stand/man/loader_simp.8 +++ b/stand/man/loader_simp.8 @@ -1,3 +1,6 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" .\" Copyright (c) 1999 Daniel C. Sobral .\" All rights reserved. .\" @@ -355,8 +358,8 @@ in .Xr kenv 1 , not for any particular value. .It Va boot_serial -Force the use of a serial console even when an internal console -is present. +Force the use of a serial console for the kernel +even when an internal console is present. .It Va boot_single Prevents the kernel from initiating a multi-user startup; instead, a single-user mode will be entered when the kernel has finished @@ -755,4 +758,4 @@ first appeared in The .Nm was written by -.An Michael Smith Aq msmith@FreeBSD.org . +.An Michael Smith Aq Mt msmith@FreeBSD.org . diff --git a/stand/userboot/Makefile.inc b/stand/userboot/Makefile.inc index 01b5f23410c8..392fd59a115f 100644 --- a/stand/userboot/Makefile.inc +++ b/stand/userboot/Makefile.inc @@ -1 +1,5 @@ .include "../Makefile.inc" + +# userboot.so should be installed in the base bootloader package, +# not bootloader-dev. +NO_DEV_PACKAGE= |
