On 8/4/21 12:22 PM, Artem Lapkin wrote:
Setup the max rows and columns limit for the EFI console output.

Why should a user set this up?

The size of serial console depends on the remote computers console
windows size.

The size of a video console depends on the attached monitor.

So we have to detect the size dynamically. Hardcoding it does not make
any sense.

Best regards

Heinrich


Signed-off-by: Artem Lapkin <a...@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;


Reply via email to