From ce43528d6a9ff3d1099a6bc194f0cccc8f0df44d Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Jun 2019 12:13:05 +0200 Subject: efi_loader: move efi_query_variable_info() Let's keep similar things together. Move efi_query_variable_info() to lib/efi_loader/efi_variable.c Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index b07155cecb..de1e67fd40 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -618,6 +618,11 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, const efi_guid_t *vendor, u32 attributes, efi_uintn_t data_size, const void *data); +efi_status_t EFIAPI efi_query_variable_info( + u32 attributes, u64 *maximum_variable_storage_size, + u64 *remaining_variable_storage_size, + u64 *maximum_variable_size); + /* * See section 3.1.3 in the v2.7 UEFI spec for more details on * the layout of EFI_LOAD_OPTION. In short it is: -- cgit From 88192098d160aff42c08a9e4edc746a55d199232 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Jun 2019 13:52:16 +0200 Subject: efi_loader: initialization of variable services Provide an initialization routine for variable services. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index de1e67fd40..d30c4e8ef3 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -325,6 +325,8 @@ extern struct list_head efi_register_notify_events; /* Initialize efi execution environment */ efi_status_t efi_init_obj_list(void); +/* Initialize variable services */ +efi_status_t efi_init_variables(void); /* Called by bootefi to initialize root node */ efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ -- cgit From 29018abb09a6ad638df38d6df5ab089ef1115e3c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 20 Jun 2019 15:25:48 +0200 Subject: efi_loader: let the variable driver patch out the runtime Our variable services are only provided at boottime. Therefore when leaving boottime the variable function are replaced by dummy functions returning EFI_UNSUPPORTED. Move this patching of the runtime table to the variable services implementation. Executed it in ExitBootServices(). Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index d30c4e8ef3..8d75dde569 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -327,6 +327,8 @@ extern struct list_head efi_register_notify_events; efi_status_t efi_init_obj_list(void); /* Initialize variable services */ efi_status_t efi_init_variables(void); +/* Notify ExitBootServices() is called */ +void efi_variables_boot_exit_notify(void); /* Called by bootefi to initialize root node */ efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ -- cgit From c7308d6e2307c763f0006f4933da3bfbb875bed7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 28 Jun 2019 19:31:55 +0200 Subject: efi_loader: bump UEFI specification number to 2.8 We are implementing UEFI variable RuntimeServicesSupported and set the unimplemented runtime functions return EFI_UNSUPPORTED as described in UEFI specification 2.8. So let's also advertise this specification version in our system table. Signed-off-by: Heinrich Schuchardt Reviewed-by: Alexander Graf --- include/efi_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/efi_api.h b/include/efi_api.h index a36ececc81..d4f32dbdc8 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -23,8 +23,8 @@ #include #endif -/* UEFI spec version 2.7 */ -#define EFI_SPECIFICATION_VERSION (2 << 16 | 70) +/* UEFI spec version 2.8 */ +#define EFI_SPECIFICATION_VERSION (2 << 16 | 80) /* Types and defines for EFI CreateEvent */ enum efi_timer_delay { -- cgit From 7f95104d91ccfb26f802feb5300838b41bc5fbb1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 5 Jul 2019 17:42:16 +0200 Subject: efi_loader: detach runtime in ExitBootServices() Linux can be called with a command line parameter efi=novamap, cf. commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted"). In this case SetVirtualAddressMap() is not called after ExitBootServices(). OpenBSD 32bit does not call SetVirtualAddressMap() either. Runtime services must be set to an implementation supported at runtime in ExitBootServices(). Reported-by: Ard Biesheuvel Suggested-by: Alexander Graf Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/efi_loader.h b/include/efi_loader.h index 8d75dde569..db4763fc9b 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -333,6 +333,8 @@ void efi_variables_boot_exit_notify(void); efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ efi_status_t efi_initialize_system_table(void); +/* efi_runtime_detach() - detach unimplemented runtime functions */ +void efi_runtime_detach(void); /* Called by bootefi to make console interface available */ efi_status_t efi_console_register(void); /* Called by bootefi to make all disk storage accessible as EFI objects */ -- cgit