| 1072 | } |
| 1073 | |
| 1074 | static void |
| 1075 | add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, |
| 1076 | int *physmap_idx) |
| 1077 | { |
| 1078 | struct efi_md *map, *p; |
| 1079 | const char *type; |
| 1080 | size_t efisz; |
| 1081 | int ndesc, i; |
| 1082 | |
| 1083 | static const char *types[] = { |
| 1084 | "Reserved", |
| 1085 | "LoaderCode", |
| 1086 | "LoaderData", |
| 1087 | "BootServicesCode", |
| 1088 | "BootServicesData", |
| 1089 | "RuntimeServicesCode", |
| 1090 | "RuntimeServicesData", |
| 1091 | "ConventionalMemory", |
| 1092 | "UnusableMemory", |
| 1093 | "ACPIReclaimMemory", |
| 1094 | "ACPIMemoryNVS", |
| 1095 | "MemoryMappedIO", |
| 1096 | "MemoryMappedIOPortSpace", |
| 1097 | "PalCode", |
| 1098 | "PersistentMemory" |
| 1099 | }; |
| 1100 | |
| 1101 | /* |
| 1102 | * Memory map data provided by UEFI via the GetMemoryMap |
| 1103 | * Boot Services API. |
| 1104 | */ |
| 1105 | efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; |
| 1106 | map = (struct efi_md *)((uint8_t *)efihdr + efisz); |
| 1107 | |
| 1108 | if (efihdr->descriptor_size == 0) |
| 1109 | return; |
| 1110 | ndesc = efihdr->memory_size / efihdr->descriptor_size; |
| 1111 | |
| 1112 | if (boothowto & RB_VERBOSE) |
| 1113 | printf("%23s %12s %12s %8s %4s\n", |
| 1114 | "Type", "Physical", "Virtual", "#Pages", "Attr"); |
| 1115 | |
| 1116 | for (i = 0, p = map; i < ndesc; i++, |
| 1117 | p = efi_next_descriptor(p, efihdr->descriptor_size)) { |
| 1118 | if (boothowto & RB_VERBOSE) { |
| 1119 | if (p->md_type < nitems(types)) |
| 1120 | type = types[p->md_type]; |
| 1121 | else |
| 1122 | type = "<INVALID>"; |
| 1123 | printf("%23s %012lx %12p %08lx ", type, p->md_phys, |
| 1124 | p->md_virt, p->md_pages); |
| 1125 | if (p->md_attr & EFI_MD_ATTR_UC) |
| 1126 | printf("UC "); |
| 1127 | if (p->md_attr & EFI_MD_ATTR_WC) |
| 1128 | printf("WC "); |
| 1129 | if (p->md_attr & EFI_MD_ATTR_WT) |
| 1130 | printf("WT "); |
| 1131 | if (p->md_attr & EFI_MD_ATTR_WB) |
no test coverage detected