mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 05:34:31 +02:00
ArmPlatformPkg/Bds: Check if the assumed requirements are set before to use it
There were some assumptions that some PCDs and protocols were defined. Check if these requirements are defined; either print a debug message to inform the user or skip the statements that require these PCDs or protocol. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11915 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5b491514ec
commit
aa95e2f79c
@ -210,8 +210,16 @@ DefineDefaultBootEntries (
|
|||||||
Size = 0;
|
Size = 0;
|
||||||
Status = gRT->GetVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &Size, NULL);
|
Status = gRT->GetVariable (L"BootOrder", &gEfiGlobalVariableGuid, NULL, &Size, NULL);
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
|
if ((PcdGetPtr(PcdDefaultBootDevicePath) == NULL) || (StrLen ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath)) == 0)) {
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
|
Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR(Status)) {
|
||||||
|
// You must provide an implementation of DevicePathFromTextProtocol in your firmware (eg: DevicePathDxe)
|
||||||
|
DEBUG((EFI_D_ERROR,"Error: Bds requires DevicePathFromTextProtocol\n"));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
BootDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath));
|
BootDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdDefaultBootDevicePath));
|
||||||
|
|
||||||
DEBUG_CODE_BEGIN();
|
DEBUG_CODE_BEGIN();
|
||||||
@ -238,6 +246,8 @@ DefineDefaultBootEntries (
|
|||||||
&BdsLoadOption
|
&BdsLoadOption
|
||||||
);
|
);
|
||||||
FreePool (BdsLoadOption);
|
FreePool (BdsLoadOption);
|
||||||
|
} else {
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,10 +351,12 @@ BdsEntry (
|
|||||||
//
|
//
|
||||||
// Declare the Firmware Vendor
|
// Declare the Firmware Vendor
|
||||||
//
|
//
|
||||||
|
if (PcdGetPtr(PcdFirmwareVendor)) {
|
||||||
Size = 0x100;
|
Size = 0x100;
|
||||||
gST->FirmwareVendor = AllocateRuntimePool (Size);
|
gST->FirmwareVendor = AllocateRuntimePool (Size);
|
||||||
ASSERT (gST->FirmwareVendor != NULL);
|
ASSERT (gST->FirmwareVendor != NULL);
|
||||||
UnicodeSPrint (gST->FirmwareVendor, Size, L"%a EFI %a %a", PcdGetPtr(PcdFirmwareVendor), __DATE__, __TIME__);
|
UnicodeSPrint (gST->FirmwareVendor, Size, L"%a EFI %a %a", PcdGetPtr(PcdFirmwareVendor), __DATE__, __TIME__);
|
||||||
|
}
|
||||||
|
|
||||||
// If BootNext environment variable is defined then we just load it !
|
// If BootNext environment variable is defined then we just load it !
|
||||||
Status = BdsStartBootOption (L"BootNext");
|
Status = BdsStartBootOption (L"BootNext");
|
||||||
|
@ -427,7 +427,11 @@ BootMenuMain (
|
|||||||
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
|
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL* DevicePathToTextProtocol;
|
||||||
|
|
||||||
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
|
Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR(Status)) {
|
||||||
|
// You must provide an implementation of DevicePathToTextProtocol in your firmware (eg: DevicePathDxe)
|
||||||
|
DEBUG((EFI_D_ERROR,"Error: Bds requires DevicePathToTextProtocol\n"));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);
|
DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText(BootOption->FilePathList,TRUE,TRUE);
|
||||||
|
|
||||||
Print(L"\t- %s\n",DevicePathTxt);
|
Print(L"\t- %s\n",DevicePathTxt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user