]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
ShellPkg/acpiview: GTDT updates for ACPI 6.3
[mirror_edk2.git] / ShellPkg / Library / UefiShellAcpiViewCommandLib / Parsers / Gtdt / GtdtParser.c
index 0ab460b02c9e062ac181e42e7e77f875a40c86dc..3b05ff3015d4a3af62dd9fab057c32369a456267 100644 (file)
@@ -1,17 +1,11 @@
 /** @file\r
   GTDT table parser\r
 \r
-  Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
   @par Reference(s):\r
-    - ACPI 6.2 Specification - Errata A, September 2017\r
+    - ACPI 6.3 Specification - January 2019\r
   **/\r
 \r
 #include <IndustryStandard/Acpi.h>\r
@@ -44,6 +38,21 @@ ValidateGtBlockTimerCount (
   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
@@ -68,7 +77,9 @@ STATIC CONST ACPI_PARSER GtdtParser[] = {
   {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
+   (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
@@ -98,7 +109,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] = {
   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
@@ -151,6 +162,34 @@ ValidateGtBlockTimerCount (
   }\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