diff mbox

[8/9] ArmPlatformPkg/Bds: show global FDT config in main menu

Message ID 1371801922-15142-9-git-send-email-ryan.harkin@linaro.org
State New
Headers show

Commit Message

Ryan Harkin June 21, 2013, 8:05 a.m. UTC
Previously, there was no way to read the global FDT config.

This patch displays the global FDT config after the boot devices in the main
menu.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
---
 ArmPlatformPkg/Bds/BootMenu.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox

Patch

diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c
index 09e1075..2b32e83 100644
--- a/ArmPlatformPkg/Bds/BootMenu.c
+++ b/ArmPlatformPkg/Bds/BootMenu.c
@@ -659,6 +659,9 @@  BootMenuMain (
   UINTN                         Index;
   UINTN                         BootMainEntryCount;
   CHAR8                         BootOptionSelectedStr[32];
+  EFI_DEVICE_PATH_PROTOCOL*     DefaultFdtDevicePath;
+  UINTN                         FdtDevicePathSize;
+
 
   BootOption              = NULL;
   BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
@@ -734,6 +737,33 @@  BootMenuMain (
     }
     BootOptionCount = OptionCount-1;
 
+    // Display the global FDT config
+    Print(L"-----------------------\n");
+      {
+        EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL*   EfiDevicePathFromTextProtocol;
+        EFI_DEVICE_PATH_PROTOCOL*             FdtDevicePath;
+        EFI_DEVICE_PATH_TO_TEXT_PROTOCOL*     DevicePathToTextProtocol;
+        CHAR16*                               DevicePathTxt;
+
+        // Get the default FDT device path
+        Status = gBS->LocateProtocol (&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID **)&EfiDevicePathFromTextProtocol);
+        ASSERT_EFI_ERROR(Status);
+        DefaultFdtDevicePath = EfiDevicePathFromTextProtocol->ConvertTextToDevicePath ((CHAR16*)PcdGetPtr(PcdFdtDevicePath));
+
+        // Get the FDT device path
+        FdtDevicePathSize = GetDevicePathSize (DefaultFdtDevicePath);
+        Status = GetEnvironmentVariable ((CHAR16 *)L"Fdt", &gArmGlobalVariableGuid, DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath);
+
+        // Convert FdtDevicePath to text
+        if (EFI_ERROR(Status)) {
+          DevicePathTxt = L"not configured";
+        } else {
+          Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevicePathToTextProtocol);
+          DevicePathTxt = DevicePathToTextProtocol->ConvertDevicePathToText ( FdtDevicePath, TRUE, TRUE );
+        }
+        Print(L"Global FDT Config\n\t- %s\n", DevicePathTxt);
+      }
+
     // Display the hardcoded Boot entries
     Print(L"-----------------------\n");
     for (Index = 0; Index < BootMainEntryCount; Index++) {