aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-01-15 08:21:22 -0500
committerMatt Fleming <matt.fleming@intel.com>2014-03-04 11:16:16 -0500
commit3e909599215456928e6b42a04f11c2517881570b (patch)
treea3b8608015b94258abc7f5773d8f3a9a5a7c5219
parent6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff)
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: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--arch/x86/include/asm/efi.h1
-rw-r--r--arch/x86/kernel/setup.c6
-rw-r--r--arch/x86/platform/efi/efi.c21
-rw-r--r--include/linux/efi.h18
4 files changed, 21 insertions, 25 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 3d6b9f81cc68..a7a8bd89024e 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -119,7 +119,6 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
119#endif /* CONFIG_X86_32 */ 119#endif /* CONFIG_X86_32 */
120 120
121extern int add_efi_memmap; 121extern int add_efi_memmap;
122extern unsigned long x86_efi_facility;
123extern struct efi_scratch efi_scratch; 122extern struct efi_scratch efi_scratch;
124extern void efi_set_executable(efi_memory_desc_t *md, bool executable); 123extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
125extern int efi_memblock_x86_reserve_range(void); 124extern int efi_memblock_x86_reserve_range(void);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 06853e670354..3b5d278b7d5b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -926,11 +926,11 @@ void __init setup_arch(char **cmdline_p)
926#ifdef CONFIG_EFI 926#ifdef CONFIG_EFI
927 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 927 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
928 "EL32", 4)) { 928 "EL32", 4)) {
929 set_bit(EFI_BOOT, &x86_efi_facility); 929 set_bit(EFI_BOOT, &efi.flags);
930 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 930 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
931 "EL64", 4)) { 931 "EL64", 4)) {
932 set_bit(EFI_BOOT, &x86_efi_facility); 932 set_bit(EFI_BOOT, &efi.flags);
933 set_bit(EFI_64BIT, &x86_efi_facility); 933 set_bit(EFI_64BIT, &efi.flags);
934 } 934 }
935 935
936 if (efi_enabled(EFI_BOOT)) 936 if (efi_enabled(EFI_BOOT))
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 1a201ac7cef8..821562984452 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -67,8 +67,6 @@ struct efi_memory_map memmap;
67static struct efi efi_phys __initdata; 67static struct efi efi_phys __initdata;
68static efi_system_table_t efi_systab __initdata; 68static efi_system_table_t efi_systab __initdata;
69 69
70unsigned long x86_efi_facility;
71
72static __initdata efi_config_table_type_t arch_tables[] = { 70static __initdata efi_config_table_type_t arch_tables[] = {
73#ifdef CONFIG_X86_UV 71#ifdef CONFIG_X86_UV
74 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab}, 72 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
@@ -78,15 +76,6 @@ static __initdata efi_config_table_type_t arch_tables[] = {
78 76
79u64 efi_setup; /* efi setup_data physical address */ 77u64 efi_setup; /* efi setup_data physical address */
80 78
81/*
82 * Returns 1 if 'facility' is enabled, 0 otherwise.
83 */
84int efi_enabled(int facility)
85{
86 return test_bit(facility, &x86_efi_facility) != 0;
87}
88EXPORT_SYMBOL(efi_enabled);
89
90static bool __initdata disable_runtime = false; 79static bool __initdata disable_runtime = false;
91static int __init setup_noefi(char *arg) 80static int __init setup_noefi(char *arg)
92{ 81{
@@ -455,7 +444,7 @@ void __init efi_reserve_boot_services(void)
455 444
456void __init efi_unmap_memmap(void) 445void __init efi_unmap_memmap(void)
457{ 446{
458 clear_bit(EFI_MEMMAP, &x86_efi_facility); 447 clear_bit(EFI_MEMMAP, &efi.flags);
459 if (memmap.map) { 448 if (memmap.map) {
460 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 449 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
461 memmap.map = NULL; 450 memmap.map = NULL;
@@ -722,7 +711,7 @@ void __init efi_init(void)
722 if (efi_systab_init(efi_phys.systab)) 711 if (efi_systab_init(efi_phys.systab))
723 return; 712 return;
724 713
725 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); 714 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
726 715
727 efi.config_table = (unsigned long)efi.systab->tables; 716 efi.config_table = (unsigned long)efi.systab->tables;
728 efi.fw_vendor = (unsigned long)efi.systab->fw_vendor; 717 efi.fw_vendor = (unsigned long)efi.systab->fw_vendor;
@@ -750,7 +739,7 @@ void __init efi_init(void)
750 if (efi_config_init(arch_tables)) 739 if (efi_config_init(arch_tables))
751 return; 740 return;
752 741
753 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility); 742 set_bit(EFI_CONFIG_TABLES, &efi.flags);
754 743
755 /* 744 /*
756 * Note: We currently don't support runtime services on an EFI 745 * Note: We currently don't support runtime services on an EFI
@@ -762,12 +751,12 @@ void __init efi_init(void)
762 else { 751 else {
763 if (disable_runtime || efi_runtime_init()) 752 if (disable_runtime || efi_runtime_init())
764 return; 753 return;
765 set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility); 754 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
766 } 755 }
767 if (efi_memmap_init()) 756 if (efi_memmap_init())
768 return; 757 return;
769 758
770 set_bit(EFI_MEMMAP, &x86_efi_facility); 759 set_bit(EFI_MEMMAP, &efi.flags);
771 760
772 print_efi_memmap(); 761 print_efi_memmap();
773} 762}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 0a819e7a60c9..214833b4a97d 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -573,6 +573,7 @@ extern struct efi {
573 efi_reset_system_t *reset_system; 573 efi_reset_system_t *reset_system;
574 efi_set_virtual_address_map_t *set_virtual_address_map; 574 efi_set_virtual_address_map_t *set_virtual_address_map;
575 struct efi_memory_map *memmap; 575 struct efi_memory_map *memmap;
576 unsigned long flags;
576} efi; 577} efi;
577 578
578static inline int 579static inline int
@@ -660,17 +661,24 @@ extern int __init efi_setup_pcdp_console(char *);
660 661
661#ifdef CONFIG_EFI 662#ifdef CONFIG_EFI
662# ifdef CONFIG_X86 663# ifdef CONFIG_X86
663extern int efi_enabled(int facility); 664
665/*
666 * Test whether the above EFI_* bits are enabled.
667 */
668static inline bool efi_enabled(int feature)
669{
670 return test_bit(feature, &efi.flags) != 0;
671}
664# else 672# else
665static inline int efi_enabled(int facility) 673static inline bool efi_enabled(int feature)
666{ 674{
667 return 1; 675 return true;
668} 676}
669# endif 677# endif
670#else 678#else
671static inline int efi_enabled(int facility) 679static inline bool efi_enabled(int feature)
672{ 680{
673 return 0; 681 return false;
674} 682}
675#endif 683#endif
676 684