Browse Source

[efi] Add EFI headers from the EFI Development Kit (edk2)

The intention is to include near-verbatim copies of the EFI headers
required by gPXE.  This is achieved using the import.pl script in
src/include/gpxe/efi.

Note that import.pl will modify any #include lines in each imported
header to reflect its new location within the gPXE tree.  It will also
tidy up the file by removing carriage return characters and trailing
whitespace.
tags/v0.9.6
Michael Brown 16 years ago
parent
commit
ac663cf509

+ 305
- 0
src/include/gpxe/efi/Base.h View File

@@ -0,0 +1,305 @@
1
+/** @file
2
+
3
+  Root include file for Mde Package Base type modules
4
+
5
+  This is the include file for any module of type base. Base modules only use
6
+  types defined via this include file and can be ported easily to any
7
+  environment. There are a set of base libraries in the Mde Package that can
8
+  be used to implement base modules.
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
15
+
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.
18
+
19
+**/
20
+
21
+
22
+#ifndef __BASE_H__
23
+#define __BASE_H__
24
+
25
+//
26
+// Include processor specific binding
27
+//
28
+#include <gpxe/efi/ProcessorBind.h>
29
+
30
+typedef struct {
31
+  UINT32  Data1;
32
+  UINT16  Data2;
33
+  UINT16  Data3;
34
+  UINT8   Data4[8];
35
+} GUID;
36
+
37
+typedef UINT64 PHYSICAL_ADDRESS;
38
+
39
+///
40
+/// LIST_ENTRY definition
41
+///
42
+typedef struct _LIST_ENTRY LIST_ENTRY;
43
+
44
+struct _LIST_ENTRY {
45
+  LIST_ENTRY  *ForwardLink;
46
+  LIST_ENTRY  *BackLink;
47
+};
48
+
49
+//
50
+// Modifiers to absract standard types to aid in debug of problems
51
+//
52
+#define CONST     const
53
+#define STATIC    static
54
+#define VOID      void
55
+
56
+//
57
+// Modifiers for Data Types used to self document code.
58
+// This concept is borrowed for UEFI specification.
59
+//
60
+#ifndef IN
61
+//
62
+// Some other envirnments use this construct, so #ifndef to prevent
63
+// mulitple definition.
64
+//
65
+#define IN
66
+#define OUT
67
+#define OPTIONAL
68
+#endif
69
+
70
+//
71
+// Constants. They may exist in other build structures, so #ifndef them.
72
+//
73
+#ifndef TRUE
74
+//
75
+//  UEFI specification claims 1 and 0. We are concerned about the
76
+//  complier portability so we did it this way.
77
+//
78
+#define TRUE  ((BOOLEAN)(1==1))
79
+#endif
80
+
81
+#ifndef FALSE
82
+#define FALSE ((BOOLEAN)(0==1))
83
+#endif
84
+
85
+#ifndef NULL
86
+#define NULL  ((VOID *) 0)
87
+#endif
88
+
89
+#define  BIT0     0x00000001
90
+#define  BIT1     0x00000002
91
+#define  BIT2     0x00000004
92
+#define  BIT3     0x00000008
93
+#define  BIT4     0x00000010
94
+#define  BIT5     0x00000020
95
+#define  BIT6     0x00000040
96
+#define  BIT7     0x00000080
97
+#define  BIT8     0x00000100
98
+#define  BIT9     0x00000200
99
+#define  BIT10    0x00000400
100
+#define  BIT11    0x00000800
101
+#define  BIT12    0x00001000
102
+#define  BIT13    0x00002000
103
+#define  BIT14    0x00004000
104
+#define  BIT15    0x00008000
105
+#define  BIT16    0x00010000
106
+#define  BIT17    0x00020000
107
+#define  BIT18    0x00040000
108
+#define  BIT19    0x00080000
109
+#define  BIT20    0x00100000
110
+#define  BIT21    0x00200000
111
+#define  BIT22    0x00400000
112
+#define  BIT23    0x00800000
113
+#define  BIT24    0x01000000
114
+#define  BIT25    0x02000000
115
+#define  BIT26    0x04000000
116
+#define  BIT27    0x08000000
117
+#define  BIT28    0x10000000
118
+#define  BIT29    0x20000000
119
+#define  BIT30    0x40000000
120
+#define  BIT31    0x80000000
121
+#define  BIT32    0x0000000100000000UL
122
+#define  BIT33    0x0000000200000000UL
123
+#define  BIT34    0x0000000400000000UL
124
+#define  BIT35    0x0000000800000000UL
125
+#define  BIT36    0x0000001000000000UL
126
+#define  BIT37    0x0000002000000000UL
127
+#define  BIT38    0x0000004000000000UL
128
+#define  BIT39    0x0000008000000000UL
129
+#define  BIT40    0x0000010000000000UL
130
+#define  BIT41    0x0000020000000000UL
131
+#define  BIT42    0x0000040000000000UL
132
+#define  BIT43    0x0000080000000000UL
133
+#define  BIT44    0x0000100000000000UL
134
+#define  BIT45    0x0000200000000000UL
135
+#define  BIT46    0x0000400000000000UL
136
+#define  BIT47    0x0000800000000000UL
137
+#define  BIT48    0x0001000000000000UL
138
+#define  BIT49    0x0002000000000000UL
139
+#define  BIT50    0x0004000000000000UL
140
+#define  BIT51    0x0008000000000000UL
141
+#define  BIT52    0x0010000000000000UL
142
+#define  BIT53    0x0020000000000000UL
143
+#define  BIT54    0x0040000000000000UL
144
+#define  BIT55    0x0080000000000000UL
145
+#define  BIT56    0x0100000000000000UL
146
+#define  BIT57    0x0200000000000000UL
147
+#define  BIT58    0x0400000000000000UL
148
+#define  BIT59    0x0800000000000000UL
149
+#define  BIT60    0x1000000000000000UL
150
+#define  BIT61    0x2000000000000000UL
151
+#define  BIT62    0x4000000000000000UL
152
+#define  BIT63    0x8000000000000000UL
153
+
154
+//
155
+//  Support for variable length argument lists using the ANSI standard.
156
+//
157
+//  Since we are using the ANSI standard we used the standard nameing and
158
+//  did not folow the coding convention
159
+//
160
+//  VA_LIST  - typedef for argument list.
161
+//  VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
162
+//  VA_END (VA_LIST Marker) - Clear Marker
163
+//  VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from
164
+//    the ... list. You must know the size and pass it in this macro.
165
+//
166
+//  example:
167
+//
168
+//  UINTN
169
+//  ExampleVarArg (
170
+//    IN UINTN  NumberOfArgs,
171
+//    ...
172
+//    )
173
+//  {
174
+//    VA_LIST Marker;
175
+//    UINTN   Index;
176
+//    UINTN   Result;
177
+//
178
+//    //
179
+//    // Initialize the Marker
180
+//    //
181
+//    VA_START (Marker, NumberOfArgs);
182
+//    for (Index = 0, Result = 0; Index < NumberOfArgs; Index++) {
183
+//      //
184
+//      // The ... list is a series of UINTN values, so average them up.
185
+//      //
186
+//      Result += VA_ARG (Marker, UINTN);
187
+//    }
188
+//
189
+//    VA_END (Marker);
190
+//    return Result
191
+//  }
192
+//
193
+
194
+#define _INT_SIZE_OF(n) ((sizeof (n) + sizeof (UINTN) - 1) &~(sizeof (UINTN) - 1))
195
+
196
+//
197
+// Also support coding convention rules for var arg macros
198
+//
199
+#ifndef VA_START
200
+
201
+typedef CHAR8 *VA_LIST;
202
+#define VA_START(ap, v) (ap = (VA_LIST) & (v) + _INT_SIZE_OF (v))
203
+#define VA_ARG(ap, t)   (*(t *) ((ap += _INT_SIZE_OF (t)) - _INT_SIZE_OF (t)))
204
+#define VA_END(ap)      (ap = (VA_LIST) 0)
205
+
206
+#endif
207
+
208
+//
209
+// Macro that returns the byte offset of a field in a data structure.
210
+//
211
+#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
212
+
213
+///
214
+///  CONTAINING_RECORD - returns a pointer to the structure
215
+///      from one of it's elements.
216
+///
217
+#define _CR(Record, TYPE, Field)  ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
218
+
219
+///
220
+///  ALIGN_POINTER - aligns a pointer to the lowest boundry
221
+///
222
+#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
223
+
224
+///
225
+///  ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
226
+///
227
+#define ALIGN_VARIABLE(Value, Adjustment) \
228
+  Adjustment = 0U; \
229
+  if ((UINTN) (Value) % sizeof (UINTN)) { \
230
+    (Adjustment) = (UINTN)(sizeof (UINTN) - ((UINTN) (Value) % sizeof (UINTN))); \
231
+  } \
232
+  (Value) = (UINTN)((UINTN) (Value) + (UINTN) (Adjustment))
233
+
234
+//
235
+// Return the maximum of two operands.
236
+// This macro returns the maximum of two operand specified by a and b.
237
+// Both a and b must be the same numerical types, signed or unsigned.
238
+//
239
+#define MAX(a, b)                       \
240
+  (((a) > (b)) ? (a) : (b))
241
+
242
+
243
+//
244
+// Return the minimum of two operands.
245
+// This macro returns the minimal of two operand specified by a and b.
246
+// Both a and b must be the same numerical types, signed or unsigned.
247
+//
248
+#define MIN(a, b)                       \
249
+  (((a) < (b)) ? (a) : (b))
250
+
251
+
252
+//
253
+// EFI Error Codes common to all execution phases
254
+//
255
+
256
+typedef INTN RETURN_STATUS;
257
+
258
+///
259
+/// Set the upper bit to indicate EFI Error.
260
+///
261
+#define ENCODE_ERROR(a)              (MAX_BIT | (a))
262
+
263
+#define ENCODE_WARNING(a)            (a)
264
+#define RETURN_ERROR(a)              ((INTN) (a) < 0)
265
+
266
+#define RETURN_SUCCESS               0
267
+#define RETURN_LOAD_ERROR            ENCODE_ERROR (1)
268
+#define RETURN_INVALID_PARAMETER     ENCODE_ERROR (2)
269
+#define RETURN_UNSUPPORTED           ENCODE_ERROR (3)
270
+#define RETURN_BAD_BUFFER_SIZE       ENCODE_ERROR (4)
271
+#define RETURN_BUFFER_TOO_SMALL      ENCODE_ERROR (5)
272
+#define RETURN_NOT_READY             ENCODE_ERROR (6)
273
+#define RETURN_DEVICE_ERROR          ENCODE_ERROR (7)
274
+#define RETURN_WRITE_PROTECTED       ENCODE_ERROR (8)
275
+#define RETURN_OUT_OF_RESOURCES      ENCODE_ERROR (9)
276
+#define RETURN_VOLUME_CORRUPTED      ENCODE_ERROR (10)
277
+#define RETURN_VOLUME_FULL           ENCODE_ERROR (11)
278
+#define RETURN_NO_MEDIA              ENCODE_ERROR (12)
279
+#define RETURN_MEDIA_CHANGED         ENCODE_ERROR (13)
280
+#define RETURN_NOT_FOUND             ENCODE_ERROR (14)
281
+#define RETURN_ACCESS_DENIED         ENCODE_ERROR (15)
282
+#define RETURN_NO_RESPONSE           ENCODE_ERROR (16)
283
+#define RETURN_NO_MAPPING            ENCODE_ERROR (17)
284
+#define RETURN_TIMEOUT               ENCODE_ERROR (18)
285
+#define RETURN_NOT_STARTED           ENCODE_ERROR (19)
286
+#define RETURN_ALREADY_STARTED       ENCODE_ERROR (20)
287
+#define RETURN_ABORTED               ENCODE_ERROR (21)
288
+#define RETURN_ICMP_ERROR            ENCODE_ERROR (22)
289
+#define RETURN_TFTP_ERROR            ENCODE_ERROR (23)
290
+#define RETURN_PROTOCOL_ERROR        ENCODE_ERROR (24)
291
+#define RETURN_INCOMPATIBLE_VERSION  ENCODE_ERROR (25)
292
+#define RETURN_SECURITY_VIOLATION    ENCODE_ERROR (26)
293
+#define RETURN_CRC_ERROR             ENCODE_ERROR (27)
294
+#define RETURN_END_OF_MEDIA          ENCODE_ERROR (28)
295
+#define RETURN_END_OF_FILE           ENCODE_ERROR (31)
296
+#define RETURN_INVALID_LANGUAGE      ENCODE_ERROR (32)
297
+
298
+
299
+#define RETURN_WARN_UNKNOWN_GLYPH    ENCODE_WARNING (1)
300
+#define RETURN_WARN_DELETE_FAILURE   ENCODE_WARNING (2)
301
+#define RETURN_WARN_WRITE_FAILURE    ENCODE_WARNING (3)
302
+#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)
303
+
304
+#endif
305
+

+ 58
- 0
src/include/gpxe/efi/Guid/PcAnsi.h View File

@@ -0,0 +1,58 @@
1
+/** @file
2
+  Terminal Device Path Vendor Guid.
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
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
+  GUIDs defined in UEFI 2.0 spec.
15
+
16
+**/
17
+
18
+#ifndef __PC_ANSI_H__
19
+#define __PC_ANSI_H__
20
+
21
+#define EFI_PC_ANSI_GUID \
22
+  { \
23
+    0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
24
+  }
25
+
26
+#define EFI_VT_100_GUID \
27
+  { \
28
+    0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
29
+  }
30
+
31
+#define EFI_VT_100_PLUS_GUID \
32
+  { \
33
+    0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43 } \
34
+  }
35
+
36
+#define EFI_VT_UTF8_GUID \
37
+  { \
38
+    0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88 } \
39
+  }
40
+
41
+#define EFI_UART_DEVICE_PATH_GUID \
42
+  { \
43
+    0x37499a9d, 0x542f, 0x4c89, {0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 } \
44
+  }
45
+
46
+#define EFI_SAS_DEVICE_PATH_GUID \
47
+  { \
48
+    0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
49
+  }
50
+
51
+extern EFI_GUID gEfiPcAnsiGuid;
52
+extern EFI_GUID gEfiVT100Guid;
53
+extern EFI_GUID gEfiVT100PlusGuid;
54
+extern EFI_GUID gEfiVTUTF8Guid;
55
+extern EFI_GUID gEfiUartDevicePathGuid;
56
+extern EFI_GUID gEfiSasDevicePathGuid;
57
+
58
+#endif

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

@@ -0,0 +1,221 @@
1
+/** @file
2
+  Processor or Compiler specific defines and types for Ia32 architecture.
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
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
+**/
14
+
15
+#ifndef __PROCESSOR_BIND_H__
16
+#define __PROCESSOR_BIND_H__
17
+
18
+///
19
+/// Define the processor type so other code can make processor based choices
20
+///
21
+#define MDE_CPU_IA32
22
+
23
+//
24
+// Make sure we are useing the correct packing rules per EFI specification
25
+//
26
+#ifndef __GNUC__
27
+#pragma pack()
28
+#endif
29
+
30
+#if __INTEL_COMPILER
31
+//
32
+// Disable ICC's remark #593: "LocalVariable" was set but never used
33
+// This is legal ANSI C code so we disable the remark that is turned on with -Wall
34
+//
35
+#pragma warning ( disable : 593 )
36
+
37
+//
38
+// Disable ICC's remark #869: "Parameter" was never referenced warning.
39
+// This is legal ANSI C code so we disable the remark that is turned on with -Wall
40
+//
41
+#pragma warning ( disable : 869 )
42
+
43
+//
44
+// Disable ICC's remark #1418: external function definition with no prior declaration.
45
+// This is legal ANSI C code so we disable the remark that is turned on with /W4
46
+//
47
+#pragma warning ( disable : 1418 )
48
+
49
+//
50
+// Disable ICC's remark #1419: external declaration in primary source file
51
+// This is legal ANSI C code so we disable the remark that is turned on with /W4
52
+//
53
+#pragma warning ( disable : 1419 )
54
+
55
+#endif
56
+
57
+
58
+#if _MSC_EXTENSIONS
59
+
60
+//
61
+// Disable warning that make it impossible to compile at /W4
62
+// This only works for Microsoft* tools
63
+//
64
+
65
+//
66
+// Disabling bitfield type checking warnings.
67
+//
68
+#pragma warning ( disable : 4214 )
69
+
70
+//
71
+// Disabling the unreferenced formal parameter warnings.
72
+//
73
+#pragma warning ( disable : 4100 )
74
+
75
+//
76
+// Disable slightly different base types warning as CHAR8 * can not be set
77
+// to a constant string.
78
+//
79
+#pragma warning ( disable : 4057 )
80
+
81
+//
82
+// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
83
+//
84
+#pragma warning ( disable : 4127 )
85
+
86
+//
87
+// This warning is caused by functions defined but not used. For precompiled header only.
88
+//
89
+#pragma warning ( disable : 4505 )
90
+
91
+//
92
+// This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
93
+//
94
+#pragma warning ( disable : 4206 )
95
+
96
+#endif
97
+
98
+
99
+#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
100
+  //
101
+  // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
102
+  //
103
+
104
+  #if _MSC_EXTENSIONS
105
+
106
+    //
107
+    // use Microsoft* C complier dependent interger width types
108
+    //
109
+    typedef unsigned __int64    UINT64;
110
+    typedef __int64             INT64;
111
+    typedef unsigned __int32    UINT32;
112
+    typedef __int32             INT32;
113
+    typedef unsigned short      UINT16;
114
+    typedef unsigned short      CHAR16;
115
+    typedef short               INT16;
116
+    typedef unsigned char       BOOLEAN;
117
+    typedef unsigned char       UINT8;
118
+    typedef char                CHAR8;
119
+    typedef char                INT8;
120
+  #else
121
+
122
+    //
123
+    // Assume standard IA-32 alignment.
124
+    // Need to check portability of long long
125
+    //
126
+    typedef unsigned long long  UINT64;
127
+    typedef long long           INT64;
128
+    typedef unsigned int        UINT32;
129
+    typedef int                 INT32;
130
+    typedef unsigned short      UINT16;
131
+    typedef unsigned short      CHAR16;
132
+    typedef short               INT16;
133
+    typedef unsigned char       BOOLEAN;
134
+    typedef unsigned char       UINT8;
135
+    typedef char                CHAR8;
136
+    typedef char                INT8;
137
+  #endif
138
+
139
+  #define UINT8_MAX 0xff
140
+
141
+#else
142
+  //
143
+  // Use ANSI C 2000 stdint.h integer width declarations
144
+  //
145
+  #include "stdint.h"
146
+  typedef uint8_t   BOOLEAN;
147
+  typedef int8_t    INT8;
148
+  typedef uint8_t   UINT8;
149
+  typedef int16_t   INT16;
150
+  typedef uint16_t  UINT16;
151
+  typedef int32_t   INT32;
152
+  typedef uint32_t  UINT32;
153
+  typedef int64_t   INT64;
154
+  typedef uint64_t  UINT64;
155
+  typedef char      CHAR8;
156
+  typedef uint16_t  CHAR16;
157
+
158
+#endif
159
+
160
+typedef UINT32  UINTN;
161
+typedef INT32   INTN;
162
+
163
+
164
+///
165
+/// Processor specific defines
166
+///
167
+#define MAX_BIT     0x80000000
168
+#define MAX_2_BITS  0xC0000000
169
+
170
+///
171
+/// Maximum legal IA-32 address
172
+///
173
+#define MAX_ADDRESS   0xFFFFFFFF
174
+
175
+///
176
+/// The stack alignment required for IA-32
177
+///
178
+#define CPU_STACK_ALIGNMENT   sizeof(UINTN)
179
+
180
+//
181
+// Modifier to ensure that all protocol member functions and EFI intrinsics
182
+// use the correct C calling convention. All protocol member functions and
183
+// EFI intrinsics are required to modify thier member functions with EFIAPI.
184
+//
185
+#if _MSC_EXTENSIONS
186
+  ///
187
+  /// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
188
+  ///
189
+  #define EFIAPI __cdecl
190
+#else
191
+  #if __GNUC__
192
+    #define EFIAPI __attribute__((cdecl,regparm(0)))
193
+  #endif
194
+#endif
195
+
196
+//
197
+// The Microsoft* C compiler can removed references to unreferenced data items
198
+//  if the /OPT:REF linker option is used. We defined a macro as this is a
199
+//  a non standard extension
200
+//
201
+#if _MSC_EXTENSIONS
202
+  #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
203
+#else
204
+  #define GLOBAL_REMOVE_IF_UNREFERENCED
205
+#endif
206
+
207
+//
208
+// For symbol name in GNU assembly code, an extra "_" is necessary
209
+//
210
+#if __GNUC__
211
+  #if defined(linux)
212
+    #define ASM_PFX(name) name
213
+  #else
214
+    #define ASM_PFX(name) _##name
215
+  #endif
216
+#endif
217
+
218
+#define FUNCTION_ENTRY_POINT(p) (p)
219
+
220
+#endif
221
+

+ 40
- 0
src/include/gpxe/efi/LICENCE View File

@@ -0,0 +1,40 @@
1
+The EFI headers contained herein are copied from the EFI Development
2
+Kit, available from http://www.tianocore.org and published under the
3
+following licence:
4
+
5
+  BSD License from Intel
6
+  Copyright (c) 2004, Intel Corporation
7
+  All rights reserved.
8
+
9
+  Redistribution and use in source and binary forms, with or without
10
+  modification, are permitted provided that the following conditions
11
+  are met:
12
+
13
+  Redistributions of source code must retain the above copyright
14
+  notice, this list of conditions and the following disclaimer.
15
+
16
+  Redistributions in binary form must reproduce the above copyright
17
+  notice, this list of conditions and the following disclaimer in the
18
+  documentation and/or other materials provided with the distribution.
19
+
20
+  Neither the name of the Intel Corporation nor the names of its
21
+  contributors may be used to endorse or promote products derived from
22
+  this software without specific prior written permission.
23
+
24
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
+  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
+  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
+  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
+  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
+  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
+  POSSIBILITY OF SUCH DAMAGE.
36
+
37
+
38
+This licence applies only to files that are part of the EFI
39
+Development Kit.  Other files may contain their own licence terms, or
40
+may fall under the standard gPXE GPL licence.

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

@@ -0,0 +1,43 @@
1
+/** @file
2
+  Present the boot mode values in PI.
3
+
4
+  Copyright (c) 2006 - 2007, 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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+#ifndef __PI_BOOT_MODE_H__
19
+#define __PI_BOOT_MODE_H__
20
+
21
+#include <gpxe/efi/ProcessorBind.h>
22
+
23
+///
24
+/// EFI boot mode
25
+///
26
+typedef UINT32  EFI_BOOT_MODE;
27
+
28
+//
29
+// 0x21 - 0xf..f are reserved.
30
+//
31
+#define BOOT_WITH_FULL_CONFIGURATION                  0x00
32
+#define BOOT_WITH_MINIMAL_CONFIGURATION               0x01
33
+#define BOOT_ASSUMING_NO_CONFIGURATION_CHANGES        0x02
34
+#define BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
35
+#define BOOT_WITH_DEFAULT_SETTINGS                    0x04
36
+#define BOOT_ON_S4_RESUME                             0x05
37
+#define BOOT_ON_S5_RESUME                             0x06
38
+#define BOOT_ON_S2_RESUME                             0x10
39
+#define BOOT_ON_S3_RESUME                             0x11
40
+#define BOOT_ON_FLASH_UPDATE                          0x12
41
+#define BOOT_IN_RECOVERY_MODE                         0x20
42
+
43
+#endif

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

@@ -0,0 +1,47 @@
1
+/** @file
2
+  Present the dependency expression values in PI.
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
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
+  Version 1.0.
15
+
16
+**/
17
+#ifndef __PI_DEPENDENCY_H__
18
+#define __PI_DEPENDENCY_H__
19
+
20
+///
21
+/// If present, this must be the first and only opcode,
22
+/// EFI_DEP_BEFORE is only used by DXE driver.
23
+///
24
+#define EFI_DEP_BEFORE        0x00
25
+
26
+///
27
+/// If present, this must be the first and only opcode,
28
+/// EFI_DEP_AFTER is only used by DXE driver.
29
+///
30
+#define EFI_DEP_AFTER         0x01
31
+
32
+#define EFI_DEP_PUSH          0x02
33
+#define EFI_DEP_AND           0x03
34
+#define EFI_DEP_OR            0x04
35
+#define EFI_DEP_NOT           0x05
36
+#define EFI_DEP_TRUE          0x06
37
+#define EFI_DEP_FALSE         0x07
38
+#define EFI_DEP_END           0x08
39
+
40
+
41
+///
42
+/// If present, this must be the first opcode,
43
+/// EFI_DEP_SOR is only used by DXE driver.
44
+///
45
+#define EFI_DEP_SOR           0x09
46
+
47
+#endif

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

@@ -0,0 +1,642 @@
1
+/** @file
2
+  Include file matches things in PI.
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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+#ifndef __PI_DXECIS_H__
19
+#define __PI_DXECIS_H__
20
+
21
+#include <gpxe/efi/Pi/PiMultiPhase.h>
22
+
23
+///
24
+/// Global Coherencey Domain types - Memory type
25
+///
26
+typedef enum {
27
+  EfiGcdMemoryTypeNonExistent,
28
+  EfiGcdMemoryTypeReserved,
29
+  EfiGcdMemoryTypeSystemMemory,
30
+  EfiGcdMemoryTypeMemoryMappedIo,
31
+  EfiGcdMemoryTypeMaximum
32
+} EFI_GCD_MEMORY_TYPE;
33
+
34
+///
35
+/// Global Coherencey Domain types - IO type
36
+///
37
+typedef enum {
38
+  EfiGcdIoTypeNonExistent,
39
+  EfiGcdIoTypeReserved,
40
+  EfiGcdIoTypeIo,
41
+  EfiGcdIoTypeMaximum
42
+} EFI_GCD_IO_TYPE;
43
+
44
+///
45
+/// The type of allocation to perform.
46
+///
47
+typedef enum {
48
+  EfiGcdAllocateAnySearchBottomUp,
49
+  EfiGcdAllocateMaxAddressSearchBottomUp,
50
+  EfiGcdAllocateAddress,
51
+  EfiGcdAllocateAnySearchTopDown,
52
+  EfiGcdAllocateMaxAddressSearchTopDown,
53
+  EfiGcdMaxAllocateType
54
+} EFI_GCD_ALLOCATE_TYPE;
55
+
56
+///
57
+/// EFI_GCD_MEMORY_SPACE_DESCRIPTOR
58
+///
59
+typedef struct {
60
+  ///
61
+  /// The physical address of the first byte in the memory region. Type
62
+  /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
63
+  /// description in the UEFI 2.0 specification
64
+  ///
65
+  EFI_PHYSICAL_ADDRESS  BaseAddress;
66
+
67
+  ///
68
+  /// The number of bytes in the memory region.
69
+  ///
70
+  UINT64                Length;
71
+
72
+  ///
73
+  /// The bit mask of attributes that the memory region is capable of supporting. The bit
74
+  /// mask of available attributes is defined in the GetMemoryMap() function description
75
+  /// in the UEFI 2.0 specification.
76
+  ///
77
+  UINT64                Capabilities;
78
+  ///
79
+  /// The bit mask of attributes that the memory region is currently using. The bit mask of
80
+  /// available attributes is defined in GetMemoryMap().
81
+  ///
82
+  UINT64                Attributes;
83
+  ///
84
+  /// Type of the memory region. Type EFI_GCD_MEMORY_TYPE is defined in the
85
+  /// AddMemorySpace() function description
86
+  ///
87
+  EFI_GCD_MEMORY_TYPE   GcdMemoryType;
88
+
89
+  ///
90
+  /// The image handle of the agent that allocated the memory resource described by
91
+  /// PhysicalStart and NumberOfBytes. If this field is NULL, then the memory
92
+  /// resource is not currently allocated. Type EFI_HANDLE is defined in
93
+  /// InstallProtocolInterface() in the UEFI 2.0 specification.
94
+  ///
95
+  EFI_HANDLE            ImageHandle;
96
+
97
+  ///
98
+  /// The device handle for which the memory resource has been allocated. If
99
+  /// ImageHandle is NULL, then the memory resource is not currently allocated. If this
100
+  /// field is NULL, then the memory resource is not associated with a device that is
101
+  /// described by a device handle. Type EFI_HANDLE is defined in
102
+  /// InstallProtocolInterface() in the UEFI 2.0 specification.
103
+  ///
104
+  EFI_HANDLE            DeviceHandle;
105
+} EFI_GCD_MEMORY_SPACE_DESCRIPTOR;
106
+
107
+///
108
+/// EFI_GCD_IO_SPACE_DESCRIPTOR
109
+///
110
+typedef struct {
111
+  ///
112
+  /// Physical address of the first byte in the I/O region. Type
113
+  /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function
114
+  /// description in the UEFI 2.0 specification.
115
+  ///
116
+  EFI_PHYSICAL_ADDRESS  BaseAddress;
117
+
118
+  ///
119
+  /// Number of bytes in the I/O region.
120
+  ///
121
+  UINT64                Length;
122
+
123
+  ///
124
+  /// Type of the I/O region. Type EFI_GCD_IO_TYPE is defined in the
125
+  /// AddIoSpace() function description.
126
+  ///
127
+  EFI_GCD_IO_TYPE       GcdIoType;
128
+
129
+  ///
130
+  /// The image handle of the agent that allocated the I/O resource described by
131
+  /// PhysicalStart and NumberOfBytes. If this field is NULL, then the I/O
132
+  /// resource is not currently allocated. Type EFI_HANDLE is defined in
133
+  /// InstallProtocolInterface() in the UEFI 2.0 specification.
134
+  ///
135
+  EFI_HANDLE            ImageHandle;
136
+
137
+  ///
138
+  /// The device handle for which the I/O resource has been allocated. If ImageHandle
139
+  /// is NULL, then the I/O resource is not currently allocated. If this field is NULL, then
140
+  /// the I/O resource is not associated with a device that is described by a device handle.
141
+  /// Type EFI_HANDLE is defined in InstallProtocolInterface() in the UEFI
142
+  /// 2.0 specification.
143
+  ///
144
+  EFI_HANDLE            DeviceHandle;
145
+} EFI_GCD_IO_SPACE_DESCRIPTOR;
146
+
147
+
148
+/**
149
+  Adds reserved memory, system memory, or memory-mapped I/O resources to the
150
+  global coherency domain of the processor.
151
+
152
+  @param  GcdMemoryType    The type of memory resource being added.
153
+  @param  BaseAddress      The physical address that is the start address
154
+                           of the memory resource being added.
155
+  @param  Length           The size, in bytes, of the memory resource that
156
+                           is being added.
157
+  @param  Capabilities     The bit mask of attributes that the memory
158
+                           resource region supports.
159
+
160
+  @retval EFI_SUCCESS            The memory resource was added to the global
161
+                                 coherency domain of the processor.
162
+  @retval EFI_INVALID_PARAMETER  GcdMemoryType is invalid.
163
+  @retval EFI_INVALID_PARAMETER  Length is zero.
164
+  @retval EFI_OUT_OF_RESOURCES   There are not enough system resources to add
165
+                                 the memory resource to the global coherency
166
+                                 domain of the processor.
167
+  @retval EFI_UNSUPPORTED        The processor does not support one or more bytes
168
+                                 of the memory resource range specified by
169
+                                 BaseAddress and Length.
170
+  @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
171
+                                 specified by BaseAddress and Length conflicts
172
+                                 with a memory resource range that was previously
173
+                                 added to the global coherency domain of the processor.
174
+  @retval EFI_ACCESS_DENIED      One or more bytes of the memory resource range
175
+                                 specified by BaseAddress and Length was allocated
176
+                                 in a prior call to AllocateMemorySpace()..
177
+
178
+**/
179
+typedef
180
+EFI_STATUS
181
+(EFIAPI *EFI_ADD_MEMORY_SPACE)(
182
+  IN EFI_GCD_MEMORY_TYPE   GcdMemoryType,
183
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
184
+  IN UINT64                Length,
185
+  IN UINT64                Capabilities
186
+  );
187
+
188
+/**
189
+  Allocates nonexistent memory, reserved memory, system memory, or memorymapped
190
+  I/O resources from the global coherency domain of the processor.
191
+
192
+  @param  GcdAllocateType  The type of allocation to perform.
193
+  @param  GcdMemoryType    The type of memory resource being allocated.
194
+  @param  Alignment        The log base 2 of the boundary that BaseAddress must
195
+                           be aligned on output. Align with 2^Alignment.
196
+  @param  Length           The size in bytes of the memory resource range that
197
+                           is being allocated.
198
+  @param  BaseAddress      A pointer to a physical address to allocate.
199
+  @param  Imagehandle      The image handle of the agent that is allocating
200
+                           the memory resource.
201
+  @param  DeviceHandle     The device handle for which the memory resource
202
+                           is being allocated.
203
+
204
+  @retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
205
+  @retval EFI_INVALID_PARAMETER GcdMemoryType is invalid.
206
+  @retval EFI_INVALID_PARAMETER Length is zero.
207
+  @retval EFI_INVALID_PARAMETER BaseAddress is NULL.
208
+  @retval EFI_INVALID_PARAMETER ImageHandle is NULL.
209
+  @retval EFI_NOT_FOUND         The memory resource request could not be satisfied.
210
+                                No descriptor contains the desired space.
211
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to allocate the memory
212
+                                resource from the global coherency domain of the processor.
213
+  @retval EFI_SUCCESS           The memory resource was allocated from the global coherency
214
+                                domain of the processor.
215
+
216
+
217
+**/
218
+typedef
219
+EFI_STATUS
220
+(EFIAPI *EFI_ALLOCATE_MEMORY_SPACE)(
221
+  IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
222
+  IN     EFI_GCD_MEMORY_TYPE                 GcdMemoryType,
223
+  IN     UINTN                               Alignment,
224
+  IN     UINT64                              Length,
225
+  IN OUT EFI_PHYSICAL_ADDRESS                *BaseAddress,
226
+  IN     EFI_HANDLE                          ImageHandle,
227
+  IN     EFI_HANDLE                          DeviceHandle OPTIONAL
228
+  );
229
+
230
+/**
231
+  Frees nonexistent memory, reserved memory, system memory, or memory-mapped
232
+  I/O resources from the global coherency domain of the processor.
233
+
234
+  @param  BaseAddress      The physical address that is the start address of the memory resource being freed.
235
+  @param  Length           The size in bytes of the memory resource range that is being freed.
236
+
237
+  @retval EFI_SUCCESS           The memory resource was freed from the global coherency domain of
238
+                                the processor.
239
+  @retval EFI_INVALID_PARAMETER Length is zero.
240
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
241
+                                resource range specified by BaseAddress and Length.
242
+  @retval EFI_NOT_FOUND         The memory resource range specified by BaseAddress and
243
+                                Length was not allocated with previous calls to AllocateMemorySpace().
244
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to free the memory resource
245
+                                from the global coherency domain of the processor.
246
+
247
+**/
248
+typedef
249
+EFI_STATUS
250
+(EFIAPI *EFI_FREE_MEMORY_SPACE)(
251
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
252
+  IN UINT64                Length
253
+  );
254
+
255
+/**
256
+  Removes reserved memory, system memory, or memory-mapped I/O resources from
257
+  the global coherency domain of the processor.
258
+
259
+  @param  BaseAddress      The physical address that is the start address of the memory resource being removed.
260
+  @param  Length           The size in bytes of the memory resource that is being removed.
261
+
262
+  @retval EFI_SUCCESS           The memory resource was removed from the global coherency
263
+                                domain of the processor.
264
+  @retval EFI_INVALID_PARAMETER Length is zero.
265
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
266
+                                resource range specified by BaseAddress and Length.
267
+  @retval EFI_NOT_FOUND         One or more bytes of the memory resource range specified by
268
+                                BaseAddress and Length was not added with previous calls to
269
+                                AddMemorySpace().
270
+  @retval EFI_ACCESS_DEFINED    One or more bytes of the memory resource range specified by
271
+                                BaseAddress and Length has been allocated with AllocateMemorySpace().
272
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to remove the memory
273
+                                resource from the global coherency domain of the processor.
274
+
275
+**/
276
+typedef
277
+EFI_STATUS
278
+(EFIAPI *EFI_REMOVE_MEMORY_SPACE)(
279
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
280
+  IN UINT64                Length
281
+  );
282
+
283
+/**
284
+  Retrieves the descriptor for a memory region containing a specified address.
285
+
286
+  @param  BaseAddress      The physical address that is the start address of a memory region.
287
+  @param  Descriptor       A pointer to a caller allocated descriptor.
288
+
289
+  @retval EFI_SUCCESS           The descriptor for the memory resource region containing
290
+                                BaseAddress was returned in Descriptor.
291
+  @retval EFI_INVALID_PARAMETER Descriptor is NULL.
292
+  @retval EFI_NOT_FOUND         A memory resource range containing BaseAddress was not found.
293
+
294
+**/
295
+typedef
296
+EFI_STATUS
297
+(EFIAPI *EFI_GET_MEMORY_SPACE_DESCRIPTOR)(
298
+  IN  EFI_PHYSICAL_ADDRESS             BaseAddress,
299
+  OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *Descriptor
300
+  );
301
+
302
+/**
303
+  Modifies the attributes for a memory region in the global coherency domain of the
304
+  processor.
305
+
306
+  @param  BaseAddress      The physical address that is the start address of a memory region.
307
+  @param  Length           The size in bytes of the memory region.
308
+  @param  Attributes       The bit mask of attributes to set for the memory region.
309
+
310
+  @retval EFI_SUCCESS           The attributes were set for the memory region.
311
+  @retval EFI_INVALID_PARAMETER Length is zero.
312
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the memory
313
+                                resource range specified by BaseAddress and Length.
314
+  @retval EFI_UNSUPPORTED       The bit mask of attributes is not support for the memory resource
315
+                                range specified by BaseAddress and Length.
316
+  @retval EFI_ACCESS_DEFINED    The attributes for the memory resource range specified by
317
+                                BaseAddress and Length cannot be modified.
318
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to modify the attributes of
319
+                                the memory resource range.
320
+
321
+**/
322
+typedef
323
+EFI_STATUS
324
+(EFIAPI *EFI_SET_MEMORY_SPACE_ATTRIBUTES)(
325
+  IN EFI_PHYSICAL_ADDRESS         BaseAddress,
326
+  IN UINT64                       Length,
327
+  IN UINT64                       Attributes
328
+  );
329
+
330
+/**
331
+  Returns a map of the memory resources in the global coherency domain of the
332
+  processor.
333
+
334
+  @param  NumberOfDescriptors A pointer to number of descriptors returned in the MemorySpaceMap buffer.
335
+  @param  MemorySpaceMap      A pointer to the array of EFI_GCD_MEMORY_SPACE_DESCRIPTORs.
336
+
337
+  @retval EFI_SUCCESS           The memory space map was returned in the MemorySpaceMap
338
+                                buffer, and the number of descriptors in MemorySpaceMap was
339
+                                returned in NumberOfDescriptors.
340
+  @retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
341
+  @retval EFI_INVALID_PARAMETER MemorySpaceMap is NULL.
342
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate MemorySpaceMap.
343
+
344
+**/
345
+typedef
346
+EFI_STATUS
347
+(EFIAPI *EFI_GET_MEMORY_SPACE_MAP)(
348
+  OUT UINTN                            *NumberOfDescriptors,
349
+  OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR  **MemorySpaceMap
350
+  );
351
+
352
+/**
353
+  Adds reserved I/O or I/O resources to the global coherency domain of the processor.
354
+
355
+  @param  GcdIoType        The type of I/O resource being added.
356
+  @param  BaseAddress      The physical address that is the start address of the I/O resource being added.
357
+  @param  Length           The size in bytes of the I/O resource that is being added.
358
+
359
+  @retval EFI_SUCCESS           The I/O resource was added to the global coherency domain of
360
+                                the processor.
361
+  @retval EFI_INVALID_PARAMETER GcdIoType is invalid.
362
+  @retval EFI_INVALID_PARAMETER Length is zero.
363
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to add the I/O resource to
364
+                                the global coherency domain of the processor.
365
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O
366
+                                resource range specified by BaseAddress and Length.
367
+  @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
368
+                                BaseAddress and Length conflicts with an I/O resource
369
+                                range that was previously added to the global coherency domain
370
+                                of the processor.
371
+  @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
372
+                                BaseAddress and Length was allocated in a prior call to
373
+                                AllocateIoSpace().
374
+
375
+**/
376
+typedef
377
+EFI_STATUS
378
+(EFIAPI *EFI_ADD_IO_SPACE)(
379
+  IN EFI_GCD_IO_TYPE       GcdIoType,
380
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
381
+  IN UINT64                Length
382
+  );
383
+
384
+/**
385
+  Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
386
+  domain of the processor.
387
+
388
+  @param  GcdAllocateType  The type of allocation to perform.
389
+  @param  GcdIoType        The type of I/O resource being allocated.
390
+  @param  Alignment        The log base 2 of the boundary that BaseAddress must be aligned on output.
391
+  @param  Length           The size in bytes of the I/O resource range that is being allocated.
392
+  @param  BaseAddress      A pointer to a physical address.
393
+  @param  Imagehandle      The image handle of the agent that is allocating the I/O resource.
394
+  @param  DeviceHandle     The device handle for which the I/O resource is being allocated.
395
+
396
+  @retval EFI_SUCCESS           The I/O resource was allocated from the global coherency domain
397
+                                of the processor.
398
+  @retval EFI_INVALID_PARAMETER GcdAllocateType is invalid.
399
+  @retval EFI_INVALID_PARAMETER GcdIoType is invalid.
400
+  @retval EFI_INVALID_PARAMETER Length is zero.
401
+  @retval EFI_INVALID_PARAMETER BaseAddress is NULL.
402
+  @retval EFI_INVALID_PARAMETER ImageHandle is NULL.
403
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to allocate the I/O
404
+                                resource from the global coherency domain of the processor.
405
+  @retval EFI_NOT_FOUND         The I/O resource request could not be satisfied.
406
+
407
+**/
408
+typedef
409
+EFI_STATUS
410
+(EFIAPI *EFI_ALLOCATE_IO_SPACE)(
411
+  IN     EFI_GCD_ALLOCATE_TYPE               GcdAllocateType,
412
+  IN     EFI_GCD_IO_TYPE                     GcdIoType,
413
+  IN     UINTN                               Alignment,
414
+  IN     UINT64                              Length,
415
+  IN OUT EFI_PHYSICAL_ADDRESS                *BaseAddress,
416
+  IN     EFI_HANDLE                          ImageHandle,
417
+  IN     EFI_HANDLE                          DeviceHandle OPTIONAL
418
+  );
419
+
420
+/**
421
+  Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
422
+  domain of the processor.
423
+
424
+  @param  BaseAddress      The physical address that is the start address of the I/O resource being freed.
425
+  @param  Length           The size in bytes of the I/O resource range that is being freed.
426
+
427
+  @retval EFI_SUCCESS           The I/O resource was freed from the global coherency domain of the
428
+                                processor.
429
+  @retval EFI_INVALID_PARAMETER Length is zero.
430
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O resource
431
+                                range specified by BaseAddress and Length.
432
+  @retval EFI_NOT_FOUND         The I/O resource range specified by BaseAddress and Length
433
+                                was not allocated with previous calls to AllocateIoSpace().
434
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to free the I/O resource from
435
+                                the global coherency domain of the processor.
436
+
437
+**/
438
+typedef
439
+EFI_STATUS
440
+(EFIAPI *EFI_FREE_IO_SPACE)(
441
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
442
+  IN UINT64                Length
443
+  );
444
+
445
+/**
446
+  Removes reserved I/O or I/O resources from the global coherency domain of the
447
+  processor.
448
+
449
+  @param  BaseAddress      A pointer to a physical address that is the start address of the I/O resource being
450
+                           removed.
451
+  @param Length            The size in bytes of the I/O resource that is being removed.
452
+
453
+  @retval EFI_SUCCESS           The I/O resource was removed from the global coherency domain
454
+                                of the processor.
455
+  @retval EFI_INVALID_PARAMETER Length is zero.
456
+  @retval EFI_UNSUPPORTED       The processor does not support one or more bytes of the I/O
457
+                                resource range specified by BaseAddress and Length.
458
+  @retval EFI_NOT_FOUND         One or more bytes of the I/O resource range specified by
459
+                                BaseAddress and Length was not added with previous
460
+                                calls to AddIoSpace().
461
+  @retval EFI_ACCESS_DENIED     One or more bytes of the I/O resource range specified by
462
+                                BaseAddress and Length has been allocated with
463
+                                AllocateIoSpace().
464
+  @retval EFI_OUT_OF_RESOURCES  There are not enough system resources to remove the I/O
465
+                                resource from the global coherency domain of the processor.
466
+
467
+**/
468
+typedef
469
+EFI_STATUS
470
+(EFIAPI *EFI_REMOVE_IO_SPACE)(
471
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
472
+  IN UINT64                Length
473
+  );
474
+
475
+/**
476
+  Retrieves the descriptor for an I/O region containing a specified address.
477
+
478
+  @param  BaseAddress      The physical address that is the start address of an I/O region.
479
+  @param  Descriptor       A pointer to a caller allocated descriptor.
480
+
481
+  @retval EFI_SUCCESS           The descriptor for the I/O resource region containing
482
+                                BaseAddress was returned in Descriptor.
483
+  @retval EFI_INVALID_PARAMETER Descriptor is NULL.
484
+  @retval EFI_NOT_FOUND         An I/O resource range containing BaseAddress was not found.
485
+
486
+**/
487
+typedef
488
+EFI_STATUS
489
+(EFIAPI *EFI_GET_IO_SPACE_DESCRIPTOR)(
490
+  IN  EFI_PHYSICAL_ADDRESS         BaseAddress,
491
+  OUT EFI_GCD_IO_SPACE_DESCRIPTOR  *Descriptor
492
+  );
493
+
494
+/**
495
+  Returns a map of the I/O resources in the global coherency domain of the processor.
496
+
497
+  @param  NumberOfDescriptors A pointer to number of descriptors returned in the IoSpaceMap buffer.
498
+  @param  MemorySpaceMap      A pointer to the array of EFI_GCD_IO_SPACE_DESCRIPTORs.
499
+
500
+  @retval EFI_SUCCESS           The I/O space map was returned in the IoSpaceMap buffer, and
501
+                                the number of descriptors in IoSpaceMap was returned in
502
+                                NumberOfDescriptors.
503
+  @retval EFI_INVALID_PARAMETER NumberOfDescriptors is NULL.
504
+  @retval EFI_INVALID_PARAMETER IoSpaceMap is NULL.
505
+  @retval EFI_OUT_OF_RESOURCES  There are not enough resources to allocate IoSpaceMap.
506
+
507
+
508
+**/
509
+typedef
510
+EFI_STATUS
511
+(EFIAPI *EFI_GET_IO_SPACE_MAP)(
512
+  OUT UINTN                        *NumberOfDescriptors,
513
+  OUT EFI_GCD_IO_SPACE_DESCRIPTOR  **IoSpaceMap
514
+  );
515
+
516
+
517
+
518
+/**
519
+  Loads and executed DXE drivers from firmware volumes.
520
+
521
+  The Dispatch() function searches for DXE drivers in firmware volumes that have been
522
+  installed since the last time the Dispatch() service was called. It then evaluates
523
+  the dependency expressions of all the DXE drivers and loads and executes those DXE
524
+  drivers whose dependency expression evaluate to TRUE. This service must interact with
525
+  the Security Architectural Protocol to authenticate DXE drivers before they are executed.
526
+  This process is continued until no more DXE drivers can be executed.
527
+
528
+  @retval EFI_SUCCESS         One or more DXE driver were dispatched.
529
+  @retval EFI_NOT_FOUND       No DXE drivers were dispatched.
530
+  @retval EFI_ALREADY_STARTED An attempt is being made to start the DXE Dispatcher recursively.
531
+                              Thus no action was taken.
532
+
533
+**/
534
+typedef
535
+EFI_STATUS
536
+(EFIAPI *EFI_DISPATCH)(
537
+  VOID
538
+  );
539
+
540
+/**
541
+  Clears the Schedule on Request (SOR) flag for a component that is stored in a firmware volume.
542
+
543
+  @param  FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
544
+  @param  FileName             A pointer to the name of the file in a firmware volume.
545
+
546
+  @retval EFI_SUCCESS         The DXE driver was found and its SOR bit was cleared.
547
+  @retval EFI_NOT_FOUND       The DXE driver does not exist, or the DXE driver exists and its SOR
548
+                              bit is not set.
549
+
550
+**/
551
+typedef
552
+EFI_STATUS
553
+(EFIAPI *EFI_SCHEDULE)(
554
+  IN EFI_HANDLE  FirmwareVolumeHandle,
555
+  IN CONST EFI_GUID    *FileName
556
+  );
557
+
558
+/**
559
+  Promotes a file stored in a firmware volume from the untrusted to the trusted state.
560
+
561
+  @param  FirmwareVolumeHandle The handle of the firmware volume that contains the file specified by FileName.
562
+  @param  DriverName           A pointer to the name of the file in a firmware volume.
563
+
564
+  @return Status of promoting FFS from untrusted to trusted
565
+          state.
566
+  @retval EFI_NOT_FOUND       The file was not found in the untrusted state.
567
+
568
+**/
569
+typedef
570
+EFI_STATUS
571
+(EFIAPI *EFI_TRUST)(
572
+  IN EFI_HANDLE  FirmwareVolumeHandle,
573
+  IN CONST EFI_GUID    *FileName
574
+  );
575
+
576
+/**
577
+  Creates a firmware volume handle for a firmware volume that is present in system memory.
578
+
579
+  @param  FirmwareVolumeHeader A pointer to the header of the firmware volume.
580
+  @param  Size                 The size, in bytes, of the firmware volume.
581
+  @param  FirmwareVolumeHandle On output, a pointer to the created handle.
582
+
583
+  @retval EFI_SUCCESS          The EFI_FIRMWARE_VOLUME_PROTOCOL and
584
+                               EFI_DEVICE_PATH_PROTOCOL were installed onto
585
+                               FirmwareVolumeHandle for the firmware volume described
586
+                               by FirmwareVolumeHeader and Size.
587
+  @retval EFI_VOLUME_CORRUPTED The firmware volume described by FirmwareVolumeHeader
588
+                               and Size is corrupted.
589
+  @retval EFI_OUT_OF_RESOURCES There are not enough system resources available to produce the
590
+                               EFI_FIRMWARE_VOLUME_PROTOCOL and EFI_DEVICE_PATH_PROTOCOL
591
+                               for the firmware volume described by FirmwareVolumeHeader and Size.
592
+
593
+**/
594
+typedef
595
+EFI_STATUS
596
+(EFIAPI *EFI_PROCESS_FIRMWARE_VOLUME)(
597
+  IN CONST VOID                       *FirmwareVolumeHeader,
598
+  IN UINTN                            Size,
599
+  OUT EFI_HANDLE                      *FirmwareVolumeHandle
600
+  );
601
+
602
+//
603
+// DXE Services Table
604
+//
605
+#define DXE_SERVICES_SIGNATURE  0x565245535f455844ULL
606
+#define DXE_SERVICES_REVISION   ((1<<16) | (00))
607
+
608
+typedef struct {
609
+  EFI_TABLE_HEADER                Hdr;
610
+
611
+  //
612
+  // Global Coherency Domain Services
613
+  //
614
+  EFI_ADD_MEMORY_SPACE            AddMemorySpace;
615
+  EFI_ALLOCATE_MEMORY_SPACE       AllocateMemorySpace;
616
+  EFI_FREE_MEMORY_SPACE           FreeMemorySpace;
617
+  EFI_REMOVE_MEMORY_SPACE         RemoveMemorySpace;
618
+  EFI_GET_MEMORY_SPACE_DESCRIPTOR GetMemorySpaceDescriptor;
619
+  EFI_SET_MEMORY_SPACE_ATTRIBUTES SetMemorySpaceAttributes;
620
+  EFI_GET_MEMORY_SPACE_MAP        GetMemorySpaceMap;
621
+  EFI_ADD_IO_SPACE                AddIoSpace;
622
+  EFI_ALLOCATE_IO_SPACE           AllocateIoSpace;
623
+  EFI_FREE_IO_SPACE               FreeIoSpace;
624
+  EFI_REMOVE_IO_SPACE             RemoveIoSpace;
625
+  EFI_GET_IO_SPACE_DESCRIPTOR     GetIoSpaceDescriptor;
626
+  EFI_GET_IO_SPACE_MAP            GetIoSpaceMap;
627
+
628
+  //
629
+  // Dispatcher Services
630
+  //
631
+  EFI_DISPATCH                    Dispatch;
632
+  EFI_SCHEDULE                    Schedule;
633
+  EFI_TRUST                       Trust;
634
+  //
635
+  // Service to process a single firmware volume found in a capsule
636
+  //
637
+  EFI_PROCESS_FIRMWARE_VOLUME     ProcessFirmwareVolume;
638
+} DXE_SERVICES;
639
+
640
+typedef DXE_SERVICES EFI_DXE_SERVICES;
641
+
642
+#endif

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

@@ -0,0 +1,242 @@
1
+/** @file
2
+  The firmware file related definitions in PI.
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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+
19
+#ifndef __PI_FIRMWARE_FILE_H__
20
+#define __PI_FIRMWARE_FILE_H__
21
+
22
+#include <gpxe/efi/ProcessorBind.h>
23
+
24
+#pragma pack(1)
25
+///
26
+/// Used to verify the integrity of the file.
27
+///
28
+typedef union {
29
+  struct {
30
+    UINT8   Header;
31
+    UINT8   File;
32
+  } Checksum;
33
+  UINT16    Checksum16;
34
+} EFI_FFS_INTEGRITY_CHECK;
35
+
36
+typedef UINT8 EFI_FV_FILETYPE;
37
+typedef UINT8 EFI_FFS_FILE_ATTRIBUTES;
38
+typedef UINT8 EFI_FFS_FILE_STATE;
39
+
40
+///
41
+/// File Types Definitions
42
+///
43
+#define EFI_FV_FILETYPE_ALL                   0x00
44
+#define EFI_FV_FILETYPE_RAW                   0x01
45
+#define EFI_FV_FILETYPE_FREEFORM              0x02
46
+#define EFI_FV_FILETYPE_SECURITY_CORE         0x03
47
+#define EFI_FV_FILETYPE_PEI_CORE              0x04
48
+#define EFI_FV_FILETYPE_DXE_CORE              0x05
49
+#define EFI_FV_FILETYPE_PEIM                  0x06
50
+#define EFI_FV_FILETYPE_DRIVER                0x07
51
+#define EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER  0x08
52
+#define EFI_FV_FILETYPE_APPLICATION           0x09
53
+#define EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE 0x0B
54
+#define EFI_FV_FILETYPE_OEM_MIN               0xc0
55
+#define EFI_FV_FILETYPE_OEM_MAX               0xdf
56
+#define EFI_FV_FILETYPE_DEBUG_MIN             0xe0
57
+#define EFI_FV_FILETYPE_DEBUG_MAX             0xef
58
+#define EFI_FV_FILETYPE_FFS_MIN               0xf0
59
+#define EFI_FV_FILETYPE_FFS_MAX               0xff
60
+#define EFI_FV_FILETYPE_FFS_PAD               0xf0
61
+///
62
+/// FFS File Attributes.
63
+///
64
+#define FFS_ATTRIB_FIXED              0x04
65
+#define FFS_ATTRIB_DATA_ALIGNMENT     0x38
66
+#define FFS_ATTRIB_CHECKSUM           0x40
67
+
68
+///
69
+/// FFS File State Bits.
70
+///
71
+#define EFI_FILE_HEADER_CONSTRUCTION  0x01
72
+#define EFI_FILE_HEADER_VALID         0x02
73
+#define EFI_FILE_DATA_VALID           0x04
74
+#define EFI_FILE_MARKED_FOR_UPDATE    0x08
75
+#define EFI_FILE_DELETED              0x10
76
+#define EFI_FILE_HEADER_INVALID       0x20
77
+
78
+
79
+///
80
+/// Each file begins with the header that describe the
81
+/// contents and state of the files.
82
+///
83
+typedef struct {
84
+  EFI_GUID                Name;
85
+  EFI_FFS_INTEGRITY_CHECK IntegrityCheck;
86
+  EFI_FV_FILETYPE         Type;
87
+  EFI_FFS_FILE_ATTRIBUTES Attributes;
88
+  UINT8                   Size[3];
89
+  EFI_FFS_FILE_STATE      State;
90
+} EFI_FFS_FILE_HEADER;
91
+
92
+
93
+typedef UINT8 EFI_SECTION_TYPE;
94
+
95
+///
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.
99
+///
100
+#define EFI_SECTION_ALL                   0x00
101
+
102
+///
103
+/// Encapsulation section Type values
104
+///
105
+#define EFI_SECTION_COMPRESSION           0x01
106
+
107
+#define EFI_SECTION_GUID_DEFINED          0x02
108
+
109
+///
110
+/// Leaf section Type values
111
+///
112
+#define EFI_SECTION_PE32                  0x10
113
+#define EFI_SECTION_PIC                   0x11
114
+#define EFI_SECTION_TE                    0x12
115
+#define EFI_SECTION_DXE_DEPEX             0x13
116
+#define EFI_SECTION_VERSION               0x14
117
+#define EFI_SECTION_USER_INTERFACE        0x15
118
+#define EFI_SECTION_COMPATIBILITY16       0x16
119
+#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE 0x17
120
+#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
121
+#define EFI_SECTION_RAW                   0x19
122
+#define EFI_SECTION_PEI_DEPEX             0x1B
123
+
124
+///
125
+/// Common section header
126
+///
127
+typedef struct {
128
+  UINT8             Size[3];
129
+  EFI_SECTION_TYPE  Type;
130
+} EFI_COMMON_SECTION_HEADER;
131
+
132
+///
133
+/// Leaf section type that contains an
134
+/// IA-32 16-bit executable image.
135
+///
136
+typedef EFI_COMMON_SECTION_HEADER EFI_COMPATIBILITY16_SECTION;
137
+
138
+///
139
+/// CompressionType of EFI_COMPRESSION_SECTION.
140
+///
141
+#define EFI_NOT_COMPRESSED        0x00
142
+#define EFI_STANDARD_COMPRESSION  0x01
143
+///
144
+/// An encapsulation section type in which the
145
+/// section data is compressed.
146
+///
147
+typedef struct {
148
+  EFI_COMMON_SECTION_HEADER   CommonHeader;
149
+  UINT32                      UncompressedLength;
150
+  UINT8                       CompressionType;
151
+} EFI_COMPRESSION_SECTION;
152
+
153
+///
154
+/// Leaf section which could be used to determine the dispatch order of DXEs.
155
+///
156
+typedef EFI_COMMON_SECTION_HEADER EFI_DXE_DEPEX_SECTION;
157
+
158
+///
159
+/// Leaf section witch contains a PI FV.
160
+///
161
+typedef EFI_COMMON_SECTION_HEADER EFI_FIRMWARE_VOLUME_IMAGE_SECTION;
162
+
163
+///
164
+/// Leaf section which contains a single GUID.
165
+///
166
+typedef struct {
167
+  EFI_COMMON_SECTION_HEADER   CommonHeader;
168
+  EFI_GUID                    SubTypeGuid;
169
+} EFI_FREEFORM_SUBTYPE_GUID_SECTION;
170
+
171
+///
172
+/// Attributes of EFI_GUID_DEFINED_SECTION
173
+///
174
+#define EFI_GUIDED_SECTION_PROCESSING_REQUIRED  0x01
175
+#define EFI_GUIDED_SECTION_AUTH_STATUS_VALID    0x02
176
+///
177
+/// Leaf section which is encapsulation defined by specific GUID
178
+///
179
+typedef struct {
180
+  EFI_COMMON_SECTION_HEADER   CommonHeader;
181
+  EFI_GUID                    SectionDefinitionGuid;
182
+  UINT16                      DataOffset;
183
+  UINT16                      Attributes;
184
+} EFI_GUID_DEFINED_SECTION;
185
+
186
+///
187
+/// Leaf section which contains PE32+ image.
188
+///
189
+typedef EFI_COMMON_SECTION_HEADER EFI_PE32_SECTION;
190
+
191
+
192
+///
193
+/// Leaf section which used to determine the dispatch order of PEIMs.
194
+///
195
+typedef EFI_COMMON_SECTION_HEADER EFI_PEI_DEPEX_SECTION;
196
+
197
+///
198
+/// Leaf section which constains the position-independent-code image.
199
+///
200
+typedef EFI_COMMON_SECTION_HEADER EFI_TE_SECTION;
201
+
202
+///
203
+/// Leaf section which contains an array of zero or more bytes.
204
+///
205
+typedef EFI_COMMON_SECTION_HEADER EFI_RAW_SECTION;
206
+
207
+///
208
+/// Leaf section which contains a unicode string that
209
+/// is human readable file name.
210
+///
211
+typedef struct {
212
+  EFI_COMMON_SECTION_HEADER   CommonHeader;
213
+
214
+  ///
215
+  /// Array of unicode string.
216
+  ///
217
+  CHAR16                      FileNameString[1];
218
+} EFI_USER_INTERFACE_SECTION;
219
+
220
+
221
+///
222
+/// Leaf section which contains a numeric build number and
223
+/// an optional unicode string that represent the file revision.
224
+///
225
+typedef struct {
226
+  EFI_COMMON_SECTION_HEADER   CommonHeader;
227
+  UINT16                      BuildNumber;
228
+
229
+  ///
230
+  /// Array of unicode string.
231
+  ///
232
+  CHAR16                      VersionString[1];
233
+} EFI_VERSION_SECTION;
234
+
235
+
236
+#define SECTION_SIZE(SectionHeaderPtr) \
237
+    ((UINT32) (*((UINT32 *) ((EFI_COMMON_SECTION_HEADER *) SectionHeaderPtr)->Size) & 0x00ffffff))
238
+
239
+#pragma pack()
240
+
241
+#endif
242
+

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

@@ -0,0 +1,154 @@
1
+/** @file
2
+  The firmware volume related definitions in PI.
3
+
4
+  Copyright (c) 2006 - 2007, 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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+#ifndef __PI_FIRMWAREVOLUME_H__
19
+#define __PI_FIRMWAREVOLUME_H__
20
+
21
+#include <gpxe/efi/ProcessorBind.h>
22
+
23
+///
24
+/// EFI_FV_FILE_ATTRIBUTES
25
+///
26
+typedef UINT32  EFI_FV_FILE_ATTRIBUTES;
27
+
28
+//
29
+// Value of EFI_FV_FILE_ATTRIBUTES.
30
+//
31
+#define EFI_FV_FILE_ATTRIB_ALIGNMENT      0x0000001F
32
+#define EFI_FV_FILE_ATTRIB_FIXED          0x00000100
33
+#define EFI_FV_FILE_ATTRIB_MEMORY_MAPPED  0x00000200
34
+
35
+///
36
+/// type of EFI FVB attribute
37
+///
38
+typedef UINT32  EFI_FVB_ATTRIBUTES_2;
39
+
40
+//
41
+// Attributes bit definitions
42
+//
43
+#define EFI_FVB2_READ_DISABLED_CAP  0x00000001
44
+#define EFI_FVB2_READ_ENABLED_CAP   0x00000002
45
+#define EFI_FVB2_READ_STATUS        0x00000004
46
+#define EFI_FVB2_WRITE_DISABLED_CAP 0x00000008
47
+#define EFI_FVB2_WRITE_ENABLED_CAP  0x00000010
48
+#define EFI_FVB2_WRITE_STATUS       0x00000020
49
+#define EFI_FVB2_LOCK_CAP           0x00000040
50
+#define EFI_FVB2_LOCK_STATUS        0x00000080
51
+#define EFI_FVB2_STICKY_WRITE       0x00000200
52
+#define EFI_FVB2_MEMORY_MAPPED      0x00000400
53
+#define EFI_FVB2_ERASE_POLARITY     0x00000800
54
+#define EFI_FVB2_READ_LOCK_CAP      0x00001000
55
+#define EFI_FVB2_READ_LOCK_STATUS   0x00002000
56
+#define EFI_FVB2_WRITE_LOCK_CAP     0x00004000
57
+#define EFI_FVB2_WRITE_LOCK_STATUS  0x00008000
58
+#define EFI_FVB2_ALIGNMENT          0x001F0000
59
+#define EFI_FVB2_ALIGNMENT_1        0x00000000
60
+#define EFI_FVB2_ALIGNMENT_2        0x00010000
61
+#define EFI_FVB2_ALIGNMENT_4        0x00020000
62
+#define EFI_FVB2_ALIGNMENT_8        0x00030000
63
+#define EFI_FVB2_ALIGNMENT_16       0x00040000
64
+#define EFI_FVB2_ALIGNMENT_32       0x00050000
65
+#define EFI_FVB2_ALIGNMENT_64       0x00060000
66
+#define EFI_FVB2_ALIGNMENT_128      0x00070000
67
+#define EFI_FVB2_ALIGNMENT_256      0x00080000
68
+#define EFI_FVB2_ALIGNMENT_512      0x00090000
69
+#define EFI_FVB2_ALIGNMENT_1K       0x000A0000
70
+#define EFI_FVB2_ALIGNMENT_2K       0x000B0000
71
+#define EFI_FVB2_ALIGNMENT_4K       0x000C0000
72
+#define EFI_FVB2_ALIGNMENT_8K       0x000D0000
73
+#define EFI_FVB2_ALIGNMENT_16K      0x000E0000
74
+#define EFI_FVB2_ALIGNMENT_32K      0x000F0000
75
+#define EFI_FVB2_ALIGNMENT_64K      0x00100000
76
+#define EFI_FVB2_ALIGNMENT_128K     0x00110000
77
+#define EFI_FVB2_ALIGNMENT_256K     0x00120000
78
+#define EFI_FVB2_ALIGNMNET_512K     0x00130000
79
+#define EFI_FVB2_ALIGNMENT_1M       0x00140000
80
+#define EFI_FVB2_ALIGNMENT_2M       0x00150000
81
+#define EFI_FVB2_ALIGNMENT_4M       0x00160000
82
+#define EFI_FVB2_ALIGNMENT_8M       0x00170000
83
+#define EFI_FVB2_ALIGNMENT_16M      0x00180000
84
+#define EFI_FVB2_ALIGNMENT_32M      0x00190000
85
+#define EFI_FVB2_ALIGNMENT_64M      0x001A0000
86
+#define EFI_FVB2_ALIGNMENT_128M     0x001B0000
87
+#define EFI_FVB2_ALIGNMENT_256M     0x001C0000
88
+#define EFI_FVB2_ALIGNMENT_512M     0x001D0000
89
+#define EFI_FVB2_ALIGNMENT_1G       0x001E0000
90
+#define EFI_FVB2_ALIGNMENT_2G       0x001F0000
91
+
92
+
93
+typedef struct {
94
+  UINT32 NumBlocks;
95
+  UINT32 Length;
96
+} EFI_FV_BLOCK_MAP_ENTRY;
97
+
98
+///
99
+/// Describes the features and layout of the firmware volume.
100
+///
101
+typedef struct {
102
+  UINT8                     ZeroVector[16];
103
+  EFI_GUID                  FileSystemGuid;
104
+  UINT64                    FvLength;
105
+  UINT32                    Signature;
106
+  EFI_FVB_ATTRIBUTES_2      Attributes;
107
+  UINT16                    HeaderLength;
108
+  UINT16                    Checksum;
109
+  UINT16                    ExtHeaderOffset;
110
+  UINT8                     Reserved[1];
111
+  UINT8                     Revision;
112
+  EFI_FV_BLOCK_MAP_ENTRY    BlockMap[1];
113
+} EFI_FIRMWARE_VOLUME_HEADER;
114
+
115
+#define EFI_FVH_SIGNATURE EFI_SIGNATURE_32 ('_', 'F', 'V', 'H')
116
+
117
+///
118
+/// Firmware Volume Header Revision definition
119
+///
120
+#define EFI_FVH_REVISION  0x02
121
+
122
+///
123
+/// Extension header pointed by ExtHeaderOffset of volume header.
124
+///
125
+typedef struct {
126
+  EFI_GUID  FvName;
127
+  UINT32    ExtHeaderSize;
128
+} EFI_FIRMWARE_VOLUME_EXT_HEADER;
129
+
130
+///
131
+/// Entry struture for describing FV extension header
132
+///
133
+typedef struct {
134
+  UINT16    ExtEntrySize;
135
+  UINT16    ExtEntryType;
136
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
137
+
138
+#define EFI_FV_EXT_TYPE_OEM_TYPE  0x01
139
+///
140
+/// This extension header provides a mapping between a GUID and an OEM file type.
141
+///
142
+typedef struct {
143
+  EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;
144
+  UINT32    TypeMask;
145
+
146
+  //
147
+  // Array of GUIDs.
148
+  // Each GUID represents an OEM file type.
149
+  //
150
+  EFI_GUID  Types[1];
151
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
152
+
153
+
154
+#endif

+ 293
- 0
src/include/gpxe/efi/Pi/PiHob.h View File

@@ -0,0 +1,293 @@
1
+/** @file
2
+  HOB related definitions in PI.
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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+#ifndef __PI_HOB_H__
19
+#define __PI_HOB_H__
20
+
21
+#include <gpxe/efi/ProcessorBind.h>
22
+#include <gpxe/efi/Pi/PiBootMode.h>
23
+#include <gpxe/efi/Uefi/UefiBaseType.h>
24
+#include <gpxe/efi/Uefi/UefiMultiPhase.h>
25
+
26
+//
27
+// HobType of EFI_HOB_GENERIC_HEADER.
28
+//
29
+#define EFI_HOB_TYPE_HANDOFF              0x0001
30
+#define EFI_HOB_TYPE_MEMORY_ALLOCATION    0x0002
31
+#define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR  0x0003
32
+#define EFI_HOB_TYPE_GUID_EXTENSION       0x0004
33
+#define EFI_HOB_TYPE_FV                   0x0005
34
+#define EFI_HOB_TYPE_CPU                  0x0006
35
+#define EFI_HOB_TYPE_MEMORY_POOL          0x0007
36
+#define EFI_HOB_TYPE_FV2                  0x0009
37
+#define EFI_HOB_TYPE_LOAD_PEIM            0x000A
38
+#define EFI_HOB_TYPE_UNUSED               0xFFFE
39
+#define EFI_HOB_TYPE_END_OF_HOB_LIST      0xFFFF
40
+
41
+///
42
+/// Describes the format and size of the data inside the HOB.
43
+/// All HOBs must contain this generic HOB header.
44
+///
45
+typedef struct {
46
+  UINT16    HobType;
47
+  UINT16    HobLength;
48
+  UINT32    Reserved;
49
+} EFI_HOB_GENERIC_HEADER;
50
+
51
+
52
+///
53
+/// Value of version ofinEFI_HOB_HANDOFF_INFO_TABLE.
54
+///
55
+#define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009
56
+
57
+///
58
+/// Contains general state information used by the HOB producer phase.
59
+/// This HOB must be the first one in the HOB list.
60
+///
61
+typedef struct {
62
+  EFI_HOB_GENERIC_HEADER  Header;
63
+  UINT32                  Version;
64
+  EFI_BOOT_MODE           BootMode;
65
+  EFI_PHYSICAL_ADDRESS    EfiMemoryTop;
66
+  EFI_PHYSICAL_ADDRESS    EfiMemoryBottom;
67
+  EFI_PHYSICAL_ADDRESS    EfiFreeMemoryTop;
68
+  EFI_PHYSICAL_ADDRESS    EfiFreeMemoryBottom;
69
+  EFI_PHYSICAL_ADDRESS    EfiEndOfHobList;
70
+} EFI_HOB_HANDOFF_INFO_TABLE;
71
+
72
+///
73
+/// EFI_HOB_MEMORY_ALLOCATION_HEADER describes the
74
+/// various attributes of the logical memory allocation. The type field will be used for
75
+/// subsequent inclusion in the UEFI memory map.
76
+///
77
+typedef struct {
78
+  ///
79
+  /// A GUID that defines the memory allocation region¡¯s type and purpose, as well as
80
+  /// other fields within the memory allocation HOB. This GUID is used to define the
81
+  /// additional data within the HOB that may be present for the memory allocation HOB.
82
+  /// Type EFI_GUID is defined in InstallProtocolInterface() in the UEFI 2.0
83
+  /// specification.
84
+  ///
85
+  EFI_GUID              Name;
86
+
87
+  /// The base address of memory allocated by this HOB. Type
88
+  /// EFI_PHYSICAL_ADDRESS is defined in AllocatePages() in the UEFI 2.0
89
+  /// specification.
90
+  EFI_PHYSICAL_ADDRESS  MemoryBaseAddress;
91
+
92
+  ///
93
+  /// The length in bytes of memory allocated by this HOB.
94
+  ///
95
+  UINT64                MemoryLength;
96
+
97
+  ///
98
+  /// Defines the type of memory allocated by this HOB. The memory type definition
99
+  /// follows the EFI_MEMORY_TYPE definition. Type EFI_MEMORY_TYPE is defined
100
+  /// in AllocatePages() in the UEFI 2.0 specification.
101
+  ///
102
+  EFI_MEMORY_TYPE       MemoryType;
103
+
104
+  ///
105
+  /// Padding for Itanium processor family
106
+  ///
107
+  UINT8                 Reserved[4];
108
+} EFI_HOB_MEMORY_ALLOCATION_HEADER;
109
+
110
+///
111
+/// Describes all memory ranges used during the HOB producer
112
+/// phase that exist outside the HOB list. This HOB type
113
+/// describes how memory is used,
114
+/// not the physical attributes of memory.
115
+///
116
+typedef struct {
117
+  EFI_HOB_GENERIC_HEADER            Header;
118
+  EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
119
+  //
120
+  // Additional data pertaining to the "Name" Guid memory
121
+  // may go here.
122
+  //
123
+} EFI_HOB_MEMORY_ALLOCATION;
124
+
125
+
126
+///
127
+/// Describes the memory stack that is produced by the HOB producer
128
+/// phase and upon which all postmemory-installed executable
129
+/// content in the HOB producer phase is executing.
130
+///
131
+typedef struct {
132
+  EFI_HOB_GENERIC_HEADER            Header;
133
+  EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
134
+} EFI_HOB_MEMORY_ALLOCATION_STACK;
135
+
136
+///
137
+/// Defines the location of the boot-strap
138
+/// processor (BSP) BSPStore ("Backing Store Pointer Store").
139
+/// This HOB is valid for the Itanium processor family only
140
+/// register overflow store.
141
+///
142
+typedef struct {
143
+  EFI_HOB_GENERIC_HEADER            Header;
144
+  EFI_HOB_MEMORY_ALLOCATION_HEADER  AllocDescriptor;
145
+} EFI_HOB_MEMORY_ALLOCATION_BSP_STORE;
146
+
147
+///
148
+/// Defines the location and entry point of the HOB consumer phase.
149
+///
150
+typedef struct {
151
+  EFI_HOB_GENERIC_HEADER            Header;
152
+  EFI_HOB_MEMORY_ALLOCATION_HEADER  MemoryAllocationHeader;
153
+  EFI_GUID                          ModuleName;
154
+  EFI_PHYSICAL_ADDRESS              EntryPoint;
155
+} EFI_HOB_MEMORY_ALLOCATION_MODULE;
156
+
157
+///
158
+/// type of Recount type
159
+///
160
+typedef UINT32 EFI_RESOURCE_TYPE;
161
+
162
+//
163
+// Value of ResourceType in EFI_HOB_RESOURCE_DESCRIPTOR.
164
+//
165
+#define EFI_RESOURCE_SYSTEM_MEMORY          0x00000000
166
+#define EFI_RESOURCE_MEMORY_MAPPED_IO       0x00000001
167
+#define EFI_RESOURCE_IO                     0x00000002
168
+#define EFI_RESOURCE_FIRMWARE_DEVICE        0x00000003
169
+#define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT  0x00000004
170
+#define EFI_RESOURCE_MEMORY_RESERVED        0x00000005
171
+#define EFI_RESOURCE_IO_RESERVED            0x00000006
172
+#define EFI_RESOURCE_MAX_MEMORY_TYPE        0x00000007
173
+
174
+///
175
+/// type of recount attribute type
176
+///
177
+typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE;
178
+
179
+//
180
+// These types can be ORed together as needed.
181
+//
182
+// The first three enumerations describe settings
183
+//
184
+#define EFI_RESOURCE_ATTRIBUTE_PRESENT              0x00000001
185
+#define EFI_RESOURCE_ATTRIBUTE_INITIALIZED          0x00000002
186
+#define EFI_RESOURCE_ATTRIBUTE_TESTED               0x00000004
187
+//
188
+// The rest of the settings describe capabilities
189
+//
190
+#define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC           0x00000008
191
+#define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC         0x00000010
192
+#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1           0x00000020
193
+#define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2           0x00000040
194
+#define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED           0x00000080
195
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED          0x00000100
196
+#define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED      0x00000200
197
+#define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE              0x00000400
198
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE        0x00000800
199
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE  0x00001000
200
+#define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE     0x00002000
201
+#define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO                0x00004000
202
+#define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO                0x00008000
203
+#define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO                0x00010000
204
+#define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED        0x00020000
205
+
206
+///
207
+/// Describes the resource properties of all fixed,
208
+/// nonrelocatable resource ranges found on the processor
209
+/// host bus during the HOB producer phase.
210
+///
211
+typedef struct {
212
+  EFI_HOB_GENERIC_HEADER      Header;
213
+  EFI_GUID                    Owner;
214
+  EFI_RESOURCE_TYPE           ResourceType;
215
+  EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
216
+  EFI_PHYSICAL_ADDRESS        PhysicalStart;
217
+  UINT64                      ResourceLength;
218
+} EFI_HOB_RESOURCE_DESCRIPTOR;
219
+
220
+///
221
+/// Allows writers of executable content in the HOB producer phase to
222
+/// maintain and manage HOBs with specific GUID.
223
+///
224
+typedef struct {
225
+  EFI_HOB_GENERIC_HEADER      Header;
226
+  EFI_GUID                    Name;
227
+
228
+  ///
229
+  /// Guid specific data goes here
230
+  ///
231
+} EFI_HOB_GUID_TYPE;
232
+
233
+///
234
+/// Details the location of firmware volumes that contain firmware files.
235
+///
236
+typedef struct {
237
+  EFI_HOB_GENERIC_HEADER Header;
238
+  EFI_PHYSICAL_ADDRESS   BaseAddress;
239
+  UINT64                 Length;
240
+} EFI_HOB_FIRMWARE_VOLUME;
241
+
242
+///
243
+/// Details the location of a firmware volume which was extracted
244
+/// from a file within another firmware volume.
245
+///
246
+typedef struct {
247
+  EFI_HOB_GENERIC_HEADER  Header;
248
+  EFI_PHYSICAL_ADDRESS    BaseAddress;
249
+  UINT64                  Length;
250
+  EFI_GUID                FvName;
251
+  EFI_GUID                FileName;
252
+} EFI_HOB_FIRMWARE_VOLUME2;
253
+
254
+
255
+///
256
+/// Describes processor information, such as address space and I/O space capabilities.
257
+///
258
+typedef struct {
259
+  EFI_HOB_GENERIC_HEADER  Header;
260
+  UINT8                   SizeOfMemorySpace;
261
+  UINT8                   SizeOfIoSpace;
262
+  UINT8                   Reserved[6];
263
+} EFI_HOB_CPU;
264
+
265
+
266
+///
267
+/// Describes pool memory allocations.
268
+///
269
+typedef struct {
270
+  EFI_HOB_GENERIC_HEADER  Header;
271
+} EFI_HOB_MEMORY_POOL;
272
+
273
+///
274
+/// Union of all the possible HOB Types
275
+///
276
+typedef union {
277
+  EFI_HOB_GENERIC_HEADER              *Header;
278
+  EFI_HOB_HANDOFF_INFO_TABLE          *HandoffInformationTable;
279
+  EFI_HOB_MEMORY_ALLOCATION           *MemoryAllocation;
280
+  EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore;
281
+  EFI_HOB_MEMORY_ALLOCATION_STACK     *MemoryAllocationStack;
282
+  EFI_HOB_MEMORY_ALLOCATION_MODULE    *MemoryAllocationModule;
283
+  EFI_HOB_RESOURCE_DESCRIPTOR         *ResourceDescriptor;
284
+  EFI_HOB_GUID_TYPE                   *Guid;
285
+  EFI_HOB_FIRMWARE_VOLUME             *FirmwareVolume;
286
+  EFI_HOB_FIRMWARE_VOLUME2            *FirmwareVolume2;
287
+  EFI_HOB_CPU                         *Cpu;
288
+  EFI_HOB_MEMORY_POOL                 *Pool;
289
+  UINT8                               *Raw;
290
+} EFI_PEI_HOB_POINTERS;
291
+
292
+
293
+#endif

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

@@ -0,0 +1,104 @@
1
+/** @file
2
+  Include file matches things in PI for multiple module types.
3
+
4
+  Copyright (c) 2006 - 2007, 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
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
+  Version 1.0.
15
+
16
+**/
17
+
18
+#ifndef __PI_MULTIPHASE_H__
19
+#define __PI_MULTIPHASE_H__
20
+
21
+#include <gpxe/efi/Uefi/UefiMultiPhase.h>
22
+
23
+#include <gpxe/efi/Pi/PiFirmwareVolume.h>
24
+#include <gpxe/efi/Pi/PiFirmwareFile.h>
25
+#include <gpxe/efi/Pi/PiBootMode.h>
26
+
27
+#include <gpxe/efi/Pi/PiHob.h>
28
+#include <gpxe/efi/Pi/PiDependency.h>
29
+
30
+
31
+#define EFI_NOT_AVAILABLE_YET   EFIERR (32)
32
+
33
+///
34
+/// Status Code Type Definition
35
+///
36
+typedef UINT32  EFI_STATUS_CODE_TYPE;
37
+
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
46
+
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
55
+
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
69
+
70
+///
71
+/// Status Code Value Definition
72
+///
73
+typedef UINT32 EFI_STATUS_CODE_VALUE;
74
+
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
82
+
83
+///
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.
87
+///
88
+typedef struct {
89
+  UINT16    HeaderSize;
90
+  UINT16    Size;
91
+  EFI_GUID  Type;
92
+} EFI_STATUS_CODE_DATA;
93
+
94
+
95
+//
96
+// Bit values for AuthenticationStatus
97
+//
98
+#define EFI_AUTH_STATUS_PLATFORM_OVERRIDE   0x01
99
+#define EFI_AUTH_STATUS_IMAGE_SIGNED        0x02
100
+#define EFI_AUTH_STATUS_NOT_TESTED          0x04
101
+#define EFI_AUTH_STATUS_TEST_FAILED         0x08
102
+#define EFI_AUTH_STATUS_ALL                 0x0f
103
+
104
+#endif

+ 25
- 0
src/include/gpxe/efi/PiDxe.h View File

@@ -0,0 +1,25 @@
1
+/** @file
2
+
3
+  Root include file for Mde Package DXE_CORE, DXE, SMM, SAL type modules.
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
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_DXE_H__
17
+#define __PI_DXE_H__
18
+
19
+#include <gpxe/efi/Uefi/UefiBaseType.h>
20
+#include <gpxe/efi/Uefi/UefiSpec.h>
21
+
22
+#include <gpxe/efi/Pi/PiDxeCis.h>
23
+
24
+#endif
25
+

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

@@ -0,0 +1,10 @@
1
+/*
2
+ * EFI header files rely on having the CPU architecture directory
3
+ * present in the search path in order to pick up ProcessorBind.h.  We
4
+ * use this header file as a quick indirection layer.
5
+ *  - mcb30
6
+ */
7
+
8
+#if __i386__
9
+#include <gpxe/efi/Ia32/ProcessorBind.h>
10
+#endif

+ 560
- 0
src/include/gpxe/efi/Protocol/DevicePath.h View File

@@ -0,0 +1,560 @@
1
+/** @file
2
+  The device path protocol as defined in UEFI 2.0.
3
+
4
+  The device path represents a programatic path to a device. It's the view
5
+  from a software point of view. It also must persist from boot to boot, so
6
+  it can not contain things like PCI bus numbers that change from boot to boot.
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
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.
16
+
17
+**/
18
+
19
+#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
20
+#define __EFI_DEVICE_PATH_PROTOCOL_H__
21
+
22
+#include <gpxe/efi/Guid/PcAnsi.h>
23
+
24
+///
25
+/// Device Path protocol
26
+///
27
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \
28
+  { \
29
+    0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
30
+  }
31
+
32
+//
33
+// Protocol GUID defined in EFI1.1.
34
+//
35
+
36
+///
37
+/// Device Path information
38
+///
39
+#define DEVICE_PATH_PROTOCOL  EFI_DEVICE_PATH_PROTOCOL_GUID
40
+
41
+#pragma pack(1)
42
+
43
+typedef struct {
44
+  UINT8 Type;
45
+  UINT8 SubType;
46
+  UINT8 Length[2];
47
+} EFI_DEVICE_PATH_PROTOCOL;
48
+
49
+///
50
+/// For backward-compatible with EFI1.1.
51
+///
52
+typedef EFI_DEVICE_PATH_PROTOCOL  EFI_DEVICE_PATH;
53
+
54
+///
55
+/// Hardware Device Paths
56
+///
57
+#define HARDWARE_DEVICE_PATH      0x01
58
+
59
+#define HW_PCI_DP                 0x01
60
+typedef struct {
61
+  EFI_DEVICE_PATH_PROTOCOL        Header;
62
+  UINT8                           Function;
63
+  UINT8                           Device;
64
+} PCI_DEVICE_PATH;
65
+
66
+#define HW_PCCARD_DP              0x02
67
+typedef struct {
68
+  EFI_DEVICE_PATH_PROTOCOL        Header;
69
+  UINT8                           FunctionNumber;
70
+} PCCARD_DEVICE_PATH;
71
+
72
+#define HW_MEMMAP_DP              0x03
73
+typedef struct {
74
+  EFI_DEVICE_PATH_PROTOCOL        Header;
75
+  UINT32                          MemoryType;
76
+  EFI_PHYSICAL_ADDRESS            StartingAddress;
77
+  EFI_PHYSICAL_ADDRESS            EndingAddress;
78
+} MEMMAP_DEVICE_PATH;
79
+
80
+#define HW_VENDOR_DP              0x04
81
+typedef struct {
82
+  EFI_DEVICE_PATH_PROTOCOL        Header;
83
+  EFI_GUID                        Guid;
84
+} VENDOR_DEVICE_PATH;
85
+
86
+#define HW_CONTROLLER_DP          0x05
87
+typedef struct {
88
+  EFI_DEVICE_PATH_PROTOCOL        Header;
89
+  UINT32                          ControllerNumber;
90
+} CONTROLLER_DEVICE_PATH;
91
+
92
+///
93
+/// ACPI Device Paths
94
+///
95
+#define ACPI_DEVICE_PATH          0x02
96
+
97
+#define ACPI_DP                   0x01
98
+typedef struct {
99
+  EFI_DEVICE_PATH_PROTOCOL        Header;
100
+  UINT32                          HID;
101
+  UINT32                          UID;
102
+} ACPI_HID_DEVICE_PATH;
103
+
104
+#define ACPI_EXTENDED_DP          0x02
105
+typedef struct {
106
+  EFI_DEVICE_PATH_PROTOCOL        Header;
107
+  UINT32                          HID;
108
+  UINT32                          UID;
109
+  UINT32                          CID;
110
+  ///
111
+  /// Optional variable length _HIDSTR
112
+  /// Optional variable length _UIDSTR
113
+  ///
114
+} ACPI_EXTENDED_HID_DEVICE_PATH;
115
+
116
+//
117
+//  EISA ID Macro
118
+//  EISA ID Definition 32-bits
119
+//   bits[15:0] - three character compressed ASCII EISA ID.
120
+//   bits[31:16] - binary number
121
+//    Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
122
+//
123
+#define PNP_EISA_ID_CONST         0x41d0
124
+#define EISA_ID(_Name, _Num)      ((UINT32)((_Name) | (_Num) << 16))
125
+#define EISA_PNP_ID(_PNPId)       (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
126
+#define EFI_PNP_ID(_PNPId)        (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
127
+
128
+#define PNP_EISA_ID_MASK          0xffff
129
+#define EISA_ID_TO_NUM(_Id)       ((_Id) >> 16)
130
+
131
+
132
+#define ACPI_ADR_DP               0x03
133
+typedef struct {
134
+  EFI_DEVICE_PATH_PROTOCOL        Header;
135
+  UINT32                          ADR;
136
+} ACPI_ADR_DEVICE_PATH;
137
+
138
+#define ACPI_ADR_DISPLAY_TYPE_OTHER             0
139
+#define ACPI_ADR_DISPLAY_TYPE_VGA               1
140
+#define ACPI_ADR_DISPLAY_TYPE_TV                2
141
+#define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL  3
142
+#define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL  4
143
+
144
+#define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \
145
+          ((UINT32)( (((_DeviceIdScheme) & 0x1) << 31) |  \
146
+                      (((_HeadId)         & 0x7) << 18) |  \
147
+                      (((_NonVgaOutput)   & 0x1) << 17) |  \
148
+                      (((_BiosCanDetect)  & 0x1) << 16) |  \
149
+                      (((_VendorInfo)     & 0xf) << 12) |  \
150
+                      (((_Type)           & 0xf) << 8)  |  \
151
+                      (((_Port)           & 0xf) << 4)  |  \
152
+                       ((_Index)          & 0xf) ))
153
+
154
+///
155
+/// Messaging Device Paths
156
+///
157
+#define MESSAGING_DEVICE_PATH     0x03
158
+
159
+#define MSG_ATAPI_DP              0x01
160
+typedef struct {
161
+  EFI_DEVICE_PATH_PROTOCOL        Header;
162
+  UINT8                           PrimarySecondary;
163
+  UINT8                           SlaveMaster;
164
+  UINT16                          Lun;
165
+} ATAPI_DEVICE_PATH;
166
+
167
+#define MSG_SCSI_DP               0x02
168
+typedef struct {
169
+  EFI_DEVICE_PATH_PROTOCOL        Header;
170
+  UINT16                          Pun;
171
+  UINT16                          Lun;
172
+} SCSI_DEVICE_PATH;
173
+
174
+#define MSG_FIBRECHANNEL_DP       0x03
175
+typedef struct {
176
+  EFI_DEVICE_PATH_PROTOCOL        Header;
177
+  UINT32                          Reserved;
178
+  UINT64                          WWN;
179
+  UINT64                          Lun;
180
+} FIBRECHANNEL_DEVICE_PATH;
181
+
182
+#define MSG_1394_DP               0x04
183
+typedef struct {
184
+  EFI_DEVICE_PATH_PROTOCOL        Header;
185
+  UINT32                          Reserved;
186
+  UINT64                          Guid;
187
+} F1394_DEVICE_PATH;
188
+
189
+#define MSG_USB_DP                0x05
190
+typedef struct {
191
+    EFI_DEVICE_PATH_PROTOCOL      Header;
192
+    UINT8                         ParentPortNumber;
193
+    UINT8                         InterfaceNumber;
194
+} USB_DEVICE_PATH;
195
+
196
+#define MSG_USB_CLASS_DP          0x0f
197
+typedef struct {
198
+    EFI_DEVICE_PATH_PROTOCOL      Header;
199
+    UINT16                        VendorId;
200
+    UINT16                        ProductId;
201
+    UINT8                         DeviceClass;
202
+    UINT8                         DeviceSubClass;
203
+    UINT8                         DeviceProtocol;
204
+} USB_CLASS_DEVICE_PATH;
205
+
206
+#define MSG_USB_WWID_DP           0x10
207
+typedef struct {
208
+    EFI_DEVICE_PATH_PROTOCOL      Header;
209
+    UINT16                        InterfaceNumber;
210
+    UINT16                        VendorId;
211
+    UINT16                        ProductId;
212
+    // CHAR16                     SerialNumber[...];
213
+} USB_WWID_DEVICE_PATH;
214
+
215
+
216
+#define MSG_DEVICE_LOGICAL_UNIT_DP  0x11
217
+typedef struct {
218
+    EFI_DEVICE_PATH_PROTOCOL      Header;
219
+    UINT8                         Lun;
220
+} DEVICE_LOGICAL_UNIT_DEVICE_PATH;
221
+
222
+#define MSG_SATA_DP               0x12
223
+typedef struct {
224
+  EFI_DEVICE_PATH_PROTOCOL        Header;
225
+  UINT16                          HBAPortNumber;
226
+  UINT16                          PortMultiplierPortNumber;
227
+  UINT16                          Lun;
228
+} SATA_DEVICE_PATH;
229
+
230
+#define MSG_I2O_DP                0x06
231
+typedef struct {
232
+  EFI_DEVICE_PATH_PROTOCOL        Header;
233
+  UINT32                          Tid;
234
+} I2O_DEVICE_PATH;
235
+
236
+#define MSG_MAC_ADDR_DP           0x0b
237
+typedef struct {
238
+  EFI_DEVICE_PATH_PROTOCOL        Header;
239
+  EFI_MAC_ADDRESS                 MacAddress;
240
+  UINT8                           IfType;
241
+} MAC_ADDR_DEVICE_PATH;
242
+
243
+#define MSG_IPv4_DP               0x0c
244
+typedef struct {
245
+  EFI_DEVICE_PATH_PROTOCOL        Header;
246
+  EFI_IPv4_ADDRESS                LocalIpAddress;
247
+  EFI_IPv4_ADDRESS                RemoteIpAddress;
248
+  UINT16                          LocalPort;
249
+  UINT16                          RemotePort;
250
+  UINT16                          Protocol;
251
+  BOOLEAN                         StaticIpAddress;
252
+} IPv4_DEVICE_PATH;
253
+
254
+#define MSG_IPv6_DP               0x0d
255
+typedef struct {
256
+  EFI_DEVICE_PATH_PROTOCOL        Header;
257
+  EFI_IPv6_ADDRESS                LocalIpAddress;
258
+  EFI_IPv6_ADDRESS                RemoteIpAddress;
259
+  UINT16                          LocalPort;
260
+  UINT16                          RemotePort;
261
+  UINT16                          Protocol;
262
+  BOOLEAN                         StaticIpAddress;
263
+} IPv6_DEVICE_PATH;
264
+
265
+#define MSG_INFINIBAND_DP         0x09
266
+typedef struct {
267
+  EFI_DEVICE_PATH_PROTOCOL        Header;
268
+  UINT32                          ResourceFlags;
269
+  UINT8                           PortGid[16];
270
+  UINT64                          ServiceId;
271
+  UINT64                          TargetPortId;
272
+  UINT64                          DeviceId;
273
+} INFINIBAND_DEVICE_PATH;
274
+
275
+#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE                0x01
276
+#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT  0x02
277
+#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL           0x04
278
+#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL           0x08
279
+#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL           0x10
280
+
281
+#define MSG_UART_DP               0x0e
282
+typedef struct {
283
+  EFI_DEVICE_PATH_PROTOCOL        Header;
284
+  UINT32                          Reserved;
285
+  UINT64                          BaudRate;
286
+  UINT8                           DataBits;
287
+  UINT8                           Parity;
288
+  UINT8                           StopBits;
289
+} UART_DEVICE_PATH;
290
+
291
+//
292
+// Use VENDOR_DEVICE_PATH struct
293
+//
294
+#define MSG_VENDOR_DP             0x0a
295
+typedef VENDOR_DEVICE_PATH        VENDOR_DEFINED_DEVICE_PATH;
296
+
297
+#define DEVICE_PATH_MESSAGING_PC_ANSI     EFI_PC_ANSI_GUID
298
+#define DEVICE_PATH_MESSAGING_VT_100      EFI_VT_100_GUID
299
+#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
300
+#define DEVICE_PATH_MESSAGING_VT_UTF8     EFI_VT_UTF8_GUID
301
+
302
+#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL   EFI_UART_DEVICE_PATH_GUID
303
+
304
+typedef struct {
305
+  EFI_DEVICE_PATH_PROTOCOL        Header;
306
+  EFI_GUID                        Guid;
307
+  UINT32                          FlowControlMap;
308
+} UART_FLOW_CONTROL_DEVICE_PATH;
309
+
310
+#define DEVICE_PATH_MESSAGING_SAS                 EFI_SAS_DEVICE_PATH_GUID
311
+
312
+typedef struct {
313
+  EFI_DEVICE_PATH_PROTOCOL        Header;
314
+  EFI_GUID                        Guid;
315
+  UINT32                          Reserved;
316
+  UINT64                          SasAddress;
317
+  UINT64                          Lun;
318
+  UINT16                          DeviceTopology;
319
+  UINT16                          RelativeTargetPort;
320
+} SAS_DEVICE_PATH;
321
+
322
+#define MSG_ISCSI_DP              0x13
323
+typedef struct {
324
+  EFI_DEVICE_PATH_PROTOCOL        Header;
325
+  UINT16                          NetworkProtocol;
326
+  UINT16                          LoginOption;
327
+  UINT64                          Lun;
328
+  UINT16                          TargetPortalGroupTag;
329
+  // CHAR8                        iSCSI Target Name
330
+} ISCSI_DEVICE_PATH;
331
+
332
+#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST             0x0000
333
+#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C   0x0002
334
+#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST               0x0000
335
+#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C     0x0008
336
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP              0x0000
337
+#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON               0x1000
338
+#define ISCSI_LOGIN_OPTION_CHAP_BI                      0x0000
339
+#define ISCSI_LOGIN_OPTION_CHAP_UNI                     0x2000
340
+
341
+//
342
+// Media Device Path
343
+//
344
+#define MEDIA_DEVICE_PATH         0x04
345
+
346
+#define MEDIA_HARDDRIVE_DP        0x01
347
+typedef struct {
348
+  EFI_DEVICE_PATH_PROTOCOL        Header;
349
+  UINT32                          PartitionNumber;
350
+  UINT64                          PartitionStart;
351
+  UINT64                          PartitionSize;
352
+  UINT8                           Signature[16];
353
+  UINT8                           MBRType;
354
+  UINT8                           SignatureType;
355
+} HARDDRIVE_DEVICE_PATH;
356
+
357
+#define MBR_TYPE_PCAT             0x01
358
+#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
359
+
360
+#define SIGNATURE_TYPE_MBR        0x01
361
+#define SIGNATURE_TYPE_GUID       0x02
362
+
363
+#define MEDIA_CDROM_DP            0x02
364
+typedef struct {
365
+  EFI_DEVICE_PATH_PROTOCOL        Header;
366
+  UINT32                          BootEntry;
367
+  UINT64                          PartitionStart;
368
+  UINT64                          PartitionSize;
369
+} CDROM_DEVICE_PATH;
370
+
371
+//
372
+// Use VENDOR_DEVICE_PATH struct
373
+//
374
+#define MEDIA_VENDOR_DP           0x03
375
+
376
+#define MEDIA_FILEPATH_DP         0x04
377
+typedef struct {
378
+  EFI_DEVICE_PATH_PROTOCOL        Header;
379
+  CHAR16                          PathName[1];
380
+} FILEPATH_DEVICE_PATH;
381
+
382
+#define SIZE_OF_FILEPATH_DEVICE_PATH  EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
383
+
384
+#define MEDIA_PROTOCOL_DP         0x05
385
+typedef struct {
386
+  EFI_DEVICE_PATH_PROTOCOL        Header;
387
+  EFI_GUID                        Protocol;
388
+} MEDIA_PROTOCOL_DEVICE_PATH;
389
+
390
+
391
+#define MEDIA_PIWG_FW_VOL_DP      0x7
392
+typedef struct {
393
+  EFI_DEVICE_PATH_PROTOCOL        Header;
394
+  EFI_GUID                        FvName;
395
+} MEDIA_FW_VOL_DEVICE_PATH;
396
+
397
+
398
+#define MEDIA_PIWG_FW_FILE_DP     0x6
399
+typedef struct {
400
+  EFI_DEVICE_PATH_PROTOCOL        Header;
401
+  EFI_GUID                        FvFileName;
402
+} MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
403
+
404
+//
405
+// BBS Device Path
406
+//
407
+#define BBS_DEVICE_PATH           0x05
408
+#define BBS_BBS_DP                0x01
409
+typedef struct {
410
+  EFI_DEVICE_PATH_PROTOCOL        Header;
411
+  UINT16                          DeviceType;
412
+  UINT16                          StatusFlag;
413
+  CHAR8                           String[1];
414
+} BBS_BBS_DEVICE_PATH;
415
+
416
+//
417
+// DeviceType definitions - from BBS specification
418
+//
419
+#define BBS_TYPE_FLOPPY           0x01
420
+#define BBS_TYPE_HARDDRIVE        0x02
421
+#define BBS_TYPE_CDROM            0x03
422
+#define BBS_TYPE_PCMCIA           0x04
423
+#define BBS_TYPE_USB              0x05
424
+#define BBS_TYPE_EMBEDDED_NETWORK 0x06
425
+#define BBS_TYPE_BEV              0x80
426
+#define BBS_TYPE_UNKNOWN          0xFF
427
+
428
+
429
+///
430
+/// Union of all possible Device Paths and pointers to Device Paths
431
+///
432
+
433
+typedef union {
434
+  EFI_DEVICE_PATH_PROTOCOL             DevPath;
435
+  PCI_DEVICE_PATH                      Pci;
436
+  PCCARD_DEVICE_PATH                   PcCard;
437
+  MEMMAP_DEVICE_PATH                   MemMap;
438
+  VENDOR_DEVICE_PATH                   Vendor;
439
+
440
+  CONTROLLER_DEVICE_PATH               Controller;
441
+  ACPI_HID_DEVICE_PATH                 Acpi;
442
+
443
+  ATAPI_DEVICE_PATH                    Atapi;
444
+  SCSI_DEVICE_PATH                     Scsi;
445
+  ISCSI_DEVICE_PATH                    Iscsi;
446
+  FIBRECHANNEL_DEVICE_PATH             FibreChannel;
447
+
448
+  F1394_DEVICE_PATH                    F1394;
449
+  USB_DEVICE_PATH                      Usb;
450
+  SATA_DEVICE_PATH                     Sata;
451
+  USB_CLASS_DEVICE_PATH                UsbClass;
452
+  I2O_DEVICE_PATH                      I2O;
453
+  MAC_ADDR_DEVICE_PATH                 MacAddr;
454
+  IPv4_DEVICE_PATH                     Ipv4;
455
+  IPv6_DEVICE_PATH                     Ipv6;
456
+  INFINIBAND_DEVICE_PATH               InfiniBand;
457
+  UART_DEVICE_PATH                     Uart;
458
+
459
+  HARDDRIVE_DEVICE_PATH                HardDrive;
460
+  CDROM_DEVICE_PATH                    CD;
461
+
462
+  FILEPATH_DEVICE_PATH                 FilePath;
463
+  MEDIA_PROTOCOL_DEVICE_PATH           MediaProtocol;
464
+
465
+  BBS_BBS_DEVICE_PATH                  Bbs;
466
+} EFI_DEV_PATH;
467
+
468
+
469
+
470
+typedef union {
471
+  EFI_DEVICE_PATH_PROTOCOL             *DevPath;
472
+  PCI_DEVICE_PATH                      *Pci;
473
+  PCCARD_DEVICE_PATH                   *PcCard;
474
+  MEMMAP_DEVICE_PATH                   *MemMap;
475
+  VENDOR_DEVICE_PATH                   *Vendor;
476
+
477
+  CONTROLLER_DEVICE_PATH               *Controller;
478
+  ACPI_HID_DEVICE_PATH                 *Acpi;
479
+  ACPI_EXTENDED_HID_DEVICE_PATH        *ExtendedAcpi;
480
+
481
+  ATAPI_DEVICE_PATH                    *Atapi;
482
+  SCSI_DEVICE_PATH                     *Scsi;
483
+  FIBRECHANNEL_DEVICE_PATH             *FibreChannel;
484
+
485
+  F1394_DEVICE_PATH                    *F1394;
486
+  USB_DEVICE_PATH                      *Usb;
487
+  SATA_DEVICE_PATH                     *Sata;
488
+  USB_CLASS_DEVICE_PATH                *UsbClass;
489
+  I2O_DEVICE_PATH                      *I2O;
490
+  MAC_ADDR_DEVICE_PATH                 *MacAddr;
491
+  IPv4_DEVICE_PATH                     *Ipv4;
492
+  IPv6_DEVICE_PATH                     *Ipv6;
493
+  INFINIBAND_DEVICE_PATH               *InfiniBand;
494
+  UART_DEVICE_PATH                     *Uart;
495
+
496
+  HARDDRIVE_DEVICE_PATH                *HardDrive;
497
+  CDROM_DEVICE_PATH                    *CD;
498
+
499
+  FILEPATH_DEVICE_PATH                 *FilePath;
500
+  MEDIA_PROTOCOL_DEVICE_PATH           *MediaProtocol;
501
+
502
+  BBS_BBS_DEVICE_PATH                  *Bbs;
503
+  UINT8                                *Raw;
504
+} EFI_DEV_PATH_PTR;
505
+
506
+#pragma pack()
507
+
508
+#define EFI_DP_TYPE_MASK                     0x7F
509
+#define EFI_DP_TYPE_UNPACKED                 0x80
510
+#define END_DEVICE_PATH_TYPE                 0x7f
511
+
512
+#define EFI_END_ENTIRE_DEVICE_PATH           0xff
513
+#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE   0xff
514
+#define EFI_END_INSTANCE_DEVICE_PATH         0x01
515
+#define END_ENTIRE_DEVICE_PATH_SUBTYPE       EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
516
+#define END_INSTANCE_DEVICE_PATH_SUBTYPE     EFI_END_INSTANCE_DEVICE_PATH
517
+
518
+#define EFI_END_DEVICE_PATH_LENGTH           (sizeof (EFI_DEVICE_PATH_PROTOCOL))
519
+#define END_DEVICE_PATH_LENGTH               EFI_END_DEVICE_PATH_LENGTH
520
+
521
+#define DP_IS_END_TYPE(a)
522
+#define DP_IS_END_SUBTYPE(a)                 (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
523
+#define DevicePathSubType(a)                 ((a)->SubType)
524
+#define IsDevicePathUnpacked(a)              ((a)->Type & EFI_DP_TYPE_UNPACKED)
525
+
526
+#define EfiDevicePathNodeLength(a)           (((a)->Length[0]) | ((a)->Length[1] << 8))
527
+#define DevicePathNodeLength(a)              (EfiDevicePathNodeLength(a))
528
+#define EfiNextDevicePathNode(a)             ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
529
+#define NextDevicePathNode(a)                (EfiNextDevicePathNode(a))
530
+
531
+#define EfiDevicePathType(a)                 (((a)->Type) & EFI_DP_TYPE_MASK)
532
+#define DevicePathType(a)                    (EfiDevicePathType(a))
533
+#define EfiIsDevicePathEndType(a)            (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
534
+#define IsDevicePathEndType(a)               (EfiIsDevicePathEndType(a))
535
+
536
+
537
+#define EfiIsDevicePathEndSubType(a)         ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
538
+#define IsDevicePathEndSubType(a)            (EfiIsDevicePathEndSubType(a))
539
+#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
540
+
541
+#define EfiIsDevicePathEnd(a)                (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
542
+#define IsDevicePathEnd(a)                   (EfiIsDevicePathEnd(a))
543
+#define EfiIsDevicePathEndInstance(a)        (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
544
+
545
+
546
+#define SetDevicePathNodeLength(a,l) {                           \
547
+          (a)->Length[0] = (UINT8) (l);                          \
548
+          (a)->Length[1] = (UINT8) ((l) >> 8);                   \
549
+          }
550
+
551
+#define SetDevicePathEndNode(a)  {                               \
552
+          (a)->Type = END_DEVICE_PATH_TYPE;                      \
553
+          (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;         \
554
+          (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL);     \
555
+          (a)->Length[1] = 0;                                    \
556
+          }
557
+
558
+extern EFI_GUID gEfiDevicePathProtocolGuid;
559
+
560
+#endif

+ 145
- 0
src/include/gpxe/efi/Protocol/SimpleTextIn.h View File

@@ -0,0 +1,145 @@
1
+/** @file
2
+  Simple Text In protocol from the UEFI 2.0 specification.
3
+
4
+  Abstraction of a very simple input device like a keyboard or serial
5
+  terminal.
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
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.
15
+
16
+**/
17
+
18
+#ifndef __SIMPLE_TEXT_IN_PROTOCOL_H__
19
+#define __SIMPLE_TEXT_IN_PROTOCOL_H__
20
+
21
+#include <gpxe/efi/ProcessorBind.h>
22
+
23
+#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
24
+  { \
25
+    0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
26
+  }
27
+
28
+///
29
+/// Protocol GUID defined in EFI1.1.
30
+///
31
+#define SIMPLE_INPUT_PROTOCOL   EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID
32
+
33
+typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
34
+
35
+///
36
+/// Backward-compatible with EFI1.1.
37
+///
38
+typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL  SIMPLE_INPUT_INTERFACE;
39
+//
40
+// Data structures
41
+//
42
+typedef struct {
43
+  UINT16  ScanCode;
44
+  CHAR16  UnicodeChar;
45
+} EFI_INPUT_KEY;
46
+
47
+//
48
+// Required unicode control chars
49
+//
50
+#define CHAR_NULL             0x0000
51
+#define CHAR_BACKSPACE        0x0008
52
+#define CHAR_TAB              0x0009
53
+#define CHAR_LINEFEED         0x000A
54
+#define CHAR_CARRIAGE_RETURN  0x000D
55
+
56
+//
57
+// EFI Scan codes
58
+//
59
+#define SCAN_NULL       0x0000
60
+#define SCAN_UP         0x0001
61
+#define SCAN_DOWN       0x0002
62
+#define SCAN_RIGHT      0x0003
63
+#define SCAN_LEFT       0x0004
64
+#define SCAN_HOME       0x0005
65
+#define SCAN_END        0x0006
66
+#define SCAN_INSERT     0x0007
67
+#define SCAN_DELETE     0x0008
68
+#define SCAN_PAGE_UP    0x0009
69
+#define SCAN_PAGE_DOWN  0x000A
70
+#define SCAN_F1         0x000B
71
+#define SCAN_F2         0x000C
72
+#define SCAN_F3         0x000D
73
+#define SCAN_F4         0x000E
74
+#define SCAN_F5         0x000F
75
+#define SCAN_F6         0x0010
76
+#define SCAN_F7         0x0011
77
+#define SCAN_F8         0x0012
78
+#define SCAN_F9         0x0013
79
+#define SCAN_F10        0x0014
80
+#define SCAN_F11        0x0015
81
+#define SCAN_F12        0x0016
82
+#define SCAN_ESC        0x0017
83
+
84
+/**
85
+  Reset the input device and optionaly run diagnostics
86
+
87
+  @param  This                 Protocol instance pointer.
88
+  @param  ExtendedVerification Driver may perform diagnostics on reset.
89
+
90
+  @retval EFI_SUCCESS          The device was reset.
91
+  @retval EFI_DEVICE_ERROR     The device is not functioning properly and could not be reset.
92
+
93
+**/
94
+typedef
95
+EFI_STATUS
96
+(EFIAPI *EFI_INPUT_RESET)(
97
+  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
98
+  IN BOOLEAN                              ExtendedVerification
99
+  );
100
+
101
+/**
102
+  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.
104
+
105
+  @param  This Protocol instance pointer.
106
+  @param  Key  Driver may perform diagnostics on reset.
107
+
108
+  @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
111
+                           hardware errors.
112
+
113
+**/
114
+typedef
115
+EFI_STATUS
116
+(EFIAPI *EFI_INPUT_READ_KEY)(
117
+  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL       *This,
118
+  OUT EFI_INPUT_KEY                       *Key
119
+  );
120
+
121
+/**
122
+  @par Protocol Description:
123
+  The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
124
+  It is the minimum required protocol for ConsoleIn.
125
+
126
+  @param Reset
127
+  Reset the ConsoleIn device.
128
+
129
+  @param ReadKeyStroke
130
+  Returns the next input character.
131
+
132
+  @param WaitForKey
133
+  Event to use with WaitForEvent() to wait for a key to be available.
134
+
135
+**/
136
+
137
+struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
138
+  EFI_INPUT_RESET     Reset;
139
+  EFI_INPUT_READ_KEY  ReadKeyStroke;
140
+  EFI_EVENT           WaitForKey;
141
+};
142
+
143
+extern EFI_GUID gEfiSimpleTextInProtocolGuid;
144
+
145
+#endif

+ 437
- 0
src/include/gpxe/efi/Protocol/SimpleTextOut.h View File

@@ -0,0 +1,437 @@
1
+/** @file
2
+  Simple Text Out protocol from the UEFI 2.0 specification.
3
+
4
+  Abstraction of a very simple text based output device like VGA text mode or
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
7
+  of multiple physical devices.
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
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.
17
+
18
+**/
19
+
20
+#ifndef __SIMPLE_TEXT_OUT_H__
21
+#define __SIMPLE_TEXT_OUT_H__
22
+
23
+#include <gpxe/efi/PiDxe.h>
24
+
25
+#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
26
+  { \
27
+    0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
28
+  }
29
+
30
+///
31
+/// Protocol GUID defined in EFI1.1.
32
+///
33
+#define SIMPLE_TEXT_OUTPUT_PROTOCOL   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID
34
+
35
+typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
36
+
37
+///
38
+/// Backward-compatible with EFI1.1.
39
+///
40
+typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   SIMPLE_TEXT_OUTPUT_INTERFACE;
41
+
42
+//
43
+// Define's for required EFI Unicode Box Draw characters
44
+//
45
+#define BOXDRAW_HORIZONTAL                  0x2500
46
+#define BOXDRAW_VERTICAL                    0x2502
47
+#define BOXDRAW_DOWN_RIGHT                  0x250c
48
+#define BOXDRAW_DOWN_LEFT                   0x2510
49
+#define BOXDRAW_UP_RIGHT                    0x2514
50
+#define BOXDRAW_UP_LEFT                     0x2518
51
+#define BOXDRAW_VERTICAL_RIGHT              0x251c
52
+#define BOXDRAW_VERTICAL_LEFT               0x2524
53
+#define BOXDRAW_DOWN_HORIZONTAL             0x252c
54
+#define BOXDRAW_UP_HORIZONTAL               0x2534
55
+#define BOXDRAW_VERTICAL_HORIZONTAL         0x253c
56
+#define BOXDRAW_DOUBLE_HORIZONTAL           0x2550
57
+#define BOXDRAW_DOUBLE_VERTICAL             0x2551
58
+#define BOXDRAW_DOWN_RIGHT_DOUBLE           0x2552
59
+#define BOXDRAW_DOWN_DOUBLE_RIGHT           0x2553
60
+#define BOXDRAW_DOUBLE_DOWN_RIGHT           0x2554
61
+#define BOXDRAW_DOWN_LEFT_DOUBLE            0x2555
62
+#define BOXDRAW_DOWN_DOUBLE_LEFT            0x2556
63
+#define BOXDRAW_DOUBLE_DOWN_LEFT            0x2557
64
+#define BOXDRAW_UP_RIGHT_DOUBLE             0x2558
65
+#define BOXDRAW_UP_DOUBLE_RIGHT             0x2559
66
+#define BOXDRAW_DOUBLE_UP_RIGHT             0x255a
67
+#define BOXDRAW_UP_LEFT_DOUBLE              0x255b
68
+#define BOXDRAW_UP_DOUBLE_LEFT              0x255c
69
+#define BOXDRAW_DOUBLE_UP_LEFT              0x255d
70
+#define BOXDRAW_VERTICAL_RIGHT_DOUBLE       0x255e
71
+#define BOXDRAW_VERTICAL_DOUBLE_RIGHT       0x255f
72
+#define BOXDRAW_DOUBLE_VERTICAL_RIGHT       0x2560
73
+#define BOXDRAW_VERTICAL_LEFT_DOUBLE        0x2561
74
+#define BOXDRAW_VERTICAL_DOUBLE_LEFT        0x2562
75
+#define BOXDRAW_DOUBLE_VERTICAL_LEFT        0x2563
76
+#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE      0x2564
77
+#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL      0x2565
78
+#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL      0x2566
79
+#define BOXDRAW_UP_HORIZONTAL_DOUBLE        0x2567
80
+#define BOXDRAW_UP_DOUBLE_HORIZONTAL        0x2568
81
+#define BOXDRAW_DOUBLE_UP_HORIZONTAL        0x2569
82
+#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE  0x256a
83
+#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL  0x256b
84
+#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL  0x256c
85
+
86
+//
87
+// EFI Required Block Elements Code Chart
88
+//
89
+#define BLOCKELEMENT_FULL_BLOCK   0x2588
90
+#define BLOCKELEMENT_LIGHT_SHADE  0x2591
91
+
92
+//
93
+// EFI Required Geometric Shapes Code Chart
94
+//
95
+#define GEOMETRICSHAPE_UP_TRIANGLE    0x25b2
96
+#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba
97
+#define GEOMETRICSHAPE_DOWN_TRIANGLE  0x25bc
98
+#define GEOMETRICSHAPE_LEFT_TRIANGLE  0x25c4
99
+
100
+//
101
+// EFI Required Arrow shapes
102
+//
103
+#define ARROW_LEFT  0x2190
104
+#define ARROW_UP    0x2191
105
+#define ARROW_RIGHT 0x2192
106
+#define ARROW_DOWN  0x2193
107
+
108
+//
109
+// EFI Console Colours
110
+//
111
+#define EFI_BLACK                 0x00
112
+#define EFI_BLUE                  0x01
113
+#define EFI_GREEN                 0x02
114
+#define EFI_CYAN                  (EFI_BLUE | EFI_GREEN)
115
+#define EFI_RED                   0x04
116
+#define EFI_MAGENTA               (EFI_BLUE | EFI_RED)
117
+#define EFI_BROWN                 (EFI_GREEN | EFI_RED)
118
+#define EFI_LIGHTGRAY             (EFI_BLUE | EFI_GREEN | EFI_RED)
119
+#define EFI_BRIGHT                0x08
120
+#define EFI_DARKGRAY              (EFI_BRIGHT)
121
+#define EFI_LIGHTBLUE             (EFI_BLUE | EFI_BRIGHT)
122
+#define EFI_LIGHTGREEN            (EFI_GREEN | EFI_BRIGHT)
123
+#define EFI_LIGHTCYAN             (EFI_CYAN | EFI_BRIGHT)
124
+#define EFI_LIGHTRED              (EFI_RED | EFI_BRIGHT)
125
+#define EFI_LIGHTMAGENTA          (EFI_MAGENTA | EFI_BRIGHT)
126
+#define EFI_YELLOW                (EFI_BROWN | EFI_BRIGHT)
127
+#define EFI_WHITE                 (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
128
+
129
+#define EFI_TEXT_ATTR(f, b)       ((f) | ((b) << 4))
130
+
131
+#define EFI_BACKGROUND_BLACK      0x00
132
+#define EFI_BACKGROUND_BLUE       0x10
133
+#define EFI_BACKGROUND_GREEN      0x20
134
+#define EFI_BACKGROUND_CYAN       (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
135
+#define EFI_BACKGROUND_RED        0x40
136
+#define EFI_BACKGROUND_MAGENTA    (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
137
+#define EFI_BACKGROUND_BROWN      (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
138
+#define EFI_BACKGROUND_LIGHTGRAY  (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
139
+
140
+//
141
+// We currently define attributes from 0 - 7F for color manipulations
142
+// To internally handle the local display characteristics for a particular character, we are defining
143
+// Bit 7 to signify the local glyph representation for a character.  If turned on, glyphs will be
144
+// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)
145
+// If bit 7 is off, the narrow glyph database will be used.  This does NOT affect information that is sent to
146
+// non-local displays (e.g. serial or LAN consoles).
147
+//
148
+#define EFI_WIDE_ATTRIBUTE  0x80
149
+
150
+/**
151
+  Reset the text output device hardware and optionaly run diagnostics
152
+
153
+  @param  This                 Protocol instance pointer.
154
+  @param  ExtendedVerification Driver may perform more exhaustive verfication
155
+                               operation of the device during reset.
156
+
157
+  @retval EFI_SUCCESS          The text output device was reset.
158
+  @retval EFI_DEVICE_ERROR     The text output device is not functioning correctly and
159
+                               could not be reset.
160
+
161
+**/
162
+typedef
163
+EFI_STATUS
164
+(EFIAPI *EFI_TEXT_RESET)(
165
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
166
+  IN BOOLEAN                                ExtendedVerification
167
+  );
168
+
169
+/**
170
+  Write a Unicode string to the output device.
171
+
172
+  @param  This   Protocol instance pointer.
173
+  @param  String The NULL-terminated Unicode string to be displayed on the output
174
+                 device(s). All output devices must also support the Unicode
175
+                 drawing defined in this file.
176
+
177
+  @retval EFI_SUCCESS             The string was output to the device.
178
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting to output
179
+                                  the text.
180
+  @retval EFI_UNSUPPORTED         The output device's mode is not currently in a
181
+                                  defined text mode.
182
+  @retval EFI_WARN_UNKNOWN_GLYPH  This warning code indicates that some of the
183
+                                  characters in the Unicode string could not be
184
+                                  rendered and were skipped.
185
+
186
+**/
187
+typedef
188
+EFI_STATUS
189
+(EFIAPI *EFI_TEXT_STRING)(
190
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
191
+  IN CHAR16                                 *String
192
+  );
193
+
194
+/**
195
+  Verifies that all characters in a Unicode string can be output to the
196
+  target device.
197
+
198
+  @param  This   Protocol instance pointer.
199
+  @param  String The NULL-terminated Unicode string to be examined for the output
200
+                 device(s).
201
+
202
+  @retval EFI_SUCCESS      The device(s) are capable of rendering the output string.
203
+  @retval EFI_UNSUPPORTED  Some of the characters in the Unicode string cannot be
204
+                           rendered by one or more of the output devices mapped
205
+                           by the EFI handle.
206
+
207
+**/
208
+typedef
209
+EFI_STATUS
210
+(EFIAPI *EFI_TEXT_TEST_STRING)(
211
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
212
+  IN CHAR16                                 *String
213
+  );
214
+
215
+/**
216
+  Returns information for an available text mode that the output device(s)
217
+  supports.
218
+
219
+  @param  This       Protocol instance pointer.
220
+  @param  ModeNumber The mode number to return information on.
221
+  @param  Columns    Returns the geometry of the text output device for the
222
+                     requested ModeNumber.
223
+  @param  Rows       Returns the geometry of the text output device for the
224
+                     requested ModeNumber.
225
+
226
+  @retval EFI_SUCCESS      The requested mode information was returned.
227
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
228
+  @retval EFI_UNSUPPORTED  The mode number was not valid.
229
+
230
+**/
231
+typedef
232
+EFI_STATUS
233
+(EFIAPI *EFI_TEXT_QUERY_MODE)(
234
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
235
+  IN UINTN                                  ModeNumber,
236
+  OUT UINTN                                 *Columns,
237
+  OUT UINTN                                 *Rows
238
+  );
239
+
240
+/**
241
+  Sets the output device(s) to a specified mode.
242
+
243
+  @param  This       Protocol instance pointer.
244
+  @param  ModeNumber The mode number to set.
245
+
246
+  @retval EFI_SUCCESS      The requested text mode was set.
247
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
248
+  @retval EFI_UNSUPPORTED  The mode number was not valid.
249
+
250
+**/
251
+typedef
252
+EFI_STATUS
253
+(EFIAPI *EFI_TEXT_SET_MODE)(
254
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
255
+  IN UINTN                                  ModeNumber
256
+  );
257
+
258
+/**
259
+  Sets the background and foreground colors for the OutputString () and
260
+  ClearScreen () functions.
261
+
262
+  @param  This      Protocol instance pointer.
263
+  @param  Attribute The attribute to set. Bits 0..3 are the foreground color, and
264
+                    bits 4..6 are the background color. All other bits are undefined
265
+                    and must be zero. The valid Attributes are defined in this file.
266
+
267
+  @retval EFI_SUCCESS     The attribute was set.
268
+  @retval EFI_DEVICE_     ERROR The device had an error and could not complete the request.
269
+  @retval EFI_UNSUPPORTED The attribute requested is not defined.
270
+
271
+**/
272
+typedef
273
+EFI_STATUS
274
+(EFIAPI *EFI_TEXT_SET_ATTRIBUTE)(
275
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
276
+  IN UINTN                                  Attribute
277
+  );
278
+
279
+/**
280
+  Clears the output device(s) display to the currently selected background
281
+  color.
282
+
283
+  @param  This              Protocol instance pointer.
284
+
285
+  @retval  EFI_SUCCESS      The operation completed successfully.
286
+  @retval  EFI_DEVICE_ERROR The device had an error and could not complete the request.
287
+  @retval  EFI_UNSUPPORTED  The output device is not in a valid text mode.
288
+
289
+**/
290
+typedef
291
+EFI_STATUS
292
+(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(
293
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *This
294
+  );
295
+
296
+/**
297
+  Sets the current coordinates of the cursor position
298
+
299
+  @param  This        Protocol instance pointer.
300
+  @param  Column      The position to set the cursor to. Must be greater than or
301
+                      equal to zero and less than the number of columns and rows
302
+                      by QueryMode ().
303
+  @param  Row         The position to set the cursor to. Must be greater than or
304
+                      equal to zero and less than the number of columns and rows
305
+                      by QueryMode ().
306
+
307
+  @retval EFI_SUCCESS      The operation completed successfully.
308
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
309
+  @retval EFI_UNSUPPORTED  The output device is not in a valid text mode, or the
310
+                           cursor position is invalid for the current mode.
311
+
312
+**/
313
+typedef
314
+EFI_STATUS
315
+(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(
316
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
317
+  IN UINTN                                  Column,
318
+  IN UINTN                                  Row
319
+  );
320
+
321
+/**
322
+  Makes the cursor visible or invisible
323
+
324
+  @param  This    Protocol instance pointer.
325
+  @param  Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
326
+                  set to be invisible.
327
+
328
+  @retval EFI_SUCCESS      The operation completed successfully.
329
+  @retval EFI_DEVICE_ERROR The device had an error and could not complete the
330
+                           request, or the device does not support changing
331
+                           the cursor mode.
332
+  @retval EFI_UNSUPPORTED  The output device is not in a valid text mode.
333
+
334
+**/
335
+typedef
336
+EFI_STATUS
337
+(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(
338
+  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL        *This,
339
+  IN BOOLEAN                                Visible
340
+  );
341
+
342
+/**
343
+  @par Data Structure Description:
344
+  Mode Structure pointed to by Simple Text Out protocol.
345
+
346
+  @param MaxMode
347
+  The number of modes supported by QueryMode () and SetMode ().
348
+
349
+  @param Mode
350
+  The text mode of the output device(s).
351
+
352
+  @param Attribute
353
+  The current character output attribute
354
+
355
+  @param CursorColumn
356
+  The cursor's column.
357
+
358
+  @param CursorRow
359
+  The cursor's row.
360
+
361
+  @param CursorVisible
362
+  The cursor is currently visbile or not.
363
+
364
+**/
365
+typedef struct {
366
+  INT32   MaxMode;
367
+
368
+  //
369
+  // current settings
370
+  //
371
+  INT32   Mode;
372
+  INT32   Attribute;
373
+  INT32   CursorColumn;
374
+  INT32   CursorRow;
375
+  BOOLEAN CursorVisible;
376
+} EFI_SIMPLE_TEXT_OUTPUT_MODE;
377
+
378
+/**
379
+  @par Protocol Description:
380
+  The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
381
+  It is the minimum required protocol for any handle supplied as the ConsoleOut
382
+  or StandardError device. In addition, the minimum supported text mode of such
383
+  devices is at least 80 x 25 characters.
384
+
385
+  @param Reset
386
+  Reset the ConsoleOut device.
387
+
388
+  @param OutputString
389
+  Displays the Unicode string on the device at the current cursor location.
390
+
391
+  @param TestString
392
+  Tests to see if the ConsoleOut device supports this Unicode string.
393
+
394
+  @param QueryMode
395
+  Queries information concerning the output device's supported text mode.
396
+
397
+  @param SetMode
398
+  Sets the current mode of the output device.
399
+
400
+  @param SetAttribute
401
+  Sets the foreground and background color of the text that is output.
402
+
403
+  @param ClearScreen
404
+  Clears the screen with the currently set background color.
405
+
406
+  @param SetCursorPosition
407
+  Sets the current cursor position.
408
+
409
+  @param EnableCursor
410
+  Turns the visibility of the cursor on/off.
411
+
412
+  @param Mode
413
+  Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
414
+**/
415
+struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
416
+  EFI_TEXT_RESET                Reset;
417
+
418
+  EFI_TEXT_STRING               OutputString;
419
+  EFI_TEXT_TEST_STRING          TestString;
420
+
421
+  EFI_TEXT_QUERY_MODE           QueryMode;
422
+  EFI_TEXT_SET_MODE             SetMode;
423
+  EFI_TEXT_SET_ATTRIBUTE        SetAttribute;
424
+
425
+  EFI_TEXT_CLEAR_SCREEN         ClearScreen;
426
+  EFI_TEXT_SET_CURSOR_POSITION  SetCursorPosition;
427
+  EFI_TEXT_ENABLE_CURSOR        EnableCursor;
428
+
429
+  //
430
+  // Current mode
431
+  //
432
+  EFI_SIMPLE_TEXT_OUTPUT_MODE   *Mode;
433
+};
434
+
435
+extern EFI_GUID gEfiSimpleTextOutProtocolGuid;
436
+
437
+#endif

+ 27
- 0
src/include/gpxe/efi/Uefi.h View File

@@ -0,0 +1,27 @@
1
+/** @file
2
+
3
+  Root include file for Mde Package UEFI, UEFI_APPLICATION type modules.
4
+
5
+  This is the include file for any module of type UEFI and UEFI_APPLICATION. Uefi modules only use
6
+  types defined via this include file and can be ported easily to any
7
+  environment.
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
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.
17
+
18
+**/
19
+
20
+#ifndef __PI_UEFI_H__
21
+#define __PI_UEFI_H__
22
+
23
+#include <gpxe/efi/Uefi/UefiBaseType.h>
24
+#include <gpxe/efi/Uefi/UefiSpec.h>
25
+
26
+#endif
27
+

+ 174
- 0
src/include/gpxe/efi/Uefi/UefiBaseType.h View File

@@ -0,0 +1,174 @@
1
+/** @file
2
+
3
+  Defines data types and constants introduced in UEFI.
4
+
5
+  Copyright (c) 2006 - 2008, 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
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 __UEFI_BASETYPE_H__
17
+#define __UEFI_BASETYPE_H__
18
+
19
+#include <gpxe/efi/Base.h>
20
+
21
+///
22
+/// Basical data type definitions introduced in UEFI.
23
+///
24
+typedef GUID                      EFI_GUID;
25
+
26
+///
27
+/// Function return status for EFI API
28
+///
29
+typedef RETURN_STATUS             EFI_STATUS;
30
+typedef VOID                      *EFI_HANDLE;
31
+
32
+typedef VOID                      *EFI_EVENT;
33
+
34
+typedef UINTN                     EFI_TPL;
35
+
36
+
37
+typedef UINT64                    EFI_LBA;
38
+
39
+
40
+typedef UINT16                    STRING_REF;
41
+
42
+typedef UINT64                    EFI_PHYSICAL_ADDRESS;
43
+typedef UINT64                    EFI_VIRTUAL_ADDRESS;
44
+
45
+///
46
+/// EFI Time Abstraction:
47
+///  Year:       2000 - 20XX
48
+///  Month:      1 - 12
49
+///  Day:        1 - 31
50
+///  Hour:       0 - 23
51
+///  Minute:     0 - 59
52
+///  Second:     0 - 59
53
+///  Nanosecond: 0 - 999,999,999
54
+///  TimeZone:   -1440 to 1440 or 2047
55
+///
56
+typedef struct {
57
+  UINT16  Year;
58
+  UINT8   Month;
59
+  UINT8   Day;
60
+  UINT8   Hour;
61
+  UINT8   Minute;
62
+  UINT8   Second;
63
+  UINT8   Pad1;
64
+  UINT32  Nanosecond;
65
+  INT16   TimeZone;
66
+  UINT8   Daylight;
67
+  UINT8   Pad2;
68
+} EFI_TIME;
69
+
70
+
71
+//
72
+// Networking Definitions
73
+//
74
+typedef struct {
75
+  UINT8 Addr[4];
76
+} EFI_IPv4_ADDRESS;
77
+
78
+typedef struct {
79
+  UINT8 Addr[16];
80
+} EFI_IPv6_ADDRESS;
81
+
82
+typedef struct {
83
+  UINT8 Addr[32];
84
+} EFI_MAC_ADDRESS;
85
+
86
+typedef union {
87
+  UINT32            Addr[4];
88
+  EFI_IPv4_ADDRESS  v4;
89
+  EFI_IPv6_ADDRESS  v6;
90
+} EFI_IP_ADDRESS;
91
+
92
+
93
+//
94
+// Enumeration of EFI_STATUS.
95
+//
96
+#define EFI_SUCCESS               RETURN_SUCCESS
97
+#define EFI_LOAD_ERROR            RETURN_LOAD_ERROR
98
+#define EFI_INVALID_PARAMETER     RETURN_INVALID_PARAMETER
99
+#define EFI_UNSUPPORTED           RETURN_UNSUPPORTED
100
+#define EFI_BAD_BUFFER_SIZE       RETURN_BAD_BUFFER_SIZE
101
+#define EFI_BUFFER_TOO_SMALL      RETURN_BUFFER_TOO_SMALL
102
+#define EFI_NOT_READY             RETURN_NOT_READY
103
+#define EFI_DEVICE_ERROR          RETURN_DEVICE_ERROR
104
+#define EFI_WRITE_PROTECTED       RETURN_WRITE_PROTECTED
105
+#define EFI_OUT_OF_RESOURCES      RETURN_OUT_OF_RESOURCES
106
+#define EFI_VOLUME_CORRUPTED      RETURN_VOLUME_CORRUPTED
107
+#define EFI_VOLUME_FULL           RETURN_VOLUME_FULL
108
+#define EFI_NO_MEDIA              RETURN_NO_MEDIA
109
+#define EFI_MEDIA_CHANGED         RETURN_MEDIA_CHANGED
110
+#define EFI_NOT_FOUND             RETURN_NOT_FOUND
111
+#define EFI_ACCESS_DENIED         RETURN_ACCESS_DENIED
112
+#define EFI_NO_RESPONSE           RETURN_NO_RESPONSE
113
+#define EFI_NO_MAPPING            RETURN_NO_MAPPING
114
+#define EFI_TIMEOUT               RETURN_TIMEOUT
115
+#define EFI_NOT_STARTED           RETURN_NOT_STARTED
116
+#define EFI_ALREADY_STARTED       RETURN_ALREADY_STARTED
117
+#define EFI_ABORTED               RETURN_ABORTED
118
+#define EFI_ICMP_ERROR            RETURN_ICMP_ERROR
119
+#define EFI_TFTP_ERROR            RETURN_TFTP_ERROR
120
+#define EFI_PROTOCOL_ERROR        RETURN_PROTOCOL_ERROR
121
+#define EFI_INCOMPATIBLE_VERSION  RETURN_INCOMPATIBLE_VERSION
122
+#define EFI_SECURITY_VIOLATION    RETURN_SECURITY_VIOLATION
123
+#define EFI_CRC_ERROR             RETURN_CRC_ERROR
124
+#define EFI_END_OF_MEDIA          RETURN_END_OF_MEDIA
125
+#define EFI_END_OF_FILE           RETURN_END_OF_FILE
126
+#define EFI_INVALID_LANGUAGE      RETURN_INVALID_LANGUAGE
127
+
128
+#define EFI_WARN_UNKNOWN_GLYPH    RETURN_WARN_UNKNOWN_GLYPH
129
+#define EFI_WARN_DELETE_FAILURE   RETURN_WARN_DELETE_FAILURE
130
+#define EFI_WARN_WRITE_FAILURE    RETURN_WARN_WRITE_FAILURE
131
+#define EFI_WARN_BUFFER_TOO_SMALL RETURN_WARN_BUFFER_TOO_SMALL
132
+
133
+
134
+#define NULL_HANDLE               ((VOID *) 0)
135
+
136
+//
137
+// Define macro to encode the status code.
138
+//
139
+#define EFIERR(_a)                ENCODE_ERROR(_a)
140
+
141
+#define EFI_ERROR(A)              RETURN_ERROR(A)
142
+
143
+//
144
+// Define macros to build data structure signatures from characters.
145
+//
146
+#define EFI_SIGNATURE_16(A, B)        ((A) | (B << 8))
147
+#define EFI_SIGNATURE_32(A, B, C, D)  (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
148
+#define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
149
+    (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
150
+
151
+
152
+///
153
+///  Returns the byte offset to a field within a structure
154
+///
155
+#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))
156
+
157
+//
158
+// The EFI memory allocation functions work in units of EFI_PAGEs that are
159
+// 4K. This should in no way be confused with the page size of the processor.
160
+// An EFI_PAGE is just the quanta of memory in EFI.
161
+//
162
+#define EFI_PAGE_SIZE             0x1000
163
+#define EFI_PAGE_MASK             0xFFF
164
+#define EFI_PAGE_SHIFT            12
165
+
166
+#define EFI_SIZE_TO_PAGES(a)  (((a) >> EFI_PAGE_SHIFT) + (((a) & EFI_PAGE_MASK) ? 1 : 0))
167
+
168
+#define EFI_PAGES_TO_SIZE(a)   ( (a) << EFI_PAGE_SHIFT)
169
+
170
+
171
+#define EFI_MAX_BIT               MAX_BIT
172
+#define EFI_MAX_ADDRESS           MAX_ADDRESS
173
+
174
+#endif

+ 66
- 0
src/include/gpxe/efi/Uefi/UefiGpt.h View File

@@ -0,0 +1,66 @@
1
+/** @file
2
+  EFI Guid Partition Table Format Definition.
3
+
4
+  Copyright (c) 2006 - 2007, 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
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
+**/
14
+
15
+#ifndef __UEFI_GPT_H__
16
+#define __UEFI_GPT_H__
17
+
18
+#define PRIMARY_PART_HEADER_LBA 1
19
+
20
+///
21
+/// EFI Partition Table Signature: "EFI PART"
22
+///
23
+#define EFI_PTAB_HEADER_ID      0x5452415020494645ULL
24
+
25
+#pragma pack(1)
26
+
27
+///
28
+/// GPT Partition Table Header
29
+///
30
+typedef struct {
31
+  EFI_TABLE_HEADER  Header;
32
+  EFI_LBA           MyLBA;
33
+  EFI_LBA           AlternateLBA;
34
+  EFI_LBA           FirstUsableLBA;
35
+  EFI_LBA           LastUsableLBA;
36
+  EFI_GUID          DiskGUID;
37
+  EFI_LBA           PartitionEntryLBA;
38
+  UINT32            NumberOfPartitionEntries;
39
+  UINT32            SizeOfPartitionEntry;
40
+  UINT32            PartitionEntryArrayCRC32;
41
+} EFI_PARTITION_TABLE_HEADER;
42
+
43
+///
44
+/// GPT Partition Entry
45
+///
46
+typedef struct {
47
+  EFI_GUID  PartitionTypeGUID;
48
+  EFI_GUID  UniquePartitionGUID;
49
+  EFI_LBA   StartingLBA;
50
+  EFI_LBA   EndingLBA;
51
+  UINT64    Attributes;
52
+  CHAR16    PartitionName[36];
53
+} EFI_PARTITION_ENTRY;
54
+
55
+///
56
+/// GPT Partition Entry Status
57
+///
58
+typedef struct {
59
+  BOOLEAN OutOfRange;
60
+  BOOLEAN Overlap;
61
+} EFI_PARTITION_ENTRY_STATUS;
62
+
63
+#pragma pack()
64
+#endif
65
+
66
+

+ 1499
- 0
src/include/gpxe/efi/Uefi/UefiInternalFormRepresentation.h
File diff suppressed because it is too large
View File


+ 218
- 0
src/include/gpxe/efi/Uefi/UefiMultiPhase.h View File

@@ -0,0 +1,218 @@
1
+/** @file
2
+  This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
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
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
+**/
14
+
15
+#ifndef __UEFI_MULTIPHASE_H__
16
+#define __UEFI_MULTIPHASE_H__
17
+
18
+#include <gpxe/efi/ProcessorBind.h>
19
+
20
+///
21
+/// Enumeration of memory types introduced in UEFI.
22
+///
23
+typedef enum {
24
+  EfiReservedMemoryType,
25
+  EfiLoaderCode,
26
+  EfiLoaderData,
27
+  EfiBootServicesCode,
28
+  EfiBootServicesData,
29
+  EfiRuntimeServicesCode,
30
+  EfiRuntimeServicesData,
31
+  EfiConventionalMemory,
32
+  EfiUnusableMemory,
33
+  EfiACPIReclaimMemory,
34
+  EfiACPIMemoryNVS,
35
+  EfiMemoryMappedIO,
36
+  EfiMemoryMappedIOPortSpace,
37
+  EfiPalCode,
38
+  EfiMaxMemoryType
39
+} EFI_MEMORY_TYPE;
40
+
41
+
42
+///
43
+/// Data structure that precedes all of the standard EFI table types.
44
+///
45
+typedef struct {
46
+  UINT64  Signature;
47
+  UINT32  Revision;
48
+  UINT32  HeaderSize;
49
+  UINT32  CRC32;
50
+  UINT32  Reserved;
51
+} EFI_TABLE_HEADER;
52
+
53
+///
54
+/// Attributes of variable.
55
+///
56
+#define EFI_VARIABLE_NON_VOLATILE                 0x00000001
57
+#define EFI_VARIABLE_BOOTSERVICE_ACCESS           0x00000002
58
+#define EFI_VARIABLE_RUNTIME_ACCESS               0x00000004
59
+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD        0x00000008
60
+
61
+///
62
+/// This attribute is identified by the mnemonic 'HR'
63
+/// elsewhere in this specification.
64
+///
65
+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS   0x00000010
66
+
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
+
75
+  The WIN_CERTIFICATE structure is part of the PE/COFF
76
+  specification and has the following definition:
77
+
78
+  @param dwLength   The length of the entire certificate,
79
+                    including the length of the header, in
80
+                    bytes.
81
+
82
+  @param wRevision  The revision level of the WIN_CERTIFICATE
83
+                    structure. The current revision level is
84
+                    0x0200.
85
+
86
+  @param wCertificateType   The certificate type. See
87
+                            WIN_CERT_TYPE_xxx for the UEFI
88
+                            certificate types. The UEFI
89
+                            specification reserves the range of
90
+                            certificate type values from 0x0EF0
91
+                            to 0x0EFF.
92
+
93
+  @param bCertificate   The actual certificate. The format of
94
+                        the certificate depends on
95
+                        wCertificateType. The format of the UEFI
96
+                        certificates is defined below.
97
+
98
+
99
+**/
100
+typedef struct _WIN_CERTIFICATE {
101
+  UINT32  dwLength;
102
+  UINT16  wRevision;
103
+  UINT16  wCertificateType;
104
+  //UINT8 bCertificate[ANYSIZE_ARRAY];
105
+} WIN_CERTIFICATE;
106
+
107
+///
108
+/// WIN_CERTIFICATE_UEFI_GUID.CertType
109
+///
110
+#define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
111
+  {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
112
+
113
+///
114
+/// WIN_CERTIFICATE_UEFI_GUID.CertData
115
+///
116
+typedef struct _EFI_CERT_BLOCK_RSA_2048_SHA256 {
117
+  UINT32  HashType;
118
+  UINT8   PublicKey[256];
119
+  UINT8   Signature[256];
120
+} EFI_CERT_BLOCK_RSA_2048_SHA256;
121
+
122
+
123
+/**
124
+
125
+  @param Hdr  This is the standard WIN_CERTIFICATE header, where
126
+              wCertificateType is set to
127
+              WIN_CERT_TYPE_UEFI_GUID.
128
+
129
+  @param CertType   This is the unique id which determines the
130
+                    format of the CertData. In this case, the
131
+                    value is EFI_CERT_TYPE_RSA2048_SHA256_GUID.
132
+
133
+  @param CertData   This is the certificate data. The format of
134
+                    the data is determined by the CertType. In
135
+                    this case the value is
136
+                    EFI_CERT_BLOCK_RSA_2048_SHA256.
137
+
138
+**/
139
+typedef struct _WIN_CERTIFICATE_UEFI_GUID {
140
+  WIN_CERTIFICATE   Hdr;
141
+  EFI_GUID          CertType;
142
+  // UINT8            CertData[ANYSIZE_ARRAY];
143
+} WIN_CERTIFICATE_UEFI_GUID;
144
+
145
+
146
+/**
147
+
148
+  Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital
149
+  signature.
150
+
151
+  The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
152
+  WIN_CERTIFICATE and encapsulate the information needed to
153
+  implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
154
+  specified in RFC2437.
155
+
156
+  @param Hdr  This is the standard WIN_CERTIFICATE header, where
157
+              wCertificateType is set to
158
+              WIN_CERT_TYPE_UEFI_PKCS1_15.
159
+
160
+  @param HashAlgorithm  This is the hashing algorithm which was
161
+                        performed on the UEFI executable when
162
+                        creating the digital signature. It is
163
+                        one of the enumerated values pre-defined
164
+                        in Section 26.4.1. See
165
+                        EFI_HASH_ALGORITHM_x.
166
+
167
+  @param Signature  This is the actual digital signature. The
168
+                    size of the signature is the same size as
169
+                    the key (1024-bit key is 128 bytes) and can
170
+                    be determined by subtracting the length of
171
+                    the other parts of this header from the
172
+                    total length of the certificate as found in
173
+                    Hdr.dwLength.
174
+
175
+**/
176
+typedef struct _WIN_CERTIFICATE_EFI_PKCS1_15 {
177
+  WIN_CERTIFICATE Hdr;
178
+  EFI_GUID        HashAlgorithm;
179
+  // UINT8 Signature[ANYSIZE_ARRAY];
180
+} WIN_CERTIFICATE_EFI_PKCS1_15;
181
+
182
+
183
+/**
184
+
185
+  AuthInfo is a WIN_CERTIFICATE using the wCertificateType
186
+  WIN_CERTIFICATE_UEFI_GUID and the CertType
187
+  EFI_CERT_TYPE_RSA2048_SHA256. If the attribute specifies
188
+  authenticated access, then the Data buffer should begin with an
189
+  authentication descriptor prior to the data payload and DataSize
190
+  should reflect the the data.and descriptor size. The caller
191
+  shall digest the Monotonic Count value and the associated data
192
+  for the variable update using the SHA-256 1-way hash algorithm.
193
+  The ensuing the 32-byte digest will be signed using the private
194
+  key associated w/ the public/private 2048-bit RSA key-pair. The
195
+  WIN_CERTIFICATE shall be used to describe the signature of the
196
+  Variable data *Data. In addition, the signature will also
197
+  include the MonotonicCount value to guard against replay attacks
198
+
199
+  @param  MonotonicCount  Included in the signature of
200
+                          AuthInfo.Used to ensure freshness/no
201
+                          replay. Incremented during each
202
+                          "Write" access.
203
+
204
+  @param AuthInfo   Provides the authorization for the variable
205
+                    access. It is a signature across the
206
+                    variable data and the  Monotonic Count
207
+                    value. Caller uses Private key that is
208
+                    associated with a public key that has been
209
+                    provisioned via the key exchange.
210
+
211
+**/
212
+typedef struct {
213
+  UINT64                      MonotonicCount;
214
+  WIN_CERTIFICATE_UEFI_GUID   AuthInfo;
215
+} EFI_VARIABLE_AUTHENTICATION;
216
+
217
+#endif
218
+

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


+ 1780
- 0
src/include/gpxe/efi/Uefi/UefiSpec.h
File diff suppressed because it is too large
View File


+ 37
- 0
src/include/gpxe/efi/efi.h View File

@@ -0,0 +1,37 @@
1
+#ifndef _EFI_H
2
+#define _EFI_H
3
+
4
+/** @file
5
+ *
6
+ * EFI API
7
+ *
8
+ * The intention is to include near-verbatim copies of the EFI headers
9
+ * required by gPXE.  This is achieved using the import.pl script in
10
+ * this directory.  Run the import script to update the local copies
11
+ * of the headers:
12
+ *
13
+ *     ./import.pl /path/to/edk2/edk2
14
+ *
15
+ * where /path/to/edk2/edk2 is the path to your local checkout of the
16
+ * EFI Development Kit.
17
+ *
18
+ * Note that import.pl will modify any #include lines in each imported
19
+ * header to reflect its new location within the gPXE tree.  It will
20
+ * also tidy up the file by removing carriage return characters and
21
+ * trailing whitespace.
22
+ *
23
+ *
24
+ * At the time of writing, there are a few other modifications to
25
+ * these headers that are present in my personal edk2 tree, that are
26
+ * not yet committed back to the main edk2 repository.  These
27
+ * modifications are fixes for compilation on case-dependent
28
+ * filesystems, compilation under -mrtd and -mregparm=3, etc.
29
+ */
30
+
31
+/* Include the top-level EFI header file */
32
+#include <gpxe/efi/Uefi.h>
33
+
34
+/* Reset any trailing #pragma pack directives */
35
+#pragma pack()
36
+
37
+#endif /* _EFI_H */

+ 75
- 0
src/include/gpxe/efi/import.pl View File

@@ -0,0 +1,75 @@
1
+#!/usr/bin/perl -w
2
+
3
+use File::Spec::Functions qw ( :ALL );
4
+use File::Find;
5
+use File::Path;
6
+use FindBin;
7
+use strict;
8
+use warnings;
9
+
10
+sub try_import_file {
11
+  my $gpxedir = shift;
12
+  my $edkdirs = shift;
13
+  my $filename = shift;
14
+
15
+  # Skip everything except headers
16
+  return unless $filename =~ /\.h$/;
17
+  print "$filename...";
18
+
19
+  my $outfile = catfile ( $gpxedir, $filename );
20
+  foreach my $edkdir ( @$edkdirs ) {
21
+    my $infile = catfile ( $edkdir, $filename );
22
+    if ( -e $infile ) {
23
+      # We have found a matching source file - import it
24
+      print "$infile\n";
25
+      open my $infh, "<$infile" or die "Could not open $infile: $!\n";
26
+      ( undef, my $outdir, undef ) = splitpath ( $outfile );
27
+      mkpath ( $outdir );
28
+      open my $outfh, ">$outfile" or die "Could not open $outfile: $!\n";
29
+      my @dependencies = ();
30
+      while ( <$infh> ) {
31
+	# Strip CR and trailing whitespace
32
+	s/\r//g;
33
+	s/\s*$//g;
34
+	chomp;
35
+	# Update include lines, and record included files
36
+	if ( s/^\#include\s+[<\"](\S+)[>\"]/\#include <gpxe\/efi\/$1>/ ) {
37
+	  push @dependencies, $1;
38
+	}
39
+	print $outfh "$_\n";
40
+      }
41
+      close $outfh;
42
+      close $infh;
43
+      # Recurse to handle any included files that we don't already have
44
+      foreach my $dependency ( @dependencies ) {
45
+	if ( ! -e catfile ( $gpxedir, $dependency ) ) {
46
+	  print "...following dependency on $dependency\n";
47
+	  try_import_file ( $gpxedir, $edkdirs, $dependency );
48
+	}
49
+      }
50
+      return;
51
+    }
52
+  }
53
+  print "no equivalent found\n";
54
+}
55
+
56
+# Identify edk import directories
57
+die "Syntax $0 /path/to/edk2/edk2\n" unless @ARGV == 1;
58
+my $edktop = shift;
59
+die "Directory \"$edktop\" does not appear to contain the EFI EDK2\n"
60
+    unless -e catfile ( $edktop, "MdePkg" );
61
+my $edkdirs = [ catfile ( $edktop, "MdePkg/Include" ),
62
+		catfile ( $edktop, "IntelFrameworkPkg/Include" ) ];
63
+
64
+# Identify gPXE EFI includes directory
65
+my $gpxedir = $FindBin::Bin;
66
+die "Directory \"$gpxedir\" does not appear to contain the gPXE EFI includes\n"
67
+    unless -e catfile ( $gpxedir, "../../../include/gpxe/efi" );
68
+
69
+print "Importing EFI headers into $gpxedir\nfrom ";
70
+print join ( "\n and ", @$edkdirs )."\n";
71
+
72
+# Import headers
73
+find ( { wanted => sub {
74
+  try_import_file ( $gpxedir, $edkdirs, abs2rel ( $_, $gpxedir ) );
75
+}, no_chdir => 1 }, $gpxedir );

Loading…
Cancel
Save