47 IN EFI_MEMORY_DESCRIPTOR *Desc
51 CONST CHAR8 *SizeType;
60 SizeValue = EFI_PAGES_TO_SIZE (Desc->NumberOfPages);
61 if (SizeValue >= BASE_1MB) {
62 SizeValue /= BASE_1MB;
65 SizeValue /= BASE_1KB;
71 "OCMM: %a [%a|%a|%a|%a|%a|%a|%a|%a|%a|%a|%a|%a|%a|%a] 0x%016LX-0x%016LX -> 0x%016X (%Lu %a)\n",
73 (Desc->Attribute & EFI_MEMORY_RUNTIME) != 0 ?
"RUN" :
" ",
74 (Desc->Attribute & EFI_MEMORY_CPU_CRYPTO) != 0 ?
"CRY" :
" ",
75 (Desc->Attribute & EFI_MEMORY_SP) != 0 ?
"SP" :
" ",
76 (Desc->Attribute & EFI_MEMORY_RO) != 0 ?
"RO" :
" ",
77 (Desc->Attribute & EFI_MEMORY_MORE_RELIABLE) != 0 ?
"MR" :
" ",
78 (Desc->Attribute & EFI_MEMORY_NV) != 0 ?
"NV" :
" ",
79 (Desc->Attribute & EFI_MEMORY_XP) != 0 ?
"XP" :
" ",
80 (Desc->Attribute & EFI_MEMORY_RP) != 0 ?
"RP" :
" ",
81 (Desc->Attribute & EFI_MEMORY_WP) != 0 ?
"WP" :
" ",
82 (Desc->Attribute & EFI_MEMORY_UCE) != 0 ?
"UCE" :
" ",
83 (Desc->Attribute & EFI_MEMORY_WB) != 0 ?
"WB" :
" ",
84 (Desc->Attribute & EFI_MEMORY_WT) != 0 ?
"WT" :
" ",
85 (Desc->Attribute & EFI_MEMORY_WC) != 0 ?
"WC" :
" ",
86 (Desc->Attribute & EFI_MEMORY_UC) != 0 ?
"UC" :
" ",
88 Desc->PhysicalStart + (EFI_PAGES_TO_SIZE (Desc->NumberOfPages) - 1),
102 CONST EFI_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable;
103 EFI_MEMORY_DESCRIPTOR *MemoryAttributesEntry;
106 if (MemoryAttributesTable == NULL) {
107 DEBUG ((DEBUG_INFO,
"OCMM: MemoryAttributesTable is not present!\n"));
116 RealSize = (UINTN)(
sizeof (EFI_MEMORY_ATTRIBUTES_TABLE)
117 + MemoryAttributesTable->NumberOfEntries * MemoryAttributesTable->DescriptorSize);
119 if (RealSize >
sizeof (mMemoryAttributesTable)) {
120 DEBUG ((DEBUG_INFO,
"OCMM: MemoryAttributesTable has too large size %u!\n", (UINT32)RealSize));
124 CopyMem (mMemoryAttributesTable, MemoryAttributesTable, RealSize);
126 MemoryAttributesTable = (EFI_MEMORY_ATTRIBUTES_TABLE *)mMemoryAttributesTable;
127 MemoryAttributesEntry = (EFI_MEMORY_DESCRIPTOR *)(MemoryAttributesTable + 1);
129 DEBUG ((DEBUG_INFO,
"OCMM: MemoryAttributesTable:\n"));
130 DEBUG ((DEBUG_INFO,
"OCMM: Version - 0x%08x\n", MemoryAttributesTable->Version));
131 DEBUG ((DEBUG_INFO,
"OCMM: NumberOfEntries - 0x%08x\n", MemoryAttributesTable->NumberOfEntries));
132 DEBUG ((DEBUG_INFO,
"OCMM: DescriptorSize - 0x%08x\n", MemoryAttributesTable->DescriptorSize));
134 for (Index = 0; Index < MemoryAttributesTable->NumberOfEntries; ++Index) {
136 MemoryAttributesEntry = NEXT_MEMORY_DESCRIPTOR (
137 MemoryAttributesEntry,
138 MemoryAttributesTable->DescriptorSize