51 CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid);
55 SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS;
57 Status = mMmCommunication2->Communicate (
65 Status = SmmVariableFunctionHeader->ReturnStatus;
95 Status =
gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid,
NULL, (VOID **)&Smmvariable);
96 if (EFI_ERROR (Status)) {
100 Status =
gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid,
NULL, (VOID **)&mMmCommunication2);
101 if (EFI_ERROR (Status)) {
108 &gEdkiiPiSmmCommunicationRegionTableGuid,
109 (VOID **)&PiSmmCommunicationRegionTable
111 if (EFI_ERROR (Status)) {
115 ASSERT (PiSmmCommunicationRegionTable !=
NULL);
119 for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
123 if (Size > MaxSize) {
125 RealCommSize = MaxSize;
134 ASSERT (CommBuffer !=
NULL);
135 ZeroMem (CommBuffer, RealCommSize);
137 Print (L
"SMM Driver Non-Volatile Variables:\n");
139 CommSize = RealCommSize;
141 if (Status == EFI_BUFFER_TOO_SMALL) {
142 Print (L
"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");
155 L
"%g R%03d(%03d) W%03d D%03d:%s\n",
161 (CHAR16 *)(VariableInfo + 1)
166 Print (L
"SMM Driver Volatile Variables:\n");
167 ZeroMem (CommBuffer, RealCommSize);
169 CommSize = RealCommSize;
171 if (Status == EFI_BUFFER_TOO_SMALL) {
172 Print (L
"The generic SMM communication buffer provided by SmmCommunicationRegionTable is too small\n");
185 L
"%g R%03d(%03d) W%03d D%03d:%s\n",
191 (CHAR16 *)(VariableInfo + 1)
224 if (EFI_ERROR (RuntimeDxeStatus) || (Entry ==
NULL)) {
228 if (!EFI_ERROR (RuntimeDxeStatus) && (Entry !=
NULL)) {
229 Print (L
"Runtime DXE Driver Non-Volatile EFI Variables:\n");
230 VariableInfo = Entry;
234 L
"%g R%03d(%03d) W%03d D%03d:%s\n",
244 VariableInfo = VariableInfo->
Next;
245 }
while (VariableInfo !=
NULL);
247 Print (L
"Runtime DXE Driver Volatile EFI Variables:\n");
248 VariableInfo = Entry;
252 L
"%g R%03d(%03d) W%03d D%03d:%s\n",
262 VariableInfo = VariableInfo->
Next;
263 }
while (VariableInfo !=
NULL);
268 if (EFI_ERROR (RuntimeDxeStatus) && EFI_ERROR (SmmStatus)) {
269 Print (L
"Warning: Variable Dxe/Smm driver doesn't enable the feature of statistical information!\n");
270 Print (L
"If you want to see this info, please:\n");
271 Print (L
" 1. Set PcdVariableCollectStatistics as TRUE\n");
272 Print (L
" 2. Rebuild Variable Dxe/Smm driver\n");
273 Print (L
" 3. Run \"VariableInfo\" cmd again\n");
275 return EFI_NOT_FOUND;
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define SMM_COMMUNICATE_HEADER_SIZE
#define SMM_VARIABLE_COMMUNICATE_HEADER_SIZE
#define EFI_PAGES_TO_SIZE(Pages)
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
EFI_STATUS PrintInfoFromSmm(VOID)
EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI GetVariableStatisticsData(IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN OUT UINTN *SmmCommunicateSize)
UINT32 DeleteCount
Number of times to delete this variable.
VARIABLE_INFO_ENTRY * Next
Pointer to next entry.
UINT32 CacheCount
Number of times that cache hits this variable.
UINT32 ReadCount
Number of times to read this variable.
CHAR16 * Name
Name of Variable.
BOOLEAN Volatile
TRUE if volatile, FALSE if non-volatile.
EFI_GUID VendorGuid
Guid of Variable.
UINT32 WriteCount
Number of times to write this variable.