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>
This commit is contained in:
@@ -112,7 +112,10 @@ ValidateNameSpaceStrLen (
|
||||
IN VOID* Context
|
||||
)
|
||||
{
|
||||
UINT16 NameSpaceStrLen = *(UINT16*)Ptr;
|
||||
UINT16 NameSpaceStrLen;
|
||||
|
||||
NameSpaceStrLen = *(UINT16*)Ptr;
|
||||
|
||||
if (NameSpaceStrLen < 2) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
|
@@ -138,7 +138,10 @@ ValidateGtBlockTimerCount (
|
||||
IN VOID* Context
|
||||
)
|
||||
{
|
||||
UINT32 BlockTimerCount = *(UINT32*)Ptr;
|
||||
UINT32 BlockTimerCount;
|
||||
|
||||
BlockTimerCount = *(UINT32*)Ptr;
|
||||
|
||||
if (BlockTimerCount > 8) {
|
||||
IncrementErrorCount ();
|
||||
Print (
|
||||
|
@@ -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,
|
||||
|
@@ -197,7 +197,9 @@ ParseAcpiMadt (
|
||||
{
|
||||
UINT32 Offset;
|
||||
UINT8* InterruptContollerPtr;
|
||||
UINT32 GICDCount = 0;
|
||||
UINT32 GICDCount;
|
||||
|
||||
GICDCount = 0;
|
||||
|
||||
if (!Trace) {
|
||||
return;
|
||||
|
@@ -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 (
|
||||
|
@@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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 (
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user