]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/AcpiView: Fix field validator invocation
authorSami Mujawar <sami.mujawar@arm.com>
Thu, 24 Sep 2020 09:51:34 +0000 (10:51 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 11 Dec 2020 02:21:23 +0000 (02:21 +0000)
Bugzilla: 3046 (https://bugzilla.tianocore.org/show_bug.cgi?id=3046)

The field validator function provides means to validate fields
in the ACPI table structures. To print complex field types a
print formatter function is provided.

The field validator was being invoked for simple data fields
for which the default print format is used. However, the field
validator function was not invoked if a print formatter function
was provided.

This problem is noticed when a Generic Address Structure (GAS)
is printed using DumpGas() and a field validator is present
to validate the GAS structure.

To fix this move the invocation of the field validator after
the field is printed such that the validation function is
called even when a print formatter function is present.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c

index 02f6d771c7e1a9b8faa577b38e51c9de350d24fd..01ac9a9bafeb2ca12c1ba19f406d626b108f5fe2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ACPI parser\r
 \r
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.\r
+  Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
@@ -596,13 +596,12 @@ ParseAcpi (
               Parser[Index].Length\r
               );\r
         } // switch\r
-\r
-        // Validating only makes sense if we are tracing\r
-        // the parsed table entries, to report by table name.\r
-        if (GetConsistencyChecking () &&\r
-            (Parser[Index].FieldValidator != NULL)) {\r
-          Parser[Index].FieldValidator (Ptr, Parser[Index].Context);\r
-        }\r
+      }\r
+      // Validating only makes sense if we are tracing\r
+      // the parsed table entries, to report by table name.\r
+      if (GetConsistencyChecking () &&\r
+          (Parser[Index].FieldValidator != NULL)) {\r
+        Parser[Index].FieldValidator (Ptr, Parser[Index].Context);\r
       }\r
       Print (L"\n");\r
     } // if (Trace)\r