]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
ShellPkg: acpiview: GTDT: Remove redundant forward declarations
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / Parsers / Gtdt / GtdtParser.c
index 3b05ff3015d4a3af62dd9fab057c32369a456267..1e5b5764f50a2d29aa904c889bc89af5bdc3af5c 100644 (file)
@@ -13,6 +13,9 @@
 #include "AcpiParser.h"\r
 #include "AcpiTableParser.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
+\r
 // Local variables\r
 STATIC CONST UINT32* GtdtPlatformTimerCount;\r
 STATIC CONST UINT32* GtdtPlatformTimerOffset;\r
@@ -36,7 +39,21 @@ EFIAPI
 ValidateGtBlockTimerCount (\r
   IN UINT8* Ptr,\r
   IN VOID*  Context\r
-  );\r
+  )\r
+{\r
+  UINT32 BlockTimerCount;\r
+\r
+  BlockTimerCount = *(UINT32*)Ptr;\r
+\r
+  if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {\r
+    IncrementErrorCount ();\r
+    Print (\r
+      L"\nERROR: Timer Count = %d. Max Timer Count is %d.",\r
+      BlockTimerCount,\r
+      GT_BLOCK_TIMER_COUNT_MAX\r
+      );\r
+  }\r
+}\r
 \r
 /**\r
   This function validates the GT Frame Number.\r
@@ -51,7 +68,21 @@ EFIAPI
 ValidateGtFrameNumber (\r
   IN UINT8* Ptr,\r
   IN VOID*  Context\r
-  );\r
+  )\r
+{\r
+  UINT8 FrameNumber;\r
+\r
+  FrameNumber = *(UINT8*)Ptr;\r
+\r
+  if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {\r
+    IncrementErrorCount ();\r
+    Print (\r
+      L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-%d.",\r
+      FrameNumber,\r
+      GT_BLOCK_TIMER_COUNT_MAX - 1\r
+      );\r
+  }\r
+}\r
 \r
 /**\r
   An ACPI_PARSER array describing the ACPI GTDT Table.\r
@@ -134,62 +165,6 @@ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = {
   {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}\r
 };\r
 \r
-/**\r
-  This function validates the GT Block timer count.\r
-\r
-  @param [in] Ptr     Pointer to the start of the field data.\r
-  @param [in] Context Pointer to context specific information e.g. this\r
-                      could be a pointer to the ACPI table header.\r
-**/\r
-STATIC\r
-VOID\r
-EFIAPI\r
-ValidateGtBlockTimerCount (\r
-  IN UINT8* Ptr,\r
-  IN VOID*  Context\r
-  )\r
-{\r
-  UINT32 BlockTimerCount;\r
-\r
-  BlockTimerCount = *(UINT32*)Ptr;\r
-\r
-  if (BlockTimerCount > 8) {\r
-    IncrementErrorCount ();\r
-    Print (\r
-      L"\nERROR: Timer Count = %d. Max Timer Count is 8.",\r
-      BlockTimerCount\r
-      );\r
-  }\r
-}\r
-\r
-/**\r
-  This function validates the GT Frame Number.\r
-\r
-  @param [in] Ptr     Pointer to the start of the field data.\r
-  @param [in] Context Pointer to context specific information e.g. this\r
-                      could be a pointer to the ACPI table header.\r
-**/\r
-STATIC\r
-VOID\r
-EFIAPI\r
-ValidateGtFrameNumber (\r
-  IN UINT8* Ptr,\r
-  IN VOID*  Context\r
-  )\r
-{\r
-  UINT8 FrameNumber;\r
-\r
-  FrameNumber = *(UINT8*)Ptr;\r
-\r
-  if (FrameNumber > 7) {\r
-    IncrementErrorCount ();\r
-    Print (\r
-      L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-7.",\r
-      FrameNumber\r
-      );\r
-  }\r
-}\r
-\r
 /**\r
   This function parses the Platform GT Block.\r
 \r