summaryrefslogtreecommitdiff
path: root/MokManager.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-03-12 16:03:38 +0100
committerPeter Jones <pjones@redhat.com>2018-03-12 18:00:41 -0400
commit1fe31ee1b4ebf2f177d512d0301e11de0689a275 (patch)
tree50f082d81f6cab93b9394328c40f005e79e0f256 /MokManager.c
parentd3b7ba1b09e64c0c17afc48270e38c364ded2cb0 (diff)
downloadefi-boot-shim-1fe31ee1b4ebf2f177d512d0301e11de0689a275.tar.gz
efi-boot-shim-1fe31ee1b4ebf2f177d512d0301e11de0689a275.zip
console: Add console_print and console_print_at helpers
This is a preparation commit for removing the setup_console(1) calls from MokManager and shim so that we don't force the EFI console to switch to text-mode. This commit replaces all direct calls to Print / PrintAt with calls to the new helpers (no functional changes) so that we can delay calling setup_console(1) till the first Print call in a follow-up patch. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'MokManager.c')
-rw-r--r--MokManager.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/MokManager.c b/MokManager.c
index 6f54163f..1a590e08 100644
--- a/MokManager.c
+++ b/MokManager.c
@@ -665,19 +665,19 @@ static EFI_STATUS get_line(UINT32 * length, CHAR16 * line, UINT32 line_max,
continue;
} else if (key.UnicodeChar == CHAR_BACKSPACE) {
if (show) {
- Print(L"\b");
+ console_print(L"\b");
}
line[--count] = '\0';
continue;
}
if (show) {
- Print(L"%c", key.UnicodeChar);
+ console_print(L"%c", key.UnicodeChar);
}
line[count++] = key.UnicodeChar;
} while (key.UnicodeChar != CHAR_CARRIAGE_RETURN);
- Print(L"\n");
+ console_print(L"\n");
*length = count;
@@ -734,7 +734,7 @@ static void console_save_and_set_mode(SIMPLE_TEXT_OUTPUT_MODE * SavedMode)
SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
if (!SavedMode) {
- Print(L"Invalid parameter: SavedMode\n");
+ console_print(L"Invalid parameter: SavedMode\n");
return;
}
@@ -1513,7 +1513,7 @@ static EFI_STATUS mok_sb_prompt(void *MokSB, UINTN MokSBSize)
if (pass1 != var->Password[pos1] ||
pass2 != var->Password[pos2] ||
pass3 != var->Password[pos3]) {
- Print(L"Invalid character\n");
+ console_print(L"Invalid character\n");
fail_count++;
} else {
break;
@@ -1628,7 +1628,7 @@ static EFI_STATUS mok_db_prompt(void *MokDB, UINTN MokDBSize)
if (pass1 != var->Password[pos1] ||
pass2 != var->Password[pos2] ||
pass3 != var->Password[pos3]) {
- Print(L"Invalid character\n");
+ console_print(L"Invalid character\n");
fail_count++;
} else {
break;
@@ -2051,14 +2051,16 @@ static int draw_countdown()
co->QueryMode(co, co->Mode->Mode, &cols, &rows);
- PrintAt((cols - StrLen(message)) / 2, rows / 2, message);
+ console_print_at((cols - StrLen(message)) / 2, rows / 2, message);
while (1) {
if (timeout > 1)
- PrintAt(2, rows - 3, L"Booting in %d seconds ",
- timeout);
+ console_print_at(2, rows - 3,
+ L"Booting in %d seconds ",
+ timeout);
else if (timeout)
- PrintAt(2, rows - 3, L"Booting in %d second ",
- timeout);
+ console_print_at(2, rows - 3,
+ L"Booting in %d second ",
+ timeout);
efi_status = WaitForSingleEvent(ci->WaitForKey, wait);
if (efi_status != EFI_TIMEOUT) {
@@ -2279,8 +2281,8 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_ENROLL_MOK:
if (!MokNew) {
- Print(L"MokManager: internal error: %s",
- L"MokNew was !NULL but is now NULL\n");
+ console_print(L"MokManager: internal error: %s",
+ L"MokNew was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
}
@@ -2291,8 +2293,8 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_DELETE_MOK:
if (!MokDel) {
- Print(L"MokManager: internal error: %s",
- L"MokDel was !NULL but is now NULL\n");
+ console_print(L"MokManager: internal error: %s",
+ L"MokDel was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
}
@@ -2306,7 +2308,7 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_ENROLL_MOKX:
if (!MokXNew) {
- Print(L"MokManager: internal error: %s",
+ console_print(L"MokManager: internal error: %s",
L"MokXNew was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
@@ -2318,7 +2320,7 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_DELETE_MOKX:
if (!MokXDel) {
- Print(L"MokManager: internal error: %s",
+ console_print(L"MokManager: internal error: %s",
L"MokXDel was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
@@ -2330,7 +2332,7 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_CHANGE_SB:
if (!MokSB) {
- Print(L"MokManager: internal error: %s",
+ console_print(L"MokManager: internal error: %s",
L"MokSB was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
@@ -2341,7 +2343,7 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_SET_PW:
if (!MokPW) {
- Print(L"MokManager: internal error: %s",
+ console_print(L"MokManager: internal error: %s",
L"MokPW was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;
@@ -2352,7 +2354,7 @@ static EFI_STATUS enter_mok_menu(EFI_HANDLE image_handle,
break;
case MOK_CHANGE_DB:
if (!MokDB) {
- Print(L"MokManager: internal error: %s",
+ console_print(L"MokManager: internal error: %s",
L"MokDB was !NULL but is now NULL\n");
ret = EFI_ABORTED;
goto out;