commit bb766caa49f4aef036208023290f16ce7b1cf05d Author: Haren Myneni Date: Tue Aug 13 14:40:26 2024 -0700 drmgr/SLOT: Add kernel interface support for device tree update Use the following kernel interfaces for SLOT device type to update the device tree if this feature is enabled in the kernel. dt add index --> for IO add dt remove index --> for IO remove Signed-off-by: Haren Myneni Signed-off-by: Tyrel Datwyler diff --git a/src/drmgr/drslot_chrp_slot.c b/src/drmgr/drslot_chrp_slot.c index 0966c25..180b108 100644 --- a/src/drmgr/drslot_chrp_slot.c +++ b/src/drmgr/drslot_chrp_slot.c @@ -71,7 +71,10 @@ release_slot(struct dr_node *slot) if (rc) return rc; - rc = remove_device_tree_nodes(slot->ofdt_path); + if (kernel_dlpar_exists()) + rc = do_dt_kernel_dlpar(slot->drc_index, REMOVE); + else + rc = remove_device_tree_nodes(slot->ofdt_path); if (rc) { acquire_drc(slot->drc_index); return rc; @@ -160,7 +163,6 @@ static int acquire_slot(char *drc_name, struct dr_node **slot) { struct dr_connector drc; - struct of_node *of_nodes; char path[DR_PATH_MAX]; int rc; @@ -180,14 +182,21 @@ acquire_slot(char *drc_name, struct dr_node **slot) if (rc) return rc; - of_nodes = configure_connector(drc.index); - if (of_nodes == NULL) { - release_drc(drc.index, PCI_DLPAR_DEV); - return -1; + if (kernel_dlpar_exists()) { + rc = do_dt_kernel_dlpar(drc.index, ADD); + } else { + struct of_node *of_nodes; + + of_nodes = configure_connector(drc.index); + if (of_nodes == NULL) { + release_drc(drc.index, PCI_DLPAR_DEV); + return -1; + } + + rc = add_device_tree_nodes(path, of_nodes); + free_of_node(of_nodes); } - rc = add_device_tree_nodes(path, of_nodes); - free_of_node(of_nodes); if (rc) { say(ERROR, "add_device_tree_nodes failed at %s\n", path); release_drc(drc.index, PCI_DLPAR_DEV);