]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
c7f33ca4 | 3 | Copyright (c) 2004 - 2007, Intel Corporation \r |
3eb9473e | 4 | All rights reserved. This program and the accompanying materials \r |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | EfiBind.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Processor or Compiler specific defines and types for IA-32.\r | |
19 | We are using the ANSI C 2000 _t type definitions for basic types.\r | |
20 | This it technically a violation of the coding standard, but they\r | |
21 | are used to make EfiTypes.h portable. Code other than EfiTypes.h\r | |
22 | should never use any ANSI C 2000 _t integer types.\r | |
23 | \r | |
24 | --*/\r | |
25 | \r | |
26 | #ifndef _EFI_BIND_H_\r | |
27 | #define _EFI_BIND_H_\r | |
28 | \r | |
29 | #ifdef EFI_DEBUG\r | |
30 | \r | |
31 | #ifdef EFI_NT_EMULATOR\r | |
32 | \r | |
33 | #define EFI_DRIVER_ENTRY_POINT(InitFunction) \\r | |
34 | EFI_STATUS \\r | |
35 | EFIAPI \\r | |
36 | InitFunction ( \\r | |
37 | EFI_HANDLE ImageHandle, \\r | |
38 | EFI_SYSTEM_TABLE *SystemTable \\r | |
39 | ); \\r | |
40 | \\r | |
41 | UINTN \\r | |
42 | __stdcall \\r | |
43 | _DllMainCRTStartup ( \\r | |
44 | UINTN Inst, \\r | |
45 | UINTN reason_for_call, \\r | |
46 | VOID *rserved \\r | |
47 | ) \\r | |
48 | { \\r | |
49 | return 1; \\r | |
50 | } \\r | |
51 | \\r | |
c7f33ca4 | 52 | EFI_STATUS \\r |
3eb9473e | 53 | __declspec( dllexport ) \\r |
54 | __cdecl \\r | |
55 | InitializeDriver ( \\r | |
c7f33ca4 | 56 | EFI_HANDLE ImageHandle, \\r |
57 | EFI_SYSTEM_TABLE *SystemTable \\r | |
3eb9473e | 58 | ) \\r |
59 | { \\r | |
60 | return InitFunction(ImageHandle, SystemTable); \\r | |
61 | }\r | |
62 | \r | |
63 | #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r | |
64 | \r | |
65 | #else\r | |
66 | \r | |
67 | #define EFI_DRIVER_ENTRY_POINT(InitFunction) \r | |
68 | #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r | |
69 | \r | |
70 | #endif\r | |
71 | \r | |
72 | #else\r | |
73 | \r | |
74 | #define EFI_DRIVER_ENTRY_POINT(InitFunction) \r | |
75 | #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r | |
76 | \r | |
77 | #endif\r | |
78 | \r | |
79 | \r | |
80 | \r | |
81 | \r | |
82 | \r | |
83 | //\r | |
84 | // Make sure we are useing the correct packing rules per EFI specification\r | |
85 | //\r | |
86 | #pragma pack()\r | |
87 | \r | |
88 | #if _MSC_EXTENSIONS\r | |
89 | \r | |
90 | //\r | |
91 | // Disable warning that make it impossible to compile at /W4\r | |
92 | // This only works for Microsoft* tools\r | |
93 | //\r | |
94 | \r | |
95 | //\r | |
96 | // Disabling bitfield type checking warnings.\r | |
97 | //\r | |
98 | #pragma warning ( disable : 4214 )\r | |
99 | \r | |
100 | //\r | |
101 | // Disabling the unreferenced formal parameter warnings.\r | |
102 | //\r | |
103 | #pragma warning ( disable : 4100 )\r | |
104 | \r | |
105 | //\r | |
106 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
107 | // to a constant string.\r | |
108 | //\r | |
109 | #pragma warning ( disable : 4057 )\r | |
110 | \r | |
111 | //\r | |
112 | // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r | |
113 | //\r | |
114 | #pragma warning ( disable : 4127 )\r | |
115 | \r | |
116 | //\r | |
117 | // Int64ShllMod32 unreferenced inline function\r | |
118 | //\r | |
119 | #pragma warning ( disable : 4514 )\r | |
120 | \r | |
121 | //\r | |
122 | // Unreferenced formal parameter - We are object oriented, so we pass This even\r | |
123 | // if we don't need them.\r | |
124 | //\r | |
125 | #pragma warning ( disable : 4100 )\r | |
126 | \r | |
127 | //\r | |
128 | // This warning is caused by empty (after preprocessing) souce file.\r | |
129 | //\r | |
130 | #pragma warning ( disable : 4206 )\r | |
131 | \r | |
132 | \r | |
133 | #endif\r | |
134 | \r | |
135 | \r | |
136 | #if (__STDC_VERSION__ < 199901L)\r | |
137 | //\r | |
138 | // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r | |
139 | //\r | |
140 | \r | |
141 | #if _MSC_EXTENSIONS \r | |
142 | \r | |
143 | //\r | |
144 | // use Microsoft* C complier dependent interger width types \r | |
145 | //\r | |
146 | typedef unsigned __int64 uint64_t;\r | |
147 | typedef __int64 int64_t;\r | |
148 | typedef unsigned __int32 uint32_t;\r | |
149 | typedef __int32 int32_t;\r | |
150 | typedef unsigned short uint16_t;\r | |
151 | typedef short int16_t;\r | |
152 | typedef unsigned char uint8_t;\r | |
153 | typedef char int8_t;\r | |
154 | #else\r | |
155 | \r | |
156 | //\r | |
157 | // Assume standard IA-32 alignment. \r | |
158 | // BugBug: Need to check portability of long long\r | |
159 | //\r | |
160 | typedef unsigned long long uint64_t;\r | |
161 | typedef long long int64_t;\r | |
162 | typedef unsigned int uint32_t;\r | |
163 | typedef int int32_t;\r | |
164 | typedef unsigned short uint16_t;\r | |
165 | typedef short int16_t;\r | |
166 | typedef unsigned char uint8_t;\r | |
167 | typedef char int8_t;\r | |
168 | #endif\r | |
169 | #else\r | |
170 | //\r | |
171 | // Use ANSI C 2000 stdint.h integer width declarations\r | |
172 | //\r | |
173 | #include "stdint.h"\r | |
174 | #endif\r | |
175 | \r | |
176 | //\r | |
177 | // Native integer size in stdint.h\r | |
178 | //\r | |
179 | typedef uint32_t uintn_t;\r | |
180 | typedef int32_t intn_t;\r | |
181 | \r | |
182 | //\r | |
183 | // Processor specific defines\r | |
184 | //\r | |
185 | #define EFI_MAX_BIT 0x80000000\r | |
186 | #define MAX_2_BITS 0xC0000000\r | |
187 | \r | |
188 | //\r | |
189 | // Maximum legal IA-32 address\r | |
190 | //\r | |
191 | #define EFI_MAX_ADDRESS 0xFFFFFFFF\r | |
192 | \r | |
193 | //\r | |
194 | // Bad pointer value to use in check builds.\r | |
195 | // if you see this value you are using uninitialized or free'ed data\r | |
196 | //\r | |
197 | #define EFI_BAD_POINTER 0xAFAFAFAF\r | |
198 | #define EFI_BAD_POINTER_AS_BYTE 0xAF\r | |
199 | \r | |
200 | //\r | |
201 | // Inject a break point in the code to assist debugging for NT Emulation Environment\r | |
202 | // For real hardware, just put in a halt loop. Don't do a while(1) because the\r | |
203 | // compiler will optimize away the rest of the function following, so that you run out in\r | |
204 | // the weeds if you skip over it with a debugger.\r | |
205 | //\r | |
206 | #define EFI_BREAKPOINT() __asm { int 3 }\r | |
207 | #define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }\r | |
208 | \r | |
209 | //\r | |
210 | // Memory Fence forces serialization, and is needed to support out of order\r | |
211 | // memory transactions. The Memory Fence is mainly used to make sure IO\r | |
212 | // transactions complete in a deterministic sequence, and to syncronize locks\r | |
213 | // an other MP code. Currently no memory fencing is required.\r | |
214 | //\r | |
215 | #define MEMORY_FENCE()\r | |
216 | \r | |
217 | //\r | |
218 | // Some compilers don't support the forward reference construct:\r | |
219 | // typedef struct XXXXX. The forward reference is required for \r | |
220 | // ANSI compatibility.\r | |
221 | //\r | |
222 | // The following macro provide a workaround for such cases.\r | |
223 | //\r | |
224 | \r | |
225 | \r | |
226 | #ifdef EFI_NO_INTERFACE_DECL\r | |
227 | #define EFI_FORWARD_DECLARATION(x)\r | |
228 | #else\r | |
229 | #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r | |
230 | #endif\r | |
231 | \r | |
232 | \r | |
233 | //\r | |
234 | // Some C compilers optimize the calling conventions to increase performance.\r | |
235 | // _EFIAPI is used to make all public APIs follow the standard C calling \r | |
236 | // convention.\r | |
237 | //\r | |
238 | #if _MSC_EXTENSIONS\r | |
239 | //\r | |
240 | // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r | |
241 | // \r | |
242 | \r | |
243 | #define _EFIAPI __cdecl \r | |
244 | #else\r | |
245 | #define _EFIAPI \r | |
246 | #endif\r | |
247 | \r | |
248 | \r | |
249 | #ifdef _EFI_WINNT\r | |
250 | \r | |
251 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
252 | warning ( disable : 4142 )\r | |
253 | \r | |
254 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
255 | warning ( default : 4142 )\r | |
256 | #else\r | |
257 | \r | |
258 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
259 | warning ( disable : 4068 )\r | |
260 | \r | |
261 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
262 | warning ( default : 4068 )\r | |
263 | \r | |
264 | #endif\r | |
265 | \r | |
266 | \r | |
267 | \r | |
268 | #endif\r | |
269 | \r |