]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Add an option in the Boot Manager to edit the Device Path of...
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Sep 2011 23:23:19 +0000 (23:23 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Sep 2011 23:23:19 +0000 (23:23 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12430 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/BootMenu.c

index 543958bf17a794f4c161a945ee436a8e8db98b02..7d1010bac274469ecc3a3c5898cc5bcb72f4b54b 100644 (file)
@@ -436,6 +436,49 @@ EXIT:
   return Status;\r
 }\r
 \r
+EFI_STATUS\r
+UpdateFdtPath (\r
+  IN LIST_ENTRY *BootOptionsList\r
+  )\r
+{\r
+  EFI_STATUS Status;\r
+\r
+  BDS_SUPPORTED_DEVICE *SupportedBootDevice;\r
+  EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNode;\r
+  EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;\r
+\r
+  Status = SelectBootDevice (&SupportedBootDevice);\r
+  if (EFI_ERROR(Status)) {\r
+    Status = EFI_ABORTED;\r
+    goto EXIT;\r
+  }\r
+\r
+  // Create the specific device path node\r
+  Print(L"File path of the FDT blob: ");\r
+  Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &FdtDevicePathNode, NULL, NULL);\r
+  if (EFI_ERROR(Status)) {\r
+    Status = EFI_ABORTED;\r
+    goto EXIT;\r
+  }\r
+\r
+  if (FdtDevicePathNode != NULL) {\r
+    // Append the Device Path node to the select device path\r
+    FdtDevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNode);\r
+    Status = gRT->SetVariable ((CHAR16*)L"FDT", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), 4, &FdtDevicePath);\r
+    ASSERT_EFI_ERROR(Status);\r
+  } else {\r
+    gRT->SetVariable ((CHAR16*)L"FDT", &gEfiGlobalVariableGuid, (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS ), 0, NULL);\r
+    ASSERT_EFI_ERROR(Status);\r
+  }\r
+\r
+EXIT:\r
+  if (Status == EFI_ABORTED) {\r
+    Print(L"\n");\r
+  }\r
+  FreePool(SupportedBootDevice);\r
+  return Status;\r
+}\r
+\r
 struct BOOT_MANAGER_ENTRY {\r
   CONST CHAR16* Description;\r
   EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);\r
@@ -443,6 +486,7 @@ struct BOOT_MANAGER_ENTRY {
     { L"Add Boot Device Entry", BootMenuAddBootOption },\r
     { L"Update Boot Device Entry", BootMenuUpdateBootOption },\r
     { L"Remove Boot Device Entry", BootMenuRemoveBootOption },\r
+    { L"Update FDT path", UpdateFdtPath },\r
 };\r
 \r
 EFI_STATUS\r