[PATCH v1 2/4] efi_loader: Add OS notifications for SetVariableRT in RAM

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Apr 8 08:41:50 CEST 2024


Hi Heinrich,

> > +
> >
> >   /* Use internal device tree when starting UEFI application */
> >   #define EFI_FDT_USE_INTERNAL NULL
> > diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
> > index 8ebbea7e5c69..d898ba6c268f 100644
> > --- a/lib/efi_loader/efi_runtime.c
> > +++ b/lib/efi_loader/efi_runtime.c
> > @@ -127,10 +127,6 @@ efi_status_t efi_init_runtime_supported(void)
> >                               EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP |
> >                               EFI_RT_SUPPORTED_CONVERT_POINTER;
> >
> > -     if (IS_ENABLED(CONFIG_EFI_RT_VOLATILE_STORE))
> > -             rt_table->runtime_services_supported |=
> > -                     EFI_RT_SUPPORTED_SET_VARIABLE;
> > -
>
[...]

> Why do you want to remove this flag?
>

I don't, I messed this up during my rebase before sending the patches.

The code in EBS() was supposed to re-enable it.
It's all fixed in patch #3, but this patch needs a change as well
rt_prop->runtime_services_supported |= ~EFI_RT_SUPPORTED_SET_VARIABLE;
should be
rt_prop->runtime_services_supported |= EFI_RT_SUPPORTED_SET_VARIABLE;
in efi_variables_boot_exit_notify()

Thanks
/Ilias

> Best regards
>
> Heinrich
>
> >       /*
> >        * This value must be synced with efi_runtime_detach_list
> >        * as well as efi_runtime_services.
> > diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> > index f79041e6bedd..f97c8c57f75c 100644
> > --- a/lib/efi_loader/efi_variable.c
> > +++ b/lib/efi_loader/efi_variable.c
> > @@ -554,6 +554,26 @@ if (IS_ENABLED(CONFIG_EFI_RT_VOLATILE_STORE)) {
> >    */
> >   void efi_variables_boot_exit_notify(void)
> >   {
> > +     const efi_guid_t efi_guid_efi_rt_var_file = U_BOOT_EFI_RT_VAR_FILE_GUID;
> > +     const efi_guid_t rt_prop_guid = EFI_RT_PROPERTIES_TABLE_GUID;
> > +     efi_status_t ret;
> > +
> > +     if (IS_ENABLED(CONFIG_EFI_RT_VOLATILE_STORE)) {
> > +             struct efi_rt_properties_table *rt_prop =
> > +                     efi_get_configuration_table(&rt_prop_guid);
> > +
> > +             ret = efi_set_variable_int(u"RTStorageVolatile",
> > +                                        &efi_guid_efi_rt_var_file,
> > +                                        EFI_VARIABLE_BOOTSERVICE_ACCESS |
> > +                                        EFI_VARIABLE_RUNTIME_ACCESS |
> > +                                        EFI_VARIABLE_READ_ONLY,
> > +                                        sizeof(EFI_VAR_FILE_NAME),
> > +                                        EFI_VAR_FILE_NAME, false);
> > +             if (ret != EFI_SUCCESS)
> > +                     rt_prop->runtime_services_supported |= ~EFI_RT_SUPPORTED_SET_VARIABLE;
> > +             else
> > +                     log_err("Can't RTStorage. SetVariableRT won't be available\n");
> > +     }
> >       /* Switch variable services functions to runtime version */
> >       efi_runtime_services.get_variable = efi_get_variable_runtime;
> >       efi_runtime_services.get_next_variable_name =
>


More information about the U-Boot mailing list