Skip to content

Commit

Permalink
drmgr/SLOT: 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 SLOT 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 a2d1b70 commit bb766ca
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/drmgr/drslot_chrp_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit bb766ca

Please sign in to comment.