Deleted Added
full compact
efibind.h (77943) efibind.h (96893)
1/* $FreeBSD: head/sys/boot/efi/include/i386/efibind.h 77943 2001-06-09 16:49:51Z dfr $ */
1/* $FreeBSD: head/sys/boot/efi/include/i386/efibind.h 96893 2002-05-19 03:17:22Z marcel $ */
2/*++
3
4Copyright (c) 1998 Intel Corporation
5
6Module Name:
7
8 efefind.h
9

--- 6 unchanged lines hidden (view full) ---

16
17Revision History
18
19--*/
20
21#pragma pack()
22
23
2/*++
3
4Copyright (c) 1998 Intel Corporation
5
6Module Name:
7
8 efefind.h
9

--- 6 unchanged lines hidden (view full) ---

16
17Revision History
18
19--*/
20
21#pragma pack()
22
23
24//
25// Basic int types of various widths
26//
24/*
25 * Basic int types of various widths
26 */
27
28#if (__STDC_VERSION__ < 199901L )
29
27
28#if (__STDC_VERSION__ < 199901L )
29
30 // No ANSI C 1999/2000 stdint.h integer width declarations
30/* No ANSI C 1999/2000 stdint.h integer width declarations */
31
32 #if _MSC_EXTENSIONS
33
31
32 #if _MSC_EXTENSIONS
33
34 // Use Microsoft C compiler integer width declarations
34/* Use Microsoft C compiler integer width declarations */
35
36 typedef unsigned __int64 uint64_t;
37 typedef __int64 int64_t;
38 typedef unsigned __int32 uint32_t;
39 typedef __int32 int32_t;
40 typedef unsigned short uint16_t;
41 typedef short int16_t;
42 typedef unsigned char uint8_t;
43 typedef char int8_t;
44 #else
45 #ifdef UNIX_LP64
46
35
36 typedef unsigned __int64 uint64_t;
37 typedef __int64 int64_t;
38 typedef unsigned __int32 uint32_t;
39 typedef __int32 int32_t;
40 typedef unsigned short uint16_t;
41 typedef short int16_t;
42 typedef unsigned char uint8_t;
43 typedef char int8_t;
44 #else
45 #ifdef UNIX_LP64
46
47 // Use LP64 programming model from C_FLAGS for integer width declarations
47/* Use LP64 programming model from C_FLAGS for integer width declarations */
48
49 typedef unsigned long uint64_t;
50 typedef long int64_t;
51 typedef unsigned int uint32_t;
52 typedef int int32_t;
53 typedef unsigned short uint16_t;
54 typedef short int16_t;
55 typedef unsigned char uint8_t;
56 typedef char int8_t;
57 #else
58
48
49 typedef unsigned long uint64_t;
50 typedef long int64_t;
51 typedef unsigned int uint32_t;
52 typedef int int32_t;
53 typedef unsigned short uint16_t;
54 typedef short int16_t;
55 typedef unsigned char uint8_t;
56 typedef char int8_t;
57 #else
58
59 // Assume P64 programming model from C_FLAGS for integer width declarations
59/* Assume P64 programming model from C_FLAGS for integer width declarations */
60
61 typedef unsigned long long uint64_t;
62 typedef long long int64_t;
63 typedef unsigned int uint32_t;
64 typedef int int32_t;
65 typedef unsigned short uint16_t;
66 typedef short int16_t;
67 typedef unsigned char uint8_t;
68 typedef char int8_t;
69 #endif
70 #endif
71#endif
72
60
61 typedef unsigned long long uint64_t;
62 typedef long long int64_t;
63 typedef unsigned int uint32_t;
64 typedef int int32_t;
65 typedef unsigned short uint16_t;
66 typedef short int16_t;
67 typedef unsigned char uint8_t;
68 typedef char int8_t;
69 #endif
70 #endif
71#endif
72
73//
74// Basic EFI types of various widths
75//
73/*
74 * Basic EFI types of various widths
75 */
76
77typedef uint64_t UINT64;
78typedef int64_t INT64;
79
80#ifndef _BASETSD_H_
81 typedef uint32_t UINT32;
82 typedef int32_t INT32;
83#endif

--- 27 unchanged lines hidden (view full) ---

111
112
113#define BAD_POINTER 0xFBFBFBFB
114#define MAX_ADDRESS 0xFFFFFFFF
115
116#ifdef EFI_NT_EMULATOR
117 #define BREAKPOINT() __asm { int 3 }
118#else
76
77typedef uint64_t UINT64;
78typedef int64_t INT64;
79
80#ifndef _BASETSD_H_
81 typedef uint32_t UINT32;
82 typedef int32_t INT32;
83#endif

--- 27 unchanged lines hidden (view full) ---

111
112
113#define BAD_POINTER 0xFBFBFBFB
114#define MAX_ADDRESS 0xFFFFFFFF
115
116#ifdef EFI_NT_EMULATOR
117 #define BREAKPOINT() __asm { int 3 }
118#else
119 #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32
119 #define BREAKPOINT() while (TRUE);
120#endif
121
120#endif
121
122//
123// Pointers must be aligned to these address to function
124//
122/*
123 * Pointers must be aligned to these address to function
124 */
125
126#define MIN_ALIGNMENT_SIZE 4
127
128#define ALIGN_VARIABLE(Value ,Adjustment) \
129 (UINTN)Adjustment = 0; \
130 if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
131 (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
132 Value = (UINTN)Value + (UINTN)Adjustment
133
134
125
126#define MIN_ALIGNMENT_SIZE 4
127
128#define ALIGN_VARIABLE(Value ,Adjustment) \
129 (UINTN)Adjustment = 0; \
130 if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
131 (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
132 Value = (UINTN)Value + (UINTN)Adjustment
133
134
135//
136// Define macros to build data structure signatures from characters.
137//
135/*
136 * Define macros to build data structure signatures from characters.
137 */
138
139#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
140#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
141#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
138
139#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
140#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
141#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
142//
143// To export & import functions in the EFI emulator environment
144//
145
142
143/*
144 * To export & import functions in the EFI emulator environment
145 */
146
146#if EFI_NT_EMULATOR
147 #define EXPORTAPI __declspec( dllexport )
148#else
149 #define EXPORTAPI
150#endif
151
152
147#if EFI_NT_EMULATOR
148 #define EXPORTAPI __declspec( dllexport )
149#else
150 #define EXPORTAPI
151#endif
152
153
153//
154// EFIAPI - prototype calling convention for EFI function pointers
155// BOOTSERVICE - prototype for implementation of a boot service interface
156// RUNTIMESERVICE - prototype for implementation of a runtime service interface
157// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
158// RUNTIME_CODE - pragma macro for declaring runtime code
159//
154/*
155 * EFIAPI - prototype calling convention for EFI function pointers
156 * BOOTSERVICE - prototype for implementation of a boot service interface
157 * RUNTIMESERVICE - prototype for implementation of a runtime service interface
158 * RUNTIMEFUNCTION - prototype for implementation of a runtime function that
159 * is not a service
160 * RUNTIME_CODE - pragma macro for declaring runtime code
161 */
160
162
161#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
163/* Forces EFI calling conventions reguardless of compiler options */
164#ifndef EFIAPI
162 #if _MSC_EXTENSIONS
165 #if _MSC_EXTENSIONS
163 #define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
166 #define EFIAPI __cdecl
164 #else
167 #else
165 #define EFIAPI // Substitute expresion to force C calling convention
168 #define EFIAPI
166 #endif
167#endif
168
169#define BOOTSERVICE
169 #endif
170#endif
171
172#define BOOTSERVICE
170//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
171//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
172#define RUNTIMESERVICE
173#define RUNTIMEFUNCTION
174
175
176#define RUNTIME_CODE(a) alloc_text("rtcode", a)
177#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
178#define END_RUNTIME_DATA() data_seg("")
179
180#define VOLATILE volatile
181
182#define MEMORY_FENCE()
183
184#ifdef EFI_NT_EMULATOR
185
173#define RUNTIMESERVICE
174#define RUNTIMEFUNCTION
175
176
177#define RUNTIME_CODE(a) alloc_text("rtcode", a)
178#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
179#define END_RUNTIME_DATA() data_seg("")
180
181#define VOLATILE volatile
182
183#define MEMORY_FENCE()
184
185#ifdef EFI_NT_EMULATOR
186
186//
187// To help ensure proper coding of integrated drivers, they are
188// compiled as DLLs. In NT they require a dll init entry pointer.
189// The macro puts a stub entry point into the DLL so it will load.
190//
187/*
188 * To help ensure proper coding of integrated drivers, they are
189 * compiled as DLLs. In NT they require a dll init entry pointer.
190 * The macro puts a stub entry point into the DLL so it will load.
191 */
191
192#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
193 UINTN \
194 __stdcall \
195 _DllMainCRTStartup ( \
196 UINTN Inst, \
197 UINTN reason_for_call, \
198 VOID *rserved \

--- 12 unchanged lines hidden (view full) ---

211 { \
212 return InitFunction(ImageHandle, SystemTable); \
213 }
214
215
216 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
217 (_if)->LoadInternal(type, name, NULL)
218
192
193#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
194 UINTN \
195 __stdcall \
196 _DllMainCRTStartup ( \
197 UINTN Inst, \
198 UINTN reason_for_call, \
199 VOID *rserved \

--- 12 unchanged lines hidden (view full) ---

212 { \
213 return InitFunction(ImageHandle, SystemTable); \
214 }
215
216
217 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
218 (_if)->LoadInternal(type, name, NULL)
219
219#else // EFI_NT_EMULATOR
220#else /* EFI_NT_EMULATOR */
220
221
221//
222// When build similiar to FW, then link everything together as
223// one big module.
224//
222/*
223 * When build similiar to FW, then link everything together as
224 * one big module.
225 */
225
226 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
227
228 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
229 (_if)->LoadInternal(type, name, entry)
230
226
227 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
228
229 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
230 (_if)->LoadInternal(type, name, entry)
231
231#endif // EFI_FW_NT
232#endif /* EFI_FW_NT */
232
233
233//
234// Some compilers don't support the forward reference construct:
235// typedef struct XXXXX
236//
237// The following macro provide a workaround for such cases.
238//
234/*
235 * Some compilers don't support the forward reference construct:
236 * typedef struct XXXXX
237 *
238 * The following macro provide a workaround for such cases.
239 */
239#ifdef NO_INTERFACE_DECL
240#define INTERFACE_DECL(x)
241#else
242#define INTERFACE_DECL(x) typedef struct x
243#endif
244
245#if _MSC_EXTENSIONS
240#ifdef NO_INTERFACE_DECL
241#define INTERFACE_DECL(x)
242#else
243#define INTERFACE_DECL(x) typedef struct x
244#endif
245
246#if _MSC_EXTENSIONS
246#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
247#pragma warning ( disable : 4731 )
247#endif
248
248#endif
249