Parent interrupt controller's address cells is arch specific. So,
create a function which can be implemented differently for
different archs. Move current implementation to ARM specific file.

Cc: Ard Biesheuvel <ardb+tianoc...@kernel.org>
Cc: Leif Lindholm <quic_llind...@quicinc.com>
Cc: Pierre Gondois <pierre.gond...@arm.com>
Cc: Sami Mujawar <sami.muja...@arm.com>
Signed-off-by: Sunil V L <suni...@ventanamicro.com>
---
 .../Library/FdtHwInfoParserLib/FdtUtility.h   |  9 ++++++
 .../FdtHwInfoParserLib/Arm/ArmFdtUtility.c    | 29 +++++++++++++++++++
 .../Pci/PciConfigSpaceParser.c                |  2 +-
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h 
b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
index 3f5d131d9ae5..1d56d044a73e 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.h
@@ -455,4 +455,13 @@ FdtGetParentAddressInfo (
   OUT       INT32     *SizeCells       OPTIONAL
   );
 
+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/Arm/ArmFdtUtility.c 
b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c
index 21b1306e577d..1b2196ef1734 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c
@@ -83,3 +83,32 @@ FdtGetInterruptFlags (
 
   return AcpiIrqFlags;
 }
+
+/** Get the Address cell info of the INTC node
+
+  @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_SUCCESS             The function completed successfully.
+  @retval EFI_ABORTED             An error occurred.
+  @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/Pci/PciConfigSpaceParser.c 
b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
index afe756bcedab..766f784da13c 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;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113476): https://edk2.groups.io/g/devel/message/113476
Mute This Topic: https://groups.io/mt/103622734/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to