boot: Drop use of LibGetSystemConfigurationTable

This commit is contained in:
Jan Janssen
2022-06-09 12:50:13 +02:00
parent 23742af522
commit 7ebce8145e
+11 -4
View 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);