/** @file\r
GTDT table parser\r
\r
- Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.\r
+ Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
@par Reference(s):\r
IN VOID* Context\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
/**\r
An ACPI_PARSER array describing the ACPI GTDT Table.\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, NULL, NULL},\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
}\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