diff mbox series

[U-Boot,v3,4/7] efi_loader: load saved non-volatile variables at init

Message ID 20190604065211.15907-5-takahiro.akashi@linaro.org
State Superseded
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: non-volatile variables support | expand

Commit Message

AKASHI Takahiro June 4, 2019, 6:52 a.m. UTC
Data cache will be read in from persistent storage after (re)boot
to restore UEFI non-volatile variables.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 lib/efi_loader/efi_setup.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Heinrich Schuchardt June 4, 2019, 9:38 p.m. UTC | #1
On 6/4/19 8:52 AM, AKASHI Takahiro wrote:
> Data cache will be read in from persistent storage after (re)boot
> to restore UEFI non-volatile variables.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>   lib/efi_loader/efi_setup.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index 8691d686d29d..45d6aca051f3 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -8,6 +8,7 @@
>   #include <common.h>
>   #include <bootm.h>
>   #include <efi_loader.h>
> +#include <environment.h>
>
>   #define OBJ_LIST_NOT_INITIALIZED 1
>
> @@ -102,6 +103,11 @@ efi_status_t efi_init_obj_list(void)
>   	/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
>   	switch_to_non_secure_mode();
>
> +#ifdef CONFIG_EFI_VARIABLE_USE_ENV

No clue what ENV refers to here as we are not talking about U-Boot
environment variables anymore. How about CONFIG_EFI_PERSISTENT_VARIABLES.


> +	/* Load non-volatile variables */
> +	env_efi_load();

Can't we make env_efi_load() a __weak function which does nothing. If we
have a backend, that backend replaces the weak function. That way we
restrict the config variables to the Makefile.

Regards

Heinrich

> +#endif
> +
>   	/* Define supported languages */
>   	ret = efi_init_platform_lang();
>   	if (ret != EFI_SUCCESS)
>
AKASHI Takahiro June 5, 2019, 12:58 a.m. UTC | #2
On Tue, Jun 04, 2019 at 11:38:27PM +0200, Heinrich Schuchardt wrote:
> On 6/4/19 8:52 AM, AKASHI Takahiro wrote:
> >Data cache will be read in from persistent storage after (re)boot
> >to restore UEFI non-volatile variables.
> >
> >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> >---
> >  lib/efi_loader/efi_setup.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> >diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> >index 8691d686d29d..45d6aca051f3 100644
> >--- a/lib/efi_loader/efi_setup.c
> >+++ b/lib/efi_loader/efi_setup.c
> >@@ -8,6 +8,7 @@
> >  #include <common.h>
> >  #include <bootm.h>
> >  #include <efi_loader.h>
> >+#include <environment.h>
> >
> >  #define OBJ_LIST_NOT_INITIALIZED 1
> >
> >@@ -102,6 +103,11 @@ efi_status_t efi_init_obj_list(void)
> >  	/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
> >  	switch_to_non_secure_mode();
> >
> >+#ifdef CONFIG_EFI_VARIABLE_USE_ENV
> 
> No clue what ENV refers to here as we are not talking about U-Boot
> environment variables anymore. How about CONFIG_EFI_PERSISTENT_VARIABLES.

It will be trivial once you take a look at "menuconfig."

> 
> >+	/* Load non-volatile variables */
> >+	env_efi_load();
> 
> Can't we make env_efi_load() a __weak function which does nothing. If we
> have a backend, that backend replaces the weak function. That way we
> restrict the config variables to the Makefile.

This is a discussion.
There can be different approaches here, so
I would like to deter to a developer who will implement a next
backing storage (other than U-Boot env), which is likely to be
Standalone MM services for secure boot.
Unfortunately I'm not responsible for that(StMM).

I hope that some Linaro engineers may have comments here.

Thanks,
-Takahiro Akashi

> Regards
> 
> Heinrich
> 
> >+#endif
> >+
> >  	/* Define supported languages */
> >  	ret = efi_init_platform_lang();
> >  	if (ret != EFI_SUCCESS)
> >
>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index 8691d686d29d..45d6aca051f3 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -8,6 +8,7 @@ 
 #include <common.h>
 #include <bootm.h>
 #include <efi_loader.h>
+#include <environment.h>
 
 #define OBJ_LIST_NOT_INITIALIZED 1
 
@@ -102,6 +103,11 @@  efi_status_t efi_init_obj_list(void)
 	/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
 	switch_to_non_secure_mode();
 
+#ifdef CONFIG_EFI_VARIABLE_USE_ENV
+	/* Load non-volatile variables */
+	env_efi_load();
+#endif
+
 	/* Define supported languages */
 	ret = efi_init_platform_lang();
 	if (ret != EFI_SUCCESS)