]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Application/VariableInfo/VariableInfo.c
MdeModulePkg: Move authenticated variable definition from SecurityPkg
[mirror_edk2.git] / MdeModulePkg / Application / VariableInfo / VariableInfo.c
CommitLineData
33a5a666
A
1/** @file\r
2 If the Variable services have PcdVariableCollectStatistics set to TRUE then \r
3 the EFI system table will contain statistical information about variable usage\r
4 an this utility will print out the information. You can use console redirection\r
5 to capture the data.\r
6 \r
cd5ebaa0
HT
7 Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials \r
33a5a666
A
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16**/\r
17\r
18#include <Uefi.h>\r
33a5a666
A
19#include <Library/UefiLib.h>\r
20#include <Library/UefiApplicationEntryPoint.h>\r
3709c4cd 21#include <Guid/VariableFormat.h>\r
33a5a666
A
22\r
23\r
24/**\r
25 The user Entry Point for Application. The user code starts with this function\r
26 as the real entry point for the image goes into a library that calls this \r
27 function.\r
28\r
29\r
30 @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
31 @param[in] SystemTable A pointer to the EFI System Table.\r
32 \r
33 @retval EFI_SUCCESS The entry point is executed successfully.\r
34 @retval other Some error occurs when executing this entry point.\r
35\r
36**/\r
37EFI_STATUS\r
38EFIAPI\r
39UefiMain (\r
40 IN EFI_HANDLE ImageHandle,\r
41 IN EFI_SYSTEM_TABLE *SystemTable\r
42 )\r
43{\r
44 EFI_STATUS Status;\r
45 VARIABLE_INFO_ENTRY *VariableInfo;\r
46 VARIABLE_INFO_ENTRY *Entry;\r
47\r
3709c4cd 48 Status = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **)&Entry);\r
33a5a666
A
49 if (!EFI_ERROR (Status) && (Entry != NULL)) {\r
50 Print (L"Non-Volatile EFI Variables:\n");\r
51 VariableInfo = Entry;\r
52 do {\r
53 if (!VariableInfo->Volatile) {\r
54 Print (\r
55 L"%g R%03d(%03d) W%03d D%03d:%s\n", \r
56 &VariableInfo->VendorGuid, \r
57 VariableInfo->ReadCount,\r
58 VariableInfo->CacheCount,\r
59 VariableInfo->WriteCount,\r
60 VariableInfo->DeleteCount,\r
61 VariableInfo->Name\r
62 );\r
63 }\r
64\r
65 VariableInfo = VariableInfo->Next;\r
66 } while (VariableInfo != NULL);\r
67\r
68 Print (L"Volatile EFI Variables:\n");\r
69 VariableInfo = Entry;\r
70 do {\r
71 if (VariableInfo->Volatile) {\r
72 Print (\r
73 L"%g R%03d(%03d) W%03d D%03d:%s\n", \r
74 &VariableInfo->VendorGuid, \r
75 VariableInfo->ReadCount,\r
76 VariableInfo->CacheCount,\r
77 VariableInfo->WriteCount,\r
78 VariableInfo->DeleteCount,\r
79 VariableInfo->Name\r
80 );\r
81 }\r
82 VariableInfo = VariableInfo->Next;\r
83 } while (VariableInfo != NULL);\r
84\r
5e895e6a 85 } else {\r
86 Print (L"Warning: Variable Dxe driver doesn't enable the feature of statistical information!\n");\r
87 Print (L"If you want to see this info, please:\n");\r
88 Print (L" 1. Set PcdVariableCollectStatistics as TRUE\n");\r
89 Print (L" 2. Rebuild Variable Dxe driver\n");\r
90 Print (L" 3. Run \"VariableInfo\" cmd again\n");\r
91\r
33a5a666
A
92 }\r
93\r
133e09da 94 return Status;\r
33a5a666 95}\r