X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=inline;f=MdeModulePkg%2FUniversal%2FBootManagerPolicyDxe%2FBootManagerPolicyDxe.c;fp=MdeModulePkg%2FUniversal%2FBootManagerPolicyDxe%2FBootManagerPolicyDxe.c;h=2c671f1d384135d57d44b85de8d3b4cacb6ace1c;hb=1436aea4d5707e672672a11bda72be2c63c936c3;hp=ff45e4f8e996ad2dad434e05d3ee60f914594564;hpb=7c7184e201a90a1d2376e615e55e3f4074731468;p=mirror_edk2.git diff --git a/MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.c b/MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.c index ff45e4f8e9..2c671f1d38 100644 --- a/MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.c +++ b/MdeModulePkg/Universal/BootManagerPolicyDxe/BootManagerPolicyDxe.c @@ -18,7 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include -CHAR16 mNetworkDeviceList[] = L"_NDL"; +CHAR16 mNetworkDeviceList[] = L"_NDL"; /** Connect all the system drivers to controllers and create the network device list in NV storage. @@ -32,29 +32,30 @@ ConnectAllAndCreateNetworkDeviceList ( VOID ) { - EFI_STATUS Status; - EFI_HANDLE *Handles; - UINTN HandleCount; - EFI_DEVICE_PATH_PROTOCOL *SingleDevice; - EFI_DEVICE_PATH_PROTOCOL *Devices; - EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; + EFI_STATUS Status; + EFI_HANDLE *Handles; + UINTN HandleCount; + EFI_DEVICE_PATH_PROTOCOL *SingleDevice; + EFI_DEVICE_PATH_PROTOCOL *Devices; + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; EfiBootManagerConnectAll (); Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiManagedNetworkServiceBindingProtocolGuid, NULL, &HandleCount, &Handles); if (EFI_ERROR (Status)) { - Handles = NULL; + Handles = NULL; HandleCount = 0; } Devices = NULL; while (HandleCount-- != 0) { - Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **) &SingleDevice); + Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **)&SingleDevice); if (EFI_ERROR (Status) || (SingleDevice == NULL)) { continue; } + TempDevicePath = Devices; - Devices = AppendDevicePathInstance (Devices, SingleDevice); + Devices = AppendDevicePathInstance (Devices, SingleDevice); if (TempDevicePath != NULL) { FreePool (TempDevicePath); } @@ -89,24 +90,26 @@ ConnectNetwork ( VOID ) { - EFI_STATUS Status; - BOOLEAN OneConnected; - EFI_DEVICE_PATH_PROTOCOL *Devices; - EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; - EFI_DEVICE_PATH_PROTOCOL *SingleDevice; - UINTN Size; + EFI_STATUS Status; + BOOLEAN OneConnected; + EFI_DEVICE_PATH_PROTOCOL *Devices; + EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; + EFI_DEVICE_PATH_PROTOCOL *SingleDevice; + UINTN Size; OneConnected = FALSE; - GetVariable2 (mNetworkDeviceList, &gEfiCallerIdGuid, (VOID **) &Devices, NULL); + GetVariable2 (mNetworkDeviceList, &gEfiCallerIdGuid, (VOID **)&Devices, NULL); TempDevicePath = Devices; while (TempDevicePath != NULL) { SingleDevice = GetNextDevicePathInstance (&TempDevicePath, &Size); - Status = EfiBootManagerConnectDevicePath (SingleDevice, NULL); + Status = EfiBootManagerConnectDevicePath (SingleDevice, NULL); if (!EFI_ERROR (Status)) { OneConnected = TRUE; } + FreePool (SingleDevice); } + if (Devices != NULL) { FreePool (Devices); } @@ -148,13 +151,13 @@ ConnectNetwork ( EFI_STATUS EFIAPI BootManagerPolicyConnectDevicePath ( - IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, - IN EFI_DEVICE_PATH *DevicePath, - IN BOOLEAN Recursive + IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, + IN EFI_DEVICE_PATH *DevicePath, + IN BOOLEAN Recursive ) { - EFI_STATUS Status; - EFI_HANDLE Controller; + EFI_STATUS Status; + EFI_HANDLE Controller; if (EfiGetCurrentTpl () != TPL_APPLICATION) { return EFI_UNSUPPORTED; @@ -173,8 +176,10 @@ BootManagerPolicyConnectDevicePath ( Status = gBS->ConnectController (Controller, NULL, DevicePath, FALSE); } } + return Status; } + /** Connect a class of devices using the platform Boot Manager policy. @@ -221,8 +226,8 @@ BootManagerPolicyConnectDevicePath ( EFI_STATUS EFIAPI BootManagerPolicyConnectDeviceClass ( - IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, - IN EFI_GUID *Class + IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, + IN EFI_GUID *Class ) { if (EfiGetCurrentTpl () != TPL_APPLICATION) { @@ -264,18 +269,19 @@ EFI_BOOT_MANAGER_POLICY_PROTOCOL mBootManagerPolicy = { EFI_STATUS EFIAPI BootManagerPolicyInitialize ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_HANDLE Handle; + EFI_HANDLE Handle; ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiBootManagerPolicyProtocolGuid); Handle = NULL; return gBS->InstallMultipleProtocolInterfaces ( &Handle, - &gEfiBootManagerPolicyProtocolGuid, &mBootManagerPolicy, + &gEfiBootManagerPolicyProtocolGuid, + &mBootManagerPolicy, NULL ); }