/** @file\r
Tools of clarify the content of the smbios table.\r
\r
- Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2005 - 2011, 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 "../UefiShellDebug1CommandsLib.h"\r
#include "LibSmbiosView.h"\r
-#include "smbiosview.h"\r
+#include "SmbiosView.h"\r
#include "PrintInfo.h"\r
#include "QueryTable.h"\r
\r
{NULL, TypeMax}\r
};\r
\r
+/**\r
+ Function for 'smbiosview' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
SHELL_STATUS\r
EFIAPI\r
ShellCommandRunSmbiosView (\r
Package = NULL;\r
ShellStatus = SHELL_SUCCESS;\r
\r
- Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ Status = ShellCommandLineParse (ParamList, &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
if (ShellCommandLineGetCount(Package) > 1) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetValue(Package, L"-t") == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"-t");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetValue(Package, L"-h") == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"-h");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (\r
+ (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-h")) ||\r
+ (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-s")) ||\r
+ (ShellCommandLineGetFlag(Package, L"-t") && ShellCommandLineGetFlag(Package, L"-a")) ||\r
+ (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-s")) ||\r
+ (ShellCommandLineGetFlag(Package, L"-h") && ShellCommandLineGetFlag(Package, L"-a")) ||\r
+ (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-a"))\r
+ ) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
} else {\r
\r
//\r
// Init Lib\r
- //\r
+ \r
Status = LibSmbiosInit ();\r
if (EFI_ERROR (Status)) {\r
ShellStatus = SHELL_NOT_FOUND;\r
// structure table head.\r
//\r
\r
- SMBIOS_STRUCTURE_POINTER pStruct;\r
+ SMBIOS_STRUCTURE_POINTER SmbiosStruct;\r
SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
\r
SMBiosTable = NULL;\r
break;\r
}\r
Offset = (UINT16) (Offset + Length);\r
- pStruct.Raw = Buffer;\r
+ SmbiosStruct.Raw = Buffer;\r
\r
//\r
// if QueryType==Random, print this structure.\r
// if QueryType!=Random, but Hdr->Type==QueryType, also print it.\r
// only if QueryType != Random and Hdr->Type != QueryType, skiped it.\r
//\r
- if (QueryType != STRUCTURE_TYPE_RANDOM && pStruct.Hdr->Type != QueryType) {\r
+ if (QueryType != STRUCTURE_TYPE_RANDOM && SmbiosStruct.Hdr->Type != QueryType) {\r
continue;\r
}\r
\r
ShellPrintHiiEx(-1,-1,NULL,\r
STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),\r
gShellDebug1HiiHandle,\r
- pStruct.Hdr->Type,\r
- pStruct.Hdr->Handle\r
+ SmbiosStruct.Hdr->Type,\r
+ SmbiosStruct.Hdr->Handle\r
);\r
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);\r
//\r
//\r
// check structure legality\r
//\r
- SmbiosCheckStructure (&pStruct);\r
+ SmbiosCheckStructure (&SmbiosStruct);\r
\r
//\r
// Print structure information\r
//\r
- SmbiosPrintStructure (&pStruct, gShowType);\r
+ SmbiosPrintStructure (&SmbiosStruct, gShowType);\r
ShellPrintEx(-1,-1,L"\n");\r
\r
/*\r
UINT16 Offset;\r
UINT16 Index;\r
\r
- SMBIOS_STRUCTURE_POINTER pStruct;\r
+ SMBIOS_STRUCTURE_POINTER SmbiosStruct;\r
SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
- STRUCTURE_STATISTICS *pStatistics;\r
+ STRUCTURE_STATISTICS *StatisticsPointer;\r
\r
SMBiosTable = NULL;\r
LibSmbiosGetEPS (&SMBiosTable);\r
mStatisticsTable = NULL;\r
}\r
\r
- mStatisticsTable = (STRUCTURE_STATISTICS *) AllocatePool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));\r
+ mStatisticsTable = (STRUCTURE_STATISTICS *) AllocateZeroPool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));\r
\r
if (mStatisticsTable == NULL) {\r
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);\r
}\r
\r
Offset = 0;\r
- pStatistics = mStatisticsTable;\r
+ StatisticsPointer = mStatisticsTable;\r
\r
//\r
// search from the first one\r
break;\r
}\r
\r
- pStruct.Raw = Buffer;\r
+ SmbiosStruct.Raw = Buffer;\r
Offset = (UINT16) (Offset + Length);\r
\r
//\r
// general statistics\r
//\r
- pStatistics->Index = Index;\r
- pStatistics->Type = pStruct.Hdr->Type;\r
- pStatistics->Handle = pStruct.Hdr->Handle;\r
- pStatistics->Length = Length;\r
- pStatistics->Addr = Offset;\r
+ StatisticsPointer->Index = Index;\r
+ StatisticsPointer->Type = SmbiosStruct.Hdr->Type;\r
+ StatisticsPointer->Handle = SmbiosStruct.Hdr->Handle;\r
+ StatisticsPointer->Length = Length;\r
+ StatisticsPointer->Addr = Offset;\r
\r
- pStatistics = &mStatisticsTable[Index];\r
+ StatisticsPointer = &mStatisticsTable[Index];\r
}\r
\r
return EFI_SUCCESS;\r
{\r
UINTN Index;\r
UINTN Num;\r
- STRUCTURE_STATISTICS *pStatistics;\r
+ STRUCTURE_STATISTICS *StatisticsPointer;\r
SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
\r
SMBiosTable = NULL;\r
}\r
\r
ShellPrintEx(-1,-1,L"============================================================\n");\r
- pStatistics = &mStatisticsTable[0];\r
+ StatisticsPointer = &mStatisticsTable[0];\r
Num = SMBiosTable->NumberOfSmbiosStructures;\r
//\r
// display statistics table content\r
//\r
for (Index = 1; Index <= Num; Index++) {\r
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, pStatistics->Index);\r
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, pStatistics->Type);\r
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, pStatistics->Handle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, StatisticsPointer->Index);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, StatisticsPointer->Type);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, StatisticsPointer->Handle);\r
if (Option >= SHOW_DETAIL) {\r
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, pStatistics->Addr);\r
- ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, pStatistics->Length);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, StatisticsPointer->Addr);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, StatisticsPointer->Length);\r
}\r
\r
ShellPrintEx(-1,-1,L"\n");\r
- pStatistics = &mStatisticsTable[Index];\r
+ StatisticsPointer = &mStatisticsTable[Index];\r
/*\r
//\r
// Display 20 lines and wait for a page break\r