From 95b3580f8217f1cd19994b480447c42cee752a20 Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Thu, 22 Sep 2011 23:23:19 +0000 Subject: ArmPlatformPkg/Bds: Add an option in the Boot Manager to edit the Device Path of the Platform Device Tree git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12430 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/Bds/BootMenu.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'ArmPlatformPkg') diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 543958bf17..7d1010bac2 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -436,6 +436,49 @@ EXIT: return Status; } +EFI_STATUS +UpdateFdtPath ( + IN LIST_ENTRY *BootOptionsList + ) +{ + EFI_STATUS Status; + + BDS_SUPPORTED_DEVICE *SupportedBootDevice; + EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNode; + EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath; + + Status = SelectBootDevice (&SupportedBootDevice); + if (EFI_ERROR(Status)) { + Status = EFI_ABORTED; + goto EXIT; + } + + // Create the specific device path node + Print(L"File path of the FDT blob: "); + Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &FdtDevicePathNode, NULL, NULL); + if (EFI_ERROR(Status)) { + Status = EFI_ABORTED; + goto EXIT; + } + + if (FdtDevicePathNode != NULL) { + // Append the Device Path node to the select device path + FdtDevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNode); + Status = gRT->SetVariable ((CHAR16*)L"FDT", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), 4, &FdtDevicePath); + ASSERT_EFI_ERROR(Status); + } else { + gRT->SetVariable ((CHAR16*)L"FDT", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), 0, NULL); + ASSERT_EFI_ERROR(Status); + } + +EXIT: + if (Status == EFI_ABORTED) { + Print(L"\n"); + } + FreePool(SupportedBootDevice); + return Status; +} + struct BOOT_MANAGER_ENTRY { CONST CHAR16* Description; EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList); @@ -443,6 +486,7 @@ struct BOOT_MANAGER_ENTRY { { L"Add Boot Device Entry", BootMenuAddBootOption }, { L"Update Boot Device Entry", BootMenuUpdateBootOption }, { L"Remove Boot Device Entry", BootMenuRemoveBootOption }, + { L"Update FDT path", UpdateFdtPath }, }; EFI_STATUS -- cgit v1.2.3