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 7 #ifndef __BOARD_ENV_LIB_H 8 #define __BOARD_ENV_LIB_H 9 10 #include <config.h> 11 #include <linux/kernel.h> 12 13 enum env_type { 14 ENV_DEC, 15 ENV_HEX 16 }; 17 18 typedef struct { 19 u32 val; 20 bool set; 21 } u32_env; 22 23 struct env_map_common { 24 const char *const env_name; 25 enum env_type type; 26 bool mandatory; 27 u32 min; 28 u32 max; 29 u32_env *val; 30 }; 31 32 struct env_map_percpu { 33 const char *const env_name; 34 enum env_type type; 35 bool mandatory; 36 u32 min[NR_CPUS]; 37 u32 max[NR_CPUS]; 38 u32_env (*val)[NR_CPUS]; 39 }; 40 41 void envs_cleanup_common(const struct env_map_common *map); 42 int envs_read_common(const struct env_map_common *map); 43 int envs_validate_common(const struct env_map_common *map); 44 int envs_read_validate_common(const struct env_map_common *map); 45 46 void envs_cleanup_core(const struct env_map_percpu *map); 47 int envs_read_validate_core(const struct env_map_percpu *map, 48 bool (*cpu_used)(u32)); 49 int envs_process_and_validate(const struct env_map_common *common, 50 const struct env_map_percpu *core, 51 bool (*cpu_used)(u32)); 52 53 int args_envs_enumerate(const struct env_map_common *map, 54 int enum_by, int argc, char *const argv[]); 55 56 #endif /* __BOARD_ENV_LIB_H */ 57