efibind.h revision 199767f8919635c4928607450d9e0abb932109ce
/* $FreeBSD$ */
/*++
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:
Abstract:
EFI to compile bindings
Revision History
--*/
#pragma pack()
#if 0
//
// Basic int types of various widths
//
#if (__STDC_VERSION__ < 199901L )
// No ANSI C 1999/2000 stdint.h integer width declarations
#ifdef _MSC_EXTENSIONS
// Use Microsoft C compiler integer width declarations
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
typedef char int8_t;
#else
#ifdef UNIX_LP64
// Use LP64 programming model from C_FLAGS for integer width declarations
typedef unsigned long uint64_t;
typedef long int64_t;
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
typedef char int8_t;
#else
// Assume P64 programming model from C_FLAGS for integer width declarations
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
typedef char int8_t;
#endif
#endif
#endif
#endif
//
// Basic EFI types of various widths
//
#ifndef ACPI_THREAD_ID /* ACPI's definitions are fine */
#ifndef _BASETSD_H_
#endif
#endif
#define VOID void
#ifdef EFI_NT_EMULATOR
#else
#ifdef EFI_DEBUG
#else
#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
//
// Pointers must be aligned to these address to function
//
#define MIN_ALIGNMENT_SIZE 4
(UINTN)Adjustment = 0; \
//
// Define macros to build data structure signatures from characters.
//
#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
#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__
#endif
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
#ifdef _MSC_EXTENSIONS
#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 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) \
InitFunction ( \
); \
\
UINTN \
) \
{ \
return 1; \
} \
\
int \
__declspec( dllexport ) \
__cdecl \
InitializeDriver ( \
void *ImageHandle, \
void *SystemTable \
) \
{ \
}
#else // EFI_NT_EMULATOR
//
// When build similiar to FW, then link everything together as
// one big module.
//
#define EFI_DRIVER_ENTRY_POINT(InitFunction)
#endif // EFI_FW_NT
#define INTERFACE_DECL(x) struct x
#if 0
//
// 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
#endif