[edk2-devel] [PATCH v2-resend 1/2] ShellPkg/AcpiView: Fix field validator invocation

Sami Mujawar sami.mujawar at arm.com
Wed Nov 4 12:33:12 UTC 2020


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 at arm.com>
---

Notes:
    v2:
     - This is a new patch introduced in v2 series.                 [SAMI]

 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#66991): https://edk2.groups.io/g/devel/message/66991
Mute This Topic: https://groups.io/mt/78027603/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list