X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FNetwork%2FPxeBcDxe%2FBc.c;h=41d06f6e376dbe9a4fa7abfa2bb8418c6d7cb3c3;hb=6c822f41fc843e5e9ab59502a5e0ea4bc6998818;hp=a520349135f1e4bda998adb86ef3d3b330976e81;hpb=687a2e5f6902fa26c7a1d7a7705e0747c4095125;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c index a520349135..41d06f6e37 100644 --- a/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c +++ b/MdeModulePkg/Universal/Network/PxeBcDxe/Bc.c @@ -345,7 +345,6 @@ UpdateChecksum ( @retval 1 Callbacks are not active on the handle **/ -STATIC BOOLEAN SetMakeCallback ( IN PXE_BASECODE_DEVICE *Private @@ -1146,9 +1145,6 @@ PxebcBisDetect ( return TRUE; } -static VOID *BCNotifyReg; - - /** Start and initialize the BaseCode protocol, Simple Network protocol and UNDI. @@ -1204,7 +1200,6 @@ BcStart ( return EFI_ALREADY_STARTED; } -#if !SUPPORT_IPV6 // // Fail if IPv6 is requested and not supported. // @@ -1213,7 +1208,6 @@ BcStart ( EfiReleaseLock (&Private->Lock); return EFI_UNSUPPORTED; } -#endif // // Setup shortcuts to SNP protocol and data structure. // @@ -1559,7 +1553,7 @@ BcStop ( return StatCode; } -const IPV4_ADDR AllSystemsGroup = { 224, 0, 0, 1 }; +const IPV4_ADDR AllSystemsGroup = {{224, 0, 0, 1}}; /** @@ -1665,7 +1659,7 @@ IpFilter ( Enable = EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST; for (Index = 0; Index < Filter->IpCnt; ++Index) { - PxebcMode->IpFilter.IpList[Index] = Filter->IpList[Index]; + CopyMem (&PxebcMode->IpFilter.IpList[Index], &Filter->IpList[Index], sizeof (EFI_IP_ADDRESS)); if (IS_MULTICAST (&Filter->IpList[Index])) { EFI_IP_ADDRESS *TmpIp; @@ -1677,7 +1671,7 @@ IpFilter ( // if (!Index2) { - TmpIp = (EFI_IP_ADDRESS *) &AllSystemsGroup; + TmpIp = (EFI_IP_ADDRESS *) &AllSystemsGroup; --Index; } else { TmpIp = (EFI_IP_ADDRESS *) &Filter->IpList[Index]; @@ -2012,8 +2006,8 @@ BcSetStationIP ( goto RELEASE_LOCK; } - PxebcMode->StationIp = *StationIpPtr; - PxebcMode->SubnetMask = *SubnetMaskPtr; + CopyMem (&PxebcMode->StationIp, StationIpPtr, sizeof (EFI_IP_ADDRESS)); + CopyMem (&PxebcMode->SubnetMask, SubnetMaskPtr, sizeof (EFI_IP_ADDRESS)); Private->GoodStationIp = TRUE; RELEASE_LOCK: @@ -2175,19 +2169,9 @@ PxeBcDriverStart ( ); if (EFI_ERROR (Status)) { - Status = gBS->OpenProtocol ( - Controller, - &gEfiNetworkInterfaceIdentifierProtocolGuid, - (VOID **) &Private->NiiPtr, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - goto PxeBcError; - } + goto PxeBcError; } + // // Get the Snp interface // @@ -2236,12 +2220,8 @@ PxeBcDriverStart ( // implementation supports IPv6. // Private->EfiBc.Mode->Ipv6Supported = SUPPORT_IPV6; - -#if SUPPORT_IPV6 - Private->EfiBc.Mode->Ipv6Available = Private->NiiPtr->Ipv6Supported; -#else Private->EfiBc.Mode->Ipv6Available = FALSE; -#endif + // // Set to TRUE by the BC constructor if this BC // implementation supports BIS. @@ -2363,6 +2343,41 @@ PxeBcDriverStop ( return Status; } +EFI_STATUS +EFIAPI +PxeBcUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + UINTN DeviceHandleCount; + EFI_HANDLE *DeviceHandleBuffer; + UINTN Index; + + Status = gBS->LocateHandleBuffer ( + AllHandles, + NULL, + NULL, + &DeviceHandleCount, + &DeviceHandleBuffer + ); + if (!EFI_ERROR (Status)) { + for (Index = 0; Index < DeviceHandleCount; Index++) { + Status = gBS->DisconnectController ( + DeviceHandleBuffer[Index], + mPxeBcDriverBinding.DriverBindingHandle, + NULL + ); + } + + if (DeviceHandleBuffer != NULL) { + gBS->FreePool (DeviceHandleBuffer); + } + } + + return Status; +} + /** Initialize the base code drivers and install the driver binding @@ -2379,20 +2394,31 @@ InitializeBCDriver ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS Status; + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; // // Initialize EFI library // - Status = EfiLibInstallAllDriverProtocols ( - ImageHandle, - SystemTable, - &mPxeBcDriverBinding, - NULL, - COMPONENT_NAME, - NULL, - NULL - ); + Status = EfiLibInstallDriverBindingComponentName2 ( + ImageHandle, + SystemTable, + &mPxeBcDriverBinding, + NULL, + &gPxeBcComponentName, + &gPxeBcComponentName2 + ); + + Status = gBS->HandleProtocol ( + ImageHandle, + &gEfiLoadedImageProtocolGuid, + (VOID **) &LoadedImage + ); + if (EFI_ERROR (Status)) { + return Status; + } else { + LoadedImage->Unload = PxeBcUnload; + } InitArpHeader (); OptionsStrucInit ();