Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

efi/libstub: Drop 'table' argument from efi_table_attr() macro

None of the definitions of the efi_table_attr() still refer to
their 'table' argument so let's get rid of it entirely.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Borislav Petkov <bp@alien8.de>
Cc: James Morse <james.morse@arm.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191224151025.32482-23-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Ard Biesheuvel and committed by
Ingo Molnar
99ea8b1d 47c0fd39

+22 -37
+1 -2
arch/arm/include/asm/efi.h
··· 54 54 #define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__) 55 55 #define efi_is_native() (true) 56 56 57 - #define efi_table_attr(table, attr, instance) \ 58 - instance->attr 57 + #define efi_table_attr(inst, attr) (inst->attr) 59 58 60 59 #define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__) 61 60
+1 -2
arch/arm64/include/asm/efi.h
··· 97 97 #define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__) 98 98 #define efi_is_native() (true) 99 99 100 - #define efi_table_attr(table, attr, instance) \ 101 - instance->attr 100 + #define efi_table_attr(inst, attr) (inst->attr) 102 101 103 102 #define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__) 104 103
+4 -4
arch/x86/boot/compressed/eboot.c
··· 47 47 * large romsize. The UEFI spec limits the size of option ROMs to 16 48 48 * MiB so we reject any ROMs over 16 MiB in size to catch this. 49 49 */ 50 - romimage = efi_table_attr(efi_pci_io_protocol, romimage, pci); 51 - romsize = efi_table_attr(efi_pci_io_protocol, romsize, pci); 50 + romimage = efi_table_attr(pci, romimage); 51 + romsize = efi_table_attr(pci, romsize); 52 52 if (!romimage || !romsize || romsize > SZ_16M) 53 53 return EFI_INVALID_PARAMETER; 54 54 ··· 183 183 if (status != EFI_SUCCESS) 184 184 return; 185 185 186 - if (efi_table_attr(apple_properties_protocol, version, p) != 0x10000) { 186 + if (efi_table_attr(p, version) != 0x10000) { 187 187 efi_printk("Unsupported properties proto version\n"); 188 188 return; 189 189 } ··· 226 226 static void setup_quirks(struct boot_params *boot_params) 227 227 { 228 228 efi_char16_t *fw_vendor = (efi_char16_t *)(unsigned long) 229 - efi_table_attr(efi_system_table, fw_vendor, sys_table); 229 + efi_table_attr(efi_system_table(), fw_vendor); 230 230 231 231 if (!memcmp(fw_vendor, apple, sizeof(apple))) { 232 232 if (IS_ENABLED(CONFIG_APPLE_PROPERTIES))
+9 -16
arch/x86/include/asm/efi.h
··· 216 216 __builtin_types_compatible_p(u32, __typeof__(attr)), \ 217 217 (unsigned long)(attr), (attr)) 218 218 219 - #define efi_table_attr(table, attr, instance) ({ \ 220 - __typeof__(instance->attr) __ret; \ 221 - if (efi_is_native()) { \ 222 - __ret = instance->attr; \ 223 - } else { \ 224 - __ret = (__typeof__(__ret)) \ 225 - efi_mixed_mode_cast(instance->mixed_mode.attr); \ 226 - } \ 227 - __ret; \ 228 - }) 219 + #define efi_table_attr(inst, attr) \ 220 + (efi_is_native() \ 221 + ? inst->attr \ 222 + : (__typeof__(inst->attr)) \ 223 + efi_mixed_mode_cast(inst->mixed_mode.attr)) 229 224 230 225 #define efi_call_proto(inst, func, ...) \ 231 226 (efi_is_native() \ ··· 230 235 #define efi_call_early(f, ...) \ 231 236 (efi_is_native() \ 232 237 ? efi_system_table()->boottime->f(__VA_ARGS__) \ 233 - : efi64_thunk(efi_table_attr(efi_boot_services, \ 234 - boottime, efi_system_table())->mixed_mode.f, \ 235 - __VA_ARGS__)) 238 + : efi64_thunk(efi_table_attr(efi_system_table(), \ 239 + boottime)->mixed_mode.f, __VA_ARGS__)) 236 240 237 241 #define efi_call_runtime(f, ...) \ 238 242 (efi_is_native() \ 239 243 ? efi_system_table()->runtime->f(__VA_ARGS__) \ 240 - : efi64_thunk(efi_table_attr(efi_runtime_services, \ 241 - runtime, efi_system_table())->mixed_mode.f, \ 242 - __VA_ARGS__)) 244 + : efi64_thunk(efi_table_attr(efi_system_table(), \ 245 + runtime)->mixed_mode.f, __VA_ARGS__)) 243 246 244 247 extern bool efi_reboot_required(void); 245 248 extern bool efi_is_table_address(unsigned long phys_addr);
+4 -7
drivers/firmware/efi/libstub/efi-stub-helper.c
··· 933 933 934 934 void *get_efi_config_table(efi_guid_t guid) 935 935 { 936 - unsigned long tables = efi_table_attr(efi_system_table, tables, 937 - efi_system_table()); 938 - int nr_tables = efi_table_attr(efi_system_table, nr_tables, 939 - efi_system_table()); 936 + unsigned long tables = efi_table_attr(efi_system_table(), tables); 937 + int nr_tables = efi_table_attr(efi_system_table(), nr_tables); 940 938 int i; 941 939 942 940 for (i = 0; i < nr_tables; i++) { 943 941 efi_config_table_t *t = (void *)tables; 944 942 945 943 if (efi_guidcmp(t->guid, guid) == 0) 946 - return efi_table_attr(efi_config_table, table, t); 944 + return efi_table_attr(t, table); 947 945 948 946 tables += efi_is_native() ? sizeof(efi_config_table_t) 949 947 : sizeof(efi_config_table_32_t); ··· 951 953 952 954 void efi_char16_printk(efi_char16_t *str) 953 955 { 954 - efi_call_proto(efi_table_attr(efi_system_table, con_out, 955 - efi_system_table()), 956 + efi_call_proto(efi_table_attr(efi_system_table(), con_out), 956 957 output_string, str); 957 958 }
+3 -6
drivers/firmware/efi/libstub/gop.c
··· 85 85 } 86 86 } 87 87 88 - #define efi_gop_attr(table, attr, instance) \ 89 - (efi_table_attr(efi_graphics_output_protocol##table, attr, instance)) 90 - 91 88 static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto, 92 89 unsigned long size, void **handles) 93 90 { ··· 120 123 if (status == EFI_SUCCESS) 121 124 conout_found = true; 122 125 123 - mode = (void *)(unsigned long)efi_gop_attr(, mode, gop); 124 - info = (void *)(unsigned long)efi_gop_attr(_mode, info, mode); 125 - current_fb_base = efi_gop_attr(_mode, frame_buffer_base, mode); 126 + mode = efi_table_attr(gop, mode); 127 + info = efi_table_attr(mode, info); 128 + current_fb_base = efi_table_attr(mode, frame_buffer_base); 126 129 127 130 if ((!first_gop || conout_found) && 128 131 info->pixel_format != PIXEL_BLT_ONLY) {