]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Include/Ipf/EfiBind.h
Add in the 1st version of ECP.
[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 //
46 // Disable warning that make it impossible to compile at /W4
47 // This only works for Microsoft tools. Copied from the
48 // IA-32 version of efibind.h
49 //
50
51 //
52 // Disabling bitfield type checking warnings.
53 //
54 #pragma warning ( disable : 4214 )
55
56
57 // Disabling the unreferenced formal parameter warnings.
58 //
59 #pragma warning ( disable : 4100 )
60
61 //
62 // Disable slightly different base types warning as CHAR8 * can not be set
63 // to a constant string.
64 //
65 #pragma warning ( disable : 4057 )
66
67 //
68 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
69 //
70 #pragma warning ( disable : 4127 )
71
72 //
73 // Can not cast a function pointer to a data pointer. We need to do this on
74 // IPF to get access to the PLABEL.
75 //
76 #pragma warning ( disable : 4514 )
77
78 //
79 // Int64ShllMod32 unreferenced inline function
80 //
81 #pragma warning ( disable : 4054 )
82
83 //
84 // Unreferenced formal parameter - We are object oriented, so we pass This even
85 // if we don't need them.
86 //
87 #pragma warning ( disable : 4100 )
88
89 //
90 // This warning is caused by empty (after preprocessing) souce file.
91 //
92 #pragma warning ( disable : 4206 )
93
94 //
95 // Warning: The result of the unary '&' operator may be unaligned. Ignore it.
96 //
97 #pragma warning ( disable : 4366 )
98
99 #endif
100
101
102 #if (__STDC_VERSION__ < 199901L)
103 //
104 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
105 //
106
107 #if _MSC_EXTENSIONS
108
109
110 //
111 // use Microsoft C complier dependent interger width types
112 //
113 typedef unsigned __int64 uint64_t;
114 typedef __int64 int64_t;
115 typedef unsigned __int32 uint32_t;
116 typedef __int32 int32_t;
117 typedef unsigned short uint16_t;
118 typedef short int16_t;
119 typedef unsigned char uint8_t;
120 typedef char int8_t;
121 #else
122 #ifdef _EFI_P64
123 //
124 // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
125 // are 32-bits
126 //
127 typedef unsigned long long uint64_t;
128 typedef long long int64_t;
129 typedef unsigned int uint32_t;
130 typedef int int32_t;
131 typedef unsigned short uint16_t;
132 typedef short int16_t;
133 typedef unsigned char uint8_t;
134 typedef char int8_t;
135 #else
136 //
137 // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
138 //
139 typedef unsigned long uint64_t;
140 typedef long int64_t;
141 typedef unsigned int uint32_t;
142 typedef int int32_t;
143 typedef unsigned short uint16_t;
144 typedef short int16_t;
145 typedef unsigned char uint8_t;
146 typedef char int8_t;
147 #endif
148 #endif
149 #else
150 //
151 // Use ANSI C 2000 stdint.h integer width declarations
152 //
153 #include "stdint.h"
154 #endif
155
156 //
157 // Native integer size in stdint.h
158 //
159 typedef uint64_t uintn_t;
160 typedef int64_t intn_t;
161
162 //
163 // Processor specific defines
164 //
165 #define EFI_MAX_BIT 0x8000000000000000
166 #define MAX_2_BITS 0xC000000000000000
167
168 //
169 // Maximum legal Itanium-based address
170 //
171 #define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
172
173 //
174 // Bad pointer value to use in check builds.
175 // if you see this value you are using uninitialized or free'ed data
176 //
177 #define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAF
178 #define EFI_BAD_POINTER_AS_BYTE 0xAF
179
180 //
181 // Inject a break point in the code to assist debugging.
182 //
183 #pragma intrinsic (__break)
184 #define EFI_BREAKPOINT() __break(0)
185 #define EFI_DEADLOOP() while(TRUE)
186
187 //
188 // Memory Fence forces serialization, and is needed to support out of order
189 // memory transactions. The Memory Fence is mainly used to make sure IO
190 // transactions complete in a deterministic sequence, and to syncronize locks
191 // an other MP code. Intel Itanium(TM) processors require explicit memory fence instructions
192 // after every IO. Need to find a way of doing that in the function _mf.
193 //
194 void __mfa (void);
195 #pragma intrinsic (__mfa)
196 #define MEMORY_FENCE() __mfa()
197
198
199 //
200 // Some compilers don't support the forward reference construct:
201 // typedef struct XXXXX. The forward reference is required for
202 // ANSI compatibility.
203 //
204 // The following macro provide a workaround for such cases.
205 //
206
207
208 #ifdef EFI_NO_INTERFACE_DECL
209 #define EFI_FORWARD_DECLARATION(x)
210 #else
211 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
212 #endif
213
214 //
215 // Some C compilers optimize the calling conventions to increase performance.
216 // _EFIAPI is used to make all public APIs follow the standard C calling
217 // convention.
218 //
219
220 #if _MSC_EXTENSIONS
221 #define _EFIAPI __cdecl
222 #else
223 #define _EFIAPI
224 #endif
225
226
227 #ifdef _EFI_WINNT
228
229 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
230 warning ( disable : 4142 )
231
232 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
233 warning ( default : 4142 )
234 #else
235
236 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
237 warning ( disable : 4068 )
238
239 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
240 warning ( default : 4068 )
241
242
243 #endif
244
245
246 #endif
247