Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2012 |
| 4 | * Joe Hershberger, National Instruments, joe.hershberger@ni.com |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __ENV_CALLBACK_H__ |
| 8 | #define __ENV_CALLBACK_H__ |
| 9 | |
Tom Rini | dec7ea0 | 2024-05-20 13:35:03 -0600 | [diff] [blame] | 10 | #include <config.h> |
Joe Hershberger | 71497d0 | 2012-12-11 22:16:31 -0600 | [diff] [blame] | 11 | #include <env_flags.h> |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 12 | #include <linker_lists.h> |
| 13 | #include <search.h> |
| 14 | |
| 15 | #define ENV_CALLBACK_VAR ".callbacks" |
| 16 | |
| 17 | /* Board configs can define additional static callback bindings */ |
Tom Rini | 364d002 | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 18 | #ifndef CFG_ENV_CALLBACK_LIST_STATIC |
| 19 | #define CFG_ENV_CALLBACK_LIST_STATIC |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 20 | #endif |
| 21 | |
Joe Hershberger | 03ddaba | 2012-12-11 22:16:30 -0600 | [diff] [blame] | 22 | #ifdef CONFIG_SILENT_CONSOLE |
| 23 | #define SILENT_CALLBACK "silent:silent," |
| 24 | #else |
| 25 | #define SILENT_CALLBACK |
| 26 | #endif |
| 27 | |
Joe Hershberger | 6db9fd4 | 2015-05-20 14:27:20 -0500 | [diff] [blame] | 28 | #ifdef CONFIG_REGEX |
| 29 | #define ENV_DOT_ESCAPE "\\" |
| 30 | #else |
| 31 | #define ENV_DOT_ESCAPE |
| 32 | #endif |
| 33 | |
Joe Hershberger | 875b6bf | 2015-05-20 14:27:23 -0500 | [diff] [blame] | 34 | #ifdef CONFIG_CMD_DNS |
| 35 | #define DNS_CALLBACK "dnsip:dnsip," |
| 36 | #else |
| 37 | #define DNS_CALLBACK |
| 38 | #endif |
| 39 | |
Heinrich Schuchardt | fe04d06 | 2019-09-02 10:10:34 +0200 | [diff] [blame] | 40 | #ifdef CONFIG_NET |
Joe Hershberger | 875b6bf | 2015-05-20 14:27:23 -0500 | [diff] [blame] | 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," \ |
Joe Hershberger | 7e0b015 | 2015-05-20 14:27:26 -0500 | [diff] [blame] | 49 | DNS_CALLBACK \ |
Joe Hershberger | 8ab8b72 | 2015-06-22 17:57:36 -0500 | [diff] [blame] | 50 | "eth" ETHADDR_WILDCARD "addr:ethaddr," |
Joe Hershberger | 875b6bf | 2015-05-20 14:27:23 -0500 | [diff] [blame] | 51 | #else |
| 52 | #define NET_CALLBACKS |
| 53 | #endif |
| 54 | |
Viacheslav Mitrofanov | df264cf | 2022-12-02 12:18:00 +0300 | [diff] [blame] | 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 |
| 63 | |
Simon Glass | b35513a | 2023-07-12 09:04:35 -0600 | [diff] [blame] | 64 | #ifdef CONFIG_BOOTSTD_FULL |
| 65 | #define BOOTSTD_CALLBACK \ |
| 66 | "bootmeths:bootmeths," \ |
| 67 | "bootargs:bootargs," |
Simon Glass | 4b508b8 | 2022-04-24 23:31:08 -0600 | [diff] [blame] | 68 | #else |
| 69 | #define BOOTSTD_CALLBACK |
| 70 | #endif |
| 71 | |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 72 | /* |
| 73 | * This list of callback bindings is static, but may be overridden by defining |
| 74 | * a new association in the ".callbacks" environment variable. |
| 75 | */ |
Joe Hershberger | 6db9fd4 | 2015-05-20 14:27:20 -0500 | [diff] [blame] | 76 | #define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," \ |
| 77 | ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \ |
Joe Hershberger | 3928bb6 | 2012-12-11 22:16:27 -0600 | [diff] [blame] | 78 | "baudrate:baudrate," \ |
Joe Hershberger | 875b6bf | 2015-05-20 14:27:23 -0500 | [diff] [blame] | 79 | NET_CALLBACKS \ |
Viacheslav Mitrofanov | df264cf | 2022-12-02 12:18:00 +0300 | [diff] [blame] | 80 | NET6_CALLBACKS \ |
Simon Glass | 4b508b8 | 2022-04-24 23:31:08 -0600 | [diff] [blame] | 81 | BOOTSTD_CALLBACK \ |
Joe Hershberger | d1f5ae9 | 2012-12-11 22:16:28 -0600 | [diff] [blame] | 82 | "loadaddr:loadaddr," \ |
Joe Hershberger | 03ddaba | 2012-12-11 22:16:30 -0600 | [diff] [blame] | 83 | SILENT_CALLBACK \ |
Joe Hershberger | 5c89d6d | 2012-12-11 22:16:29 -0600 | [diff] [blame] | 84 | "stdin:console,stdout:console,stderr:console," \ |
Sam Protsenko | 708bc68 | 2017-09-01 15:42:03 +0300 | [diff] [blame] | 85 | "serial#:serialno," \ |
Tom Rini | 364d002 | 2023-01-10 11:19:45 -0500 | [diff] [blame] | 86 | CFG_ENV_CALLBACK_LIST_STATIC |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 87 | |
Simon Glass | 209ae76 | 2024-09-29 19:49:49 -0600 | [diff] [blame] | 88 | #ifndef CONFIG_XPL_BUILD |
Simon Glass | 1a23686 | 2019-08-02 09:44:18 -0600 | [diff] [blame] | 89 | void env_callback_init(struct env_entry *var_entry); |
Rasmus Villemoes | a664870 | 2020-02-27 13:56:10 +0000 | [diff] [blame] | 90 | #else |
| 91 | static inline void env_callback_init(struct env_entry *var_entry) |
| 92 | { |
| 93 | } |
| 94 | #endif |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 95 | |
Joe Hershberger | 60fd3ad | 2012-12-11 22:16:24 -0600 | [diff] [blame] | 96 | #endif /* __ENV_CALLBACK_H__ */ |