forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/ia64/kernel/efi.c
....@@ -23,7 +23,7 @@
2323 * Skip non-WB memory and ignore empty memory ranges.
2424 */
2525 #include <linux/module.h>
26
-#include <linux/bootmem.h>
26
+#include <linux/memblock.h>
2727 #include <linux/crash_dump.h>
2828 #include <linux/kernel.h>
2929 #include <linux/init.h>
....@@ -37,7 +37,6 @@
3737 #include <asm/io.h>
3838 #include <asm/kregs.h>
3939 #include <asm/meminit.h>
40
-#include <asm/pgtable.h>
4140 #include <asm/processor.h>
4241 #include <asm/mca.h>
4342 #include <asm/setup.h>
....@@ -45,11 +44,24 @@
4544
4645 #define EFI_DEBUG 0
4746
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;
4852 static __initdata unsigned long palo_phys;
4953
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
+ {},
5365 };
5466
5567 extern efi_status_t efi_call_phys (void *, ...);
....@@ -401,10 +413,10 @@
401413 mask = ~((1 << IA64_GRANULE_SHIFT) - 1);
402414
403415 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);
408420 #endif
409421 return __va(md->phys_addr);
410422 }
....@@ -471,11 +483,10 @@
471483 void __init
472484 efi_init (void)
473485 {
486
+ const efi_system_table_t *efi_systab;
474487 void *efi_map_start, *efi_map_end;
475
- efi_char16_t *c16;
476488 u64 efi_desc_size;
477
- char *cp, vendor[100] = "unknown";
478
- int i;
489
+ char *cp;
479490
480491 set_bit(EFI_BOOT, &efi.flags);
481492 set_bit(EFI_64BIT, &efi.flags);
....@@ -505,42 +516,29 @@
505516 printk(KERN_INFO "Ignoring memory above %lluMB\n",
506517 max_addr >> 20);
507518
508
- efi.systab = __va(ia64_boot_param->efi_systab);
519
+ efi_systab = __va(ia64_boot_param->efi_systab);
509520
510521 /*
511522 * Verify the EFI Table
512523 */
513
- if (efi.systab == NULL)
524
+ if (efi_systab == NULL)
514525 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))
516527 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);
522528
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);
534530
535531 palo_phys = EFI_INVALID_TABLE_ADDR;
536532
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)
538536 return;
539537
540538 if (palo_phys != EFI_INVALID_TABLE_ADDR)
541539 handle_palo(palo_phys);
542540
543
- runtime = __va(efi.systab->runtime);
541
+ runtime = __va(efi_systab->runtime);
544542 efi.get_time = phys_get_time;
545543 efi.set_time = phys_set_time;
546544 efi.get_wakeup_time = phys_get_wakeup_time;
....@@ -560,6 +558,7 @@
560558 {
561559 efi_memory_desc_t *md;
562560 void *p;
561
+ unsigned int i;
563562
564563 for (i = 0, p = efi_map_start; p < efi_map_end;
565564 ++i, p += efi_desc_size)
....@@ -586,7 +585,7 @@
586585 }
587586
588587 printk("mem%02d: %s "
589
- "range=[0x%016lx-0x%016lx) (%4lu%s)\n",
588
+ "range=[0x%016llx-0x%016llx) (%4lu%s)\n",
590589 i, efi_md_typeattr_format(buf, sizeof(buf), md),
591590 md->phys_addr,
592591 md->phys_addr + efi_md_size(md), size, unit);
....@@ -842,7 +841,6 @@
842841 } while (md);
843842 return 0; /* never reached */
844843 }
845
-EXPORT_SYMBOL(kern_mem_attribute);
846844
847845 int
848846 valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size)
....@@ -853,7 +851,7 @@
853851 * /dev/mem reads and writes use copy_to_user(), which implicitly
854852 * uses a granule-sized kernel identity mapping. It's really
855853 * 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.
857855 */
858856 attr = kern_mem_attribute(phys_addr, size);
859857 if (attr & EFI_MEMORY_WB || attr & EFI_MEMORY_UC)
....@@ -1349,3 +1347,12 @@
13491347 return ret;
13501348 }
13511349 #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
+}