diff options
author | Frédéric Danis <frederic.danis@collabora.com> | 2020-03-20 10:59:24 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-14 11:16:34 -0400 |
commit | 9ea0a1ee9309054102e61a29e746db672494d385 (patch) | |
tree | b9a033c630654fadfdee30b85175773b18a7405d /cmd | |
parent | 26f555a6e5454043ed0b0a12d6fce252f5ae5b80 (diff) | |
download | u-boot-9ea0a1ee9309054102e61a29e746db672494d385.tar.gz |
cmd: Fixup DT to pass PStore Ramoops parameters
To simplify configuration and keep synchronized the PStore/Ramoops between
U-Boot and the Linux kernel, this commit dynamically adds the Ramoops
parameters defined in the U-Boot session to the Device Tree.
Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/pstore.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cmd/pstore.c b/cmd/pstore.c index 530eb03b18..9a8b38c7f2 100644 --- a/cmd/pstore.c +++ b/cmd/pstore.c @@ -480,6 +480,44 @@ static int do_pstore(struct cmd_tbl *cmdtp, int flag, int argc, char * const arg return c->cmd(cmdtp, flag, argc, argv); } +void fdt_fixup_pstore(void *blob) +{ + char node[32]; + int nodeoffset; /* node offset from libfdt */ + + nodeoffset = fdt_path_offset(blob, "/"); + if (nodeoffset < 0) { + /* Not found or something else bad happened. */ + log_err("fdt_path_offset() returned %s\n", fdt_strerror(nodeoffset)); + return; + } + + nodeoffset = fdt_add_subnode(blob, nodeoffset, "reserved-memory"); + if (nodeoffset < 0) { + log_err("Add 'reserved-memory' node failed: %s\n", + fdt_strerror(nodeoffset)); + return; + } + fdt_setprop_u32(blob, nodeoffset, "#address-cells", 2); + fdt_setprop_u32(blob, nodeoffset, "#size-cells", 2); + fdt_setprop_empty(blob, nodeoffset, "ranges"); + + sprintf(node, "ramoops@%llx", (unsigned long long)pstore_addr); + nodeoffset = fdt_add_subnode(blob, nodeoffset, node); + if (nodeoffset < 0) { + log_err("Add '%s' node failed: %s\n", node, fdt_strerror(nodeoffset)); + return; + } + fdt_setprop_string(blob, nodeoffset, "compatible", "ramoops"); + fdt_setprop_u64(blob, nodeoffset, "reg", pstore_addr); + fdt_appendprop_u64(blob, nodeoffset, "reg", pstore_length); + fdt_setprop_u32(blob, nodeoffset, "record-size", pstore_record_size); + fdt_setprop_u32(blob, nodeoffset, "console-size", pstore_console_size); + fdt_setprop_u32(blob, nodeoffset, "ftrace-size", pstore_ftrace_size); + fdt_setprop_u32(blob, nodeoffset, "pmsg-size", pstore_pmsg_size); + fdt_setprop_u32(blob, nodeoffset, "ecc-size", pstore_ecc_size); +} + U_BOOT_CMD(pstore, 10, 0, do_pstore, "Manage Linux Persistent Storage", "set <addr> <len> [record-size] [console-size] [ftrace-size] [pmsg_size] [ecc-size]\n" |