diff options
author | Leif Lindholm <leif.lindholm@linaro.org> | 2013-09-05 06:34:54 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-09-05 08:29:29 -0400 |
commit | 272686bf46a34f86d270cf192f68769667792026 (patch) | |
tree | 4a2ac56e098cc6477ad50839fd5db40719867bd0 /arch/ia64/kernel/efi.c | |
parent | d02d0545f1fc62302fd9973a530b8029f1d9a9f1 (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/ia64/kernel/efi.c')
-rw-r--r-- | arch/ia64/kernel/efi.c | 54 |
1 files changed, 11 insertions, 43 deletions
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 51bce594eb83..da5b462e6de6 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c | |||
@@ -44,10 +44,15 @@ | |||
44 | 44 | ||
45 | #define EFI_DEBUG 0 | 45 | #define EFI_DEBUG 0 |
46 | 46 | ||
47 | static __initdata unsigned long palo_phys; | ||
48 | |||
49 | static __initdata efi_config_table_type_t arch_tables[] = { | ||
50 | {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys}, | ||
51 | {NULL_GUID, NULL, 0}, | ||
52 | }; | ||
53 | |||
47 | extern efi_status_t efi_call_phys (void *, ...); | 54 | extern efi_status_t efi_call_phys (void *, ...); |
48 | 55 | ||
49 | struct efi efi; | ||
50 | EXPORT_SYMBOL(efi); | ||
51 | static efi_runtime_services_t *runtime; | 56 | static efi_runtime_services_t *runtime; |
52 | static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL; | 57 | static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL; |
53 | 58 | ||
@@ -423,9 +428,9 @@ static u8 __init palo_checksum(u8 *buffer, u32 length) | |||
423 | * Parse and handle PALO table which is published at: | 428 | * Parse and handle PALO table which is published at: |
424 | * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf | 429 | * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf |
425 | */ | 430 | */ |
426 | static void __init handle_palo(unsigned long palo_phys) | 431 | static void __init handle_palo(unsigned long phys_addr) |
427 | { | 432 | { |
428 | struct palo_table *palo = __va(palo_phys); | 433 | struct palo_table *palo = __va(phys_addr); |
429 | u8 checksum; | 434 | u8 checksum; |
430 | 435 | ||
431 | if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) { | 436 | if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) { |
@@ -467,12 +472,10 @@ void __init | |||
467 | efi_init (void) | 472 | efi_init (void) |
468 | { | 473 | { |
469 | void *efi_map_start, *efi_map_end; | 474 | void *efi_map_start, *efi_map_end; |
470 | efi_config_table_t *config_tables; | ||
471 | efi_char16_t *c16; | 475 | efi_char16_t *c16; |
472 | u64 efi_desc_size; | 476 | u64 efi_desc_size; |
473 | char *cp, vendor[100] = "unknown"; | 477 | char *cp, vendor[100] = "unknown"; |
474 | int i; | 478 | int i; |
475 | unsigned long palo_phys; | ||
476 | 479 | ||
477 | /* | 480 | /* |
478 | * It's too early to be able to use the standard kernel command line | 481 | * It's too early to be able to use the standard kernel command line |
@@ -514,8 +517,6 @@ efi_init (void) | |||
514 | efi.systab->hdr.revision >> 16, | 517 | efi.systab->hdr.revision >> 16, |
515 | efi.systab->hdr.revision & 0xffff); | 518 | efi.systab->hdr.revision & 0xffff); |
516 | 519 | ||
517 | config_tables = __va(efi.systab->tables); | ||
518 | |||
519 | /* Show what we know for posterity */ | 520 | /* Show what we know for posterity */ |
520 | c16 = __va(efi.systab->fw_vendor); | 521 | c16 = __va(efi.systab->fw_vendor); |
521 | if (c16) { | 522 | if (c16) { |
@@ -528,43 +529,10 @@ efi_init (void) | |||
528 | efi.systab->hdr.revision >> 16, | 529 | efi.systab->hdr.revision >> 16, |
529 | efi.systab->hdr.revision & 0xffff, vendor); | 530 | efi.systab->hdr.revision & 0xffff, vendor); |
530 | 531 | ||
531 | efi.mps = EFI_INVALID_TABLE_ADDR; | ||
532 | efi.acpi = EFI_INVALID_TABLE_ADDR; | ||
533 | efi.acpi20 = EFI_INVALID_TABLE_ADDR; | ||
534 | efi.smbios = EFI_INVALID_TABLE_ADDR; | ||
535 | efi.sal_systab = EFI_INVALID_TABLE_ADDR; | ||
536 | efi.boot_info = EFI_INVALID_TABLE_ADDR; | ||
537 | efi.hcdp = EFI_INVALID_TABLE_ADDR; | ||
538 | efi.uga = EFI_INVALID_TABLE_ADDR; | ||
539 | |||
540 | palo_phys = EFI_INVALID_TABLE_ADDR; | 532 | palo_phys = EFI_INVALID_TABLE_ADDR; |
541 | 533 | ||
542 | for (i = 0; i < (int) efi.systab->nr_tables; i++) { | 534 | if (efi_config_init(arch_tables) != 0) |
543 | if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { | 535 | return; |
544 | efi.mps = config_tables[i].table; | ||
545 | printk(" MPS=0x%lx", config_tables[i].table); | ||
546 | } else if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) { | ||
547 | efi.acpi20 = config_tables[i].table; | ||
548 | printk(" ACPI 2.0=0x%lx", config_tables[i].table); | ||
549 | } else if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) { | ||
550 | efi.acpi = config_tables[i].table; | ||
551 | printk(" ACPI=0x%lx", config_tables[i].table); | ||
552 | } else if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) { | ||
553 | efi.smbios = config_tables[i].table; | ||
554 | printk(" SMBIOS=0x%lx", config_tables[i].table); | ||
555 | } else if (efi_guidcmp(config_tables[i].guid, SAL_SYSTEM_TABLE_GUID) == 0) { | ||
556 | efi.sal_systab = config_tables[i].table; | ||
557 | printk(" SALsystab=0x%lx", config_tables[i].table); | ||
558 | } else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) { | ||
559 | efi.hcdp = config_tables[i].table; | ||
560 | printk(" HCDP=0x%lx", config_tables[i].table); | ||
561 | } else if (efi_guidcmp(config_tables[i].guid, | ||
562 | PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID) == 0) { | ||
563 | palo_phys = config_tables[i].table; | ||
564 | printk(" PALO=0x%lx", config_tables[i].table); | ||
565 | } | ||
566 | } | ||
567 | printk("\n"); | ||
568 | 536 | ||
569 | if (palo_phys != EFI_INVALID_TABLE_ADDR) | 537 | if (palo_phys != EFI_INVALID_TABLE_ADDR) |
570 | handle_palo(palo_phys); | 538 | handle_palo(palo_phys); |