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