Skip to content

Commit

Permalink
Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/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
  • Loading branch information
torvalds committed Aug 18, 2019
2 parents 5bba5c9 + cbd32a1 commit 645c03a
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions drivers/firmware/efi/libstub/efi-stub-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,17 +927,33 @@ efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg,
return status;
}

#define GET_EFI_CONFIG_TABLE(bits) \
static void *get_efi_config_table##bits(efi_system_table_t *_sys_table, \
efi_guid_t guid) \
{ \
efi_system_table_##bits##_t *sys_table; \
efi_config_table_##bits##_t *tables; \
int i; \
\
sys_table = (typeof(sys_table))_sys_table; \
tables = (typeof(tables))(unsigned long)sys_table->tables; \
\
for (i = 0; i < sys_table->nr_tables; i++) { \
if (efi_guidcmp(tables[i].guid, guid) != 0) \
continue; \
\
return (void *)(unsigned long)tables[i].table; \
} \
\
return NULL; \
}
GET_EFI_CONFIG_TABLE(32)
GET_EFI_CONFIG_TABLE(64)

void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid)
{
efi_config_table_t *tables = (efi_config_table_t *)sys_table->tables;
int i;

for (i = 0; i < sys_table->nr_tables; i++) {
if (efi_guidcmp(tables[i].guid, guid) != 0)
continue;

return (void *)tables[i].table;
}

return NULL;
if (efi_is_64bit())
return get_efi_config_table64(sys_table, guid);
else
return get_efi_config_table32(sys_table, guid);
}

0 comments on commit 645c03a

Please sign in to comment.