VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c@ 105668

Last change on this file since 105668 was 99404, checked in by vboxsync, 20 months ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 21.1 KB
Line 
1/** @file
2 Main file for Mode shell Debug1 function.
3
4 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
5 (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
6 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9**/
10
11//
12// Need full names for Standard-Format Output
13//
14STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved";
15STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode";
16STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData";
17STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode";
18STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData";
19STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode";
20STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData";
21STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available";
22STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent";
23STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory";
24STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory";
25STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS";
26STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO";
27STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace";
28STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode";
29STATIC CONST CHAR16 NameEfiUnacceptedMemoryType[] = L"Unaccepted";
30
31//
32// Need short names for some memory types
33//
34STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code";
35STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data";
36STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code";
37STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data";
38STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable";
39STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl";
40STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS";
41STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO";
42STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port";
43
44#include "UefiShellDebug1CommandsLib.h"
45
46typedef struct {
47 UINT32 Type;
48 UINT64 NumberOfPages;
49 LIST_ENTRY Link;
50} MEMORY_LENGTH_ENTRY;
51
52/**
53 Add the length of the specified type to List.
54
55 @param List A list to hold all pairs of <Type, NumberOfPages>.
56 @param Type Memory type.
57 @param NumberOfPages Number of pages.
58**/
59VOID
60AddMemoryLength (
61 LIST_ENTRY *List,
62 UINT32 Type,
63 UINT64 NumberOfPages
64 )
65{
66 MEMORY_LENGTH_ENTRY *Entry;
67 MEMORY_LENGTH_ENTRY *NewEntry;
68 LIST_ENTRY *Link;
69
70 Entry = NULL;
71 for (Link = GetFirstNode (List); !IsNull (List, Link); Link = GetNextNode (List, Link)) {
72 Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
73 if (Entry->Type >= Type) {
74 break;
75 }
76 }
77
78 if ((Entry != NULL) && (Entry->Type == Type)) {
79 //
80 // The Entry is the one we look for.
81 //
82 NewEntry = Entry;
83 } else {
84 //
85 // The search operation breaks due to:
86 // 1. Type of every entry < Type --> Insert to tail
87 // 2. Type of an entry > Type --> Insert to previous of this entry
88 //
89 NewEntry = AllocatePool (sizeof (*NewEntry));
90 if (NewEntry == NULL) {
91 return;
92 }
93
94 NewEntry->Type = Type;
95 NewEntry->NumberOfPages = 0;
96 InsertTailList (Link, &NewEntry->Link);
97 }
98
99 NewEntry->NumberOfPages += NumberOfPages;
100}
101
102/**
103 Function for 'memmap' command.
104
105 @param[in] ImageHandle Handle to the Image (NULL if Internal).
106 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
107**/
108SHELL_STATUS
109EFIAPI
110ShellCommandRunMemMap (
111 IN EFI_HANDLE ImageHandle,
112 IN EFI_SYSTEM_TABLE *SystemTable
113 )
114{
115 EFI_STATUS Status;
116 LIST_ENTRY *Package;
117 CHAR16 *ProblemParam;
118 SHELL_STATUS ShellStatus;
119 UINTN Size;
120 EFI_MEMORY_DESCRIPTOR *Descriptors;
121 UINTN MapKey;
122 UINTN ItemSize;
123 UINT32 Version;
124 EFI_MEMORY_DESCRIPTOR *Walker;
125 UINT64 ReservedPages;
126 UINT64 LoadCodePages;
127 UINT64 LoadDataPages;
128 UINT64 BSCodePages;
129 UINT64 BSDataPages;
130 UINT64 RTDataPages;
131 UINT64 RTCodePages;
132 UINT64 AvailPages;
133 UINT64 TotalPages;
134 UINT64 ReservedPagesSize;
135 UINT64 LoadCodePagesSize;
136 UINT64 LoadDataPagesSize;
137 UINT64 BSCodePagesSize;
138 UINT64 BSDataPagesSize;
139 UINT64 RTDataPagesSize;
140 UINT64 RTCodePagesSize;
141 UINT64 AvailPagesSize;
142 UINT64 TotalPagesSize;
143 UINT64 AcpiReclaimPages;
144 UINT64 AcpiNvsPages;
145 UINT64 MmioSpacePages;
146 UINT64 AcpiReclaimPagesSize;
147 UINT64 AcpiNvsPagesSize;
148 UINT64 MmioSpacePagesSize;
149 UINT64 MmioPortPages;
150 UINT64 MmioPortPagesSize;
151 UINT64 UnusableMemoryPages;
152 UINT64 UnusableMemoryPagesSize;
153 UINT64 PalCodePages;
154 UINT64 PalCodePagesSize;
155 UINT64 UnacceptedPages;
156 UINT64 UnacceptedPagesSize;
157 UINT64 PersistentPages;
158 UINT64 PersistentPagesSize;
159 BOOLEAN Sfo;
160 LIST_ENTRY MemoryList;
161 MEMORY_LENGTH_ENTRY *Entry;
162 LIST_ENTRY *Link;
163
164 AcpiReclaimPages = 0;
165 AcpiNvsPages = 0;
166 MmioSpacePages = 0;
167 TotalPages = 0;
168 ReservedPages = 0;
169 LoadCodePages = 0;
170 LoadDataPages = 0;
171 BSCodePages = 0;
172 BSDataPages = 0;
173 RTDataPages = 0;
174 RTCodePages = 0;
175 AvailPages = 0;
176 MmioPortPages = 0;
177 UnusableMemoryPages = 0;
178 PalCodePages = 0;
179 PersistentPages = 0;
180 Size = 0;
181 UnacceptedPages = 0;
182 Descriptors = NULL;
183 ShellStatus = SHELL_SUCCESS;
184 Status = EFI_SUCCESS;
185 InitializeListHead (&MemoryList);
186
187 //
188 // initialize the shell lib (we must be in non-auto-init...)
189 //
190 Status = ShellInitialize ();
191 ASSERT_EFI_ERROR (Status);
192
193 Status = CommandInit ();
194 ASSERT_EFI_ERROR (Status);
195
196 //
197 // parse the command line
198 //
199 Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
200 if (EFI_ERROR (Status)) {
201 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
202 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam);
203 FreePool (ProblemParam);
204 ShellStatus = SHELL_INVALID_PARAMETER;
205 } else {
206 ASSERT (FALSE);
207 }
208 } else {
209 if (ShellCommandLineGetCount (Package) > 1) {
210 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap");
211 ShellStatus = SHELL_INVALID_PARAMETER;
212 } else {
213 Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
214 if (Status == EFI_BUFFER_TOO_SMALL) {
215 Size += SIZE_1KB;
216 Descriptors = AllocateZeroPool (Size);
217 Status = gBS->GetMemoryMap (&Size, Descriptors, &MapKey, &ItemSize, &Version);
218 }
219
220 if (EFI_ERROR (Status)) {
221 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
222 ShellStatus = SHELL_ACCESS_DENIED;
223 } else {
224 ASSERT (Version == EFI_MEMORY_DESCRIPTOR_VERSION);
225
226 Sfo = ShellCommandLineGetFlag (Package, L"-sfo");
227 if (!Sfo) {
228 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle);
229 } else {
230 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"memmap");
231 }
232
233 for ( Walker = Descriptors
234 ; (Walker < (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Descriptors + Size)) && (Walker != NULL)
235 ; Walker = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Walker + ItemSize)
236 )
237 {
238 switch (Walker->Type) {
239 case EfiReservedMemoryType:
240 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);
241 ReservedPages += Walker->NumberOfPages;
242 break;
243 case EfiLoaderCode:
244 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);
245 LoadCodePages += Walker->NumberOfPages;
246 TotalPages += Walker->NumberOfPages;
247 break;
248 case EfiLoaderData:
249 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);
250 LoadDataPages += Walker->NumberOfPages;
251 TotalPages += Walker->NumberOfPages;
252 break;
253 case EfiBootServicesCode:
254 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);
255 BSCodePages += Walker->NumberOfPages;
256 TotalPages += Walker->NumberOfPages;
257 break;
258 case EfiBootServicesData:
259 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);
260 BSDataPages += Walker->NumberOfPages;
261 TotalPages += Walker->NumberOfPages;
262 break;
263 case EfiRuntimeServicesCode:
264 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);
265 RTCodePages += Walker->NumberOfPages;
266 TotalPages += Walker->NumberOfPages;
267 break;
268 case EfiRuntimeServicesData:
269 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);
270 RTDataPages += Walker->NumberOfPages;
271 TotalPages += Walker->NumberOfPages;
272 break;
273 case EfiConventionalMemory:
274 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);
275 AvailPages += Walker->NumberOfPages;
276 TotalPages += Walker->NumberOfPages;
277 break;
278 case EfiPersistentMemory:
279 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);
280 PersistentPages += Walker->NumberOfPages;
281 TotalPages += Walker->NumberOfPages;
282 break;
283 case EfiUnusableMemory:
284 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);
285 UnusableMemoryPages += Walker->NumberOfPages;
286 break;
287 case EfiACPIReclaimMemory:
288 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);
289 TotalPages += Walker->NumberOfPages;
290 AcpiReclaimPages += Walker->NumberOfPages;
291 break;
292 case EfiACPIMemoryNVS:
293 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);
294 TotalPages += Walker->NumberOfPages;
295 AcpiNvsPages += Walker->NumberOfPages;
296 break;
297 case EfiMemoryMappedIO:
298 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);
299 MmioSpacePages += Walker->NumberOfPages;
300 break;
301 case EfiMemoryMappedIOPortSpace:
302 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);
303 MmioPortPages += Walker->NumberOfPages;
304 break;
305 case EfiPalCode:
306 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);
307 TotalPages += Walker->NumberOfPages;
308 PalCodePages += Walker->NumberOfPages;
309 break;
310 case EfiUnacceptedMemoryType:
311 ShellPrintHiiEx (-1, -1, NULL, (EFI_STRING_ID)(!Sfo ? STRING_TOKEN (STR_MEMMAP_LIST_ITEM) : STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiUnacceptedMemoryType, Walker->PhysicalStart, Walker->PhysicalStart+MultU64x64 (SIZE_4KB, Walker->NumberOfPages)-1, Walker->NumberOfPages, Walker->Attribute);
312 TotalPages += Walker->NumberOfPages;
313 UnacceptedPages += Walker->NumberOfPages;
314 break;
315 default:
316 //
317 // Shell Spec defines the SFO format.
318 // Do not print the OEM/OS memory usage in the SFO format, to avoid conflict with Shell Spec.
319 //
320 if (!Sfo) {
321 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_ITEM_OTHER), gShellDebug1HiiHandle, Walker->Type, Walker->PhysicalStart, Walker->PhysicalStart + MultU64x64 (SIZE_4KB, Walker->NumberOfPages) - 1, Walker->NumberOfPages, Walker->Attribute);
322 }
323
324 TotalPages += Walker->NumberOfPages;
325 AddMemoryLength (&MemoryList, Walker->Type, Walker->NumberOfPages);
326 break;
327 }
328 }
329
330 //
331 // print the summary
332 //
333 ReservedPagesSize = MultU64x64 (SIZE_4KB, ReservedPages);
334 LoadCodePagesSize = MultU64x64 (SIZE_4KB, LoadCodePages);
335 LoadDataPagesSize = MultU64x64 (SIZE_4KB, LoadDataPages);
336 BSCodePagesSize = MultU64x64 (SIZE_4KB, BSCodePages);
337 BSDataPagesSize = MultU64x64 (SIZE_4KB, BSDataPages);
338 RTDataPagesSize = MultU64x64 (SIZE_4KB, RTDataPages);
339 RTCodePagesSize = MultU64x64 (SIZE_4KB, RTCodePages);
340 AvailPagesSize = MultU64x64 (SIZE_4KB, AvailPages);
341 TotalPagesSize = MultU64x64 (SIZE_4KB, TotalPages);
342 AcpiReclaimPagesSize = MultU64x64 (SIZE_4KB, AcpiReclaimPages);
343 AcpiNvsPagesSize = MultU64x64 (SIZE_4KB, AcpiNvsPages);
344 MmioSpacePagesSize = MultU64x64 (SIZE_4KB, MmioSpacePages);
345 MmioPortPagesSize = MultU64x64 (SIZE_4KB, MmioPortPages);
346 PalCodePagesSize = MultU64x64 (SIZE_4KB, PalCodePages);
347 UnacceptedPagesSize = MultU64x64 (SIZE_4KB, UnacceptedPages);
348 PersistentPagesSize = MultU64x64 (SIZE_4KB, PersistentPages);
349 UnusableMemoryPagesSize = MultU64x64 (SIZE_4KB, UnusableMemoryPages);
350 if (!Sfo) {
351 ShellPrintHiiEx (
352 -1,
353 -1,
354 NULL,
355 STRING_TOKEN (STR_MEMMAP_LIST_SUMM),
356 gShellDebug1HiiHandle,
357 ReservedPages,
358 ReservedPagesSize,
359 LoadCodePages,
360 LoadCodePagesSize,
361 LoadDataPages,
362 LoadDataPagesSize,
363 BSCodePages,
364 BSCodePagesSize,
365 BSDataPages,
366 BSDataPagesSize,
367 RTCodePages,
368 RTCodePagesSize,
369 RTDataPages,
370 RTDataPagesSize,
371 AcpiReclaimPages,
372 AcpiReclaimPagesSize,
373 AcpiNvsPages,
374 AcpiNvsPagesSize,
375 MmioSpacePages,
376 MmioSpacePagesSize,
377 MmioPortPages,
378 MmioPortPagesSize,
379 PalCodePages,
380 PalCodePagesSize,
381 UnacceptedPages,
382 UnacceptedPagesSize,
383 AvailPages,
384 AvailPagesSize,
385 PersistentPages,
386 PersistentPagesSize
387 );
388
389 //
390 // Print out the total memory usage for OEM/OS types in the order of type.
391 //
392 for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); Link = GetNextNode (&MemoryList, Link)) {
393 Entry = BASE_CR (Link, MEMORY_LENGTH_ENTRY, Link);
394 ShellPrintHiiEx (
395 -1,
396 -1,
397 NULL,
398 STRING_TOKEN (STR_MEMMAP_LIST_SUMM_OTHER),
399 gShellDebug1HiiHandle,
400 Entry->Type,
401 Entry->NumberOfPages,
402 MultU64x64 (SIZE_4KB, Entry->NumberOfPages)
403 );
404 }
405
406 ShellPrintHiiEx (
407 -1,
408 -1,
409 NULL,
410 STRING_TOKEN (STR_MEMMAP_LIST_SUMM2),
411 gShellDebug1HiiHandle,
412 DivU64x32 (MultU64x64 (SIZE_4KB, TotalPages), SIZE_1MB),
413 TotalPagesSize
414 );
415 } else {
416 ShellPrintHiiEx (
417 -1,
418 -1,
419 NULL,
420 STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO),
421 gShellDebug1HiiHandle,
422 TotalPagesSize,
423 ReservedPagesSize,
424 BSCodePagesSize,
425 BSDataPagesSize,
426 RTCodePagesSize,
427 RTDataPagesSize,
428 LoadCodePagesSize,
429 LoadDataPagesSize,
430 AvailPagesSize,
431 MmioSpacePagesSize,
432 MmioPortPagesSize,
433 UnusableMemoryPagesSize,
434 AcpiReclaimPagesSize,
435 AcpiNvsPagesSize,
436 PalCodePagesSize,
437 UnacceptedPagesSize,
438 PersistentPagesSize
439 );
440 }
441 }
442 }
443
444 ShellCommandLineFreeVarList (Package);
445 }
446
447 if (Descriptors != NULL) {
448 FreePool (Descriptors);
449 }
450
451 //
452 // Free the memory list.
453 //
454 for (Link = GetFirstNode (&MemoryList); !IsNull (&MemoryList, Link); ) {
455 Link = RemoveEntryList (Link);
456 }
457
458 return (ShellStatus);
459}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette