2010-11-16 23:36:37 +01:00
|
|
|
/** @file
|
|
|
|
Main file for Mode shell Debug1 function.
|
|
|
|
|
2015-02-04 23:25:01 +01:00
|
|
|
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
|
2015-04-29 10:11:45 +02:00
|
|
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
2013-05-22 04:19:16 +02:00
|
|
|
This program and the accompanying materials
|
2010-11-16 23:36:37 +01:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which acModeanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
2014-08-21 22:26:32 +02:00
|
|
|
//
|
|
|
|
// Need full names for Standard-Format Output
|
|
|
|
//
|
2011-03-25 22:22:20 +01:00
|
|
|
STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved";
|
|
|
|
STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode";
|
|
|
|
STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData";
|
2014-08-21 22:26:32 +02:00
|
|
|
STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode";
|
|
|
|
STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData";
|
|
|
|
STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode";
|
|
|
|
STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData";
|
2011-03-25 22:22:20 +01:00
|
|
|
STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available";
|
2015-04-29 03:37:32 +02:00
|
|
|
STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent";
|
2014-08-21 22:26:32 +02:00
|
|
|
STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory";
|
|
|
|
STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory";
|
|
|
|
STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS";
|
|
|
|
STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO";
|
|
|
|
STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace";
|
2011-03-25 22:22:20 +01:00
|
|
|
STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode";
|
2010-11-16 23:36:37 +01:00
|
|
|
|
2014-08-21 22:26:32 +02:00
|
|
|
//
|
|
|
|
// Need short names for some memory types
|
|
|
|
//
|
|
|
|
STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code";
|
|
|
|
STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data";
|
|
|
|
STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code";
|
|
|
|
STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data";
|
|
|
|
STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable";
|
|
|
|
STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl";
|
|
|
|
STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS";
|
|
|
|
STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO";
|
|
|
|
STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port";
|
|
|
|
|
2010-11-16 23:36:37 +01:00
|
|
|
#include "UefiShellDebug1CommandsLib.h"
|
|
|
|
|
2011-03-25 22:22:20 +01:00
|
|
|
/**
|
|
|
|
Function for 'memmap' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
2010-11-16 23:36:37 +01:00
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunMemMap (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_STATUS Status;
|
|
|
|
LIST_ENTRY *Package;
|
|
|
|
CHAR16 *ProblemParam;
|
|
|
|
SHELL_STATUS ShellStatus;
|
|
|
|
UINTN Size;
|
|
|
|
EFI_MEMORY_DESCRIPTOR *Buffer;
|
|
|
|
UINTN MapKey;
|
|
|
|
UINTN ItemSize;
|
|
|
|
UINT32 Version;
|
|
|
|
UINT8 *Walker;
|
|
|
|
UINT64 ReservedPages;
|
|
|
|
UINT64 LoadCodePages;
|
|
|
|
UINT64 LoadDataPages;
|
|
|
|
UINT64 BSCodePages;
|
|
|
|
UINT64 BSDataPages;
|
|
|
|
UINT64 RTDataPages;
|
|
|
|
UINT64 RTCodePages;
|
|
|
|
UINT64 AvailPages;
|
|
|
|
UINT64 TotalPages;
|
|
|
|
UINT64 ReservedPagesSize;
|
|
|
|
UINT64 LoadCodePagesSize;
|
|
|
|
UINT64 LoadDataPagesSize;
|
|
|
|
UINT64 BSCodePagesSize;
|
|
|
|
UINT64 BSDataPagesSize;
|
|
|
|
UINT64 RTDataPagesSize;
|
|
|
|
UINT64 RTCodePagesSize;
|
|
|
|
UINT64 AvailPagesSize;
|
|
|
|
UINT64 TotalPagesSize;
|
2011-03-25 22:22:20 +01:00
|
|
|
UINT64 AcpiReclaimPages;
|
|
|
|
UINT64 AcpiNvsPages;
|
|
|
|
UINT64 MmioSpacePages;
|
|
|
|
UINT64 AcpiReclaimPagesSize;
|
|
|
|
UINT64 AcpiNvsPagesSize;
|
|
|
|
UINT64 MmioSpacePagesSize;
|
2014-08-05 22:57:08 +02:00
|
|
|
UINT64 MmioPortPages;
|
|
|
|
UINT64 MmioPortPagesSize;
|
|
|
|
UINT64 UnusableMemoryPages;
|
|
|
|
UINT64 UnusableMemoryPagesSize;
|
|
|
|
UINT64 PalCodePages;
|
|
|
|
UINT64 PalCodePagesSize;
|
2010-11-16 23:36:37 +01:00
|
|
|
BOOLEAN Sfo;
|
|
|
|
|
2011-03-25 22:22:20 +01:00
|
|
|
AcpiReclaimPages = 0;
|
|
|
|
AcpiNvsPages = 0;
|
|
|
|
MmioSpacePages = 0;
|
2010-11-16 23:36:37 +01:00
|
|
|
TotalPages = 0;
|
|
|
|
ReservedPages = 0;
|
|
|
|
LoadCodePages = 0;
|
|
|
|
LoadDataPages = 0;
|
|
|
|
BSCodePages = 0;
|
|
|
|
BSDataPages = 0;
|
|
|
|
RTDataPages = 0;
|
|
|
|
RTCodePages = 0;
|
|
|
|
AvailPages = 0;
|
2014-08-05 22:57:08 +02:00
|
|
|
MmioPortPages = 0;
|
|
|
|
UnusableMemoryPages = 0;
|
|
|
|
PalCodePages = 0;
|
2010-11-16 23:36:37 +01:00
|
|
|
Size = 0;
|
|
|
|
Buffer = NULL;
|
|
|
|
ShellStatus = SHELL_SUCCESS;
|
|
|
|
Status = EFI_SUCCESS;
|
|
|
|
|
|
|
|
//
|
|
|
|
// initialize the shell lib (we must be in non-auto-init...)
|
|
|
|
//
|
|
|
|
Status = ShellInitialize();
|
|
|
|
ASSERT_EFI_ERROR(Status);
|
|
|
|
|
|
|
|
Status = CommandInit();
|
|
|
|
ASSERT_EFI_ERROR(Status);
|
|
|
|
|
|
|
|
//
|
|
|
|
// parse the command line
|
|
|
|
//
|
|
|
|
Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);
|
|
|
|
if (EFI_ERROR(Status)) {
|
|
|
|
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
2015-02-03 22:22:53 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam);
|
2010-11-16 23:36:37 +01:00
|
|
|
FreePool(ProblemParam);
|
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ShellCommandLineGetCount(Package) > 1) {
|
2015-02-03 22:22:53 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap");
|
2010-11-16 23:36:37 +01:00
|
|
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
|
|
|
} else {
|
|
|
|
Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);
|
|
|
|
if (Status == EFI_BUFFER_TOO_SMALL){
|
|
|
|
Size += SIZE_1KB;
|
2011-03-25 22:22:20 +01:00
|
|
|
Buffer = AllocateZeroPool(Size);
|
2010-11-16 23:36:37 +01:00
|
|
|
Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);
|
|
|
|
}
|
|
|
|
if (EFI_ERROR(Status)) {
|
2015-02-03 22:22:53 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");
|
2010-11-16 23:36:37 +01:00
|
|
|
ShellStatus = SHELL_ACCESS_DENIED;
|
|
|
|
} else {
|
|
|
|
ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION);
|
2014-08-21 22:26:32 +02:00
|
|
|
|
2010-11-16 23:36:37 +01:00
|
|
|
Sfo = ShellCommandLineGetFlag(Package, L"-sfo");
|
2014-08-21 22:26:32 +02:00
|
|
|
if (!Sfo) {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle);
|
|
|
|
} else {
|
|
|
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"memmap");
|
|
|
|
}
|
|
|
|
|
2010-11-16 23:36:37 +01:00
|
|
|
for (Walker = (UINT8*)Buffer; Walker < (((UINT8*)Buffer)+Size) && Walker != NULL; Walker += ItemSize){
|
|
|
|
switch (((EFI_MEMORY_DESCRIPTOR*)Walker)->Type) {
|
|
|
|
case EfiReservedMemoryType:
|
2011-03-25 22:22:20 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
ReservedPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiLoaderCode:
|
2011-03-25 22:22:20 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
LoadCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiLoaderData:
|
2011-03-25 22:22:20 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiLoaderData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
LoadDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiBootServicesCode:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
BSCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiBootServicesData:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
BSDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiRuntimeServicesCode:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
RTCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiRuntimeServicesData:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
RTDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiConventionalMemory:
|
2011-03-25 22:22:20 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiConventionalMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2015-04-29 03:37:32 +02:00
|
|
|
AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiPersistentMemory:
|
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
|
|
|
break;
|
|
|
|
case EfiUnusableMemory:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2014-08-05 22:57:08 +02:00
|
|
|
UnusableMemoryPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
case EfiACPIReclaimMemory:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2011-03-25 22:22:20 +01:00
|
|
|
AcpiReclaimPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
case EfiACPIMemoryNVS:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2011-03-25 22:22:20 +01:00
|
|
|
AcpiNvsPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
case EfiMemoryMappedIO:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2011-03-25 22:22:20 +01:00
|
|
|
MmioSpacePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
case EfiMemoryMappedIOPortSpace:
|
2014-08-21 22:26:32 +02:00
|
|
|
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, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2014-08-05 22:57:08 +02:00
|
|
|
MmioPortPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
case EfiPalCode:
|
2011-03-25 22:22:20 +01:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);
|
2010-11-16 23:36:37 +01:00
|
|
|
TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2014-08-05 22:57:08 +02:00
|
|
|
PalCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;
|
2010-11-16 23:36:37 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT(FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// print the summary
|
|
|
|
//
|
2014-08-21 22:26:32 +02:00
|
|
|
ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages);
|
|
|
|
LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages);
|
|
|
|
LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages);
|
|
|
|
BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages);
|
|
|
|
BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages);
|
|
|
|
RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages);
|
|
|
|
RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages);
|
|
|
|
AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages);
|
|
|
|
TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages);
|
|
|
|
AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages);
|
|
|
|
AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages);
|
|
|
|
MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages);
|
|
|
|
MmioPortPagesSize = MultU64x64(SIZE_4KB,MmioPortPages);
|
|
|
|
PalCodePagesSize = MultU64x64(SIZE_4KB,PalCodePages);
|
|
|
|
UnusableMemoryPagesSize = MultU64x64(SIZE_4KB,UnusableMemoryPages);
|
2010-11-16 23:36:37 +01:00
|
|
|
if (!Sfo) {
|
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle,
|
|
|
|
ReservedPages, ReservedPagesSize,
|
|
|
|
LoadCodePages, LoadCodePagesSize,
|
|
|
|
LoadDataPages, LoadDataPagesSize,
|
|
|
|
BSCodePages, BSCodePagesSize,
|
|
|
|
BSDataPages, BSDataPagesSize,
|
2011-03-25 22:22:20 +01:00
|
|
|
RTCodePages, RTCodePagesSize,
|
2010-11-16 23:36:37 +01:00
|
|
|
RTDataPages, RTDataPagesSize,
|
2011-03-25 22:22:20 +01:00
|
|
|
AcpiReclaimPages, AcpiReclaimPagesSize,
|
|
|
|
AcpiNvsPages, AcpiNvsPagesSize,
|
|
|
|
MmioSpacePages, MmioSpacePagesSize,
|
2014-08-21 22:26:32 +02:00
|
|
|
MmioPortPages, MmioPortPagesSize,
|
|
|
|
PalCodePages, PalCodePagesSize,
|
2010-11-16 23:36:37 +01:00
|
|
|
AvailPages, AvailPagesSize,
|
|
|
|
DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize
|
|
|
|
);
|
|
|
|
} else {
|
2014-08-21 22:26:32 +02:00
|
|
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle,
|
2010-11-16 23:36:37 +01:00
|
|
|
TotalPagesSize,
|
2014-08-21 22:26:32 +02:00
|
|
|
ReservedPagesSize,
|
2010-11-16 23:36:37 +01:00
|
|
|
BSCodePagesSize,
|
|
|
|
BSDataPagesSize,
|
|
|
|
RTCodePagesSize,
|
|
|
|
RTDataPagesSize,
|
|
|
|
LoadCodePagesSize,
|
|
|
|
LoadDataPagesSize,
|
2014-08-05 22:57:08 +02:00
|
|
|
AvailPagesSize,
|
|
|
|
MmioSpacePagesSize,
|
|
|
|
MmioPortPagesSize,
|
|
|
|
UnusableMemoryPagesSize,
|
|
|
|
AcpiReclaimPagesSize,
|
|
|
|
AcpiNvsPagesSize,
|
|
|
|
PalCodePagesSize
|
2010-11-16 23:36:37 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ShellCommandLineFreeVarList (Package);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Buffer != NULL) {
|
|
|
|
FreePool(Buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ShellStatus);
|
|
|
|
}
|
|
|
|
|