summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-02-19 22:48:49 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-02-26 21:32:09 +0300
commit76be687288dc618eabd1ef643488cd5bd93f84ff (patch)
tree62e1713fb51d8b3404d16bd8a2280820d02e41f7 /lib
parent548ce227d3d852455c6395c0cec30af0cda77b09 (diff)
downloadu-boot-76be687288dc618eabd1ef643488cd5bd93f84ff.tar.xz
efi_loader: implement EFI_RT_PROPERTIES_TABLE
UEFI spec 2.8 errata A replaces the RuntimeServicesSupported variable defined in UEFI spec 2.8 by the configuration table EFI_RT_PROPERTIES_TABLE. So let's follow suit. Cc: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Tested-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_runtime.c36
-rw-r--r--lib/efi_loader/efi_setup.c8
2 files changed, 32 insertions, 12 deletions
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 4b3c843b2c..4be51335bc 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -18,6 +18,10 @@
/* For manual relocation support */
DECLARE_GLOBAL_DATA_PTR;
+/* GUID of the runtime properties table */
+static const efi_guid_t efi_rt_properties_table_guid =
+ EFI_RT_PROPERTIES_TABLE_GUID;
+
struct efi_runtime_mmio_list {
struct list_head link;
void **ptr;
@@ -94,9 +98,28 @@ static __efi_runtime_data efi_uintn_t efi_descriptor_size;
* handle a good number of runtime callbacks
*/
+/**
+ * efi_init_runtime_supported() - create runtime properties table
+ *
+ * Create a configuration table specifying which services are available at
+ * runtime.
+ *
+ * Return: status code
+ */
efi_status_t efi_init_runtime_supported(void)
{
- u16 efi_runtime_services_supported =
+ efi_status_t ret;
+ struct efi_rt_properties_table *rt_table;
+
+ ret = efi_allocate_pool(EFI_RUNTIME_SERVICES_DATA,
+ sizeof(struct efi_rt_properties_table),
+ (void **)&rt_table);
+ if (ret != EFI_SUCCESS)
+ return ret;
+
+ rt_table->version = EFI_RT_PROPERTIES_TABLE_VERSION;
+ rt_table->length = sizeof(struct efi_rt_properties_table);
+ rt_table->runtime_services_supported =
EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP |
EFI_RT_SUPPORTED_CONVERT_POINTER;
@@ -105,15 +128,12 @@ efi_status_t efi_init_runtime_supported(void)
* as well as efi_runtime_services.
*/
#ifdef CONFIG_EFI_HAVE_RUNTIME_RESET
- efi_runtime_services_supported |= EFI_RT_SUPPORTED_RESET_SYSTEM;
+ rt_table->runtime_services_supported |= EFI_RT_SUPPORTED_RESET_SYSTEM;
#endif
- return EFI_CALL(efi_set_variable(L"RuntimeServicesSupported",
- &efi_global_variable_guid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(efi_runtime_services_supported),
- &efi_runtime_services_supported));
+ ret = efi_install_configuration_table(&efi_rt_properties_table_guid,
+ rt_table);
+ return ret;
}
/**
diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
index de7b616c6d..2060307b05 100644
--- a/lib/efi_loader/efi_setup.c
+++ b/lib/efi_loader/efi_setup.c
@@ -122,13 +122,13 @@ efi_status_t efi_init_obj_list(void)
if (ret != EFI_SUCCESS)
goto out;
- /* Indicate supported runtime services */
- ret = efi_init_runtime_supported();
+ /* Initialize system table */
+ ret = efi_initialize_system_table();
if (ret != EFI_SUCCESS)
goto out;
- /* Initialize system table */
- ret = efi_initialize_system_table();
+ /* Indicate supported runtime services */
+ ret = efi_init_runtime_supported();
if (ret != EFI_SUCCESS)
goto out;