summaryrefslogtreecommitdiff
path: root/boot/vbe_simple_os.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-10-21 03:23:14 +0300
committerTom Rini <trini@konsulko.com>2022-10-31 18:04:00 +0300
commita56f663f07073713042bb0fd08053aeb667e717b (patch)
treee2b9b511a30a5d09fb2b56bb29217fb505088ce6 /boot/vbe_simple_os.c
parent4218456b3fac98966a320c3f2db36d543a32ec17 (diff)
downloadu-boot-a56f663f07073713042bb0fd08053aeb667e717b.tar.xz
vbe: Add info about the VBE device to the fwupd node
At present we put the driver in the /chosen node in U-Boot. This is a bit strange, since U-Boot doesn't normally use that node itself. It is better to put it under the bootstd node. To make this work we need to copy create the node under /chosen when fixing up the device tree. Copy over all the properties so that fwupd knows what to do. Update the sandbox device tree accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/vbe_simple_os.c')
-rw-r--r--boot/vbe_simple_os.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c
index 87778bba97..b2041a95a3 100644
--- a/boot/vbe_simple_os.c
+++ b/boot/vbe_simple_os.c
@@ -62,24 +62,34 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event)
*/
for (vbe_find_first_device(&dev); dev; vbe_find_next_device(&dev)) {
struct simple_state state;
- ofnode node, subnode;
+ ofnode node, subnode, chosen;
int ret;
if (strcmp("vbe_simple", dev->driver->name))
continue;
- /* Check if there is a node to fix up */
- node = oftree_path(tree, "/chosen/fwupd");
- if (!ofnode_valid(node))
- continue;
- subnode = ofnode_find_subnode(node, dev->name);
- if (!ofnode_valid(subnode))
+ /* Check if there is a node to fix up, adding if not */
+ chosen = oftree_path(tree, "/chosen");
+ if (!ofnode_valid(chosen))
continue;
+ ret = ofnode_add_subnode(chosen, "fwupd", &node);
+ if (ret && ret != -EEXIST)
+ return log_msg_ret("fwu", ret);
+
+ ret = ofnode_add_subnode(node, dev->name, &subnode);
+ if (ret && ret != -EEXIST)
+ return log_msg_ret("dev", ret);
- log_debug("Fixing up: %s\n", dev->name);
ret = device_probe(dev);
if (ret)
return log_msg_ret("probe", ret);
+
+ /* Copy over the vbe properties for fwupd */
+ log_debug("Fixing up: %s\n", dev->name);
+ ret = ofnode_copy_props(dev_ofnode(dev), subnode);
+ if (ret)
+ return log_msg_ret("cp", ret);
+
ret = vbe_simple_read_state(dev, &state);
if (ret)
return log_msg_ret("read", ret);