/*++12Copyright (c) 1999 - 2003 Intel Corporation. All rights reserved3This software and associated documentation (if any) is furnished4under a license and may only be used or copied in accordance5with the terms of the license. Except as permitted by such6license, no part of this software or documentation may be7reproduced, stored in a retrieval system, or transmitted in any8form or by any means without the express written consent of9Intel Corporation.1011Module Name:1213efefind.h1415Abstract:1617EFI to compile bindings1819202122Revision History2324--*/2526#pragma pack()2728//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++29// BugBug: Code to debug30//31#define BIT63 0x80000000000000003233#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63)34#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) )3536//37// Macro's with casts make this much easier to use and read.38//39#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port)))40#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data))41//42// BugBug: End Debug Code!!!43//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++4445#define EFIERR(a) (0x8000000000000000 | a)46#define EFI_ERROR_MASK 0x800000000000000047#define EFIERR_OEM(a) (0xc000000000000000 | a)4849#define BAD_POINTER 0xFBFBFBFBFBFBFBFB50#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF5152#define BREAKPOINT() __break(0)5354//55// Pointers must be aligned to these address to function56// you will get an alignment fault if this value is less than 857//58#define MIN_ALIGNMENT_SIZE 85960#define ALIGN_VARIABLE(Value , Adjustment) \61(UINTN) Adjustment = 0; \62if((UINTN)Value % MIN_ALIGNMENT_SIZE) \63(UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \64Value = (UINTN)Value + (UINTN)Adjustment6566//67// Define macros to create data structure signatures.68//6970#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))71#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))72#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))7374//75// EFIAPI - prototype calling convention for EFI function pointers76// BOOTSERVICE - prototype for implementation of a boot service interface77// RUNTIMESERVICE - prototype for implementation of a runtime service interface78// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service79// RUNTIME_CODE - pragma macro for declaring runtime code80//8182#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options83#ifdef _MSC_EXTENSIONS84#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler85#else86#define EFIAPI // Substitute expresion to force C calling convention87#endif88#endif8990#define BOOTSERVICE91#define RUNTIMESERVICE92#define RUNTIMEFUNCTION9394#define RUNTIME_CODE(a) alloc_text("rtcode", a)95#define BEGIN_RUNTIME_DATA() data_seg("rtdata")96#define END_RUNTIME_DATA() data_seg()9798#define VOLATILE volatile99100//101// BugBug: Need to find out if this is portable across compilers.102//103void __mfa (void);104#define MEMORY_FENCE() __mfa()105106#ifdef EFI_NO_INTERFACE_DECL107#define EFI_FORWARD_DECLARATION(x)108#define EFI_INTERFACE_DECL(x)109#else110#define EFI_FORWARD_DECLARATION(x) typedef struct _##x x111#define EFI_INTERFACE_DECL(x) typedef struct x112#endif113114//115// When build similar to FW, then link everything together as116// one big module.117//118119#define EFI_DRIVER_ENTRY_POINT(InitFunction)120121#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \122(_if)->LoadInternal(type, name, entry)123// entry(NULL, ST)124125#ifdef __FreeBSD__126#define INTERFACE_DECL(x) struct x127#else128//129// Some compilers don't support the forward reference construct:130// typedef struct XXXXX131//132// The following macro provide a workaround for such cases.133//134#ifdef NO_INTERFACE_DECL135#define INTERFACE_DECL(x)136#else137#define INTERFACE_DECL(x) typedef struct x138#endif139#endif140141142