diff options
author | Ryan Harkin <ryan.harkin@linaro.org> | 2012-11-26 17:04:36 +0000 |
---|---|---|
committer | Ryan Harkin <ryan.harkin@linaro.org> | 2012-11-26 17:04:36 +0000 |
commit | 0de715e1d58d16bc22947eb12527ab490267f060 (patch) | |
tree | 809c0e13d7e3abd9d8a50dd63e8f367da04ad90e | |
parent | 25df3c4a36a94eae644089a093a2607fe79f24d9 (diff) | |
parent | 87150407e1570cf5883dd927d2f05be12113b642 (diff) |
Merge branch 'armlt-tracking-menu' into armlt-tracking
-rw-r--r-- | edk2/ArmPlatformPkg/Bds/BootMenu.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/edk2/ArmPlatformPkg/Bds/BootMenu.c b/edk2/ArmPlatformPkg/Bds/BootMenu.c index c2b91b8ba..1cc048e51 100644 --- a/edk2/ArmPlatformPkg/Bds/BootMenu.c +++ b/edk2/ArmPlatformPkg/Bds/BootMenu.c @@ -592,8 +592,8 @@ struct BOOT_MAIN_ENTRY { CONST CHAR16* Description;
EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList);
} BootMainEntries[] = {
- { L"Shell", BootShell },
{ L"Boot Manager", BootMenuManager },
+ { L"Shell", BootShell },
};
@@ -604,6 +604,7 @@ BootMenuMain ( {
LIST_ENTRY BootOptionsList;
UINTN OptionCount;
+ UINTN HardCodedOptionCount; UINTN BootOptionCount;
EFI_STATUS Status;
LIST_ENTRY* Entry;
@@ -611,6 +612,10 @@ BootMenuMain ( UINTN BootOptionSelected;
UINTN Index;
UINTN BootMainEntryCount;
+ CHAR8 BootOptionSelectedStr[32]; + EFI_DEVICE_PATH_PROTOCOL* DefaultFdtDevicePath; + UINTN FdtDevicePathSize; + BootOption = NULL;
BootMainEntryCount = sizeof(BootMainEntries) / sizeof(struct BOOT_MAIN_ENTRY);
@@ -670,17 +675,50 @@ 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", DefaultFdtDevicePath, &FdtDevicePathSize, (VOID **)&FdtDevicePath); + ASSERT_EFI_ERROR(Status); + + // Convert FdtDevicePath to text + 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++) {
- Print(L"[%d] %s\n",OptionCount,BootMainEntries[Index]);
+ Print(L"[%c] %s\n", ('a'+Index), BootMainEntries[Index]); OptionCount++;
}
+ HardCodedOptionCount=Index; // Request the boot entry from the user
BootOptionSelected = 0;
while (BootOptionSelected == 0) {
Print(L"Start: ");
- Status = GetHIInputInteger (&BootOptionSelected);
+ Status = GetHIInputAscii (BootOptionSelectedStr,8); + + if (BootOptionSelectedStr[0]-'0' <= OptionCount) { + BootOptionSelected = BootOptionSelectedStr[0] - '0'; + } else if (BootOptionSelectedStr[0]-'a' <= HardCodedOptionCount) { + BootOptionSelected = BootOptionCount + 1 + BootOptionSelectedStr[0] - 'a'; + } + if (EFI_ERROR(Status) || (BootOptionSelected == 0) || (BootOptionSelected > OptionCount)) {
Print(L"Invalid input (max %d)\n",(OptionCount-1));
BootOptionSelected = 0;
|