]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c
ShellPkg: Update Shell MemMap command to show PersistentMemory range
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / MemMap.c
index 6bc1a3ed72e2ede055f9f555ae8a1dd1ff9a055e..4e35760aa07c5d05f3ed2efdb3022be0a7719874 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for Mode shell Debug1 function.\r
 \r
-  (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P.\r
+  (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
   Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -24,6 +24,7 @@ STATIC CONST CHAR16 NameEfiBootServicesData[]        = L"BootServiceData";
 STATIC CONST CHAR16 NameEfiRuntimeServicesCode[]     = L"RuntimeCode";\r
 STATIC CONST CHAR16 NameEfiRuntimeServicesData[]     = L"RuntimeData";\r
 STATIC CONST CHAR16 NameEfiConventionalMemory[]      = L"Available";\r
+STATIC CONST CHAR16 NameEfiPersistentMemory[]        = L"Persistent";\r
 STATIC CONST CHAR16 NameEfiUnusableMemory[]          = L"UnusableMemory";\r
 STATIC CONST CHAR16 NameEfiACPIReclaimMemory[]       = L"ACPIReclaimMemory";\r
 STATIC CONST CHAR16 NameEfiACPIMemoryNVS[]           = L"ACPIMemoryNVS";\r
@@ -136,7 +137,7 @@ ShellCommandRunMemMap (
   Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"memmap", ProblemParam);  \r
       FreePool(ProblemParam);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
@@ -144,7 +145,7 @@ ShellCommandRunMemMap (
     }\r
   } else {\r
     if (ShellCommandLineGetCount(Package) > 1) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle, L"memmap");  \r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
       Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);\r
@@ -154,7 +155,7 @@ ShellCommandRunMemMap (
         Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);\r
       }\r
       if (EFI_ERROR(Status)) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, Status);\r
+        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, L"memmap");  \r
         ShellStatus = SHELL_ACCESS_DENIED;\r
       } else {\r
         ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION);\r
@@ -207,6 +208,11 @@ ShellCommandRunMemMap (
               AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
               TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
               break;\r
+            case EfiPersistentMemory:\r
+              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);\r
+              AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+              TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+              break;\r
             case EfiUnusableMemory:\r
               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);\r
               UnusableMemoryPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r