1 // SPDX-License-Identifier: Intel
3 * Access to binman information at runtime
5 * Copyright 2019 Google LLC
6 * Written by Simon Glass <sjg@chromium.org>
19 static struct binman_info *binman;
21 int binman_entry_find(const char *name, struct binman_entry *entry)
26 node = ofnode_find_subnode(binman->image, name);
27 if (!ofnode_valid(node))
28 return log_msg_ret("no binman node", -ENOENT);
30 ret = ofnode_read_u32(node, "image-pos", &entry->image_pos);
32 return log_msg_ret("bad binman node1", ret);
33 ret = ofnode_read_u32(node, "size", &entry->size);
35 return log_msg_ret("bad binman node2", ret);
42 binman = malloc(sizeof(struct binman_info));
44 return log_msg_ret("space for binman", -ENOMEM);
45 binman->image = ofnode_path("/binman");
46 if (!ofnode_valid(binman->image))
47 return log_msg_ret("binman node", -EINVAL);