
From: Jan Kiszka jan.kiszka@siemens.com
Ensure that the default colors are set when clearing the screen so that the background is properly filled and succeeding colored outputs will have no differently colored trail.
Before clearing, ensure that no previous output of firmware or UEFI programs will overwritten on serial devices or other streaming consoles. This helps generating complete boot logs.
Signed-off-by: Jan Kiszka jan.kiszka@siemens.com --- lib/efi_loader/efi_console.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index ba68a150172..0270b20bafe 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -463,8 +463,18 @@ static efi_status_t EFIAPI efi_cout_set_attribute( static efi_status_t EFIAPI efi_cout_clear_screen( struct efi_simple_text_output_protocol *this) { + unsigned int row; + EFI_ENTRY("%p", this);
+ /* Avoid overwriting previous outputs on streaming consoles */ + for (row = 1; row < efi_cout_modes[efi_con_mode.mode].rows; row++) + printf("\n"); + + /* Set default colors if not done yet */ + if (efi_con_mode.attribute == 0) + efi_cout_set_attribute(this, 0x07); + /* * The Linux console wants both a clear and a home command. The video * uclass does not support <ESC>[H without coordinates, yet. @@ -522,11 +532,11 @@ static efi_status_t EFIAPI efi_cout_reset( { EFI_ENTRY("%p, %d", this, extended_verification);
+ /* Trigger reset to default colors */ + efi_con_mode.attribute = 0; + /* Clear screen */ EFI_CALL(efi_cout_clear_screen(this)); - /* Set default colors */ - efi_con_mode.attribute = 0x07; - printf(ESC "[0;37;40m");
return EFI_EXIT(EFI_SUCCESS); }