On Thu, Jun 20, 2024 at 12:06:29AM +0200, Pierre Gondois wrote:
> 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 <suni...@ventanamicro.com>
> Signed-off-by: Pierre Gondois <pierre.gond...@arm.com>
> ---
>  .../AcpiSsdtPcieLib/SsdtPcieGenerator.c       |  2 +-
>  .../FdtHwInfoParserLib/Arm/ArmFdtUtility.c    | 33 +++++++++++++++++++
>  .../Library/FdtHwInfoParserLib/FdtUtility.h   | 30 +++++++++++++++++
>  .../Pci/PciConfigSpaceParser.c                |  2 +-
>  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 2b488016e545..5b6d5515622b 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/ArmFdtUtility.c 
> b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c
> index 21b1306e577d..71774fae7113 100644
> --- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c
> +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.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 3f5d131d9ae5..2d7048753b9f 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
NIT: I might be wrong but alignment doesn't look correct.

Otherwise, LGTM.

Reviewed-by: Sunil V L <suni...@ventanamicro.com>

Thanks!
Sunil


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


Reply via email to