Skip to content

Commit

Permalink
efi/libstub/x86: Avoid getter function for efi_is64
Browse files Browse the repository at this point in the history
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 <ardb@kernel.org>
  • Loading branch information
Ard Biesheuvel committed Apr 24, 2020
1 parent 980771f commit 0a75561
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 8 additions & 3 deletions arch/x86/include/asm/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,19 @@ efi_status_t efi_set_virtual_address_map(unsigned long memory_map_size,

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

__attribute_const__ bool efi_is_64bit(void);
extern const bool efi_is64;

static inline bool efi_is_64bit(void)
{
if (IS_ENABLED(CONFIG_EFI_MIXED))
return efi_is64;
return IS_ENABLED(CONFIG_X86_64);
}

static inline bool efi_is_native(void)
{
if (!IS_ENABLED(CONFIG_X86_64))
return true;
if (!IS_ENABLED(CONFIG_EFI_MIXED))
return true;
return efi_is_64bit();
}

Expand Down
8 changes: 0 additions & 8 deletions drivers/firmware/efi/libstub/x86-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,8 @@
#define MAXMEM_X86_64_4LEVEL (1ull << 46)

const efi_system_table_t *efi_system_table;
extern const bool efi_is64;
extern u32 image_offset;

__attribute_const__ bool efi_is_64bit(void)
{
if (IS_ENABLED(CONFIG_EFI_MIXED))
return efi_is64;
return IS_ENABLED(CONFIG_X86_64);
}

static efi_status_t
preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
{
Expand Down

0 comments on commit 0a75561

Please sign in to comment.