};
/**
+ * binman_set_rom_offset() - Set the ROM memory-map offset
+ *
+ * @rom_offset: Offset from an image_pos to the memory-mapped address. This
+ * tells binman that ROM image_pos x can be addressed at rom_offset + x
+ */
+void binman_set_rom_offset(int rom_offset);
+
+/**
* binman_entry_find() - Find a binman symbol
*
* This searches the binman information in the device tree for a symbol of the
#include <log.h>
#include <malloc.h>
+/**
+ * struct binman_info - Information needed by the binman library
+ *
+ * @image: Node describing the image we are running from
+ * @rom_offset: Offset from an image_pos to the memory-mapped address, or
+ * ROM_OFFSET_NONE if the ROM is not memory-mapped. Can be positive or
+ * negative
+ */
struct binman_info {
ofnode image;
+ int rom_offset;
};
+#define ROM_OFFSET_NONE (-1)
+
static struct binman_info *binman;
int binman_entry_find(const char *name, struct binman_entry *entry)
return 0;
}
+void binman_set_rom_offset(int rom_offset)
+{
+ binman->rom_offset = rom_offset;
+}
+
int binman_init(void)
{
binman = malloc(sizeof(struct binman_info));
binman->image = ofnode_path("/binman");
if (!ofnode_valid(binman->image))
return log_msg_ret("binman node", -EINVAL);
+ binman->rom_offset = ROM_OFFSET_NONE;
return 0;
}