3 * Copyright (c) 2011, ARM Limited. All rights reserved.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "BdsInternal.h"
17 extern EFI_HANDLE mImageHandle
;
18 extern BDS_LOAD_OPTION_SUPPORT
*BdsLoadOptionSupportList
;
22 OUT BDS_SUPPORTED_DEVICE
** SupportedBootDevice
26 LIST_ENTRY SupportedDeviceList
;
27 UINTN SupportedDeviceCount
;
29 UINTN SupportedDeviceSelected
;
33 // List the Boot Devices supported
36 // Start all the drivers first
37 BdsConnectAllDrivers ();
39 // List the supported devices
40 Status
= BootDeviceListSupportedInit (&SupportedDeviceList
);
41 ASSERT_EFI_ERROR(Status
);
43 SupportedDeviceCount
= 0;
44 for (Entry
= GetFirstNode (&SupportedDeviceList
);
45 !IsNull (&SupportedDeviceList
,Entry
);
46 Entry
= GetNextNode (&SupportedDeviceList
,Entry
)
49 *SupportedBootDevice
= SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry
);
50 Print(L
"[%d] %s\n",SupportedDeviceCount
+1,(*SupportedBootDevice
)->Description
);
53 CHAR16
* DevicePathTxt
;
54 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
* DevicePathToTextProtocol
;
56 Status
= gBS
->LocateProtocol (&gEfiDevicePathToTextProtocolGuid
, NULL
, (VOID
**)&DevicePathToTextProtocol
);
57 ASSERT_EFI_ERROR(Status
);
58 DevicePathTxt
= DevicePathToTextProtocol
->ConvertDevicePathToText ((*SupportedBootDevice
)->DevicePathProtocol
,TRUE
,TRUE
);
60 Print(L
"\t- %s\n",DevicePathTxt
);
62 FreePool(DevicePathTxt
);
65 SupportedDeviceCount
++;
68 if (SupportedDeviceCount
== 0) {
69 Print(L
"There is no supported device.\n");
75 // Select the Boot Device
77 SupportedDeviceSelected
= 0;
78 while (SupportedDeviceSelected
== 0) {
79 Print(L
"Select the Boot Device: ");
80 Status
= GetHIInputInteger (&SupportedDeviceSelected
);
81 if (EFI_ERROR(Status
)) {
84 } else if ((SupportedDeviceSelected
== 0) || (SupportedDeviceSelected
> SupportedDeviceCount
)) {
85 Print(L
"Invalid input (max %d)\n",SupportedDeviceCount
);
86 SupportedDeviceSelected
= 0;
91 // Get the Device Path for the selected boot device
94 for (Entry
= GetFirstNode (&SupportedDeviceList
);
95 !IsNull (&SupportedDeviceList
,Entry
);
96 Entry
= GetNextNode (&SupportedDeviceList
,Entry
)
99 if (Index
== SupportedDeviceSelected
) {
100 *SupportedBootDevice
= SUPPORTED_BOOT_DEVICE_FROM_LINK(Entry
);
107 BootDeviceListSupportedFree (&SupportedDeviceList
, *SupportedBootDevice
);
112 BootMenuAddBootOption (
113 IN LIST_ENTRY
*BootOptionsList
117 BDS_SUPPORTED_DEVICE
* SupportedBootDevice
;
118 ARM_BDS_LOADER_ARGUMENTS
* BootArguments
;
119 CHAR16 BootDescription
[BOOT_DEVICE_DESCRIPTION_MAX
];
120 CHAR8 CmdLine
[BOOT_DEVICE_OPTION_MAX
];
122 ARM_BDS_LOADER_TYPE BootType
;
123 BDS_LOAD_OPTION_ENTRY
*BdsLoadOptionEntry
;
124 EFI_DEVICE_PATH
*DevicePath
;
125 EFI_DEVICE_PATH_PROTOCOL
*DevicePathNode
;
126 EFI_DEVICE_PATH_PROTOCOL
*InitrdPathNode
;
127 EFI_DEVICE_PATH_PROTOCOL
*InitrdPath
;
132 SupportedBootDevice
= NULL
;
134 // List the Boot Devices supported
135 Status
= SelectBootDevice (&SupportedBootDevice
);
136 if (EFI_ERROR(Status
)) {
137 Status
= EFI_ABORTED
;
141 // Create the specific device path node
142 Print(L
"File path of the EFI Application or the kernel: ");
143 Status
= SupportedBootDevice
->Support
->CreateDevicePathNode (SupportedBootDevice
, &DevicePathNode
, &BootType
, &Attributes
);
144 if (EFI_ERROR(Status
)) {
145 Status
= EFI_ABORTED
;
148 // Append the Device Path node to the select device path
149 DevicePath
= AppendDevicePathNode (SupportedBootDevice
->DevicePathProtocol
, (CONST EFI_DEVICE_PATH_PROTOCOL
*)DevicePathNode
);
151 if ((BootType
== BDS_LOADER_KERNEL_LINUX_ATAG
) || (BootType
== BDS_LOADER_KERNEL_LINUX_FDT
)) {
152 // Create the specific device path node
153 Print(L
"File path of the initrd: ");
154 Status
= SupportedBootDevice
->Support
->CreateDevicePathNode (SupportedBootDevice
, &InitrdPathNode
, NULL
, NULL
);
155 if (EFI_ERROR(Status
) && Status
!= EFI_NOT_FOUND
) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
156 Status
= EFI_ABORTED
;
160 if (InitrdPathNode
!= NULL
) {
161 // Append the Device Path node to the select device path
162 InitrdPath
= AppendDevicePathNode (SupportedBootDevice
->DevicePathProtocol
, (CONST EFI_DEVICE_PATH_PROTOCOL
*)InitrdPathNode
);
167 Print(L
"Arguments to pass to the binary: ");
168 Status
= GetHIInputAscii (CmdLine
,BOOT_DEVICE_OPTION_MAX
);
169 if (EFI_ERROR(Status
)) {
170 Status
= EFI_ABORTED
;
171 goto FREE_DEVICE_PATH
;
174 CmdLineSize
= AsciiStrSize (CmdLine
);
175 InitrdSize
= GetDevicePathSize (InitrdPath
);
177 BootArguments
= (ARM_BDS_LOADER_ARGUMENTS
*)AllocatePool (sizeof(ARM_BDS_LOADER_ARGUMENTS
) + CmdLineSize
+ InitrdSize
);
179 BootArguments
->LinuxArguments
.CmdLineSize
= CmdLineSize
;
180 BootArguments
->LinuxArguments
.InitrdSize
= InitrdSize
;
181 CopyMem ((VOID
*)(&BootArguments
->LinuxArguments
+ 1), CmdLine
, CmdLineSize
);
182 CopyMem ((VOID
*)((UINTN
)(&BootArguments
->LinuxArguments
+ 1) + CmdLineSize
), InitrdPath
, InitrdSize
);
184 BootArguments
= NULL
;
187 Print(L
"Description for this new Entry: ");
188 Status
= GetHIInputStr (BootDescription
, BOOT_DEVICE_DESCRIPTION_MAX
);
189 if (EFI_ERROR(Status
)) {
190 Status
= EFI_ABORTED
;
191 goto FREE_DEVICE_PATH
;
195 BdsLoadOptionEntry
= (BDS_LOAD_OPTION_ENTRY
*)AllocatePool (sizeof(BDS_LOAD_OPTION_ENTRY
));
196 Status
= BootOptionCreate (Attributes
, BootDescription
, DevicePath
, BootType
, BootArguments
, &BdsLoadOptionEntry
->BdsLoadOption
);
197 if (!EFI_ERROR(Status
)) {
198 InsertTailList (BootOptionsList
, &BdsLoadOptionEntry
->Link
);
202 FreePool (DevicePath
);
206 if (Status
== EFI_ABORTED
) {
209 FreePool(SupportedBootDevice
);
215 BootMenuSelectBootOption (
216 IN LIST_ENTRY
* BootOptionsList
,
217 IN CONST CHAR16
* InputStatement
,
218 IN BOOLEAN OnlyArmBdsBootEntry
,
219 OUT BDS_LOAD_OPTION_ENTRY
** BdsLoadOptionEntry
224 BDS_LOAD_OPTION
* BdsLoadOption
;
225 UINTN BootOptionSelected
;
226 UINTN BootOptionCount
;
229 // Display the list of supported boot devices
231 for (Entry
= GetFirstNode (BootOptionsList
);
232 !IsNull (BootOptionsList
,Entry
);
233 Entry
= GetNextNode (BootOptionsList
, Entry
)
236 BdsLoadOption
= LOAD_OPTION_FROM_LINK(Entry
);
238 if (OnlyArmBdsBootEntry
&& !IS_ARM_BDS_BOOTENTRY (BdsLoadOption
)) {
242 Print (L
"[%d] %s\n", (BootOptionCount
+ 1), BdsLoadOption
->Description
);
245 CHAR16
* DevicePathTxt
;
246 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
* DevicePathToTextProtocol
;
247 ARM_BDS_LOADER_TYPE LoaderType
;
248 ARM_BDS_LOADER_OPTIONAL_DATA
* OptionalData
;
250 Status
= gBS
->LocateProtocol(&gEfiDevicePathToTextProtocolGuid
, NULL
, (VOID
**)&DevicePathToTextProtocol
);
251 ASSERT_EFI_ERROR(Status
);
252 DevicePathTxt
= DevicePathToTextProtocol
->ConvertDevicePathToText(BdsLoadOption
->FilePathList
,TRUE
,TRUE
);
254 Print(L
"\t- %s\n",DevicePathTxt
);
255 OptionalData
= BdsLoadOption
->OptionalData
;
256 LoaderType
= (ARM_BDS_LOADER_TYPE
)ReadUnaligned32 ((CONST UINT32
*)&OptionalData
->Header
.LoaderType
);
257 if ((LoaderType
== BDS_LOADER_KERNEL_LINUX_ATAG
) || (LoaderType
== BDS_LOADER_KERNEL_LINUX_FDT
)) {
258 Print (L
"\t- Arguments: %a\n",&OptionalData
->Arguments
.LinuxArguments
+ 1);
261 FreePool(DevicePathTxt
);
267 // Check if a valid boot option(s) is found
268 if (BootOptionCount
== 0) {
269 if (StrCmp (InputStatement
, DELETE_BOOT_ENTRY
) == 0) {
270 Print (L
"Nothing to remove!\n");
271 }else if (StrCmp (InputStatement
, UPDATE_BOOT_ENTRY
) == 0) {
272 Print (L
"Couldn't find valid boot entries\n");
274 Print (L
"No supported Boot Entry.\n");
277 return EFI_NOT_FOUND
;
280 // Get the index of the boot device to delete
281 BootOptionSelected
= 0;
282 while (BootOptionSelected
== 0) {
283 Print(InputStatement
);
284 Status
= GetHIInputInteger (&BootOptionSelected
);
285 if (EFI_ERROR(Status
)) {
287 } else if ((BootOptionSelected
== 0) || (BootOptionSelected
> BootOptionCount
)) {
288 Print(L
"Invalid input (max %d)\n",BootOptionCount
);
289 BootOptionSelected
= 0;
293 // Get the structure of the Boot device to delete
295 for (Entry
= GetFirstNode (BootOptionsList
);
296 !IsNull (BootOptionsList
, Entry
);
297 Entry
= GetNextNode (BootOptionsList
,Entry
)
300 if (Index
== BootOptionSelected
) {
301 *BdsLoadOptionEntry
= LOAD_OPTION_ENTRY_FROM_LINK(Entry
);
311 BootMenuRemoveBootOption (
312 IN LIST_ENTRY
*BootOptionsList
316 BDS_LOAD_OPTION_ENTRY
* BootOptionEntry
;
318 Status
= BootMenuSelectBootOption (BootOptionsList
, DELETE_BOOT_ENTRY
, FALSE
, &BootOptionEntry
);
319 if (EFI_ERROR(Status
)) {
323 // If the Boot Option was attached to a list remove it
324 if (!IsListEmpty (&BootOptionEntry
->Link
)) {
325 // Remove the entry from the list
326 RemoveEntryList (&BootOptionEntry
->Link
);
329 // Delete the BDS Load option structures
330 BootOptionDelete (BootOptionEntry
->BdsLoadOption
);
336 BootMenuUpdateBootOption (
337 IN LIST_ENTRY
*BootOptionsList
341 BDS_LOAD_OPTION_ENTRY
*BootOptionEntry
;
342 BDS_LOAD_OPTION
*BootOption
;
343 BDS_LOAD_OPTION_SUPPORT
* DeviceSupport
;
344 ARM_BDS_LOADER_ARGUMENTS
* BootArguments
;
345 CHAR16 BootDescription
[BOOT_DEVICE_DESCRIPTION_MAX
];
346 CHAR8 CmdLine
[BOOT_DEVICE_OPTION_MAX
];
347 EFI_DEVICE_PATH
* DevicePath
;
348 ARM_BDS_LOADER_TYPE BootType
;
349 ARM_BDS_LOADER_OPTIONAL_DATA
* OptionalData
;
350 ARM_BDS_LINUX_ARGUMENTS
* LinuxArguments
;
351 EFI_DEVICE_PATH
* InitrdPathList
;
355 Status
= BootMenuSelectBootOption (BootOptionsList
, UPDATE_BOOT_ENTRY
, TRUE
, &BootOptionEntry
);
356 if (EFI_ERROR(Status
)) {
359 BootOption
= BootOptionEntry
->BdsLoadOption
;
361 // Get the device support for this Boot Option
362 Status
= BootDeviceGetDeviceSupport (BootOption
, &DeviceSupport
);
363 if (EFI_ERROR(Status
)) {
364 Print(L
"Not possible to retrieve the supported device for the update\n");
365 return EFI_UNSUPPORTED
;
368 Print(L
"File path of the EFI Application or the kernel: ");
369 Status
= DeviceSupport
->UpdateDevicePathNode (BootOption
->FilePathList
, &DevicePath
, NULL
, NULL
);
370 if (EFI_ERROR(Status
)) {
371 Status
= EFI_ABORTED
;
375 OptionalData
= BootOption
->OptionalData
;
376 BootType
= (ARM_BDS_LOADER_TYPE
)ReadUnaligned32 ((UINT32
*)(&OptionalData
->Header
.LoaderType
));
378 // TODO: Allow adding an initrd to a boot entry without one
379 if ((BootType
== BDS_LOADER_KERNEL_LINUX_ATAG
) || (BootType
== BDS_LOADER_KERNEL_LINUX_FDT
)) {
380 LinuxArguments
= &OptionalData
->Arguments
.LinuxArguments
;
382 CmdLineSize
= ReadUnaligned16 ((CONST UINT16
*)&LinuxArguments
->CmdLineSize
);
384 InitrdSize
= ReadUnaligned16 ((CONST UINT16
*)&LinuxArguments
->InitrdSize
);
385 if (InitrdSize
> 0) {
386 Print(L
"File path of the initrd: ");
387 Status
= DeviceSupport
->UpdateDevicePathNode ((EFI_DEVICE_PATH
*)((LinuxArguments
+ 1) + CmdLineSize
), &InitrdPathList
, NULL
, NULL
);
388 if (EFI_ERROR(Status
) && Status
!= EFI_NOT_FOUND
) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
389 Status
= EFI_ABORTED
;
392 InitrdSize
= GetDevicePathSize (InitrdPathList
);
395 Print(L
"Arguments to pass to the binary: ");
396 if (CmdLineSize
> 0) {
397 AsciiStrnCpy(CmdLine
, (CONST CHAR8
*)(LinuxArguments
+ 1), CmdLineSize
);
401 Status
= EditHIInputAscii (CmdLine
, BOOT_DEVICE_OPTION_MAX
);
402 if (EFI_ERROR(Status
)) {
403 Status
= EFI_ABORTED
;
404 goto FREE_DEVICE_PATH
;
407 CmdLineSize
= AsciiStrSize (CmdLine
);
409 BootArguments
= (ARM_BDS_LOADER_ARGUMENTS
*)AllocatePool(sizeof(ARM_BDS_LOADER_ARGUMENTS
) + CmdLineSize
+ InitrdSize
);
410 BootArguments
->LinuxArguments
.CmdLineSize
= CmdLineSize
;
411 BootArguments
->LinuxArguments
.InitrdSize
= InitrdSize
;
412 CopyMem (&BootArguments
->LinuxArguments
+ 1, CmdLine
, CmdLineSize
);
413 CopyMem ((UINTN
)(&BootArguments
->LinuxArguments
+ 1) + CmdLine
, InitrdPathList
, InitrdSize
);
415 BootArguments
= NULL
;
418 Print(L
"Description for this new Entry: ");
419 StrnCpy (BootDescription
, BootOption
->Description
, BOOT_DEVICE_DESCRIPTION_MAX
);
420 Status
= EditHIInputStr (BootDescription
, BOOT_DEVICE_DESCRIPTION_MAX
);
421 if (EFI_ERROR(Status
)) {
422 Status
= EFI_ABORTED
;
423 goto FREE_DEVICE_PATH
;
427 Status
= BootOptionUpdate (BootOption
, BootOption
->Attributes
, BootDescription
, DevicePath
, BootType
, BootArguments
);
430 FreePool (DevicePath
);
433 if (Status
== EFI_ABORTED
) {
441 IN LIST_ENTRY
*BootOptionsList
446 BDS_SUPPORTED_DEVICE
*SupportedBootDevice
;
447 EFI_DEVICE_PATH_PROTOCOL
*FdtDevicePathNode
;
448 EFI_DEVICE_PATH_PROTOCOL
*FdtDevicePath
;
450 Status
= SelectBootDevice (&SupportedBootDevice
);
451 if (EFI_ERROR(Status
)) {
452 Status
= EFI_ABORTED
;
456 // Create the specific device path node
457 Print(L
"File path of the FDT blob: ");
458 Status
= SupportedBootDevice
->Support
->CreateDevicePathNode (SupportedBootDevice
, &FdtDevicePathNode
, NULL
, NULL
);
459 if (EFI_ERROR(Status
)) {
460 Status
= EFI_ABORTED
;
464 if (FdtDevicePathNode
!= NULL
) {
465 // Append the Device Path node to the select device path
466 FdtDevicePath
= AppendDevicePathNode (SupportedBootDevice
->DevicePathProtocol
, FdtDevicePathNode
);
467 Status
= gRT
->SetVariable ((CHAR16
*)L
"FDT", &gEfiGlobalVariableGuid
, (EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
), 4, &FdtDevicePath
);
468 ASSERT_EFI_ERROR(Status
);
470 gRT
->SetVariable ((CHAR16
*)L
"FDT", &gEfiGlobalVariableGuid
, (EFI_VARIABLE_RUNTIME_ACCESS
| EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
), 0, NULL
);
471 ASSERT_EFI_ERROR(Status
);
475 if (Status
== EFI_ABORTED
) {
478 FreePool(SupportedBootDevice
);
482 struct BOOT_MANAGER_ENTRY
{
483 CONST CHAR16
* Description
;
484 EFI_STATUS (*Callback
) (IN LIST_ENTRY
*BootOptionsList
);
485 } BootManagerEntries
[] = {
486 { L
"Add Boot Device Entry", BootMenuAddBootOption
},
487 { L
"Update Boot Device Entry", BootMenuUpdateBootOption
},
488 { L
"Remove Boot Device Entry", BootMenuRemoveBootOption
},
489 { L
"Update FDT path", UpdateFdtPath
},
494 IN LIST_ENTRY
*BootOptionsList
498 UINTN OptionSelected
;
499 UINTN BootManagerEntryCount
;
502 BootManagerEntryCount
= sizeof(BootManagerEntries
) / sizeof(struct BOOT_MANAGER_ENTRY
);
505 // Display Boot Manager menu
506 for (Index
= 0; Index
< BootManagerEntryCount
; Index
++) {
507 Print(L
"[%d] %s\n",Index
+1,BootManagerEntries
[Index
]);
509 Print(L
"[%d] Return to main menu\n",Index
+1);
511 // Select which entry to call
513 Status
= GetHIInputInteger (&OptionSelected
);
514 if (EFI_ERROR(Status
) || (OptionSelected
== (BootManagerEntryCount
+1))) {
515 if (EFI_ERROR(Status
)) {
519 } else if ((OptionSelected
> 0) && (OptionSelected
<= BootManagerEntryCount
)) {
520 BootManagerEntries
[OptionSelected
-1].Callback (BootOptionsList
);
523 // Should never go here
528 IN LIST_ENTRY
*BootOptionsList
534 Status
= BdsLoadApplication (mImageHandle
, L
"Ebl", 0, NULL
);
535 if (Status
== EFI_NOT_FOUND
) {
536 Print (L
"Error: EFI Application not found.\n");
537 } else if (EFI_ERROR(Status
)) {
538 Print (L
"Error: Status Code: 0x%X\n",(UINT32
)Status
);
544 struct BOOT_MAIN_ENTRY
{
545 CONST CHAR16
* Description
;
546 EFI_STATUS (*Callback
) (IN LIST_ENTRY
*BootOptionsList
);
547 } BootMainEntries
[] = {
549 { L
"Boot Manager", BootMenuManager
},
558 LIST_ENTRY BootOptionsList
;
560 UINTN BootOptionCount
;
563 BDS_LOAD_OPTION
* BootOption
;
564 UINTN BootOptionSelected
;
566 UINTN BootMainEntryCount
;
569 BootMainEntryCount
= sizeof(BootMainEntries
) / sizeof(struct BOOT_MAIN_ENTRY
);
573 BootOptionList (&BootOptionsList
);
577 // Display the Boot options
578 for (Entry
= GetFirstNode (&BootOptionsList
);
579 !IsNull (&BootOptionsList
,Entry
);
580 Entry
= GetNextNode (&BootOptionsList
,Entry
)
583 BootOption
= LOAD_OPTION_FROM_LINK(Entry
);
585 Print(L
"[%d] %s\n", OptionCount
, BootOption
->Description
);
588 CHAR16
* DevicePathTxt
;
589 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
* DevicePathToTextProtocol
;
590 ARM_BDS_LOADER_OPTIONAL_DATA
* OptionalData
;
592 ARM_BDS_LOADER_TYPE LoaderType
;
594 Status
= gBS
->LocateProtocol (&gEfiDevicePathToTextProtocolGuid
, NULL
, (VOID
**)&DevicePathToTextProtocol
);
595 if (EFI_ERROR(Status
)) {
596 // You must provide an implementation of DevicePathToTextProtocol in your firmware (eg: DevicePathDxe)
597 DEBUG((EFI_D_ERROR
,"Error: Bds requires DevicePathToTextProtocol\n"));
600 DevicePathTxt
= DevicePathToTextProtocol
->ConvertDevicePathToText (BootOption
->FilePathList
, TRUE
, TRUE
);
602 Print(L
"\t- %s\n",DevicePathTxt
);
604 // If it is a supported BootEntry then print its details
605 if (IS_ARM_BDS_BOOTENTRY (BootOption
)) {
606 OptionalData
= BootOption
->OptionalData
;
607 LoaderType
= (ARM_BDS_LOADER_TYPE
)ReadUnaligned32 ((CONST UINT32
*)&OptionalData
->Header
.LoaderType
);
608 if ((LoaderType
== BDS_LOADER_KERNEL_LINUX_ATAG
) || (LoaderType
== BDS_LOADER_KERNEL_LINUX_FDT
)) {
609 if (ReadUnaligned16 (&OptionalData
->Arguments
.LinuxArguments
.InitrdSize
) > 0) {
610 CmdLineSize
= ReadUnaligned16 (&OptionalData
->Arguments
.LinuxArguments
.CmdLineSize
);
611 DevicePathTxt
= DevicePathToTextProtocol
->ConvertDevicePathToText (
612 GetAlignedDevicePath ((EFI_DEVICE_PATH
*)((UINTN
)(&OptionalData
->Arguments
.LinuxArguments
+ 1) + CmdLineSize
)), TRUE
, TRUE
);
613 Print(L
"\t- Initrd: %s\n", DevicePathTxt
);
615 Print(L
"\t- Arguments: %a\n", (&OptionalData
->Arguments
.LinuxArguments
+ 1));
617 Print(L
"\t- LoaderType: %d\n", LoaderType
);
619 FreePool(DevicePathTxt
);
624 BootOptionCount
= OptionCount
-1;
626 // Display the hardcoded Boot entries
627 for (Index
= 0; Index
< BootMainEntryCount
; Index
++) {
628 Print(L
"[%d] %s\n",OptionCount
,BootMainEntries
[Index
]);
632 // Request the boot entry from the user
633 BootOptionSelected
= 0;
634 while (BootOptionSelected
== 0) {
636 Status
= GetHIInputInteger (&BootOptionSelected
);
637 if (EFI_ERROR(Status
) || (BootOptionSelected
== 0) || (BootOptionSelected
> OptionCount
)) {
638 Print(L
"Invalid input (max %d)\n",(OptionCount
-1));
639 BootOptionSelected
= 0;
643 // Start the selected entry
644 if (BootOptionSelected
> BootOptionCount
) {
645 // Start the hardcoded entry
646 Status
= BootMainEntries
[BootOptionSelected
- BootOptionCount
- 1].Callback (&BootOptionsList
);
648 // Find the selected entry from the Boot#### list
650 for (Entry
= GetFirstNode (&BootOptionsList
);
651 !IsNull (&BootOptionsList
,Entry
);
652 Entry
= GetNextNode (&BootOptionsList
,Entry
)
655 if (Index
== BootOptionSelected
) {
656 BootOption
= LOAD_OPTION_FROM_LINK(Entry
);
662 Status
= BootOptionStart (BootOption
);
665 // Should never go here