diff options
author | Dandan Bi <dandan.bi@intel.com> | 2018-06-05 09:20:05 +0800 |
---|---|---|
committer | Eric Dong <eric.dong@intel.com> | 2018-06-11 16:10:22 +0800 |
commit | f75c7478280b96d191e86856c0b1c49ff711c284 (patch) | |
tree | b2f9c063d386e3006f5db0a272b6fc990c1d1344 | |
parent | a6eaba4d7f23262ab8e8502b476bdf5249a54ad4 (diff) | |
download | edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.gz edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.bz2 edk2-f75c7478280b96d191e86856c0b1c49ff711c284.zip |
ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
1. Separate variable definition and initialization.
2. Make the variable naming following Edk2 rule.
V2: Remove the updates of guard macros in header files.
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Evan Lloyd <evan.lloyd@arm.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
14 files changed, 178 insertions, 117 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 088575d014..6d3bc451ac 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -21,6 +21,15 @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount;
STATIC UINT32 mTableWarningCount;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+
+/**
+ An ACPI_PARSER array describing the ACPI header.
+**/
+STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
+ PARSE_ACPI_HEADER (&AcpiHdrInfo)
+};
+
/**
This function resets the ACPI table error counter to Zero.
**/
@@ -114,10 +123,13 @@ VerifyChecksum ( IN UINT32 Length
)
{
- UINTN ByteCount = 0;
- UINT8 Checksum = 0;
+ UINTN ByteCount;
+ UINT8 Checksum;
UINTN OriginalAttribute;
+ ByteCount = 0;
+ Checksum = 0;
+
while (ByteCount < Length) {
Checksum += *(Ptr++);
ByteCount++;
@@ -166,11 +178,14 @@ DumpRaw ( IN UINT32 Length
)
{
- UINTN ByteCount = 0;
+ UINTN ByteCount;
UINTN PartLineChars;
- UINTN AsciiBufferIndex = 0;
+ UINTN AsciiBufferIndex;
CHAR8 AsciiBuffer[17];
+ ByteCount = 0;
+ AsciiBufferIndex = 0;
+
Print (L"Address : 0x%p\n", Ptr);
Print (L"Length : %d\n", Length);
@@ -277,7 +292,10 @@ DumpUint64 ( // Some fields are not aligned and this causes alignment faults
// on ARM platforms if the compiler generates LDRD instructions.
// Perform word access so that LDRD instructions are not generated.
- UINT64 Val = *(UINT32*)(Ptr + sizeof (UINT32));
+ UINT64 Val;
+
+ Val = *(UINT32*)(Ptr + sizeof (UINT32));
+
Val <<= 32;
Val |= *(UINT32*)Ptr;
@@ -456,13 +474,16 @@ ParseAcpi ( )
{
UINT32 Index;
- UINT32 Offset = 0;
+ UINT32 Offset;
+ BOOLEAN HighLight;
+
+ Offset = 0;
// Increment the Indent
gIndent += Indent;
if (Trace && (AsciiName != NULL)){
- BOOLEAN HighLight = GetColourHighlighting ();
+ HighLight = GetColourHighlighting ();
UINTN OriginalAttribute;
if (HighLight) {
@@ -620,11 +641,6 @@ DumpAcpiHeader ( IN UINT8* Ptr
)
{
- ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
- ACPI_PARSER AcpiHeaderParser[] = {
- PARSE_ACPI_HEADER (&AcpiHdrInfo)
- };
-
return ParseAcpi (
TRUE,
0,
@@ -658,10 +674,6 @@ ParseAcpiHeader ( )
{
UINT32 BytesParsed;
- ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
- ACPI_PARSER AcpiHeaderParser[] = {
- PARSE_ACPI_HEADER (&AcpiHdrInfo)
- };
BytesParsed = ParseAcpi (
FALSE,
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index 7b1a02cad3..fff5757bf5 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -45,32 +45,32 @@ RegisterParser ( IN PARSE_ACPI_TABLE_PROC ParserProc
)
{
- UINT32 index;
+ UINT32 Index;
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
return EFI_INVALID_PARAMETER;
}
// Search if a parser is already installed
- for (index = 0;
- index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
- index++)
+ for (Index = 0;
+ Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+ Index++)
{
- if (Signature == mTableParserList[index].Signature) {
- if (mTableParserList[index].Parser != NULL) {
+ if (Signature == mTableParserList[Index].Signature) {
+ if (mTableParserList[Index].Parser != NULL) {
return EFI_ALREADY_STARTED;
}
}
}
// Find the first free slot and register the parser
- for (index = 0;
- index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
- index++)
+ for (Index = 0;
+ Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+ Index++)
{
- if (mTableParserList[index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
- mTableParserList[index].Signature = Signature;
- mTableParserList[index].Parser = ParserProc;
+ if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
+ mTableParserList[Index].Signature = Signature;
+ mTableParserList[Index].Parser = ParserProc;
return EFI_SUCCESS;
}
}
@@ -96,19 +96,19 @@ DeregisterParser ( IN UINT32 Signature
)
{
- UINT32 index;
+ UINT32 Index;
if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
return EFI_INVALID_PARAMETER;
}
- for (index = 0;
- index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
- index++)
+ for (Index = 0;
+ Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+ Index++)
{
- if (Signature == mTableParserList[index].Signature) {
- mTableParserList[index].Signature = ACPI_PARSER_SIGNATURE_NULL;
- mTableParserList[index].Parser = NULL;
+ if (Signature == mTableParserList[Index].Signature) {
+ mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
+ mTableParserList[Index].Parser = NULL;
return EFI_SUCCESS;
}
}
@@ -137,18 +137,18 @@ GetParser ( OUT PARSE_ACPI_TABLE_PROC * ParserProc
)
{
- UINT32 index;
+ UINT32 Index;
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
return EFI_INVALID_PARAMETER;
}
- for (index = 0;
- index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
- index++)
+ for (Index = 0;
+ Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
+ Index++)
{
- if (Signature == mTableParserList[index].Signature) {
- *ParserProc = mTableParserList[index].Parser;
+ if (Signature == mTableParserList[Index].Signature) {
+ *ParserProc = mTableParserList[Index].Parser;
return EFI_SUCCESS;
}
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index f5602e9429..47ce93f104 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -122,8 +122,11 @@ DumpAcpiTableToFile ( {
EFI_STATUS Status;
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
- SHELL_FILE_HANDLE DumpFileHandle = NULL;
- UINTN TransferBytes = Length;
+ SHELL_FILE_HANDLE DumpFileHandle;
+ UINTN TransferBytes;
+
+ DumpFileHandle = NULL;
+ TransferBytes = Length;
UnicodeSPrint (
FileNameBuffer,
@@ -186,20 +189,25 @@ ProcessTableReportOptions ( )
{
UINTN OriginalAttribute;
- UINT8* SignaturePtr = (UINT8*)(UINTN)&Signature;
- BOOLEAN Log = FALSE;
- BOOLEAN HighLight = GetColourHighlighting ();
+ UINT8* SignaturePtr;
+ BOOLEAN Log;
+ BOOLEAN HighLight;
+
+ SignaturePtr = (UINT8*)(UINTN)&Signature;
+ Log = FALSE;
+ HighLight = GetColourHighlighting ();
+
switch (GetReportOption ()) {
- case EREPORT_ALL:
+ case ReportAll:
Log = TRUE;
break;
- case EREPORT_SELECTED:
+ case ReportSelected:
if (Signature == GetSelectedAcpiTable ()) {
Log = TRUE;
mSelectedAcpiTableFound = TRUE;
}
break;
- case EREPORT_TABLE_LIST:
+ case ReportTableList:
if (mTableCount == 0) {
if (HighLight) {
OriginalAttribute = gST->ConOut->Mode->Attribute;
@@ -223,13 +231,13 @@ ProcessTableReportOptions ( SignaturePtr[3]
);
break;
- case EREPORT_DUMP_BIN_FILE:
+ case ReportDumpBinFile:
if (Signature == GetSelectedAcpiTable ()) {
mSelectedAcpiTableFound = TRUE;
DumpAcpiTableToFile (TablePtr, Length);
}
break;
- case EREPORT_MAX:
+ case ReportMax:
// We should never be here.
// This case is only present to prevent compiler warning.
break;
@@ -273,9 +281,11 @@ ConvertStrToAcpiSignature ( IN CONST CHAR16* Str
)
{
- UINT8 Index = 0;
+ UINT8 Index;
CHAR8 Ptr[4];
+ Index = 0;
+
// Convert to Upper case and convert to ASCII
while ((Index < 4) && (Str[Index] != 0)) {
if (Str[Index] >= L'a' && Str[Index] <= L'z') {
@@ -371,12 +381,12 @@ AcpiView ( }
ReportOption = GetReportOption ();
- if (EREPORT_TABLE_LIST != ReportOption) {
- if (((EREPORT_SELECTED == ReportOption) ||
- (EREPORT_DUMP_BIN_FILE == ReportOption)) &&
+ if (ReportTableList != ReportOption) {
+ if (((ReportSelected == ReportOption) ||
+ (ReportDumpBinFile == ReportOption)) &&
(!mSelectedAcpiTableFound)) {
Print (L"\nRequested ACPI Table not found.\n");
- } else if (EREPORT_DUMP_BIN_FILE != ReportOption) {
+ } else if (ReportDumpBinFile != ReportOption) {
OriginalAttribute = gST->ConOut->Mode->Attribute;
Print (L"\nTable Statistics:\n");
@@ -426,15 +436,15 @@ ShellCommandRunAcpiView ( )
{
EFI_STATUS Status;
- SHELL_STATUS ShellStatus = SHELL_SUCCESS;
- LIST_ENTRY* Package = NULL;
+ SHELL_STATUS ShellStatus;
+ LIST_ENTRY* Package;
CHAR16* ProblemParam;
CONST CHAR16* Temp;
CHAR8 ColourOption[8];
- SHELL_FILE_HANDLE TmpDumpFileHandle = NULL;
+ SHELL_FILE_HANDLE TmpDumpFileHandle;
// Set Defaults
- mReportType = EREPORT_ALL;
+ mReportType = ReportAll;
mTableCount = 0;
mBinTableCount = 0;
mSelectedAcpiTable = 0;
@@ -443,6 +453,10 @@ ShellCommandRunAcpiView ( mVerbose = TRUE;
mConsistencyCheck = TRUE;
+ ShellStatus = SHELL_SUCCESS;
+ Package = NULL;
+ TmpDumpFileHandle = NULL;
+
// Reset The error/warning counters
ResetErrorCount ();
ResetWarningCount ();
@@ -547,19 +561,19 @@ ShellCommandRunAcpiView ( }
if (ShellCommandLineGetFlag (Package, L"-l")) {
- mReportType = EREPORT_TABLE_LIST;
+ mReportType = ReportTableList;
} else {
mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s");
if (mSelectedAcpiTableName != NULL) {
mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature (
mSelectedAcpiTableName
);
- mReportType = EREPORT_SELECTED;
+ mReportType = ReportSelected;
if (ShellCommandLineGetFlag (Package, L"-d")) {
// Create a temporary file to check if the media is writable.
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
- mReportType = EREPORT_DUMP_BIN_FILE;
+ mReportType = ReportDumpBinFile;
UnicodeSPrint (
FileNameBuffer,
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index b035395a72..615686dde8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -33,11 +33,11 @@ The EREPORT_OPTION enum describes ACPI table Reporting options.
**/
typedef enum ReportOption {
- EREPORT_ALL, ///< Report All tables.
- EREPORT_SELECTED, ///< Report Selected table.
- EREPORT_TABLE_LIST, ///< Report List of tables.
- EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file.
- EREPORT_MAX
+ ReportAll, ///< Report All tables.
+ ReportSelected, ///< Report Selected table.
+ ReportTableList, ///< Report List of tables.
+ ReportDumpBinFile, ///< Dump selected table to a file.
+ ReportMax,
} EREPORT_OPTION;
/**
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index 7f66bce074..bc8b7b00e3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -112,7 +112,10 @@ ValidateNameSpaceStrLen ( IN VOID* Context
)
{
- UINT16 NameSpaceStrLen = *(UINT16*)Ptr;
+ UINT16 NameSpaceStrLen;
+
+ NameSpaceStrLen = *(UINT16*)Ptr;
+
if (NameSpaceStrLen < 2) {
IncrementErrorCount ();
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index 30cf3e14f7..3a3cee948a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -138,7 +138,10 @@ ValidateGtBlockTimerCount ( IN VOID* Context
)
{
- UINT32 BlockTimerCount = *(UINT32*)Ptr;
+ UINT32 BlockTimerCount;
+
+ BlockTimerCount = *(UINT32*)Ptr;
+
if (BlockTimerCount > 8) {
IncrementErrorCount ();
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 704dfc407c..fb0abe3c43 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -27,13 +27,13 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; The EIORT_NODE enum describes the IORT Node types.
**/
typedef enum IortNode {
- EIORT_NODE_ITS_GROUP, ///< ITS Group node
- EIORT_NODE_NAMED_COMPONENT, ///< Named Component node
- EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node
- EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node
- EIORT_NODE_SMMUV3, ///< SMMU v3 node
- EIORT_NODE_PMCG, ///< PMC group node
- EIORT_NODE_MAX
+ Iort_Node_ITS_Group, ///< ITS Group node
+ Iort_Node_Named_Component, ///< Named Component node
+ Iort_Node_Root_Complex, ///< Root Complex node
+ Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node
+ Iort_Node_SMMUV3, ///< SMMU v3 node
+ Iort_Node_PMCG, ///< PMC group node
+ Iort_Node_Max
} EIORT_NODE;
// Local Variables
@@ -665,13 +665,13 @@ ParseAcpiIort ( Print (L"0x%x\n", Offset);
switch (*IortNodeType) {
- case EIORT_NODE_ITS_GROUP:
+ case Iort_Node_ITS_Group:
DumpIortNodeIts (
NodePtr,
*IortNodeLength
);
break;
- case EIORT_NODE_NAMED_COMPONENT:
+ case Iort_Node_Named_Component:
DumpIortNodeNamedComponent (
NodePtr,
*IortNodeLength,
@@ -679,7 +679,7 @@ ParseAcpiIort ( *IortIdMappingOffset
);
break;
- case EIORT_NODE_ROOT_COMPLEX:
+ case Iort_Node_Root_Complex:
DumpIortNodeRootComplex (
NodePtr,
*IortNodeLength,
@@ -687,7 +687,7 @@ ParseAcpiIort ( *IortIdMappingOffset
);
break;
- case EIORT_NODE_SMMUV1_V2:
+ case Iort_Node_SMMUV1_V2:
DumpIortNodeSmmuV1V2 (
NodePtr,
*IortNodeLength,
@@ -695,7 +695,7 @@ ParseAcpiIort ( *IortIdMappingOffset
);
break;
- case EIORT_NODE_SMMUV3:
+ case Iort_Node_SMMUV3:
DumpIortNodeSmmuV3 (
NodePtr,
*IortNodeLength,
@@ -703,7 +703,7 @@ ParseAcpiIort ( *IortIdMappingOffset
);
break;
- case EIORT_NODE_PMCG:
+ case Iort_Node_PMCG:
DumpIortNodePmcg (
NodePtr,
*IortNodeLength,
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 3ac27086a6..a704b0c631 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -197,7 +197,9 @@ ParseAcpiMadt ( {
UINT32 Offset;
UINT8* InterruptContollerPtr;
- UINT32 GICDCount = 0;
+ UINT32 GICDCount;
+
+ GICDCount = 0;
if (!Trace) {
return;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index c33bb1e923..164cd46202 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -88,7 +88,10 @@ ValidateRsdtAddress ( // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT32 RsdtAddr = *(UINT32*)Ptr;
+ UINT32 RsdtAddr;
+
+ RsdtAddr = *(UINT32*)Ptr;
+
if (RsdtAddr != 0) {
IncrementErrorCount ();
Print (
@@ -120,7 +123,10 @@ ValidateXsdtAddress ( // Root System Description Pointer (RSDP), ACPI ? 5.2.5.
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
- UINT64 XsdtAddr = *(UINT64*)Ptr;
+ UINT64 XsdtAddr;
+
+ XsdtAddr = *(UINT64*)Ptr;
+
if (XsdtAddr == 0) {
IncrementErrorCount ();
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index a028ae541c..c38666d2b7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -63,8 +63,8 @@ ParseAcpiSlit ( )
{
UINT32 Offset;
- UINT64 i;
- UINT64 j;
+ UINT64 Count;
+ UINT64 Index;
UINT64 LocalityCount;
UINT8* LocalityPtr;
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
@@ -98,46 +98,46 @@ ParseAcpiSlit ( PrintFieldName (0, Buffer);
Print (L"\n");
Print (L" ");
- for (j = 0; j < LocalityCount; j++) {
- Print (L" (%3d) ", j);
+ for (Index = 0; Index < LocalityCount; Index++) {
+ Print (L" (%3d) ", Index);
}
Print (L"\n");
- for (i = 0; i < LocalityCount; i++) {
- Print (L" (%3d) ", i);
- for (j = 0; j < LocalityCount; j++) {
- Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, i, j));
+ for (Count = 0; Count< LocalityCount; Count++) {
+ Print (L" (%3d) ", Count);
+ for (Index = 0; Index < LocalityCount; Index++) {
+ Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index));
}
Print (L"\n");
}
}
// Validate
- for (i = 0; i < LocalityCount; i++) {
- for (j = 0; j < LocalityCount; j++) {
+ for (Count = 0; Count < LocalityCount; Count++) {
+ for (Index = 0; Index < LocalityCount; Index++) {
// Element[x][x] must be equal to 10
- if ((i == j) && (SLIT_ELEMENT (LocalityPtr, i, j) != 10)) {
+ if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) {
IncrementErrorCount ();
Print (
L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
" Normalized Value is not 10\n",
- i,
- j,
- SLIT_ELEMENT (LocalityPtr, i, j)
+ Count,
+ Index,
+ SLIT_ELEMENT (LocalityPtr, Count, Index)
);
}
// Element[i][j] must be equal to Element[j][i]
- if (SLIT_ELEMENT (LocalityPtr, i, j) !=
- SLIT_ELEMENT (LocalityPtr, j, i)) {
+ if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
+ SLIT_ELEMENT (LocalityPtr, Index, Count)) {
IncrementErrorCount ();
Print (
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
"Element[0x%lx][0x%lx] (%3d) do not match.\n",
- i,
- j,
- SLIT_ELEMENT (LocalityPtr, i, j),
- j,
- i,
- SLIT_ELEMENT (LocalityPtr, j, i)
+ Count,
+ Index,
+ SLIT_ELEMENT (LocalityPtr, Count, Index),
+ Index,
+ Count,
+ SLIT_ELEMENT (LocalityPtr, Index, Count)
);
}
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index 64340886fe..815ba9a9db 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -98,7 +98,10 @@ ValidateInterruptType ( )
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
- UINT8 InterruptType = *Ptr;
+ UINT8 InterruptType;
+
+ InterruptType = *Ptr;
+
if (InterruptType !=
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
IncrementErrorCount ();
@@ -126,7 +129,10 @@ ValidateIrq ( )
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
- UINT8 Irq = *Ptr;
+ UINT8 Irq;
+
+ Irq = *Ptr;
+
if (Irq != 0) {
IncrementErrorCount ();
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index fbe943d898..043277aabf 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -177,7 +177,10 @@ DumpSratApicProximity ( IN UINT8* Ptr
)
{
- UINT32 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
+ UINT32 ProximityDomain;
+
+ ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
+
Print (Format, ProximityDomain);
}
@@ -210,13 +213,19 @@ ParseAcpiSrat ( {
UINT32 Offset;
UINT8* ResourcePtr;
- UINT32 GicCAffinityIndex = 0;
- UINT32 GicITSAffinityIndex = 0;
- UINT32 MemoryAffinityIndex = 0;
- UINT32 ApicSapicAffinityIndex = 0;
- UINT32 X2ApicAffinityIndex = 0;
+ UINT32 GicCAffinityIndex;
+ UINT32 GicITSAffinityIndex;
+ UINT32 MemoryAffinityIndex;
+ UINT32 ApicSapicAffinityIndex;
+ UINT32 X2ApicAffinityIndex;
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
+ GicCAffinityIndex = 0;
+ GicITSAffinityIndex = 0;
+ MemoryAffinityIndex = 0;
+ ApicSapicAffinityIndex = 0;
+ X2ApicAffinityIndex = 0;
+
if (!Trace) {
return;
}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index 8479bfbc9b..c2f40009ee 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -64,7 +64,10 @@ RegisterAllParsers ( )
{
EFI_STATUS Status;
- UINTN Count = sizeof (ParserList) / sizeof (ParserList[0]);
+ UINTN Count;
+
+ Count = sizeof (ParserList) / sizeof (ParserList[0]);
+
while (Count-- != 0) {
Status = RegisterParser (
ParserList[Count].Signature,
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf index dbdb7e301b..6df8c08b85 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf @@ -27,6 +27,9 @@ UefiShellAcpiViewCommandLib.uni
UefiShellAcpiViewCommandLib.c
UefiShellAcpiViewCommandLib.h
+ AcpiParser.h
+ AcpiTableParser.h
+ AcpiView.h
AcpiParser.c
AcpiTableParser.c
AcpiView.c
|