Module Name: src Committed By: jmcneill Date: Thu Sep 30 19:02:48 UTC 2021
Modified Files: src/sys/external/bsd/gnu-efi/dist/inc: efiapi.h efilib.h efistdarg.h src/sys/external/bsd/gnu-efi/dist/inc/aarch64: efibind.h efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/inc/arm: efibind.h efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/inc/ia32: efibind.h efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/inc/ia64: efibind.h efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/inc/mips64el: efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/inc/x86_64: efibind.h efisetjmp_arch.h src/sys/external/bsd/gnu-efi/dist/lib: dpath.c hand.c misc.c print.c Removed Files: src/sys/external/bsd/gnu-efi/dist/inc: efishellparm.h src/sys/external/bsd/gnu-efi/dist/lib: lib.h Log Message: merge conflicts To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h \ src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/inc/efilib.h cvs rdiff -u -r1.1.1.1 -r0 \ src/sys/external/bsd/gnu-efi/dist/inc/efishellparm.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h \ src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h \ src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/gnu-efi/dist/lib/dpath.c cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/gnu-efi/dist/lib/hand.c \ src/sys/external/bsd/gnu-efi/dist/lib/print.c cvs rdiff -u -r1.1.1.2 -r0 src/sys/external/bsd/gnu-efi/dist/lib/lib.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/gnu-efi/dist/lib/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.3 src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.4 --- src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h:1.3 Thu Aug 16 18:22:05 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/efiapi.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efiapi.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $ */ +/* $NetBSD: efiapi.h,v 1.4 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef _EFI_API_H #define _EFI_API_H @@ -344,6 +344,18 @@ EFI_STATUS #define EFI_IMAGE_MACHINE_AARCH64 0xAA64 #endif +#if !defined(EFI_IMAGE_MACHINE_RISCV32) +#define EFI_IMAGE_MACHINE_RISCV32 0x5032 +#endif + +#if !defined(EFI_IMAGE_MACHINE_RISCV64) +#define EFI_IMAGE_MACHINE_RISCV64 0x5064 +#endif + +#if !defined(EFI_IMAGE_MACHINE_RISCV128) +#define EFI_IMAGE_MACHINE_RISCV128 0x5128 +#endif + // Image Entry prototype typedef @@ -578,7 +590,7 @@ EFI_STATUS IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN const VOID *NotifyContext OPTIONAL, - IN const EFI_GUID EventGroup OPTIONAL, + IN const EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event ); @@ -929,6 +941,9 @@ typedef struct _EFI_BOOT_SERVICES { #define HCDP_TABLE_GUID \ { 0xf951938d, 0x620b, 0x42ef, {0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98} } +#define EFI_DTB_TABLE_GUID \ + { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} } + typedef struct _EFI_CONFIGURATION_TABLE { EFI_GUID VendorGuid; VOID *VendorTable; Index: src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.3 src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.4 --- src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h:1.3 Thu Aug 16 18:22:05 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/efistdarg.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efistdarg.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $ */ +/* $NetBSD: efistdarg.h,v 1.4 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef _EFISTDARG_H_ #define _EFISTDARG_H_ @@ -21,7 +21,7 @@ Revision History --*/ -#ifndef GNU_EFI_USE_EXTERNAL_STDARG +#if !defined(GNU_EFI_USE_EXTERNAL_STDARG) && !defined(_MSC_VER) #ifdef __NetBSD__ #include <sys/stdarg.h> #else Index: src/sys/external/bsd/gnu-efi/dist/inc/efilib.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/efilib.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/efilib.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/efilib.h:1.2 Sun Aug 19 14:50:24 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/efilib.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efilib.h,v 1.2 2018/08/19 14:50:24 jmcneill Exp $ */ +/* $NetBSD: efilib.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef _EFILIB_INCLUDE_ #define _EFILIB_INCLUDE_ @@ -23,7 +23,21 @@ Revision History #include "efidebug.h" #include "efipart.h" -#include "efilibplat.h" +#if defined(_M_X64) || defined(__x86_64__) || defined(__amd64__) +#include "x86_64/efilibplat.h" +#elif defined(_M_IX86) || defined(__i386__) +#include "ia32/efilibplat.h" +#elif defined(_M_IA64) || defined(__ia64__) +#include "ia64/efilibplat.h" +#elif defined (_M_ARM64) || defined(__aarch64__) +#include "aarch64/efilibplat.h" +#elif defined (_M_ARM) || defined(__arm__) +#include "arm/efilibplat.h" +#elif defined (_M_MIPS64) || defined(__mips64__) +#include "mips64el/efilibplat.h" +#elif defined (__riscv) && __riscv_xlen == 64 +#include "riscv64/efilibplat.h" +#endif #include "efilink.h" #include "efirtlib.h" #include "efistdarg.h" @@ -47,6 +61,8 @@ extern EFI_GUID gEfiDevicePathToTextProt #define DevicePathToTextProtocol gEfiDevicePathToTextProtocolGuid extern EFI_GUID gEfiDevicePathFromTextProtocolGuid; #define DevicePathFromTextProtocol gEfiDevicePathFromTextProtocolGuid +extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid; +#define DevicePathUtilitiesProtocol gEfiDevicePathUtilitiesProtocolGuid extern EFI_GUID gEfiLoadedImageProtocolGuid; #define LoadedImageProtocol gEfiLoadedImageProtocolGuid extern EFI_GUID gEfiSimpleTextInProtocolGuid; @@ -139,7 +155,9 @@ extern EFI_GUID EfiPartTypeLegacyMbrGuid extern EFI_GUID MpsTableGuid; extern EFI_GUID AcpiTableGuid; extern EFI_GUID SMBIOSTableGuid; +extern EFI_GUID SMBIOS3TableGuid; extern EFI_GUID SalSystemTableGuid; +extern EFI_GUID EfiDtbTableGuid; extern EFI_GUID SimplePointerProtocol; extern EFI_GUID AbsolutePointerProtocol; @@ -147,6 +165,12 @@ extern EFI_GUID AbsolutePointerProtocol; extern EFI_GUID gEfiDebugImageInfoTableGuid; extern EFI_GUID gEfiDebugSupportProtocolGuid; +extern EFI_GUID SimpleTextInputExProtocol; + +extern EFI_GUID ShellProtocolGuid; +extern EFI_GUID ShellParametersProtocolGuid; +extern EFI_GUID ShellDynamicCommandProtocolGuid; + // // EFI Variable strings // @@ -514,7 +538,7 @@ VPrint ( ); UINTN -SPrint ( +UnicodeSPrint ( OUT CHAR16 *Str, IN UINTN StrSize, IN CONST CHAR16 *fmt, @@ -522,7 +546,7 @@ SPrint ( ); UINTN -VSPrint ( +UnicodeVSPrint ( OUT CHAR16 *Str, IN UINTN StrSize, IN CONST CHAR16 *fmt, @@ -579,11 +603,26 @@ IPrintAt ( ); UINTN -APrint ( +AsciiPrint ( IN CONST CHAR8 *fmt, ... ); +UINTN +AsciiVSPrint( + OUT CHAR8 *Str, + IN UINTN StrSize, + IN CONST CHAR8 *fmt, + va_list args +); + +// +// For compatibility with previous gnu-efi versions +// +#define SPrint UnicodeSPrint +#define VSPrint UnicodeVSPrint +#define APrint AsciiPrint + VOID ValueToHex ( IN CHAR16 *Buffer, @@ -1018,6 +1057,11 @@ WritePciConfig ( IN UINTN Data ); +VOID +Pause ( + VOID +); + extern EFI_DEVICE_IO_INTERFACE *GlobalIoFncs; #define outp(_Port, _DataByte) (UINT8)WritePort(GlobalIoFncs, IO_UINT8, (UINTN)_Port, (UINTN)_DataByte) @@ -1034,7 +1078,6 @@ extern EFI_DEVICE_IO_INTERFACE *GlobalI #define writepci32(_Addr, _DataByte) (UINT32)WritePciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr, (UINTN)_DataByte) #define readpci32(_Addr) (UINT32)ReadPciConfig(GlobalIoFncs, IO_UINT32, (UINTN)_Addr) -#define Pause() WaitForSingleEvent (ST->ConIn->WaitForKey, 0) #define Port80(_PostCode) GlobalIoFncs->Io.Write (GlobalIoFncs, IO_UINT16, (UINT64)0x80, 1, &(_PostCode)) #endif Index: src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h:1.2 Sat Aug 18 20:17:51 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efibind.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efibind.h,v 1.2 2018/08/18 20:17:51 jmcneill Exp $ */ +/* $NetBSD: efibind.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ /* * Copright (C) 2014 - 2015 Linaro Ltd. @@ -17,7 +17,7 @@ * either version 2 of the License, or (at your option) any later version. */ -#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) +#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) && !defined(__cplusplus) // ANSI C 1999/2000 stdint.h integer width declarations @@ -29,6 +29,8 @@ typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef signed char int8_t; // unqualified 'char' is unsigned on ARM +typedef uint64_t uintptr_t; +typedef int64_t intptr_t; #elif defined(__NetBSD__) #include <sys/stdint.h> Index: src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/aarch64/efisetjmp_arch.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef GNU_EFI_AARCH64_SETJMP_H #define GNU_EFI_AARCH64_SETJMP_H @@ -30,6 +30,6 @@ typedef struct { UINT64 D13; UINT64 D14; UINT64 D15; -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_AARCH64_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h:1.2 Sat Aug 18 20:17:51 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/arm/efibind.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efibind.h,v 1.2 2018/08/18 20:17:51 jmcneill Exp $ */ +/* $NetBSD: efibind.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ /* * Copright (C) 2014 - 2015 Linaro Ltd. @@ -17,7 +17,7 @@ * either version 2 of the License, or (at your option) any later version. */ -#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) +#if !defined(_MSC_VER) && (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )) && !defined(__cplusplus) // ANSI C 1999/2000 stdint.h integer width declarations @@ -29,6 +29,8 @@ typedef unsigned short uint16_t; typedef short int16_t; typedef unsigned char uint8_t; typedef signed char int8_t; // unqualified 'char' is unsigned on ARM +typedef uint32_t uintptr_t; +typedef int32_t intptr_t; #elif defined(__NetBSD__) #include <sys/stdint.h> @@ -40,7 +42,7 @@ typedef signed char int8_t; // * This prevents GCC from emitting GOT based relocations, and use R_ARM_REL32 * relative relocations instead, which are more suitable for static binaries. */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !__STDC_HOSTED__ #pragma GCC visibility push (hidden) #endif Index: src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/arm/efisetjmp_arch.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef GNU_EFI_ARM_SETJMP_H #define GNU_EFI_ARM_SETJMP_H @@ -18,6 +18,6 @@ typedef struct { UINT32 R12; UINT32 R13; UINT32 R14; -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_ARM_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.4 src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.5 --- src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h:1.4 Fri Sep 13 20:56:29 2019 +++ src/sys/external/bsd/gnu-efi/dist/inc/ia32/efibind.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efibind.h,v 1.4 2019/09/13 20:56:29 tnn Exp $ */ +/* $NetBSD: efibind.h,v 1.5 2021/09/30 19:02:47 jmcneill Exp $ */ /*++ @@ -27,7 +27,7 @@ Revision History // Basic int types of various widths // -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) +#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) // No ANSI C 1999/2000 stdint.h integer width declarations @@ -77,6 +77,8 @@ Revision History typedef unsigned char uint8_t; typedef char int8_t; #endif + typedef uint32_t uintptr_t; + typedef int32_t intptr_t; #elif defined(__NetBSD__) #include <sys/stdint.h> #elif defined(__GNUC__) Index: src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/ia32/efisetjmp_arch.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef GNU_EFI_IA32_SETJMP_H #define GNU_EFI_IA32_SETJMP_H @@ -12,6 +12,6 @@ typedef struct { UINT32 Ebp; UINT32 Esp; UINT32 Eip; -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_IA32_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.3 src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.4 --- src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h:1.3 Thu Aug 16 18:22:05 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/ia64/efibind.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efibind.h,v 1.3 2018/08/16 18:22:05 jmcneill Exp $ */ +/* $NetBSD: efibind.h,v 1.4 2021/09/30 19:02:47 jmcneill Exp $ */ /*++ @@ -26,7 +26,7 @@ Revision History // Basic int types of various widths // -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) +#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) // No ANSI C 1999/2000 stdint.h integer width declarations @@ -64,6 +64,8 @@ Revision History typedef unsigned char uint8_t; typedef char int8_t; #endif + typedef uint64_t uintptr_t; + typedef int64_t intptr_t; #elif defined(__NetBSD__) #include <sys/stdint.h> #elif defined(__GNUC__) Index: src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/ia64/efisetjmp_arch.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef GNU_EFI_IA64_SETJMP_H #define GNU_EFI_IA64_SETJMP_H @@ -44,6 +44,6 @@ typedef struct { UINT64 Predicates; UINT64 LoopCount; UINT64 FPSR; -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_IA64_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/mips64el/efisetjmp_arch.h Thu Sep 30 19:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:47 jmcneill Exp $ */ #ifndef GNU_EFI_MIPS64EL_SETJMP_H #define GNU_EFI_MIPS64EL_SETJMP_H @@ -31,6 +31,6 @@ typedef struct { UINT64 F30; UINT64 F31; #endif -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_MIPS64EL_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.4 src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.5 --- src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h:1.4 Fri Sep 13 20:56:29 2019 +++ src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efibind.h Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efibind.h,v 1.4 2019/09/13 20:56:29 tnn Exp $ */ +/* $NetBSD: efibind.h,v 1.5 2021/09/30 19:02:48 jmcneill Exp $ */ /*++ @@ -24,7 +24,9 @@ Revision History #pragma pack() #endif -#if defined(GNU_EFI_USE_MS_ABI) +#if defined(_MSC_VER) + #define HAVE_USE_MS_ABI 1 +#elif defined(GNU_EFI_USE_MS_ABI) #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)))||(defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 2))) #define HAVE_USE_MS_ABI 1 #else @@ -36,7 +38,7 @@ Revision History // Basic int types of various widths // -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) +#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus) // No ANSI C 1999/2000 stdint.h integer width declarations @@ -86,9 +88,11 @@ Revision History typedef unsigned char uint8_t; typedef char int8_t; #endif + typedef uint64_t uintptr_t; + typedef int64_t intptr_t; #elif defined(__NetBSD__) #include <sys/stdint.h> -#elif defined(__GNUC__) +#else #include <stdint.h> #endif Index: src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h diff -u src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h:1.2 src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h:1.3 --- src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h:1.2 Thu Aug 16 18:24:36 2018 +++ src/sys/external/bsd/gnu-efi/dist/inc/x86_64/efisetjmp_arch.h Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: efisetjmp_arch.h,v 1.2 2018/08/16 18:24:36 jmcneill Exp $ */ +/* $NetBSD: efisetjmp_arch.h,v 1.3 2021/09/30 19:02:48 jmcneill Exp $ */ #ifndef GNU_EFI_X86_64_SETJMP_H #define GNU_EFI_X86_64_SETJMP_H @@ -19,6 +19,6 @@ typedef struct { UINT64 Rip; UINT64 MxCsr; UINT8 XmmBuffer[160]; // XMM6 - XMM15 -} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf; +} EFI_ALIGN(JMPBUF_ALIGN) jmp_buf[1]; #endif /* GNU_EFI_X86_64_SETJMP_H */ Index: src/sys/external/bsd/gnu-efi/dist/lib/dpath.c diff -u src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.3 src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.4 --- src/sys/external/bsd/gnu-efi/dist/lib/dpath.c:1.3 Thu Aug 16 18:22:05 2018 +++ src/sys/external/bsd/gnu-efi/dist/lib/dpath.c Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dpath.c,v 1.3 2018/08/16 18:22:05 jmcneill Exp $ */ +/* $NetBSD: dpath.c,v 1.4 2021/09/30 19:02:48 jmcneill Exp $ */ /*++ @@ -661,7 +661,8 @@ _DevPath1394 ( F1394_DEVICE_PATH *F1394; F1394 = DevPath; - CatPrint(Str, L"1394(%g)", &F1394->Guid); + // Guid has format of IEEE-EUI64 + CatPrint(Str, L"I1394(%016lx)", F1394->Guid); } @@ -865,9 +866,9 @@ _DevPathInfiniBand ( INFINIBAND_DEVICE_PATH *InfiniBand __unused; InfiniBand = DevPath; - CatPrint( Str , L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)" , - InfiniBand-> ResourceFlags , InfiniBand-> PortGid , InfiniBand-> ServiceId , - InfiniBand-> TargetPortId , InfiniBand-> DeviceId ) ; + CatPrint(Str, L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)", + InfiniBand->ResourceFlags, InfiniBand->PortGid, InfiniBand->ServiceId, + InfiniBand->TargetPortId, InfiniBand->DeviceId); } static VOID @@ -891,17 +892,19 @@ _DevPathUart ( } if (Uart->BaudRate == 0) { - CatPrint(Str, L"Uart(DEFAULT %c",Uart->BaudRate,Parity); + CatPrint(Str, L"Uart(DEFAULT,"); } else { - CatPrint(Str, L"Uart(%d %c",Uart->BaudRate,Parity); + CatPrint(Str, L"Uart(%ld,", Uart->BaudRate); } if (Uart->DataBits == 0) { - CatPrint(Str, L"D"); + CatPrint(Str, L"DEFAULT,"); } else { - CatPrint(Str, L"%d",Uart->DataBits); + CatPrint(Str, L"%d,", Uart->DataBits); } + CatPrint(Str, L"%c,", Parity); + switch (Uart->StopBits) { case 0 : CatPrint(Str, L"D)"); break; case 1 : CatPrint(Str, L"1)"); break; @@ -935,21 +938,20 @@ _DevPathHardDrive ( Hd = DevPath; switch (Hd->SignatureType) { case SIGNATURE_TYPE_MBR: - CatPrint(Str, L"HD(Part%d,Sig%08X)", + CatPrint(Str, L"HD(%d,MBR,0x%08x)", Hd->PartitionNumber, *((UINT32 *)(&(Hd->Signature[0]))) ); break; case SIGNATURE_TYPE_GUID: - CatPrint(Str, L"HD(Part%d,Sig%g)", + CatPrint(Str, L"HD(%d,GPT,%g)", Hd->PartitionNumber, (EFI_GUID *) &(Hd->Signature[0]) ); break; default: - CatPrint(Str, L"HD(Part%d,MBRType=%02x,SigType=%02x)", + CatPrint(Str, L"HD(%d,%d,0)", Hd->PartitionNumber, - Hd->MBRType, Hd->SignatureType ); break; Index: src/sys/external/bsd/gnu-efi/dist/lib/hand.c diff -u src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.4 src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.5 --- src/sys/external/bsd/gnu-efi/dist/lib/hand.c:1.4 Thu Aug 16 18:22:05 2018 +++ src/sys/external/bsd/gnu-efi/dist/lib/hand.c Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: hand.c,v 1.4 2018/08/16 18:22:05 jmcneill Exp $ */ +/* $NetBSD: hand.c,v 1.5 2021/09/30 19:02:48 jmcneill Exp $ */ /*++ @@ -490,6 +490,7 @@ LibInstallProtocolInterfaces ( Index += 1; } + va_end (args); va_end (args); @@ -511,6 +512,7 @@ LibInstallProtocolInterfaces ( va_end (args); *Handle = OldHandle; + va_end (args); } // @@ -613,6 +615,7 @@ LibReinstallProtocolInterfaces ( Index += 1; } + va_end (args); va_end (args); @@ -632,8 +635,8 @@ LibReinstallProtocolInterfaces ( uefi_call_wrapper(BS->ReinstallProtocolInterface, 4, Handle, Protocol, NewInterface, OldInterface); Index -= 1; - } - va_end (args); + } + va_end (args); } // Index: src/sys/external/bsd/gnu-efi/dist/lib/print.c diff -u src/sys/external/bsd/gnu-efi/dist/lib/print.c:1.4 src/sys/external/bsd/gnu-efi/dist/lib/print.c:1.5 --- src/sys/external/bsd/gnu-efi/dist/lib/print.c:1.4 Sun Jan 27 04:17:39 2019 +++ src/sys/external/bsd/gnu-efi/dist/lib/print.c Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.4 2019/01/27 04:17:39 oster Exp $ */ +/* $NetBSD: print.c,v 1.5 2021/09/30 19:02:48 jmcneill Exp $ */ /*++ @@ -317,7 +317,7 @@ _SPrint ( IN VOID *Context, IN CHAR16 *Buffer ) -// Append string worker for SPrint, PoolPrint and CatPrint +// Append string worker for UnicodeSPrint, PoolPrint and CatPrint { UINTN len; POOL_PRINT *spc; @@ -407,7 +407,7 @@ _PoolCatPrint ( IN OUT POOL_PRINT *spc, IN INTN (EFIAPI *Output)(VOID *context, CHAR16 *str) ) -// Dispath function for SPrint, PoolPrint, and CatPrint +// Dispatch function for UnicodeSPrint, PoolPrint, and CatPrint { PRINT_STATE ps; @@ -423,7 +423,7 @@ _PoolCatPrint ( UINTN -VSPrint ( +UnicodeVSPrint ( OUT CHAR16 *Str, IN UINTN StrSize, IN CONST CHAR16 *fmt, @@ -465,7 +465,7 @@ Returns: } UINTN -SPrint ( +UnicodeSPrint ( OUT CHAR16 *Str, IN UINTN StrSize, IN CONST CHAR16 *fmt, @@ -496,7 +496,7 @@ Returns: UINTN len; va_start (args, fmt); - len = VSPrint(Str, StrSize, fmt, args); + len = UnicodeVSPrint(Str, StrSize, fmt, args); va_end (args); return len; @@ -812,7 +812,7 @@ _IPrint ( UINTN -APrint ( +AsciiPrint ( IN CONST CHAR8 *fmt, ... ) @@ -844,6 +844,64 @@ Returns: } +UINTN +AsciiVSPrint ( + OUT CHAR8 *Str, + IN UINTN StrSize, + IN CONST CHAR8 *fmt, + va_list args +) +/*++ + +Routine Description: + + Prints a formatted ascii string to a buffer using a va_list + +Arguments: + + Str - Output buffer to print the formatted string into + + StrSize - Size of Str. String is truncated to this size. + A size of 0 means there is no limit + + fmt - The format string + + args - va_list + + +Returns: + + String length returned in buffer + +--*/ +// Use UnicodeVSPrint() and convert back to ASCII +{ + CHAR16 *UnicodeStr, *UnicodeFmt; + UINTN i, Len; + + UnicodeStr = AllocatePool(StrSize * sizeof(CHAR16)); + if (!UnicodeStr) + return 0; + + UnicodeFmt = PoolPrint(L"%a", fmt); + if (!UnicodeFmt) { + FreePool(UnicodeStr); + return 0; + } + + Len = UnicodeVSPrint(UnicodeStr, StrSize, UnicodeFmt, args); + FreePool(UnicodeFmt); + + // The strings are ASCII so just do a plain Unicode conversion + for (i = 0; i < Len; i++) + Str[i] = (CHAR8)UnicodeStr[i]; + Str[Len] = 0; + FreePool(UnicodeStr); + + return Len; +} + + STATIC VOID PFLUSH ( @@ -1323,7 +1381,7 @@ ValueToString ( *(p1++) = (CHAR8)r + '0'; } - c = (Comma ? ca[(p1 - str) % 3] : 999) + 1; + c = (UINTN) (Comma ? ca[(p1 - str) % 3] : 999) + 1; while (p1 != str) { c -= 1; @@ -1415,7 +1473,7 @@ TimeToString ( Year = Time->Year % 100; // bugbug: for now just print it any old way - SPrint (Buffer, 0, L"%02d/%02d/%02d %02d:%02d%c", + UnicodeSPrint (Buffer, 0, L"%02d/%02d/%02d %02d:%02d%c", Time->Month, Time->Day, Year, Index: src/sys/external/bsd/gnu-efi/dist/lib/misc.c diff -u src/sys/external/bsd/gnu-efi/dist/lib/misc.c:1.2 src/sys/external/bsd/gnu-efi/dist/lib/misc.c:1.3 --- src/sys/external/bsd/gnu-efi/dist/lib/misc.c:1.2 Mon Apr 12 09:24:24 2021 +++ src/sys/external/bsd/gnu-efi/dist/lib/misc.c Thu Sep 30 19:02:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.2 2021/04/12 09:24:24 mrg Exp $ */ +/* $NetBSD: misc.c,v 1.3 2021/09/30 19:02:48 jmcneill Exp $ */ /*++ @@ -248,7 +248,7 @@ LibGetVariableAndSize ( OUT UINTN *VarSize ) { - EFI_STATUS Status; + EFI_STATUS Status = EFI_SUCCESS; VOID *Buffer; UINTN BufferSize; @@ -389,7 +389,9 @@ LibInsertToTailOfBootOrder ( VarSize += sizeof(UINT16); NewBootOptionArray = AllocatePool (VarSize); - + if (!NewBootOptionArray) + return EFI_OUT_OF_RESOURCES; + for (Index = 0; Index < ((VarSize/sizeof(UINT16)) - 1); Index++) { NewBootOptionArray[Index] = BootOptionArray[Index]; } @@ -406,9 +408,7 @@ LibInsertToTailOfBootOrder ( VarSize, (VOID*) NewBootOptionArray ); - if (NewBootOptionArray) { - FreePool (NewBootOptionArray); - } + FreePool (NewBootOptionArray); if (BootOptionArray) { FreePool (BootOptionArray); }