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>
This commit is contained in:
Fu Siyuan
2016-03-14 10:43:42 +08:00
parent 6ddc2e438b
commit 7537258100
6 changed files with 29 additions and 41 deletions

View File

@ -447,6 +447,7 @@ HttpBootCreateHttpIo (
{
HTTP_IO_CONFIG_DATA ConfigData;
EFI_STATUS Status;
EFI_HANDLE ImageHandle;
ASSERT (Private != NULL);
@ -456,14 +457,16 @@ HttpBootCreateHttpIo (
ConfigData.Config4.RequestTimeOut = HTTP_BOOT_REQUEST_TIMEOUT;
IP4_COPY_ADDRESS (&ConfigData.Config4.LocalIp, &Private->StationIp.v4);
IP4_COPY_ADDRESS (&ConfigData.Config4.SubnetMask, &Private->SubnetMask.v4);
ImageHandle = Private->Ip4Nic->ImageHandle;
} else {
ConfigData.Config6.HttpVersion = HttpVersion11;
ConfigData.Config6.RequestTimeOut = HTTP_BOOT_REQUEST_TIMEOUT;
IP6_COPY_ADDRESS (&ConfigData.Config6.LocalIp, &Private->StationIp.v6);
ImageHandle = Private->Ip6Nic->ImageHandle;
}
Status = HttpIoCreateIo (
Private->Image,
ImageHandle,
Private->Controller,
Private->UsingIpv6 ? IP_VERSION_6 : IP_VERSION_4,
&ConfigData,