Преглед на файлове

[efi] Add definitions of GUIDs observed during Windows boot

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown преди 10 години
родител
ревизия
a56bba3912

+ 2175
- 0
src/include/ipxe/efi/IndustryStandard/Tpm12.h
Файловите разлики са ограничени, защото са твърде много
Целия файл


+ 172
- 0
src/include/ipxe/efi/IndustryStandard/UefiTcgPlatform.h Целия файл

@@ -0,0 +1,172 @@
1
+/** @file
2
+  TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final
3
+
4
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5
+  This program and the accompanying materials
6
+  are licensed and made available under the terms and conditions of the BSD License
7
+  which accompanies this distribution.  The full text of the license may be found at
8
+  http://opensource.org/licenses/bsd-license.php
9
+
10
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+**/
14
+
15
+#ifndef __UEFI_TCG_PLATFORM_H__
16
+#define __UEFI_TCG_PLATFORM_H__
17
+
18
+FILE_LICENCE ( BSD3 );
19
+
20
+#include <ipxe/efi/IndustryStandard/Tpm12.h>
21
+#include <ipxe/efi/Uefi.h>
22
+
23
+//
24
+// Standard event types
25
+//
26
+#define EV_POST_CODE                ((TCG_EVENTTYPE) 0x00000001)
27
+#define EV_SEPARATOR                ((TCG_EVENTTYPE) 0x00000004)
28
+#define EV_S_CRTM_CONTENTS          ((TCG_EVENTTYPE) 0x00000007)
29
+#define EV_S_CRTM_VERSION           ((TCG_EVENTTYPE) 0x00000008)
30
+#define EV_CPU_MICROCODE            ((TCG_EVENTTYPE) 0x00000009)
31
+#define EV_TABLE_OF_DEVICES         ((TCG_EVENTTYPE) 0x0000000B)
32
+
33
+//
34
+// EFI specific event types
35
+//
36
+#define EV_EFI_EVENT_BASE                   ((TCG_EVENTTYPE) 0x80000000)
37
+#define EV_EFI_VARIABLE_DRIVER_CONFIG       (EV_EFI_EVENT_BASE + 1)
38
+#define EV_EFI_VARIABLE_BOOT                (EV_EFI_EVENT_BASE + 2)
39
+#define EV_EFI_BOOT_SERVICES_APPLICATION    (EV_EFI_EVENT_BASE + 3)
40
+#define EV_EFI_BOOT_SERVICES_DRIVER         (EV_EFI_EVENT_BASE + 4)
41
+#define EV_EFI_RUNTIME_SERVICES_DRIVER      (EV_EFI_EVENT_BASE + 5)
42
+#define EV_EFI_GPT_EVENT                    (EV_EFI_EVENT_BASE + 6)
43
+#define EV_EFI_ACTION                       (EV_EFI_EVENT_BASE + 7)
44
+#define EV_EFI_PLATFORM_FIRMWARE_BLOB       (EV_EFI_EVENT_BASE + 8)
45
+#define EV_EFI_HANDOFF_TABLES               (EV_EFI_EVENT_BASE + 9)
46
+
47
+#define EFI_CALLING_EFI_APPLICATION         \
48
+  "Calling EFI Application from Boot Option"
49
+#define EFI_RETURNING_FROM_EFI_APPLICATOIN  \
50
+  "Returning from EFI Application from Boot Option"
51
+#define EFI_EXIT_BOOT_SERVICES_INVOCATION   \
52
+  "Exit Boot Services Invocation"
53
+#define EFI_EXIT_BOOT_SERVICES_FAILED       \
54
+  "Exit Boot Services Returned with Failure"
55
+#define EFI_EXIT_BOOT_SERVICES_SUCCEEDED    \
56
+  "Exit Boot Services Returned with Success"
57
+
58
+
59
+#define EV_POSTCODE_INFO_POST_CODE    "POST CODE"
60
+#define POST_CODE_STR_LEN             (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)
61
+
62
+#define EV_POSTCODE_INFO_SMM_CODE     "SMM CODE"
63
+#define SMM_CODE_STR_LEN              (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)
64
+
65
+#define EV_POSTCODE_INFO_ACPI_DATA    "ACPI DATA"
66
+#define ACPI_DATA_LEN                 (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)
67
+
68
+#define EV_POSTCODE_INFO_BIS_CODE     "BIS CODE"
69
+#define BIS_CODE_LEN                  (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)
70
+
71
+#define EV_POSTCODE_INFO_UEFI_PI      "UEFI PI"
72
+#define UEFI_PI_LEN                   (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)
73
+
74
+#define EV_POSTCODE_INFO_OPROM        "Embedded Option ROM"
75
+#define OPROM_LEN                     (sizeof(EV_POSTCODE_INFO_OPROM) - 1)
76
+
77
+//
78
+// Set structure alignment to 1-byte
79
+//
80
+#pragma pack (1)
81
+
82
+typedef UINT32                     TCG_EVENTTYPE;
83
+typedef TPM_PCRINDEX               TCG_PCRINDEX;
84
+typedef TPM_DIGEST                 TCG_DIGEST;
85
+///
86
+/// Event Log Entry Structure Definition
87
+///
88
+typedef struct tdTCG_PCR_EVENT {
89
+  TCG_PCRINDEX                      PCRIndex;  ///< PCRIndex event extended to
90
+  TCG_EVENTTYPE                     EventType; ///< TCG EFI event type
91
+  TCG_DIGEST                        Digest;    ///< Value extended into PCRIndex
92
+  UINT32                            EventSize; ///< Size of the event data
93
+  UINT8                             Event[1];  ///< The event data
94
+} TCG_PCR_EVENT;
95
+
96
+#define TSS_EVENT_DATA_MAX_SIZE   256
97
+
98
+///
99
+/// TCG_PCR_EVENT_HDR
100
+///
101
+typedef struct tdTCG_PCR_EVENT_HDR {
102
+  TCG_PCRINDEX                      PCRIndex;
103
+  TCG_EVENTTYPE                     EventType;
104
+  TCG_DIGEST                        Digest;
105
+  UINT32                            EventSize;
106
+} TCG_PCR_EVENT_HDR;
107
+
108
+///
109
+/// EFI_PLATFORM_FIRMWARE_BLOB
110
+///
111
+/// BlobLength should be of type UINTN but we use UINT64 here
112
+/// because PEI is 32-bit while DXE is 64-bit on x64 platforms
113
+///
114
+typedef struct tdEFI_PLATFORM_FIRMWARE_BLOB {
115
+  EFI_PHYSICAL_ADDRESS              BlobBase;
116
+  UINT64                            BlobLength;
117
+} EFI_PLATFORM_FIRMWARE_BLOB;
118
+
119
+///
120
+/// EFI_IMAGE_LOAD_EVENT
121
+///
122
+/// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,
123
+/// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER
124
+///
125
+typedef struct tdEFI_IMAGE_LOAD_EVENT {
126
+  EFI_PHYSICAL_ADDRESS              ImageLocationInMemory;
127
+  UINTN                             ImageLengthInMemory;
128
+  UINTN                             ImageLinkTimeAddress;
129
+  UINTN                             LengthOfDevicePath;
130
+  EFI_DEVICE_PATH_PROTOCOL          DevicePath[1];
131
+} EFI_IMAGE_LOAD_EVENT;
132
+
133
+///
134
+/// EFI_HANDOFF_TABLE_POINTERS
135
+///
136
+/// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate
137
+/// the measurement of given configuration tables.
138
+///
139
+typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
140
+  UINTN                             NumberOfTables;
141
+  EFI_CONFIGURATION_TABLE           TableEntry[1];
142
+} EFI_HANDOFF_TABLE_POINTERS;
143
+
144
+///
145
+/// EFI_VARIABLE_DATA
146
+///
147
+/// This structure serves as the header for measuring variables. The name of the
148
+/// variable (in Unicode format) should immediately follow, then the variable
149
+/// data.
150
+///
151
+typedef struct tdEFI_VARIABLE_DATA {
152
+  EFI_GUID                          VariableName;
153
+  UINTN                             UnicodeNameLength;
154
+  UINTN                             VariableDataLength;
155
+  CHAR16                            UnicodeName[1];
156
+  INT8                              VariableData[1];  ///< Driver or platform-specific data
157
+} EFI_VARIABLE_DATA;
158
+
159
+typedef struct tdEFI_GPT_DATA {
160
+  EFI_PARTITION_TABLE_HEADER  EfiPartitionHeader;
161
+  UINTN                       NumberOfPartitions;
162
+  EFI_PARTITION_ENTRY         Partitions[1];
163
+} EFI_GPT_DATA;
164
+
165
+//
166
+// Restore original structure alignment
167
+//
168
+#pragma pack ()
169
+
170
+#endif
171
+
172
+

+ 278
- 0
src/include/ipxe/efi/Protocol/GraphicsOutput.h Целия файл

@@ -0,0 +1,278 @@
1
+/** @file
2
+  Graphics Output Protocol from the UEFI 2.0 specification.
3
+
4
+  Abstraction of a very simple graphics device.
5
+
6
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
7
+  This program and the accompanying materials
8
+  are licensed and made available under the terms and conditions of the BSD License
9
+  which accompanies this distribution.  The full text of the license may be found at
10
+  http://opensource.org/licenses/bsd-license.php
11
+
12
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
+
15
+**/
16
+
17
+#ifndef __GRAPHICS_OUTPUT_H__
18
+#define __GRAPHICS_OUTPUT_H__
19
+
20
+FILE_LICENCE ( BSD3 );
21
+
22
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
23
+  { \
24
+    0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
25
+  }
26
+
27
+typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
28
+
29
+typedef struct {
30
+  UINT32            RedMask;
31
+  UINT32            GreenMask;
32
+  UINT32            BlueMask;
33
+  UINT32            ReservedMask;
34
+} EFI_PIXEL_BITMASK;
35
+
36
+typedef enum {
37
+  ///
38
+  /// A pixel is 32-bits and byte zero represents red, byte one represents green,
39
+  /// byte two represents blue, and byte three is reserved. This is the definition
40
+  /// for the physical frame buffer. The byte values for the red, green, and blue
41
+  /// components represent the color intensity. This color intensity value range
42
+  /// from a minimum intensity of 0 to maximum intensity of 255.
43
+  ///
44
+  PixelRedGreenBlueReserved8BitPerColor,
45
+  ///
46
+  /// A pixel is 32-bits and byte zero represents blue, byte one represents green,
47
+  /// byte two represents red, and byte three is reserved. This is the definition
48
+  /// for the physical frame buffer. The byte values for the red, green, and blue
49
+  /// components represent the color intensity. This color intensity value range
50
+  /// from a minimum intensity of 0 to maximum intensity of 255.
51
+  ///
52
+  PixelBlueGreenRedReserved8BitPerColor,
53
+  ///
54
+  /// The Pixel definition of the physical frame buffer.
55
+  ///
56
+  PixelBitMask,
57
+  ///
58
+  /// This mode does not support a physical frame buffer.
59
+  ///
60
+  PixelBltOnly,
61
+  ///
62
+  /// Valid EFI_GRAPHICS_PIXEL_FORMAT enum values are less than this value.
63
+  ///
64
+  PixelFormatMax
65
+} EFI_GRAPHICS_PIXEL_FORMAT;
66
+
67
+typedef struct {
68
+  ///
69
+  /// The version of this data structure. A value of zero represents the
70
+  /// EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure as defined in this specification.
71
+  ///
72
+  UINT32                     Version;
73
+  ///
74
+  /// The size of video screen in pixels in the X dimension.
75
+  ///
76
+  UINT32                     HorizontalResolution;
77
+  ///
78
+  /// The size of video screen in pixels in the Y dimension.
79
+  ///
80
+  UINT32                     VerticalResolution;
81
+  ///
82
+  /// Enumeration that defines the physical format of the pixel. A value of PixelBltOnly
83
+  /// implies that a linear frame buffer is not available for this mode.
84
+  ///
85
+  EFI_GRAPHICS_PIXEL_FORMAT  PixelFormat;
86
+  ///
87
+  /// This bit-mask is only valid if PixelFormat is set to PixelPixelBitMask.
88
+  /// A bit being set defines what bits are used for what purpose such as Red, Green, Blue, or Reserved.
89
+  ///
90
+  EFI_PIXEL_BITMASK          PixelInformation;
91
+  ///
92
+  /// Defines the number of pixel elements per video memory line.
93
+  ///
94
+  UINT32                     PixelsPerScanLine;
95
+} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
96
+
97
+/**
98
+  Returns information for an available graphics mode that the graphics device
99
+  and the set of active video output devices supports.
100
+
101
+  @param  This                  The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.
102
+  @param  ModeNumber            The mode number to return information on.
103
+  @param  SizeOfInfo            A pointer to the size, in bytes, of the Info buffer.
104
+  @param  Info                  A pointer to callee allocated buffer that returns information about ModeNumber.
105
+
106
+  @retval EFI_SUCCESS           Valid mode information was returned.
107
+  @retval EFI_DEVICE_ERROR      A hardware error occurred trying to retrieve the video mode.
108
+  @retval EFI_INVALID_PARAMETER ModeNumber is not valid.
109
+
110
+**/
111
+typedef
112
+EFI_STATUS
113
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE)(
114
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
115
+  IN  UINT32                                ModeNumber,
116
+  OUT UINTN                                 *SizeOfInfo,
117
+  OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
118
+  );
119
+
120
+/**
121
+  Set the video device into the specified mode and clears the visible portions of
122
+  the output display to black.
123
+
124
+  @param  This              The EFI_GRAPHICS_OUTPUT_PROTOCOL instance.
125
+  @param  ModeNumber        Abstraction that defines the current video mode.
126
+
127
+  @retval EFI_SUCCESS       The graphics mode specified by ModeNumber was selected.
128
+  @retval EFI_DEVICE_ERROR  The device had an error and could not complete the request.
129
+  @retval EFI_UNSUPPORTED   ModeNumber is not supported by this device.
130
+
131
+**/
132
+typedef
133
+EFI_STATUS
134
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE)(
135
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
136
+  IN  UINT32                       ModeNumber
137
+  );
138
+
139
+typedef struct {
140
+  UINT8 Blue;
141
+  UINT8 Green;
142
+  UINT8 Red;
143
+  UINT8 Reserved;
144
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
145
+
146
+typedef union {
147
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
148
+  UINT32                        Raw;
149
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
150
+
151
+///
152
+/// actions for BltOperations
153
+///
154
+typedef enum {
155
+  ///
156
+  /// Write data from the BltBuffer pixel (0, 0)
157
+  /// directly to every pixel of the video display rectangle
158
+  /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
159
+  /// Only one pixel will be used from the BltBuffer. Delta is NOT used.
160
+  ///
161
+  EfiBltVideoFill,
162
+
163
+  ///
164
+  /// Read data from the video display rectangle
165
+  /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
166
+  /// the BltBuffer rectangle (DestinationX, DestinationY )
167
+  /// (DestinationX + Width, DestinationY + Height). If DestinationX or
168
+  /// DestinationY is not zero then Delta must be set to the length in bytes
169
+  /// of a row in the BltBuffer.
170
+  ///
171
+  EfiBltVideoToBltBuffer,
172
+
173
+  ///
174
+  /// Write data from the BltBuffer rectangle
175
+  /// (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
176
+  /// video display rectangle (DestinationX, DestinationY)
177
+  /// (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
178
+  /// not zero then Delta must be set to the length in bytes of a row in the
179
+  /// BltBuffer.
180
+  ///
181
+  EfiBltBufferToVideo,
182
+
183
+  ///
184
+  /// Copy from the video display rectangle (SourceX, SourceY)
185
+  /// (SourceX + Width, SourceY + Height) to the video display rectangle
186
+  /// (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
187
+  /// The BltBuffer and Delta are not used in this mode.
188
+  ///
189
+  EfiBltVideoToVideo,
190
+
191
+  EfiGraphicsOutputBltOperationMax
192
+} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
193
+
194
+/**
195
+  Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
196
+
197
+  @param  This         Protocol instance pointer.
198
+  @param  BltBuffer    The data to transfer to the graphics screen.
199
+                       Size is at least Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL).
200
+  @param  BltOperation The operation to perform when copying BltBuffer on to the graphics screen.
201
+  @param  SourceX      The X coordinate of source for the BltOperation.
202
+  @param  SourceY      The Y coordinate of source for the BltOperation.
203
+  @param  DestinationX The X coordinate of destination for the BltOperation.
204
+  @param  DestinationY The Y coordinate of destination for the BltOperation.
205
+  @param  Width        The width of a rectangle in the blt rectangle in pixels.
206
+  @param  Height       The height of a rectangle in the blt rectangle in pixels.
207
+  @param  Delta        Not used for EfiBltVideoFill or the EfiBltVideoToVideo operation.
208
+                       If a Delta of zero is used, the entire BltBuffer is being operated on.
209
+                       If a subrectangle of the BltBuffer is being used then Delta
210
+                       represents the number of bytes in a row of the BltBuffer.
211
+
212
+  @retval EFI_SUCCESS           BltBuffer was drawn to the graphics screen.
213
+  @retval EFI_INVALID_PARAMETER BltOperation is not valid.
214
+  @retval EFI_DEVICE_ERROR      The device had an error and could not complete the request.
215
+
216
+**/
217
+typedef
218
+EFI_STATUS
219
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT)(
220
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL            *This,
221
+  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL           *BltBuffer,   OPTIONAL
222
+  IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION       BltOperation,
223
+  IN  UINTN                                   SourceX,
224
+  IN  UINTN                                   SourceY,
225
+  IN  UINTN                                   DestinationX,
226
+  IN  UINTN                                   DestinationY,
227
+  IN  UINTN                                   Width,
228
+  IN  UINTN                                   Height,
229
+  IN  UINTN                                   Delta         OPTIONAL
230
+  );
231
+
232
+typedef struct {
233
+  ///
234
+  /// The number of modes supported by QueryMode() and SetMode().
235
+  ///
236
+  UINT32                                 MaxMode;
237
+  ///
238
+  /// Current Mode of the graphics device. Valid mode numbers are 0 to MaxMode -1.
239
+  ///
240
+  UINT32                                 Mode;
241
+  ///
242
+  /// Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.
243
+  ///
244
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION   *Info;
245
+  ///
246
+  /// Size of Info structure in bytes.
247
+  ///
248
+  UINTN                                  SizeOfInfo;
249
+  ///
250
+  /// Base address of graphics linear frame buffer.
251
+  /// Offset zero in FrameBufferBase represents the upper left pixel of the display.
252
+  ///
253
+  EFI_PHYSICAL_ADDRESS                   FrameBufferBase;
254
+  ///
255
+  /// Amount of frame buffer needed to support the active mode as defined by
256
+  /// PixelsPerScanLine xVerticalResolution x PixelElementSize.
257
+  ///
258
+  UINTN                                  FrameBufferSize;
259
+} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
260
+
261
+///
262
+/// Provides a basic abstraction to set video modes and copy pixels to and from
263
+/// the graphics controller's frame buffer. The linear address of the hardware
264
+/// frame buffer is also exposed so software can write directly to the video hardware.
265
+///
266
+struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
267
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE  QueryMode;
268
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE    SetMode;
269
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT         Blt;
270
+  ///
271
+  /// Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.
272
+  ///
273
+  EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE        *Mode;
274
+};
275
+
276
+extern EFI_GUID gEfiGraphicsOutputProtocolGuid;
277
+
278
+#endif

+ 936
- 0
src/include/ipxe/efi/Protocol/PxeBaseCode.h Целия файл

@@ -0,0 +1,936 @@
1
+/** @file
2
+  EFI PXE Base Code Protocol definitions, which is used to access PXE-compatible
3
+  devices for network access and network booting.
4
+
5
+Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
6
+This program and the accompanying materials are licensed and made available under
7
+the terms and conditions of the BSD License that accompanies this distribution.
8
+The full text of the license may be found at
9
+http://opensource.org/licenses/bsd-license.php.
10
+
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
+  @par Revision Reference:
15
+  This Protocol is introduced in EFI Specification 1.10.
16
+
17
+**/
18
+#ifndef __PXE_BASE_CODE_PROTOCOL_H__
19
+#define __PXE_BASE_CODE_PROTOCOL_H__
20
+
21
+FILE_LICENCE ( BSD3 );
22
+
23
+///
24
+/// PXE Base Code protocol.
25
+///
26
+#define EFI_PXE_BASE_CODE_PROTOCOL_GUID \
27
+  { \
28
+    0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
29
+  }
30
+
31
+typedef struct _EFI_PXE_BASE_CODE_PROTOCOL  EFI_PXE_BASE_CODE_PROTOCOL;
32
+
33
+///
34
+/// Protocol defined in EFI1.1.
35
+///
36
+typedef EFI_PXE_BASE_CODE_PROTOCOL  EFI_PXE_BASE_CODE;
37
+
38
+///
39
+/// Default IP TTL and ToS.
40
+///
41
+#define DEFAULT_TTL 16
42
+#define DEFAULT_ToS 0
43
+
44
+///
45
+/// ICMP error format.
46
+///
47
+typedef struct {
48
+  UINT8   Type;
49
+  UINT8   Code;
50
+  UINT16  Checksum;
51
+  union {
52
+    UINT32  reserved;
53
+    UINT32  Mtu;
54
+    UINT32  Pointer;
55
+    struct {
56
+      UINT16  Identifier;
57
+      UINT16  Sequence;
58
+    } Echo;
59
+  } u;
60
+  UINT8 Data[494];
61
+} EFI_PXE_BASE_CODE_ICMP_ERROR;
62
+
63
+///
64
+/// TFTP error format.
65
+///
66
+typedef struct {
67
+  UINT8 ErrorCode;
68
+  CHAR8 ErrorString[127];
69
+} EFI_PXE_BASE_CODE_TFTP_ERROR;
70
+
71
+///
72
+/// IP Receive Filter definitions.
73
+///
74
+#define EFI_PXE_BASE_CODE_MAX_IPCNT 8
75
+
76
+///
77
+/// IP Receive Filter structure.
78
+///
79
+typedef struct {
80
+  UINT8           Filters;
81
+  UINT8           IpCnt;
82
+  UINT16          reserved;
83
+  EFI_IP_ADDRESS  IpList[EFI_PXE_BASE_CODE_MAX_IPCNT];
84
+} EFI_PXE_BASE_CODE_IP_FILTER;
85
+
86
+#define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP            0x0001
87
+#define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST             0x0002
88
+#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS           0x0004
89
+#define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008
90
+
91
+///
92
+/// ARP cache entries.
93
+///
94
+typedef struct {
95
+  EFI_IP_ADDRESS  IpAddr;
96
+  EFI_MAC_ADDRESS MacAddr;
97
+} EFI_PXE_BASE_CODE_ARP_ENTRY;
98
+
99
+///
100
+/// ARP route table entries.
101
+///
102
+typedef struct {
103
+  EFI_IP_ADDRESS  IpAddr;
104
+  EFI_IP_ADDRESS  SubnetMask;
105
+  EFI_IP_ADDRESS  GwAddr;
106
+} EFI_PXE_BASE_CODE_ROUTE_ENTRY;
107
+
108
+//
109
+// UDP definitions
110
+//
111
+typedef UINT16  EFI_PXE_BASE_CODE_UDP_PORT;
112
+
113
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP    0x0001
114
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT  0x0002
115
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP   0x0004
116
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008
117
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER    0x0010
118
+#define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT  0x0020
119
+
120
+//
121
+// Discover() definitions
122
+//
123
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP         0
124
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS      1
125
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM         2
126
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI           3
127
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO        4
128
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD          5
129
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM          6
130
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG  7
131
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW       8
132
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9         9
133
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10        10
134
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11        11
135
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12       12
136
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL    13
137
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT       14
138
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO             15
139
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT           16
140
+//
141
+// 17 through 32767 are reserved
142
+// 32768 through 65279 are for vendor use
143
+// 65280 through 65534 are reserved
144
+//
145
+#define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST   65535
146
+
147
+#define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK     0x7FFF
148
+#define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL  0x0000
149
+
150
+//
151
+// PXE Tag definition that identifies the processor
152
+// and programming environment of the client system.
153
+// These identifiers are defined by IETF:
154
+// http://www.ietf.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml
155
+//
156
+#if defined (MDE_CPU_IA32)
157
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x0006
158
+#elif defined (MDE_CPU_IPF)
159
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x0002
160
+#elif defined (MDE_CPU_X64)
161
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x0007
162
+#elif defined (MDE_CPU_ARM)
163
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x000A
164
+#elif defined (MDE_CPU_AARCH64)
165
+#define EFI_PXE_CLIENT_SYSTEM_ARCHITECTURE    0x000B
166
+#endif
167
+
168
+
169
+///
170
+/// Discover() server list structure.
171
+///
172
+typedef struct {
173
+  UINT16          Type;
174
+  BOOLEAN         AcceptAnyResponse;
175
+  UINT8           Reserved;
176
+  EFI_IP_ADDRESS  IpAddr;
177
+} EFI_PXE_BASE_CODE_SRVLIST;
178
+
179
+///
180
+/// Discover() information override structure.
181
+///
182
+typedef struct {
183
+  BOOLEAN                   UseMCast;
184
+  BOOLEAN                   UseBCast;
185
+  BOOLEAN                   UseUCast;
186
+  BOOLEAN                   MustUseList;
187
+  EFI_IP_ADDRESS            ServerMCastIp;
188
+  UINT16                    IpCnt;
189
+  EFI_PXE_BASE_CODE_SRVLIST SrvList[1];
190
+} EFI_PXE_BASE_CODE_DISCOVER_INFO;
191
+
192
+///
193
+/// TFTP opcode definitions.
194
+///
195
+typedef enum {
196
+  EFI_PXE_BASE_CODE_TFTP_FIRST,
197
+  EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
198
+  EFI_PXE_BASE_CODE_TFTP_READ_FILE,
199
+  EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,
200
+  EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY,
201
+  EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE,
202
+  EFI_PXE_BASE_CODE_MTFTP_READ_FILE,
203
+  EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY,
204
+  EFI_PXE_BASE_CODE_MTFTP_LAST
205
+} EFI_PXE_BASE_CODE_TFTP_OPCODE;
206
+
207
+///
208
+/// MTFTP information. This information is required
209
+/// to start or join a multicast TFTP session. It is also required to
210
+/// perform the "get file size" and "read directory" operations of MTFTP.
211
+///
212
+typedef struct {
213
+  EFI_IP_ADDRESS              MCastIp;
214
+  EFI_PXE_BASE_CODE_UDP_PORT  CPort;
215
+  EFI_PXE_BASE_CODE_UDP_PORT  SPort;
216
+  UINT16                      ListenTimeout;
217
+  UINT16                      TransmitTimeout;
218
+} EFI_PXE_BASE_CODE_MTFTP_INFO;
219
+
220
+///
221
+/// DHCPV4 Packet structure.
222
+///
223
+typedef struct {
224
+  UINT8   BootpOpcode;
225
+  UINT8   BootpHwType;
226
+  UINT8   BootpHwAddrLen;
227
+  UINT8   BootpGateHops;
228
+  UINT32  BootpIdent;
229
+  UINT16  BootpSeconds;
230
+  UINT16  BootpFlags;
231
+  UINT8   BootpCiAddr[4];
232
+  UINT8   BootpYiAddr[4];
233
+  UINT8   BootpSiAddr[4];
234
+  UINT8   BootpGiAddr[4];
235
+  UINT8   BootpHwAddr[16];
236
+  UINT8   BootpSrvName[64];
237
+  UINT8   BootpBootFile[128];
238
+  UINT32  DhcpMagik;
239
+  UINT8   DhcpOptions[56];
240
+} EFI_PXE_BASE_CODE_DHCPV4_PACKET;
241
+
242
+///
243
+/// DHCPV6 Packet structure.
244
+///
245
+typedef struct {
246
+  UINT32  MessageType:8;
247
+  UINT32  TransactionId:24;
248
+  UINT8   DhcpOptions[1024];
249
+} EFI_PXE_BASE_CODE_DHCPV6_PACKET;
250
+
251
+///
252
+/// Packet structure.
253
+///
254
+typedef union {
255
+  UINT8                           Raw[1472];
256
+  EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4;
257
+  EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6;
258
+} EFI_PXE_BASE_CODE_PACKET;
259
+
260
+//
261
+// PXE Base Code Mode structure
262
+//
263
+#define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES   8
264
+#define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
265
+
266
+///
267
+/// EFI_PXE_BASE_CODE_MODE.
268
+/// The data values in this structure are read-only and
269
+/// are updated by the code that produces the
270
+/// EFI_PXE_BASE_CODE_PROTOCOL functions.
271
+///
272
+typedef struct {
273
+  BOOLEAN                       Started;
274
+  BOOLEAN                       Ipv6Available;
275
+  BOOLEAN                       Ipv6Supported;
276
+  BOOLEAN                       UsingIpv6;
277
+  BOOLEAN                       BisSupported;
278
+  BOOLEAN                       BisDetected;
279
+  BOOLEAN                       AutoArp;
280
+  BOOLEAN                       SendGUID;
281
+  BOOLEAN                       DhcpDiscoverValid;
282
+  BOOLEAN                       DhcpAckReceived;
283
+  BOOLEAN                       ProxyOfferReceived;
284
+  BOOLEAN                       PxeDiscoverValid;
285
+  BOOLEAN                       PxeReplyReceived;
286
+  BOOLEAN                       PxeBisReplyReceived;
287
+  BOOLEAN                       IcmpErrorReceived;
288
+  BOOLEAN                       TftpErrorReceived;
289
+  BOOLEAN                       MakeCallbacks;
290
+  UINT8                         TTL;
291
+  UINT8                         ToS;
292
+  EFI_IP_ADDRESS                StationIp;
293
+  EFI_IP_ADDRESS                SubnetMask;
294
+  EFI_PXE_BASE_CODE_PACKET      DhcpDiscover;
295
+  EFI_PXE_BASE_CODE_PACKET      DhcpAck;
296
+  EFI_PXE_BASE_CODE_PACKET      ProxyOffer;
297
+  EFI_PXE_BASE_CODE_PACKET      PxeDiscover;
298
+  EFI_PXE_BASE_CODE_PACKET      PxeReply;
299
+  EFI_PXE_BASE_CODE_PACKET      PxeBisReply;
300
+  EFI_PXE_BASE_CODE_IP_FILTER   IpFilter;
301
+  UINT32                        ArpCacheEntries;
302
+  EFI_PXE_BASE_CODE_ARP_ENTRY   ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
303
+  UINT32                        RouteTableEntries;
304
+  EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
305
+  EFI_PXE_BASE_CODE_ICMP_ERROR  IcmpError;
306
+  EFI_PXE_BASE_CODE_TFTP_ERROR  TftpError;
307
+} EFI_PXE_BASE_CODE_MODE;
308
+
309
+//
310
+// PXE Base Code Interface Function definitions
311
+//
312
+
313
+/**
314
+  Enables the use of the PXE Base Code Protocol functions.
315
+
316
+  This function enables the use of the PXE Base Code Protocol functions. If the
317
+  Started field of the EFI_PXE_BASE_CODE_MODE structure is already TRUE, then
318
+  EFI_ALREADY_STARTED will be returned. If UseIpv6 is TRUE, then IPv6 formatted
319
+  addresses will be used in this session. If UseIpv6 is FALSE, then IPv4 formatted
320
+  addresses will be used in this session. If UseIpv6 is TRUE, and the Ipv6Supported
321
+  field of the EFI_PXE_BASE_CODE_MODE structure is FALSE, then EFI_UNSUPPORTED will
322
+  be returned. If there is not enough memory or other resources to start the PXE
323
+  Base Code Protocol, then EFI_OUT_OF_RESOURCES will be returned. Otherwise, the
324
+  PXE Base Code Protocol will be started, and all of the fields of the EFI_PXE_BASE_CODE_MODE
325
+  structure will be initialized as follows:
326
+    StartedSet to TRUE.
327
+    Ipv6SupportedUnchanged.
328
+    Ipv6AvailableUnchanged.
329
+    UsingIpv6Set to UseIpv6.
330
+    BisSupportedUnchanged.
331
+    BisDetectedUnchanged.
332
+    AutoArpSet to TRUE.
333
+    SendGUIDSet to FALSE.
334
+    TTLSet to DEFAULT_TTL.
335
+    ToSSet to DEFAULT_ToS.
336
+    DhcpCompletedSet to FALSE.
337
+    ProxyOfferReceivedSet to FALSE.
338
+    StationIpSet to an address of all zeros.
339
+    SubnetMaskSet to a subnet mask of all zeros.
340
+    DhcpDiscoverZero-filled.
341
+    DhcpAckZero-filled.
342
+    ProxyOfferZero-filled.
343
+    PxeDiscoverValidSet to FALSE.
344
+    PxeDiscoverZero-filled.
345
+    PxeReplyValidSet to FALSE.
346
+    PxeReplyZero-filled.
347
+    PxeBisReplyValidSet to FALSE.
348
+    PxeBisReplyZero-filled.
349
+    IpFilterSet the Filters field to 0 and the IpCnt field to 0.
350
+    ArpCacheEntriesSet to 0.
351
+    ArpCacheZero-filled.
352
+    RouteTableEntriesSet to 0.
353
+    RouteTableZero-filled.
354
+    IcmpErrorReceivedSet to FALSE.
355
+    IcmpErrorZero-filled.
356
+    TftpErroReceivedSet to FALSE.
357
+    TftpErrorZero-filled.
358
+    MakeCallbacksSet to TRUE if the PXE Base Code Callback Protocol is available.
359
+    Set to FALSE if the PXE Base Code Callback Protocol is not available.
360
+
361
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
362
+  @param  UseIpv6               Specifies the type of IP addresses that are to be used during the session
363
+                                that is being started. Set to TRUE for IPv6 addresses, and FALSE for
364
+                                IPv4 addresses.
365
+
366
+  @retval EFI_SUCCESS           The PXE Base Code Protocol was started.
367
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this oper
368
+  @retval EFI_UNSUPPORTED       UseIpv6 is TRUE, but the Ipv6Supported field of the
369
+                                EFI_PXE_BASE_CODE_MODE structure is FALSE.
370
+  @retval EFI_ALREADY_STARTED   The PXE Base Code Protocol is already in the started state.
371
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
372
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.
373
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory or other resources to start the
374
+                                PXE Base Code Protocol.
375
+
376
+**/
377
+typedef
378
+EFI_STATUS
379
+(EFIAPI *EFI_PXE_BASE_CODE_START)(
380
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
381
+  IN BOOLEAN                               UseIpv6
382
+  );
383
+
384
+/**
385
+  Disables the use of the PXE Base Code Protocol functions.
386
+
387
+  This function stops all activity on the network device. All the resources allocated
388
+  in Start() are released, the Started field of the EFI_PXE_BASE_CODE_MODE structure is
389
+  set to FALSE and EFI_SUCCESS is returned. If the Started field of the EFI_PXE_BASE_CODE_MODE
390
+  structure is already FALSE, then EFI_NOT_STARTED will be returned.
391
+
392
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
393
+
394
+  @retval EFI_SUCCESS           The PXE Base Code Protocol was stopped.
395
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is already in the stopped state.
396
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
397
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.
398
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
399
+
400
+**/
401
+typedef
402
+EFI_STATUS
403
+(EFIAPI *EFI_PXE_BASE_CODE_STOP)(
404
+  IN EFI_PXE_BASE_CODE_PROTOCOL    *This
405
+  );
406
+
407
+/**
408
+  Attempts to complete a DHCPv4 D.O.R.A. (discover / offer / request / acknowledge) or DHCPv6
409
+  S.A.R.R (solicit / advertise / request / reply) sequence.
410
+
411
+  This function attempts to complete the DHCP sequence. If this sequence is completed,
412
+  then EFI_SUCCESS is returned, and the DhcpCompleted, ProxyOfferReceived, StationIp,
413
+  SubnetMask, DhcpDiscover, DhcpAck, and ProxyOffer fields of the EFI_PXE_BASE_CODE_MODE
414
+  structure are filled in.
415
+  If SortOffers is TRUE, then the cached DHCP offer packets will be sorted before
416
+  they are tried. If SortOffers is FALSE, then the cached DHCP offer packets will
417
+  be tried in the order in which they are received. Please see the Preboot Execution
418
+  Environment (PXE) Specification for additional details on the implementation of DHCP.
419
+  This function can take at least 31 seconds to timeout and return control to the
420
+  caller. If the DHCP sequence does not complete, then EFI_TIMEOUT will be returned.
421
+  If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
422
+  then the DHCP sequence will be stopped and EFI_ABORTED will be returned.
423
+
424
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
425
+  @param  SortOffers            TRUE if the offers received should be sorted. Set to FALSE to try the
426
+                                offers in the order that they are received.
427
+
428
+  @retval EFI_SUCCESS           Valid DHCP has completed.
429
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
430
+  @retval EFI_INVALID_PARAMETER The This parameter is NULL or does not point to a valid
431
+                                EFI_PXE_BASE_CODE_PROTOCOL structure.
432
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
433
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory to complete the DHCP Protocol.
434
+  @retval EFI_ABORTED           The callback function aborted the DHCP Protocol.
435
+  @retval EFI_TIMEOUT           The DHCP Protocol timed out.
436
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the DHCP session.
437
+  @retval EFI_NO_RESPONSE       Valid PXE offer was not received.
438
+
439
+**/
440
+typedef
441
+EFI_STATUS
442
+(EFIAPI *EFI_PXE_BASE_CODE_DHCP)(
443
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
444
+  IN BOOLEAN                               SortOffers
445
+  );
446
+
447
+/**
448
+  Attempts to complete the PXE Boot Server and/or boot image discovery sequence.
449
+
450
+  This function attempts to complete the PXE Boot Server and/or boot image discovery
451
+  sequence. If this sequence is completed, then EFI_SUCCESS is returned, and the
452
+  PxeDiscoverValid, PxeDiscover, PxeReplyReceived, and PxeReply fields of the
453
+  EFI_PXE_BASE_CODE_MODE structure are filled in. If UseBis is TRUE, then the
454
+  PxeBisReplyReceived and PxeBisReply fields of the EFI_PXE_BASE_CODE_MODE structure
455
+  will also be filled in. If UseBis is FALSE, then PxeBisReplyValid will be set to FALSE.
456
+  In the structure referenced by parameter Info, the PXE Boot Server list, SrvList[],
457
+  has two uses: It is the Boot Server IP address list used for unicast discovery
458
+  (if the UseUCast field is TRUE), and it is the list used for Boot Server verification
459
+  (if the MustUseList field is TRUE). Also, if the MustUseList field in that structure
460
+  is TRUE and the AcceptAnyResponse field in the SrvList[] array is TRUE, any Boot
461
+  Server reply of that type will be accepted. If the AcceptAnyResponse field is
462
+  FALSE, only responses from Boot Servers with matching IP addresses will be accepted.
463
+  This function can take at least 10 seconds to timeout and return control to the
464
+  caller. If the Discovery sequence does not complete, then EFI_TIMEOUT will be
465
+  returned. Please see the Preboot Execution Environment (PXE) Specification for
466
+  additional details on the implementation of the Discovery sequence.
467
+  If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
468
+  then the Discovery sequence is stopped and EFI_ABORTED will be returned.
469
+
470
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
471
+  @param  Type                  The type of bootstrap to perform.
472
+  @param  Layer                 The pointer to the boot server layer number to discover, which must be
473
+                                PXE_BOOT_LAYER_INITIAL when a new server type is being
474
+                                discovered.
475
+  @param  UseBis                TRUE if Boot Integrity Services are to be used. FALSE otherwise.
476
+  @param  Info                  The pointer to a data structure that contains additional information on the
477
+                                type of discovery operation that is to be performed.
478
+
479
+  @retval EFI_SUCCESS           The Discovery sequence has been completed.
480
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
481
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
482
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
483
+  @retval EFI_OUT_OF_RESOURCES  Could not allocate enough memory to complete Discovery.
484
+  @retval EFI_ABORTED           The callback function aborted the Discovery sequence.
485
+  @retval EFI_TIMEOUT           The Discovery sequence timed out.
486
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the PXE discovery
487
+                                session.
488
+
489
+**/
490
+typedef
491
+EFI_STATUS
492
+(EFIAPI *EFI_PXE_BASE_CODE_DISCOVER)(
493
+  IN EFI_PXE_BASE_CODE_PROTOCOL           *This,
494
+  IN UINT16                               Type,
495
+  IN UINT16                               *Layer,
496
+  IN BOOLEAN                              UseBis,
497
+  IN EFI_PXE_BASE_CODE_DISCOVER_INFO      *Info   OPTIONAL
498
+  );
499
+
500
+/**
501
+  Used to perform TFTP and MTFTP services.
502
+
503
+  This function is used to perform TFTP and MTFTP services. This includes the
504
+  TFTP operations to get the size of a file, read a directory, read a file, and
505
+  write a file. It also includes the MTFTP operations to get the size of a file,
506
+  read a directory, and read a file. The type of operation is specified by Operation.
507
+  If the callback function that is invoked during the TFTP/MTFTP operation does
508
+  not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will
509
+  be returned.
510
+  For read operations, the return data will be placed in the buffer specified by
511
+  BufferPtr. If BufferSize is too small to contain the entire downloaded file,
512
+  then EFI_BUFFER_TOO_SMALL will be returned and BufferSize will be set to zero
513
+  or the size of the requested file (the size of the requested file is only returned
514
+  if the TFTP server supports TFTP options). If BufferSize is large enough for the
515
+  read operation, then BufferSize will be set to the size of the downloaded file,
516
+  and EFI_SUCCESS will be returned. Applications using the PxeBc.Mtftp() services
517
+  should use the get-file-size operations to determine the size of the downloaded
518
+  file prior to using the read-file operations--especially when downloading large
519
+  (greater than 64 MB) files--instead of making two calls to the read-file operation.
520
+  Following this recommendation will save time if the file is larger than expected
521
+  and the TFTP server does not support TFTP option extensions. Without TFTP option
522
+  extension support, the client has to download the entire file, counting and discarding
523
+  the received packets, to determine the file size.
524
+  For write operations, the data to be sent is in the buffer specified by BufferPtr.
525
+  BufferSize specifies the number of bytes to send. If the write operation completes
526
+  successfully, then EFI_SUCCESS will be returned.
527
+  For TFTP "get file size" operations, the size of the requested file or directory
528
+  is returned in BufferSize, and EFI_SUCCESS will be returned. If the TFTP server
529
+  does not support options, the file will be downloaded into a bit bucket and the
530
+  length of the downloaded file will be returned. For MTFTP "get file size" operations,
531
+  if the MTFTP server does not support the "get file size" option, EFI_UNSUPPORTED
532
+  will be returned.
533
+  This function can take up to 10 seconds to timeout and return control to the caller.
534
+  If the TFTP sequence does not complete, EFI_TIMEOUT will be returned.
535
+  If the Callback Protocol does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE,
536
+  then the TFTP sequence is stopped and EFI_ABORTED will be returned.
537
+  The format of the data returned from a TFTP read directory operation is a null-terminated
538
+  filename followed by a null-terminated information string, of the form
539
+  "size year-month-day hour:minute:second" (i.e. %d %d-%d-%d %d:%d:%f - note that
540
+  the seconds field can be a decimal number), where the date and time are UTC. For
541
+  an MTFTP read directory command, there is additionally a null-terminated multicast
542
+  IP address preceding the filename of the form %d.%d.%d.%d for IP v4. The final
543
+  entry is itself null-terminated, so that the final information string is terminated
544
+  with two null octets.
545
+
546
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
547
+  @param  Operation             The type of operation to perform.
548
+  @param  BufferPtr             A pointer to the data buffer.
549
+  @param  Overwrite             Only used on write file operations. TRUE if a file on a remote server can
550
+                                be overwritten.
551
+  @param  BufferSize            For get-file-size operations, *BufferSize returns the size of the
552
+                                requested file.
553
+  @param  BlockSize             The requested block size to be used during a TFTP transfer.
554
+  @param  ServerIp              The TFTP / MTFTP server IP address.
555
+  @param  Filename              A Null-terminated ASCII string that specifies a directory name or a file
556
+                                name.
557
+  @param  Info                  The pointer to the MTFTP information.
558
+  @param  DontUseBuffer         Set to FALSE for normal TFTP and MTFTP read file operation.
559
+
560
+  @retval EFI_SUCCESS           The TFTP/MTFTP operation was completed.
561
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
562
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
563
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
564
+  @retval EFI_BUFFER_TOO_SMALL  The buffer is not large enough to complete the read operation.
565
+  @retval EFI_ABORTED           The callback function aborted the TFTP/MTFTP operation.
566
+  @retval EFI_TIMEOUT           The TFTP/MTFTP operation timed out.
567
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the MTFTP session.
568
+  @retval EFI_TFTP_ERROR        A TFTP error packet was received during the MTFTP session.
569
+
570
+**/
571
+typedef
572
+EFI_STATUS
573
+(EFIAPI *EFI_PXE_BASE_CODE_MTFTP)(
574
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,
575
+  IN EFI_PXE_BASE_CODE_TFTP_OPCODE             Operation,
576
+  IN OUT VOID                                  *BufferPtr OPTIONAL,
577
+  IN BOOLEAN                                   Overwrite,
578
+  IN OUT UINT64                                *BufferSize,
579
+  IN UINTN                                     *BlockSize OPTIONAL,
580
+  IN EFI_IP_ADDRESS                            *ServerIp,
581
+  IN UINT8                                     *Filename  OPTIONAL,
582
+  IN EFI_PXE_BASE_CODE_MTFTP_INFO              *Info      OPTIONAL,
583
+  IN BOOLEAN                                   DontUseBuffer
584
+  );
585
+
586
+/**
587
+  Writes a UDP packet to the network interface.
588
+
589
+  This function writes a UDP packet specified by the (optional HeaderPtr and)
590
+  BufferPtr parameters to the network interface. The UDP header is automatically
591
+  built by this routine. It uses the parameters OpFlags, DestIp, DestPort, GatewayIp,
592
+  SrcIp, and SrcPort to build this header. If the packet is successfully built and
593
+  transmitted through the network interface, then EFI_SUCCESS will be returned.
594
+  If a timeout occurs during the transmission of the packet, then EFI_TIMEOUT will
595
+  be returned. If an ICMP error occurs during the transmission of the packet, then
596
+  the IcmpErrorReceived field is set to TRUE, the IcmpError field is filled in and
597
+  EFI_ICMP_ERROR will be returned. If the Callback Protocol does not return
598
+  EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED will be returned.
599
+
600
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
601
+  @param  OpFlags               The UDP operation flags.
602
+  @param  DestIp                The destination IP address.
603
+  @param  DestPort              The destination UDP port number.
604
+  @param  GatewayIp             The gateway IP address.
605
+  @param  SrcIp                 The source IP address.
606
+  @param  SrcPort               The source UDP port number.
607
+  @param  HeaderSize            An optional field which may be set to the length of a header at
608
+                                HeaderPtr to be prefixed to the data at BufferPtr.
609
+  @param  HeaderPtr             If HeaderSize is not NULL, a pointer to a header to be prefixed to the
610
+                                data at BufferPtr.
611
+  @param  BufferSize            A pointer to the size of the data at BufferPtr.
612
+  @param  BufferPtr             A pointer to the data to be written.
613
+
614
+  @retval EFI_SUCCESS           The UDP Write operation was completed.
615
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
616
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
617
+  @retval EFI_BAD_BUFFER_SIZE   The buffer is too long to be transmitted.
618
+  @retval EFI_ABORTED           The callback function aborted the UDP Write operation.
619
+  @retval EFI_TIMEOUT           The UDP Write operation timed out.
620
+  @retval EFI_ICMP_ERROR        An ICMP error packet was received during the UDP write session.
621
+
622
+**/
623
+typedef
624
+EFI_STATUS
625
+(EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE)(
626
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,
627
+  IN UINT16                                    OpFlags,
628
+  IN EFI_IP_ADDRESS                            *DestIp,
629
+  IN EFI_PXE_BASE_CODE_UDP_PORT                *DestPort,
630
+  IN EFI_IP_ADDRESS                            *GatewayIp,  OPTIONAL
631
+  IN EFI_IP_ADDRESS                            *SrcIp,      OPTIONAL
632
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *SrcPort,    OPTIONAL
633
+  IN UINTN                                     *HeaderSize, OPTIONAL
634
+  IN VOID                                      *HeaderPtr,  OPTIONAL
635
+  IN UINTN                                     *BufferSize,
636
+  IN VOID                                      *BufferPtr
637
+  );
638
+
639
+/**
640
+  Reads a UDP packet from the network interface.
641
+
642
+  This function reads a UDP packet from a network interface. The data contents
643
+  are returned in (the optional HeaderPtr and) BufferPtr, and the size of the
644
+  buffer received is returned in BufferSize. If the input BufferSize is smaller
645
+  than the UDP packet received (less optional HeaderSize), it will be set to the
646
+  required size, and EFI_BUFFER_TOO_SMALL will be returned. In this case, the
647
+  contents of BufferPtr are undefined, and the packet is lost. If a UDP packet is
648
+  successfully received, then EFI_SUCCESS will be returned, and the information
649
+  from the UDP header will be returned in DestIp, DestPort, SrcIp, and SrcPort if
650
+  they are not NULL.
651
+  Depending on the values of OpFlags and the DestIp, DestPort, SrcIp, and SrcPort
652
+  input values, different types of UDP packet receive filtering will be performed.
653
+  The following tables summarize these receive filter operations.
654
+
655
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
656
+  @param  OpFlags               The UDP operation flags.
657
+  @param  DestIp                The destination IP address.
658
+  @param  DestPort              The destination UDP port number.
659
+  @param  SrcIp                 The source IP address.
660
+  @param  SrcPort               The source UDP port number.
661
+  @param  HeaderSize            An optional field which may be set to the length of a header at
662
+                                HeaderPtr to be prefixed to the data at BufferPtr.
663
+  @param  HeaderPtr             If HeaderSize is not NULL, a pointer to a header to be prefixed to the
664
+                                data at BufferPtr.
665
+  @param  BufferSize            A pointer to the size of the data at BufferPtr.
666
+  @param  BufferPtr             A pointer to the data to be read.
667
+
668
+  @retval EFI_SUCCESS           The UDP Read operation was completed.
669
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
670
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
671
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
672
+  @retval EFI_BUFFER_TOO_SMALL  The packet is larger than Buffer can hold.
673
+  @retval EFI_ABORTED           The callback function aborted the UDP Read operation.
674
+  @retval EFI_TIMEOUT           The UDP Read operation timed out.
675
+
676
+**/
677
+typedef
678
+EFI_STATUS
679
+(EFIAPI *EFI_PXE_BASE_CODE_UDP_READ)(
680
+  IN EFI_PXE_BASE_CODE_PROTOCOL                *This,
681
+  IN UINT16                                    OpFlags,
682
+  IN OUT EFI_IP_ADDRESS                        *DestIp,     OPTIONAL
683
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *DestPort,   OPTIONAL
684
+  IN OUT EFI_IP_ADDRESS                        *SrcIp,      OPTIONAL
685
+  IN OUT EFI_PXE_BASE_CODE_UDP_PORT            *SrcPort,    OPTIONAL
686
+  IN UINTN                                     *HeaderSize, OPTIONAL
687
+  IN VOID                                      *HeaderPtr,  OPTIONAL
688
+  IN OUT UINTN                                 *BufferSize,
689
+  IN VOID                                      *BufferPtr
690
+  );
691
+
692
+/**
693
+  Updates the IP receive filters of a network device and enables software filtering.
694
+
695
+  The NewFilter field is used to modify the network device's current IP receive
696
+  filter settings and to enable a software filter. This function updates the IpFilter
697
+  field of the EFI_PXE_BASE_CODE_MODE structure with the contents of NewIpFilter.
698
+  The software filter is used when the USE_FILTER in OpFlags is set to UdpRead().
699
+  The current hardware filter remains in effect no matter what the settings of OpFlags
700
+  are, so that the meaning of ANY_DEST_IP set in OpFlags to UdpRead() is from those
701
+  packets whose reception is enabled in hardware - physical NIC address (unicast),
702
+  broadcast address, logical address or addresses (multicast), or all (promiscuous).
703
+  UdpRead() does not modify the IP filter settings.
704
+  Dhcp(), Discover(), and Mtftp() set the IP filter, and return with the IP receive
705
+  filter list emptied and the filter set to EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP.
706
+  If an application or driver wishes to preserve the IP receive filter settings,
707
+  it will have to preserve the IP receive filter settings before these calls, and
708
+  use SetIpFilter() to restore them after the calls. If incompatible filtering is
709
+  requested (for example, PROMISCUOUS with anything else), or if the device does not
710
+  support a requested filter setting and it cannot be accommodated in software
711
+  (for example, PROMISCUOUS not supported), EFI_INVALID_PARAMETER will be returned.
712
+  The IPlist field is used to enable IPs other than the StationIP. They may be
713
+  multicast or unicast. If IPcnt is set as well as EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP,
714
+  then both the StationIP and the IPs from the IPlist will be used.
715
+
716
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
717
+  @param  NewFilter             The pointer to the new set of IP receive filters.
718
+
719
+  @retval EFI_SUCCESS           The IP receive filter settings were updated.
720
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
721
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
722
+
723
+**/
724
+typedef
725
+EFI_STATUS
726
+(EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER)(
727
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
728
+  IN EFI_PXE_BASE_CODE_IP_FILTER           *NewFilter
729
+  );
730
+
731
+/**
732
+  Uses the ARP protocol to resolve a MAC address.
733
+
734
+  This function uses the ARP protocol to resolve a MAC address. The UsingIpv6 field
735
+  of the EFI_PXE_BASE_CODE_MODE structure is used to determine if IPv4 or IPv6
736
+  addresses are being used. The IP address specified by IpAddr is used to resolve
737
+  a MAC address. If the ARP protocol succeeds in resolving the specified address,
738
+  then the ArpCacheEntries and ArpCache fields of the EFI_PXE_BASE_CODE_MODE structure
739
+  are updated, and EFI_SUCCESS is returned. If MacAddr is not NULL, the resolved
740
+  MAC address is placed there as well.
741
+  If the PXE Base Code protocol is in the stopped state, then EFI_NOT_STARTED is
742
+  returned. If the ARP protocol encounters a timeout condition while attempting
743
+  to resolve an address, then EFI_TIMEOUT is returned. If the Callback Protocol
744
+  does not return EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, then EFI_ABORTED is
745
+  returned.
746
+
747
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
748
+  @param  IpAddr                The pointer to the IP address that is used to resolve a MAC address.
749
+  @param  MacAddr               If not NULL, a pointer to the MAC address that was resolved with the
750
+                                ARP protocol.
751
+
752
+  @retval EFI_SUCCESS           The IP or MAC address was resolved.
753
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
754
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
755
+  @retval EFI_DEVICE_ERROR      The network device encountered an error during this operation.
756
+  @retval EFI_ABORTED           The callback function aborted the ARP Protocol.
757
+  @retval EFI_TIMEOUT           The ARP Protocol encountered a timeout condition.
758
+
759
+**/
760
+typedef
761
+EFI_STATUS
762
+(EFIAPI *EFI_PXE_BASE_CODE_ARP)(
763
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
764
+  IN EFI_IP_ADDRESS                        *IpAddr,
765
+  IN EFI_MAC_ADDRESS                       *MacAddr OPTIONAL
766
+  );
767
+
768
+/**
769
+  Updates the parameters that affect the operation of the PXE Base Code Protocol.
770
+
771
+  This function sets parameters that affect the operation of the PXE Base Code Protocol.
772
+  The parameter specified by NewAutoArp is used to control the generation of ARP
773
+  protocol packets. If NewAutoArp is TRUE, then ARP Protocol packets will be generated
774
+  as required by the PXE Base Code Protocol. If NewAutoArp is FALSE, then no ARP
775
+  Protocol packets will be generated. In this case, the only mappings that are
776
+  available are those stored in the ArpCache of the EFI_PXE_BASE_CODE_MODE structure.
777
+  If there are not enough mappings in the ArpCache to perform a PXE Base Code Protocol
778
+  service, then the service will fail. This function updates the AutoArp field of
779
+  the EFI_PXE_BASE_CODE_MODE structure to NewAutoArp.
780
+  The SetParameters() call must be invoked after a Callback Protocol is installed
781
+  to enable the use of callbacks.
782
+
783
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
784
+  @param  NewAutoArp            If not NULL, a pointer to a value that specifies whether to replace the
785
+                                current value of AutoARP.
786
+  @param  NewSendGUID           If not NULL, a pointer to a value that specifies whether to replace the
787
+                                current value of SendGUID.
788
+  @param  NewTTL                If not NULL, a pointer to be used in place of the current value of TTL,
789
+                                the "time to live" field of the IP header.
790
+  @param  NewToS                If not NULL, a pointer to be used in place of the current value of ToS,
791
+                                the "type of service" field of the IP header.
792
+  @param  NewMakeCallback       If not NULL, a pointer to a value that specifies whether to replace the
793
+                                current value of the MakeCallback field of the Mode structure.
794
+
795
+  @retval EFI_SUCCESS           The new parameters values were updated.
796
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
797
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
798
+
799
+**/
800
+typedef
801
+EFI_STATUS
802
+(EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS)(
803
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
804
+  IN BOOLEAN                               *NewAutoArp,     OPTIONAL
805
+  IN BOOLEAN                               *NewSendGUID,    OPTIONAL
806
+  IN UINT8                                 *NewTTL,         OPTIONAL
807
+  IN UINT8                                 *NewToS,         OPTIONAL
808
+  IN BOOLEAN                               *NewMakeCallback OPTIONAL
809
+  );
810
+
811
+/**
812
+  Updates the station IP address and/or subnet mask values of a network device.
813
+
814
+  This function updates the station IP address and/or subnet mask values of a network
815
+  device.
816
+  The NewStationIp field is used to modify the network device's current IP address.
817
+  If NewStationIP is NULL, then the current IP address will not be modified. Otherwise,
818
+  this function updates the StationIp field of the EFI_PXE_BASE_CODE_MODE structure
819
+  with NewStationIp.
820
+  The NewSubnetMask field is used to modify the network device's current subnet
821
+  mask. If NewSubnetMask is NULL, then the current subnet mask will not be modified.
822
+  Otherwise, this function updates the SubnetMask field of the EFI_PXE_BASE_CODE_MODE
823
+  structure with NewSubnetMask.
824
+
825
+  @param  This                  The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
826
+  @param  NewStationIp          The pointer to the new IP address to be used by the network device.
827
+  @param  NewSubnetMask         The pointer to the new subnet mask to be used by the network device.
828
+
829
+  @retval EFI_SUCCESS           The new station IP address and/or subnet mask were updated.
830
+  @retval EFI_NOT_STARTED       The PXE Base Code Protocol is in the stopped state.
831
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
832
+
833
+**/
834
+typedef
835
+EFI_STATUS
836
+(EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP)(
837
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
838
+  IN EFI_IP_ADDRESS                        *NewStationIp,   OPTIONAL
839
+  IN EFI_IP_ADDRESS                        *NewSubnetMask   OPTIONAL
840
+  );
841
+
842
+/**
843
+  Updates the contents of the cached DHCP and Discover packets.
844
+
845
+  The pointers to the new packets are used to update the contents of the cached
846
+  packets in the EFI_PXE_BASE_CODE_MODE structure.
847
+
848
+  @param  This                   The pointer to the EFI_PXE_BASE_CODE_PROTOCOL instance.
849
+  @param  NewDhcpDiscoverValid   The pointer to a value that will replace the current
850
+                                 DhcpDiscoverValid field.
851
+  @param  NewDhcpAckReceived     The pointer to a value that will replace the current
852
+                                 DhcpAckReceived field.
853
+  @param  NewProxyOfferReceived  The pointer to a value that will replace the current
854
+                                 ProxyOfferReceived field.
855
+  @param  NewPxeDiscoverValid    The pointer to a value that will replace the current
856
+                                 ProxyOfferReceived field.
857
+  @param  NewPxeReplyReceived    The pointer to a value that will replace the current
858
+                                 PxeReplyReceived field.
859
+  @param  NewPxeBisReplyReceived The pointer to a value that will replace the current
860
+                                 PxeBisReplyReceived field.
861
+  @param  NewDhcpDiscover        The pointer to the new cached DHCP Discover packet contents.
862
+  @param  NewDhcpAck             The pointer to the new cached DHCP Ack packet contents.
863
+  @param  NewProxyOffer          The pointer to the new cached Proxy Offer packet contents.
864
+  @param  NewPxeDiscover         The pointer to the new cached PXE Discover packet contents.
865
+  @param  NewPxeReply            The pointer to the new cached PXE Reply packet contents.
866
+  @param  NewPxeBisReply         The pointer to the new cached PXE BIS Reply packet contents.
867
+
868
+  @retval EFI_SUCCESS            The cached packet contents were updated.
869
+  @retval EFI_NOT_STARTED        The PXE Base Code Protocol is in the stopped state.
870
+  @retval EFI_INVALID_PARAMETER  This is NULL or not point to a valid EFI_PXE_BASE_CODE_PROTOCOL structure.
871
+
872
+**/
873
+typedef
874
+EFI_STATUS
875
+(EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS)(
876
+  IN EFI_PXE_BASE_CODE_PROTOCOL            *This,
877
+  BOOLEAN                                  *NewDhcpDiscoverValid,   OPTIONAL
878
+  BOOLEAN                                  *NewDhcpAckReceived,     OPTIONAL
879
+  BOOLEAN                                  *NewProxyOfferReceived,  OPTIONAL
880
+  BOOLEAN                                  *NewPxeDiscoverValid,    OPTIONAL
881
+  BOOLEAN                                  *NewPxeReplyReceived,    OPTIONAL
882
+  BOOLEAN                                  *NewPxeBisReplyReceived, OPTIONAL
883
+  IN EFI_PXE_BASE_CODE_PACKET              *NewDhcpDiscover,        OPTIONAL
884
+  IN EFI_PXE_BASE_CODE_PACKET              *NewDhcpAck,             OPTIONAL
885
+  IN EFI_PXE_BASE_CODE_PACKET              *NewProxyOffer,          OPTIONAL
886
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeDiscover,         OPTIONAL
887
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeReply,            OPTIONAL
888
+  IN EFI_PXE_BASE_CODE_PACKET              *NewPxeBisReply          OPTIONAL
889
+  );
890
+
891
+//
892
+// PXE Base Code Protocol structure
893
+//
894
+#define EFI_PXE_BASE_CODE_PROTOCOL_REVISION   0x00010000
895
+
896
+//
897
+// Revision defined in EFI1.1
898
+//
899
+#define EFI_PXE_BASE_CODE_INTERFACE_REVISION  EFI_PXE_BASE_CODE_PROTOCOL_REVISION
900
+
901
+///
902
+/// The EFI_PXE_BASE_CODE_PROTOCOL is used to control PXE-compatible devices.
903
+/// An EFI_PXE_BASE_CODE_PROTOCOL will be layered on top of an
904
+/// EFI_MANAGED_NETWORK_PROTOCOL protocol in order to perform packet level transactions.
905
+/// The EFI_PXE_BASE_CODE_PROTOCOL handle also supports the
906
+/// EFI_LOAD_FILE_PROTOCOL protocol. This provides a clean way to obtain control from the
907
+/// boot manager if the boot path is from the remote device.
908
+///
909
+struct _EFI_PXE_BASE_CODE_PROTOCOL {
910
+  ///
911
+  ///  The revision of the EFI_PXE_BASE_CODE_PROTOCOL. All future revisions must
912
+  ///  be backwards compatible. If a future version is not backwards compatible
913
+  ///  it is not the same GUID.
914
+  ///
915
+  UINT64                            Revision;
916
+  EFI_PXE_BASE_CODE_START           Start;
917
+  EFI_PXE_BASE_CODE_STOP            Stop;
918
+  EFI_PXE_BASE_CODE_DHCP            Dhcp;
919
+  EFI_PXE_BASE_CODE_DISCOVER        Discover;
920
+  EFI_PXE_BASE_CODE_MTFTP           Mtftp;
921
+  EFI_PXE_BASE_CODE_UDP_WRITE       UdpWrite;
922
+  EFI_PXE_BASE_CODE_UDP_READ        UdpRead;
923
+  EFI_PXE_BASE_CODE_SET_IP_FILTER   SetIpFilter;
924
+  EFI_PXE_BASE_CODE_ARP             Arp;
925
+  EFI_PXE_BASE_CODE_SET_PARAMETERS  SetParameters;
926
+  EFI_PXE_BASE_CODE_SET_STATION_IP  SetStationIp;
927
+  EFI_PXE_BASE_CODE_SET_PACKETS     SetPackets;
928
+  ///
929
+  /// The pointer to the EFI_PXE_BASE_CODE_MODE data for this device.
930
+  ///
931
+  EFI_PXE_BASE_CODE_MODE            *Mode;
932
+};
933
+
934
+extern EFI_GUID gEfiPxeBaseCodeProtocolGuid;
935
+
936
+#endif

+ 209
- 0
src/include/ipxe/efi/Protocol/TcgService.h Целия файл

@@ -0,0 +1,209 @@
1
+/** @file
2
+  TCG Service Protocol as defined in TCG_EFI_Protocol_1_20_Final
3
+  See http://trustedcomputinggroup.org for the latest specification
4
+
5
+Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6
+This program and the accompanying materials are licensed and made available under
7
+the terms and conditions of the BSD License that accompanies this distribution.
8
+The full text of the license may be found at
9
+http://opensource.org/licenses/bsd-license.php.
10
+
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 _TCG_SERVICE_PROTOCOL_H_
17
+#define _TCG_SERVICE_PROTOCOL_H_
18
+
19
+FILE_LICENCE ( BSD3 );
20
+
21
+#include <ipxe/efi/IndustryStandard/UefiTcgPlatform.h>
22
+
23
+#define EFI_TCG_PROTOCOL_GUID  \
24
+  {0xf541796d, 0xa62e, 0x4954, { 0xa7, 0x75, 0x95, 0x84, 0xf6, 0x1b, 0x9c, 0xdd } }
25
+
26
+typedef struct _EFI_TCG_PROTOCOL EFI_TCG_PROTOCOL;
27
+
28
+typedef struct {
29
+  UINT8  Major;
30
+  UINT8  Minor;
31
+  UINT8  RevMajor;
32
+  UINT8  RevMinor;
33
+} TCG_VERSION;
34
+
35
+typedef struct _TCG_EFI_BOOT_SERVICE_CAPABILITY {
36
+  UINT8          Size;                /// Size of this structure.
37
+  TCG_VERSION    StructureVersion;
38
+  TCG_VERSION    ProtocolSpecVersion;
39
+  UINT8          HashAlgorithmBitmap; /// Hash algorithms .
40
+                                      /// This protocol is capable of : 01=SHA-1.
41
+  BOOLEAN        TPMPresentFlag;      /// 00h = TPM not present.
42
+  BOOLEAN        TPMDeactivatedFlag;  /// 01h = TPM currently deactivated.
43
+} TCG_EFI_BOOT_SERVICE_CAPABILITY;
44
+
45
+typedef UINT32   TCG_ALGORITHM_ID;
46
+
47
+///
48
+/// Note:
49
+///   Status codes returned for functions of EFI_TCG_PROTOCOL do not exactly match
50
+///   those defined in the TCG EFI Protocol 1.20 Final Specification.
51
+///
52
+
53
+/**
54
+  This service provides EFI protocol capability information, state information
55
+  about the TPM, and Event Log state information.
56
+
57
+  @param  This                   Indicates the calling context
58
+  @param  ProtocolCapability     The callee allocates memory for a TCG_BOOT_SERVICE_CAPABILITY
59
+                                 structure and fills in the fields with the EFI protocol
60
+                                 capability information and the current TPM state information.
61
+  @param  TCGFeatureFlags        This is a pointer to the feature flags. No feature
62
+                                 flags are currently defined so this parameter
63
+                                 MUST be set to 0. However, in the future,
64
+                                 feature flags may be defined that, for example,
65
+                                 enable hash algorithm agility.
66
+  @param  EventLogLocation       This is a pointer to the address of the event log in memory.
67
+  @param  EventLogLastEntry      If the Event Log contains more than one entry,
68
+                                 this is a pointer to the address of the start of
69
+                                 the last entry in the event log in memory.
70
+
71
+  @retval EFI_SUCCESS            The operation completed successfully.
72
+  @retval EFI_INVALID_PARAMETER  ProtocolCapability does not match TCG capability.
73
+**/
74
+typedef
75
+EFI_STATUS
76
+(EFIAPI *EFI_TCG_STATUS_CHECK)(
77
+  IN      EFI_TCG_PROTOCOL          *This,
78
+  OUT     TCG_EFI_BOOT_SERVICE_CAPABILITY
79
+                                    *ProtocolCapability,
80
+  OUT     UINT32                    *TCGFeatureFlags,
81
+  OUT     EFI_PHYSICAL_ADDRESS      *EventLogLocation,
82
+  OUT     EFI_PHYSICAL_ADDRESS      *EventLogLastEntry
83
+  );
84
+
85
+/**
86
+  This service abstracts the capability to do a hash operation on a data buffer.
87
+
88
+  @param  This                   Indicates the calling context.
89
+  @param  HashData               The pointer to the data buffer to be hashed.
90
+  @param  HashDataLen            The length of the data buffer to be hashed.
91
+  @param  AlgorithmId            Identification of the Algorithm to use for the hashing operation.
92
+  @param  HashedDataLen          Resultant length of the hashed data.
93
+  @param  HashedDataResult       Resultant buffer of the hashed data.
94
+
95
+  @retval EFI_SUCCESS            The operation completed successfully.
96
+  @retval EFI_INVALID_PARAMETER  HashDataLen is NULL.
97
+  @retval EFI_INVALID_PARAMETER  HashDataLenResult is NULL.
98
+  @retval EFI_OUT_OF_RESOURCES   Cannot allocate buffer of size *HashedDataLen.
99
+  @retval EFI_UNSUPPORTED        AlgorithmId not supported.
100
+  @retval EFI_BUFFER_TOO_SMALL   *HashedDataLen < sizeof (TCG_DIGEST).
101
+**/
102
+typedef
103
+EFI_STATUS
104
+(EFIAPI *EFI_TCG_HASH_ALL)(
105
+  IN      EFI_TCG_PROTOCOL          *This,
106
+  IN      UINT8                     *HashData,
107
+  IN      UINT64                    HashDataLen,
108
+  IN      TCG_ALGORITHM_ID          AlgorithmId,
109
+  IN OUT  UINT64                    *HashedDataLen,
110
+  IN OUT  UINT8                     **HashedDataResult
111
+  );
112
+
113
+/**
114
+  This service abstracts the capability to add an entry to the Event Log.
115
+
116
+  @param  This                   Indicates the calling context
117
+  @param  TCGLogData             The pointer to the start of the data buffer containing
118
+                                 the TCG_PCR_EVENT data structure. All fields in
119
+                                 this structure are properly filled by the caller.
120
+  @param  EventNumber            The event number of the event just logged.
121
+  @param  Flags                  Indicates additional flags. Only one flag has been
122
+                                 defined at this time, which is 0x01 and means the
123
+                                 extend operation should not be performed. All
124
+                                 other bits are reserved.
125
+
126
+  @retval EFI_SUCCESS            The operation completed successfully.
127
+  @retval EFI_OUT_OF_RESOURCES   Insufficient memory in the event log to complete this action.
128
+**/
129
+typedef
130
+EFI_STATUS
131
+(EFIAPI *EFI_TCG_LOG_EVENT)(
132
+  IN      EFI_TCG_PROTOCOL          *This,
133
+  IN      TCG_PCR_EVENT             *TCGLogData,
134
+  IN OUT  UINT32                    *EventNumber,
135
+  IN      UINT32                    Flags
136
+  );
137
+
138
+/**
139
+  This service is a proxy for commands to the TPM.
140
+
141
+  @param  This                        Indicates the calling context.
142
+  @param  TpmInputParameterBlockSize  Size of the TPM input parameter block.
143
+  @param  TpmInputParameterBlock      The pointer to the TPM input parameter block.
144
+  @param  TpmOutputParameterBlockSize Size of the TPM output parameter block.
145
+  @param  TpmOutputParameterBlock     The pointer to the TPM output parameter block.
146
+
147
+  @retval EFI_SUCCESS            The operation completed successfully.
148
+  @retval EFI_INVALID_PARAMETER  Invalid ordinal.
149
+  @retval EFI_UNSUPPORTED        Current Task Priority Level  >= EFI_TPL_CALLBACK.
150
+  @retval EFI_TIMEOUT            The TIS timed-out.
151
+**/
152
+typedef
153
+EFI_STATUS
154
+(EFIAPI *EFI_TCG_PASS_THROUGH_TO_TPM)(
155
+  IN      EFI_TCG_PROTOCOL          *This,
156
+  IN      UINT32                    TpmInputParameterBlockSize,
157
+  IN      UINT8                     *TpmInputParameterBlock,
158
+  IN      UINT32                    TpmOutputParameterBlockSize,
159
+  IN      UINT8                     *TpmOutputParameterBlock
160
+  );
161
+
162
+/**
163
+  This service abstracts the capability to do a hash operation on a data buffer, extend a specific TPM PCR with the hash result, and add an entry to the Event Log
164
+
165
+  @param  This                   Indicates the calling context
166
+  @param  HashData               The physical address of the start of the data buffer
167
+                                 to be hashed, extended, and logged.
168
+  @param  HashDataLen            The length, in bytes, of the buffer referenced by HashData
169
+  @param  AlgorithmId            Identification of the Algorithm to use for the hashing operation
170
+  @param  TCGLogData             The physical address of the start of the data
171
+                                 buffer containing the TCG_PCR_EVENT data structure.
172
+  @param  EventNumber            The event number of the event just logged.
173
+  @param  EventLogLastEntry      The physical address of the first byte of the entry
174
+                                 just placed in the Event Log. If the Event Log was
175
+                                 empty when this function was called then this physical
176
+                                 address will be the same as the physical address of
177
+                                 the start of the Event Log.
178
+
179
+  @retval EFI_SUCCESS            The operation completed successfully.
180
+  @retval EFI_UNSUPPORTED        AlgorithmId != TPM_ALG_SHA.
181
+  @retval EFI_UNSUPPORTED        Current TPL >= EFI_TPL_CALLBACK.
182
+  @retval EFI_DEVICE_ERROR       The command was unsuccessful.
183
+**/
184
+typedef
185
+EFI_STATUS
186
+(EFIAPI *EFI_TCG_HASH_LOG_EXTEND_EVENT)(
187
+  IN      EFI_TCG_PROTOCOL          *This,
188
+  IN      EFI_PHYSICAL_ADDRESS      HashData,
189
+  IN      UINT64                    HashDataLen,
190
+  IN      TCG_ALGORITHM_ID          AlgorithmId,
191
+  IN OUT  TCG_PCR_EVENT             *TCGLogData,
192
+  IN OUT  UINT32                    *EventNumber,
193
+     OUT  EFI_PHYSICAL_ADDRESS      *EventLogLastEntry
194
+  );
195
+
196
+///
197
+/// The EFI_TCG Protocol abstracts TCG activity.
198
+///
199
+struct _EFI_TCG_PROTOCOL {
200
+  EFI_TCG_STATUS_CHECK              StatusCheck;
201
+  EFI_TCG_HASH_ALL                  HashAll;
202
+  EFI_TCG_LOG_EVENT                 LogEvent;
203
+  EFI_TCG_PASS_THROUGH_TO_TPM       PassThroughToTpm;
204
+  EFI_TCG_HASH_LOG_EXTEND_EVENT     HashLogExtendEvent;
205
+};
206
+
207
+extern EFI_GUID gEfiTcgProtocolGuid;
208
+
209
+#endif

+ 3
- 0
src/include/ipxe/efi/efi.h Целия файл

@@ -160,14 +160,17 @@ extern EFI_GUID efi_component_name2_protocol_guid;
160 160
 extern EFI_GUID efi_device_path_protocol_guid;
161 161
 extern EFI_GUID efi_disk_io_protocol_guid;
162 162
 extern EFI_GUID efi_driver_binding_protocol_guid;
163
+extern EFI_GUID efi_graphics_output_protocol_guid;
163 164
 extern EFI_GUID efi_load_file_protocol_guid;
164 165
 extern EFI_GUID efi_load_file2_protocol_guid;
165 166
 extern EFI_GUID efi_loaded_image_protocol_guid;
166 167
 extern EFI_GUID efi_loaded_image_device_path_protocol_guid;
167 168
 extern EFI_GUID efi_pci_io_protocol_guid;
168 169
 extern EFI_GUID efi_pci_root_bridge_io_protocol_guid;
170
+extern EFI_GUID efi_pxe_base_code_protocol_guid;
169 171
 extern EFI_GUID efi_simple_file_system_protocol_guid;
170 172
 extern EFI_GUID efi_simple_network_protocol_guid;
173
+extern EFI_GUID efi_tcg_protocol_guid;
171 174
 
172 175
 extern EFI_HANDLE efi_image_handle;
173 176
 extern EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image;

+ 6
- 0
src/interface/efi/efi_debug.c Целия файл

@@ -66,6 +66,8 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
66 66
 	  "DriverBinding" },
67 67
 	{ &efi_disk_io_protocol_guid,
68 68
 	  "DiskIo" },
69
+	{ &efi_graphics_output_protocol_guid,
70
+	  "GraphicsOutput" },
69 71
 	{ &efi_load_file_protocol_guid,
70 72
 	  "LoadFile" },
71 73
 	{ &efi_load_file2_protocol_guid,
@@ -78,10 +80,14 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
78 80
 	  "PciIo" },
79 81
 	{ &efi_pci_root_bridge_io_protocol_guid,
80 82
 	  "PciRootBridgeIo" },
83
+	{ &efi_pxe_base_code_protocol_guid,
84
+	  "PxeBaseCode" },
81 85
 	{ &efi_simple_file_system_protocol_guid,
82 86
 	  "SimpleFileSystem" },
83 87
 	{ &efi_simple_network_protocol_guid,
84 88
 	  "SimpleNetwork" },
89
+	{ &efi_tcg_protocol_guid,
90
+	  "Tcg" },
85 91
 };
86 92
 
87 93
 /**

+ 16
- 1
src/interface/efi/efi_guid.c Целия файл

@@ -28,13 +28,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
28 28
 #include <ipxe/efi/Protocol/DevicePathToText.h>
29 29
 #include <ipxe/efi/Protocol/DiskIo.h>
30 30
 #include <ipxe/efi/Protocol/DriverBinding.h>
31
+#include <ipxe/efi/Protocol/GraphicsOutput.h>
31 32
 #include <ipxe/efi/Protocol/LoadFile.h>
32 33
 #include <ipxe/efi/Protocol/LoadFile2.h>
33 34
 #include <ipxe/efi/Protocol/LoadedImage.h>
34 35
 #include <ipxe/efi/Protocol/PciIo.h>
35 36
 #include <ipxe/efi/Protocol/PciRootBridgeIo.h>
37
+#include <ipxe/efi/Protocol/PxeBaseCode.h>
36 38
 #include <ipxe/efi/Protocol/SimpleFileSystem.h>
37 39
 #include <ipxe/efi/Protocol/SimpleNetwork.h>
40
+#include <ipxe/efi/Protocol/TcgService.h>
38 41
 
39 42
 /** @file
40 43
  *
@@ -70,6 +73,10 @@ EFI_GUID efi_disk_io_protocol_guid
70 73
 EFI_GUID efi_driver_binding_protocol_guid
71 74
 	= EFI_DRIVER_BINDING_PROTOCOL_GUID;
72 75
 
76
+/** Graphics output protocol GUID */
77
+EFI_GUID efi_graphics_output_protocol_guid
78
+	= EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
79
+
73 80
 /** Load file protocol GUID */
74 81
 EFI_GUID efi_load_file_protocol_guid
75 82
 	= EFI_LOAD_FILE_PROTOCOL_GUID;
@@ -94,10 +101,18 @@ EFI_GUID efi_pci_io_protocol_guid
94 101
 EFI_GUID efi_pci_root_bridge_io_protocol_guid
95 102
 	= EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
96 103
 
104
+/** PXE base code protocol GUID */
105
+EFI_GUID efi_pxe_base_code_protocol_guid
106
+	= EFI_PXE_BASE_CODE_PROTOCOL_GUID;
107
+
97 108
 /** Simple file system protocol GUID */
98 109
 EFI_GUID efi_simple_file_system_protocol_guid
99 110
 	= EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
100 111
 
101
-/** Simple network protocol guid */
112
+/** Simple network protocol GUID */
102 113
 EFI_GUID efi_simple_network_protocol_guid
103 114
 	= EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
115
+
116
+/** TCG protocol GUID */
117
+EFI_GUID efi_tcg_protocol_guid
118
+	= EFI_TCG_PROTOCOL_GUID;

Loading…
Отказ
Запис