diff options
Diffstat (limited to 'sys/boot/efi/include/i386/efibind.h')
-rw-r--r-- | sys/boot/efi/include/i386/efibind.h | 184 |
1 files changed, 104 insertions, 80 deletions
diff --git a/sys/boot/efi/include/i386/efibind.h b/sys/boot/efi/include/i386/efibind.h index 1c62eb6..f28057b 100644 --- a/sys/boot/efi/include/i386/efibind.h +++ b/sys/boot/efi/include/i386/efibind.h @@ -1,7 +1,14 @@ /* $FreeBSD$ */ /*++ -Copyright (c) 1998 Intel Corporation +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: @@ -21,17 +28,20 @@ Revision History #pragma pack() -/* - * Basic int types of various widths - */ +#ifdef __FreeBSD__ +#include <sys/stdint.h> +#else +// +// Basic int types of various widths +// #if (__STDC_VERSION__ < 199901L ) -/* No ANSI C 1999/2000 stdint.h integer width declarations */ + // No ANSI C 1999/2000 stdint.h integer width declarations #if _MSC_EXTENSIONS -/* Use Microsoft C compiler integer width declarations */ + // Use Microsoft C compiler integer width declarations typedef unsigned __int64 uint64_t; typedef __int64 int64_t; @@ -44,7 +54,7 @@ Revision History #else #ifdef UNIX_LP64 -/* Use LP64 programming model from C_FLAGS for integer width declarations */ + // Use LP64 programming model from C_FLAGS for integer width declarations typedef unsigned long uint64_t; typedef long int64_t; @@ -56,7 +66,7 @@ Revision History typedef char int8_t; #else -/* Assume P64 programming model from C_FLAGS for integer width declarations */ + // Assume P64 programming model from C_FLAGS for integer width declarations typedef unsigned long long uint64_t; typedef long long int64_t; @@ -69,10 +79,11 @@ Revision History #endif #endif #endif +#endif /* __FreeBSD__ */ -/* - * Basic EFI types of various widths - */ +// +// Basic EFI types of various widths +// typedef uint64_t UINT64; typedef int64_t INT64; @@ -113,15 +124,11 @@ typedef uint32_t UINTN; #define BAD_POINTER 0xFBFBFBFB #define MAX_ADDRESS 0xFFFFFFFF -#ifdef EFI_NT_EMULATOR - #define BREAKPOINT() __asm { int 3 } -#else - #define BREAKPOINT() while (TRUE); -#endif +#define BREAKPOINT() __asm { int 3 } -/* - * Pointers must be aligned to these address to function - */ +// +// Pointers must be aligned to these address to function +// #define MIN_ALIGNMENT_SIZE 4 @@ -132,108 +139,125 @@ typedef uint32_t UINTN; Value = (UINTN)Value + (UINTN)Adjustment -/* - * Define macros to build data structure signatures from characters. - */ +// +// 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)) -/* - * To export & import functions in the EFI emulator environment - */ - -#if EFI_NT_EMULATOR - #define EXPORTAPI __declspec( dllexport ) -#else - #define EXPORTAPI -#endif - +// +// 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 +// -/* - * 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 - */ - -/* Forces EFI calling conventions reguardless of compiler options */ -#ifndef EFIAPI +#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options #if _MSC_EXTENSIONS - #define EFIAPI __cdecl + #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler #else - #define EFIAPI + #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 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) \ - UINTN \ - __stdcall \ - _DllMainCRTStartup ( \ - UINTN Inst, \ - UINTN reason_for_call, \ - VOID *rserved \ - ) \ - { \ - return 1; \ - } \ - \ - int \ - EXPORTAPI \ - __cdecl \ - InitializeDriver ( \ - void *ImageHandle, \ - void *SystemTable \ - ) \ - { \ - return InitFunction(ImageHandle, SystemTable); \ +// +// 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 */ +#else // EFI_NT_EMULATOR -/* - * When build similiar to FW, then link everything together as - * one big module. - */ +// +// When build similiar 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 */ +#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__ */ #if _MSC_EXTENSIONS -#pragma warning ( disable : 4731 ) +#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP #endif |