| .. | .. |
|---|
| 23 | 23 | * Skip non-WB memory and ignore empty memory ranges. |
|---|
| 24 | 24 | */ |
|---|
| 25 | 25 | #include <linux/module.h> |
|---|
| 26 | | -#include <linux/bootmem.h> |
|---|
| 26 | +#include <linux/memblock.h> |
|---|
| 27 | 27 | #include <linux/crash_dump.h> |
|---|
| 28 | 28 | #include <linux/kernel.h> |
|---|
| 29 | 29 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 37 | 37 | #include <asm/io.h> |
|---|
| 38 | 38 | #include <asm/kregs.h> |
|---|
| 39 | 39 | #include <asm/meminit.h> |
|---|
| 40 | | -#include <asm/pgtable.h> |
|---|
| 41 | 40 | #include <asm/processor.h> |
|---|
| 42 | 41 | #include <asm/mca.h> |
|---|
| 43 | 42 | #include <asm/setup.h> |
|---|
| .. | .. |
|---|
| 45 | 44 | |
|---|
| 46 | 45 | #define EFI_DEBUG 0 |
|---|
| 47 | 46 | |
|---|
| 47 | +#define ESI_TABLE_GUID \ |
|---|
| 48 | + EFI_GUID(0x43EA58DC, 0xCF28, 0x4b06, 0xB3, \ |
|---|
| 49 | + 0x91, 0xB7, 0x50, 0x59, 0x34, 0x2B, 0xD4) |
|---|
| 50 | + |
|---|
| 51 | +static unsigned long mps_phys = EFI_INVALID_TABLE_ADDR; |
|---|
| 48 | 52 | static __initdata unsigned long palo_phys; |
|---|
| 49 | 53 | |
|---|
| 50 | | -static __initdata efi_config_table_type_t arch_tables[] = { |
|---|
| 51 | | - {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys}, |
|---|
| 52 | | - {NULL_GUID, NULL, 0}, |
|---|
| 54 | +unsigned long __initdata esi_phys = EFI_INVALID_TABLE_ADDR; |
|---|
| 55 | +unsigned long hcdp_phys = EFI_INVALID_TABLE_ADDR; |
|---|
| 56 | +unsigned long sal_systab_phys = EFI_INVALID_TABLE_ADDR; |
|---|
| 57 | + |
|---|
| 58 | +static const efi_config_table_type_t arch_tables[] __initconst = { |
|---|
| 59 | + {ESI_TABLE_GUID, &esi_phys, "ESI" }, |
|---|
| 60 | + {HCDP_TABLE_GUID, &hcdp_phys, "HCDP" }, |
|---|
| 61 | + {MPS_TABLE_GUID, &mps_phys, "MPS" }, |
|---|
| 62 | + {PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, &palo_phys, "PALO" }, |
|---|
| 63 | + {SAL_SYSTEM_TABLE_GUID, &sal_systab_phys, "SALsystab" }, |
|---|
| 64 | + {}, |
|---|
| 53 | 65 | }; |
|---|
| 54 | 66 | |
|---|
| 55 | 67 | extern efi_status_t efi_call_phys (void *, ...); |
|---|
| .. | .. |
|---|
| 401 | 413 | mask = ~((1 << IA64_GRANULE_SHIFT) - 1); |
|---|
| 402 | 414 | |
|---|
| 403 | 415 | printk(KERN_INFO "CPU %d: mapping PAL code " |
|---|
| 404 | | - "[0x%lx-0x%lx) into [0x%lx-0x%lx)\n", |
|---|
| 405 | | - smp_processor_id(), md->phys_addr, |
|---|
| 406 | | - md->phys_addr + efi_md_size(md), |
|---|
| 407 | | - vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE); |
|---|
| 416 | + "[0x%llx-0x%llx) into [0x%llx-0x%llx)\n", |
|---|
| 417 | + smp_processor_id(), md->phys_addr, |
|---|
| 418 | + md->phys_addr + efi_md_size(md), |
|---|
| 419 | + vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE); |
|---|
| 408 | 420 | #endif |
|---|
| 409 | 421 | return __va(md->phys_addr); |
|---|
| 410 | 422 | } |
|---|
| .. | .. |
|---|
| 471 | 483 | void __init |
|---|
| 472 | 484 | efi_init (void) |
|---|
| 473 | 485 | { |
|---|
| 486 | + const efi_system_table_t *efi_systab; |
|---|
| 474 | 487 | void *efi_map_start, *efi_map_end; |
|---|
| 475 | | - efi_char16_t *c16; |
|---|
| 476 | 488 | u64 efi_desc_size; |
|---|
| 477 | | - char *cp, vendor[100] = "unknown"; |
|---|
| 478 | | - int i; |
|---|
| 489 | + char *cp; |
|---|
| 479 | 490 | |
|---|
| 480 | 491 | set_bit(EFI_BOOT, &efi.flags); |
|---|
| 481 | 492 | set_bit(EFI_64BIT, &efi.flags); |
|---|
| .. | .. |
|---|
| 505 | 516 | printk(KERN_INFO "Ignoring memory above %lluMB\n", |
|---|
| 506 | 517 | max_addr >> 20); |
|---|
| 507 | 518 | |
|---|
| 508 | | - efi.systab = __va(ia64_boot_param->efi_systab); |
|---|
| 519 | + efi_systab = __va(ia64_boot_param->efi_systab); |
|---|
| 509 | 520 | |
|---|
| 510 | 521 | /* |
|---|
| 511 | 522 | * Verify the EFI Table |
|---|
| 512 | 523 | */ |
|---|
| 513 | | - if (efi.systab == NULL) |
|---|
| 524 | + if (efi_systab == NULL) |
|---|
| 514 | 525 | panic("Whoa! Can't find EFI system table.\n"); |
|---|
| 515 | | - if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) |
|---|
| 526 | + if (efi_systab_check_header(&efi_systab->hdr, 1)) |
|---|
| 516 | 527 | panic("Whoa! EFI system table signature incorrect\n"); |
|---|
| 517 | | - if ((efi.systab->hdr.revision >> 16) == 0) |
|---|
| 518 | | - printk(KERN_WARNING "Warning: EFI system table version " |
|---|
| 519 | | - "%d.%02d, expected 1.00 or greater\n", |
|---|
| 520 | | - efi.systab->hdr.revision >> 16, |
|---|
| 521 | | - efi.systab->hdr.revision & 0xffff); |
|---|
| 522 | 528 | |
|---|
| 523 | | - /* Show what we know for posterity */ |
|---|
| 524 | | - c16 = __va(efi.systab->fw_vendor); |
|---|
| 525 | | - if (c16) { |
|---|
| 526 | | - for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i) |
|---|
| 527 | | - vendor[i] = *c16++; |
|---|
| 528 | | - vendor[i] = '\0'; |
|---|
| 529 | | - } |
|---|
| 530 | | - |
|---|
| 531 | | - printk(KERN_INFO "EFI v%u.%.02u by %s:", |
|---|
| 532 | | - efi.systab->hdr.revision >> 16, |
|---|
| 533 | | - efi.systab->hdr.revision & 0xffff, vendor); |
|---|
| 529 | + efi_systab_report_header(&efi_systab->hdr, efi_systab->fw_vendor); |
|---|
| 534 | 530 | |
|---|
| 535 | 531 | palo_phys = EFI_INVALID_TABLE_ADDR; |
|---|
| 536 | 532 | |
|---|
| 537 | | - if (efi_config_init(arch_tables) != 0) |
|---|
| 533 | + if (efi_config_parse_tables(__va(efi_systab->tables), |
|---|
| 534 | + efi_systab->nr_tables, |
|---|
| 535 | + arch_tables) != 0) |
|---|
| 538 | 536 | return; |
|---|
| 539 | 537 | |
|---|
| 540 | 538 | if (palo_phys != EFI_INVALID_TABLE_ADDR) |
|---|
| 541 | 539 | handle_palo(palo_phys); |
|---|
| 542 | 540 | |
|---|
| 543 | | - runtime = __va(efi.systab->runtime); |
|---|
| 541 | + runtime = __va(efi_systab->runtime); |
|---|
| 544 | 542 | efi.get_time = phys_get_time; |
|---|
| 545 | 543 | efi.set_time = phys_set_time; |
|---|
| 546 | 544 | efi.get_wakeup_time = phys_get_wakeup_time; |
|---|
| .. | .. |
|---|
| 560 | 558 | { |
|---|
| 561 | 559 | efi_memory_desc_t *md; |
|---|
| 562 | 560 | void *p; |
|---|
| 561 | + unsigned int i; |
|---|
| 563 | 562 | |
|---|
| 564 | 563 | for (i = 0, p = efi_map_start; p < efi_map_end; |
|---|
| 565 | 564 | ++i, p += efi_desc_size) |
|---|
| .. | .. |
|---|
| 586 | 585 | } |
|---|
| 587 | 586 | |
|---|
| 588 | 587 | printk("mem%02d: %s " |
|---|
| 589 | | - "range=[0x%016lx-0x%016lx) (%4lu%s)\n", |
|---|
| 588 | + "range=[0x%016llx-0x%016llx) (%4lu%s)\n", |
|---|
| 590 | 589 | i, efi_md_typeattr_format(buf, sizeof(buf), md), |
|---|
| 591 | 590 | md->phys_addr, |
|---|
| 592 | 591 | md->phys_addr + efi_md_size(md), size, unit); |
|---|
| .. | .. |
|---|
| 842 | 841 | } while (md); |
|---|
| 843 | 842 | return 0; /* never reached */ |
|---|
| 844 | 843 | } |
|---|
| 845 | | -EXPORT_SYMBOL(kern_mem_attribute); |
|---|
| 846 | 844 | |
|---|
| 847 | 845 | int |
|---|
| 848 | 846 | valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size) |
|---|
| .. | .. |
|---|
| 853 | 851 | * /dev/mem reads and writes use copy_to_user(), which implicitly |
|---|
| 854 | 852 | * uses a granule-sized kernel identity mapping. It's really |
|---|
| 855 | 853 | * only safe to do this for regions in kern_memmap. For more |
|---|
| 856 | | - * details, see Documentation/ia64/aliasing.txt. |
|---|
| 854 | + * details, see Documentation/ia64/aliasing.rst. |
|---|
| 857 | 855 | */ |
|---|
| 858 | 856 | attr = kern_mem_attribute(phys_addr, size); |
|---|
| 859 | 857 | if (attr & EFI_MEMORY_WB || attr & EFI_MEMORY_UC) |
|---|
| .. | .. |
|---|
| 1349 | 1347 | return ret; |
|---|
| 1350 | 1348 | } |
|---|
| 1351 | 1349 | #endif |
|---|
| 1350 | + |
|---|
| 1351 | +char *efi_systab_show_arch(char *str) |
|---|
| 1352 | +{ |
|---|
| 1353 | + if (mps_phys != EFI_INVALID_TABLE_ADDR) |
|---|
| 1354 | + str += sprintf(str, "MPS=0x%lx\n", mps_phys); |
|---|
| 1355 | + if (hcdp_phys != EFI_INVALID_TABLE_ADDR) |
|---|
| 1356 | + str += sprintf(str, "HCDP=0x%lx\n", hcdp_phys); |
|---|
| 1357 | + return str; |
|---|
| 1358 | +} |
|---|