Browse Source

[efi] Update UEFI header files with latest version from TianoCore

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Geoff Lywood 14 years ago
parent
commit
eef46c23d6
41 changed files with 6072 additions and 1613 deletions
  1. 705
    89
      src/include/ipxe/efi/Base.h
  2. 25
    0
      src/include/ipxe/efi/Guid/HiiFormMapMethodGuid.h
  3. 3
    3
      src/include/ipxe/efi/Guid/PcAnsi.h
  4. 3
    5
      src/include/ipxe/efi/Guid/SmBios.h
  5. 128
    0
      src/include/ipxe/efi/Guid/WinCertificate.h
  6. 160
    97
      src/include/ipxe/efi/Ia32/ProcessorBind.h
  7. 259
    45
      src/include/ipxe/efi/IndustryStandard/Pci22.h
  8. 249
    248
      src/include/ipxe/efi/IndustryStandard/PeImage.h
  9. 2
    4
      src/include/ipxe/efi/Pi/PiBootMode.h
  10. 2
    2
      src/include/ipxe/efi/Pi/PiDependency.h
  11. 86
    15
      src/include/ipxe/efi/Pi/PiDxeCis.h
  12. 272
    34
      src/include/ipxe/efi/Pi/PiFirmwareFile.h
  13. 68
    10
      src/include/ipxe/efi/Pi/PiFirmwareVolume.h
  14. 178
    24
      src/include/ipxe/efi/Pi/PiHob.h
  15. 97
    65
      src/include/ipxe/efi/Pi/PiMultiPhase.h
  16. 59
    0
      src/include/ipxe/efi/Pi/PiS3BootScript.h
  17. 1126
    0
      src/include/ipxe/efi/Pi/PiStatusCode.h
  18. 6
    6
      src/include/ipxe/efi/PiDxe.h
  19. 17
    18
      src/include/ipxe/efi/Protocol/ComponentName2.h
  20. 10
    3
      src/include/ipxe/efi/Protocol/Cpu.h
  21. 19
    101
      src/include/ipxe/efi/Protocol/CpuIo.h
  22. 142
    0
      src/include/ipxe/efi/Protocol/CpuIo2.h
  23. 96
    47
      src/include/ipxe/efi/Protocol/DebugSupport.h
  24. 600
    63
      src/include/ipxe/efi/Protocol/DevicePath.h
  25. 103
    55
      src/include/ipxe/efi/Protocol/DriverBinding.h
  26. 35
    18
      src/include/ipxe/efi/Protocol/NetworkInterfaceIdentifier.h
  27. 46
    7
      src/include/ipxe/efi/Protocol/PciIo.h
  28. 44
    4
      src/include/ipxe/efi/Protocol/PciRootBridgeIo.h
  29. 96
    27
      src/include/ipxe/efi/Protocol/SimpleNetwork.h
  30. 15
    16
      src/include/ipxe/efi/Protocol/SimpleTextIn.h
  31. 49
    49
      src/include/ipxe/efi/Protocol/SimpleTextOut.h
  32. 5
    5
      src/include/ipxe/efi/Uefi.h
  33. 98
    35
      src/include/ipxe/efi/Uefi/UefiBaseType.h
  34. 86
    12
      src/include/ipxe/efi/Uefi/UefiGpt.h
  35. 516
    40
      src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h
  36. 78
    119
      src/include/ipxe/efi/Uefi/UefiMultiPhase.h
  37. 111
    97
      src/include/ipxe/efi/Uefi/UefiPxe.h
  38. 313
    136
      src/include/ipxe/efi/Uefi/UefiSpec.h
  39. 154
    113
      src/include/ipxe/efi/X64/ProcessorBind.h
  40. 10
    0
      src/include/ipxe/efi/efi.h
  41. 1
    1
      src/interface/efi/efi_smbios.c

+ 705
- 89
src/include/ipxe/efi/Base.h View File

@@ -6,11 +6,12 @@
6 6
   environment. There are a set of base libraries in the Mde Package that can
7 7
   be used to implement base modules.
8 8
 
9
-Copyright (c) 2006 - 2008, Intel Corporation
10
-All rights reserved. This program and the accompanying materials
9
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
10
+Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
11
+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
13
-http://opensource.org/licenses/bsd-license.php
14
+http://opensource.org/licenses/bsd-license.php.
14 15
 
15 16
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 17
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -26,6 +27,88 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
26 27
 //
27 28
 #include <ipxe/efi/ProcessorBind.h>
28 29
 
30
+
31
+/**
32
+  Verifies the storage size of a given data type.
33
+
34
+  This macro generates a divide by zero error or a zero size array declaration in
35
+  the preprocessor if the size is incorrect.  These are declared as "extern" so
36
+  the space for these arrays will not be in the modules.
37
+
38
+  @param  TYPE  The date type to determine the size of.
39
+  @param  Size  The expected size for the TYPE.
40
+
41
+**/
42
+#define VERIFY_SIZE_OF(TYPE, Size) extern UINT8 _VerifySizeof##TYPE[(sizeof(TYPE) == (Size)) / (sizeof(TYPE) == (Size))]
43
+
44
+//
45
+// Verify that ProcessorBind.h produced UEFI Data Types that are compliant with
46
+// Section 2.3.1 of the UEFI 2.3 Specification.
47
+//
48
+VERIFY_SIZE_OF (BOOLEAN, 1);
49
+VERIFY_SIZE_OF (INT8, 1);
50
+VERIFY_SIZE_OF (UINT8, 1);
51
+VERIFY_SIZE_OF (INT16, 2);
52
+VERIFY_SIZE_OF (UINT16, 2);
53
+VERIFY_SIZE_OF (INT32, 4);
54
+VERIFY_SIZE_OF (UINT32, 4);
55
+VERIFY_SIZE_OF (INT64, 8);
56
+VERIFY_SIZE_OF (UINT64, 8);
57
+VERIFY_SIZE_OF (CHAR8, 1);
58
+VERIFY_SIZE_OF (CHAR16, 2);
59
+
60
+//
61
+// The Microsoft* C compiler can removed references to unreferenced data items
62
+//  if the /OPT:REF linker option is used. We defined a macro as this is a
63
+//  a non standard extension
64
+//
65
+#if defined(_MSC_EXTENSIONS) && !defined (MDE_CPU_EBC)
66
+  ///
67
+  /// Remove global variable from the linked image if there are no references to
68
+  /// it after all compiler and linker optimizations have been performed.
69
+  ///
70
+  ///
71
+  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
72
+#else
73
+  ///
74
+  /// Remove the global variable from the linked image if there are no references
75
+  ///  to it after all compiler and linker optimizations have been performed.
76
+  ///
77
+  ///
78
+  #define GLOBAL_REMOVE_IF_UNREFERENCED
79
+#endif
80
+
81
+//
82
+// For symbol name in GNU assembly code, an extra "_" is necessary
83
+//
84
+#if defined(__GNUC__)
85
+  ///
86
+  /// Private worker functions for ASM_PFX()
87
+  ///
88
+  #define _CONCATENATE(a, b)  __CONCATENATE(a, b)
89
+  #define __CONCATENATE(a, b) a ## b
90
+
91
+  ///
92
+  /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
93
+  /// on symbols in assembly language.
94
+  ///
95
+  #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)
96
+#endif
97
+
98
+#if __APPLE__
99
+  //
100
+  // Apple extension that is used by the linker to optimize code size
101
+  // with assembly functions. Put at the end of your .S files
102
+  //
103
+  #define ASM_FUNCTION_REMOVE_IF_UNREFERENCED  .subsections_via_symbols
104
+#else
105
+  #define ASM_FUNCTION_REMOVE_IF_UNREFERENCED
106
+#endif
107
+
108
+///
109
+/// 128 bit buffer containing a unique identifier value.
110
+/// Unless otherwise specified, aligned on a 64 bit boundary.
111
+///
29 112
 typedef struct {
30 113
   UINT32  Data1;
31 114
   UINT16  Data2;
@@ -33,42 +116,87 @@ typedef struct {
33 116
   UINT8   Data4[8];
34 117
 } GUID;
35 118
 
119
+//
120
+// 8-bytes unsigned value that represents a physical system address.
121
+//
36 122
 typedef UINT64 PHYSICAL_ADDRESS;
37 123
 
38 124
 ///
39
-/// LIST_ENTRY definition
125
+/// LIST_ENTRY structure definition.
40 126
 ///
41 127
 typedef struct _LIST_ENTRY LIST_ENTRY;
42 128
 
129
+///
130
+/// _LIST_ENTRY structure definition.
131
+///
43 132
 struct _LIST_ENTRY {
44 133
   LIST_ENTRY  *ForwardLink;
45 134
   LIST_ENTRY  *BackLink;
46 135
 };
47 136
 
48 137
 //
49
-// Modifiers to absract standard types to aid in debug of problems
138
+// Modifiers to abstract standard types to aid in debug of problems
50 139
 //
140
+
141
+///
142
+/// Datum is read-only.
143
+///
51 144
 #define CONST     const
145
+
146
+///
147
+/// Datum is scoped to the current file or function.
148
+///
52 149
 #define STATIC    static
150
+
151
+///
152
+/// Undeclared type.
153
+///
53 154
 #define VOID      void
54 155
 
55 156
 //
56 157
 // Modifiers for Data Types used to self document code.
57 158
 // This concept is borrowed for UEFI specification.
58 159
 //
160
+
161
+///
162
+/// Datum is passed to the function.
163
+///
59 164
 #define IN
165
+
166
+///
167
+/// Datum is returned from the function.
168
+///
60 169
 #define OUT
170
+
171
+///
172
+/// Passing the datum to the function is optional, and a NULL
173
+/// is passed if the value is not supplied.
174
+///
61 175
 #define OPTIONAL
62 176
 
63 177
 //
64 178
 //  UEFI specification claims 1 and 0. We are concerned about the
65 179
 //  complier portability so we did it this way.
66 180
 //
181
+
182
+///
183
+/// Boolean true value.  UEFI Specification defines this value to be 1,
184
+/// but this form is more portable.
185
+///
67 186
 #define TRUE  ((BOOLEAN)(1==1))
187
+
188
+///
189
+/// Boolean false value.  UEFI Specification defines this value to be 0,
190
+/// but this form is more portable.
191
+///
68 192
 #define FALSE ((BOOLEAN)(0==1))
69 193
 
194
+///
195
+/// NULL pointer (VOID *)
196
+///
70 197
 #define NULL  ((VOID *) 0)
71 198
 
199
+
72 200
 #define  BIT0     0x00000001
73 201
 #define  BIT1     0x00000002
74 202
 #define  BIT2     0x00000004
@@ -101,49 +229,159 @@ struct _LIST_ENTRY {
101 229
 #define  BIT29    0x20000000
102 230
 #define  BIT30    0x40000000
103 231
 #define  BIT31    0x80000000
104
-#define  BIT32    0x0000000100000000UL
105
-#define  BIT33    0x0000000200000000UL
106
-#define  BIT34    0x0000000400000000UL
107
-#define  BIT35    0x0000000800000000UL
108
-#define  BIT36    0x0000001000000000UL
109
-#define  BIT37    0x0000002000000000UL
110
-#define  BIT38    0x0000004000000000UL
111
-#define  BIT39    0x0000008000000000UL
112
-#define  BIT40    0x0000010000000000UL
113
-#define  BIT41    0x0000020000000000UL
114
-#define  BIT42    0x0000040000000000UL
115
-#define  BIT43    0x0000080000000000UL
116
-#define  BIT44    0x0000100000000000UL
117
-#define  BIT45    0x0000200000000000UL
118
-#define  BIT46    0x0000400000000000UL
119
-#define  BIT47    0x0000800000000000UL
120
-#define  BIT48    0x0001000000000000UL
121
-#define  BIT49    0x0002000000000000UL
122
-#define  BIT50    0x0004000000000000UL
123
-#define  BIT51    0x0008000000000000UL
124
-#define  BIT52    0x0010000000000000UL
125
-#define  BIT53    0x0020000000000000UL
126
-#define  BIT54    0x0040000000000000UL
127
-#define  BIT55    0x0080000000000000UL
128
-#define  BIT56    0x0100000000000000UL
129
-#define  BIT57    0x0200000000000000UL
130
-#define  BIT58    0x0400000000000000UL
131
-#define  BIT59    0x0800000000000000UL
132
-#define  BIT60    0x1000000000000000UL
133
-#define  BIT61    0x2000000000000000UL
134
-#define  BIT62    0x4000000000000000UL
135
-#define  BIT63    0x8000000000000000UL
232
+#define  BIT32    0x0000000100000000ULL
233
+#define  BIT33    0x0000000200000000ULL
234
+#define  BIT34    0x0000000400000000ULL
235
+#define  BIT35    0x0000000800000000ULL
236
+#define  BIT36    0x0000001000000000ULL
237
+#define  BIT37    0x0000002000000000ULL
238
+#define  BIT38    0x0000004000000000ULL
239
+#define  BIT39    0x0000008000000000ULL
240
+#define  BIT40    0x0000010000000000ULL
241
+#define  BIT41    0x0000020000000000ULL
242
+#define  BIT42    0x0000040000000000ULL
243
+#define  BIT43    0x0000080000000000ULL
244
+#define  BIT44    0x0000100000000000ULL
245
+#define  BIT45    0x0000200000000000ULL
246
+#define  BIT46    0x0000400000000000ULL
247
+#define  BIT47    0x0000800000000000ULL
248
+#define  BIT48    0x0001000000000000ULL
249
+#define  BIT49    0x0002000000000000ULL
250
+#define  BIT50    0x0004000000000000ULL
251
+#define  BIT51    0x0008000000000000ULL
252
+#define  BIT52    0x0010000000000000ULL
253
+#define  BIT53    0x0020000000000000ULL
254
+#define  BIT54    0x0040000000000000ULL
255
+#define  BIT55    0x0080000000000000ULL
256
+#define  BIT56    0x0100000000000000ULL
257
+#define  BIT57    0x0200000000000000ULL
258
+#define  BIT58    0x0400000000000000ULL
259
+#define  BIT59    0x0800000000000000ULL
260
+#define  BIT60    0x1000000000000000ULL
261
+#define  BIT61    0x2000000000000000ULL
262
+#define  BIT62    0x4000000000000000ULL
263
+#define  BIT63    0x8000000000000000ULL
264
+
265
+#define  SIZE_1KB    0x00000400
266
+#define  SIZE_2KB    0x00000800
267
+#define  SIZE_4KB    0x00001000
268
+#define  SIZE_8KB    0x00002000
269
+#define  SIZE_16KB   0x00004000
270
+#define  SIZE_32KB   0x00008000
271
+#define  SIZE_64KB   0x00010000
272
+#define  SIZE_128KB  0x00020000
273
+#define  SIZE_256KB  0x00040000
274
+#define  SIZE_512KB  0x00080000
275
+#define  SIZE_1MB    0x00100000
276
+#define  SIZE_2MB    0x00200000
277
+#define  SIZE_4MB    0x00400000
278
+#define  SIZE_8MB    0x00800000
279
+#define  SIZE_16MB   0x01000000
280
+#define  SIZE_32MB   0x02000000
281
+#define  SIZE_64MB   0x04000000
282
+#define  SIZE_128MB  0x08000000
283
+#define  SIZE_256MB  0x10000000
284
+#define  SIZE_512MB  0x20000000
285
+#define  SIZE_1GB    0x40000000
286
+#define  SIZE_2GB    0x80000000
287
+#define  SIZE_4GB    0x0000000100000000ULL
288
+#define  SIZE_8GB    0x0000000200000000ULL
289
+#define  SIZE_16GB   0x0000000400000000ULL
290
+#define  SIZE_32GB   0x0000000800000000ULL
291
+#define  SIZE_64GB   0x0000001000000000ULL
292
+#define  SIZE_128GB  0x0000002000000000ULL
293
+#define  SIZE_256GB  0x0000004000000000ULL
294
+#define  SIZE_512GB  0x0000008000000000ULL
295
+#define  SIZE_1TB    0x0000010000000000ULL
296
+#define  SIZE_2TB    0x0000020000000000ULL
297
+#define  SIZE_4TB    0x0000040000000000ULL
298
+#define  SIZE_8TB    0x0000080000000000ULL
299
+#define  SIZE_16TB   0x0000100000000000ULL
300
+#define  SIZE_32TB   0x0000200000000000ULL
301
+#define  SIZE_64TB   0x0000400000000000ULL
302
+#define  SIZE_128TB  0x0000800000000000ULL
303
+#define  SIZE_256TB  0x0001000000000000ULL
304
+#define  SIZE_512TB  0x0002000000000000ULL
305
+#define  SIZE_1PB    0x0004000000000000ULL
306
+#define  SIZE_2PB    0x0008000000000000ULL
307
+#define  SIZE_4PB    0x0010000000000000ULL
308
+#define  SIZE_8PB    0x0020000000000000ULL
309
+#define  SIZE_16PB   0x0040000000000000ULL
310
+#define  SIZE_32PB   0x0080000000000000ULL
311
+#define  SIZE_64PB   0x0100000000000000ULL
312
+#define  SIZE_128PB  0x0200000000000000ULL
313
+#define  SIZE_256PB  0x0400000000000000ULL
314
+#define  SIZE_512PB  0x0800000000000000ULL
315
+#define  SIZE_1EB    0x1000000000000000ULL
316
+#define  SIZE_2EB    0x2000000000000000ULL
317
+#define  SIZE_4EB    0x4000000000000000ULL
318
+#define  SIZE_8EB    0x8000000000000000ULL
319
+
320
+#define  BASE_1KB    0x00000400
321
+#define  BASE_2KB    0x00000800
322
+#define  BASE_4KB    0x00001000
323
+#define  BASE_8KB    0x00002000
324
+#define  BASE_16KB   0x00004000
325
+#define  BASE_32KB   0x00008000
326
+#define  BASE_64KB   0x00010000
327
+#define  BASE_128KB  0x00020000
328
+#define  BASE_256KB  0x00040000
329
+#define  BASE_512KB  0x00080000
330
+#define  BASE_1MB    0x00100000
331
+#define  BASE_2MB    0x00200000
332
+#define  BASE_4MB    0x00400000
333
+#define  BASE_8MB    0x00800000
334
+#define  BASE_16MB   0x01000000
335
+#define  BASE_32MB   0x02000000
336
+#define  BASE_64MB   0x04000000
337
+#define  BASE_128MB  0x08000000
338
+#define  BASE_256MB  0x10000000
339
+#define  BASE_512MB  0x20000000
340
+#define  BASE_1GB    0x40000000
341
+#define  BASE_2GB    0x80000000
342
+#define  BASE_4GB    0x0000000100000000ULL
343
+#define  BASE_8GB    0x0000000200000000ULL
344
+#define  BASE_16GB   0x0000000400000000ULL
345
+#define  BASE_32GB   0x0000000800000000ULL
346
+#define  BASE_64GB   0x0000001000000000ULL
347
+#define  BASE_128GB  0x0000002000000000ULL
348
+#define  BASE_256GB  0x0000004000000000ULL
349
+#define  BASE_512GB  0x0000008000000000ULL
350
+#define  BASE_1TB    0x0000010000000000ULL
351
+#define  BASE_2TB    0x0000020000000000ULL
352
+#define  BASE_4TB    0x0000040000000000ULL
353
+#define  BASE_8TB    0x0000080000000000ULL
354
+#define  BASE_16TB   0x0000100000000000ULL
355
+#define  BASE_32TB   0x0000200000000000ULL
356
+#define  BASE_64TB   0x0000400000000000ULL
357
+#define  BASE_128TB  0x0000800000000000ULL
358
+#define  BASE_256TB  0x0001000000000000ULL
359
+#define  BASE_512TB  0x0002000000000000ULL
360
+#define  BASE_1PB    0x0004000000000000ULL
361
+#define  BASE_2PB    0x0008000000000000ULL
362
+#define  BASE_4PB    0x0010000000000000ULL
363
+#define  BASE_8PB    0x0020000000000000ULL
364
+#define  BASE_16PB   0x0040000000000000ULL
365
+#define  BASE_32PB   0x0080000000000000ULL
366
+#define  BASE_64PB   0x0100000000000000ULL
367
+#define  BASE_128PB  0x0200000000000000ULL
368
+#define  BASE_256PB  0x0400000000000000ULL
369
+#define  BASE_512PB  0x0800000000000000ULL
370
+#define  BASE_1EB    0x1000000000000000ULL
371
+#define  BASE_2EB    0x2000000000000000ULL
372
+#define  BASE_4EB    0x4000000000000000ULL
373
+#define  BASE_8EB    0x8000000000000000ULL
136 374
 
137 375
 //
138 376
 //  Support for variable length argument lists using the ANSI standard.
139 377
 //
140
-//  Since we are using the ANSI standard we used the standard nameing and
141
-//  did not folow the coding convention
378
+//  Since we are using the ANSI standard we used the standard naming and
379
+//  did not follow the coding convention
142 380
 //
143 381
 //  VA_LIST  - typedef for argument list.
144 382
 //  VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
145 383
 //  VA_END (VA_LIST Marker) - Clear Marker
146
-//  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from
384
+//  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
147 385
 //    the ... list. You must know the size and pass it in this macro.
148 386
 //
149 387
 //  example:
@@ -174,118 +412,490 @@ struct _LIST_ENTRY {
174 412
 //  }
175 413
 //
176 414
 
415
+/**
416
+  Return the size of argument that has been aligned to sizeof (UINTN).
417
+
418
+  @param  n    The parameter size to be aligned.
419
+
420
+  @return The aligned size.
421
+**/
177 422
 #define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
178 423
 
424
+#if defined(__CC_ARM)
179 425
 //
180
-// Also support coding convention rules for var arg macros
426
+// RVCT ARM variable argument list support.
181 427
 //
182
-typedef CHAR8 *VA_LIST;
183
-#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
184
-#define VA_ARG(ap, t)   (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
185
-#define VA_END(ap)      (ap = (VA_LIST) 0)
186 428
 
429
+///
430
+/// Variable used to traverse the list of arguments. This type can vary by
431
+/// implementation and could be an array or structure.
432
+///
433
+#ifdef __APCS_ADSABI
434
+  typedef int         *va_list[1];
435
+  #define VA_LIST     va_list
436
+#else
437
+  typedef struct __va_list { void *__ap; } va_list;
438
+  #define VA_LIST                          va_list
439
+#endif
440
+
441
+#define VA_START(Marker, Parameter)   __va_start(Marker, Parameter)
442
+
443
+#define VA_ARG(Marker, TYPE)          __va_arg(Marker, TYPE)
444
+
445
+#define VA_END(Marker)                ((void)0)
446
+
447
+#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)
187 448
 //
188
-// Macro that returns the byte offset of a field in a data structure.
449
+// Use GCC built-in macros for variable argument lists.
189 450
 //
190
-#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
191 451
 
192 452
 ///
193
-///  CONTAINING_RECORD - returns a pointer to the structure
194
-///      from one of it's elements.
453
+/// Variable used to traverse the list of arguments. This type can vary by
454
+/// implementation and could be an array or structure.
195 455
 ///
196
-#define _CR(Record, TYPE, Field)  ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
456
+typedef __builtin_va_list VA_LIST;
457
+
458
+#define VA_START(Marker, Parameter)  __builtin_va_start (Marker, Parameter)
197 459
 
460
+#define VA_ARG(Marker, TYPE)         ((sizeof (TYPE) < sizeof (UINTN)) ? (TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, TYPE)))
461
+
462
+#define VA_END(Marker)               __builtin_va_end (Marker)
463
+
464
+#else
198 465
 ///
199
-///  ALIGN_VALUE - aligns a value up to the next boundary of the given alignment.
466
+/// Variable used to traverse the list of arguments. This type can vary by
467
+/// implementation and could be an array or structure.
200 468
 ///
201
-#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
469
+typedef CHAR8 *VA_LIST;
470
+
471
+/**
472
+  Retrieves a pointer to the beginning of a variable argument list, based on
473
+  the name of the parameter that immediately precedes the variable argument list.
474
+
475
+  This function initializes Marker to point to the beginning of the variable
476
+  argument list that immediately follows Parameter.  The method for computing the
477
+  pointer to the next argument in the argument list is CPU-specific following the
478
+  EFIAPI ABI.
479
+
480
+  @param   Marker       The VA_LIST used to traverse the list of arguments.
481
+  @param   Parameter    The name of the parameter that immediately precedes
482
+                        the variable argument list.
483
+
484
+  @return  A pointer to the beginning of a variable argument list.
485
+
486
+**/
487
+#define VA_START(Marker, Parameter) (Marker = (VA_LIST) & (Parameter) + _INT_SIZE_OF (Parameter))
488
+
489
+/**
490
+  Returns an argument of a specified type from a variable argument list and updates
491
+  the pointer to the variable argument list to point to the next argument.
492
+
493
+  This function returns an argument of the type specified by TYPE from the beginning
494
+  of the variable argument list specified by Marker.  Marker is then updated to point
495
+  to the next argument in the variable argument list.  The method for computing the
496
+  pointer to the next argument in the argument list is CPU-specific following the EFIAPI ABI.
497
+
498
+  @param   Marker   VA_LIST used to traverse the list of arguments.
499
+  @param   TYPE     The type of argument to retrieve from the beginning
500
+                    of the variable argument list.
501
+
502
+  @return  An argument of the type specified by TYPE.
503
+
504
+**/
505
+#define VA_ARG(Marker, TYPE)   (*(TYPE *) ((Marker += _INT_SIZE_OF (TYPE)) - _INT_SIZE_OF (TYPE)))
506
+
507
+/**
508
+  Terminates the use of a variable argument list.
509
+
510
+  This function initializes Marker so it can no longer be used with VA_ARG().
511
+  After this macro is used, the only way to access the variable argument list is
512
+  by using VA_START() again.
513
+
514
+  @param   Marker   VA_LIST used to traverse the list of arguments.
515
+
516
+**/
517
+#define VA_END(Marker)      (Marker = (VA_LIST) 0)
518
+
519
+#endif
202 520
 
203 521
 ///
204
-///  ALIGN_POINTER - aligns a pointer to the lowest boundry
522
+/// Pointer to the start of a variable argument list stored in a memory buffer. Same as UINT8 *.
205 523
 ///
524
+typedef UINTN  *BASE_LIST;
525
+
526
+/**
527
+  Returns the size of a data type in sizeof(UINTN) units rounded up to the nearest UINTN boundary.
528
+
529
+  @param  TYPE  The date type to determine the size of.
530
+
531
+  @return The size of TYPE in sizeof (UINTN) units rounded up to the nearest UINTN boundary.
532
+**/
533
+#define _BASE_INT_SIZE_OF(TYPE) ((sizeof (TYPE) + sizeof (UINTN) - 1) / sizeof (UINTN))
534
+
535
+/**
536
+  Returns an argument of a specified type from a variable argument list and updates
537
+  the pointer to the variable argument list to point to the next argument.
538
+
539
+  This function returns an argument of the type specified by TYPE from the beginning
540
+  of the variable argument list specified by Marker.  Marker is then updated to point
541
+  to the next argument in the variable argument list.  The method for computing the
542
+  pointer to the next argument in the argument list is CPU specific following the EFIAPI ABI.
543
+
544
+  @param   Marker   The pointer to the beginning of a variable argument list.
545
+  @param   TYPE     The type of argument to retrieve from the beginning
546
+                    of the variable argument list.
547
+
548
+  @return  An argument of the type specified by TYPE.
549
+
550
+**/
551
+#define BASE_ARG(Marker, TYPE)   (*(TYPE *) ((Marker += _BASE_INT_SIZE_OF (TYPE)) - _BASE_INT_SIZE_OF (TYPE)))
552
+
553
+/**
554
+  The macro that returns the byte offset of a field in a data structure.
555
+
556
+  This function returns the offset, in bytes, of field specified by Field from the
557
+  beginning of the  data structure specified by TYPE. If TYPE does not contain Field,
558
+  the module will not compile.
559
+
560
+  @param   TYPE     The name of the data structure that contains the field specified by Field.
561
+  @param   Field    The name of the field in the data structure.
562
+
563
+  @return  Offset, in bytes, of field.
564
+
565
+**/
566
+#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
567
+
568
+/**
569
+  Macro that returns a pointer to the data structure that contains a specified field of
570
+  that data structure.  This is a lightweight method to hide information by placing a
571
+  public data structure inside a larger private data structure and using a pointer to
572
+  the public data structure to retrieve a pointer to the private data structure.
573
+
574
+  This function computes the offset, in bytes, of field specified by Field from the beginning
575
+  of the  data structure specified by TYPE.  This offset is subtracted from Record, and is
576
+  used to return a pointer to a data structure of the type specified by TYPE. If the data type
577
+  specified by TYPE does not contain the field specified by Field, then the module will not compile.
578
+
579
+  @param   Record   Pointer to the field specified by Field within a data structure of type TYPE.
580
+  @param   TYPE     The name of the data structure type to return.  This data structure must
581
+                    contain the field specified by Field.
582
+  @param   Field    The name of the field in the data structure specified by TYPE to which Record points.
583
+
584
+  @return  A pointer to the structure from one of it's elements.
585
+
586
+**/
587
+#define BASE_CR(Record, TYPE, Field)  ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
588
+
589
+/**
590
+  Rounds a value up to the next boundary using a specified alignment.
591
+
592
+  This function rounds Value up to the next boundary using the specified Alignment.
593
+  This aligned value is returned.
594
+
595
+  @param   Value      The value to round up.
596
+  @param   Alignment  The alignment boundary used to return the aligned value.
597
+
598
+  @return  A value up to the next boundary.
599
+
600
+**/
601
+#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
602
+
603
+/**
604
+  Adjust a pointer by adding the minimum offset required for it to be aligned on
605
+  a specified alignment boundary.
606
+
607
+  This function rounds the pointer specified by Pointer to the next alignment boundary
608
+  specified by Alignment. The pointer to the aligned address is returned.
609
+
610
+  @param   Pointer    The pointer to round up.
611
+  @param   Alignment  The alignment boundary to use to return an aligned pointer.
612
+
613
+  @return  Pointer to the aligned address.
614
+
615
+**/
206 616
 #define ALIGN_POINTER(Pointer, Alignment) ((VOID *) (ALIGN_VALUE ((UINTN)(Pointer), (Alignment))))
207 617
 
208
-///
209
-///  ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
210
-///
618
+/**
619
+  Rounds a value up to the next natural boundary for the current CPU.
620
+  This is 4-bytes for 32-bit CPUs and 8-bytes for 64-bit CPUs.
621
+
622
+  This function rounds the value specified by Value up to the next natural boundary for the
623
+  current CPU. This rounded value is returned.
624
+
625
+  @param   Value      The value to round up.
626
+
627
+  @return  Rounded value specified by Value.
628
+
629
+**/
211 630
 #define ALIGN_VARIABLE(Value)  ALIGN_VALUE ((Value), sizeof (UINTN))
212 631
 
213 632
 
214
-//
215
-// Return the maximum of two operands.
216
-// This macro returns the maximum of two operand specified by a and b.
217
-// Both a and b must be the same numerical types, signed or unsigned.
218
-//
633
+/**
634
+  Return the maximum of two operands.
635
+
636
+  This macro returns the maximum of two operand specified by a and b.
637
+  Both a and b must be the same numerical types, signed or unsigned.
638
+
639
+  @param   a        The first operand with any numerical type.
640
+  @param   b        The second operand. Can be any numerical type as long as is
641
+                    the same type as a.
642
+
643
+  @return  Maximum of two operands.
644
+
645
+**/
219 646
 #define MAX(a, b)                       \
220 647
   (((a) > (b)) ? (a) : (b))
221 648
 
649
+/**
650
+  Return the minimum of two operands.
651
+
652
+  This macro returns the minimal of two operand specified by a and b.
653
+  Both a and b must be the same numerical types, signed or unsigned.
654
+
655
+  @param   a        The first operand with any numerical type.
656
+  @param   b        The second operand. It should be the same any numerical type with a.
657
+
658
+  @return  Minimum of two operands.
659
+
660
+**/
222 661
 
223
-//
224
-// Return the minimum of two operands.
225
-// This macro returns the minimal of two operand specified by a and b.
226
-// Both a and b must be the same numerical types, signed or unsigned.
227
-//
228 662
 #define MIN(a, b)                       \
229 663
   (((a) < (b)) ? (a) : (b))
230 664
 
231
-
232 665
 //
233
-// EFI Error Codes common to all execution phases
666
+// Status codes common to all execution phases
234 667
 //
668
+typedef UINTN RETURN_STATUS;
235 669
 
236
-typedef INTN RETURN_STATUS;
670
+/**
671
+  Produces a RETURN_STATUS code with the highest bit set.
237 672
 
238
-///
239
-/// Set the upper bit to indicate EFI Error.
240
-///
241
-#define ENCODE_ERROR(a)              (MAX_BIT | (a))
673
+  @param  StatusCode    The status code value to convert into a warning code.
674
+                        StatusCode must be in the range 0x00000000..0x7FFFFFFF.
675
+
676
+  @return The value specified by StatusCode with the highest bit set.
677
+
678
+**/
679
+#define ENCODE_ERROR(StatusCode)     ((RETURN_STATUS)(MAX_BIT | (StatusCode)))
680
+
681
+/**
682
+  Produces a RETURN_STATUS code with the highest bit clear.
683
+
684
+  @param  StatusCode    The status code value to convert into a warning code.
685
+                        StatusCode must be in the range 0x00000000..0x7FFFFFFF.
242 686
 
243
-#define ENCODE_WARNING(a)            (a)
244
-#define RETURN_ERROR(a)              ((INTN) (a) < 0)
687
+  @return The value specified by StatusCode with the highest bit clear.
688
+
689
+**/
690
+#define ENCODE_WARNING(StatusCode)   ((RETURN_STATUS)(StatusCode))
691
+
692
+/**
693
+  Returns TRUE if a specified RETURN_STATUS code is an error code.
694
+
695
+  This function returns TRUE if StatusCode has the high bit set.  Otherwise, FALSE is returned.
696
+
697
+  @param  StatusCode    The status code value to evaluate.
698
+
699
+  @retval TRUE          The high bit of StatusCode is set.
700
+  @retval FALSE         The high bit of StatusCode is clear.
701
+
702
+**/
703
+#define RETURN_ERROR(StatusCode)     (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
245 704
 
705
+///
706
+/// The operation completed successfully.
707
+///
246 708
 #define RETURN_SUCCESS               0
709
+
710
+///
711
+/// The image failed to load.
712
+///
247 713
 #define RETURN_LOAD_ERROR            ENCODE_ERROR (1)
714
+
715
+///
716
+/// The parameter was incorrect.
717
+///
248 718
 #define RETURN_INVALID_PARAMETER     ENCODE_ERROR (2)
719
+
720
+///
721
+/// The operation is not supported.
722
+///
249 723
 #define RETURN_UNSUPPORTED           ENCODE_ERROR (3)
724
+
725
+///
726
+/// The buffer was not the proper size for the request.
727
+///
250 728
 #define RETURN_BAD_BUFFER_SIZE       ENCODE_ERROR (4)
729
+
730
+///
731
+/// The buffer was not large enough to hold the requested data.
732
+/// The required buffer size is returned in the appropriate
733
+/// parameter when this error occurs.
734
+///
251 735
 #define RETURN_BUFFER_TOO_SMALL      ENCODE_ERROR (5)
736
+
737
+///
738
+/// There is no data pending upon return.
739
+///
252 740
 #define RETURN_NOT_READY             ENCODE_ERROR (6)
741
+
742
+///
743
+/// The physical device reported an error while attempting the
744
+/// operation.
745
+///
253 746
 #define RETURN_DEVICE_ERROR          ENCODE_ERROR (7)
747
+
748
+///
749
+/// The device can not be written to.
750
+///
254 751
 #define RETURN_WRITE_PROTECTED       ENCODE_ERROR (8)
752
+
753
+///
754
+/// The resource has run out.
755
+///
255 756
 #define RETURN_OUT_OF_RESOURCES      ENCODE_ERROR (9)
757
+
758
+///
759
+/// An inconsistency was detected on the file system causing the
760
+/// operation to fail.
761
+///
256 762
 #define RETURN_VOLUME_CORRUPTED      ENCODE_ERROR (10)
763
+
764
+///
765
+/// There is no more space on the file system.
766
+///
257 767
 #define RETURN_VOLUME_FULL           ENCODE_ERROR (11)
768
+
769
+///
770
+/// The device does not contain any medium to perform the
771
+/// operation.
772
+///
258 773
 #define RETURN_NO_MEDIA              ENCODE_ERROR (12)
774
+
775
+///
776
+/// The medium in the device has changed since the last
777
+/// access.
778
+///
259 779
 #define RETURN_MEDIA_CHANGED         ENCODE_ERROR (13)
780
+
781
+///
782
+/// The item was not found.
783
+///
260 784
 #define RETURN_NOT_FOUND             ENCODE_ERROR (14)
785
+
786
+///
787
+/// Access was denied.
788
+///
261 789
 #define RETURN_ACCESS_DENIED         ENCODE_ERROR (15)
790
+
791
+///
792
+/// The server was not found or did not respond to the request.
793
+///
262 794
 #define RETURN_NO_RESPONSE           ENCODE_ERROR (16)
795
+
796
+///
797
+/// A mapping to the device does not exist.
798
+///
263 799
 #define RETURN_NO_MAPPING            ENCODE_ERROR (17)
800
+
801
+///
802
+/// A timeout time expired.
803
+///
264 804
 #define RETURN_TIMEOUT               ENCODE_ERROR (18)
805
+
806
+///
807
+/// The protocol has not been started.
808
+///
265 809
 #define RETURN_NOT_STARTED           ENCODE_ERROR (19)
810
+
811
+///
812
+/// The protocol has already been started.
813
+///
266 814
 #define RETURN_ALREADY_STARTED       ENCODE_ERROR (20)
815
+
816
+///
817
+/// The operation was aborted.
818
+///
267 819
 #define RETURN_ABORTED               ENCODE_ERROR (21)
820
+
821
+///
822
+/// An ICMP error occurred during the network operation.
823
+///
268 824
 #define RETURN_ICMP_ERROR            ENCODE_ERROR (22)
825
+
826
+///
827
+/// A TFTP error occurred during the network operation.
828
+///
269 829
 #define RETURN_TFTP_ERROR            ENCODE_ERROR (23)
830
+
831
+///
832
+/// A protocol error occurred during the network operation.
833
+///
270 834
 #define RETURN_PROTOCOL_ERROR        ENCODE_ERROR (24)
835
+
836
+///
837
+/// A function encountered an internal version that was
838
+/// incompatible with a version requested by the caller.
839
+///
271 840
 #define RETURN_INCOMPATIBLE_VERSION  ENCODE_ERROR (25)
841
+
842
+///
843
+/// The function was not performed due to a security violation.
844
+///
272 845
 #define RETURN_SECURITY_VIOLATION    ENCODE_ERROR (26)
846
+
847
+///
848
+/// A CRC error was detected.
849
+///
273 850
 #define RETURN_CRC_ERROR             ENCODE_ERROR (27)
851
+
852
+///
853
+/// The beginning or end of media was reached.
854
+///
274 855
 #define RETURN_END_OF_MEDIA          ENCODE_ERROR (28)
856
+
857
+///
858
+/// The end of the file was reached.
859
+///
275 860
 #define RETURN_END_OF_FILE           ENCODE_ERROR (31)
861
+
862
+///
863
+/// The language specified was invalid.
864
+///
276 865
 #define RETURN_INVALID_LANGUAGE      ENCODE_ERROR (32)
277 866
 
278 867
 
868
+///
869
+/// The string contained one or more characters that
870
+/// the device could not render and were skipped.
871
+///
279 872
 #define RETURN_WARN_UNKNOWN_GLYPH    ENCODE_WARNING (1)
873
+
874
+///
875
+/// The handle was closed, but the file was not deleted.
876
+///
280 877
 #define RETURN_WARN_DELETE_FAILURE   ENCODE_WARNING (2)
878
+
879
+///
880
+/// The handle was closed, but the data to the file was not
881
+/// flushed properly.
882
+///
281 883
 #define RETURN_WARN_WRITE_FAILURE    ENCODE_WARNING (3)
884
+
885
+///
886
+/// The resulting buffer was too small, and the data was
887
+/// truncated to the buffer size.
888
+///
282 889
 #define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
283 890
 
284 891
 /**
285 892
   Returns a 16-bit signature built from 2 ASCII characters.
286 893
 
287
-  @param  A	   The first ASCII character.
288
-  @param  B	   The second ASCII character.
894
+  This macro returns a 16-bit value built from the two ASCII characters specified
895
+  by A and B.
896
+
897
+  @param  A    The first ASCII character.
898
+  @param  B    The second ASCII character.
289 899
 
290 900
   @return A 16-bit value built from the two ASCII characters specified by A and B.
291 901
 
@@ -295,10 +905,13 @@ typedef INTN RETURN_STATUS;
295 905
 /**
296 906
   Returns a 32-bit signature built from 4 ASCII characters.
297 907
 
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.
908
+  This macro returns a 32-bit value built from the four ASCII characters specified
909
+  by A, B, C, and D.
910
+
911
+  @param  A    The first ASCII character.
912
+  @param  B    The second ASCII character.
913
+  @param  C    The third ASCII character.
914
+  @param  D    The fourth ASCII character.
302 915
 
303 916
   @return A 32-bit value built from the two ASCII characters specified by A, B,
304 917
           C and D.
@@ -309,14 +922,17 @@ typedef INTN RETURN_STATUS;
309 922
 /**
310 923
   Returns a 64-bit signature built from 8 ASCII characters.
311 924
 
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.
925
+  This macro returns a 64-bit value built from the eight ASCII characters specified
926
+  by A, B, C, D, E, F, G,and H.
927
+
928
+  @param  A    The first ASCII character.
929
+  @param  B    The second ASCII character.
930
+  @param  C    The third ASCII character.
931
+  @param  D    The fourth ASCII character.
932
+  @param  E    The fifth ASCII character.
933
+  @param  F    The sixth ASCII character.
934
+  @param  G    The seventh ASCII character.
935
+  @param  H    The eighth ASCII character.
320 936
 
321 937
   @return A 64-bit value built from the two ASCII characters specified by A, B,
322 938
           C, D, E, F, G and H.

+ 25
- 0
src/include/ipxe/efi/Guid/HiiFormMapMethodGuid.h View File

@@ -0,0 +1,25 @@
1
+/** @file
2
+  Guid used to identify HII FormMap configuration method.
3
+
4
+  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
5
+  This program and the accompanying materials
6
+  are licensed and made available under the terms and conditions of the BSD License
7
+  which accompanies this distribution.  The full text of the license may be found at
8
+  http://opensource.org/licenses/bsd-license.php
9
+
10
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+  @par Revision Reference:
14
+  GUID defined in UEFI 2.2 spec.
15
+**/
16
+
17
+#ifndef __EFI_HII_FORMMAP_GUID_H__
18
+#define __EFI_HII_FORMMAP_GUID_H__
19
+
20
+#define EFI_HII_STANDARD_FORM_GUID \
21
+  { 0x3bd2f4ec, 0xe524, 0x46e4, { 0xa9, 0xd8, 0x51, 0x1, 0x17, 0x42, 0x55, 0x62 } }
22
+
23
+extern EFI_GUID gEfiHiiStandardFormGuid;
24
+
25
+#endif

+ 3
- 3
src/include/ipxe/efi/Guid/PcAnsi.h View File

@@ -1,8 +1,8 @@
1 1
 /** @file
2 2
   Terminal Device Path Vendor Guid.
3 3
 
4
-  Copyright (c) 2006, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
4
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5
+  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
8 8
   http://opensource.org/licenses/bsd-license.php
@@ -38,7 +38,7 @@
38 38
     0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
39 39
   }
40 40
 
41
-#define EFI_UART_DEVICE_PATH_GUID \
41
+#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL \
42 42
   { \
43 43
     0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
44 44
   }

+ 3
- 5
src/include/ipxe/efi/Guid/SmBios.h View File

@@ -5,8 +5,8 @@
5 5
   locate the SMBIOS tables. Do not search the 0xF0000 segment to find SMBIOS
6 6
   tables.
7 7
 
8
-  Copyright (c) 2006, Intel Corporation
9
-  All rights reserved. This program and the accompanying materials
8
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
9
+  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
12 12
   http://opensource.org/licenses/bsd-license.php
@@ -22,13 +22,11 @@
22 22
 #ifndef __SMBIOS_GUID_H__
23 23
 #define __SMBIOS_GUID_H__
24 24
 
25
-#define EFI_SMBIOS_TABLE_GUID \
25
+#define SMBIOS_TABLE_GUID \
26 26
   { \
27 27
     0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
28 28
   }
29 29
 
30
-#define SMBIOS_TABLE_GUID EFI_SMBIOS_TABLE_GUID
31
-
32 30
 extern EFI_GUID       gEfiSmbiosTableGuid;
33 31
 
34 32
 #endif

+ 128
- 0
src/include/ipxe/efi/Guid/WinCertificate.h View File

@@ -0,0 +1,128 @@
1
+/** @file
2
+  GUID for UEFI WIN_CERTIFICATE structure.
3
+
4
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+  This program and the accompanying materials
6
+  are licensed and made available under the terms and conditions of the BSD License
7
+  which accompanies this distribution.  The full text of the license may be found at
8
+  http://opensource.org/licenses/bsd-license.php
9
+
10
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+  @par Revision Reference:
14
+  GUID defined in UEFI 2.0 spec.
15
+**/
16
+
17
+#ifndef __EFI_WIN_CERTIFICATE_H__
18
+#define __EFI_WIN_CERTIFICATE_H__
19
+
20
+//
21
+// _WIN_CERTIFICATE.wCertificateType
22
+//
23
+#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
24
+#define WIN_CERT_TYPE_EFI_PKCS115      0x0EF0
25
+#define WIN_CERT_TYPE_EFI_GUID         0x0EF1
26
+
27
+///
28
+/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
29
+///
30
+typedef struct {
31
+  ///
32
+  /// The length of the entire certificate,
33
+  /// including the length of the header, in bytes.
34
+  ///
35
+  UINT32  dwLength;
36
+  ///
37
+  /// The revision level of the WIN_CERTIFICATE
38
+  /// structure. The current revision level is 0x0200.
39
+  ///
40
+  UINT16  wRevision;
41
+  ///
42
+  /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI
43
+  /// certificate types. The UEFI specification reserves the range of
44
+  /// certificate type values from 0x0EF0 to 0x0EFF.
45
+  ///
46
+  UINT16  wCertificateType;
47
+  ///
48
+  /// The following is the actual certificate. The format of
49
+  /// the certificate depends on wCertificateType.
50
+  ///
51
+  /// UINT8 bCertificate[ANYSIZE_ARRAY];
52
+  ///
53
+} WIN_CERTIFICATE;
54
+
55
+///
56
+/// WIN_CERTIFICATE_UEFI_GUID.CertType
57
+///
58
+#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
59
+  {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
60
+
61
+///
62
+/// WIN_CERTIFICATE_UEFI_GUID.CertData
63
+///
64
+typedef struct {
65
+  EFI_GUID  HashType;
66
+  UINT8     PublicKey[256];
67
+  UINT8     Signature[256];
68
+} EFI_CERT_BLOCK_RSA_2048_SHA256;
69
+
70
+
71
+///
72
+/// Certificate which encapsulates a GUID-specific digital signature
73
+///
74
+typedef struct {
75
+  ///
76
+  /// This is the standard WIN_CERTIFICATE header, where
77
+  /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID.
78
+  ///
79
+  WIN_CERTIFICATE   Hdr;
80
+  ///
81
+  /// This is the unique id which determines the
82
+  /// format of the CertData. .
83
+  ///
84
+  EFI_GUID          CertType;
85
+  ///
86
+  /// The following is the certificate data. The format of
87
+  /// the data is determined by the CertType.
88
+  /// If CertType is EFI_CERT_TYPE_RSA2048_SHA256_GUID,
89
+  /// the CertData will be EFI_CERT_BLOCK_RSA_2048_SHA256 structure.
90
+  ///
91
+  UINT8            CertData[1];
92
+} WIN_CERTIFICATE_UEFI_GUID;
93
+
94
+
95
+///
96
+/// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.
97
+///
98
+/// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
99
+/// WIN_CERTIFICATE and encapsulate the information needed to
100
+/// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
101
+/// specified in RFC2437.
102
+///
103
+typedef struct {
104
+  ///
105
+  /// This is the standard WIN_CERTIFICATE header, where
106
+  /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15.
107
+  ///
108
+  WIN_CERTIFICATE Hdr;
109
+  ///
110
+  /// This is the hashing algorithm which was performed on the
111
+  /// UEFI executable when creating the digital signature.
112
+  ///
113
+  EFI_GUID        HashAlgorithm;
114
+  ///
115
+  /// The following is the actual digital signature. The
116
+  /// size of the signature is the same size as the key
117
+  /// (1024-bit key is 128 bytes) and can be determined by
118
+  /// subtracting the length of the other parts of this header
119
+  /// from the total length of the certificate as found in
120
+  /// Hdr.dwLength.
121
+  ///
122
+  /// UINT8 Signature[];
123
+  ///
124
+} WIN_CERTIFICATE_EFI_PKCS1_15;
125
+
126
+extern EFI_GUID gEfiCertTypeRsa2048Sha256Guid;
127
+
128
+#endif

+ 160
- 97
src/include/ipxe/efi/Ia32/ProcessorBind.h View File

@@ -1,14 +1,14 @@
1 1
 /** @file
2
-  Processor or Compiler specific defines and types for Ia32 architecture.
2
+  Processor or Compiler specific defines and types for IA-32 architecture.
3 3
 
4
-  Copyright (c) 2006, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
 **/
14 14
 
@@ -16,18 +16,18 @@
16 16
 #define __PROCESSOR_BIND_H__
17 17
 
18 18
 ///
19
-/// Define the processor type so other code can make processor based choices
19
+/// Define the processor type so other code can make processor based choices.
20 20
 ///
21 21
 #define MDE_CPU_IA32
22 22
 
23 23
 //
24
-// Make sure we are useing the correct packing rules per EFI specification
24
+// Make sure we are using the correct packing rules per EFI specification
25 25
 //
26
-#ifndef __GNUC__
26
+#if !defined(__GNUC__)
27 27
 #pragma pack()
28 28
 #endif
29 29
 
30
-#if __INTEL_COMPILER
30
+#if defined(__INTEL_COMPILER)
31 31
 //
32 32
 // Disable ICC's remark #869: "Parameter" was never referenced warning.
33 33
 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
@@ -46,10 +46,16 @@
46 46
 //
47 47
 #pragma warning ( disable : 1419 )
48 48
 
49
+//
50
+// Disable ICC's remark #593: "Variable" was set but never used.
51
+// This is legal ANSI C code so we disable the remark that is turned on with /W4
52
+//
53
+#pragma warning ( disable : 593 )
54
+
49 55
 #endif
50 56
 
51 57
 
52
-#if _MSC_EXTENSIONS
58
+#if defined(_MSC_EXTENSIONS)
53 59
 
54 60
 //
55 61
 // Disable warning that make it impossible to compile at /W4
@@ -83,133 +89,190 @@
83 89
 #pragma warning ( disable : 4505 )
84 90
 
85 91
 //
86
-// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
92
+// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
87 93
 //
88 94
 #pragma warning ( disable : 4206 )
89 95
 
90 96
 #endif
91 97
 
92 98
 
93
-#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
94
-  //
95
-  // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
96
-  //
97
-
98
-  #if _MSC_EXTENSIONS
99
-
100
-    //
101
-    // use Microsoft* C complier dependent interger width types
102
-    //
103
-    typedef unsigned __int64    UINT64;
104
-    typedef __int64             INT64;
105
-    typedef unsigned __int32    UINT32;
106
-    typedef __int32             INT32;
107
-    typedef unsigned short      UINT16;
108
-    typedef unsigned short      CHAR16;
109
-    typedef short               INT16;
110
-    typedef unsigned char       BOOLEAN;
111
-    typedef unsigned char       UINT8;
112
-    typedef char                CHAR8;
113
-    typedef char                INT8;
114
-  #else
115
-
116
-    //
117
-    // Assume standard IA-32 alignment.
118
-    // Need to check portability of long long
119
-    //
120
-    typedef unsigned long long  UINT64;
121
-    typedef long long           INT64;
122
-    typedef unsigned int        UINT32;
123
-    typedef int                 INT32;
124
-    typedef unsigned short      UINT16;
125
-    typedef unsigned short      CHAR16;
126
-    typedef short               INT16;
127
-    typedef unsigned char       BOOLEAN;
128
-    typedef unsigned char       UINT8;
129
-    typedef char                CHAR8;
130
-    typedef char                INT8;
131
-  #endif
99
+#if defined(_MSC_EXTENSIONS)
132 100
 
133
-  #define UINT8_MAX 0xff
134
-
135
-#else
136 101
   //
137
-  // Use ANSI C 2000 stdint.h integer width declarations
102
+  // use Microsoft C complier dependent integer width types
138 103
   //
139
-  #include "stdint.h"
140
-  typedef uint8_t   BOOLEAN;
141
-  typedef int8_t    INT8;
142
-  typedef uint8_t   UINT8;
143
-  typedef int16_t   INT16;
144
-  typedef uint16_t  UINT16;
145
-  typedef int32_t   INT32;
146
-  typedef uint32_t  UINT32;
147
-  typedef int64_t   INT64;
148
-  typedef uint64_t  UINT64;
149
-  typedef char      CHAR8;
150
-  typedef uint16_t  CHAR16;
151 104
 
105
+  ///
106
+  /// 8-byte unsigned value.
107
+  ///
108
+  typedef unsigned __int64    UINT64;
109
+  ///
110
+  /// 8-byte signed value.
111
+  ///
112
+  typedef __int64             INT64;
113
+  ///
114
+  /// 4-byte unsigned value.
115
+  ///
116
+  typedef unsigned __int32    UINT32;
117
+  ///
118
+  /// 4-byte signed value.
119
+  ///
120
+  typedef __int32             INT32;
121
+  ///
122
+  /// 2-byte unsigned value.
123
+  ///
124
+  typedef unsigned short      UINT16;
125
+  ///
126
+  /// 2-byte Character.  Unless otherwise specified all strings are stored in the
127
+  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
128
+  ///
129
+  typedef unsigned short      CHAR16;
130
+  ///
131
+  /// 2-byte signed value.
132
+  ///
133
+  typedef short               INT16;
134
+  ///
135
+  /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
136
+  /// values are undefined.
137
+  ///
138
+  typedef unsigned char       BOOLEAN;
139
+  ///
140
+  /// 1-byte unsigned value.
141
+  ///
142
+  typedef unsigned char       UINT8;
143
+  ///
144
+  /// 1-byte Character.
145
+  ///
146
+  typedef char                CHAR8;
147
+  ///
148
+  /// 1-byte signed value.
149
+  ///
150
+  typedef char                INT8;
151
+#else
152
+  ///
153
+  /// 8-byte unsigned value.
154
+  ///
155
+  typedef unsigned long long  UINT64;
156
+  ///
157
+  /// 8-byte signed value.
158
+  ///
159
+  typedef long long           INT64;
160
+  ///
161
+  /// 4-byte unsigned value.
162
+  ///
163
+  typedef unsigned int        UINT32;
164
+  ///
165
+  /// 4-byte signed value.
166
+  ///
167
+  typedef int                 INT32;
168
+  ///
169
+  /// 2-byte unsigned value.
170
+  ///
171
+  typedef unsigned short      UINT16;
172
+  ///
173
+  /// 2-byte Character.  Unless otherwise specified all strings are stored in the
174
+  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
175
+  ///
176
+  typedef unsigned short      CHAR16;
177
+  ///
178
+  /// 2-byte signed value.
179
+  ///
180
+  typedef short               INT16;
181
+  ///
182
+  /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
183
+  /// values are undefined.
184
+  ///
185
+  typedef unsigned char       BOOLEAN;
186
+  ///
187
+  /// 1-byte unsigned value.
188
+  ///
189
+  typedef unsigned char       UINT8;
190
+  ///
191
+  /// 1-byte Character
192
+  ///
193
+  typedef char                CHAR8;
194
+  ///
195
+  /// 1-byte signed value
196
+  ///
197
+  typedef char                INT8;
152 198
 #endif
153 199
 
200
+///
201
+/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions;
202
+/// 8 bytes on supported 64-bit processor instructions.)
203
+///
154 204
 typedef UINT32  UINTN;
205
+///
206
+/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions;
207
+/// 8 bytes on supported 64-bit processor instructions.)
208
+///
155 209
 typedef INT32   INTN;
156 210
 
211
+//
212
+// Processor specific defines
213
+//
157 214
 
158 215
 ///
159
-/// Processor specific defines
216
+/// A value of native width with the highest bit set.
160 217
 ///
161 218
 #define MAX_BIT     0x80000000
219
+///
220
+/// A value of native width with the two highest bits set.
221
+///
162 222
 #define MAX_2_BITS  0xC0000000
163 223
 
164 224
 ///
165
-/// Maximum legal IA-32 address
225
+/// Maximum legal IA-32 address.
166 226
 ///
167 227
 #define MAX_ADDRESS   0xFFFFFFFF
168 228
 
169 229
 ///
170
-/// The stack alignment required for IA-32
230
+/// The stack alignment required for IA-32.
171 231
 ///
172 232
 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
173 233
 
174 234
 //
175 235
 // Modifier to ensure that all protocol member functions and EFI intrinsics
176 236
 // use the correct C calling convention. All protocol member functions and
177
-// EFI intrinsics are required to modify thier member functions with EFIAPI.
237
+// EFI intrinsics are required to modify their member functions with EFIAPI.
178 238
 //
179
-#if _MSC_EXTENSIONS
239
+#ifdef EFIAPI
180 240
   ///
181
-  /// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
241
+  /// If EFIAPI is already defined, then we use that definition.
242
+  ///
243
+#elif defined(_MSC_EXTENSIONS)
244
+  ///
245
+  /// Microsoft* compiler specific method for EFIAPI calling convention.
182 246
   ///
183 247
   #define EFIAPI __cdecl
184 248
 #else
185
-  #if __GNUC__
186
-    #define EFIAPI __attribute__((cdecl,regparm(0)))
249
+  #if defined(__GNUC__)
250
+    ///
251
+    /// GCC specific method for EFIAPI calling convention.
252
+    ///
253
+    #define EFIAPI __attribute__((cdecl))
187 254
   #endif
188 255
 #endif
189 256
 
190
-//
191
-// The Microsoft* C compiler can removed references to unreferenced data items
192
-//  if the /OPT:REF linker option is used. We defined a macro as this is a
193
-//  a non standard extension
194
-//
195
-#if _MSC_EXTENSIONS
196
-  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
197
-#else
198
-  #define GLOBAL_REMOVE_IF_UNREFERENCED
257
+#if defined(__GNUC__)
258
+  ///
259
+  /// For GNU assembly code, .global or .globl can declare global symbols.
260
+  /// Define this macro to unify the usage.
261
+  ///
262
+  #define ASM_GLOBAL .globl
199 263
 #endif
200 264
 
201
-//
202
-// For symbol name in GNU assembly code, an extra "_" is necessary
203
-//
204
-#if __GNUC__
205
-  #if defined(linux)
206
-    #define ASM_PFX(name) name
207
-  #else
208
-    #define ASM_PFX(name) _##name
209
-  #endif
210
-#endif
265
+/**
266
+  Return the pointer to the first instruction of a function given a function pointer.
267
+  On IA-32 CPU architectures, these two pointer values are the same,
268
+  so the implementation of this macro is very simple.
269
+
270
+  @param  FunctionPointer   A pointer to a function.
211 271
 
212
-#define FUNCTION_ENTRY_POINT(p) (p)
272
+  @return The pointer to the first instruction of a function given a function pointer.
273
+
274
+**/
275
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
213 276
 
214 277
 #endif
215 278
 

+ 259
- 45
src/include/ipxe/efi/IndustryStandard/Pci22.h View File

@@ -2,12 +2,12 @@
2 2
   Support for PCI 2.2 standard.
3 3
 
4 4
   This file includes the definitions in the following specifications,
5
-    PCI Local Bus Specification, 2.0
6
-    PCI-to-PCI Bridge Architecture Specification,
5
+    PCI Local Bus Specification, 2.2
6
+    PCI-to-PCI Bridge Architecture Specification, Revision 1.2
7 7
     PC Card Standard, 8.0
8 8
 
9
-  Copyright (c) 2006 - 2008, Intel Corporation
10
-  All rights reserved. This program and the accompanying materials
9
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
10
+  This program and the accompanying materials
11 11
   are licensed and made available under the terms and conditions of the BSD License
12 12
   which accompanies this distribution.  The full text of the license may be found at
13 13
   http://opensource.org/licenses/bsd-license.php
@@ -20,13 +20,16 @@
20 20
 #ifndef _PCI22_H_
21 21
 #define _PCI22_H_
22 22
 
23
-#define PCI_MAX_SEGMENT 0
24 23
 #define PCI_MAX_BUS     255
25 24
 #define PCI_MAX_DEVICE  31
26 25
 #define PCI_MAX_FUNC    7
27 26
 
28
-
29 27
 #pragma pack(1)
28
+
29
+///
30
+/// Common header region in PCI Configuration Space
31
+/// Section 6.1, PCI Local Bus Specification, 2.2
32
+///
30 33
 typedef struct {
31 34
   UINT16  VendorId;
32 35
   UINT16  DeviceId;
@@ -40,6 +43,10 @@ typedef struct {
40 43
   UINT8   BIST;
41 44
 } PCI_DEVICE_INDEPENDENT_REGION;
42 45
 
46
+///
47
+/// PCI Device header region in PCI Configuration Space
48
+/// Section 6.1, PCI Local Bus Specification, 2.2
49
+///
43 50
 typedef struct {
44 51
   UINT32  Bar[6];
45 52
   UINT32  CISPtr;
@@ -55,13 +62,18 @@ typedef struct {
55 62
   UINT8   MaxLat;
56 63
 } PCI_DEVICE_HEADER_TYPE_REGION;
57 64
 
65
+///
66
+/// PCI Device Configuration Space
67
+/// Section 6.1, PCI Local Bus Specification, 2.2
68
+///
58 69
 typedef struct {
59 70
   PCI_DEVICE_INDEPENDENT_REGION Hdr;
60 71
   PCI_DEVICE_HEADER_TYPE_REGION Device;
61 72
 } PCI_TYPE00;
62 73
 
63 74
 ///
64
-/// defined in PCI-to-PCI Bridge Architecture Specification
75
+/// PCI-PCI Bridge header region in PCI Configuration Space
76
+/// Section 3.2, PCI-PCI Bridge Architecture, Version 1.2
65 77
 ///
66 78
 typedef struct {
67 79
   UINT32  Bar[2];
@@ -88,6 +100,10 @@ typedef struct {
88 100
   UINT16  BridgeControl;
89 101
 } PCI_BRIDGE_CONTROL_REGISTER;
90 102
 
103
+///
104
+/// PCI-to-PCI Bridge Configuration Space
105
+/// Section 3.2, PCI-PCI Bridge Architecture, Version 1.2
106
+///
91 107
 typedef struct {
92 108
   PCI_DEVICE_INDEPENDENT_REGION Hdr;
93 109
   PCI_BRIDGE_CONTROL_REGISTER   Bridge;
@@ -99,7 +115,8 @@ typedef union {
99 115
 } PCI_TYPE_GENERIC;
100 116
 
101 117
 ///
102
-/// CardBus Conroller Configuration Space, defined in PC Card Standard. 8.0
118
+/// CardBus Conroller Configuration Space,
119
+/// Section 4.5.1, PC Card Standard. 8.0
103 120
 ///
104 121
 typedef struct {
105 122
   UINT32  CardBusSocketReg;     ///< Cardus Socket/ExCA Base
@@ -123,9 +140,9 @@ typedef struct {
123 140
   UINT16  BridgeControl;        ///< Bridge Control
124 141
 } PCI_CARDBUS_CONTROL_REGISTER;
125 142
 
126
-///
127
-/// Definitions of PCI class bytes and manipulation macros.
128
-///
143
+//
144
+// Definitions of PCI class bytes and manipulation macros.
145
+//
129 146
 #define PCI_CLASS_OLD                 0x00
130 147
 #define   PCI_CLASS_OLD_OTHER           0x00
131 148
 #define   PCI_CLASS_OLD_VGA             0x01
@@ -153,7 +170,6 @@ typedef struct {
153 170
 #define   PCI_CLASS_DISPLAY_XGA         0x01
154 171
 #define   PCI_CLASS_DISPLAY_3D          0x02
155 172
 #define   PCI_CLASS_DISPLAY_OTHER       0x80
156
-#define   PCI_CLASS_DISPLAY_GFX         0x80
157 173
 
158 174
 #define PCI_CLASS_MEDIA               0x04
159 175
 #define   PCI_CLASS_MEDIA_VIDEO         0x00
@@ -284,23 +300,172 @@ typedef struct {
284 300
 #define   PCI_SUBCLASS_DPIO             0x00
285 301
 #define   PCI_SUBCLASS_DPIO_OTHER       0x80
286 302
 
303
+/**
304
+  Macro that checks whether the Base Class code of device matched.
305
+
306
+  @param  _p      Specified device.
307
+  @param  c       Base Class code needs matching.
308
+
309
+  @retval TRUE    Base Class code matches the specified device.
310
+  @retval FALSE   Base Class code doesn't match the specified device.
311
+
312
+**/
287 313
 #define IS_CLASS1(_p, c)              ((_p)->Hdr.ClassCode[2] == (c))
314
+/**
315
+  Macro that checks whether the Base Class code and Sub-Class code of device matched.
316
+
317
+  @param  _p      Specified device.
318
+  @param  c       Base Class code needs matching.
319
+  @param  s       Sub-Class code needs matching.
320
+
321
+  @retval TRUE    Base Class code and Sub-Class code match the specified device.
322
+  @retval FALSE   Base Class code and Sub-Class code don't match the specified device.
323
+
324
+**/
288 325
 #define IS_CLASS2(_p, c, s)           (IS_CLASS1 (_p, c) && ((_p)->Hdr.ClassCode[1] == (s)))
326
+/**
327
+  Macro that checks whether the Base Class code, Sub-Class code and Interface code of device matched.
328
+
329
+  @param  _p      Specified device.
330
+  @param  c       Base Class code needs matching.
331
+  @param  s       Sub-Class code needs matching.
332
+  @param  p       Interface code needs matching.
333
+
334
+  @retval TRUE    Base Class code, Sub-Class code and Interface code match the specified device.
335
+  @retval FALSE   Base Class code, Sub-Class code and Interface code don't match the specified device.
336
+
337
+**/
289 338
 #define IS_CLASS3(_p, c, s, p)        (IS_CLASS2 (_p, c, s) && ((_p)->Hdr.ClassCode[0] == (p)))
290 339
 
340
+/**
341
+  Macro that checks whether device is a display controller.
342
+
343
+  @param  _p      Specified device.
344
+
345
+  @retval TRUE    Device is a display controller.
346
+  @retval FALSE   Device is not a display controller.
347
+
348
+**/
291 349
 #define IS_PCI_DISPLAY(_p)            IS_CLASS1 (_p, PCI_CLASS_DISPLAY)
292
-#define IS_PCI_VGA(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 0)
293
-#define IS_PCI_8514(_p)               IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 1)
294
-#define IS_PCI_GFX(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_GFX, 0)
350
+/**
351
+  Macro that checks whether device is a VGA-compatible controller.
352
+
353
+  @param  _p      Specified device.
354
+
355
+  @retval TRUE    Device is a VGA-compatible controller.
356
+  @retval FALSE   Device is not a VGA-compatible controller.
357
+
358
+**/
359
+#define IS_PCI_VGA(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_VGA)
360
+/**
361
+  Macro that checks whether device is an 8514-compatible controller.
362
+
363
+  @param  _p      Specified device.
364
+
365
+  @retval TRUE    Device is an 8514-compatible controller.
366
+  @retval FALSE   Device is not an 8514-compatible controller.
367
+
368
+**/
369
+#define IS_PCI_8514(_p)               IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_8514)
370
+/**
371
+  Macro that checks whether device is built before the Class Code field was defined.
372
+
373
+  @param  _p      Specified device.
374
+
375
+  @retval TRUE    Device is an old device.
376
+  @retval FALSE   Device is not an old device.
377
+
378
+**/
295 379
 #define IS_PCI_OLD(_p)                IS_CLASS1 (_p, PCI_CLASS_OLD)
380
+/**
381
+  Macro that checks whether device is a VGA-compatible device built before the Class Code field was defined.
382
+
383
+  @param  _p      Specified device.
384
+
385
+  @retval TRUE    Device is an old VGA-compatible device.
386
+  @retval FALSE   Device is not an old VGA-compatible device.
387
+
388
+**/
296 389
 #define IS_PCI_OLD_VGA(_p)            IS_CLASS2 (_p, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA)
390
+/**
391
+  Macro that checks whether device is an IDE controller.
392
+
393
+  @param  _p      Specified device.
394
+
395
+  @retval TRUE    Device is an IDE controller.
396
+  @retval FALSE   Device is not an IDE controller.
397
+
398
+**/
297 399
 #define IS_PCI_IDE(_p)                IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_IDE)
298
-#define IS_PCI_SCSI(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI, 0)
299
-#define IS_PCI_RAID(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID, 0)
300
-#define IS_PCI_LPC(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA, 0)
301
-#define IS_PCI_P2P(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 0)
302
-#define IS_PCI_P2P_SUB(_p)            IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 1)
400
+/**
401
+  Macro that checks whether device is a SCSI bus controller.
402
+
403
+  @param  _p      Specified device.
404
+
405
+  @retval TRUE    Device is a SCSI bus controller.
406
+  @retval FALSE   Device is not a SCSI bus controller.
407
+
408
+**/
409
+#define IS_PCI_SCSI(_p)               IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI)
410
+/**
411
+  Macro that checks whether device is a RAID controller.
412
+
413
+  @param  _p      Specified device.
414
+
415
+  @retval TRUE    Device is a RAID controller.
416
+  @retval FALSE   Device is not a RAID controller.
417
+
418
+**/
419
+#define IS_PCI_RAID(_p)               IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID)
420
+/**
421
+  Macro that checks whether device is an ISA bridge.
422
+
423
+  @param  _p      Specified device.
424
+
425
+  @retval TRUE    Device is an ISA bridge.
426
+  @retval FALSE   Device is not an ISA bridge.
427
+
428
+**/
429
+#define IS_PCI_LPC(_p)                IS_CLASS2 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA)
430
+/**
431
+  Macro that checks whether device is a PCI-to-PCI bridge.
432
+
433
+  @param  _p      Specified device.
434
+
435
+  @retval TRUE    Device is a PCI-to-PCI bridge.
436
+  @retval FALSE   Device is not a PCI-to-PCI bridge.
437
+
438
+**/
439
+#define IS_PCI_P2P(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P)
440
+/**
441
+  Macro that checks whether device is a Subtractive Decode PCI-to-PCI bridge.
442
+
443
+  @param  _p      Specified device.
444
+
445
+  @retval TRUE    Device is a Subtractive Decode PCI-to-PCI bridge.
446
+  @retval FALSE   Device is not a Subtractive Decode PCI-to-PCI bridge.
447
+
448
+**/
449
+#define IS_PCI_P2P_SUB(_p)            IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P_SUBTRACTIVE)
450
+/**
451
+  Macro that checks whether device is a 16550-compatible serial controller.
452
+
453
+  @param  _p      Specified device.
454
+
455
+  @retval TRUE    Device is a 16550-compatible serial controller.
456
+  @retval FALSE   Device is not a 16550-compatible serial controller.
457
+
458
+**/
303 459
 #define IS_PCI_16550_SERIAL(_p)       IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
460
+/**
461
+  Macro that checks whether device is a Universal Serial Bus controller.
462
+
463
+  @param  _p      Specified device.
464
+
465
+  @retval TRUE    Device is a Universal Serial Bus controller.
466
+  @retval FALSE   Device is not a Universal Serial Bus controller.
467
+
468
+**/
304 469
 #define IS_PCI_USB(_p)                IS_CLASS2 (_p, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB)
305 470
 
306 471
 //
@@ -314,9 +479,35 @@ typedef struct {
314 479
 // Mask of Header type
315 480
 //
316 481
 #define HEADER_LAYOUT_CODE            0x7f
482
+/**
483
+  Macro that checks whether device is a PCI-PCI bridge.
484
+
485
+  @param  _p      Specified device.
486
+
487
+  @retval TRUE    Device is a PCI-PCI bridge.
488
+  @retval FALSE   Device is not a PCI-PCI bridge.
317 489
 
490
+**/
318 491
 #define IS_PCI_BRIDGE(_p)             (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_PCI_TO_PCI_BRIDGE))
492
+/**
493
+  Macro that checks whether device is a CardBus bridge.
494
+
495
+  @param  _p      Specified device.
496
+
497
+  @retval TRUE    Device is a CardBus bridge.
498
+  @retval FALSE   Device is not a CardBus bridge.
499
+
500
+**/
319 501
 #define IS_CARDBUS_BRIDGE(_p)         (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE))
502
+/**
503
+  Macro that checks whether device is a multiple functions device.
504
+
505
+  @param  _p      Specified device.
506
+
507
+  @retval TRUE    Device is a multiple functions device.
508
+  @retval FALSE   Device is not a multiple functions device.
509
+
510
+**/
320 511
 #define IS_PCI_MULTI_FUNC(_p)         ((_p)->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION)
321 512
 
322 513
 ///
@@ -350,9 +541,9 @@ typedef struct {
350 541
 #define PCI_MAXGNT_OFFSET                           0x3E ///< Max Grant Register
351 542
 #define PCI_MAXLAT_OFFSET                           0x3F ///< Max Latency Register
352 543
 
353
-///
354
-/// defined in PCI-to-PCI Bridge Architecture Specification
355
-///
544
+//
545
+// defined in PCI-to-PCI Bridge Architecture Specification
546
+//
356 547
 #define PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET      0x18
357 548
 #define PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET    0x19
358 549
 #define PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET  0x1a
@@ -364,6 +555,9 @@ typedef struct {
364 555
 ///
365 556
 #define PCI_INT_LINE_UNKNOWN                        0xFF
366 557
 
558
+///
559
+/// PCI Access Data Format
560
+///
367 561
 typedef union {
368 562
   struct {
369 563
     UINT32  Reg : 8;
@@ -389,9 +583,9 @@ typedef union {
389 583
 #define EFI_PCI_COMMAND_SERR                            BIT8   ///< 0x0100
390 584
 #define EFI_PCI_COMMAND_FAST_BACK_TO_BACK               BIT9   ///< 0x0200
391 585
 
392
-///
393
-/// defined in PCI-to-PCI Bridge Architecture Specification
394
-///
586
+//
587
+// defined in PCI-to-PCI Bridge Architecture Specification
588
+//
395 589
 #define EFI_PCI_BRIDGE_CONTROL_PARITY_ERROR_RESPONSE    BIT0   ///< 0x0001
396 590
 #define EFI_PCI_BRIDGE_CONTROL_SERR                     BIT1   ///< 0x0002
397 591
 #define EFI_PCI_BRIDGE_CONTROL_ISA                      BIT2   ///< 0x0004
@@ -405,9 +599,9 @@ typedef union {
405 599
 #define EFI_PCI_BRIDGE_CONTROL_TIMER_STATUS             BIT10  ///< 0x0400
406 600
 #define EFI_PCI_BRIDGE_CONTROL_DISCARD_TIMER_SERR       BIT11  ///< 0x0800
407 601
 
408
-///
409
-/// Following are the PCI-CARDBUS bridge control bit, defined in PC Card Standard
410
-///
602
+//
603
+// Following are the PCI-CARDBUS bridge control bit, defined in PC Card Standard
604
+//
411 605
 #define EFI_PCI_BRIDGE_CONTROL_IREQINT_ENABLE           BIT7   ///< 0x0080
412 606
 #define EFI_PCI_BRIDGE_CONTROL_RANGE0_MEMORY_TYPE       BIT8   ///< 0x0100
413 607
 #define EFI_PCI_BRIDGE_CONTROL_RANGE1_MEMORY_TYPE       BIT9   ///< 0x0200
@@ -436,13 +630,19 @@ typedef union {
436 630
 #define EFI_PCI_CAPABILITY_ID_SLOTID  0x04
437 631
 #define EFI_PCI_CAPABILITY_ID_MSI     0x05
438 632
 #define EFI_PCI_CAPABILITY_ID_HOTPLUG 0x06
633
+
634
+///
635
+/// Capabilities List Header
636
+/// Section 6.7, PCI Local Bus Specification, 2.2
637
+///
439 638
 typedef struct {
440 639
   UINT8 CapabilityID;
441 640
   UINT8 NextItemPtr;
442 641
 } EFI_PCI_CAPABILITY_HDR;
443 642
 
444 643
 ///
445
-/// Capability EFI_PCI_CAPABILITY_ID_PMI, defined in PCI Power Management Interface Specifiction
644
+/// Power Management Register Block Definition
645
+/// Section 3.2, PCI Power Management Interface Specifiction, Revision 1.2
446 646
 ///
447 647
 typedef struct {
448 648
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -453,7 +653,8 @@ typedef struct {
453 653
 } EFI_PCI_CAPABILITY_PMI;
454 654
 
455 655
 ///
456
-/// Capability EFI_PCI_CAPABILITY_ID_AGP, defined in Accelerated Graphics Port Interface Specification
656
+/// A.G.P Capability
657
+/// Section 6.1.4, Accelerated Graphics Port Interface Specification, Revision 1.0
457 658
 ///
458 659
 typedef struct {
459 660
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -464,7 +665,8 @@ typedef struct {
464 665
 } EFI_PCI_CAPABILITY_AGP;
465 666
 
466 667
 ///
467
-/// Capability EFI_PCI_CAPABILITY_ID_VPD, in PCI2.2 Spec.
668
+/// VPD Capability Structure
669
+/// Appendix I, PCI Local Bus Specification, 2.2
468 670
 ///
469 671
 typedef struct {
470 672
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -473,7 +675,8 @@ typedef struct {
473 675
 } EFI_PCI_CAPABILITY_VPD;
474 676
 
475 677
 ///
476
-/// Capability EFI_PCI_CAPABILITY_ID_SLOTID, defined in PCI-to-PCI Bridge Architeture Specification
678
+/// Slot Numbering Capabilities Register
679
+/// Section 3.2.6, PCI-to-PCI Bridge Architeture Specification, Revision 1.2
477 680
 ///
478 681
 typedef struct {
479 682
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -482,7 +685,8 @@ typedef struct {
482 685
 } EFI_PCI_CAPABILITY_SLOTID;
483 686
 
484 687
 ///
485
-/// Capability EFI_PCI_CAPABILITY_ID_MSI, defined in PCI2.2
688
+/// Message Capability Structure for 32-bit Message Address
689
+/// Section 6.8.1, PCI Local Bus Specification, 2.2
486 690
 ///
487 691
 typedef struct {
488 692
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -491,6 +695,10 @@ typedef struct {
491 695
   UINT16                  MsgDataReg;
492 696
 } EFI_PCI_CAPABILITY_MSI32;
493 697
 
698
+///
699
+/// Message Capability Structure for 64-bit Message Address
700
+/// Section 6.8.1, PCI Local Bus Specification, 2.2
701
+///
494 702
 typedef struct {
495 703
   EFI_PCI_CAPABILITY_HDR  Hdr;
496 704
   UINT16                  MsgCtrlReg;
@@ -500,7 +708,8 @@ typedef struct {
500 708
 } EFI_PCI_CAPABILITY_MSI64;
501 709
 
502 710
 ///
503
-/// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG, defined in CompactPCI Hot Swap Specification PICMG 2.1, R1.0
711
+/// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG,
712
+/// CompactPCI Hot Swap Specification PICMG 2.1, R1.0
504 713
 ///
505 714
 typedef struct {
506 715
   EFI_PCI_CAPABILITY_HDR  Hdr;
@@ -532,25 +741,25 @@ typedef struct {
532 741
 #define EFI_ROOT_BRIDGE_LIST                            'eprb'
533 742
 #define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE       0x0EF1  ///< defined in UEFI Spec.
534 743
 
535
-typedef struct {
536
-  UINT8 Register;
537
-  UINT8 Function;
538
-  UINT8 Device;
539
-  UINT8 Bus;
540
-  UINT8 Reserved[4];
541
-} DEFIO_PCI_ADDR;
542
-
543 744
 #define PCI_EXPANSION_ROM_HEADER_SIGNATURE              0xaa55
544 745
 #define PCI_DATA_STRUCTURE_SIGNATURE                    SIGNATURE_32 ('P', 'C', 'I', 'R')
545 746
 #define PCI_CODE_TYPE_PCAT_IMAGE                        0x00
546
-#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED         0x0001  ///<defined in UEFI spec.
747
+#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED         0x0001  ///< defined in UEFI spec.
547 748
 
749
+///
750
+/// Standard PCI Expansion ROM Header
751
+/// Section 13.4.2, Unified Extensible Firmware Interface Specification, Version 2.1
752
+///
548 753
 typedef struct {
549 754
   UINT16  Signature;    ///< 0xaa55
550 755
   UINT8   Reserved[0x16];
551 756
   UINT16  PcirOffset;
552 757
 } PCI_EXPANSION_ROM_HEADER;
553 758
 
759
+///
760
+/// Legacy ROM Header Extensions
761
+/// Section 6.3.3.1, PCI Local Bus Specification, 2.2
762
+///
554 763
 typedef struct {
555 764
   UINT16  Signature;    ///< 0xaa55
556 765
   UINT8   Size512;
@@ -559,6 +768,10 @@ typedef struct {
559 768
   UINT16  PcirOffset;
560 769
 } EFI_LEGACY_EXPANSION_ROM_HEADER;
561 770
 
771
+///
772
+/// PCI Data Structure Format
773
+/// Section 6.3.1.2, PCI Local Bus Specification, 2.2
774
+///
562 775
 typedef struct {
563 776
   UINT32  Signature;    ///< "PCIR"
564 777
   UINT16  VendorId;
@@ -575,7 +788,8 @@ typedef struct {
575 788
 } PCI_DATA_STRUCTURE;
576 789
 
577 790
 ///
578
-/// defined in EFI/UEFI Spec
791
+/// EFI PCI Expansion ROM Header
792
+/// Section 13.4.2, Unified Extensible Firmware Interface Specification, Version 2.1
579 793
 ///
580 794
 typedef struct {
581 795
   UINT16  Signature;    ///< 0xaa55

+ 249
- 248
src/include/ipxe/efi/IndustryStandard/PeImage.h View File

@@ -7,50 +7,42 @@
7 7
   Common Object File Format Specification, Revision 8.0 - May 16, 2006.
8 8
   This file also includes some definitions in PI Specification, Revision 1.0.
9 9
 
10
-  Copyright (c) 2006 - 2008, Intel Corporation
11
-  All rights reserved. This program and the accompanying materials
12
-  are licensed and made available under the terms and conditions of the BSD License
13
-  which accompanies this distribution.  The full text of the license may be found at
14
-  http://opensource.org/licenses/bsd-license.php
10
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
11
+Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
12
+This program and the accompanying materials
13
+are licensed and made available under the terms and conditions of the BSD License
14
+which accompanies this distribution.  The full text of the license may be found at
15
+http://opensource.org/licenses/bsd-license.php.
15 16
 
16
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 19
 
19 20
 **/
20 21
 
21 22
 #ifndef __PE_IMAGE_H__
22 23
 #define __PE_IMAGE_H__
23 24
 
24
-///
25
-/// PE32+ Subsystem type for EFI images
26
-///
25
+//
26
+// PE32+ Subsystem type for EFI images
27
+//
27 28
 #define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION         10
28 29
 #define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
29 30
 #define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      12
30
-#define EFI_IMAGE_SUBSYSTEM_EFI_EFI_ROM             13
31
-
32 31
 #define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER      13 ///< defined PI Specification, 1.0
33 32
 
34 33
 
35
-///
36
-/// PE32+ Machine type for EFI images
37
-///
38
-#define IMAGE_FILE_MACHINE_I386     0x014c
39
-#define IMAGE_FILE_MACHINE_IA64     0x0200
40
-#define IMAGE_FILE_MACHINE_EBC      0x0EBC
41
-#define IMAGE_FILE_MACHINE_X64      0x8664
42 34
 //
43
-// Support old names for backward compatible
35
+// PE32+ Machine type for EFI images
44 36
 //
45
-#define EFI_IMAGE_MACHINE_IA32      IMAGE_FILE_MACHINE_I386
46
-#define EFI_IMAGE_MACHINE_IA64      IMAGE_FILE_MACHINE_IA64
47
-#define EFI_IMAGE_MACHINE_IPF       IMAGE_FILE_MACHINE_IA64
48
-#define EFI_IMAGE_MACHINE_EBC       IMAGE_FILE_MACHINE_EBC
49
-#define EFI_IMAGE_MACHINE_X64       IMAGE_FILE_MACHINE_X64
37
+#define IMAGE_FILE_MACHINE_I386            0x014c
38
+#define IMAGE_FILE_MACHINE_IA64            0x0200
39
+#define IMAGE_FILE_MACHINE_EBC             0x0EBC
40
+#define IMAGE_FILE_MACHINE_X64             0x8664
41
+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  0x01c2
50 42
 
51
-///
52
-/// EXE file formats
53
-///
43
+//
44
+// EXE file formats
45
+//
54 46
 #define EFI_IMAGE_DOS_SIGNATURE     SIGNATURE_16('M', 'Z')
55 47
 #define EFI_IMAGE_OS2_SIGNATURE     SIGNATURE_16('N', 'E')
56 48
 #define EFI_IMAGE_OS2_SIGNATURE_LE  SIGNATURE_16('L', 'E')
@@ -61,29 +53,29 @@
61 53
 /// under DOS it can print an error message.
62 54
 ///
63 55
 typedef struct {
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
56
+  UINT16  e_magic;    ///< Magic number.
57
+  UINT16  e_cblp;     ///< Bytes on last page of file.
58
+  UINT16  e_cp;       ///< Pages in file.
59
+  UINT16  e_crlc;     ///< Relocations.
60
+  UINT16  e_cparhdr;  ///< Size of header in paragraphs.
61
+  UINT16  e_minalloc; ///< Minimum extra paragraphs needed.
62
+  UINT16  e_maxalloc; ///< Maximum extra paragraphs needed.
63
+  UINT16  e_ss;       ///< Initial (relative) SS value.
64
+  UINT16  e_sp;       ///< Initial SP value.
65
+  UINT16  e_csum;     ///< Checksum.
66
+  UINT16  e_ip;       ///< Initial IP value.
67
+  UINT16  e_cs;       ///< Initial (relative) CS value.
68
+  UINT16  e_lfarlc;   ///< File address of relocation table.
69
+  UINT16  e_ovno;     ///< Overlay number.
70
+  UINT16  e_res[4];   ///< Reserved words.
71
+  UINT16  e_oemid;    ///< OEM identifier (for e_oeminfo).
72
+  UINT16  e_oeminfo;  ///< OEM information; e_oemid specific.
73
+  UINT16  e_res2[10]; ///< Reserved words.
74
+  UINT32  e_lfanew;   ///< File address of new exe header.
83 75
 } EFI_IMAGE_DOS_HEADER;
84 76
 
85 77
 ///
86
-/// COFF File Header (Object and Image)
78
+/// COFF File Header (Object and Image).
87 79
 ///
88 80
 typedef struct {
89 81
   UINT16  Machine;
@@ -96,49 +88,35 @@ typedef struct {
96 88
 } EFI_IMAGE_FILE_HEADER;
97 89
 
98 90
 ///
99
-/// Size of EFI_IMAGE_FILE_HEADER
91
+/// Size of EFI_IMAGE_FILE_HEADER.
100 92
 ///
101 93
 #define EFI_IMAGE_SIZEOF_FILE_HEADER        20
102 94
 
103
-///
104
-/// Characteristics
105
-///
95
+//
96
+// Characteristics
97
+//
106 98
 #define EFI_IMAGE_FILE_RELOCS_STRIPPED      BIT0     ///< 0x0001  Relocation info stripped from file.
107 99
 #define EFI_IMAGE_FILE_EXECUTABLE_IMAGE     BIT1     ///< 0x0002  File is executable  (i.e. no unresolved externel references).
108 100
 #define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED   BIT2     ///< 0x0004  Line nunbers stripped from file.
109 101
 #define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED  BIT3     ///< 0x0008  Local symbols stripped from file.
110 102
 #define EFI_IMAGE_FILE_BYTES_REVERSED_LO    BIT7     ///< 0x0080  Bytes of machine word are reversed.
111 103
 #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
104
+#define EFI_IMAGE_FILE_DEBUG_STRIPPED       BIT9     ///< 0x0200  Debugging info stripped from file in .DBG file.
113 105
 #define EFI_IMAGE_FILE_SYSTEM               BIT12    ///< 0x1000  System File.
114 106
 #define EFI_IMAGE_FILE_DLL                  BIT13    ///< 0x2000  File is a DLL.
115 107
 #define EFI_IMAGE_FILE_BYTES_REVERSED_HI    BIT15    ///< 0x8000  Bytes of machine word are reversed.
116 108
 
117 109
 ///
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
125
-//
126
-// * Other names and brands may be claimed as the property of others.
127
-//
128
-
129
-///
130
-/// Header Data Directories
110
+/// Header Data Directories.
131 111
 ///
132 112
 typedef struct {
133 113
   UINT32  VirtualAddress;
134 114
   UINT32  Size;
135 115
 } EFI_IMAGE_DATA_DIRECTORY;
136 116
 
137
-#define EFI_IMAGE_ROM_OPTIONAL_HDR_MAGIC      0x107
138
-
139
-///
140
-/// Directory Entries
141
-///
117
+//
118
+// Directory Entries
119
+//
142 120
 #define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT      0
143 121
 #define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT      1
144 122
 #define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE    2
@@ -161,6 +139,9 @@ typedef struct {
161 139
 ///
162 140
 #define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
163 141
 
142
+///
143
+/// Optional Header Standard Fields for PE32.
144
+///
164 145
 typedef struct {
165 146
   ///
166 147
   /// Standard fields.
@@ -173,9 +154,9 @@ typedef struct {
173 154
   UINT32                    SizeOfUninitializedData;
174 155
   UINT32                    AddressOfEntryPoint;
175 156
   UINT32                    BaseOfCode;
176
-  UINT32                    BaseOfData;  ///< PE32 contains this additional field, which is absent in PE32+
157
+  UINT32                    BaseOfData;  ///< PE32 contains this additional field, which is absent in PE32+.
177 158
   ///
178
-  /// NT additional fields.
159
+  /// Optional Header Windows-Specific Fields.
179 160
   ///
180 161
   UINT32                    ImageBase;
181 162
   UINT32                    SectionAlignment;
@@ -209,10 +190,13 @@ typedef struct {
209 190
 ///
210 191
 #define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
211 192
 
193
+///
194
+/// Optional Header Standard Fields for PE32+.
195
+///
212 196
 typedef struct {
213
-  //
214
-  // Standard fields.
215
-  //
197
+  ///
198
+  /// Standard fields.
199
+  ///
216 200
   UINT16                    Magic;
217 201
   UINT8                     MajorLinkerVersion;
218 202
   UINT8                     MinorLinkerVersion;
@@ -221,9 +205,9 @@ typedef struct {
221 205
   UINT32                    SizeOfUninitializedData;
222 206
   UINT32                    AddressOfEntryPoint;
223 207
   UINT32                    BaseOfCode;
224
-  //
225
-  // NT additional fields.
226
-  //
208
+  ///
209
+  /// Optional Header Windows-Specific Fields.
210
+  ///
227 211
   UINT64                    ImageBase;
228 212
   UINT32                    SectionAlignment;
229 213
   UINT32                    FileAlignment;
@@ -251,8 +235,7 @@ typedef struct {
251 235
 
252 236
 ///
253 237
 /// @attention
254
-/// EFI_IMAGE_NT_HEADERS32 and EFI_IMAGE_HEADERS64 are for use ONLY
255
-/// by tools.  All proper EFI code MUST use EFI_IMAGE_NT_HEADERS ONLY!!!
238
+/// EFI_IMAGE_NT_HEADERS32 is for use ONLY by tools.
256 239
 ///
257 240
 typedef struct {
258 241
   UINT32                      Signature;
@@ -262,6 +245,10 @@ typedef struct {
262 245
 
263 246
 #define EFI_IMAGE_SIZEOF_NT_OPTIONAL32_HEADER sizeof (EFI_IMAGE_NT_HEADERS32)
264 247
 
248
+///
249
+/// @attention
250
+/// EFI_IMAGE_HEADERS64 is for use ONLY by tools.
251
+///
265 252
 typedef struct {
266 253
   UINT32                      Signature;
267 254
   EFI_IMAGE_FILE_HEADER       FileHeader;
@@ -270,70 +257,9 @@ typedef struct {
270 257
 
271 258
 #define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
272 259
 
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
-///
279
-#if   defined (MDE_CPU_IA32)
280
-
281
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
282
-  (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
283
-
284
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64)
285
-
286
-typedef EFI_IMAGE_NT_HEADERS32    EFI_IMAGE_NT_HEADERS;
287
-
288
-#elif defined (MDE_CPU_IPF)
289
-
290
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
291
-  (((Machine) == EFI_IMAGE_MACHINE_IPF) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
292
-
293
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
294
-
295
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
296
-
297
-#elif defined (MDE_CPU_X64)
298
-
299
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
300
-  (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
301
-
302
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
303
-
304
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
305
-
306
-#elif defined (MDE_CPU_EBC)
307
-
308
-///
309
-/// This is just to make sure you can cross compile with the EBC compiiler.
310
-/// It does not make sense to have a PE loader coded in EBC. You need to
311
-/// understand the basic
312
-///
313
-#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)
314
-
315
-#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
316
-
317
-typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
318
-
319
-#else
320
-#error Unknown Processor Type
321
-#endif
322
-
323
-
324
-#define EFI_IMAGE_FIRST_SECTION(ntheader) \
325
-    ( \
326
-      (EFI_IMAGE_SECTION_HEADER *) \
327
-        ( \
328
-          (UINT32) ntheader + \
329
-          FIELD_OFFSET (EFI_IMAGE_NT_HEADERS, OptionalHeader) + \
330
-          ((EFI_IMAGE_NT_HEADERS *) (ntheader))->FileHeader.SizeOfOptionalHeader \
331
-        ) \
332
-    )
333
-
334
-///
335
-/// Other Windows Subsystem Values
336
-///
260
+//
261
+// Other Windows Subsystem Values
262
+//
337 263
 #define EFI_IMAGE_SUBSYSTEM_UNKNOWN     0
338 264
 #define EFI_IMAGE_SUBSYSTEM_NATIVE      1
339 265
 #define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
@@ -342,10 +268,13 @@ typedef EFI_IMAGE_NT_HEADERS64    EFI_IMAGE_NT_HEADERS;
342 268
 #define EFI_IMAGE_SUBSYSTEM_POSIX_CUI   7
343 269
 
344 270
 ///
345
-/// Section header format.
271
+/// Length of ShortName.
346 272
 ///
347 273
 #define EFI_IMAGE_SIZEOF_SHORT_NAME 8
348 274
 
275
+///
276
+/// Section Table. This table immediately follows the optional header.
277
+///
349 278
 typedef struct {
350 279
   UINT8 Name[EFI_IMAGE_SIZEOF_SHORT_NAME];
351 280
   union {
@@ -363,13 +292,13 @@ typedef struct {
363 292
 } EFI_IMAGE_SECTION_HEADER;
364 293
 
365 294
 ///
366
-/// Size of EFI_IMAGE_SECTION_HEADER
295
+/// Size of EFI_IMAGE_SECTION_HEADER.
367 296
 ///
368 297
 #define EFI_IMAGE_SIZEOF_SECTION_HEADER       40
369 298
 
370
-///
371
-/// Section Flags Values
372
-///
299
+//
300
+// Section Flags Values
301
+//
373 302
 #define EFI_IMAGE_SCN_TYPE_NO_PAD                  BIT3   ///< 0x00000008  ///< Reserved.
374 303
 #define EFI_IMAGE_SCN_CNT_CODE                     BIT5   ///< 0x00000020
375 304
 #define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA         BIT6   ///< 0x00000040
@@ -377,7 +306,7 @@ typedef struct {
377 306
 
378 307
 #define EFI_IMAGE_SCN_LNK_OTHER                    BIT8   ///< 0x00000100  ///< Reserved.
379 308
 #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.
309
+#define EFI_IMAGE_SCN_LNK_REMOVE                   BIT11  ///< 0x00000800  ///< Section contents will not become part of image.
381 310
 #define EFI_IMAGE_SCN_LNK_COMDAT                   BIT12  ///< 0x00001000
382 311
 
383 312
 #define EFI_IMAGE_SCN_ALIGN_1BYTES                 BIT20  ///< 0x00100000
@@ -397,21 +326,21 @@ typedef struct {
397 326
 #define EFI_IMAGE_SCN_MEM_WRITE                    BIT31  ///< 0x80000000
398 327
 
399 328
 ///
400
-/// Size of a Symbol Table Record
329
+/// Size of a Symbol Table Record.
401 330
 ///
402 331
 #define EFI_IMAGE_SIZEOF_SYMBOL 18
403 332
 
404
-///
405
-/// Symbols have a section number of the section in which they are
406
-/// defined. Otherwise, section numbers have the following meanings:
407
-///
333
+//
334
+// Symbols have a section number of the section in which they are
335
+// defined. Otherwise, section numbers have the following meanings:
336
+//
408 337
 #define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0  ///< Symbol is undefined or is common.
409 338
 #define EFI_IMAGE_SYM_ABSOLUTE  (UINT16) -1 ///< Symbol is an absolute value.
410 339
 #define EFI_IMAGE_SYM_DEBUG     (UINT16) -2 ///< Symbol is a special debug item.
411 340
 
412
-///
413
-/// Symbol Type (fundamental) values.
414
-///
341
+//
342
+// Symbol Type (fundamental) values.
343
+//
415 344
 #define EFI_IMAGE_SYM_TYPE_NULL   0   ///< no type.
416 345
 #define EFI_IMAGE_SYM_TYPE_VOID   1   ///< no valid type.
417 346
 #define EFI_IMAGE_SYM_TYPE_CHAR   2   ///< type character.
@@ -429,17 +358,17 @@ typedef struct {
429 358
 #define EFI_IMAGE_SYM_TYPE_UINT   14
430 359
 #define EFI_IMAGE_SYM_TYPE_DWORD  15
431 360
 
432
-///
433
-/// Symbol Type (derived) values.
434
-///
361
+//
362
+// Symbol Type (derived) values.
363
+//
435 364
 #define EFI_IMAGE_SYM_DTYPE_NULL      0 ///< no derived type.
436 365
 #define EFI_IMAGE_SYM_DTYPE_POINTER   1
437 366
 #define EFI_IMAGE_SYM_DTYPE_FUNCTION  2
438 367
 #define EFI_IMAGE_SYM_DTYPE_ARRAY     3
439 368
 
440
-///
441
-/// Storage classes.
442
-///
369
+//
370
+// Storage classes.
371
+//
443 372
 #define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION   ((UINT8) -1)
444 373
 #define EFI_IMAGE_SYM_CLASS_NULL              0
445 374
 #define EFI_IMAGE_SYM_CLASS_AUTOMATIC         1
@@ -477,18 +406,18 @@ typedef struct {
477 406
 #define EFI_IMAGE_N_BTSHFT  4
478 407
 #define EFI_IMAGE_N_TSHIFT  2
479 408
 
480
-///
481
-/// Communal selection types.
482
-///
409
+//
410
+// Communal selection types.
411
+//
483 412
 #define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES    1
484 413
 #define EFI_IMAGE_COMDAT_SELECT_ANY             2
485 414
 #define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE       3
486 415
 #define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH     4
487 416
 #define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE     5
488 417
 
489
-///
490
-/// the following values only be referred in PeCoff, not defined in PECOFF.
491
-///
418
+//
419
+// the following values only be referred in PeCoff, not defined in PECOFF.
420
+//
492 421
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY  1
493 422
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY    2
494 423
 #define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS      3
@@ -507,39 +436,39 @@ typedef struct {
507 436
 ///
508 437
 #define EFI_IMAGE_SIZEOF_RELOCATION 10
509 438
 
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
439
+//
440
+// I386 relocation types.
441
+//
442
+#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000  ///< Reference is absolute, no relocation is necessary.
443
+#define EFI_IMAGE_REL_I386_DIR16    0x0001  ///< Direct 16-bit reference to the symbols virtual address.
444
+#define EFI_IMAGE_REL_I386_REL16    0x0002  ///< PC-relative 16-bit reference to the symbols virtual address.
445
+#define EFI_IMAGE_REL_I386_DIR32    0x0006  ///< Direct 32-bit reference to the symbols virtual address.
446
+#define EFI_IMAGE_REL_I386_DIR32NB  0x0007  ///< Direct 32-bit reference to the symbols virtual address, base not included.
447
+#define EFI_IMAGE_REL_I386_SEG12    0x0009  ///< Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address.
519 448
 #define EFI_IMAGE_REL_I386_SECTION  0x000A
520 449
 #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
522
-
523
-///
524
-/// x64 processor relocation types.
525
-///
526
-#define IMAGE_REL_AMD64_ABSOLUTE	0x0000
527
-#define IMAGE_REL_AMD64_ADDR64	  0x0001
528
-#define IMAGE_REL_AMD64_ADDR32	  0x0002
529
-#define IMAGE_REL_AMD64_ADDR32NB	0x0003
530
-#define IMAGE_REL_AMD64_REL32	    0x0004
531
-#define IMAGE_REL_AMD64_REL32_1	  0x0005
532
-#define IMAGE_REL_AMD64_REL32_2	  0x0006
533
-#define IMAGE_REL_AMD64_REL32_3	  0x0007
534
-#define IMAGE_REL_AMD64_REL32_4	  0x0008
535
-#define IMAGE_REL_AMD64_REL32_5	  0x0009
536
-#define IMAGE_REL_AMD64_SECTION	  0x000A
537
-#define IMAGE_REL_AMD64_SECREL	  0x000B
538
-#define IMAGE_REL_AMD64_SECREL7	  0x000C
539
-#define IMAGE_REL_AMD64_TOKEN	    0x000D
540
-#define IMAGE_REL_AMD64_SREL32	  0x000E
541
-#define IMAGE_REL_AMD64_PAIR	    0x000F
542
-#define IMAGE_REL_AMD64_SSPAN32	  0x0010
450
+#define EFI_IMAGE_REL_I386_REL32    0x0014  ///< PC-relative 32-bit reference to the symbols virtual address.
451
+
452
+//
453
+// x64 processor relocation types.
454
+//
455
+#define IMAGE_REL_AMD64_ABSOLUTE  0x0000
456
+#define IMAGE_REL_AMD64_ADDR64    0x0001
457
+#define IMAGE_REL_AMD64_ADDR32    0x0002
458
+#define IMAGE_REL_AMD64_ADDR32NB  0x0003
459
+#define IMAGE_REL_AMD64_REL32     0x0004
460
+#define IMAGE_REL_AMD64_REL32_1   0x0005
461
+#define IMAGE_REL_AMD64_REL32_2   0x0006
462
+#define IMAGE_REL_AMD64_REL32_3   0x0007
463
+#define IMAGE_REL_AMD64_REL32_4   0x0008
464
+#define IMAGE_REL_AMD64_REL32_5   0x0009
465
+#define IMAGE_REL_AMD64_SECTION   0x000A
466
+#define IMAGE_REL_AMD64_SECREL    0x000B
467
+#define IMAGE_REL_AMD64_SECREL7   0x000C
468
+#define IMAGE_REL_AMD64_TOKEN     0x000D
469
+#define IMAGE_REL_AMD64_SREL32    0x000E
470
+#define IMAGE_REL_AMD64_PAIR      0x000F
471
+#define IMAGE_REL_AMD64_SSPAN32   0x0010
543 472
 
544 473
 ///
545 474
 /// Based relocation format.
@@ -550,42 +479,42 @@ typedef struct {
550 479
 } EFI_IMAGE_BASE_RELOCATION;
551 480
 
552 481
 ///
553
-/// Size of EFI_IMAGE_BASE_RELOCATION
482
+/// Size of EFI_IMAGE_BASE_RELOCATION.
554 483
 ///
555 484
 #define EFI_IMAGE_SIZEOF_BASE_RELOCATION  8
556 485
 
557
-///
558
-/// Based relocation types.
559
-///
560
-#define EFI_IMAGE_REL_BASED_ABSOLUTE      0
561
-#define EFI_IMAGE_REL_BASED_HIGH          1
562
-#define EFI_IMAGE_REL_BASED_LOW           2
563
-#define EFI_IMAGE_REL_BASED_HIGHLOW       3
564
-#define EFI_IMAGE_REL_BASED_HIGHADJ       4
565
-#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR  5
566
-#define EFI_IMAGE_REL_BASED_IA64_IMM64    9
567
-#define IMAGE_REL_BASED_MIPS_JMPADDR16    9
568
-#define EFI_IMAGE_REL_BASED_DIR64         10
486
+//
487
+// Based relocation types.
488
+//
489
+#define EFI_IMAGE_REL_BASED_ABSOLUTE        0
490
+#define EFI_IMAGE_REL_BASED_HIGH            1
491
+#define EFI_IMAGE_REL_BASED_LOW             2
492
+#define EFI_IMAGE_REL_BASED_HIGHLOW         3
493
+#define EFI_IMAGE_REL_BASED_HIGHADJ         4
494
+#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR    5
495
+#define EFI_IMAGE_REL_BASED_IA64_IMM64      9
496
+#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR16  9
497
+#define EFI_IMAGE_REL_BASED_DIR64           10
569 498
 
570 499
 ///
571 500
 /// Line number format.
572 501
 ///
573 502
 typedef struct {
574 503
   union {
575
-    UINT32  SymbolTableIndex; // Symbol table index of function name if Linenumber is 0.
576
-    UINT32  VirtualAddress;   // Virtual address of line number.
504
+    UINT32  SymbolTableIndex; ///< Symbol table index of function name if Linenumber is 0.
505
+    UINT32  VirtualAddress;   ///< Virtual address of line number.
577 506
   } Type;
578
-  UINT16  Linenumber;         // Line number.
507
+  UINT16  Linenumber;         ///< Line number.
579 508
 } EFI_IMAGE_LINENUMBER;
580 509
 
581 510
 ///
582
-/// Size of EFI_IMAGE_LINENUMBER
511
+/// Size of EFI_IMAGE_LINENUMBER.
583 512
 ///
584 513
 #define EFI_IMAGE_SIZEOF_LINENUMBER 6
585 514
 
586
-///
587
-/// Archive format.
588
-///
515
+//
516
+// Archive format.
517
+//
589 518
 #define EFI_IMAGE_ARCHIVE_START_SIZE        8
590 519
 #define EFI_IMAGE_ARCHIVE_START             "!<arch>\n"
591 520
 #define EFI_IMAGE_ARCHIVE_END               "`\n"
@@ -593,6 +522,9 @@ typedef struct {
593 522
 #define EFI_IMAGE_ARCHIVE_LINKER_MEMBER     "/               "
594 523
 #define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER  "//              "
595 524
 
525
+///
526
+/// Archive Member Headers
527
+///
596 528
 typedef struct {
597 529
   UINT8 Name[16];     ///< File member name - `/' terminated.
598 530
   UINT8 Date[12];     ///< File member date - decimal.
@@ -600,21 +532,21 @@ typedef struct {
600 532
   UINT8 GroupID[6];   ///< File member group id - decimal.
601 533
   UINT8 Mode[8];      ///< File member mode - octal.
602 534
   UINT8 Size[10];     ///< File member size - decimal.
603
-  UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A)
535
+  UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A).
604 536
 } EFI_IMAGE_ARCHIVE_MEMBER_HEADER;
605 537
 
606 538
 ///
607
-/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER
539
+/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER.
608 540
 ///
609 541
 #define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
610 542
 
611 543
 
612
-///
613
-/// DLL Support
614
-///
544
+//
545
+// DLL Support
546
+//
615 547
 
616 548
 ///
617
-/// Export Directory Table
549
+/// Export Directory Table.
618 550
 ///
619 551
 typedef struct {
620 552
   UINT32  Characteristics;
@@ -631,13 +563,16 @@ typedef struct {
631 563
 } EFI_IMAGE_EXPORT_DIRECTORY;
632 564
 
633 565
 ///
634
-/// Hint/Name Table
566
+/// Hint/Name Table.
635 567
 ///
636 568
 typedef struct {
637 569
   UINT16  Hint;
638 570
   UINT8   Name[1];
639 571
 } EFI_IMAGE_IMPORT_BY_NAME;
640 572
 
573
+///
574
+/// Import Address Table RVA (Thunk Table).
575
+///
641 576
 typedef struct {
642 577
   union {
643 578
     UINT32                    Function;
@@ -646,7 +581,7 @@ typedef struct {
646 581
   } u1;
647 582
 } EFI_IMAGE_THUNK_DATA;
648 583
 
649
-#define EFI_IMAGE_ORDINAL_FLAG              BIT31    ///< Flag for PE32
584
+#define EFI_IMAGE_ORDINAL_FLAG              BIT31    ///< Flag for PE32.
650 585
 #define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal)  ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
651 586
 #define EFI_IMAGE_ORDINAL(Ordinal)          (Ordinal & 0xffff)
652 587
 
@@ -663,7 +598,7 @@ typedef struct {
663 598
 
664 599
 
665 600
 ///
666
-/// Debug Direcotry Format
601
+/// Debug Directory Format.
667 602
 ///
668 603
 typedef struct {
669 604
   UINT32  Characteristics;
@@ -672,14 +607,14 @@ typedef struct {
672 607
   UINT16  MinorVersion;
673 608
   UINT32  Type;
674 609
   UINT32  SizeOfData;
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
610
+  UINT32  RVA;           ///< The address of the debug data when loaded, relative to the image base.
611
+  UINT32  FileOffset;    ///< The file pointer to the debug data.
677 612
 } EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
678 613
 
679
-#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2     ///< The Visual C++ debug information
614
+#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2     ///< The Visual C++ debug information.
680 615
 
681 616
 ///
682
-/// Debug Data Structure defined in Microsoft C++
617
+/// Debug Data Structure defined in Microsoft C++.
683 618
 ///
684 619
 #define CODEVIEW_SIGNATURE_NB10  SIGNATURE_32('N', 'B', '1', '0')
685 620
 typedef struct {
@@ -693,11 +628,11 @@ typedef struct {
693 628
 } EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;
694 629
 
695 630
 ///
696
-/// Debug Data Structure defined in Microsoft C++
631
+/// Debug Data Structure defined in Microsoft C++.
697 632
 ///
698 633
 #define CODEVIEW_SIGNATURE_RSDS  SIGNATURE_32('R', 'S', 'D', 'S')
699 634
 typedef struct {
700
-  UINT32  Signature;                        ///< "RSDS"
635
+  UINT32  Signature;                        ///< "RSDS".
701 636
   UINT32  Unknown;
702 637
   UINT32  Unknown2;
703 638
   UINT32  Unknown3;
@@ -708,19 +643,85 @@ typedef struct {
708 643
   //
709 644
 } EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
710 645
 
646
+
647
+///
648
+/// Debug Data Structure defined by Apple Mach-O to Coff utility.
649
+///
650
+#define CODEVIEW_SIGNATURE_MTOC  SIGNATURE_32('M', 'T', 'O', 'C')
651
+typedef struct {
652
+  UINT32    Signature;                       ///< "MTOC".
653
+  GUID      MachOUuid;
654
+  //
655
+  //  Filename of .DLL (Mach-O with debug info) goes here
656
+  //
657
+} EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY;
658
+
659
+///
660
+/// Resource format.
661
+///
662
+typedef struct {
663
+  UINT32  Characteristics;
664
+  UINT32  TimeDateStamp;
665
+  UINT16  MajorVersion;
666
+  UINT16  MinorVersion;
667
+  UINT16  NumberOfNamedEntries;
668
+  UINT16  NumberOfIdEntries;
669
+  //
670
+  // Array of EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY entries goes here.
671
+  //
672
+} EFI_IMAGE_RESOURCE_DIRECTORY;
673
+
674
+///
675
+/// Resource directory entry format.
676
+///
677
+typedef struct {
678
+  union {
679
+    struct {
680
+      UINT32  NameOffset:31;
681
+      UINT32  NameIsString:1;
682
+    } s;
683
+    UINT32  Id;
684
+  } u1;
685
+  union {
686
+    UINT32  OffsetToData;
687
+    struct {
688
+      UINT32  OffsetToDirectory:31;
689
+      UINT32  DataIsDirectory:1;
690
+    } s;
691
+  } u2;
692
+} EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY;
693
+
694
+///
695
+/// Resource directory entry for string.
696
+///
697
+typedef struct {
698
+  UINT16  Length;
699
+  CHAR16  String[1];
700
+} EFI_IMAGE_RESOURCE_DIRECTORY_STRING;
701
+
702
+///
703
+/// Resource directory entry for data array.
704
+///
705
+typedef struct {
706
+  UINT32  OffsetToData;
707
+  UINT32  Size;
708
+  UINT32  CodePage;
709
+  UINT32  Reserved;
710
+} EFI_IMAGE_RESOURCE_DATA_ENTRY;
711
+
711 712
 ///
712
-/// Header format for TE images, defined in PI Specification, 1.0
713
+/// Header format for TE images, defined in the PI Specification, 1.0.
713 714
 ///
714 715
 typedef struct {
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
716
+  UINT16                    Signature;            ///< The signature for TE format = "VZ".
717
+  UINT16                    Machine;              ///< From the original file header.
718
+  UINT8                     NumberOfSections;     ///< From the original file header.
719
+  UINT8                     Subsystem;            ///< From original optional header.
720
+  UINT16                    StrippedSize;         ///< Number of bytes we removed from the header.
721
+  UINT32                    AddressOfEntryPoint;  ///< Offset to entry point -- from original optional header.
722
+  UINT32                    BaseOfCode;           ///< From original image -- required for ITP debug.
723
+  UINT64                    ImageBase;            ///< From original file header.
724
+  EFI_IMAGE_DATA_DIRECTORY  DataDirectory[2];     ///< Only base relocation and debug directory.
724 725
 } EFI_TE_IMAGE_HEADER;
725 726
 
726 727
 
@@ -734,7 +735,7 @@ typedef struct {
734 735
 
735 736
 
736 737
 ///
737
-/// Union of PE32, PE32+, and TE headers
738
+/// Union of PE32, PE32+, and TE headers.
738 739
 ///
739 740
 typedef union {
740 741
   EFI_IMAGE_NT_HEADERS32   Pe32;

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

@@ -1,8 +1,8 @@
1 1
 /** @file
2 2
   Present the boot mode values in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
4
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5
+  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
8 8
   http://opensource.org/licenses/bsd-license.php
@@ -18,8 +18,6 @@
18 18
 #ifndef __PI_BOOT_MODE_H__
19 19
 #define __PI_BOOT_MODE_H__
20 20
 
21
-#include <ipxe/efi/ProcessorBind.h>
22
-
23 21
 ///
24 22
 /// EFI boot mode
25 23
 ///

+ 2
- 2
src/include/ipxe/efi/Pi/PiDependency.h View File

@@ -1,8 +1,8 @@
1 1
 /** @file
2 2
   Present the dependency expression values in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
4
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5
+  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
8 8
   http://opensource.org/licenses/bsd-license.php

+ 86
- 15
src/include/ipxe/efi/Pi/PiDxeCis.h View File

@@ -1,14 +1,14 @@
1 1
 /** @file
2 2
   Include file matches things in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14 14
   PI Version 1.0
@@ -18,25 +18,57 @@
18 18
 #ifndef __PI_DXECIS_H__
19 19
 #define __PI_DXECIS_H__
20 20
 
21
+#include <ipxe/efi/Uefi/UefiMultiPhase.h>
21 22
 #include <ipxe/efi/Pi/PiMultiPhase.h>
22 23
 
23 24
 ///
24
-/// Global Coherencey Domain types - Memory type
25
+/// Global Coherencey Domain types - Memory type.
25 26
 ///
26 27
 typedef enum {
28
+  ///
29
+  /// A memory region that is visible to the boot processor. However, there are no system
30
+  /// components that are currently decoding this memory region.
31
+  ///
27 32
   EfiGcdMemoryTypeNonExistent,
33
+  ///
34
+  /// A memory region that is visible to the boot processor. This memory region is being
35
+  /// decoded by a system component, but the memory region is not considered to be either
36
+  /// system memory or memory-mapped I/O.
37
+  ///
28 38
   EfiGcdMemoryTypeReserved,
39
+  ///
40
+  /// A memory region that is visible to the boot processor. A memory controller is
41
+  /// currently decoding this memory region and the memory controller is producing a
42
+  /// tested system memory region that is available to the memory services.
43
+  ///
29 44
   EfiGcdMemoryTypeSystemMemory,
45
+  ///
46
+  /// A memory region that is visible to the boot processor. This memory region is
47
+  /// currently being decoded by a component as memory-mapped I/O that can be used to
48
+  /// access I/O devices in the platform.
49
+  ///
30 50
   EfiGcdMemoryTypeMemoryMappedIo,
31 51
   EfiGcdMemoryTypeMaximum
32 52
 } EFI_GCD_MEMORY_TYPE;
33 53
 
34 54
 ///
35
-/// Global Coherencey Domain types - IO type
55
+/// Global Coherencey Domain types - IO type.
36 56
 ///
37 57
 typedef enum {
58
+  ///
59
+  /// An I/O region that is visible to the boot processor. However, there are no system
60
+  /// components that are currently decoding this I/O region.
61
+  ///
38 62
   EfiGcdIoTypeNonExistent,
63
+  ///
64
+  /// An I/O region that is visible to the boot processor. This I/O region is currently being
65
+  /// decoded by a system component, but the I/O region cannot be used to access I/O devices.
66
+  ///
39 67
   EfiGcdIoTypeReserved,
68
+  ///
69
+  /// An I/O region that is visible to the boot processor. This I/O region is currently being
70
+  /// decoded by a system component that is producing I/O ports that can be used to access I/O devices.
71
+  ///
40 72
   EfiGcdIoTypeIo,
41 73
   EfiGcdIoTypeMaximum
42 74
 } EFI_GCD_IO_TYPE;
@@ -45,22 +77,42 @@ typedef enum {
45 77
 /// The type of allocation to perform.
46 78
 ///
47 79
 typedef enum {
80
+  ///
81
+  /// The GCD memory space map is searched from the lowest address up to the highest address
82
+  /// looking for unallocated memory ranges.
83
+  ///
48 84
   EfiGcdAllocateAnySearchBottomUp,
85
+  ///
86
+  /// The GCD memory space map is searched from the lowest address up
87
+  /// to the specified MaxAddress looking for unallocated memory ranges.
88
+  ///
49 89
   EfiGcdAllocateMaxAddressSearchBottomUp,
90
+  ///
91
+  /// The GCD memory space map is checked to see if the memory range starting
92
+  /// at the specified Address is available.
93
+  ///
50 94
   EfiGcdAllocateAddress,
95
+  ///
96
+  /// The GCD memory space map is searched from the highest address down to the lowest address
97
+  /// looking for unallocated memory ranges.
98
+  ///
51 99
   EfiGcdAllocateAnySearchTopDown,
100
+  ///
101
+  /// The GCD memory space map is searched from the specified MaxAddress
102
+  /// down to the lowest address looking for unallocated memory ranges.
103
+  ///
52 104
   EfiGcdAllocateMaxAddressSearchTopDown,
53 105
   EfiGcdMaxAllocateType
54 106
 } EFI_GCD_ALLOCATE_TYPE;
55 107
 
56 108
 ///
57
-/// EFI_GCD_MEMORY_SPACE_DESCRIPTOR
109
+/// EFI_GCD_MEMORY_SPACE_DESCRIPTOR.
58 110
 ///
59 111
 typedef struct {
60 112
   ///
61 113
   /// The physical address of the first byte in the memory region. Type
62 114
   /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
63
-  /// description in the UEFI 2.0 specification
115
+  /// description in the UEFI 2.0 specification.
64 116
   ///
65 117
   EFI_PHYSICAL_ADDRESS  BaseAddress;
66 118
 
@@ -82,7 +134,7 @@ typedef struct {
82 134
   UINT64                Attributes;
83 135
   ///
84 136
   /// Type of the memory region. Type EFI_GCD_MEMORY_TYPE is defined in the
85
-  /// AddMemorySpace() function description
137
+  /// AddMemorySpace() function description.
86 138
   ///
87 139
   EFI_GCD_MEMORY_TYPE   GcdMemoryType;
88 140
 
@@ -105,7 +157,7 @@ typedef struct {
105 157
 } EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
106 158
 
107 159
 ///
108
-/// EFI_GCD_IO_SPACE_DESCRIPTOR
160
+/// EFI_GCD_IO_SPACE_DESCRIPTOR.
109 161
 ///
110 162
 typedef struct {
111 163
   ///
@@ -173,7 +225,7 @@ typedef struct {
173 225
                                  added to the global coherency domain of the processor.
174 226
   @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
175 227
                                  specified by BaseAddress and Length was allocated
176
-                                 in a prior call to AllocateMemorySpace()..
228
+                                 in a prior call to AllocateMemorySpace().
177 229
 
178 230
 **/
179 231
 typedef
@@ -528,7 +580,7 @@ EFI_STATUS
528 580
   @retval EFI_SUCCESS         One or more DXE driver were dispatched.
529 581
   @retval EFI_NOT_FOUND       No DXE drivers were dispatched.
530 582
   @retval EFI_ALREADY_STARTED An attempt is being made to start the DXE Dispatcher recursively.
531
-                              Thus no action was taken.
583
+                              Thus, no action was taken.
532 584
 
533 585
 **/
534 586
 typedef
@@ -606,6 +658,10 @@ EFI_STATUS
606 658
 #define DXE_SERVICES_REVISION   ((1<<16) | (00))
607 659
 
608 660
 typedef struct {
661
+  ///
662
+  /// The table header for the DXE Services Table.
663
+  /// This header contains the DXE_SERVICES_SIGNATURE and DXE_SERVICES_REVISION values.
664
+  ///
609 665
   EFI_TABLE_HEADER                Hdr;
610 666
 
611 667
   //
@@ -639,4 +695,19 @@ typedef struct {
639 695
 
640 696
 typedef DXE_SERVICES EFI_DXE_SERVICES;
641 697
 
698
+
699
+/**
700
+  The function prototype for invoking a function on an Application Processor.
701
+
702
+  This definition is used by the UEFI MP Serices Protocol, and the
703
+  PI SMM System Table.
704
+
705
+  @param[in,out] Buffer  The pointer to private data buffer.
706
+**/
707
+typedef
708
+VOID
709
+(EFIAPI *EFI_AP_PROCEDURE)(
710
+  IN OUT VOID  *Buffer
711
+  );
712
+
642 713
 #endif

+ 272
- 34
src/include/ipxe/efi/Pi/PiFirmwareFile.h View File

@@ -1,17 +1,17 @@
1 1
 /** @file
2 2
   The firmware file related definitions in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  PI Version 1.0
14
+  PI Version 1.2.
15 15
 
16 16
 **/
17 17
 
@@ -19,20 +19,42 @@
19 19
 #ifndef __PI_FIRMWARE_FILE_H__
20 20
 #define __PI_FIRMWARE_FILE_H__
21 21
 
22
-#include <ipxe/efi/ProcessorBind.h>
23
-
24 22
 #pragma pack(1)
25 23
 ///
26 24
 /// Used to verify the integrity of the file.
27 25
 ///
28 26
 typedef union {
29 27
   struct {
28
+    ///
29
+    /// The IntegrityCheck.Checksum.Header field is an 8-bit checksum of the file
30
+    /// header. The State and IntegrityCheck.Checksum.File fields are assumed
31
+    /// to be zero and the checksum is calculated such that the entire header sums to zero.
32
+    ///
30 33
     UINT8   Header;
34
+    ///
35
+    /// If the FFS_ATTRIB_CHECKSUM (see definition below) bit of the Attributes
36
+    /// field is set to one, the IntegrityCheck.Checksum.File field is an 8-bit
37
+    /// checksum of the entire file The State field and the file tail are assumed to be zero
38
+    /// and the checksum is calculated such that the entire file sums to zero.
39
+    /// If the FFS_ATTRIB_CHECKSUM bit of the Attributes field is cleared to zero,
40
+    /// the IntegrityCheck.Checksum.File field must be initialized with a value of
41
+    /// 0xAA. The IntegrityCheck.Checksum.File field is valid any time the
42
+    /// EFI_FILE_DATA_VALID bit is set in the State field.
43
+    ///
31 44
     UINT8   File;
32 45
   } Checksum;
46
+  ///
47
+  /// This is the full 16 bits of the IntegrityCheck field.
48
+  ///
33 49
   UINT16    Checksum16;
34 50
 } EFI_FFS_INTEGRITY_CHECK;
35 51
 
52
+///
53
+/// FFS_FIXED_CHECKSUM is the checksum value used when the
54
+/// FFS_ATTRIB_CHECKSUM attribute bit is clear.
55
+///
56
+#define FFS_FIXED_CHECKSUM  0xAA
57
+
36 58
 typedef UINT8 EFI_FV_FILETYPE;
37 59
 typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
38 60
 typedef UINT8 EFI_FFS_FILE_STATE;
@@ -50,7 +72,10 @@ typedef UINT8 EFI_FFS_FILE_STATE;
50 72
 #define EFI_FV_FILETYPE_DRIVER                0x07
51 73
 #define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER  0x08
52 74
 #define EFI_FV_FILETYPE_APPLICATION           0x09
75
+#define EFI_FV_FILETYPE_SMM                   0x0A
53 76
 #define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
77
+#define EFI_FV_FILETYPE_COMBINED_SMM_DXE      0x0C
78
+#define EFI_FV_FILETYPE_SMM_CORE              0x0D
54 79
 #define EFI_FV_FILETYPE_OEM_MIN               0xc0
55 80
 #define EFI_FV_FILETYPE_OEM_MAX               0xdf
56 81
 #define EFI_FV_FILETYPE_DEBUG_MIN             0xe0
@@ -61,6 +86,7 @@ typedef UINT8 EFI_FFS_FILE_STATE;
61 86
 ///
62 87
 /// FFS File Attributes.
63 88
 ///
89
+#define FFS_ATTRIB_LARGE_FILE         0x01
64 90
 #define FFS_ATTRIB_FIXED              0x04
65 91
 #define FFS_ATTRIB_DATA_ALIGNMENT     0x38
66 92
 #define FFS_ATTRIB_CHECKSUM           0x40
@@ -81,33 +107,95 @@ typedef UINT8 EFI_FFS_FILE_STATE;
81 107
 /// contents and state of the files.
82 108
 ///
83 109
 typedef struct {
110
+  ///
111
+  /// This GUID is the file name. It is used to uniquely identify the file.
112
+  ///
84 113
   EFI_GUID                Name;
114
+  ///
115
+  /// Used to verify the integrity of the file.
116
+  ///
85 117
   EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
118
+  ///
119
+  /// Identifies the type of file.
120
+  ///
86 121
   EFI_FV_FILETYPE         Type;
122
+  ///
123
+  /// Declares various file attribute bits.
124
+  ///
87 125
   EFI_FFS_FILE_ATTRIBUTES Attributes;
126
+  ///
127
+  /// The length of the file in bytes, including the FFS header.
128
+  ///
88 129
   UINT8                   Size[3];
130
+  ///
131
+  /// Used to track the state of the file throughout the life of the file from creation to deletion.
132
+  ///
89 133
   EFI_FFS_FILE_STATE      State;
90 134
 } EFI_FFS_FILE_HEADER;
91 135
 
136
+typedef struct {
137
+  ///
138
+  /// This GUID is the file name. It is used to uniquely identify the file. There may be only
139
+  /// one instance of a file with the file name GUID of Name in any given firmware
140
+  /// volume, except if the file type is EFI_FV_FILETYPE_FFS_PAD.
141
+  ///
142
+  EFI_GUID                  Name;
143
+
144
+  ///
145
+  /// Used to verify the integrity of the file.
146
+  ///
147
+  EFI_FFS_INTEGRITY_CHECK   IntegrityCheck;
148
+
149
+  ///
150
+  /// Identifies the type of file.
151
+  ///
152
+  EFI_FV_FILETYPE           Type;
153
+
154
+  ///
155
+  /// Declares various file attribute bits.
156
+  ///
157
+  EFI_FFS_FILE_ATTRIBUTES   Attributes;
158
+
159
+  ///
160
+  /// The length of the file in bytes, including the FFS header.
161
+  /// The length of the file data is either (Size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a
162
+  /// zero-length file has a Size of 24 bytes, which is sizeof(EFI_FFS_FILE_HEADER).
163
+  /// Size is not required to be a multiple of 8 bytes. Given a file F, the next file header is
164
+  /// located at the next 8-byte aligned firmware volume offset following the last byte of the file F.
165
+  ///
166
+  UINT8                     Size[3];
167
+
168
+  ///
169
+  /// Used to track the state of the file throughout the life of the file from creation to deletion.
170
+  ///
171
+  EFI_FFS_FILE_STATE        State;
172
+
173
+  ///
174
+  /// If FFS_ATTRIB_LARGE_FILE is set in Attributes, then ExtendedSize exists and Size must be set to zero.
175
+  /// If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used.
176
+  ///
177
+  EFI_FFS_FILE_STATE        ExtendedSize;
178
+} EFI_FFS_FILE_HEADER2;
92 179
 
93 180
 typedef UINT8 EFI_SECTION_TYPE;
94 181
 
95 182
 ///
96
-/// Pseudo type. It is
97
-/// used as a wild card when retrieving sections. The section
98
-/// type EFI_SECTION_ALL matches all section types.
183
+/// Pseudo type. It is used as a wild card when retrieving sections.
184
+///  The section type EFI_SECTION_ALL matches all section types.
99 185
 ///
100 186
 #define EFI_SECTION_ALL                   0x00
101 187
 
102 188
 ///
103
-/// Encapsulation section Type values
189
+/// Encapsulation section Type values.
104 190
 ///
105 191
 #define EFI_SECTION_COMPRESSION           0x01
106 192
 
107 193
 #define EFI_SECTION_GUID_DEFINED          0x02
108 194
 
195
+#define EFI_SECTION_DISPOSABLE            0x03
196
+
109 197
 ///
110
-/// Leaf section Type values
198
+/// Leaf section Type values.
111 199
 ///
112 200
 #define EFI_SECTION_PE32                  0x10
113 201
 #define EFI_SECTION_PIC                   0x11
@@ -120,20 +208,45 @@ typedef UINT8 EFI_SECTION_TYPE;
120 208
 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
121 209
 #define EFI_SECTION_RAW                   0x19
122 210
 #define EFI_SECTION_PEI_DEPEX             0x1B
211
+#define EFI_SECTION_SMM_DEPEX             0x1C
123 212
 
124 213
 ///
125
-/// Common section header
214
+/// Common section header.
126 215
 ///
127 216
 typedef struct {
217
+  ///
218
+  /// A 24-bit unsigned integer that contains the total size of the section in bytes,
219
+  /// including the EFI_COMMON_SECTION_HEADER.
220
+  ///
128 221
   UINT8             Size[3];
129 222
   EFI_SECTION_TYPE  Type;
223
+  ///
224
+  /// Declares the section type.
225
+  ///
130 226
 } EFI_COMMON_SECTION_HEADER;
131 227
 
228
+typedef struct {
229
+  ///
230
+  /// A 24-bit unsigned integer that contains the total size of the section in bytes,
231
+  /// including the EFI_COMMON_SECTION_HEADER.
232
+  ///
233
+  UINT8             Size[3];
234
+
235
+  EFI_SECTION_TYPE  Type;
236
+
237
+  ///
238
+  /// If Size is 0xFFFFFF, then ExtendedSize contains the size of the section. If
239
+  /// Size is not equal to 0xFFFFFF, then this field does not exist.
240
+  ///
241
+  UINT32            ExtendedSize;
242
+} EFI_COMMON_SECTION_HEADER2;
243
+
132 244
 ///
133 245
 /// Leaf section type that contains an
134 246
 /// IA-32 16-bit executable image.
135 247
 ///
136
-typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
248
+typedef EFI_COMMON_SECTION_HEADER  EFI_COMPATIBILITY16_SECTION;
249
+typedef EFI_COMMON_SECTION_HEADER2 EFI_COMPATIBILITY16_SECTION2;
137 250
 
138 251
 ///
139 252
 /// CompressionType of EFI_COMPRESSION_SECTION.
@@ -145,67 +258,179 @@ typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
145 258
 /// section data is compressed.
146 259
 ///
147 260
 typedef struct {
261
+  ///
262
+  /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.
263
+  ///
148 264
   EFI_COMMON_SECTION_HEADER   CommonHeader;
265
+  ///
266
+  /// The UINT32 that indicates the size of the section data after decompression.
267
+  ///
149 268
   UINT32                      UncompressedLength;
269
+  ///
270
+  /// Indicates which compression algorithm is used.
271
+  ///
150 272
   UINT8                       CompressionType;
151 273
 } EFI_COMPRESSION_SECTION;
152 274
 
275
+typedef struct {
276
+  ///
277
+  /// Usual common section header. CommonHeader.Type = EFI_SECTION_COMPRESSION.
278
+  ///
279
+  EFI_COMMON_SECTION_HEADER2    CommonHeader;
280
+  ///
281
+  /// UINT32 that indicates the size of the section data after decompression.
282
+  ///
283
+  UINT32                        UncompressedLength;
284
+  ///
285
+  /// Indicates which compression algorithm is used.
286
+  ///
287
+  UINT8                         CompressionType;
288
+} EFI_COMPRESSION_SECTION2;
289
+
153 290
 ///
154
-/// Leaf section which could be used to determine the dispatch order of DXEs.
291
+/// An encapsulation section type in which the section data is disposable.
292
+/// A disposable section is an encapsulation section in which the section data may be disposed of during
293
+/// the process of creating or updating a firmware image without significant impact on the usefulness of
294
+/// the file. The Type field in the section header is set to EFI_SECTION_DISPOSABLE. This
295
+/// allows optional or descriptive data to be included with the firmware file which can be removed in
296
+/// order to conserve space. The contents of this section are implementation specific, but might contain
297
+/// debug data or detailed integration instructions.
155 298
 ///
156
-typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
299
+typedef EFI_COMMON_SECTION_HEADER   EFI_DISPOSABLE_SECTION;
300
+typedef EFI_COMMON_SECTION_HEADER2  EFI_DISPOSABLE_SECTION2;
157 301
 
158 302
 ///
159
-/// Leaf section which contains a PI FV.
303
+/// The leaf section which could be used to determine the dispatch order of DXEs.
160 304
 ///
161
-typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
305
+typedef EFI_COMMON_SECTION_HEADER   EFI_DXE_DEPEX_SECTION;
306
+typedef EFI_COMMON_SECTION_HEADER2  EFI_DXE_DEPEX_SECTION2;
162 307
 
163 308
 ///
164
-/// Leaf section which contains a single GUID.
309
+/// The leaf section which contains a PI FV.
310
+///
311
+typedef EFI_COMMON_SECTION_HEADER   EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
312
+typedef EFI_COMMON_SECTION_HEADER2  EFI_FIRMWARE_VOLUME_IMAGE_SECTION2;
313
+
314
+///
315
+/// The leaf section which contains a single GUID.
165 316
 ///
166 317
 typedef struct {
318
+  ///
319
+  /// Common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.
320
+  ///
167 321
   EFI_COMMON_SECTION_HEADER   CommonHeader;
322
+  ///
323
+  /// This GUID is defined by the creator of the file. It is a vendor-defined file type.
324
+  ///
168 325
   EFI_GUID                    SubTypeGuid;
169 326
 } EFI_FREEFORM_SUBTYPE_GUID_SECTION;
170 327
 
328
+typedef struct {
329
+  ///
330
+  /// The common section header. CommonHeader.Type = EFI_SECTION_FREEFORM_SUBTYPE_GUID.
331
+  ///
332
+  EFI_COMMON_SECTION_HEADER2    CommonHeader;
333
+  ///
334
+  /// This GUID is defined by the creator of the file. It is a vendor-defined file type.
335
+  ///
336
+  EFI_GUID                      SubTypeGuid;
337
+} EFI_FREEFORM_SUBTYPE_GUID_SECTION2;
338
+
171 339
 ///
172
-/// Attributes of EFI_GUID_DEFINED_SECTION
340
+/// Attributes of EFI_GUID_DEFINED_SECTION.
173 341
 ///
174 342
 #define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01
175 343
 #define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02
176 344
 ///
177
-/// Leaf section which is encapsulation defined by specific GUID
345
+/// The leaf section which is encapsulation defined by specific GUID.
178 346
 ///
179 347
 typedef struct {
348
+  ///
349
+  /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.
350
+  ///
180 351
   EFI_COMMON_SECTION_HEADER   CommonHeader;
352
+  ///
353
+  /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.
354
+  ///
181 355
   EFI_GUID                    SectionDefinitionGuid;
356
+  ///
357
+  /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.
358
+  ///
182 359
   UINT16                      DataOffset;
360
+  ///
361
+  /// The bit field that declares some specific characteristics of the section contents.
362
+  ///
183 363
   UINT16                      Attributes;
184 364
 } EFI_GUID_DEFINED_SECTION;
185 365
 
366
+typedef struct {
367
+  ///
368
+  /// The common section header. CommonHeader.Type = EFI_SECTION_GUID_DEFINED.
369
+  ///
370
+  EFI_COMMON_SECTION_HEADER2    CommonHeader;
371
+  ///
372
+  /// The GUID that defines the format of the data that follows. It is a vendor-defined section type.
373
+  ///
374
+  EFI_GUID                      SectionDefinitionGuid;
375
+  ///
376
+  /// Contains the offset in bytes from the beginning of the common header to the first byte of the data.
377
+  ///
378
+  UINT16                        DataOffset;
379
+  ///
380
+  /// The bit field that declares some specific characteristics of the section contents.
381
+  ///
382
+  UINT16                        Attributes;
383
+} EFI_GUID_DEFINED_SECTION2;
384
+
186 385
 ///
187
-/// Leaf section which contains PE32+ image.
386
+/// The leaf section which contains PE32+ image.
188 387
 ///
189
-typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
388
+typedef EFI_COMMON_SECTION_HEADER   EFI_PE32_SECTION;
389
+typedef EFI_COMMON_SECTION_HEADER2  EFI_PE32_SECTION2;
190 390
 
391
+///
392
+/// The leaf section used to determine the dispatch order of PEIMs.
393
+///
394
+typedef EFI_COMMON_SECTION_HEADER   EFI_PEI_DEPEX_SECTION;
395
+typedef EFI_COMMON_SECTION_HEADER2  EFI_PEI_DEPEX_SECTION2;
191 396
 
192 397
 ///
193
-/// Leaf section which used to determine the dispatch order of PEIMs.
398
+/// A leaf section type that contains a position-independent-code (PIC) image.
399
+/// A PIC image section is a leaf section that contains a position-independent-code (PIC) image.
400
+/// In addition to normal PE32+ images that contain relocation information, PEIM executables may be
401
+/// PIC and are referred to as PIC images. A PIC image is the same as a PE32+ image except that all
402
+/// relocation information has been stripped from the image and the image can be moved and will
403
+/// execute correctly without performing any relocation or other fix-ups. EFI_PIC_SECTION2 must
404
+/// be used if the section is 16MB or larger.
194 405
 ///
195
-typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
406
+typedef EFI_COMMON_SECTION_HEADER   EFI_PIC_SECTION;
407
+typedef EFI_COMMON_SECTION_HEADER2  EFI_PIC_SECTION2;
196 408
 
197 409
 ///
198
-/// Leaf section which constains the position-independent-code image.
410
+/// The leaf section which constains the position-independent-code image.
199 411
 ///
200
-typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
412
+typedef EFI_COMMON_SECTION_HEADER   EFI_TE_SECTION;
413
+typedef EFI_COMMON_SECTION_HEADER2  EFI_TE_SECTION2;
201 414
 
202 415
 ///
203
-/// Leaf section which contains an array of zero or more bytes.
416
+/// The leaf section which contains an array of zero or more bytes.
204 417
 ///
205
-typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
418
+typedef EFI_COMMON_SECTION_HEADER   EFI_RAW_SECTION;
419
+typedef EFI_COMMON_SECTION_HEADER2  EFI_RAW_SECTION2;
206 420
 
207 421
 ///
208
-/// Leaf section which contains a unicode string that
422
+/// The SMM dependency expression section is a leaf section that contains a dependency expression that
423
+/// is used to determine the dispatch order for SMM drivers. Before the SMRAM invocation of the
424
+/// SMM driver's entry point, this dependency expression must evaluate to TRUE. See the Platform
425
+/// Initialization Specification, Volume 2, for details regarding the format of the dependency expression.
426
+/// The dependency expression may refer to protocols installed in either the UEFI or the SMM protocol
427
+/// database. EFI_SMM_DEPEX_SECTION2 must be used if the section is 16MB or larger.
428
+///
429
+typedef EFI_COMMON_SECTION_HEADER EFI_SMM_DEPEX_SECTION;
430
+typedef EFI_COMMON_SECTION_HEADER2 EFI_SMM_DEPEX_SECTION2;
431
+
432
+///
433
+/// The leaf section which contains a unicode string that
209 434
 /// is human readable file name.
210 435
 ///
211 436
 typedef struct {
@@ -217,9 +442,13 @@ typedef struct {
217 442
   CHAR16                      FileNameString[1];
218 443
 } EFI_USER_INTERFACE_SECTION;
219 444
 
445
+typedef struct {
446
+  EFI_COMMON_SECTION_HEADER2    CommonHeader;
447
+  CHAR16                        FileNameString[1];
448
+} EFI_USER_INTERFACE_SECTION2;
220 449
 
221 450
 ///
222
-/// Leaf section which contains a numeric build number and
451
+/// The leaf section which contains a numeric build number and
223 452
 /// an optional unicode string that represents the file revision.
224 453
 ///
225 454
 typedef struct {
@@ -232,6 +461,15 @@ typedef struct {
232 461
   CHAR16                      VersionString[1];
233 462
 } EFI_VERSION_SECTION;
234 463
 
464
+typedef struct {
465
+  EFI_COMMON_SECTION_HEADER2    CommonHeader;
466
+  ///
467
+  /// A UINT16 that represents a particular build. Subsequent builds have monotonically
468
+  /// increasing build numbers relative to earlier builds.
469
+  ///
470
+  UINT16                        BuildNumber;
471
+  CHAR16                        VersionString[1];
472
+} EFI_VERSION_SECTION2;
235 473
 
236 474
 #define SECTION_SIZE(SectionHeaderPtr) \
237 475
     ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))

+ 68
- 10
src/include/ipxe/efi/Pi/PiFirmwareVolume.h View File

@@ -1,8 +1,8 @@
1 1
 /** @file
2 2
   The firmware volume related definitions in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
4
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5
+  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
8 8
   http://opensource.org/licenses/bsd-license.php
@@ -18,8 +18,6 @@
18 18
 #ifndef __PI_FIRMWAREVOLUME_H__
19 19
 #define __PI_FIRMWAREVOLUME_H__
20 20
 
21
-#include <ipxe/efi/ProcessorBind.h>
22
-
23 21
 ///
24 22
 /// EFI_FV_FILE_ATTRIBUTES
25 23
 ///
@@ -91,7 +89,13 @@ typedef UINT32  EFI_FVB_ATTRIBUTES_2;
91 89
 
92 90
 
93 91
 typedef struct {
92
+  ///
93
+  /// The number of sequential blocks which are of the same size.
94
+  ///
94 95
   UINT32 NumBlocks;
96
+  ///
97
+  /// The size of the blocks.
98
+  ///
95 99
   UINT32 Length;
96 100
 } EFI_FV_BLOCK_MAP_ENTRY;
97 101
 
@@ -99,20 +103,57 @@ typedef struct {
99 103
 /// Describes the features and layout of the firmware volume.
100 104
 ///
101 105
 typedef struct {
106
+  ///
107
+  /// The first 16 bytes are reserved to allow for the reset vector of
108
+  /// processors whose reset vector is at address 0.
109
+  ///
102 110
   UINT8                     ZeroVector[16];
111
+  ///
112
+  /// Declares the file system with which the firmware volume is formatted.
113
+  ///
103 114
   EFI_GUID                  FileSystemGuid;
115
+  ///
116
+  /// Length in bytes of the complete firmware volume, including the header.
117
+  ///
104 118
   UINT64                    FvLength;
119
+  ///
120
+  /// Set to EFI_FVH_SIGNATURE
121
+  ///
105 122
   UINT32                    Signature;
123
+  ///
124
+  /// Declares capabilities and power-on defaults for the firmware volume.
125
+  ///
106 126
   EFI_FVB_ATTRIBUTES_2      Attributes;
127
+  ///
128
+  /// Length in bytes of the complete firmware volume header.
129
+  ///
107 130
   UINT16                    HeaderLength;
131
+  ///
132
+  /// A 16-bit checksum of the firmware volume header. A valid header sums to zero.
133
+  ///
108 134
   UINT16                    Checksum;
135
+  ///
136
+  /// Offset, relative to the start of the header, of the extended header
137
+  /// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
138
+  ///
109 139
   UINT16                    ExtHeaderOffset;
140
+  ///
141
+  /// This field must always be set to zero.
142
+  ///
110 143
   UINT8                     Reserved[1];
144
+  ///
145
+  /// Set to 2. Future versions of this specification may define new header fields and will
146
+  /// increment the Revision field accordingly.
147
+  ///
111 148
   UINT8                     Revision;
149
+  ///
150
+  /// An array of run-length encoded FvBlockMapEntry structures. The array is
151
+  /// terminated with an entry of {0,0}.
152
+  ///
112 153
   EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
113 154
 } EFI_FIRMWARE_VOLUME_HEADER;
114 155
 
115
-#define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
156
+#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
116 157
 
117 158
 ///
118 159
 /// Firmware Volume Header Revision definition
@@ -123,7 +164,13 @@ typedef struct {
123 164
 /// Extension header pointed by ExtHeaderOffset of volume header.
124 165
 ///
125 166
 typedef struct {
167
+  ///
168
+  /// Firmware volume name.
169
+  ///
126 170
   EFI_GUID  FvName;
171
+  ///
172
+  /// Size of the rest of the extension header, including this structure.
173
+  ///
127 174
   UINT32    ExtHeaderSize;
128 175
 } EFI_FIRMWARE_VOLUME_EXT_HEADER;
129 176
 
@@ -131,7 +178,13 @@ typedef struct {
131 178
 /// Entry struture for describing FV extension header
132 179
 ///
133 180
 typedef struct {
181
+  ///
182
+  /// Size of this header extension.
183
+  ///
134 184
   UINT16    ExtEntrySize;
185
+  ///
186
+  /// Type of the header.
187
+  ///
135 188
   UINT16    ExtEntryType;
136 189
 } EFI_FIRMWARE_VOLUME_EXT_ENTRY;
137 190
 
@@ -140,13 +193,18 @@ typedef struct {
140 193
 /// This extension header provides a mapping between a GUID and an OEM file type.
141 194
 ///
142 195
 typedef struct {
196
+  ///
197
+  /// Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE.
198
+  ///
143 199
   EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
200
+  ///
201
+  /// A bit mask, one bit for each file type between 0xC0 (bit 0) and 0xDF (bit 31). If a bit
202
+  /// is '1', then the GUID entry exists in Types. If a bit is '0' then no GUID entry exists in Types.
203
+  ///
144 204
   UINT32    TypeMask;
145
-
146
-  //
147
-  // Array of GUIDs.
148
-  // Each GUID represents an OEM file type.
149
-  //
205
+  ///
206
+  /// An array of GUIDs, each GUID representing an OEM file type.
207
+  ///
150 208
   EFI_GUID  Types[1];
151 209
 } EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
152 210
 

+ 178
- 24
src/include/ipxe/efi/Pi/PiHob.h View File

@@ -1,14 +1,14 @@
1 1
 /** @file
2 2
   HOB related definitions in PI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14 14
   PI Version 1.0
@@ -18,11 +18,6 @@
18 18
 #ifndef __PI_HOB_H__
19 19
 #define __PI_HOB_H__
20 20
 
21
-#include <ipxe/efi/ProcessorBind.h>
22
-#include <ipxe/efi/Pi/PiBootMode.h>
23
-#include <ipxe/efi/Uefi/UefiBaseType.h>
24
-#include <ipxe/efi/Uefi/UefiMultiPhase.h>
25
-
26 21
 //
27 22
 // HobType of EFI_HOB_GENERIC_HEADER.
28 23
 //
@@ -34,7 +29,8 @@
34 29
 #define EFI_HOB_TYPE_CPU                  0x0006
35 30
 #define EFI_HOB_TYPE_MEMORY_POOL          0x0007
36 31
 #define EFI_HOB_TYPE_FV2                  0x0009
37
-#define EFI_HOB_TYPE_LOAD_PEIM            0x000A
32
+#define EFI_HOB_TYPE_LOAD_PEIM_UNUSED     0x000A
33
+#define EFI_HOB_TYPE_UEFI_CAPSULE         0x000B
38 34
 #define EFI_HOB_TYPE_UNUSED               0xFFFE
39 35
 #define EFI_HOB_TYPE_END_OF_HOB_LIST      0xFFFF
40 36
 
@@ -43,14 +39,23 @@
43 39
 /// All HOBs must contain this generic HOB header.
44 40
 ///
45 41
 typedef struct {
42
+  ///
43
+  /// Identifies the HOB data structure type.
44
+  ///
46 45
   UINT16    HobType;
46
+  ///
47
+  /// The length in bytes of the HOB.
48
+  ///
47 49
   UINT16    HobLength;
50
+  ///
51
+  /// This field must always be set to zero.
52
+  ///
48 53
   UINT32    Reserved;
49 54
 } EFI_HOB_GENERIC_HEADER;
50 55
 
51 56
 
52 57
 ///
53
-/// Value of version ofinEFI_HOB_HANDOFF_INFO_TABLE.
58
+/// Value of version  in EFI_HOB_HANDOFF_INFO_TABLE.
54 59
 ///
55 60
 #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
56 61
 
@@ -59,13 +64,41 @@ typedef struct {
59 64
 /// This HOB must be the first one in the HOB list.
60 65
 ///
61 66
 typedef struct {
67
+  ///
68
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_HANDOFF.
69
+  ///
62 70
   EFI_HOB_GENERIC_HEADER  Header;
71
+  ///
72
+  /// The version number pertaining to the PHIT HOB definition.
73
+  /// This value is four bytes in length to provide an 8-byte aligned entry
74
+  /// when it is combined with the 4-byte BootMode.
75
+  ///
63 76
   UINT32                  Version;
77
+  ///
78
+  /// The system boot mode as determined during the HOB producer phase.
79
+  ///
64 80
   EFI_BOOT_MODE           BootMode;
81
+  ///
82
+  /// The highest address location of memory that is allocated for use by the HOB producer
83
+  /// phase. This address must be 4-KB aligned to meet page restrictions of UEFI.
84
+  ///
65 85
   EFI_PHYSICAL_ADDRESS    EfiMemoryTop;
86
+  ///
87
+  /// The lowest address location of memory that is allocated for use by the HOB producer phase.
88
+  ///
66 89
   EFI_PHYSICAL_ADDRESS    EfiMemoryBottom;
90
+  ///
91
+  /// The highest address location of free memory that is currently available
92
+  /// for use by the HOB producer phase.
93
+  ///
67 94
   EFI_PHYSICAL_ADDRESS    EfiFreeMemoryTop;
95
+  ///
96
+  /// The lowest address location of free memory that is available for use by the HOB producer phase.
97
+  ///
68 98
   EFI_PHYSICAL_ADDRESS    EfiFreeMemoryBottom;
99
+  ///
100
+  /// The end of the HOB list.
101
+  ///
69 102
   EFI_PHYSICAL_ADDRESS    EfiEndOfHobList;
70 103
 } EFI_HOB_HANDOFF_INFO_TABLE;
71 104
 
@@ -112,11 +145,17 @@ typedef struct {
112 145
 ///
113 146
 /// Describes all memory ranges used during the HOB producer
114 147
 /// phase that exist outside the HOB list. This HOB type
115
-/// describes how memory is used,
116
-/// not the physical attributes of memory.
148
+/// describes how memory is used, not the physical attributes of memory.
117 149
 ///
118 150
 typedef struct {
151
+  ///
152
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
153
+  ///
119 154
   EFI_HOB_GENERIC_HEADER            Header;
155
+  ///
156
+  /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
157
+  /// various attributes of the logical memory allocation.
158
+  ///
120 159
   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
121 160
   //
122 161
   // Additional data pertaining to the "Name" Guid memory
@@ -127,11 +166,18 @@ typedef struct {
127 166
 
128 167
 ///
129 168
 /// Describes the memory stack that is produced by the HOB producer
130
-/// phase and upon which all postmemory-installed executable
169
+/// phase and upon which all post-memory-installed executable
131 170
 /// content in the HOB producer phase is executing.
132 171
 ///
133 172
 typedef struct {
173
+  ///
174
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
175
+  ///
134 176
   EFI_HOB_GENERIC_HEADER            Header;
177
+  ///
178
+  /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
179
+  /// various attributes of the logical memory allocation.
180
+  ///
135 181
   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
136 182
 } EFI_HOB_MEMORY_ALLOCATION_STACK;
137 183
 
@@ -142,7 +188,14 @@ typedef struct {
142 188
 /// register overflow store.
143 189
 ///
144 190
 typedef struct {
191
+  ///
192
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
193
+  ///
145 194
   EFI_HOB_GENERIC_HEADER            Header;
195
+  ///
196
+  /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
197
+  /// various attributes of the logical memory allocation.
198
+  ///
146 199
   EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
147 200
 } EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
148 201
 
@@ -150,14 +203,29 @@ typedef struct {
150 203
 /// Defines the location and entry point of the HOB consumer phase.
151 204
 ///
152 205
 typedef struct {
206
+  ///
207
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_ALLOCATION.
208
+  ///
153 209
   EFI_HOB_GENERIC_HEADER            Header;
210
+  ///
211
+  /// An instance of the EFI_HOB_MEMORY_ALLOCATION_HEADER that describes the
212
+  /// various attributes of the logical memory allocation.
213
+  ///
154 214
   EFI_HOB_MEMORY_ALLOCATION_HEADER  MemoryAllocationHeader;
215
+  ///
216
+  /// The GUID specifying the values of the firmware file system name
217
+  /// that contains the HOB consumer phase component.
218
+  ///
155 219
   EFI_GUID                          ModuleName;
220
+  ///
221
+  /// The address of the memory-mapped firmware volume
222
+  /// that contains the HOB consumer phase firmware file.
223
+  ///
156 224
   EFI_PHYSICAL_ADDRESS              EntryPoint;
157 225
 } EFI_HOB_MEMORY_ALLOCATION_MODULE;
158 226
 
159 227
 ///
160
-/// Resource type
228
+/// The resource type.
161 229
 ///
162 230
 typedef UINT32 EFI_RESOURCE_TYPE;
163 231
 
@@ -174,7 +242,7 @@ typedef UINT32 EFI_RESOURCE_TYPE;
174 242
 #define EFI_RESOURCE_MAX_MEMORY_TYPE        0x00000007
175 243
 
176 244
 ///
177
-/// type of recount attribute type
245
+/// A type of recount attribute type.
178 246
 ///
179 247
 typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
180 248
 
@@ -211,11 +279,30 @@ typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
211 279
 /// host bus during the HOB producer phase.
212 280
 ///
213 281
 typedef struct {
282
+  ///
283
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
284
+  ///
214 285
   EFI_HOB_GENERIC_HEADER      Header;
286
+  ///
287
+  /// A GUID representing the owner of the resource. This GUID is used by HOB
288
+  /// consumer phase components to correlate device ownership of a resource.
289
+  ///
215 290
   EFI_GUID                    Owner;
291
+  ///
292
+  /// The resource type enumeration as defined by EFI_RESOURCE_TYPE.
293
+  ///
216 294
   EFI_RESOURCE_TYPE           ResourceType;
295
+  ///
296
+  /// Resource attributes as defined by EFI_RESOURCE_ATTRIBUTE_TYPE.
297
+  ///
217 298
   EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
299
+  ///
300
+  /// The physical start address of the resource region.
301
+  ///
218 302
   EFI_PHYSICAL_ADDRESS        PhysicalStart;
303
+  ///
304
+  /// The number of bytes of the resource region.
305
+  ///
219 306
   UINT64                      ResourceLength;
220 307
 } EFI_HOB_RESOURCE_DESCRIPTOR;
221 308
 
@@ -224,32 +311,61 @@ typedef struct {
224 311
 /// maintain and manage HOBs with specific GUID.
225 312
 ///
226 313
 typedef struct {
314
+  ///
315
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_GUID_EXTENSION.
316
+  ///
227 317
   EFI_HOB_GENERIC_HEADER      Header;
228
-  EFI_GUID                    Name;
229
-
230 318
   ///
231
-  /// Guid specific data goes here
319
+  /// A GUID that defines the contents of this HOB.
232 320
   ///
321
+  EFI_GUID                    Name;
322
+  //
323
+  // Guid specific data goes here
324
+  //
233 325
 } EFI_HOB_GUID_TYPE;
234 326
 
235 327
 ///
236 328
 /// Details the location of firmware volumes that contain firmware files.
237 329
 ///
238 330
 typedef struct {
331
+  ///
332
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV.
333
+  ///
239 334
   EFI_HOB_GENERIC_HEADER Header;
335
+  ///
336
+  /// The physical memory-mapped base address of the firmware volume.
337
+  ///
240 338
   EFI_PHYSICAL_ADDRESS   BaseAddress;
339
+  ///
340
+  /// The length in bytes of the firmware volume.
341
+  ///
241 342
   UINT64                 Length;
242 343
 } EFI_HOB_FIRMWARE_VOLUME;
243 344
 
244 345
 ///
245
-/// Details the location of a firmware volume which was extracted
346
+/// Details the location of a firmware volume that was extracted
246 347
 /// from a file within another firmware volume.
247 348
 ///
248 349
 typedef struct {
350
+  ///
351
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_FV2.
352
+  ///
249 353
   EFI_HOB_GENERIC_HEADER  Header;
354
+  ///
355
+  /// The physical memory-mapped base address of the firmware volume.
356
+  ///
250 357
   EFI_PHYSICAL_ADDRESS    BaseAddress;
358
+  ///
359
+  /// The length in bytes of the firmware volume.
360
+  ///
251 361
   UINT64                  Length;
362
+  ///
363
+  /// The name of the firmware volume.
364
+  ///
252 365
   EFI_GUID                FvName;
366
+  ///
367
+  /// The name of the firmware file that contained this firmware volume.
368
+  ///
253 369
   EFI_GUID                FileName;
254 370
 } EFI_HOB_FIRMWARE_VOLUME2;
255 371
 
@@ -258,9 +374,21 @@ typedef struct {
258 374
 /// Describes processor information, such as address space and I/O space capabilities.
259 375
 ///
260 376
 typedef struct {
377
+  ///
378
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_CPU.
379
+  ///
261 380
   EFI_HOB_GENERIC_HEADER  Header;
381
+  ///
382
+  /// Identifies the maximum physical memory addressability of the processor.
383
+  ///
262 384
   UINT8                   SizeOfMemorySpace;
385
+  ///
386
+  /// Identifies the maximum physical I/O addressability of the processor.
387
+  ///
263 388
   UINT8                   SizeOfIoSpace;
389
+  ///
390
+  /// This field will always be set to zero.
391
+  ///
264 392
   UINT8                   Reserved[6];
265 393
 } EFI_HOB_CPU;
266 394
 
@@ -269,11 +397,36 @@ typedef struct {
269 397
 /// Describes pool memory allocations.
270 398
 ///
271 399
 typedef struct {
400
+  ///
401
+  /// The HOB generic header. Header.HobType = EFI_HOB_TYPE_MEMORY_POOL.
402
+  ///
272 403
   EFI_HOB_GENERIC_HEADER  Header;
273 404
 } EFI_HOB_MEMORY_POOL;
274 405
 
275 406
 ///
276
-/// Union of all the possible HOB Types
407
+/// Each UEFI capsule HOB details the location of a UEFI capsule. It includes a base address and length
408
+/// which is based upon memory blocks with a EFI_CAPSULE_HEADER and the associated
409
+/// CapsuleImageSize-based payloads. These HOB's shall be created by the PEI PI firmware
410
+/// sometime after the UEFI UpdateCapsule service invocation with the
411
+/// CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE flag set in the EFI_CAPSULE_HEADER.
412
+///
413
+typedef struct {
414
+  ///
415
+  /// The HOB generic header where Header.HobType = EFI_HOB_TYPE_UEFI_CAPSULE.
416
+  ///
417
+  EFI_HOB_GENERIC_HEADER Header;
418
+
419
+  ///
420
+  /// The physical memory-mapped base address of an UEFI capsule. This value is set to
421
+  /// point to the base of the contiguous memory of the UEFI capsule.
422
+  /// The length of the contiguous memory in bytes.
423
+  ///
424
+  EFI_PHYSICAL_ADDRESS   BaseAddress;
425
+  UINT64                 Length;
426
+} EFI_HOB_UEFI_CAPSULE;
427
+
428
+///
429
+/// Union of all the possible HOB Types.
277 430
 ///
278 431
 typedef union {
279 432
   EFI_HOB_GENERIC_HEADER              *Header;
@@ -288,6 +441,7 @@ typedef union {
288 441
   EFI_HOB_FIRMWARE_VOLUME2            *FirmwareVolume2;
289 442
   EFI_HOB_CPU                         *Cpu;
290 443
   EFI_HOB_MEMORY_POOL                 *Pool;
444
+  EFI_HOB_UEFI_CAPSULE                *Capsule;
291 445
   UINT8                               *Raw;
292 446
 } EFI_PEI_HOB_POINTERS;
293 447
 

+ 97
- 65
src/include/ipxe/efi/Pi/PiMultiPhase.h View File

@@ -1,104 +1,136 @@
1 1
 /** @file
2 2
   Include file matches things in PI for multiple module types.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
   @par Revision Reference:
14
-  PI Version 1.0
14
+  These elements are defined in UEFI Platform Initialization Specification 1.2.
15 15
 
16 16
 **/
17 17
 
18 18
 #ifndef __PI_MULTIPHASE_H__
19 19
 #define __PI_MULTIPHASE_H__
20 20
 
21
-#include <ipxe/efi/Uefi/UefiMultiPhase.h>
22
-
23 21
 #include <ipxe/efi/Pi/PiFirmwareVolume.h>
24 22
 #include <ipxe/efi/Pi/PiFirmwareFile.h>
25 23
 #include <ipxe/efi/Pi/PiBootMode.h>
26
-
27 24
 #include <ipxe/efi/Pi/PiHob.h>
28 25
 #include <ipxe/efi/Pi/PiDependency.h>
26
+#include <ipxe/efi/Pi/PiStatusCode.h>
27
+#include <ipxe/efi/Pi/PiS3BootScript.h>
29 28
 
29
+/**
30
+  Produces an error code in the range reserved for use by the Platform Initialization
31
+  Architecture Specification.
30 32
 
31
-#define EFI_NOT_AVAILABLE_YET   EFIERR (32)
33
+  The supported 32-bit range is 0xA0000000-0xBFFFFFFF
34
+  The supported 64-bit range is 0xA000000000000000-0xBFFFFFFFFFFFFFFF
32 35
 
33
-///
34
-/// Status Code Type Definition
35
-///
36
-typedef UINT32  EFI_STATUS_CODE_TYPE;
36
+  @param  StatusCode    The status code value to convert into a warning code.
37
+                        StatusCode must be in the range 0x00000000..0x1FFFFFFF.
37 38
 
38
-//
39
-// A Status Code Type is made up of the code type and severity
40
-// All values masked by EFI_STATUS_CODE_RESERVED_MASK are
41
-// reserved for use by this specification.
42
-//
43
-#define EFI_STATUS_CODE_TYPE_MASK     0x000000FF
44
-#define EFI_STATUS_CODE_SEVERITY_MASK 0xFF000000
45
-#define EFI_STATUS_CODE_RESERVED_MASK 0x00FFFF00
39
+  @return The value specified by StatusCode in the PI reserved range.
46 40
 
47
-//
48
-// Definition of code types, all other values masked by
49
-// EFI_STATUS_CODE_TYPE_MASK are reserved for use by
50
-// this specification.
51
-//
52
-#define EFI_PROGRESS_CODE             0x00000001
53
-#define EFI_ERROR_CODE                0x00000002
54
-#define EFI_DEBUG_CODE                0x00000003
41
+**/
42
+#define DXE_ERROR(StatusCode)  (MAX_BIT | (MAX_BIT >> 2) | StatusCode)
55 43
 
56
-//
57
-// Definitions of severities, all other values masked by
58
-// EFI_STATUS_CODE_SEVERITY_MASK are reserved for use by
59
-// this specification.
60
-// Uncontained errors are major errors that could not contained
61
-// to the specific component that is reporting the error
62
-// For example, if a memory error was not detected early enough,
63
-// the bad data could be consumed by other drivers.
64
-//
65
-#define EFI_ERROR_MINOR               0x40000000
66
-#define EFI_ERROR_MAJOR               0x80000000
67
-#define EFI_ERROR_UNRECOVERED         0x90000000
68
-#define EFI_ERROR_UNCONTAINED         0xa0000000
44
+///
45
+/// If this value is returned by an EFI image, then the image should be unloaded.
46
+///
47
+#define EFI_REQUEST_UNLOAD_IMAGE  DXE_ERROR (1)
69 48
 
70 49
 ///
71
-/// Status Code Value Definition
50
+/// If this value is returned by an API, it means the capability is not yet
51
+/// installed/available/ready to use.
72 52
 ///
73
-typedef UINT32 EFI_STATUS_CODE_VALUE;
53
+#define EFI_NOT_AVAILABLE_YET     DXE_ERROR (2)
74 54
 
75
-//
76
-// A Status Code Value is made up of the class, subclass, and
77
-// an operation.
78
-//
79
-#define EFI_STATUS_CODE_CLASS_MASK      0xFF000000
80
-#define EFI_STATUS_CODE_SUBCLASS_MASK   0x00FF0000
81
-#define EFI_STATUS_CODE_OPERATION_MASK  0x0000FFFF
55
+///
56
+/// Success and warning codes reserved for use by PI.
57
+/// Supported 32-bit range is 0x20000000-0x3fffffff.
58
+/// Supported 64-bit range is 0x2000000000000000-0x3fffffffffffffff.
59
+///
60
+#define PI_ENCODE_WARNING(a)                ((MAX_BIT >> 2) | (a))
82 61
 
83 62
 ///
84
-/// Definition of Status Code extended data header.
85
-/// The data will follow HeaderSize bytes from the beginning of
86
-/// the structure and is Size bytes long.
63
+/// Error codes reserved for use by PI.
64
+/// Supported 32-bit range is 0xa0000000-0xbfffffff.
65
+/// Supported 64-bit range is 0xa000000000000000-0xbfffffffffffffff.
87 66
 ///
88
-typedef struct {
89
-  UINT16    HeaderSize;
90
-  UINT16    Size;
91
-  EFI_GUID  Type;
92
-} EFI_STATUS_CODE_DATA;
67
+#define PI_ENCODE_ERROR(a)                  (MAX_BIT | (MAX_BIT >> 2) | (a))
93 68
 
69
+///
70
+/// Return status codes defined in SMM CIS.
71
+///
72
+#define EFI_INTERRUPT_PENDING               PI_ENCODE_ERROR (0)
94 73
 
95
-//
96
-// Bit values for Authentication Status
97
-//
74
+#define EFI_WARN_INTERRUPT_SOURCE_PENDING   PI_ENCODE_WARNING (0)
75
+#define EFI_WARN_INTERRUPT_SOURCE_QUIESCED  PI_ENCODE_WARNING (1)
76
+
77
+///
78
+/// Bitmask of values for Authentication Status.
79
+/// Authentication Status is returned from EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL
80
+/// and the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
81
+///
82
+/// xx00 Image was not signed.
83
+/// xxx1 Platform security policy override. Assumes the same meaning as 0010 (the image was signed, the
84
+///      signature was tested, and the signature passed authentication test).
85
+/// 0010 Image was signed, the signature was tested, and the signature passed authentication test.
86
+/// 0110 Image was signed and the signature was not tested.
87
+/// 1010 Image was signed, the signature was tested, and the signature failed the authentication test.
88
+///
89
+///@{
98 90
 #define EFI_AUTH_STATUS_PLATFORM_OVERRIDE   0x01
99 91
 #define EFI_AUTH_STATUS_IMAGE_SIGNED        0x02
100 92
 #define EFI_AUTH_STATUS_NOT_TESTED          0x04
101 93
 #define EFI_AUTH_STATUS_TEST_FAILED         0x08
102 94
 #define EFI_AUTH_STATUS_ALL                 0x0f
95
+///@}
96
+
97
+///
98
+/// SMRAM states and capabilities
99
+///
100
+#define EFI_SMRAM_OPEN                  0x00000001
101
+#define EFI_SMRAM_CLOSED                0x00000002
102
+#define EFI_SMRAM_LOCKED                0x00000004
103
+#define EFI_CACHEABLE                   0x00000008
104
+#define EFI_ALLOCATED                   0x00000010
105
+#define EFI_NEEDS_TESTING               0x00000020
106
+#define EFI_NEEDS_ECC_INITIALIZATION    0x00000040
107
+
108
+///
109
+/// Structure describing a SMRAM region and its accessibility attributes.
110
+///
111
+typedef struct {
112
+  ///
113
+  /// Designates the physical address of the SMRAM in memory. This view of memory is
114
+  /// the same as seen by I/O-based agents, for example, but it may not be the address seen
115
+  /// by the processors.
116
+  ///
117
+  EFI_PHYSICAL_ADDRESS  PhysicalStart;
118
+  ///
119
+  /// Designates the address of the SMRAM, as seen by software executing on the
120
+  /// processors. This address may or may not match PhysicalStart.
121
+  ///
122
+  EFI_PHYSICAL_ADDRESS  CpuStart;
123
+  ///
124
+  /// Describes the number of bytes in the SMRAM region.
125
+  ///
126
+  UINT64                PhysicalSize;
127
+  ///
128
+  /// Describes the accessibility attributes of the SMRAM.  These attributes include the
129
+  /// hardware state (e.g., Open/Closed/Locked), capability (e.g., cacheable), logical
130
+  /// allocation (e.g., allocated), and pre-use initialization (e.g., needs testing/ECC
131
+  /// initialization).
132
+  ///
133
+  UINT64                RegionState;
134
+} EFI_SMRAM_DESCRIPTOR;
103 135
 
104 136
 #endif

+ 59
- 0
src/include/ipxe/efi/Pi/PiS3BootScript.h View File

@@ -0,0 +1,59 @@
1
+/** @file
2
+  This file contains the boot script defintions that are shared between the
3
+  Boot Script Executor PPI and the Boot Script Save Protocol.
4
+
5
+  Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
6
+  This program and the accompanying materials
7
+  are licensed and made available under the terms and conditions of the BSD License
8
+  which accompanies this distribution.  The full text of the license may be found at
9
+  http://opensource.org/licenses/bsd-license.php
10
+
11
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
+
14
+**/
15
+
16
+#ifndef _PI_S3_BOOT_SCRIPT_H_
17
+#define _PI_S3_BOOT_SCRIPT_H_
18
+
19
+//*******************************************
20
+// EFI Boot Script Opcode definitions
21
+//*******************************************
22
+#define EFI_BOOT_SCRIPT_IO_WRITE_OPCODE                 0x00
23
+#define EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE            0x01
24
+#define EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE                0x02
25
+#define EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE           0x03
26
+#define EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE         0x04
27
+#define EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE    0x05
28
+#define EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE            0x06
29
+#define EFI_BOOT_SCRIPT_STALL_OPCODE                    0x07
30
+#define EFI_BOOT_SCRIPT_DISPATCH_OPCODE                 0x08
31
+#define EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE               0x09
32
+#define EFI_BOOT_SCRIPT_INFORMATION_OPCODE              0x0A
33
+#define EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE        0x0B
34
+#define EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE   0x0C
35
+#define EFI_BOOT_SCRIPT_IO_POLL_OPCODE                  0x0D
36
+#define EFI_BOOT_SCRIPT_MEM_POLL_OPCODE                 0x0E
37
+#define EFI_BOOT_SCRIPT_PCI_CONFIG_POLL_OPCODE          0x0F
38
+#define EFI_BOOT_SCRIPT_PCI_CONFIG2_POLL_OPCODE         0x10
39
+
40
+//*******************************************
41
+// EFI_BOOT_SCRIPT_WIDTH
42
+//*******************************************
43
+typedef enum {
44
+  EfiBootScriptWidthUint8,
45
+  EfiBootScriptWidthUint16,
46
+  EfiBootScriptWidthUint32,
47
+  EfiBootScriptWidthUint64,
48
+  EfiBootScriptWidthFifoUint8,
49
+  EfiBootScriptWidthFifoUint16,
50
+  EfiBootScriptWidthFifoUint32,
51
+  EfiBootScriptWidthFifoUint64,
52
+  EfiBootScriptWidthFillUint8,
53
+  EfiBootScriptWidthFillUint16,
54
+  EfiBootScriptWidthFillUint32,
55
+  EfiBootScriptWidthFillUint64,
56
+  EfiBootScriptWidthMaximum
57
+} EFI_BOOT_SCRIPT_WIDTH;
58
+
59
+#endif

+ 1126
- 0
src/include/ipxe/efi/Pi/PiStatusCode.h
File diff suppressed because it is too large
View File


+ 6
- 6
src/include/ipxe/efi/PiDxe.h View File

@@ -1,12 +1,12 @@
1 1
 /** @file
2 2
 
3
-  Root include file for Mde Package DXE_CORE, DXE, SMM, SAL type modules.
3
+  Root include file for Mde Package DXE_CORE, DXE, RUNTIME, SMM, SAL type modules.
4 4
 
5
-Copyright (c) 2006 - 2007, Intel Corporation
6
-All rights reserved. This program and the accompanying materials
7
-are licensed and made available under the terms and conditions of the BSD License
8
-which accompanies this distribution.  The full text of the license may be found at
9
-http://opensource.org/licenses/bsd-license.php
5
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6
+This program and the accompanying materials are licensed and made available under
7
+the terms and conditions of the BSD License that accompanies this distribution.
8
+The full text of the license may be found at
9
+http://opensource.org/licenses/bsd-license.php.
10 10
 
11 11
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 12
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+ 17
- 18
src/include/ipxe/efi/Protocol/ComponentName2.h View File

@@ -3,8 +3,8 @@
3 3
   This protocol is used to retrieve user readable names of drivers
4 4
   and controllers managed by UEFI Drivers.
5 5
 
6
-  Copyright (c) 2006 - 2008, Intel Corporation
7
-  All rights reserved. This program and the accompanying materials
6
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
7
+  This program and the accompanying materials
8 8
   are licensed and made available under the terms and conditions of the BSD License
9 9
   which accompanies this distribution.  The full text of the license may be found at
10 10
   http://opensource.org/licenses/bsd-license.php
@@ -27,7 +27,7 @@ typedef struct _EFI_COMPONENT_NAME2_PROTOCOL  EFI_COMPONENT_NAME2_PROTOCOL;
27 27
 
28 28
 
29 29
 /**
30
-  Retrieves a Unicode string that is the user readable name of
30
+  Retrieves a string that is the user readable name of
31 31
   the EFI Driver.
32 32
 
33 33
   @param  This       A pointer to the
@@ -40,15 +40,15 @@ typedef struct _EFI_COMPONENT_NAME2_PROTOCOL  EFI_COMPONENT_NAME2_PROTOCOL;
40 40
                      languages specified in SupportedLanguages.
41 41
                      The number of languages supported by a
42 42
                      driver is up to the driver writer. Language
43
-                     is specified in RFC 3066 language code
43
+                     is specified in RFC 4646 language code
44 44
                      format.
45 45
 
46
-  @param  DriverName A pointer to the Unicode string to return.
47
-                     This Unicode string is the name of the
46
+  @param  DriverName A pointer to the string to return.
47
+                     This string is the name of the
48 48
                      driver specified by This in the language
49 49
                      specified by Language.
50 50
 
51
-  @retval EFI_SUCCESS           The Unicode string for the
51
+  @retval EFI_SUCCESS           The string for the
52 52
                                 Driver specified by This and the
53 53
                                 language specified by Language
54 54
                                 was returned in DriverName.
@@ -72,7 +72,7 @@ EFI_STATUS
72 72
 
73 73
 
74 74
 /**
75
-  Retrieves a Unicode string that is the user readable name of
75
+  Retrieves a string that is the user readable name of
76 76
   the controller that is being managed by an EFI Driver.
77 77
 
78 78
   @param  This             A pointer to the
@@ -83,11 +83,11 @@ EFI_STATUS
83 83
                            This handle specifies the controller
84 84
                            whose name is to be returned.
85 85
 
86
-  @param ChildHandle      The handle of the child controller to
86
+  @param  ChildHandle      The handle of the child controller to
87 87
                            retrieve the name of.  This is an
88 88
                            optional parameter that may be NULL.
89 89
                            It will be NULL for device drivers.
90
-                           It will also be NULL for a bus
90
+                           It will also be NULL for bus
91 91
                            drivers that wish to retrieve the
92 92
                            name of the bus controller.  It will
93 93
                            not be NULL for a bus driver that
@@ -103,18 +103,17 @@ EFI_STATUS
103 103
                            SupportedLanguages. The number of
104 104
                            languages supported by a driver is up
105 105
                            to the driver writer. Language is
106
-                           specified in RFC 3066 language code
106
+                           specified in RFC 4646 language code
107 107
                            format.
108 108
 
109
-  @param  ControllerName   A pointer to the Unicode string to
110
-                           return.  This Unicode string is the
111
-                           name of the controller specified by
112
-                           ControllerHandle and ChildHandle in
113
-                           the language specified by Language
109
+  @param  ControllerName   A pointer to the string to return.
110
+                           This string is the name of the controller
111
+                           specified by ControllerHandle and ChildHandle
112
+                           in the language specified by Language
114 113
                            from the point of view of the driver
115 114
                            specified by This.
116 115
 
117
-  @retval EFI_SUCCESS           The Unicode string for the user
116
+  @retval EFI_SUCCESS           The string for the user
118 117
                                 readable name in the language
119 118
                                 specified by Language for the
120 119
                                 driver specified by This was
@@ -164,7 +163,7 @@ struct _EFI_COMPONENT_NAME2_PROTOCOL {
164 163
   /// supported language codes. This is the list of language codes that
165 164
   /// this protocol supports. The number of languages supported by a
166 165
   /// driver is up to the driver writer. SupportedLanguages is
167
-  /// specified in RFC 3066 format.
166
+  /// specified in RFC 4646 format.
168 167
   ///
169 168
   CHAR8                                    *SupportedLanguages;
170 169
 };

+ 10
- 3
src/include/ipxe/efi/Protocol/Cpu.h View File

@@ -3,8 +3,8 @@
3 3
 
4 4
   This code abstracts the DXE core from processor implementation details.
5 5
 
6
-  Copyright (c) 2006 - 2008, Intel Corporation
7
-  All rights reserved. This program and the accompanying materials
6
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
7
+  This program and the accompanying materials
8 8
   are licensed and made available under the terms and conditions of the BSD License
9 9
   which accompanies this distribution.  The full text of the license may be found at
10 10
   http://opensource.org/licenses/bsd-license.php
@@ -24,6 +24,9 @@
24 24
 
25 25
 typedef struct _EFI_CPU_ARCH_PROTOCOL   EFI_CPU_ARCH_PROTOCOL;
26 26
 
27
+///
28
+/// The type of flush operation
29
+///
27 30
 typedef enum {
28 31
   EfiCpuFlushTypeWriteBackInvalidate,
29 32
   EfiCpuFlushTypeWriteBack,
@@ -31,6 +34,9 @@ typedef enum {
31 34
   EfiCpuMaxFlushType
32 35
 } EFI_CPU_FLUSH_TYPE;
33 36
 
37
+///
38
+/// The type of processor INIT.
39
+///
34 40
 typedef enum {
35 41
   EfiCpuInit,
36 42
   EfiCpuMaxInitType
@@ -206,7 +212,8 @@ EFI_STATUS
206 212
                            must be between 0 and NumberOfTimers-1.
207 213
   @param  TimerValue       Pointer to the returned timer value.
208 214
   @param  TimerPeriod      A pointer to the amount of time that passes in femtoseconds for each increment
209
-                           of TimerValue.
215
+                           of TimerValue. If TimerValue does not increment at a predictable rate, then 0 is
216
+                           returned. This parameter is optional and may be NULL.
210 217
 
211 218
   @retval EFI_SUCCESS           The processor timer value specified by TimerIndex was returned in TimerValue.
212 219
   @retval EFI_DEVICE_ERROR      An error occurred attempting to read one of the processor's timers.

+ 19
- 101
src/include/ipxe/efi/Protocol/CpuIo.h View File

@@ -2,126 +2,44 @@
2 2
   This code abstracts the CPU IO Protocol which installed by some platform or chipset-specific
3 3
   PEIM that abstracts the processor-visible I/O operations.
4 4
 
5
-  Copyright (c) 2007, Intel Corporation
6
-  All rights reserved. This program and the accompanying materials
7
-  are licensed and made available under the terms and conditions of the BSD License
8
-  which accompanies this distribution.  The full text of the license may be found at
9
-  http://opensource.org/licenses/bsd-license.php
5
+  Note: This is a runtime protocol and can be used by runtime drivers after ExitBootServices().
6
+  It is different from the PI 1.2 CPU I/O 2 Protocol, which is a boot services only protocol
7
+  and may not be used by runtime drivers after ExitBootServices().
10 8
 
11
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
9
+Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
10
+This program and the accompanying materials are licensed and made available under
11
+the terms and conditions of the BSD License that accompanies this distribution.
12
+The full text of the license may be found at
13
+http://opensource.org/licenses/bsd-license.php.
13 14
 
14
-  Module Name:  CpuIO.h
15
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 17
 
16 18
   @par Revision Reference:
17 19
   CPU IO Protocol is defined in Framework of EFI CPU IO Protocol Spec
18
-  Version 0.9
20
+  Version 0.9.
19 21
 
20 22
 **/
21 23
 
22 24
 #ifndef _CPUIO_H_
23 25
 #define _CPUIO_H_
24 26
 
25
-#include <ipxe/efi/PiDxe.h>
27
+#include <ipxe/efi/Protocol/CpuIo2.h>
26 28
 
27 29
 #define EFI_CPU_IO_PROTOCOL_GUID \
28 30
   { \
29 31
     0xB0732526, 0x38C8, 0x4b40, {0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } \
30 32
   }
31 33
 
32
-typedef struct _EFI_CPU_IO_PROTOCOL EFI_CPU_IO_PROTOCOL;
33
-
34
-//
35
-// *******************************************************
36
-// EFI_CPU_IO_PROTOCOL_WIDTH
37
-// *******************************************************
38
-//
39
-typedef enum {
40
-  EfiCpuIoWidthUint8,
41
-  EfiCpuIoWidthUint16,
42
-  EfiCpuIoWidthUint32,
43
-  EfiCpuIoWidthUint64,
44
-  EfiCpuIoWidthFifoUint8,
45
-  EfiCpuIoWidthFifoUint16,
46
-  EfiCpuIoWidthFifoUint32,
47
-  EfiCpuIoWidthFifoUint64,
48
-  EfiCpuIoWidthFillUint8,
49
-  EfiCpuIoWidthFillUint16,
50
-  EfiCpuIoWidthFillUint32,
51
-  EfiCpuIoWidthFillUint64,
52
-  EfiCpuIoWidthMaximum
53
-} EFI_CPU_IO_PROTOCOL_WIDTH;
54
-
55
-//
56
-// *******************************************************
57
-// EFI_CPU_IO_PROTOCOL_IO_MEM
58
-// *******************************************************
59
-//
60
-/**
61
-  Enables a driver to access memory-mapped registers in the EFI system memory space.
62
-  Or, Enables a driver to access registers in the EFI CPU I/O space.
63
-
64
-  @param  This                  A pointer to the EFI_CPU_IO_PROTOCOL instance.
65
-  @param  Width                 Signifies the width of the I/O or Memory operation.
66
-  @param  Address               The base address of the I/O or Memoryoperation.
67
-  @param  Count                 The number of I/O or Memory operations to perform.
68
-                                The number of bytes moved is Width size * Count, starting at Address.
69
-  @param  Buffer                For read operations, the destination buffer to store the results.
70
-                                For write operations, the source buffer from which to write data.
71
-
72
-  @retval EFI_SUCCESS           The data was read from or written to the EFI system.
73
-  @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.Or Buffer is NULL.
74
-  @retval EFI_UNSUPPORTED       The Buffer is not aligned for the given Width.
75
-                                Or,The address range specified by Address, Width, and Count is not valid for this EFI system.
76
-
77
-**/
78
-typedef
79
-EFI_STATUS
80
-(EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)(
81
-  IN EFI_CPU_IO_PROTOCOL                *This,
82
-  IN  EFI_CPU_IO_PROTOCOL_WIDTH         Width,
83
-  IN  UINT64                            Address,
84
-  IN  UINTN                             Count,
85
-  IN  OUT VOID                          *Buffer
86
-  );
87
-
88
-//
89
-// *******************************************************
90
-// EFI_CPU_IO_PROTOCOL_ACCESS
91
-// *******************************************************
92 34
 //
93
-typedef struct {
94
-  EFI_CPU_IO_PROTOCOL_IO_MEM  Read;
95
-  EFI_CPU_IO_PROTOCOL_IO_MEM  Write;
96
-} EFI_CPU_IO_PROTOCOL_ACCESS;
97
-
35
+// Framework CPU IO protocol structure is the same as CPU IO 2 protocol defined in PI 1.2 spec.
36
+// However, there is a significant different between the Framework CPU I/O
37
+// Protocol and the PI 1.2 CPU I/O 2 Protocol.  The Framework one is a runtime
38
+// protocol, which means it can be used by runtime drivers after ExitBootServices().
39
+// The PI one is not runtime safe, so it is a boot services only protocol and may
40
+// not be used by runtime drivers after ExitBootServices().
98 41
 //
99
-// *******************************************************
100
-// EFI_CPU_IO_PROTOCOL
101
-// *******************************************************
102
-//
103
-/**
104
-  @par Protocol Description:
105
-  Provides the basic memory and I/O interfaces that are used to abstract
106
-  accesses to devices in a system.
107
-
108
-  @param Mem.Read
109
-  Allows reads from memory-mapped I/O space.
110
-
111
-  @param Mem.Write
112
-  Allows writes to memory-mapped I/O space.
113
-
114
-  @param Io.Read
115
-  Allows reads from I/O space.
116
-
117
-  @param Io.Write
118
-  Allows writes to I/O space.
119
-
120
-**/
121
-struct _EFI_CPU_IO_PROTOCOL {
122
-  EFI_CPU_IO_PROTOCOL_ACCESS  Mem;
123
-  EFI_CPU_IO_PROTOCOL_ACCESS  Io;
124
-};
42
+typedef EFI_CPU_IO2_PROTOCOL EFI_CPU_IO_PROTOCOL;
125 43
 
126 44
 extern EFI_GUID gEfiCpuIoProtocolGuid;
127 45
 

+ 142
- 0
src/include/ipxe/efi/Protocol/CpuIo2.h View File

@@ -0,0 +1,142 @@
1
+/** @file
2
+  This files describes the CPU I/O 2 Protocol.
3
+
4
+  This protocol provides an I/O abstraction for a system processor. This protocol
5
+  is used by a PCI root bridge I/O driver to perform memory-mapped I/O and I/O transactions.
6
+  The I/O or memory primitives can be used by the consumer of the protocol to materialize
7
+  bus-specific configuration cycles, such as the transitional configuration address and data
8
+  ports for PCI. Only drivers that require direct access to the entire system should use this
9
+  protocol.
10
+
11
+  Note: This is a boot-services only protocol and it may not be used by runtime drivers after
12
+  ExitBootServices(). It is different from the Framework CPU I/O Protocol, which is a runtime
13
+  protocol and can be used by runtime drivers after ExitBootServices().
14
+
15
+  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
16
+  This program and the accompanying materials
17
+  are licensed and made available under the terms and conditions of the BSD License
18
+  which accompanies this distribution.  The full text of the license may be found at
19
+  http://opensource.org/licenses/bsd-license.php
20
+
21
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
22
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23
+
24
+  @par Revision Reference:
25
+  This Protocol is defined in UEFI Platform Initialization Specification 1.2
26
+  Volume 5: Standards
27
+
28
+**/
29
+
30
+#ifndef __CPU_IO2_H__
31
+#define __CPU_IO2_H__
32
+
33
+#define EFI_CPU_IO2_PROTOCOL_GUID \
34
+  { \
35
+    0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} \
36
+  }
37
+
38
+typedef struct _EFI_CPU_IO2_PROTOCOL EFI_CPU_IO2_PROTOCOL;
39
+
40
+///
41
+/// Enumeration that defines the width of the I/O operation.
42
+///
43
+typedef enum {
44
+  EfiCpuIoWidthUint8,
45
+  EfiCpuIoWidthUint16,
46
+  EfiCpuIoWidthUint32,
47
+  EfiCpuIoWidthUint64,
48
+  EfiCpuIoWidthFifoUint8,
49
+  EfiCpuIoWidthFifoUint16,
50
+  EfiCpuIoWidthFifoUint32,
51
+  EfiCpuIoWidthFifoUint64,
52
+  EfiCpuIoWidthFillUint8,
53
+  EfiCpuIoWidthFillUint16,
54
+  EfiCpuIoWidthFillUint32,
55
+  EfiCpuIoWidthFillUint64,
56
+  EfiCpuIoWidthMaximum
57
+} EFI_CPU_IO_PROTOCOL_WIDTH;
58
+
59
+/**
60
+  Enables a driver to access registers in the PI CPU I/O space.
61
+
62
+  The Io.Read() and Io.Write() functions enable a driver to access PCI controller
63
+  registers in the PI CPU I/O space.
64
+
65
+  The I/O operations are carried out exactly as requested. The caller is responsible
66
+  for satisfying any alignment and I/O width restrictions that a PI System on a
67
+  platform might require. For example on some platforms, width requests of
68
+  EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will
69
+  be handled by the driver.
70
+
71
+  If Width is EfiCpuIoWidthUint8, EfiCpuIoWidthUint16, EfiCpuIoWidthUint32,
72
+  or EfiCpuIoWidthUint64, then both Address and Buffer are incremented for
73
+  each of the Count operations that is performed.
74
+
75
+  If Width is EfiCpuIoWidthFifoUint8, EfiCpuIoWidthFifoUint16,
76
+  EfiCpuIoWidthFifoUint32, or EfiCpuIoWidthFifoUint64, then only Buffer is
77
+  incremented for each of the Count operations that is performed. The read or
78
+  write operation is performed Count times on the same Address.
79
+
80
+  If Width is EfiCpuIoWidthFillUint8, EfiCpuIoWidthFillUint16,
81
+  EfiCpuIoWidthFillUint32, or EfiCpuIoWidthFillUint64, then only Address is
82
+  incremented for each of the Count operations that is performed. The read or
83
+  write operation is performed Count times from the first element of Buffer.
84
+
85
+  @param[in]       This     A pointer to the EFI_CPU_IO2_PROTOCOL instance.
86
+  @param[in]       Width    Signifies the width of the I/O or Memory operation.
87
+  @param[in]       Address  The base address of the I/O operation.
88
+  @param[in]       Count    The number of I/O operations to perform. The number
89
+                            of bytes moved is Width size * Count, starting at Address.
90
+  @param[in, out]  Buffer   For read operations, the destination buffer to store the results.
91
+                            For write operations, the source buffer from which to write data.
92
+
93
+  @retval EFI_SUCCESS            The data was read from or written to the PI system.
94
+  @retval EFI_INVALID_PARAMETER  Width is invalid for this PI system.
95
+  @retval EFI_INVALID_PARAMETER  Buffer is NULL.
96
+  @retval EFI_UNSUPPORTED        The Buffer is not aligned for the given Width.
97
+  @retval EFI_UNSUPPORTED        The address range specified by Address, Width,
98
+                                 and Count is not valid for this PI system.
99
+
100
+**/
101
+typedef
102
+EFI_STATUS
103
+(EFIAPI *EFI_CPU_IO_PROTOCOL_IO_MEM)(
104
+  IN     EFI_CPU_IO2_PROTOCOL              *This,
105
+  IN     EFI_CPU_IO_PROTOCOL_WIDTH         Width,
106
+  IN     UINT64                            Address,
107
+  IN     UINTN                             Count,
108
+  IN OUT VOID                              *Buffer
109
+  );
110
+
111
+///
112
+/// Service for read and write accesses.
113
+///
114
+typedef struct {
115
+  ///
116
+  /// This service provides the various modalities of memory and I/O read.
117
+  ///
118
+  EFI_CPU_IO_PROTOCOL_IO_MEM  Read;
119
+  ///
120
+  /// This service provides the various modalities of memory and I/O write.
121
+  ///
122
+  EFI_CPU_IO_PROTOCOL_IO_MEM  Write;
123
+} EFI_CPU_IO_PROTOCOL_ACCESS;
124
+
125
+///
126
+/// Provides the basic memory and I/O interfaces that are used to abstract
127
+/// accesses to devices in a system.
128
+///
129
+struct _EFI_CPU_IO2_PROTOCOL {
130
+  ///
131
+  /// Enables a driver to access memory-mapped registers in the EFI system memory space.
132
+  ///
133
+  EFI_CPU_IO_PROTOCOL_ACCESS  Mem;
134
+  ///
135
+  /// Enables a driver to access registers in the EFI CPU I/O space.
136
+  ///
137
+  EFI_CPU_IO_PROTOCOL_ACCESS  Io;
138
+};
139
+
140
+extern EFI_GUID gEfiCpuIo2ProtocolGuid;
141
+
142
+#endif

+ 96
- 47
src/include/ipxe/efi/Protocol/DebugSupport.h View File

@@ -5,27 +5,26 @@
5 5
   The DebugSupport protocol is used by source level debuggers to abstract the
6 6
   processor and handle context save and restore operations.
7 7
 
8
-  Copyright (c) 2006 - 2008, Intel Corporation
9
-  All rights reserved. This program and the accompanying materials
10
-  are licensed and made available under the terms and conditions of the BSD License
11
-  which accompanies this distribution.  The full text of the license may be found at
12
-  http://opensource.org/licenses/bsd-license.php
8
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9
+This program and the accompanying materials are licensed and made available under
10
+the terms and conditions of the BSD License that accompanies this distribution.
11
+The full text of the license may be found at
12
+http://opensource.org/licenses/bsd-license.php.
13 13
 
14
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 16
 
17 17
 **/
18 18
 
19 19
 #ifndef __DEBUG_SUPPORT_H__
20 20
 #define __DEBUG_SUPPORT_H__
21 21
 
22
-#include <ipxe/efi/ProcessorBind.h>
23 22
 #include <ipxe/efi/IndustryStandard/PeImage.h>
24 23
 
25 24
 typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;
26 25
 
27 26
 ///
28
-/// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}
27
+/// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}.
29 28
 ///
30 29
 #define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \
31 30
   { \
@@ -33,13 +32,14 @@ typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;
33 32
   }
34 33
 
35 34
 ///
36
-/// Debug Support definitions
35
+/// Processor exception to be hooked.
36
+/// All exception types for IA32, X64, Itanium and EBC processors are defined.
37 37
 ///
38 38
 typedef INTN  EFI_EXCEPTION_TYPE;
39 39
 
40
-//
41
-//  IA-32 processor exception types
42
-//
40
+///
41
+///  IA-32 processor exception types.
42
+///
43 43
 #define EXCEPT_IA32_DIVIDE_ERROR    0
44 44
 #define EXCEPT_IA32_DEBUG           1
45 45
 #define EXCEPT_IA32_NMI             2
@@ -59,11 +59,8 @@ typedef INTN  EFI_EXCEPTION_TYPE;
59 59
 #define EXCEPT_IA32_SIMD            19
60 60
 
61 61
 ///
62
-///  IA-32 processor context definition
63
-///
64
-///
65
-/// FXSAVE_STATE
66
-/// FP / MMX / XMM registers (see fxrstor instruction definition)
62
+/// FXSAVE_STATE.
63
+/// FP / MMX / XMM registers (see fxrstor instruction definition).
67 64
 ///
68 65
 typedef struct {
69 66
   UINT16  Fcw;
@@ -95,6 +92,9 @@ typedef struct {
95 92
   UINT8   Reserved11[14 * 16];
96 93
 } EFI_FX_SAVE_STATE_IA32;
97 94
 
95
+///
96
+///  IA-32 processor context definition.
97
+///
98 98
 typedef struct {
99 99
   UINT32                 ExceptionData;
100 100
   EFI_FX_SAVE_STATE_IA32 FxSaveState;
@@ -131,9 +131,9 @@ typedef struct {
131 131
   UINT32                 Eax;
132 132
 } EFI_SYSTEM_CONTEXT_IA32;
133 133
 
134
-//
135
-//  X64 processor exception types
136
-//
134
+///
135
+///  x64 processor exception types.
136
+///
137 137
 #define EXCEPT_X64_DIVIDE_ERROR    0
138 138
 #define EXCEPT_X64_DEBUG           1
139 139
 #define EXCEPT_X64_NMI             2
@@ -153,10 +153,8 @@ typedef struct {
153 153
 #define EXCEPT_X64_SIMD            19
154 154
 
155 155
 ///
156
-///  X64 processor context definition
157
-///
158
-/// FXSAVE_STATE
159
-/// FP / MMX / XMM registers (see fxrstor instruction definition)
156
+/// FXSAVE_STATE.
157
+/// FP / MMX / XMM registers (see fxrstor instruction definition).
160 158
 ///
161 159
 typedef struct {
162 160
   UINT16  Fcw;
@@ -188,6 +186,9 @@ typedef struct {
188 186
   UINT8   Reserved11[14 * 16];
189 187
 } EFI_FX_SAVE_STATE_X64;
190 188
 
189
+///
190
+///  x64 processor context definition.
191
+///
191 192
 typedef struct {
192 193
   UINT64                ExceptionData;
193 194
   EFI_FX_SAVE_STATE_X64 FxSaveState;
@@ -233,9 +234,9 @@ typedef struct {
233 234
   UINT64                R15;
234 235
 } EFI_SYSTEM_CONTEXT_X64;
235 236
 
236
-//
237
-//  IPF processor exception types
238
-//
237
+///
238
+///  Itanium Processor Family Exception types.
239
+///
239 240
 #define EXCEPT_IPF_VHTP_TRANSLATION       0
240 241
 #define EXCEPT_IPF_INSTRUCTION_TLB        1
241 242
 #define EXCEPT_IPF_DATA_TLB               2
@@ -279,12 +280,12 @@ typedef struct {
279 280
 #define EXCEPT_IPF_IA32_INTERRUPT 47
280 281
 
281 282
 ///
282
-///  IPF processor context definition
283
+///  IPF processor context definition.
283 284
 ///
284 285
 typedef struct {
285 286
   //
286 287
   // The first reserved field is necessary to preserve alignment for the correct
287
-  // bits in UNAT and to insure F2 is 16 byte aligned..
288
+  // bits in UNAT and to insure F2 is 16 byte aligned.
288 289
   //
289 290
   UINT64  Reserved;
290 291
   UINT64  R1;
@@ -434,27 +435,27 @@ typedef struct {
434 435
 
435 436
 } EFI_SYSTEM_CONTEXT_IPF;
436 437
 
437
-//
438
-//  EBC processor exception types
439
-//
438
+///
439
+///  EBC processor exception types.
440
+///
440 441
 #define EXCEPT_EBC_UNDEFINED            0
441 442
 #define EXCEPT_EBC_DIVIDE_ERROR         1
442 443
 #define EXCEPT_EBC_DEBUG                2
443 444
 #define EXCEPT_EBC_BREAKPOINT           3
444 445
 #define EXCEPT_EBC_OVERFLOW             4
445
-#define EXCEPT_EBC_INVALID_OPCODE       5   // opcode out of range
446
+#define EXCEPT_EBC_INVALID_OPCODE       5   ///< Opcode out of range.
446 447
 #define EXCEPT_EBC_STACK_FAULT          6
447 448
 #define EXCEPT_EBC_ALIGNMENT_CHECK      7
448
-#define EXCEPT_EBC_INSTRUCTION_ENCODING 8   // malformed instruction
449
-#define EXCEPT_EBC_BAD_BREAK            9   // BREAK 0 or undefined BREAK
450
-#define EXCEPT_EBC_STEP                 10  // to support debug stepping
449
+#define EXCEPT_EBC_INSTRUCTION_ENCODING 8   ///< Malformed instruction.
450
+#define EXCEPT_EBC_BAD_BREAK            9   ///< BREAK 0 or undefined BREAK.
451
+#define EXCEPT_EBC_STEP                 10  ///< To support debug stepping.
451 452
 ///
452 453
 /// For coding convenience, define the maximum valid EBC exception.
453 454
 ///
454 455
 #define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP
455 456
 
456 457
 ///
457
-///  EBC processor context definition
458
+///  EBC processor context definition.
458 459
 ///
459 460
 typedef struct {
460 461
   UINT64  R0;
@@ -470,14 +471,61 @@ typedef struct {
470 471
   UINT64  Ip;
471 472
 } EFI_SYSTEM_CONTEXT_EBC;
472 473
 
474
+
475
+
476
+///
477
+///  ARM processor exception types.
478
+///
479
+#define EXCEPT_ARM_RESET                    0
480
+#define EXCEPT_ARM_UNDEFINED_INSTRUCTION    1
481
+#define EXCEPT_ARM_SOFTWARE_INTERRUPT       2
482
+#define EXCEPT_ARM_PREFETCH_ABORT           3
483
+#define EXCEPT_ARM_DATA_ABORT               4
484
+#define EXCEPT_ARM_RESERVED                 5
485
+#define EXCEPT_ARM_IRQ                      6
486
+#define EXCEPT_ARM_FIQ                      7
487
+
488
+///
489
+/// For coding convenience, define the maximum valid ARM exception.
490
+///
491
+#define MAX_ARM_EXCEPTION EXCEPT_ARM_FIQ
492
+
493
+///
494
+///  ARM processor context definition.
495
+///
496
+typedef struct {
497
+  UINT32  R0;
498
+  UINT32  R1;
499
+  UINT32  R2;
500
+  UINT32  R3;
501
+  UINT32  R4;
502
+  UINT32  R5;
503
+  UINT32  R6;
504
+  UINT32  R7;
505
+  UINT32  R8;
506
+  UINT32  R9;
507
+  UINT32  R10;
508
+  UINT32  R11;
509
+  UINT32  R12;
510
+  UINT32  SP;
511
+  UINT32  LR;
512
+  UINT32  PC;
513
+  UINT32  CPSR;
514
+  UINT32  DFSR;
515
+  UINT32  DFAR;
516
+  UINT32  IFSR;
517
+  UINT32  IFAR;
518
+} EFI_SYSTEM_CONTEXT_ARM;
519
+
473 520
 ///
474
-/// Universal EFI_SYSTEM_CONTEXT definition
521
+/// Universal EFI_SYSTEM_CONTEXT definition.
475 522
 ///
476 523
 typedef union {
477 524
   EFI_SYSTEM_CONTEXT_EBC  *SystemContextEbc;
478 525
   EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
479 526
   EFI_SYSTEM_CONTEXT_X64  *SystemContextX64;
480 527
   EFI_SYSTEM_CONTEXT_IPF  *SystemContextIpf;
528
+  EFI_SYSTEM_CONTEXT_ARM  *SystemContextArm;
481 529
 } EFI_SYSTEM_CONTEXT;
482 530
 
483 531
 //
@@ -487,13 +535,13 @@ typedef union {
487 535
 /**
488 536
   Registers and enables an exception callback function for the specified exception.
489 537
 
490
-  @param  ExceptionType         Exception types in EBC, IA-32, X64, or IPF
538
+  @param  ExceptionType         Exception types in EBC, IA-32, x64, or IPF.
491 539
   @param  SystemContext         Exception content.
492 540
 
493 541
 **/
494 542
 typedef
495 543
 VOID
496
-(*EFI_EXCEPTION_CALLBACK)(
544
+(EFIAPI *EFI_EXCEPTION_CALLBACK)(
497 545
   IN     EFI_EXCEPTION_TYPE               ExceptionType,
498 546
   IN OUT EFI_SYSTEM_CONTEXT               SystemContext
499 547
   );
@@ -506,7 +554,7 @@ VOID
506 554
 **/
507 555
 typedef
508 556
 VOID
509
-(*EFI_PERIODIC_CALLBACK)(
557
+(EFIAPI *EFI_PERIODIC_CALLBACK)(
510 558
   IN OUT EFI_SYSTEM_CONTEXT               SystemContext
511 559
   );
512 560
 
@@ -514,10 +562,11 @@ VOID
514 562
 /// Machine type definition
515 563
 ///
516 564
 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
565
+  IsaIa32 = IMAGE_FILE_MACHINE_I386,           ///< 0x014C
566
+  IsaX64  = IMAGE_FILE_MACHINE_X64,            ///< 0x8664
567
+  IsaIpf  = IMAGE_FILE_MACHINE_IA64,           ///< 0x0200
568
+  IsaEbc  = IMAGE_FILE_MACHINE_EBC,            ///< 0x0EBC
569
+  IsaArm  = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED  ///< 0x01c2
521 570
 } EFI_INSTRUCTION_SET_ARCHITECTURE;
522 571
 
523 572
 
@@ -571,7 +620,7 @@ EFI_STATUS
571 620
 
572 621
   @param  This                  A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.
573 622
   @param  ProcessorIndex        Specifies which processor the callback function applies to.
574
-  @param  PeriodicCallback      A pointer to a function of type EXCEPTION_CALLBACK that is called
623
+  @param  ExceptionCallback     A pointer to a function of type EXCEPTION_CALLBACK that is called
575 624
                                 when the processor exception specified by ExceptionType occurs.
576 625
   @param  ExceptionType         Specifies which processor exception to hook.
577 626
 

+ 600
- 63
src/include/ipxe/efi/Protocol/DevicePath.h
File diff suppressed because it is too large
View File


+ 103
- 55
src/include/ipxe/efi/Protocol/DriverBinding.h View File

@@ -4,23 +4,22 @@
4 4
   This protocol is produced by every driver that follows the UEFI Driver Model,
5 5
   and it is the central component that allows drivers and controllers to be managed.
6 6
 
7
-  Copyright (c) 2006 - 2008, Intel Corporation
8
-  All rights reserved. This program and the accompanying materials
9
-  are licensed and made available under the terms and conditions of the BSD License
10
-  which accompanies this distribution.  The full text of the license may be found at
11
-  http://opensource.org/licenses/bsd-license.php
7
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
8
+This program and the accompanying materials are licensed and made available under
9
+the terms and conditions of the BSD License that accompanies this distribution.
10
+The full text of the license may be found at
11
+http://opensource.org/licenses/bsd-license.php.
12 12
 
13
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 15
 
16 16
 **/
17 17
 
18 18
 #ifndef __EFI_DRIVER_BINDING_H__
19 19
 #define __EFI_DRIVER_BINDING_H__
20 20
 
21
-#include <ipxe/efi/Protocol/DevicePath.h>
22 21
 ///
23
-/// Global ID for the ControllerHandle Driver Protocol
22
+/// The global ID for the ControllerHandle Driver Protocol.
24 23
 ///
25 24
 #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
26 25
   { \
@@ -30,22 +29,46 @@
30 29
 typedef struct _EFI_DRIVER_BINDING_PROTOCOL  EFI_DRIVER_BINDING_PROTOCOL;
31 30
 
32 31
 /**
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.
39
-
40
-  @param  This                Protocol instance pointer.
41
-  @param  ControllerHandle    Handle of device to test
42
-  @param  RemainingDevicePath Optional parameter use to pick a specific child
43
-                              device to start.
44
-
45
-  @retval EFI_SUCCESS         This driver supports this device
46
-  @retval EFI_ALREADY_STARTED This driver is already running on this device
47
-  @retval other               This driver does not support this device
48
-
32
+  Tests to see if this driver supports a given controller. If a child device is provided,
33
+  it further tests to see if this driver supports creating a handle for the specified child device.
34
+
35
+  This function checks to see if the driver specified by This supports the device specified by
36
+  ControllerHandle. Drivers will typically use the device path attached to
37
+  ControllerHandle and/or the services from the bus I/O abstraction attached to
38
+  ControllerHandle to determine if the driver supports ControllerHandle. This function
39
+  may be called many times during platform initialization. In order to reduce boot times, the tests
40
+  performed by this function must be very small, and take as little time as possible to execute. This
41
+  function must not change the state of any hardware devices, and this function must be aware that the
42
+  device specified by ControllerHandle may already be managed by the same driver or a
43
+  different driver. This function must match its calls to AllocatePages() with FreePages(),
44
+  AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
45
+  Because ControllerHandle may have been previously started by the same driver, if a protocol is
46
+  already in the opened state, then it must not be closed with CloseProtocol(). This is required
47
+  to guarantee the state of ControllerHandle is not modified by this function.
48
+
49
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
50
+  @param[in]  ControllerHandle     The handle of the controller to test. This handle
51
+                                   must support a protocol interface that supplies
52
+                                   an I/O abstraction to the driver.
53
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
54
+                                   parameter is ignored by device drivers, and is optional for bus
55
+                                   drivers. For bus drivers, if this parameter is not NULL, then
56
+                                   the bus driver must determine if the bus controller specified
57
+                                   by ControllerHandle and the child controller specified
58
+                                   by RemainingDevicePath are both supported by this
59
+                                   bus driver.
60
+
61
+  @retval EFI_SUCCESS              The device specified by ControllerHandle and
62
+                                   RemainingDevicePath is supported by the driver specified by This.
63
+  @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
64
+                                   RemainingDevicePath is already being managed by the driver
65
+                                   specified by This.
66
+  @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
67
+                                   RemainingDevicePath is already being managed by a different
68
+                                   driver or an application that requires exclusive access.
69
+                                   Currently not implemented.
70
+  @retval EFI_UNSUPPORTED          The device specified by ControllerHandle and
71
+                                   RemainingDevicePath is not supported by the driver specified by This.
49 72
 **/
50 73
 typedef
51 74
 EFI_STATUS
@@ -56,21 +79,38 @@ EFI_STATUS
56 79
   );
57 80
 
58 81
 /**
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.
65
-
66
-  @param  This                 Protocol instance pointer.
67
-  @param  ControllerHandle     Handle of device to bind driver to
68
-  @param  RemainingDevicePath  Optional parameter use to pick a specific child
69
-                               device to start.
70
-
71
-  @retval EFI_SUCCESS          This driver is added to ControllerHandle
72
-  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle
73
-  @retval other                This driver does not support this device
82
+  Starts a device controller or a bus controller.
83
+
84
+  The Start() function is designed to be invoked from the EFI boot service ConnectController().
85
+  As a result, much of the error checking on the parameters to Start() has been moved into this
86
+  common boot service. It is legal to call Start() from other locations,
87
+  but the following calling restrictions must be followed, or the system behavior will not be deterministic.
88
+  1. ControllerHandle must be a valid EFI_HANDLE.
89
+  2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
90
+     EFI_DEVICE_PATH_PROTOCOL.
91
+  3. Prior to calling Start(), the Supported() function for the driver specified by This must
92
+     have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
93
+
94
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
95
+  @param[in]  ControllerHandle     The handle of the controller to start. This handle
96
+                                   must support a protocol interface that supplies
97
+                                   an I/O abstraction to the driver.
98
+  @param[in]  RemainingDevicePath  A pointer to the remaining portion of a device path.  This
99
+                                   parameter is ignored by device drivers, and is optional for bus
100
+                                   drivers. For a bus driver, if this parameter is NULL, then handles
101
+                                   for all the children of Controller are created by this driver.
102
+                                   If this parameter is not NULL and the first Device Path Node is
103
+                                   not the End of Device Path Node, then only the handle for the
104
+                                   child device specified by the first Device Path Node of
105
+                                   RemainingDevicePath is created by this driver.
106
+                                   If the first Device Path Node of RemainingDevicePath is
107
+                                   the End of Device Path Node, no child handle is created by this
108
+                                   driver.
109
+
110
+  @retval EFI_SUCCESS              The device was started.
111
+  @retval EFI_DEVICE_ERROR         The device could not be started due to a device error.Currently not implemented.
112
+  @retval EFI_OUT_OF_RESOURCES     The request could not be completed due to a lack of resources.
113
+  @retval Others                   The driver failded to start the device.
74 114
 
75 115
 **/
76 116
 typedef
@@ -82,21 +122,29 @@ EFI_STATUS
82 122
   );
83 123
 
84 124
 /**
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.
91
-
92
-  @param  This              Protocol instance pointer.
93
-  @param  ControllerHandle  Handle of device to stop driver on
94
-  @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of
95
-                            children is zero stop the entire bus driver.
96
-  @param  ChildHandleBuffer List of Child Handles to Stop.
97
-
98
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle
99
-  @retval other             This driver was not removed from this device
125
+  Stops a device controller or a bus controller.
126
+
127
+  The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
128
+  As a result, much of the error checking on the parameters to Stop() has been moved
129
+  into this common boot service. It is legal to call Stop() from other locations,
130
+  but the following calling restrictions must be followed, or the system behavior will not be deterministic.
131
+  1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
132
+     same driver's Start() function.
133
+  2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
134
+     EFI_HANDLE. In addition, all of these handles must have been created in this driver's
135
+     Start() function, and the Start() function must have called OpenProtocol() on
136
+     ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
137
+
138
+  @param[in]  This              A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
139
+  @param[in]  ControllerHandle  A handle to the device being stopped. The handle must
140
+                                support a bus specific I/O protocol for the driver
141
+                                to use to stop the device.
142
+  @param[in]  NumberOfChildren  The number of child device handles in ChildHandleBuffer.
143
+  @param[in]  ChildHandleBuffer An array of child handles to be freed. May be NULL
144
+                                if NumberOfChildren is 0.
145
+
146
+  @retval EFI_SUCCESS           The device was stopped.
147
+  @retval EFI_DEVICE_ERROR      The device could not be stopped due to a device error.
100 148
 
101 149
 **/
102 150
 typedef

+ 35
- 18
src/include/ipxe/efi/Protocol/NetworkInterfaceIdentifier.h View File

@@ -1,27 +1,39 @@
1 1
 /** @file
2
-  EFI Network Interface Identifier Protocol
2
+  EFI Network Interface Identifier Protocol.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13
+  @par Revision Reference:
14
+  This Protocol is introduced in EFI Specification 1.10.
13 15
 
14 16
 **/
15 17
 
16 18
 #ifndef __EFI_NETWORK_INTERFACE_IDENTIFER_H__
17 19
 #define __EFI_NETWORK_INTERFACE_IDENTIFER_H__
18 20
 
19
-
21
+//
22
+// GUID retired from UEFI Specification 2.1b
23
+//
20 24
 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID \
21 25
   { \
22 26
     0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29 } \
23 27
   }
24 28
 
29
+//
30
+// GUID intruduced in UEFI Specification 2.1b
31
+//
32
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31 \
33
+  { \
34
+    0x1ACED566, 0x76ED, 0x4218, {0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 } \
35
+  }
36
+
25 37
 #define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION    0x00010000
26 38
 
27 39
 ///
@@ -30,7 +42,7 @@
30 42
 #define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION   EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_REVISION
31 43
 
32 44
 ///
33
-/// Forward reference for pure ANSI compatability
45
+/// Forward reference for pure ANSI compatability.
34 46
 ///
35 47
 typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL  EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;
36 48
 
@@ -39,22 +51,18 @@ typedef struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL  EFI_NETWORK_INTERFACE
39 51
 ///
40 52
 typedef EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL   EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;
41 53
 
42
-typedef enum {
43
-  EfiNetworkInterfaceUndi = 1
44
-} EFI_NETWORK_PROTOCOL_TYPE;
45
-
46 54
 ///
47 55
 /// An optional protocol that is used to describe details about the software
48 56
 /// layer that is used to produce the Simple Network Protocol.
49 57
 ///
50 58
 struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {
51 59
   UINT64    Revision;   ///< The revision of the EFI_NETWORK_INTERFACE_IDENTIFIER protocol.
52
-  UINT64    ID;         ///< Address of the first byte of the identifying structure for this network
60
+  UINT64    Id;         ///< The address of the first byte of the identifying structure for this network
53 61
                         ///< interface. This is only valid when the network interface is started
54 62
                         ///< (see Start()). When the network interface is not started, this field is set to zero.
55
-  UINT64    ImageAddr;  ///< Address of the first byte of the identifying structure for this
63
+  UINT64    ImageAddr;  ///< The address of the first byte of the identifying structure for this
56 64
                         ///< network interface.  This is set to zero if there is no structure.
57
-  UINT32    ImageSize;  ///< Size of unrelocated network interface image.
65
+  UINT32    ImageSize;  ///< The size of unrelocated network interface image.
58 66
   CHAR8     StringId[4];///< A four-character ASCII string that is sent in the class identifier field of
59 67
                         ///< option 60 in DHCP. For a Type of EfiNetworkInterfaceUndi, this field is UNDI.
60 68
   UINT8     Type;       ///< Network interface type. This will be set to one of the values
@@ -68,7 +76,16 @@ struct _EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL {
68 76
 
69 77
 };
70 78
 
79
+///
80
+///*******************************************************
81
+/// EFI_NETWORK_INTERFACE_TYPE
82
+///*******************************************************
83
+///
84
+typedef enum {
85
+  EfiNetworkInterfaceUndi = 1
86
+} EFI_NETWORK_INTERFACE_TYPE;
87
+
71 88
 extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid;
72 89
 extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid_31;
73 90
 
74
-#endif // _EFI_NII_H
91
+#endif

+ 46
- 7
src/include/ipxe/efi/Protocol/PciIo.h View File

@@ -2,8 +2,8 @@
2 2
   EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration,
3 3
   and DMA interfaces that a driver uses to access its PCI controller.
4 4
 
5
-  Copyright (c) 2006 - 2008, Intel Corporation
6
-  All rights reserved. This program and the accompanying materials
5
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6
+  This program and the accompanying materials
7 7
   are licensed and made available under the terms and conditions of the BSD License
8 8
   which accompanies this distribution.  The full text of the license may be found at
9 9
   http://opensource.org/licenses/bsd-license.php
@@ -27,7 +27,9 @@
27 27
 typedef struct _EFI_PCI_IO_PROTOCOL  EFI_PCI_IO_PROTOCOL;
28 28
 
29 29
 ///
30
-/// Prototypes for the PCI I/O Protocol
30
+/// *******************************************************
31
+/// EFI_PCI_IO_PROTOCOL_WIDTH
32
+/// *******************************************************
31 33
 ///
32 34
 typedef enum {
33 35
   EfiPciIoWidthUint8      = 0,
@@ -57,7 +59,7 @@ typedef enum {
57 59
 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
58 60
 #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
59 61
 #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
62
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  ///< Map a memory range so writes are combined
61 63
 #define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  ///< Enable the I/O decode bit in the PCI Config Header
62 64
 #define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  ///< Enable the Memory decode bit in the PCI Config Header
63 65
 #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  ///< Enable the DMA bit in the PCI Config Header
@@ -79,8 +81,18 @@ typedef enum {
79 81
 /// *******************************************************
80 82
 ///
81 83
 typedef enum {
84
+  ///
85
+  /// A read operation from system memory by a bus master.
86
+  ///
82 87
   EfiPciIoOperationBusMasterRead,
88
+  ///
89
+  /// A write operation from system memory by a bus master.
90
+  ///
83 91
   EfiPciIoOperationBusMasterWrite,
92
+  ///
93
+  /// Provides both read and write access to system memory by both the processor and a
94
+  /// bus master. The buffer is coherent from both the processor's and the bus master's point of view.
95
+  ///
84 96
   EfiPciIoOperationBusMasterCommonBuffer,
85 97
   EfiPciIoOperationMaximum
86 98
 } EFI_PCI_IO_PROTOCOL_OPERATION;
@@ -91,16 +103,31 @@ typedef enum {
91 103
 /// *******************************************************
92 104
 ///
93 105
 typedef enum {
106
+  ///
107
+  /// Retrieve the PCI controller's current attributes, and return them in Result.
108
+  ///
94 109
   EfiPciIoAttributeOperationGet,
110
+  ///
111
+  /// Set the PCI controller's current attributes to Attributes.
112
+  ///
95 113
   EfiPciIoAttributeOperationSet,
114
+  ///
115
+  /// Enable the attributes specified by the bits that are set in Attributes for this PCI controller.
116
+  ///
96 117
   EfiPciIoAttributeOperationEnable,
118
+  ///
119
+  /// Disable the attributes specified by the bits that are set in Attributes for this PCI controller.
120
+  ///
97 121
   EfiPciIoAttributeOperationDisable,
122
+  ///
123
+  /// Retrieve the PCI controller's supported attributes, and return them in Result.
124
+  ///
98 125
   EfiPciIoAttributeOperationSupported,
99 126
   EfiPciIoAttributeOperationMaximum
100 127
 } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
101 128
 
102 129
 /**
103
-  Reads from the memory space of a PCI controller. Returns when either the polling exit criteria is
130
+  Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is
104 131
   satisfied or after a defined duration.
105 132
 
106 133
   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
@@ -166,7 +193,13 @@ EFI_STATUS
166 193
   );
167 194
 
168 195
 typedef struct {
196
+  ///
197
+  /// Read PCI controller registers in the PCI memory or I/O space.
198
+  ///
169 199
   EFI_PCI_IO_PROTOCOL_IO_MEM  Read;
200
+  ///
201
+  /// Write PCI controller registers in the PCI memory or I/O space.
202
+  ///
170 203
   EFI_PCI_IO_PROTOCOL_IO_MEM  Write;
171 204
 } EFI_PCI_IO_PROTOCOL_ACCESS;
172 205
 
@@ -199,7 +232,13 @@ EFI_STATUS
199 232
   );
200 233
 
201 234
 typedef struct {
235
+  ///
236
+  /// Read PCI controller registers in PCI configuration space.
237
+  ///
202 238
   EFI_PCI_IO_PROTOCOL_CONFIG  Read;
239
+  ///
240
+  /// Write PCI controller registers in PCI configuration space.
241
+  ///
203 242
   EFI_PCI_IO_PROTOCOL_CONFIG  Write;
204 243
 } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
205 244
 
@@ -244,7 +283,7 @@ EFI_STATUS
244 283
   );
245 284
 
246 285
 /**
247
-  Provides the PCI controller-Cspecific addresses needed to access system memory.
286
+  Provides the PCI controller-specific addresses needed to access system memory.
248 287
 
249 288
   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
250 289
   @param  Operation             Indicates if the bus master is going to read or write to system memory.
@@ -476,7 +515,7 @@ EFI_STATUS
476 515
 
477 516
 ///
478 517
 /// 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.
518
+/// and DMA interfaces used to abstract accesses to PCI controllers.
480 519
 /// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
481 520
 /// A device driver that wishes to manage a PCI controller in a system will have to
482 521
 /// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.

+ 44
- 4
src/include/ipxe/efi/Protocol/PciRootBridgeIo.h View File

@@ -3,10 +3,10 @@
3 3
 
4 4
   PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform PCI Memory, PCI I/O,
5 5
   and PCI Configuration cycles on a PCI Root Bridge. It also provides services to perform
6
-  defferent types of bus mastering DMA
6
+  defferent types of bus mastering DMA.
7 7
 
8
-  Copyright (c) 2006 - 2008, Intel Corporation
9
-  All rights reserved. This program and the accompanying materials
8
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
9
+  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
12 12
   http://opensource.org/licenses/bsd-license.php
@@ -26,6 +26,11 @@
26 26
 
27 27
 typedef struct _EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL;
28 28
 
29
+///
30
+/// *******************************************************
31
+/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH
32
+/// *******************************************************
33
+///
29 34
 typedef enum {
30 35
   EfiPciWidthUint8,
31 36
   EfiPciWidthUint16,
@@ -42,12 +47,41 @@ typedef enum {
42 47
   EfiPciWidthMaximum
43 48
 } EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH;
44 49
 
50
+///
51
+/// *******************************************************
52
+/// EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION
53
+/// *******************************************************
54
+///
45 55
 typedef enum {
56
+  ///
57
+  /// A read operation from system memory by a bus master that is not capable of producing
58
+  /// PCI dual address cycles.
59
+  ///
46 60
   EfiPciOperationBusMasterRead,
61
+  ///
62
+  /// A write operation from system memory by a bus master that is not capable of producing
63
+  /// PCI dual address cycles.
64
+  ///
47 65
   EfiPciOperationBusMasterWrite,
66
+  ///
67
+  /// Provides both read and write access to system memory by both the processor and a bus
68
+  /// master that is not capable of producing PCI dual address cycles.
69
+  ///
48 70
   EfiPciOperationBusMasterCommonBuffer,
71
+  ///
72
+  /// A read operation from system memory by a bus master that is capable of producing PCI
73
+  /// dual address cycles.
74
+  ///
49 75
   EfiPciOperationBusMasterRead64,
76
+  ///
77
+  /// A write operation to system memory by a bus master that is capable of producing PCI
78
+  /// dual address cycles.
79
+  ///
50 80
   EfiPciOperationBusMasterWrite64,
81
+  ///
82
+  /// Provides both read and write access to system memory by both the processor and a bus
83
+  /// master that is capable of producing PCI dual address cycles.
84
+  ///
51 85
   EfiPciOperationBusMasterCommonBuffer64,
52 86
   EfiPciOperationMaximum
53 87
 } EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION;
@@ -135,7 +169,13 @@ EFI_STATUS
135 169
   );
136 170
 
137 171
 typedef struct {
172
+  ///
173
+  /// Read PCI controller registers in the PCI root bridge memory space.
174
+  ///
138 175
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM  Read;
176
+  ///
177
+  /// Write PCI controller registers in the PCI root bridge memory space.
178
+  ///
139 179
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM  Write;
140 180
 } EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS;
141 181
 
@@ -165,7 +205,7 @@ EFI_STATUS
165 205
   );
166 206
 
167 207
 /**
168
-  Provides the PCI controller-Cspecific addresses required to access system memory from a
208
+  Provides the PCI controller-specific addresses required to access system memory from a
169 209
   DMA bus master.
170 210
 
171 211
   @param  This                  A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.

+ 96
- 27
src/include/ipxe/efi/Protocol/SimpleNetwork.h View File

@@ -1,5 +1,6 @@
1 1
 /** @file
2
-  Simple Network protocol as defined in the UEFI 2.0 specification.
2
+  The EFI_SIMPLE_NETWORK_PROTOCOL provides services to initialize a network interface,
3
+  transmit packets, receive packets, and close a network interface.
3 4
 
4 5
   Basic network device abstraction.
5 6
 
@@ -8,14 +9,17 @@
8 9
   MCast - MultiCast
9 10
   ...
10 11
 
11
-  Copyright (c) 2006 - 2008, Intel Corporation
12
-  All rights reserved. This program and the accompanying materials
13
-  are licensed and made available under the terms and conditions of the BSD License
14
-  which accompanies this distribution.  The full text of the license may be found at
15
-  http://opensource.org/licenses/bsd-license.php
12
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
13
+This program and the accompanying materials are licensed and made available under
14
+the terms and conditions of the BSD License that accompanies this distribution.
15
+The full text of the license may be found at
16
+http://opensource.org/licenses/bsd-license.php.
16 17
 
17
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
19
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20
+
21
+  @par Revision Reference:
22
+  This Protocol is introduced in EFI Specification 1.10.
19 23
 
20 24
 **/
21 25
 
@@ -36,7 +40,7 @@ typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL  EFI_SIMPLE_NETWORK_PROTOCOL;
36 40
 typedef EFI_SIMPLE_NETWORK_PROTOCOL   EFI_SIMPLE_NETWORK;
37 41
 
38 42
 ///
39
-/// Simple Network Protocol data structures
43
+/// Simple Network Protocol data structures.
40 44
 ///
41 45
 typedef struct {
42 46
   ///
@@ -119,6 +123,11 @@ typedef struct {
119 123
 
120 124
 } EFI_NETWORK_STATISTICS;
121 125
 
126
+///
127
+/// The state of the network interface.
128
+/// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a
129
+/// network interface, the network interface is left in the EfiSimpleNetworkStopped state.
130
+///
122 131
 typedef enum {
123 132
   EfiSimpleNetworkStopped,
124 133
   EfiSimpleNetworkStarted,
@@ -139,24 +148,84 @@ typedef enum {
139 148
 
140 149
 #define MAX_MCAST_FILTER_CNT                              16
141 150
 typedef struct {
151
+  ///
152
+  /// Reports the current state of the network interface.
153
+  ///
142 154
   UINT32          State;
155
+  ///
156
+  /// The size, in bytes, of the network interface's HW address.
157
+  ///
143 158
   UINT32          HwAddressSize;
159
+  ///
160
+  /// The size, in bytes, of the network interface's media header.
161
+  ///
144 162
   UINT32          MediaHeaderSize;
163
+  ///
164
+  /// The maximum size, in bytes, of the packets supported by the network interface.
165
+  ///
145 166
   UINT32          MaxPacketSize;
167
+  ///
168
+  /// The size, in bytes, of the NVRAM device attached to the network interface.
169
+  ///
146 170
   UINT32          NvRamSize;
171
+  ///
172
+  /// The size that must be used for all NVRAM reads and writes. The
173
+  /// start address for NVRAM read and write operations and the total
174
+  /// length of those operations, must be a multiple of this value. The
175
+  /// legal values for this field are 0, 1, 2, 4, and 8.
176
+  ///
147 177
   UINT32          NvRamAccessSize;
178
+  ///
179
+  /// The multicast receive filter settings supported by the network interface.
180
+  ///
148 181
   UINT32          ReceiveFilterMask;
182
+  ///
183
+  /// The current multicast receive filter settings.
184
+  ///
149 185
   UINT32          ReceiveFilterSetting;
186
+  ///
187
+  /// The maximum number of multicast address receive filters supported by the driver.
188
+  ///
150 189
   UINT32          MaxMCastFilterCount;
190
+  ///
191
+  /// The current number of multicast address receive filters.
192
+  ///
151 193
   UINT32          MCastFilterCount;
194
+  ///
195
+  /// Array containing the addresses of the current multicast address receive filters.
196
+  ///
152 197
   EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
198
+  ///
199
+  /// The current HW MAC address for the network interface.
200
+  ///
153 201
   EFI_MAC_ADDRESS CurrentAddress;
202
+  ///
203
+  /// The current HW MAC address for broadcast packets.
204
+  ///
154 205
   EFI_MAC_ADDRESS BroadcastAddress;
206
+  ///
207
+  /// The permanent HW MAC address for the network interface.
208
+  ///
155 209
   EFI_MAC_ADDRESS PermanentAddress;
210
+  ///
211
+  /// The interface type of the network interface.
212
+  ///
156 213
   UINT8           IfType;
214
+  ///
215
+  /// TRUE if the HW MAC address can be changed.
216
+  ///
157 217
   BOOLEAN         MacAddressChangeable;
218
+  ///
219
+  /// TRUE if the network interface can transmit more than one packet at a time.
220
+  ///
158 221
   BOOLEAN         MultipleTxSupported;
222
+  ///
223
+  /// TRUE if the presence of media can be determined; otherwise FALSE.
224
+  ///
159 225
   BOOLEAN         MediaPresentSupported;
226
+  ///
227
+  /// TRUE if media are connected to the network interface; otherwise FALSE.
228
+  ///
160 229
   BOOLEAN         MediaPresent;
161 230
 } EFI_SIMPLE_NETWORK_MODE;
162 231
 
@@ -204,7 +273,7 @@ EFI_STATUS
204 273
   required by the network interface; optionally, also requests allocation
205 274
   of additional transmit and receive buffers.
206 275
 
207
-  @param  This              Protocol instance pointer.
276
+  @param  This              The protocol instance pointer.
208 277
   @param  ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
209 278
                             that the driver should allocate for the network interface.
210 279
                             Some network interfaces will not be able to use the extra
@@ -217,9 +286,9 @@ EFI_STATUS
217 286
                             being used.
218 287
 
219 288
   @retval EFI_SUCCESS           The network interface was initialized.
220
-  @retval EFI_NOT_STARTED       The network interface has not been started
289
+  @retval EFI_NOT_STARTED       The network interface has not been started.
221 290
   @retval EFI_OUT_OF_RESOURCES  There was not enough memory for the transmit and
222
-                                receive buffers.   .
291
+                                receive buffers.
223 292
   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
224 293
   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
225 294
   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
@@ -237,13 +306,13 @@ EFI_STATUS
237 306
   Resets a network adapter and re-initializes it with the parameters that were
238 307
   provided in the previous call to Initialize().
239 308
 
240
-  @param  This                 Protocol instance pointer.
309
+  @param  This                 The protocol instance pointer.
241 310
   @param  ExtendedVerification Indicates that the driver may perform a more
242 311
                                exhaustive verification operation of the device
243 312
                                during reset.
244 313
 
245 314
   @retval EFI_SUCCESS           The network interface was reset.
246
-  @retval EFI_NOT_STARTED       The network interface has not been started
315
+  @retval EFI_NOT_STARTED       The network interface has not been started.
247 316
   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
248 317
   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
249 318
   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
@@ -263,7 +332,7 @@ EFI_STATUS
263 332
   @param  This Protocol instance pointer.
264 333
 
265 334
   @retval EFI_SUCCESS           The network interface was shutdown.
266
-  @retval EFI_NOT_STARTED       The network interface has not been started
335
+  @retval EFI_NOT_STARTED       The network interface has not been started.
267 336
   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
268 337
   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
269 338
   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
@@ -278,7 +347,7 @@ EFI_STATUS
278 347
 /**
279 348
   Manages the multicast receive filters of a network interface.
280 349
 
281
-  @param  This             Protocol instance pointer.
350
+  @param  This             The protocol instance pointer.
282 351
   @param  Enable           A bit mask of receive filters to enable on the network interface.
283 352
   @param  Disable          A bit mask of receive filters to disable on the network interface.
284 353
   @param  ResetMCastFilter Set to TRUE to reset the contents of the multicast receive
@@ -293,7 +362,7 @@ EFI_STATUS
293 362
                            ResetMCastFilter is TRUE.
294 363
 
295 364
   @retval EFI_SUCCESS           The multicast receive filter list was updated.
296
-  @retval EFI_NOT_STARTED       The network interface has not been started
365
+  @retval EFI_NOT_STARTED       The network interface has not been started.
297 366
   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
298 367
   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
299 368
   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
@@ -313,13 +382,13 @@ EFI_STATUS
313 382
 /**
314 383
   Modifies or resets the current station address, if supported.
315 384
 
316
-  @param  This  Protocol instance pointer.
385
+  @param  This  The protocol instance pointer.
317 386
   @param  Reset Flag used to reset the station address to the network interfaces
318 387
                 permanent address.
319
-  @param  New   New station address to be used for the network interface.
388
+  @param  New   The new station address to be used for the network interface.
320 389
 
321 390
   @retval EFI_SUCCESS           The network interfaces station address was updated.
322
-  @retval EFI_NOT_STARTED       The network interface has not been started
391
+  @retval EFI_NOT_STARTED       The network interface has not been started.
323 392
   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
324 393
   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
325 394
   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
@@ -366,7 +435,7 @@ EFI_STATUS
366 435
 /**
367 436
   Converts a multicast IP address to a multicast HW MAC address.
368 437
 
369
-  @param  This Protocol instance pointer.
438
+  @param  This The protocol instance pointer.
370 439
   @param  IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
371 440
                to FALSE if the multicast IP address is IPv4 [RFC 791].
372 441
   @param  IP   The multicast IP address that is to be converted to a multicast
@@ -397,7 +466,7 @@ EFI_STATUS
397 466
   Performs read and write operations on the NVRAM device attached to a
398 467
   network interface.
399 468
 
400
-  @param  This       Protocol instance pointer.
469
+  @param  This       The protocol instance pointer.
401 470
   @param  ReadWrite  TRUE for read operations, FALSE for write operations.
402 471
   @param  Offset     Byte offset in the NVRAM device at which to start the read or
403 472
                      write operation. This must be a multiple of NvRamAccessSize and
@@ -427,7 +496,7 @@ EFI_STATUS
427 496
   Reads the current interrupt status and recycled transmit buffer status from
428 497
   a network interface.
429 498
 
430
-  @param  This            Protocol instance pointer.
499
+  @param  This            The protocol instance pointer.
431 500
   @param  InterruptStatus A pointer to the bit mask of the currently active interrupts
432 501
                           If this is NULL, the interrupt status will not be read from
433 502
                           the device. If this is not NULL, the interrupt status will
@@ -459,7 +528,7 @@ EFI_STATUS
459 528
 /**
460 529
   Places a packet in the transmit queue of a network interface.
461 530
 
462
-  @param  This       Protocol instance pointer.
531
+  @param  This       The protocol instance pointer.
463 532
   @param  HeaderSize The size, in bytes, of the media header to be filled in by
464 533
                      the Transmit() function. If HeaderSize is non-zero, then it
465 534
                      must be equal to This->Mode->MediaHeaderSize and the DestAddr
@@ -474,7 +543,7 @@ EFI_STATUS
474 543
   @param  SrcAddr    The source HW MAC address. If HeaderSize is zero, then this parameter
475 544
                      is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
476 545
                      This->Mode->CurrentAddress is used for the source HW MAC address.
477
-  @param  DsetAddr   The destination HW MAC address. If HeaderSize is zero, then this
546
+  @param  DestAddr   The destination HW MAC address. If HeaderSize is zero, then this
478 547
                      parameter is ignored.
479 548
   @param  Protocol   The type of header to build. If HeaderSize is zero, then this
480 549
                      parameter is ignored. See RFC 1700, section "Ether Types", for
@@ -504,7 +573,7 @@ EFI_STATUS
504 573
 /**
505 574
   Receives a packet from a network interface.
506 575
 
507
-  @param  This       Protocol instance pointer.
576
+  @param  This       The protocol instance pointer.
508 577
   @param  HeaderSize The size, in bytes, of the media header received on the network
509 578
                      interface. If this parameter is NULL, then the media header size
510 579
                      will not be returned.
@@ -515,7 +584,7 @@ EFI_STATUS
515 584
   @param  SrcAddr    The source HW MAC address. If this parameter is NULL, the
516 585
                      HW MAC source address will not be extracted from the media
517 586
                      header.
518
-  @param  DsetAddr   The destination HW MAC address. If this parameter is NULL,
587
+  @param  DestAddr   The destination HW MAC address. If this parameter is NULL,
519 588
                      the HW MAC destination address will not be extracted from the
520 589
                      media header.
521 590
   @param  Protocol   The media header type. If this parameter is NULL, then the

+ 15
- 16
src/include/ipxe/efi/Protocol/SimpleTextIn.h View File

@@ -1,11 +1,11 @@
1 1
 /** @file
2
-  Simple Text In protocol from the UEFI 2.0 specification.
2
+  Simple Text Input protocol from the UEFI 2.0 specification.
3 3
 
4 4
   Abstraction of a very simple input device like a keyboard or serial
5 5
   terminal.
6 6
 
7
-  Copyright (c) 2006 - 2008, Intel Corporation
8
-  All rights reserved. This program and the accompanying materials
7
+  Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
8
+  This program and the accompanying materials
9 9
   are licensed and made available under the terms and conditions of the BSD License
10 10
   which accompanies this distribution.  The full text of the license may be found at
11 11
   http://opensource.org/licenses/bsd-license.php
@@ -18,27 +18,26 @@
18 18
 #ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__
19 19
 #define __SIMPLE_TEXT_IN_PROTOCOL_H__
20 20
 
21
-#include <ipxe/efi/ProcessorBind.h>
22
-
23 21
 #define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
24 22
   { \
25 23
     0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
26 24
   }
27 25
 
26
+typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
27
+
28 28
 ///
29
-/// Protocol GUID defined in EFI1.1.
29
+/// Protocol GUID name defined in EFI1.1.
30 30
 ///
31 31
 #define SIMPLE_INPUT_PROTOCOL   EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
32 32
 
33
-typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
34
-
35 33
 ///
36
-/// Backward-compatible with EFI1.1.
34
+/// Protocol name in EFI1.1 for backward-compatible.
37 35
 ///
38 36
 typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  SIMPLE_INPUT_INTERFACE;
39
-//
40
-// Data structures
41
-//
37
+
38
+///
39
+/// The keystroke information for the key that was pressed.
40
+///
42 41
 typedef struct {
43 42
   UINT16  ScanCode;
44 43
   CHAR16  UnicodeChar;
@@ -82,7 +81,7 @@ typedef struct {
82 81
 #define SCAN_ESC        0x0017
83 82
 
84 83
 /**
85
-  Reset the input device and optionaly run diagnostics
84
+  Reset the input device and optionally run diagnostics
86 85
 
87 86
   @param  This                 Protocol instance pointer.
88 87
   @param  ExtendedVerification Driver may perform diagnostics on reset.
@@ -100,14 +99,14 @@ EFI_STATUS
100 99
 
101 100
 /**
102 101
   Reads the next keystroke from the input device. The WaitForKey Event can
103
-  be used to test for existance of a keystroke via WaitForEvent () call.
102
+  be used to test for existence of a keystroke via WaitForEvent () call.
104 103
 
105 104
   @param  This Protocol instance pointer.
106 105
   @param  Key  Driver may perform diagnostics on reset.
107 106
 
108 107
   @retval EFI_SUCCESS      The keystroke information was returned.
109
-  @retval EFI_NOT_READY    There was no keystroke data availiable.
110
-  @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to
108
+  @retval EFI_NOT_READY    There was no keystroke data available.
109
+  @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
111 110
                            hardware errors.
112 111
 
113 112
 **/

+ 49
- 49
src/include/ipxe/efi/Protocol/SimpleTextOut.h View File

@@ -3,17 +3,17 @@
3 3
 
4 4
   Abstraction of a very simple text based output device like VGA text mode or
5 5
   a serial terminal. The Simple Text Out protocol instance can represent
6
-  a single hardware device or a virtual device that is an agregation
6
+  a single hardware device or a virtual device that is an aggregation
7 7
   of multiple physical devices.
8 8
 
9
-  Copyright (c) 2006 - 2008, Intel Corporation
10
-  All rights reserved. This program and the accompanying materials
11
-  are licensed and made available under the terms and conditions of the BSD License
12
-  which accompanies this distribution.  The full text of the license may be found at
13
-  http://opensource.org/licenses/bsd-license.php
9
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
10
+This program and the accompanying materials are licensed and made available under
11
+the terms and conditions of the BSD License that accompanies this distribution.
12
+The full text of the license may be found at
13
+http://opensource.org/licenses/bsd-license.php.
14 14
 
15
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 17
 
18 18
 **/
19 19
 
@@ -137,18 +137,18 @@ typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   SIMPLE_TEXT_OUTPUT_INTERFACE;
137 137
 
138 138
 //
139 139
 // We currently define attributes from 0 - 7F for color manipulations
140
-// To internally handle the local display characteristics for a particular character, we are defining
141
-// Bit 7 to signify the local glyph representation for a character.  If turned on, glyphs will be
140
+// To internally handle the local display characteristics for a particular character,
141
+// Bit 7 signifies the local glyph representation for a character.  If turned on, glyphs will be
142 142
 // pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
143 143
 // If bit 7 is off, the narrow glyph database will be used.  This does NOT affect information that is sent to
144
-// non-local displays (e.g. serial or LAN consoles).
144
+// non-local displays, such as serial or LAN consoles.
145 145
 //
146 146
 #define EFI_WIDE_ATTRIBUTE  0x80
147 147
 
148 148
 /**
149 149
   Reset the text output device hardware and optionaly run diagnostics
150 150
 
151
-  @param  This                 Protocol instance pointer.
151
+  @param  This                 The protocol instance pointer.
152 152
   @param  ExtendedVerification Driver may perform more exhaustive verfication
153 153
                                operation of the device during reset.
154 154
 
@@ -165,12 +165,12 @@ EFI_STATUS
165 165
   );
166 166
 
167 167
 /**
168
-  Write a Unicode string to the output device.
168
+  Write a string to the output device.
169 169
 
170
-  @param  This   Protocol instance pointer.
171
-  @param  String The NULL-terminated Unicode string to be displayed on the output
170
+  @param  This   The protocol instance pointer.
171
+  @param  String The NULL-terminated string to be displayed on the output
172 172
                  device(s). All output devices must also support the Unicode
173
-                 drawing defined in this file.
173
+                 drawing character codes defined in this file.
174 174
 
175 175
   @retval EFI_SUCCESS             The string was output to the device.
176 176
   @retval EFI_DEVICE_ERROR        The device reported an error while attempting to output
@@ -178,7 +178,7 @@ EFI_STATUS
178 178
   @retval EFI_UNSUPPORTED         The output device's mode is not currently in a
179 179
                                   defined text mode.
180 180
   @retval EFI_WARN_UNKNOWN_GLYPH  This warning code indicates that some of the
181
-                                  characters in the Unicode string could not be
181
+                                  characters in the string could not be
182 182
                                   rendered and were skipped.
183 183
 
184 184
 **/
@@ -190,15 +190,15 @@ EFI_STATUS
190 190
   );
191 191
 
192 192
 /**
193
-  Verifies that all characters in a Unicode string can be output to the
193
+  Verifies that all characters in a string can be output to the
194 194
   target device.
195 195
 
196
-  @param  This   Protocol instance pointer.
197
-  @param  String The NULL-terminated Unicode string to be examined for the output
196
+  @param  This   The protocol instance pointer.
197
+  @param  String The NULL-terminated string to be examined for the output
198 198
                  device(s).
199 199
 
200 200
   @retval EFI_SUCCESS      The device(s) are capable of rendering the output string.
201
-  @retval EFI_UNSUPPORTED  Some of the characters in the Unicode string cannot be
201
+  @retval EFI_UNSUPPORTED  Some of the characters in the string cannot be
202 202
                            rendered by one or more of the output devices mapped
203 203
                            by the EFI handle.
204 204
 
@@ -214,7 +214,7 @@ EFI_STATUS
214 214
   Returns information for an available text mode that the output device(s)
215 215
   supports.
216 216
 
217
-  @param  This       Protocol instance pointer.
217
+  @param  This       The protocol instance pointer.
218 218
   @param  ModeNumber The mode number to return information on.
219 219
   @param  Columns    Returns the geometry of the text output device for the
220 220
                      requested ModeNumber.
@@ -238,7 +238,7 @@ EFI_STATUS
238 238
 /**
239 239
   Sets the output device(s) to a specified mode.
240 240
 
241
-  @param  This       Protocol instance pointer.
241
+  @param  This       The protocol instance pointer.
242 242
   @param  ModeNumber The mode number to set.
243 243
 
244 244
   @retval EFI_SUCCESS      The requested text mode was set.
@@ -257,14 +257,14 @@ EFI_STATUS
257 257
   Sets the background and foreground colors for the OutputString () and
258 258
   ClearScreen () functions.
259 259
 
260
-  @param  This      Protocol instance pointer.
260
+  @param  This      The protocol instance pointer.
261 261
   @param  Attribute The attribute to set. Bits 0..3 are the foreground color, and
262 262
                     bits 4..6 are the background color. All other bits are undefined
263 263
                     and must be zero. The valid Attributes are defined in this file.
264 264
 
265
-  @retval EFI_SUCCESS     The attribute was set.
266
-  @retval EFI_DEVICE_     ERROR The device had an error and could not complete the request.
267
-  @retval EFI_UNSUPPORTED The attribute requested is not defined.
265
+  @retval EFI_SUCCESS       The attribute was set.
266
+  @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
267
+  @retval EFI_UNSUPPORTED   The attribute requested is not defined.
268 268
 
269 269
 **/
270 270
 typedef
@@ -278,7 +278,7 @@ EFI_STATUS
278 278
   Clears the output device(s) display to the currently selected background
279 279
   color.
280 280
 
281
-  @param  This              Protocol instance pointer.
281
+  @param  This              The protocol instance pointer.
282 282
 
283 283
   @retval  EFI_SUCCESS      The operation completed successfully.
284 284
   @retval  EFI_DEVICE_ERROR The device had an error and could not complete the request.
@@ -294,7 +294,7 @@ EFI_STATUS
294 294
 /**
295 295
   Sets the current coordinates of the cursor position
296 296
 
297
-  @param  This        Protocol instance pointer.
297
+  @param  This        The protocol instance pointer.
298 298
   @param  Column      The position to set the cursor to. Must be greater than or
299 299
                       equal to zero and less than the number of columns and rows
300 300
                       by QueryMode ().
@@ -319,7 +319,7 @@ EFI_STATUS
319 319
 /**
320 320
   Makes the cursor visible or invisible
321 321
 
322
-  @param  This    Protocol instance pointer.
322
+  @param  This    The protocol instance pointer.
323 323
   @param  Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
324 324
                   set to be invisible.
325 325
 
@@ -340,36 +340,36 @@ EFI_STATUS
340 340
 /**
341 341
   @par Data Structure Description:
342 342
   Mode Structure pointed to by Simple Text Out protocol.
343
-
344
-  @param MaxMode
345
-  The number of modes supported by QueryMode () and SetMode ().
346
-
347
-  @param Mode
348
-  The text mode of the output device(s).
349
-
350
-  @param Attribute
351
-  The current character output attribute
352
-
353
-  @param CursorColumn
354
-  The cursor's column.
355
-
356
-  @param CursorRow
357
-  The cursor's row.
358
-
359
-  @param CursorVisible
360
-  The cursor is currently visbile or not.
361
-
362 343
 **/
363 344
 typedef struct {
345
+  ///
346
+  /// The number of modes supported by QueryMode () and SetMode ().
347
+  ///
364 348
   INT32   MaxMode;
365 349
 
366 350
   //
367 351
   // current settings
368 352
   //
353
+
354
+  ///
355
+  /// The text mode of the output device(s).
356
+  ///
369 357
   INT32   Mode;
358
+  ///
359
+  /// The current character output attribute.
360
+  ///
370 361
   INT32   Attribute;
362
+  ///
363
+  /// The cursor's column.
364
+  ///
371 365
   INT32   CursorColumn;
366
+  ///
367
+  /// The cursor's row.
368
+  ///
372 369
   INT32   CursorRow;
370
+  ///
371
+  /// The cursor is currently visbile or not.
372
+  ///
373 373
   BOOLEAN CursorVisible;
374 374
 } EFI_SIMPLE_TEXT_OUTPUT_MODE;
375 375
 

+ 5
- 5
src/include/ipxe/efi/Uefi.h View File

@@ -6,11 +6,11 @@
6 6
   types defined via this include file and can be ported easily to any
7 7
   environment.
8 8
 
9
-Copyright (c) 2006 - 2007, Intel Corporation
10
-All rights reserved. This program and the accompanying materials
11
-are licensed and made available under the terms and conditions of the BSD License
12
-which accompanies this distribution.  The full text of the license may be found at
13
-http://opensource.org/licenses/bsd-license.php
9
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
10
+This program and the accompanying materials are licensed and made available under
11
+the terms and conditions of the BSD License that accompanies this distribution.
12
+The full text of the license may be found at
13
+http://opensource.org/licenses/bsd-license.php.
14 14
 
15 15
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 16
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+ 98
- 35
src/include/ipxe/efi/Uefi/UefiBaseType.h View File

@@ -1,14 +1,14 @@
1 1
 /** @file
2 2
   Defines data types and constants introduced in UEFI.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
 **/
14 14
 
@@ -18,7 +18,7 @@
18 18
 #include <ipxe/efi/Base.h>
19 19
 
20 20
 //
21
-// Basical data type definitions introduced in UEFI.
21
+// Basic data type definitions introduced in UEFI.
22 22
 //
23 23
 
24 24
 ///
@@ -26,7 +26,7 @@
26 26
 ///
27 27
 typedef GUID                      EFI_GUID;
28 28
 ///
29
-/// Function return status for EFI API
29
+/// Function return status for EFI API.
30 30
 ///
31 31
 typedef RETURN_STATUS             EFI_STATUS;
32 32
 ///
@@ -45,12 +45,20 @@ typedef UINTN                     EFI_TPL;
45 45
 /// Logical block address.
46 46
 ///
47 47
 typedef UINT64                    EFI_LBA;
48
+
49
+///
50
+/// 64-bit physical memory address.
51
+///
48 52
 typedef UINT64                    EFI_PHYSICAL_ADDRESS;
53
+
54
+///
55
+/// 64-bit virtual memory address.
56
+///
49 57
 typedef UINT64                    EFI_VIRTUAL_ADDRESS;
50 58
 
51 59
 ///
52 60
 /// EFI Time Abstraction:
53
-///  Year:       1998 - 20XX
61
+///  Year:       1900 - 9999
54 62
 ///  Month:      1 - 12
55 63
 ///  Day:        1 - 31
56 64
 ///  Hour:       0 - 23
@@ -82,7 +90,7 @@ typedef struct {
82 90
 } EFI_IPv4_ADDRESS;
83 91
 
84 92
 ///
85
-/// 16-byte buffer. An IPv6 internet protocol address
93
+/// 16-byte buffer. An IPv6 internet protocol address.
86 94
 ///
87 95
 typedef struct {
88 96
   UINT8 Addr[16];
@@ -106,9 +114,9 @@ typedef union {
106 114
 } EFI_IP_ADDRESS;
107 115
 
108 116
 
109
-//
110
-// Enumeration of EFI_STATUS.
111
-//
117
+///
118
+/// Enumeration of EFI_STATUS.
119
+///@{
112 120
 #define EFI_SUCCESS               RETURN_SUCCESS
113 121
 #define EFI_LOAD_ERROR            RETURN_LOAD_ERROR
114 122
 #define EFI_INVALID_PARAMETER     RETURN_INVALID_PARAMETER
@@ -145,27 +153,31 @@ typedef union {
145 153
 #define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE
146 154
 #define EFI_WARN_WRITE_FAILURE    RETURN_WARN_WRITE_FAILURE
147 155
 #define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
156
+///@}
148 157
 
149
-
150
-//
151
-// Define macro to encode the status code.
152
-//
158
+///
159
+/// Define macro to encode the status code.
160
+///
153 161
 #define EFIERR(_a)                ENCODE_ERROR(_a)
154 162
 
155 163
 #define EFI_ERROR(A)              RETURN_ERROR(A)
156 164
 
157
-//
158
-// Define macros to build data structure signatures from characters.
159
-//
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)
163
-
164
-
165 165
 ///
166
-///  Returns the byte offset to a field within a structure
166
+/// ICMP error definitions
167
+///@{
168
+#define EFI_NETWORK_UNREACHABLE   EFIERR(100)
169
+#define EFI_HOST_UNREACHABLE      EFIERR(101)
170
+#define EFI_PROTOCOL_UNREACHABLE  EFIERR(102)
171
+#define EFI_PORT_UNREACHABLE      EFIERR(103)
172
+///@}
173
+
167 174
 ///
168
-#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
175
+/// Tcp connection status definitions
176
+///@{
177
+#define EFI_CONNECTION_FIN        EFIERR(104)
178
+#define EFI_CONNECTION_RESET      EFIERR(105)
179
+#define EFI_CONNECTION_REFUSED    EFIERR(106)
180
+///@}
169 181
 
170 182
 //
171 183
 // The EFI memory allocation functions work in units of EFI_PAGEs that are
@@ -180,21 +192,72 @@ typedef union {
180 192
 
181 193
 #define EFI_PAGES_TO_SIZE(a)   ( (a) << EFI_PAGE_SHIFT)
182 194
 
195
+///
196
+/// PE32+ Machine type for IA32 UEFI images.
197
+///
198
+#define EFI_IMAGE_MACHINE_IA32            0x014C
199
+
200
+///
201
+/// PE32+ Machine type for IA64 UEFI images.
202
+///
203
+#define EFI_IMAGE_MACHINE_IA64            0x0200
183 204
 
184
-#define EFI_MAX_BIT               MAX_BIT
185
-#define EFI_MAX_ADDRESS           MAX_ADDRESS
205
+///
206
+/// PE32+ Machine type for EBC UEFI images.
207
+///
208
+#define EFI_IMAGE_MACHINE_EBC             0x0EBC
186 209
 
210
+///
211
+/// PE32+ Machine type for X64 UEFI images.
212
+///
213
+#define EFI_IMAGE_MACHINE_X64             0x8664
187 214
 
188 215
 ///
189
-/// Limited buffer size for a language code recommended by RFC3066
190
-/// (42 characters plus a NULL terminator)
216
+/// PE32+ Machine type for ARM mixed ARM and Thumb/Thumb2 images.
191 217
 ///
192
-#define RFC_3066_ENTRY_SIZE             (42 + 1)
218
+#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED  0x01C2
219
+
220
+
221
+#if   defined (MDE_CPU_IA32)
222
+
223
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
224
+  (((Machine) == EFI_IMAGE_MACHINE_IA32) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
225
+
226
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64)
227
+
228
+#elif defined (MDE_CPU_IPF)
229
+
230
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
231
+  (((Machine) == EFI_IMAGE_MACHINE_IA64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
232
+
233
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
234
+
235
+#elif defined (MDE_CPU_X64)
236
+
237
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
238
+  (((Machine) == EFI_IMAGE_MACHINE_X64) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
239
+
240
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
241
+
242
+#elif defined (MDE_CPU_ARM)
243
+
244
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
245
+  (((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
246
+
247
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
248
+
249
+#elif defined (MDE_CPU_EBC)
193 250
 
194 251
 ///
195
-/// The size of a 3 character ISO639 language code.
252
+/// This is just to make sure you can cross compile with the EBC compiler.
253
+/// It does not make sense to have a PE loader coded in EBC.
196 254
 ///
197
-#define ISO_639_2_ENTRY_SIZE            3
255
+#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_EBC)
198 256
 
257
+#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
258
+
259
+#else
260
+#error Unknown Processor Type
261
+#endif
199 262
 
200 263
 #endif

+ 86
- 12
src/include/ipxe/efi/Uefi/UefiGpt.h View File

@@ -1,14 +1,14 @@
1 1
 /** @file
2 2
   EFI Guid Partition Table Format Definition.
3 3
 
4
-  Copyright (c) 2006 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
 **/
14 14
 
@@ -20,39 +20,113 @@
20 20
 /// located in LBA 1 (i.e., the second logical block).
21 21
 ///
22 22
 #define PRIMARY_PART_HEADER_LBA 1
23
-
24 23
 ///
25
-/// EFI Partition Table Signature: "EFI PART"
24
+/// EFI Partition Table Signature: "EFI PART".
26 25
 ///
27
-#define EFI_PTAB_HEADER_ID      0x5452415020494645ULL
26
+#define EFI_PTAB_HEADER_ID      SIGNATURE_64 ('E','F','I',' ','P','A','R','T')
28 27
 
29 28
 #pragma pack(1)
30 29
 
31 30
 ///
32
-/// GPT Partition Table Header
31
+/// GPT Partition Table Header.
33 32
 ///
34 33
 typedef struct {
34
+  ///
35
+  /// The table header for the GPT partition Table.
36
+  /// This header contains EFI_PTAB_HEADER_ID.
37
+  ///
35 38
   EFI_TABLE_HEADER  Header;
39
+  ///
40
+  /// The LBA that contains this data structure.
41
+  ///
36 42
   EFI_LBA           MyLBA;
43
+  ///
44
+  /// LBA address of the alternate GUID Partition Table Header.
45
+  ///
37 46
   EFI_LBA           AlternateLBA;
47
+  ///
48
+  /// The first usable logical block that may be used
49
+  /// by a partition described by a GUID Partition Entry.
50
+  ///
38 51
   EFI_LBA           FirstUsableLBA;
52
+  ///
53
+  /// The last usable logical block that may be used
54
+  /// by a partition described by a GUID Partition Entry.
55
+  ///
39 56
   EFI_LBA           LastUsableLBA;
57
+  ///
58
+  /// GUID that can be used to uniquely identify the disk.
59
+  ///
40 60
   EFI_GUID          DiskGUID;
61
+  ///
62
+  /// The starting LBA of the GUID Partition Entry array.
63
+  ///
41 64
   EFI_LBA           PartitionEntryLBA;
65
+  ///
66
+  /// The number of Partition Entries in the GUID Partition Entry array.
67
+  ///
42 68
   UINT32            NumberOfPartitionEntries;
69
+  ///
70
+  /// The size, in bytes, of each the GUID Partition
71
+  /// Entry structures in the GUID Partition Entry
72
+  /// array. Must be a multiple of 8.
73
+  ///
43 74
   UINT32            SizeOfPartitionEntry;
75
+  ///
76
+  /// The CRC32 of the GUID Partition Entry array.
77
+  /// Starts at PartitionEntryLBA and is
78
+  /// computed over a byte length of
79
+  /// NumberOfPartitionEntries * SizeOfPartitionEntry.
80
+  ///
44 81
   UINT32            PartitionEntryArrayCRC32;
45 82
 } EFI_PARTITION_TABLE_HEADER;
46 83
 
47 84
 ///
48
-/// GPT Partition Entry
85
+/// GPT Partition Entry.
49 86
 ///
50 87
 typedef struct {
88
+  ///
89
+  /// Unique ID that defines the purpose and type of this Partition. A value of
90
+  /// zero defines that this partition entry is not being used.
91
+  ///
51 92
   EFI_GUID  PartitionTypeGUID;
93
+  ///
94
+  /// GUID that is unique for every partition entry. Every partition ever
95
+  /// created will have a unique GUID.
96
+  /// This GUID must be assigned when the GUID Partition Entry is created.
97
+  ///
52 98
   EFI_GUID  UniquePartitionGUID;
99
+  ///
100
+  /// Starting LBA of the partition defined by this entry
101
+  ///
53 102
   EFI_LBA   StartingLBA;
103
+  ///
104
+  /// Ending LBA of the partition defined by this entry.
105
+  ///
54 106
   EFI_LBA   EndingLBA;
107
+  ///
108
+  /// Attribute bits, all bits reserved by UEFI
109
+  /// Bit 0:      If this bit is set, the partition is required for the platform to function. The owner/creator of the
110
+  ///             partition indicates that deletion or modification of the contents can result in loss of platform
111
+  ///             features or failure for the platform to boot or operate. The system cannot function normally if
112
+  ///             this partition is removed, and it should be considered part of the hardware of the system.
113
+  ///             Actions such as running diagnostics, system recovery, or even OS install or boot, could
114
+  ///             potentially stop working if this partition is removed. Unless OS software or firmware
115
+  ///             recognizes this partition, it should never be removed or modified as the UEFI firmware or
116
+  ///             platform hardware may become non-functional.
117
+  /// Bit 1:      If this bit is set firmware must not produce an EFI_BLOCK_IO_PROTOCOL device for
118
+  ///             this partition. By not producing EFI_BLOCK_IO_PROTOCOL partition, file system
119
+  ///             mappings will not be created for this partition in UEFI.
120
+  /// Bits 2-47:  Undefined and must be zero. Reserved for expansion by future versions of the UEFI
121
+  ///             specification.
122
+  /// Bits 48-63: Reserved for GUID specific use. The use of these bits will vary depending on the
123
+  ///             PartitionTypeGUID. Only the owner of the PartitionTypeGUID is allowed
124
+  ///             to modify these bits. They must be preserved if Bits 0-47 are modified..
125
+  ///
55 126
   UINT64    Attributes;
127
+  ///
128
+  /// Null-terminated name of the partition.
129
+  ///
56 130
   CHAR16    PartitionName[36];
57 131
 } EFI_PARTITION_ENTRY;
58 132
 

+ 516
- 40
src/include/ipxe/efi/Uefi/UefiInternalFormRepresentation.h View File

@@ -3,23 +3,25 @@
3 3
   IFR is primarily consumed by the EFI presentation engine, and produced by EFI
4 4
   internal application and drivers as well as all add-in card option-ROM drivers
5 5
 
6
-  Copyright (c) 2006 - 2008, Intel Corporation
7
-  All rights reserved. This program and the accompanying materials
8
-  are licensed and made available under the terms and conditions of the BSD License
9
-  which accompanies this distribution.  The full text of the license may be found at
10
-  http://opensource.org/licenses/bsd-license.php
6
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7
+This program and the accompanying materials are licensed and made available under
8
+the terms and conditions of the BSD License that accompanies this distribution.
9
+The full text of the license may be found at
10
+http://opensource.org/licenses/bsd-license.php.
11 11
 
12
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 14
 
15 15
   @par Revision Reference:
16
-  These definitions are from UEFI2.1.
16
+  These definitions are from UEFI 2.1 and 2.2.
17 17
 
18 18
 **/
19 19
 
20 20
 #ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
21 21
 #define __UEFI_INTERNAL_FORMREPRESENTATION_H__
22 22
 
23
+#include <ipxe/efi/Guid/HiiFormMapMethodGuid.h>
24
+
23 25
 ///
24 26
 /// The following types are currently defined:
25 27
 ///
@@ -30,6 +32,7 @@ typedef UINT16  EFI_QUESTION_ID;
30 32
 typedef UINT16  EFI_STRING_ID;
31 33
 typedef UINT16  EFI_FORM_ID;
32 34
 typedef UINT16  EFI_VARSTORE_ID;
35
+typedef UINT16  EFI_ANIMATION_ID;
33 36
 
34 37
 typedef UINT16  EFI_DEFAULT_ID;
35 38
 
@@ -73,34 +76,76 @@ typedef struct {
73 76
 #define EFI_HII_PACKAGE_SIMPLE_FONTS         0x07
74 77
 #define EFI_HII_PACKAGE_DEVICE_PATH          0x08
75 78
 #define EFI_HII_PACKAGE_KEYBOARD_LAYOUT      0x09
79
+#define EFI_HII_PACKAGE_ANIMATIONS           0x0A
76 80
 #define EFI_HII_PACKAGE_END                  0xDF
77 81
 #define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN    0xE0
78 82
 #define EFI_HII_PACKAGE_TYPE_SYSTEM_END      0xFF
79 83
 
80 84
 //
81 85
 // Definitions for Simplified Font Package
82
-// Section 27.3.2
83 86
 //
84 87
 
85
-//
86
-// Contents of EFI_NARROW_GLYPH.Attributes
87
-//
88
+///
89
+/// Contents of EFI_NARROW_GLYPH.Attributes.
90
+///@{
88 91
 #define EFI_GLYPH_NON_SPACING                0x01
89 92
 #define EFI_GLYPH_WIDE                       0x02
90 93
 #define EFI_GLYPH_HEIGHT                     19
91 94
 #define EFI_GLYPH_WIDTH                      8
95
+///@}
92 96
 
97
+///
98
+/// The EFI_NARROW_GLYPH has a preferred dimension (w x h) of 8 x 19 pixels.
99
+///
93 100
 typedef struct {
101
+  ///
102
+  /// The Unicode representation of the glyph. The term weight is the
103
+  /// technical term for a character code.
104
+  ///
94 105
   CHAR16                 UnicodeWeight;
106
+  ///
107
+  /// The data element containing the glyph definitions.
108
+  ///
95 109
   UINT8                  Attributes;
110
+  ///
111
+  /// The column major glyph representation of the character. Bits
112
+  /// with values of one indicate that the corresponding pixel is to be
113
+  /// on when normally displayed; those with zero are off.
114
+  ///
96 115
   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
97 116
 } EFI_NARROW_GLYPH;
98 117
 
118
+///
119
+/// The EFI_WIDE_GLYPH has a preferred dimension (w x h) of 16 x 19 pixels, which is large enough
120
+/// to accommodate logographic characters.
121
+///
99 122
 typedef struct {
123
+  ///
124
+  /// The Unicode representation of the glyph. The term weight is the
125
+  /// technical term for a character code.
126
+  ///
100 127
   CHAR16                 UnicodeWeight;
128
+  ///
129
+  /// The data element containing the glyph definitions.
130
+  ///
101 131
   UINT8                  Attributes;
132
+  ///
133
+  /// The column major glyph representation of the character. Bits
134
+  /// with values of one indicate that the corresponding pixel is to be
135
+  /// on when normally displayed; those with zero are off.
136
+  ///
102 137
   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
138
+  ///
139
+  /// The column major glyph representation of the character. Bits
140
+  /// with values of one indicate that the corresponding pixel is to be
141
+  /// on when normally displayed; those with zero are off.
142
+  ///
103 143
   UINT8                  GlyphCol2[EFI_GLYPH_HEIGHT];
144
+  ///
145
+  /// Ensures that sizeof (EFI_WIDE_GLYPH) is twice the
146
+  /// sizeof (EFI_NARROW_GLYPH). The contents of Pad must
147
+  /// be zero.
148
+  ///
104 149
   UINT8                  Pad[3];
105 150
 } EFI_WIDE_GLYPH;
106 151
 
@@ -142,7 +187,7 @@ typedef struct _EFI_HII_GLYPH_INFO {
142 187
 } EFI_HII_GLYPH_INFO;
143 188
 
144 189
 ///
145
-/// The fixed header consists of a standard record header and
190
+/// The fixed header consists of a standard record header,
146 191
 /// then the character values in this section, the flags
147 192
 /// (including the encoding method) and the offsets of the glyph
148 193
 /// information, the glyph bitmaps and the character map.
@@ -255,10 +300,10 @@ typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
255 300
 /// The device path package is used to carry a device path
256 301
 /// associated with the package list.
257 302
 ///
258
-typedef struct _EFI_HII_DEVICE_PATH_PACKAGE {
303
+typedef struct _EFI_HII_DEVICE_PATH_PACKAGE_HDR {
259 304
   EFI_HII_PACKAGE_HEADER   Header;
260 305
   // EFI_DEVICE_PATH_PROTOCOL DevicePath[];
261
-} EFI_HII_DEVICE_PATH_PACKAGE;
306
+} EFI_HII_DEVICE_PATH_PACKAGE_HDR;
262 307
 
263 308
 //
264 309
 // Definitions for GUID Package
@@ -279,8 +324,8 @@ typedef struct _EFI_HII_GUID_PACKAGE_HDR {
279 324
 // Section 27.3.6
280 325
 //
281 326
 
282
-#define UEFI_CONFIG_LANG  L"x-UEFI"
283
-#define UEFI_CONFIG_LANG2 L"x-i-UEFI"
327
+#define UEFI_CONFIG_LANG   "x-UEFI"
328
+#define UEFI_CONFIG_LANG_2 "x-i-UEFI"
284 329
 
285 330
 ///
286 331
 /// The fixed header consists of a standard record header and then the string identifiers
@@ -593,13 +638,13 @@ typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
593 638
 //
594 639
 
595 640
 ///
596
-/// The Forms package is used to carry forms-based encoding data.
641
+/// The Form package is used to carry form-based encoding data.
597 642
 ///
598
-typedef struct _EFI_HII_FORM_PACKAGE {
643
+typedef struct _EFI_HII_FORM_PACKAGE_HDR {
599 644
   EFI_HII_PACKAGE_HEADER       Header;
600 645
   // EFI_IFR_OP_HEADER         OpCodeHeader;
601 646
   // More op-codes follow
602
-} EFI_HII_FORM_PACKAGE;
647
+} EFI_HII_FORM_PACKAGE_HDR;
603 648
 
604 649
 typedef struct {
605 650
   UINT8 Hour;
@@ -621,7 +666,8 @@ typedef union {
621 666
   BOOLEAN         b;
622 667
   EFI_HII_TIME    time;
623 668
   EFI_HII_DATE    date;
624
-  EFI_STRING_ID   string;
669
+  EFI_STRING_ID   string; ///< EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION
670
+  // UINT8 buffer[];      ///< EFI_IFR_TYPE_ORDERED_LIST
625 671
 } EFI_IFR_TYPE_VALUE;
626 672
 
627 673
 //
@@ -657,8 +703,10 @@ typedef union {
657 703
 #define EFI_IFR_STRING_OP              0x1C
658 704
 #define EFI_IFR_REFRESH_OP             0x1D
659 705
 #define EFI_IFR_DISABLE_IF_OP          0x1E
706
+#define EFI_IFR_ANIMATION_OP           0x1F
660 707
 #define EFI_IFR_TO_LOWER_OP            0x20
661 708
 #define EFI_IFR_TO_UPPER_OP            0x21
709
+#define EFI_IFR_MAP_OP                 0x22
662 710
 #define EFI_IFR_ORDERED_LIST_OP        0x23
663 711
 #define EFI_IFR_VARSTORE_OP            0x24
664 712
 #define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
@@ -667,6 +715,10 @@ typedef union {
667 715
 #define EFI_IFR_VERSION_OP             0x28
668 716
 #define EFI_IFR_END_OP                 0x29
669 717
 #define EFI_IFR_MATCH_OP               0x2A
718
+#define EFI_IFR_GET_OP                 0x2B
719
+#define EFI_IFR_SET_OP                 0x2C
720
+#define EFI_IFR_READ_OP                0x2D
721
+#define EFI_IFR_WRITE_OP               0x2E
670 722
 #define EFI_IFR_EQUAL_OP               0x2F
671 723
 #define EFI_IFR_NOT_EQUAL_OP           0x30
672 724
 #define EFI_IFR_GREATER_THAN_OP        0x31
@@ -713,8 +765,10 @@ typedef union {
713 765
 #define EFI_IFR_VALUE_OP               0x5A
714 766
 #define EFI_IFR_DEFAULT_OP             0x5B
715 767
 #define EFI_IFR_DEFAULTSTORE_OP        0x5C
768
+#define EFI_IFR_FORM_MAP_OP            0x5D
716 769
 #define EFI_IFR_CATENATE_OP            0x5E
717 770
 #define EFI_IFR_GUID_OP                0x5F
771
+#define EFI_IFR_SECURITY_OP            0x60
718 772
 
719 773
 //
720 774
 // Definitions of IFR Standard Headers
@@ -800,6 +854,8 @@ typedef struct _EFI_IFR_FORM_SET {
800 854
   EFI_GUID                 Guid;
801 855
   EFI_STRING_ID            FormSetTitle;
802 856
   EFI_STRING_ID            Help;
857
+  UINT8                    Flags;
858
+  // EFI_GUID              ClassGuid[];
803 859
 } EFI_IFR_FORM_SET;
804 860
 
805 861
 typedef struct _EFI_IFR_END {
@@ -892,7 +948,7 @@ typedef struct _EFI_IFR_REF4 {
892 948
 
893 949
 typedef struct _EFI_IFR_RESET_BUTTON {
894 950
   EFI_IFR_OP_HEADER        Header;
895
-  EFI_IFR_QUESTION_HEADER  Question;
951
+  EFI_IFR_STATEMENT_HEADER Statement;
896 952
   EFI_DEFAULT_ID           DefaultId;
897 953
 } EFI_IFR_RESET_BUTTON;
898 954
 
@@ -1073,6 +1129,9 @@ typedef struct _EFI_IFR_ONE_OF_OPTION {
1073 1129
 #define EFI_IFR_TYPE_DATE              0x06
1074 1130
 #define EFI_IFR_TYPE_STRING            0x07
1075 1131
 #define EFI_IFR_TYPE_OTHER             0x08
1132
+#define EFI_IFR_TYPE_UNDEFINED         0x09
1133
+#define EFI_IFR_TYPE_ACTION            0x0A
1134
+#define EFI_IFR_TYPE_BUFFER            0x0B
1076 1135
 
1077 1136
 #define EFI_IFR_OPTION_DEFAULT         0x10
1078 1137
 #define EFI_IFR_OPTION_DEFAULT_MFG     0x20
@@ -1099,12 +1158,12 @@ typedef struct _EFI_IFR_EQ_ID_VAL {
1099 1158
   UINT16                   Value;
1100 1159
 } EFI_IFR_EQ_ID_VAL;
1101 1160
 
1102
-typedef struct _EFI_IFR_EQ_ID_LIST {
1161
+typedef struct _EFI_IFR_EQ_ID_VAL_LIST {
1103 1162
   EFI_IFR_OP_HEADER        Header;
1104 1163
   EFI_QUESTION_ID          QuestionId;
1105 1164
   UINT16                   ListLength;
1106 1165
   UINT16                   ValueList[1];
1107
-} EFI_IFR_EQ_ID_LIST;
1166
+} EFI_IFR_EQ_ID_VAL_LIST;
1108 1167
 
1109 1168
 typedef struct _EFI_IFR_UINT8 {
1110 1169
   EFI_IFR_OP_HEADER        Header;
@@ -1212,25 +1271,28 @@ typedef struct _EFI_IFR_TO_BOOLEAN {
1212 1271
   EFI_IFR_OP_HEADER        Header;
1213 1272
 } EFI_IFR_TO_BOOLEAN;
1214 1273
 
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
-//
1274
+///
1275
+/// For EFI_IFR_TO_STRING, when converting from
1276
+/// unsigned integers, these flags control the format:
1277
+/// 0 = unsigned decimal.
1278
+/// 1 = signed decimal.
1279
+/// 2 = hexadecimal (lower-case alpha).
1280
+/// 3 = hexadecimal (upper-case alpha).
1281
+///@{
1223 1282
 #define EFI_IFR_STRING_UNSIGNED_DEC      0
1224 1283
 #define EFI_IFR_STRING_SIGNED_DEC        1
1225 1284
 #define EFI_IFR_STRING_LOWERCASE_HEX     2
1226 1285
 #define EFI_IFR_STRING_UPPERCASE_HEX     3
1227
-//
1228
-// When converting from a buffer, these flags control the format:
1229
-// 0 = ASCII
1230
-// 8 = Unicode
1231
-//
1286
+///@}
1287
+
1288
+///
1289
+/// When converting from a buffer, these flags control the format:
1290
+/// 0 = ASCII.
1291
+/// 8 = Unicode.
1292
+///@{
1232 1293
 #define EFI_IFR_STRING_ASCII             0
1233 1294
 #define EFI_IFR_STRING_UNICODE           8
1295
+///@}
1234 1296
 
1235 1297
 typedef struct _EFI_IFR_TO_STRING {
1236 1298
   EFI_IFR_OP_HEADER        Header;
@@ -1360,12 +1422,119 @@ typedef struct _EFI_IFR_SPAN {
1360 1422
   UINT8                    Flags;
1361 1423
 } EFI_IFR_SPAN;
1362 1424
 
1425
+typedef struct _EFI_IFR_SECURITY {
1426
+  ///
1427
+  /// Standard opcode header, where Header.Op = EFI_IFR_SECURITY_OP.
1428
+  ///
1429
+  EFI_IFR_OP_HEADER        Header;
1430
+  ///
1431
+  /// Security permission level.
1432
+  ///
1433
+  EFI_GUID                 Permissions;
1434
+} EFI_IFR_SECURITY;
1435
+
1436
+typedef struct _EFI_IFR_FORM_MAP_METHOD {
1437
+  ///
1438
+  /// The string identifier which provides the human-readable name of
1439
+  /// the configuration method for this standards map form.
1440
+  ///
1441
+  EFI_STRING_ID            MethodTitle;
1442
+  ///
1443
+  /// Identifier which uniquely specifies the configuration methods
1444
+  /// associated with this standards map form.
1445
+  ///
1446
+  EFI_GUID                 MethodIdentifier;
1447
+} EFI_IFR_FORM_MAP_METHOD;
1448
+
1449
+typedef struct _EFI_IFR_FORM_MAP {
1450
+  ///
1451
+  /// The sequence that defines the type of opcode as well as the length
1452
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
1453
+  ///
1454
+  EFI_IFR_OP_HEADER        Header;
1455
+  ///
1456
+  /// The unique identifier for this particular form.
1457
+  ///
1458
+  EFI_FORM_ID              FormId;
1459
+  ///
1460
+  /// One or more configuration method's name and unique identifier.
1461
+  ///
1462
+  // EFI_IFR_FORM_MAP_METHOD  Methods[];
1463
+} EFI_IFR_FORM_MAP;
1464
+
1465
+typedef struct _EFI_IFR_SET {
1466
+  ///
1467
+  /// The sequence that defines the type of opcode as well as the length
1468
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
1469
+  ///
1470
+  EFI_IFR_OP_HEADER  Header;
1471
+  ///
1472
+  /// Specifies the identifier of a previously declared variable store to
1473
+  /// use when storing the question's value.
1474
+  ///
1475
+  EFI_VARSTORE_ID    VarStoreId;
1476
+  union {
1477
+    ///
1478
+    /// A 16-bit Buffer Storage offset.
1479
+    ///
1480
+    EFI_STRING_ID    VarName;
1481
+    ///
1482
+    /// A Name Value or EFI Variable name (VarName).
1483
+    ///
1484
+    UINT16           VarOffset;
1485
+  }                  VarStoreInfo;
1486
+  ///
1487
+  /// Specifies the type used for storage.
1488
+  ///
1489
+  UINT8              VarStoreType;
1490
+} EFI_IFR_SET;
1491
+
1492
+typedef struct _EFI_IFR_GET {
1493
+  ///
1494
+  /// The sequence that defines the type of opcode as well as the length
1495
+  /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
1496
+  ///
1497
+  EFI_IFR_OP_HEADER  Header;
1498
+  ///
1499
+  /// Specifies the identifier of a previously declared variable store to
1500
+  /// use when retrieving the value.
1501
+  ///
1502
+  EFI_VARSTORE_ID    VarStoreId;
1503
+  union {
1504
+    ///
1505
+    /// A 16-bit Buffer Storage offset.
1506
+    ///
1507
+    EFI_STRING_ID    VarName;
1508
+    ///
1509
+    /// A Name Value or EFI Variable name (VarName).
1510
+    ///
1511
+    UINT16           VarOffset;
1512
+  }                  VarStoreInfo;
1513
+  ///
1514
+  /// Specifies the type used for storage.
1515
+  ///
1516
+  UINT8              VarStoreType;
1517
+} EFI_IFR_GET;
1518
+
1519
+typedef struct _EFI_IFR_READ {
1520
+  EFI_IFR_OP_HEADER       Header;
1521
+} EFI_IFR_READ;
1522
+
1523
+typedef struct _EFI_IFR_WRITE {
1524
+  EFI_IFR_OP_HEADER      Header;
1525
+} EFI_IFR_WRITE;
1526
+
1527
+typedef struct _EFI_IFR_MAP {
1528
+  EFI_IFR_OP_HEADER      Header;
1529
+} EFI_IFR_MAP;
1363 1530
 //
1364 1531
 // Definitions for Keyboard Package
1365
-// Section 27.3.9
1366 1532
 // Releated definitions are in Section of EFI_HII_DATABASE_PROTOCOL
1367 1533
 //
1368 1534
 
1535
+///
1536
+/// Each enumeration values maps a physical key on a keyboard.
1537
+///
1369 1538
 typedef enum {
1370 1539
   EfiKeyLCtrl,
1371 1540
   EfiKeyA0,
@@ -1475,11 +1644,31 @@ typedef enum {
1475 1644
 } EFI_KEY;
1476 1645
 
1477 1646
 typedef struct {
1647
+  ///
1648
+  /// Used to describe a physical key on a keyboard.
1649
+  ///
1478 1650
   EFI_KEY                 Key;
1651
+  ///
1652
+  /// Unicode character code for the Key.
1653
+  ///
1479 1654
   CHAR16                  Unicode;
1655
+  ///
1656
+  /// Unicode character code for the key with the shift key being held down.
1657
+  ///
1480 1658
   CHAR16                  ShiftedUnicode;
1659
+  ///
1660
+  /// Unicode character code for the key with the Alt-GR being held down.
1661
+  ///
1481 1662
   CHAR16                  AltGrUnicode;
1663
+  ///
1664
+  /// Unicode character code for the key with the Alt-GR and shift keys being held down.
1665
+  ///
1482 1666
   CHAR16                  ShiftedAltGrUnicode;
1667
+  ///
1668
+  /// Modifier keys are defined to allow for special functionality that is not necessarily
1669
+  /// accomplished by a printable character. Many of these modifier keys are flags to toggle
1670
+  /// certain state bits on and off inside of a keyboard driver.
1671
+  ///
1483 1672
   UINT16                  Modifier;
1484 1673
   UINT16                  AffectedAttribute;
1485 1674
 } EFI_KEY_DESCRIPTOR;
@@ -1493,7 +1682,7 @@ typedef struct {
1493 1682
 ///
1494 1683
 /// This key is affected by the caps lock so that if a keyboard driver
1495 1684
 /// would need to disambiguate between a key which had a "1" defined
1496
-/// versus a "a" character.  Having this bit turned on would tell
1685
+/// versus an "a" character.  Having this bit turned on would tell
1497 1686
 /// the keyboard driver to use the appropriate shifted state or not.
1498 1687
 ///
1499 1688
 #define EFI_AFFECTED_BY_CAPS_LOCK            0x0002
@@ -1559,7 +1748,7 @@ typedef struct {
1559 1748
 //
1560 1749
 // Keys that have multiple control functions based on modifier
1561 1750
 // settings are handled in the keyboard driver implementation.
1562
-// For instance PRINT_KEY might have a modifier held down and
1751
+// For instance, PRINT_KEY might have a modifier held down and
1563 1752
 // is still a nonprinting character, but might have an alternate
1564 1753
 // control function like SYSREQUEST
1565 1754
 //
@@ -1573,6 +1762,293 @@ typedef struct {
1573 1762
 #define EFI_RIGHT_LOGO_MODIFIER          0x0028
1574 1763
 #define EFI_MENU_MODIFIER                0x0029
1575 1764
 
1765
+///
1766
+/// Animation IFR opcode
1767
+///
1768
+typedef struct _EFI_IFR_ANIMATION {
1769
+  ///
1770
+  /// Standard opcode header, where Header.OpCode is
1771
+  /// EFI_IFR_ANIMATION_OP.
1772
+  ///
1773
+  EFI_IFR_OP_HEADER        Header;
1774
+  ///
1775
+  /// Animation identifier in the HII database.
1776
+  ///
1777
+  EFI_ANIMATION_ID         Id;
1778
+} EFI_IFR_ANIMATION;
1779
+
1780
+///
1781
+/// HII animation package header.
1782
+///
1783
+typedef struct _EFI_HII_ANIMATION_PACKAGE_HDR {
1784
+  ///
1785
+  /// Standard package header, where Header.Type = EFI_HII_PACKAGE_ANIMATIONS.
1786
+  ///
1787
+  EFI_HII_PACKAGE_HEADER  Header;
1788
+  ///
1789
+  /// Offset, relative to this header, of the animation information. If
1790
+  /// this is zero, then there are no animation sequences in the package.
1791
+  ///
1792
+  UINT32                  AnimationInfoOffset;
1793
+} EFI_HII_ANIMATION_PACKAGE_HDR;
1794
+
1795
+///
1796
+/// Animation information is encoded as a series of blocks,
1797
+/// with each block prefixed by a single byte header EFI_HII_ANIMATION_BLOCK.
1798
+///
1799
+typedef struct _EFI_HII_ANIMATION_BLOCK {
1800
+  UINT8  BlockType;
1801
+  //UINT8  BlockBody[];
1802
+} EFI_HII_ANIMATION_BLOCK;
1803
+
1804
+///
1805
+/// Animation block types.
1806
+///
1807
+#define EFI_HII_AIBT_END                 0x00
1808
+#define EFI_HII_AIBT_OVERLAY_IMAGES      0x10
1809
+#define EFI_HII_AIBT_CLEAR_IMAGES        0x11
1810
+#define EFI_HII_AIBT_RESTORE_SCRN        0x12
1811
+#define EFI_HII_AIBT_OVERLAY_IMAGES_LOOP 0x18
1812
+#define EFI_HII_AIBT_CLEAR_IMAGES_LOOP   0x19
1813
+#define EFI_HII_AIBT_RESTORE_SCRN_LOOP   0x1A
1814
+#define EFI_HII_AIBT_DUPLICATE           0x20
1815
+#define EFI_HII_AIBT_SKIP2               0x21
1816
+#define EFI_HII_AIBT_SKIP1               0x22
1817
+#define EFI_HII_AIBT_EXT1                0x30
1818
+#define EFI_HII_AIBT_EXT2                0x31
1819
+#define EFI_HII_AIBT_EXT4                0x32
1820
+
1821
+///
1822
+/// Extended block headers used for variable sized animation records
1823
+/// which need an explicit length.
1824
+///
1825
+
1826
+typedef struct _EFI_HII_AIBT_EXT1_BLOCK  {
1827
+  ///
1828
+  /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT1.
1829
+  ///
1830
+  EFI_HII_ANIMATION_BLOCK  Header;
1831
+  ///
1832
+  /// The block type.
1833
+  ///
1834
+  UINT8                    BlockType2;
1835
+  ///
1836
+  /// Size of the animation block, in bytes, including the animation block header.
1837
+  ///
1838
+  UINT8                    Length;
1839
+} EFI_HII_AIBT_EXT1_BLOCK;
1840
+
1841
+typedef struct _EFI_HII_AIBT_EXT2_BLOCK {
1842
+  ///
1843
+  /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT2.
1844
+  ///
1845
+  EFI_HII_ANIMATION_BLOCK  Header;
1846
+  ///
1847
+  /// The block type
1848
+  ///
1849
+  UINT8                    BlockType2;
1850
+  ///
1851
+  /// Size of the animation block, in bytes, including the animation block header.
1852
+  ///
1853
+  UINT16                   Length;
1854
+} EFI_HII_AIBT_EXT2_BLOCK;
1855
+
1856
+typedef struct _EFI_HII_AIBT_EXT4_BLOCK {
1857
+  ///
1858
+  /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT4.
1859
+  ///
1860
+  EFI_HII_ANIMATION_BLOCK  Header;
1861
+  ///
1862
+  /// The block type
1863
+  ///
1864
+  UINT8                    BlockType2;
1865
+  ///
1866
+  /// Size of the animation block, in bytes, including the animation block header.
1867
+  ///
1868
+  UINT32                   Length;
1869
+} EFI_HII_AIBT_EXT4_BLOCK;
1870
+
1871
+typedef struct _EFI_HII_ANIMATION_CELL {
1872
+  ///
1873
+  /// The X offset from the upper left hand corner of the logical
1874
+  /// window to position the indexed image.
1875
+  ///
1876
+  UINT16                    OffsetX;
1877
+  ///
1878
+  /// The Y offset from the upper left hand corner of the logical
1879
+  /// window to position the indexed image.
1880
+  ///
1881
+  UINT16                    OffsetY;
1882
+  ///
1883
+  /// The image to display at the specified offset from the upper left
1884
+  /// hand corner of the logical window.
1885
+  ///
1886
+  EFI_IMAGE_ID              ImageId;
1887
+  ///
1888
+  /// The number of milliseconds to delay after displaying the indexed
1889
+  /// image and before continuing on to the next linked image.  If value
1890
+  /// is zero, no delay.
1891
+  ///
1892
+  UINT16                    Delay;
1893
+} EFI_HII_ANIMATION_CELL;
1894
+
1895
+///
1896
+/// An animation block to describe an animation sequence that does not cycle, and
1897
+/// where one image is simply displayed over the previous image.
1898
+///
1899
+typedef struct _EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK {
1900
+  ///
1901
+  /// This is image that is to be reference by the image protocols, if the
1902
+  /// animation function is not supported or disabled. This image can
1903
+  /// be one particular image from the animation sequence (if any one
1904
+  /// of the animation frames has a complete image) or an alternate
1905
+  /// image that can be displayed alone. If the value is zero, no image
1906
+  /// is displayed.
1907
+  ///
1908
+  EFI_IMAGE_ID            DftImageId;
1909
+  ///
1910
+  /// The overall width of the set of images (logical window width).
1911
+  ///
1912
+  UINT16                  Width;
1913
+  ///
1914
+  /// The overall height of the set of images (logical window height).
1915
+  ///
1916
+  UINT16                  Height;
1917
+  ///
1918
+  /// The number of EFI_HII_ANIMATION_CELL contained in the
1919
+  /// animation sequence.
1920
+  ///
1921
+  UINT16                  CellCount;
1922
+  ///
1923
+  /// An array of CellCount animation cells.
1924
+  ///
1925
+  EFI_HII_ANIMATION_CELL  AnimationCell[1];
1926
+} EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK;
1927
+
1928
+///
1929
+/// An animation block to describe an animation sequence that does not cycle,
1930
+/// and where the logical window is cleared to the specified color before
1931
+/// the next image is displayed.
1932
+///
1933
+typedef struct _EFI_HII_AIBT_CLEAR_IMAGES_BLOCK {
1934
+  ///
1935
+  /// This is image that is to be reference by the image protocols, if the
1936
+  /// animation function is not supported or disabled. This image can
1937
+  /// be one particular image from the animation sequence (if any one
1938
+  /// of the animation frames has a complete image) or an alternate
1939
+  /// image that can be displayed alone. If the value is zero, no image
1940
+  /// is displayed.
1941
+  ///
1942
+  EFI_IMAGE_ID       DftImageId;
1943
+  ///
1944
+  /// The overall width of the set of images (logical window width).
1945
+  ///
1946
+  UINT16             Width;
1947
+  ///
1948
+  /// The overall height of the set of images (logical window height).
1949
+  ///
1950
+  UINT16             Height;
1951
+  ///
1952
+  /// The number of EFI_HII_ANIMATION_CELL contained in the
1953
+  /// animation sequence.
1954
+  ///
1955
+  UINT16             CellCount;
1956
+  ///
1957
+  /// The color to clear the logical window to before displaying the
1958
+  /// indexed image.
1959
+  ///
1960
+  EFI_HII_RGB_PIXEL  BackgndColor;
1961
+  ///
1962
+  /// An array of CellCount animation cells.
1963
+  ///
1964
+  EFI_HII_ANIMATION_CELL AnimationCell[1];
1965
+} EFI_HII_AIBT_CLEAR_IMAGES_BLOCK;
1966
+
1967
+///
1968
+/// An animation block to describe an animation sequence that does not cycle,
1969
+/// and where the screen is restored to the original state before the next
1970
+/// image is displayed.
1971
+///
1972
+typedef struct _EFI_HII_AIBT_RESTORE_SCRN_BLOCK {
1973
+  ///
1974
+  /// This is image that is to be reference by the image protocols, if the
1975
+  /// animation function is not supported or disabled. This image can
1976
+  /// be one particular image from the animation sequence (if any one
1977
+  /// of the animation frames has a complete image) or an alternate
1978
+  /// image that can be displayed alone. If the value is zero, no image
1979
+  /// is displayed.
1980
+  ///
1981
+  EFI_IMAGE_ID            DftImageId;
1982
+  ///
1983
+  /// The overall width of the set of images (logical window width).
1984
+  ///
1985
+  UINT16                  Width;
1986
+  ///
1987
+  /// The overall height of the set of images (logical window height).
1988
+  ///
1989
+  UINT16                  Height;
1990
+  ///
1991
+  /// The number of EFI_HII_ANIMATION_CELL contained in the
1992
+  /// animation sequence.
1993
+  ///
1994
+  UINT16                  CellCount;
1995
+  ///
1996
+  /// An array of CellCount animation cells.
1997
+  ///
1998
+  EFI_HII_ANIMATION_CELL  AnimationCell[1];
1999
+} EFI_HII_AIBT_RESTORE_SCRN_BLOCK;
2000
+
2001
+///
2002
+/// An animation block to describe an animation sequence that continuously cycles,
2003
+/// and where one image is simply displayed over the previous image.
2004
+///
2005
+typedef EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK  EFI_HII_AIBT_OVERLAY_IMAGES_LOOP_BLOCK;
2006
+
2007
+///
2008
+/// An animation block to describe an animation sequence that continuously cycles,
2009
+/// and where the logical window is cleared to the specified color before
2010
+/// the next image is displayed.
2011
+///
2012
+typedef EFI_HII_AIBT_CLEAR_IMAGES_BLOCK    EFI_HII_AIBT_CLEAR_IMAGES_LOOP_BLOCK;
2013
+
2014
+///
2015
+/// An animation block to describe an animation sequence that continuously cycles,
2016
+/// and where the screen is restored to the original state before
2017
+/// the next image is displayed.
2018
+///
2019
+typedef EFI_HII_AIBT_RESTORE_SCRN_BLOCK    EFI_HII_AIBT_RESTORE_SCRN_LOOP_BLOCK;
2020
+
2021
+///
2022
+/// Assigns a new character value to a previously defined animation sequence.
2023
+///
2024
+typedef struct _EFI_HII_AIBT_DUPLICATE_BLOCK {
2025
+  ///
2026
+  /// The previously defined animation ID with the exact same
2027
+  /// animation information.
2028
+  ///
2029
+  EFI_ANIMATION_ID  AnimationId;
2030
+} EFI_HII_AIBT_DUPLICATE_BLOCK;
2031
+
2032
+///
2033
+/// Skips animation IDs.
2034
+///
2035
+typedef struct _EFI_HII_AIBT_SKIP1_BLOCK {
2036
+  ///
2037
+  /// The unsigned 8-bit value to add to AnimationIdCurrent.
2038
+  ///
2039
+  UINT8  SkipCount;
2040
+} EFI_HII_AIBT_SKIP1_BLOCK;
2041
+
2042
+///
2043
+/// Skips animation IDs.
2044
+///
2045
+typedef struct _EFI_HII_AIBT_SKIP2_BLOCK {
2046
+  ///
2047
+  /// The unsigned 16-bit value to add to AnimationIdCurrent.
2048
+  ///
2049
+  UINT16  SkipCount;
2050
+} EFI_HII_AIBT_SKIP2_BLOCK;
2051
+
1576 2052
 #pragma pack()
1577 2053
 
1578 2054
 

+ 78
- 119
src/include/ipxe/efi/Uefi/UefiMultiPhase.h View File

@@ -1,52 +1,119 @@
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 - 2008, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
6
-  are licensed and made available under the terms and conditions of the BSD License
7
-  which accompanies this distribution.  The full text of the license may be found at
8
-  http://opensource.org/licenses/bsd-license.php
4
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9 9
 
10
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 12
 
13 13
 **/
14 14
 
15 15
 #ifndef __UEFI_MULTIPHASE_H__
16 16
 #define __UEFI_MULTIPHASE_H__
17 17
 
18
-#include <ipxe/efi/ProcessorBind.h>
19
-
18
+#include <ipxe/efi/Guid/WinCertificate.h>
20 19
 ///
21 20
 /// Enumeration of memory types introduced in UEFI.
22 21
 ///
23 22
 typedef enum {
23
+  ///
24
+  /// Not used.
25
+  ///
24 26
   EfiReservedMemoryType,
27
+  ///
28
+  /// The code portions of a loaded application.
29
+  /// (Note that UEFI OS loaders are UEFI applications.)
30
+  ///
25 31
   EfiLoaderCode,
32
+  ///
33
+  /// The data portions of a loaded application and the default data allocation
34
+  /// type used by an application to allocate pool memory.
35
+  ///
26 36
   EfiLoaderData,
37
+  ///
38
+  /// The code portions of a loaded Boot Services Driver.
39
+  ///
27 40
   EfiBootServicesCode,
41
+  ///
42
+  /// The data portions of a loaded Boot Serves Driver, and the default data
43
+  /// allocation type used by a Boot Services Driver to allocate pool memory.
44
+  ///
28 45
   EfiBootServicesData,
46
+  ///
47
+  /// The code portions of a loaded Runtime Services Driver.
48
+  ///
29 49
   EfiRuntimeServicesCode,
50
+  ///
51
+  /// The data portions of a loaded Runtime Services Driver and the default
52
+  /// data allocation type used by a Runtime Services Driver to allocate pool memory.
53
+  ///
30 54
   EfiRuntimeServicesData,
55
+  ///
56
+  /// Free (unallocated) memory.
57
+  ///
31 58
   EfiConventionalMemory,
59
+  ///
60
+  /// Memory in which errors have been detected.
61
+  ///
32 62
   EfiUnusableMemory,
63
+  ///
64
+  /// Memory that holds the ACPI tables.
65
+  ///
33 66
   EfiACPIReclaimMemory,
67
+  ///
68
+  /// Address space reserved for use by the firmware.
69
+  ///
34 70
   EfiACPIMemoryNVS,
71
+  ///
72
+  /// Used by system firmware to request that a memory-mapped IO region
73
+  /// be mapped by the OS to a virtual address so it can be accessed by EFI runtime services.
74
+  ///
35 75
   EfiMemoryMappedIO,
76
+  ///
77
+  /// System memory-mapped IO region that is used to translate memory
78
+  /// cycles to IO cycles by the processor.
79
+  ///
36 80
   EfiMemoryMappedIOPortSpace,
81
+  ///
82
+  /// Address space reserved by the firmware for code that is part of the processor.
83
+  ///
37 84
   EfiPalCode,
38 85
   EfiMaxMemoryType
39 86
 } EFI_MEMORY_TYPE;
40 87
 
41
-
42 88
 ///
43 89
 /// Data structure that precedes all of the standard EFI table types.
44 90
 ///
45 91
 typedef struct {
92
+  ///
93
+  /// A 64-bit signature that identifies the type of table that follows.
94
+  /// Unique signatures have been generated for the EFI System Table,
95
+  /// the EFI Boot Services Table, and the EFI Runtime Services Table.
96
+  ///
46 97
   UINT64  Signature;
98
+  ///
99
+  /// The revision of the EFI Specification to which this table
100
+  /// conforms. The upper 16 bits of this field contain the major
101
+  /// revision value, and the lower 16 bits contain the minor revision
102
+  /// value. The minor revision values are limited to the range of 00..99.
103
+  ///
47 104
   UINT32  Revision;
105
+  ///
106
+  /// The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
107
+  ///
48 108
   UINT32  HeaderSize;
109
+  ///
110
+  /// The 32-bit CRC for the entire table. This value is computed by
111
+  /// setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
112
+  ///
49 113
   UINT32  CRC32;
114
+  ///
115
+  /// Reserved field that must be set to 0.
116
+  ///
50 117
   UINT32  Reserved;
51 118
 } EFI_TABLE_HEADER;
52 119
 
@@ -64,114 +131,6 @@ typedef struct {
64 131
 ///
65 132
 #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS   0x00000010
66 133
 
67
-//
68
-// _WIN_CERTIFICATE.wCertificateType
69
-//
70
-#define WIN_CERT_TYPE_EFI_PKCS115   0x0EF0
71
-#define WIN_CERT_TYPE_EFI_GUID      0x0EF1
72
-
73
-///
74
-/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
75
-///
76
-typedef struct _WIN_CERTIFICATE {
77
-  ///
78
-  /// The length of the entire certificate,
79
-  /// including the length of the header, in bytes.
80
-  ///
81
-  UINT32  dwLength;
82
-  ///
83
-  /// The revision level of the WIN_CERTIFICATE
84
-  /// structure. The current revision level is 0x0200.
85
-  ///
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
-  ///
92
-  UINT16  wCertificateType;
93
-  ///
94
-  /// The following is the actual certificate. The format of
95
-  /// the certificate depends on wCertificateType.
96
-  ///
97
-  /// UINT8 bCertificate[ANYSIZE_ARRAY];
98
-  ///
99
-} WIN_CERTIFICATE;
100
-
101
-///
102
-/// WIN_CERTIFICATE_UEFI_GUID.CertType
103
-///
104
-#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
105
-  {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
106
-
107
-//
108
-// WIN_CERTIFICATE_UEFI_GUID.CertData
109
-//
110
-typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
111
-  UINT32  HashType;
112
-  UINT8   PublicKey[256];
113
-  UINT8   Signature[256];
114
-} EFI_CERT_BLOCK_RSA_2048_SHA256;
115
-
116
-
117
-///
118
-/// Certificate which encapsulates a GUID-specific digital signature
119
-///
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
-  ///
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
-  ///
131
-  EFI_GUID          CertType;
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
-  ///
139
-} WIN_CERTIFICATE_UEFI_GUID;
140
-
141
-
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
-///
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
-  ///
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
-  ///
160
-  EFI_GUID        HashAlgorithm;
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
-  ///
171
-} WIN_CERTIFICATE_EFI_PKCS1_15;
172
-
173
-
174
-
175 134
 ///
176 135
 /// AuthInfo is a WIN_CERTIFICATE using the wCertificateType
177 136
 /// WIN_CERTIFICATE_UEFI_GUID and the CertType
@@ -185,7 +144,7 @@ typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
185 144
 /// key associated w/ the public/private 2048-bit RSA key-pair. The
186 145
 /// WIN_CERTIFICATE shall be used to describe the signature of the
187 146
 /// Variable data *Data. In addition, the signature will also
188
-/// include the MonotonicCount value to guard against replay attacks
147
+/// include the MonotonicCount value to guard against replay attacks.
189 148
 ///
190 149
 typedef struct {
191 150
   ///

+ 111
- 97
src/include/ipxe/efi/Uefi/UefiPxe.h View File

@@ -3,18 +3,18 @@
3 3
   structure prototypes, global variables and constants that
4 4
   are needed for porting PXE to EFI.
5 5
 
6
-  Copyright (c) 2006 - 2008, Intel Corporation
7
-  All rights reserved. This program and the accompanying materials
8
-  are licensed and made available under the terms and conditions of the BSD License
9
-  which accompanies this distribution.  The full text of the license may be found at
10
-  http://opensource.org/licenses/bsd-license.php
6
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7
+This program and the accompanying materials are licensed and made available under
8
+the terms and conditions of the BSD License that accompanies this distribution.
9
+The full text of the license may be found at
10
+http://opensource.org/licenses/bsd-license.php.
11 11
 
12
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 14
 
15 15
   @par Revision Reference:
16 16
   32/64-bit PXE specification:
17
-  alpha-4, 99-Dec-17
17
+  alpha-4, 99-Dec-17.
18 18
 
19 19
 **/
20 20
 
@@ -30,12 +30,12 @@
30 30
     )
31 31
 
32 32
 ///
33
-/// UNDI ROM ID and devive ID signature
33
+/// UNDI ROM ID and devive ID signature.
34 34
 ///
35 35
 #define PXE_BUSTYPE_PXE PXE_BUSTYPE ('!', 'P', 'X', 'E')
36 36
 
37 37
 ///
38
-/// BUS ROM ID signatures
38
+/// BUS ROM ID signatures.
39 39
 ///
40 40
 #define PXE_BUSTYPE_PCI     PXE_BUSTYPE ('P', 'C', 'I', 'R')
41 41
 #define PXE_BUSTYPE_PC_CARD PXE_BUSTYPE ('P', 'C', 'C', 'R')
@@ -76,7 +76,7 @@ typedef UINT32         PXE_UINT32;
76 76
 typedef UINTN          PXE_UINTN;
77 77
 
78 78
 ///
79
-/// typedef unsigned long PXE_UINT64;
79
+/// Typedef unsigned long PXE_UINT64.
80 80
 ///
81 81
 typedef UINT64      PXE_UINT64;
82 82
 
@@ -226,12 +226,12 @@ typedef PXE_UINT16  PXE_OPFLAGS;
226 226
 #define PXE_OPFLAGS_RESET_DISABLE_FILTERS     0x0002
227 227
 
228 228
 ///
229
-/// UNDI Shutdown
229
+/// UNDI Shutdown.
230 230
 ///
231
-/// No OpFlags
231
+/// No OpFlags.
232 232
 
233 233
 ///
234
-/// UNDI Interrupt Enables
234
+/// UNDI Interrupt Enables.
235 235
 ///
236 236
 ///
237 237
 /// Select whether to enable or disable external interrupt signals.
@@ -267,7 +267,7 @@ typedef PXE_UINT16  PXE_OPFLAGS;
267 267
 #define PXE_OPFLAGS_INTERRUPT_SOFTWARE  0x0008
268 268
 
269 269
 ///
270
-/// UNDI Receive Filters
270
+/// UNDI Receive Filters.
271 271
 ///
272 272
 ///
273 273
 /// Select whether to enable or disable receive filters.
@@ -315,20 +315,20 @@ typedef PXE_UINT16  PXE_OPFLAGS;
315 315
 #define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST  0x0010
316 316
 
317 317
 ///
318
-/// UNDI Station Address
318
+/// UNDI Station Address.
319 319
 ///
320 320
 #define PXE_OPFLAGS_STATION_ADDRESS_READ   0x0000
321 321
 #define PXE_OPFLAGS_STATION_ADDRESS_WRITE  0x0000
322 322
 #define PXE_OPFLAGS_STATION_ADDRESS_RESET  0x0001
323 323
 
324 324
 ///
325
-/// UNDI Statistics
325
+/// UNDI Statistics.
326 326
 ///
327 327
 #define PXE_OPFLAGS_STATISTICS_READ   0x0000
328 328
 #define PXE_OPFLAGS_STATISTICS_RESET  0x0001
329 329
 
330 330
 ///
331
-/// UNDI MCast IP to MAC
331
+/// UNDI MCast IP to MAC.
332 332
 ///
333 333
 ///
334 334
 /// Identify the type of IP address in the CPB.
@@ -338,7 +338,7 @@ typedef PXE_UINT16  PXE_OPFLAGS;
338 338
 #define PXE_OPFLAGS_MCAST_IPV6_TO_MAC       0x0001
339 339
 
340 340
 ///
341
-/// UNDI NvData
341
+/// UNDI NvData.
342 342
 ///
343 343
 ///
344 344
 /// Select the type of non-volatile data operation.
@@ -348,7 +348,7 @@ typedef PXE_UINT16  PXE_OPFLAGS;
348 348
 #define PXE_OPFLAGS_NVDATA_WRITE  0x0001
349 349
 
350 350
 ///
351
-/// UNDI Get Status
351
+/// UNDI Get Status.
352 352
 ///
353 353
 ///
354 354
 /// Return current interrupt status.  This will also clear any interrupts
@@ -369,14 +369,19 @@ typedef PXE_UINT16  PXE_OPFLAGS;
369 369
 #define PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS 0x0002
370 370
 
371 371
 ///
372
-/// UNDI Fill Header
372
+/// Return current media status.
373
+///
374
+#define PXE_OPFLAGS_GET_MEDIA_STATUS    0x0004
375
+
376
+///
377
+/// UNDI Fill Header.
373 378
 ///
374 379
 #define PXE_OPFLAGS_FILL_HEADER_OPMASK      0x0001
375 380
 #define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED  0x0001
376 381
 #define PXE_OPFLAGS_FILL_HEADER_WHOLE       0x0000
377 382
 
378 383
 ///
379
-/// UNDI Transmit
384
+/// UNDI Transmit.
380 385
 ///
381 386
 ///
382 387
 /// S/W UNDI only.  Return after the packet has been transmitted.  A
@@ -392,13 +397,13 @@ typedef PXE_UINT16  PXE_OPFLAGS;
392 397
 #define PXE_OPFLAGS_TRANSMIT_WHOLE      0x0000
393 398
 
394 399
 ///
395
-/// UNDI Receive
400
+/// UNDI Receive.
396 401
 ///
397
-/// No OpFlags
402
+/// No OpFlags.
398 403
 ///
399 404
 
400 405
 ///
401
-/// PXE STATFLAGS
406
+/// PXE STATFLAGS.
402 407
 ///
403 408
 typedef PXE_UINT16  PXE_STATFLAGS;
404 409
 
@@ -418,7 +423,7 @@ typedef PXE_UINT16  PXE_STATFLAGS;
418 423
 #define PXE_STATFLAGS_COMMAND_QUEUED    0x4000
419 424
 
420 425
 ///
421
-/// UNDI Get State
426
+/// UNDI Get State.
422 427
 ///
423 428
 #define PXE_STATFLAGS_GET_STATE_MASK        0x0003
424 429
 #define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002
@@ -426,35 +431,39 @@ typedef PXE_UINT16  PXE_STATFLAGS;
426 431
 #define PXE_STATFLAGS_GET_STATE_STOPPED     0x0000
427 432
 
428 433
 ///
429
-/// UNDI Start
434
+/// UNDI Start.
430 435
 ///
431
-/// No additional StatFlags
436
+/// No additional StatFlags.
432 437
 ///
433 438
 
434 439
 ///
435
-/// UNDI Get Init Info
440
+/// UNDI Get Init Info.
436 441
 ///
437 442
 #define PXE_STATFLAGS_CABLE_DETECT_MASK           0x0001
438 443
 #define PXE_STATFLAGS_CABLE_DETECT_NOT_SUPPORTED  0x0000
439 444
 #define PXE_STATFLAGS_CABLE_DETECT_SUPPORTED      0x0001
440 445
 
446
+#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_MASK           0x0002
447
+#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_NOT_SUPPORTED  0x0000
448
+#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA_SUPPORTED      0x0002
449
+
441 450
 ///
442
-/// UNDI Initialize
451
+/// UNDI Initialize.
443 452
 ///
444 453
 #define PXE_STATFLAGS_INITIALIZED_NO_MEDIA  0x0001
445 454
 
446 455
 ///
447
-/// UNDI Reset
456
+/// UNDI Reset.
448 457
 ///
449 458
 #define PXE_STATFLAGS_RESET_NO_MEDIA  0x0001
450 459
 
451 460
 ///
452
-/// UNDI Shutdown
461
+/// UNDI Shutdown.
453 462
 ///
454
-/// No additional StatFlags
463
+/// No additional StatFlags.
455 464
 
456 465
 ///
457
-/// UNDI Interrupt Enables
466
+/// UNDI Interrupt Enables.
458 467
 ///
459 468
 ///
460 469
 /// If set, receive interrupts are enabled.
@@ -472,7 +481,7 @@ typedef PXE_UINT16  PXE_STATFLAGS;
472 481
 #define PXE_STATFLAGS_INTERRUPT_COMMAND 0x0004
473 482
 
474 483
 ///
475
-/// UNDI Receive Filters
484
+/// UNDI Receive Filters.
476 485
 ///
477 486
 
478 487
 ///
@@ -502,30 +511,30 @@ typedef PXE_UINT16  PXE_STATFLAGS;
502 511
 #define PXE_STATFLAGS_RECEIVE_FILTER_ALL_MULTICAST  0x0010
503 512
 
504 513
 ///
505
-/// UNDI Station Address
514
+/// UNDI Station Address.
506 515
 ///
507
-/// No additional StatFlags
516
+/// No additional StatFlags.
508 517
 ///
509 518
 
510 519
 ///
511
-/// UNDI Statistics
520
+/// UNDI Statistics.
512 521
 ///
513
-/// No additional StatFlags
522
+/// No additional StatFlags.
514 523
 ///
515 524
 
516 525
 ///
517
-//// UNDI MCast IP to MAC
526
+//// UNDI MCast IP to MAC.
518 527
 ////
519
-//// No additional StatFlags
528
+//// No additional StatFlags.
520 529
 
521 530
 ///
522
-/// UNDI NvData
531
+/// UNDI NvData.
523 532
 ///
524
-/// No additional StatFlags
533
+/// No additional StatFlags.
525 534
 ///
526 535
 
527 536
 ///
528
-/// UNDI Get Status
537
+/// UNDI Get Status.
529 538
 ///
530 539
 
531 540
 ///
@@ -567,19 +576,24 @@ typedef PXE_UINT16  PXE_STATFLAGS;
567 576
 #define PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN  0x0020
568 577
 
569 578
 ///
570
-/// UNDI Fill Header
579
+/// This flag is set if there is no media detected.
580
+///
581
+#define PXE_STATFLAGS_GET_STATUS_NO_MEDIA  0x0040
582
+
571 583
 ///
572
-/// No additional StatFlags
584
+/// UNDI Fill Header.
585
+///
586
+/// No additional StatFlags.
573 587
 ///
574 588
 
575 589
 ///
576
-/// UNDI Transmit
590
+/// UNDI Transmit.
577 591
 ///
578 592
 /// No additional StatFlags.
579 593
 
580 594
 ///
581 595
 /// UNDI Receive
582
-///
596
+///.
583 597
 
584 598
 ///
585 599
 /// No additional StatFlags.
@@ -701,28 +715,28 @@ typedef UINT16      PXE_MEDIA_PROTOCOL;
701 715
 #define PXE_IFTYPE_FIBRE_CHANNEL  0x12
702 716
 
703 717
 typedef struct s_pxe_hw_undi {
704
-  PXE_UINT32  Signature;      ///< PXE_ROMID_SIGNATURE
705
-  PXE_UINT8   Len;            ///< sizeof(PXE_HW_UNDI)
706
-  PXE_UINT8   Fudge;          ///< makes 8-bit cksum equal zero
707
-  PXE_UINT8   Rev;            ///< PXE_ROMID_REV
708
-  PXE_UINT8   IFcnt;          ///< physical connector count
709
-  PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER
710
-  PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER
711
-  PXE_UINT16  reserved;       ///< zero, not used
712
-  PXE_UINT32  Implementation; ///< implementation flags
713
-  ///< reserved             ///< vendor use
714
-  ///< UINT32 Status;       ///< status port
715
-  ///< UINT32 Command;      ///< command port
716
-  ///< UINT64 CDBaddr;      ///< CDB address port
718
+  PXE_UINT32  Signature;      ///< PXE_ROMID_SIGNATURE.
719
+  PXE_UINT8   Len;            ///< sizeof(PXE_HW_UNDI).
720
+  PXE_UINT8   Fudge;          ///< makes 8-bit cksum equal zero.
721
+  PXE_UINT8   Rev;            ///< PXE_ROMID_REV.
722
+  PXE_UINT8   IFcnt;          ///< physical connector count.
723
+  PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER.
724
+  PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER.
725
+  PXE_UINT16  reserved;       ///< zero, not used.
726
+  PXE_UINT32  Implementation; ///< implementation flags.
727
+  ///< reserved             ///< vendor use.
728
+  ///< UINT32 Status;       ///< status port.
729
+  ///< UINT32 Command;      ///< command port.
730
+  ///< UINT64 CDBaddr;      ///< CDB address port.
717 731
   ///<
718 732
 } PXE_HW_UNDI;
719 733
 
720 734
 ///
721
-/// Status port bit definitions
735
+/// Status port bit definitions.
722 736
 ///
723 737
 
724 738
 ///
725
-/// UNDI operation state
739
+/// UNDI operation state.
726 740
 ///
727 741
 #define PXE_HWSTAT_STATE_MASK   0xC0000000
728 742
 #define PXE_HWSTAT_BUSY         0xC0000000
@@ -731,12 +745,12 @@ typedef struct s_pxe_hw_undi {
731 745
 #define PXE_HWSTAT_STOPPED      0x00000000
732 746
 
733 747
 ///
734
-/// If set, last command failed
748
+/// If set, last command failed.
735 749
 ///
736 750
 #define PXE_HWSTAT_COMMAND_FAILED 0x20000000
737 751
 
738 752
 ///
739
-/// If set, identifies enabled receive filters
753
+/// If set, identifies enabled receive filters.
740 754
 ///
741 755
 #define PXE_HWSTAT_PROMISCUOUS_MULTICAST_RX_ENABLED 0x00001000
742 756
 #define PXE_HWSTAT_PROMISCUOUS_RX_ENABLED           0x00000800
@@ -745,7 +759,7 @@ typedef struct s_pxe_hw_undi {
745 759
 #define PXE_HWSTAT_UNICAST_RX_ENABLED               0x00000100
746 760
 
747 761
 ///
748
-/// If set, identifies enabled external interrupts
762
+/// If set, identifies enabled external interrupts.
749 763
 ///
750 764
 #define PXE_HWSTAT_SOFTWARE_INT_ENABLED     0x00000080
751 765
 #define PXE_HWSTAT_TX_COMPLETE_INT_ENABLED  0x00000040
@@ -753,7 +767,7 @@ typedef struct s_pxe_hw_undi {
753 767
 #define PXE_HWSTAT_CMD_COMPLETE_INT_ENABLED 0x00000010
754 768
 
755 769
 ///
756
-/// If set, identifies pending interrupts
770
+/// If set, identifies pending interrupts.
757 771
 ///
758 772
 #define PXE_HWSTAT_SOFTWARE_INT_PENDING     0x00000008
759 773
 #define PXE_HWSTAT_TX_COMPLETE_INT_PENDING  0x00000004
@@ -761,7 +775,7 @@ typedef struct s_pxe_hw_undi {
761 775
 #define PXE_HWSTAT_CMD_COMPLETE_INT_PENDING 0x00000001
762 776
 
763 777
 ///
764
-/// Command port definitions
778
+/// Command port definitions.
765 779
 ///
766 780
 
767 781
 ///
@@ -781,7 +795,7 @@ typedef struct s_pxe_hw_undi {
781 795
 #define PXE_HWCMD_UNICAST_RX_ENABLE               0x00000100
782 796
 
783 797
 ///
784
-/// Use these to enable/disable external interrupts
798
+/// Use these to enable/disable external interrupts.
785 799
 ///
786 800
 #define PXE_HWCMD_SOFTWARE_INT_ENABLE     0x00000080
787 801
 #define PXE_HWCMD_TX_COMPLETE_INT_ENABLE  0x00000040
@@ -789,7 +803,7 @@ typedef struct s_pxe_hw_undi {
789 803
 #define PXE_HWCMD_CMD_COMPLETE_INT_ENABLE 0x00000010
790 804
 
791 805
 ///
792
-/// Use these to clear pending external interrupts
806
+/// Use these to clear pending external interrupts.
793 807
 ///
794 808
 #define PXE_HWCMD_CLEAR_SOFTWARE_INT      0x00000008
795 809
 #define PXE_HWCMD_CLEAR_TX_COMPLETE_INT   0x00000004
@@ -797,19 +811,19 @@ typedef struct s_pxe_hw_undi {
797 811
 #define PXE_HWCMD_CLEAR_CMD_COMPLETE_INT  0x00000001
798 812
 
799 813
 typedef struct s_pxe_sw_undi {
800
-  PXE_UINT32  Signature;      ///< PXE_ROMID_SIGNATURE
801
-  PXE_UINT8   Len;            ///< sizeof(PXE_SW_UNDI)
802
-  PXE_UINT8   Fudge;          ///< makes 8-bit cksum zero
803
-  PXE_UINT8   Rev;            ///< PXE_ROMID_REV
804
-  PXE_UINT8   IFcnt;          ///< physical connector count
805
-  PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER
806
-  PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER
807
-  PXE_UINT16  reserved1;      ///< zero, not used
808
-  PXE_UINT32  Implementation; ///< Implementation flags
809
-  PXE_UINT64  EntryPoint;     ///< API entry point
810
-  PXE_UINT8   reserved2[3];   ///< zero, not used
811
-  PXE_UINT8   BusCnt;         ///< number of bustypes supported
812
-  PXE_UINT32  BusType[1];     ///< list of supported bustypes
814
+  PXE_UINT32  Signature;      ///< PXE_ROMID_SIGNATURE.
815
+  PXE_UINT8   Len;            ///< sizeof(PXE_SW_UNDI).
816
+  PXE_UINT8   Fudge;          ///< makes 8-bit cksum zero.
817
+  PXE_UINT8   Rev;            ///< PXE_ROMID_REV.
818
+  PXE_UINT8   IFcnt;          ///< physical connector count.
819
+  PXE_UINT8   MajorVer;       ///< PXE_ROMID_MAJORVER.
820
+  PXE_UINT8   MinorVer;       ///< PXE_ROMID_MINORVER.
821
+  PXE_UINT16  reserved1;      ///< zero, not used.
822
+  PXE_UINT32  Implementation; ///< Implementation flags.
823
+  PXE_UINT64  EntryPoint;     ///< API entry point.
824
+  PXE_UINT8   reserved2[3];   ///< zero, not used.
825
+  PXE_UINT8   BusCnt;         ///< number of bustypes supported.
826
+  PXE_UINT32  BusType[1];     ///< list of supported bustypes.
813 827
 } PXE_SW_UNDI;
814 828
 
815 829
 typedef union u_pxe_undi {
@@ -818,13 +832,13 @@ typedef union u_pxe_undi {
818 832
 } PXE_UNDI;
819 833
 
820 834
 ///
821
-/// Signature of !PXE structure
835
+/// Signature of !PXE structure.
822 836
 ///
823 837
 #define PXE_ROMID_SIGNATURE PXE_BUSTYPE ('!', 'P', 'X', 'E')
824 838
 
825 839
 ///
826 840
 /// !PXE structure format revision
827
-///
841
+///.
828 842
 #define PXE_ROMID_REV 0x02
829 843
 
830 844
 ///
@@ -836,7 +850,7 @@ typedef union u_pxe_undi {
836 850
 #define PXE_ROMID_MINORVER    0x01
837 851
 
838 852
 ///
839
-/// Implementation flags
853
+/// Implementation flags.
840 854
 ///
841 855
 #define PXE_ROMID_IMP_HW_UNDI                             0x80000000
842 856
 #define PXE_ROMID_IMP_SW_VIRT_ADDR                        0x40000000
@@ -907,9 +921,9 @@ typedef union pxe_device {
907 921
 ///
908 922
 /// cpb and db definitions
909 923
 ///
910
-#define MAX_PCI_CONFIG_LEN    64  ///< # of dwords
911
-#define MAX_EEPROM_LEN        128 ///< # of dwords
912
-#define MAX_XMIT_BUFFERS      32  ///< recycling Q length for xmit_done
924
+#define MAX_PCI_CONFIG_LEN    64  ///< # of dwords.
925
+#define MAX_EEPROM_LEN        128 ///< # of dwords.
926
+#define MAX_XMIT_BUFFERS      32  ///< recycling Q length for xmit_done.
913 927
 #define MAX_MCAST_ADDRESS_CNT 8
914 928
 
915 929
 typedef struct s_pxe_cpb_start_30 {
@@ -1034,7 +1048,7 @@ typedef struct s_pxe_cpb_start_31 {
1034 1048
   /// used with the DMA, it converts the given virtual address to it's
1035 1049
   /// physical address and write that in the mapped address pointer.
1036 1050
   ///
1037
-  /// This field can be set to zero if there is no mapping service available
1051
+  /// This field can be set to zero if there is no mapping service available.
1038 1052
   ///
1039 1053
   UINT64  Map_Mem;
1040 1054
 
@@ -1042,10 +1056,10 @@ typedef struct s_pxe_cpb_start_31 {
1042 1056
   /// PXE_VOID UnMap_Mem(UINT64 unq_id, UINT64 virtual_addr, UINT32 size,
1043 1057
   ///            UINT32 Direction, UINT64 mapped_addr);
1044 1058
   ///
1045
-  /// UNDI will pass the virtual and mapped addresses of a buffer
1046
-  /// This call will un map the given address
1059
+  /// UNDI will pass the virtual and mapped addresses of a buffer.
1060
+  /// This call will un map the given address.
1047 1061
   ///
1048
-  /// This field can be set to zero if there is no unmapping service available
1062
+  /// This field can be set to zero if there is no unmapping service available.
1049 1063
   ///
1050 1064
   UINT64  UnMap_Mem;
1051 1065
 
@@ -1053,11 +1067,11 @@ typedef struct s_pxe_cpb_start_31 {
1053 1067
   /// PXE_VOID Sync_Mem(UINT64 unq_id, UINT64 virtual,
1054 1068
   ///            UINT32 size, UINT32 Direction, UINT64 mapped_addr);
1055 1069
   ///
1056
-  /// UNDI will pass the virtual and mapped addresses of a buffer
1057
-  /// This call will synchronize the contents of both the virtual and mapped
1070
+  /// UNDI will pass the virtual and mapped addresses of a buffer.
1071
+  /// This call will synchronize the contents of both the virtual and mapped.
1058 1072
   /// buffers for the given Direction.
1059 1073
   ///
1060
-  /// This field can be set to zero if there is no service available
1074
+  /// This field can be set to zero if there is no service available.
1061 1075
   ///
1062 1076
   UINT64  Sync_Mem;
1063 1077
 
@@ -1181,7 +1195,7 @@ typedef struct s_pxe_pci_config_info {
1181 1195
   UINT32  BusType;
1182 1196
 
1183 1197
   ///
1184
-  /// This identifies the PCI network device that this UNDI interface
1198
+  /// This identifies the PCI network device that this UNDI interface.
1185 1199
   /// is bound to.
1186 1200
   ///
1187 1201
   UINT16  Bus;

+ 313
- 136
src/include/ipxe/efi/Uefi/UefiSpec.h View File

@@ -5,14 +5,14 @@
5 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 - 2008, Intel Corporation
9
-  All rights reserved. This program and the accompanying materials
10
-  are licensed and made available under the terms and conditions of the BSD License
11
-  which accompanies this distribution.  The full text of the license may be found at
12
-  http://opensource.org/licenses/bsd-license.php
8
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
9
+This program and the accompanying materials are licensed and made available under
10
+the terms and conditions of the BSD License that accompanies this distribution.
11
+The full text of the license may be found at
12
+http://opensource.org/licenses/bsd-license.php.
13 13
 
14
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 16
 
17 17
 **/
18 18
 
@@ -26,12 +26,25 @@
26 26
 #include <ipxe/efi/Protocol/SimpleTextOut.h>
27 27
 
28 28
 ///
29
-/// Enumeration of memory allocation.
29
+/// Enumeration of EFI memory allocation types.
30 30
 ///
31 31
 typedef enum {
32
+  ///
33
+  /// Allocate any available range of pages that satisfies the request.
34
+  ///
32 35
   AllocateAnyPages,
36
+  ///
37
+  /// Allocate any available range of pages whose uppermost address is less than
38
+  /// or equal to a specified maximum address.
39
+  ///
33 40
   AllocateMaxAddress,
41
+  ///
42
+  /// Allocate pages at a specified address.
43
+  ///
34 44
   AllocateAddress,
45
+  ///
46
+  /// Maximum enumeration value that may be used for bounds checking.
47
+  ///
35 48
   MaxAllocateType
36 49
 } EFI_ALLOCATE_TYPE;
37 50
 
@@ -42,7 +55,7 @@ typedef enum {
42 55
 #define EFI_TIME_IN_DAYLIGHT      0x02
43 56
 
44 57
 ///
45
-/// Value definition for EFI_TIME.TimeZone
58
+/// Value definition for EFI_TIME.TimeZone.
46 59
 ///
47 60
 #define EFI_UNSPECIFIED_TIMEZONE  0x07FF
48 61
 
@@ -66,38 +79,47 @@ typedef enum {
66 79
 #define EFI_MEMORY_RUNTIME  0x8000000000000000ULL
67 80
 
68 81
 ///
69
-/// Memory descriptor version number
82
+/// Memory descriptor version number.
70 83
 ///
71 84
 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
72 85
 
73 86
 ///
74
-/// Definition of memory descriptor
87
+/// Definition of an EFI memory descriptor.
75 88
 ///
76 89
 typedef struct {
90
+  ///
91
+  /// Type of the memory region.  See EFI_MEMORY_TYPE.
92
+  ///
77 93
   UINT32                Type;
94
+  ///
95
+  /// Physical address of the first byte of the memory region.  Must aligned
96
+  /// on a 4 KB boundary.
97
+  ///
78 98
   EFI_PHYSICAL_ADDRESS  PhysicalStart;
99
+  ///
100
+  /// Virtual address of the first byte of the memory region.  Must aligned
101
+  /// on a 4 KB boundary.
102
+  ///
79 103
   EFI_VIRTUAL_ADDRESS   VirtualStart;
104
+  ///
105
+  /// Number of 4KB pages in the memory region.
106
+  ///
80 107
   UINT64                NumberOfPages;
108
+  ///
109
+  /// Attributes of the memory region that describe the bit mask of capabilities
110
+  /// for that memory region, and not necessarily the current settings for that
111
+  /// memory region.
112
+  ///
81 113
   UINT64                Attribute;
82 114
 } EFI_MEMORY_DESCRIPTOR;
83 115
 
84
-///
85
-/// Build macros to find next EFI_MEMORY_DESCRIPTOR.
86
-///
87
-#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size)   ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))
88
-
89
-///
90
-/// Declare forward referenced data structures
91
-///
92
-typedef struct _EFI_SYSTEM_TABLE   EFI_SYSTEM_TABLE;
93
-
94 116
 /**
95 117
   Allocates memory pages from the system.
96 118
 
97 119
   @param  Type        The type of allocation to perform.
98 120
   @param  MemoryType  The type of memory to allocate.
99 121
   @param  Pages       The number of contiguous 4 KB pages to allocate.
100
-  @param  Memory      Pointer to a physical address. On input, the way in which the address is
122
+  @param  Memory      The pointer to a physical address. On input, the way in which the address is
101 123
                       used depends on the value of Type.
102 124
 
103 125
   @retval EFI_SUCCESS           The requested pages were allocated.
@@ -196,7 +218,7 @@ EFI_STATUS
196 218
 /**
197 219
   Returns pool memory to the system.
198 220
 
199
-  @param  Buffer                Pointer to the buffer to free.
221
+  @param  Buffer                The pointer to the buffer to free.
200 222
 
201 223
   @retval EFI_SUCCESS           The memory was returned to the system.
202 224
   @retval EFI_INVALID_PARAMETER Buffer was invalid.
@@ -306,7 +328,6 @@ EFI_STATUS
306 328
 // ConvertPointer DebugDisposition type.
307 329
 //
308 330
 #define EFI_OPTIONAL_PTR     0x00000001
309
-#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR
310 331
 
311 332
 /**
312 333
   Determines the new virtual address that is to be used on subsequent memory accesses.
@@ -356,7 +377,7 @@ EFI_STATUS
356 377
   Invoke a notification event
357 378
 
358 379
   @param  Event                 Event whose notification function is being invoked.
359
-  @param  Context               Pointer to the notification function's context,
380
+  @param  Context               The pointer to the notification function's context,
360 381
                                 which is implementation-dependent.
361 382
 
362 383
 **/
@@ -372,10 +393,10 @@ VOID
372 393
 
373 394
   @param  Type                  The type of event to create and its mode and attributes.
374 395
   @param  NotifyTpl             The task priority level of event notifications, if needed.
375
-  @param  NotifyFunction        Pointer to the event's notification function, if any.
376
-  @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
396
+  @param  NotifyFunction        The pointer to the event's notification function, if any.
397
+  @param  NotifyContext         The pointer to the notification function's context; corresponds to parameter
377 398
                                 Context in the notification function.
378
-  @param  Event                 Pointer to the newly created event if the call succeeds; undefined
399
+  @param  Event                 The pointer to the newly created event if the call succeeds; undefined
379 400
                                 otherwise.
380 401
 
381 402
   @retval EFI_SUCCESS           The event structure was created.
@@ -398,13 +419,13 @@ EFI_STATUS
398 419
 
399 420
   @param  Type                  The type of event to create and its mode and attributes.
400 421
   @param  NotifyTpl             The task priority level of event notifications,if needed.
401
-  @param  NotifyFunction        Pointer to the event's notification function, if any.
402
-  @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
422
+  @param  NotifyFunction        The pointer to the event's notification function, if any.
423
+  @param  NotifyContext         The pointer to the notification function's context; corresponds to parameter
403 424
                                 Context in the notification function.
404
-  @param  EventGroup            Pointer to the unique identifier of the group to which this event belongs.
425
+  @param  EventGroup            The pointer to the unique identifier of the group to which this event belongs.
405 426
                                 If this is NULL, then the function behaves as if the parameters were passed
406 427
                                 to CreateEvent.
407
-  @param  Event                 Pointer to the newly created event if the call succeeds; undefined
428
+  @param  Event                 The pointer to the newly created event if the call succeeds; undefined
408 429
                                 otherwise.
409 430
 
410 431
   @retval EFI_SUCCESS           The event structure was created.
@@ -427,8 +448,17 @@ EFI_STATUS
427 448
 /// Timer delay types
428 449
 ///
429 450
 typedef enum {
451
+  ///
452
+  /// An event's timer settings is to be cancelled and not trigger time is to be set/
453
+  ///
430 454
   TimerCancel,
455
+  ///
456
+  /// An event is to be signalled periodically at a specified interval from the current time.
457
+  ///
431 458
   TimerPeriodic,
459
+  ///
460
+  /// An event is to be signalled once at a specified interval from the current time.
461
+  ///
432 462
   TimerRelative
433 463
 } EFI_TIMER_DELAY;
434 464
 
@@ -475,7 +505,7 @@ EFI_STATUS
475 505
 
476 506
   @param  NumberOfEvents        The number of events in the Event array.
477 507
   @param  Event                 An array of EFI_EVENT.
478
-  @param  Index                 Pointer to the index of the event which satisfied the wait condition.
508
+  @param  Index                 The pointer to the index of the event which satisfied the wait condition.
479 509
 
480 510
   @retval EFI_SUCCESS           The event indicated by Index was signaled.
481 511
   @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.
@@ -561,8 +591,8 @@ VOID
561 591
 /**
562 592
   Returns the value of a variable.
563 593
 
564
-  @param  VariableName          A Null-terminated Unicode string that is the name of the
565
-                                vendor's variable.
594
+  @param  VariableName          A Null-terminated string that is the name of the vendor's
595
+                                variable.
566 596
   @param  VendorGuid            A unique identifier for the vendor.
567 597
   @param  Attributes            If not NULL, a pointer to the memory location to return the
568 598
                                 attributes bitmask for the variable.
@@ -597,7 +627,7 @@ EFI_STATUS
597 627
   @param  VariableNameSize      The size of the VariableName buffer.
598 628
   @param  VariableName          On input, supplies the last VariableName that was returned
599 629
                                 by GetNextVariableName(). On output, returns the Nullterminated
600
-                                Unicode string of the current variable.
630
+                                string of the current variable.
601 631
   @param  VendorGuid            On input, supplies the last VendorGuid that was returned by
602 632
                                 GetNextVariableName(). On output, returns the
603 633
                                 VendorGuid of the current variable.
@@ -622,23 +652,28 @@ EFI_STATUS
622 652
 /**
623 653
   Sets the value of a variable.
624 654
 
625
-  @param  VariableName          A Null-terminated Unicode string that is the name of the
626
-                                vendor's variable.
627
-  @param  VendorGuid            A unique identifier for the vendor.
628
-  @param  Attributes            Attributes bitmask to set for the variable.
629
-  @param  DataSize              The size in bytes of the Data buffer.
630
-  @param  Data                  The contents for the variable.
655
+  @param  VariableName           A Null-terminated string that is the name of the vendor's variable.
656
+                                 Each VariableName is unique for each VendorGuid. VariableName must
657
+                                 contain 1 or more characters. If VariableName is an empty string,
658
+                                 then EFI_INVALID_PARAMETER is returned.
659
+  @param  VendorGuid             A unique identifier for the vendor.
660
+  @param  Attributes             Attributes bitmask to set for the variable.
661
+  @param  DataSize               The size in bytes of the Data buffer. A size of zero causes the
662
+                                 variable to be deleted.
663
+  @param  Data                   The contents for the variable.
631 664
 
632 665
   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
633 666
                                  defined by the Attributes.
634 667
   @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits was supplied, or the
635 668
                                  DataSize exceeds the maximum allowed.
636
-  @retval EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
669
+  @retval EFI_INVALID_PARAMETER  VariableName is an empty string.
637 670
   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
638 671
   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
639 672
   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
640 673
   @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.
674
+  @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
675
+                                 set but the AuthInfo does NOT pass the validation check carried out
676
+                                 by the firmware.
642 677
   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
643 678
 
644 679
 **/
@@ -658,8 +693,27 @@ EFI_STATUS
658 693
 /// real time clock device as exposed through the EFI interfaces.
659 694
 ///
660 695
 typedef struct {
696
+  ///
697
+  /// Provides the reporting resolution of the real-time clock device in
698
+  /// counts per second. For a normal PC-AT CMOS RTC device, this
699
+  /// value would be 1 Hz, or 1, to indicate that the device only reports
700
+  /// the time to the resolution of 1 second.
701
+  ///
661 702
   UINT32    Resolution;
703
+  ///
704
+  /// Provides the timekeeping accuracy of the real-time clock in an
705
+  /// error rate of 1E-6 parts per million. For a clock with an accuracy
706
+  /// of 50 parts per million, the value in this field would be
707
+  /// 50,000,000.
708
+  ///
662 709
   UINT32    Accuracy;
710
+  ///
711
+  /// A TRUE indicates that a time set operation clears the device's
712
+  /// time below the Resolution reporting level. A FALSE
713
+  /// indicates that the state below the Resolution level of the
714
+  /// device is not cleared when the time is set. Normal PC-AT CMOS
715
+  /// RTC devices set this value to FALSE.
716
+  ///
663 717
   BOOLEAN   SetsToZero;
664 718
 } EFI_TIME_CAPABILITIES;
665 719
 
@@ -743,25 +797,6 @@ EFI_STATUS
743 797
   IN  EFI_TIME                     *Time   OPTIONAL
744 798
   );
745 799
 
746
-/**
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.
750
-
751
-  @param  ImageHandle           The firmware allocated handle for the UEFI image.
752
-  @param  SystemTable           A pointer to the EFI System Table.
753
-
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.
756
-
757
-**/
758
-typedef
759
-EFI_STATUS
760
-(EFIAPI *EFI_IMAGE_ENTRY_POINT)(
761
-  IN  EFI_HANDLE                   ImageHandle,
762
-  IN  EFI_SYSTEM_TABLE             *SystemTable
763
-  );
764
-
765 800
 /**
766 801
   Loads an EFI image into memory.
767 802
 
@@ -775,7 +810,7 @@ EFI_STATUS
775 810
   @param  SourceBuffer          If not NULL, a pointer to the memory location containing a copy
776 811
                                 of the image to be loaded.
777 812
   @param  SourceSize            The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
778
-  @param  ImageHandle           Pointer to the returned image handle that is created when the
813
+  @param  ImageHandle           The pointer to the returned image handle that is created when the
779 814
                                 image is successfully loaded.
780 815
 
781 816
   @retval EFI_SUCCESS           Image was loaded into memory correctly.
@@ -803,12 +838,12 @@ EFI_STATUS
803 838
   Transfers control to a loaded image's entry point.
804 839
 
805 840
   @param  ImageHandle           Handle of image to be started.
806
-  @param  ExitDataSize          Pointer to the size, in bytes, of ExitData.
807
-  @param  ExitData              Pointer to a pointer to a data buffer that includes a Null-terminated
808
-                                Unicode string, optionally followed by additional binary data.
841
+  @param  ExitDataSize          The pointer to the size, in bytes, of ExitData.
842
+  @param  ExitData              The pointer to a pointer to a data buffer that includes a Null-terminated
843
+                                string, optionally followed by additional binary data.
809 844
 
810 845
   @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
811
-                                has already been initialized with StartImage
846
+                                has already been initialized with StartImage.
812 847
   @return Exit code from image
813 848
 
814 849
 **/
@@ -823,11 +858,16 @@ EFI_STATUS
823 858
 /**
824 859
   Terminates a loaded EFI image and returns control to boot services.
825 860
 
826
-  @param  ImageHandle           Handle that identifies the image.
861
+  @param  ImageHandle           Handle that identifies the image. This parameter is passed to the
862
+                                image on entry.
827 863
   @param  ExitStatus            The image's exit code.
828
-  @param  ExitDataSize          The size, in bytes, of ExitData.
829
-  @param  ExitData              Pointer to a data buffer that includes a Null-terminated Unicode string,
830
-                                optionally followed by additional binary data.
864
+  @param  ExitDataSize          The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
865
+  @param  ExitData              The pointer to a data buffer that includes a Null-terminated string,
866
+                                optionally followed by additional binary data. The string is a
867
+                                description that the caller may use to further indicate the reason
868
+                                for the image's exit. ExitData is only valid if ExitStatus
869
+                                is something other than EFI_SUCCESS. The ExitData buffer
870
+                                must be allocated by calling AllocatePool().
831 871
 
832 872
   @retval EFI_SUCCESS           The image specified by ImageHandle was unloaded.
833 873
   @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
@@ -851,8 +891,6 @@ EFI_STATUS
851 891
 
852 892
   @retval EFI_SUCCESS           The image has been unloaded.
853 893
   @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
854
-  @retval EFI_UNSUPPORTED       The image has been started, and does not support unload.
855
-  @return Exit code from the image's unload handler
856 894
 
857 895
 **/
858 896
 typedef
@@ -899,13 +937,13 @@ EFI_STATUS
899 937
   @param  Timeout               The number of seconds to set the watchdog timer to.
900 938
   @param  WatchdogCode          The numeric code to log on a watchdog timer timeout event.
901 939
   @param  DataSize              The size, in bytes, of WatchdogData.
902
-  @param  WatchdogData          A data buffer that includes a Null-terminated Unicode string, optionally
940
+  @param  WatchdogData          A data buffer that includes a Null-terminated string, optionally
903 941
                                 followed by additional binary data.
904 942
 
905 943
   @retval EFI_SUCCESS           The timeout has been set.
906 944
   @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
907 945
   @retval EFI_UNSUPPORTED       The system does not have a watchdog timer.
908
-  @retval EFI_DEVICE_ERROR      The watch dog timer could not be programmed due to a hardware
946
+  @retval EFI_DEVICE_ERROR      The watchdog timer could not be programmed due to a hardware
909 947
                                 error.
910 948
 
911 949
 **/
@@ -922,10 +960,25 @@ EFI_STATUS
922 960
 /// Enumeration of reset types.
923 961
 ///
924 962
 typedef enum {
963
+  ///
964
+  /// Used to induce a system-wide reset. This sets all circuitry within the
965
+  /// system to its initial state.  This type of reset is asynchronous to system
966
+  /// operation and operates withgout regard to cycle boundaries.  EfiColdReset
967
+  /// is tantamount to a system power cycle.
968
+  ///
925 969
   EfiResetCold,
970
+  ///
971
+  /// Used to induce a system-wide initialization. The processors are set to their
972
+  /// initial state, and pending cycles are not corrupted.  If the system does
973
+  /// not support this reset type, then an EfiResetCold must be performed.
974
+  ///
926 975
   EfiResetWarm,
927
-  EfiResetShutdown,
928
-  EfiResetUpdate
976
+  ///
977
+  /// Used to induce an entry into a power state equivalent to the ACPI G2/S5 or G3
978
+  /// state.  If the system does not support this reset type, then when the system
979
+  /// is rebooted, it should exhibit the EfiResetCold attributes.
980
+  ///
981
+  EfiResetShutdown
929 982
 } EFI_RESET_TYPE;
930 983
 
931 984
 /**
@@ -936,7 +989,7 @@ typedef enum {
936 989
   @param  DataSize              The size, in bytes, of WatchdogData.
937 990
   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or
938 991
                                 EfiResetShutdown the data buffer starts with a Null-terminated
939
-                                Unicode string, optionally followed by additional binary data.
992
+                                string, optionally followed by additional binary data.
940 993
 
941 994
 **/
942 995
 typedef
@@ -945,13 +998,13 @@ VOID
945 998
   IN EFI_RESET_TYPE           ResetType,
946 999
   IN EFI_STATUS               ResetStatus,
947 1000
   IN UINTN                    DataSize,
948
-  IN CHAR16                   *ResetData OPTIONAL
1001
+  IN VOID                     *ResetData OPTIONAL
949 1002
   );
950 1003
 
951 1004
 /**
952 1005
   Returns a monotonically increasing count for the platform.
953 1006
 
954
-  @param  Count                 Pointer to returned value.
1007
+  @param  Count                 The pointer to returned value.
955 1008
 
956 1009
   @retval EFI_SUCCESS           The next monotonic count was returned.
957 1010
   @retval EFI_INVALID_PARAMETER Count is NULL.
@@ -967,7 +1020,7 @@ EFI_STATUS
967 1020
 /**
968 1021
   Returns the next high 32 bits of the platform's monotonic counter.
969 1022
 
970
-  @param  HighCount             Pointer to returned value.
1023
+  @param  HighCount             The pointer to returned value.
971 1024
 
972 1025
   @retval EFI_SUCCESS           The next high monotonic count was returned.
973 1026
   @retval EFI_INVALID_PARAMETER HighCount is NULL.
@@ -1006,8 +1059,8 @@ EFI_STATUS
1006 1059
 /**
1007 1060
   Copies the contents of one buffer to another buffer.
1008 1061
 
1009
-  @param  Destination           Pointer to the destination buffer of the memory copy.
1010
-  @param  Source                Pointer to the source buffer of the memory copy.
1062
+  @param  Destination           The pointer to the destination buffer of the memory copy.
1063
+  @param  Source                The pointer to the source buffer of the memory copy.
1011 1064
   @param  Length                Number of bytes to copy from Source to Destination.
1012 1065
 
1013 1066
 **/
@@ -1022,7 +1075,7 @@ VOID
1022 1075
 /**
1023 1076
   The SetMem() function fills a buffer with a specified value.
1024 1077
 
1025
-  @param  Buffer                Pointer to the buffer to fill.
1078
+  @param  Buffer                The pointer to the buffer to fill.
1026 1079
   @param  Size                  Number of bytes in Buffer to fill.
1027 1080
   @param  Value                 Value to fill Buffer with.
1028 1081
 
@@ -1035,11 +1088,13 @@ VOID
1035 1088
   IN UINT8    Value
1036 1089
   );
1037 1090
 
1038
-
1039
-//
1040
-// Protocol handler functions
1041
-//
1091
+///
1092
+/// Enumeration of EFI Interface Types
1093
+///
1042 1094
 typedef enum {
1095
+  ///
1096
+  /// Indicates that the supplied protocol interface is supplied in native form.
1097
+  ///
1043 1098
   EFI_NATIVE_INTERFACE
1044 1099
 } EFI_INTERFACE_TYPE;
1045 1100
 
@@ -1262,7 +1317,9 @@ EFI_STATUS
1262 1317
   IN EFI_HANDLE               ControllerHandle
1263 1318
   );
1264 1319
 
1265
-
1320
+///
1321
+/// EFI Oprn Protocol Information Entry
1322
+///
1266 1323
 typedef struct {
1267 1324
   EFI_HANDLE  AgentHandle;
1268 1325
   EFI_HANDLE  ControllerHandle;
@@ -1346,10 +1403,22 @@ EFI_STATUS
1346 1403
   OUT VOID                     **Registration
1347 1404
   );
1348 1405
 
1349
-
1406
+///
1407
+/// Enumeration of EFI Locate Search Types
1408
+///
1350 1409
 typedef enum {
1410
+  ///
1411
+  /// Retrieve all the handles in the handle database.
1412
+  ///
1351 1413
   AllHandles,
1414
+  ///
1415
+  /// Retrieve the next handle fron a RegisterProtocolNotify() event.
1416
+  ///
1352 1417
   ByRegisterNotify,
1418
+  ///
1419
+  /// Retrieve the set of handles from the handle database that support a
1420
+  /// specified protocol.
1421
+  ///
1353 1422
   ByProtocol
1354 1423
 } EFI_LOCATE_SEARCH_TYPE;
1355 1424
 
@@ -1429,7 +1498,6 @@ EFI_STATUS
1429 1498
   IN VOID                     *Table
1430 1499
   );
1431 1500
 
1432
-
1433 1501
 /**
1434 1502
   Returns an array of handles that support the requested protocol in a buffer allocated from pool.
1435 1503
 
@@ -1483,33 +1551,75 @@ EFI_STATUS
1483 1551
   OUT VOID      **Interface
1484 1552
   );
1485 1553
 
1554
+///
1555
+/// EFI Capsule Block Descriptor
1556
+///
1486 1557
 typedef struct {
1487
-  UINT64                            Length;
1558
+  ///
1559
+  /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
1560
+  ///
1561
+  UINT64                  Length;
1488 1562
   union {
1563
+    ///
1564
+    /// Physical address of the data block. This member of the union is
1565
+    /// used if Length is not equal to zero.
1566
+    ///
1489 1567
     EFI_PHYSICAL_ADDRESS  DataBlock;
1568
+    ///
1569
+    /// Physical address of another block of
1570
+    /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This
1571
+    /// member of the union is used if Length is equal to zero. If
1572
+    /// ContinuationPointer is zero this entry represents the end of the list.
1573
+    ///
1490 1574
     EFI_PHYSICAL_ADDRESS  ContinuationPointer;
1491 1575
   } Union;
1492 1576
 } EFI_CAPSULE_BLOCK_DESCRIPTOR;
1493 1577
 
1578
+///
1579
+/// EFI Capsule Header.
1580
+///
1494 1581
 typedef struct {
1582
+  ///
1583
+  /// A GUID that defines the contents of a capsule.
1584
+  ///
1495 1585
   EFI_GUID          CapsuleGuid;
1586
+  ///
1587
+  /// The size of the capsule header. This may be larger than the size of
1588
+  /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
1589
+  /// extended header entries
1590
+  ///
1496 1591
   UINT32            HeaderSize;
1592
+  ///
1593
+  /// Bit-mapped list describing the capsule attributes. The Flag values
1594
+  /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
1595
+  /// of 0x10000 - 0xFFFFFFFF are defined by this specification
1596
+  ///
1497 1597
   UINT32            Flags;
1598
+  ///
1599
+  /// Size in bytes of the capsule.
1600
+  ///
1498 1601
   UINT32            CapsuleImageSize;
1499 1602
 } EFI_CAPSULE_HEADER;
1500 1603
 
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
-//
1604
+///
1605
+/// The EFI System Table entry must point to an array of capsules
1606
+/// that contain the same CapsuleGuid value. The array must be
1607
+/// prefixed by a UINT32 that represents the size of the array of capsules.
1608
+///
1506 1609
 typedef struct {
1610
+  ///
1611
+  /// the size of the array of capsules.
1612
+  ///
1507 1613
   UINT32   CapsuleArrayNumber;
1614
+  ///
1615
+  /// Point to an array of capsules that contain the same CapsuleGuid value.
1616
+  ///
1508 1617
   VOID*    CapsulePtr[1];
1509 1618
 } EFI_CAPSULE_TABLE;
1510 1619
 
1511 1620
 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000
1512 1621
 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000
1622
+#define CAPSULE_FLAGS_INITIATE_RESET                0x00040000
1513 1623
 
1514 1624
 /**
1515 1625
   Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
@@ -1529,8 +1639,10 @@ typedef struct {
1529 1639
   @retval EFI_SUCCESS           Valid capsule was passed. If
1530 1640
                                 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
1531 1641
                                 capsule has been successfully processed by the firmware.
1642
+  @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
1643
+                                set in the capsule header.
1644
+  @retval EFI_INVALID_PARAMETER CapsuleCount is 0.
1532 1645
   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
1533
-  @retval EFI_INVALID_PARAMETER CapsuleSize is NULL.
1534 1646
   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
1535 1647
   @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the capsule.
1536 1648
 
@@ -1606,18 +1718,20 @@ EFI_STATUS
1606 1718
 //
1607 1719
 // EFI Runtime Services Table
1608 1720
 //
1609
-#define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249ULL
1610
-#define EFI_SYSTEM_TABLE_REVISION       ((2<<16) | (10))
1611
-#define EFI_2_10_SYSTEM_TABLE_REVISION  ((2<<16) | (10))
1612
-#define EFI_2_00_SYSTEM_TABLE_REVISION  ((2<<16) | (00))
1613
-#define EFI_1_10_SYSTEM_TABLE_REVISION  ((1<<16) | (10))
1614
-#define EFI_1_02_SYSTEM_TABLE_REVISION  ((1<<16) | (02))
1615
-
1616
-#define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552ULL
1617
-#define EFI_RUNTIME_SERVICES_REVISION   EFI_2_10_SYSTEM_TABLE_REVISION
1721
+#define EFI_SYSTEM_TABLE_SIGNATURE      SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
1722
+#define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))
1723
+#define EFI_2_20_SYSTEM_TABLE_REVISION  ((2 << 16) | (20))
1724
+#define EFI_2_10_SYSTEM_TABLE_REVISION  ((2 << 16) | (10))
1725
+#define EFI_2_00_SYSTEM_TABLE_REVISION  ((2 << 16) | (00))
1726
+#define EFI_1_10_SYSTEM_TABLE_REVISION  ((1 << 16) | (10))
1727
+#define EFI_1_02_SYSTEM_TABLE_REVISION  ((1 << 16) | (02))
1728
+#define EFI_SYSTEM_TABLE_REVISION       EFI_2_30_SYSTEM_TABLE_REVISION
1729
+
1730
+#define EFI_RUNTIME_SERVICES_SIGNATURE  SIGNATURE_64 ('R','U','N','T','S','E','R','V')
1731
+#define EFI_RUNTIME_SERVICES_REVISION   EFI_2_30_SYSTEM_TABLE_REVISION
1618 1732
 
1619 1733
 ///
1620
-/// EFI Runtime Services Table
1734
+/// EFI Runtime Services Table.
1621 1735
 ///
1622 1736
 typedef struct {
1623 1737
   ///
@@ -1665,11 +1779,11 @@ typedef struct {
1665 1779
 } EFI_RUNTIME_SERVICES;
1666 1780
 
1667 1781
 
1668
-#define EFI_BOOT_SERVICES_SIGNATURE   0x56524553544f4f42ULL
1669
-#define EFI_BOOT_SERVICES_REVISION    EFI_2_10_SYSTEM_TABLE_REVISION
1782
+#define EFI_BOOT_SERVICES_SIGNATURE   SIGNATURE_64 ('B','O','O','T','S','E','R','V')
1783
+#define EFI_BOOT_SERVICES_REVISION    EFI_2_30_SYSTEM_TABLE_REVISION
1670 1784
 
1671 1785
 ///
1672
-/// EFI Boot Services Table
1786
+/// EFI Boot Services Table.
1673 1787
 ///
1674 1788
 typedef struct {
1675 1789
   ///
@@ -1770,7 +1884,7 @@ typedef struct {
1770 1884
 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
1771 1885
 /// EFI System Table.
1772 1886
 ///
1773
-typedef struct{
1887
+typedef struct {
1774 1888
   ///
1775 1889
   /// The 128-bit GUID value that uniquely identifies the system configuration table.
1776 1890
   ///
@@ -1784,14 +1898,14 @@ typedef struct{
1784 1898
 ///
1785 1899
 /// EFI System Table
1786 1900
 ///
1787
-struct _EFI_SYSTEM_TABLE {
1901
+typedef struct {
1788 1902
   ///
1789 1903
   /// The table header for the EFI System Table.
1790 1904
   ///
1791 1905
   EFI_TABLE_HEADER                  Hdr;
1792 1906
   ///
1793
-  /// A pointer to a null terminated Unicode string that identifies
1794
-  /// the vendor that produces the system firmware for the platform.
1907
+  /// A pointer to a null terminated string that identifies the vendor
1908
+  /// that produces the system firmware for the platform.
1795 1909
   ///
1796 1910
   CHAR16                            *FirmwareVendor;
1797 1911
   ///
@@ -1800,11 +1914,12 @@ struct _EFI_SYSTEM_TABLE {
1800 1914
   ///
1801 1915
   UINT32                            FirmwareRevision;
1802 1916
   ///
1803
-  /// The handle for the active console input device.
1917
+  /// The handle for the active console input device. This handle must support
1918
+  /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
1804 1919
   ///
1805 1920
   EFI_HANDLE                        ConsoleInHandle;
1806 1921
   ///
1807
-  /// A pointer to the SIMPLE_INPUT_PROTOCOL interface that is
1922
+  /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
1808 1923
   /// associated with ConsoleInHandle.
1809 1924
   ///
1810 1925
   EFI_SIMPLE_TEXT_INPUT_PROTOCOL    *ConIn;
@@ -1813,16 +1928,17 @@ struct _EFI_SYSTEM_TABLE {
1813 1928
   ///
1814 1929
   EFI_HANDLE                        ConsoleOutHandle;
1815 1930
   ///
1816
-  /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1931
+  /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1817 1932
   /// that is associated with ConsoleOutHandle.
1818 1933
   ///
1819 1934
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *ConOut;
1820 1935
   ///
1821 1936
   /// The handle for the active standard error console device.
1937
+  /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
1822 1938
   ///
1823 1939
   EFI_HANDLE                        StandardErrorHandle;
1824 1940
   ///
1825
-  /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1941
+  /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1826 1942
   /// that is associated with StandardErrorHandle.
1827 1943
   ///
1828 1944
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *StdErr;
@@ -1843,7 +1959,25 @@ struct _EFI_SYSTEM_TABLE {
1843 1959
   /// The number of entries in the table is NumberOfTableEntries.
1844 1960
   ///
1845 1961
   EFI_CONFIGURATION_TABLE           *ConfigurationTable;
1846
-};
1962
+} EFI_SYSTEM_TABLE;
1963
+
1964
+/**
1965
+  This is the declaration of an EFI image entry point. This entry point is
1966
+  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
1967
+  both device drivers and bus drivers.
1968
+
1969
+  @param  ImageHandle           The firmware allocated handle for the UEFI image.
1970
+  @param  SystemTable           A pointer to the EFI System Table.
1971
+
1972
+  @retval EFI_SUCCESS           The operation completed successfully.
1973
+  @retval Others                An unexpected error occurred.
1974
+**/
1975
+typedef
1976
+EFI_STATUS
1977
+(EFIAPI *EFI_IMAGE_ENTRY_POINT)(
1978
+  IN  EFI_HANDLE                   ImageHandle,
1979
+  IN  EFI_SYSTEM_TABLE             *SystemTable
1980
+  );
1847 1981
 
1848 1982
 //
1849 1983
 // EFI Load Options Attributes
@@ -1860,43 +1994,84 @@ struct _EFI_SYSTEM_TABLE {
1860 1994
 #define EFI_BOOT_OPTION_SUPPORT_APP   0x00000002
1861 1995
 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
1862 1996
 
1997
+///
1998
+/// EFI Boot Key Data
1999
+///
1863 2000
 typedef union {
1864 2001
   struct {
2002
+    ///
2003
+    /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.
2004
+    ///
1865 2005
     UINT32  Revision        : 8;
2006
+    ///
2007
+    /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
2008
+    ///
1866 2009
     UINT32  ShiftPressed    : 1;
2010
+    ///
2011
+    /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).
2012
+    ///
1867 2013
     UINT32  ControlPressed  : 1;
2014
+    ///
2015
+    /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
2016
+    ///
1868 2017
     UINT32  AltPressed      : 1;
2018
+    ///
2019
+    /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
2020
+    ///
1869 2021
     UINT32  LogoPressed     : 1;
2022
+    ///
2023
+    /// The Menu key must be pressed (1) or must not be pressed (0).
2024
+    ///
1870 2025
     UINT32  MenuPressed     : 1;
1871
-    UINT32  SysReqPessed    : 1;
2026
+    ///
2027
+    /// The SysReq key must be pressed (1) or must not be pressed (0).
2028
+    ///
2029
+    UINT32  SysReqPressed    : 1;
1872 2030
     UINT32  Reserved        : 16;
2031
+    ///
2032
+    /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
2033
+    /// zero, then only the shift state is considered. If more than one, then the boot option will
2034
+    /// only be launched if all of the specified keys are pressed with the same shift state.
2035
+    ///
1873 2036
     UINT32  InputKeyCount   : 2;
1874 2037
   } Options;
1875 2038
   UINT32  PackedValue;
1876
-} HOT_KEY_EFI_KEY_DATA;
2039
+} EFI_BOOT_KEY_DATA;
1877 2040
 
2041
+///
2042
+/// EFI Key Option.
2043
+///
1878 2044
 typedef struct {
1879
-  HOT_KEY_EFI_KEY_DATA  KeyOptions;
1880
-  UINT32                BootOptionCrc;
1881
-  UINT16                BootOption;
1882
-//EFI_INPUT_KEY         Keys[];
2045
+  ///
2046
+  /// Specifies options about how the key will be processed.
2047
+  ///
2048
+  EFI_BOOT_KEY_DATA  KeyData;
2049
+  ///
2050
+  /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
2051
+  /// which BootOption refers. If the CRC-32s do not match this value, then this key
2052
+  /// option is ignored.
2053
+  ///
2054
+  UINT32             BootOptionCrc;
2055
+  ///
2056
+  /// The Boot#### option which will be invoked if this key is pressed and the boot option
2057
+  /// is active (LOAD_OPTION_ACTIVE is set).
2058
+  ///
2059
+  UINT16             BootOption;
2060
+  ///
2061
+  /// The key codes to compare against those returned by the
2062
+  /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
2063
+  /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
2064
+  ///
2065
+  //EFI_INPUT_KEY      Keys[];
1883 2066
 } EFI_KEY_OPTION;
1884 2067
 
1885
-#define EFI_KEY_OPTION_SHIFT     0x00000001
1886
-#define EFI_KEY_OPTION_CONTROL   0x00000002
1887
-#define EFI_KEY_OPTION_ALT       0x00000004
1888
-#define EFI_KEY_OPTION_LOGO      0x00000008
1889
-#define EFI_KEY_OPTION_MENU      0x00000010
1890
-#define EFI_KEY_OPTION_SYSREQ    0x00000020
1891
-#define EFI_KEY_CODE_COUNT       0x00000300
1892
-
1893
-
1894 2068
 //
1895 2069
 // EFI File location to boot from on removable media devices
1896 2070
 //
1897 2071
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32    L"\\EFI\\BOOT\\BOOTIA32.EFI"
1898 2072
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"
1899 2073
 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
2074
+#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"
1900 2075
 
1901 2076
 #if   defined (MDE_CPU_IA32)
1902 2077
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
@@ -1905,6 +2080,8 @@ typedef struct {
1905 2080
 #elif defined (MDE_CPU_X64)
1906 2081
   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_X64
1907 2082
 #elif defined (MDE_CPU_EBC)
2083
+#elif defined (MDE_CPU_ARM)
2084
+  #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
1908 2085
 #else
1909 2086
   #error Unknown Processor Type
1910 2087
 #endif

+ 154
- 113
src/include/ipxe/efi/X64/ProcessorBind.h View File

@@ -1,8 +1,8 @@
1 1
 /** @file
2
-  Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
2
+  Processor or Compiler specific defines and types x64 (Intel 64, AMD64).
3 3
 
4
-  Copyright (c) 2006, Intel Corporation
5
-  All rights reserved. This program and the accompanying materials
4
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5
+  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
8 8
   http://opensource.org/licenses/bsd-license.php
@@ -20,16 +20,15 @@
20 20
 ///
21 21
 #define MDE_CPU_X64
22 22
 
23
-
24 23
 //
25
-// Make sure we are useing the correct packing rules per EFI specification
24
+// Make sure we are using the correct packing rules per EFI specification
26 25
 //
27
-#ifndef __GNUC__
26
+#if !defined(__GNUC__)
28 27
 #pragma pack()
29 28
 #endif
30 29
 
31 30
 
32
-#if __INTEL_COMPILER
31
+#if defined(__INTEL_COMPILER)
33 32
 //
34 33
 // Disable ICC's remark #869: "Parameter" was never referenced warning.
35 34
 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
@@ -48,10 +47,16 @@
48 47
 //
49 48
 #pragma warning ( disable : 1419 )
50 49
 
50
+//
51
+// Disable ICC's remark #593: "Variable" was set but never used.
52
+// This is legal ANSI C code so we disable the remark that is turned on with /W4
53
+//
54
+#pragma warning ( disable : 593 )
55
+
51 56
 #endif
52 57
 
53 58
 
54
-#if _MSC_EXTENSIONS
59
+#if defined(_MSC_EXTENSIONS)
55 60
 
56 61
 //
57 62
 // Disable warning that make it impossible to compile at /W4
@@ -85,123 +90,163 @@
85 90
 #pragma warning ( disable : 4505 )
86 91
 
87 92
 //
88
-// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
93
+// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
89 94
 //
90 95
 #pragma warning ( disable : 4206 )
91 96
 
92 97
 #endif
93 98
 
94 99
 
95
-#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
100
+#if defined(_MSC_EXTENSIONS)
96 101
   //
97
-  // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
102
+  // use Microsoft C complier dependent integer width types
98 103
   //
99 104
 
100
-  #if _MSC_EXTENSIONS
101
-
102
-
103
-    //
104
-    // use Microsoft C complier dependent interger width types
105
-    //
106
-    typedef unsigned __int64    UINT64;
107
-    typedef __int64             INT64;
108
-    typedef unsigned __int32    UINT32;
109
-    typedef __int32             INT32;
110
-    typedef unsigned short      UINT16;
111
-    typedef unsigned short      CHAR16;
112
-    typedef short               INT16;
113
-    typedef unsigned char       BOOLEAN;
114
-    typedef unsigned char       UINT8;
115
-    typedef char                CHAR8;
116
-    typedef char                INT8;
117
-  #else
118
-    #ifdef _EFI_P64
119
-      //
120
-      // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
121
-      //  are 32-bits
122
-      //
123
-      typedef unsigned long long  UINT64;
124
-      typedef long long           INT64;
125
-      typedef unsigned int        UINT32;
126
-      typedef int                 INT32;
127
-      typedef unsigned short      CHAR16;
128
-      typedef unsigned short      UINT16;
129
-      typedef short               INT16;
130
-      typedef unsigned char       BOOLEAN;
131
-      typedef unsigned char       UINT8;
132
-      typedef char                CHAR8;
133
-      typedef char                INT8;
134
-    #else
135
-      //
136
-      // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
137
-      //
138
-      typedef unsigned long   UINT64;
139
-      typedef long            INT64;
140
-      typedef unsigned int    UINT32;
141
-      typedef int             INT32;
142
-      typedef unsigned short  UINT16;
143
-      typedef unsigned short  CHAR16;
144
-      typedef short           INT16;
145
-      typedef unsigned char   BOOLEAN;
146
-      typedef unsigned char   UINT8;
147
-      typedef char            CHAR8;
148
-      typedef char            INT8;
149
-    #endif
150
-  #endif
151
-
152
-  #define UINT8_MAX 0xff
153
-
105
+  ///
106
+  /// 8-byte unsigned value
107
+  ///
108
+  typedef unsigned __int64    UINT64;
109
+  ///
110
+  /// 8-byte signed value
111
+  ///
112
+  typedef __int64             INT64;
113
+  ///
114
+  /// 4-byte unsigned value
115
+  ///
116
+  typedef unsigned __int32    UINT32;
117
+  ///
118
+  /// 4-byte signed value
119
+  ///
120
+  typedef __int32             INT32;
121
+  ///
122
+  /// 2-byte unsigned value
123
+  ///
124
+  typedef unsigned short      UINT16;
125
+  ///
126
+  /// 2-byte Character.  Unless otherwise specified all strings are stored in the
127
+  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
128
+  ///
129
+  typedef unsigned short      CHAR16;
130
+  ///
131
+  /// 2-byte signed value
132
+  ///
133
+  typedef short               INT16;
134
+  ///
135
+  /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
136
+  /// values are undefined.
137
+  ///
138
+  typedef unsigned char       BOOLEAN;
139
+  ///
140
+  /// 1-byte unsigned value
141
+  ///
142
+  typedef unsigned char       UINT8;
143
+  ///
144
+  /// 1-byte Character
145
+  ///
146
+  typedef char                CHAR8;
147
+  ///
148
+  /// 1-byte signed value
149
+  ///
150
+  typedef char                INT8;
154 151
 #else
155
-  //
156
-  // Use ANSI C 2000 stdint.h integer width declarations
157
-  //
158
-  #include <stdint.h>
159
-  typedef uint8_t   BOOLEAN;
160
-  typedef int8_t    INT8;
161
-  typedef uint8_t   UINT8;
162
-  typedef int16_t   INT16;
163
-  typedef uint16_t  UINT16;
164
-  typedef int32_t   INT32;
165
-  typedef uint32_t  UINT32;
166
-  typedef int64_t   INT64;
167
-  typedef uint64_t  UINT64;
168
-  typedef char      CHAR8;
169
-  typedef uint16_t  CHAR16;
170
-
152
+  ///
153
+  /// 8-byte unsigned value
154
+  ///
155
+  typedef unsigned long long  UINT64;
156
+  ///
157
+  /// 8-byte signed value
158
+  ///
159
+  typedef long long           INT64;
160
+  ///
161
+  /// 4-byte unsigned value
162
+  ///
163
+  typedef unsigned int        UINT32;
164
+  ///
165
+  /// 4-byte signed value
166
+  ///
167
+  typedef int                 INT32;
168
+  ///
169
+  /// 2-byte unsigned value
170
+  ///
171
+  typedef unsigned short      UINT16;
172
+  ///
173
+  /// 2-byte Character.  Unless otherwise specified all strings are stored in the
174
+  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
175
+  ///
176
+  typedef unsigned short      CHAR16;
177
+  ///
178
+  /// 2-byte signed value
179
+  ///
180
+  typedef short               INT16;
181
+  ///
182
+  /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
183
+  /// values are undefined.
184
+  ///
185
+  typedef unsigned char       BOOLEAN;
186
+  ///
187
+  /// 1-byte unsigned value
188
+  ///
189
+  typedef unsigned char       UINT8;
190
+  ///
191
+  /// 1-byte Character
192
+  ///
193
+  typedef char                CHAR8;
194
+  ///
195
+  /// 1-byte signed value
196
+  ///
197
+  typedef char                INT8;
171 198
 #endif
172 199
 
200
+///
201
+/// Unsigned value of native width.  (4 bytes on supported 32-bit processor instructions,
202
+/// 8 bytes on supported 64-bit processor instructions)
203
+///
173 204
 typedef UINT64  UINTN;
205
+///
206
+/// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
207
+/// 8 bytes on supported 64-bit processor instructions)
208
+///
174 209
 typedef INT64   INTN;
175 210
 
176 211
 
177 212
 //
178 213
 // Processor specific defines
179 214
 //
215
+
216
+///
217
+/// A value of native width with the highest bit set.
218
+///
180 219
 #define MAX_BIT     0x8000000000000000ULL
220
+///
221
+/// A value of native width with the two highest bits set.
222
+///
181 223
 #define MAX_2_BITS  0xC000000000000000ULL
182 224
 
183
-//
184
-// Maximum legal X64 address
185
-//
225
+///
226
+/// Maximum legal x64 address
227
+///
186 228
 #define MAX_ADDRESS   0xFFFFFFFFFFFFFFFFULL
187 229
 
188
-//
189
-// The stack alignment required for X64
190
-//
230
+///
231
+/// The stack alignment required for x64
232
+///
191 233
 #define CPU_STACK_ALIGNMENT   16
192 234
 
193 235
 //
194 236
 // Modifier to ensure that all protocol member functions and EFI intrinsics
195 237
 // use the correct C calling convention. All protocol member functions and
196
-// EFI intrinsics are required to modify thier member functions with EFIAPI.
238
+// EFI intrinsics are required to modify their member functions with EFIAPI.
197 239
 //
198
-#if _MSC_EXTENSIONS
240
+#ifdef EFIAPI
199 241
   ///
200
-  /// Define the standard calling convention reguardless of optimization level.
201
-  /// __cdecl is Microsoft* specific C extension.
242
+  /// If EFIAPI is already defined, then we use that definition.
243
+  ///
244
+#elif defined(_MSC_EXTENSIONS)
245
+  ///
246
+  /// Microsoft* compiler specific method for EFIAPI calling convension
202 247
   ///
203 248
   #define EFIAPI __cdecl
204
-#elif __GNUC__
249
+#elif defined(__GNUC__)
205 250
   ///
206 251
   /// Define the standard calling convention reguardless of optimization level.
207 252
   /// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
@@ -210,7 +255,7 @@ typedef INT64   INTN;
210 255
   /// x64. Warning the assembly code in the MDE x64 does not follow the correct
211 256
   /// ABI for the standard x64 (x86-64) GCC.
212 257
   ///
213
-  #define EFIAPI __attribute__((ms_abi))
258
+  #define EFIAPI
214 259
 #else
215 260
   ///
216 261
   /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
@@ -219,29 +264,25 @@ typedef INT64   INTN;
219 264
   #define EFIAPI
220 265
 #endif
221 266
 
222
-//
223
-// The Microsoft* C compiler can removed references to unreferenced data items
224
-//  if the /OPT:REF linker option is used. We defined a macro as this is a
225
-//  a non standard extension
226
-//
227
-#if _MSC_EXTENSIONS
228
-  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
229
-#else
230
-  #define GLOBAL_REMOVE_IF_UNREFERENCED
267
+#if defined(__GNUC__)
268
+  ///
269
+  /// For GNU assembly code, .global or .globl can declare global symbols.
270
+  /// Define this macro to unify the usage.
271
+  ///
272
+  #define ASM_GLOBAL .globl
231 273
 #endif
232 274
 
233
-//
234
-// For symbol name in GNU assembly code, an extra "_" is necessary
235
-//
236
-#if __GNUC__
237
-  #if defined(linux)
238
-    #define ASM_PFX(name) name
239
-  #else
240
-    #define ASM_PFX(name) _##name
241
-  #endif
242
-#endif
275
+/**
276
+  Return the pointer to the first instruction of a function given a function pointer.
277
+  On x64 CPU architectures, these two pointer values are the same,
278
+  so the implementation of this macro is very simple.
279
+
280
+  @param  FunctionPointer   A pointer to a function.
243 281
 
244
-#define FUNCTION_ENTRY_POINT(p) (p)
282
+  @return The pointer to the first instruction of a function given a function pointer.
283
+
284
+**/
285
+#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
245 286
 
246 287
 #endif
247 288
 

+ 10
- 0
src/include/ipxe/efi/efi.h View File

@@ -36,6 +36,16 @@
36 36
 #define __GNUC__ 1
37 37
 #endif
38 38
 
39
+/* EFI headers think your compiler uses the MS ABI by default on X64 */
40
+#if __x86_64__
41
+#define EFIAPI __attribute__((ms_abi))
42
+#endif
43
+
44
+/* EFI headers assume regparm(0) on i386, but that is not the case for iPXE */
45
+#if __i386__
46
+#define EFIAPI __attribute__((cdecl,regparm(0)))
47
+#endif
48
+
39 49
 /* Include the top-level EFI header files */
40 50
 #include <ipxe/efi/Uefi.h>
41 51
 #include <ipxe/efi/PiDxe.h>

+ 1
- 1
src/interface/efi/efi_smbios.c View File

@@ -31,7 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
31 31
 
32 32
 /** SMBIOS configuration table */
33 33
 static struct smbios_entry *smbios_entry;
34
-EFI_USE_TABLE ( EFI_SMBIOS_TABLE, &smbios_entry, 0 );
34
+EFI_USE_TABLE ( SMBIOS_TABLE, &smbios_entry, 0 );
35 35
 
36 36
 /**
37 37
  * Find SMBIOS

Loading…
Cancel
Save