提交 956a9082 编写于 作者: S Simon Glass 提交者: Bin Meng

binman: Refactor binman_entry_find() to allow other nodes

At present we can only read from a top-level binman node entry. Refactor
this function to produce a second local function which supports reading
from any node.
Signed-off-by: NSimon Glass <sjg@chromium.org>
Reviewed-by: NBin Meng <bmeng.cn@gmail.com>
上级 db6fb7d1
...@@ -29,25 +29,32 @@ struct binman_info { ...@@ -29,25 +29,32 @@ struct binman_info {
static struct binman_info *binman; static struct binman_info *binman;
int binman_entry_find(const char *name, struct binman_entry *entry) static int binman_entry_find_internal(ofnode node, const char *name,
struct binman_entry *entry)
{ {
ofnode node;
int ret; int ret;
node = ofnode_find_subnode(binman->image, name);
if (!ofnode_valid(node)) if (!ofnode_valid(node))
return log_msg_ret("no binman node", -ENOENT); node = binman->image;
node = ofnode_find_subnode(node, name);
if (!ofnode_valid(node))
return log_msg_ret("node", -ENOENT);
ret = ofnode_read_u32(node, "image-pos", &entry->image_pos); ret = ofnode_read_u32(node, "image-pos", &entry->image_pos);
if (ret) if (ret)
return log_msg_ret("bad binman node1", ret); return log_msg_ret("import-pos", ret);
ret = ofnode_read_u32(node, "size", &entry->size); ret = ofnode_read_u32(node, "size", &entry->size);
if (ret) if (ret)
return log_msg_ret("bad binman node2", ret); return log_msg_ret("size", ret);
return 0; return 0;
} }
int binman_entry_find(const char *name, struct binman_entry *entry)
{
return binman_entry_find_internal(binman->image, name, entry);
}
void binman_set_rom_offset(int rom_offset) void binman_set_rom_offset(int rom_offset)
{ {
binman->rom_offset = rom_offset; binman->rom_offset = rom_offset;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册