summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2024-06-10 14:00:00 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-29 13:44:55 +0000
commit40a0dbdd18fe6303a71113e7e9c49f45042e692b (patch)
tree2efcbf1dae8d61d4c0da690920b33aaeb7198d6d /DynamicTablesPkg
parentd8aa665b31e309a31b59b97d04ba8d003f4fe84e (diff)
downloadedk2-40a0dbdd18fe6303a71113e7e9c49f45042e692b.tar.gz
edk2-40a0dbdd18fe6303a71113e7e9c49f45042e692b.tar.bz2
edk2-40a0dbdd18fe6303a71113e7e9c49f45042e692b.zip
DynamicTablesPkg: FdtHwInfoParserLib: Create wrapper to get INTC addr cells
Parent interrupt controller's address cells is arch specific. So, create a wrapper function which can be implemented differently for different archs. Move current implementation to ARM specific file. Suggested-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Diffstat (limited to 'DynamicTablesPkg')
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c2
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c33
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h30
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c2
4 files changed, 65 insertions, 2 deletions
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c
index 2b488016e5..5b6d551562 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieGenerator.c
@@ -974,7 +974,7 @@ BuildSsdtPciTableEx (
EFI_STATUS Status;
CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO *PciInfo;
UINT32 PciCount;
- UINTN Index;
+ UINT32 Index;
EFI_ACPI_DESCRIPTION_HEADER **TableList;
ACPI_PCI_GENERATOR *Generator;
UINT32 Uid;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
index 21b1306e57..71774fae71 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
@@ -83,3 +83,36 @@ FdtGetInterruptFlags (
return AcpiIrqFlags;
}
+
+/** For relevant architectures, get the "#address-cells" and/or "#size-cells"
+ property of the node.
+
+ According to the Device Tree specification, s2.3.5 "#address-cells and
+ #size-cells":
+ "If missing, a client program should assume a default value of 2 for
+ #address-cells, and a value of 1 for #size-cells."
+
+ @param [in] Fdt Pointer to a Flattened Device Tree.
+ @param [in] Node Offset of the node having to get the
+ "#address-cells" and "#size-cells"
+ properties from.
+ @param [out] AddressCells If success, number of address-cells.
+ If the property is not available,
+ default value is 2.
+ @param [out] SizeCells If success, number of size-cells.
+ If the property is not available,
+ default value is 1.
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+FdtGetIntcAddressCells (
+ IN CONST VOID *Fdt,
+ IN INT32 Node,
+ OUT INT32 *AddressCells, OPTIONAL
+ OUT INT32 *SizeCells OPTIONAL
+ )
+{
+ return FdtGetAddressInfo (Fdt, Node, AddressCells, SizeCells);
+}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
index 3f5d131d9a..2d7048753b 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
@@ -455,4 +455,34 @@ FdtGetParentAddressInfo (
OUT INT32 *SizeCells OPTIONAL
);
+/** For relevant architectures, get the "#address-cells" and/or "#size-cells"
+ property of the node.
+
+ According to the Device Tree specification, s2.3.5 "#address-cells and
+ #size-cells":
+ "If missing, a client program should assume a default value of 2 for
+ #address-cells, and a value of 1 for #size-cells."
+
+ @param [in] Fdt Pointer to a Flattened Device Tree.
+ @param [in] Node Offset of the node having to get the
+ "#address-cells" and "#size-cells"
+ properties from.
+ @param [out] AddressCells If success, number of address-cells.
+ If the property is not available,
+ default value is 2.
+ @param [out] SizeCells If success, number of size-cells.
+ If the property is not available,
+ default value is 1.
+
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+FdtGetIntcAddressCells (
+ IN CONST VOID *Fdt,
+ IN INT32 Node,
+ OUT INT32 *AddressCells, OPTIONAL
+ OUT INT32 *SizeCells OPTIONAL
+ );
+
#endif // FDT_UTILITY_H_
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
index 76f9efdf64..7f536c0ac6 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
@@ -365,7 +365,7 @@ ParseIrqMap (
}
// Get the "address-cells" property of the IntcNode.
- Status = FdtGetAddressInfo (Fdt, IntcNode, &IntcAddressCells, NULL);
+ Status = FdtGetIntcAddressCells (Fdt, IntcNode, &IntcAddressCells, NULL);
if (EFI_ERROR (Status)) {
ASSERT (0);
return Status;