]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Drop use of LibGetSystemConfigurationTable
authorJan Janssen <medhefgo@web.de>
Thu, 26 May 2022 08:27:32 +0000 (10:27 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 9 Jun 2022 10:50:13 +0000 (12:50 +0200)
src/boot/efi/devicetree.c

index 81c6e60ca66818eac61d41a87fb47eba03e62ae7..d5186d10d0fd9869521fff414443402e7576bb32 100644 (file)
@@ -8,6 +8,13 @@
 
 #define FDT_V1_SIZE (7*4)
 
+static void *get_dtb_table(void) {
+        for (UINTN i = 0; i < ST->NumberOfTableEntries; i++)
+                if (memcmp(&EfiDtbTableGuid, &ST->ConfigurationTable[i].VendorGuid, sizeof(EfiDtbTableGuid)) == 0)
+                        return ST->ConfigurationTable[i].VendorTable;
+        return NULL;
+}
+
 static EFI_STATUS devicetree_allocate(struct devicetree_state *state, UINTN size) {
         UINTN pages = DIV_ROUND_UP(size, EFI_PAGE_SIZE);
         EFI_STATUS err;
@@ -74,8 +81,8 @@ EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir
         assert(root_dir);
         assert(name);
 
-        err = LibGetSystemConfigurationTable(&EfiDtbTableGuid, &state->orig);
-        if (EFI_ERROR(err))
+        state->orig = get_dtb_table();
+        if (!state->orig)
                 return EFI_UNSUPPORTED;
 
         err = root_dir->Open(root_dir, &handle, name, EFI_FILE_MODE_READ, EFI_FILE_READ_ONLY);
@@ -114,8 +121,8 @@ EFI_STATUS devicetree_install_from_memory(struct devicetree_state *state,
         assert(state);
         assert(dtb_buffer && dtb_length > 0);
 
-        err = LibGetSystemConfigurationTable(&EfiDtbTableGuid, &state->orig);
-        if (EFI_ERROR(err))
+        state->orig = get_dtb_table();
+        if (!state->orig)
                 return EFI_UNSUPPORTED;
 
         err = devicetree_allocate(state, dtb_length);