X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FLibrary%2FGenericBdsLib%2FBdsBoot.c;h=f816d4c39eda8b055c6fb553d7b3a2b92b0d86b5;hb=7d84fbbb5e504002646e17746dbb79a6f33d5f14;hp=134833286fcc8933d252e129ca8aaa7d9660d8ed;hpb=69fc8f080e07ea026e8fbb8610cfb89c099d6db2;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index 134833286f..f816d4c39e 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -521,23 +521,23 @@ BdsDeleteAllInvalidLegacyBootOptions ( return Status; } - LegacyBios->GetBbsInfo ( - LegacyBios, - &HddCount, - &LocalHddInfo, - &BbsCount, - &LocalBbsTable - ); - BootOrder = BdsLibGetVariableAndSize ( L"BootOrder", &gEfiGlobalVariableGuid, &BootOrderSize ); if (BootOrder == NULL) { - BootOrderSize = 0; + return EFI_NOT_FOUND; } + LegacyBios->GetBbsInfo ( + LegacyBios, + &HddCount, + &LocalHddInfo, + &BbsCount, + &LocalBbsTable + ); + Index = 0; while (Index < BootOrderSize / sizeof (UINT16)) { UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]); @@ -634,9 +634,7 @@ BdsDeleteAllInvalidLegacyBootOptions ( // Shrinking variable with existing variable implementation shouldn't fail. // ASSERT_EFI_ERROR (Status); - if (BootOrder != NULL) { - FreePool (BootOrder); - } + FreePool (BootOrder); return Status; } @@ -2526,11 +2524,28 @@ BdsExpandPartitionPartialDevicePathToFull ( // If exist, search the front path which point to partition node in the variable instants. // If fail to find or HD_BOOT_DEVICE_PATH_VARIABLE_NAME not exist, reconnect all and search in all system // - CachedDevicePath = BdsLibGetVariableAndSize ( - HD_BOOT_DEVICE_PATH_VARIABLE_NAME, - &gHdBootDevicePathVariablGuid, - &CachedDevicePathSize - ); + GetVariable2 ( + HD_BOOT_DEVICE_PATH_VARIABLE_NAME, + &gHdBootDevicePathVariablGuid, + (VOID **) &CachedDevicePath, + &CachedDevicePathSize + ); + + // + // Delete the invalid HD_BOOT_DEVICE_PATH_VARIABLE_NAME variable. + // + if ((CachedDevicePath != NULL) && !IsDevicePathValid (CachedDevicePath, CachedDevicePathSize)) { + FreePool (CachedDevicePath); + CachedDevicePath = NULL; + Status = gRT->SetVariable ( + HD_BOOT_DEVICE_PATH_VARIABLE_NAME, + &gHdBootDevicePathVariablGuid, + 0, + 0, + NULL + ); + ASSERT_EFI_ERROR (Status); + } if (CachedDevicePath != NULL) { TempNewDevicePath = CachedDevicePath; @@ -2593,7 +2608,7 @@ BdsExpandPartitionPartialDevicePathToFull ( Status = gRT->SetVariable ( HD_BOOT_DEVICE_PATH_VARIABLE_NAME, &gHdBootDevicePathVariablGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, GetDevicePathSize (CachedDevicePath), CachedDevicePath ); @@ -2692,7 +2707,7 @@ BdsExpandPartitionPartialDevicePathToFull ( Status = gRT->SetVariable ( HD_BOOT_DEVICE_PATH_VARIABLE_NAME, &gHdBootDevicePathVariablGuid, - EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, GetDevicePathSize (CachedDevicePath), CachedDevicePath ); @@ -3204,9 +3219,16 @@ BdsLibEnumerateAllBootOption ( (VOID **) &BlkIo ); // - // skip the fixed block io then the removable block io + // skip the logical partition // - if (EFI_ERROR (Status) || (BlkIo->Media->RemovableMedia == Removable[RemovableIndex])) { + if (EFI_ERROR (Status) || BlkIo->Media->LogicalPartition) { + continue; + } + + // + // firstly fixed block io then the removable block io + // + if (BlkIo->Media->RemovableMedia == Removable[RemovableIndex]) { continue; } DevicePath = DevicePathFromHandle (BlockIoHandles[Index]); @@ -3268,6 +3290,7 @@ BdsLibEnumerateAllBootOption ( break; case BDS_EFI_MESSAGE_MISC_BOOT: + default: if (MiscNumber != 0) { UnicodeSPrint (Buffer, sizeof (Buffer), L"%s %d", BdsLibGetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC)), MiscNumber); } else { @@ -3276,9 +3299,6 @@ BdsLibEnumerateAllBootOption ( BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer); MiscNumber++; break; - - default: - break; } } }