]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / AcpiParser.c
index 088575d0144becab944b2cfe61e3e0c7f6795f0c..6d3bc451acd6386774f74c21a0554ab1e541b4d9 100644 (file)
@@ -21,6 +21,15 @@ STATIC UINT32   gIndent;
 STATIC UINT32   mTableErrorCount;\r
 STATIC UINT32   mTableWarningCount;\r
 \r
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;\r
+\r
+/**\r
+  An ACPI_PARSER array describing the ACPI header.\r
+**/\r
+STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {\r
+  PARSE_ACPI_HEADER (&AcpiHdrInfo)\r
+};\r
+\r
 /**\r
   This function resets the ACPI table error counter to Zero.\r
 **/\r
@@ -114,10 +123,13 @@ VerifyChecksum (
   IN UINT32  Length\r
   )\r
 {\r
-  UINTN ByteCount = 0;\r
-  UINT8 Checksum = 0;\r
+  UINTN ByteCount;\r
+  UINT8 Checksum;\r
   UINTN OriginalAttribute;\r
 \r
+  ByteCount = 0;\r
+  Checksum = 0;\r
+\r
   while (ByteCount < Length) {\r
     Checksum += *(Ptr++);\r
     ByteCount++;\r
@@ -166,11 +178,14 @@ DumpRaw (
   IN UINT32 Length\r
   )\r
 {\r
-  UINTN ByteCount = 0;\r
+  UINTN ByteCount;\r
   UINTN PartLineChars;\r
-  UINTN AsciiBufferIndex = 0;\r
+  UINTN AsciiBufferIndex;\r
   CHAR8 AsciiBuffer[17];\r
 \r
+  ByteCount = 0;\r
+  AsciiBufferIndex = 0;\r
+\r
   Print (L"Address  : 0x%p\n", Ptr);\r
   Print (L"Length   : %d\n", Length);\r
 \r
@@ -277,7 +292,10 @@ DumpUint64 (
   // Some fields are not aligned and this causes alignment faults\r
   // on ARM platforms if the compiler generates LDRD instructions.\r
   // Perform word access so that LDRD instructions are not generated.\r
-  UINT64 Val = *(UINT32*)(Ptr + sizeof (UINT32));\r
+  UINT64 Val;\r
+\r
+  Val = *(UINT32*)(Ptr + sizeof (UINT32));\r
+\r
   Val <<= 32;\r
   Val |= *(UINT32*)Ptr;\r
 \r
@@ -456,13 +474,16 @@ ParseAcpi (
 )\r
 {\r
   UINT32  Index;\r
-  UINT32  Offset = 0;\r
+  UINT32  Offset;\r
+  BOOLEAN HighLight;\r
+\r
+  Offset = 0;\r
 \r
   // Increment the Indent\r
   gIndent += Indent;\r
 \r
   if (Trace && (AsciiName != NULL)){\r
-    BOOLEAN HighLight = GetColourHighlighting ();\r
+    HighLight = GetColourHighlighting ();\r
     UINTN   OriginalAttribute;\r
 \r
     if (HighLight) {\r
@@ -620,11 +641,6 @@ DumpAcpiHeader (
   IN UINT8* Ptr\r
   )\r
 {\r
-  ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;\r
-  ACPI_PARSER AcpiHeaderParser[] = {\r
-    PARSE_ACPI_HEADER (&AcpiHdrInfo)\r
-  };\r
-\r
   return ParseAcpi (\r
            TRUE,\r
            0,\r
@@ -658,10 +674,6 @@ ParseAcpiHeader (
   )\r
 {\r
   UINT32                        BytesParsed;\r
-  ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;\r
-  ACPI_PARSER AcpiHeaderParser[] = {\r
-    PARSE_ACPI_HEADER (&AcpiHdrInfo)\r
-  };\r
 \r
   BytesParsed = ParseAcpi (\r
                   FALSE,\r