]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h
ICC Cleanup:
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / Ipf / EfiBind.h
1 /*++
2
3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 EfiBind.h
15
16 Abstract:
17
18 Processor or Compiler specific defines and types for Intel Itanium(TM).
19 We are using the ANSI C 2000 _t type definitions for basic types.
20 This it technically a violation of the coding standard, but they
21 are used to make EfiTypes.h portable. Code other than EfiTypes.h
22 should never use any ANSI C 2000 _t integer types.
23
24 --*/
25
26 #ifndef _EFI_BIND_H_
27 #define _EFI_BIND_H_
28
29
30 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
31
32 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
33
34
35
36
37 //
38 // Make sure we are useing the correct packing rules per EFI specification
39 //
40 #pragma pack()
41
42
43 #if _MSC_EXTENSIONS
44
45 #if __INTEL_COMPILER
46
47 //
48 // Disable the extra ";" warning;
49 // All places referencing EFI_GUID_STRING MACRO will generate this error.
50 //
51 #pragma warning ( disable : 424 )
52
53 //
54 // error #593: variable "Status" was set but never used
55 // This error may be flagged if a function only do ASSERT on return status when
56 // EFI_DEBUG is not defined (EDK's ASSERT will be defined as empty statement).
57 // To make EdkCompatibilityPkg buildable by ICC with EFI_DEBUG undefined, disable
58 // this warning.
59 //
60 #pragma warning ( disable : 593 )
61
62 //
63 // Disable ICC's remark #869: "Parameter" was never referenced warning.
64 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
65 //
66 #pragma warning ( disable : 869 )
67
68 //
69 // Disable ICC's remark #1418: external function definition with no prior declaration.
70 // This is legal ANSI C code so we disable the remark that is turned on with /W4
71 //
72 #pragma warning ( disable : 1418 )
73
74 //
75 // Disable ICC's remark #1419: external declaration in primary source file
76 // This is legal ANSI C code so we disable the remark that is turned on with /W4
77 //
78 #pragma warning ( disable : 1419 )
79
80 #endif
81
82
83
84 //
85 // Disable warning that make it impossible to compile at /W4
86 // This only works for Microsoft tools. Copied from the
87 // IA-32 version of efibind.h
88 //
89
90 //
91 // Disabling bitfield type checking warnings.
92 //
93 #pragma warning ( disable : 4214 )
94
95
96 // Disabling the unreferenced formal parameter warnings.
97 //
98 #pragma warning ( disable : 4100 )
99
100 //
101 // Disable slightly different base types warning as CHAR8 * can not be set
102 // to a constant string.
103 //
104 #pragma warning ( disable : 4057 )
105
106 //
107 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
108 //
109 #pragma warning ( disable : 4127 )
110
111 //
112 // Can not cast a function pointer to a data pointer. We need to do this on
113 // IPF to get access to the PLABEL.
114 //
115 #pragma warning ( disable : 4514 )
116
117 //
118 // Int64ShllMod32 unreferenced inline function
119 //
120 #pragma warning ( disable : 4054 )
121
122 //
123 // Unreferenced formal parameter - We are object oriented, so we pass This even
124 // if we don't need them.
125 //
126 #pragma warning ( disable : 4100 )
127
128 //
129 // This warning is caused by empty (after preprocessing) souce file.
130 //
131 #pragma warning ( disable : 4206 )
132
133 //
134 // Warning: The result of the unary '&' operator may be unaligned. Ignore it.
135 //
136 #pragma warning ( disable : 4366 )
137
138 #endif
139
140
141 #if (__STDC_VERSION__ < 199901L)
142 //
143 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
144 //
145
146 #if _MSC_EXTENSIONS
147
148
149 //
150 // use Microsoft C complier dependent interger width types
151 //
152 typedef unsigned __int64 uint64_t;
153 typedef __int64 int64_t;
154 typedef unsigned __int32 uint32_t;
155 typedef __int32 int32_t;
156 typedef unsigned short uint16_t;
157 typedef short int16_t;
158 typedef unsigned char uint8_t;
159 typedef char int8_t;
160 #else
161 #ifdef _EFI_P64
162 //
163 // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
164 // are 32-bits
165 //
166 typedef unsigned long long uint64_t;
167 typedef long long int64_t;
168 typedef unsigned int uint32_t;
169 typedef int int32_t;
170 typedef unsigned short uint16_t;
171 typedef short int16_t;
172 typedef unsigned char uint8_t;
173 typedef char int8_t;
174 #else
175 //
176 // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
177 //
178 typedef unsigned long uint64_t;
179 typedef long int64_t;
180 typedef unsigned int uint32_t;
181 typedef int int32_t;
182 typedef unsigned short uint16_t;
183 typedef short int16_t;
184 typedef unsigned char uint8_t;
185 typedef char int8_t;
186 #endif
187 #endif
188 #else
189 //
190 // Use ANSI C 2000 stdint.h integer width declarations
191 //
192 #include "stdint.h"
193 #endif
194
195 //
196 // Native integer size in stdint.h
197 //
198 typedef uint64_t uintn_t;
199 typedef int64_t intn_t;
200
201 //
202 // Processor specific defines
203 //
204 #define EFI_MAX_BIT 0x8000000000000000
205 #define MAX_2_BITS 0xC000000000000000
206
207 //
208 // Maximum legal Itanium-based address
209 //
210 #define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
211
212 //
213 // Bad pointer value to use in check builds.
214 // if you see this value you are using uninitialized or free'ed data
215 //
216 #define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAF
217 #define EFI_BAD_POINTER_AS_BYTE 0xAF
218
219 //
220 // Inject a break point in the code to assist debugging.
221 //
222 #pragma intrinsic (__break)
223 #define EFI_BREAKPOINT() __break(0)
224 #define EFI_DEADLOOP() while(TRUE)
225
226 //
227 // Memory Fence forces serialization, and is needed to support out of order
228 // memory transactions. The Memory Fence is mainly used to make sure IO
229 // transactions complete in a deterministic sequence, and to syncronize locks
230 // an other MP code. Intel Itanium(TM) processors require explicit memory fence instructions
231 // after every IO. Need to find a way of doing that in the function _mf.
232 //
233 void __mfa (void);
234 #pragma intrinsic (__mfa)
235 #define MEMORY_FENCE() __mfa()
236
237
238 //
239 // Some compilers don't support the forward reference construct:
240 // typedef struct XXXXX. The forward reference is required for
241 // ANSI compatibility.
242 //
243 // The following macro provide a workaround for such cases.
244 //
245
246
247 #ifdef EFI_NO_INTERFACE_DECL
248 #define EFI_FORWARD_DECLARATION(x)
249 #else
250 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
251 #endif
252
253 //
254 // Some C compilers optimize the calling conventions to increase performance.
255 // _EFIAPI is used to make all public APIs follow the standard C calling
256 // convention.
257 //
258
259 #if _MSC_EXTENSIONS
260 #define _EFIAPI __cdecl
261 #else
262 #define _EFIAPI
263 #endif
264
265
266 #ifdef _EFI_WINNT
267
268 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
269 warning ( disable : 4142 )
270
271 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
272 warning ( default : 4142 )
273 #else
274
275 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
276 warning ( disable : 4068 )
277
278 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
279 warning ( default : 4068 )
280
281
282 #endif
283
284
285 #endif
286