]>
git.ipfire.org Git - people/ms/u-boot.git/blob - include/binman_sym.h
3999b26d8d4fa7cbd543c93e7d9d27307b682172
2 * Symbol access for symbols set up by binman as part of the build.
4 * This allows C code to access the position of a particular part of the image
7 * Copyright (c) 2017 Google, Inc
9 * SPDX-License-Identifier: GPL-2.0+
12 #ifndef __BINMAN_SYM_H
13 #define __BINMAN_SYM_H
15 #define BINMAN_SYM_MISSING (-1UL)
20 * binman_symname() - Internal fnuction to get a binman symbol name
22 * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
23 * @_prop_name: Property value to get from that entry (e.g. 'pos')
24 * @returns name of the symbol for that entry and property
26 #define binman_symname(_entry_name, _prop_name) \
27 _binman_ ## _entry_name ## _prop_ ## _prop_name
30 * binman_sym_declare() - Declare a symbol that will be used at run-time
32 * @_type: Type f the symbol (e.g. unsigned long)
33 * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
34 * @_prop_name: Property value to get from that entry (e.g. 'pos')
36 #define binman_sym_declare(_type, _entry_name, _prop_name) \
37 _type binman_symname(_entry_name, _prop_name) \
38 __attribute__((aligned(4), unused, section(".binman_sym")))
41 * binman_sym_declare_optional() - Declare an optional symbol
43 * If this symbol cannot be provided by binman, an error will not be generated.
44 * Instead the image will be assigned the value BINMAN_SYM_MISSING.
46 * @_type: Type f the symbol (e.g. unsigned long)
47 * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
48 * @_prop_name: Property value to get from that entry (e.g. 'pos')
50 #define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
51 _type binman_symname(_entry_name, _prop_name) \
52 __attribute__((aligned(4), weak, unused, \
53 section(".binman_sym")))
56 * binman_sym() - Access a previously declared symbol
58 * This is used to get the value of a symbol. E.g.:
60 * ulong address = binman_sym(ulong, u_boot_spl, pos);
62 * @_type: Type f the symbol (e.g. unsigned long)
63 * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
64 * @_prop_name: Property value to get from that entry (e.g. 'pos')
65 * @returns value of that property (filled in by binman)
67 #define binman_sym(_type, _entry_name, _prop_name) \
68 (*(_type *)&binman_symname(_entry_name, _prop_name))
72 #define binman_sym_declare(_type, _entry_name, _prop_name)
74 #define binman_sym_declare_optional(_type, _entry_name, _prop_name)
76 #define binman_sym(_type, _entry_name, _prop_name) BINMAN_SYM_MISSING