aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-08-18 12:36:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-08-18 12:36:51 -0400
commit645c03aaca2bc02f5d5cc70804ca00b248b729dc (patch)
treee0b6376e2382049ce235f90ca441e97322a77d12
parent5bba5c9c86b31895f5cb67f2db2b0f0cddc96dc6 (diff)
parentcbd32a1c56e36fedaa93a727699188bd3e6e6f67 (diff)
Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI fix from Thomas Gleixner: "A single fix for a EFI mixed mode regression caused by recent rework which did not take the firmware bitwidth into account" * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi-stub: Fix get_efi_config_table on mixed-mode setups
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 1db780c0f07b..3caae7f2cf56 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -927,17 +927,33 @@ fail:
927 return status; 927 return status;
928} 928}
929 929
930#define GET_EFI_CONFIG_TABLE(bits) \
931static void *get_efi_config_table##bits(efi_system_table_t *_sys_table, \
932 efi_guid_t guid) \
933{ \
934 efi_system_table_##bits##_t *sys_table; \
935 efi_config_table_##bits##_t *tables; \
936 int i; \
937 \
938 sys_table = (typeof(sys_table))_sys_table; \
939 tables = (typeof(tables))(unsigned long)sys_table->tables; \
940 \
941 for (i = 0; i < sys_table->nr_tables; i++) { \
942 if (efi_guidcmp(tables[i].guid, guid) != 0) \
943 continue; \
944 \
945 return (void *)(unsigned long)tables[i].table; \
946 } \
947 \
948 return NULL; \
949}
950GET_EFI_CONFIG_TABLE(32)
951GET_EFI_CONFIG_TABLE(64)
952
930void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid) 953void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid)
931{ 954{
932 efi_config_table_t *tables = (efi_config_table_t *)sys_table->tables; 955 if (efi_is_64bit())
933 int i; 956 return get_efi_config_table64(sys_table, guid);
934 957 else
935 for (i = 0; i < sys_table->nr_tables; i++) { 958 return get_efi_config_table32(sys_table, guid);
936 if (efi_guidcmp(tables[i].guid, guid) != 0)
937 continue;
938
939 return (void *)tables[i].table;
940 }
941
942 return NULL;
943} 959}