]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h
For ECP, disable ICC's remark #869: "Parameter" was never referenced warning.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / Ia32 / EfiBind.h
CommitLineData
3eb9473e 1/*++\r
2\r
b9b47808 3Copyright (c) 2004 - 2008, Intel Corporation \r
3eb9473e 4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiBind.h\r
15\r
16Abstract:\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
b9b47808 88#if __INTEL_COMPILER\r
89//\r
90// Disable ICC's warning: trailing comma is nonstandard\r
91//\r
92//#pragma warning ( disable : 271 )\r
93\r
94//\r
95// Disable ICC's warning: extra ";" ignored\r
96//\r
97#pragma warning ( disable : 424 )\r
98\r
99//\r
100// Disable ICC's warning: : variable "foo" was set but never used\r
101//\r
102#pragma warning ( disable : 593 )\r
103\r
104//\r
105// Disable ICC's remark #1418: external function definition with no prior declaration.\r
106// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
107//\r
108#pragma warning ( disable : 1418 )\r
109\r
110\r
111//\r
112// Disable ICC's remark #1419: external declaration in primary source file\r
113// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
114//\r
115#pragma warning ( disable : 1419 )\r
116\r
59a7e4f4 117//\r
118// Disable ICC's remark #869: "Parameter" was never referenced warning.\r
119// This is legal ANSI C code so we disable the remark that is turned on with -Wall\r
120//\r
121#pragma warning ( disable : 869 )\r
122\r
b9b47808 123#endif\r
124\r
125\r
3eb9473e 126#if _MSC_EXTENSIONS\r
127\r
128//\r
129// Disable warning that make it impossible to compile at /W4\r
130// This only works for Microsoft* tools\r
131//\r
132\r
133//\r
134// Disabling bitfield type checking warnings.\r
135//\r
136#pragma warning ( disable : 4214 )\r
137\r
138//\r
139// Disabling the unreferenced formal parameter warnings.\r
140//\r
141#pragma warning ( disable : 4100 )\r
142\r
143//\r
144// Disable slightly different base types warning as CHAR8 * can not be set\r
145// to a constant string.\r
146//\r
147#pragma warning ( disable : 4057 )\r
148\r
149//\r
150// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
151//\r
152#pragma warning ( disable : 4127 )\r
153\r
154//\r
155// Int64ShllMod32 unreferenced inline function\r
156//\r
157#pragma warning ( disable : 4514 )\r
158\r
159//\r
160// Unreferenced formal parameter - We are object oriented, so we pass This even\r
161// if we don't need them.\r
162//\r
163#pragma warning ( disable : 4100 )\r
164\r
165//\r
166// This warning is caused by empty (after preprocessing) souce file.\r
167//\r
168#pragma warning ( disable : 4206 )\r
169\r
170\r
171#endif\r
172\r
173\r
b9b47808 174#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
3eb9473e 175 //\r
176 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
177 //\r
178 \r
179 #if _MSC_EXTENSIONS \r
180 \r
181 //\r
182 // use Microsoft* C complier dependent interger width types \r
183 //\r
184 typedef unsigned __int64 uint64_t;\r
185 typedef __int64 int64_t;\r
186 typedef unsigned __int32 uint32_t;\r
187 typedef __int32 int32_t;\r
188 typedef unsigned short uint16_t;\r
189 typedef short int16_t;\r
190 typedef unsigned char uint8_t;\r
191 typedef char int8_t;\r
192 #else\r
193\r
194 //\r
195 // Assume standard IA-32 alignment. \r
196 // BugBug: Need to check portability of long long\r
197 //\r
198 typedef unsigned long long uint64_t;\r
199 typedef long long int64_t;\r
200 typedef unsigned int uint32_t;\r
201 typedef int int32_t;\r
202 typedef unsigned short uint16_t;\r
203 typedef short int16_t;\r
204 typedef unsigned char uint8_t;\r
205 typedef char int8_t;\r
206 #endif\r
207#else\r
208 //\r
209 // Use ANSI C 2000 stdint.h integer width declarations\r
210 //\r
211 #include "stdint.h"\r
212#endif\r
213\r
214//\r
215// Native integer size in stdint.h\r
216//\r
217typedef uint32_t uintn_t;\r
218typedef int32_t intn_t;\r
219\r
220//\r
221// Processor specific defines\r
222//\r
223#define EFI_MAX_BIT 0x80000000\r
224#define MAX_2_BITS 0xC0000000\r
225\r
226//\r
227// Maximum legal IA-32 address\r
228//\r
229#define EFI_MAX_ADDRESS 0xFFFFFFFF\r
230\r
231//\r
232// Bad pointer value to use in check builds.\r
233// if you see this value you are using uninitialized or free'ed data\r
234//\r
235#define EFI_BAD_POINTER 0xAFAFAFAF\r
236#define EFI_BAD_POINTER_AS_BYTE 0xAF\r
237\r
238//\r
239// Inject a break point in the code to assist debugging for NT Emulation Environment\r
240// For real hardware, just put in a halt loop. Don't do a while(1) because the\r
241// compiler will optimize away the rest of the function following, so that you run out in\r
242// the weeds if you skip over it with a debugger.\r
243//\r
0d37437d 244#ifdef _MSC_EXTENSIONS\r
3eb9473e 245#define EFI_BREAKPOINT() __asm { int 3 }\r
0d37437d 246#elif __GNUC__\r
247#define EFI_BREAKPOINT() asm(" int $3");\r
248#endif\r
249\r
3eb9473e 250#define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }\r
251\r
252//\r
253// Memory Fence forces serialization, and is needed to support out of order\r
254// memory transactions. The Memory Fence is mainly used to make sure IO\r
255// transactions complete in a deterministic sequence, and to syncronize locks\r
256// an other MP code. Currently no memory fencing is required.\r
257//\r
258#define MEMORY_FENCE()\r
259\r
260//\r
261// Some compilers don't support the forward reference construct:\r
262// typedef struct XXXXX. The forward reference is required for \r
263// ANSI compatibility.\r
264//\r
265// The following macro provide a workaround for such cases.\r
266//\r
267\r
268\r
269#ifdef EFI_NO_INTERFACE_DECL\r
270 #define EFI_FORWARD_DECLARATION(x)\r
271#else\r
272 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
273#endif\r
274\r
275\r
276//\r
277// Some C compilers optimize the calling conventions to increase performance.\r
278// _EFIAPI is used to make all public APIs follow the standard C calling \r
279// convention.\r
280//\r
281#if _MSC_EXTENSIONS\r
282 //\r
283 // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r
284 // \r
285\r
286 #define _EFIAPI __cdecl \r
287#else\r
288 #define _EFIAPI \r
289#endif\r
290\r
291\r
292#ifdef _EFI_WINNT\r
293\r
294 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
295 warning ( disable : 4142 )\r
296\r
297 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
298 warning ( default : 4142 )\r
299#else\r
300\r
301 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
302 warning ( disable : 4068 )\r
303\r
304 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
305 warning ( default : 4068 )\r
306\r
307#endif\r
308\r
297c148b 309//\r
310// For symbol name in GNU assembly code, an extra "_" is necessary\r
311//\r
312#if __GNUC__\r
4b79797e 313 #if defined(linux)\r
314 #define ASM_PFX(name) name\r
315 #else\r
316 #define ASM_PFX(name) _##name\r
317 #endif \r
297c148b 318#endif\r
3eb9473e 319\r
320#endif\r
321\r