From bb766caa49f4aef036208023290f16ce7b1cf05d Mon Sep 17 00:00:00 2001 From: Haren Myneni Date: Tue, 13 Aug 2024 14:40:26 -0700 Subject: [PATCH] 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 --- src/drmgr/drslot_chrp_slot.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/drmgr/drslot_chrp_slot.c b/src/drmgr/drslot_chrp_slot.c index 0966c256..180b1085 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);