Base.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __BASE_H__
00022 #define __BASE_H__
00023
00024
00025
00026
00027 #include <gpxe/efi/ProcessorBind.h>
00028
00029 typedef struct {
00030 UINT32 Data1;
00031 UINT16 Data2;
00032 UINT16 Data3;
00033 UINT8 Data4[8];
00034 } GUID;
00035
00036 typedef UINT64 PHYSICAL_ADDRESS;
00037
00038
00039
00040
00041 typedef struct _LIST_ENTRY LIST_ENTRY;
00042
00043 struct _LIST_ENTRY {
00044 LIST_ENTRY *ForwardLink;
00045 LIST_ENTRY *BackLink;
00046 };
00047
00048
00049
00050
00051 #define CONST const
00052 #define STATIC static
00053 #define VOID void
00054
00055
00056
00057
00058
00059 #define IN
00060 #define OUT
00061 #define OPTIONAL
00062
00063
00064
00065
00066
00067 #define TRUE ((BOOLEAN)(1==1))
00068 #define FALSE ((BOOLEAN)(0==1))
00069
00070 #define NULL ((VOID *) 0)
00071
00072 #define BIT0 0x00000001
00073 #define BIT1 0x00000002
00074 #define BIT2 0x00000004
00075 #define BIT3 0x00000008
00076 #define BIT4 0x00000010
00077 #define BIT5 0x00000020
00078 #define BIT6 0x00000040
00079 #define BIT7 0x00000080
00080 #define BIT8 0x00000100
00081 #define BIT9 0x00000200
00082 #define BIT10 0x00000400
00083 #define BIT11 0x00000800
00084 #define BIT12 0x00001000
00085 #define BIT13 0x00002000
00086 #define BIT14 0x00004000
00087 #define BIT15 0x00008000
00088 #define BIT16 0x00010000
00089 #define BIT17 0x00020000
00090 #define BIT18 0x00040000
00091 #define BIT19 0x00080000
00092 #define BIT20 0x00100000
00093 #define BIT21 0x00200000
00094 #define BIT22 0x00400000
00095 #define BIT23 0x00800000
00096 #define BIT24 0x01000000
00097 #define BIT25 0x02000000
00098 #define BIT26 0x04000000
00099 #define BIT27 0x08000000
00100 #define BIT28 0x10000000
00101 #define BIT29 0x20000000
00102 #define BIT30 0x40000000
00103 #define BIT31 0x80000000
00104 #define BIT32 0x0000000100000000UL
00105 #define BIT33 0x0000000200000000UL
00106 #define BIT34 0x0000000400000000UL
00107 #define BIT35 0x0000000800000000UL
00108 #define BIT36 0x0000001000000000UL
00109 #define BIT37 0x0000002000000000UL
00110 #define BIT38 0x0000004000000000UL
00111 #define BIT39 0x0000008000000000UL
00112 #define BIT40 0x0000010000000000UL
00113 #define BIT41 0x0000020000000000UL
00114 #define BIT42 0x0000040000000000UL
00115 #define BIT43 0x0000080000000000UL
00116 #define BIT44 0x0000100000000000UL
00117 #define BIT45 0x0000200000000000UL
00118 #define BIT46 0x0000400000000000UL
00119 #define BIT47 0x0000800000000000UL
00120 #define BIT48 0x0001000000000000UL
00121 #define BIT49 0x0002000000000000UL
00122 #define BIT50 0x0004000000000000UL
00123 #define BIT51 0x0008000000000000UL
00124 #define BIT52 0x0010000000000000UL
00125 #define BIT53 0x0020000000000000UL
00126 #define BIT54 0x0040000000000000UL
00127 #define BIT55 0x0080000000000000UL
00128 #define BIT56 0x0100000000000000UL
00129 #define BIT57 0x0200000000000000UL
00130 #define BIT58 0x0400000000000000UL
00131 #define BIT59 0x0800000000000000UL
00132 #define BIT60 0x1000000000000000UL
00133 #define BIT61 0x2000000000000000UL
00134 #define BIT62 0x4000000000000000UL
00135 #define BIT63 0x8000000000000000UL
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 #define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
00178
00179
00180
00181
00182 typedef CHAR8 *VA_LIST;
00183 #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
00184 #define VA_ARG(ap, t) (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
00185 #define VA_END(ap) (ap = (VA_LIST) 0)
00186
00187
00188
00189
00190 #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
00191
00192
00193
00194
00195
00196 #define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
00197
00198
00199
00200
00201 #define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
00202
00203
00204
00205
00206 #define ALIGN_POINTER(Pointer, Alignment) ((VOID *) (ALIGN_VALUE ((UINTN)(Pointer), (Alignment))))
00207
00208
00209
00210
00211 #define ALIGN_VARIABLE(Value) ALIGN_VALUE ((Value), sizeof (UINTN))
00212
00213
00214
00215
00216
00217
00218
00219 #define MAX(a, b) \
00220 (((a) > (b)) ? (a) : (b))
00221
00222
00223
00224
00225
00226
00227
00228 #define MIN(a, b) \
00229 (((a) < (b)) ? (a) : (b))
00230
00231
00232
00233
00234
00235
00236 typedef INTN RETURN_STATUS;
00237
00238
00239
00240
00241 #define ENCODE_ERROR(a) (MAX_BIT | (a))
00242
00243 #define ENCODE_WARNING(a) (a)
00244 #define RETURN_ERROR(a) ((INTN) (a) < 0)
00245
00246 #define RETURN_SUCCESS 0
00247 #define RETURN_LOAD_ERROR ENCODE_ERROR (1)
00248 #define RETURN_INVALID_PARAMETER ENCODE_ERROR (2)
00249 #define RETURN_UNSUPPORTED ENCODE_ERROR (3)
00250 #define RETURN_BAD_BUFFER_SIZE ENCODE_ERROR (4)
00251 #define RETURN_BUFFER_TOO_SMALL ENCODE_ERROR (5)
00252 #define RETURN_NOT_READY ENCODE_ERROR (6)
00253 #define RETURN_DEVICE_ERROR ENCODE_ERROR (7)
00254 #define RETURN_WRITE_PROTECTED ENCODE_ERROR (8)
00255 #define RETURN_OUT_OF_RESOURCES ENCODE_ERROR (9)
00256 #define RETURN_VOLUME_CORRUPTED ENCODE_ERROR (10)
00257 #define RETURN_VOLUME_FULL ENCODE_ERROR (11)
00258 #define RETURN_NO_MEDIA ENCODE_ERROR (12)
00259 #define RETURN_MEDIA_CHANGED ENCODE_ERROR (13)
00260 #define RETURN_NOT_FOUND ENCODE_ERROR (14)
00261 #define RETURN_ACCESS_DENIED ENCODE_ERROR (15)
00262 #define RETURN_NO_RESPONSE ENCODE_ERROR (16)
00263 #define RETURN_NO_MAPPING ENCODE_ERROR (17)
00264 #define RETURN_TIMEOUT ENCODE_ERROR (18)
00265 #define RETURN_NOT_STARTED ENCODE_ERROR (19)
00266 #define RETURN_ALREADY_STARTED ENCODE_ERROR (20)
00267 #define RETURN_ABORTED ENCODE_ERROR (21)
00268 #define RETURN_ICMP_ERROR ENCODE_ERROR (22)
00269 #define RETURN_TFTP_ERROR ENCODE_ERROR (23)
00270 #define RETURN_PROTOCOL_ERROR ENCODE_ERROR (24)
00271 #define RETURN_INCOMPATIBLE_VERSION ENCODE_ERROR (25)
00272 #define RETURN_SECURITY_VIOLATION ENCODE_ERROR (26)
00273 #define RETURN_CRC_ERROR ENCODE_ERROR (27)
00274 #define RETURN_END_OF_MEDIA ENCODE_ERROR (28)
00275 #define RETURN_END_OF_FILE ENCODE_ERROR (31)
00276 #define RETURN_INVALID_LANGUAGE ENCODE_ERROR (32)
00277
00278
00279 #define RETURN_WARN_UNKNOWN_GLYPH ENCODE_WARNING (1)
00280 #define RETURN_WARN_DELETE_FAILURE ENCODE_WARNING (2)
00281 #define RETURN_WARN_WRITE_FAILURE ENCODE_WARNING (3)
00282 #define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 #define SIGNATURE_16(A, B) ((A) | (B << 8))
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 #define SIGNATURE_32(A, B, C, D) (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 #define SIGNATURE_64(A, B, C, D, E, F, G, H) \
00326 (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
00327
00328 #endif
00329