From: seanedmond@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: dphadke@linux.microsoft.com, macromorgan@hotmail.com, sjg@chromium.org
Subject: [PATCH 3/4] cmd: kaslrseed: Use common API to fixup FDT
Date: Tue, 29 Aug 2023 13:32:04 -0700 [thread overview]
Message-ID: <20230829203210.83914-3-seanedmond@linux.microsoft.com> (raw)
In-Reply-To: <20230829203210.83914-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 8a1d8120cd..c65607619b 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, buf, sizeof(buf));
+ if (ret) {
+ printf("ERROR: failed to add kaslr-seed to fdt\n");
return CMD_RET_FAILURE;
}
--
2.40.0
next prev parent reply other threads:[~2023-08-29 20:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 20:32 [PATCH 1/4] fdt: common API to populate kaslr seed seanedmond
2023-08-29 20:32 ` [PATCH 2/4] fdt: kaslr seed from tpm entropy seanedmond
2023-08-29 20:32 ` seanedmond [this message]
2023-08-29 20:32 ` [PATCH 4/4] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
2023-08-29 20:32 ` [PATCH v2 0/4] Populate kaslr seed with TPM seanedmond
2023-08-29 20:32 ` [PATCH v2 1/4] fdt: common API to populate kaslr seed seanedmond
2023-08-29 20:32 ` [PATCH v2 2/4] fdt: kaslr seed from tpm entropy seanedmond
2023-08-29 20:32 ` [PATCH v2 3/4] cmd: kaslrseed: Use common API to fixup FDT seanedmond
2023-08-29 20:32 ` [PATCH v2 4/4] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
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=20230829203210.83914-3-seanedmond@linux.microsoft.com \
--to=seanedmond@linux.microsoft.com \
--cc=dphadke@linux.microsoft.com \
--cc=macromorgan@hotmail.com \
--cc=sjg@chromium.org \
--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.