Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb341831 authored by Matt Fleming's avatar Matt Fleming Committed by Joonwoo Park
Browse files

efi: Move facility flags to struct efi



As we grow support for more EFI architectures they're going to want the
ability to query which EFI features are available on the running system.
Instead of storing this information in an architecture-specific place,
stick it in the global 'struct efi', which is already the central
location for EFI state.

While we're at it, let's change the return value of efi_enabled() to be
bool and replace all references to 'facility' with 'feature', which is
the usual word used to describe the attributes of the running system.

Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Git-commit: 3e909599215456928e6b42a04f11c2517881570b
[joonwoop@codeaurora.org: fixed trivial merge conflict.]
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent fac031db
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -94,7 +94,6 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
#endif /* CONFIG_X86_32 */
#endif /* CONFIG_X86_32 */


extern int add_efi_memmap;
extern int add_efi_memmap;
extern unsigned long x86_efi_facility;
extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
extern int efi_memblock_x86_reserve_range(void);
extern int efi_memblock_x86_reserve_range(void);
extern void efi_call_phys_prelog(void);
extern void efi_call_phys_prelog(void);
+3 −3
Original line number Original line Diff line number Diff line
@@ -908,11 +908,11 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_EFI
#ifdef CONFIG_EFI
	if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
	if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
		     "EL32", 4)) {
		     "EL32", 4)) {
		set_bit(EFI_BOOT, &x86_efi_facility);
		set_bit(EFI_BOOT, &efi.flags);
	} else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
	} else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
		     "EL64", 4)) {
		     "EL64", 4)) {
		set_bit(EFI_BOOT, &x86_efi_facility);
		set_bit(EFI_BOOT, &efi.flags);
		set_bit(EFI_64BIT, &x86_efi_facility);
		set_bit(EFI_64BIT, &efi.flags);
	}
	}


	if (efi_enabled(EFI_BOOT))
	if (efi_enabled(EFI_BOOT))
+5 −7
Original line number Original line Diff line number Diff line
@@ -65,8 +65,6 @@ struct efi_memory_map memmap;
static struct efi efi_phys __initdata;
static struct efi efi_phys __initdata;
static efi_system_table_t efi_systab __initdata;
static efi_system_table_t efi_systab __initdata;


unsigned long x86_efi_facility;

static __initdata efi_config_table_type_t arch_tables[] = {
static __initdata efi_config_table_type_t arch_tables[] = {
#ifdef CONFIG_X86_UV
#ifdef CONFIG_X86_UV
	{UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
	{UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
@@ -450,7 +448,7 @@ void __init efi_reserve_boot_services(void)


void __init efi_unmap_memmap(void)
void __init efi_unmap_memmap(void)
{
{
	clear_bit(EFI_MEMMAP, &x86_efi_facility);
	clear_bit(EFI_MEMMAP, &efi.flags);
	if (memmap.map) {
	if (memmap.map) {
		early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
		early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
		memmap.map = NULL;
		memmap.map = NULL;
@@ -647,7 +645,7 @@ void __init efi_init(void)
	if (efi_systab_init(efi_phys.systab))
	if (efi_systab_init(efi_phys.systab))
		return;
		return;


	set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
	set_bit(EFI_SYSTEM_TABLES, &efi.flags);


	/*
	/*
	 * Show what we know for posterity
	 * Show what we know for posterity
@@ -668,7 +666,7 @@ void __init efi_init(void)
	if (efi_config_init(arch_tables))
	if (efi_config_init(arch_tables))
		return;
		return;


	set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
	set_bit(EFI_CONFIG_TABLES, &efi.flags);


	/*
	/*
	 * Note: We currently don't support runtime services on an EFI
	 * Note: We currently don't support runtime services on an EFI
@@ -680,13 +678,13 @@ void __init efi_init(void)
	else {
	else {
		if (disable_runtime || efi_runtime_init())
		if (disable_runtime || efi_runtime_init())
			return;
			return;
		set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
		set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
	}
	}


	if (efi_memmap_init())
	if (efi_memmap_init())
		return;
		return;


	set_bit(EFI_MEMMAP, &x86_efi_facility);
	set_bit(EFI_MEMMAP, &efi.flags);


#if EFI_DEBUG
#if EFI_DEBUG
	print_efi_memmap();
	print_efi_memmap();
+13 −5
Original line number Original line Diff line number Diff line
@@ -559,6 +559,7 @@ extern struct efi {
	efi_reset_system_t *reset_system;
	efi_reset_system_t *reset_system;
	efi_set_virtual_address_map_t *set_virtual_address_map;
	efi_set_virtual_address_map_t *set_virtual_address_map;
	struct efi_memory_map *memmap;
	struct efi_memory_map *memmap;
	unsigned long flags;
} efi;
} efi;


static inline int
static inline int
@@ -651,17 +652,24 @@ extern int __init efi_setup_pcdp_console(char *);


#ifdef CONFIG_EFI
#ifdef CONFIG_EFI
# ifdef CONFIG_X86
# ifdef CONFIG_X86
extern int efi_enabled(int facility);

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