From: Jan Janssen Date: Thu, 26 May 2022 08:27:32 +0000 (+0200) Subject: boot: Drop use of LibGetSystemConfigurationTable X-Git-Tag: v252-rc1~835^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ebce8145e627b04a976a5e60b91552321121293;p=thirdparty%2Fsystemd.git boot: Drop use of LibGetSystemConfigurationTable --- diff --git a/src/boot/efi/devicetree.c b/src/boot/efi/devicetree.c index 81c6e60ca66..d5186d10d0f 100644 --- a/src/boot/efi/devicetree.c +++ b/src/boot/efi/devicetree.c @@ -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);