aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi
diff options
context:
space:
mode:
authorLeif Lindholm <leif.lindholm@linaro.org>2013-09-05 06:34:54 -0400
committerMatt Fleming <matt.fleming@intel.com>2013-09-05 08:29:29 -0400
commit272686bf46a34f86d270cf192f68769667792026 (patch)
tree4a2ac56e098cc6477ad50839fd5db40719867bd0 /arch/x86/platform/efi
parentd02d0545f1fc62302fd9973a530b8029f1d9a9f1 (diff)
efi: x86: ia64: provide a generic efi_config_init()
Common to (U)EFI support on all platforms is the global "efi" data structure, and the code that parses the System Table to locate addresses to populate that structure with. This patch adds both of these to the global EFI driver code and removes the local definition of the global "efi" data structure from the x86 and ia64 code. Squashed into one big patch to avoid breaking bisection. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/platform/efi')
-rw-r--r--arch/x86/platform/efi/efi.c96
1 files changed, 8 insertions, 88 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 90f6ed127096..ed2be58ea3f1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -60,19 +60,6 @@
60 60
61static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 }; 61static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
62 62
63struct efi __read_mostly efi = {
64 .mps = EFI_INVALID_TABLE_ADDR,
65 .acpi = EFI_INVALID_TABLE_ADDR,
66 .acpi20 = EFI_INVALID_TABLE_ADDR,
67 .smbios = EFI_INVALID_TABLE_ADDR,
68 .sal_systab = EFI_INVALID_TABLE_ADDR,
69 .boot_info = EFI_INVALID_TABLE_ADDR,
70 .hcdp = EFI_INVALID_TABLE_ADDR,
71 .uga = EFI_INVALID_TABLE_ADDR,
72 .uv_systab = EFI_INVALID_TABLE_ADDR,
73};
74EXPORT_SYMBOL(efi);
75
76struct efi_memory_map memmap; 63struct efi_memory_map memmap;
77 64
78static struct efi efi_phys __initdata; 65static struct efi efi_phys __initdata;
@@ -80,6 +67,13 @@ static efi_system_table_t efi_systab __initdata;
80 67
81unsigned long x86_efi_facility; 68unsigned long x86_efi_facility;
82 69
70static __initdata efi_config_table_type_t arch_tables[] = {
71#ifdef CONFIG_X86_UV
72 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
73#endif
74 {NULL_GUID, NULL, 0},
75};
76
83/* 77/*
84 * Returns 1 if 'facility' is enabled, 0 otherwise. 78 * Returns 1 if 'facility' is enabled, 0 otherwise.
85 */ 79 */
@@ -578,80 +572,6 @@ static int __init efi_systab_init(void *phys)
578 return 0; 572 return 0;
579} 573}
580 574
581static int __init efi_config_init(u64 tables, int nr_tables)
582{
583 void *config_tables, *tablep;
584 int i, sz;
585
586 if (efi_enabled(EFI_64BIT))
587 sz = sizeof(efi_config_table_64_t);
588 else
589 sz = sizeof(efi_config_table_32_t);
590
591 /*
592 * Let's see what config tables the firmware passed to us.
593 */
594 config_tables = early_ioremap(tables, nr_tables * sz);
595 if (config_tables == NULL) {
596 pr_err("Could not map Configuration table!\n");
597 return -ENOMEM;
598 }
599
600 tablep = config_tables;
601 pr_info("");
602 for (i = 0; i < efi.systab->nr_tables; i++) {
603 efi_guid_t guid;
604 unsigned long table;
605
606 if (efi_enabled(EFI_64BIT)) {
607 u64 table64;
608 guid = ((efi_config_table_64_t *)tablep)->guid;
609 table64 = ((efi_config_table_64_t *)tablep)->table;
610 table = table64;
611#ifdef CONFIG_X86_32
612 if (table64 >> 32) {
613 pr_cont("\n");
614 pr_err("Table located above 4GB, disabling EFI.\n");
615 early_iounmap(config_tables,
616 efi.systab->nr_tables * sz);
617 return -EINVAL;
618 }
619#endif
620 } else {
621 guid = ((efi_config_table_32_t *)tablep)->guid;
622 table = ((efi_config_table_32_t *)tablep)->table;
623 }
624 if (!efi_guidcmp(guid, MPS_TABLE_GUID)) {
625 efi.mps = table;
626 pr_cont(" MPS=0x%lx ", table);
627 } else if (!efi_guidcmp(guid, ACPI_20_TABLE_GUID)) {
628 efi.acpi20 = table;
629 pr_cont(" ACPI 2.0=0x%lx ", table);
630 } else if (!efi_guidcmp(guid, ACPI_TABLE_GUID)) {
631 efi.acpi = table;
632 pr_cont(" ACPI=0x%lx ", table);
633 } else if (!efi_guidcmp(guid, SMBIOS_TABLE_GUID)) {
634 efi.smbios = table;
635 pr_cont(" SMBIOS=0x%lx ", table);
636#ifdef CONFIG_X86_UV
637 } else if (!efi_guidcmp(guid, UV_SYSTEM_TABLE_GUID)) {
638 efi.uv_systab = table;
639 pr_cont(" UVsystab=0x%lx ", table);
640#endif
641 } else if (!efi_guidcmp(guid, HCDP_TABLE_GUID)) {
642 efi.hcdp = table;
643 pr_cont(" HCDP=0x%lx ", table);
644 } else if (!efi_guidcmp(guid, UGA_IO_PROTOCOL_GUID)) {
645 efi.uga = table;
646 pr_cont(" UGA=0x%lx ", table);
647 }
648 tablep += sz;
649 }
650 pr_cont("\n");
651 early_iounmap(config_tables, efi.systab->nr_tables * sz);
652 return 0;
653}
654
655static int __init efi_runtime_init(void) 575static int __init efi_runtime_init(void)
656{ 576{
657 efi_runtime_services_t *runtime; 577 efi_runtime_services_t *runtime;
@@ -745,7 +665,7 @@ void __init efi_init(void)
745 efi.systab->hdr.revision >> 16, 665 efi.systab->hdr.revision >> 16,
746 efi.systab->hdr.revision & 0xffff, vendor); 666 efi.systab->hdr.revision & 0xffff, vendor);
747 667
748 if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) 668 if (efi_config_init(arch_tables))
749 return; 669 return;
750 670
751 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility); 671 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);