Commit a8492e25 authored by Bin Meng's avatar Bin Meng Committed by Andes
Browse files

riscv: Expand the DT size before copy reserved memory node



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's avatarRick Chen <rick@andestech.com>
Signed-off-by: default avatarBin Meng <bin.meng@windriver.com>
Reviewed-by: default avatarAtish Patra <atish.patra@wdc.com>
Reviewed-by: Rick Chen's avatarRick Chen <rick@andestech.com>
parent c4f7c506
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment