[PATCH 4/5] acpi: Conditionally set mapping_offset in IORT
Patrick Rudolph
patrick.rudolph at 9elements.com
Sun Mar 16 09:32:55 CET 2025
The spec recommends to set the mapping_offset only when there are
ID mappings as indicated by the mapping_count field.
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
---
lib/acpi/acpi_table.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index fc43862ec37..4ad1f56e961 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -649,7 +649,9 @@ int acpi_iort_add_rc(struct acpi_ctx *ctx,
node->type = ACPI_IORT_NODE_PCI_ROOT_COMPLEX;
node->revision = 2;
node->mapping_count = num_mappings;
- node->mapping_offset = sizeof(struct acpi_iort_node) + sizeof(struct acpi_iort_rc);
+ if (num_mappings)
+ node->mapping_offset = sizeof(struct acpi_iort_node) +
+ sizeof(struct acpi_iort_rc);
node->length = sizeof(struct acpi_iort_node);
node->length += sizeof(struct acpi_iort_rc);
@@ -709,7 +711,9 @@ int acpi_iort_add_smmu_v3(struct acpi_ctx *ctx,
node->type = ACPI_IORT_NODE_SMMU_V3;
node->revision = 5;
node->mapping_count = num_mappings;
- node->mapping_offset = sizeof(struct acpi_iort_node) + sizeof(struct acpi_iort_smmu_v3);
+ if (num_mappings)
+ node->mapping_offset = sizeof(struct acpi_iort_node) +
+ sizeof(struct acpi_iort_smmu_v3);
node->length = sizeof(struct acpi_iort_node);
node->length += sizeof(struct acpi_iort_smmu_v3);
--
2.48.1
More information about the U-Boot
mailing list