diff mbox series

[v4,2/2] efi_loader: Set default console colors on efi_cout_clear_screen if needed

Message ID cf59eebcd1e36a321c931ceff8927b885b8f7552.1674074699.git.jan.kiszka@siemens.com
State Superseded, archived
Headers show
Series efi_loader: console improvements | expand

Commit Message

Jan Kiszka Jan. 18, 2023, 8:44 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Ensures a consistent background color of the whole screen for succeeding
outputs as both demanded by the spec and implemented in EDK2 as well.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 lib/efi_loader/efi_console.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Heinrich Schuchardt Jan. 18, 2023, 8:58 p.m. UTC | #1
Am 18. Januar 2023 21:44:59 MEZ schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>From: Jan Kiszka <jan.kiszka@siemens.com>
>
>Ensures a consistent background color of the whole screen for succeeding
>outputs as both demanded by the spec and implemented in EDK2 as well.
>
>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>


Reviewed-by: Heinrich Schuchard <xypron.glpk@gmx.de>

>---
> lib/efi_loader/efi_console.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
>index e40c129d1b2..84b5f60b321 100644
>--- a/lib/efi_loader/efi_console.c
>+++ b/lib/efi_loader/efi_console.c
>@@ -497,6 +497,12 @@ static efi_status_t EFIAPI efi_cout_clear_screen(
> {
> 	EFI_ENTRY("%p", this);
> 
>+	/* Set default colors if not done yet */
>+	if (efi_con_mode.attribute == 0) {
>+		efi_con_mode.attribute = 0x07;
>+		printf(ESC "[0;37;40m");
>+	}
>+
> 	efi_clear_screen();
> 
> 	return EFI_EXIT(EFI_SUCCESS);
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index e40c129d1b2..84b5f60b321 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -497,6 +497,12 @@  static efi_status_t EFIAPI efi_cout_clear_screen(
 {
 	EFI_ENTRY("%p", this);
 
+	/* Set default colors if not done yet */
+	if (efi_con_mode.attribute == 0) {
+		efi_con_mode.attribute = 0x07;
+		printf(ESC "[0;37;40m");
+	}
+
 	efi_clear_screen();
 
 	return EFI_EXIT(EFI_SUCCESS);