4 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 Processor or Compiler specific defines and types for IA-32.
21 We are using the ANSI C 2000 _t type definitions for basic types.
22 This it technically a violation of the coding standard, but they
23 are used to make EfiTypes.h portable. Code other than EfiTypes.h
24 should never use any ANSI C 2000 _t integer types.
32 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
33 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
37 // Make sure we are using the correct packing rules per EFI specification
45 #include <sys/stdint.h>
48 // Assume standard IA-32 alignment.
49 // BugBug: Need to check portability of long long
51 typedef unsigned long long uint64_t;
52 typedef long long int64_t;
53 typedef unsigned int uint32_t;
55 typedef unsigned short uint16_t;
56 typedef short int16_t;
57 typedef unsigned char uint8_t;
58 typedef signed char int8_t;
61 typedef uint64_t UINT64;
62 typedef int64_t INT64;
63 typedef uint32_t UINT32;
64 typedef int32_t INT32;
65 typedef uint16_t UINT16;
66 typedef int16_t INT16;
67 typedef uint8_t UINT8;
74 // Native integer size in stdint.h
76 typedef uint32_t UINTN;
79 #define EFIERR(a) (0x80000000 | a)
80 #define EFI_ERROR_MASK 0x80000000
81 #define EFIERR_OEM(a) (0xc0000000 | a)
84 // Processor specific defines
86 #define EFI_MAX_BIT 0x80000000
87 #define MAX_2_BITS 0xC0000000
90 // Maximum legal IA-32 address
92 #define EFI_MAX_ADDRESS 0xFFFFFFFF
95 // Bad pointer value to use in check builds.
96 // if you see this value you are using uninitialized or free'ed data
98 #define EFI_BAD_POINTER 0xAFAFAFAF
99 #define EFI_BAD_POINTER_AS_BYTE 0xAF
101 #define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }
104 // Inject a break point in the code to assist debugging for NT Emulation Environment
105 // For real hardware, just put in a halt loop. Don't do a while(1) because the
106 // compiler will optimize away the rest of the function following, so that you run out in
107 // the weeds if you skip over it with a debugger.
109 #define EFI_BREAKPOINT EFI_DEADLOOP()
113 // Memory Fence forces serialization, and is needed to support out of order
114 // memory transactions. The Memory Fence is mainly used to make sure IO
115 // transactions complete in a deterministic sequence, and to syncronize locks
116 // an other MP code. Currently no memory fencing is required.
118 #define MEMORY_FENCE()
121 // Some compilers don't support the forward reference construct:
122 // typedef struct XXXXX. The forward reference is required for
123 // ANSI compatibility.
125 // The following macro provide a workaround for such cases.
129 #ifdef EFI_NO_INTERFACE_DECL
130 #define EFI_FORWARD_DECLARATION(x)
132 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
137 // Some C compilers optimize the calling conventions to increase performance.
138 // EFIAPI is used to make all public APIs follow the standard C calling
146 // For symbol name in GNU assembly code, an extra "_" is necessary
148 #if defined(__GNUC__)
150 /// Private worker functions for ASM_PFX()
152 #define _CONCATENATE(a, b) __CONCATENATE(a, b)
153 #define __CONCATENATE(a, b) a ## b
156 /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
157 /// on symbols in assembly language.
159 #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
163 #define INTERFACE_DECL(x) struct x