From 8ca2d97eb80b825025a142a56615f212200ffa74 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 17 Dec 2017 14:41:22 +0100 Subject: [PATCH] boot/efi: Port most of our efi boot code to the EDK II headers. --- sys/boot/efi/boot1/Makefile | 5 +- sys/boot/efi/boot1/boot1.c | 48 ++++---- sys/boot/efi/boot1/ufs_module.c | 8 +- sys/boot/efi/include/efi.h | 113 +++++++++--------- sys/boot/efi/libefi/Makefile | 2 +- sys/boot/efi/libefi/efinet.c | 16 +-- sys/boot/efi/libefi/efipart.c | 1 - sys/boot/efi/loader/Makefile | 1 - sys/boot/efi/loader/arch/x86_64/Makefile.inc | 1 + .../efi/loader/arch/x86_64/elf64_freebsd.c | 3 +- sys/boot/efi/loader/arch/x86_64/framebuffer.c | 14 +-- sys/boot/efi/loader/bootinfo.c | 10 +- sys/boot/efi/loader/copy.c | 8 +- sys/boot/efi/loader/main.c | 16 +-- 14 files changed, 127 insertions(+), 119 deletions(-) diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index a83cc3ec63..ecf38e0a4a 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -14,12 +14,15 @@ SRCS= boot1.c self_reloc.c start.S ufs_module.c CFLAGS+= -I. CFLAGS+= -I${.CURDIR}/../include -CFLAGS+= -I${.CURDIR}/../include/${MACHINE} CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/source/include CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -DEFI_UFS_BOOT +.if ${MACHINE_ARCH} == "x86_64" +CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include/X64 +.endif + # Disable stack protector CFLAGS+= -fno-stack-protector diff --git a/sys/boot/efi/boot1/boot1.c b/sys/boot/efi/boot1/boot1.c index 8f7751dd57..f078d3b40b 100644 --- a/sys/boot/efi/boot1/boot1.c +++ b/sys/boot/efi/boot1/boot1.c @@ -419,15 +419,15 @@ try_boot(void) if ((status = bs->LoadImage(TRUE, image, devpath_last(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)); + printf("Failed to load image provided by %s, size: %zu, (%llu)\n", + mod->name, loadersize, status); goto errout; } if ((status = bs->HandleProtocol(loaderhandle, &LoadedImageGUID, (VOID**)&loaded_image)) != EFI_SUCCESS) { - printf("Failed to query LoadedImage provided by %s (%lu)\n", - mod->name, EFI_ERROR_CODE(status)); + printf("Failed to query LoadedImage provided by %s (%llu)\n", + mod->name, status); goto errout; } @@ -452,8 +452,8 @@ try_boot(void) 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)); + printf("Failed to start image provided by %s (%llu)\n", + mod->name, status); loaded_image->LoadOptionsSize = 0; loaded_image->LoadOptions = NULL; } @@ -489,8 +489,8 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) return (status); if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); + DPRINTF("\nFailed to query DevicePath (%llu)\n", + status); return (status); } @@ -501,8 +501,8 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) return (status); if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", - EFI_ERROR_CODE(status)); + DPRINTF("\nFailed to query BlockIoProtocol (%llu)\n", + status); return (status); } @@ -519,8 +519,8 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) if ((status = bs->AllocatePool(EfiLoaderData, sizeof(*devinfo), (void **)&devinfo)) != EFI_SUCCESS) { - DPRINTF("\nFailed to allocate devinfo (%lu)\n", - EFI_ERROR_CODE(status)); + DPRINTF("\nFailed to allocate devinfo (%llu)\n", + status); continue; } devinfo->dev = blkio; @@ -569,7 +569,7 @@ probe_handle_status(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) break; default: printf("x"); - DPRINTF(" error (%lu)\n", EFI_ERROR_CODE(status)); + DPRINTF(" error (%llu)\n", status); break; } DSTALL(500000); @@ -639,8 +639,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); if ((status = bs->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) - panic("Failed to allocate %d handles (%lu)", NUM_HANDLES_INIT, - EFI_ERROR_CODE(status)); + panic("Failed to allocate %d handles (%llu)", NUM_HANDLES_INIT, + status); status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); @@ -651,23 +651,23 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) (void)bs->FreePool(handles); if ((status = bs->AllocatePool(EfiLoaderData, hsize, (void **)&handles)) != EFI_SUCCESS) { - panic("Failed to allocate %zu handles (%lu)", hsize / - sizeof(*handles), EFI_ERROR_CODE(status)); + panic("Failed to allocate %llu handles (%llu)", hsize / + sizeof(*handles), status); } status = bs->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, &hsize, handles); if (status != EFI_SUCCESS) - panic("Failed to get device handles (%lu)\n", - EFI_ERROR_CODE(status)); + panic("Failed to get device handles (%llu)\n", + status); break; default: - panic("Failed to get device handles (%lu)", - EFI_ERROR_CODE(status)); + panic("Failed to get device handles (%llu)", + status); } /* Scan all partitions, probing with all modules. */ nhandles = hsize / sizeof(*handles); - printf(" Probing %zu block devices...", nhandles); + printf(" Probing %llu block devices...", nhandles); DPRINTF("\n"); /* Determine the devpath of our image so we can prefer it. */ @@ -677,8 +677,8 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) status = bs->HandleProtocol(img->DeviceHandle, &DevicePathGUID, (void **)&imgpath); if (status != EFI_SUCCESS) - DPRINTF("Failed to get image DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); + DPRINTF("Failed to get image DevicePath (%llu)\n", + status); DPRINTF("boot1 imagepath: %s\n", devpath_str(imgpath)); } diff --git a/sys/boot/efi/boot1/ufs_module.c b/sys/boot/efi/boot1/ufs_module.c index bd3ee3d57e..97dfeaa5fd 100644 --- a/sys/boot/efi/boot1/ufs_module.c +++ b/sys/boot/efi/boot1/ufs_module.c @@ -61,9 +61,9 @@ dskread(void *buf, u_int64_t lba, int nblk) if (status != EFI_SUCCESS) { DPRINTF("dskread: failed dev: %p, id: %u, lba: %lu, size: %d, " - "status: %lu\n", devinfo->dev, + "status: %llu\n", devinfo->dev, devinfo->dev->Media->MediaId, lba, size, - EFI_ERROR_CODE(status)); + status); return (-1); } @@ -148,8 +148,8 @@ load(const char *filepath, dev_info_t *dev, void **bufp, size_t *bufsize) if ((status = bs->AllocatePool(EfiLoaderData, size, &buf)) != EFI_SUCCESS) { - printf("Failed to allocate read buffer %zu for '%s' (%lu)\n", - size, filepath, EFI_ERROR_CODE(status)); + printf("Failed to allocate read buffer %zu for '%s' (%llu)\n", + size, filepath, status); return (status); } diff --git a/sys/boot/efi/include/efi.h b/sys/boot/efi/include/efi.h index 411394d6d6..cddba663fc 100644 --- a/sys/boot/efi/include/efi.h +++ b/sys/boot/efi/include/efi.h @@ -1,69 +1,74 @@ -/* $FreeBSD: head/sys/boot/efi/include/efi.h 292625 2015-12-22 20:40:34Z emaste $ */ -/*++ - -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: - - efi.h - -Abstract: - - Public EFI header files - - - -Revision History - ---*/ - -// -// Build flags on input -// EFI32 -// EFI_DEBUG - Enable debugging code -// EFI_NT_EMULATOR - Building for running under NT -// - +/* + * 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. + */ #ifndef _EFI_INCLUDE_ #define _EFI_INCLUDE_ -#define EFI_FIRMWARE_VENDOR L"INTEL" -#define EFI_FIRMWARE_MAJOR_REVISION 14 -#define EFI_FIRMWARE_MINOR_REVISION 62 -#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION)) - -#define PACKED -#define GUID EFI_GUID +#ifdef __x86_64__ +#define EFIAPI __attribute__((ms_abi)) +#endif -#include "efibind.h" -#include "efidef.h" -#include "efidevp.h" -#include "efipxebc.h" +/* + * The following macros are defined unconditionally in the EDK II headers, + * so get our definitions out of the way. + */ +#undef NULL +#undef MIN +#undef MAX + +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include #include -#include "efiapi.h" -#include "efiprot.h" -#include "efifs.h" -#include "efierr.h" -#define EFI_STRINGIZE(a) #a -#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h) +/* + * The following macros haven been preserved from the old EFI headers for now. + */ +#define EFI_DP_TYPE_MASK 0x7f + +#define END_DEVICE_PATH_TYPE 0x7f + +#define DevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK) +#define DevicePathSubType(a) ((a)->SubType) +#define DevicePathNodeLength(a) (((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 SetDevicePathEndNode(a) do { \ + (a)->Type = END_DEVICE_PATH_TYPE; \ + (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ + (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ + (a)->Length[1] = 0; \ +} while (0) + +#define NextMemoryDescriptor(Ptr,Size) ((EFI_MEMORY_DESCRIPTOR *)(((UINT8 *)Ptr) + Size)) + +#define FDT_TABLE_GUID \ + { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } -#define EFI_GUID_DEFINITION(a) EFI_STRINGIZE(Guid/a/a##.h) -#define EFI_GUID_STRING(guidpointer, shortstring, longstring) +#define MEMORY_TYPE_INFORMATION_TABLE_GUID \ + { 0x4c19049f, 0x4137, 0x4dd3, {0x9c, 0x10, 0x8b, 0x97, 0xa8, 0x3f, 0xfd, 0xfa} } #endif diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index 262c754d4b..04c57b1da3 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -9,9 +9,9 @@ SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \ .if ${MACHINE_ARCH} == "x86_64" CFLAGS+= -fPIC -mno-red-zone +CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include/X64 .endif CFLAGS+= -I${.CURDIR}/../include -CFLAGS+= -I${.CURDIR}/../include/${MACHINE} CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include CFLAGS+= -I${.CURDIR}/../../../../lib/libstand diff --git a/sys/boot/efi/libefi/efinet.c b/sys/boot/efi/libefi/efinet.c index 68b0564355..62b1fd80a4 100644 --- a/sys/boot/efi/libefi/efinet.c +++ b/sys/boot/efi/libefi/efinet.c @@ -193,8 +193,8 @@ efinet_init(struct iodesc *desc, void *machdep_hint) h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; status = BS->HandleProtocol(h, &sn_guid, (VOID **)&nif->nif_devdata); if (status != EFI_SUCCESS) { - printf("net%d: cannot start interface (status=%lu)\n", - nif->nif_unit, EFI_ERROR_CODE(status)); + printf("net%d: cannot start interface (status=%llu)\n", + nif->nif_unit, status); return; } @@ -202,8 +202,8 @@ efinet_init(struct iodesc *desc, void *machdep_hint) if (net->Mode->State == EfiSimpleNetworkStopped) { status = net->Start(net); if (status != EFI_SUCCESS) { - printf("net%d: cannot start interface (status=%ld)\n", - nif->nif_unit, (long)status); + printf("net%d: cannot start interface (status=%llu)\n", + nif->nif_unit, status); return; } } @@ -211,8 +211,8 @@ efinet_init(struct iodesc *desc, void *machdep_hint) if (net->Mode->State != EfiSimpleNetworkInitialized) { status = net->Initialize(net, 0, 0); if (status != EFI_SUCCESS) { - printf("net%d: cannot init. interface (status=%ld)\n", - nif->nif_unit, (long)status); + printf("net%d: cannot init. interface (status=%llu)\n", + nif->nif_unit, status); return; } } @@ -223,8 +223,8 @@ efinet_init(struct iodesc *desc, void *machdep_hint) status = net->ReceiveFilters(net, mask, 0, FALSE, 0, 0); if (status != EFI_SUCCESS) { - printf("net%d: cannot set rx. filters (status=%ld)\n", - nif->nif_unit, (long)status); + printf("net%d: cannot set rx. filters (status=%llu)\n", + nif->nif_unit, status); return; } } diff --git a/sys/boot/efi/libefi/efipart.c b/sys/boot/efi/libefi/efipart.c index 50fcd8fb97..0182441850 100644 --- a/sys/boot/efi/libefi/efipart.c +++ b/sys/boot/efi/libefi/efipart.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD: head/sys/boot/efi/libefi/efipart.c 293724 2016-01-12 02:17:3 #include #include -#include static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; static EFI_GUID devpath_guid = DEVICE_PATH_PROTOCOL; diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index 668babcb7b..33aa9524ff 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -33,7 +33,6 @@ BOOT_DLOADER= yes CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/arch/${MACHINE} CFLAGS+= -I${.CURDIR}/../include -CFLAGS+= -I${.CURDIR}/../include/${MACHINE} CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/source/include CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I${.CURDIR}/../../pc32/libi386 diff --git a/sys/boot/efi/loader/arch/x86_64/Makefile.inc b/sys/boot/efi/loader/arch/x86_64/Makefile.inc index e3a66777de..e5fa9ee175 100644 --- a/sys/boot/efi/loader/arch/x86_64/Makefile.inc +++ b/sys/boot/efi/loader/arch/x86_64/Makefile.inc @@ -14,4 +14,5 @@ CFLAGS+= -fno-stack-protector CFLAGS+= -fPIC CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include +CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include/X64 LDFLAGS+= -Wl,-znocombreloc diff --git a/sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c b/sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c index 9959e748f6..5b467a732f 100644 --- a/sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c +++ b/sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c @@ -44,13 +44,14 @@ __FBSDID("$FreeBSD: head/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c 293724 2 #include "platform/acdragonfly.h" #include "acconfig.h" #define ACPI_SYSTEM_XFACE +#define ACPI_USE_SYSTEM_INTTYPES #include "actypes.h" #include "actbl.h" #include "loader_efi.h" static EFI_GUID acpi_guid = ACPI_TABLE_GUID; -static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID; +static EFI_GUID acpi20_guid = EFI_ACPI_TABLE_GUID; extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); diff --git a/sys/boot/efi/loader/arch/x86_64/framebuffer.c b/sys/boot/efi/loader/arch/x86_64/framebuffer.c index f323cc2345..2a672f45a5 100644 --- a/sys/boot/efi/loader/arch/x86_64/framebuffer.c +++ b/sys/boot/efi/loader/arch/x86_64/framebuffer.c @@ -178,7 +178,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 %llu\n", status); free(data1); return (-1); } @@ -473,8 +473,8 @@ command_gop(int argc, char *argv[]) status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); if (EFI_ERROR(status)) { snprintf(command_errbuf, sizeof(command_errbuf), - "%s: Graphics Output Protocol not present (error=%lu)", - argv[0], EFI_ERROR_CODE(status)); + "%s: Graphics Output Protocol not present (error=%llu)", + argv[0], status); return (CMD_ERROR); } @@ -494,8 +494,8 @@ command_gop(int argc, char *argv[]) status = gop->SetMode(gop, mode); 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)); + "%s: Unable to set mode to %u (error=%llu)", + argv[0], mode, status); return (CMD_ERROR); } } else if (!strcmp(argv[1], "get")) { @@ -542,8 +542,8 @@ command_uga(int argc, char *argv[]) status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); if (EFI_ERROR(status)) { snprintf(command_errbuf, sizeof(command_errbuf), - "%s: UGA Protocol not present (error=%lu)", - argv[0], EFI_ERROR_CODE(status)); + "%s: UGA Protocol not present (error=%llu)", + argv[0], status); return (CMD_ERROR); } diff --git a/sys/boot/efi/loader/bootinfo.c b/sys/boot/efi/loader/bootinfo.c index 6cd13dd4aa..d053e14f42 100644 --- a/sys/boot/efi/loader/bootinfo.c +++ b/sys/boot/efi/loader/bootinfo.c @@ -295,8 +295,8 @@ bi_load_efi_data(struct preloaded_file *kfp) status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, pages, &addr); if (EFI_ERROR(status)) { - printf("%s: AllocatePages error %lu\n", __func__, - EFI_ERROR_CODE(status)); + printf("%s: AllocatePages error %llu\n", __func__, + status); return (ENOMEM); } @@ -311,8 +311,8 @@ bi_load_efi_data(struct preloaded_file *kfp) status = BS->GetMemoryMap(&sz, mm, &efi_mapkey, &mmsz, &mmver); if (EFI_ERROR(status)) { - printf("%s: GetMemoryMap error %lu\n", __func__, - EFI_ERROR_CODE(status)); + printf("%s: GetMemoryMap error %llu\n", __func__, + status); return (EINVAL); } status = BS->ExitBootServices(IH, efi_mapkey); @@ -326,7 +326,7 @@ bi_load_efi_data(struct preloaded_file *kfp) } BS->FreePages(addr, pages); } - printf("ExitBootServices error %lu\n", EFI_ERROR_CODE(status)); + printf("ExitBootServices error %llu\n", status); return (EINVAL); } diff --git a/sys/boot/efi/loader/copy.c b/sys/boot/efi/loader/copy.c index cd25cfdbed..3200018bda 100644 --- a/sys/boot/efi/loader/copy.c +++ b/sys/boot/efi/loader/copy.c @@ -58,8 +58,8 @@ efi_copy_init(void) status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, pages, &staging); if (EFI_ERROR(status)) { - printf("failed to allocate %uMB staging area: %lu\n", - EFI_STAGING_SIZE, EFI_ERROR_CODE(status)); + printf("failed to allocate %uMB staging area: %llu\n", + EFI_STAGING_SIZE, status); printf("retrying with smaller %uMB allocation\n", EFI_STAGING_SIZE/2); pages /= 2; @@ -67,8 +67,8 @@ efi_copy_init(void) pages, &staging); } if (EFI_ERROR(status)) { - printf("failed to allocate staging area: %lu\n", - EFI_ERROR_CODE(status)); + printf("failed to allocate staging area: %llu\n", + status); return (status); } staging_end = staging + pages * EFI_PAGE_SIZE; diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index c8182b9165..c54bbd9260 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -53,16 +53,16 @@ extern char bootprog_maker[]; struct arch_switch archsw; /* MI/MD interface boundary */ EFI_GUID acpi = ACPI_TABLE_GUID; -EFI_GUID acpi20 = ACPI_20_TABLE_GUID; +EFI_GUID acpi20 = EFI_ACPI_TABLE_GUID; EFI_GUID devid = DEVICE_PATH_PROTOCOL; EFI_GUID imgid = LOADED_IMAGE_PROTOCOL; -EFI_GUID mps = MPS_TABLE_GUID; +EFI_GUID mps = EFI_MPS_TABLE_GUID; EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID; EFI_GUID smbios = SMBIOS_TABLE_GUID; EFI_GUID dxe = DXE_SERVICES_TABLE_GUID; -EFI_GUID hoblist = HOB_LIST_TABLE_GUID; +EFI_GUID hoblist = HOB_LIST_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_INPUT_PROTOCOL; @@ -652,14 +652,14 @@ 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", status); + printf("Can't get the variable: error %#llx\n", status); return (CMD_ERROR); } data = malloc(datasz); status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, data); if (status != EFI_SUCCESS) { - printf("Can't get the variable: error %#lx\n", status); + printf("Can't get the variable: error %#llx\n", status); return (CMD_ERROR); } uuid_to_string((uuid_t *)matchguid, &str, &uuid_status); @@ -896,7 +896,7 @@ command_efi_set(int argc, char *argv[]) EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS, strlen(val) + 1, val); if (EFI_ERROR(err)) { - printf("Failed to set variable: error %lu\n", EFI_ERROR_CODE(err)); + printf("Failed to set variable: error %llu\n", err); return (CMD_ERROR); } return (CMD_OK); @@ -927,7 +927,7 @@ command_efi_unset(int argc, char *argv[]) cpy8to16(var, wvar, sizeof(wvar)); err = RS->SetVariable(wvar, &guid, 0, 0, NULL); if (EFI_ERROR(err)) { - printf("Failed to unset variable: error %lu\n", EFI_ERROR_CODE(err)); + printf("Failed to unset variable: error %llu\n", err); return (CMD_ERROR); } return (CMD_OK); -- 2.41.0