From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 2/3] riscv: Expand the DT size before copy reserved memory node
Date: Thu, 25 Jun 2020 00:37:25 -0700 [thread overview]
Message-ID: <1593070646-6774-2-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1593070646-6774-1-git-send-email-bmeng.cn@gmail.com>
From: Bin Meng <bin.meng@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@andestech.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
Changes in v3:
- Extend the FDT size by 1024 bytes
arch/riscv/lib/fdt_fixup.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
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
next prev parent reply other threads:[~2020-06-25 7:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 7:37 [PATCH v3 1/3] riscv: Avoid the reserved memory fixup if src and dst point to the same place Bin Meng
2020-06-25 7:37 ` Bin Meng [this message]
2020-06-25 18:49 ` [PATCH v3 2/3] riscv: Expand the DT size before copy reserved memory node Atish Patra
2020-06-25 7:37 ` [PATCH v3 3/3] riscv: Enable CONFIG_OF_BOARD_FIXUP by default for OF_SEPARATE Bin Meng
2020-06-25 18:48 ` Atish Patra
2020-06-25 18:48 ` [PATCH v3 1/3] riscv: Avoid the reserved memory fixup if src and dst point to the same place Atish Patra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1593070646-6774-2-git-send-email-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox