199767f8919635c4928607450d9e0abb932109ceToomas Soome/* $FreeBSD$ */
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCopyright (c) 1999 - 2003 Intel Corporation. All rights reserved
199767f8919635c4928607450d9e0abb932109ceToomas SoomeThis software and associated documentation (if any) is furnished
199767f8919635c4928607450d9e0abb932109ceToomas Soomeunder a license and may only be used or copied in accordance
199767f8919635c4928607450d9e0abb932109ceToomas Soomewith the terms of the license. Except as permitted by such
199767f8919635c4928607450d9e0abb932109ceToomas Soomelicense, no part of this software or documentation may be
199767f8919635c4928607450d9e0abb932109ceToomas Soomereproduced, stored in a retrieval system, or transmitted in any
199767f8919635c4928607450d9e0abb932109ceToomas Soomeform or by any means without the express written consent of
199767f8919635c4928607450d9e0abb932109ceToomas SoomeIntel Corporation.
199767f8919635c4928607450d9e0abb932109ceToomas Soome EFI to compile bindings
199767f8919635c4928607450d9e0abb932109ceToomas SoomeRevision History
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Basic int types of various widths
199767f8919635c4928607450d9e0abb932109ceToomas Soome // No ANSI C 1999/2000 stdint.h integer width declarations
199767f8919635c4928607450d9e0abb932109ceToomas Soome // Use Microsoft C compiler integer width declarations
199767f8919635c4928607450d9e0abb932109ceToomas Soome // Use LP64 programming model from C_FLAGS for integer width declarations
199767f8919635c4928607450d9e0abb932109ceToomas Soome // Assume P64 programming model from C_FLAGS for integer width declarations
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif /* __FreeBSD__ */
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Basic EFI types of various widths
199767f8919635c4928607450d9e0abb932109ceToomas Soome//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
199767f8919635c4928607450d9e0abb932109ceToomas Soome// BugBug: Code to debug
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PLATFORM_IOBASE_ADDRESS (0xffffc000000 | BIT63)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PORT_TO_MEMD(_Port) (PLATFORM_IOBASE_ADDRESS | ( ( ( (_Port) & 0xfffc) << 10 ) | ( (_Port) & 0x0fff) ) )
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Macro's with casts make this much easier to use and read.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define PORT_TO_MEM8D(_Port) (*(UINT8 *)(PORT_TO_MEMD(_Port)))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define POST_CODE(_Data) (PORT_TO_MEM8D(0x80) = (_Data))
199767f8919635c4928607450d9e0abb932109ceToomas Soome// BugBug: End Debug Code!!!
199767f8919635c4928607450d9e0abb932109ceToomas Soome//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Pointers must be aligned to these address to function
199767f8919635c4928607450d9e0abb932109ceToomas Soome// you will get an alignment fault if this value is less than 8
199767f8919635c4928607450d9e0abb932109ceToomas Soome (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Define macros to create data structure signatures.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
199767f8919635c4928607450d9e0abb932109ceToomas Soome#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))
199767f8919635c4928607450d9e0abb932109ceToomas Soome// EFIAPI - prototype calling convention for EFI function pointers
199767f8919635c4928607450d9e0abb932109ceToomas Soome// BOOTSERVICE - prototype for implementation of a boot service interface
199767f8919635c4928607450d9e0abb932109ceToomas Soome// RUNTIMESERVICE - prototype for implementation of a runtime service interface
199767f8919635c4928607450d9e0abb932109ceToomas Soome// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
199767f8919635c4928607450d9e0abb932109ceToomas Soome// RUNTIME_CODE - pragma macro for declaring runtime code
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define EFIAPI // Substitute expresion to force C calling convention
199767f8919635c4928607450d9e0abb932109ceToomas Soome// BugBug: Need to find out if this is portable accross compliers.
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
199767f8919635c4928607450d9e0abb932109ceToomas Soome// When build similiar to FW, then link everything together as
199767f8919635c4928607450d9e0abb932109ceToomas Soome// one big module.
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
199767f8919635c4928607450d9e0abb932109ceToomas Soome// entry(NULL, ST)
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Some compilers don't support the forward reference construct:
199767f8919635c4928607450d9e0abb932109ceToomas Soome// typedef struct XXXXX
199767f8919635c4928607450d9e0abb932109ceToomas Soome// The following macro provide a workaround for such cases.