]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/VariableInfo/VariableInfo.c
MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats
[mirror_edk2.git] / MdeModulePkg / Application / VariableInfo / VariableInfo.c
index f213471e9abcdc9287d75a78ce868c638ef24704..c04ba182132faa44c2fdc224a177c1e085fc1d3f 100644 (file)
@@ -3,7 +3,7 @@
   this utility will print out the statistics information. You can use console\r
   redirection to capture the data.\r
 \r
   this utility will print out the statistics information. You can use console\r
   redirection to capture the data.\r
 \r
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -126,7 +126,7 @@ PrintInfoFromSmm (
   ASSERT (CommBuffer != NULL);\r
   ZeroMem (CommBuffer, RealCommSize);\r
 \r
   ASSERT (CommBuffer != NULL);\r
   ZeroMem (CommBuffer, RealCommSize);\r
 \r
-  Print (L"Non-Volatile SMM Variables:\n");\r
+  Print (L"SMM Driver Non-Volatile Variables:\n");\r
   do {\r
     CommSize = RealCommSize;\r
     Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
   do {\r
     CommSize = RealCommSize;\r
     Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
@@ -155,7 +155,7 @@ PrintInfoFromSmm (
     }\r
   } while (TRUE);\r
 \r
     }\r
   } while (TRUE);\r
 \r
-  Print (L"Volatile SMM Variables:\n");\r
+  Print (L"SMM Driver Volatile Variables:\n");\r
   ZeroMem (CommBuffer, RealCommSize);\r
   do {\r
     CommSize = RealCommSize;\r
   ZeroMem (CommBuffer, RealCommSize);\r
   do {\r
     CommSize = RealCommSize;\r
@@ -207,24 +207,18 @@ UefiMain (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
+  EFI_STATUS            RuntimeDxeStatus;\r
+  EFI_STATUS            SmmStatus;\r
   VARIABLE_INFO_ENTRY   *VariableInfo;\r
   VARIABLE_INFO_ENTRY   *Entry;\r
 \r
   VARIABLE_INFO_ENTRY   *VariableInfo;\r
   VARIABLE_INFO_ENTRY   *Entry;\r
 \r
-  Status = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **)&Entry);\r
-  if (EFI_ERROR (Status) || (Entry == NULL)) {\r
-    Status = EfiGetSystemConfigurationTable (&gEfiAuthenticatedVariableGuid, (VOID **)&Entry);\r
+  RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **) &Entry);\r
+  if (EFI_ERROR (RuntimeDxeStatus) || (Entry == NULL)) {\r
+    RuntimeDxeStatus = EfiGetSystemConfigurationTable (&gEfiAuthenticatedVariableGuid, (VOID **) &Entry);\r
   }\r
 \r
   }\r
 \r
-  if (EFI_ERROR (Status) || (Entry == NULL)) {\r
-    Status = PrintInfoFromSmm ();\r
-    if (!EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-  }\r
-\r
-  if (!EFI_ERROR (Status) && (Entry != NULL)) {\r
-    Print (L"Non-Volatile EFI Variables:\n");\r
+  if (!EFI_ERROR (RuntimeDxeStatus) && (Entry != NULL)) {\r
+    Print (L"Runtime DXE Driver Non-Volatile EFI Variables:\n");\r
     VariableInfo = Entry;\r
     do {\r
       if (!VariableInfo->Volatile) {\r
     VariableInfo = Entry;\r
     do {\r
       if (!VariableInfo->Volatile) {\r
@@ -242,7 +236,7 @@ UefiMain (
       VariableInfo = VariableInfo->Next;\r
     } while (VariableInfo != NULL);\r
 \r
       VariableInfo = VariableInfo->Next;\r
     } while (VariableInfo != NULL);\r
 \r
-    Print (L"Volatile EFI Variables:\n");\r
+    Print (L"Runtime DXE Driver Volatile EFI Variables:\n");\r
     VariableInfo = Entry;\r
     do {\r
       if (VariableInfo->Volatile) {\r
     VariableInfo = Entry;\r
     do {\r
       if (VariableInfo->Volatile) {\r
@@ -258,14 +252,19 @@ UefiMain (
       }\r
       VariableInfo = VariableInfo->Next;\r
     } while (VariableInfo != NULL);\r
       }\r
       VariableInfo = VariableInfo->Next;\r
     } while (VariableInfo != NULL);\r
+  }\r
+\r
+  SmmStatus = PrintInfoFromSmm ();\r
 \r
 \r
-  } else {\r
+  if (EFI_ERROR (RuntimeDxeStatus) && EFI_ERROR (SmmStatus)) {\r
     Print (L"Warning: Variable Dxe/Smm driver doesn't enable the feature of statistical information!\n");\r
     Print (L"If you want to see this info, please:\n");\r
     Print (L"  1. Set PcdVariableCollectStatistics as TRUE\n");\r
     Print (L"  2. Rebuild Variable Dxe/Smm driver\n");\r
     Print (L"  3. Run \"VariableInfo\" cmd again\n");\r
     Print (L"Warning: Variable Dxe/Smm driver doesn't enable the feature of statistical information!\n");\r
     Print (L"If you want to see this info, please:\n");\r
     Print (L"  1. Set PcdVariableCollectStatistics as TRUE\n");\r
     Print (L"  2. Rebuild Variable Dxe/Smm driver\n");\r
     Print (L"  3. Run \"VariableInfo\" cmd again\n");\r
+\r
+    return EFI_NOT_FOUND;\r
   }\r
 \r
   }\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
 }\r