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>
This commit is contained in:
Pierre Gondois 2024-06-10 14:00:00 +02:00 committed by mergify[bot]
parent d8aa665b31
commit 40a0dbdd18
4 changed files with 65 additions and 2 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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_

View File

@ -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;