diff mbox series

[v3,06/17] efi_loader: add option to initialise EFI subsystem early

Message ID 20200710012537.6264-7-takahiro.akashi@linaro.org
State Superseded, archived
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: add capsule update support | expand

Commit Message

AKASHI Takahiro July 10, 2020, 1:25 a.m. UTC
If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation
of UEFI subsystem will be done as part of U-Boot initialisation.

Please note that this option won't be enabled explicitly by users,
instead, should be enabled implicitly by other configuration options.

Specifically, this feature will be utilised in implementing capsule-on-disk
feature.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 common/board_r.c       | 6 ++++++
 lib/efi_loader/Kconfig | 4 ++++
 2 files changed, 10 insertions(+)

Comments

Heinrich Schuchardt July 10, 2020, 4:25 p.m. UTC | #1
On 10.07.20 03:25, AKASHI Takahiro wrote:
> If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation
> of UEFI subsystem will be done as part of U-Boot initialisation.
>
> Please note that this option won't be enabled explicitly by users,
> instead, should be enabled implicitly by other configuration options.
>
> Specifically, this feature will be utilised in implementing capsule-on-disk
> feature.

This breaks access to block devices in UEFI. You cannot do the
initialization before the initialization of block devices which
currently is not done automatically but requires commands like 'scsi
scan' in a script or entered manually.

It might make sense to scan all block devices automatically instead of
requiring command entry.

Best regards

Heinrich

>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  common/board_r.c       | 6 ++++++
>  lib/efi_loader/Kconfig | 4 ++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index fa57fa9b6993..dcb8c6f79d2f 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -68,6 +68,9 @@
>  #if defined(CONFIG_GPIO_HOG)
>  #include <asm/gpio.h>
>  #endif
> +#ifdef CONFIG_EFI_SETUP_EARLY
> +#include <efi_loader.h>
> +#endif
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -858,6 +861,9 @@ static init_fnc_t init_sequence_r[] = {
>  #endif
>  #if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
>  	blkcache_init,
> +#endif
> +#ifdef CONFIG_EFI_SETUP_EARLY
> +	(init_fnc_t)efi_init_obj_list,
>  #endif
>  	run_main_loop,
>  };
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index 6c9df3a76763..f0a30a43bc48 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -27,6 +27,10 @@ config EFI_LOADER
>
>  if EFI_LOADER
>
> +config EFI_SETUP_EARLY
> +	bool
> +	default n
> +
>  config EFI_GET_TIME
>  	bool "GetTime() runtime service"
>  	depends on DM_RTC
>
AKASHI Takahiro July 15, 2020, 4:41 a.m. UTC | #2
Heinrich,

On Fri, Jul 10, 2020 at 06:25:34PM +0200, Heinrich Schuchardt wrote:
> On 10.07.20 03:25, AKASHI Takahiro wrote:
> > If this option, CONFIG_EFI_SETUP_EARLY, is enabled, the initialisation
> > of UEFI subsystem will be done as part of U-Boot initialisation.
> >
> > Please note that this option won't be enabled explicitly by users,
> > instead, should be enabled implicitly by other configuration options.
> >
> > Specifically, this feature will be utilised in implementing capsule-on-disk
> > feature.
> 
> This breaks access to block devices in UEFI. You cannot do the
> initialization before the initialization of block devices which
> currently is not done automatically but requires commands like 'scsi
> scan' in a script or entered manually.

I know that, but I'm also sure there are some devices detected before
executing such kind of commands.

The reason that I added this configuration is to give users alternative
choices depending on their systems and 'needs'.

> It might make sense to scan all block devices automatically instead of
> requiring command entry.

I don't object to this idea, but it can break the compatibility
with existing config_distro_bootcmd framework.

-Takahiro Akashi


> Best regards
> 
> Heinrich
> 
> >
> > Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > ---
> >  common/board_r.c       | 6 ++++++
> >  lib/efi_loader/Kconfig | 4 ++++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/common/board_r.c b/common/board_r.c
> > index fa57fa9b6993..dcb8c6f79d2f 100644
> > --- a/common/board_r.c
> > +++ b/common/board_r.c
> > @@ -68,6 +68,9 @@
> >  #if defined(CONFIG_GPIO_HOG)
> >  #include <asm/gpio.h>
> >  #endif
> > +#ifdef CONFIG_EFI_SETUP_EARLY
> > +#include <efi_loader.h>
> > +#endif
> >
> >  DECLARE_GLOBAL_DATA_PTR;
> >
> > @@ -858,6 +861,9 @@ static init_fnc_t init_sequence_r[] = {
> >  #endif
> >  #if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
> >  	blkcache_init,
> > +#endif
> > +#ifdef CONFIG_EFI_SETUP_EARLY
> > +	(init_fnc_t)efi_init_obj_list,
> >  #endif
> >  	run_main_loop,
> >  };
> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > index 6c9df3a76763..f0a30a43bc48 100644
> > --- a/lib/efi_loader/Kconfig
> > +++ b/lib/efi_loader/Kconfig
> > @@ -27,6 +27,10 @@ config EFI_LOADER
> >
> >  if EFI_LOADER
> >
> > +config EFI_SETUP_EARLY
> > +	bool
> > +	default n
> > +
> >  config EFI_GET_TIME
> >  	bool "GetTime() runtime service"
> >  	depends on DM_RTC
> >
>
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index fa57fa9b6993..dcb8c6f79d2f 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -68,6 +68,9 @@ 
 #if defined(CONFIG_GPIO_HOG)
 #include <asm/gpio.h>
 #endif
+#ifdef CONFIG_EFI_SETUP_EARLY
+#include <efi_loader.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -858,6 +861,9 @@  static init_fnc_t init_sequence_r[] = {
 #endif
 #if defined(CONFIG_M68K) && defined(CONFIG_BLOCK_CACHE)
 	blkcache_init,
+#endif
+#ifdef CONFIG_EFI_SETUP_EARLY
+	(init_fnc_t)efi_init_obj_list,
 #endif
 	run_main_loop,
 };
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 6c9df3a76763..f0a30a43bc48 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -27,6 +27,10 @@  config EFI_LOADER
 
 if EFI_LOADER
 
+config EFI_SETUP_EARLY
+	bool
+	default n
+
 config EFI_GET_TIME
 	bool "GetTime() runtime service"
 	depends on DM_RTC