199767f8919635c4928607450d9e0abb932109ceToomas Soome/* $FreeBSD$ */
199767f8919635c4928607450d9e0abb932109ceToomas Soome/*++
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas SoomeCopyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas SoomeThis program and the accompanying materials
199767f8919635c4928607450d9e0abb932109ceToomas Soomeare licensed and made available under the terms and conditions of the BSD License
199767f8919635c4928607450d9e0abb932109ceToomas Soomewhich accompanies this distribution. The full text of the license may be found at
199767f8919635c4928607450d9e0abb932109ceToomas Soomehttp://opensource.org/licenses/bsd-license.php
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas SoomeTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
199767f8919635c4928607450d9e0abb932109ceToomas SoomeWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas SoomeModule Name:
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome EfiBind.h
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas SoomeAbstract:
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome Processor or Compiler specific defines and types for IA-32.
199767f8919635c4928607450d9e0abb932109ceToomas Soome We are using the ANSI C 2000 _t type definitions for basic types.
199767f8919635c4928607450d9e0abb932109ceToomas Soome This it technically a violation of the coding standard, but they
199767f8919635c4928607450d9e0abb932109ceToomas Soome are used to make EfiTypes.h portable. Code other than EfiTypes.h
199767f8919635c4928607450d9e0abb932109ceToomas Soome should never use any ANSI C 2000 _t integer types.
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome--*/
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef _EFI_BIND_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define _EFI_BIND_H_
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_DRIVER_ENTRY_POINT(InitFunction)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Make sure we are useing the correct packing rules per EFI specification
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifndef __GNUC__
199767f8919635c4928607450d9e0abb932109ceToomas Soome#pragma pack()
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef __FreeBSD__
199767f8919635c4928607450d9e0abb932109ceToomas Soome#include <sys/stdint.h>
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Assume standard IA-32 alignment.
199767f8919635c4928607450d9e0abb932109ceToomas Soome// BugBug: Need to check portability of long long
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned long long uint64_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef long long int64_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned int uint32_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int int32_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned short uint16_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef short int16_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef unsigned char uint8_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef signed char int8_t;
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef uint64_t UINT64;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int64_t INT64;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef uint32_t UINT32;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int32_t INT32;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef uint16_t UINT16;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int16_t INT16;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef uint8_t UINT8;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int8_t INT8;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#undef VOID
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define VOID void
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Native integer size in stdint.h
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef uint32_t UINTN;
199767f8919635c4928607450d9e0abb932109ceToomas Soometypedef int32_t INTN;
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFIERR(a) (0x80000000 | a)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_ERROR_MASK 0x80000000
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFIERR_OEM(a) (0xc0000000 | a)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Processor specific defines
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_MAX_BIT 0x80000000
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MAX_2_BITS 0xC0000000
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Maximum legal IA-32 address
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_MAX_ADDRESS 0xFFFFFFFF
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Bad pointer value to use in check builds.
199767f8919635c4928607450d9e0abb932109ceToomas Soome// if you see this value you are using uninitialized or free'ed data
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_BAD_POINTER 0xAFAFAFAF
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_BAD_POINTER_AS_BYTE 0xAF
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Inject a break point in the code to assist debugging for NT Emulation Environment
199767f8919635c4928607450d9e0abb932109ceToomas Soome// For real hardware, just put in a halt loop. Don't do a while(1) because the
199767f8919635c4928607450d9e0abb932109ceToomas Soome// compiler will optimize away the rest of the function following, so that you run out in
199767f8919635c4928607450d9e0abb932109ceToomas Soome// the weeds if you skip over it with a debugger.
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFI_BREAKPOINT EFI_DEADLOOP()
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Memory Fence forces serialization, and is needed to support out of order
199767f8919635c4928607450d9e0abb932109ceToomas Soome// memory transactions. The Memory Fence is mainly used to make sure IO
199767f8919635c4928607450d9e0abb932109ceToomas Soome// transactions complete in a deterministic sequence, and to syncronize locks
199767f8919635c4928607450d9e0abb932109ceToomas Soome// an other MP code. Currently no memory fencing is required.
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define MEMORY_FENCE()
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Some compilers don't support the forward reference construct:
199767f8919635c4928607450d9e0abb932109ceToomas Soome// typedef struct XXXXX. The forward reference is required for
199767f8919635c4928607450d9e0abb932109ceToomas Soome// ANSI compatibility.
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// The following macro provide a workaround for such cases.
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#ifdef EFI_NO_INTERFACE_DECL
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define EFI_FORWARD_DECLARATION(x)
199767f8919635c4928607450d9e0abb932109ceToomas Soome#else
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// Some C compilers optimize the calling conventions to increase performance.
199767f8919635c4928607450d9e0abb932109ceToomas Soome// EFIAPI is used to make all public APIs follow the standard C calling
199767f8919635c4928607450d9e0abb932109ceToomas Soome// convention.
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define EFIAPI
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome// For symbol name in GNU assembly code, an extra "_" is necessary
199767f8919635c4928607450d9e0abb932109ceToomas Soome//
199767f8919635c4928607450d9e0abb932109ceToomas Soome#if defined(__GNUC__)
199767f8919635c4928607450d9e0abb932109ceToomas Soome ///
199767f8919635c4928607450d9e0abb932109ceToomas Soome /// Private worker functions for ASM_PFX()
199767f8919635c4928607450d9e0abb932109ceToomas Soome ///
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define _CONCATENATE(a, b) __CONCATENATE(a, b)
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define __CONCATENATE(a, b) a ## b
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome ///
199767f8919635c4928607450d9e0abb932109ceToomas Soome /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
199767f8919635c4928607450d9e0abb932109ceToomas Soome /// on symbols in assembly language.
199767f8919635c4928607450d9e0abb932109ceToomas Soome ///
199767f8919635c4928607450d9e0abb932109ceToomas Soome #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#define INTERFACE_DECL(x) struct x
199767f8919635c4928607450d9e0abb932109ceToomas Soome
199767f8919635c4928607450d9e0abb932109ceToomas Soome#endif