Lines Matching +full:my +full:- +full:drc +full:- +full:index

1 // SPDX-License-Identifier: GPL-2.0-only
25 #include <asm/rtas-work-area.h>
45 kfree(prop->name); in dlpar_free_cc_property()
46 kfree(prop->value); in dlpar_free_cc_property()
60 name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); in dlpar_parse_cc_property()
61 prop->name = kstrdup(name, GFP_KERNEL); in dlpar_parse_cc_property()
62 if (!prop->name) { in dlpar_parse_cc_property()
67 prop->length = be32_to_cpu(ccwa->prop_length); in dlpar_parse_cc_property()
68 value = (char *)ccwa + be32_to_cpu(ccwa->prop_offset); in dlpar_parse_cc_property()
69 prop->value = kmemdup(value, prop->length, GFP_KERNEL); in dlpar_parse_cc_property()
70 if (!prop->value) { in dlpar_parse_cc_property()
87 name = (const char *)ccwa + be32_to_cpu(ccwa->name_offset); in dlpar_parse_cc_node()
88 dn->full_name = kstrdup(name, GFP_KERNEL); in dlpar_parse_cc_node()
89 if (!dn->full_name) { in dlpar_parse_cc_node()
104 while (dn->properties) { in dlpar_free_one_cc_node()
105 prop = dn->properties; in dlpar_free_one_cc_node()
106 dn->properties = prop->next; in dlpar_free_one_cc_node()
110 kfree(dn->full_name); in dlpar_free_one_cc_node()
116 if (dn->child) in dlpar_free_cc_nodes()
117 dlpar_free_cc_nodes(dn->child); in dlpar_free_cc_nodes()
119 if (dn->sibling) in dlpar_free_cc_nodes()
120 dlpar_free_cc_nodes(dn->sibling); in dlpar_free_cc_nodes()
131 #define ERR_CFG_USE -9003
145 int rc = -1; in dlpar_configure_connector()
155 ccwa->drc_index = drc_index; in dlpar_configure_connector()
156 ccwa->zero = 0; in dlpar_configure_connector()
173 dn->parent = last_dn->parent; in dlpar_configure_connector()
174 last_dn->sibling = dn; in dlpar_configure_connector()
184 dn->parent = parent; in dlpar_configure_connector()
187 dn->parent = last_dn; in dlpar_configure_connector()
189 last_dn->child = dn; in dlpar_configure_connector()
200 if (!last_dn->properties) in dlpar_configure_connector()
201 last_dn->properties = property; in dlpar_configure_connector()
203 last_property->next = property; in dlpar_configure_connector()
209 last_dn = last_dn->parent; in dlpar_configure_connector()
216 "returned from configure-connector\n", rc); in dlpar_configure_connector()
238 dn->parent = parent; in dlpar_attach_node()
272 if (!rc && dn->child) in dlpar_changeset_attach_cc_nodes()
273 rc = dlpar_changeset_attach_cc_nodes(ocs, dn->child); in dlpar_changeset_attach_cc_nodes()
274 if (!rc && dn->sibling) in dlpar_changeset_attach_cc_nodes()
275 rc = dlpar_changeset_attach_cc_nodes(ocs, dn->sibling); in dlpar_changeset_attach_cc_nodes()
296 return -1; in dlpar_acquire_drc()
317 return -1; in dlpar_release_drc()
338 return -1; in dlpar_unisolate_drc()
346 get_device_node_with_drc_index(u32 index) in get_device_node_with_drc_index() argument
352 for_each_node_with_property(np, "ibm,my-drc-index") { in get_device_node_with_drc_index()
353 rc = of_property_read_u32(np, "ibm,my-drc-index", in get_device_node_with_drc_index()
357 __func__, np, "ibm,my-drc-index", rc); in get_device_node_with_drc_index()
362 if (index == node_index) in get_device_node_with_drc_index()
370 get_device_node_with_drc_info(u32 index) in get_device_node_with_drc_info() argument
373 struct of_drc_info drc; in get_device_node_with_drc_info() local
379 for_each_node_with_property(np, "ibm,drc-info") { in get_device_node_with_drc_info()
380 info = of_find_property(np, "ibm,drc-info", NULL); in get_device_node_with_drc_info()
391 if (of_read_drc_info_cell(&info, &value, &drc)) in get_device_node_with_drc_info()
393 if (index > drc.last_drc_index) in get_device_node_with_drc_info()
395 node_index = drc.drc_index_start; in get_device_node_with_drc_info()
396 for (j = 0; j < drc.num_sequential_elems; j++) { in get_device_node_with_drc_info()
397 if (index == node_index) in get_device_node_with_drc_info()
399 node_index += drc.sequential_inc; in get_device_node_with_drc_info()
407 static int dlpar_hp_dt_add(u32 index) in dlpar_hp_dt_add() argument
417 np = get_device_node_with_drc_index(index); in dlpar_hp_dt_add()
419 pr_err("%s: Adding device node for index (%d), but " in dlpar_hp_dt_add()
421 __func__, index); in dlpar_hp_dt_add()
422 rc = -EINVAL; in dlpar_hp_dt_add()
426 np = get_device_node_with_drc_info(index); in dlpar_hp_dt_add()
429 return -EIO; in dlpar_hp_dt_add()
432 nodes = dlpar_configure_connector(cpu_to_be32(index), np); in dlpar_hp_dt_add()
434 rc = -EIO; in dlpar_hp_dt_add()
440 * the device-tree. in dlpar_hp_dt_add()
478 u32 index; in dlpar_hp_dt_remove() local
482 * Prune all nodes with a matching index. in dlpar_hp_dt_remove()
486 for_each_node_with_property(np, "ibm,my-drc-index") { in dlpar_hp_dt_remove()
487 rc = of_property_read_u32(np, "ibm,my-drc-index", &index); in dlpar_hp_dt_remove()
490 __func__, np, "ibm,my-drc-index", rc); in dlpar_hp_dt_remove()
495 if (index == drc_index) { in dlpar_hp_dt_remove()
516 if (phpe->id_type != PSERIES_HP_ELOG_ID_DRC_INDEX) in dlpar_hp_dt()
517 return -EINVAL; in dlpar_hp_dt()
519 drc_index = be32_to_cpu(phpe->_drc_u.drc_index); in dlpar_hp_dt()
523 switch (phpe->action) { in dlpar_hp_dt()
531 pr_err("Invalid action (%d) specified\n", phpe->action); in dlpar_hp_dt()
532 rc = -EINVAL; in dlpar_hp_dt()
545 switch (hp_elog->resource) { in handle_dlpar_errorlog()
561 hp_elog->resource); in handle_dlpar_errorlog()
562 rc = -EINVAL; in handle_dlpar_errorlog()
573 handle_dlpar_errorlog(hp_work->errlog); in pseries_hp_work_fn()
575 kfree(hp_work->errlog); in pseries_hp_work_fn()
591 work->errlog = hp_errlog_copy; in queue_hotplug_event()
604 return -EINVAL; in dlpar_parse_resource()
607 hp_elog->resource = PSERIES_HP_ELOG_RESOURCE_MEM; in dlpar_parse_resource()
609 hp_elog->resource = PSERIES_HP_ELOG_RESOURCE_CPU; in dlpar_parse_resource()
611 hp_elog->resource = PSERIES_HP_ELOG_RESOURCE_DT; in dlpar_parse_resource()
614 return -EINVAL; in dlpar_parse_resource()
626 return -EINVAL; in dlpar_parse_action()
629 hp_elog->action = PSERIES_HP_ELOG_ACTION_ADD; in dlpar_parse_action()
631 hp_elog->action = PSERIES_HP_ELOG_ACTION_REMOVE; in dlpar_parse_action()
634 return -EINVAL; in dlpar_parse_action()
643 u32 count, index; in dlpar_parse_id_type() local
647 return -EINVAL; in dlpar_parse_id_type()
649 if (sysfs_streq(arg, "indexed-count")) { in dlpar_parse_id_type()
650 hp_elog->id_type = PSERIES_HP_ELOG_ID_DRC_IC; in dlpar_parse_id_type()
653 pr_err("No DRC count specified.\n"); in dlpar_parse_id_type()
654 return -EINVAL; in dlpar_parse_id_type()
658 pr_err("Invalid DRC count specified.\n"); in dlpar_parse_id_type()
659 return -EINVAL; in dlpar_parse_id_type()
664 pr_err("No DRC Index specified.\n"); in dlpar_parse_id_type()
665 return -EINVAL; in dlpar_parse_id_type()
668 if (kstrtou32(arg, 0, &index)) { in dlpar_parse_id_type()
669 pr_err("Invalid DRC Index specified.\n"); in dlpar_parse_id_type()
670 return -EINVAL; in dlpar_parse_id_type()
673 hp_elog->_drc_u.ic.count = cpu_to_be32(count); in dlpar_parse_id_type()
674 hp_elog->_drc_u.ic.index = cpu_to_be32(index); in dlpar_parse_id_type()
675 } else if (sysfs_streq(arg, "index")) { in dlpar_parse_id_type()
676 hp_elog->id_type = PSERIES_HP_ELOG_ID_DRC_INDEX; in dlpar_parse_id_type()
679 pr_err("No DRC Index specified.\n"); in dlpar_parse_id_type()
680 return -EINVAL; in dlpar_parse_id_type()
683 if (kstrtou32(arg, 0, &index)) { in dlpar_parse_id_type()
684 pr_err("Invalid DRC Index specified.\n"); in dlpar_parse_id_type()
685 return -EINVAL; in dlpar_parse_id_type()
688 hp_elog->_drc_u.drc_index = cpu_to_be32(index); in dlpar_parse_id_type()
690 hp_elog->id_type = PSERIES_HP_ELOG_ID_DRC_COUNT; in dlpar_parse_id_type()
693 pr_err("No DRC count specified.\n"); in dlpar_parse_id_type()
694 return -EINVAL; in dlpar_parse_id_type()
698 pr_err("Invalid DRC count specified.\n"); in dlpar_parse_id_type()
699 return -EINVAL; in dlpar_parse_id_type()
702 hp_elog->_drc_u.drc_count = cpu_to_be32(count); in dlpar_parse_id_type()
705 return -EINVAL; in dlpar_parse_id_type()
721 return -ENOMEM; in dlpar_store()
765 return pseries_hp_wq ? 0 : -ENOMEM; in dlpar_workqueue_init()