]>
Commit | Line | Data |
---|---|---|
d933e70a JW |
1 | /** @file\r |
2 | UEFI HTTP boot driver's private data structure and interfaces declaration.\r | |
3 | \r | |
f75a7f56 | 4 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
90f658c4 | 5 | (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r |
ecf98fbc | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d933e70a JW |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #ifndef __EFI_HTTP_BOOT_DXE_H__\r | |
11 | #define __EFI_HTTP_BOOT_DXE_H__\r | |
12 | \r | |
13 | #include <Uefi.h>\r | |
14 | \r | |
90f658c4 | 15 | #include <IndustryStandard/Http11.h>\r |
142c00c3 | 16 | #include <IndustryStandard/Dhcp.h>\r |
90f658c4 | 17 | \r |
d933e70a JW |
18 | //\r |
19 | // Libraries\r | |
20 | //\r | |
21 | #include <Library/UefiBootServicesTableLib.h>\r | |
fa848a40 FS |
22 | #include <Library/UefiHiiServicesLib.h>\r |
23 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
d933e70a JW |
24 | #include <Library/MemoryAllocationLib.h>\r |
25 | #include <Library/BaseLib.h>\r | |
26 | #include <Library/UefiLib.h>\r | |
27 | #include <Library/DevicePathLib.h>\r | |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/NetLib.h>\r | |
30 | #include <Library/HttpLib.h>\r | |
fa848a40 FS |
31 | #include <Library/HiiLib.h>\r |
32 | #include <Library/PrintLib.h>\r | |
5e9e151c | 33 | #include <Library/DpcLib.h>\r |
d933e70a JW |
34 | \r |
35 | //\r | |
36 | // UEFI Driver Model Protocols\r | |
37 | //\r | |
38 | #include <Protocol/DriverBinding.h>\r | |
39 | #include <Protocol/ComponentName2.h>\r | |
40 | #include <Protocol/ComponentName.h>\r | |
41 | \r | |
42 | //\r | |
43 | // Consumed Protocols\r | |
44 | //\r | |
fa848a40 FS |
45 | #include <Protocol/ServiceBinding.h>\r |
46 | #include <Protocol/HiiConfigAccess.h>\r | |
d933e70a JW |
47 | #include <Protocol/NetworkInterfaceIdentifier.h>\r |
48 | #include <Protocol/Dhcp4.h>\r | |
b659408b ZL |
49 | #include <Protocol/Dhcp6.h>\r |
50 | #include <Protocol/Dns6.h>\r | |
d933e70a JW |
51 | #include <Protocol/Http.h>\r |
52 | #include <Protocol/Ip4Config2.h>\r | |
b659408b | 53 | #include <Protocol/Ip6Config.h>\r |
587d204c | 54 | #include <Protocol/RamDisk.h>\r |
ed247d86 JW |
55 | #include <Protocol/AdapterInformation.h>\r |
56 | \r | |
d933e70a JW |
57 | //\r |
58 | // Produced Protocols\r | |
59 | //\r | |
60 | #include <Protocol/LoadFile.h>\r | |
95b5c32f | 61 | #include <Protocol/HttpBootCallback.h>\r |
d933e70a | 62 | \r |
fa848a40 FS |
63 | //\r |
64 | // Consumed Guids\r | |
65 | //\r | |
66 | #include <Guid/HttpBootConfigHii.h>\r | |
67 | \r | |
d933e70a JW |
68 | //\r |
69 | // Driver Version\r | |
70 | //\r | |
71 | #define HTTP_BOOT_DXE_VERSION 0xa\r | |
72 | \r | |
587d204c | 73 | //\r |
f75a7f56 | 74 | // Standard Media Types defined in\r |
b173ad78 | 75 | // http://www.iana.org/assignments/media-types\r |
587d204c FS |
76 | //\r |
77 | #define HTTP_CONTENT_TYPE_APP_EFI "application/efi"\r | |
b173ad78 JW |
78 | #define HTTP_CONTENT_TYPE_APP_IMG "application/vnd.efi-img"\r |
79 | #define HTTP_CONTENT_TYPE_APP_ISO "application/vnd.efi-iso"\r | |
587d204c | 80 | \r |
d933e70a JW |
81 | //\r |
82 | // Protocol instances\r | |
83 | //\r | |
84 | extern EFI_DRIVER_BINDING_PROTOCOL gHttpBootDxeDriverBinding;\r | |
85 | extern EFI_COMPONENT_NAME2_PROTOCOL gHttpBootDxeComponentName2;\r | |
86 | extern EFI_COMPONENT_NAME_PROTOCOL gHttpBootDxeComponentName;\r | |
87 | \r | |
88 | //\r | |
89 | // Private data structure\r | |
90 | //\r | |
91 | typedef struct _HTTP_BOOT_PRIVATE_DATA HTTP_BOOT_PRIVATE_DATA;\r | |
b659408b | 92 | typedef struct _HTTP_BOOT_VIRTUAL_NIC HTTP_BOOT_VIRTUAL_NIC;\r |
d933e70a | 93 | \r |
587d204c FS |
94 | typedef enum {\r |
95 | ImageTypeEfi,\r | |
96 | ImageTypeVirtualCd,\r | |
97 | ImageTypeVirtualDisk,\r | |
98 | ImageTypeMax\r | |
99 | } HTTP_BOOT_IMAGE_TYPE;\r | |
100 | \r | |
d933e70a JW |
101 | //\r |
102 | // Include files with internal function prototypes\r | |
103 | //\r | |
104 | #include "HttpBootComponentName.h"\r | |
105 | #include "HttpBootDhcp4.h"\r | |
b659408b | 106 | #include "HttpBootDhcp6.h"\r |
d933e70a JW |
107 | #include "HttpBootImpl.h"\r |
108 | #include "HttpBootSupport.h"\r | |
109 | #include "HttpBootClient.h"\r | |
fa848a40 | 110 | #include "HttpBootConfig.h"\r |
d933e70a JW |
111 | \r |
112 | typedef union {\r | |
113 | HTTP_BOOT_DHCP4_PACKET_CACHE Dhcp4;\r | |
b659408b | 114 | HTTP_BOOT_DHCP6_PACKET_CACHE Dhcp6;\r |
d933e70a JW |
115 | } HTTP_BOOT_DHCP_PACKET_CACHE;\r |
116 | \r | |
b659408b ZL |
117 | struct _HTTP_BOOT_VIRTUAL_NIC {\r |
118 | UINT32 Signature;\r | |
119 | EFI_HANDLE Controller;\r | |
75372581 | 120 | EFI_HANDLE ImageHandle;\r |
b659408b ZL |
121 | EFI_LOAD_FILE_PROTOCOL LoadFile;\r |
122 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
123 | HTTP_BOOT_PRIVATE_DATA *Private;\r | |
124 | };\r | |
125 | \r | |
fa848a40 FS |
126 | #define HTTP_BOOT_PRIVATE_DATA_FROM_CALLBACK_INFO(Callback) \\r |
127 | CR ( \\r | |
128 | Callback, \\r | |
129 | HTTP_BOOT_PRIVATE_DATA, \\r | |
130 | CallbackInfo, \\r | |
131 | HTTP_BOOT_PRIVATE_DATA_SIGNATURE \\r | |
132 | )\r | |
f75a7f56 | 133 | \r |
95b5c32f FS |
134 | #define HTTP_BOOT_PRIVATE_DATA_FROM_CALLBACK_PROTOCOL(CallbackProtocol) \\r |
135 | CR ( \\r | |
136 | CallbackProtocol, \\r | |
137 | HTTP_BOOT_PRIVATE_DATA, \\r | |
138 | LoadFileCallback, \\r | |
139 | HTTP_BOOT_PRIVATE_DATA_SIGNATURE \\r | |
140 | )\r | |
fa848a40 | 141 | \r |
d933e70a JW |
142 | struct _HTTP_BOOT_PRIVATE_DATA {\r |
143 | UINT32 Signature;\r | |
144 | EFI_HANDLE Controller;\r | |
d933e70a | 145 | \r |
b659408b ZL |
146 | HTTP_BOOT_VIRTUAL_NIC *Ip4Nic;\r |
147 | HTTP_BOOT_VIRTUAL_NIC *Ip6Nic;\r | |
148 | \r | |
d933e70a JW |
149 | //\r |
150 | // Cousumed children\r | |
151 | //\r | |
b659408b | 152 | EFI_HANDLE Ip6Child;\r |
d933e70a | 153 | EFI_HANDLE Dhcp4Child;\r |
b659408b | 154 | EFI_HANDLE Dhcp6Child;\r |
d933e70a JW |
155 | HTTP_IO HttpIo;\r |
156 | BOOLEAN HttpCreated;\r | |
157 | \r | |
158 | //\r | |
159 | // Consumed protocol\r | |
160 | //\r | |
161 | EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL *Nii;\r | |
b659408b | 162 | EFI_IP6_PROTOCOL *Ip6;\r |
d933e70a | 163 | EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;\r |
b659408b | 164 | EFI_IP6_CONFIG_PROTOCOL *Ip6Config;\r |
d933e70a | 165 | EFI_DHCP4_PROTOCOL *Dhcp4;\r |
b659408b | 166 | EFI_DHCP6_PROTOCOL *Dhcp6;\r |
d933e70a JW |
167 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r |
168 | \r | |
f75a7f56 | 169 | \r |
d933e70a JW |
170 | //\r |
171 | // Produced protocol\r | |
172 | //\r | |
173 | EFI_LOAD_FILE_PROTOCOL LoadFile;\r | |
174 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
175 | UINT32 Id;\r | |
95b5c32f FS |
176 | EFI_HTTP_BOOT_CALLBACK_PROTOCOL *HttpBootCallback;\r |
177 | EFI_HTTP_BOOT_CALLBACK_PROTOCOL LoadFileCallback;\r | |
bb4831c0 FS |
178 | \r |
179 | //\r | |
180 | // Data for the default HTTP Boot callback protocol\r | |
181 | //\r | |
95b5c32f FS |
182 | UINT64 FileSize;\r |
183 | UINT64 ReceivedSize;\r | |
184 | UINT32 Percentage;\r | |
d933e70a | 185 | \r |
fa848a40 FS |
186 | //\r |
187 | // HII callback info block\r | |
188 | //\r | |
189 | HTTP_BOOT_FORM_CALLBACK_INFO CallbackInfo;\r | |
190 | \r | |
d933e70a JW |
191 | //\r |
192 | // Mode data\r | |
193 | //\r | |
194 | BOOLEAN UsingIpv6;\r | |
195 | BOOLEAN Started;\r | |
196 | EFI_IP_ADDRESS StationIp;\r | |
197 | EFI_IP_ADDRESS SubnetMask;\r | |
198 | EFI_IP_ADDRESS GatewayIp;\r | |
b659408b | 199 | EFI_IP_ADDRESS ServerIp;\r |
d933e70a | 200 | UINT16 Port;\r |
7b1dbd15 JW |
201 | UINT32 DnsServerCount;\r |
202 | EFI_IP_ADDRESS *DnsServerIp;\r | |
587d204c FS |
203 | \r |
204 | //\r | |
205 | // The URI string attempt to download through HTTP, may point to\r | |
206 | // the memory in cached DHCP offer, or to the memory in FilePathUri.\r | |
207 | //\r | |
d933e70a JW |
208 | CHAR8 *BootFileUri;\r |
209 | VOID *BootFileUriParser;\r | |
210 | UINTN BootFileSize;\r | |
b659408b | 211 | BOOLEAN NoGateway;\r |
44a7d08b | 212 | HTTP_BOOT_IMAGE_TYPE ImageType;\r |
d933e70a | 213 | \r |
fa848a40 FS |
214 | //\r |
215 | // URI string extracted from the input FilePath parameter.\r | |
216 | //\r | |
217 | CHAR8 *FilePathUri;\r | |
218 | VOID *FilePathUriParser;\r | |
219 | \r | |
d933e70a JW |
220 | //\r |
221 | // Cached HTTP data\r | |
222 | //\r | |
223 | LIST_ENTRY CacheList;\r | |
224 | \r | |
225 | //\r | |
226 | // Cached DHCP offer\r | |
227 | //\r | |
228 | // OfferIndex records the index of DhcpOffer[] buffer, and OfferCount records the num of each type of offer.\r | |
229 | //\r | |
230 | // It supposed that\r | |
231 | //\r | |
232 | // OfferNum: 8\r | |
233 | // OfferBuffer: [ProxyNameUri, DhcpNameUri, DhcpIpUri, ProxyNameUri, ProxyIpUri, DhcpOnly, DhcpIpUri, DhcpNameUriDns]\r | |
234 | // (OfferBuffer is 0-based.)\r | |
235 | //\r | |
236 | // And assume that (DhcpIpUri is the first priority actually.)\r | |
237 | //\r | |
238 | // SelectIndex: 5\r | |
239 | // SelectProxyType: HttpOfferTypeProxyIpUri\r | |
240 | // (SelectIndex is 1-based, and 0 means no one is selected.)\r | |
241 | //\r | |
242 | // So it should be\r | |
243 | //\r | |
244 | // DhcpIpUri DhcpNameUriDns DhcpDns DhcpOnly ProxyNameUri ProxyIpUri DhcpNameUri\r | |
245 | // OfferCount: [ 2, 1, 0, 1, 2, 1, 1]\r | |
246 | //\r | |
247 | // OfferIndex: {[ 2, 7, 0, 5, 0, *4, 1]\r | |
248 | // [ 6, 0, 0, 0, 3, 0, 0]\r | |
249 | // [ 0, 0, 0, 0, 0, 0, 0]\r | |
250 | // ... ]}\r | |
251 | // (OfferIndex is 0-based.)\r | |
252 | //\r | |
253 | //\r | |
254 | UINT32 SelectIndex;\r | |
255 | UINT32 SelectProxyType;\r | |
256 | HTTP_BOOT_DHCP_PACKET_CACHE OfferBuffer[HTTP_BOOT_OFFER_MAX_NUM];\r | |
257 | UINT32 OfferNum;\r | |
258 | UINT32 OfferCount[HttpOfferTypeMax];\r | |
259 | UINT32 OfferIndex[HttpOfferTypeMax][HTTP_BOOT_OFFER_MAX_NUM];\r | |
260 | };\r | |
261 | \r | |
262 | #define HTTP_BOOT_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'B', 'P', 'D')\r | |
b659408b | 263 | #define HTTP_BOOT_VIRTUAL_NIC_SIGNATURE SIGNATURE_32 ('H', 'B', 'V', 'N')\r |
d933e70a JW |
264 | #define HTTP_BOOT_PRIVATE_DATA_FROM_LOADFILE(a) CR (a, HTTP_BOOT_PRIVATE_DATA, LoadFile, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)\r |
265 | #define HTTP_BOOT_PRIVATE_DATA_FROM_ID(a) CR (a, HTTP_BOOT_PRIVATE_DATA, Id, HTTP_BOOT_PRIVATE_DATA_SIGNATURE)\r | |
b659408b | 266 | #define HTTP_BOOT_VIRTUAL_NIC_FROM_LOADFILE(a) CR (a, HTTP_BOOT_VIRTUAL_NIC, LoadFile, HTTP_BOOT_VIRTUAL_NIC_SIGNATURE)\r |
d933e70a JW |
267 | extern EFI_LOAD_FILE_PROTOCOL gHttpBootDxeLoadFile;\r |
268 | \r | |
269 | /**\r | |
f75a7f56 | 270 | Tests to see if this driver supports a given controller. If a child device is provided,\r |
d933e70a JW |
271 | it further tests to see if this driver supports creating a handle for the specified child device.\r |
272 | \r | |
f75a7f56 LG |
273 | This function checks to see if the driver specified by This supports the device specified by\r |
274 | ControllerHandle. Drivers will typically use the device path attached to\r | |
275 | ControllerHandle and/or the services from the bus I/O abstraction attached to\r | |
276 | ControllerHandle to determine if the driver supports ControllerHandle. This function\r | |
277 | may be called many times during platform initialization. In order to reduce boot times, the tests\r | |
278 | performed by this function must be very small, and take as little time as possible to execute. This\r | |
279 | function must not change the state of any hardware devices, and this function must be aware that the\r | |
280 | device specified by ControllerHandle may already be managed by the same driver or a\r | |
281 | different driver. This function must match its calls to AllocatePages() with FreePages(),\r | |
282 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r | |
283 | Because ControllerHandle may have been previously started by the same driver, if a protocol is\r | |
284 | already in the opened state, then it must not be closed with CloseProtocol(). This is required\r | |
d933e70a JW |
285 | to guarantee the state of ControllerHandle is not modified by this function.\r |
286 | \r | |
287 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
f75a7f56 LG |
288 | @param[in] ControllerHandle The handle of the controller to test. This handle\r |
289 | must support a protocol interface that supplies\r | |
d933e70a | 290 | an I/O abstraction to the driver.\r |
f75a7f56 LG |
291 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
292 | parameter is ignored by device drivers, and is optional for bus\r | |
293 | drivers. For bus drivers, if this parameter is not NULL, then\r | |
294 | the bus driver must determine if the bus controller specified\r | |
295 | by ControllerHandle and the child controller specified\r | |
296 | by RemainingDevicePath are both supported by this\r | |
d933e70a JW |
297 | bus driver.\r |
298 | \r | |
299 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
300 | RemainingDevicePath is supported by the driver specified by This.\r | |
301 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
302 | RemainingDevicePath is already being managed by the driver\r | |
303 | specified by This.\r | |
304 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
305 | RemainingDevicePath is already being managed by a different\r | |
306 | driver or an application that requires exclusive access.\r | |
307 | Currently not implemented.\r | |
308 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
309 | RemainingDevicePath is not supported by the driver specified by This.\r | |
310 | **/\r | |
311 | EFI_STATUS\r | |
312 | EFIAPI\r | |
313 | HttpBootIp4DxeDriverBindingSupported (\r | |
314 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
315 | IN EFI_HANDLE ControllerHandle,\r | |
316 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
317 | );\r | |
318 | \r | |
319 | /**\r | |
320 | Starts a device controller or a bus controller.\r | |
321 | \r | |
322 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
f75a7f56 LG |
323 | As a result, much of the error checking on the parameters to Start() has been moved into this\r |
324 | common boot service. It is legal to call Start() from other locations,\r | |
d933e70a JW |
325 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r |
326 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
327 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
328 | EFI_DEVICE_PATH_PROTOCOL.\r | |
329 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
f75a7f56 | 330 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r |
d933e70a JW |
331 | \r |
332 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
f75a7f56 LG |
333 | @param[in] ControllerHandle The handle of the controller to start. This handle\r |
334 | must support a protocol interface that supplies\r | |
d933e70a | 335 | an I/O abstraction to the driver.\r |
f75a7f56 LG |
336 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
337 | parameter is ignored by device drivers, and is optional for bus\r | |
338 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
339 | for all the children of Controller are created by this driver.\r | |
340 | If this parameter is not NULL and the first Device Path Node is\r | |
341 | not the End of Device Path Node, then only the handle for the\r | |
342 | child device specified by the first Device Path Node of\r | |
d933e70a | 343 | RemainingDevicePath is created by this driver.\r |
f75a7f56 | 344 | If the first Device Path Node of RemainingDevicePath is\r |
d933e70a JW |
345 | the End of Device Path Node, no child handle is created by this\r |
346 | driver.\r | |
347 | \r | |
348 | @retval EFI_SUCCESS The device was started.\r | |
349 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
350 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
351 | @retval Others The driver failded to start the device.\r | |
352 | \r | |
353 | **/\r | |
354 | EFI_STATUS\r | |
355 | EFIAPI\r | |
356 | HttpBootIp4DxeDriverBindingStart (\r | |
357 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
358 | IN EFI_HANDLE ControllerHandle,\r | |
359 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
360 | );\r | |
361 | \r | |
362 | /**\r | |
363 | Stops a device controller or a bus controller.\r | |
f75a7f56 LG |
364 | \r |
365 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r | |
366 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
367 | into this common boot service. It is legal to call Stop() from other locations,\r | |
d933e70a JW |
368 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r |
369 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
370 | same driver's Start() function.\r | |
371 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
372 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
373 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
374 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
f75a7f56 | 375 | \r |
d933e70a | 376 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r |
f75a7f56 LG |
377 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r |
378 | support a bus specific I/O protocol for the driver\r | |
d933e70a JW |
379 | to use to stop the device.\r |
380 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
f75a7f56 | 381 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r |
d933e70a JW |
382 | if NumberOfChildren is 0.\r |
383 | \r | |
384 | @retval EFI_SUCCESS The device was stopped.\r | |
385 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
386 | \r | |
387 | **/\r | |
388 | EFI_STATUS\r | |
389 | EFIAPI\r | |
390 | HttpBootIp4DxeDriverBindingStop (\r | |
391 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
392 | IN EFI_HANDLE ControllerHandle,\r | |
393 | IN UINTN NumberOfChildren,\r | |
394 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r | |
395 | );\r | |
396 | \r | |
b659408b | 397 | /**\r |
f75a7f56 | 398 | Tests to see if this driver supports a given controller. If a child device is provided,\r |
b659408b ZL |
399 | it further tests to see if this driver supports creating a handle for the specified child device.\r |
400 | \r | |
f75a7f56 LG |
401 | This function checks to see if the driver specified by This supports the device specified by\r |
402 | ControllerHandle. Drivers will typically use the device path attached to\r | |
403 | ControllerHandle and/or the services from the bus I/O abstraction attached to\r | |
404 | ControllerHandle to determine if the driver supports ControllerHandle. This function\r | |
405 | may be called many times during platform initialization. In order to reduce boot times, the tests\r | |
406 | performed by this function must be very small, and take as little time as possible to execute. This\r | |
407 | function must not change the state of any hardware devices, and this function must be aware that the\r | |
408 | device specified by ControllerHandle may already be managed by the same driver or a\r | |
409 | different driver. This function must match its calls to AllocatePages() with FreePages(),\r | |
410 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r | |
411 | Because ControllerHandle may have been previously started by the same driver, if a protocol is\r | |
412 | already in the opened state, then it must not be closed with CloseProtocol(). This is required\r | |
b659408b ZL |
413 | to guarantee the state of ControllerHandle is not modified by this function.\r |
414 | \r | |
415 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
f75a7f56 LG |
416 | @param[in] ControllerHandle The handle of the controller to test. This handle\r |
417 | must support a protocol interface that supplies\r | |
b659408b | 418 | an I/O abstraction to the driver.\r |
f75a7f56 LG |
419 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
420 | parameter is ignored by device drivers, and is optional for bus\r | |
421 | drivers. For bus drivers, if this parameter is not NULL, then\r | |
422 | the bus driver must determine if the bus controller specified\r | |
423 | by ControllerHandle and the child controller specified\r | |
424 | by RemainingDevicePath are both supported by this\r | |
b659408b ZL |
425 | bus driver.\r |
426 | \r | |
427 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
428 | RemainingDevicePath is supported by the driver specified by This.\r | |
429 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
430 | RemainingDevicePath is already being managed by the driver\r | |
431 | specified by This.\r | |
432 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
433 | RemainingDevicePath is already being managed by a different\r | |
434 | driver or an application that requires exclusive access.\r | |
435 | Currently not implemented.\r | |
436 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
437 | RemainingDevicePath is not supported by the driver specified by This.\r | |
438 | **/\r | |
439 | EFI_STATUS\r | |
440 | EFIAPI\r | |
441 | HttpBootIp6DxeDriverBindingSupported (\r | |
442 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
443 | IN EFI_HANDLE ControllerHandle,\r | |
444 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
445 | );\r | |
446 | \r | |
447 | /**\r | |
448 | Starts a device controller or a bus controller.\r | |
449 | \r | |
450 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
f75a7f56 LG |
451 | As a result, much of the error checking on the parameters to Start() has been moved into this\r |
452 | common boot service. It is legal to call Start() from other locations,\r | |
b659408b ZL |
453 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r |
454 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
455 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
456 | EFI_DEVICE_PATH_PROTOCOL.\r | |
457 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
f75a7f56 | 458 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r |
b659408b ZL |
459 | \r |
460 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
f75a7f56 LG |
461 | @param[in] ControllerHandle The handle of the controller to start. This handle\r |
462 | must support a protocol interface that supplies\r | |
b659408b | 463 | an I/O abstraction to the driver.\r |
f75a7f56 LG |
464 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
465 | parameter is ignored by device drivers, and is optional for bus\r | |
466 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
467 | for all the children of Controller are created by this driver.\r | |
468 | If this parameter is not NULL and the first Device Path Node is\r | |
469 | not the End of Device Path Node, then only the handle for the\r | |
470 | child device specified by the first Device Path Node of\r | |
b659408b | 471 | RemainingDevicePath is created by this driver.\r |
f75a7f56 | 472 | If the first Device Path Node of RemainingDevicePath is\r |
b659408b ZL |
473 | the End of Device Path Node, no child handle is created by this\r |
474 | driver.\r | |
475 | \r | |
476 | @retval EFI_SUCCESS The device was started.\r | |
477 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
478 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
479 | @retval Others The driver failded to start the device.\r | |
480 | \r | |
481 | **/\r | |
482 | EFI_STATUS\r | |
483 | EFIAPI\r | |
484 | HttpBootIp6DxeDriverBindingStart (\r | |
485 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
486 | IN EFI_HANDLE ControllerHandle,\r | |
487 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r | |
488 | );\r | |
489 | \r | |
490 | /**\r | |
491 | Stops a device controller or a bus controller.\r | |
f75a7f56 LG |
492 | \r |
493 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r | |
494 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
495 | into this common boot service. It is legal to call Stop() from other locations,\r | |
b659408b ZL |
496 | but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r |
497 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
498 | same driver's Start() function.\r | |
499 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
500 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
501 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
502 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
f75a7f56 | 503 | \r |
b659408b | 504 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r |
f75a7f56 LG |
505 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r |
506 | support a bus specific I/O protocol for the driver\r | |
b659408b ZL |
507 | to use to stop the device.\r |
508 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
f75a7f56 | 509 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r |
b659408b ZL |
510 | if NumberOfChildren is 0.\r |
511 | \r | |
512 | @retval EFI_SUCCESS The device was stopped.\r | |
513 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
514 | \r | |
515 | **/\r | |
516 | EFI_STATUS\r | |
517 | EFIAPI\r | |
518 | HttpBootIp6DxeDriverBindingStop (\r | |
519 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
520 | IN EFI_HANDLE ControllerHandle,\r | |
521 | IN UINTN NumberOfChildren,\r | |
522 | IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r | |
523 | );\r | |
d933e70a | 524 | #endif\r |