X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=NetworkPkg%2FUefiPxeBcDxe%2FPxeBcDriver.c;h=3c1d400d502ca63a08d07cbb96f90c6198498658;hp=c2987b8734a8986cbba9e0e776ca08842fa919ab;hb=ecf98fbcf858b9cb09ff0ac1c2a09c0111b4026b;hpb=2bbe9553c495bb9024b4b51743142a0a50e0d370 diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c index c2987b8734..3c1d400d50 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -2,15 +2,9 @@ Driver Binding functions implementationfor for UefiPxeBc Driver. (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -254,8 +248,9 @@ PxeBcDestroyIp4Children ( &Private->PxeBc, NULL ); + FreePool (Private->Ip4Nic->DevicePath); - if (Private->Snp != NULL) { + if (Private->Snp != NULL) { // // Close SNP from the child virtual handle // @@ -265,7 +260,7 @@ PxeBcDestroyIp4Children ( This->DriverBindingHandle, Private->Ip4Nic->Controller ); - + gBS->UninstallProtocolInterface ( Private->Ip4Nic->Controller, &gEfiSimpleNetworkProtocolGuid, @@ -414,6 +409,8 @@ PxeBcDestroyIp6Children ( &Private->PxeBc, NULL ); + FreePool (Private->Ip6Nic->DevicePath); + if (Private->Snp != NULL) { // // Close SNP from the child virtual handle @@ -486,7 +483,7 @@ PxeBcCheckIpv6Support ( // // Get the NIC handle by SNP protocol. - // + // Handle = NetLibGetSnpHandle (ControllerHandle, NULL); if (Handle == NULL) { return EFI_NOT_FOUND; @@ -532,7 +529,7 @@ PxeBcCheckIpv6Support ( if (EFI_ERROR (Status) || InfoBlock == NULL) { FreePool (InfoBlock); return EFI_NOT_FOUND; - } + } *Ipv6Support = ((EFI_ADAPTER_INFO_UNDI_IPV6_SUPPORT *) InfoBlock)->Ipv6Support; FreePool (InfoBlock); @@ -742,6 +739,18 @@ PxeBcCreateIp4Children ( Private->Ip4Nic->Private = Private; Private->Ip4Nic->Signature = PXEBC_VIRTUAL_NIC_SIGNATURE; + // + // Locate Ip4->Ip4Config2 and store it for set IPv4 Policy. + // + Status = gBS->HandleProtocol ( + ControllerHandle, + &gEfiIp4Config2ProtocolGuid, + (VOID **) &Private->Ip4Config2 + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; + } + // // Create a device path node for Ipv4 virtual nic, and append it. // @@ -799,7 +808,7 @@ PxeBcCreateIp4Children ( } // - // Open SNP on the child handle BY_DRIVER. It will prevent any additionally + // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally // layering to perform the experiment. // Status = gBS->OpenProtocol ( @@ -808,7 +817,7 @@ PxeBcCreateIp4Children ( (VOID **) &Snp, This->DriverBindingHandle, Private->Ip4Nic->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER + EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE ); if (EFI_ERROR (Status)) { goto ON_ERROR; @@ -936,7 +945,7 @@ PxeBcCreateIp6Children ( if (Private->Snp != NULL) { for (Index = 0; Index < Private->Snp->Mode->HwAddressSize; Index++) { Private->IaId |= (Private->Snp->Mode->CurrentAddress.Addr[Index] << ((Index << 3) & 31)); - } + } } // @@ -1049,6 +1058,30 @@ PxeBcCreateIp6Children ( Private->Ip6MaxPacketSize = Ip6ModeData.MaxPacketSize; + if (Ip6ModeData.AddressList != NULL) { + FreePool (Ip6ModeData.AddressList); + } + + if (Ip6ModeData.GroupTable != NULL) { + FreePool (Ip6ModeData.GroupTable); + } + + if (Ip6ModeData.RouteTable != NULL) { + FreePool (Ip6ModeData.RouteTable); + } + + if (Ip6ModeData.NeighborCache != NULL) { + FreePool (Ip6ModeData.NeighborCache); + } + + if (Ip6ModeData.PrefixTable != NULL) { + FreePool (Ip6ModeData.PrefixTable); + } + + if (Ip6ModeData.IcmpTypeList != NULL) { + FreePool (Ip6ModeData.IcmpTypeList); + } + // // Locate Ip6->Ip6Config and store it for set IPv6 address. // @@ -1101,7 +1134,7 @@ PxeBcCreateIp6Children ( if (EFI_ERROR (Status)) { goto ON_ERROR; } - + if (Private->Snp != NULL) { // // Install SNP protocol on purpose is for some OS loader backward @@ -1118,7 +1151,7 @@ PxeBcCreateIp6Children ( } // - // Open SNP on the child handle BY_DRIVER. It will prevent any additionally + // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally // layering to perform the experiment. // Status = gBS->OpenProtocol ( @@ -1127,7 +1160,7 @@ PxeBcCreateIp6Children ( (VOID **) &Snp, This->DriverBindingHandle, Private->Ip6Nic->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER + EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE ); if (EFI_ERROR (Status)) { goto ON_ERROR; @@ -1230,16 +1263,11 @@ PxeBcDriverEntryPoint ( &gPxeBcComponentName2 ); if (EFI_ERROR (Status)) { - gBS->UninstallMultipleProtocolInterfaces ( - ImageHandle, - &gEfiDriverBindingProtocolGuid, - &gPxeBcIp4DriverBinding, - &gEfiComponentName2ProtocolGuid, - &gPxeBcComponentName2, - &gEfiComponentNameProtocolGuid, - &gPxeBcComponentName, - NULL - ); + EfiLibUninstallDriverBindingComponentName2 ( + &gPxeBcIp4DriverBinding, + &gPxeBcComponentName, + &gPxeBcComponentName2 + ); } return Status; @@ -1254,7 +1282,7 @@ PxeBcDriverEntryPoint ( @param[in] RemainingDevicePath Optional parameter used to pick a specific child device to be started. @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. - + @retval EFI_SUCCESS This driver supports this device. @retval EFI_UNSUPPORTED This driver does not support this device. @@ -1271,7 +1299,7 @@ PxeBcSupported ( EFI_STATUS Status; EFI_GUID *DhcpServiceBindingGuid; EFI_GUID *MtftpServiceBindingGuid; - + if (IpVersion == IP_VERSION_4) { DhcpServiceBindingGuid = &gEfiDhcp4ServiceBindingProtocolGuid; MtftpServiceBindingGuid = &gEfiMtftp4ServiceBindingProtocolGuid; @@ -1414,7 +1442,7 @@ PxeBcStart ( // // Install PxeBaseCodePrivate protocol onto the real NIC handler. - // PxeBaseCodePrivate protocol is only used to keep the relationship between + // PxeBaseCodePrivate protocol is only used to keep the relationship between // NIC handle and virtual child handles. // gEfiCallerIdGuid will be used as its protocol guid. // @@ -1431,7 +1459,7 @@ PxeBcStart ( // // Try to locate SNP protocol. // - NetLibGetSnpHandle(ControllerHandle, &Private->Snp); + NetLibGetSnpHandle(ControllerHandle, &Private->Snp); } if (IpVersion == IP_VERSION_4) {