efi: Clean up config_parse_tables()
config_parse_tables() is a jumble of pointer arithmetic, due to the fact that on x86, we may be dealing with firmware whose native word size differs from the kernel's. This is not a concern on other architectures, and doesn't quite justify the state of the code, so let's clean it up by adding a non-x86 code path, constifying statically allocated tables and replacing preprocessor conditionals with IS_ENABLED() checks. Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64 Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
@@ -60,7 +60,7 @@ static u64 efi_systab_phys __initdata;
|
||||
static unsigned long prop_phys = EFI_INVALID_TABLE_ADDR;
|
||||
static unsigned long uga_phys = EFI_INVALID_TABLE_ADDR;
|
||||
|
||||
static efi_config_table_type_t arch_tables[] __initdata = {
|
||||
static const efi_config_table_type_t arch_tables[] __initconst = {
|
||||
{EFI_PROPERTIES_TABLE_GUID, "PROP", &prop_phys},
|
||||
{UGA_IO_PROTOCOL_GUID, "UGA", &uga_phys},
|
||||
#ifdef CONFIG_X86_UV
|
||||
@@ -431,7 +431,7 @@ static int __init efi_systab_init(u64 phys)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init efi_config_init(efi_config_table_type_t *arch_tables)
|
||||
static int __init efi_config_init(const efi_config_table_type_t *arch_tables)
|
||||
{
|
||||
void *config_tables;
|
||||
int sz, ret;
|
||||
@@ -454,7 +454,7 @@ static int __init efi_config_init(efi_config_table_type_t *arch_tables)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = efi_config_parse_tables(config_tables, efi.systab->nr_tables, sz,
|
||||
ret = efi_config_parse_tables(config_tables, efi.systab->nr_tables,
|
||||
arch_tables);
|
||||
|
||||
early_memunmap(config_tables, efi.systab->nr_tables * sz);
|
||||
|
Reference in New Issue
Block a user