Skip to content

Commit 0a75561

Browse files
committed
efi/libstub/x86: Avoid getter function for efi_is64
We no longer need to take special care when using global variables in the EFI stub, so switch to a simple symbol reference for efi_is64. Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 980771f commit 0a75561

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

arch/x86/include/asm/efi.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,19 @@ efi_status_t efi_set_virtual_address_map(unsigned long memory_map_size,
225225

226226
/* arch specific definitions used by the stub code */
227227

228-
__attribute_const__ bool efi_is_64bit(void);
228+
extern const bool efi_is64;
229+
230+
static inline bool efi_is_64bit(void)
231+
{
232+
if (IS_ENABLED(CONFIG_EFI_MIXED))
233+
return efi_is64;
234+
return IS_ENABLED(CONFIG_X86_64);
235+
}
229236

230237
static inline bool efi_is_native(void)
231238
{
232239
if (!IS_ENABLED(CONFIG_X86_64))
233240
return true;
234-
if (!IS_ENABLED(CONFIG_EFI_MIXED))
235-
return true;
236241
return efi_is_64bit();
237242
}
238243

drivers/firmware/efi/libstub/x86-stub.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,8 @@
2121
#define MAXMEM_X86_64_4LEVEL (1ull << 46)
2222

2323
const efi_system_table_t *efi_system_table;
24-
extern const bool efi_is64;
2524
extern u32 image_offset;
2625

27-
__attribute_const__ bool efi_is_64bit(void)
28-
{
29-
if (IS_ENABLED(CONFIG_EFI_MIXED))
30-
return efi_is64;
31-
return IS_ENABLED(CONFIG_X86_64);
32-
}
33-
3426
static efi_status_t
3527
preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
3628
{

0 commit comments

Comments
 (0)