From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: u-boot@lists.denx.de, Fabio Estevam <festevam@gmail.com>,
Mark Kettenis <mark.kettenis@xs4all.nl>,
Neil Armstrong <narmstrong@baylibre.com>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
sughosh.ganu@linaro.org
Subject: Re: [PATCH 1/1] efi_loader: initialize console size late
Date: Wed, 15 Jun 2022 15:16:16 +0900 [thread overview]
Message-ID: <20220615061616.GD58082@laputa> (raw)
In-Reply-To: <20220614060203.33600-1-heinrich.schuchardt@canonical.com>
On Tue, Jun 14, 2022 at 08:02:03AM +0200, Heinrich Schuchardt wrote:
> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> If CONFIG_VIDEO_DM=n we query the display size from the serial console.
> Especially when using a remote console the response can be so late that
> it interferes with autoboot.
>
> Only query the console size when running an EFI binary.
>
> Add debug output showing the determined console size.
>
> Reported-by: Fabio Estevam <festevam@gmail.com>
> Fixes: a9bf024b2933 ("efi_loader: disk: a helper function to create efi_disk objects from udevice")
If the key part of this patch is to move query_console_size() from
efi_init_early() to efi_init_obj_list(), the to-be-fixed patch is not
the one above but
commit a57ad20d07e8 ("efi_loader: split efi_init_obj_list() into two stages")
Moreover, this is just a warning but once Sughosh's patch,
https://lists.denx.de/pipermail/u-boot/2022-June/485977.html
is merged and FWU_MULTI_BANK_UPDATE is enabled, the said phenomenon can
be triggered again because efi_init_obj_list(), hence query_console_size(),
will be called in board_init_r() before showing the U-Boot prompt.
-Takahiro Akashi
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> include/efi_loader.h | 2 ++
> lib/efi_loader/efi_console.c | 20 +++++++++++++-------
> lib/efi_loader/efi_setup.c | 4 ++++
> 3 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index f6651e2c60..c1e00ebac3 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -499,6 +499,8 @@ extern struct list_head efi_register_notify_events;
> int efi_init_early(void);
> /* Initialize efi execution environment */
> efi_status_t efi_init_obj_list(void);
> +/* Set up console modes */
> +void efi_setup_console_size(void);
> /* Install device tree */
> efi_status_t efi_install_fdt(void *fdt);
> /* Run loaded UEFI image */
> diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
> index 60a3fc85ac..3164fd484e 100644
> --- a/lib/efi_loader/efi_console.c
> +++ b/lib/efi_loader/efi_console.c
> @@ -5,6 +5,8 @@
> * Copyright (c) 2016 Alexander Graf
> */
>
> +#define LOG_CATEGORY LOGC_EFI
> +
> #include <common.h>
> #include <charset.h>
> #include <malloc.h>
> @@ -12,6 +14,7 @@
> #include <dm/device.h>
> #include <efi_loader.h>
> #include <env.h>
> +#include <log.h>
> #include <stdio_dev.h>
> #include <video_console.h>
> #include <linux/delay.h>
> @@ -58,7 +61,12 @@ const efi_guid_t efi_guid_text_output_protocol =
> #define cESC '\x1b'
> #define ESC "\x1b"
>
> -/* Default to mode 0 */
> +/*
> + * efi_con_mode - mode information of the Simple Text Output Protocol
> + *
> + * Use safe settings before efi_setup_console_size() is called.
> + * By default enable only the 80x25 mode which must always exist.
> + */
> static struct simple_text_output_mode efi_con_mode = {
> .max_mode = 1,
> .mode = 0,
> @@ -333,13 +341,13 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)
> }
>
> /**
> - * query_console_size() - update the mode table.
> + * 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.
> */
> -static void query_console_size(void)
> +void efi_setup_console_size(void)
> {
> int rows = 25, cols = 80;
> int ret = -ENODEV;
> @@ -351,6 +359,8 @@ static void query_console_size(void)
> if (ret)
> return;
>
> + log_debug("Console size %dx%d\n", rows, cols);
> +
> /* Test if we can have Mode 1 */
> if (cols >= 80 && rows >= 50) {
> efi_cout_modes[1].present = 1;
> @@ -371,7 +381,6 @@ static void query_console_size(void)
> }
> }
>
> -
> /**
> * efi_cout_query_mode() - get terminal size for a text mode
> *
> @@ -1262,9 +1271,6 @@ efi_status_t efi_console_register(void)
> efi_status_t r;
> struct efi_device_path *dp;
>
> - /* Set up mode information */
> - query_console_size();
> -
> /* Install protocols on root node */
> r = EFI_CALL(efi_install_multiple_protocol_interfaces
> (&efi_root,
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index 250eeb2fcd..492ecf4cb1 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -243,6 +243,10 @@ efi_status_t efi_init_obj_list(void)
> goto out;
> }
>
> + /* Set up console modes */
> + efi_setup_console_size();
> +
> + /* Install EFI_RNG_PROTOCOL */
> if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
> ret = efi_rng_register();
> if (ret != EFI_SUCCESS)
> --
> 2.36.1
>
next prev parent reply other threads:[~2022-06-15 6:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 6:02 [PATCH 1/1] efi_loader: initialize console size late Heinrich Schuchardt
2022-06-14 10:53 ` Fabio Estevam
2022-06-14 15:18 ` Heiko Thiery
2022-06-15 6:16 ` AKASHI Takahiro [this message]
2022-06-15 6:27 ` Heinrich Schuchardt
2022-06-15 6:34 ` AKASHI Takahiro
2022-06-15 13:53 ` Fabio Estevam
2022-06-15 14:02 ` Heinrich Schuchardt
2022-06-16 0:32 ` AKASHI Takahiro
2022-06-16 22:50 ` Tom Rini
2022-06-17 4:59 ` Heinrich Schuchardt
2022-06-28 13:52 ` Fabio Estevam
2022-06-28 13:55 ` Tom Rini
2022-06-28 13:57 ` Fabio Estevam
2022-06-28 14:01 ` Heinrich Schuchardt
2022-06-28 14:04 ` Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220615061616.GD58082@laputa \
--to=takahiro.akashi@linaro.org \
--cc=festevam@gmail.com \
--cc=heinrich.schuchardt@canonical.com \
--cc=mark.kettenis@xs4all.nl \
--cc=narmstrong@baylibre.com \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox