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>
12 #include <dm/ofnode.h>
15 *struct binman_entry - information about a binman entry
17 * @image_pos: Position of entry in the image
18 * @size: Size of entry
26 * binman_entry_map() - Look up the address of an entry in memory
28 * @parent: Parent binman node
29 * @name: Name of entry
30 * @bufp: Returns a pointer to the entry
31 * @sizep: Returns the size of the entry
32 * @return 0 on success, -EPERM if the ROM offset is not set, -ENOENT if the
33 * entry cannot be found, other error code other error
35 int binman_entry_map(ofnode parent, const char *name, void **bufp, int *sizep);
38 * binman_set_rom_offset() - Set the ROM memory-map offset
40 * @rom_offset: Offset from an image_pos to the memory-mapped address. This
41 * tells binman that ROM image_pos x can be addressed at rom_offset + x
43 void binman_set_rom_offset(int rom_offset);
46 * binman_get_rom_offset() - Get the ROM memory-map offset
48 * @returns offset from an image_pos to the memory-mapped address
50 int binman_get_rom_offset(void);
53 * binman_entry_find() - Find a binman symbol
55 * This searches the binman information in the device tree for a symbol of the
58 * @name: Path to entry to examine (e.g. "/read-only/u-boot")
59 * @entry: Returns information about the entry
60 * @return 0 if OK, -ENOENT if the path is not found, other -ve value if the
61 * binman information is invalid (missing image-pos or size)
63 int binman_entry_find(const char *name, struct binman_entry *entry);
66 * binman_section_find_node() - Find a binman node
68 * @name: Name of node to look for
69 * @return Node that was found, ofnode_null() if not found
71 ofnode binman_section_find_node(const char *name);
74 * binman_select_subnode() - Select a subnode to use to find entries
76 * Normally binman selects the top-level node for future entry requests, such as
77 * binman_entry_find(). This function allows a subnode to be chosen instead.
79 * @name: Name of subnode, typically a section. This must be in the top-level
81 * @return 0 if OK, -EINVAL if there is no /binman node, -ECHILD if multiple
82 * images are being used but the first image is not available, -ENOENT if
83 * the requested subnode cannot be found
85 int binman_select_subnode(const char *name);
88 * binman_init() - Set up the binman symbol information
90 * This locates the binary symbol information in the device tree ready for use
92 * @return 0 if OK, -ENOMEM if out of memory, -EINVAL if there is no binman node
94 int binman_init(void);