blob: 955b7503b41ad459ed70dd5f56ef629182cfeb93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* Copyright (c) 2026, Apollo Telephone Laboratories.
* Provided under the BSD-3 clause.
*/
#include <sboot/sboot.h>
#include <sboot/fwi.h>
#include <sboot/config.h>
#define MENU_CLEAR() \
Print(L"\r\t\t\t\t\t\t\r")
#define MENU_WRITE(ENTRY) \
Print(L"<-- %s -->", (ENTRY)->Name);
VOID
SBootMenu(OUT BOOT_ENTRY *Entry)
{
EFI_INPUT_KEY Key;
UINTN CurrentEntryIndex;
BOOT_ENTRY *CurrentEntry;
EFI_STATUS Status;
BOOLEAN Run = TRUE;
Print(L" ===== USE LEFT/RIGHT ARROW KEYS TO SELECT ====\n\n");
CurrentEntryIndex = 0;
CurrentEntry = &ConfigBootEntries[CurrentEntryIndex];
MENU_WRITE(CurrentEntry);
while (Run) {
Status = uefi_call_wrapper(gST->ConIn->ReadKeyStroke, 2, gST->ConIn, &Key);
if (EFI_ERROR(Status)) {
continue;
}
switch (Key.ScanCode) {
case 0x0:
Run = FALSE;
continue;
case SCAN_RIGHT:
if (CurrentEntryIndex < NELEM(ConfigBootEntries) - 2) {
++CurrentEntryIndex;
CurrentEntry = &ConfigBootEntries[CurrentEntryIndex];
MENU_CLEAR();
MENU_WRITE(CurrentEntry);
}
break;
case SCAN_LEFT:
if (CurrentEntryIndex == 0)
continue;
--CurrentEntryIndex;
CurrentEntry = &ConfigBootEntries[CurrentEntryIndex];
MENU_CLEAR();
MENU_WRITE(CurrentEntry);
break;
}
}
Print(L"\nBooting %s (%s)\n", CurrentEntry->Name, CurrentEntry->BootPath);
*Entry = *CurrentEntry;
}
|