Skip to content

Commit

Permalink
drmgr/pci: Add kernel interface support for device tree update
Browse files Browse the repository at this point in the history
Use the following kernel interfaces for PCI device type to update
the device tree if this feature is enabled in the kernel.

dt add index <DRC index>  --> for IO add
dt remove index <DRC index> --> for IO remove

Signed-off-by: Haren Myneni <[email protected]>
Signed-off-by: Tyrel Datwyler <[email protected]>
  • Loading branch information
hmyneni authored and tyreld committed Sep 18, 2024
1 parent 9aaa1a6 commit a2d1b70
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/drmgr/drslot_chrp_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ static int add_work(struct dr_node *node, bool partner_device)
/* on when */
int iso_state = ISOLATE; /* Tells us isolation state after */
int rc;
struct of_node *new_nodes;/* nodes returned from configure_connector */

/*
* Already checked the card presence for the original device
Expand Down Expand Up @@ -445,16 +444,26 @@ static int add_work(struct dr_node *node, bool partner_device)
* the return status requires a message, print it out
* and exit, otherwise, add the nodes to the OF tree.
*/
new_nodes = configure_connector(node->drc_index);
if (new_nodes == NULL) {
rtas_set_indicator(ISOLATION_STATE, node->drc_index, ISOLATE);
set_power(node->drc_power, POWER_OFF);
return -1;
if (kernel_dlpar_exists()) {
rc = do_dt_kernel_dlpar(node->drc_index, ADD);
} else {
struct of_node *new_nodes; /* nodes returned from */
/* configure_connector */

new_nodes = configure_connector(node->drc_index);
if (new_nodes == NULL) {
rtas_set_indicator(ISOLATION_STATE, node->drc_index,
ISOLATE);
set_power(node->drc_power, POWER_OFF);
return -1;
}

say(DEBUG, "Adding %s to %s\n", new_nodes->name,
node->ofdt_path);
rc = add_device_tree_nodes(node->ofdt_path, new_nodes);
free_of_node(new_nodes);
}

say(DEBUG, "Adding %s to %s\n", new_nodes->name, node->ofdt_path);
rc = add_device_tree_nodes(node->ofdt_path, new_nodes);
free_of_node(new_nodes);
if (rc) {
say(DEBUG, "add_device_tree_nodes failed at %s\n",
node->ofdt_path);
Expand Down Expand Up @@ -786,7 +795,10 @@ static int remove_work(struct dr_node *node, bool partner_device)
* the device tree.
*/
for (child = node->children; child; child = child->next) {
rc = remove_device_tree_nodes(child->ofdt_path);
if (kernel_dlpar_exists())
rc = do_dt_kernel_dlpar(child->drc_index, REMOVE);
else
rc = remove_device_tree_nodes(child->ofdt_path);
if (rc) {
say(ERROR, "%s", sw_error);
rtas_set_indicator(ISOLATION_STATE, node->drc_index,
Expand Down

0 comments on commit a2d1b70

Please sign in to comment.