From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <Alexei.Fedorov@arm.com>,
<Matteo.Carlini@arm.com>, <Ben.Adderson@arm.com>, <nd@arm.com>
Subject: [PATCH v2 5/8] DynamicTablesPkg: IORT set reference to Id array only if present
Date: Thu, 17 Jun 2021 10:55:34 +0100 [thread overview]
Message-ID: <20210617095538.93280-6-sami.mujawar@arm.com> (raw)
In-Reply-To: <20210617095538.93280-1-sami.mujawar@arm.com>
The IORT table generator is setting up a reference to ID array for
nodes even when the ID Mapping count is zero. This is not an issue as an
OS would only access the ID Reference if the ID mapping count is not zero.
However, it would be good to set the reference to ID array to zero when
the ID Mapping count is zero rather than populating it with an incorrect
value.
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
Notes:
v2:
- No code change since v1. Re-sending with v2 series. [SAMI]
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 29 +++++++++++---------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 349caa8006bc34ca789cb3e321a0f87c0cd4ff0d..bdf839eab25e2b84b40c50da38f2bf961cdc5f42 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -1,7 +1,7 @@
/** @file
IORT Table Generator
- Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -870,9 +870,9 @@ AddNamedComponentNodes (
NcNode->Node.NumIdMappings = NodeList->IdMappingCount;
ObjectNameLength = AsciiStrLen (NodeList->ObjectName) + 1;
- NcNode->Node.IdReference =
- (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
- (ALIGN_VALUE (ObjectNameLength, 4)));
+ NcNode->Node.IdReference = (NodeList->IdMappingCount == 0) ?
+ 0 : ((UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
+ (ALIGN_VALUE (ObjectNameLength, 4))));
// Named Component specific data
NcNode->Flags = NodeList->Flags;
@@ -990,7 +990,8 @@ AddRootComplexNodes (
RcNode->Node.Revision = 1;
RcNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
RcNode->Node.NumIdMappings = NodeList->IdMappingCount;
- RcNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE);
+ RcNode->Node.IdReference = (NodeList->IdMappingCount == 0) ?
+ 0 : sizeof (EFI_ACPI_6_0_IO_REMAPPING_RC_NODE);
// Root Complex specific data
RcNode->CacheCoherent = NodeList->CacheCoherent;
@@ -1160,11 +1161,12 @@ AddSmmuV1V2Nodes (
SmmuNode->Node.Revision = 0;
SmmuNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
SmmuNode->Node.NumIdMappings = NodeList->IdMappingCount;
- SmmuNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE) +
- (NodeList->ContextInterruptCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)) +
- (NodeList->PmuInterruptCount *
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT));
+ SmmuNode->Node.IdReference = (NodeList->IdMappingCount == 0) ?
+ 0 : (sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE) +
+ (NodeList->ContextInterruptCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)) +
+ (NodeList->PmuInterruptCount *
+ sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)));
// SMMU v1/v2 specific data
SmmuNode->Base = NodeList->BaseAddress;
@@ -1319,8 +1321,8 @@ AddSmmuV3Nodes (
SmmuV3Node->Node.Revision = 2;
SmmuV3Node->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
SmmuV3Node->Node.NumIdMappings = NodeList->IdMappingCount;
- SmmuV3Node->Node.IdReference =
- sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE);
+ SmmuV3Node->Node.IdReference = (NodeList->IdMappingCount == 0) ?
+ 0 : sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU3_NODE);
// SMMUv3 specific data
SmmuV3Node->Base = NodeList->BaseAddress;
@@ -1438,7 +1440,8 @@ AddPmcgNodes (
PmcgNode->Node.Revision = 1;
PmcgNode->Node.Reserved = EFI_ACPI_RESERVED_DWORD;
PmcgNode->Node.NumIdMappings = NodeList->IdMappingCount;
- PmcgNode->Node.IdReference = sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE);
+ PmcgNode->Node.IdReference = (NodeList->IdMappingCount == 0) ?
+ 0 : sizeof (EFI_ACPI_6_0_IO_REMAPPING_PMCG_NODE);
// PMCG specific data
PmcgNode->Base = NodeList->BaseAddress;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
next prev parent reply other threads:[~2021-06-17 9:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 9:55 [PATCH v2 0/8] IORT Rev E.b specification updates Sami Mujawar
2021-06-17 9:55 ` [PATCH v2 1/8] MdePkg: Fix IORT header file include guard Sami Mujawar
2021-06-17 18:19 ` Michael D Kinney
2021-06-21 11:08 ` [edk2-devel] " Sami Mujawar
2021-06-17 9:55 ` [PATCH v2 2/8] MdePkg: IORT header update for IORT Rev E.b spec Sami Mujawar
2021-06-28 7:53 ` Gao, Zhichao
2021-10-15 14:45 ` [edk2-devel] " PierreGondois
2021-06-17 9:55 ` [PATCH v2 3/8] ShellPkg: Acpiview: Abbreviate field names to preserve alignment Sami Mujawar
2021-06-28 7:53 ` Gao, Zhichao
2021-10-15 13:33 ` [edk2-devel] " PierreGondois
2021-06-17 9:55 ` [PATCH v2 4/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.b spec Sami Mujawar
2021-06-28 7:53 ` Gao, Zhichao
2021-06-17 9:55 ` Sami Mujawar [this message]
2021-10-15 15:22 ` [edk2-devel] [PATCH v2 5/8] DynamicTablesPkg: IORT set reference to Id array only if present PierreGondois
2021-06-17 9:55 ` [PATCH v2 6/8] DynamicTablesPkg: IORT set reference to interrupt array " Sami Mujawar
2021-10-18 15:48 ` [edk2-devel] " PierreGondois
2021-06-17 9:55 ` [PATCH v2 7/8] DynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.b Sami Mujawar
2021-10-18 15:59 ` [edk2-devel] " PierreGondois
2021-10-18 16:00 ` PierreGondois
2021-06-17 9:55 ` [PATCH v2 8/8] DynamicTablesPkg: IORT generator updates for Rev E.b spec Sami Mujawar
2021-10-18 16:17 ` [edk2-devel] " PierreGondois
2021-06-18 0:49 ` 回复: [edk2-devel] [PATCH v2 0/8] IORT Rev E.b specification updates gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210617095538.93280-6-sami.mujawar@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox