]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootDxe.c
NetworkPkg: Fix the driver model issue in HTTP Boot driver.
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootDxe.c
index 9fb33bbb53abf20e874f4ea240543577ab2870d1..642e0fe31ee5de9028ed749ab565786c7495ddf1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Driver Binding functions implementation for UEFI HTTP boot.\r
 \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available under \r
 the terms and conditions of the BSD License that accompanies this distribution.  \r
 The full text of the license may be found at\r
@@ -321,7 +321,7 @@ HttpBootIp4DxeDriverBindingStart (
                   );\r
 \r
   if (!EFI_ERROR (Status)) {\r
-      Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);\r
+    Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);\r
   } else {\r
     //\r
     // Initialize the private data structure.\r
@@ -332,7 +332,6 @@ HttpBootIp4DxeDriverBindingStart (
     }\r
     Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;\r
     Private->Controller = ControllerHandle;\r
-    Private->Image = This->ImageHandle;\r
     InitializeListHead (&Private->CacheList);\r
     //\r
     // Get the NII interface if it exists, it's not required.\r
@@ -364,6 +363,14 @@ HttpBootIp4DxeDriverBindingStart (
       goto ON_ERROR;\r
     }\r
 \r
+    //\r
+    // Initialize the HII configuration form.\r
+    //\r
+    Status = HttpBootConfigFormInit (Private);\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
     //\r
     // Install a protocol with Caller Id Guid to the NIC, this is just to build the relationship between\r
     // NIC handle and the private data.\r
@@ -391,8 +398,9 @@ HttpBootIp4DxeDriverBindingStart (
   if (Private->Ip4Nic == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  Private->Ip4Nic->Private   = Private;\r
-  Private->Ip4Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;\r
+  Private->Ip4Nic->Private     = Private;\r
+  Private->Ip4Nic->ImageHandle = This->DriverBindingHandle;\r
+  Private->Ip4Nic->Signature   = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;\r
   \r
   //\r
   // Create DHCP4 child instance.\r
@@ -508,8 +516,9 @@ HttpBootIp4DxeDriverBindingStart (
 \r
     \r
 ON_ERROR:\r
-  \r
+\r
   HttpBootDestroyIp4Children (This, Private);\r
+  HttpBootConfigFormUnload (Private);\r
   FreePool (Private);\r
 \r
   return Status;\r
@@ -615,6 +624,11 @@ HttpBootIp4DxeDriverBindingStop (
     // Release the cached data.\r
     //\r
     HttpBootFreeCacheList (Private);\r
+\r
+    //\r
+    // Unload the config form.\r
+    //\r
+    HttpBootConfigFormUnload (Private);\r
     \r
     gBS->UninstallProtocolInterface (\r
            NicHandle,\r
@@ -779,7 +793,7 @@ HttpBootIp6DxeDriverBindingStart (
                   );\r
   \r
   if (!EFI_ERROR (Status)) {\r
-      Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);\r
+    Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);\r
   } else {\r
     //\r
     // Initialize the private data structure.\r
@@ -790,7 +804,6 @@ HttpBootIp6DxeDriverBindingStart (
     }\r
     Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;\r
     Private->Controller = ControllerHandle;\r
-    Private->Image = This->ImageHandle;\r
     InitializeListHead (&Private->CacheList);\r
     //\r
     // Get the NII interface if it exists, it's not required.\r
@@ -822,6 +835,14 @@ HttpBootIp6DxeDriverBindingStart (
       goto ON_ERROR;\r
     }\r
 \r
+    //\r
+    // Initialize the HII configuration form.\r
+    //\r
+    Status = HttpBootConfigFormInit (Private);\r
+    if (EFI_ERROR (Status)) {\r
+      goto ON_ERROR;\r
+    }\r
+\r
     //\r
     // Install a protocol with Caller Id Guid to the NIC, this is just to build the relationship between\r
     // NIC handle and the private data.\r
@@ -849,9 +870,10 @@ HttpBootIp6DxeDriverBindingStart (
   if (Private->Ip6Nic == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  Private->Ip6Nic->Private   = Private;\r
-  Private->Ip6Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;\r
-\r
+  Private->Ip6Nic->Private     = Private;\r
+  Private->Ip6Nic->ImageHandle = This->DriverBindingHandle;\r
+  Private->Ip6Nic->Signature   = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;\r
+  \r
   //\r
   // Create Dhcp6 child and open Dhcp6 protocol\r
   Status = NetLibCreateServiceChild (\r
@@ -989,12 +1011,12 @@ HttpBootIp6DxeDriverBindingStart (
   return EFI_SUCCESS;\r
    \r
 ON_ERROR:\r
-  \r
- HttpBootDestroyIp6Children(This, Private);\r
- FreePool (Private);\r
 \r
- return Status;\r
\r
+  HttpBootDestroyIp6Children(This, Private);\r
+  HttpBootConfigFormUnload (Private);\r
+  FreePool (Private);\r
+\r
+  return Status;\r
 }\r
 \r
 /**\r
@@ -1096,7 +1118,12 @@ HttpBootIp6DxeDriverBindingStop (
     // Release the cached data.\r
     //\r
     HttpBootFreeCacheList (Private);\r
-        \r
+\r
+    //\r
+    // Unload the config form.\r
+    //\r
+    HttpBootConfigFormUnload (Private);\r
+\r
     gBS->UninstallProtocolInterface (\r
            NicHandle,\r
            &gEfiCallerIdGuid,\r
@@ -1128,6 +1155,7 @@ HttpBootDxeDriverEntryPoint (
   )\r
 {\r
   EFI_STATUS   Status;\r
+\r
   //\r
   // Install UEFI Driver Model protocol(s).\r
   //\r