summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2019-05-16 01:43:35 -0700
committerJaben Carsey <jaben.carsey@intel.com>2019-05-17 08:09:21 -0700
commit8da8daafc9055ce83804fcc65d0f4cf01b2ca6fe (patch)
tree8a5bd51c8f4e55f4743c385bf82a884a5870fa48 /ShellPkg
parentfb5573b83007bb2f2b4b5b1cacbf4e1a5714b9fd (diff)
downloadedk2-8da8daafc9055ce83804fcc65d0f4cf01b2ca6fe.zip
edk2-8da8daafc9055ce83804fcc65d0f4cf01b2ca6fe.tar.gz
edk2-8da8daafc9055ce83804fcc65d0f4cf01b2ca6fe.tar.bz2
ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser
The ACPI 6.2 specification mandates that the Generic Timer (GT) Block Timer Structures must have a frame number in the range 0-7. Update the GTDT parser to warn if this condition is violated. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index f31c4a2..1b7e564 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -1,7 +1,7 @@
/** @file
GTDT table parser
- Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -39,6 +39,21 @@ ValidateGtBlockTimerCount (
);
/**
+ This function validates the GT Frame Number.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateGtFrameNumber (
+ IN UINT8* Ptr,
+ IN VOID* Context
+ );
+
+/**
An ACPI_PARSER array describing the ACPI GTDT Table.
**/
STATIC CONST ACPI_PARSER GtdtParser[] = {
@@ -92,7 +107,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] = {
An ACPI_PARSER array describing the GT Block timer.
**/
STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
- {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL},
+ {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL},
{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
{L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,
@@ -146,6 +161,34 @@ ValidateGtBlockTimerCount (
}
/**
+ This function validates the GT Frame Number.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateGtFrameNumber (
+ IN UINT8* Ptr,
+ IN VOID* Context
+ )
+{
+ UINT8 FrameNumber;
+
+ FrameNumber = *(UINT8*)Ptr;
+
+ if (FrameNumber > 7) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: GT Frame Number = %d. GT Frame Number must be in range 0-7.",
+ FrameNumber
+ );
+ }
+}
+
+/**
This function parses the Platform GT Block.
@param [in] Ptr Pointer to the start of the GT Block data.