env-lib.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2018 Synopsys, Inc. All rights reserved.
  4. * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
  5. */
  6. #ifndef __BOARD_ENV_LIB_H
  7. #define __BOARD_ENV_LIB_H
  8. #include <common.h>
  9. #include <config.h>
  10. #include <linux/kernel.h>
  11. enum env_type {
  12. ENV_DEC,
  13. ENV_HEX
  14. };
  15. typedef struct {
  16. u32 val;
  17. bool set;
  18. } u32_env;
  19. struct env_map_common {
  20. const char *const env_name;
  21. enum env_type type;
  22. bool mandatory;
  23. u32 min;
  24. u32 max;
  25. u32_env *val;
  26. };
  27. struct env_map_percpu {
  28. const char *const env_name;
  29. enum env_type type;
  30. bool mandatory;
  31. u32 min[NR_CPUS];
  32. u32 max[NR_CPUS];
  33. u32_env (*val)[NR_CPUS];
  34. };
  35. void envs_cleanup_common(const struct env_map_common *map);
  36. int envs_read_common(const struct env_map_common *map);
  37. int envs_validate_common(const struct env_map_common *map);
  38. int envs_read_validate_common(const struct env_map_common *map);
  39. void envs_cleanup_core(const struct env_map_percpu *map);
  40. int envs_read_validate_core(const struct env_map_percpu *map,
  41. bool (*cpu_used)(u32));
  42. int envs_process_and_validate(const struct env_map_common *common,
  43. const struct env_map_percpu *core,
  44. bool (*cpu_used)(u32));
  45. int args_envs_enumerate(const struct env_map_common *map,
  46. int enum_by, int argc, char *const argv[]);
  47. #endif /* __BOARD_ENV_LIB_H */