summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/HttpBootDxe/HttpBootDxe.c
diff options
context:
space:
mode:
authorFu Siyuan <siyuan.fu@intel.com>2016-03-14 10:43:42 +0800
committerFu Siyuan <siyuan.fu@intel.com>2016-03-16 14:43:17 +0800
commit7537258100166bdf6e9f4203ac13e53a14f97490 (patch)
treeaf266f6ba498fc0ccc63a125026f6ae81715f6ca /NetworkPkg/HttpBootDxe/HttpBootDxe.c
parent6ddc2e438bd55e72b65806414c4fd712d50e612d (diff)
downloadedk2-7537258100166bdf6e9f4203ac13e53a14f97490.tar.gz
edk2-7537258100166bdf6e9f4203ac13e53a14f97490.tar.bz2
edk2-7537258100166bdf6e9f4203ac13e53a14f97490.zip
NetworkPkg: Fix the driver model issue in HTTP Boot driver.
The HTTP Boot driver have some UEFI driver model problems which will make the code ASSERT when it's disconnected. First, the driver opens the HttpSb protocol BY_CHILD without BY_DRIVER attribute. So the driver binding stop won't be called when HTTP driver is disconnected, so a child handle is left and made HTTP driver binding stop function goes into error. This patch remove this unnecessary OpenProtocol and only unload the HII from when both the IP4 and IP6 stack have been stopped completely. The second issue is the HTTP boot driver always use the driver's image handle as it's driver binding handle, it's not correct. HTTP Boot driver provides 2 separate driver binding protocols from IP4 and IP6 stack, so it has 2 driver binding handle. So this patch fix the code to use correct driver binding handle when create/open a HTTP child handle. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Diffstat (limited to 'NetworkPkg/HttpBootDxe/HttpBootDxe.c')
-rw-r--r--NetworkPkg/HttpBootDxe/HttpBootDxe.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.c b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
index 6a3033db11..642e0fe31e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
@@ -321,7 +321,7 @@ HttpBootIp4DxeDriverBindingStart (
);
if (!EFI_ERROR (Status)) {
- Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);
+ Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);
} else {
//
// Initialize the private data structure.
@@ -332,7 +332,6 @@ HttpBootIp4DxeDriverBindingStart (
}
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
Private->Controller = ControllerHandle;
- Private->Image = This->ImageHandle;
InitializeListHead (&Private->CacheList);
//
// Get the NII interface if it exists, it's not required.
@@ -399,8 +398,9 @@ HttpBootIp4DxeDriverBindingStart (
if (Private->Ip4Nic == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Private->Ip4Nic->Private = Private;
- Private->Ip4Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
+ Private->Ip4Nic->Private = Private;
+ Private->Ip4Nic->ImageHandle = This->DriverBindingHandle;
+ Private->Ip4Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
//
// Create DHCP4 child instance.
@@ -793,7 +793,7 @@ HttpBootIp6DxeDriverBindingStart (
);
if (!EFI_ERROR (Status)) {
- Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);
+ Private = HTTP_BOOT_PRIVATE_DATA_FROM_ID(Id);
} else {
//
// Initialize the private data structure.
@@ -804,7 +804,6 @@ HttpBootIp6DxeDriverBindingStart (
}
Private->Signature = HTTP_BOOT_PRIVATE_DATA_SIGNATURE;
Private->Controller = ControllerHandle;
- Private->Image = This->ImageHandle;
InitializeListHead (&Private->CacheList);
//
// Get the NII interface if it exists, it's not required.
@@ -871,9 +870,10 @@ HttpBootIp6DxeDriverBindingStart (
if (Private->Ip6Nic == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- Private->Ip6Nic->Private = Private;
- Private->Ip6Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
-
+ Private->Ip6Nic->Private = Private;
+ Private->Ip6Nic->ImageHandle = This->DriverBindingHandle;
+ Private->Ip6Nic->Signature = HTTP_BOOT_VIRTUAL_NIC_SIGNATURE;
+
//
// Create Dhcp6 child and open Dhcp6 protocol
Status = NetLibCreateServiceChild (