binman: Allow setting the ROM offset
[platform/kernel/u-boot.git] / include / binman.h
1 /* SPDX-License-Identifier: Intel */
2 /*
3  * Access to binman information at runtime
4  *
5  * Copyright 2019 Google LLC
6  * Written by Simon Glass <sjg@chromium.org>
7  */
8
9 #ifndef _BINMAN_H_
10 #define _BINMAN_H_
11
12 /**
13  *struct binman_entry - information about a binman entry
14  *
15  * @image_pos: Position of entry in the image
16  * @size: Size of entry
17  */
18 struct binman_entry {
19         u32 image_pos;
20         u32 size;
21 };
22
23 /**
24  * binman_set_rom_offset() - Set the ROM memory-map offset
25  *
26  * @rom_offset: Offset from an image_pos to the memory-mapped address. This
27  *      tells binman that ROM image_pos x can be addressed at rom_offset + x
28  */
29 void binman_set_rom_offset(int rom_offset);
30
31 /**
32  * binman_entry_find() - Find a binman symbol
33  *
34  * This searches the binman information in the device tree for a symbol of the
35  * given name
36  *
37  * @name: Path to entry to examine (e.g. "/read-only/u-boot")
38  * @entry: Returns information about the entry
39  * @return 0 if OK, -ENOENT if the path is not found, other -ve value if the
40  *      binman information is invalid (missing image-pos or size)
41  */
42 int binman_entry_find(const char *name, struct binman_entry *entry);
43
44 /**
45  * binman_init() - Set up the binman symbol information
46  *
47  * This locates the binary symbol information in the device tree ready for use
48  *
49  * @return 0 if OK, -ENOMEM if out of memory, -EINVAL if there is no binman node
50  */
51 int binman_init(void);
52
53 #endif