[PATCH 3/4] EFI: console: max rows and cols user limit

Artem Lapkin email2tema at gmail.com
Wed Aug 4 12:22:16 CEST 2021


Setup the max rows and columns limit for the EFI console output.

Signed-off-by: Artem Lapkin <art at khadas.com>
---
 lib/efi_loader/Kconfig       | 12 ++++++++++++
 lib/efi_loader/efi_console.c |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index dacc3b5881..7d00d6cde5 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -381,4 +381,16 @@ config EFI_ESRT
 	help
 	  Enabling this option creates the ESRT UEFI system table.
 
+config EFI_CONSOLE_MAX_ROWS
+	int "setup console max rows"
+	default 0
+	help
+	  Set console max rows limit or set to zero to disable limit.
+
+config EFI_CONSOLE_MAX_COLS
+	int "setup console max cols"
+	default 0
+	help
+	  Set console max rows limit or set to zero to disable limit.
+
 endif
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 847069212e..b5d79d788f 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -351,6 +351,11 @@ static void query_console_size(void)
 	} else if (query_console_serial(&rows, &cols))
 		return;
 
+	if (CONFIG_EFI_CONSOLE_MAX_ROWS > 0)
+		rows = min(rows, CONFIG_EFI_CONSOLE_MAX_ROWS);
+	if (CONFIG_EFI_CONSOLE_MAX_COLS > 0)
+		cols = min(cols, CONFIG_EFI_CONSOLE_MAX_COLS);
+
 	/* Test if we can have Mode 1 */
 	if (cols >= 80 && rows >= 50) {
 		efi_cout_modes[1].present = 1;
-- 
2.25.1



More information about the U-Boot mailing list