summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Koch <krzysztof.koch@arm.com>2019-07-22 15:50:26 -0700
committerJaben Carsey <jaben.carsey@intel.com>2019-07-31 09:53:00 -0700
commit05f8e85fa7d83222310e471c9a43a6d2ab532c95 (patch)
treed7c7f14126b9e846b915d6705e2e45305feaea98
parentd23bf7973491938d479bef5535c9017dc9065e58 (diff)
downloadedk2-05f8e85fa7d83222310e471c9a43a6d2ab532c95.tar.gz
edk2-05f8e85fa7d83222310e471c9a43a6d2ab532c95.tar.bz2
edk2-05f8e85fa7d83222310e471c9a43a6d2ab532c95.zip
ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation
Move Performance Monitoring Counter Group (PMCG) node ID mapping count validation from the core IORT acpiview parser logic to a dedicated function. Now, the pointer to the validation function is passed to the IortNodePmcgParser[] ACPI_PARSER array. This check does not affect the flow of IORT parsing and is limited to a single table field in scope, therefore, it is better to keep it away from the code responsible for traversing the table. Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
index 0461205b4f..7c850b3813 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -54,6 +54,28 @@ ValidateItsIdMappingCount (
}
/**
+ This function validates the ID Mapping array count for the Performance
+ Monitoring Counter Group (PMCG) node.
+
+ @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
+ValidatePmcgIdMappingCount (
+ IN UINT8* Ptr,
+ IN VOID* Context
+ )
+{
+ if (*(UINT32*)Ptr > 1) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: IORT ID Mapping count must not be greater than 1.");
+ }
+}
+
+/**
This function validates the ID Mapping array offset for the ITS node.
@param [in] Ptr Pointer to the start of the field data.
@@ -216,7 +238,7 @@ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
An ACPI_PARSER array describing the IORT PMCG node.
**/
STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
- PARSE_IORT_NODE_HEADER (NULL, NULL),
+ PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
{L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
{L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},
@@ -537,14 +559,6 @@ DumpIortNodePmcg (
if (*IortIdMappingCount != 0) {
DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset);
}
-
- if (*IortIdMappingCount > 1) {
- IncrementErrorCount ();
- Print (
- L"ERROR: ID mapping must not be greater than 1. Id Mapping Count =%d\n",
- *IortIdMappingCount
- );
- }
}
/**