[PATCH 3/3] lib/utils: Support fixing up the official DT bindings of PLIC

Anup Patel Anup.Patel at wdc.com
Wed Mar 31 05:55:34 BST 2021



> -----Original Message-----
> From: opensbi <opensbi-bounces at lists.infradead.org> On Behalf Of Bin
> Meng
> Sent: 27 March 2021 10:35
> To: opensbi at lists.infradead.org
> Cc: Bin Meng <bmeng.cn at gmail.com>
> Subject: [PATCH 3/3] lib/utils: Support fixing up the official DT bindings of
> PLIC
> 
> Current fdt_plic_fixup() only does necessary fix-up against the legacy
> "riscv,plic0" node. The upstream Linux kernel defines its official DT bindings
> which uses "sifive,plic-1.0.0" as the compatible string and we should check
> that first, and if not present fall back to legacy.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>

Looks good to me.

Reviewed-by: Anup Patel <anup.patel at wdc.com>

Regards,
Anup

> ---
> 
>  lib/utils/fdt/fdt_fixup.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index
> a306ff5..1465500 100644
> --- a/lib/utils/fdt/fdt_fixup.c
> +++ b/lib/utils/fdt/fdt_fixup.c
> @@ -57,9 +57,12 @@ void fdt_plic_fixup(void *fdt)
>  	int i, cells_count;
>  	int plic_off;
> 
> -	plic_off = fdt_node_offset_by_compatible(fdt, 0, "riscv,plic0");
> -	if (plic_off < 0)
> -		return;
> +	plic_off = fdt_node_offset_by_compatible(fdt, 0, "sifive,plic-1.0.0");
> +	if (plic_off < 0) {
> +		plic_off = fdt_node_offset_by_compatible(fdt, 0,
> "riscv,plic0");
> +		if (plic_off < 0)
> +			return;
> +	}
> 
>  	cells = (u32 *)fdt_getprop(fdt, plic_off,
>  				   "interrupts-extended", &cells_count);
> --
> 2.25.1
> 
> 
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list