Skip to content

Commit

Permalink
ia64/efi: Implement efi_enabled()
Browse files Browse the repository at this point in the history
There's no good reason to keep efi_enabled() under CONFIG_X86 anymore,
since nothing about the implementation is specific to x86.

Set EFI feature flags in the ia64 boot path instead of claiming to
support all features. The old behaviour was actually buggy since
efi.memmap never points to a valid memory map, so we shouldn't be
claiming to support EFI_MEMMAP.

Fortunately, this bug was never triggered because EFI_MEMMAP isn't used
outside of arch/x86 currently, but that may not always be the case.

Reviewed-and-tested-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
  • Loading branch information
Matt Fleming committed Mar 4, 2014
1 parent fabb37c commit 0920638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 7 additions & 0 deletions arch/ia64/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ efi_init (void)
char *cp, vendor[100] = "unknown";
int i;

set_bit(EFI_BOOT, &efi.flags);
set_bit(EFI_64BIT, &efi.flags);

/*
* It's too early to be able to use the standard kernel command line
* support...
Expand Down Expand Up @@ -529,6 +532,8 @@ efi_init (void)
efi.systab->hdr.revision >> 16,
efi.systab->hdr.revision & 0xffff, vendor);

set_bit(EFI_SYSTEM_TABLES, &efi.flags);

palo_phys = EFI_INVALID_TABLE_ADDR;

if (efi_config_init(arch_tables) != 0)
Expand Down Expand Up @@ -657,6 +662,8 @@ efi_enter_virtual_mode (void)
return;
}

set_bit(EFI_RUNTIME_SERVICES, &efi.flags);

/*
* Now that EFI is in virtual mode, we call the EFI functions more
* efficiently:
Expand Down
8 changes: 0 additions & 8 deletions include/linux/efi.h
Original file line number Diff line number Diff line change
Expand Up @@ -660,21 +660,13 @@ extern int __init efi_setup_pcdp_console(char *);
#define EFI_ARCH_1 6 /* First arch-specific bit */

#ifdef CONFIG_EFI
# ifdef CONFIG_X86

/*
* Test whether the above EFI_* bits are enabled.
*/
static inline bool efi_enabled(int feature)
{
return test_bit(feature, &efi.flags) != 0;
}
# else
static inline bool efi_enabled(int feature)
{
return true;
}
# endif
#else
static inline bool efi_enabled(int feature)
{
Expand Down

0 comments on commit 0920638

Please sign in to comment.