summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-06-05 09:20:05 +0800
committerEric Dong <eric.dong@intel.com>2018-06-11 16:10:22 +0800
commitf75c7478280b96d191e86856c0b1c49ff711c284 (patch)
treeb2f9c063d386e3006f5db0a272b6fc990c1d1344 /ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers
parenta6eaba4d7f23262ab8e8502b476bdf5249a54ad4 (diff)
downloadedk2-f75c7478280b96d191e86856c0b1c49ff711c284.zip
edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.gz
edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.bz2
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>
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c5
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c5
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c26
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c4
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c10
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c44
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c10
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c21
8 files changed, 77 insertions, 48 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
index 7f66bce..bc8b7b0 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 30cf3e1..3a3cee9 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 704dfc4..fb0abe3 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 3ac2708..a704b0c 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 c33bb1e..164cd46 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 a028ae5..c38666d 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 6434088..815ba9a 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 fbe943d..043277a 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;
}