]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: implement EFI_RT_PROPERTIES_TABLE
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 19 Feb 2020 19:48:49 +0000 (20:48 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 26 Feb 2020 18:32:09 +0000 (19:32 +0100)
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>
cmd/efidebug.c
include/efi_api.h
lib/efi_loader/efi_runtime.c
lib/efi_loader/efi_setup.c

index 576e95b395dcd9f8efbb66967a292f163c108ee8..510e258b12abc13c4c74f6dca6e61a2404df2642 100644 (file)
@@ -264,6 +264,10 @@ static const struct {
                "SMBIOS table",
                SMBIOS_TABLE_GUID,
        },
+       {
+               "Runtime properties",
+               EFI_RT_PROPERTIES_TABLE_GUID,
+       },
 };
 
 /**
index 22396172e15f258155b6b3d9093985c10e85fd58..b7b68cb7a1f0670977a750c673e0a04e889f47be 100644 (file)
@@ -228,6 +228,18 @@ struct efi_capsule_header {
 #define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES    0x1000
 #define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO           0x2000
 
+#define EFI_RT_PROPERTIES_TABLE_GUID \
+       EFI_GUID(0xeb66918a, 0x7eef, 0x402a, 0x84, 0x2e, \
+                0x93, 0x1d, 0x21, 0xc3, 0x8a, 0xe9)
+
+#define EFI_RT_PROPERTIES_TABLE_VERSION        0x1
+
+struct efi_rt_properties_table {
+       u16 version;
+       u16 length;
+       u32 runtime_services_supported;
+};
+
 struct efi_runtime_services {
        struct efi_table_hdr hdr;
        efi_status_t (EFIAPI *get_time)(struct efi_time *time,
index 4b3c843b2ced089fc355c88b228451587a072511..4be51335bcb6e8263dc91a4476ed89443cf5ff4c 100644 (file)
 /* 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;
 }
 
 /**
index de7b616c6daa75ae2d67b5026c19201e4fb42f08..2060307b053f8edd10e3983b3ff648397d94a1fa 100644 (file)
@@ -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;