diff options
| author | Hans de Goede <hdegoede@redhat.com> | 2018-03-12 17:14:58 +0100 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2018-03-12 18:00:41 -0400 |
| commit | 1ff4a36a23ac5c17144275ccb3e1e1061750a137 (patch) | |
| tree | 05d9b0f1c43d42e123a79e40ad55f59fbf4add0b /lib/console.c | |
| parent | 42b1d8832f8a764f9a1cbea5e8b916dbb4665f30 (diff) | |
| download | efi-boot-shim-1ff4a36a23ac5c17144275ccb3e1e1061750a137.tar.gz efi-boot-shim-1ff4a36a23ac5c17144275ccb3e1e1061750a137.zip | |
console: Do not set EFI console to textmode until something is printed
Remove the setup_console(1) calls from shim and instead make lib/console.c
make that call when necessary. This avoids shim forcing the EFI console to
switch to text-mode if nothing is printed.
This commit also modifies MokManager to work the same way for consistency,
even though MokManager will always print something.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'lib/console.c')
| -rw-r--r-- | lib/console.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/console.c b/lib/console.c index c23baec4..c4eaf617 100644 --- a/lib/console.c +++ b/lib/console.c @@ -11,6 +11,8 @@ #include "shim.h" +static UINT8 console_text_mode = 0; + static int count_lines(CHAR16 *str_arr[]) { @@ -46,7 +48,7 @@ console_get_keystroke(EFI_INPUT_KEY *key) return efi_status; } -VOID setup_console (int text) +static VOID setup_console (int text) { EFI_STATUS efi_status; EFI_CONSOLE_CONTROL_PROTOCOL *concon; @@ -71,6 +73,13 @@ VOID setup_console (int text) } concon->SetMode(concon, new_mode); + console_text_mode = text; +} + +VOID console_fini(VOID) +{ + if (console_text_mode) + setup_console(0); } UINTN @@ -79,6 +88,9 @@ console_print(const CHAR16 *fmt, ...) va_list args; UINTN ret; + if (!console_text_mode) + setup_console(1); + va_start(args, fmt); ret = VPrint(fmt, args); va_end(args); @@ -93,6 +105,9 @@ console_print_at(UINTN col, UINTN row, const CHAR16 *fmt, ...) va_list args; UINTN ret; + if (!console_text_mode) + setup_console(1); + co->SetCursorPosition(co, col, row); va_start(args, fmt); @@ -117,6 +132,9 @@ console_print_box_at(CHAR16 *str_arr[], int highlight, if (lines == 0) return; + if (!console_text_mode) + setup_console(1); + co->QueryMode(co, co->Mode->Mode, &cols, &rows); /* last row on screen is unusable without scrolling, so ignore it */ @@ -219,6 +237,9 @@ console_print_box(CHAR16 *str_arr[], int highlight) SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut; EFI_INPUT_KEY key; + if (!console_text_mode) + setup_console(1); + CopyMem(&SavedConsoleMode, co->Mode, sizeof(SavedConsoleMode)); co->EnableCursor(co, FALSE); co->SetAttribute(co, EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE); @@ -249,6 +270,9 @@ console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start) unsigned int selector_offset; UINTN cols, rows; + if (!console_text_mode) + setup_console(1); + co->QueryMode(co, co->Mode->Mode, &cols, &rows); for (i = 0; i < selector_lines; i++) { @@ -462,6 +486,9 @@ console_reset(void) { SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut; + if (!console_text_mode) + setup_console(1); + co->Reset(co, TRUE); /* set mode 0 - required to be 80x25 */ co->SetMode(co, 0); |
