Prepare v2025.01
[u-boot.git] / include / env_callback.h
blobbc8ff1923e118691cdcb08e54341317608115643
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * (C) Copyright 2012
4 * Joe Hershberger, National Instruments, joe.hershberger@ni.com
5 */
7 #ifndef __ENV_CALLBACK_H__
8 #define __ENV_CALLBACK_H__
10 #include <config.h>
11 #include <env_flags.h>
12 #include <linker_lists.h>
13 #include <search.h>
15 #define ENV_CALLBACK_VAR ".callbacks"
17 /* Board configs can define additional static callback bindings */
18 #ifndef CFG_ENV_CALLBACK_LIST_STATIC
19 #define CFG_ENV_CALLBACK_LIST_STATIC
20 #endif
22 #ifdef CONFIG_SILENT_CONSOLE
23 #define SILENT_CALLBACK "silent:silent,"
24 #else
25 #define SILENT_CALLBACK
26 #endif
28 #ifdef CONFIG_REGEX
29 #define ENV_DOT_ESCAPE "\\"
30 #else
31 #define ENV_DOT_ESCAPE
32 #endif
34 #ifdef CONFIG_CMD_DNS
35 #define DNS_CALLBACK "dnsip:dnsip,"
36 #else
37 #define DNS_CALLBACK
38 #endif
40 #ifdef CONFIG_NET
41 #define NET_CALLBACKS \
42 "bootfile:bootfile," \
43 "ipaddr:ipaddr," \
44 "gatewayip:gatewayip," \
45 "netmask:netmask," \
46 "serverip:serverip," \
47 "nvlan:nvlan," \
48 "vlan:vlan," \
49 DNS_CALLBACK \
50 "eth" ETHADDR_WILDCARD "addr:ethaddr,"
51 #else
52 #define NET_CALLBACKS
53 #endif
55 #ifdef CONFIG_IPV6
56 #define NET6_CALLBACKS \
57 "ip6addr:ip6addr," \
58 "serverip6:serverip6," \
59 "gatewayip6:gatewayip6,"
60 #else
61 #define NET6_CALLBACKS
62 #endif
64 #ifdef CONFIG_BOOTSTD_FULL
65 #define BOOTSTD_CALLBACK \
66 "bootmeths:bootmeths," \
67 "bootargs:bootargs,"
68 #else
69 #define BOOTSTD_CALLBACK
70 #endif
72 #ifdef CONFIG_DFU
73 #define DFU_CALLBACK "dfu_alt_info:dfu_alt_info,"
74 #else
75 #define DFU_CALLBACK
76 #endif
79 * This list of callback bindings is static, but may be overridden by defining
80 * a new association in the ".callbacks" environment variable.
82 #define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," \
83 ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \
84 "baudrate:baudrate," \
85 NET_CALLBACKS \
86 NET6_CALLBACKS \
87 BOOTSTD_CALLBACK \
88 DFU_CALLBACK \
89 "loadaddr:loadaddr," \
90 SILENT_CALLBACK \
91 "stdin:console,stdout:console,stderr:console," \
92 "serial#:serialno," \
93 CFG_ENV_CALLBACK_LIST_STATIC
95 #ifndef CONFIG_XPL_BUILD
96 void env_callback_init(struct env_entry *var_entry);
97 #else
98 static inline void env_callback_init(struct env_entry *var_entry)
101 #endif
103 #endif /* __ENV_CALLBACK_H__ */