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>
17 static struct binman_info *binman;
19 int binman_entry_find(const char *name, struct binman_entry *entry)
24 node = ofnode_find_subnode(binman->image, name);
25 if (!ofnode_valid(node))
26 return log_msg_ret("no binman node", -ENOENT);
28 ret = ofnode_read_u32(node, "image-pos", &entry->image_pos);
30 return log_msg_ret("bad binman node1", ret);
31 ret = ofnode_read_u32(node, "size", &entry->size);
33 return log_msg_ret("bad binman node2", ret);
40 binman = malloc(sizeof(struct binman_info));
42 return log_msg_ret("space for binman", -ENOMEM);
43 binman->image = ofnode_path("/binman");
44 if (!ofnode_valid(binman->image))
45 return log_msg_ret("binman node", -EINVAL);