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