Browse Source

[efi] Update to latest UEFI headers

tags/v0.9.6
Michael Brown 15 years ago
parent
commit
ab96932ab3

+ 52
- 28
src/include/gpxe/efi/Base.h View File

@@ -1,5 +1,4 @@
1 1
 /** @file
2
-
3 2
   Root include file for Mde Package Base type modules
4 3
 
5 4
   This is the include file for any module of type base. Base modules only use
@@ -57,34 +56,18 @@ struct _LIST_ENTRY {
57 56
 // Modifiers for Data Types used to self document code.
58 57
 // This concept is borrowed for UEFI specification.
59 58
 //
60
-#ifndef IN
61
-//
62
-// Some other envirnments use this construct, so #ifndef to prevent
63
-// mulitple definition.
64
-//
65 59
 #define IN
66 60
 #define OUT
67 61
 #define OPTIONAL
68
-#endif
69 62
 
70
-//
71
-// Constants. They may exist in other build structures, so #ifndef them.
72
-//
73
-#ifndef TRUE
74 63
 //
75 64
 //  UEFI specification claims 1 and 0. We are concerned about the
76 65
 //  complier portability so we did it this way.
77 66
 //
78 67
 #define TRUE  ((BOOLEAN)(1==1))
79
-#endif
80
-
81
-#ifndef FALSE
82 68
 #define FALSE ((BOOLEAN)(0==1))
83
-#endif
84 69
 
85
-#ifndef NULL
86 70
 #define NULL  ((VOID *) 0)
87
-#endif
88 71
 
89 72
 #define  BIT0     0x00000001
90 73
 #define  BIT1     0x00000002
@@ -196,15 +179,11 @@ struct _LIST_ENTRY {
196 179
 //
197 180
 // Also support coding convention rules for var arg macros
198 181
 //
199
-#ifndef VA_START
200
-
201 182
 typedef CHAR8 *VA_LIST;
202 183
 #define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
203 184
 #define VA_ARG(ap, t)   (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
204 185
 #define VA_END(ap)      (ap = (VA_LIST) 0)
205 186
 
206
-#endif
207
-
208 187
 //
209 188
 // Macro that returns the byte offset of a field in a data structure.
210 189
 //
@@ -216,20 +195,21 @@ typedef CHAR8 *VA_LIST;
216 195
 ///
217 196
 #define _CR(Record, TYPE, Field)  ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
218 197
 
198
+///
199
+///  ALIGN_VALUE - aligns a value up to the next boundary of the given alignment.
200
+///
201
+#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
202
+
219 203
 ///
220 204
 ///  ALIGN_POINTER - aligns a pointer to the lowest boundry
221 205
 ///
222
-#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
206
+#define ALIGN_POINTER(Pointer, Alignment) ((VOID *) (ALIGN_VALUE ((UINTN)(Pointer), (Alignment))))
223 207
 
224 208
 ///
225 209
 ///  ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
226 210
 ///
227
-#define ALIGN_VARIABLE(Value, Adjustment) \
228
-  Adjustment = 0U; \
229
-  if ((UINTN) (Value) % sizeof (UINTN)) { \
230
-    (Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
231
-  } \
232
-  (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
211
+#define ALIGN_VARIABLE(Value)  ALIGN_VALUE ((Value), sizeof (UINTN))
212
+
233 213
 
234 214
 //
235 215
 // Return the maximum of two operands.
@@ -301,5 +281,49 @@ typedef INTN RETURN_STATUS;
301 281
 #define RETURN_WARN_WRITE_FAILURE    ENCODE_WARNING (3)
302 282
 #define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
303 283
 
284
+/**
285
+  Returns a 16-bit signature built from 2 ASCII characters.
286
+
287
+  @param  A	   The first ASCII character.
288
+  @param  B	   The second ASCII character.
289
+
290
+  @return A 16-bit value built from the two ASCII characters specified by A and B.
291
+
292
+**/
293
+#define SIGNATURE_16(A, B)        ((A) | (B << 8))
294
+
295
+/**
296
+  Returns a 32-bit signature built from 4 ASCII characters.
297
+
298
+  @param  A	   The first ASCII character.
299
+  @param  B	   The second ASCII character.
300
+  @param  C	   The third ASCII character.
301
+  @param  D	   The fourth ASCII character.
302
+
303
+  @return A 32-bit value built from the two ASCII characters specified by A, B,
304
+          C and D.
305
+
306
+**/
307
+#define SIGNATURE_32(A, B, C, D)  (SIGNATURE_16 (A, B) | (SIGNATURE_16 (C, D) << 16))
308
+
309
+/**
310
+  Returns a 64-bit signature built from 8 ASCII characters.
311
+
312
+  @param  A	   The first ASCII character.
313
+  @param  B	   The second ASCII character.
314
+  @param  C	   The third ASCII character.
315
+  @param  D	   The fourth ASCII character.
316
+  @param  E	   The fifth ASCII character.
317
+  @param  F	   The sixth ASCII character.
318
+  @param  G	   The seventh ASCII character.
319
+  @param  H	   The eighth ASCII character.
320
+
321
+  @return A 64-bit value built from the two ASCII characters specified by A, B,
322
+          C, D, E, F, G and H.
323
+
324
+**/
325
+#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
326
+    (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))
327
+
304 328
 #endif
305 329
 

+ 0
- 6
src/include/gpxe/efi/Ia32/ProcessorBind.h View File

@@ -28,12 +28,6 @@
28 28
 #endif
29 29
 
30 30
 #if __INTEL_COMPILER
31
-//
32
-// Disable ICC's remark #593: "LocalVariable" was set but never used
33
-// This is legal ANSI C code so we disable the remark that is turned on with -Wall
34
-//
35
-#pragma warning ( disable : 593 )
36
-
37 31
 //
38 32
 // Disable ICC's remark #869: "Parameter" was never referenced warning.
39 33
 // This is legal ANSI C code so we disable the remark that is turned on with -Wall

+ 234
- 224
src/include/gpxe/efi/IndustryStandard/PeImage.h View File

@@ -1,12 +1,13 @@
1 1
 /** @file
2
-  EFI image format for PE32 and PE32+. Please note some data structures are
2
+  EFI image format for PE32, PE32+ and TE. Please note some data structures are
3 3
   different for PE32 and PE32+. EFI_IMAGE_NT_HEADERS32 is for PE32 and
4 4
   EFI_IMAGE_NT_HEADERS64 is for PE32+.
5 5
 
6 6
   This file is coded to the Visual Studio, Microsoft Portable Executable and
7 7
   Common Object File Format Specification, Revision 8.0 - May 16, 2006.
8
+  This file also includes some definitions in PI Specification, Revision 1.0.
8 9
 
9
-  Copyright (c) 2006 - 2007, Intel Corporation
10
+  Copyright (c) 2006 - 2008, Intel Corporation
10 11
   All rights reserved. This program and the accompanying materials
11 12
   are licensed and made available under the terms and conditions of the BSD License
12 13
   which accompanies this distribution.  The full text of the license may be found at
@@ -17,23 +18,23 @@
17 18
 
18 19
 **/
19 20
 
20
-#ifndef __EFI_IMAGE_H__
21
-#define __EFI_IMAGE_H__
21
+#ifndef __PE_IMAGE_H__
22
+#define __PE_IMAGE_H__
22 23
 
23
-//
24
-// PE32+ Subsystem type for EFI images
25
-//
24
+///
25
+/// PE32+ Subsystem type for EFI images
26
+///
26 27
 #define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION         10
27 28
 #define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
28 29
 #define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      12
29 30
 #define EFI_IMAGE_SUBSYSTEM_EFI_EFI_ROM             13
30 31
 
31
-#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER      13
32
+#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER      13 ///< defined PI Specification, 1.0
32 33
 
33 34
 
34
-//
35
-// PE32+ Machine type for EFI images
36
-//
35
+///
36
+/// PE32+ Machine type for EFI images
37
+///
37 38
 #define IMAGE_FILE_MACHINE_I386     0x014c
38 39
 #define IMAGE_FILE_MACHINE_IA64     0x0200
39 40
 #define IMAGE_FILE_MACHINE_EBC      0x0EBC
@@ -47,39 +48,42 @@
47 48
 #define EFI_IMAGE_MACHINE_EBC       IMAGE_FILE_MACHINE_EBC
48 49
 #define EFI_IMAGE_MACHINE_X64       IMAGE_FILE_MACHINE_X64
49 50
 
50
-#define EFI_IMAGE_DOS_SIGNATURE     0x5A4D      // MZ
51
-#define EFI_IMAGE_OS2_SIGNATURE     0x454E      // NE
52
-#define EFI_IMAGE_OS2_SIGNATURE_LE  0x454C      // LE
53
-#define EFI_IMAGE_NT_SIGNATURE      0x00004550  // PE00
51
+///
52
+/// EXE file formats
53
+///
54
+#define EFI_IMAGE_DOS_SIGNATURE     SIGNATURE_16('M', 'Z')
55
+#define EFI_IMAGE_OS2_SIGNATURE     SIGNATURE_16('N', 'E')
56
+#define EFI_IMAGE_OS2_SIGNATURE_LE  SIGNATURE_16('L', 'E')
57
+#define EFI_IMAGE_NT_SIGNATURE      SIGNATURE_32('P', 'E', '\0', '\0')
54 58
 
55 59
 ///
56 60
 /// PE images can start with an optional DOS header, so if an image is run
57
-///  under DOS it can print an error message.
61
+/// under DOS it can print an error message.
58 62
 ///
59 63
 typedef struct {
60
-  UINT16  e_magic;    // Magic number
61
-  UINT16  e_cblp;     // Bytes on last page of file
62
-  UINT16  e_cp;       // Pages in file
63
-  UINT16  e_crlc;     // Relocations
64
-  UINT16  e_cparhdr;  // Size of header in paragraphs
65
-  UINT16  e_minalloc; // Minimum extra paragraphs needed
66
-  UINT16  e_maxalloc; // Maximum extra paragraphs needed
67
-  UINT16  e_ss;       // Initial (relative) SS value
68
-  UINT16  e_sp;       // Initial SP value
69
-  UINT16  e_csum;     // Checksum
70
-  UINT16  e_ip;       // Initial IP value
71
-  UINT16  e_cs;       // Initial (relative) CS value
72
-  UINT16  e_lfarlc;   // File address of relocation table
73
-  UINT16  e_ovno;     // Overlay number
74
-  UINT16  e_res[4];   // Reserved words
75
-  UINT16  e_oemid;    // OEM identifier (for e_oeminfo)
76
-  UINT16  e_oeminfo;  // OEM information; e_oemid specific
77
-  UINT16  e_res2[10]; // Reserved words
78
-  UINT32  e_lfanew;   // File address of new exe header
64
+  UINT16  e_magic;    ///< Magic number
65
+  UINT16  e_cblp;     ///< Bytes on last page of file
66
+  UINT16  e_cp;       ///< Pages in file
67
+  UINT16  e_crlc;     ///< Relocations
68
+  UINT16  e_cparhdr;  ///< Size of header in paragraphs
69
+  UINT16  e_minalloc; ///< Minimum extra paragraphs needed
70
+  UINT16  e_maxalloc; ///< Maximum extra paragraphs needed
71
+  UINT16  e_ss;       ///< Initial (relative) SS value
72
+  UINT16  e_sp;       ///< Initial SP value
73
+  UINT16  e_csum;     ///< Checksum
74
+  UINT16  e_ip;       ///< Initial IP value
75
+  UINT16  e_cs;       ///< Initial (relative) CS value
76
+  UINT16  e_lfarlc;   ///< File address of relocation table
77
+  UINT16  e_ovno;     ///< Overlay number
78
+  UINT16  e_res[4];   ///< Reserved words
79
+  UINT16  e_oemid;    ///< OEM identifier (for e_oeminfo)
80
+  UINT16  e_oeminfo;  ///< OEM information; e_oemid specific
81
+  UINT16  e_res2[10]; ///< Reserved words
82
+  UINT32  e_lfanew;   ///< File address of new exe header
79 83
 } EFI_IMAGE_DOS_HEADER;
80 84
 
81 85
 ///
82
-/// File header format.
86
+/// COFF File Header (Object and Image)
83 87
 ///
84 88
 typedef struct {
85 89
   UINT16  Machine;
@@ -91,62 +95,63 @@ typedef struct {
91 95
   UINT16  Characteristics;
92 96
 } EFI_IMAGE_FILE_HEADER;
93 97
 
98
+///
99
+/// Size of EFI_IMAGE_FILE_HEADER
100
+///
94 101
 #define EFI_IMAGE_SIZEOF_FILE_HEADER        20
95 102
 
96
-#define EFI_IMAGE_FILE_RELOCS_STRIPPED      0x0001  // Relocation info stripped from file.
97
-#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE     0x0002  // File is executable  (i.e. no unresolved externel references).
98
-#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED   0x0004  // Line nunbers stripped from file.
99
-#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED  0x0008  // Local symbols stripped from file.
100
-#define EFI_IMAGE_FILE_BYTES_REVERSED_LO    0x0080  // Bytes of machine word are reversed.
101
-#define EFI_IMAGE_FILE_32BIT_MACHINE        0x0100  // 32 bit word machine.
102
-#define EFI_IMAGE_FILE_DEBUG_STRIPPED       0x0200  // Debugging info stripped from file in .DBG file
103
-#define EFI_IMAGE_FILE_SYSTEM               0x1000  // System File.
104
-#define EFI_IMAGE_FILE_DLL                  0x2000  // File is a DLL.
105
-#define EFI_IMAGE_FILE_BYTES_REVERSED_HI    0x8000  // Bytes of machine word are reversed.
106
-#define EFI_IMAGE_FILE_MACHINE_UNKNOWN      0
107
-#define EFI_IMAGE_FILE_MACHINE_I386         0x14c   // Intel 386.
108
-#define EFI_IMAGE_FILE_MACHINE_R3000        0x162   // MIPS* little-endian, 0540 big-endian
109
-#define EFI_IMAGE_FILE_MACHINE_R4000        0x166   // MIPS* little-endian
110
-#define EFI_IMAGE_FILE_MACHINE_ALPHA        0x184   // Alpha_AXP*
111
-#define EFI_IMAGE_FILE_MACHINE_POWERPC      0x1F0   // IBM* PowerPC Little-Endian
112
-#define EFI_IMAGE_FILE_MACHINE_TAHOE        0x7cc   // Intel EM machine
103
+///
104
+/// Characteristics
105
+///
106
+#define EFI_IMAGE_FILE_RELOCS_STRIPPED      BIT0     ///< 0x0001  Relocation info stripped from file.
107
+#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE     BIT1     ///< 0x0002  File is executable  (i.e. no unresolved externel references).
108
+#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED   BIT2     ///< 0x0004  Line nunbers stripped from file.
109
+#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED  BIT3     ///< 0x0008  Local symbols stripped from file.
110
+#define EFI_IMAGE_FILE_BYTES_REVERSED_LO    BIT7     ///< 0x0080  Bytes of machine word are reversed.
111
+#define EFI_IMAGE_FILE_32BIT_MACHINE        BIT8     ///< 0x0100  32 bit word machine.
112
+#define EFI_IMAGE_FILE_DEBUG_STRIPPED       BIT9     ///< 0x0200  Debugging info stripped from file in .DBG file
113
+#define EFI_IMAGE_FILE_SYSTEM               BIT12    ///< 0x1000  System File.
114
+#define EFI_IMAGE_FILE_DLL                  BIT13    ///< 0x2000  File is a DLL.
115
+#define EFI_IMAGE_FILE_BYTES_REVERSED_HI    BIT15    ///< 0x8000  Bytes of machine word are reversed.
116
+
117
+///
118
+/// Other Machine Types
119
+///
120
+#define EFI_IMAGE_FILE_MACHINE_UNKNOWN      0       ///< Any machine type
121
+#define EFI_IMAGE_FILE_MACHINE_I386         0x14c   ///< Intel 386.
122
+#define EFI_IMAGE_FILE_MACHINE_R3000        0x162   ///< MIPS* little-endian, 0540 big-endian
123
+#define EFI_IMAGE_FILE_MACHINE_R4000        0x166   ///< MIPS* little-endian
124
+#define EFI_IMAGE_FILE_MACHINE_POWERPC      0x1F0   ///< IBM* PowerPC Little-Endian
113 125
 //
114 126
 // * Other names and brands may be claimed as the property of others.
115 127
 //
116 128
 
117 129
 ///
118
-/// Directory format.
130
+/// Header Data Directories
119 131
 ///
120 132
 typedef struct {
121 133
   UINT32  VirtualAddress;
122 134
   UINT32  Size;
123 135
 } EFI_IMAGE_DATA_DIRECTORY;
124 136
 
125
-#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
126
-
127
-typedef struct {
128
-  UINT16  Magic;
129
-  UINT8   MajorLinkerVersion;
130
-  UINT8   MinorLinkerVersion;
131
-  UINT32  SizeOfCode;
132
-  UINT32  SizeOfInitializedData;
133
-  UINT32  SizeOfUninitializedData;
134
-  UINT32  AddressOfEntryPoint;
135
-  UINT32  BaseOfCode;
136
-  UINT32  BaseOfData;
137
-  UINT32  BaseOfBss;
138
-  UINT32  GprMask;
139
-  UINT32  CprMask[4];
140
-  UINT32  GpValue;
141
-} EFI_IMAGE_ROM_OPTIONAL_HEADER;
142
-
143 137
 #define EFI_IMAGE_ROM_OPTIONAL_HDR_MAGIC      0x107
144
-#define EFI_IMAGE_SIZEOF_ROM_OPTIONAL_HEADER  sizeof (EFI_IMAGE_ROM_OPTIONAL_HEADER)
145 138
 
146
-typedef struct {
147
-  EFI_IMAGE_FILE_HEADER         FileHeader;
148
-  EFI_IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
149
-} EFI_IMAGE_ROM_HEADERS;
139
+///
140
+/// Directory Entries
141
+///
142
+#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT      0
143
+#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT      1
144
+#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE    2
145
+#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION   3
146
+#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY    4
147
+#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC   5
148
+#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG       6
149
+#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT   7
150
+#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR   8
151
+#define EFI_IMAGE_DIRECTORY_ENTRY_TLS         9
152
+#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
153
+
154
+#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
150 155
 
151 156
 ///
152 157
 /// @attention
@@ -168,7 +173,7 @@ typedef struct {
168 173
   UINT32                    SizeOfUninitializedData;
169 174
   UINT32                    AddressOfEntryPoint;
170 175
   UINT32                    BaseOfCode;
171
-  UINT32                    BaseOfData;
176
+  UINT32                    BaseOfData;  ///< PE32 contains this additional field, which is absent in PE32+
172 177
   ///
173 178
   /// NT additional fields.
174 179
   ///
@@ -266,11 +271,11 @@ typedef struct {
266 271
 #define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
267 272
 
268 273
 
269
-//
270
-// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
271
-// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build.  Same for
272
-// EFI_IMAGE_NT_HEADERS.  These definitions MUST be used by ALL EFI code.
273
-//
274
+///
275
+/// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
276
+/// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build.  Same for
277
+/// EFI_IMAGE_NT_HEADERS.  These definitions MUST be used by ALL EFI code.
278
+///
274 279
 #if   defined (MDE_CPU_IA32)
275 280
 
276 281
 #define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
@@ -278,9 +283,6 @@ typedef struct {
278 283
 
279 284
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64)
280 285
 
281
-//
282
-// @bug - Remove me when other package updated.
283
-//
284 286
 typedef EFI_IMAGE_NT_HEADERS32    EFI_IMAGE_NT_HEADERS;
285 287
 
286 288
 #elif defined (MDE_CPU_IPF)
@@ -290,9 +292,6 @@ typedef EFI_IMAGE_NT_HEADERS32    EFI_IMAGE_NT_HEADERS;
290 292
 
291 293
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
292 294
 
293
-//
294
-// @bug - Remove me when other package updated.
295
-//
296 295
 typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
297 296
 
298 297
 #elif defined (MDE_CPU_X64)
@@ -302,9 +301,6 @@ typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
302 301
 
303 302
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
304 303
 
305
-//
306
-// @bug - Remove me when other package updated.
307
-//
308 304
 typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
309 305
 
310 306
 #elif defined (MDE_CPU_EBC)
@@ -318,9 +314,6 @@ typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
318 314
 
319 315
 #define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
320 316
 
321
-//
322
-// @bug - Remove me when other package updated.
323
-//
324 317
 typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
325 318
 
326 319
 #else
@@ -338,34 +331,19 @@ typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
338 331
         ) \
339 332
     )
340 333
 
341
-//
342
-// Subsystem Values
343
-//
334
+///
335
+/// Other Windows Subsystem Values
336
+///
344 337
 #define EFI_IMAGE_SUBSYSTEM_UNKNOWN     0
345 338
 #define EFI_IMAGE_SUBSYSTEM_NATIVE      1
346 339
 #define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
347
-#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3.
340
+#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3
348 341
 #define EFI_IMAGE_SUBSYSTEM_OS2_CUI     5
349 342
 #define EFI_IMAGE_SUBSYSTEM_POSIX_CUI   7
350 343
 
351
-//
352
-// Directory Entries
353
-//
354
-#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT      0
355
-#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT      1
356
-#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE    2
357
-#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION   3
358
-#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY    4
359
-#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC   5
360
-#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG       6
361
-#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT   7
362
-#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR   8
363
-#define EFI_IMAGE_DIRECTORY_ENTRY_TLS         9
364
-#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
365
-
366
-//
367
-// Section header format.
368
-//
344
+///
345
+/// Section header format.
346
+///
369 347
 #define EFI_IMAGE_SIZEOF_SHORT_NAME 8
370 348
 
371 349
 typedef struct {
@@ -384,80 +362,85 @@ typedef struct {
384 362
   UINT32  Characteristics;
385 363
 } EFI_IMAGE_SECTION_HEADER;
386 364
 
365
+///
366
+/// Size of EFI_IMAGE_SECTION_HEADER
367
+///
387 368
 #define EFI_IMAGE_SIZEOF_SECTION_HEADER       40
388 369
 
389
-#define EFI_IMAGE_SCN_TYPE_NO_PAD             0x00000008  // Reserved.
390
-#define EFI_IMAGE_SCN_CNT_CODE                0x00000020
391
-#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA    0x00000040
392
-#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA  0x00000080
370
+///
371
+/// Section Flags Values
372
+///
373
+#define EFI_IMAGE_SCN_TYPE_NO_PAD                  BIT3   ///< 0x00000008  ///< Reserved.
374
+#define EFI_IMAGE_SCN_CNT_CODE                     BIT5   ///< 0x00000020
375
+#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA         BIT6   ///< 0x00000040
376
+#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA       BIT7   ///< 0x00000080
393 377
 
394
-#define EFI_IMAGE_SCN_LNK_OTHER               0x00000100  // Reserved.
395
-#define EFI_IMAGE_SCN_LNK_INFO                0x00000200  // Section contains comments or some other type of information.
396
-#define EFI_IMAGE_SCN_LNK_REMOVE              0x00000800  // Section contents will not become part of image.
397
-#define EFI_IMAGE_SCN_LNK_COMDAT              0x00001000
378
+#define EFI_IMAGE_SCN_LNK_OTHER                    BIT8   ///< 0x00000100  ///< Reserved.
379
+#define EFI_IMAGE_SCN_LNK_INFO                     BIT9   ///< 0x00000200  ///< Section contains comments or some other type of information.
380
+#define EFI_IMAGE_SCN_LNK_REMOVE                   BIT10  ///< 0x00000800  ///< Section contents will not become part of image.
381
+#define EFI_IMAGE_SCN_LNK_COMDAT                   BIT12  ///< 0x00001000
398 382
 
399
-#define EFI_IMAGE_SCN_ALIGN_1BYTES            0x00100000
400
-#define EFI_IMAGE_SCN_ALIGN_2BYTES            0x00200000
401
-#define EFI_IMAGE_SCN_ALIGN_4BYTES            0x00300000
402
-#define EFI_IMAGE_SCN_ALIGN_8BYTES            0x00400000
403
-#define EFI_IMAGE_SCN_ALIGN_16BYTES           0x00500000
404
-#define EFI_IMAGE_SCN_ALIGN_32BYTES           0x00600000
405
-#define EFI_IMAGE_SCN_ALIGN_64BYTES           0x00700000
383
+#define EFI_IMAGE_SCN_ALIGN_1BYTES                 BIT20  ///< 0x00100000
384
+#define EFI_IMAGE_SCN_ALIGN_2BYTES                 BIT21  ///< 0x00200000
385
+#define EFI_IMAGE_SCN_ALIGN_4BYTES          (BIT20|BIT21) ///< 0x00300000
386
+#define EFI_IMAGE_SCN_ALIGN_8BYTES                 BIT22  ///< 0x00400000
387
+#define EFI_IMAGE_SCN_ALIGN_16BYTES         (BIT20|BIT22) ///< 0x00500000
388
+#define EFI_IMAGE_SCN_ALIGN_32BYTES         (BIT21|BIT22) ///< 0x00600000
389
+#define EFI_IMAGE_SCN_ALIGN_64BYTES   (BIT20|BIT21|BIT22) ///< 0x00700000
406 390
 
407
-#define EFI_IMAGE_SCN_MEM_DISCARDABLE         0x02000000
408
-#define EFI_IMAGE_SCN_MEM_NOT_CACHED          0x04000000
409
-#define EFI_IMAGE_SCN_MEM_NOT_PAGED           0x08000000
410
-#define EFI_IMAGE_SCN_MEM_SHARED              0x10000000
411
-#define EFI_IMAGE_SCN_MEM_EXECUTE             0x20000000
412
-#define EFI_IMAGE_SCN_MEM_READ                0x40000000
413
-#define EFI_IMAGE_SCN_MEM_WRITE               0x80000000
391
+#define EFI_IMAGE_SCN_MEM_DISCARDABLE              BIT25  ///< 0x02000000
392
+#define EFI_IMAGE_SCN_MEM_NOT_CACHED               BIT26  ///< 0x04000000
393
+#define EFI_IMAGE_SCN_MEM_NOT_PAGED                BIT27  ///< 0x08000000
394
+#define EFI_IMAGE_SCN_MEM_SHARED                   BIT28  ///< 0x10000000
395
+#define EFI_IMAGE_SCN_MEM_EXECUTE                  BIT29  ///< 0x20000000
396
+#define EFI_IMAGE_SCN_MEM_READ                     BIT30  ///< 0x40000000
397
+#define EFI_IMAGE_SCN_MEM_WRITE                    BIT31  ///< 0x80000000
414 398
 
415 399
 ///
416
-/// Symbol format.
400
+/// Size of a Symbol Table Record
417 401
 ///
418 402
 #define EFI_IMAGE_SIZEOF_SYMBOL 18
419 403
 
420
-//
421
-// Section values.
422
-//
423
-// Symbols have a section number of the section in which they are
424
-// defined. Otherwise, section numbers have the following meanings:
425
-//
426
-#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0  // Symbol is undefined or is common.
427
-#define EFI_IMAGE_SYM_ABSOLUTE  (UINT16) -1 // Symbol is an absolute value.
428
-#define EFI_IMAGE_SYM_DEBUG     (UINT16) -2 // Symbol is a special debug item.
429
-//
430
-// Type (fundamental) values.
431
-//
432
-#define EFI_IMAGE_SYM_TYPE_NULL   0   // no type.
433
-#define EFI_IMAGE_SYM_TYPE_VOID   1   //
434
-#define EFI_IMAGE_SYM_TYPE_CHAR   2   // type character.
435
-#define EFI_IMAGE_SYM_TYPE_SHORT  3   // type short integer.
404
+///
405
+/// Symbols have a section number of the section in which they are
406
+/// defined. Otherwise, section numbers have the following meanings:
407
+///
408
+#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0  ///< Symbol is undefined or is common.
409
+#define EFI_IMAGE_SYM_ABSOLUTE  (UINT16) -1 ///< Symbol is an absolute value.
410
+#define EFI_IMAGE_SYM_DEBUG     (UINT16) -2 ///< Symbol is a special debug item.
411
+
412
+///
413
+/// Symbol Type (fundamental) values.
414
+///
415
+#define EFI_IMAGE_SYM_TYPE_NULL   0   ///< no type.
416
+#define EFI_IMAGE_SYM_TYPE_VOID   1   ///< no valid type.
417
+#define EFI_IMAGE_SYM_TYPE_CHAR   2   ///< type character.
418
+#define EFI_IMAGE_SYM_TYPE_SHORT  3   ///< type short integer.
436 419
 #define EFI_IMAGE_SYM_TYPE_INT    4
437 420
 #define EFI_IMAGE_SYM_TYPE_LONG   5
438 421
 #define EFI_IMAGE_SYM_TYPE_FLOAT  6
439 422
 #define EFI_IMAGE_SYM_TYPE_DOUBLE 7
440 423
 #define EFI_IMAGE_SYM_TYPE_STRUCT 8
441 424
 #define EFI_IMAGE_SYM_TYPE_UNION  9
442
-#define EFI_IMAGE_SYM_TYPE_ENUM   10  // enumeration.
443
-#define EFI_IMAGE_SYM_TYPE_MOE    11  // member of enumeration.
425
+#define EFI_IMAGE_SYM_TYPE_ENUM   10  ///< enumeration.
426
+#define EFI_IMAGE_SYM_TYPE_MOE    11  ///< member of enumeration.
444 427
 #define EFI_IMAGE_SYM_TYPE_BYTE   12
445 428
 #define EFI_IMAGE_SYM_TYPE_WORD   13
446 429
 #define EFI_IMAGE_SYM_TYPE_UINT   14
447 430
 #define EFI_IMAGE_SYM_TYPE_DWORD  15
448 431
 
449
-//
450
-// Type (derived) values.
451
-//
452
-#define EFI_IMAGE_SYM_DTYPE_NULL      0 // no derived type.
432
+///
433
+/// Symbol Type (derived) values.
434
+///
435
+#define EFI_IMAGE_SYM_DTYPE_NULL      0 ///< no derived type.
453 436
 #define EFI_IMAGE_SYM_DTYPE_POINTER   1
454 437
 #define EFI_IMAGE_SYM_DTYPE_FUNCTION  2
455 438
 #define EFI_IMAGE_SYM_DTYPE_ARRAY     3
456 439
 
457
-//
458
-// Storage classes.
459
-//
460
-#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION   (UINT8) -1
440
+///
441
+/// Storage classes.
442
+///
443
+#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION   ((UINT8) -1)
461 444
 #define EFI_IMAGE_SYM_CLASS_NULL              0
462 445
 #define EFI_IMAGE_SYM_CLASS_AUTOMATIC         1
463 446
 #define EFI_IMAGE_SYM_CLASS_EXTERNAL          2
@@ -494,15 +477,18 @@ typedef struct {
494 477
 #define EFI_IMAGE_N_BTSHFT  4
495 478
 #define EFI_IMAGE_N_TSHIFT  2
496 479
 
497
-//
498
-// Communal selection types.
499
-//
480
+///
481
+/// Communal selection types.
482
+///
500 483
 #define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES    1
501 484
 #define EFI_IMAGE_COMDAT_SELECT_ANY             2
502 485
 #define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE       3
503 486
 #define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH     4
504 487
 #define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE     5
505 488
 
489
+///
490
+/// the following values only be referred in PeCoff, not defined in PECOFF.
491
+///
506 492
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY  1
507 493
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY    2
508 494
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS      3
@@ -516,24 +502,27 @@ typedef struct {
516 502
   UINT16  Type;
517 503
 } EFI_IMAGE_RELOCATION;
518 504
 
505
+///
506
+/// Size of EFI_IMAGE_RELOCATION
507
+///
519 508
 #define EFI_IMAGE_SIZEOF_RELOCATION 10
520 509
 
521
-//
522
-// I386 relocation types.
523
-//
524
-#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000   // Reference is absolute, no relocation is necessary
525
-#define EFI_IMAGE_REL_I386_DIR16    0x0001  // Direct 16-bit reference to the symbols virtual address
526
-#define EFI_IMAGE_REL_I386_REL16    0x0002  // PC-relative 16-bit reference to the symbols virtual address
527
-#define EFI_IMAGE_REL_I386_DIR32    0x0006  // Direct 32-bit reference to the symbols virtual address
528
-#define EFI_IMAGE_REL_I386_DIR32NB  0x0007  // Direct 32-bit reference to the symbols virtual address, base not included
529
-#define EFI_IMAGE_REL_I386_SEG12    0x0009 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
530
-#define EFI_IMAGE_REL_I386_SECTION  0x001a
531
-#define EFI_IMAGE_REL_I386_SECREL   0x000b
532
-#define EFI_IMAGE_REL_I386_REL32    0x0014 // PC-relative 32-bit reference to the symbols virtual address
510
+///
511
+/// I386 relocation types.
512
+///
513
+#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000  ///< Reference is absolute, no relocation is necessary
514
+#define EFI_IMAGE_REL_I386_DIR16    0x0001  ///< Direct 16-bit reference to the symbols virtual address
515
+#define EFI_IMAGE_REL_I386_REL16    0x0002  ///< PC-relative 16-bit reference to the symbols virtual address
516
+#define EFI_IMAGE_REL_I386_DIR32    0x0006  ///< Direct 32-bit reference to the symbols virtual address
517
+#define EFI_IMAGE_REL_I386_DIR32NB  0x0007  ///< Direct 32-bit reference to the symbols virtual address, base not included
518
+#define EFI_IMAGE_REL_I386_SEG12    0x0009  ///< Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
519
+#define EFI_IMAGE_REL_I386_SECTION  0x000A
520
+#define EFI_IMAGE_REL_I386_SECREL   0x000B
521
+#define EFI_IMAGE_REL_I386_REL32    0x0014  ///< PC-relative 32-bit reference to the symbols virtual address
533 522
 
534
-//
535
-// x64 processor relocation types.
536
-//
523
+///
524
+/// x64 processor relocation types.
525
+///
537 526
 #define IMAGE_REL_AMD64_ABSOLUTE	0x0000
538 527
 #define IMAGE_REL_AMD64_ADDR64	  0x0001
539 528
 #define IMAGE_REL_AMD64_ADDR32	  0x0002
@@ -560,11 +549,14 @@ typedef struct {
560 549
   UINT32  SizeOfBlock;
561 550
 } EFI_IMAGE_BASE_RELOCATION;
562 551
 
552
+///
553
+/// Size of EFI_IMAGE_BASE_RELOCATION
554
+///
563 555
 #define EFI_IMAGE_SIZEOF_BASE_RELOCATION  8
564 556
 
565
-//
566
-// Based relocation types.
567
-//
557
+///
558
+/// Based relocation types.
559
+///
568 560
 #define EFI_IMAGE_REL_BASED_ABSOLUTE      0
569 561
 #define EFI_IMAGE_REL_BASED_HIGH          1
570 562
 #define EFI_IMAGE_REL_BASED_LOW           2
@@ -572,6 +564,7 @@ typedef struct {
572 564
 #define EFI_IMAGE_REL_BASED_HIGHADJ       4
573 565
 #define EFI_IMAGE_REL_BASED_MIPS_JMPADDR  5
574 566
 #define EFI_IMAGE_REL_BASED_IA64_IMM64    9
567
+#define IMAGE_REL_BASED_MIPS_JMPADDR16    9
575 568
 #define EFI_IMAGE_REL_BASED_DIR64         10
576 569
 
577 570
 ///
@@ -585,11 +578,14 @@ typedef struct {
585 578
   UINT16  Linenumber;         // Line number.
586 579
 } EFI_IMAGE_LINENUMBER;
587 580
 
581
+///
582
+/// Size of EFI_IMAGE_LINENUMBER
583
+///
588 584
 #define EFI_IMAGE_SIZEOF_LINENUMBER 6
589 585
 
590
-//
591
-// Archive format.
592
-//
586
+///
587
+/// Archive format.
588
+///
593 589
 #define EFI_IMAGE_ARCHIVE_START_SIZE        8
594 590
 #define EFI_IMAGE_ARCHIVE_START             "!<arch>\n"
595 591
 #define EFI_IMAGE_ARCHIVE_END               "`\n"
@@ -598,23 +594,27 @@ typedef struct {
598 594
 #define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER  "//              "
599 595
 
600 596
 typedef struct {
601
-  UINT8 Name[16];     // File member name - `/' terminated.
602
-  UINT8 Date[12];     // File member date - decimal.
603
-  UINT8 UserID[6];    // File member user id - decimal.
604
-  UINT8 GroupID[6];   // File member group id - decimal.
605
-  UINT8 Mode[8];      // File member mode - octal.
606
-  UINT8 Size[10];     // File member size - decimal.
607
-  UINT8 EndHeader[2]; // String to end header.
597
+  UINT8 Name[16];     ///< File member name - `/' terminated.
598
+  UINT8 Date[12];     ///< File member date - decimal.
599
+  UINT8 UserID[6];    ///< File member user id - decimal.
600
+  UINT8 GroupID[6];   ///< File member group id - decimal.
601
+  UINT8 Mode[8];      ///< File member mode - octal.
602
+  UINT8 Size[10];     ///< File member size - decimal.
603
+  UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A)
608 604
 } EFI_IMAGE_ARCHIVE_MEMBER_HEADER;
609 605
 
606
+///
607
+/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER
608
+///
610 609
 #define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
611 610
 
612
-//
613
-// DLL support.
614
-//
615 611
 
616 612
 ///
617
-/// DLL Export Format
613
+/// DLL Support
614
+///
615
+
616
+///
617
+/// Export Directory Table
618 618
 ///
619 619
 typedef struct {
620 620
   UINT32  Characteristics;
@@ -631,8 +631,7 @@ typedef struct {
631 631
 } EFI_IMAGE_EXPORT_DIRECTORY;
632 632
 
633 633
 ///
634
-/// DLL support.
635
-/// Import Format
634
+/// Hint/Name Table
636 635
 ///
637 636
 typedef struct {
638 637
   UINT16  Hint;
@@ -647,10 +646,13 @@ typedef struct {
647 646
   } u1;
648 647
 } EFI_IMAGE_THUNK_DATA;
649 648
 
650
-#define EFI_IMAGE_ORDINAL_FLAG              0x80000000
649
+#define EFI_IMAGE_ORDINAL_FLAG              BIT31    ///< Flag for PE32
651 650
 #define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal)  ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
652 651
 #define EFI_IMAGE_ORDINAL(Ordinal)          (Ordinal & 0xffff)
653 652
 
653
+///
654
+/// Import Directory Table
655
+///
654 656
 typedef struct {
655 657
   UINT32                Characteristics;
656 658
   UINT32                TimeDateStamp;
@@ -659,11 +661,10 @@ typedef struct {
659 661
   EFI_IMAGE_THUNK_DATA  *FirstThunk;
660 662
 } EFI_IMAGE_IMPORT_DESCRIPTOR;
661 663
 
664
+
662 665
 ///
663
-/// Debug Format
666
+/// Debug Direcotry Format
664 667
 ///
665
-#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2
666
-
667 668
 typedef struct {
668 669
   UINT32  Characteristics;
669 670
   UINT32  TimeDateStamp;
@@ -671,13 +672,18 @@ typedef struct {
671 672
   UINT16  MinorVersion;
672 673
   UINT32  Type;
673 674
   UINT32  SizeOfData;
674
-  UINT32  RVA;
675
-  UINT32  FileOffset;
675
+  UINT32  RVA;           ///< The address of the debug data when loaded, relative to the image base
676
+  UINT32  FileOffset;    ///< The file pointer to the debug data
676 677
 } EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
677 678
 
678
-#define CODEVIEW_SIGNATURE_NB10 0x3031424E  // "NB10"
679
+#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2     ///< The Visual C++ debug information
680
+
681
+///
682
+/// Debug Data Structure defined in Microsoft C++
683
+///
684
+#define CODEVIEW_SIGNATURE_NB10  SIGNATURE_32('N', 'B', '1', '0')
679 685
 typedef struct {
680
-  UINT32  Signature;                        // "NB10"
686
+  UINT32  Signature;                        ///< "NB10"
681 687
   UINT32  Unknown;
682 688
   UINT32  Unknown2;
683 689
   UINT32  Unknown3;
@@ -686,9 +692,12 @@ typedef struct {
686 692
   //
687 693
 } EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;
688 694
 
689
-#define CODEVIEW_SIGNATURE_RSDS 0x53445352  // "RSDS"
695
+///
696
+/// Debug Data Structure defined in Microsoft C++
697
+///
698
+#define CODEVIEW_SIGNATURE_RSDS  SIGNATURE_32('R', 'S', 'D', 'S')
690 699
 typedef struct {
691
-  UINT32  Signature;                        // "RSDS"
700
+  UINT32  Signature;                        ///< "RSDS"
692 701
   UINT32  Unknown;
693 702
   UINT32  Unknown2;
694 703
   UINT32  Unknown3;
@@ -700,21 +709,22 @@ typedef struct {
700 709
 } EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
701 710
 
702 711
 ///
703
-/// Header format for TE images
712
+/// Header format for TE images, defined in PI Specification, 1.0
704 713
 ///
705 714
 typedef struct {
706
-  UINT16                    Signature;            // signature for TE format = "VZ"
707
-  UINT16                    Machine;              // from the original file header
708
-  UINT8                     NumberOfSections;     // from the original file header
709
-  UINT8                     Subsystem;            // from original optional header
710
-  UINT16                    StrippedSize;         // how many bytes we removed from the header
711
-  UINT32                    AddressOfEntryPoint;  // offset to entry point -- from original optional header
712
-  UINT32                    BaseOfCode;           // from original image -- required for ITP debug
713
-  UINT64                    ImageBase;            // from original file header
714
-  EFI_IMAGE_DATA_DIRECTORY  DataDirectory[2];     // only base relocation and debug directory
715
+  UINT16                    Signature;            ///< signature for TE format = "VZ"
716
+  UINT16                    Machine;              ///< from the original file header
717
+  UINT8                     NumberOfSections;     ///< from the original file header
718
+  UINT8                     Subsystem;            ///< from original optional header
719
+  UINT16                    StrippedSize;         ///< how many bytes we removed from the header
720
+  UINT32                    AddressOfEntryPoint;  ///< offset to entry point -- from original optional header
721
+  UINT32                    BaseOfCode;           ///< from original image -- required for ITP debug
722
+  UINT64                    ImageBase;            ///< from original file header
723
+  EFI_IMAGE_DATA_DIRECTORY  DataDirectory[2];     ///< only base relocation and debug directory
715 724
 } EFI_TE_IMAGE_HEADER;
716 725
 
717
-#define EFI_TE_IMAGE_HEADER_SIGNATURE 0x5A56      // "VZ"
726
+
727
+#define EFI_TE_IMAGE_HEADER_SIGNATURE  SIGNATURE_16('V', 'Z')
718 728
 
719 729
 //
720 730
 // Data directory indexes in our TE image header

+ 2
- 2
src/include/gpxe/efi/Pi/PiBootMode.h View File

@@ -1,7 +1,7 @@
1 1
 /** @file
2 2
   Present the boot mode values in PI.
3 3
 
4
-  Copyright (c) 2006 - 2007, Intel Corporation
4
+  Copyright (c) 2006 - 2008, Intel Corporation
5 5
   All rights reserved. This program and the accompanying materials
6 6
   are licensed and made available under the terms and conditions of the BSD License
7 7
   which accompanies this distribution.  The full text of the license may be found at
@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 

+ 1
- 1
src/include/gpxe/efi/Pi/PiDependency.h View File

@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 #ifndef __PI_DEPENDENCY_H__

+ 1
- 1
src/include/gpxe/efi/Pi/PiDxeCis.h View File

@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 

+ 3
- 3
src/include/gpxe/efi/Pi/PiFirmwareFile.h View File

@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 
@@ -156,7 +156,7 @@ typedef struct {
156 156
 typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
157 157
 
158 158
 ///
159
-/// Leaf section witch contains a PI FV.
159
+/// Leaf section which contains a PI FV.
160 160
 ///
161 161
 typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
162 162
 
@@ -220,7 +220,7 @@ typedef struct {
220 220
 
221 221
 ///
222 222
 /// Leaf section which contains a numeric build number and
223
-/// an optional unicode string that represent the file revision.
223
+/// an optional unicode string that represents the file revision.
224 224
 ///
225 225
 typedef struct {
226 226
   EFI_COMMON_SECTION_HEADER   CommonHeader;

+ 2
- 2
src/include/gpxe/efi/Pi/PiFirmwareVolume.h View File

@@ -1,7 +1,7 @@
1 1
 /** @file
2 2
   The firmware volume related definitions in PI.
3 3
 
4
-  Copyright (c) 2006 - 2007, Intel Corporation
4
+  Copyright (c) 2006 - 2008, Intel Corporation
5 5
   All rights reserved. This program and the accompanying materials
6 6
   are licensed and made available under the terms and conditions of the BSD License
7 7
   which accompanies this distribution.  The full text of the license may be found at
@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 

+ 5
- 3
src/include/gpxe/efi/Pi/PiHob.h View File

@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 
@@ -76,7 +76,7 @@ typedef struct {
76 76
 ///
77 77
 typedef struct {
78 78
   ///
79
-  /// A GUID that defines the memory allocation region¡¯s type and purpose, as well as
79
+  /// A GUID that defines the memory allocation region's type and purpose, as well as
80 80
   /// other fields within the memory allocation HOB. This GUID is used to define the
81 81
   /// additional data within the HOB that may be present for the memory allocation HOB.
82 82
   /// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0
@@ -84,9 +84,11 @@ typedef struct {
84 84
   ///
85 85
   EFI_GUID              Name;
86 86
 
87
+  ///
87 88
   /// The base address of memory allocated by this HOB. Type
88 89
   /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
89 90
   /// specification.
91
+  ///
90 92
   EFI_PHYSICAL_ADDRESS  MemoryBaseAddress;
91 93
 
92 94
   ///
@@ -155,7 +157,7 @@ typedef struct {
155 157
 } EFI_HOB_MEMORY_ALLOCATION_MODULE;
156 158
 
157 159
 ///
158
-/// type of Recount type
160
+/// Resource type
159 161
 ///
160 162
 typedef UINT32 EFI_RESOURCE_TYPE;
161 163
 

+ 3
- 3
src/include/gpxe/efi/Pi/PiMultiPhase.h View File

@@ -1,7 +1,7 @@
1 1
 /** @file
2 2
   Include file matches things in PI for multiple module types.
3 3
 
4
-  Copyright (c) 2006 - 2007, Intel Corporation
4
+  Copyright (c) 2006 - 2008, Intel Corporation
5 5
   All rights reserved. This program and the accompanying materials
6 6
   are licensed and made available under the terms and conditions of the BSD License
7 7
   which accompanies this distribution.  The full text of the license may be found at
@@ -11,7 +11,7 @@
11 11
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  Version 1.0.
14
+  PI Version 1.0
15 15
 
16 16
 **/
17 17
 
@@ -93,7 +93,7 @@ typedef struct {
93 93
 
94 94
 
95 95
 //
96
-// Bit values for AuthenticationStatus
96
+// Bit values for Authentication Status
97 97
 //
98 98
 #define EFI_AUTH_STATUS_PLATFORM_OVERRIDE   0x01
99 99
 #define EFI_AUTH_STATUS_IMAGE_SIGNED        0x02

+ 18
- 53
src/include/gpxe/efi/Protocol/Cpu.h View File

@@ -255,59 +255,12 @@ EFI_STATUS
255 255
   );
256 256
 
257 257
 
258
-/**
259
-  @par Protocol Description:
260
-  The EFI_CPU_ARCH_PROTOCOL is used to abstract processor-specific functions from the DXE
261
-  Foundation. This includes flushing caches, enabling and disabling interrupts, hooking interrupt
262
-  vectors and exception vectors, reading internal processor timers, resetting the processor, and
263
-  determining the processor frequency.
264
-
265
-  @param FlushDataCache
266
-  Flushes a range of the processor's data cache. If the processor does
267
-  not contain a data cache, or the data cache is fully coherent, then this
268
-  function can just return EFI_SUCCESS. If the processor does not support
269
-  flushing a range of addresses from the data cache, then the entire data
270
-  cache must be flushed.
271
-
272
-  @param EnableInterrupt
273
-  Enables interrupt processing by the processor.
274
-
275
-  @param DisableInterrupt
276
-  Disables interrupt processing by the processor.
277
-
278
-  @param GetInterruptState
279
-  Retrieves the processor's current interrupt state.
280
-
281
-  @param Init
282
-  Generates an INIT on the processor. If a processor cannot programmatically
283
-  generate an INIT without help from external hardware, then this function
284
-  returns EFI_UNSUPPORTED.
285
-
286
-  @param RegisterInterruptHandler
287
-  Associates an interrupt service routine with one of the processor's interrupt
288
-  vectors. This function is typically used by the EFI_TIMER_ARCH_PROTOCOL to
289
-  hook the timer interrupt in a system. It can also be used by the debugger to
290
-  hook exception vectors.
291
-
292
-  @param GetTimerValue
293
-  Returns the value of one of the processor's internal timers.
294
-
295
-  @param SetMemoryAttributes
296
-  Attempts to set the attributes of a memory region.
297
-
298
-  @param NumberOfTimers
299
-  The number of timers that are available in a processor. The value in this
300
-  field is a constant that must not be modified after the CPU Architectural
301
-  Protocol is installed. All consumers must treat this as a read-only field.
302
-
303
-  @param DmaBufferAlignment
304
-  The size, in bytes, of the alignment required for DMA buffer allocations.
305
-  This is typically the size of the largest data cache line in the platform.
306
-  The value in this field is a constant that must not be modified after the
307
-  CPU Architectural Protocol is installed. All consumers must treat this as
308
-  a read-only field.
309
-
310
-**/
258
+///
259
+/// The EFI_CPU_ARCH_PROTOCOL is used to abstract processor-specific functions from the DXE
260
+/// Foundation. This includes flushing caches, enabling and disabling interrupts, hooking interrupt
261
+/// vectors and exception vectors, reading internal processor timers, resetting the processor, and
262
+/// determining the processor frequency.
263
+///
311 264
 struct _EFI_CPU_ARCH_PROTOCOL {
312 265
   EFI_CPU_FLUSH_DATA_CACHE            FlushDataCache;
313 266
   EFI_CPU_ENABLE_INTERRUPT            EnableInterrupt;
@@ -317,7 +270,19 @@ struct _EFI_CPU_ARCH_PROTOCOL {
317 270
   EFI_CPU_REGISTER_INTERRUPT_HANDLER  RegisterInterruptHandler;
318 271
   EFI_CPU_GET_TIMER_VALUE             GetTimerValue;
319 272
   EFI_CPU_SET_MEMORY_ATTRIBUTES       SetMemoryAttributes;
273
+  ///
274
+  /// The number of timers that are available in a processor. The value in this
275
+  /// field is a constant that must not be modified after the CPU Architectural
276
+  /// Protocol is installed. All consumers must treat this as a read-only field.
277
+  ///
320 278
   UINT32                              NumberOfTimers;
279
+  ///
280
+  /// The size, in bytes, of the alignment required for DMA buffer allocations.
281
+  /// This is typically the size of the largest data cache line in the platform.
282
+  /// The value in this field is a constant that must not be modified after the
283
+  /// CPU Architectural Protocol is installed. All consumers must treat this as
284
+  /// a read-only field.
285
+  ///
321 286
   UINT32                              DmaBufferAlignment;
322 287
 };
323 288
 

+ 31
- 53
src/include/gpxe/efi/Protocol/DebugSupport.h View File

@@ -58,13 +58,13 @@ typedef INTN  EFI_EXCEPTION_TYPE;
58 58
 #define EXCEPT_IA32_MACHINE_CHECK   18
59 59
 #define EXCEPT_IA32_SIMD            19
60 60
 
61
-//
62
-//  IA-32 processor context definition
63
-//
64
-//
65
-// FXSAVE_STATE
66
-// FP / MMX / XMM registers (see fxrstor instruction definition)
67
-//
61
+///
62
+///  IA-32 processor context definition
63
+///
64
+///
65
+/// FXSAVE_STATE
66
+/// FP / MMX / XMM registers (see fxrstor instruction definition)
67
+///
68 68
 typedef struct {
69 69
   UINT16  Fcw;
70 70
   UINT16  Fsw;
@@ -152,12 +152,12 @@ typedef struct {
152 152
 #define EXCEPT_X64_MACHINE_CHECK   18
153 153
 #define EXCEPT_X64_SIMD            19
154 154
 
155
-//
156
-//  X64 processor context definition
157
-//
158
-// FXSAVE_STATE
159
-// FP / MMX / XMM registers (see fxrstor instruction definition)
160
-//
155
+///
156
+///  X64 processor context definition
157
+///
158
+/// FXSAVE_STATE
159
+/// FP / MMX / XMM registers (see fxrstor instruction definition)
160
+///
161 161
 typedef struct {
162 162
   UINT16  Fcw;
163 163
   UINT16  Fsw;
@@ -278,9 +278,9 @@ typedef struct {
278 278
 #define EXCEPT_IPF_IA32_INTERCEPT 46
279 279
 #define EXCEPT_IPF_IA32_INTERRUPT 47
280 280
 
281
-//
282
-//  IPF processor context definition
283
-//
281
+///
282
+///  IPF processor context definition
283
+///
284 284
 typedef struct {
285 285
   //
286 286
   // The first reserved field is necessary to preserve alignment for the correct
@@ -510,14 +510,14 @@ VOID
510 510
   IN OUT EFI_SYSTEM_CONTEXT               SystemContext
511 511
   );
512 512
 
513
-//
514
-// Machine type definition
515
-//
513
+///
514
+/// Machine type definition
515
+///
516 516
 typedef enum {
517
-  IsaIa32 = IMAGE_FILE_MACHINE_I386, // 0x014C
518
-  IsaX64  = IMAGE_FILE_MACHINE_X64,   // 0x8664
519
-  IsaIpf  = IMAGE_FILE_MACHINE_IA64,  // 0x0200
520
-  IsaEbc  = IMAGE_FILE_MACHINE_EBC    // 0x0EBC
517
+  IsaIa32 = IMAGE_FILE_MACHINE_I386,  ///< 0x014C
518
+  IsaX64  = IMAGE_FILE_MACHINE_X64,   ///< 0x8664
519
+  IsaIpf  = IMAGE_FILE_MACHINE_IA64,  ///< 0x0200
520
+  IsaEbc  = IMAGE_FILE_MACHINE_EBC    ///< 0x0EBC
521 521
 } EFI_INSTRUCTION_SET_ARCHITECTURE;
522 522
 
523 523
 
@@ -613,37 +613,15 @@ EFI_STATUS
613 613
   IN UINT64                              Length
614 614
   );
615 615
 
616
-//
617
-// DebugSupport protocol definition
618
-//
619
-/**
620
-  @par Protocol Description:
621
-  This protocol provides the services to allow the debug agent to register
622
-  callback functions that are called either periodically or when specific
623
-  processor exceptions occur.
624
-
625
-  @param Isa
626
-  Declares the processor architecture for this instance of the EFI
627
-  Debug Support protocol.
628
-
629
-  @param GetMaximumProcessorIndex
630
-  Returns the maximum processor index value that may be used.
631
-
632
-  @param RegisterPeriodicCallback
633
-  Registers a callback function that will be invoked periodically
634
-  and asynchronously to the execution of EFI.
635
-
636
-  @param RegisterExceptionCallback
637
-  Registers a callback function that will be called each time the
638
-  specified processor exception occurs.
639
-
640
-  @param InvalidateInstructionCache
641
-  Invalidate the instruction cache of the processor. This is required
642
-  by processor architectures where instruction and data caches are
643
-  not coherent when instructions in the code under debug has been
644
-  modified by the debug agent.
645
-**/
616
+///
617
+/// This protocol provides the services to allow the debug agent to register
618
+/// callback functions that are called either periodically or when specific
619
+/// processor exceptions occur.
620
+///
646 621
 struct _EFI_DEBUG_SUPPORT_PROTOCOL {
622
+  ///
623
+  /// Declares the processor architecture for this instance of the EFI Debug Support protocol.
624
+  ///
647 625
   EFI_INSTRUCTION_SET_ARCHITECTURE  Isa;
648 626
   EFI_GET_MAXIMUM_PROCESSOR_INDEX   GetMaximumProcessorIndex;
649 627
   EFI_REGISTER_PERIODIC_CALLBACK    RegisterPeriodicCallback;

+ 26
- 51
src/include/gpxe/efi/Protocol/DevicePath.h View File

@@ -40,10 +40,30 @@
40 40
 
41 41
 #pragma pack(1)
42 42
 
43
+/**
44
+  This protocol can be used on any device handle to obtain generic path/location
45
+  information concerning the physical device or logical device. If the handle does
46
+  not logically map to a physical device, the handle may not necessarily support
47
+  the device path protocol. The device path describes the location of the device
48
+  the handle is for. The size of the Device Path can be determined from the structures
49
+  that make up the Device Path.
50
+**/
43 51
 typedef struct {
44
-  UINT8 Type;
45
-  UINT8 SubType;
46
-  UINT8 Length[2];
52
+  UINT8 Type;       ///< 0x01 Hardware Device Path
53
+                    ///< 0x02 ACPI Device Path
54
+                    ///< 0x03 Messaging Device Path
55
+                    ///< 0x04 Media Device Path
56
+                    ///< 0x05 BIOS Boot Specification Device Path
57
+                    ///< 0x7F End of Hardware Device Path
58
+
59
+  UINT8 SubType;    ///< Varies by Type
60
+                    ///< 0xFF End Entire Device Path, or
61
+                    ///< 0x01 End This Instance of a Device Path and start a new
62
+                    ///< Device Path
63
+
64
+  UINT8 Length[2];  ///< Specific Device Path data. Type and Sub-Type define
65
+                    ///< type of data. Size of data is included in Length.
66
+
47 67
 } EFI_DEVICE_PATH_PROTOCOL;
48 68
 
49 69
 ///
@@ -110,6 +130,7 @@ typedef struct {
110 130
   ///
111 131
   /// Optional variable length _HIDSTR
112 132
   /// Optional variable length _UIDSTR
133
+  /// Optional variable length _CIDSTR
113 134
   ///
114 135
 } ACPI_EXTENDED_HID_DEVICE_PATH;
115 136
 
@@ -505,55 +526,9 @@ typedef union {
505 526
 
506 527
 #pragma pack()
507 528
 
508
-#define EFI_DP_TYPE_MASK                     0x7F
509
-#define EFI_DP_TYPE_UNPACKED                 0x80
510 529
 #define END_DEVICE_PATH_TYPE                 0x7f
511
-
512
-#define EFI_END_ENTIRE_DEVICE_PATH           0xff
513
-#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE   0xff
514
-#define EFI_END_INSTANCE_DEVICE_PATH         0x01
515
-#define END_ENTIRE_DEVICE_PATH_SUBTYPE       EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
516
-#define END_INSTANCE_DEVICE_PATH_SUBTYPE     EFI_END_INSTANCE_DEVICE_PATH
517
-
518
-#define EFI_END_DEVICE_PATH_LENGTH           (sizeof (EFI_DEVICE_PATH_PROTOCOL))
519
-#define END_DEVICE_PATH_LENGTH               EFI_END_DEVICE_PATH_LENGTH
520
-
521
-#define DP_IS_END_TYPE(a)
522
-#define DP_IS_END_SUBTYPE(a)                 (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
523
-#define DevicePathSubType(a)                 ((a)->SubType)
524
-#define IsDevicePathUnpacked(a)              ((a)->Type & EFI_DP_TYPE_UNPACKED)
525
-
526
-#define EfiDevicePathNodeLength(a)           (((a)->Length[0]) | ((a)->Length[1] << 8))
527
-#define DevicePathNodeLength(a)              (EfiDevicePathNodeLength(a))
528
-#define EfiNextDevicePathNode(a)             ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
529
-#define NextDevicePathNode(a)                (EfiNextDevicePathNode(a))
530
-
531
-#define EfiDevicePathType(a)                 (((a)->Type) & EFI_DP_TYPE_MASK)
532
-#define DevicePathType(a)                    (EfiDevicePathType(a))
533
-#define EfiIsDevicePathEndType(a)            (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
534
-#define IsDevicePathEndType(a)               (EfiIsDevicePathEndType(a))
535
-
536
-
537
-#define EfiIsDevicePathEndSubType(a)         ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
538
-#define IsDevicePathEndSubType(a)            (EfiIsDevicePathEndSubType(a))
539
-#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
540
-
541
-#define EfiIsDevicePathEnd(a)                (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
542
-#define IsDevicePathEnd(a)                   (EfiIsDevicePathEnd(a))
543
-#define EfiIsDevicePathEndInstance(a)        (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
544
-
545
-
546
-#define SetDevicePathNodeLength(a,l) {                           \
547
-          (a)->Length[0] = (UINT8) (l);                          \
548
-          (a)->Length[1] = (UINT8) ((l) >> 8);                   \
549
-          }
550
-
551
-#define SetDevicePathEndNode(a)  {                               \
552
-          (a)->Type = END_DEVICE_PATH_TYPE;                      \
553
-          (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;         \
554
-          (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL);     \
555
-          (a)->Length[1] = 0;                                    \
556
-          }
530
+#define END_ENTIRE_DEVICE_PATH_SUBTYPE       0xFF
531
+#define END_INSTANCE_DEVICE_PATH_SUBTYPE     0x01
557 532
 
558 533
 extern EFI_GUID gEfiDevicePathProtocolGuid;
559 534
 

+ 49
- 62
src/include/gpxe/efi/Protocol/DriverBinding.h View File

@@ -18,7 +18,6 @@
18 18
 #ifndef __EFI_DRIVER_BINDING_H__
19 19
 #define __EFI_DRIVER_BINDING_H__
20 20
 
21
-#include <gpxe/efi/PiDxe.h>
22 21
 #include <gpxe/efi/Protocol/DevicePath.h>
23 22
 ///
24 23
 /// Global ID for the ControllerHandle Driver Protocol
@@ -31,7 +30,12 @@
31 30
 typedef struct _EFI_DRIVER_BINDING_PROTOCOL  EFI_DRIVER_BINDING_PROTOCOL;
32 31
 
33 32
 /**
34
-  Test to see if this driver supports ControllerHandle.
33
+  Test to see if this driver supports ControllerHandle. This service
34
+  is called by the EFI boot service ConnectController(). In
35
+  order to make drivers as small as possible, there are a few calling
36
+  restrictions for this service. ConnectController() must
37
+  follow these calling restrictions. If any other agent wishes to call
38
+  Supported() it must also follow these calling restrictions.
35 39
 
36 40
   @param  This                Protocol instance pointer.
37 41
   @param  ControllerHandle    Handle of device to test
@@ -52,7 +56,12 @@ EFI_STATUS
52 56
   );
53 57
 
54 58
 /**
55
-  Start this driver on ControllerHandle.
59
+  Start this driver on ControllerHandle. This service is called by the
60
+  EFI boot service ConnectController(). In order to make
61
+  drivers as small as possible, there are a few calling restrictions for
62
+  this service. ConnectController() must follow these
63
+  calling restrictions. If any other agent wishes to call Start() it
64
+  must also follow these calling restrictions.
56 65
 
57 66
   @param  This                 Protocol instance pointer.
58 67
   @param  ControllerHandle     Handle of device to bind driver to
@@ -73,7 +82,12 @@ EFI_STATUS
73 82
   );
74 83
 
75 84
 /**
76
-  Stop this driver on ControllerHandle.
85
+  Stop this driver on ControllerHandle. This service is called by the
86
+  EFI boot service DisconnectController(). In order to
87
+  make drivers as small as possible, there are a few calling
88
+  restrictions for this service. DisconnectController()
89
+  must follow these calling restrictions. If any other agent wishes
90
+  to call Stop() it must also follow these calling restrictions.
77 91
 
78 92
   @param  This              Protocol instance pointer.
79 93
   @param  ControllerHandle  Handle of device to stop driver on
@@ -94,70 +108,43 @@ EFI_STATUS
94 108
   IN  EFI_HANDLE                            *ChildHandleBuffer OPTIONAL
95 109
   );
96 110
 
97
-//
98
-// Interface structure for the ControllerHandle Driver Protocol
99
-//
100
-/**
101
-  @par Protocol Description:
102
-  This protocol provides the services required to determine if a driver supports a given controller.
103
-  If a controller is supported, then it also provides routines to start and stop the controller.
104
-
105
-  @param Supported
106
-  Tests to see if this driver supports a given controller. This service
107
-  is called by the EFI boot service ConnectController(). In
108
-  order to make drivers as small as possible, there are a few calling
109
-  restrictions for this service. ConnectController() must
110
-  follow these calling restrictions. If any other agent wishes to call
111
-  Supported() it must also follow these calling restrictions.
112
-
113
-
114
-  @param Start
115
-  Starts a controller using this driver. This service is called by the
116
-  EFI boot service ConnectController(). In order to make
117
-  drivers as small as possible, there are a few calling restrictions for
118
-  this service. ConnectController() must follow these
119
-  calling restrictions. If any other agent wishes to call Start() it
120
-  must also follow these calling restrictions.
121
-
122
-  @param Stop
123
-  Stops a controller using this driver. This service is called by the
124
-  EFI boot service DisconnectController(). In order to
125
-  make drivers as small as possible, there are a few calling
126
-  restrictions for this service. DisconnectController()
127
-  must follow these calling restrictions. If any other agent wishes
128
-  to call Stop() it must also follow these calling restrictions.
129
-
130
-  @param Version
131
-  The version number of the UEFI driver that produced the
132
-  EFI_DRIVER_BINDING_PROTOCOL. This field is used by
133
-  the EFI boot service ConnectController() to determine
134
-  the order that driver's Supported() service will be used when
135
-  a controller needs to be started. EFI Driver Binding Protocol
136
-  instances with higher Version values will be used before ones
137
-  with lower Version values. The Version values of 0x0-
138
-  0x0f and 0xfffffff0-0xffffffff are reserved for
139
-  platform/OEM specific drivers. The Version values of 0x10-
140
-  0xffffffef are reserved for IHV-developed drivers.
141
-
142
-  @param ImageHandle
143
-  The image handle of the UEFI driver that produced this instance
144
-  of the EFI_DRIVER_BINDING_PROTOCOL.
145
-
146
-  @param DriverBindingHandle
147
-  The handle on which this instance of the
148
-  EFI_DRIVER_BINDING_PROTOCOL is installed. In most
149
-  cases, this is the same handle as ImageHandle. However, for
150
-  UEFI drivers that produce more than one instance of the
151
-  EFI_DRIVER_BINDING_PROTOCOL, this value may not be
152
-  the same as ImageHandle.
153
-
154
-**/
111
+///
112
+/// This protocol provides the services required to determine if a driver supports a given controller.
113
+/// If a controller is supported, then it also provides routines to start and stop the controller.
114
+///
155 115
 struct _EFI_DRIVER_BINDING_PROTOCOL {
156 116
   EFI_DRIVER_BINDING_SUPPORTED  Supported;
157 117
   EFI_DRIVER_BINDING_START      Start;
158 118
   EFI_DRIVER_BINDING_STOP       Stop;
119
+
120
+  ///
121
+  /// The version number of the UEFI driver that produced the
122
+  /// EFI_DRIVER_BINDING_PROTOCOL. This field is used by
123
+  /// the EFI boot service ConnectController() to determine
124
+  /// the order that driver's Supported() service will be used when
125
+  /// a controller needs to be started. EFI Driver Binding Protocol
126
+  /// instances with higher Version values will be used before ones
127
+  /// with lower Version values. The Version values of 0x0-
128
+  /// 0x0f and 0xfffffff0-0xffffffff are reserved for
129
+  /// platform/OEM specific drivers. The Version values of 0x10-
130
+  /// 0xffffffef are reserved for IHV-developed drivers.
131
+  ///
159 132
   UINT32                        Version;
133
+
134
+  ///
135
+  /// The image handle of the UEFI driver that produced this instance
136
+  /// of the EFI_DRIVER_BINDING_PROTOCOL.
137
+  ///
160 138
   EFI_HANDLE                    ImageHandle;
139
+
140
+  ///
141
+  /// The handle on which this instance of the
142
+  /// EFI_DRIVER_BINDING_PROTOCOL is installed. In most
143
+  /// cases, this is the same handle as ImageHandle. However, for
144
+  /// UEFI drivers that produce more than one instance of the
145
+  /// EFI_DRIVER_BINDING_PROTOCOL, this value may not be
146
+  /// the same as ImageHandle.
147
+  ///
161 148
   EFI_HANDLE                    DriverBindingHandle;
162 149
 };
163 150
 

+ 41
- 99
src/include/gpxe/efi/Protocol/PciIo.h View File

@@ -48,27 +48,27 @@ typedef enum {
48 48
 //
49 49
 // Complete PCI address generater
50 50
 //
51
-#define EFI_PCI_IO_PASS_THROUGH_BAR               0xff    // Special BAR that passes a memory or I/O cycle through unchanged
52
-#define EFI_PCI_IO_ATTRIBUTE_MASK                 0x077f  // All the following I/O and Memory cycles
53
-#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  // I/O cycles 0x0000-0x00FF (10 bit decode)
54
-#define EFI_PCI_IO_ATTRIBUTE_ISA_IO               0x0002  // I/O cycles 0x0100-0x03FF or greater (10 bit decode)
55
-#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO       0x0004  // I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
56
-#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY           0x0008  // MEM cycles 0xA0000-0xBFFFF (24 bit decode)
57
-#define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
58
-#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  // I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
59
-#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO     0x0040  // I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
60
-#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  // Map a memory range so write are combined
61
-#define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  // Enable the I/O decode bit in the PCI Config Header
62
-#define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  // Enable the Memory decode bit in the PCI Config Header
63
-#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  // Enable the DMA bit in the PCI Config Header
64
-#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        0x0800  // Map a memory range so all r/w accesses are cached
65
-#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       0x1000  // Disable a memory range
66
-#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      0x2000  // Clear for an add-in PCI Device
67
-#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         0x4000  // Clear for a physical PCI Option ROM accessed through ROM BAR
68
-#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  // Clear for PCI controllers that can not genrate a DAC
69
-#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16            0x10000 // I/O cycles 0x0100-0x03FF or greater (16 bit decode)
70
-#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16    0x20000 // I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
71
-#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16            0x30000 // I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
51
+#define EFI_PCI_IO_PASS_THROUGH_BAR               0xff    ///< Special BAR that passes a memory or I/O cycle through unchanged
52
+#define EFI_PCI_IO_ATTRIBUTE_MASK                 0x077f  ///< All the following I/O and Memory cycles
53
+#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  ///< I/O cycles 0x0000-0x00FF (10 bit decode)
54
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO               0x0002  ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode)
55
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO       0x0004  ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
56
+#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY           0x0008  ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode)
57
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
58
+#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
59
+#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO     0x0040  ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
60
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  ///< Map a memory range so write are combined
61
+#define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  ///< Enable the I/O decode bit in the PCI Config Header
62
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  ///< Enable the Memory decode bit in the PCI Config Header
63
+#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  ///< Enable the DMA bit in the PCI Config Header
64
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        0x0800  ///< Map a memory range so all r/w accesses are cached
65
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       0x1000  ///< Disable a memory range
66
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      0x2000  ///< Clear for an add-in PCI Device
67
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         0x4000  ///< Clear for a physical PCI Option ROM accessed through ROM BAR
68
+#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  ///< Clear for PCI controllers that can not genrate a DAC
69
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16            0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode)
70
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16    0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
71
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16            0x30000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
72 72
 
73 73
 #define EFI_PCI_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
74 74
 #define EFI_VGA_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO)
@@ -474,84 +474,13 @@ EFI_STATUS
474 474
   IN OUT UINT64                       *Length
475 475
   );
476 476
 
477
-/**
478
-  @par Protocol Description:
479
-  The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration,
480
-  and DMA interfaces that are used to abstract accesses to PCI controllers.
481
-  There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
482
-  A device driver that wishes to manage a PCI controller in a system will have to
483
-  retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.
484
-
485
-  @param PollMem
486
-  Polls an address in PCI memory space until an exit condition is met, or a timeout occurs.
487
-
488
-  @param PollIo
489
-  Polls an address in PCI I/O space until an exit condition is met, or a timeout occurs.
490
-
491
-  @param Mem.Read
492
-  Allows BAR relative reads to PCI memory space.
493
-
494
-  @param Mem.Write
495
-  Allows BAR relative writes to PCI memory space.
496
-
497
-  @param Io.Read
498
-  Allows BAR relative reads to PCI I/O space.
499
-
500
-  @param Io.Write
501
-  Allows BAR relative writes to PCI I/O space.
502
-
503
-  @param Pci.Read
504
-  Allows PCI controller relative reads to PCI configuration space.
505
-
506
-  @param Pci.Write
507
-  Allows PCI controller relative writes to PCI configuration space.
508
-
509
-  @param CopyMem
510
-  Allows one region of PCI memory space to be copied to another region of PCI memory space.
511
-
512
-  @param Map
513
-  Provides the PCI controller's specific address needed to access system memory for DMA.
514
-
515
-  @param Unmap
516
-  Releases any resources allocated by Map().
517
-
518
-  @param AllocateBuffer
519
-  Allocates pages that are suitable for a common buffer mapping.
520
-
521
-  @param FreeBuffer
522
-  Frees pages that were allocated with AllocateBuffer().
523
-
524
-  @param Flush
525
-  Flushes all PCI posted write transactions to system memory.
526
-
527
-  @param GetLocation
528
-  Retrieves this PCI controller's current PCI bus number, device number, and function number.
529
-
530
-  @param Attributes
531
-  Performs an operation on the attributes that this PCI controller supports.
532
-  The operations include getting the set of supported attributes, retrieving
533
-  the current attributes, setting the current
534
-  attributes, enabling attributes, and disabling attributes.
535
-
536
-  @param GetBarAttributes
537
-  Gets the attributes that this PCI controller supports setting on a BAR using
538
-  SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
539
-
540
-  @param SetBarAttributes
541
-  Sets the attributes for a range of a BAR on a PCI controller.
542
-
543
-  @param RomSize
544
-  The size, in bytes, of the ROM image.
545
-
546
-  @param RomImage
547
-  A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible
548
-  for allocating memory for the ROM image, and copying the contents of the ROM to memory.
549
-  The contents of this buffer are either from the PCI option ROM that can be accessed
550
-  through the ROM BAR of the PCI controller, or it is from a platform-specific location.
551
-  The Attributes() function can be used to determine from which of these two sources
552
-  the RomImage buffer was initialized.
553
-
554
-**/
477
+///
478
+/// The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration,
479
+/// and DMA interfaces that are used to abstract accesses to PCI controllers.
480
+/// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
481
+/// A device driver that wishes to manage a PCI controller in a system will have to
482
+/// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.
483
+///
555 484
 struct _EFI_PCI_IO_PROTOCOL {
556 485
   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollMem;
557 486
   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollIo;
@@ -568,7 +497,20 @@ struct _EFI_PCI_IO_PROTOCOL {
568 497
   EFI_PCI_IO_PROTOCOL_ATTRIBUTES          Attributes;
569 498
   EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES  GetBarAttributes;
570 499
   EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES  SetBarAttributes;
500
+
501
+  ///
502
+  /// The size, in bytes, of the ROM image.
503
+  ///
571 504
   UINT64                                  RomSize;
505
+
506
+  ///
507
+  /// A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible
508
+  /// for allocating memory for the ROM image, and copying the contents of the ROM to memory.
509
+  /// The contents of this buffer are either from the PCI option ROM that can be accessed
510
+  /// through the ROM BAR of the PCI controller, or it is from a platform-specific location.
511
+  /// The Attributes() function can be used to determine from which of these two sources
512
+  /// the RomImage buffer was initialized.
513
+  ///
572 514
   VOID                                    *RomImage;
573 515
 };
574 516
 

+ 11
- 68
src/include/gpxe/efi/Protocol/PciRootBridgeIo.h View File

@@ -19,8 +19,6 @@
19 19
 #ifndef __PCI_ROOT_BRIDGE_IO_H__
20 20
 #define __PCI_ROOT_BRIDGE_IO_H__
21 21
 
22
-#include <gpxe/efi/PiDxe.h>
23
-
24 22
 #define EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID \
25 23
   { \
26 24
     0x2f707ebb, 0x4a1a, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
@@ -360,73 +358,14 @@ EFI_STATUS
360 358
   OUT VOID                                     **Resources
361 359
   );
362 360
 
363
-/**
364
-  @par Protocol Description:
365
-  Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are
366
-  used to abstract accesses to PCI controllers behind a PCI Root Bridge Controller.
367
-
368
-  @param ParentHandle
369
-  The EFI_HANDLE of the PCI Host Bridge of which this PCI Root Bridge is a member.
370
-
371
-  @param PollMem
372
-  Polls an address in memory mapped I/O space until an exit condition is met,
373
-  or a timeout occurs.
374
-
375
-  @param PollIo
376
-  Polls an address in I/O space until an exit condition is met, or a timeout occurs.
377
-
378
-  @param Mem.Read
379
-  Allows reads from memory mapped I/O space.
380
-
381
-  @param Mem.Write
382
-  Allows writes to memory mapped I/O space.
383
-
384
-  @param Io.Read
385
-  Allows reads from I/O space.
386
-
387
-  @param Io.Write
388
-  Allows writes to I/O space.
389
-
390
-  @param Pci.Read
391
-  Allows reads from PCI configuration space.
392
-
393
-  @param Pci.Write
394
-  Allows writes to PCI configuration space.
395
-
396
-  @param CopyMem
397
-  Allows one region of PCI root bridge memory space to be copied to another
398
-  region of PCI root bridge memory space.
399
-
400
-  @param Map
401
-  Provides the PCI controller's specific addresses needed to access system memory for DMA.
402
-
403
-  @param Unmap
404
-  Releases any resources allocated by Map().
405
-
406
-  @param AllocateBuffer
407
-  Allocates pages that are suitable for a common buffer mapping.
408
-
409
-  @param FreeBuffer
410
-  Free pages that were allocated with AllocateBuffer().
411
-
412
-  @param Flush
413
-  Flushes all PCI posted write transactions to system memory.
414
-
415
-  @param GetAttributes
416
-  Gets the attributes that a PCI root bridge supports setting with SetAttributes(),
417
-  and the attributes that a PCI root bridge is currently using.
418
-
419
-  @param SetAttributes
420
-  Sets attributes for a resource range on a PCI root bridge.
421
-
422
-  @param Configuration
423
-  Gets the current resource settings for this PCI root bridge.
424
-
425
-  @param SegmentNumber
426
-  The segment number that this PCI root bridge resides.
427
-
428
-**/
361
+///
362
+/// Provides the basic Memory, I/O, PCI configuration, and DMA interfaces that are
363
+/// used to abstract accesses to PCI controllers behind a PCI Root Bridge Controller.
364
+///
429 365
 struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {
366
+  ///
367
+  /// The EFI_HANDLE of the PCI Host Bridge of which this PCI Root Bridge is a member.
368
+  ///
430 369
   EFI_HANDLE                                      ParentHandle;
431 370
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM     PollMem;
432 371
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM     PollIo;
@@ -442,6 +381,10 @@ struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL {
442 381
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES  GetAttributes;
443 382
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES  SetAttributes;
444 383
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION   Configuration;
384
+
385
+  ///
386
+  /// The segment number that this PCI root bridge resides.
387
+  ///
445 388
   UINT32                                          SegmentNumber;
446 389
 };
447 390
 

+ 17
- 69
src/include/gpxe/efi/Protocol/SimpleNetwork.h View File

@@ -552,76 +552,18 @@ EFI_STATUS
552 552
 //
553 553
 #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION   EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
554 554
 
555
-/**
556
-  @par Protocol Description:
557
-  The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access
558
-  to a network adapter. Once the network adapter initializes,
559
-  the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that
560
-  allow packets to be transmitted and received.
561
-
562
-  @param Revision
563
-  Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must
564
-  be backwards compatible. If a future version is not backwards compatible
565
-  it is not the same GUID.
566
-
567
-  @param Start
568
-  Prepares the network interface for further command operations.
569
-  No other EFI_SIMPLE_NETWORK_PROTOCOL interface functions will operate
570
-  until this call is made.
571
-
572
-  @param Stop
573
-  Stops further network interface command processing.
574
-  No other EFI_SIMPLE_NETWORK_PROTOCOL interface functions will operate
575
-  after this call is made until another Start() call is made.
576
-
577
-  @param Initialize
578
-  Resets the network adapter and allocates the transmit and receive buffers.
579
-
580
-  @param Reset
581
-  Resets the network adapter and reinitializes it with the parameters
582
-  provided in the previous call to Initialize().
583
-
584
-  @param Shutdown
585
-  Resets the network adapter and leaves it in a state safe for another driver
586
-  to initialize. The memory buffers assigned in the Initialize() call are released.
587
-  After this call, only the Initialize() or Stop() calls may be used.
588
-
589
-  @param ReceiveFilters
590
-  Enables and disables the receive filters for the network interface and,
591
-  if supported, manages the filtered multicast
592
-  HW MAC (Hardware Media Access Control) address list.
593
-
594
-  @param StationAddress
595
-  Modifies or resets the current station address, if supported.
596
-
597
-  @param Statistics
598
-  Collects statistics from the network interface and allows the statistics to be reset.
599
-
600
-  @param MCastIpToMac
601
-  Maps a multicast IP address to a multicast HW MAC address.
602
-
603
-  @param NvData
604
-  Reads and writes the contents of the NVRAM devices attached to the network interface.
605
-
606
-  @param GetStatus
607
-  Reads the current interrupt status and the list of recycled transmit
608
-  buffers from the network interface.
609
-
610
-  @param Transmit
611
-  Places a packet in the transmit queue.
612
-
613
-  @param Receive
614
-  Retrieves a packet from the receive queue, along with the status
615
-  flags that describe the packet type.
616
-
617
-  @param WaitForPacket
618
-  Event used with WaitForEvent() to wait for a packet to be received.
619
-
620
-  @param Mode
621
-  Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
622
-
623
-**/
555
+///
556
+/// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access
557
+/// to a network adapter. Once the network adapter initializes,
558
+/// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that
559
+/// allow packets to be transmitted and received.
560
+///
624 561
 struct _EFI_SIMPLE_NETWORK_PROTOCOL {
562
+  ///
563
+  /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must
564
+  /// be backwards compatible. If a future version is not backwards compatible
565
+  /// it is not the same GUID.
566
+  ///
625 567
   UINT64                              Revision;
626 568
   EFI_SIMPLE_NETWORK_START            Start;
627 569
   EFI_SIMPLE_NETWORK_STOP             Stop;
@@ -636,7 +578,13 @@ struct _EFI_SIMPLE_NETWORK_PROTOCOL {
636 578
   EFI_SIMPLE_NETWORK_GET_STATUS       GetStatus;
637 579
   EFI_SIMPLE_NETWORK_TRANSMIT         Transmit;
638 580
   EFI_SIMPLE_NETWORK_RECEIVE          Receive;
581
+  ///
582
+  /// Event used with WaitForEvent() to wait for a packet to be received.
583
+  ///
639 584
   EFI_EVENT                           WaitForPacket;
585
+  ///
586
+  /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
587
+  ///
640 588
   EFI_SIMPLE_NETWORK_MODE             *Mode;
641 589
 };
642 590
 

+ 7
- 16
src/include/gpxe/efi/Protocol/SimpleTextIn.h View File

@@ -118,25 +118,16 @@ EFI_STATUS
118 118
   OUT EFI_INPUT_KEY                       *Key
119 119
   );
120 120
 
121
-/**
122
-  @par Protocol Description:
123
-  The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
124
-  It is the minimum required protocol for ConsoleIn.
125
-
126
-  @param Reset
127
-  Reset the ConsoleIn device.
128
-
129
-  @param ReadKeyStroke
130
-  Returns the next input character.
131
-
132
-  @param WaitForKey
133
-  Event to use with WaitForEvent() to wait for a key to be available.
134
-
135
-**/
136
-
121
+///
122
+/// The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
123
+/// It is the minimum required protocol for ConsoleIn.
124
+///
137 125
 struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
138 126
   EFI_INPUT_RESET     Reset;
139 127
   EFI_INPUT_READ_KEY  ReadKeyStroke;
128
+  ///
129
+  /// Event to use with WaitForEvent() to wait for a key to be available
130
+  ///
140 131
   EFI_EVENT           WaitForKey;
141 132
 };
142 133
 

+ 9
- 42
src/include/gpxe/efi/Protocol/SimpleTextOut.h View File

@@ -20,8 +20,6 @@
20 20
 #ifndef __SIMPLE_TEXT_OUT_H__
21 21
 #define __SIMPLE_TEXT_OUT_H__
22 22
 
23
-#include <gpxe/efi/PiDxe.h>
24
-
25 23
 #define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
26 24
   { \
27 25
     0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
@@ -375,43 +373,12 @@ typedef struct {
375 373
   BOOLEAN CursorVisible;
376 374
 } EFI_SIMPLE_TEXT_OUTPUT_MODE;
377 375
 
378
-/**
379
-  @par Protocol Description:
380
-  The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
381
-  It is the minimum required protocol for any handle supplied as the ConsoleOut
382
-  or StandardError device. In addition, the minimum supported text mode of such
383
-  devices is at least 80 x 25 characters.
384
-
385
-  @param Reset
386
-  Reset the ConsoleOut device.
387
-
388
-  @param OutputString
389
-  Displays the Unicode string on the device at the current cursor location.
390
-
391
-  @param TestString
392
-  Tests to see if the ConsoleOut device supports this Unicode string.
393
-
394
-  @param QueryMode
395
-  Queries information concerning the output device's supported text mode.
396
-
397
-  @param SetMode
398
-  Sets the current mode of the output device.
399
-
400
-  @param SetAttribute
401
-  Sets the foreground and background color of the text that is output.
402
-
403
-  @param ClearScreen
404
-  Clears the screen with the currently set background color.
405
-
406
-  @param SetCursorPosition
407
-  Sets the current cursor position.
408
-
409
-  @param EnableCursor
410
-  Turns the visibility of the cursor on/off.
411
-
412
-  @param Mode
413
-  Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
414
-**/
376
+///
377
+/// The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
378
+/// It is the minimum required protocol for any handle supplied as the ConsoleOut
379
+/// or StandardError device. In addition, the minimum supported text mode of such
380
+/// devices is at least 80 x 25 characters.
381
+///
415 382
 struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
416 383
   EFI_TEXT_RESET                Reset;
417 384
 
@@ -426,9 +393,9 @@ struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
426 393
   EFI_TEXT_SET_CURSOR_POSITION  SetCursorPosition;
427 394
   EFI_TEXT_ENABLE_CURSOR        EnableCursor;
428 395
 
429
-  //
430
-  // Current mode
431
-  //
396
+  ///
397
+  /// Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
398
+  ///
432 399
   EFI_SIMPLE_TEXT_OUTPUT_MODE   *Mode;
433 400
 };
434 401
 

+ 47
- 21
src/include/gpxe/efi/Uefi/UefiBaseType.h View File

@@ -1,5 +1,4 @@
1 1
 /** @file
2
-
3 2
   Defines data types and constants introduced in UEFI.
4 3
 
5 4
   Copyright (c) 2006 - 2008, Intel Corporation
@@ -18,33 +17,40 @@
18 17
 
19 18
 #include <gpxe/efi/Base.h>
20 19
 
20
+//
21
+// Basical data type definitions introduced in UEFI.
22
+//
23
+
21 24
 ///
22
-/// Basical data type definitions introduced in UEFI.
25
+/// 128-bit buffer containing a unique identifier value.
23 26
 ///
24 27
 typedef GUID                      EFI_GUID;
25
-
26 28
 ///
27 29
 /// Function return status for EFI API
28 30
 ///
29 31
 typedef RETURN_STATUS             EFI_STATUS;
32
+///
33
+/// A collection of related interfaces.
34
+///
30 35
 typedef VOID                      *EFI_HANDLE;
31
-
36
+///
37
+/// Handle to an event structure.
38
+///
32 39
 typedef VOID                      *EFI_EVENT;
33
-
40
+///
41
+/// Task priority level.
42
+///
34 43
 typedef UINTN                     EFI_TPL;
35
-
36
-
44
+///
45
+/// Logical block address.
46
+///
37 47
 typedef UINT64                    EFI_LBA;
38
-
39
-
40
-typedef UINT16                    STRING_REF;
41
-
42 48
 typedef UINT64                    EFI_PHYSICAL_ADDRESS;
43 49
 typedef UINT64                    EFI_VIRTUAL_ADDRESS;
44 50
 
45 51
 ///
46 52
 /// EFI Time Abstraction:
47
-///  Year:       2000 - 20XX
53
+///  Year:       1998 - 20XX
48 54
 ///  Month:      1 - 12
49 55
 ///  Day:        1 - 31
50 56
 ///  Hour:       0 - 23
@@ -68,21 +74,31 @@ typedef struct {
68 74
 } EFI_TIME;
69 75
 
70 76
 
71
-//
72
-// Networking Definitions
73
-//
77
+///
78
+/// 4-byte buffer. An IPv4 internet protocol address.
79
+///
74 80
 typedef struct {
75 81
   UINT8 Addr[4];
76 82
 } EFI_IPv4_ADDRESS;
77 83
 
84
+///
85
+/// 16-byte buffer. An IPv6 internet protocol address
86
+///
78 87
 typedef struct {
79 88
   UINT8 Addr[16];
80 89
 } EFI_IPv6_ADDRESS;
81 90
 
91
+///
92
+/// 32-byte buffer containing a network Media Access Control address.
93
+///
82 94
 typedef struct {
83 95
   UINT8 Addr[32];
84 96
 } EFI_MAC_ADDRESS;
85 97
 
98
+///
99
+/// 16-byte buffer aligned on a 4-byte boundary.
100
+/// An IPv4 or IPv6 internet protocol address.
101
+///
86 102
 typedef union {
87 103
   UINT32            Addr[4];
88 104
   EFI_IPv4_ADDRESS  v4;
@@ -131,8 +147,6 @@ typedef union {
131 147
 #define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
132 148
 
133 149
 
134
-#define NULL_HANDLE               ((VOID *) 0)
135
-
136 150
 //
137 151
 // Define macro to encode the status code.
138 152
 //
@@ -143,10 +157,9 @@ typedef union {
143 157
 //
144 158
 // Define macros to build data structure signatures from characters.
145 159
 //
146
-#define EFI_SIGNATURE_16(A, B)        ((A) | (B << 8))
147
-#define EFI_SIGNATURE_32(A, B, C, D)  (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
148
-#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
149
-    (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
160
+#define EFI_SIGNATURE_16(A, B)                    SIGNATURE_16 (A, B)
161
+#define EFI_SIGNATURE_32(A, B, C, D)              SIGNATURE_32 (A, B, C, D)
162
+#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H)  SIGNATURE_64 (A, B, C, D, E, F, G, H)
150 163
 
151 164
 
152 165
 ///
@@ -171,4 +184,17 @@ typedef union {
171 184
 #define EFI_MAX_BIT               MAX_BIT
172 185
 #define EFI_MAX_ADDRESS           MAX_ADDRESS
173 186
 
187
+
188
+///
189
+/// Limited buffer size for a language code recommended by RFC3066
190
+/// (42 characters plus a NULL terminator)
191
+///
192
+#define RFC_3066_ENTRY_SIZE             (42 + 1)
193
+
194
+///
195
+/// The size of a 3 character ISO639 language code.
196
+///
197
+#define ISO_639_2_ENTRY_SIZE            3
198
+
199
+
174 200
 #endif

+ 5
- 9
src/include/gpxe/efi/Uefi/UefiGpt.h View File

@@ -1,7 +1,7 @@
1 1
 /** @file
2 2
   EFI Guid Partition Table Format Definition.
3 3
 
4
-  Copyright (c) 2006 - 2007, Intel Corporation
4
+  Copyright (c) 2006 - 2008, Intel Corporation
5 5
   All rights reserved. This program and the accompanying materials
6 6
   are licensed and made available under the terms and conditions of the BSD License
7 7
   which accompanies this distribution.  The full text of the license may be found at
@@ -15,6 +15,10 @@
15 15
 #ifndef __UEFI_GPT_H__
16 16
 #define __UEFI_GPT_H__
17 17
 
18
+///
19
+/// The primary GUID Partition Table Header must be
20
+/// located in LBA 1 (i.e., the second logical block).
21
+///
18 22
 #define PRIMARY_PART_HEADER_LBA 1
19 23
 
20 24
 ///
@@ -52,14 +56,6 @@ typedef struct {
52 56
   CHAR16    PartitionName[36];
53 57
 } EFI_PARTITION_ENTRY;
54 58
 
55
-///
56
-/// GPT Partition Entry Status
57
-///
58
-typedef struct {
59
-  BOOLEAN OutOfRange;
60
-  BOOLEAN Overlap;
61
-} EFI_PARTITION_ENTRY_STATUS;
62
-
63 59
 #pragma pack()
64 60
 #endif
65 61
 

+ 156
- 65
src/include/gpxe/efi/Uefi/UefiInternalFormRepresentation.h View File

@@ -23,8 +23,6 @@
23 23
 ///
24 24
 /// The following types are currently defined:
25 25
 ///
26
-typedef UINT32  RELOFST;
27
-
28 26
 typedef VOID*   EFI_HII_HANDLE;
29 27
 typedef CHAR16* EFI_STRING;
30 28
 typedef UINT16  EFI_IMAGE_ID;
@@ -32,45 +30,31 @@ typedef UINT16  EFI_QUESTION_ID;
32 30
 typedef UINT16  EFI_STRING_ID;
33 31
 typedef UINT16  EFI_FORM_ID;
34 32
 typedef UINT16  EFI_VARSTORE_ID;
33
+
35 34
 typedef UINT16  EFI_DEFAULT_ID;
35
+
36 36
 typedef UINT32  EFI_HII_FONT_STYLE;
37 37
 
38 38
 
39 39
 
40 40
 #pragma pack(1)
41 41
 
42
+//
43
+// Definitions for Package Lists and Package Headers
44
+// Section 27.3.1
45
+//
42 46
 
43 47
 ///
44
-/// HII package list
48
+/// The header found at the start of each package list.
45 49
 ///
46 50
 typedef struct {
47 51
   EFI_GUID               PackageListGuid;
48 52
   UINT32                 PackageLength;
49 53
 } EFI_HII_PACKAGE_LIST_HEADER;
50 54
 
51
-/**
52
-
53
-  Each package starts with a header, as defined above, which
54
-  indicates the size and type of the package. When added to a
55
-  pointer pointing to the start of the header, Length points at
56
-  the next package. The package lists form a package list when
57
-  concatenated together and terminated with an
58
-  EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The
59
-  type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII
60
-  packages, whose contents are determined by the Guid. The range
61
-  of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN
62
-  through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system
63
-  firmware implementers.
64
-
65
-  @param Length The size of the package in bytes.
66
-
67
-  @param Type   The package type. See EFI_HII_PACKAGE_TYPE_x,
68
-                below.
69
-
70
-  @param Data   The package data, the format of which is
71
-                determined by Type.
72
-
73
-**/
55
+///
56
+/// The header found at the start of each package.
57
+///
74 58
 typedef struct {
75 59
   UINT32  Length:24;
76 60
   UINT32  Type:8;
@@ -78,32 +62,33 @@ typedef struct {
78 62
 } EFI_HII_PACKAGE_HEADER;
79 63
 
80 64
 //
81
-// EFI_HII_PACKAGE_TYPE_x.
65
+// Value of HII package type
82 66
 //
83 67
 #define EFI_HII_PACKAGE_TYPE_ALL             0x00
84 68
 #define EFI_HII_PACKAGE_TYPE_GUID            0x01
85
-#define EFI_HII_PACKAGE_FORM                 0x02
86
-#define EFI_HII_PACKAGE_KEYBOARD_LAYOUT      0x03
69
+#define EFI_HII_PACKAGE_FORMS                0x02
87 70
 #define EFI_HII_PACKAGE_STRINGS              0x04
88 71
 #define EFI_HII_PACKAGE_FONTS                0x05
89 72
 #define EFI_HII_PACKAGE_IMAGES               0x06
90 73
 #define EFI_HII_PACKAGE_SIMPLE_FONTS         0x07
91 74
 #define EFI_HII_PACKAGE_DEVICE_PATH          0x08
75
+#define EFI_HII_PACKAGE_KEYBOARD_LAYOUT      0x09
92 76
 #define EFI_HII_PACKAGE_END                  0xDF
93 77
 #define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN    0xE0
94 78
 #define EFI_HII_PACKAGE_TYPE_SYSTEM_END      0xFF
95 79
 
96 80
 //
97
-// Simplified Font Package
81
+// Definitions for Simplified Font Package
82
+// Section 27.3.2
98 83
 //
99 84
 
100
-#define EFI_GLYPH_HEIGHT                     19
101
-#define EFI_GLYPH_WIDTH                      8
102 85
 //
103 86
 // Contents of EFI_NARROW_GLYPH.Attributes
104 87
 //
105 88
 #define EFI_GLYPH_NON_SPACING                0x01
106 89
 #define EFI_GLYPH_WIDE                       0x02
90
+#define EFI_GLYPH_HEIGHT                     19
91
+#define EFI_GLYPH_WIDTH                      8
107 92
 
108 93
 typedef struct {
109 94
   CHAR16                 UnicodeWeight;
@@ -119,7 +104,10 @@ typedef struct {
119 104
   UINT8                  Pad[3];
120 105
 } EFI_WIDE_GLYPH;
121 106
 
122
-
107
+///
108
+/// A simplified font package consists of a font header
109
+/// followed by a series of glyph structures.
110
+///
123 111
 typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
124 112
   EFI_HII_PACKAGE_HEADER Header;
125 113
   UINT16                 NumberOfNarrowGlyphs;
@@ -129,9 +117,13 @@ typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
129 117
 } EFI_HII_SIMPLE_FONT_PACKAGE_HDR;
130 118
 
131 119
 //
132
-// Font Package
120
+// Definitions for Font Package
121
+// Section 27.3.3
133 122
 //
134 123
 
124
+//
125
+// Value for font style
126
+//
135 127
 #define EFI_HII_FONT_STYLE_NORMAL            0x00000000
136 128
 #define EFI_HII_FONT_STYLE_BOLD              0x00000001
137 129
 #define EFI_HII_FONT_STYLE_ITALIC            0x00000002
@@ -149,6 +141,12 @@ typedef struct _EFI_HII_GLYPH_INFO {
149 141
   INT16                  AdvanceX;
150 142
 } EFI_HII_GLYPH_INFO;
151 143
 
144
+///
145
+/// The fixed header consists of a standard record header and
146
+/// then the character values in this section, the flags
147
+/// (including the encoding method) and the offsets of the glyph
148
+/// information, the glyph bitmaps and the character map.
149
+///
152 150
 typedef struct _EFI_HII_FONT_PACKAGE_HDR {
153 151
   EFI_HII_PACKAGE_HEADER Header;
154 152
   UINT32                 HdrSize;
@@ -158,6 +156,9 @@ typedef struct _EFI_HII_FONT_PACKAGE_HDR {
158 156
   CHAR16                 FontFamily[1];
159 157
 } EFI_HII_FONT_PACKAGE_HDR;
160 158
 
159
+//
160
+// Value of different glyph info block types
161
+//
161 162
 #define EFI_HII_GIBT_END                  0x00
162 163
 #define EFI_HII_GIBT_GLYPH                0x10
163 164
 #define EFI_HII_GIBT_GLYPHS               0x11
@@ -175,6 +176,10 @@ typedef struct _EFI_HII_GLYPH_BLOCK {
175 176
   UINT8                  BlockType;
176 177
 } EFI_HII_GLYPH_BLOCK;
177 178
 
179
+//
180
+// Definition of different glyph info block types
181
+//
182
+
178 183
 typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {
179 184
   EFI_HII_GLYPH_BLOCK    Header;
180 185
   EFI_HII_GLYPH_INFO     Cell;
@@ -210,25 +215,25 @@ typedef struct _EFI_HII_GIBT_EXT4_BLOCK {
210 215
 typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
211 216
   EFI_HII_GLYPH_BLOCK    Header;
212 217
   EFI_HII_GLYPH_INFO     Cell;
213
-  UINT8                  BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
218
+  UINT8                  BitmapData[1];
214 219
 } EFI_HII_GIBT_GLYPH_BLOCK;
215 220
 
216 221
 typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
217 222
   EFI_HII_GLYPH_BLOCK    Header;
218 223
   EFI_HII_GLYPH_INFO     Cell;
219 224
   UINT16                 Count;
220
-  UINT8                  BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Cell.Width+7)/8)*Cell.Height
225
+  UINT8                  BitmapData[1];
221 226
 } EFI_HII_GIBT_GLYPHS_BLOCK;
222 227
 
223 228
 typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {
224 229
   EFI_HII_GLYPH_BLOCK    Header;
225
-  UINT8                  BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height
230
+  UINT8                  BitmapData[1];
226 231
 } EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;
227 232
 
228 233
 typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {
229 234
   EFI_HII_GLYPH_BLOCK    Header;
230 235
   UINT16                 Count;
231
-  UINT8                  BitmapData[1]; // the number of bytes per bitmap can be calculated by ((Global.Cell.Width+7)/8)*Global.Cell.Height
236
+  UINT8                  BitmapData[1];
232 237
 } EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;
233 238
 
234 239
 typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {
@@ -242,16 +247,27 @@ typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
242 247
 } EFI_HII_GIBT_SKIP2_BLOCK;
243 248
 
244 249
 //
245
-// Device Path Package
250
+// Definitions for Device Path Package
251
+// Section 27.3.4
246 252
 //
253
+
254
+///
255
+/// The device path package is used to carry a device path
256
+/// associated with the package list.
257
+///
247 258
 typedef struct _EFI_HII_DEVICE_PATH_PACKAGE {
248 259
   EFI_HII_PACKAGE_HEADER   Header;
249 260
   // EFI_DEVICE_PATH_PROTOCOL DevicePath[];
250 261
 } EFI_HII_DEVICE_PATH_PACKAGE;
251 262
 
252 263
 //
253
-// GUID Package
264
+// Definitions for GUID Package
265
+// Section 27.3.5
254 266
 //
267
+
268
+///
269
+/// The GUID package is used to carry data where the format is defined by a GUID.
270
+///
255 271
 typedef struct _EFI_HII_GUID_PACKAGE_HDR {
256 272
   EFI_HII_PACKAGE_HEADER  Header;
257 273
   EFI_GUID                Guid;
@@ -259,12 +275,17 @@ typedef struct _EFI_HII_GUID_PACKAGE_HDR {
259 275
 } EFI_HII_GUID_PACKAGE_HDR;
260 276
 
261 277
 //
262
-// String Package
278
+// Definitions for String Package
279
+// Section 27.3.6
263 280
 //
264 281
 
265 282
 #define UEFI_CONFIG_LANG  L"x-UEFI"
266
-#define UEFI_CONFIG_LANG2 L"x-i-UEFI"     // BUGBUG, spec need to be updated.
283
+#define UEFI_CONFIG_LANG2 L"x-i-UEFI"
267 284
 
285
+///
286
+/// The fixed header consists of a standard record header and then the string identifiers
287
+/// contained in this section and the offsets of the string and language information.
288
+///
268 289
 typedef struct _EFI_HII_STRING_PACKAGE_HDR {
269 290
   EFI_HII_PACKAGE_HEADER  Header;
270 291
   UINT32                  HdrSize;
@@ -278,6 +299,9 @@ typedef struct {
278 299
   UINT8                   BlockType;
279 300
 } EFI_HII_STRING_BLOCK;
280 301
 
302
+//
303
+// Value of different string information block types
304
+//
281 305
 #define EFI_HII_SIBT_END                     0x00
282 306
 #define EFI_HII_SIBT_STRING_SCSU             0x10
283 307
 #define EFI_HII_SIBT_STRING_SCSU_FONT        0x11
@@ -295,6 +319,10 @@ typedef struct {
295 319
 #define EFI_HII_SIBT_EXT4                    0x32
296 320
 #define EFI_HII_SIBT_FONT                    0x40
297 321
 
322
+//
323
+// Definition of different string information block types
324
+//
325
+
298 326
 typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {
299 327
   EFI_HII_STRING_BLOCK    Header;
300 328
   EFI_STRING_ID           StringId;
@@ -389,7 +417,8 @@ typedef struct _EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK {
389 417
 } EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK;
390 418
 
391 419
 //
392
-// Image Packages
420
+// Definitions for Image Package
421
+// Section 27.3.7
393 422
 //
394 423
 
395 424
 typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
@@ -402,6 +431,9 @@ typedef struct _EFI_HII_IMAGE_BLOCK {
402 431
   UINT8                   BlockType;
403 432
 } EFI_HII_IMAGE_BLOCK;
404 433
 
434
+//
435
+// Value of different image information block types
436
+//
405 437
 #define EFI_HII_IIBT_END               0x00
406 438
 #define EFI_HII_IIBT_IMAGE_1BIT        0x10
407 439
 #define EFI_HII_IIBT_IMAGE_1BIT_TRANS  0x11
@@ -419,6 +451,10 @@ typedef struct _EFI_HII_IMAGE_BLOCK {
419 451
 #define EFI_HII_IIBT_EXT2              0x31
420 452
 #define EFI_HII_IIBT_EXT4              0x32
421 453
 
454
+//
455
+// Definition of different image information block types
456
+//
457
+
422 458
 typedef struct _EFI_HII_IIBT_END_BLOCK {
423 459
   EFI_HII_IMAGE_BLOCK          Header;
424 460
 } EFI_HII_IIBT_END_BLOCK;
@@ -538,6 +574,10 @@ typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {
538 574
   UINT16                       SkipCount;
539 575
 } EFI_HII_IIBT_SKIP2_BLOCK;
540 576
 
577
+//
578
+// Definitions for Palette Information
579
+//
580
+
541 581
 typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {
542 582
   UINT16                       PaletteCount;
543 583
 } EFI_HII_IMAGE_PALETTE_INFO_HEADER;
@@ -548,9 +588,13 @@ typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
548 588
 } EFI_HII_IMAGE_PALETTE_INFO;
549 589
 
550 590
 //
551
-// Forms Package
591
+// Definitions for Forms Package
592
+// Section 27.3.8
552 593
 //
553 594
 
595
+///
596
+/// The Forms package is used to carry forms-based encoding data.
597
+///
554 598
 typedef struct _EFI_HII_FORM_PACKAGE {
555 599
   EFI_HII_PACKAGE_HEADER       Header;
556 600
   // EFI_IFR_OP_HEADER         OpCodeHeader;
@@ -672,6 +716,10 @@ typedef union {
672 716
 #define EFI_IFR_CATENATE_OP            0x5E
673 717
 #define EFI_IFR_GUID_OP                0x5F
674 718
 
719
+//
720
+// Definitions of IFR Standard Headers
721
+// Section 27.3.8.2
722
+//
675 723
 
676 724
 typedef struct _EFI_IFR_OP_HEADER {
677 725
   UINT8                    OpCode;
@@ -695,17 +743,27 @@ typedef struct _EFI_IFR_QUESTION_HEADER {
695 743
   UINT8                    Flags;
696 744
 } EFI_IFR_QUESTION_HEADER;
697 745
 
746
+//
747
+// Flag values of EFI_IFR_QUESTION_HEADER
748
+//
698 749
 #define EFI_IFR_FLAG_READ_ONLY         0x01
699 750
 #define EFI_IFR_FLAG_CALLBACK          0x04
700 751
 #define EFI_IFR_FLAG_RESET_REQUIRED    0x10
701 752
 #define EFI_IFR_FLAG_OPTIONS_ONLY      0x80
702 753
 
754
+//
755
+// Definition for Opcode Reference
756
+// Section 27.3.8.3
757
+//
703 758
 typedef struct _EFI_IFR_DEFAULTSTORE {
704 759
   EFI_IFR_OP_HEADER        Header;
705 760
   EFI_STRING_ID            DefaultName;
706 761
   UINT16                   DefaultId;
707 762
 } EFI_IFR_DEFAULTSTORE;
708 763
 
764
+//
765
+// Default Identifier of default store
766
+//
709 767
 #define EFI_HII_DEFAULT_CLASS_STANDARD       0x0000
710 768
 #define EFI_HII_DEFAULT_CLASS_MANUFACTURING  0x0001
711 769
 #define EFI_HII_DEFAULT_CLASS_SAFE           0x0002
@@ -855,6 +913,9 @@ typedef struct _EFI_IFR_DATE {
855 913
   UINT8                    Flags;
856 914
 } EFI_IFR_DATE;
857 915
 
916
+//
917
+// Flags that describe the behavior of the question.
918
+//
858 919
 #define EFI_QF_DATE_YEAR_SUPPRESS      0x01
859 920
 #define EFI_QF_DATE_MONTH_SUPPRESS     0x02
860 921
 #define EFI_QF_DATE_DAY_SUPPRESS       0x04
@@ -894,16 +955,19 @@ typedef struct _EFI_IFR_NUMERIC {
894 955
   MINMAXSTEP_DATA          data;
895 956
 } EFI_IFR_NUMERIC;
896 957
 
958
+//
959
+// Flags related to the numeric question
960
+//
897 961
 #define EFI_IFR_NUMERIC_SIZE           0x03
898
-#define EFI_IFR_NUMERIC_SIZE_1         0x00
899
-#define EFI_IFR_NUMERIC_SIZE_2         0x01
900
-#define EFI_IFR_NUMERIC_SIZE_4         0x02
901
-#define EFI_IFR_NUMERIC_SIZE_8         0x03
962
+#define   EFI_IFR_NUMERIC_SIZE_1       0x00
963
+#define   EFI_IFR_NUMERIC_SIZE_2       0x01
964
+#define   EFI_IFR_NUMERIC_SIZE_4       0x02
965
+#define   EFI_IFR_NUMERIC_SIZE_8       0x03
902 966
 
903 967
 #define EFI_IFR_DISPLAY                0x30
904
-#define EFI_IFR_DISPLAY_INT_DEC        0x00
905
-#define EFI_IFR_DISPLAY_UINT_DEC       0x10
906
-#define EFI_IFR_DISPLAY_UINT_HEX       0x20
968
+#define   EFI_IFR_DISPLAY_INT_DEC      0x00
969
+#define   EFI_IFR_DISPLAY_UINT_DEC     0x10
970
+#define   EFI_IFR_DISPLAY_UINT_HEX     0x20
907 971
 
908 972
 typedef struct _EFI_IFR_ONE_OF {
909 973
   EFI_IFR_OP_HEADER        Header;
@@ -945,14 +1009,17 @@ typedef struct _EFI_IFR_TIME {
945 1009
   UINT8                    Flags;
946 1010
 } EFI_IFR_TIME;
947 1011
 
1012
+//
1013
+// A bit-mask that determines which unique settings are active for this opcode.
1014
+//
948 1015
 #define QF_TIME_HOUR_SUPPRESS          0x01
949 1016
 #define QF_TIME_MINUTE_SUPPRESS        0x02
950 1017
 #define QF_TIME_SECOND_SUPPRESS        0x04
951 1018
 
952 1019
 #define QF_TIME_STORAGE                0x30
953
-#define QF_TIME_STORAGE_NORMAL         0x00
954
-#define QF_TIME_STORAGE_TIME           0x10
955
-#define QF_TIME_STORAGE_WAKEUP         0x20
1020
+#define   QF_TIME_STORAGE_NORMAL       0x00
1021
+#define   QF_TIME_STORAGE_TIME         0x10
1022
+#define   QF_TIME_STORAGE_WAKEUP       0x20
956 1023
 
957 1024
 typedef struct _EFI_IFR_DISABLE_IF {
958 1025
   EFI_IFR_OP_HEADER        Header;
@@ -994,6 +1061,9 @@ typedef struct _EFI_IFR_ONE_OF_OPTION {
994 1061
   EFI_IFR_TYPE_VALUE       Value;
995 1062
 } EFI_IFR_ONE_OF_OPTION;
996 1063
 
1064
+//
1065
+// Types of the option's value.
1066
+//
997 1067
 #define EFI_IFR_TYPE_NUM_SIZE_8        0x00
998 1068
 #define EFI_IFR_TYPE_NUM_SIZE_16       0x01
999 1069
 #define EFI_IFR_TYPE_NUM_SIZE_32       0x02
@@ -1036,11 +1106,6 @@ typedef struct _EFI_IFR_EQ_ID_LIST {
1036 1106
   UINT16                   ValueList[1];
1037 1107
 } EFI_IFR_EQ_ID_LIST;
1038 1108
 
1039
-typedef struct _EFI_IFR_QUESTION_REF1 {
1040
-  EFI_IFR_OP_HEADER        Header;
1041
-  EFI_QUESTION_ID          QuestionId;
1042
-} EFI_IFR_QUESTION_REF1;
1043
-
1044 1109
 typedef struct _EFI_IFR_UINT8 {
1045 1110
   EFI_IFR_OP_HEADER        Header;
1046 1111
   UINT8 Value;
@@ -1051,10 +1116,6 @@ typedef struct _EFI_IFR_UINT16 {
1051 1116
   UINT16                   Value;
1052 1117
 } EFI_IFR_UINT16;
1053 1118
 
1054
-typedef struct _EFI_IFR_QUESTION_REF2 {
1055
-  EFI_IFR_OP_HEADER        Header;
1056
-} EFI_IFR_QUESTION_REF2;
1057
-
1058 1119
 typedef struct _EFI_IFR_UINT32 {
1059 1120
   EFI_IFR_OP_HEADER        Header;
1060 1121
   UINT32                   Value;
@@ -1065,6 +1126,15 @@ typedef struct _EFI_IFR_UINT64 {
1065 1126
   UINT64 Value;
1066 1127
 } EFI_IFR_UINT64;
1067 1128
 
1129
+typedef struct _EFI_IFR_QUESTION_REF1 {
1130
+  EFI_IFR_OP_HEADER        Header;
1131
+  EFI_QUESTION_ID          QuestionId;
1132
+} EFI_IFR_QUESTION_REF1;
1133
+
1134
+typedef struct _EFI_IFR_QUESTION_REF2 {
1135
+  EFI_IFR_OP_HEADER        Header;
1136
+} EFI_IFR_QUESTION_REF2;
1137
+
1068 1138
 typedef struct _EFI_IFR_QUESTION_REF3 {
1069 1139
   EFI_IFR_OP_HEADER        Header;
1070 1140
 } EFI_IFR_QUESTION_REF3;
@@ -1142,11 +1212,23 @@ typedef struct _EFI_IFR_TO_BOOLEAN {
1142 1212
   EFI_IFR_OP_HEADER        Header;
1143 1213
 } EFI_IFR_TO_BOOLEAN;
1144 1214
 
1215
+//
1216
+// For EFI_IFR_TO_STRING, when converting from
1217
+// unsigned integers, these flags control the format:
1218
+// 0 = unsigned decimal
1219
+// 1 = signed decimal
1220
+// 2 = hexadecimal (lower-case alpha)
1221
+// 3 = hexadecimal (upper-case alpha)
1222
+//
1145 1223
 #define EFI_IFR_STRING_UNSIGNED_DEC      0
1146 1224
 #define EFI_IFR_STRING_SIGNED_DEC        1
1147 1225
 #define EFI_IFR_STRING_LOWERCASE_HEX     2
1148 1226
 #define EFI_IFR_STRING_UPPERCASE_HEX     3
1149
-
1227
+//
1228
+// When converting from a buffer, these flags control the format:
1229
+// 0 = ASCII
1230
+// 8 = Unicode
1231
+//
1150 1232
 #define EFI_IFR_STRING_ASCII             0
1151 1233
 #define EFI_IFR_STRING_UNICODE           8
1152 1234
 
@@ -1247,6 +1329,9 @@ typedef struct _EFI_IFR_CONDITIONAL {
1247 1329
   EFI_IFR_OP_HEADER        Header;
1248 1330
 } EFI_IFR_CONDITIONAL;
1249 1331
 
1332
+//
1333
+// Flags governing the matching criteria of EFI_IFR_FIND
1334
+//
1250 1335
 #define EFI_IFR_FF_CASE_SENSITIVE    0x00
1251 1336
 #define EFI_IFR_FF_CASE_INSENSITIVE  0x01
1252 1337
 
@@ -1263,6 +1348,10 @@ typedef struct _EFI_IFR_TOKEN {
1263 1348
   EFI_IFR_OP_HEADER        Header;
1264 1349
 } EFI_IFR_TOKEN;
1265 1350
 
1351
+//
1352
+// Flags specifying whether to find the first matching string
1353
+// or the first non-matching string.
1354
+//
1266 1355
 #define EFI_IFR_FLAGS_FIRST_MATCHING     0x00
1267 1356
 #define EFI_IFR_FLAGS_FIRST_NON_MATCHING 0x01
1268 1357
 
@@ -1272,7 +1361,9 @@ typedef struct _EFI_IFR_SPAN {
1272 1361
 } EFI_IFR_SPAN;
1273 1362
 
1274 1363
 //
1275
-// Keyboard Package
1364
+// Definitions for Keyboard Package
1365
+// Section 27.3.9
1366
+// Releated definitions are in Section of EFI_HII_DATABASE_PROTOCOL
1276 1367
 //
1277 1368
 
1278 1369
 typedef enum {

+ 100
- 108
src/include/gpxe/efi/Uefi/UefiMultiPhase.h View File

@@ -1,7 +1,7 @@
1 1
 /** @file
2 2
   This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
3 3
 
4
-  Copyright (c) 2006, Intel Corporation
4
+  Copyright (c) 2006 - 2008, Intel Corporation
5 5
   All rights reserved. This program and the accompanying materials
6 6
   are licensed and made available under the terms and conditions of the BSD License
7 7
   which accompanies this distribution.  The full text of the license may be found at
@@ -70,38 +70,32 @@ typedef struct {
70 70
 #define WIN_CERT_TYPE_EFI_PKCS115   0x0EF0
71 71
 #define WIN_CERT_TYPE_EFI_GUID      0x0EF1
72 72
 
73
-/**
74
-
75
-  The WIN_CERTIFICATE structure is part of the PE/COFF
76
-  specification and has the following definition:
77
-
78
-  @param dwLength   The length of the entire certificate,
79
-                    including the length of the header, in
80
-                    bytes.
81
-
82
-  @param wRevision  The revision level of the WIN_CERTIFICATE
83
-                    structure. The current revision level is
84
-                    0x0200.
85
-
86
-  @param wCertificateType   The certificate type. See
87
-                            WIN_CERT_TYPE_xxx for the UEFI
88
-                            certificate types. The UEFI
89
-                            specification reserves the range of
90
-                            certificate type values from 0x0EF0
91
-                            to 0x0EFF.
92
-
93
-  @param bCertificate   The actual certificate. The format of
94
-                        the certificate depends on
95
-                        wCertificateType. The format of the UEFI
96
-                        certificates is defined below.
97
-
98
-
99
-**/
73
+///
74
+/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
75
+///
100 76
 typedef struct _WIN_CERTIFICATE {
77
+  ///
78
+  /// The length of the entire certificate,
79
+  /// including the length of the header, in bytes.
80
+  ///
101 81
   UINT32  dwLength;
82
+  ///
83
+  /// The revision level of the WIN_CERTIFICATE
84
+  /// structure. The current revision level is 0x0200.
85
+  ///
102 86
   UINT16  wRevision;
87
+  ///
88
+  /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI
89
+  /// certificate types. The UEFI specification reserves the range of
90
+  /// certificate type values from 0x0EF0 to 0x0EFF.
91
+  ///
103 92
   UINT16  wCertificateType;
104
-  //UINT8 bCertificate[ANYSIZE_ARRAY];
93
+  ///
94
+  /// The following is the actual certificate. The format of
95
+  /// the certificate depends on wCertificateType.
96
+  ///
97
+  /// UINT8 bCertificate[ANYSIZE_ARRAY];
98
+  ///
105 99
 } WIN_CERTIFICATE;
106 100
 
107 101
 ///
@@ -110,9 +104,9 @@ typedef struct _WIN_CERTIFICATE {
110 104
 #define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
111 105
   {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
112 106
 
113
-///
114
-/// WIN_CERTIFICATE_UEFI_GUID.CertData
115
-///
107
+//
108
+// WIN_CERTIFICATE_UEFI_GUID.CertData
109
+//
116 110
 typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
117 111
   UINT32  HashType;
118 112
   UINT8   PublicKey[256];
@@ -120,97 +114,95 @@ typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
120 114
 } EFI_CERT_BLOCK_RSA_2048_SHA256;
121 115
 
122 116
 
123
-/**
124
-
125
-  @param Hdr  This is the standard WIN_CERTIFICATE header, where
126
-              wCertificateType is set to
127
-              WIN_CERT_TYPE_UEFI_GUID.
128
-
129
-  @param CertType   This is the unique id which determines the
130
-                    format of the CertData. In this case, the
131
-                    value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
132
-
133
-  @param CertData   This is the certificate data. The format of
134
-                    the data is determined by the CertType. In
135
-                    this case the value is
136
-                    EFI_CERT_BLOCK_RSA_2048_SHA256.
137
-
138
-**/
117
+///
118
+/// Certificate which encapsulates a GUID-specific digital signature
119
+///
139 120
 typedef struct _WIN_CERTIFICATE_UEFI_GUID {
121
+  ///
122
+  /// This is the standard WIN_CERTIFICATE header, where
123
+  /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID.
124
+  ///
140 125
   WIN_CERTIFICATE   Hdr;
126
+  ///
127
+  /// This is the unique id which determines the
128
+  /// format of the CertData. In this case, the
129
+  /// value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
130
+  ///
141 131
   EFI_GUID          CertType;
142
-  // UINT8            CertData[ANYSIZE_ARRAY];
132
+  ///
133
+  /// The following is the certificate data. The format of
134
+  /// the data is determined by the CertType. In this case the value is
135
+  /// EFI_CERT_BLOCK_RSA_2048_SHA256.
136
+  ///
137
+  /// UINT8            CertData[ANYSIZE_ARRAY];
138
+  ///
143 139
 } WIN_CERTIFICATE_UEFI_GUID;
144 140
 
145 141
 
146
-/**
147
-
148
-  Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
149
-  signature.
150
-
151
-  The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
152
-  WIN_CERTIFICATE and encapsulate the information needed to
153
-  implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
154
-  specified in RFC2437.
155
-
156
-  @param Hdr  This is the standard WIN_CERTIFICATE header, where
157
-              wCertificateType is set to
158
-              WIN_CERT_TYPE_UEFI_PKCS1_15.
159
-
160
-  @param HashAlgorithm  This is the hashing algorithm which was
161
-                        performed on the UEFI executable when
162
-                        creating the digital signature. It is
163
-                        one of the enumerated values pre-defined
164
-                        in Section 26.4.1. See
165
-                        EFI_HASH_ALGORITHM_x.
166
-
167
-  @param Signature  This is the actual digital signature. The
168
-                    size of the signature is the same size as
169
-                    the key (1024-bit key is 128 bytes) and can
170
-                    be determined by subtracting the length of
171
-                    the other parts of this header from the
172
-                    total length of the certificate as found in
173
-                    Hdr.dwLength.
174
-
175
-**/
142
+///
143
+/// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.
144
+///
145
+/// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
146
+/// WIN_CERTIFICATE and encapsulate the information needed to
147
+/// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
148
+/// specified in RFC2437.
149
+///
176 150
 typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
151
+  ///
152
+  /// This is the standard WIN_CERTIFICATE header, where
153
+  /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15.
154
+  ///
177 155
   WIN_CERTIFICATE Hdr;
156
+  ///
157
+  /// This is the hashing algorithm which was performed on the
158
+  /// UEFI executable when creating the digital signature.
159
+  ///
178 160
   EFI_GUID        HashAlgorithm;
179
-  // UINT8 Signature[ANYSIZE_ARRAY];
161
+  ///
162
+  /// The following is the actual digital signature. The
163
+  /// size of the signature is the same size as the key
164
+  /// (1024-bit key is 128 bytes) and can be determined by
165
+  /// subtracting the length of the other parts of this header
166
+  /// from the total length of the certificate as found in
167
+  /// Hdr.dwLength.
168
+  ///
169
+  /// UINT8 Signature[ANYSIZE_ARRAY];
170
+  ///
180 171
 } WIN_CERTIFICATE_EFI_PKCS1_15;
181 172
 
182 173
 
183
-/**
184
-
185
-  AuthInfo is a WIN_CERTIFICATE using the wCertificateType
186
-  WIN_CERTIFICATE_UEFI_GUID and the CertType
187
-  EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
188
-  authenticated access, then the Data buffer should begin with an
189
-  authentication descriptor prior to the data payload and DataSize
190
-  should reflect the the data.and descriptor size. The caller
191
-  shall digest the Monotonic Count value and the associated data
192
-  for the variable update using the SHA-256 1-way hash algorithm.
193
-  The ensuing the 32-byte digest will be signed using the private
194
-  key associated w/ the public/private 2048-bit RSA key-pair. The
195
-  WIN_CERTIFICATE shall be used to describe the signature of the
196
-  Variable data *Data. In addition, the signature will also
197
-  include the MonotonicCount value to guard against replay attacks
198
-
199
-  @param  MonotonicCount  Included in the signature of
200
-                          AuthInfo.Used to ensure freshness/no
201
-                          replay. Incremented during each
202
-                          "Write" access.
203
-
204
-  @param AuthInfo   Provides the authorization for the variable
205
-                    access. It is a signature across the
206
-                    variable data and the  Monotonic Count
207
-                    value. Caller uses Private key that is
208
-                    associated with a public key that has been
209
-                    provisioned via the key exchange.
210 174
 
211
-**/
175
+///
176
+/// AuthInfo is a WIN_CERTIFICATE using the wCertificateType
177
+/// WIN_CERTIFICATE_UEFI_GUID and the CertType
178
+/// EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
179
+/// authenticated access, then the Data buffer should begin with an
180
+/// authentication descriptor prior to the data payload and DataSize
181
+/// should reflect the the data.and descriptor size. The caller
182
+/// shall digest the Monotonic Count value and the associated data
183
+/// for the variable update using the SHA-256 1-way hash algorithm.
184
+/// The ensuing the 32-byte digest will be signed using the private
185
+/// key associated w/ the public/private 2048-bit RSA key-pair. The
186
+/// WIN_CERTIFICATE shall be used to describe the signature of the
187
+/// Variable data *Data. In addition, the signature will also
188
+/// include the MonotonicCount value to guard against replay attacks
189
+///
212 190
 typedef struct {
191
+  ///
192
+  /// Included in the signature of
193
+  /// AuthInfo.Used to ensure freshness/no
194
+  /// replay. Incremented during each
195
+  /// "Write" access.
196
+  ///
213 197
   UINT64                      MonotonicCount;
198
+  ///
199
+  /// Provides the authorization for the variable
200
+  /// access. It is a signature across the
201
+  /// variable data and the  Monotonic Count
202
+  /// value. Caller uses Private key that is
203
+  /// associated with a public key that has been
204
+  /// provisioned via the key exchange.
205
+  ///
214 206
   WIN_CERTIFICATE_UEFI_GUID   AuthInfo;
215 207
 } EFI_VARIABLE_AUTHENTICATION;
216 208
 

+ 853
- 908
src/include/gpxe/efi/Uefi/UefiPxe.h
File diff suppressed because it is too large
View File


+ 211
- 75
src/include/gpxe/efi/Uefi/UefiSpec.h View File

@@ -1,11 +1,11 @@
1 1
 /** @file
2
-  Include file that supportes UEFI.
2
+  Include file that supports UEFI.
3 3
 
4
-  This include file must only contain things defined in the UEFI 2.0 specification.
5
-  If a code construct is defined in the UEFI 2.0 specification it must be included
4
+  This include file must only contain things defined in the UEFI 2.1 specification.
5
+  If a code construct is defined in the UEFI 2.1 specification it must be included
6 6
   by this include file.
7 7
 
8
-  Copyright (c) 2006 - 2007, Intel Corporation
8
+  Copyright (c) 2006 - 2008, Intel Corporation
9 9
   All rights reserved. This program and the accompanying materials
10 10
   are licensed and made available under the terms and conditions of the BSD License
11 11
   which accompanies this distribution.  The full text of the license may be found at
@@ -47,27 +47,32 @@ typedef enum {
47 47
 #define EFI_UNSPECIFIED_TIMEZONE  0x07FF
48 48
 
49 49
 //
50
-// possible caching types for the memory range
50
+// Memory cacheability attributes
51 51
 //
52 52
 #define EFI_MEMORY_UC   0x0000000000000001ULL
53 53
 #define EFI_MEMORY_WC   0x0000000000000002ULL
54 54
 #define EFI_MEMORY_WT   0x0000000000000004ULL
55 55
 #define EFI_MEMORY_WB   0x0000000000000008ULL
56 56
 #define EFI_MEMORY_UCE  0x0000000000000010ULL
57
-
58 57
 //
59
-// physical memory protection on range
58
+// Physical memory protection attributes
60 59
 //
61 60
 #define EFI_MEMORY_WP   0x0000000000001000ULL
62 61
 #define EFI_MEMORY_RP   0x0000000000002000ULL
63 62
 #define EFI_MEMORY_XP   0x0000000000004000ULL
63
+//
64
+// Runtime memory attribute
65
+//
66
+#define EFI_MEMORY_RUNTIME  0x8000000000000000ULL
64 67
 
65 68
 ///
66
-/// range requires a runtime mapping
69
+/// Memory descriptor version number
67 70
 ///
68
-#define EFI_MEMORY_RUNTIME  0x8000000000000000ULL
69
-
70 71
 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
72
+
73
+///
74
+/// Definition of memory descriptor
75
+///
71 76
 typedef struct {
72 77
   UINT32                Type;
73 78
   EFI_PHYSICAL_ADDRESS  PhysicalStart;
@@ -79,8 +84,7 @@ typedef struct {
79 84
 ///
80 85
 /// Build macros to find next EFI_MEMORY_DESCRIPTOR.
81 86
 ///
82
-#define NextMemoryDescriptor(_Ptr, _Size)   ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))
83
-#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)
87
+#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size)   ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))
84 88
 
85 89
 ///
86 90
 /// Declare forward referenced data structures
@@ -137,6 +141,10 @@ EFI_STATUS
137 141
   Returns the current memory map.
138 142
 
139 143
   @param  MemoryMapSize         A pointer to the size, in bytes, of the MemoryMap buffer.
144
+                                On input, this is the size of the buffer allocated by the caller.
145
+                                On output, it is the size of the buffer returned by the firmware if
146
+                                the buffer was large enough, or the size of the buffer needed to contain
147
+                                the map if the buffer was too small.
140 148
   @param  MemoryMap             A pointer to the buffer in which firmware places the current memory
141 149
                                 map.
142 150
   @param  MapKey                A pointer to the location in which firmware returns the key for the
@@ -265,14 +273,20 @@ EFI_STATUS
265 273
 
266 274
   @param  ControllerHandle      The handle of the controller from which driver(s) are to be disconnected.
267 275
   @param  DriverImageHandle     The driver to disconnect from ControllerHandle.
276
+                                If DriverImageHandle is NULL, then all the drivers currently managing
277
+                                ControllerHandle are disconnected from ControllerHandle.
268 278
   @param  ChildHandle           The handle of the child to destroy.
279
+                                If ChildHandle is NULL, then all the children of ControllerHandle are
280
+                                destroyed before the drivers are disconnected from ControllerHandle.
269 281
 
270 282
   @retval EFI_SUCCESS           1) One or more drivers were disconnected from the controller.
271 283
                                 2) On entry, no drivers are managing ControllerHandle.
272 284
                                 3) DriverImageHandle is not NULL, and on entry
273 285
                                    DriverImageHandle is not managing ControllerHandle.
274
-
275
-  @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.
286
+  @retval EFI_INVALID_PARAMETER 1) ControllerHandle is not a valid EFI_HANDLE.
287
+                                2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
288
+                                3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
289
+                                4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.
276 290
   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to disconnect any drivers from
277 291
                                 ControllerHandle.
278 292
   @retval EFI_DEVICE_ERROR      The controller could not be disconnected because of a device error.
@@ -357,7 +371,7 @@ VOID
357 371
   Creates an event.
358 372
 
359 373
   @param  Type                  The type of event to create and its mode and attributes.
360
-  @param  NotifyTpl             Pointer to the notification function's context.
374
+  @param  NotifyTpl             The task priority level of event notifications, if needed.
361 375
   @param  NotifyFunction        Pointer to the event's notification function, if any.
362 376
   @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
363 377
                                 Context in the notification function.
@@ -383,11 +397,13 @@ EFI_STATUS
383 397
   Creates an event in a group.
384 398
 
385 399
   @param  Type                  The type of event to create and its mode and attributes.
386
-  @param  NotifyTpl             Pointer to the notification function's context.
400
+  @param  NotifyTpl             The task priority level of event notifications,if needed.
387 401
   @param  NotifyFunction        Pointer to the event's notification function, if any.
388 402
   @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
389 403
                                 Context in the notification function.
390 404
   @param  EventGroup            Pointer to the unique identifier of the group to which this event belongs.
405
+                                If this is NULL, then the function behaves as if the parameters were passed
406
+                                to CreateEvent.
391 407
   @param  Event                 Pointer to the newly created event if the call succeeds; undefined
392 408
                                 otherwise.
393 409
 
@@ -400,13 +416,16 @@ typedef
400 416
 EFI_STATUS
401 417
 (EFIAPI *EFI_CREATE_EVENT_EX)(
402 418
   IN       UINT32                 Type,
403
-  IN       EFI_TPL                NotifyTpl      OPTIONAL,
419
+  IN       EFI_TPL                NotifyTpl,
404 420
   IN       EFI_EVENT_NOTIFY       NotifyFunction OPTIONAL,
405 421
   IN CONST VOID                   *NotifyContext OPTIONAL,
406 422
   IN CONST EFI_GUID               *EventGroup    OPTIONAL,
407 423
   OUT      EFI_EVENT              *Event
408 424
   );
409 425
 
426
+///
427
+/// Timer delay types
428
+///
410 429
 typedef enum {
411 430
   TimerCancel,
412 431
   TimerPeriodic,
@@ -419,6 +438,11 @@ typedef enum {
419 438
   @param  Event                 The timer event that is to be signaled at the specified time.
420 439
   @param  Type                  The type of time that is specified in TriggerTime.
421 440
   @param  TriggerTime           The number of 100ns units until the timer expires.
441
+                                A TriggerTime of 0 is legal.
442
+                                If Type is TimerRelative and TriggerTime is 0, then the timer
443
+                                event will be signaled on the next timer tick.
444
+                                If Type is TimerPeriodic and TriggerTime is 0, then the timer
445
+                                event will be signaled on every timer tick.
422 446
 
423 447
   @retval EFI_SUCCESS           The event has been set to be signaled at the requested time.
424 448
   @retval EFI_INVALID_PARAMETER Event or Type is not valid.
@@ -500,7 +524,7 @@ EFI_STATUS
500 524
 
501 525
 
502 526
 //
503
-// Task priority level (name defined in spec).
527
+// Task priority level
504 528
 //
505 529
 #define TPL_APPLICATION       4
506 530
 #define TPL_CALLBACK          8
@@ -513,7 +537,7 @@ EFI_STATUS
513 537
 
514 538
   @param  NewTpl                The new task priority level.
515 539
 
516
-  @retval                       Previous task priority level
540
+  @return Previous task priority level
517 541
 
518 542
 **/
519 543
 typedef
@@ -525,7 +549,7 @@ EFI_TPL
525 549
 /**
526 550
   Restores a task's priority level to its previous value.
527 551
 
528
-  @param  OldTpl                The previous task priority level to restore
552
+  @param  OldTpl                The previous task priority level to restore.
529 553
 
530 554
 **/
531 555
 typedef
@@ -546,11 +570,15 @@ VOID
546 570
                                 On output the size of data returned in Data.
547 571
   @param  Data                  The buffer to return the contents of the variable.
548 572
 
549
-  @retval EFI_SUCCESS           The function completed successfully.
550
-  @retval EFI_NOT_FOUND         The variable was not found.
551
-  @retval EFI_BUFFER_TOO_SMALL  The DataSize is too small for the result.
552
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
553
-  @retval EFI_DEVICE_ERROR      The variable could not be retrieved due to a hardware error.
573
+  @retval EFI_SUCCESS            The function completed successfully.
574
+  @retval EFI_NOT_FOUND          The variable was not found.
575
+  @retval EFI_BUFFER_TOO_SMALL   The DataSize is too small for the result.
576
+  @retval EFI_INVALID_PARAMETER  VariableName is NULL.
577
+  @retval EFI_INVALID_PARAMETER  VendorGuid is NULL.
578
+  @retval EFI_INVALID_PARAMETER  DataSize is NULL.
579
+  @retval EFI_INVALID_PARAMETER  The DataSize is not too small and Data is NULL.
580
+  @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
581
+  @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
554 582
 
555 583
 **/
556 584
 typedef
@@ -577,7 +605,9 @@ EFI_STATUS
577 605
   @retval EFI_SUCCESS           The function completed successfully.
578 606
   @retval EFI_NOT_FOUND         The next variable was not found.
579 607
   @retval EFI_BUFFER_TOO_SMALL  The VariableNameSize is too small for the result.
580
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
608
+  @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
609
+  @retval EFI_INVALID_PARAMETER VariableName is NULL.
610
+  @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
581 611
   @retval EFI_DEVICE_ERROR      The variable could not be retrieved due to a hardware error.
582 612
 
583 613
 **/
@@ -599,12 +629,17 @@ EFI_STATUS
599 629
   @param  DataSize              The size in bytes of the Data buffer.
600 630
   @param  Data                  The contents for the variable.
601 631
 
602
-  @retval EFI_SUCCESS           The firmware has successfully stored the variable and its data as
603
-                                defined by the Attributes.
604
-  @retval EFI_WRITE_PROTECTED   The variable in question is read-only.
605
-  @retval EFI_OUT_OF_RESOURCES  Not enough storage is available to hold the variable and its data.
606
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
607
-  @retval EFI_DEVICE_ERROR      The variable could not be retrieved due to a hardware error.
632
+  @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
633
+                                 defined by the Attributes.
634
+  @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits was supplied, or the
635
+                                 DataSize exceeds the maximum allowed.
636
+  @retval EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
637
+  @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
638
+  @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
639
+  @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
640
+  @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
641
+  @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
642
+  @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
608 643
 
609 644
 **/
610 645
 typedef
@@ -618,10 +653,10 @@ EFI_STATUS
618 653
   );
619 654
 
620 655
 
621
-//
622
-// This provides the capabilities of the
623
-// real time clock device as exposed through the EFI interfaces.
624
-//
656
+///
657
+/// This provides the capabilities of the
658
+/// real time clock device as exposed through the EFI interfaces.
659
+///
625 660
 typedef struct {
626 661
   UINT32    Resolution;
627 662
   UINT32    Accuracy;
@@ -672,8 +707,11 @@ EFI_STATUS
672 707
   @param  Time                  The current alarm setting.
673 708
 
674 709
   @retval EFI_SUCCESS           The alarm settings were returned.
675
-  @retval EFI_INVALID_PARAMETER Any parameter is NULL.
710
+  @retval EFI_INVALID_PARAMETER Enabled is NULL.
711
+  @retval EFI_INVALID_PARAMETER Pending is NULL.
712
+  @retval EFI_INVALID_PARAMETER Time is NULL.
676 713
   @retval EFI_DEVICE_ERROR      The wakeup time could not be retrieved due to a hardware error.
714
+  @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.
677 715
 
678 716
 **/
679 717
 typedef
@@ -689,6 +727,7 @@ EFI_STATUS
689 727
 
690 728
   @param  Enabled               Enable or disable the wakeup alarm.
691 729
   @param  Time                  If Enable is TRUE, the time to set the wakeup alarm for.
730
+                                If Enable is FALSE, then this parameter is optional, and may be NULL.
692 731
 
693 732
   @retval EFI_SUCCESS           If Enable is TRUE, then the wakeup alarm was enabled. If
694 733
                                 Enable is FALSE, then the wakeup alarm was disabled.
@@ -705,13 +744,15 @@ EFI_STATUS
705 744
   );
706 745
 
707 746
 /**
708
-  This is the declaration of an EFI image entry point. This can be the entry point to an application
709
-  written to this specification, an EFI boot service driver, or an EFI runtime driver.
747
+  This is the declaration of an EFI image entry point. This entry point is
748
+  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
749
+  both device drivers and bus drivers.
710 750
 
711
-  @param  ImageHandle           Handle that identifies the loaded image.
712
-  @param  SystemTable           System Table for this image.
751
+  @param  ImageHandle           The firmware allocated handle for the UEFI image.
752
+  @param  SystemTable           A pointer to the EFI System Table.
713 753
 
714 754
   @retval EFI_SUCCESS           The operation completed successfully.
755
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
715 756
 
716 757
 **/
717 758
 typedef
@@ -729,16 +770,16 @@ EFI_STATUS
729 770
                                 FilePath as a boot selection. Ignored if SourceBuffer is
730 771
                                 not NULL.
731 772
   @param  ParentImageHandle     The caller's image handle.
732
-  @param  FilePath              The DeviceHandle specific file path from which the image is
773
+  @param  DevicePath            The DeviceHandle specific file path from which the image is
733 774
                                 loaded.
734 775
   @param  SourceBuffer          If not NULL, a pointer to the memory location containing a copy
735 776
                                 of the image to be loaded.
736
-  @param  SourceSize            The size in bytes of SourceBuffer.
777
+  @param  SourceSize            The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
737 778
   @param  ImageHandle           Pointer to the returned image handle that is created when the
738 779
                                 image is successfully loaded.
739 780
 
740 781
   @retval EFI_SUCCESS           Image was loaded into memory correctly.
741
-  @retval EFI_NOT_FOUND         Both SourceBuffer and FilePath are NULL.
782
+  @retval EFI_NOT_FOUND         Both SourceBuffer and DevicePath are NULL.
742 783
   @retval EFI_INVALID_PARAMETER One or more parametes are invalid.
743 784
   @retval EFI_UNSUPPORTED       The image type is not supported.
744 785
   @retval EFI_OUT_OF_RESOURCES  Image was not loaded due to insufficient resources.
@@ -752,7 +793,7 @@ EFI_STATUS
752 793
 (EFIAPI *EFI_IMAGE_LOAD)(
753 794
   IN  BOOLEAN                      BootPolicy,
754 795
   IN  EFI_HANDLE                   ParentImageHandle,
755
-  IN  EFI_DEVICE_PATH_PROTOCOL     *FilePath,
796
+  IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath,
756 797
   IN  VOID                         *SourceBuffer OPTIONAL,
757 798
   IN  UINTN                        SourceSize,
758 799
   OUT EFI_HANDLE                   *ImageHandle
@@ -768,7 +809,7 @@ EFI_STATUS
768 809
 
769 810
   @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
770 811
                                 has already been initialized with StartImage
771
-  @retval Exit code from image  Exit code from image
812
+  @return Exit code from image
772 813
 
773 814
 **/
774 815
 typedef
@@ -811,7 +852,7 @@ EFI_STATUS
811 852
   @retval EFI_SUCCESS           The image has been unloaded.
812 853
   @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
813 854
   @retval EFI_UNSUPPORTED       The image has been started, and does not support unload.
814
-  @retval                       Exit code from the image's unload handler
855
+  @return Exit code from the image's unload handler
815 856
 
816 857
 **/
817 858
 typedef
@@ -877,9 +918,9 @@ EFI_STATUS
877 918
   IN CHAR16                   *WatchdogData OPTIONAL
878 919
   );
879 920
 
880
-//
881
-// Enumeration of reset types.
882
-//
921
+///
922
+/// Enumeration of reset types.
923
+///
883 924
 typedef enum {
884 925
   EfiResetCold,
885 926
   EfiResetWarm,
@@ -949,7 +990,9 @@ EFI_STATUS
949 990
 
950 991
   @retval EFI_SUCCESS           The 32-bit CRC was computed for the data buffer and returned in
951 992
                                 Crc32.
952
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
993
+  @retval EFI_INVALID_PARAMETER Data is NULL.
994
+  @retval EFI_INVALID_PARAMETER Crc32 is NULL.
995
+  @retval EFI_INVALID_PARAMETER DataSize is 0.
953 996
 
954 997
 **/
955 998
 typedef
@@ -1014,7 +1057,10 @@ typedef enum {
1014 1057
 
1015 1058
   @retval EFI_SUCCESS           The protocol interface was installed.
1016 1059
   @retval EFI_OUT_OF_RESOURCES  Space for a new handle could not be allocated.
1017
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1060
+  @retval EFI_INVALID_PARAMETER Handle is NULL.
1061
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1062
+  @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
1063
+  @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1018 1064
 
1019 1065
 **/
1020 1066
 typedef
@@ -1061,7 +1107,8 @@ EFI_STATUS
1061 1107
   @retval EFI_ACCESS_DENIED     The protocol interface could not be reinstalled,
1062 1108
                                 because OldInterface is still being used by a
1063 1109
                                 driver that will not release it.
1064
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1110
+  @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1111
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1065 1112
 
1066 1113
 **/
1067 1114
 typedef
@@ -1086,7 +1133,8 @@ EFI_STATUS
1086 1133
   @retval EFI_NOT_FOUND         The interface was not found.
1087 1134
   @retval EFI_ACCESS_DENIED     The interface was not removed because the interface
1088 1135
                                 is still being used by a driver.
1089
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1136
+  @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1137
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1090 1138
 
1091 1139
 **/
1092 1140
 typedef
@@ -1122,9 +1170,12 @@ EFI_STATUS
1122 1170
   @param  Protocol              The published unique identifier of the protocol.
1123 1171
   @param  Interface             Supplies the address where a pointer to the corresponding Protocol
1124 1172
                                 Interface is returned.
1173
+
1125 1174
   @retval EFI_SUCCESS           The interface information for the specified protocol was returned.
1126 1175
   @retval EFI_UNSUPPORTED       The device does not support the specified protocol.
1127
-  @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
1176
+  @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1177
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1178
+  @retval EFI_INVALID_PARAMETER Interface is NULL.
1128 1179
 
1129 1180
 **/
1130 1181
 typedef
@@ -1174,9 +1225,9 @@ EFI_STATUS
1174 1225
 (EFIAPI *EFI_OPEN_PROTOCOL)(
1175 1226
   IN  EFI_HANDLE                Handle,
1176 1227
   IN  EFI_GUID                  *Protocol,
1177
-  OUT VOID                      **Interface,
1228
+  OUT VOID                      **Interface, OPTIONAL
1178 1229
   IN  EFI_HANDLE                AgentHandle,
1179
-  IN  EFI_HANDLE                ControllerHandle, OPTIONAL
1230
+  IN  EFI_HANDLE                ControllerHandle,
1180 1231
   IN  UINT32                    Attributes
1181 1232
   );
1182 1233
 
@@ -1187,15 +1238,16 @@ EFI_STATUS
1187 1238
   @param  Handle                The handle for the protocol interface that was previously opened
1188 1239
                                 with OpenProtocol(), and is now being closed.
1189 1240
   @param  Protocol              The published unique identifier of the protocol.
1190
-  @param  Interface             Supplies the address where a pointer to the corresponding Protocol
1191
-                                Interface is returned.
1192 1241
   @param  AgentHandle           The handle of the agent that is closing the protocol interface.
1193 1242
   @param  ControllerHandle      If the agent that opened a protocol is a driver that follows the
1194 1243
                                 UEFI Driver Model, then this parameter is the controller handle
1195 1244
                                 that required the protocol interface.
1196 1245
 
1197 1246
   @retval EFI_SUCCESS           The protocol instance was closed.
1198
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1247
+  @retval EFI_INVALID_PARAMETER 1) Handle is not a valid EFI_HANDLE.
1248
+                                2) AgentHandle is not a valid EFI_HANDLE.
1249
+                                3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
1250
+                                4) Protocol is NULL.
1199 1251
   @retval EFI_NOT_FOUND         1) Handle does not support the protocol specified by Protocol.
1200 1252
                                 2) The protocol interface specified by Handle and Protocol is not
1201 1253
                                    currently open by AgentHandle and ControllerHandle.
@@ -1238,7 +1290,7 @@ EFI_STATUS
1238 1290
 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(
1239 1291
   IN  EFI_HANDLE                          Handle,
1240 1292
   IN  EFI_GUID                            *Protocol,
1241
-  IN  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
1293
+  OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
1242 1294
   OUT UINTN                               *EntryCount
1243 1295
   );
1244 1296
 
@@ -1257,7 +1309,10 @@ EFI_STATUS
1257 1309
                                 ProtocolBuffer. The number of protocol interface GUIDs was
1258 1310
                                 returned in ProtocolBufferCount.
1259 1311
   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the results.
1260
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1312
+  @retval EFI_INVALID_PARAMETER Handle is NULL.
1313
+  @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1314
+  @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
1315
+  @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
1261 1316
 
1262 1317
 **/
1263 1318
 typedef
@@ -1278,7 +1333,9 @@ EFI_STATUS
1278 1333
 
1279 1334
   @retval EFI_SUCCESS           The notification event has been registered.
1280 1335
   @retval EFI_OUT_OF_RESOURCES  Space for the notification event could not be allocated.
1281
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1336
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1337
+  @retval EFI_INVALID_PARAMETER Event is NULL.
1338
+  @retval EFI_INVALID_PARAMETER Registration is NULL.
1282 1339
 
1283 1340
 **/
1284 1341
 typedef
@@ -1311,7 +1368,11 @@ typedef enum {
1311 1368
   @retval EFI_SUCCESS           The array of handles was returned.
1312 1369
   @retval EFI_NOT_FOUND         No handles match the search.
1313 1370
   @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small for the result.
1314
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1371
+  @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
1372
+  @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
1373
+  @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
1374
+  @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
1375
+  @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
1315 1376
 
1316 1377
 **/
1317 1378
 typedef
@@ -1335,7 +1396,9 @@ EFI_STATUS
1335 1396
 
1336 1397
   @retval EFI_SUCCESS           The resulting handle was returned.
1337 1398
   @retval EFI_NOT_FOUND         No handles match the search.
1338
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1399
+  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1400
+  @retval EFI_INVALID_PARAMETER DevicePath is NULL.
1401
+  @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
1339 1402
 
1340 1403
 **/
1341 1404
 typedef
@@ -1371,7 +1434,8 @@ EFI_STATUS
1371 1434
   Returns an array of handles that support the requested protocol in a buffer allocated from pool.
1372 1435
 
1373 1436
   @param  SearchType            Specifies which handle(s) are to be returned.
1374
-  @param  Protocol              Specifies the protocol to search by.
1437
+  @param  Protocol              Provides the protocol to search by.
1438
+                                This parameter is only valid for a SearchType of ByProtocol.
1375 1439
   @param  SearchKey             Supplies the search key depending on the SearchType.
1376 1440
   @param  NoHandles             The number of handles returned in Buffer.
1377 1441
   @param  Buffer                A pointer to the buffer to return the requested array of handles that
@@ -1381,7 +1445,8 @@ EFI_STATUS
1381 1445
                                 handles in Buffer was returned in NoHandles.
1382 1446
   @retval EFI_NOT_FOUND         No handles match the search.
1383 1447
   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the matching results.
1384
-  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1448
+  @retval EFI_INVALID_PARAMETER NoHandles is NULL.
1449
+  @retval EFI_INVALID_PARAMETER Buffer is NULL.
1385 1450
 
1386 1451
 **/
1387 1452
 typedef
@@ -1433,6 +1498,11 @@ typedef struct {
1433 1498
   UINT32            CapsuleImageSize;
1434 1499
 } EFI_CAPSULE_HEADER;
1435 1500
 
1501
+//
1502
+// The EFI System Table entry must point to an array of capsules
1503
+// that contain the same CapsuleGuid value. The array must be
1504
+// prefixed by a UINT32 that represents the size of the array of capsules.
1505
+//
1436 1506
 typedef struct {
1437 1507
   UINT32   CapsuleArrayNumber;
1438 1508
   VOID*    CapsulePtr[1];
@@ -1461,6 +1531,8 @@ typedef struct {
1461 1531
                                 capsule has been successfully processed by the firmware.
1462 1532
   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
1463 1533
   @retval EFI_INVALID_PARAMETER CapsuleSize is NULL.
1534
+  @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
1535
+  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the capsule.
1464 1536
 
1465 1537
 **/
1466 1538
 typedef
@@ -1487,6 +1559,7 @@ EFI_STATUS
1487 1559
   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform, and
1488 1560
                                 MaximumCapsuleSize and ResetType are undefined.
1489 1561
   @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
1562
+  @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the query request.
1490 1563
 
1491 1564
 **/
1492 1565
 typedef
@@ -1543,7 +1616,13 @@ EFI_STATUS
1543 1616
 #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552ULL
1544 1617
 #define EFI_RUNTIME_SERVICES_REVISION   EFI_2_10_SYSTEM_TABLE_REVISION
1545 1618
 
1619
+///
1620
+/// EFI Runtime Services Table
1621
+///
1546 1622
 typedef struct {
1623
+  ///
1624
+  /// The table header for the EFI Runtime Services Table.
1625
+  ///
1547 1626
   EFI_TABLE_HEADER                Hdr;
1548 1627
 
1549 1628
   //
@@ -1589,7 +1668,13 @@ typedef struct {
1589 1668
 #define EFI_BOOT_SERVICES_SIGNATURE   0x56524553544f4f42ULL
1590 1669
 #define EFI_BOOT_SERVICES_REVISION    EFI_2_10_SYSTEM_TABLE_REVISION
1591 1670
 
1671
+///
1672
+/// EFI Boot Services Table
1673
+///
1592 1674
 typedef struct {
1675
+  ///
1676
+  /// The table header for the EFI Boot Services Table.
1677
+  ///
1593 1678
   EFI_TABLE_HEADER                Hdr;
1594 1679
 
1595 1680
   //
@@ -1678,32 +1763,85 @@ typedef struct {
1678 1763
   //
1679 1764
   EFI_COPY_MEM                      CopyMem;
1680 1765
   EFI_SET_MEM                       SetMem;
1681
-
1682 1766
   EFI_CREATE_EVENT_EX               CreateEventEx;
1683 1767
 } EFI_BOOT_SERVICES;
1684 1768
 
1685
-//
1686
-// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
1687
-// EFI System Table.
1688
-//
1769
+///
1770
+/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
1771
+/// EFI System Table.
1772
+///
1689 1773
 typedef struct{
1774
+  ///
1775
+  /// The 128-bit GUID value that uniquely identifies the system configuration table.
1776
+  ///
1690 1777
   EFI_GUID                          VendorGuid;
1778
+  ///
1779
+  /// A pointer to the table associated with VendorGuid.
1780
+  ///
1691 1781
   VOID                              *VendorTable;
1692 1782
 } EFI_CONFIGURATION_TABLE;
1693 1783
 
1784
+///
1785
+/// EFI System Table
1786
+///
1694 1787
 struct _EFI_SYSTEM_TABLE {
1788
+  ///
1789
+  /// The table header for the EFI System Table.
1790
+  ///
1695 1791
   EFI_TABLE_HEADER                  Hdr;
1792
+  ///
1793
+  /// A pointer to a null terminated Unicode string that identifies
1794
+  /// the vendor that produces the system firmware for the platform.
1795
+  ///
1696 1796
   CHAR16                            *FirmwareVendor;
1797
+  ///
1798
+  /// A firmware vendor specific value that identifies the revision
1799
+  /// of the system firmware for the platform.
1800
+  ///
1697 1801
   UINT32                            FirmwareRevision;
1802
+  ///
1803
+  /// The handle for the active console input device.
1804
+  ///
1698 1805
   EFI_HANDLE                        ConsoleInHandle;
1806
+  ///
1807
+  /// A pointer to the SIMPLE_INPUT_PROTOCOL interface that is
1808
+  /// associated with ConsoleInHandle.
1809
+  ///
1699 1810
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL    *ConIn;
1811
+  ///
1812
+  /// The handle for the active console output device.
1813
+  ///
1700 1814
   EFI_HANDLE                        ConsoleOutHandle;
1815
+  ///
1816
+  /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1817
+  /// that is associated with ConsoleOutHandle.
1818
+  ///
1701 1819
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *ConOut;
1820
+  ///
1821
+  /// The handle for the active standard error console device.
1822
+  ///
1702 1823
   EFI_HANDLE                        StandardErrorHandle;
1824
+  ///
1825
+  /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1826
+  /// that is associated with StandardErrorHandle.
1827
+  ///
1703 1828
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *StdErr;
1829
+  ///
1830
+  /// A pointer to the EFI Runtime Services Table.
1831
+  ///
1704 1832
   EFI_RUNTIME_SERVICES              *RuntimeServices;
1833
+  ///
1834
+  /// A pointer to the EFI Boot Services Table.
1835
+  ///
1705 1836
   EFI_BOOT_SERVICES                 *BootServices;
1837
+  ///
1838
+  /// The number of system configuration tables in the buffer ConfigurationTable.
1839
+  ///
1706 1840
   UINTN                             NumberOfTableEntries;
1841
+  ///
1842
+  /// A pointer to the system configuration tables.
1843
+  /// The number of entries in the table is NumberOfTableEntries.
1844
+  ///
1707 1845
   EFI_CONFIGURATION_TABLE           *ConfigurationTable;
1708 1846
 };
1709 1847
 
@@ -1733,7 +1871,7 @@ typedef union {
1733 1871
     UINT32  SysReqPessed    : 1;
1734 1872
     UINT32  Reserved        : 16;
1735 1873
     UINT32  InputKeyCount   : 2;
1736
-  }       Options;
1874
+  } Options;
1737 1875
   UINT32  PackedValue;
1738 1876
 } HOT_KEY_EFI_KEY_DATA;
1739 1877
 
@@ -1759,7 +1897,6 @@ typedef struct {
1759 1897
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32    L"\\EFI\\BOOT\\BOOTIA32.EFI"
1760 1898
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"
1761 1899
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
1762
-#define EFI_REMOVABLE_MEDIA_FILE_NAME_EBC     L"\\EFI\\BOOT\\BOOTEBC.EFI"
1763 1900
 
1764 1901
 #if   defined (MDE_CPU_IA32)
1765 1902
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
@@ -1768,7 +1905,6 @@ typedef struct {
1768 1905
 #elif defined (MDE_CPU_X64)
1769 1906
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_X64
1770 1907
 #elif defined (MDE_CPU_EBC)
1771
-  #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_EBC
1772 1908
 #else
1773 1909
   #error Unknown Processor Type
1774 1910
 #endif

+ 5
- 1
src/include/gpxe/efi/efi.h View File

@@ -28,8 +28,12 @@
28 28
  * filesystems, compilation under -mrtd and -mregparm=3, etc.
29 29
  */
30 30
 
31
-/* Include the top-level EFI header file */
31
+/* EFI headers rudely redefine NULL */
32
+#undef NULL
33
+
34
+/* Include the top-level EFI header files */
32 35
 #include <gpxe/efi/Uefi.h>
36
+#include <gpxe/efi/PiDxe.h>
33 37
 
34 38
 /* Reset any trailing #pragma pack directives */
35 39
 #pragma pack()

Loading…
Cancel
Save