]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h
For ECP, disable ICC's remark #869: "Parameter" was never referenced warning.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / X64 / EfiBind.h
CommitLineData
3eb9473e 1/*++\r
2\r
4b79797e 3Copyright (c) 2005 - 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 x64.\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\r
30#define EFI_DRIVER_ENTRY_POINT(InitFunction) \r
31#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r
32\r
33\r
34\r
35//\r
36// Make sure we are useing the correct packing rules per EFI specification\r
37//\r
38#pragma pack()\r
39\r
4cb43192 40#if __INTEL_COMPILER\r
41//\r
42// Disable ICC's warning: trailing comma is nonstandard\r
43//\r
44//#pragma warning ( disable : 271 )\r
45\r
46//\r
47// Disable ICC's warning: extra ";" ignored\r
48//\r
49#pragma warning ( disable : 424 )\r
50\r
51//\r
52// Disable ICC's warning: : variable "foo" was set but never used\r
53//\r
54#pragma warning ( disable : 593 )\r
55\r
56//\r
57// Disable ICC's remark #1418: external function definition with no prior declaration.\r
58// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
59//\r
60#pragma warning ( disable : 1418 )\r
61\r
62\r
63//\r
64// Disable ICC's remark #1419: external declaration in primary source file\r
65// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
66//\r
67#pragma warning ( disable : 1419 )\r
68\r
59a7e4f4 69//\r
70// Disable ICC's remark #869: "Parameter" was never referenced warning.\r
71// This is legal ANSI C code so we disable the remark that is turned on with -Wall\r
72//\r
73#pragma warning ( disable : 869 )\r
74\r
4cb43192 75#endif\r
76\r
77\r
3eb9473e 78#if _MSC_EXTENSIONS\r
79\r
80//\r
81// Disable warning that make it impossible to compile at /W4\r
82// This only works for Microsoft* tools\r
83//\r
84\r
85//\r
86// Disabling bitfield type checking warnings.\r
87//\r
88#pragma warning ( disable : 4214 )\r
89\r
90//\r
91// Disabling the unreferenced formal parameter warnings.\r
92//\r
93#pragma warning ( disable : 4100 )\r
94\r
95//\r
96// Disable slightly different base types warning as CHAR8 * can not be set\r
97// to a constant string.\r
98//\r
99#pragma warning ( disable : 4057 )\r
100\r
101//\r
102// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
103//\r
104#pragma warning ( disable : 4127 )\r
105\r
106//\r
107// Int64ShllMod32 unreferenced inline function\r
108//\r
109#pragma warning ( disable : 4514 )\r
110\r
111//\r
112// Unreferenced formal parameter - We are object oriented, so we pass This even\r
113// if we don't need them.\r
114//\r
115#pragma warning ( disable : 4100 )\r
116\r
117//\r
118// This warning is caused by empty (after preprocessing) souce file.\r
119//\r
120#pragma warning ( disable : 4206 )\r
121\r
122//\r
123// Warning: The result of the unary '&' operator may be unaligned. Ignore it.\r
124//\r
125#pragma warning ( disable : 4366 )\r
126\r
127#endif\r
128\r
129\r
4cb43192 130#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
3eb9473e 131 //\r
132 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
133 //\r
134 \r
135 #if _MSC_EXTENSIONS \r
136 \r
137 //\r
138 // use Microsoft* C complier dependent interger width types \r
139 //\r
140 typedef unsigned __int64 uint64_t;\r
141 typedef __int64 int64_t;\r
142 typedef unsigned __int32 uint32_t;\r
143 typedef __int32 int32_t;\r
144 typedef unsigned short uint16_t;\r
145 typedef short int16_t;\r
146 typedef unsigned char uint8_t;\r
147 typedef char int8_t;\r
148 #else\r
149\r
150 //\r
151 // Assume standard IA-32 alignment. \r
152 // BugBug: Need to check portability of long long\r
153 //\r
154 typedef unsigned long long uint64_t;\r
155 typedef long long int64_t;\r
156 typedef unsigned int uint32_t;\r
157 typedef int int32_t;\r
158 typedef unsigned short uint16_t;\r
159 typedef short int16_t;\r
160 typedef unsigned char uint8_t;\r
161 typedef char int8_t;\r
162 #endif\r
163#else\r
164 //\r
165 // Use ANSI C 2000 stdint.h integer width declarations\r
166 //\r
167 #include "stdint.h"\r
168#endif\r
169\r
170//\r
171// Native integer size in stdint.h\r
172//\r
173typedef uint64_t uintn_t;\r
174typedef int64_t intn_t;\r
175\r
176//\r
177// Processor specific defines\r
178//\r
96703427 179#define EFI_MAX_BIT 0x8000000000000000ULL\r
180#define MAX_2_BITS 0xC000000000000000ULL\r
3eb9473e 181\r
182//\r
183// Maximum legal IA-32 address\r
184//\r
96703427 185#define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
3eb9473e 186\r
187//\r
188// Bad pointer value to use in check builds.\r
189// if you see this value you are using uninitialized or free'ed data\r
190//\r
96703427 191#define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAFULL\r
3eb9473e 192#define EFI_BAD_POINTER_AS_BYTE 0xAF\r
193\r
194//\r
195// Inject a break point in the code to assist debugging.\r
196//\r
197#define EFI_DEADLOOP() { volatile int __iii; __iii = 1; while (__iii); }\r
88b6bcec 198#if _MSC_EXTENSIONS \r
199 #define EFI_BREAKPOINT() __debugbreak()\r
200#elif __GNUC__\r
201 #define EFI_BREAKPOINT() asm(" int $3");\r
202#endif\r
3eb9473e 203\r
204//\r
205// Memory Fence forces serialization, and is needed to support out of order\r
206// memory transactions. The Memory Fence is mainly used to make sure IO\r
207// transactions complete in a deterministic sequence, and to syncronize locks\r
208// an other MP code. Currently no memory fencing is required.\r
209//\r
210#define MEMORY_FENCE()\r
211\r
212//\r
213// Some compilers don't support the forward reference construct:\r
214// typedef struct XXXXX. The forward reference is required for \r
215// ANSI compatibility.\r
216//\r
217// The following macro provide a workaround for such cases.\r
218//\r
219\r
220\r
221#ifdef EFI_NO_INTERFACE_DECL\r
222 #define EFI_FORWARD_DECLARATION(x)\r
223#else\r
224 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
225#endif\r
226\r
227\r
228//\r
229// Some C compilers optimize the calling conventions to increase performance.\r
230// _EFIAPI is used to make all public APIs follow the standard C calling \r
231// convention.\r
232//\r
233#if _MSC_EXTENSIONS\r
234 //\r
235 // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r
236 // \r
237\r
238 #define _EFIAPI __cdecl \r
239#else\r
240 #define _EFIAPI \r
241#endif\r
242\r
243\r
244#ifdef _EFI_WINNT\r
245\r
246 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
247 warning ( disable : 4142 )\r
248\r
249 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
250 warning ( default : 4142 )\r
251#else\r
252\r
253 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
254 warning ( disable : 4068 )\r
255\r
256 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
257 warning ( default : 4068 )\r
258\r
259#endif\r
260\r
297c148b 261//\r
262// For symbol name in GNU assembly code, an extra "_" is necessary\r
263//\r
264#if __GNUC__\r
4b79797e 265 #if defined(linux)\r
266 #define ASM_PFX(name) name\r
267 #else\r
268 #define ASM_PFX(name) _##name\r
269 #endif \r
297c148b 270#endif\r
3eb9473e 271\r
272#endif\r
273\r