git: 84dc74b8274c - main - stand: switch the loader over to using efi-edk2.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 16 Nov 2025 18:29:04 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=84dc74b8274c77ea878837cb0e2dbd4c93b93052
commit 84dc74b8274c77ea878837cb0e2dbd4c93b93052
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-11-16 17:34:49 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-11-16 18:29:03 +0000
stand: switch the loader over to using efi-edk2.h
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D53652
---
stand/efi/include/amd64/efibind.h | 187 --------------------------------------
stand/efi/include/arm/efibind.h | 129 --------------------------
stand/efi/include/arm64/efibind.h | 140 ----------------------------
stand/efi/include/efi.h | 34 ++-----
stand/efi/include/i386/efibind.h | 183 -------------------------------------
stand/efi/include/riscv/efibind.h | 140 ----------------------------
6 files changed, 9 insertions(+), 804 deletions(-)
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/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..e19c4dbde2ad 100644
--- a/stand/efi/include/efi.h
+++ b/stand/efi/include/efi.h
@@ -43,34 +43,18 @@ 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>
+#if __SIZEOF_LONG__ == 4
+#define EFI_ERROR_MASK 0x80000000
+#define EFIERR(a) (0x80000000 | a)
+#define EFIERR_OEM(a) (0xc0000000 | a)
+#else
+#define EFI_ERROR_MASK 0x8000000000000000
+#define EFIERR(a) (0x8000000000000000 | a)
+#define EFIERR_OEM(a) (0xc000000000000000 | a)
#endif
-#undef VOID
-#define VOID void
-
-
-#include "efibind.h"
#include "efidef.h"
#include "efidevp.h"
#include "efipciio.h"
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/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