ShellPkg/memmap: Refine code
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / MemMap.c
CommitLineData
5d73d92f 1/** @file\r
2 Main file for Mode shell Debug1 function.\r
3\r
38707d76 4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
c011b6c9 5 (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
ac25ebdc 6 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
d0cec2da 7 This program and the accompanying materials\r
5d73d92f 8 are licensed and made available under the terms and conditions of the BSD License\r
9 which acModeanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
73768087
CP
17//\r
18// Need full names for Standard-Format Output\r
19//\r
3737ac2b 20STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved";\r
21STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode";\r
22STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData";\r
73768087
CP
23STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode";\r
24STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData";\r
25STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode";\r
26STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData";\r
3737ac2b 27STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available";\r
6c4542ed 28STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent";\r
73768087
CP
29STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory";\r
30STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory";\r
31STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS";\r
32STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO";\r
33STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace";\r
3737ac2b 34STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode";\r
5d73d92f 35\r
73768087
CP
36//\r
37// Need short names for some memory types\r
38//\r
39STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code";\r
40STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data";\r
41STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code";\r
42STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data";\r
43STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable";\r
44STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl";\r
45STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS";\r
46STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO";\r
47STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port";\r
48\r
5d73d92f 49#include "UefiShellDebug1CommandsLib.h"\r
50\r
3737ac2b 51/**\r
52 Function for 'memmap' command.\r
53\r
54 @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
55 @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
56**/\r
5d73d92f 57SHELL_STATUS\r
58EFIAPI\r
59ShellCommandRunMemMap (\r
60 IN EFI_HANDLE ImageHandle,\r
61 IN EFI_SYSTEM_TABLE *SystemTable\r
62 )\r
63{\r
64 EFI_STATUS Status;\r
65 LIST_ENTRY *Package;\r
66 CHAR16 *ProblemParam;\r
67 SHELL_STATUS ShellStatus;\r
68 UINTN Size;\r
ac25ebdc 69 EFI_MEMORY_DESCRIPTOR *Descriptors;\r
5d73d92f 70 UINTN MapKey;\r
71 UINTN ItemSize;\r
72 UINT32 Version;\r
ac25ebdc 73 EFI_MEMORY_DESCRIPTOR *Walker;\r
5d73d92f 74 UINT64 ReservedPages;\r
75 UINT64 LoadCodePages;\r
76 UINT64 LoadDataPages;\r
77 UINT64 BSCodePages;\r
78 UINT64 BSDataPages;\r
79 UINT64 RTDataPages;\r
80 UINT64 RTCodePages;\r
81 UINT64 AvailPages;\r
82 UINT64 TotalPages;\r
83 UINT64 ReservedPagesSize;\r
84 UINT64 LoadCodePagesSize;\r
85 UINT64 LoadDataPagesSize;\r
86 UINT64 BSCodePagesSize;\r
87 UINT64 BSDataPagesSize;\r
88 UINT64 RTDataPagesSize;\r
89 UINT64 RTCodePagesSize;\r
90 UINT64 AvailPagesSize;\r
91 UINT64 TotalPagesSize;\r
3737ac2b 92 UINT64 AcpiReclaimPages;\r
93 UINT64 AcpiNvsPages;\r
94 UINT64 MmioSpacePages;\r
95 UINT64 AcpiReclaimPagesSize;\r
96 UINT64 AcpiNvsPagesSize;\r
97 UINT64 MmioSpacePagesSize;\r
c12383d5
JC
98 UINT64 MmioPortPages;\r
99 UINT64 MmioPortPagesSize;\r
100 UINT64 UnusableMemoryPages;\r
101 UINT64 UnusableMemoryPagesSize;\r
102 UINT64 PalCodePages;\r
103 UINT64 PalCodePagesSize;\r
38707d76
TS
104 UINT64 PersistentPages;\r
105 UINT64 PersistentPagesSize;\r
5d73d92f 106 BOOLEAN Sfo;\r
107\r
3737ac2b 108 AcpiReclaimPages = 0;\r
109 AcpiNvsPages = 0;\r
110 MmioSpacePages = 0;\r
5d73d92f 111 TotalPages = 0;\r
112 ReservedPages = 0;\r
113 LoadCodePages = 0;\r
114 LoadDataPages = 0;\r
115 BSCodePages = 0;\r
116 BSDataPages = 0;\r
117 RTDataPages = 0;\r
118 RTCodePages = 0;\r
119 AvailPages = 0;\r
c12383d5
JC
120 MmioPortPages = 0;\r
121 UnusableMemoryPages = 0;\r
122 PalCodePages = 0;\r
38707d76 123 PersistentPages = 0;\r
5d73d92f 124 Size = 0;\r
ac25ebdc 125 Descriptors = NULL;\r
5d73d92f 126 ShellStatus = SHELL_SUCCESS;\r
127 Status = EFI_SUCCESS;\r
128\r
129 //\r
130 // initialize the shell lib (we must be in non-auto-init...)\r
131 //\r
132 Status = ShellInitialize();\r
133 ASSERT_EFI_ERROR(Status);\r
134\r
135 Status = CommandInit();\r
136 ASSERT_EFI_ERROR(Status);\r
137\r
138 //\r
139 // parse the command line\r
140 //\r
141 Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);\r
142 if (EFI_ERROR(Status)) {\r
143 if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
4092a8f6 144 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam); \r
5d73d92f 145 FreePool(ProblemParam);\r
146 ShellStatus = SHELL_INVALID_PARAMETER;\r
147 } else {\r
148 ASSERT(FALSE);\r
149 }\r
150 } else {\r
151 if (ShellCommandLineGetCount(Package) > 1) {\r
4092a8f6 152 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap"); \r
5d73d92f 153 ShellStatus = SHELL_INVALID_PARAMETER;\r
154 } else {\r
ac25ebdc 155 Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version);\r
5d73d92f 156 if (Status == EFI_BUFFER_TOO_SMALL){\r
157 Size += SIZE_1KB;\r
ac25ebdc
RN
158 Descriptors = AllocateZeroPool(Size);\r
159 Status = gBS->GetMemoryMap(&Size, Descriptors, &MapKey, &ItemSize, &Version);\r
5d73d92f 160 }\r
161 if (EFI_ERROR(Status)) {\r
4092a8f6 162 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap"); \r
5d73d92f 163 ShellStatus = SHELL_ACCESS_DENIED;\r
164 } else {\r
165 ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION);\r
73768087 166\r
5d73d92f 167 Sfo = ShellCommandLineGetFlag(Package, L"-sfo");\r
73768087
CP
168 if (!Sfo) {\r
169 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle);\r
170 } else {\r
171 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"memmap");\r
172 }\r
173\r
ac25ebdc
RN
174 for ( Walker = Descriptors\r
175 ; (Walker < (EFI_MEMORY_DESCRIPTOR *) ((UINT8*)Descriptors + Size)) && (Walker != NULL)\r
176 ; Walker = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *)Walker + ItemSize)\r
177 ){\r
178 switch (Walker->Type) {\r
5d73d92f 179 case EfiReservedMemoryType:\r
ac25ebdc
RN
180 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
181 ReservedPages += Walker->NumberOfPages;\r
5d73d92f 182 break;\r
183 case EfiLoaderCode:\r
ac25ebdc
RN
184 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
185 LoadCodePages += Walker->NumberOfPages;\r
186 TotalPages += Walker->NumberOfPages;\r
5d73d92f 187 break;\r
188 case EfiLoaderData:\r
ac25ebdc
RN
189 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
190 LoadDataPages += Walker->NumberOfPages;\r
191 TotalPages += Walker->NumberOfPages;\r
5d73d92f 192 break;\r
193 case EfiBootServicesCode:\r
ac25ebdc
RN
194 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
195 BSCodePages += Walker->NumberOfPages;\r
196 TotalPages += Walker->NumberOfPages;\r
5d73d92f 197 break;\r
198 case EfiBootServicesData:\r
ac25ebdc
RN
199 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
200 BSDataPages += Walker->NumberOfPages;\r
201 TotalPages += Walker->NumberOfPages;\r
5d73d92f 202 break;\r
203 case EfiRuntimeServicesCode:\r
ac25ebdc
RN
204 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeServicesCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
205 RTCodePages += Walker->NumberOfPages;\r
206 TotalPages += Walker->NumberOfPages;\r
5d73d92f 207 break;\r
208 case EfiRuntimeServicesData:\r
ac25ebdc
RN
209 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeServicesData, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
210 RTDataPages += Walker->NumberOfPages;\r
211 TotalPages += Walker->NumberOfPages;\r
5d73d92f 212 break;\r
213 case EfiConventionalMemory:\r
ac25ebdc
RN
214 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiConventionalMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
215 AvailPages += Walker->NumberOfPages;\r
216 TotalPages += Walker->NumberOfPages;\r
6c4542ed
LG
217 break;\r
218 case EfiPersistentMemory:\r
ac25ebdc
RN
219 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
220 PersistentPages += Walker->NumberOfPages;\r
221 TotalPages += Walker->NumberOfPages;\r
5d73d92f 222 break;\r
223 case EfiUnusableMemory:\r
ac25ebdc
RN
224 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
225 UnusableMemoryPages += Walker->NumberOfPages;\r
5d73d92f 226 break;\r
227 case EfiACPIReclaimMemory:\r
ac25ebdc
RN
228 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemory, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
229 TotalPages += Walker->NumberOfPages;\r
230 AcpiReclaimPages += Walker->NumberOfPages;\r
5d73d92f 231 break;\r
232 case EfiACPIMemoryNVS:\r
ac25ebdc
RN
233 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
234 TotalPages += Walker->NumberOfPages;\r
235 AcpiNvsPages += Walker->NumberOfPages;\r
5d73d92f 236 break;\r
237 case EfiMemoryMappedIO:\r
ac25ebdc
RN
238 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
239 MmioSpacePages += Walker->NumberOfPages;\r
5d73d92f 240 break;\r
241 case EfiMemoryMappedIOPortSpace:\r
ac25ebdc
RN
242 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMappedIOPortSpace, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
243 MmioPortPages += Walker->NumberOfPages;\r
5d73d92f 244 break;\r
245 case EfiPalCode:\r
ac25ebdc
RN
246 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64(SIZE_4KB,Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);\r
247 TotalPages += Walker->NumberOfPages;\r
248 PalCodePages += Walker->NumberOfPages;\r
5d73d92f 249 break;\r
250 default:\r
251 ASSERT(FALSE);\r
252 }\r
253 }\r
254 //\r
255 // print the summary\r
256 //\r
73768087
CP
257 ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages);\r
258 LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages);\r
259 LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages);\r
260 BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages);\r
261 BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages);\r
262 RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages);\r
263 RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages);\r
264 AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages);\r
265 TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages);\r
266 AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages);\r
267 AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages);\r
268 MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages);\r
269 MmioPortPagesSize = MultU64x64(SIZE_4KB,MmioPortPages);\r
270 PalCodePagesSize = MultU64x64(SIZE_4KB,PalCodePages);\r
38707d76 271 PersistentPagesSize = MultU64x64(SIZE_4KB,PersistentPages);\r
73768087 272 UnusableMemoryPagesSize = MultU64x64(SIZE_4KB,UnusableMemoryPages);\r
5d73d92f 273 if (!Sfo) {\r
274 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle,\r
275 ReservedPages, ReservedPagesSize,\r
276 LoadCodePages, LoadCodePagesSize,\r
277 LoadDataPages, LoadDataPagesSize,\r
278 BSCodePages, BSCodePagesSize,\r
279 BSDataPages, BSDataPagesSize,\r
3737ac2b 280 RTCodePages, RTCodePagesSize,\r
5d73d92f 281 RTDataPages, RTDataPagesSize,\r
3737ac2b 282 AcpiReclaimPages, AcpiReclaimPagesSize,\r
283 AcpiNvsPages, AcpiNvsPagesSize,\r
284 MmioSpacePages, MmioSpacePagesSize,\r
73768087
CP
285 MmioPortPages, MmioPortPagesSize,\r
286 PalCodePages, PalCodePagesSize,\r
5d73d92f 287 AvailPages, AvailPagesSize,\r
38707d76 288 PersistentPages, PersistentPagesSize,\r
5d73d92f 289 DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize\r
290 );\r
291 } else {\r
73768087 292 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle,\r
5d73d92f 293 TotalPagesSize,\r
73768087 294 ReservedPagesSize,\r
5d73d92f 295 BSCodePagesSize,\r
296 BSDataPagesSize,\r
297 RTCodePagesSize,\r
298 RTDataPagesSize,\r
299 LoadCodePagesSize,\r
300 LoadDataPagesSize,\r
c12383d5
JC
301 AvailPagesSize,\r
302 MmioSpacePagesSize,\r
303 MmioPortPagesSize,\r
304 UnusableMemoryPagesSize,\r
305 AcpiReclaimPagesSize,\r
306 AcpiNvsPagesSize,\r
38707d76
TS
307 PalCodePagesSize,\r
308 PersistentPagesSize\r
5d73d92f 309 );\r
310 }\r
311 }\r
312 }\r
313 ShellCommandLineFreeVarList (Package);\r
314 }\r
315\r
ac25ebdc
RN
316 if (Descriptors != NULL) {\r
317 FreePool(Descriptors);\r
5d73d92f 318 }\r
319\r
320 return (ShellStatus);\r
321}\r
322\r