TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpBootDxe.h
Go to the documentation of this file.
1
10#ifndef __EFI_HTTP_BOOT_DXE_H__
11#define __EFI_HTTP_BOOT_DXE_H__
12
13#include <Uefi.h>
14
17
18//
19// Libraries
20//
25#include <Library/BaseLib.h>
26#include <Library/UefiLib.h>
28#include <Library/DebugLib.h>
29#include <Library/NetLib.h>
30#include <Library/HttpLib.h>
31#include <Library/HttpIoLib.h>
32#include <Library/HiiLib.h>
33#include <Library/PrintLib.h>
34#include <Library/DpcLib.h>
35
36//
37// UEFI Driver Model Protocols
38//
42
43//
44// Consumed Protocols
45//
49#include <Protocol/Dhcp4.h>
50#include <Protocol/Dhcp6.h>
51#include <Protocol/Dns6.h>
52#include <Protocol/Http.h>
53#include <Protocol/Ip4Config2.h>
54#include <Protocol/Ip6Config.h>
55#include <Protocol/RamDisk.h>
57
58//
59// Produced Protocols
60//
61#include <Protocol/LoadFile.h>
63
64//
65// Consumed Guids
66//
68
69//
70// Driver Version
71//
72#define HTTP_BOOT_DXE_VERSION 0xa
73
74//
75// Standard Media Types defined in
76// http://www.iana.org/assignments/media-types
77//
78#define HTTP_CONTENT_TYPE_APP_EFI "application/efi"
79#define HTTP_CONTENT_TYPE_APP_IMG "application/vnd.efi-img"
80#define HTTP_CONTENT_TYPE_APP_ISO "application/vnd.efi-iso"
81
82//
83// Protocol instances
84//
85extern EFI_DRIVER_BINDING_PROTOCOL gHttpBootDxeDriverBinding;
88
89//
90// Private data structure
91//
94
95typedef enum {
96 ImageTypeEfi,
97 ImageTypeVirtualCd,
98 ImageTypeVirtualDisk,
99 ImageTypeMax
100} HTTP_BOOT_IMAGE_TYPE;
101
102//
103// Include files with internal function prototypes
104//
106#include "HttpBootDhcp4.h"
107#include "HttpBootDhcp6.h"
108#include "HttpBootImpl.h"
109#include "HttpBootSupport.h"
110#include "HttpBootClient.h"
111#include "HttpBootConfig.h"
112
113typedef union {
117
119 UINT32 Signature;
120 EFI_HANDLE Controller;
121 EFI_HANDLE ImageHandle;
122 EFI_LOAD_FILE_PROTOCOL LoadFile;
123 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
124 HTTP_BOOT_PRIVATE_DATA *Private;
125};
126
127#define HTTP_BOOT_PRIVATE_DATA_FROM_CALLBACK_INFO(Callback) \
128 CR ( \
129 Callback, \
130 HTTP_BOOT_PRIVATE_DATA, \
131 CallbackInfo, \
132 HTTP_BOOT_PRIVATE_DATA_SIGNATURE \
133 )
134
135#define HTTP_BOOT_PRIVATE_DATA_FROM_CALLBACK_PROTOCOL(CallbackProtocol) \
136 CR ( \
137 CallbackProtocol, \
138 HTTP_BOOT_PRIVATE_DATA, \
139 LoadFileCallback, \
140 HTTP_BOOT_PRIVATE_DATA_SIGNATURE \
141 )
142
144 UINT32 Signature;
145 EFI_HANDLE Controller;
146
147 HTTP_BOOT_VIRTUAL_NIC *Ip4Nic;
148 HTTP_BOOT_VIRTUAL_NIC *Ip6Nic;
149
150 //
151 // Consumed children
152 //
153 EFI_HANDLE Ip6Child;
154 EFI_HANDLE Dhcp4Child;
155 EFI_HANDLE Dhcp6Child;
156 HTTP_IO HttpIo;
157 BOOLEAN HttpCreated;
158
159 //
160 // Consumed protocol
161 //
163 EFI_IP6_PROTOCOL *Ip6;
164 EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
165 EFI_IP6_CONFIG_PROTOCOL *Ip6Config;
166 EFI_DHCP4_PROTOCOL *Dhcp4;
167 EFI_DHCP6_PROTOCOL *Dhcp6;
168 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
169
170 //
171 // Produced protocol
172 //
173 EFI_LOAD_FILE_PROTOCOL LoadFile;
174 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
175 UINT32 Id;
176 EFI_HTTP_BOOT_CALLBACK_PROTOCOL *HttpBootCallback;
177 EFI_HTTP_BOOT_CALLBACK_PROTOCOL LoadFileCallback;
178
179 //
180 // Data for the default HTTP Boot callback protocol
181 //
182 UINT64 FileSize;
183 UINT64 ReceivedSize;
184 UINT32 Percentage;
185
186 //
187 // Data for the server to authenticate the client
188 //
189 CHAR8 *AuthData;
190 CHAR8 *AuthScheme;
191
192 //
193 // HII callback info block
194 //
195 HTTP_BOOT_FORM_CALLBACK_INFO CallbackInfo;
196
197 //
198 // Mode data
199 //
200 BOOLEAN UsingIpv6;
201 BOOLEAN Started;
202 EFI_IP_ADDRESS StationIp;
203 EFI_IP_ADDRESS SubnetMask;
204 EFI_IP_ADDRESS GatewayIp;
205 EFI_IP_ADDRESS ServerIp;
206 UINT16 Port;
207 UINT32 DnsServerCount;
208 EFI_IP_ADDRESS *DnsServerIp;
209
210 //
211 // The URI string attempt to download through HTTP, may point to
212 // the memory in cached DHCP offer, or to the memory in FilePathUri.
213 //
214 CHAR8 *BootFileUri;
215 VOID *BootFileUriParser;
216 UINTN BootFileSize;
217 UINTN PartialTransferredSize;
218 CHAR8 *LastModifiedOrEtag;
219 BOOLEAN NoGateway;
220 HTTP_BOOT_IMAGE_TYPE ImageType;
221
222 //
223 // URI string extracted from the input FilePath parameter.
224 //
225 CHAR8 *FilePathUri;
226 VOID *FilePathUriParser;
227
228 //
229 // Cached HTTP data
230 //
231 LIST_ENTRY CacheList;
232
233 //
234 // Cached DHCP offer
235 //
236 // OfferIndex records the index of DhcpOffer[] buffer, and OfferCount records the num of each type of offer.
237 //
238 // It supposed that
239 //
240 // OfferNum: 8
241 // OfferBuffer: [ProxyNameUri, DhcpNameUri, DhcpIpUri, ProxyNameUri, ProxyIpUri, DhcpOnly, DhcpIpUri, DhcpNameUriDns]
242 // (OfferBuffer is 0-based.)
243 //
244 // And assume that (DhcpIpUri is the first priority actually.)
245 //
246 // SelectIndex: 5
247 // SelectProxyType: HttpOfferTypeProxyIpUri
248 // (SelectIndex is 1-based, and 0 means no one is selected.)
249 //
250 // So it should be
251 //
252 // DhcpIpUri DhcpNameUriDns DhcpDns DhcpOnly ProxyNameUri ProxyIpUri DhcpNameUri
253 // OfferCount: [ 2, 1, 0, 1, 2, 1, 1]
254 //
255 // OfferIndex: {[ 2, 7, 0, 5, 0, *4, 1]
256 // [ 6, 0, 0, 0, 3, 0, 0]
257 // [ 0, 0, 0, 0, 0, 0, 0]
258 // ... ]}
259 // (OfferIndex is 0-based.)
260 //
261 //
262 UINT32 SelectIndex;
263 UINT32 SelectProxyType;
264 HTTP_BOOT_DHCP_PACKET_CACHE OfferBuffer[HTTP_BOOT_OFFER_MAX_NUM];
265 UINT32 OfferNum;
266 UINT32 OfferCount[HttpOfferTypeMax];
267 UINT32 OfferIndex[HttpOfferTypeMax][HTTP_BOOT_OFFER_MAX_NUM];
268};
269
270#define HTTP_BOOT_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'B', 'P', 'D')
271#define HTTP_BOOT_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('H', 'B', 'V', 'N')
272#define HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, HTTP_BOOT_PRIVATE_DATA, LoadFile, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)
273#define HTTP_BOOT_PRIVATE_DATA_FROM_ID(a) CR (a, HTTP_BOOT_PRIVATE_DATA, Id, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)
274#define HTTP_BOOT_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, HTTP_BOOT_VIRTUAL_NIC, LoadFile, HTTP_BOOT_VIRTUAL_NIC_SIGNATURE)
276
320EFIAPI
323 IN EFI_HANDLE ControllerHandle,
324 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
325 );
326
363EFIAPI
366 IN EFI_HANDLE ControllerHandle,
367 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
368 );
369
397EFIAPI
400 IN EFI_HANDLE ControllerHandle,
401 IN UINTN NumberOfChildren,
402 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
403 );
404
448EFIAPI
451 IN EFI_HANDLE ControllerHandle,
452 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
453 );
454
491EFIAPI
494 IN EFI_HANDLE ControllerHandle,
495 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
496 );
497
525EFIAPI
528 IN EFI_HANDLE ControllerHandle,
529 IN UINTN NumberOfChildren,
530 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
531 );
532
533#endif
UINT64 UINTN
EFI_STATUS EFIAPI HttpBootIp6DxeDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
Definition: HttpBootDxe.c:1189
EFI_STATUS EFIAPI HttpBootIp4DxeDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
Definition: HttpBootDxe.c:657
EFI_STATUS EFIAPI HttpBootIp4DxeDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: HttpBootDxe.c:300
EFI_STATUS EFIAPI HttpBootIp6DxeDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: HttpBootDxe.c:790
EFI_LOAD_FILE_PROTOCOL gHttpBootDxeLoadFile
Definition: HttpBootImpl.c:759
EFI_COMPONENT_NAME2_PROTOCOL gHttpBootDxeComponentName2
EFI_STATUS EFIAPI HttpBootIp4DxeDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: HttpBootDxe.c:384
EFI_COMPONENT_NAME_PROTOCOL gHttpBootDxeComponentName
EFI_STATUS EFIAPI HttpBootIp6DxeDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
Definition: HttpBootDxe.c:874
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33