Lines Matching refs:map

11 static void env_clear_common(u32 index, const struct env_map_common *map)  in env_clear_common()  argument
13 map[index].val->val = 0; in env_clear_common()
14 map[index].val->set = false; in env_clear_common()
17 static int env_read_common(u32 index, const struct env_map_common *map) in env_read_common() argument
21 if (!env_get_yesno(map[index].env_name)) { in env_read_common()
22 if (map[index].type == ENV_HEX) { in env_read_common()
23 val = (u32)env_get_hex(map[index].env_name, 0); in env_read_common()
24 debug("ENV: %s: = %#x\n", map[index].env_name, val); in env_read_common()
26 val = (u32)env_get_ulong(map[index].env_name, 10, 0); in env_read_common()
27 debug("ENV: %s: = %d\n", map[index].env_name, val); in env_read_common()
30 map[index].val->val = val; in env_read_common()
31 map[index].val->set = true; in env_read_common()
37 static void env_clear_core(u32 index, const struct env_map_percpu *map) in env_clear_core() argument
40 (*map[index].val)[i].val = 0; in env_clear_core()
41 (*map[index].val)[i].set = false; in env_clear_core()
45 static int env_read_core(u32 index, const struct env_map_percpu *map) in env_read_core() argument
51 sprintf(command, "%s_%u", map[index].env_name, i); in env_read_core()
53 if (map[index].type == ENV_HEX) { in env_read_core()
61 (*map[index].val)[i].val = val; in env_read_core()
62 (*map[index].val)[i].set = true; in env_read_core()
69 static int env_validate_common(u32 index, const struct env_map_common *map) in env_validate_common() argument
71 u32 value = map[index].val->val; in env_validate_common()
72 bool set = map[index].val->set; in env_validate_common()
73 u32 min = map[index].min; in env_validate_common()
74 u32 max = map[index].max; in env_validate_common()
77 if (map[index].mandatory && !set) { in env_validate_common()
79 map[index].env_name); in env_validate_common()
86 if (map[index].type == ENV_HEX) in env_validate_common()
88 map[index].env_name, min, max); in env_validate_common()
91 map[index].env_name, min, max); in env_validate_common()
99 static int env_validate_core(u32 index, const struct env_map_percpu *map, in env_validate_core() argument
104 bool mandatory = map[index].mandatory; in env_validate_core()
108 set = (*map[index].val)[i].set; in env_validate_core()
109 value = (*map[index].val)[i].val; in env_validate_core()
114 i, map[index].env_name, i); in env_validate_core()
119 min = map[index].min[i]; in env_validate_core()
120 max = map[index].max[i]; in env_validate_core()
124 if (map[index].type == ENV_HEX) in env_validate_core()
126 map[index].env_name, i, min, max); in env_validate_core()
129 map[index].env_name, i, min, max); in env_validate_core()
138 void envs_cleanup_core(const struct env_map_percpu *map) in envs_cleanup_core() argument
141 for (u32 i = 0; map[i].env_name; i++) in envs_cleanup_core()
142 env_clear_core(i, map); in envs_cleanup_core()
145 void envs_cleanup_common(const struct env_map_common *map) in envs_cleanup_common() argument
148 for (u32 i = 0; map[i].env_name; i++) in envs_cleanup_common()
149 env_clear_common(i, map); in envs_cleanup_common()
152 int envs_read_common(const struct env_map_common *map) in envs_read_common() argument
156 for (u32 i = 0; map[i].env_name; i++) { in envs_read_common()
157 ret = env_read_common(i, map); in envs_read_common()
165 int envs_validate_common(const struct env_map_common *map) in envs_validate_common() argument
169 for (u32 i = 0; map[i].env_name; i++) { in envs_validate_common()
170 ret = env_validate_common(i, map); in envs_validate_common()
178 int envs_read_validate_common(const struct env_map_common *map) in envs_read_validate_common() argument
182 envs_cleanup_common(map); in envs_read_validate_common()
184 ret = envs_read_common(map); in envs_read_validate_common()
188 ret = envs_validate_common(map); in envs_read_validate_common()
195 int envs_read_validate_core(const struct env_map_percpu *map, in envs_read_validate_core() argument
200 envs_cleanup_core(map); in envs_read_validate_core()
202 for (u32 i = 0; map[i].env_name; i++) { in envs_read_validate_core()
203 ret = env_read_core(i, map); in envs_read_validate_core()
208 for (u32 i = 0; map[i].env_name; i++) { in envs_read_validate_core()
209 ret = env_validate_core(i, map, cpu_used); in envs_read_validate_core()
234 static int args_envs_read_search(const struct env_map_common *map, in args_envs_read_search() argument
237 for (int i = 0; map[i].env_name; i++) { in args_envs_read_search()
238 if (!strcmp(argv[0], map[i].env_name)) in args_envs_read_search()
247 static int arg_read_set(const struct env_map_common *map, u32 i, int argc, in arg_read_set() argument
252 if (map[i].type == ENV_HEX) in arg_read_set()
253 map[i].val->val = simple_strtoul(argv[1], &endp, 16); in arg_read_set()
255 map[i].val->val = simple_strtoul(argv[1], &endp, 10); in arg_read_set()
257 map[i].val->set = true; in arg_read_set()
264 map[i].val->set = false; in arg_read_set()
269 int args_envs_enumerate(const struct env_map_common *map, int enum_by, in args_envs_enumerate() argument
280 i = args_envs_read_search(map, argc, argv); in args_envs_enumerate()
284 debug("ARG: found '%s' with index %d\n", map[i].env_name, i); in args_envs_enumerate()
291 if (arg_read_set(map, i, argc, argv)) in args_envs_enumerate()
294 debug("ARG: value.s '%s' == %#x\n", argv[1], map[i].val->val); in args_envs_enumerate()