From nobody Sun Nov 16 18:29:04 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d8fXc4l4Bz6GsB6; Sun, 16 Nov 2025 18:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d8fXc2Yvzz431h; Sun, 16 Nov 2025 18:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/9jH4ci0nyhHYj2XuC5XK78fye1dLyv3KN4x0Xg8EsQ=; b=gHI0H4EPeoG9tKTpLnQgc4qCL32vGn8JKc8ae9PMTv3AwFbps9J6nfwwCUq4kuXS/cx5rK JdqpVR505PIpaOd693/GRWKaZDi8/6HG2rdThDWyquyvl08JHTrcjPkqeng++IOPJJV/pe u6oG9yc5kvpN/P0F/6HM9t3xhePWrV91L/5cp3Z7ZYZZUa9dTHB/IgAkA4rmADenYzfo27 njKfpCrl/CWDQE0M3rrFKmRXoVMOiynPFyvkKl0Ak7F6kE4PhAaPosZ5HRzD39K4/5Dh3Z tcJ54kR8cUnQOmfL8picifQ9WE47FuAJ0iR8CYo621xEXjkfrSGnBFJSe+WGUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763317744; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/9jH4ci0nyhHYj2XuC5XK78fye1dLyv3KN4x0Xg8EsQ=; b=d0sJHGaWUTiHgUtuw7plLQjTZOicvdGXd3YkNBMQO2G4dqboaqQ5cB2GkSJgPs8yYIrDNT pWsibaVnnfYZfbfDOEagpzw1DAtrqp+JeDQuIJgfqeALjwo/Wp/l9gt5zZyQKXe5Q8zDLQ BoGqlmihAMjG2wOTtqLMAvkZiiVHhpsrtO8fOMXpWHHcp9DweN/OSFzcvYvYCIBPAmH7vK l4cGbZE9AmDO57UddJ5YVRkGZtW6rFKZXauDj39JgnVZUHF9CvIIWD7ZsoPhUWBbzPsNkz zzj/nm1uTql7SgTvABfAZ9iWQbhDZrca7PfAfcSbTXC70jIVH8qRfWDsqhzKQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763317744; a=rsa-sha256; cv=none; b=PapFqShSxDcU6AqARQFPWXFOfk8cpVNiTMlexFXwpdzqeo0gn1Jga19y9x1J7BrpfiOPVt d0dHkbOGseG9WX0xH6AjmDoAcJeea5F5eeUaK6AcB9h20WRdHTUqmCw0lT7RGFFC2iiFiU 5paQIiZfGTE0T+dOyFnuT5v+vG6rnMOip19tSwSpw8pCVfOsD0K0o05GJjB57StRdkSdnP Gg5xUcmAbNiwu1xCAQzvPtpxMaQ4m7Aa2v4NwxVP8uqaXEJTZIDCAYkk9cYCr8mA3r0tDr xtipet5Yln8MeP2hxP1Ih4InOVz4cAtkZjoDbysi8Lgh/UiKLuG2Z6jfHMpeoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d8fXc1vsBzqWY; Sun, 16 Nov 2025 18:29:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5AGIT4dh007996; Sun, 16 Nov 2025 18:29:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AGIT4RT007993; Sun, 16 Nov 2025 18:29:04 GMT (envelope-from git) Date: Sun, 16 Nov 2025 18:29:04 GMT Message-Id: <202511161829.5AGIT4RT007993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 84dc74b8274c - main - stand: switch the loader over to using efi-edk2.h List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84dc74b8274c77ea878837cb0e2dbd4c93b93052 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=84dc74b8274c77ea878837cb0e2dbd4c93b93052 commit 84dc74b8274c77ea878837cb0e2dbd4c93b93052 Author: Warner Losh AuthorDate: 2025-11-16 17:34:49 +0000 Commit: Warner Losh 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 -#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 +#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