summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_console.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-05-18 08:06:56 -0600
committerTom Rini <trini@konsulko.com>2025-05-18 08:06:56 -0600
commiteeb5ff1a468b2303efa9deb2483b5edbebb568c6 (patch)
tree52d32503af86d214a4bece8b6093393e521e345d /lib/efi_loader/efi_console.c
parent126a88d49bcae04bbfc0d6723097cd6341355ade (diff)
parent22abd882c3de2eb365d4c503246c9c7499d4c7f1 (diff)
Merge tag 'efi-2025-07-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-07-rc3-2 Documentation: * Add test/py/requirements.txt to documentation * Use globing for selecting pytest files UEFI: * Provide a function to disable ANSI output during tests Other: * test: allow multiple config options in buildconfigspec * test: allow testing with NET_LWIP=y
Diffstat (limited to 'lib/efi_loader/efi_console.c')
-rw-r--r--lib/efi_loader/efi_console.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 9d9f786a6db..e310f2f53ae 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -30,6 +30,17 @@ struct cout_mode {
__maybe_unused static struct efi_object uart_obj;
+/*
+ * suppress emission of ANSI escape-characters for use by unit tests. Leave it
+ * as 0 for the default behaviour
+ */
+static bool no_ansi;
+
+void efi_console_set_ansi(bool allow_ansi)
+{
+ no_ansi = !allow_ansi;
+}
+
static struct cout_mode efi_cout_modes[] = {
/* EFI Mode 0 is 80x25 and always present */
{
@@ -348,13 +359,6 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)
return 0;
}
-/**
- * efi_setup_console_size() - update the mode table.
- *
- * By default the only mode available is 80x25. If the console has at least 50
- * lines, enable mode 80x50. If we can query the console size and it is neither
- * 80x25 nor 80x50, set it as an additional mode.
- */
void efi_setup_console_size(void)
{
int rows = 25, cols = 80;
@@ -362,8 +366,12 @@ void efi_setup_console_size(void)
if (IS_ENABLED(CONFIG_VIDEO))
ret = query_vidconsole(&rows, &cols);
- if (ret)
- ret = query_console_serial(&rows, &cols);
+ if (ret) {
+ if (no_ansi)
+ ret = 0;
+ else
+ ret = query_console_serial(&rows, &cols);
+ }
if (ret)
return;