Lines Matching refs:map

13 static void env_clear_common(u32 index, const struct env_map_common *map)  in env_clear_common()  argument
15 map[index].val->val = 0; in env_clear_common()
16 map[index].val->set = false; in env_clear_common()
19 static int env_read_common(u32 index, const struct env_map_common *map) in env_read_common() argument
23 if (!env_get_yesno(map[index].env_name)) { in env_read_common()
24 if (map[index].type == ENV_HEX) { in env_read_common()
25 val = (u32)env_get_hex(map[index].env_name, 0); in env_read_common()
26 debug("ENV: %s: = %#x\n", map[index].env_name, val); in env_read_common()
28 val = (u32)env_get_ulong(map[index].env_name, 10, 0); in env_read_common()
29 debug("ENV: %s: = %d\n", map[index].env_name, val); in env_read_common()
32 map[index].val->val = val; in env_read_common()
33 map[index].val->set = true; in env_read_common()
39 static void env_clear_core(u32 index, const struct env_map_percpu *map) in env_clear_core() argument
42 (*map[index].val)[i].val = 0; in env_clear_core()
43 (*map[index].val)[i].set = false; in env_clear_core()
47 static int env_read_core(u32 index, const struct env_map_percpu *map) in env_read_core() argument
53 sprintf(command, "%s_%u", map[index].env_name, i); in env_read_core()
55 if (map[index].type == ENV_HEX) { in env_read_core()
63 (*map[index].val)[i].val = val; in env_read_core()
64 (*map[index].val)[i].set = true; in env_read_core()
71 static int env_validate_common(u32 index, const struct env_map_common *map) in env_validate_common() argument
73 u32 value = map[index].val->val; in env_validate_common()
74 bool set = map[index].val->set; in env_validate_common()
75 u32 min = map[index].min; in env_validate_common()
76 u32 max = map[index].max; in env_validate_common()
79 if (map[index].mandatory && !set) { in env_validate_common()
81 map[index].env_name); in env_validate_common()
88 if (map[index].type == ENV_HEX) in env_validate_common()
90 map[index].env_name, min, max); in env_validate_common()
93 map[index].env_name, min, max); in env_validate_common()
101 static int env_validate_core(u32 index, const struct env_map_percpu *map, in env_validate_core() argument
106 bool mandatory = map[index].mandatory; in env_validate_core()
110 set = (*map[index].val)[i].set; in env_validate_core()
111 value = (*map[index].val)[i].val; in env_validate_core()
116 i, map[index].env_name, i); in env_validate_core()
121 min = map[index].min[i]; in env_validate_core()
122 max = map[index].max[i]; in env_validate_core()
126 if (map[index].type == ENV_HEX) in env_validate_core()
128 map[index].env_name, i, min, max); in env_validate_core()
131 map[index].env_name, i, min, max); in env_validate_core()
140 void envs_cleanup_core(const struct env_map_percpu *map) in envs_cleanup_core() argument
143 for (u32 i = 0; map[i].env_name; i++) in envs_cleanup_core()
144 env_clear_core(i, map); in envs_cleanup_core()
147 void envs_cleanup_common(const struct env_map_common *map) in envs_cleanup_common() argument
150 for (u32 i = 0; map[i].env_name; i++) in envs_cleanup_common()
151 env_clear_common(i, map); in envs_cleanup_common()
154 int envs_read_common(const struct env_map_common *map) in envs_read_common() argument
158 for (u32 i = 0; map[i].env_name; i++) { in envs_read_common()
159 ret = env_read_common(i, map); in envs_read_common()
167 int envs_validate_common(const struct env_map_common *map) in envs_validate_common() argument
171 for (u32 i = 0; map[i].env_name; i++) { in envs_validate_common()
172 ret = env_validate_common(i, map); in envs_validate_common()
180 int envs_read_validate_common(const struct env_map_common *map) in envs_read_validate_common() argument
184 envs_cleanup_common(map); in envs_read_validate_common()
186 ret = envs_read_common(map); in envs_read_validate_common()
190 ret = envs_validate_common(map); in envs_read_validate_common()
197 int envs_read_validate_core(const struct env_map_percpu *map, in envs_read_validate_core() argument
202 envs_cleanup_core(map); in envs_read_validate_core()
204 for (u32 i = 0; map[i].env_name; i++) { in envs_read_validate_core()
205 ret = env_read_core(i, map); in envs_read_validate_core()
210 for (u32 i = 0; map[i].env_name; i++) { in envs_read_validate_core()
211 ret = env_validate_core(i, map, cpu_used); in envs_read_validate_core()
236 static int args_envs_read_search(const struct env_map_common *map, in args_envs_read_search() argument
239 for (int i = 0; map[i].env_name; i++) { in args_envs_read_search()
240 if (!strcmp(argv[0], map[i].env_name)) in args_envs_read_search()
249 static int arg_read_set(const struct env_map_common *map, u32 i, int argc, in arg_read_set() argument
254 if (map[i].type == ENV_HEX) in arg_read_set()
255 map[i].val->val = simple_strtoul(argv[1], &endp, 16); in arg_read_set()
257 map[i].val->val = simple_strtoul(argv[1], &endp, 10); in arg_read_set()
259 map[i].val->set = true; in arg_read_set()
266 map[i].val->set = false; in arg_read_set()
271 int args_envs_enumerate(const struct env_map_common *map, int enum_by, in args_envs_enumerate() argument
282 i = args_envs_read_search(map, argc, argv); in args_envs_enumerate()
286 debug("ARG: found '%s' with index %d\n", map[i].env_name, i); in args_envs_enumerate()
293 if (arg_read_set(map, i, argc, argv)) in args_envs_enumerate()
296 debug("ARG: value.s '%s' == %#x\n", argv[1], map[i].val->val); in args_envs_enumerate()