]> git.proxmox.com Git - mirror_edk2.git/blob - NetworkPkg/HttpDxe/HttpDriver.c
NetworkPkg: Code logic optimization for DnsDxe and HttpDxe driver
[mirror_edk2.git] / NetworkPkg / HttpDxe / HttpDriver.c
1 /** @file
2 The driver binding and service binding protocol for HttpDxe driver.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include "HttpDriver.h"
17
18 ///
19 /// Driver Binding Protocol instance
20 ///
21 EFI_DRIVER_BINDING_PROTOCOL gHttpDxeDriverBinding = {
22 HttpDxeDriverBindingSupported,
23 HttpDxeDriverBindingStart,
24 HttpDxeDriverBindingStop,
25 HTTP_DRIVER_VERSION,
26 NULL,
27 NULL
28 };
29
30 /**
31 Create a HTTP driver service binding private instance.
32
33 @param[in] Controller The controller that has TCP4 service binding
34 installed.
35 @param[in] ImageHandle The HTTP driver's image handle.
36 @param[out] ServiceData Point to HTTP driver private instance.
37
38 @retval EFI_OUT_OF_RESOURCES Failed to allocate some resources.
39 @retval EFI_SUCCESS A new HTTP driver private instance is created.
40
41 **/
42 EFI_STATUS
43 HttpCreateService (
44 IN EFI_HANDLE Controller,
45 IN EFI_HANDLE ImageHandle,
46 OUT HTTP_SERVICE **ServiceData
47 )
48 {
49 HTTP_SERVICE *HttpService;
50
51 ASSERT (ServiceData != NULL);
52 *ServiceData = NULL;
53
54 HttpService = AllocateZeroPool (sizeof (HTTP_SERVICE));
55 if (HttpService == NULL) {
56 return EFI_OUT_OF_RESOURCES;
57 }
58
59 HttpService->Signature = HTTP_SERVICE_SIGNATURE;
60 HttpService->ServiceBinding.CreateChild = HttpServiceBindingCreateChild;
61 HttpService->ServiceBinding.DestroyChild = HttpServiceBindingDestroyChild;
62 HttpService->ImageHandle = ImageHandle;
63 HttpService->ControllerHandle = Controller;
64 HttpService->ChildrenNumber = 0;
65 InitializeListHead (&HttpService->ChildrenList);
66
67 *ServiceData = HttpService;
68 return EFI_SUCCESS;
69 }
70
71 /**
72 Release all the resource used the HTTP service binding instance.
73
74 @param HttpService The HTTP private instance.
75
76 **/
77 VOID
78 HttpCleanService (
79 IN HTTP_SERVICE *HttpService
80 )
81 {
82 if (HttpService == NULL) {
83 return ;
84 }
85
86 if (HttpService->TcpChildHandle != NULL) {
87 gBS->CloseProtocol (
88 HttpService->TcpChildHandle,
89 &gEfiTcp4ProtocolGuid,
90 HttpService->ImageHandle,
91 HttpService->ControllerHandle
92 );
93
94 NetLibDestroyServiceChild (
95 HttpService->ControllerHandle,
96 HttpService->ImageHandle,
97 &gEfiTcp4ServiceBindingProtocolGuid,
98 HttpService->TcpChildHandle
99 );
100 }
101 }
102
103 /**
104 This is the declaration of an EFI image entry point. This entry point is
105 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
106 both device drivers and bus drivers.
107
108 @param ImageHandle The firmware allocated handle for the UEFI image.
109 @param SystemTable A pointer to the EFI System Table.
110
111 @retval EFI_SUCCESS The operation completed successfully.
112 @retval Others An unexpected error occurred.
113
114 **/
115 EFI_STATUS
116 EFIAPI
117 HttpDxeDriverEntryPoint (
118 IN EFI_HANDLE ImageHandle,
119 IN EFI_SYSTEM_TABLE *SystemTable
120 )
121 {
122 //
123 // Install UEFI Driver Model protocol(s).
124 //
125 return EfiLibInstallDriverBindingComponentName2 (
126 ImageHandle,
127 SystemTable,
128 &gHttpDxeDriverBinding,
129 ImageHandle,
130 &gHttpDxeComponentName,
131 &gHttpDxeComponentName2
132 );
133 }
134
135 /**
136 Callback function which provided by user to remove one node in NetDestroyLinkList process.
137
138 @param[in] Entry The entry to be removed.
139 @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
140
141 @retval EFI_INVALID_PARAMETER Any input parameter is NULL.
142 @retval EFI_SUCCESS The entry has been removed successfully.
143 @retval Others Fail to remove the entry.
144
145 **/
146 EFI_STATUS
147 EFIAPI
148 HttpDestroyChildEntryInHandleBuffer (
149 IN LIST_ENTRY *Entry,
150 IN VOID *Context
151 )
152 {
153 HTTP_PROTOCOL *HttpInstance;
154 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
155 UINTN NumberOfChildren;
156 EFI_HANDLE *ChildHandleBuffer;
157
158 if (Entry == NULL || Context == NULL) {
159 return EFI_INVALID_PARAMETER;
160 }
161
162 HttpInstance = NET_LIST_USER_STRUCT_S (Entry, HTTP_PROTOCOL, Link, HTTP_PROTOCOL_SIGNATURE);
163 ServiceBinding = ((HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ServiceBinding;
164 NumberOfChildren = ((HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->NumberOfChildren;
165 ChildHandleBuffer = ((HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT *) Context)->ChildHandleBuffer;
166
167 if (!NetIsInHandleBuffer (HttpInstance->Handle, NumberOfChildren, ChildHandleBuffer)) {
168 return EFI_SUCCESS;
169 }
170
171 return ServiceBinding->DestroyChild (ServiceBinding, HttpInstance->Handle);
172 }
173
174 /**
175 Tests to see if this driver supports a given controller. If a child device is provided,
176 it further tests to see if this driver supports creating a handle for the specified child device.
177
178 This function checks to see if the driver specified by This supports the device specified by
179 ControllerHandle. Drivers will typically use the device path attached to
180 ControllerHandle and/or the services from the bus I/O abstraction attached to
181 ControllerHandle to determine if the driver supports ControllerHandle. This function
182 may be called many times during platform initialization. In order to reduce boot times, the tests
183 performed by this function must be very small, and take as little time as possible to execute. This
184 function must not change the state of any hardware devices, and this function must be aware that the
185 device specified by ControllerHandle may already be managed by the same driver or a
186 different driver. This function must match its calls to AllocatePages() with FreePages(),
187 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
188 Because ControllerHandle may have been previously started by the same driver, if a protocol is
189 already in the opened state, then it must not be closed with CloseProtocol(). This is required
190 to guarantee the state of ControllerHandle is not modified by this function.
191
192 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
193 @param[in] ControllerHandle The handle of the controller to test. This handle
194 must support a protocol interface that supplies
195 an I/O abstraction to the driver.
196 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
197 parameter is ignored by device drivers, and is optional for bus
198 drivers. For bus drivers, if this parameter is not NULL, then
199 the bus driver must determine if the bus controller specified
200 by ControllerHandle and the child controller specified
201 by RemainingDevicePath are both supported by this
202 bus driver.
203
204 @retval EFI_SUCCESS The device specified by ControllerHandle and
205 RemainingDevicePath is supported by the driver specified by This.
206 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
207 RemainingDevicePath is already being managed by the driver
208 specified by This.
209 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
210 RemainingDevicePath is already being managed by a different
211 driver or an application that requires exclusive access.
212 Currently not implemented.
213 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
214 RemainingDevicePath is not supported by the driver specified by This.
215 **/
216 EFI_STATUS
217 EFIAPI
218 HttpDxeDriverBindingSupported (
219 IN EFI_DRIVER_BINDING_PROTOCOL *This,
220 IN EFI_HANDLE ControllerHandle,
221 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
222 )
223 {
224 EFI_STATUS Status;
225
226 //
227 // Test for the HttpServiceBinding protocol.
228 //
229 Status = gBS->OpenProtocol (
230 ControllerHandle,
231 &gEfiHttpServiceBindingProtocolGuid,
232 NULL,
233 This->DriverBindingHandle,
234 ControllerHandle,
235 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
236 );
237 if (!EFI_ERROR (Status)) {
238 return EFI_ALREADY_STARTED;
239 }
240
241 //
242 // Test for the Tcp4 Protocol
243 //
244 return gBS->OpenProtocol (
245 ControllerHandle,
246 &gEfiTcp4ServiceBindingProtocolGuid,
247 NULL,
248 This->DriverBindingHandle,
249 ControllerHandle,
250 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
251 );
252
253 }
254
255 /**
256 Starts a device controller or a bus controller.
257
258 The Start() function is designed to be invoked from the EFI boot service ConnectController().
259 As a result, much of the error checking on the parameters to Start() has been moved into this
260 common boot service. It is legal to call Start() from other locations,
261 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
262 1. ControllerHandle must be a valid EFI_HANDLE.
263 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
264 EFI_DEVICE_PATH_PROTOCOL.
265 3. Prior to calling Start(), the Supported() function for the driver specified by This must
266 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
267
268 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
269 @param[in] ControllerHandle The handle of the controller to start. This handle
270 must support a protocol interface that supplies
271 an I/O abstraction to the driver.
272 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
273 parameter is ignored by device drivers, and is optional for bus
274 drivers. For a bus driver, if this parameter is NULL, then handles
275 for all the children of Controller are created by this driver.
276 If this parameter is not NULL and the first Device Path Node is
277 not the End of Device Path Node, then only the handle for the
278 child device specified by the first Device Path Node of
279 RemainingDevicePath is created by this driver.
280 If the first Device Path Node of RemainingDevicePath is
281 the End of Device Path Node, no child handle is created by this
282 driver.
283
284 @retval EFI_SUCCESS The device was started.
285 @retval EFI_ALREADY_STARTED This device is already running on ControllerHandle.
286 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
287 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
288 @retval Others The driver failded to start the device.
289
290 **/
291 EFI_STATUS
292 EFIAPI
293 HttpDxeDriverBindingStart (
294 IN EFI_DRIVER_BINDING_PROTOCOL *This,
295 IN EFI_HANDLE ControllerHandle,
296 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
297 )
298 {
299 EFI_STATUS Status;
300 HTTP_SERVICE *HttpService;
301 VOID *Interface;
302
303 //
304 // Test for the Http service binding protocol
305 //
306 Status = gBS->OpenProtocol (
307 ControllerHandle,
308 &gEfiHttpServiceBindingProtocolGuid,
309 NULL,
310 This->DriverBindingHandle,
311 ControllerHandle,
312 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
313 );
314
315 if (Status == EFI_SUCCESS) {
316 return EFI_ALREADY_STARTED;
317 }
318
319 Status = HttpCreateService (ControllerHandle, This->DriverBindingHandle, &HttpService);
320 if (EFI_ERROR (Status)) {
321 return Status;
322 }
323
324 ASSERT (HttpService != NULL);
325
326 //
327 // Create a TCP child instance, but do not configure it. This will establish the parent-child relationship.
328 //
329 Status = NetLibCreateServiceChild (
330 ControllerHandle,
331 This->DriverBindingHandle,
332 &gEfiTcp4ServiceBindingProtocolGuid,
333 &HttpService->TcpChildHandle
334 );
335
336 if (EFI_ERROR (Status)) {
337 goto ON_ERROR;
338 }
339
340 Status = gBS->OpenProtocol (
341 HttpService->TcpChildHandle,
342 &gEfiTcp4ProtocolGuid,
343 &Interface,
344 This->DriverBindingHandle,
345 ControllerHandle,
346 EFI_OPEN_PROTOCOL_BY_DRIVER
347 );
348
349 if (EFI_ERROR (Status)) {
350 goto ON_ERROR;
351 }
352
353 //
354 // Install the HttpServiceBinding Protocol onto Controller
355 //
356 Status = gBS->InstallMultipleProtocolInterfaces (
357 &ControllerHandle,
358 &gEfiHttpServiceBindingProtocolGuid,
359 &HttpService->ServiceBinding,
360 NULL
361 );
362
363 if (EFI_ERROR (Status)) {
364 goto ON_ERROR;
365 }
366
367 return EFI_SUCCESS;
368
369 ON_ERROR:
370
371 if (HttpService != NULL) {
372 HttpCleanService (HttpService);
373 FreePool (HttpService);
374 }
375
376 return Status;
377 }
378
379 /**
380 Stops a device controller or a bus controller.
381
382 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
383 As a result, much of the error checking on the parameters to Stop() has been moved
384 into this common boot service. It is legal to call Stop() from other locations,
385 but the following calling restrictions must be followed, or the system behavior will not be deterministic.
386 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
387 same driver's Start() function.
388 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
389 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
390 Start() function, and the Start() function must have called OpenProtocol() on
391 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
392
393 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
394 @param[in] ControllerHandle A handle to the device being stopped. The handle must
395 support a bus specific I/O protocol for the driver
396 to use to stop the device.
397 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
398 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
399 if NumberOfChildren is 0.
400
401 @retval EFI_SUCCESS The device was stopped.
402 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
403
404 **/
405 EFI_STATUS
406 EFIAPI
407 HttpDxeDriverBindingStop (
408 IN EFI_DRIVER_BINDING_PROTOCOL *This,
409 IN EFI_HANDLE ControllerHandle,
410 IN UINTN NumberOfChildren,
411 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
412 )
413 {
414 EFI_HANDLE NicHandle;
415 EFI_STATUS Status;
416 EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
417 HTTP_SERVICE *HttpService;
418 LIST_ENTRY *List;
419 HTTP_DESTROY_CHILD_IN_HANDLE_BUF_CONTEXT Context;
420
421 //
422 // HTTP driver opens TCP child, So, Controller is a TCP
423 // child handle. Locate the Nic handle first. Then get the
424 // HTTP private data back.
425 //
426 NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiTcp4ProtocolGuid);
427 if (NicHandle == NULL) {
428 return EFI_SUCCESS;
429 }
430
431 Status = gBS->OpenProtocol (
432 NicHandle,
433 &gEfiHttpServiceBindingProtocolGuid,
434 (VOID **) &ServiceBinding,
435 This->DriverBindingHandle,
436 NicHandle,
437 EFI_OPEN_PROTOCOL_GET_PROTOCOL
438 );
439
440 if (EFI_ERROR (Status)) {
441 return EFI_DEVICE_ERROR;
442 }
443
444 HttpService = HTTP_SERVICE_FROM_PROTOCOL (ServiceBinding);
445
446 if (!IsListEmpty (&HttpService->ChildrenList)) {
447 //
448 // Destroy the HTTP child instance in ChildHandleBuffer.
449 //
450 List = &HttpService->ChildrenList;
451 Context.ServiceBinding = ServiceBinding;
452 Context.NumberOfChildren = NumberOfChildren;
453 Context.ChildHandleBuffer = ChildHandleBuffer;
454 Status = NetDestroyLinkList (
455 List,
456 HttpDestroyChildEntryInHandleBuffer,
457 &Context,
458 NULL
459 );
460 }
461
462 if (NumberOfChildren == 0 && IsListEmpty (&HttpService->ChildrenList)) {
463 gBS->UninstallProtocolInterface (
464 NicHandle,
465 &gEfiHttpServiceBindingProtocolGuid,
466 ServiceBinding
467 );
468
469 HttpCleanService (HttpService);
470
471 FreePool (HttpService);
472
473 Status = EFI_SUCCESS;
474 }
475
476 return Status;
477 }
478
479 /**
480 Creates a child handle and installs a protocol.
481
482 The CreateChild() function installs a protocol on ChildHandle.
483 If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle.
484 If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle.
485
486 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
487 @param ChildHandle Pointer to the handle of the child to create. If it is NULL,
488 then a new handle is created. If it is a pointer to an existing UEFI handle,
489 then the protocol is added to the existing UEFI handle.
490
491 @retval EFI_SUCCES The protocol was added to ChildHandle.
492 @retval EFI_INVALID_PARAMETER This is NULL, or ChildHandle is NULL.
493 @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to create
494 the child.
495 @retval other The child handle was not created.
496
497 **/
498 EFI_STATUS
499 EFIAPI
500 HttpServiceBindingCreateChild (
501 IN EFI_SERVICE_BINDING_PROTOCOL *This,
502 IN OUT EFI_HANDLE *ChildHandle
503 )
504 {
505 HTTP_SERVICE *HttpService;
506 HTTP_PROTOCOL *HttpInstance;
507 EFI_STATUS Status;
508 VOID *Interface;
509 EFI_TPL OldTpl;
510
511 if ((This == NULL) || (ChildHandle == NULL)) {
512 return EFI_INVALID_PARAMETER;
513 }
514
515 HttpService = HTTP_SERVICE_FROM_PROTOCOL (This);
516 HttpInstance = AllocateZeroPool (sizeof (HTTP_PROTOCOL));
517 if (HttpInstance == NULL) {
518 return EFI_OUT_OF_RESOURCES;
519 }
520
521 //
522 // Install HTTP protocol onto ChildHandle
523 //
524 Status = gBS->InstallMultipleProtocolInterfaces (
525 ChildHandle,
526 &gEfiHttpProtocolGuid,
527 &HttpInstance->Http,
528 NULL
529 );
530
531 if (EFI_ERROR (Status)) {
532 goto ON_ERROR;
533 }
534
535 HttpInstance->Handle = *ChildHandle;
536
537 Status = HttpInitProtocol (HttpService, HttpInstance);
538 if (EFI_ERROR (Status)) {
539 goto ON_ERROR;
540 }
541
542 //
543 // Open the default Tcp4 protocol by child.
544 //
545 Status = gBS->OpenProtocol (
546 HttpService->TcpChildHandle,
547 &gEfiTcp4ProtocolGuid,
548 (VOID **) &Interface,
549 gHttpDxeDriverBinding.DriverBindingHandle,
550 HttpInstance->Handle,
551 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
552 );
553 if (EFI_ERROR (Status)) {
554 goto ON_ERROR;
555 }
556
557 //
558 // Add it to the HTTP service's child list.
559 //
560 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
561
562 InsertTailList (&HttpService->ChildrenList, &HttpInstance->Link);
563 HttpService->ChildrenNumber++;
564
565 gBS->RestoreTPL (OldTpl);
566
567 return EFI_SUCCESS;
568
569 ON_ERROR:
570
571 HttpCleanProtocol (HttpInstance);
572 FreePool (HttpInstance);
573
574 return Status;
575 }
576
577 /**
578 Destroys a child handle with a protocol installed on it.
579
580 The DestroyChild() function does the opposite of CreateChild(). It removes a protocol
581 that was installed by CreateChild() from ChildHandle. If the removed protocol is the
582 last protocol on ChildHandle, then ChildHandle is destroyed.
583
584 @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance.
585 @param ChildHandle Handle of the child to destroy
586
587 @retval EFI_SUCCES The protocol was removed from ChildHandle.
588 @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed.
589 @retval EFI_INVALID_PARAMETER Child handle is NULL.
590 @retval other The child handle was not destroyed
591
592 **/
593 EFI_STATUS
594 EFIAPI
595 HttpServiceBindingDestroyChild (
596 IN EFI_SERVICE_BINDING_PROTOCOL *This,
597 IN EFI_HANDLE ChildHandle
598 )
599 {
600 HTTP_SERVICE *HttpService;
601 HTTP_PROTOCOL *HttpInstance;
602 EFI_HTTP_PROTOCOL *Http;
603 EFI_STATUS Status;
604 EFI_TPL OldTpl;
605
606 if ((This == NULL) || (ChildHandle == NULL)) {
607 return EFI_INVALID_PARAMETER;
608 }
609
610 HttpService = HTTP_SERVICE_FROM_PROTOCOL (This);
611 Status = gBS->OpenProtocol (
612 ChildHandle,
613 &gEfiHttpProtocolGuid,
614 (VOID **) &Http,
615 gHttpDxeDriverBinding.DriverBindingHandle,
616 ChildHandle,
617 EFI_OPEN_PROTOCOL_GET_PROTOCOL
618 );
619 if (EFI_ERROR (Status)) {
620 return EFI_UNSUPPORTED;
621 }
622
623 HttpInstance = HTTP_INSTANCE_FROM_PROTOCOL (Http);
624 if (HttpInstance->Service != HttpService) {
625 return EFI_INVALID_PARAMETER;
626 }
627
628 if (HttpInstance->InDestroy) {
629 return EFI_SUCCESS;
630 }
631
632 //
633 // Close the Tcp4 protocol.
634 //
635 gBS->CloseProtocol (
636 HttpService->TcpChildHandle,
637 &gEfiTcp4ProtocolGuid,
638 gHttpDxeDriverBinding.DriverBindingHandle,
639 ChildHandle
640 );
641
642 HttpInstance->InDestroy = TRUE;
643
644 //
645 // Uninstall the HTTP protocol.
646 //
647 Status = gBS->UninstallProtocolInterface (
648 ChildHandle,
649 &gEfiHttpProtocolGuid,
650 Http
651 );
652
653 if (EFI_ERROR (Status)) {
654 HttpInstance->InDestroy = FALSE;
655 return Status;
656 }
657
658 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
659
660 HttpCleanProtocol (HttpInstance);
661
662 RemoveEntryList (&HttpInstance->Link);
663 HttpService->ChildrenNumber--;
664
665 gBS->RestoreTPL (OldTpl);
666
667 FreePool (HttpInstance);
668 return EFI_SUCCESS;
669 }