From: seanedmond@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: dphadke@linux.microsoft.com, ilias.apalodimas@linaro.org,
trini@konsulko.com, sjg@chromium.org
Subject: [PATCH v5 3/5] cmd: kaslrseed: Use common API to fixup FDT
Date: Thu, 16 Nov 2023 18:02:04 -0800 [thread overview]
Message-ID: <20231117020207.948636-4-seanedmond@linux.microsoft.com> (raw)
In-Reply-To: <20231117020207.948636-1-seanedmond@linux.microsoft.com>
From: Sean Edmond <seanedmond@microsoft.com>
Use the newly introduced common API fdt_fixup_kaslr_seed() in the
kaslrseed command.
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
cmd/kaslrseed.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/cmd/kaslrseed.c b/cmd/kaslrseed.c
index 9acb8e16386..23ed7c066aa 100644
--- a/cmd/kaslrseed.c
+++ b/cmd/kaslrseed.c
@@ -19,7 +19,7 @@ static int do_kaslr_seed(struct cmd_tbl *cmdtp, int flag, int argc, char *const
size_t n = 0x8;
struct udevice *dev;
u64 *buf;
- int nodeoffset;
+ ofnode root;
int ret = CMD_RET_SUCCESS;
if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
@@ -45,21 +45,15 @@ static int do_kaslr_seed(struct cmd_tbl *cmdtp, int flag, int argc, char *const
return CMD_RET_FAILURE;
}
- ret = fdt_check_header(working_fdt);
- if (ret < 0) {
- printf("fdt_chosen: %s\n", fdt_strerror(ret));
- return CMD_RET_FAILURE;
- }
-
- nodeoffset = fdt_find_or_add_subnode(working_fdt, 0, "chosen");
- if (nodeoffset < 0) {
- printf("Reading chosen node failed\n");
- return CMD_RET_FAILURE;
+ ret = root_ofnode_from_fdt(working_fdt, &root);
+ if (ret) {
+ printf("ERROR: Unable to get root ofnode\n");
+ goto CMD_RET_FAILURE;
}
- ret = fdt_setprop(working_fdt, nodeoffset, "kaslr-seed", buf, sizeof(buf));
- if (ret < 0) {
- printf("Unable to set kaslr-seed on chosen node: %s\n", fdt_strerror(ret));
+ ret = fdt_fixup_kaslr_seed(root, (u8 *)buf, sizeof(buf));
+ if (ret) {
+ printf("ERROR: failed to add kaslr-seed to fdt\n");
return CMD_RET_FAILURE;
}
--
2.42.0
next prev parent reply other threads:[~2023-11-17 2:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 2:02 [PATCH v5 0/5] Populate kaslr seed with RNG seanedmond
2023-11-17 2:02 ` [PATCH v5 1/5] fdt: common API to populate kaslr seed seanedmond
2023-11-29 17:47 ` Simon Glass
2023-11-17 2:02 ` [PATCH v5 2/5] fdt: kaslr seed from RNG device seanedmond
2023-11-18 7:33 ` Ilias Apalodimas
2023-11-22 23:55 ` Sean Edmond
2023-11-23 6:17 ` Ilias Apalodimas
2023-11-29 17:47 ` Simon Glass
2023-11-29 17:55 ` Ilias Apalodimas
2023-11-17 2:02 ` seanedmond [this message]
2023-11-29 17:47 ` [PATCH v5 3/5] cmd: kaslrseed: Use common API to fixup FDT Simon Glass
2023-11-17 2:02 ` [PATCH v5 4/5] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
2023-11-29 17:47 ` Simon Glass
2023-11-17 2:02 ` [PATCH v5 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE seanedmond
2023-11-29 17:47 ` Simon Glass
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=20231117020207.948636-4-seanedmond@linux.microsoft.com \
--to=seanedmond@linux.microsoft.com \
--cc=dphadke@linux.microsoft.com \
--cc=ilias.apalodimas@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.