diff options
author | Sami Mujawar <sami.mujawar@arm.com> | 2022-07-14 17:50:26 +0100 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-07-29 19:22:15 +0000 |
commit | f5cea604a6df84e186f78e00f5863f15e3fe8a37 (patch) | |
tree | be7b22528cdbe9f5b8ae1f548e35c89428b4edb7 /DynamicTablesPkg/Library/Acpi/Arm | |
parent | 65c4f3f2be30b01b48b5123ac84f84f9b91e8d4d (diff) | |
download | edk2-f5cea604a6df84e186f78e00f5863f15e3fe8a37.zip edk2-f5cea604a6df84e186f78e00f5863f15e3fe8a37.tar.gz edk2-f5cea604a6df84e186f78e00f5863f15e3fe8a37.tar.bz2 |
DynamicTablesPkg: IORT set reference to Id array only if present
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>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Diffstat (limited to 'DynamicTablesPkg/Library/Acpi/Arm')
-rw-r--r-- | DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index daf9ff0..a4dd3d4 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -876,9 +876,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;
@@ -1007,7 +1007,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;
@@ -1188,11 +1189,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;
@@ -1360,8 +1362,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;
@@ -1491,7 +1493,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;
|