Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142637870
D49132.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D49132.id.diff
View Options
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -56,6 +56,7 @@
#include <sys/cpu.h>
#include <sys/devmap.h>
#include <sys/efi.h>
+#include <sys/efi_map.h>
#include <sys/imgact.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
@@ -462,20 +463,22 @@
efihdr = (struct efi_map_header *)preload_search_info(preload_kmdp,
MODINFO_METADATA | MODINFOMD_EFI_MAP);
if (efihdr != NULL) {
- arm_add_efi_map_entries(efihdr, mem_regions, &mem_regions_sz);
+ efi_map_add_entries(efihdr);
+ efi_map_exclude_entries(efihdr);
} else
#endif
{
/* Grab physical memory regions information from device tree. */
if (fdt_get_mem_regions(mem_regions, &mem_regions_sz,NULL) != 0)
panic("Cannot get physical memory regions");
- }
- physmem_hardware_regions(mem_regions, mem_regions_sz);
- /* Grab reserved memory regions information from device tree. */
- if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0)
- physmem_exclude_regions(mem_regions, mem_regions_sz,
- EXFLAG_NODUMP | EXFLAG_NOALLOC);
+ physmem_hardware_regions(mem_regions, mem_regions_sz);
+
+ /* Grab reserved memory regions information from device tree. */
+ if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0)
+ physmem_exclude_regions(mem_regions, mem_regions_sz,
+ EXFLAG_NODUMP | EXFLAG_NOALLOC);
+ }
/*
* Set TEX remapping registers.
@@ -632,6 +635,14 @@
arm_kdb_init();
/* Apply possible BP hardening. */
cpuinfo_init_bp_hardening();
+
+#ifdef EFI
+ if (boothowto & RB_VERBOSE) {
+ if (efihdr != NULL)
+ efi_map_print_entries(efihdr);
+ }
+#endif
+
return ((void *)STACKALIGN(thread0.td_pcb));
}
diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c
--- a/sys/arm/arm/machdep_boot.c
+++ b/sys/arm/arm/machdep_boot.c
@@ -389,110 +389,3 @@
return (lastaddr);
}
-
-#ifdef EFI
-void
-arm_add_efi_map_entries(struct efi_map_header *efihdr, struct mem_region *mr,
- int *mrcnt)
-{
- struct efi_md *map, *p;
- const char *type;
- size_t efisz;
- int ndesc, i, j;
-
- static const char *types[] = {
- "Reserved",
- "LoaderCode",
- "LoaderData",
- "BootServicesCode",
- "BootServicesData",
- "RuntimeServicesCode",
- "RuntimeServicesData",
- "ConventionalMemory",
- "UnusableMemory",
- "ACPIReclaimMemory",
- "ACPIMemoryNVS",
- "MemoryMappedIO",
- "MemoryMappedIOPortSpace",
- "PalCode",
- "PersistentMemory"
- };
-
- *mrcnt = 0;
-
- /*
- * Memory map data provided by UEFI via the GetMemoryMap
- * Boot Services API.
- */
- efisz = roundup2(sizeof(struct efi_map_header), 0x10);
- map = (struct efi_md *)((uint8_t *)efihdr + efisz);
-
- if (efihdr->descriptor_size == 0)
- return;
- ndesc = efihdr->memory_size / efihdr->descriptor_size;
-
- if (boothowto & RB_VERBOSE)
- printf("%23s %12s %12s %8s %4s\n",
- "Type", "Physical", "Virtual", "#Pages", "Attr");
-
- for (i = 0, j = 0, p = map; i < ndesc; i++,
- p = efi_next_descriptor(p, efihdr->descriptor_size)) {
- if (boothowto & RB_VERBOSE) {
- if (p->md_type < nitems(types))
- type = types[p->md_type];
- else
- type = "<INVALID>";
- printf("%23s %012llx %012llx %08llx ", type, p->md_phys,
- p->md_virt, p->md_pages);
- if (p->md_attr & EFI_MD_ATTR_UC)
- printf("UC ");
- if (p->md_attr & EFI_MD_ATTR_WC)
- printf("WC ");
- if (p->md_attr & EFI_MD_ATTR_WT)
- printf("WT ");
- if (p->md_attr & EFI_MD_ATTR_WB)
- printf("WB ");
- if (p->md_attr & EFI_MD_ATTR_UCE)
- printf("UCE ");
- if (p->md_attr & EFI_MD_ATTR_WP)
- printf("WP ");
- if (p->md_attr & EFI_MD_ATTR_RP)
- printf("RP ");
- if (p->md_attr & EFI_MD_ATTR_XP)
- printf("XP ");
- if (p->md_attr & EFI_MD_ATTR_NV)
- printf("NV ");
- if (p->md_attr & EFI_MD_ATTR_MORE_RELIABLE)
- printf("MORE_RELIABLE ");
- if (p->md_attr & EFI_MD_ATTR_RO)
- printf("RO ");
- if (p->md_attr & EFI_MD_ATTR_RT)
- printf("RUNTIME");
- printf("\n");
- }
-
- switch (p->md_type) {
- case EFI_MD_TYPE_CODE:
- case EFI_MD_TYPE_DATA:
- case EFI_MD_TYPE_BS_CODE:
- case EFI_MD_TYPE_BS_DATA:
- case EFI_MD_TYPE_FREE:
- /*
- * We're allowed to use any entry with these types.
- */
- break;
- default:
- continue;
- }
-
- j++;
- if (j >= FDT_MEM_REGIONS)
- break;
-
- mr[j].mr_start = p->md_phys;
- mr[j].mr_size = p->md_pages * EFI_PAGE_SIZE;
- }
-
- *mrcnt = j;
-}
-#endif /* EFI */
diff --git a/sys/conf/files.arm b/sys/conf/files.arm
--- a/sys/conf/files.arm
+++ b/sys/conf/files.arm
@@ -108,6 +108,7 @@
kern/pic_if.m optional intrng
kern/subr_busdma_bufalloc.c standard
kern/subr_devmap.c standard
+kern/subr_efi_map.c optional efi
kern/subr_physmem.c standard
kern/subr_sfbuf.c standard
libkern/arm/aeabi_unwind.c standard
diff --git a/sys/kern/subr_efi_map.c b/sys/kern/subr_efi_map.c
--- a/sys/kern/subr_efi_map.c
+++ b/sys/kern/subr_efi_map.c
@@ -139,8 +139,8 @@
type = types[p->md_type];
else
type = "<INVALID>";
- printf("%23s %012lx %012lx %08lx ", type, p->md_phys,
- p->md_virt, p->md_pages);
+ printf("%23s %012jx %012jx %08jx ", type, (uintmax_t)p->md_phys,
+ (uintmax_t)p->md_virt, (uintmax_t)p->md_pages);
if (p->md_attr & EFI_MD_ATTR_UC)
printf("UC ");
if (p->md_attr & EFI_MD_ATTR_WC)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 22, 6:02 PM (14 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27858185
Default Alt Text
D49132.id.diff (5 KB)
Attached To
Mode
D49132: arm: switch to subr_efi_map.c
Attached
Detach File
Event Timeline
Log In to Comment