aboutsummaryrefslogtreecommitdiff
path: root/sys/arm64
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2018-05-31 12:37:34 +0000
committerAndrew Turner <andrew@FreeBSD.org>2018-05-31 12:37:34 +0000
commitc891735cf71a6e998006679afaea679ff3ddc1ce (patch)
tree6b8955b9e49d468540c7833f173d562debb64a17 /sys/arm64
parent69d6653ba4d2f5b26c3a9dee9978d34f1a86aad4 (diff)
downloadsrc-c891735cf71a6e998006679afaea679ff3ddc1ce.tar.gz
src-c891735cf71a6e998006679afaea679ff3ddc1ce.zip
Move the code to print the EFI memory table to a new function and call it
in teh bootverbose path after cninit(). This allows users to see these tables when booting with boot -v. Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/head/; revision=334424
Diffstat (limited to 'sys/arm64')
-rw-r--r--sys/arm64/arm64/machdep.c125
1 files changed, 67 insertions, 58 deletions
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index b42ba2d36f16..f1ba40cfa9ae 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -726,28 +726,9 @@ static void
foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb)
{
struct efi_md *map, *p;
- const char *type;
size_t efisz;
int ndesc, i;
- static const char *types[] = {
- "Reserved",
- "LoaderCode",
- "LoaderData",
- "BootServicesCode",
- "BootServicesData",
- "RuntimeServicesCode",
- "RuntimeServicesData",
- "ConventionalMemory",
- "UnusableMemory",
- "ACPIReclaimMemory",
- "ACPIMemoryNVS",
- "MemoryMappedIO",
- "MemoryMappedIOPortSpace",
- "PalCode",
- "PersistentMemory"
- };
-
/*
* Memory map data provided by UEFI via the GetMemoryMap
* Boot Services API.
@@ -759,46 +740,8 @@ foreach_efi_map_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb)
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, 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 %012lx %12p %08lx ", 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");
- }
-
cb(p);
}
}
@@ -862,6 +805,70 @@ add_efi_map_entries(struct efi_map_header *efihdr)
foreach_efi_map_entry(efihdr, add_efi_map_entry);
}
+static void
+print_efi_map_entry(struct efi_md *p)
+{
+ const char *type;
+ static const char *types[] = {
+ "Reserved",
+ "LoaderCode",
+ "LoaderData",
+ "BootServicesCode",
+ "BootServicesData",
+ "RuntimeServicesCode",
+ "RuntimeServicesData",
+ "ConventionalMemory",
+ "UnusableMemory",
+ "ACPIReclaimMemory",
+ "ACPIMemoryNVS",
+ "MemoryMappedIO",
+ "MemoryMappedIOPortSpace",
+ "PalCode",
+ "PersistentMemory"
+ };
+
+ if (p->md_type < nitems(types))
+ type = types[p->md_type];
+ else
+ type = "<INVALID>";
+ printf("%23s %012lx %12p %08lx ", 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");
+}
+
+static void
+print_efi_map_entries(struct efi_map_header *efihdr)
+{
+
+ printf("%23s %12s %12s %8s %4s\n",
+ "Type", "Physical", "Virtual", "#Pages", "Attr");
+ foreach_efi_map_entry(efihdr, print_efi_map_entry);
+}
+
#ifdef FDT
static void
try_load_dtb(caddr_t kmdp)
@@ -1075,8 +1082,10 @@ initarm(struct arm64_bootparams *abp)
if (env != NULL)
strlcpy(kernelname, env, sizeof(kernelname));
- if (boothowto & RB_VERBOSE)
+ if (boothowto & RB_VERBOSE) {
+ print_efi_map_entries(efihdr);
arm_physmem_print_tables();
+ }
early_boot = 0;
}