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