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>
18 static struct binman_info *binman;
20 int binman_entry_find(const char *name, struct binman_entry *entry)
25 node = ofnode_find_subnode(binman->image, name);
26 if (!ofnode_valid(node))
27 return log_msg_ret("no binman node", -ENOENT);
29 ret = ofnode_read_u32(node, "image-pos", &entry->image_pos);
31 return log_msg_ret("bad binman node1", ret);
32 ret = ofnode_read_u32(node, "size", &entry->size);
34 return log_msg_ret("bad binman node2", ret);
41 binman = malloc(sizeof(struct binman_info));
43 return log_msg_ret("space for binman", -ENOMEM);
44 binman->image = ofnode_path("/binman");
45 if (!ofnode_valid(binman->image))
46 return log_msg_ret("binman node", -EINVAL);