[PATCH v4 2/3] riscv: Expand the DT size before copy reserved memory node
Rick Chen
rickchen36 at gmail.com
Mon Jun 29 08:36:40 CEST 2020
> From: Bin Meng [mailto:bmeng.cn at gmail.com]
> Sent: Friday, June 26, 2020 9:16 AM
> To: Rick Jian-Zhi Chen(陳建志); U-Boot Mailing List
> Cc: Atish Patra; Bin Meng
> Subject: [PATCH v4 2/3] riscv: Expand the DT size before copy reserved memory node
>
> From: Bin Meng <bin.meng at windriver.com>
>
> The FDT blob might not have sufficient space to hold a copy of reserved memory node. Expand it before the copy.
>
> Reported-by: Rick Chen <rick at andestech.com>
> Signed-off-by: Bin Meng <bin.meng at windriver.com>
> Reviewed-by: Atish Patra <atish.patra at wdc.com>
> ---
>
> (no changes since v3)
>
> Changes in v3:
> - Extend the FDT size by 1024 bytes
>
> arch/riscv/lib/fdt_fixup.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
Reviewed-by: Rick Chen <rick at andestech.com>
> diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c index 5f523f0..160ccca 100644
> --- a/arch/riscv/lib/fdt_fixup.c
> +++ b/arch/riscv/lib/fdt_fixup.c
> @@ -41,6 +41,18 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst)
> return 0;
> }
>
> + /*
> + * Extend the FDT by the following estimated size:
> + *
> + * Each PMP memory region entry occupies 64 bytes.
> + * With 16 PMP memory regions we need 64 * 16 = 1024 bytes.
> + */
> + err = fdt_open_into(dst, dst, fdt_totalsize(dst) + 1024);
> + if (err < 0) {
> + printf("Device Tree can't be expanded to accommodate new node");
> + return err;
> + }
> +
> fdt_for_each_subnode(node, src, offset) {
> name = fdt_get_name(src, node, NULL);
>
> --
> 2.7.4
More information about the U-Boot
mailing list