Lines Matching +full:prop +full:-
1 // SPDX-License-Identifier: GPL-2.0-or-later
27 last_lmb = &drmem_info->lmbs[drmem_info->n_lmbs - 1]; in drmem_lmb_memory_max()
28 return last_lmb->base_addr + drmem_lmb_size(); in drmem_lmb_memory_max()
37 return lmb->flags & ~DRMEM_LMB_RESERVED; in drmem_lmb_flags()
40 static struct property *clone_property(struct property *prop, u32 prop_sz) in clone_property() argument
48 new_prop->name = kstrdup(prop->name, GFP_KERNEL); in clone_property()
49 new_prop->value = kzalloc(prop_sz, GFP_KERNEL); in clone_property()
50 if (!new_prop->name || !new_prop->value) { in clone_property()
51 kfree(new_prop->name); in clone_property()
52 kfree(new_prop->value); in clone_property()
57 new_prop->length = prop_sz; in clone_property()
65 struct property *prop) in drmem_update_dt_v1() argument
72 new_prop = clone_property(prop, prop->length); in drmem_update_dt_v1()
74 return -1; in drmem_update_dt_v1()
76 p = new_prop->value; in drmem_update_dt_v1()
77 *p++ = cpu_to_be32(drmem_info->n_lmbs); in drmem_update_dt_v1()
82 dr_cell->base_addr = cpu_to_be64(lmb->base_addr); in drmem_update_dt_v1()
83 dr_cell->drc_index = cpu_to_be32(lmb->drc_index); in drmem_update_dt_v1()
84 dr_cell->aa_index = cpu_to_be32(lmb->aa_index); in drmem_update_dt_v1()
85 dr_cell->flags = cpu_to_be32(drmem_lmb_flags(lmb)); in drmem_update_dt_v1()
97 dr_cell->base_addr = cpu_to_be64(lmb->base_addr); in init_drconf_v2_cell()
98 dr_cell->drc_index = cpu_to_be32(lmb->drc_index); in init_drconf_v2_cell()
99 dr_cell->aa_index = cpu_to_be32(lmb->aa_index); in init_drconf_v2_cell()
100 dr_cell->flags = cpu_to_be32(drmem_lmb_flags(lmb)); in init_drconf_v2_cell()
104 struct property *prop) in drmem_update_dt_v2() argument
122 if (prev_lmb->aa_index != lmb->aa_index || in drmem_update_dt_v2()
130 new_prop = clone_property(prop, prop_sz); in drmem_update_dt_v2()
132 return -1; in drmem_update_dt_v2()
134 p = new_prop->value; in drmem_update_dt_v2()
151 if (prev_lmb->aa_index != lmb->aa_index || in drmem_update_dt_v2()
154 dr_cell->seq_lmbs = cpu_to_be32(seq_lmbs); in drmem_update_dt_v2()
167 dr_cell->seq_lmbs = cpu_to_be32(seq_lmbs); in drmem_update_dt_v2()
175 struct property *prop; in drmem_update_dt() local
176 int rc = -1; in drmem_update_dt()
178 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); in drmem_update_dt()
180 return -1; in drmem_update_dt()
187 prop = of_find_property(memory, "ibm,dynamic-memory", NULL); in drmem_update_dt()
188 if (prop) { in drmem_update_dt()
189 rc = drmem_update_dt_v1(memory, prop); in drmem_update_dt()
191 prop = of_find_property(memory, "ibm,dynamic-memory-v2", NULL); in drmem_update_dt()
192 if (prop) in drmem_update_dt()
193 rc = drmem_update_dt_v2(memory, prop); in drmem_update_dt()
202 const __be32 **prop) in read_drconf_v1_cell() argument
204 const __be32 *p = *prop; in read_drconf_v1_cell()
206 lmb->base_addr = of_read_number(p, n_root_addr_cells); in read_drconf_v1_cell()
208 lmb->drc_index = of_read_number(p++, 1); in read_drconf_v1_cell()
212 lmb->aa_index = of_read_number(p++, 1); in read_drconf_v1_cell()
213 lmb->flags = of_read_number(p++, 1); in read_drconf_v1_cell()
215 *prop = p; in read_drconf_v1_cell()
219 __walk_drmem_v1_lmbs(const __be32 *prop, const __be32 *usm, void *data, in __walk_drmem_v1_lmbs() argument
226 n_lmbs = of_read_number(prop++, 1); in __walk_drmem_v1_lmbs()
228 read_drconf_v1_cell(&lmb, &prop); in __walk_drmem_v1_lmbs()
238 const __be32 **prop) in read_drconf_v2_cell() argument
240 const __be32 *p = *prop; in read_drconf_v2_cell()
242 dr_cell->seq_lmbs = of_read_number(p++, 1); in read_drconf_v2_cell()
243 dr_cell->base_addr = of_read_number(p, n_root_addr_cells); in read_drconf_v2_cell()
245 dr_cell->drc_index = of_read_number(p++, 1); in read_drconf_v2_cell()
246 dr_cell->aa_index = of_read_number(p++, 1); in read_drconf_v2_cell()
247 dr_cell->flags = of_read_number(p++, 1); in read_drconf_v2_cell()
249 *prop = p; in read_drconf_v2_cell()
253 __walk_drmem_v2_lmbs(const __be32 *prop, const __be32 *usm, void *data, in __walk_drmem_v2_lmbs() argument
261 lmb_sets = of_read_number(prop++, 1); in __walk_drmem_v2_lmbs()
263 read_drconf_v2_cell(&dr_cell, &prop); in __walk_drmem_v2_lmbs()
288 const __be32 *prop, *usm; in walk_drmem_lmbs_early() local
289 int len, ret = -ENODEV; in walk_drmem_lmbs_early()
291 prop = of_get_flat_dt_prop(node, "ibm,lmb-size", &len); in walk_drmem_lmbs_early()
292 if (!prop || len < dt_root_size_cells * sizeof(__be32)) in walk_drmem_lmbs_early()
299 drmem_info->lmb_size = dt_mem_next_cell(dt_root_size_cells, &prop); in walk_drmem_lmbs_early()
301 usm = of_get_flat_dt_prop(node, "linux,drconf-usable-memory", &len); in walk_drmem_lmbs_early()
303 prop = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &len); in walk_drmem_lmbs_early()
304 if (prop) { in walk_drmem_lmbs_early()
305 ret = __walk_drmem_v1_lmbs(prop, usm, data, func); in walk_drmem_lmbs_early()
307 prop = of_get_flat_dt_prop(node, "ibm,dynamic-memory-v2", in walk_drmem_lmbs_early()
309 if (prop) in walk_drmem_lmbs_early()
310 ret = __walk_drmem_v2_lmbs(prop, usm, data, func); in walk_drmem_lmbs_early()
327 if (lmb->drc_index != updated_lmb->drc_index) in update_lmb()
330 lmb->aa_index = updated_lmb->aa_index; in update_lmb()
340 * dynamic-reconfiguration-memory node property.
342 void drmem_update_lmbs(struct property *prop) in drmem_update_lmbs() argument
351 if (!strcmp(prop->name, "ibm,dynamic-memory")) in drmem_update_lmbs()
352 __walk_drmem_v1_lmbs(prop->value, NULL, NULL, update_lmb); in drmem_update_lmbs()
353 else if (!strcmp(prop->name, "ibm,dynamic-memory-v2")) in drmem_update_lmbs()
354 __walk_drmem_v2_lmbs(prop->value, NULL, NULL, update_lmb); in drmem_update_lmbs()
360 const __be32 *prop; in init_drmem_lmb_size() local
363 if (drmem_info->lmb_size) in init_drmem_lmb_size()
366 prop = of_get_property(dn, "ibm,lmb-size", &len); in init_drmem_lmb_size()
367 if (!prop || len < n_root_size_cells * sizeof(__be32)) { in init_drmem_lmb_size()
369 return -1; in init_drmem_lmb_size()
372 drmem_info->lmb_size = of_read_number(prop, n_root_size_cells); in init_drmem_lmb_size()
377 * Returns the property linux,drconf-usable-memory if
379 * added by kexec-tools)
383 const __be32 *prop; in of_get_usable_memory() local
386 prop = of_get_property(dn, "linux,drconf-usable-memory", &len); in of_get_usable_memory()
387 if (!prop || len < sizeof(unsigned int)) in of_get_usable_memory()
390 return prop; in of_get_usable_memory()
397 const __be32 *prop, *usm; in walk_drmem_lmbs() local
398 int ret = -ENODEV; in walk_drmem_lmbs()
413 prop = of_get_property(dn, "ibm,dynamic-memory", NULL); in walk_drmem_lmbs()
414 if (prop) { in walk_drmem_lmbs()
415 ret = __walk_drmem_v1_lmbs(prop, usm, data, func); in walk_drmem_lmbs()
417 prop = of_get_property(dn, "ibm,dynamic-memory-v2", NULL); in walk_drmem_lmbs()
418 if (prop) in walk_drmem_lmbs()
419 ret = __walk_drmem_v2_lmbs(prop, usm, data, func); in walk_drmem_lmbs()
425 static void __init init_drmem_v1_lmbs(const __be32 *prop) in init_drmem_v1_lmbs() argument
429 drmem_info->n_lmbs = of_read_number(prop++, 1); in init_drmem_v1_lmbs()
430 if (drmem_info->n_lmbs == 0) in init_drmem_v1_lmbs()
433 drmem_info->lmbs = kcalloc(drmem_info->n_lmbs, sizeof(*lmb), in init_drmem_v1_lmbs()
435 if (!drmem_info->lmbs) in init_drmem_v1_lmbs()
439 read_drconf_v1_cell(lmb, &prop); in init_drmem_v1_lmbs()
442 static void __init init_drmem_v2_lmbs(const __be32 *prop) in init_drmem_v2_lmbs() argument
450 lmb_sets = of_read_number(prop++, 1); in init_drmem_v2_lmbs()
455 p = prop; in init_drmem_v2_lmbs()
458 drmem_info->n_lmbs += dr_cell.seq_lmbs; in init_drmem_v2_lmbs()
461 drmem_info->lmbs = kcalloc(drmem_info->n_lmbs, sizeof(*lmb), in init_drmem_v2_lmbs()
463 if (!drmem_info->lmbs) in init_drmem_v2_lmbs()
468 p = prop; in init_drmem_v2_lmbs()
474 lmb = &drmem_info->lmbs[lmb_index++]; in init_drmem_v2_lmbs()
476 lmb->base_addr = dr_cell.base_addr; in init_drmem_v2_lmbs()
477 dr_cell.base_addr += drmem_info->lmb_size; in init_drmem_v2_lmbs()
479 lmb->drc_index = dr_cell.drc_index; in init_drmem_v2_lmbs()
482 lmb->aa_index = dr_cell.aa_index; in init_drmem_v2_lmbs()
483 lmb->flags = dr_cell.flags; in init_drmem_v2_lmbs()
491 const __be32 *prop; in drmem_init() local
493 dn = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); in drmem_init()
502 prop = of_get_property(dn, "ibm,dynamic-memory", NULL); in drmem_init()
503 if (prop) { in drmem_init()
504 init_drmem_v1_lmbs(prop); in drmem_init()
506 prop = of_get_property(dn, "ibm,dynamic-memory-v2", NULL); in drmem_init()
507 if (prop) in drmem_init()
508 init_drmem_v2_lmbs(prop); in drmem_init()