]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / Parsers / Gtdt / GtdtParser.c
index d00eaafe60a5beba7ca8b833766fdfda98760cf7..e62927098a010a0e1dad8361dcfc6559d32dcebf 100644 (file)
 #include "AcpiViewConfig.h"\r
 \r
 // "The number of GT Block Timers must be less than or equal to 8"\r
-#define GT_BLOCK_TIMER_COUNT_MAX 8\r
+#define GT_BLOCK_TIMER_COUNT_MAX  8\r
 \r
 // Local variables\r
-STATIC CONST UINT32GtdtPlatformTimerCount;\r
-STATIC CONST UINT32GtdtPlatformTimerOffset;\r
-STATIC CONST UINT8*  PlatformTimerType;\r
-STATIC CONST UINT16PlatformTimerLength;\r
-STATIC CONST UINT32GtBlockTimerCount;\r
-STATIC CONST UINT32GtBlockTimerOffset;\r
-STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;\r
+STATIC CONST UINT32                  *GtdtPlatformTimerCount;\r
+STATIC CONST UINT32                  *GtdtPlatformTimerOffset;\r
+STATIC CONST UINT8                   *PlatformTimerType;\r
+STATIC CONST UINT16                  *PlatformTimerLength;\r
+STATIC CONST UINT32                  *GtBlockTimerCount;\r
+STATIC CONST UINT32                  *GtBlockTimerOffset;\r
+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;\r
 \r
 /**\r
   This function validates the GT Block timer count.\r
@@ -37,13 +37,13 @@ STATIC
 VOID\r
 EFIAPI\r
 ValidateGtBlockTimerCount (\r
-  IN UINT8Ptr,\r
-  IN VOID*  Context\r
+  IN UINT8  *Ptr,\r
+  IN VOID   *Context\r
   )\r
 {\r
-  UINT32 BlockTimerCount;\r
+  UINT32  BlockTimerCount;\r
 \r
-  BlockTimerCount = *(UINT32*)Ptr;\r
+  BlockTimerCount = *(UINT32 *)Ptr;\r
 \r
   if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {\r
     IncrementErrorCount ();\r
@@ -66,13 +66,13 @@ STATIC
 VOID\r
 EFIAPI\r
 ValidateGtFrameNumber (\r
-  IN UINT8Ptr,\r
-  IN VOID*  Context\r
+  IN UINT8  *Ptr,\r
+  IN VOID   *Context\r
   )\r
 {\r
-  UINT8 FrameNumber;\r
+  UINT8  FrameNumber;\r
 \r
-  FrameNumber = *(UINT8*)Ptr;\r
+  FrameNumber = *(UINT8 *)Ptr;\r
 \r
   if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {\r
     IncrementErrorCount ();\r
@@ -87,82 +87,82 @@ ValidateGtFrameNumber (
 /**\r
   An ACPI_PARSER array describing the ACPI GTDT Table.\r
 **/\r
-STATIC CONST ACPI_PARSER GtdtParser[] = {\r
+STATIC CONST ACPI_PARSER  GtdtParser[] = {\r
   PARSE_ACPI_HEADER (&AcpiHdrInfo),\r
-  {L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL,\r
-   NULL, NULL},\r
-  {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},\r
-\r
-  {L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},\r
-\r
-  {L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},\r
-\r
-  {L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},\r
-\r
-  {L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},\r
-  {L"Platform Timer Count", 4, 88, L"%d", NULL,\r
-   (VOID**)&GtdtPlatformTimerCount, NULL, NULL},\r
-  {L"Platform Timer Offset", 4, 92, L"0x%x", NULL,\r
-   (VOID**)&GtdtPlatformTimerOffset, NULL, NULL},\r
-  {L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}\r
+  { L"CntControlBase Physical Address",8,      36,  L"0x%lx", NULL, NULL,\r
+    NULL,                             NULL },\r
+  { L"Reserved",                      4,      44,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Secure EL1 timer GSIV",         4,      48,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Secure EL1 timer FLAGS",        4,      52,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+\r
+  { L"Non-Secure EL1 timer GSIV",     4,      56,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Non-Secure EL1 timer FLAGS",    4,      60,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+\r
+  { L"Virtual timer GSIV",            4,      64,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Virtual timer FLAGS",           4,      68,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+\r
+  { L"Non-Secure EL2 timer GSIV",     4,      72,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Non-Secure EL2 timer FLAGS",    4,      76,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+\r
+  { L"CntReadBase Physical address",  8,      80,  L"0x%lx", NULL, NULL,NULL,  NULL },\r
+  { L"Platform Timer Count",          4,      88,  L"%d",    NULL,\r
+    (VOID **)&GtdtPlatformTimerCount, NULL,   NULL },\r
+  { L"Platform Timer Offset",         4,      92,  L"0x%x",  NULL,\r
+    (VOID **)&GtdtPlatformTimerOffset,NULL,   NULL },\r
+  { L"Virtual EL2 Timer GSIV",        4,      96,  L"0x%x",  NULL, NULL,NULL,  NULL },\r
+  { L"Virtual EL2 Timer Flags",       4,      100, L"0x%x",  NULL, NULL,NULL,  NULL }\r
 };\r
 \r
 /**\r
   An ACPI_PARSER array describing the Platform timer header.\r
 **/\r
-STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = {\r
-  {L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL},\r
-  {L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL},\r
-  {L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL}\r
+STATIC CONST ACPI_PARSER  GtPlatformTimerHeaderParser[] = {\r
+  { L"Type",     1, 0, NULL, NULL, (VOID **)&PlatformTimerType,   NULL, NULL },\r
+  { L"Length",   2, 1, NULL, NULL, (VOID **)&PlatformTimerLength, NULL, NULL },\r
+  { L"Reserved", 1, 3, NULL, NULL, NULL,                          NULL, NULL }\r
 };\r
 \r
 /**\r
   An ACPI_PARSER array describing the Platform GT Block.\r
 **/\r
-STATIC CONST ACPI_PARSER GtBlockParser[] = {\r
-  {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},\r
-  {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},\r
-  {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},\r
-  {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},\r
-  {L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount,\r
-   ValidateGtBlockTimerCount, NULL},\r
-  {L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL,\r
-    NULL}\r
+STATIC CONST ACPI_PARSER  GtBlockParser[] = {\r
+  { L"Type",                          1, 0,  L"%d",    NULL, NULL,                         NULL, NULL },\r
+  { L"Length",                        2, 1,  L"%d",    NULL, NULL,                         NULL, NULL },\r
+  { L"Reserved",                      1, 3,  L"%x",    NULL, NULL,                         NULL, NULL },\r
+  { L"Physical address (CntCtlBase)", 8, 4,  L"0x%lx", NULL, NULL,                         NULL, NULL },\r
+  { L"Timer Count",                   4, 12, L"%d",    NULL, (VOID **)&GtBlockTimerCount,\r
+    ValidateGtBlockTimerCount, NULL },\r
+  { L"Timer Offset",                  4, 16, L"%d",    NULL, (VOID **)&GtBlockTimerOffset, NULL,\r
+    NULL }\r
 };\r
 \r
 /**\r
   An ACPI_PARSER array describing the GT Block timer.\r
 **/\r
-STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {\r
-  {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL},\r
-  {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},\r
-  {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},\r
-  {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,\r
-    NULL},\r
-  {L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}\r
+STATIC CONST ACPI_PARSER  GtBlockTimerParser[] = {\r
+  { L"Frame Number",                   1, 0,  L"%d",       NULL,       NULL, ValidateGtFrameNumber, NULL },\r
+  { L"Reserved",                       3, 1,  L"%x %x %x", Dump3Chars, NULL, NULL,                  NULL },\r
+  { L"Physical address (CntBaseX)",    8, 4,  L"0x%lx",    NULL,       NULL, NULL,                  NULL },\r
+  { L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx",    NULL,       NULL, NULL,\r
+    NULL },\r
+  { L"Physical Timer GSIV",            4, 20, L"0x%x",     NULL,       NULL, NULL,                  NULL },\r
+  { L"Physical Timer Flags",           4, 24, L"0x%x",     NULL,       NULL, NULL,                  NULL },\r
+  { L"Virtual Timer GSIV",             4, 28, L"0x%x",     NULL,       NULL, NULL,                  NULL },\r
+  { L"Virtual Timer Flags",            4, 32, L"0x%x",     NULL,       NULL, NULL,                  NULL },\r
+  { L"Common Flags",                   4, 36, L"0x%x",     NULL,       NULL, NULL,                  NULL }\r
 };\r
 \r
 /**\r
   An ACPI_PARSER array describing the Platform Watchdog.\r
 **/\r
-STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {\r
-  {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},\r
-  {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},\r
-  {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},\r
-  {L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},\r
-  {L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},\r
-  {L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},\r
-  {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}\r
+STATIC CONST ACPI_PARSER  ArmGenericWatchdogParser[] = {\r
+  { L"Type",                          1, 0,  L"%d",    NULL, NULL, NULL, NULL },\r
+  { L"Length",                        2, 1,  L"%d",    NULL, NULL, NULL, NULL },\r
+  { L"Reserved",                      1, 3,  L"%x",    NULL, NULL, NULL, NULL },\r
+  { L"RefreshFrame Physical address", 8, 4,  L"0x%lx", NULL, NULL, NULL, NULL },\r
+  { L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL },\r
+  { L"Watchdog Timer GSIV",           4, 20, L"0x%x",  NULL, NULL, NULL, NULL },\r
+  { L"Watchdog Timer Flags",          4, 24, L"0x%x",  NULL, NULL, NULL, NULL }\r
 };\r
 \r
 /**\r
@@ -174,12 +174,12 @@ STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
 STATIC\r
 VOID\r
 DumpGTBlock (\r
-  IN UINT8Ptr,\r
-  IN UINT16 Length\r
+  IN UINT8   *Ptr,\r
+  IN UINT16  Length\r
   )\r
 {\r
-  UINT32 Index;\r
-  UINT32 Offset;\r
+  UINT32  Index;\r
+  UINT32  Offset;\r
 \r
   ParseAcpi (\r
     TRUE,\r
@@ -193,7 +193,8 @@ DumpGTBlock (
   // Check if the values used to control the parsing logic have been\r
   // successfully read.\r
   if ((GtBlockTimerCount == NULL) ||\r
-      (GtBlockTimerOffset == NULL)) {\r
+      (GtBlockTimerOffset == NULL))\r
+  {\r
     IncrementErrorCount ();\r
     Print (\r
       L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",\r
@@ -203,12 +204,13 @@ DumpGTBlock (
   }\r
 \r
   Offset = *GtBlockTimerOffset;\r
-  Index = 0;\r
+  Index  = 0;\r
 \r
   // Parse the specified number of GT Block Timer Structures or the GT Block\r
   // Structure buffer length. Whichever is minimum.\r
   while ((Index++ < *GtBlockTimerCount) &&\r
-         (Offset < Length)) {\r
+         (Offset < Length))\r
+  {\r
     Offset += ParseAcpi (\r
                 TRUE,\r
                 2,\r
@@ -229,8 +231,8 @@ DumpGTBlock (
 STATIC\r
 VOID\r
 DumpWatchdogTimer (\r
-  IN UINT8Ptr,\r
-  IN UINT16 Length\r
+  IN UINT8   *Ptr,\r
+  IN UINT16  Length\r
   )\r
 {\r
   ParseAcpi (\r
@@ -262,15 +264,15 @@ DumpWatchdogTimer (
 VOID\r
 EFIAPI\r
 ParseAcpiGtdt (\r
-  IN BOOLEAN Trace,\r
-  IN UINT8*  Ptr,\r
-  IN UINT32  AcpiTableLength,\r
-  IN UINT8   AcpiTableRevision\r
+  IN BOOLEAN  Trace,\r
+  IN UINT8    *Ptr,\r
+  IN UINT32   AcpiTableLength,\r
+  IN UINT8    AcpiTableRevision\r
   )\r
 {\r
-  UINT32 Index;\r
-  UINT32 Offset;\r
-  UINT8TimerPtr;\r
+  UINT32  Index;\r
+  UINT32  Offset;\r
+  UINT8   *TimerPtr;\r
 \r
   if (!Trace) {\r
     return;\r
@@ -288,7 +290,8 @@ ParseAcpiGtdt (
   // Check if the values used to control the parsing logic have been\r
   // successfully read.\r
   if ((GtdtPlatformTimerCount == NULL) ||\r
-      (GtdtPlatformTimerOffset == NULL)) {\r
+      (GtdtPlatformTimerOffset == NULL))\r
+  {\r
     IncrementErrorCount ();\r
     Print (\r
       L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",\r
@@ -298,13 +301,14 @@ ParseAcpiGtdt (
   }\r
 \r
   TimerPtr = Ptr + *GtdtPlatformTimerOffset;\r
-  Offset = *GtdtPlatformTimerOffset;\r
-  Index = 0;\r
+  Offset   = *GtdtPlatformTimerOffset;\r
+  Index    = 0;\r
 \r
   // Parse the specified number of Platform Timer Structures or the GTDT\r
   // buffer length. Whichever is minimum.\r
   while ((Index++ < *GtdtPlatformTimerCount) &&\r
-         (Offset < AcpiTableLength)) {\r
+         (Offset < AcpiTableLength))\r
+  {\r
     // Parse the Platform Timer Header to obtain Length and Type\r
     ParseAcpi (\r
       FALSE,\r
@@ -318,11 +322,12 @@ ParseAcpiGtdt (
     // Check if the values used to control the parsing logic have been\r
     // successfully read.\r
     if ((PlatformTimerType == NULL) ||\r
-        (PlatformTimerLength == NULL)) {\r
+        (PlatformTimerLength == NULL))\r
+    {\r
       IncrementErrorCount ();\r
       Print (\r
         L"ERROR: Insufficient remaining table buffer length to read the " \\r
-          L"Platform Timer Structure header. Length = %d.\n",\r
+        L"Platform Timer Structure header. Length = %d.\n",\r
         AcpiTableLength - Offset\r
         );\r
       return;\r
@@ -330,11 +335,12 @@ ParseAcpiGtdt (
 \r
     // Validate Platform Timer Structure length\r
     if ((*PlatformTimerLength == 0) ||\r
-        ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {\r
+        ((Offset + (*PlatformTimerLength)) > AcpiTableLength))\r
+    {\r
       IncrementErrorCount ();\r
       Print (\r
         L"ERROR: Invalid Platform Timer Structure length. " \\r
-          L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",\r
+        L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",\r
         *PlatformTimerLength,\r
         Offset,\r
         AcpiTableLength\r
@@ -359,6 +365,6 @@ ParseAcpiGtdt (
     } // switch\r
 \r
     TimerPtr += *PlatformTimerLength;\r
-    Offset += *PlatformTimerLength;\r
+    Offset   += *PlatformTimerLength;\r
   } // while\r
 }\r