env_callback.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2012
  4. * Joe Hershberger, National Instruments, joe.hershberger@ni.com
  5. */
  6. #ifndef __ENV_CALLBACK_H__
  7. #define __ENV_CALLBACK_H__
  8. #include <env_flags.h>
  9. #include <linker_lists.h>
  10. #include <search.h>
  11. #define ENV_CALLBACK_VAR ".callbacks"
  12. /* Board configs can define additional static callback bindings */
  13. #ifndef CFG_ENV_CALLBACK_LIST_STATIC
  14. #define CFG_ENV_CALLBACK_LIST_STATIC
  15. #endif
  16. #ifdef CONFIG_SILENT_CONSOLE
  17. #define SILENT_CALLBACK "silent:silent,"
  18. #else
  19. #define SILENT_CALLBACK
  20. #endif
  21. #ifdef CONFIG_REGEX
  22. #define ENV_DOT_ESCAPE "\\"
  23. #else
  24. #define ENV_DOT_ESCAPE
  25. #endif
  26. #ifdef CONFIG_CMD_DNS
  27. #define DNS_CALLBACK "dnsip:dnsip,"
  28. #else
  29. #define DNS_CALLBACK
  30. #endif
  31. #ifdef CONFIG_NET
  32. #define NET_CALLBACKS \
  33. "bootfile:bootfile," \
  34. "ipaddr:ipaddr," \
  35. "gatewayip:gatewayip," \
  36. "netmask:netmask," \
  37. "serverip:serverip," \
  38. "nvlan:nvlan," \
  39. "vlan:vlan," \
  40. DNS_CALLBACK \
  41. "eth" ETHADDR_WILDCARD "addr:ethaddr,"
  42. #else
  43. #define NET_CALLBACKS
  44. #endif
  45. #ifdef CONFIG_IPV6
  46. #define NET6_CALLBACKS \
  47. "ip6addr:ip6addr," \
  48. "serverip6:serverip6," \
  49. "gatewayip6:gatewayip6,"
  50. #else
  51. #define NET6_CALLBACKS
  52. #endif
  53. #ifdef CONFIG_BOOTSTD_FULL
  54. #define BOOTSTD_CALLBACK \
  55. "bootmeths:bootmeths," \
  56. "bootargs:bootargs,"
  57. #else
  58. #define BOOTSTD_CALLBACK
  59. #endif
  60. /*
  61. * This list of callback bindings is static, but may be overridden by defining
  62. * a new association in the ".callbacks" environment variable.
  63. */
  64. #define ENV_CALLBACK_LIST_STATIC ENV_DOT_ESCAPE ENV_CALLBACK_VAR ":callbacks," \
  65. ENV_DOT_ESCAPE ENV_FLAGS_VAR ":flags," \
  66. "baudrate:baudrate," \
  67. NET_CALLBACKS \
  68. NET6_CALLBACKS \
  69. BOOTSTD_CALLBACK \
  70. "loadaddr:loadaddr," \
  71. SILENT_CALLBACK \
  72. "stdin:console,stdout:console,stderr:console," \
  73. "serial#:serialno," \
  74. CFG_ENV_CALLBACK_LIST_STATIC
  75. #ifndef CONFIG_SPL_BUILD
  76. void env_callback_init(struct env_entry *var_entry);
  77. #else
  78. static inline void env_callback_init(struct env_entry *var_entry)
  79. {
  80. }
  81. #endif
  82. #endif /* __ENV_CALLBACK_H__ */