this utility will print out the statistics information. You can use console\r
redirection to capture the data.\r
\r
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2006 - 2016, 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
which accompanies this distribution. The full text of the license may be found at\r
\r
#include <Guid/VariableFormat.h>\r
#include <Guid/SmmVariableCommon.h>\r
+#include <Guid/PiSmmCommunicationRegionTable.h>\r
#include <Protocol/SmmCommunication.h>\r
#include <Protocol/SmmVariable.h>\r
\r
UINTN CommSize;\r
SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader;\r
EFI_SMM_VARIABLE_PROTOCOL *Smmvariable;\r
+ EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable;\r
+ UINT32 Index;\r
+ EFI_MEMORY_DESCRIPTOR *Entry;\r
+ UINTN Size;\r
+ UINTN MaxSize;\r
\r
Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **) &Smmvariable);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- CommSize = SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;\r
- RealCommSize = CommSize;\r
- CommBuffer = AllocateZeroPool (CommSize);\r
+ CommBuffer = NULL;\r
+ Status = EfiGetSystemConfigurationTable (\r
+ &gEdkiiPiSmmCommunicationRegionTableGuid,\r
+ (VOID **) &PiSmmCommunicationRegionTable\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ ASSERT (PiSmmCommunicationRegionTable != NULL);\r
+ Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);\r
+ Size = 0;\r
+ MaxSize = 0;\r
+ for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {\r
+ if (Entry->Type == EfiConventionalMemory) {\r
+ Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);\r
+ if (Size > (SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE + sizeof (VARIABLE_INFO_ENTRY))) {\r
+ if (Size > MaxSize) {\r
+ MaxSize = Size;\r
+ RealCommSize = MaxSize;\r
+ CommBuffer = (EFI_SMM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart;\r
+ }\r
+ }\r
+ }\r
+ Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + PiSmmCommunicationRegionTable->DescriptorSize);\r
+ }\r
ASSERT (CommBuffer != NULL);\r
+ ZeroMem (CommBuffer, RealCommSize);\r
\r
Print (L"Non-Volatile SMM Variables:\n");\r
do {\r
+ CommSize = RealCommSize;\r
Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- FreePool (CommBuffer);\r
- CommBuffer = AllocateZeroPool (CommSize);\r
- ASSERT (CommBuffer != NULL);\r
- RealCommSize = CommSize;\r
- Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
+ Print (L"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");\r
+ return Status;\r
}\r
\r
if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) {\r
break;\r
}\r
\r
- if (CommSize < RealCommSize) {\r
- CommSize = RealCommSize;\r
- }\r
-\r
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) CommBuffer->Data;\r
VariableInfo = (VARIABLE_INFO_ENTRY *) FunctionHeader->Data;\r
\r
} while (TRUE);\r
\r
Print (L"Volatile SMM Variables:\n");\r
- ZeroMem (CommBuffer, CommSize);\r
+ ZeroMem (CommBuffer, RealCommSize);\r
do {\r
+ CommSize = RealCommSize;\r
Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
- FreePool (CommBuffer);\r
- CommBuffer = AllocateZeroPool (CommSize);\r
- ASSERT (CommBuffer != NULL);\r
- RealCommSize = CommSize;\r
- Status = GetVariableStatisticsData (CommBuffer, &CommSize);\r
+ Print (L"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");\r
+ return Status;\r
}\r
\r
if (EFI_ERROR (Status) || (CommSize <= SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE)) {\r
break;\r
}\r
\r
- if (CommSize < RealCommSize) {\r
- CommSize = RealCommSize;\r
- }\r
-\r
FunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) CommBuffer->Data;\r
VariableInfo = (VARIABLE_INFO_ENTRY *) FunctionHeader->Data;\r
\r
}\r
} while (TRUE);\r
\r
- FreePool (CommBuffer);\r
return Status;\r
}\r
\r
} while (VariableInfo != NULL);\r
\r
} else {\r
- Print (L"Warning: Variable Dxe driver doesn't enable the feature of statistical information!\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 driver\n");\r
+ Print (L" 2. Rebuild Variable Dxe/Smm driver\n");\r
Print (L" 3. Run \"VariableInfo\" cmd again\n");\r
}\r
\r
#\r
# This application can display statistical information about variable usage for SMM variable\r
# driver and non-SMM variable driver.\r
-# Note that if Variable Dxe driver doesn't enable the feature by setting PcdVariableCollectStatistics\r
+# Note that if Variable Dxe/Smm driver doesn't enable the feature by setting PcdVariableCollectStatistics\r
# as TRUE, the application will not display variable statistical information.\r
#\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2016, 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
# which accompanies this distribution. The full text of the license may be found at\r
gEfiSmmVariableProtocolGuid\r
\r
[Guids]\r
- gEfiAuthenticatedVariableGuid ## SOMETIMES_CONSUMES ## SystemTable\r
- gEfiVariableGuid ## CONSUMES ## SystemTable\r
+ gEfiAuthenticatedVariableGuid ## SOMETIMES_CONSUMES ## SystemTable\r
+ gEfiVariableGuid ## SOMETIMES_CONSUMES ## SystemTable\r
+ gEdkiiPiSmmCommunicationRegionTableGuid ## SOMETIMES_CONSUMES ## SystemTable\r
\r
[UserExtensions.TianoCore."ExtraFiles"]\r
VariableInfoExtra.uni\r
//\r
// This application can display statistical information about variable usage for SMM variable\r
// driver and non-SMM variable driver.\r
-// Note that if Variable Dxe driver doesn't enable the feature by setting PcdVariableCollectStatistics\r
+// Note that if Variable Dxe/Smm driver doesn't enable the feature by setting PcdVariableCollectStatistics\r
// as TRUE, the application will not display variable statistical information.\r
//\r
-// Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
//\r
// This program and the accompanying materials\r
// are licensed and made available under the terms and conditions of the BSD License\r
\r
#string STR_MODULE_ABSTRACT #language en-US "A shell application that displays statistical information about variable usage"\r
\r
-#string STR_MODULE_DESCRIPTION #language en-US "This application can display statistical information about variable usage for SMM variable driver and non-SMM variable driver. Note that if Variable DXE driver doesn't enable the feature by setting PcdVariableCollectStatistics as TRUE, the application will not display variable statistical information."\r
+#string STR_MODULE_DESCRIPTION #language en-US "This application can display statistical information about variable usage for SMM variable driver and non-SMM variable driver. Note that if Variable DXE/SMM driver doesn't enable the feature by setting PcdVariableCollectStatistics as TRUE, the application will not display variable statistical information."\r
\r