]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / AcpiParser.c
index 74056e72c359c732758563a9fe14ff2582f39f21..cb193a5ea449007159c6ef1a828bea9b5dce3537 100644 (file)
 #include "AcpiView.h"\r
 #include "AcpiViewConfig.h"\r
 \r
-STATIC UINT32   gIndent;\r
-STATIC UINT32   mTableErrorCount;\r
-STATIC UINT32   mTableWarningCount;\r
+STATIC UINT32  gIndent;\r
+STATIC UINT32  mTableErrorCount;\r
+STATIC UINT32  mTableWarningCount;\r
 \r
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;\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
+STATIC CONST ACPI_PARSER  AcpiHeaderParser[] = {\r
   PARSE_ACPI_HEADER (&AcpiHdrInfo)\r
 };\r
 \r
@@ -113,21 +113,21 @@ IncrementWarningCount (
 BOOLEAN\r
 EFIAPI\r
 VerifyChecksum (\r
-  IN BOOLEAN Log,\r
-  IN UINT8*  Ptr,\r
-  IN UINT32  Length\r
+  IN BOOLEAN  Log,\r
+  IN UINT8    *Ptr,\r
+  IN UINT32   Length\r
   )\r
 {\r
-  UINTN ByteCount;\r
-  UINT8 Checksum;\r
-  UINTN OriginalAttribute;\r
+  UINTN  ByteCount;\r
+  UINT8  Checksum;\r
+  UINTN  OriginalAttribute;\r
 \r
   //\r
   // set local variables to suppress incorrect compiler/analyzer warnings\r
   //\r
   OriginalAttribute = 0;\r
-  ByteCount = 0;\r
-  Checksum = 0;\r
+  ByteCount         = 0;\r
+  Checksum          = 0;\r
 \r
   while (ByteCount < Length) {\r
     Checksum += *(Ptr++);\r
@@ -140,22 +140,29 @@ VerifyChecksum (
       if (GetColourHighlighting ()) {\r
         gST->ConOut->SetAttribute (\r
                        gST->ConOut,\r
-                       EFI_TEXT_ATTR (EFI_GREEN,\r
-                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
+                       EFI_TEXT_ATTR (\r
+                         EFI_GREEN,\r
+                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)\r
+                         )\r
                        );\r
       }\r
+\r
       Print (L"Table Checksum : OK\n\n");\r
     } else {\r
       IncrementErrorCount ();\r
       if (GetColourHighlighting ()) {\r
         gST->ConOut->SetAttribute (\r
                        gST->ConOut,\r
-                       EFI_TEXT_ATTR (EFI_RED,\r
-                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
+                       EFI_TEXT_ATTR (\r
+                         EFI_RED,\r
+                         ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)\r
+                         )\r
                        );\r
       }\r
+\r
       Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);\r
     }\r
+\r
     if (GetColourHighlighting ()) {\r
       gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);\r
     }\r
@@ -173,16 +180,16 @@ VerifyChecksum (
 VOID\r
 EFIAPI\r
 DumpRaw (\r
-  IN UINT8Ptr,\r
-  IN UINT32 Length\r
+  IN UINT8   *Ptr,\r
+  IN UINT32  Length\r
   )\r
 {\r
-  UINTN ByteCount;\r
-  UINTN PartLineChars;\r
-  UINTN AsciiBufferIndex;\r
-  CHAR8 AsciiBuffer[17];\r
+  UINTN  ByteCount;\r
+  UINTN  PartLineChars;\r
+  UINTN  AsciiBufferIndex;\r
+  CHAR8  AsciiBuffer[17];\r
 \r
-  ByteCount = 0;\r
+  ByteCount        = 0;\r
   AsciiBufferIndex = 0;\r
 \r
   Print (L"Address  : 0x%p\n", Ptr);\r
@@ -216,6 +223,7 @@ DumpRaw (
     if ((Length & 0x0F) <= 8) {\r
       PartLineChars += 2;\r
     }\r
+\r
     while (PartLineChars > 0) {\r
       Print (L" ");\r
       PartLineChars--;\r
@@ -236,8 +244,8 @@ DumpRaw (
 VOID\r
 EFIAPI\r
 DumpUint8 (\r
-  IN CONST CHAR16Format,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   Print (Format, *Ptr);\r
@@ -252,11 +260,11 @@ DumpUint8 (
 VOID\r
 EFIAPI\r
 DumpUint16 (\r
-  IN CONST CHAR16Format,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
-  Print (Format, *(UINT16*)Ptr);\r
+  Print (Format, *(UINT16 *)Ptr);\r
 }\r
 \r
 /**\r
@@ -268,11 +276,11 @@ DumpUint16 (
 VOID\r
 EFIAPI\r
 DumpUint32 (\r
-  IN CONST CHAR16Format,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
-  Print (Format, *(UINT32*)Ptr);\r
+  Print (Format, *(UINT32 *)Ptr);\r
 }\r
 \r
 /**\r
@@ -284,19 +292,19 @@ DumpUint32 (
 VOID\r
 EFIAPI\r
 DumpUint64 (\r
-  IN CONST CHAR16Format,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   // 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;\r
+  UINT64  Val;\r
 \r
-  Val = *(UINT32*)(Ptr + sizeof (UINT32));\r
+  Val = *(UINT32 *)(Ptr + sizeof (UINT32));\r
 \r
-  Val = LShiftU64(Val,32);\r
-  Val |= (UINT64)*(UINT32*)Ptr;\r
+  Val  = LShiftU64 (Val, 32);\r
+  Val |= (UINT64)*(UINT32 *)Ptr;\r
 \r
   Print (Format, Val);\r
 }\r
@@ -313,8 +321,8 @@ DumpUint64 (
 VOID\r
 EFIAPI\r
 Dump3Chars (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   Print (\r
@@ -337,8 +345,8 @@ Dump3Chars (
 VOID\r
 EFIAPI\r
 Dump4Chars (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   Print (\r
@@ -362,8 +370,8 @@ Dump4Chars (
 VOID\r
 EFIAPI\r
 Dump6Chars (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   Print (\r
@@ -389,8 +397,8 @@ Dump6Chars (
 VOID\r
 EFIAPI\r
 Dump8Chars (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   Print (\r
@@ -418,8 +426,8 @@ Dump8Chars (
 VOID\r
 EFIAPI\r
 Dump12Chars (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN       UINT8*  Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN       UINT8   *Ptr\r
   )\r
 {\r
   Print (\r
@@ -454,9 +462,9 @@ Dump12Chars (
 VOID\r
 EFIAPI\r
 PrintFieldName (\r
-  IN UINT32         Indent,\r
-  IN CONST CHAR16*  FieldName\r
-)\r
+  IN UINT32        Indent,\r
+  IN CONST CHAR16  *FieldName\r
+  )\r
 {\r
   Print (\r
     L"%*a%-*s : ",\r
@@ -498,38 +506,41 @@ EFIAPI
 ParseAcpi (\r
   IN BOOLEAN            Trace,\r
   IN UINT32             Indent,\r
-  IN CONST CHAR8*       AsciiName OPTIONAL,\r
-  IN UINT8*             Ptr,\r
+  IN CONST CHAR8        *AsciiName OPTIONAL,\r
+  IN UINT8              *Ptr,\r
   IN UINT32             Length,\r
-  IN CONST ACPI_PARSERParser,\r
+  IN CONST ACPI_PARSER  *Parser,\r
   IN UINT32             ParserItems\r
-)\r
+  )\r
 {\r
-  UINT32  Index;\r
-  UINT32  Offset;\r
-  BOOLEAN HighLight;\r
-  UINTN   OriginalAttribute;\r
+  UINT32   Index;\r
+  UINT32   Offset;\r
+  BOOLEAN  HighLight;\r
+  UINTN    OriginalAttribute;\r
 \r
   //\r
   // set local variables to suppress incorrect compiler/analyzer warnings\r
   //\r
   OriginalAttribute = 0;\r
-  Offset = 0;\r
+  Offset            = 0;\r
 \r
   // Increment the Indent\r
   gIndent += Indent;\r
 \r
-  if (Trace && (AsciiName != NULL)){\r
+  if (Trace && (AsciiName != NULL)) {\r
     HighLight = GetColourHighlighting ();\r
 \r
     if (HighLight) {\r
       OriginalAttribute = gST->ConOut->Mode->Attribute;\r
       gST->ConOut->SetAttribute (\r
                      gST->ConOut,\r
-                     EFI_TEXT_ATTR(EFI_YELLOW,\r
-                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))\r
+                     EFI_TEXT_ATTR (\r
+                       EFI_YELLOW,\r
+                       ((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)\r
+                       )\r
                      );\r
     }\r
+\r
     Print (\r
       L"%*a%-*a :\n",\r
       gIndent,\r
@@ -544,7 +555,6 @@ ParseAcpi (
 \r
   for (Index = 0; Index < ParserItems; Index++) {\r
     if ((Offset + Parser[Index].Length) > Length) {\r
-\r
       // For fields outside the buffer length provided, reset any pointers\r
       // which were supposed to be updated by this function call\r
       if (Parser[Index].ItemPtr != NULL) {\r
@@ -556,11 +566,12 @@ ParseAcpi (
     }\r
 \r
     if (GetConsistencyChecking () &&\r
-        (Offset != Parser[Index].Offset)) {\r
+        (Offset != Parser[Index].Offset))\r
+    {\r
       IncrementErrorCount ();\r
       Print (\r
         L"\nERROR: %a: Offset Mismatch for %s\n"\r
-          L"CurrentOffset = %d FieldOffset = %d\n",\r
+        L"CurrentOffset = %d FieldOffset = %d\n",\r
         AsciiName,\r
         Parser[Index].NameStr,\r
         Offset,\r
@@ -597,20 +608,23 @@ ParseAcpi (
               );\r
         } // switch\r
       }\r
+\r
       // Validating only makes sense if we are tracing\r
       // the parsed table entries, to report by table name.\r
       if (GetConsistencyChecking () &&\r
-          (Parser[Index].FieldValidator != NULL)) {\r
+          (Parser[Index].FieldValidator != NULL))\r
+      {\r
         Parser[Index].FieldValidator (Ptr, Parser[Index].Context);\r
       }\r
+\r
       Print (L"\n");\r
     } // if (Trace)\r
 \r
     if (Parser[Index].ItemPtr != NULL) {\r
-      *Parser[Index].ItemPtr = (VOID*)Ptr;\r
+      *Parser[Index].ItemPtr = (VOID *)Ptr;\r
     }\r
 \r
-    Ptr += Parser[Index].Length;\r
+    Ptr    += Parser[Index].Length;\r
     Offset += Parser[Index].Length;\r
   } // for\r
 \r
@@ -624,12 +638,12 @@ ParseAcpi (
   The GasParser array is used by the ParseAcpi function to parse and/or trace\r
   the GAS structure.\r
 **/\r
-STATIC CONST ACPI_PARSER GasParser[] = {\r
-  {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}\r
+STATIC CONST ACPI_PARSER  GasParser[] = {\r
+  { L"Address Space ID",    1, 0, L"0x%x",  NULL, NULL, NULL, NULL },\r
+  { L"Register Bit Width",  1, 1, L"0x%x",  NULL, NULL, NULL, NULL },\r
+  { L"Register Bit Offset", 1, 2, L"0x%x",  NULL, NULL, NULL, NULL },\r
+  { L"Access Size",         1, 3, L"0x%x",  NULL, NULL, NULL, NULL },\r
+  { L"Address",             8, 4, L"0x%lx", NULL, NULL, NULL, NULL }\r
 };\r
 \r
 /**\r
@@ -644,9 +658,9 @@ STATIC CONST ACPI_PARSER GasParser[] = {
 UINT32\r
 EFIAPI\r
 DumpGasStruct (\r
-  IN UINT8*        Ptr,\r
-  IN UINT32        Indent,\r
-  IN UINT32        Length\r
+  IN UINT8   *Ptr,\r
+  IN UINT32  Indent,\r
+  IN UINT32  Length\r
   )\r
 {\r
   Print (L"\n");\r
@@ -669,8 +683,8 @@ DumpGasStruct (
 VOID\r
 EFIAPI\r
 DumpGas (\r
-  IN CONST CHAR16Format OPTIONAL,\r
-  IN UINT8*        Ptr\r
+  IN CONST CHAR16  *Format OPTIONAL,\r
+  IN UINT8         *Ptr\r
   )\r
 {\r
   DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));\r
@@ -686,7 +700,7 @@ DumpGas (
 UINT32\r
 EFIAPI\r
 DumpAcpiHeader (\r
-  IN UINT8Ptr\r
+  IN UINT8  *Ptr\r
   )\r
 {\r
   return ParseAcpi (\r
@@ -715,13 +729,13 @@ DumpAcpiHeader (
 UINT32\r
 EFIAPI\r
 ParseAcpiHeader (\r
-  IN  UINT8*         Ptr,\r
-  OUT CONST UINT32** Signature,\r
-  OUT CONST UINT32** Length,\r
-  OUT CONST UINT8**  Revision\r
+  IN  UINT8         *Ptr,\r
+  OUT CONST UINT32  **Signature,\r
+  OUT CONST UINT32  **Length,\r
+  OUT CONST UINT8   **Revision\r
   )\r
 {\r
-  UINT32                        BytesParsed;\r
+  UINT32  BytesParsed;\r
 \r
   BytesParsed = ParseAcpi (\r
                   FALSE,\r
@@ -733,8 +747,8 @@ ParseAcpiHeader (
                   );\r
 \r
   *Signature = AcpiHdrInfo.Signature;\r
-  *Length = AcpiHdrInfo.Length;\r
-  *Revision = AcpiHdrInfo.Revision;\r
+  *Length    = AcpiHdrInfo.Length;\r
+  *Revision  = AcpiHdrInfo.Revision;\r
 \r
   return BytesParsed;\r
 }\r