summaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/rmgr/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/tidspbridge/rmgr/node.c')
-rw-r--r--drivers/staging/tidspbridge/rmgr/node.c1092
1 files changed, 507 insertions, 585 deletions
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 1562f3c1281c..5dadaa445ad9 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -17,6 +17,9 @@
*/
#include <linux/types.h>
+#include <linux/bitmap.h>
+#include <linux/list.h>
+
/* ----------------------------------- Host OS */
#include <dspbridge/host_os.h>
@@ -27,7 +30,6 @@
#include <dspbridge/dbc.h>
/* ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/list.h>
#include <dspbridge/memdefs.h>
#include <dspbridge/proc.h>
#include <dspbridge/strm.h>
@@ -50,7 +52,6 @@
#include <dspbridge/dspioctl.h>
/* ----------------------------------- Others */
-#include <dspbridge/gb.h>
#include <dspbridge/uuidutil.h>
/* ----------------------------------- This */
@@ -63,7 +64,6 @@
#include <dspbridge/nldr.h>
#include <dspbridge/drv.h>
-#include <dspbridge/drvdefs.h>
#include <dspbridge/resourcecleanup.h>
#include <_tiomap.h>
@@ -124,33 +124,36 @@
* ======== node_mgr ========
*/
struct node_mgr {
- struct dev_object *hdev_obj; /* Device object */
+ struct dev_object *dev_obj; /* Device object */
/* Function interface to Bridge driver */
struct bridge_drv_interface *intf_fxns;
- struct dcd_manager *hdcd_mgr; /* Proc/Node data manager */
+ struct dcd_manager *dcd_mgr; /* Proc/Node data manager */
struct disp_object *disp_obj; /* Node dispatcher */
- struct lst_list *node_list; /* List of all allocated nodes */
+ struct list_head node_list; /* List of all allocated nodes */
u32 num_nodes; /* Number of nodes in node_list */
u32 num_created; /* Number of nodes *created* on DSP */
- struct gb_t_map *pipe_map; /* Pipe connection bit map */
- struct gb_t_map *pipe_done_map; /* Pipes that are half free */
- struct gb_t_map *chnl_map; /* Channel allocation bit map */
- struct gb_t_map *dma_chnl_map; /* DMA Channel allocation bit map */
- struct gb_t_map *zc_chnl_map; /* Zero-Copy Channel alloc bit map */
+ DECLARE_BITMAP(pipe_map, MAXPIPES); /* Pipe connection bitmap */
+ DECLARE_BITMAP(pipe_done_map, MAXPIPES); /* Pipes that are half free */
+ /* Channel allocation bitmap */
+ DECLARE_BITMAP(chnl_map, CHNL_MAXCHANNELS);
+ /* DMA Channel allocation bitmap */
+ DECLARE_BITMAP(dma_chnl_map, CHNL_MAXCHANNELS);
+ /* Zero-Copy Channel alloc bitmap */
+ DECLARE_BITMAP(zc_chnl_map, CHNL_MAXCHANNELS);
struct ntfy_object *ntfy_obj; /* Manages registered notifications */
struct mutex node_mgr_lock; /* For critical sections */
- u32 ul_fxn_addrs[NUMRMSFXNS]; /* RMS function addresses */
+ u32 fxn_addrs[NUMRMSFXNS]; /* RMS function addresses */
struct msg_mgr *msg_mgr_obj;
/* Processor properties needed by Node Dispatcher */
- u32 ul_num_chnls; /* Total number of channels */
- u32 ul_chnl_offset; /* Offset of chnl ids rsvd for RMS */
- u32 ul_chnl_buf_size; /* Buffer size for data to RMS */
+ u32 num_chnls; /* Total number of channels */
+ u32 chnl_offset; /* Offset of chnl ids rsvd for RMS */
+ u32 chnl_buf_size; /* Buffer size for data to RMS */
int proc_family; /* eg, 5000 */
int proc_type; /* eg, 5510 */
- u32 udsp_word_size; /* Size of DSP word on host bytes */
- u32 udsp_data_mau_size; /* Size of DSP data MAU */
- u32 udsp_mau_size; /* Size of MAU */
+ u32 dsp_word_size; /* Size of DSP word on host bytes */
+ u32 dsp_data_mau_size; /* Size of DSP data MAU */
+ u32 dsp_mau_size; /* Size of MAU */
s32 min_pri; /* Minimum runtime priority for node */
s32 max_pri; /* Maximum runtime priority for node */
@@ -185,14 +188,14 @@ struct stream_chnl {
*/
struct node_object {
struct list_head list_elem;
- struct node_mgr *hnode_mgr; /* The manager of this node */
- struct proc_object *hprocessor; /* Back pointer to processor */
+ struct node_mgr *node_mgr; /* The manager of this node */
+ struct proc_object *processor; /* Back pointer to processor */
struct dsp_uuid node_uuid; /* Node's ID */
s32 prio; /* Node's current priority */
- u32 utimeout; /* Timeout for blocking NODE calls */
+ u32 timeout; /* Timeout for blocking NODE calls */
u32 heap_size; /* Heap Size */
- u32 udsp_heap_virt_addr; /* Heap Size */
- u32 ugpp_heap_virt_addr; /* Heap Size */
+ u32 dsp_heap_virt_addr; /* Heap Size */
+ u32 gpp_heap_virt_addr; /* Heap Size */
enum node_type ntype; /* Type of node: message, task, etc */
enum node_state node_state; /* NODE_ALLOCATED, NODE_CREATED, ... */
u32 num_inputs; /* Current number of inputs */
@@ -204,9 +207,9 @@ struct node_object {
struct node_createargs create_args; /* Args for node create func */
nodeenv node_env; /* Environment returned by RMS */
struct dcd_genericobj dcd_props; /* Node properties from DCD */
- struct dsp_cbdata *pargs; /* Optional args to pass to node */
+ struct dsp_cbdata *args; /* Optional args to pass to node */
struct ntfy_object *ntfy_obj; /* Manages registered notifications */
- char *pstr_dev_name; /* device name, if device node */
+ char *str_dev_name; /* device name, if device node */
struct sync_object *sync_done; /* Synchronize node_terminate */
s32 exit_status; /* execute function return status */
@@ -232,9 +235,9 @@ struct node_object {
/* Default buffer attributes */
static struct dsp_bufferattr node_dfltbufattrs = {
- 0, /* cb_struct */
- 1, /* segment_id */
- 0, /* buf_alignment */
+ .cb_struct = 0,
+ .segment_id = 1,
+ .buf_alignment = 0,
};
static void delete_node(struct node_object *hnode,
@@ -280,8 +283,7 @@ enum node_state node_get_state(void *hnode)
struct node_object *pnode = (struct node_object *)hnode;
if (!pnode)
return -1;
- else
- return pnode->node_state;
+ return pnode->node_state;
}
/*
@@ -365,7 +367,7 @@ int node_allocate(struct proc_object *hprocessor,
}
/* Assuming that 0 is not a valid function address */
- if (hnode_mgr->ul_fxn_addrs[0] == 0) {
+ if (hnode_mgr->fxn_addrs[0] == 0) {
/* No RMS on target - we currently can't handle this */
pr_err("%s: Failed, no RMS in base image\n", __func__);
status = -EPERM;
@@ -387,28 +389,28 @@ int node_allocate(struct proc_object *hprocessor,
status = -ENOMEM;
goto func_end;
}
- pnode->hnode_mgr = hnode_mgr;
+ pnode->node_mgr = hnode_mgr;
/* This critical section protects get_node_props */
mutex_lock(&hnode_mgr->node_mgr_lock);
/* Get dsp_ndbprops from node database */
- status = get_node_props(hnode_mgr->hdcd_mgr, pnode, node_uuid,
+ status = get_node_props(hnode_mgr->dcd_mgr, pnode, node_uuid,
&(pnode->dcd_props));
if (status)
goto func_cont;
pnode->node_uuid = *node_uuid;
- pnode->hprocessor = hprocessor;
+ pnode->processor = hprocessor;
pnode->ntype = pnode->dcd_props.obj_data.node_obj.ndb_props.ntype;
- pnode->utimeout = pnode->dcd_props.obj_data.node_obj.ndb_props.utimeout;
+ pnode->timeout = pnode->dcd_props.obj_data.node_obj.ndb_props.timeout;
pnode->prio = pnode->dcd_props.obj_data.node_obj.ndb_props.prio;
/* Currently only C64 DSP builds support Node Dynamic * heaps */
/* Allocate memory for node heap */
pnode->create_args.asa.task_arg_obj.heap_size = 0;
- pnode->create_args.asa.task_arg_obj.udsp_heap_addr = 0;
- pnode->create_args.asa.task_arg_obj.udsp_heap_res_addr = 0;
- pnode->create_args.asa.task_arg_obj.ugpp_heap_addr = 0;
+ pnode->create_args.asa.task_arg_obj.dsp_heap_addr = 0;
+ pnode->create_args.asa.task_arg_obj.dsp_heap_res_addr = 0;
+ pnode->create_args.asa.task_arg_obj.gpp_heap_addr = 0;
if (!attr_in)
goto func_cont;
@@ -424,7 +426,7 @@ int node_allocate(struct proc_object *hprocessor,
} else {
pnode->create_args.asa.task_arg_obj.heap_size =
attr_in->heap_size;
- pnode->create_args.asa.task_arg_obj.ugpp_heap_addr =
+ pnode->create_args.asa.task_arg_obj.gpp_heap_addr =
(u32) attr_in->pgpp_virt_addr;
}
if (status)
@@ -434,7 +436,7 @@ int node_allocate(struct proc_object *hprocessor,
pnode->create_args.asa.task_arg_obj.
heap_size + PAGE_SIZE,
(void **)&(pnode->create_args.asa.
- task_arg_obj.udsp_heap_res_addr),
+ task_arg_obj.dsp_heap_res_addr),
pr_ctxt);
if (status) {
pr_err("%s: Failed to reserve memory for heap: 0x%x\n",
@@ -457,20 +459,20 @@ int node_allocate(struct proc_object *hprocessor,
status = proc_map(hprocessor, (void *)attr_in->pgpp_virt_addr,
pnode->create_args.asa.task_arg_obj.heap_size,
(void *)pnode->create_args.asa.task_arg_obj.
- udsp_heap_res_addr, (void **)&mapped_addr, map_attrs,
+ dsp_heap_res_addr, (void **)&mapped_addr, map_attrs,
pr_ctxt);
if (status)
pr_err("%s: Failed to map memory for Heap: 0x%x\n",
__func__, status);
else
- pnode->create_args.asa.task_arg_obj.udsp_heap_addr =
+ pnode->create_args.asa.task_arg_obj.dsp_heap_addr =
(u32) mapped_addr;
func_cont:
mutex_unlock(&hnode_mgr->node_mgr_lock);
if (attr_in != NULL) {
/* Overrides of NBD properties */
- pnode->utimeout = attr_in->utimeout;
+ pnode->timeout = attr_in->timeout;
pnode->prio = attr_in->prio;
}
/* Create object to manage notifications */
@@ -562,7 +564,7 @@ func_cont:
/* Create a message queue for this node */
intf_fxns = hnode_mgr->intf_fxns;
status =
- (*intf_fxns->pfn_msg_create_queue) (hnode_mgr->msg_mgr_obj,
+ (*intf_fxns->msg_create_queue) (hnode_mgr->msg_mgr_obj,
&pnode->msg_queue_obj,
0,
pnode->create_args.asa.
@@ -573,7 +575,7 @@ func_cont:
if (!status) {
/* Create object for dynamic loading */
- status = hnode_mgr->nldr_fxns.pfn_allocate(hnode_mgr->nldr_obj,
+ status = hnode_mgr->nldr_fxns.allocate(hnode_mgr->nldr_obj,
(void *)pnode,
&pnode->dcd_props.
obj_data.node_obj,
@@ -594,7 +596,7 @@ func_cont:
stack_seg_name, STACKSEGLABEL) == 0) {
status =
hnode_mgr->nldr_fxns.
- pfn_get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG",
+ get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG",
&dynext_base);
if (status)
pr_err("%s: Failed to get addr for DYNEXT_BEG"
@@ -602,7 +604,7 @@ func_cont:
status =
hnode_mgr->nldr_fxns.
- pfn_get_fxn_addr(pnode->nldr_node_obj,
+ get_fxn_addr(pnode->nldr_node_obj,
"L1DSRAM_HEAP", &pul_value);
if (status)
@@ -619,7 +621,7 @@ func_cont:
goto func_end;
}
- ul_gpp_mem_base = (u32) host_res->dw_mem_base[1];
+ ul_gpp_mem_base = (u32) host_res->mem_base[1];
off_set = pul_value - dynext_base;
ul_stack_seg_addr = ul_gpp_mem_base + off_set;
ul_stack_seg_val = readl(ul_stack_seg_addr);
@@ -637,13 +639,12 @@ func_cont:
if (!status) {
/* Add the node to the node manager's list of allocated
* nodes. */
- lst_init_elem((struct list_head *)pnode);
NODE_SET_STATE(pnode, NODE_ALLOCATED);
mutex_lock(&hnode_mgr->node_mgr_lock);
- lst_put_tail(hnode_mgr->node_list, (struct list_head *) pnode);
- ++(hnode_mgr->num_nodes);
+ list_add_tail(&pnode->list_elem, &hnode_mgr->node_list);
+ ++(hnode_mgr->num_nodes);
/* Exit critical section */
mutex_unlock(&hnode_mgr->node_mgr_lock);
@@ -711,7 +712,7 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
if (pattr == NULL)
pattr = &node_dfltbufattrs; /* set defaults */
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (proc_id != DSP_UNIT) {
DBC_ASSERT(NULL);
goto func_end;
@@ -783,10 +784,10 @@ int node_change_priority(struct node_object *hnode, s32 prio)
DBC_REQUIRE(refs > 0);
- if (!hnode || !hnode->hnode_mgr) {
+ if (!hnode || !hnode->node_mgr) {
status = -EFAULT;
} else {
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
node_type = node_get_type(hnode);
if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET)
status = -EPERM;
@@ -807,12 +808,12 @@ int node_change_priority(struct node_object *hnode, s32 prio)
status = -EBADR;
goto func_cont;
}
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (proc_id == DSP_UNIT) {
status =
disp_node_change_priority(hnode_mgr->disp_obj,
hnode,
- hnode_mgr->ul_fxn_addrs
+ hnode_mgr->fxn_addrs
[RMSCHANGENODEPRIORITY],
hnode->node_env, prio);
}
@@ -841,229 +842,209 @@ int node_connect(struct node_object *node1, u32 stream1,
char *pstr_dev_name = NULL;
enum node_type node1_type = NODE_TASK;
enum node_type node2_type = NODE_TASK;
+ enum dsp_strmmode strm_mode;
struct node_strmdef *pstrm_def;
struct node_strmdef *input = NULL;
struct node_strmdef *output = NULL;
struct node_object *dev_node_obj;
struct node_object *hnode;
struct stream_chnl *pstream;
- u32 pipe_id = GB_NOBITS;
- u32 chnl_id = GB_NOBITS;
+ u32 pipe_id;
+ u32 chnl_id;
s8 chnl_mode;
u32 dw_length;
int status = 0;
DBC_REQUIRE(refs > 0);
- if ((node1 != (struct node_object *)DSP_HGPPNODE && !node1) ||
- (node2 != (struct node_object *)DSP_HGPPNODE && !node2))
- status = -EFAULT;
+ if (!node1 || !node2)
+ return -EFAULT;
- if (!status) {
- /* The two nodes must be on the same processor */
- if (node1 != (struct node_object *)DSP_HGPPNODE &&
- node2 != (struct node_object *)DSP_HGPPNODE &&
- node1->hnode_mgr != node2->hnode_mgr)
- status = -EPERM;
- /* Cannot connect a node to itself */
- if (node1 == node2)
- status = -EPERM;
+ /* The two nodes must be on the same processor */
+ if (node1 != (struct node_object *)DSP_HGPPNODE &&
+ node2 != (struct node_object *)DSP_HGPPNODE &&
+ node1->node_mgr != node2->node_mgr)
+ return -EPERM;
+
+ /* Cannot connect a node to itself */
+ if (node1 == node2)
+ return -EPERM;
+
+ /* node_get_type() will return NODE_GPP if hnode = DSP_HGPPNODE. */
+ node1_type = node_get_type(node1);
+ node2_type = node_get_type(node2);
+ /* Check stream indices ranges */
+ if ((node1_type != NODE_GPP && node1_type != NODE_DEVICE &&
+ stream1 >= MAX_OUTPUTS(node1)) ||
+ (node2_type != NODE_GPP && node2_type != NODE_DEVICE &&
+ stream2 >= MAX_INPUTS(node2)))
+ return -EINVAL;
- }
- if (!status) {
- /* node_get_type() will return NODE_GPP if hnode =
- * DSP_HGPPNODE. */
- node1_type = node_get_type(node1);
- node2_type = node_get_type(node2);
- /* Check stream indices ranges */
- if ((node1_type != NODE_GPP && node1_type != NODE_DEVICE &&
- stream1 >= MAX_OUTPUTS(node1)) || (node2_type != NODE_GPP
- && node2_type !=
- NODE_DEVICE
- && stream2 >=
- MAX_INPUTS(node2)))
- status = -EINVAL;
- }
- if (!status) {
- /*
- * Only the following types of connections are allowed:
- * task/dais socket < == > task/dais socket
- * task/dais socket < == > device
- * task/dais socket < == > GPP
- *
- * ie, no message nodes, and at least one task or dais
- * socket node.
- */
- if (node1_type == NODE_MESSAGE || node2_type == NODE_MESSAGE ||
- (node1_type != NODE_TASK && node1_type != NODE_DAISSOCKET &&
- node2_type != NODE_TASK && node2_type != NODE_DAISSOCKET))
- status = -EPERM;
- }
+ /*
+ * Only the following types of connections are allowed:
+ * task/dais socket < == > task/dais socket
+ * task/dais socket < == > device
+ * task/dais socket < == > GPP
+ *
+ * ie, no message nodes, and at least one task or dais
+ * socket node.
+ */
+ if (node1_type == NODE_MESSAGE || node2_type == NODE_MESSAGE ||
+ (node1_type != NODE_TASK &&
+ node1_type != NODE_DAISSOCKET &&
+ node2_type != NODE_TASK &&
+ node2_type != NODE_DAISSOCKET))
+ return -EPERM;
/*
* Check stream mode. Default is STRMMODE_PROCCOPY.
*/
- if (!status && pattrs) {
- if (pattrs->strm_mode != STRMMODE_PROCCOPY)
- status = -EPERM; /* illegal stream mode */
-
- }
- if (status)
- goto func_end;
+ if (pattrs && pattrs->strm_mode != STRMMODE_PROCCOPY)
+ return -EPERM; /* illegal stream mode */
if (node1_type != NODE_GPP) {
- hnode_mgr = node1->hnode_mgr;
+ hnode_mgr = node1->node_mgr;
} else {
DBC_ASSERT(node2 != (struct node_object *)DSP_HGPPNODE);
- hnode_mgr = node2->hnode_mgr;
+ hnode_mgr = node2->node_mgr;
}
+
/* Enter critical section */
mutex_lock(&hnode_mgr->node_mgr_lock);
/* Nodes must be in the allocated state */
- if (node1_type != NODE_GPP && node_get_state(node1) != NODE_ALLOCATED)
+ if (node1_type != NODE_GPP &&
+ node_get_state(node1) != NODE_ALLOCATED) {
status = -EBADR;
+ goto out_unlock;
+ }
- if (node2_type != NODE_GPP && node_get_state(node2) != NODE_ALLOCATED)
+ if (node2_type != NODE_GPP &&
+ node_get_state(node2) != NODE_ALLOCATED) {
status = -EBADR;
+ goto out_unlock;
+ }
- if (!status) {
- /* Check that stream indices for task and dais socket nodes
- * are not already be used. (Device nodes checked later) */
- if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
- output =
- &(node1->create_args.asa.
- task_arg_obj.strm_out_def[stream1]);
- if (output->sz_device != NULL)
- status = -EISCONN;
-
+ /*
+ * Check that stream indices for task and dais socket nodes
+ * are not already be used. (Device nodes checked later)
+ */
+ if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
+ output = &(node1->create_args.asa.
+ task_arg_obj.strm_out_def[stream1]);
+ if (output->sz_device) {
+ status = -EISCONN;
+ goto out_unlock;
}
- if (node2_type == NODE_TASK || node2_type == NODE_DAISSOCKET) {
- input =
- &(node2->create_args.asa.
- task_arg_obj.strm_in_def[stream2]);
- if (input->sz_device != NULL)
- status = -EISCONN;
+ }
+ if (node2_type == NODE_TASK || node2_type == NODE_DAISSOCKET) {
+ input = &(node2->create_args.asa.
+ task_arg_obj.strm_in_def[stream2]);
+ if (input->sz_device) {
+ status = -EISCONN;
+ goto out_unlock;
}
+
}
/* Connecting two task nodes? */
- if (!status && ((node1_type == NODE_TASK ||
- node1_type == NODE_DAISSOCKET)
- && (node2_type == NODE_TASK
- || node2_type == NODE_DAISSOCKET))) {
+ if ((node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) &&
+ (node2_type == NODE_TASK ||
+ node2_type == NODE_DAISSOCKET)) {
/* Find available pipe */
- pipe_id = gb_findandset(hnode_mgr->pipe_map);
- if (pipe_id == GB_NOBITS) {
+ pipe_id = find_first_zero_bit(hnode_mgr->pipe_map, MAXPIPES);
+ if (pipe_id == MAXPIPES) {
status = -ECONNREFUSED;
- } else {
- node1->outputs[stream1].type = NODECONNECT;
- node2->inputs[stream2].type = NODECONNECT;
- node1->outputs[stream1].dev_id = pipe_id;
- node2->inputs[stream2].dev_id = pipe_id;
- output->sz_device = kzalloc(PIPENAMELEN + 1,
- GFP_KERNEL);
- input->sz_device = kzalloc(PIPENAMELEN + 1, GFP_KERNEL);
- if (output->sz_device == NULL ||
- input->sz_device == NULL) {
- /* Undo the connection */
- kfree(output->sz_device);
-
- kfree(input->sz_device);
-
- output->sz_device = NULL;
- input->sz_device = NULL;
- gb_clear(hnode_mgr->pipe_map, pipe_id);
- status = -ENOMEM;
- } else {
- /* Copy "/dbpipe<pipId>" name to device names */
- sprintf(output->sz_device, "%s%d",
- PIPEPREFIX, pipe_id);
- strcpy(input->sz_device, output->sz_device);
- }
+ goto out_unlock;
+ }
+ set_bit(pipe_id, hnode_mgr->pipe_map);
+ node1->outputs[stream1].type = NODECONNECT;
+ node2->inputs[stream2].type = NODECONNECT;
+ node1->outputs[stream1].dev_id = pipe_id;
+ node2->inputs[stream2].dev_id = pipe_id;
+ output->sz_device = kzalloc(PIPENAMELEN + 1, GFP_KERNEL);
+ input->sz_device = kzalloc(PIPENAMELEN + 1, GFP_KERNEL);
+ if (!output->sz_device || !input->sz_device) {
+ /* Undo the connection */
+ kfree(output->sz_device);
+ kfree(input->sz_device);
+ clear_bit(pipe_id, hnode_mgr->pipe_map);
+ status = -ENOMEM;
+ goto out_unlock;
}
+ /* Copy "/dbpipe<pipId>" name to device names */
+ sprintf(output->sz_device, "%s%d", PIPEPREFIX, pipe_id);
+ strcpy(input->sz_device, output->sz_device);
}
/* Connecting task node to host? */
- if (!status && (node1_type == NODE_GPP ||
- node2_type == NODE_GPP)) {
- if (node1_type == NODE_GPP) {
- chnl_mode = CHNL_MODETODSP;
- } else {
- DBC_ASSERT(node2_type == NODE_GPP);
- chnl_mode = CHNL_MODEFROMDSP;
+ if (node1_type == NODE_GPP || node2_type == NODE_GPP) {
+ pstr_dev_name = kzalloc(HOSTNAMELEN + 1, GFP_KERNEL);
+ if (!pstr_dev_name) {
+ status = -ENOMEM;
+ goto out_unlock;
}
- /* Reserve a channel id. We need to put the name "/host<id>"
+
+ DBC_ASSERT((node1_type == NODE_GPP) ||
+ (node2_type == NODE_GPP));
+
+ chnl_mode = (node1_type == NODE_GPP) ?
+ CHNL_MODETODSP : CHNL_MODEFROMDSP;
+
+ /*
+ * Reserve a channel id. We need to put the name "/host<id>"
* in the node's create_args, but the host
* side channel will not be opened until DSPStream_Open is
- * called for this node. */
- if (pattrs) {
- if (pattrs->strm_mode == STRMMODE_RDMA) {
- chnl_id =
- gb_findandset(hnode_mgr->dma_chnl_map);
+ * called for this node.
+ */
+ strm_mode = pattrs ? pattrs->strm_mode : STRMMODE_PROCCOPY;
+ switch (strm_mode) {
+ case STRMMODE_RDMA:
+ chnl_id = find_first_zero_bit(hnode_mgr->dma_chnl_map,
+ CHNL_MAXCHANNELS);
+ if (chnl_id < CHNL_MAXCHANNELS) {
+ set_bit(chnl_id, hnode_mgr->dma_chnl_map);
/* dma chans are 2nd transport chnl set
* ids(e.g. 16-31) */
- (chnl_id != GB_NOBITS) ?
- (chnl_id =
- chnl_id +
- hnode_mgr->ul_num_chnls) : chnl_id;
- } else if (pattrs->strm_mode == STRMMODE_ZEROCOPY) {
- chnl_id = gb_findandset(hnode_mgr->zc_chnl_map);
+ chnl_id = chnl_id + hnode_mgr->num_chnls;
+ }
+ break;
+ case STRMMODE_ZEROCOPY:
+ chnl_id = find_first_zero_bit(hnode_mgr->zc_chnl_map,
+ CHNL_MAXCHANNELS);
+ if (chnl_id < CHNL_MAXCHANNELS) {
+ set_bit(chnl_id, hnode_mgr->zc_chnl_map);
/* zero-copy chans are 3nd transport set
* (e.g. 32-47) */
- (chnl_id != GB_NOBITS) ? (chnl_id = chnl_id +
- (2 *
- hnode_mgr->
- ul_num_chnls))
- : chnl_id;
- } else { /* must be PROCCOPY */
- DBC_ASSERT(pattrs->strm_mode ==
- STRMMODE_PROCCOPY);
- chnl_id = gb_findandset(hnode_mgr->chnl_map);
- /* e.g. 0-15 */
+ chnl_id = chnl_id +
+ (2 * hnode_mgr->num_chnls);
}
- } else {
- /* default to PROCCOPY */
- chnl_id = gb_findandset(hnode_mgr->chnl_map);
+ break;
+ case STRMMODE_PROCCOPY:
+ chnl_id = find_first_zero_bit(hnode_mgr->chnl_map,
+ CHNL_MAXCHANNELS);
+ if (chnl_id < CHNL_MAXCHANNELS)
+ set_bit(chnl_id, hnode_mgr->chnl_map);
+ break;
+ default:
+ status = -EINVAL;
+ goto out_unlock;
}
- if (chnl_id == GB_NOBITS) {
+ if (chnl_id == CHNL_MAXCHANNELS) {
status = -ECONNREFUSED;
- goto func_cont2;
+ goto out_unlock;
}
- pstr_dev_name = kzalloc(HOSTNAMELEN + 1, GFP_KERNEL);
- if (pstr_dev_name != NULL)
- goto func_cont2;
-
- if (pattrs) {
- if (pattrs->strm_mode == STRMMODE_RDMA) {
- gb_clear(hnode_mgr->dma_chnl_map, chnl_id -
- hnode_mgr->ul_num_chnls);
- } else if (pattrs->strm_mode == STRMMODE_ZEROCOPY) {
- gb_clear(hnode_mgr->zc_chnl_map, chnl_id -
- (2 * hnode_mgr->ul_num_chnls));
- } else {
- DBC_ASSERT(pattrs->strm_mode ==
- STRMMODE_PROCCOPY);
- gb_clear(hnode_mgr->chnl_map, chnl_id);
- }
+
+ if (node1 == (struct node_object *)DSP_HGPPNODE) {
+ node2->inputs[stream2].type = HOSTCONNECT;
+ node2->inputs[stream2].dev_id = chnl_id;
+ input->sz_device = pstr_dev_name;
} else {
- gb_clear(hnode_mgr->chnl_map, chnl_id);
- }
- status = -ENOMEM;
-func_cont2:
- if (!status) {
- if (node1 == (struct node_object *)DSP_HGPPNODE) {
- node2->inputs[stream2].type = HOSTCONNECT;
- node2->inputs[stream2].dev_id = chnl_id;
- input->sz_device = pstr_dev_name;
- } else {
- node1->outputs[stream1].type = HOSTCONNECT;
- node1->outputs[stream1].dev_id = chnl_id;
- output->sz_device = pstr_dev_name;
- }
- sprintf(pstr_dev_name, "%s%d", HOSTPREFIX, chnl_id);
+ node1->outputs[stream1].type = HOSTCONNECT;
+ node1->outputs[stream1].dev_id = chnl_id;
+ output->sz_device = pstr_dev_name;
}
+ sprintf(pstr_dev_name, "%s%d", HOSTPREFIX, chnl_id);
}
/* Connecting task node to device node? */
- if (!status && ((node1_type == NODE_DEVICE) ||
- (node2_type == NODE_DEVICE))) {
+ if ((node1_type == NODE_DEVICE) || (node2_type == NODE_DEVICE)) {
if (node2_type == NODE_DEVICE) {
/* node1 == > device */
dev_node_obj = node2;
@@ -1079,61 +1060,59 @@ func_cont2:
}
/* Set up create args */
pstream->type = DEVICECONNECT;
- dw_length = strlen(dev_node_obj->pstr_dev_name);
- if (conn_param != NULL) {
+ dw_length = strlen(dev_node_obj->str_dev_name);
+ if (conn_param)
pstrm_def->sz_device = kzalloc(dw_length + 1 +
- conn_param->cb_data,
- GFP_KERNEL);
- } else {
+ conn_param->cb_data,
+ GFP_KERNEL);
+ else
pstrm_def->sz_device = kzalloc(dw_length + 1,
- GFP_KERNEL);
- }
- if (pstrm_def->sz_device == NULL) {
+ GFP_KERNEL);
+ if (!pstrm_def->sz_device) {
status = -ENOMEM;
- } else {
- /* Copy device name */
- strncpy(pstrm_def->sz_device,
- dev_node_obj->pstr_dev_name, dw_length);
- if (conn_param != NULL) {
- strncat(pstrm_def->sz_device,
+ goto out_unlock;
+ }
+ /* Copy device name */
+ strncpy(pstrm_def->sz_device,
+ dev_node_obj->str_dev_name, dw_length);
+ if (conn_param)
+ strncat(pstrm_def->sz_device,
(char *)conn_param->node_data,
(u32) conn_param->cb_data);
- }
- dev_node_obj->device_owner = hnode;
- }
+ dev_node_obj->device_owner = hnode;
}
- if (!status) {
- /* Fill in create args */
- if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
- node1->create_args.asa.task_arg_obj.num_outputs++;
- fill_stream_def(node1, output, pattrs);
- }
- if (node2_type == NODE_TASK || node2_type == NODE_DAISSOCKET) {
- node2->create_args.asa.task_arg_obj.num_inputs++;
- fill_stream_def(node2, input, pattrs);
- }
- /* Update node1 and node2 stream_connect */
- if (node1_type != NODE_GPP && node1_type != NODE_DEVICE) {
- node1->num_outputs++;
- if (stream1 > node1->max_output_index)
- node1->max_output_index = stream1;
+ /* Fill in create args */
+ if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
+ node1->create_args.asa.task_arg_obj.num_outputs++;
+ fill_stream_def(node1, output, pattrs);
+ }
+ if (node2_type == NODE_TASK || node2_type == NODE_DAISSOCKET) {
+ node2->create_args.asa.task_arg_obj.num_inputs++;
+ fill_stream_def(node2, input, pattrs);
+ }
+ /* Update node1 and node2 stream_connect */
+ if (node1_type != NODE_GPP && node1_type != NODE_DEVICE) {
+ node1->num_outputs++;
+ if (stream1 > node1->max_output_index)
+ node1->max_output_index = stream1;
- }
- if (node2_type != NODE_GPP && node2_type != NODE_DEVICE) {
- node2->num_inputs++;
- if (stream2 > node2->max_input_index)
- node2->max_input_index = stream2;
+ }
+ if (node2_type != NODE_GPP && node2_type != NODE_DEVICE) {
+ node2->num_inputs++;
+ if (stream2 > node2->max_input_index)
+ node2->max_input_index = stream2;
- }
- fill_stream_connect(node1, node2, stream1, stream2);
}
+ fill_stream_connect(node1, node2, stream1, stream2);
/* end of sync_enter_cs */
/* Exit critical section */
+out_unlock:
+ if (status && pstr_dev_name)
+ kfree(pstr_dev_name);
mutex_unlock(&hnode_mgr->node_mgr_lock);
-func_end:
dev_dbg(bridge, "%s: node1: %p stream1: %d node2: %p stream2: %d"
- "pattrs: %p status: 0x%x\n", __func__, node1,
- stream1, node2, stream2, pattrs, status);
+ "pattrs: %p status: 0x%x\n", __func__, node1,
+ stream1, node2, stream2, pattrs, status);
return status;
}
@@ -1165,7 +1144,7 @@ int node_create(struct node_object *hnode)
status = -EFAULT;
goto func_end;
}
- hprocessor = hnode->hprocessor;
+ hprocessor = hnode->processor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
@@ -1179,7 +1158,7 @@ int node_create(struct node_object *hnode)
/* create struct dsp_cbdata struct for PWR calls */
cb_data.cb_data = PWR_TIMEOUT;
node_type = node_get_type(hnode);
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
intf_fxns = hnode_mgr->intf_fxns;
/* Get access to node dispatcher */
mutex_lock(&hnode_mgr->node_mgr_lock);
@@ -1189,7 +1168,7 @@ int node_create(struct node_object *hnode)
status = -EBADR;
if (!status)
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (status)
goto func_cont2;
@@ -1211,7 +1190,7 @@ int node_create(struct node_object *hnode)
if (pdata->cpu_set_freq)
(*pdata->cpu_set_freq) (pdata->mpu_speed[VDD1_OPP3]);
#endif
- status = hnode_mgr->nldr_fxns.pfn_load(hnode->nldr_node_obj,
+ status = hnode_mgr->nldr_fxns.load(hnode->nldr_node_obj,
NLDR_CREATE);
/* Get address of node's create function */
if (!status) {
@@ -1232,19 +1211,19 @@ int node_create(struct node_object *hnode)
/* Get address of iAlg functions, if socket node */
if (!status) {
if (node_type == NODE_DAISSOCKET) {
- status = hnode_mgr->nldr_fxns.pfn_get_fxn_addr
+ status = hnode_mgr->nldr_fxns.get_fxn_addr
(hnode->nldr_node_obj,
hnode->dcd_props.obj_data.node_obj.
- pstr_i_alg_name,
+ str_i_alg_name,
&hnode->create_args.asa.
- task_arg_obj.ul_dais_arg);
+ task_arg_obj.dais_arg);
}
}
}
if (!status) {
if (node_type != NODE_DEVICE) {
status = disp_node_create(hnode_mgr->disp_obj, hnode,
- hnode_mgr->ul_fxn_addrs
+ hnode_mgr->fxn_addrs
[RMSCREATENODE],
ul_create_fxn,
&(hnode->create_args),
@@ -1253,7 +1232,7 @@ int node_create(struct node_object *hnode)
/* Set the message queue id to the node env
* pointer */
intf_fxns = hnode_mgr->intf_fxns;
- (*intf_fxns->pfn_msg_set_queue_id) (hnode->
+ (*intf_fxns->msg_set_queue_id) (hnode->
msg_queue_obj,
hnode->node_env);
}
@@ -1264,7 +1243,7 @@ int node_create(struct node_object *hnode)
if (hnode->loaded && hnode->phase_split) {
/* If create code was dynamically loaded, we can now unload
* it. */
- status1 = hnode_mgr->nldr_fxns.pfn_unload(hnode->nldr_node_obj,
+ status1 = hnode_mgr->nldr_fxns.unload(hnode->nldr_node_obj,
NLDR_CREATE);
hnode->loaded = false;
}
@@ -1287,7 +1266,7 @@ func_cont:
mutex_unlock(&hnode_mgr->node_mgr_lock);
func_end:
if (status >= 0) {
- proc_notify_clients(hnode->hprocessor, DSP_NODESTATECHANGE);
+ proc_notify_clients(hnode->processor, DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
@@ -1311,6 +1290,7 @@ int node_create_mgr(struct node_mgr **node_man,
struct nldr_attrs nldr_attrs_obj;
int status = 0;
u8 dev_type;
+
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(node_man != NULL);
DBC_REQUIRE(hdev_obj != NULL);
@@ -1318,113 +1298,89 @@ int node_create_mgr(struct node_mgr **node_man,
*node_man = NULL;
/* Allocate Node manager object */
node_mgr_obj = kzalloc(sizeof(struct node_mgr), GFP_KERNEL);
- if (node_mgr_obj) {
- node_mgr_obj->hdev_obj = hdev_obj;
- node_mgr_obj->node_list = kzalloc(sizeof(struct lst_list),
- GFP_KERNEL);
- node_mgr_obj->pipe_map = gb_create(MAXPIPES);
- node_mgr_obj->pipe_done_map = gb_create(MAXPIPES);
- if (node_mgr_obj->node_list == NULL
- || node_mgr_obj->pipe_map == NULL
- || node_mgr_obj->pipe_done_map == NULL) {
- status = -ENOMEM;
- } else {
- INIT_LIST_HEAD(&node_mgr_obj->node_list->head);
- node_mgr_obj->ntfy_obj = kmalloc(
- sizeof(struct ntfy_object), GFP_KERNEL);
- if (node_mgr_obj->ntfy_obj)
- ntfy_init(node_mgr_obj->ntfy_obj);
- else
- status = -ENOMEM;
- }
- node_mgr_obj->num_created = 0;
- } else {
+ if (!node_mgr_obj)
+ return -ENOMEM;
+
+ node_mgr_obj->dev_obj = hdev_obj;
+
+ node_mgr_obj->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
+ GFP_KERNEL);
+ if (!node_mgr_obj->ntfy_obj) {
status = -ENOMEM;
+ goto out_err;
}
- /* get devNodeType */
- if (!status)
- status = dev_get_dev_type(hdev_obj, &dev_type);
+ ntfy_init(node_mgr_obj->ntfy_obj);
- /* Create the DCD Manager */
- if (!status) {
- status =
- dcd_create_manager(sz_zl_file, &node_mgr_obj->hdcd_mgr);
- if (!status)
- status = get_proc_props(node_mgr_obj, hdev_obj);
+ INIT_LIST_HEAD(&node_mgr_obj->node_list);
+
+ dev_get_dev_type(hdev_obj, &dev_type);
+
+ status = dcd_create_manager(sz_zl_file, &node_mgr_obj->dcd_mgr);
+ if (status)
+ goto out_err;
+
+ status = get_proc_props(node_mgr_obj, hdev_obj);
+ if (status)
+ goto out_err;
- }
/* Create NODE Dispatcher */
- if (!status) {
- disp_attr_obj.ul_chnl_offset = node_mgr_obj->ul_chnl_offset;
- disp_attr_obj.ul_chnl_buf_size = node_mgr_obj->ul_chnl_buf_size;
- disp_attr_obj.proc_family = node_mgr_obj->proc_family;
- disp_attr_obj.proc_type = node_mgr_obj->proc_type;
- status =
- disp_create(&node_mgr_obj->disp_obj, hdev_obj,
- &disp_attr_obj);
- }
+ disp_attr_obj.chnl_offset = node_mgr_obj->chnl_offset;
+ disp_attr_obj.chnl_buf_size = node_mgr_obj->chnl_buf_size;
+ disp_attr_obj.proc_family = node_mgr_obj->proc_family;
+ disp_attr_obj.proc_type = node_mgr_obj->proc_type;
+
+ status = disp_create(&node_mgr_obj->disp_obj, hdev_obj, &disp_attr_obj);
+ if (status)
+ goto out_err;
+
/* Create a STRM Manager */
- if (!status)
- status = strm_create(&node_mgr_obj->strm_mgr_obj, hdev_obj);
+ status = strm_create(&node_mgr_obj->strm_mgr_obj, hdev_obj);
+ if (status)
+ goto out_err;
- if (!status) {
- dev_get_intf_fxns(hdev_obj, &node_mgr_obj->intf_fxns);
- /* Get msg_ctrl queue manager */
- dev_get_msg_mgr(hdev_obj, &node_mgr_obj->msg_mgr_obj);
- mutex_init(&node_mgr_obj->node_mgr_lock);
- node_mgr_obj->chnl_map = gb_create(node_mgr_obj->ul_num_chnls);
- /* dma chnl map. ul_num_chnls is # per transport */
- node_mgr_obj->dma_chnl_map =
- gb_create(node_mgr_obj->ul_num_chnls);
- node_mgr_obj->zc_chnl_map =
- gb_create(node_mgr_obj->ul_num_chnls);
- if ((node_mgr_obj->chnl_map == NULL)
- || (node_mgr_obj->dma_chnl_map == NULL)
- || (node_mgr_obj->zc_chnl_map == NULL)) {
- status = -ENOMEM;
- } else {
- /* Block out reserved channels */
- for (i = 0; i < node_mgr_obj->ul_chnl_offset; i++)
- gb_set(node_mgr_obj->chnl_map, i);
-
- /* Block out channels reserved for RMS */
- gb_set(node_mgr_obj->chnl_map,
- node_mgr_obj->ul_chnl_offset);
- gb_set(node_mgr_obj->chnl_map,
- node_mgr_obj->ul_chnl_offset + 1);
- }
- }
- if (!status) {
- /* NO RM Server on the IVA */
- if (dev_type != IVA_UNIT) {
- /* Get addresses of any RMS functions loaded */
- status = get_rms_fxns(node_mgr_obj);
- }
+ dev_get_intf_fxns(hdev_obj, &node_mgr_obj->intf_fxns);
+ /* Get msg_ctrl queue manager */
+ dev_get_msg_mgr(hdev_obj, &node_mgr_obj->msg_mgr_obj);
+ mutex_init(&node_mgr_obj->node_mgr_lock);
+
+ /* Block out reserved channels */
+ for (i = 0; i < node_mgr_obj->chnl_offset; i++)
+ set_bit(i, node_mgr_obj->chnl_map);
+
+ /* Block out channels reserved for RMS */
+ set_bit(node_mgr_obj->chnl_offset, node_mgr_obj->chnl_map);
+ set_bit(node_mgr_obj->chnl_offset + 1, node_mgr_obj->chnl_map);
+
+ /* NO RM Server on the IVA */
+ if (dev_type != IVA_UNIT) {
+ /* Get addresses of any RMS functions loaded */
+ status = get_rms_fxns(node_mgr_obj);
+ if (status)
+ goto out_err;
}
/* Get loader functions and create loader */
- if (!status)
- node_mgr_obj->nldr_fxns = nldr_fxns; /* Dyn loader funcs */
+ node_mgr_obj->nldr_fxns = nldr_fxns; /* Dyn loader funcs */
+
+ nldr_attrs_obj.ovly = ovly;
+ nldr_attrs_obj.write = mem_write;
+ nldr_attrs_obj.dsp_word_size = node_mgr_obj->dsp_word_size;
+ nldr_attrs_obj.dsp_mau_size = node_mgr_obj->dsp_mau_size;
+ node_mgr_obj->loader_init = node_mgr_obj->nldr_fxns.init();
+ status = node_mgr_obj->nldr_fxns.create(&node_mgr_obj->nldr_obj,
+ hdev_obj,
+ &nldr_attrs_obj);
+ if (status)
+ goto out_err;
- if (!status) {
- nldr_attrs_obj.pfn_ovly = ovly;
- nldr_attrs_obj.pfn_write = mem_write;
- nldr_attrs_obj.us_dsp_word_size = node_mgr_obj->udsp_word_size;
- nldr_attrs_obj.us_dsp_mau_size = node_mgr_obj->udsp_mau_size;
- node_mgr_obj->loader_init = node_mgr_obj->nldr_fxns.pfn_init();
- status =
- node_mgr_obj->nldr_fxns.pfn_create(&node_mgr_obj->nldr_obj,
- hdev_obj,
- &nldr_attrs_obj);
- }
- if (!status)
- *node_man = node_mgr_obj;
- else
- delete_node_mgr(node_mgr_obj);
+ *node_man = node_mgr_obj;
DBC_ENSURE((status && *node_man == NULL) || (!status && *node_man));
return status;
+out_err:
+ delete_node_mgr(node_mgr_obj);
+ return status;
}
/*
@@ -1437,7 +1393,7 @@ int node_create_mgr(struct node_mgr **node_man,
int node_delete(struct node_res_object *noderes,
struct process_context *pr_ctxt)
{
- struct node_object *pnode = noderes->hnode;
+ struct node_object *pnode = noderes->node;
struct node_mgr *hnode_mgr;
struct proc_object *hprocessor;
struct disp_object *disp_obj;
@@ -1461,8 +1417,8 @@ int node_delete(struct node_res_object *noderes,
}
/* create struct dsp_cbdata struct for PWR call */
cb_data.cb_data = PWR_TIMEOUT;
- hnode_mgr = pnode->hnode_mgr;
- hprocessor = pnode->hprocessor;
+ hnode_mgr = pnode->node_mgr;
+ hprocessor = pnode->processor;
disp_obj = hnode_mgr->disp_obj;
node_type = node_get_type(pnode);
intf_fxns = hnode_mgr->intf_fxns;
@@ -1477,7 +1433,7 @@ int node_delete(struct node_res_object *noderes,
* code must be executed. */
if (!(state == NODE_ALLOCATED && pnode->node_env == (u32) NULL) &&
node_type != NODE_DEVICE) {
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (status)
goto func_cont1;
@@ -1494,7 +1450,7 @@ int node_delete(struct node_res_object *noderes,
* is not * running */
status1 =
hnode_mgr->nldr_fxns.
- pfn_unload(pnode->nldr_node_obj,
+ unload(pnode->nldr_node_obj,
NLDR_EXECUTE);
pnode->loaded = false;
NODE_SET_STATE(pnode, NODE_DONE);
@@ -1505,7 +1461,7 @@ int node_delete(struct node_res_object *noderes,
pnode->phase_split) {
status =
hnode_mgr->nldr_fxns.
- pfn_load(pnode->nldr_node_obj, NLDR_DELETE);
+ load(pnode->nldr_node_obj, NLDR_DELETE);
if (!status)
pnode->loaded = true;
else
@@ -1533,7 +1489,7 @@ func_cont1:
status =
disp_node_delete(disp_obj, pnode,
hnode_mgr->
- ul_fxn_addrs
+ fxn_addrs
[RMSDELETENODE],
ul_delete_fxn,
pnode->node_env);
@@ -1546,7 +1502,7 @@ func_cont1:
pnode->phase_split) {
status1 =
hnode_mgr->nldr_fxns.
- pfn_unload(pnode->nldr_node_obj,
+ unload(pnode->nldr_node_obj,
NLDR_EXECUTE);
}
if (status1)
@@ -1554,7 +1510,7 @@ func_cont1:
" 0x%x\n", __func__, status1);
status1 =
- hnode_mgr->nldr_fxns.pfn_unload(pnode->
+ hnode_mgr->nldr_fxns.unload(pnode->
nldr_node_obj,
NLDR_DELETE);
pnode->loaded = false;
@@ -1566,7 +1522,7 @@ func_cont1:
}
/* Free host side resources even if a failure occurred */
/* Remove node from hnode_mgr->node_list */
- lst_remove_elem(hnode_mgr->node_list, (struct list_head *)pnode);
+ list_del(&pnode->list_elem);
hnode_mgr->num_nodes--;
/* Decrement count of nodes created on DSP */
if ((state != NODE_ALLOCATED) || ((state == NODE_ALLOCATED) &&
@@ -1598,16 +1554,14 @@ func_end:
*/
int node_delete_mgr(struct node_mgr *hnode_mgr)
{
- int status = 0;
-
DBC_REQUIRE(refs > 0);
- if (hnode_mgr)
- delete_node_mgr(hnode_mgr);
- else
- status = -EFAULT;
+ if (!hnode_mgr)
+ return -EFAULT;
- return status;
+ delete_node_mgr(hnode_mgr);
+
+ return 0;
}
/*
@@ -1620,7 +1574,7 @@ int node_enum_nodes(struct node_mgr *hnode_mgr, void **node_tab,
u32 *pu_allocated)
{
struct node_object *hnode;
- u32 i;
+ u32 i = 0;
int status = 0;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(node_tab != NULL || node_tab_size == 0);
@@ -1639,15 +1593,8 @@ int node_enum_nodes(struct node_mgr *hnode_mgr, void **node_tab,
*pu_num_nodes = 0;
status = -EINVAL;
} else {
- hnode = (struct node_object *)lst_first(hnode_mgr->
- node_list);
- for (i = 0; i < hnode_mgr->num_nodes; i++) {
- DBC_ASSERT(hnode);
- node_tab[i] = hnode;
- hnode = (struct node_object *)lst_next
- (hnode_mgr->node_list,
- (struct list_head *)hnode);
- }
+ list_for_each_entry(hnode, &hnode_mgr->node_list, list_elem)
+ node_tab[i++] = hnode;
*pu_allocated = *pu_num_nodes = hnode_mgr->num_nodes;
}
/* end of sync_enter_cs */
@@ -1691,7 +1638,7 @@ int node_free_msg_buf(struct node_object *hnode, u8 * pbuffer,
status = -EFAULT;
goto func_end;
}
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (proc_id == DSP_UNIT) {
if (!status) {
if (pattr == NULL) {
@@ -1722,38 +1669,37 @@ int node_get_attr(struct node_object *hnode,
struct dsp_nodeattr *pattr, u32 attr_size)
{
struct node_mgr *hnode_mgr;
- int status = 0;
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(pattr != NULL);
DBC_REQUIRE(attr_size >= sizeof(struct dsp_nodeattr));
- if (!hnode) {
- status = -EFAULT;
- } else {
- hnode_mgr = hnode->hnode_mgr;
- /* Enter hnode_mgr critical section (since we're accessing
- * data that could be changed by node_change_priority() and
- * node_connect(). */
- mutex_lock(&hnode_mgr->node_mgr_lock);
- pattr->cb_struct = sizeof(struct dsp_nodeattr);
- /* dsp_nodeattrin */
- pattr->in_node_attr_in.cb_struct =
- sizeof(struct dsp_nodeattrin);
- pattr->in_node_attr_in.prio = hnode->prio;
- pattr->in_node_attr_in.utimeout = hnode->utimeout;
- pattr->in_node_attr_in.heap_size =
- hnode->create_args.asa.task_arg_obj.heap_size;
- pattr->in_node_attr_in.pgpp_virt_addr = (void *)
- hnode->create_args.asa.task_arg_obj.ugpp_heap_addr;
- pattr->node_attr_inputs = hnode->num_gpp_inputs;
- pattr->node_attr_outputs = hnode->num_gpp_outputs;
- /* dsp_nodeinfo */
- get_node_info(hnode, &(pattr->node_info));
- /* end of sync_enter_cs */
- /* Exit critical section */
- mutex_unlock(&hnode_mgr->node_mgr_lock);
- }
- return status;
+ if (!hnode)
+ return -EFAULT;
+
+ hnode_mgr = hnode->node_mgr;
+ /* Enter hnode_mgr critical section (since we're accessing
+ * data that could be changed by node_change_priority() and
+ * node_connect(). */
+ mutex_lock(&hnode_mgr->node_mgr_lock);
+ pattr->cb_struct = sizeof(struct dsp_nodeattr);
+ /* dsp_nodeattrin */
+ pattr->in_node_attr_in.cb_struct =
+ sizeof(struct dsp_nodeattrin);
+ pattr->in_node_attr_in.prio = hnode->prio;
+ pattr->in_node_attr_in.timeout = hnode->timeout;
+ pattr->in_node_attr_in.heap_size =
+ hnode->create_args.asa.task_arg_obj.heap_size;
+ pattr->in_node_attr_in.pgpp_virt_addr = (void *)
+ hnode->create_args.asa.task_arg_obj.gpp_heap_addr;
+ pattr->node_attr_inputs = hnode->num_gpp_inputs;
+ pattr->node_attr_outputs = hnode->num_gpp_outputs;
+ /* dsp_nodeinfo */
+ get_node_info(hnode, &(pattr->node_info));
+ /* end of sync_enter_cs */
+ /* Exit critical section */
+ mutex_unlock(&hnode_mgr->node_mgr_lock);
+
+ return 0;
}
/*
@@ -1822,7 +1768,7 @@ int node_get_message(struct node_object *hnode,
status = -EFAULT;
goto func_end;
}
- hprocessor = hnode->hprocessor;
+ hprocessor = hnode->processor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
@@ -1833,7 +1779,7 @@ int node_get_message(struct node_object *hnode,
status = -EPERM;
goto func_end;
}
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
node_type = node_get_type(hnode);
if (node_type != NODE_MESSAGE && node_type != NODE_TASK &&
node_type != NODE_DAISSOCKET) {
@@ -1847,24 +1793,24 @@ int node_get_message(struct node_object *hnode,
* available. */
intf_fxns = hnode_mgr->intf_fxns;
status =
- (*intf_fxns->pfn_msg_get) (hnode->msg_queue_obj, message, utimeout);
+ (*intf_fxns->msg_get) (hnode->msg_queue_obj, message, utimeout);
/* Check if message contains SM descriptor */
- if (status || !(message->dw_cmd & DSP_RMSBUFDESC))
+ if (status || !(message->cmd & DSP_RMSBUFDESC))
goto func_end;
/* Translate DSP byte addr to GPP Va. */
tmp_buf = cmm_xlator_translate(hnode->xlator,
- (void *)(message->dw_arg1 *
- hnode->hnode_mgr->
- udsp_word_size), CMM_DSPPA2PA);
+ (void *)(message->arg1 *
+ hnode->node_mgr->
+ dsp_word_size), CMM_DSPPA2PA);
if (tmp_buf != NULL) {
/* now convert this GPP Pa to Va */
tmp_buf = cmm_xlator_translate(hnode->xlator, tmp_buf,
CMM_PA2VA);
if (tmp_buf != NULL) {
/* Adjust SM size in msg */
- message->dw_arg1 = (u32) tmp_buf;
- message->dw_arg2 *= hnode->hnode_mgr->udsp_word_size;
+ message->arg1 = (u32) tmp_buf;
+ message->arg2 *= hnode->node_mgr->dsp_word_size;
} else {
status = -ESRCH;
}
@@ -1911,7 +1857,7 @@ int node_get_strm_mgr(struct node_object *hnode,
if (!hnode)
status = -EFAULT;
else
- *strm_man = hnode->hnode_mgr->strm_mgr_obj;
+ *strm_man = hnode->node_mgr->strm_mgr_obj;
return status;
}
@@ -1927,7 +1873,7 @@ enum nldr_loadtype node_get_load_type(struct node_object *hnode)
dev_dbg(bridge, "%s: Failed. hnode: %p\n", __func__, hnode);
return -1;
} else {
- return hnode->dcd_props.obj_data.node_obj.us_load_type;
+ return hnode->dcd_props.obj_data.node_obj.load_type;
}
}
@@ -1944,7 +1890,7 @@ u32 node_get_timeout(struct node_object *hnode)
dev_dbg(bridge, "%s: failed. hnode: %p\n", __func__, hnode);
return 0;
} else {
- return hnode->utimeout;
+ return hnode->timeout;
}
}
@@ -1996,7 +1942,7 @@ void node_on_exit(struct node_object *hnode, s32 node_status)
NODE_SET_STATE(hnode, NODE_DONE);
hnode->exit_status = node_status;
if (hnode->loaded && hnode->phase_split) {
- (void)hnode->hnode_mgr->nldr_fxns.pfn_unload(hnode->
+ (void)hnode->node_mgr->nldr_fxns.unload(hnode->
nldr_node_obj,
NLDR_EXECUTE);
hnode->loaded = false;
@@ -2004,7 +1950,7 @@ void node_on_exit(struct node_object *hnode, s32 node_status)
/* Unblock call to node_terminate */
(void)sync_set_event(hnode->sync_done);
/* Notify clients */
- proc_notify_clients(hnode->hprocessor, DSP_NODESTATECHANGE);
+ proc_notify_clients(hnode->processor, DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
@@ -2036,13 +1982,13 @@ int node_pause(struct node_object *hnode)
if (status)
goto func_end;
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (proc_id == IVA_UNIT)
status = -ENOSYS;
if (!status) {
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
/* Enter critical section */
mutex_lock(&hnode_mgr->node_mgr_lock);
@@ -2053,7 +1999,7 @@ int node_pause(struct node_object *hnode)
if (status)
goto func_cont;
- hprocessor = hnode->hprocessor;
+ hprocessor = hnode->processor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
@@ -2066,7 +2012,7 @@ int node_pause(struct node_object *hnode)
}
status = disp_node_change_priority(hnode_mgr->disp_obj, hnode,
- hnode_mgr->ul_fxn_addrs[RMSCHANGENODEPRIORITY],
+ hnode_mgr->fxn_addrs[RMSCHANGENODEPRIORITY],
hnode->node_env, NODE_SUSPENDEDPRI);
/* Update state */
@@ -2078,7 +2024,7 @@ func_cont:
/* Leave critical section */
mutex_unlock(&hnode_mgr->node_mgr_lock);
if (status >= 0) {
- proc_notify_clients(hnode->hprocessor,
+ proc_notify_clients(hnode->processor,
DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
@@ -2115,7 +2061,7 @@ int node_put_message(struct node_object *hnode,
status = -EFAULT;
goto func_end;
}
- hprocessor = hnode->hprocessor;
+ hprocessor = hnode->processor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
@@ -2126,7 +2072,7 @@ int node_put_message(struct node_object *hnode,
status = -EPERM;
goto func_end;
}
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
node_type = node_get_type(hnode);
if (node_type != NODE_MESSAGE && node_type != NODE_TASK &&
node_type != NODE_DAISSOCKET)
@@ -2154,22 +2100,22 @@ int node_put_message(struct node_object *hnode,
/* assign pmsg values to new msg */
new_msg = *pmsg;
/* Now, check if message contains a SM buffer descriptor */
- if (pmsg->dw_cmd & DSP_RMSBUFDESC) {
+ if (pmsg->cmd & DSP_RMSBUFDESC) {
/* Translate GPP Va to DSP physical buf Ptr. */
tmp_buf = cmm_xlator_translate(hnode->xlator,
- (void *)new_msg.dw_arg1,
+ (void *)new_msg.arg1,
CMM_VA2DSPPA);
if (tmp_buf != NULL) {
/* got translation, convert to MAUs in msg */
- if (hnode->hnode_mgr->udsp_word_size != 0) {
- new_msg.dw_arg1 =
+ if (hnode->node_mgr->dsp_word_size != 0) {
+ new_msg.arg1 =
(u32) tmp_buf /
- hnode->hnode_mgr->udsp_word_size;
+ hnode->node_mgr->dsp_word_size;
/* MAUs */
- new_msg.dw_arg2 /= hnode->hnode_mgr->
- udsp_word_size;
+ new_msg.arg2 /= hnode->node_mgr->
+ dsp_word_size;
} else {
- pr_err("%s: udsp_word_size is zero!\n",
+ pr_err("%s: dsp_word_size is zero!\n",
__func__);
status = -EPERM; /* bad DSPWordSize */
}
@@ -2179,7 +2125,7 @@ int node_put_message(struct node_object *hnode,
}
if (!status) {
intf_fxns = hnode_mgr->intf_fxns;
- status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj,
+ status = (*intf_fxns->msg_put) (hnode->msg_queue_obj,
&new_msg, utimeout);
}
func_end:
@@ -2226,8 +2172,8 @@ int node_register_notify(struct node_object *hnode, u32 event_mask,
notify_type);
} else {
/* Send Message part of event mask to msg_ctrl */
- intf_fxns = hnode->hnode_mgr->intf_fxns;
- status = (*intf_fxns->pfn_msg_register_notify)
+ intf_fxns = hnode->node_mgr->intf_fxns;
+ status = (*intf_fxns->msg_register_notify)
(hnode->msg_queue_obj,
event_mask & DSP_NODEMESSAGEREADY, notify_type,
hnotification);
@@ -2267,7 +2213,7 @@ int node_run(struct node_object *hnode)
status = -EFAULT;
goto func_end;
}
- hprocessor = hnode->hprocessor;
+ hprocessor = hnode->processor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
@@ -2283,7 +2229,7 @@ int node_run(struct node_object *hnode)
if (status)
goto func_end;
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
if (!hnode_mgr) {
status = -EFAULT;
goto func_end;
@@ -2297,7 +2243,7 @@ int node_run(struct node_object *hnode)
status = -EBADR;
if (!status)
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (status)
goto func_cont1;
@@ -2309,7 +2255,7 @@ int node_run(struct node_object *hnode)
/* If node's execute function is not loaded, load it */
if (!(hnode->loaded) && hnode->phase_split) {
status =
- hnode_mgr->nldr_fxns.pfn_load(hnode->nldr_node_obj,
+ hnode_mgr->nldr_fxns.load(hnode->nldr_node_obj,
NLDR_EXECUTE);
if (!status) {
hnode->loaded = true;
@@ -2328,14 +2274,14 @@ int node_run(struct node_object *hnode)
}
}
if (!status) {
- ul_fxn_addr = hnode_mgr->ul_fxn_addrs[RMSEXECUTENODE];
+ ul_fxn_addr = hnode_mgr->fxn_addrs[RMSEXECUTENODE];
status =
disp_node_run(hnode_mgr->disp_obj, hnode,
ul_fxn_addr, ul_execute_fxn,
hnode->node_env);
}
} else if (state == NODE_PAUSED) {
- ul_fxn_addr = hnode_mgr->ul_fxn_addrs[RMSCHANGENODEPRIORITY];
+ ul_fxn_addr = hnode_mgr->fxn_addrs[RMSCHANGENODEPRIORITY];
status = disp_node_change_priority(hnode_mgr->disp_obj, hnode,
ul_fxn_addr, hnode->node_env,
NODE_GET_PRIORITY(hnode));
@@ -2353,7 +2299,7 @@ func_cont1:
/* Exit critical section */
mutex_unlock(&hnode_mgr->node_mgr_lock);
if (status >= 0) {
- proc_notify_clients(hnode->hprocessor, DSP_NODESTATECHANGE);
+ proc_notify_clients(hnode->processor, DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
func_end:
@@ -2383,18 +2329,18 @@ int node_terminate(struct node_object *hnode, int *pstatus)
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(pstatus != NULL);
- if (!hnode || !hnode->hnode_mgr) {
+ if (!hnode || !hnode->node_mgr) {
status = -EFAULT;
goto func_end;
}
- if (pnode->hprocessor == NULL) {
+ if (pnode->processor == NULL) {
status = -EFAULT;
goto func_end;
}
- status = proc_get_processor_id(pnode->hprocessor, &proc_id);
+ status = proc_get_processor_id(pnode->processor, &proc_id);
if (!status) {
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
node_type = node_get_type(hnode);
if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET)
status = -EPERM;
@@ -2421,7 +2367,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
* Send exit message. Do not change state to NODE_DONE
* here. That will be done in callback.
*/
- status = proc_get_state(pnode->hprocessor, &proc_state,
+ status = proc_get_state(pnode->processor, &proc_state,
sizeof(struct dsp_processorstate));
if (status)
goto func_cont;
@@ -2432,19 +2378,19 @@ int node_terminate(struct node_object *hnode, int *pstatus)
goto func_cont;
}
- msg.dw_cmd = RMS_EXIT;
- msg.dw_arg1 = hnode->node_env;
- killmsg.dw_cmd = RMS_KILLTASK;
- killmsg.dw_arg1 = hnode->node_env;
+ msg.cmd = RMS_EXIT;
+ msg.arg1 = hnode->node_env;
+ killmsg.cmd = RMS_KILLTASK;
+ killmsg.arg1 = hnode->node_env;
intf_fxns = hnode_mgr->intf_fxns;
- if (hnode->utimeout > MAXTIMEOUT)
+ if (hnode->timeout > MAXTIMEOUT)
kill_time_out = MAXTIMEOUT;
else
- kill_time_out = (hnode->utimeout) * 2;
+ kill_time_out = (hnode->timeout) * 2;
- status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj, &msg,
- hnode->utimeout);
+ status = (*intf_fxns->msg_put) (hnode->msg_queue_obj, &msg,
+ hnode->timeout);
if (status)
goto func_cont;
@@ -2459,8 +2405,8 @@ int node_terminate(struct node_object *hnode, int *pstatus)
if (status != ETIME)
goto func_cont;
- status = (*intf_fxns->pfn_msg_put)(hnode->msg_queue_obj,
- &killmsg, hnode->utimeout);
+ status = (*intf_fxns->msg_put)(hnode->msg_queue_obj,
+ &killmsg, hnode->timeout);
if (status)
goto func_cont;
status = sync_wait_on_event(hnode->sync_done,
@@ -2470,7 +2416,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
* Here it goes the part of the simulation of
* the DSP exception.
*/
- dev_get_deh_mgr(hnode_mgr->hdev_obj, &hdeh_mgr);
+ dev_get_deh_mgr(hnode_mgr->dev_obj, &hdeh_mgr);
if (!hdeh_mgr)
goto func_cont;
@@ -2514,12 +2460,12 @@ static void delete_node(struct node_object *hnode,
#ifdef DSP_DMM_DEBUG
struct dmm_object *dmm_mgr;
struct proc_object *p_proc_object =
- (struct proc_object *)hnode->hprocessor;
+ (struct proc_object *)hnode->processor;
#endif
int status;
if (!hnode)
goto func_end;
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
if (!hnode_mgr)
goto func_end;
@@ -2531,7 +2477,7 @@ static void delete_node(struct node_object *hnode,
/* Free msg_ctrl queue */
if (hnode->msg_queue_obj) {
intf_fxns = hnode_mgr->intf_fxns;
- (*intf_fxns->pfn_msg_delete_queue) (hnode->
+ (*intf_fxns->msg_delete_queue) (hnode->
msg_queue_obj);
hnode->msg_queue_obj = NULL;
}
@@ -2572,15 +2518,15 @@ static void delete_node(struct node_object *hnode,
kfree(task_arg_obj.strm_out_def);
task_arg_obj.strm_out_def = NULL;
}
- if (task_arg_obj.udsp_heap_res_addr) {
- status = proc_un_map(hnode->hprocessor, (void *)
- task_arg_obj.udsp_heap_addr,
+ if (task_arg_obj.dsp_heap_res_addr) {
+ status = proc_un_map(hnode->processor, (void *)
+ task_arg_obj.dsp_heap_addr,
pr_ctxt);
- status = proc_un_reserve_memory(hnode->hprocessor,
+ status = proc_un_reserve_memory(hnode->processor,
(void *)
task_arg_obj.
- udsp_heap_res_addr,
+ dsp_heap_res_addr,
pr_ctxt);
#ifdef DSP_DMM_DEBUG
status = dmm_get_handle(p_proc_object, &dmm_mgr);
@@ -2595,8 +2541,8 @@ static void delete_node(struct node_object *hnode,
kfree(hnode->stream_connect);
hnode->stream_connect = NULL;
}
- kfree(hnode->pstr_dev_name);
- hnode->pstr_dev_name = NULL;
+ kfree(hnode->str_dev_name);
+ hnode->str_dev_name = NULL;
if (hnode->ntfy_obj) {
ntfy_delete(hnode->ntfy_obj);
@@ -2605,23 +2551,23 @@ static void delete_node(struct node_object *hnode,
}
/* These were allocated in dcd_get_object_def (via node_allocate) */
- kfree(hnode->dcd_props.obj_data.node_obj.pstr_create_phase_fxn);
- hnode->dcd_props.obj_data.node_obj.pstr_create_phase_fxn = NULL;
+ kfree(hnode->dcd_props.obj_data.node_obj.str_create_phase_fxn);
+ hnode->dcd_props.obj_data.node_obj.str_create_phase_fxn = NULL;
- kfree(hnode->dcd_props.obj_data.node_obj.pstr_execute_phase_fxn);
- hnode->dcd_props.obj_data.node_obj.pstr_execute_phase_fxn = NULL;
+ kfree(hnode->dcd_props.obj_data.node_obj.str_execute_phase_fxn);
+ hnode->dcd_props.obj_data.node_obj.str_execute_phase_fxn = NULL;
- kfree(hnode->dcd_props.obj_data.node_obj.pstr_delete_phase_fxn);
- hnode->dcd_props.obj_data.node_obj.pstr_delete_phase_fxn = NULL;
+ kfree(hnode->dcd_props.obj_data.node_obj.str_delete_phase_fxn);
+ hnode->dcd_props.obj_data.node_obj.str_delete_phase_fxn = NULL;
- kfree(hnode->dcd_props.obj_data.node_obj.pstr_i_alg_name);
- hnode->dcd_props.obj_data.node_obj.pstr_i_alg_name = NULL;
+ kfree(hnode->dcd_props.obj_data.node_obj.str_i_alg_name);
+ hnode->dcd_props.obj_data.node_obj.str_i_alg_name = NULL;
/* Free all SM address translator resources */
kfree(hnode->xlator);
kfree(hnode->nldr_node_obj);
hnode->nldr_node_obj = NULL;
- hnode->hnode_mgr = NULL;
+ hnode->node_mgr = NULL;
kfree(hnode);
hnode = NULL;
func_end:
@@ -2635,21 +2581,18 @@ func_end:
*/
static void delete_node_mgr(struct node_mgr *hnode_mgr)
{
- struct node_object *hnode;
+ struct node_object *hnode, *tmp;
if (hnode_mgr) {
/* Free resources */
- if (hnode_mgr->hdcd_mgr)
- dcd_destroy_manager(hnode_mgr->hdcd_mgr);
+ if (hnode_mgr->dcd_mgr)
+ dcd_destroy_manager(hnode_mgr->dcd_mgr);
/* Remove any elements remaining in lists */
- if (hnode_mgr->node_list) {
- while ((hnode = (struct node_object *)
- lst_get_head(hnode_mgr->node_list)))
- delete_node(hnode, NULL);
-
- DBC_ASSERT(LST_IS_EMPTY(hnode_mgr->node_list));
- kfree(hnode_mgr->node_list);
+ list_for_each_entry_safe(hnode, tmp, &hnode_mgr->node_list,
+ list_elem) {
+ list_del(&hnode->list_elem);
+ delete_node(hnode, NULL);
}
mutex_destroy(&hnode_mgr->node_mgr_lock);
if (hnode_mgr->ntfy_obj) {
@@ -2657,21 +2600,6 @@ static void delete_node_mgr(struct node_mgr *hnode_mgr)
kfree(hnode_mgr->ntfy_obj);
}
- if (hnode_mgr->pipe_map)
- gb_delete(hnode_mgr->pipe_map);
-
- if (hnode_mgr->pipe_done_map)
- gb_delete(hnode_mgr->pipe_done_map);
-
- if (hnode_mgr->chnl_map)
- gb_delete(hnode_mgr->chnl_map);
-
- if (hnode_mgr->dma_chnl_map)
- gb_delete(hnode_mgr->dma_chnl_map);
-
- if (hnode_mgr->zc_chnl_map)
- gb_delete(hnode_mgr->zc_chnl_map);
-
if (hnode_mgr->disp_obj)
disp_delete(hnode_mgr->disp_obj);
@@ -2680,10 +2608,10 @@ static void delete_node_mgr(struct node_mgr *hnode_mgr)
/* Delete the loader */
if (hnode_mgr->nldr_obj)
- hnode_mgr->nldr_fxns.pfn_delete(hnode_mgr->nldr_obj);
+ hnode_mgr->nldr_fxns.delete(hnode_mgr->nldr_obj);
if (hnode_mgr->loader_init)
- hnode_mgr->nldr_fxns.pfn_exit();
+ hnode_mgr->nldr_fxns.exit();
kfree(hnode_mgr);
}
@@ -2758,22 +2686,22 @@ static void fill_stream_def(struct node_object *hnode,
struct node_strmdef *pstrm_def,
struct dsp_strmattr *pattrs)
{
- struct node_mgr *hnode_mgr = hnode->hnode_mgr;
+ struct node_mgr *hnode_mgr = hnode->node_mgr;
if (pattrs != NULL) {
pstrm_def->num_bufs = pattrs->num_bufs;
pstrm_def->buf_size =
- pattrs->buf_size / hnode_mgr->udsp_data_mau_size;
+ pattrs->buf_size / hnode_mgr->dsp_data_mau_size;
pstrm_def->seg_id = pattrs->seg_id;
pstrm_def->buf_alignment = pattrs->buf_alignment;
- pstrm_def->utimeout = pattrs->utimeout;
+ pstrm_def->timeout = pattrs->timeout;
} else {
pstrm_def->num_bufs = DEFAULTNBUFS;
pstrm_def->buf_size =
- DEFAULTBUFSIZE / hnode_mgr->udsp_data_mau_size;
+ DEFAULTBUFSIZE / hnode_mgr->dsp_data_mau_size;
pstrm_def->seg_id = DEFAULTSEGID;
pstrm_def->buf_alignment = DEFAULTALIGNMENT;
- pstrm_def->utimeout = DEFAULTTIMEOUT;
+ pstrm_def->timeout = DEFAULTTIMEOUT;
}
}
@@ -2786,25 +2714,25 @@ static void free_stream(struct node_mgr *hnode_mgr, struct stream_chnl stream)
{
/* Free up the pipe id unless other node has not yet been deleted. */
if (stream.type == NODECONNECT) {
- if (gb_test(hnode_mgr->pipe_done_map, stream.dev_id)) {
+ if (test_bit(stream.dev_id, hnode_mgr->pipe_done_map)) {
/* The other node has already been deleted */
- gb_clear(hnode_mgr->pipe_done_map, stream.dev_id);
- gb_clear(hnode_mgr->pipe_map, stream.dev_id);
+ clear_bit(stream.dev_id, hnode_mgr->pipe_done_map);
+ clear_bit(stream.dev_id, hnode_mgr->pipe_map);
} else {
/* The other node has not been deleted yet */
- gb_set(hnode_mgr->pipe_done_map, stream.dev_id);
+ set_bit(stream.dev_id, hnode_mgr->pipe_done_map);
}
} else if (stream.type == HOSTCONNECT) {
- if (stream.dev_id < hnode_mgr->ul_num_chnls) {
- gb_clear(hnode_mgr->chnl_map, stream.dev_id);
- } else if (stream.dev_id < (2 * hnode_mgr->ul_num_chnls)) {
+ if (stream.dev_id < hnode_mgr->num_chnls) {
+ clear_bit(stream.dev_id, hnode_mgr->chnl_map);
+ } else if (stream.dev_id < (2 * hnode_mgr->num_chnls)) {
/* dsp-dma */
- gb_clear(hnode_mgr->dma_chnl_map, stream.dev_id -
- (1 * hnode_mgr->ul_num_chnls));
- } else if (stream.dev_id < (3 * hnode_mgr->ul_num_chnls)) {
+ clear_bit(stream.dev_id - (1 * hnode_mgr->num_chnls),
+ hnode_mgr->dma_chnl_map);
+ } else if (stream.dev_id < (3 * hnode_mgr->num_chnls)) {
/* zero-copy */
- gb_clear(hnode_mgr->zc_chnl_map, stream.dev_id -
- (2 * hnode_mgr->ul_num_chnls));
+ clear_bit(stream.dev_id - (2 * hnode_mgr->num_chnls),
+ hnode_mgr->zc_chnl_map);
}
}
}
@@ -2818,7 +2746,7 @@ static int get_fxn_address(struct node_object *hnode, u32 * fxn_addr,
u32 phase)
{
char *pstr_fxn_name = NULL;
- struct node_mgr *hnode_mgr = hnode->hnode_mgr;
+ struct node_mgr *hnode_mgr = hnode->node_mgr;
int status = 0;
DBC_REQUIRE(node_get_type(hnode) == NODE_TASK ||
node_get_type(hnode) == NODE_DAISSOCKET ||
@@ -2827,15 +2755,15 @@ static int get_fxn_address(struct node_object *hnode, u32 * fxn_addr,
switch (phase) {
case CREATEPHASE:
pstr_fxn_name =
- hnode->dcd_props.obj_data.node_obj.pstr_create_phase_fxn;
+ hnode->dcd_props.obj_data.node_obj.str_create_phase_fxn;
break;
case EXECUTEPHASE:
pstr_fxn_name =
- hnode->dcd_props.obj_data.node_obj.pstr_execute_phase_fxn;
+ hnode->dcd_props.obj_data.node_obj.str_execute_phase_fxn;
break;
case DELETEPHASE:
pstr_fxn_name =
- hnode->dcd_props.obj_data.node_obj.pstr_delete_phase_fxn;
+ hnode->dcd_props.obj_data.node_obj.str_delete_phase_fxn;
break;
default:
/* Should never get here */
@@ -2844,7 +2772,7 @@ static int get_fxn_address(struct node_object *hnode, u32 * fxn_addr,
}
status =
- hnode_mgr->nldr_fxns.pfn_get_fxn_addr(hnode->nldr_node_obj,
+ hnode_mgr->nldr_fxns.get_fxn_addr(hnode->nldr_node_obj,
pstr_fxn_name, fxn_addr);
return status;
@@ -2923,11 +2851,11 @@ static int get_node_props(struct dcd_manager *hdcd_mgr,
DBC_REQUIRE(pndb_props->ac_name);
len = strlen(pndb_props->ac_name);
DBC_ASSERT(len < MAXDEVNAMELEN);
- hnode->pstr_dev_name = kzalloc(len + 1, GFP_KERNEL);
- if (hnode->pstr_dev_name == NULL) {
+ hnode->str_dev_name = kzalloc(len + 1, GFP_KERNEL);
+ if (hnode->str_dev_name == NULL) {
status = -ENOMEM;
} else {
- strncpy(hnode->pstr_dev_name,
+ strncpy(hnode->str_dev_name,
pndb_props->ac_name, len);
}
}
@@ -2974,9 +2902,9 @@ static int get_proc_props(struct node_mgr *hnode_mgr,
host_res = pbridge_context->resources;
if (!host_res)
return -EPERM;
- hnode_mgr->ul_chnl_offset = host_res->dw_chnl_offset;
- hnode_mgr->ul_chnl_buf_size = host_res->dw_chnl_buf_size;
- hnode_mgr->ul_num_chnls = host_res->dw_num_chnls;
+ hnode_mgr->chnl_offset = host_res->chnl_offset;
+ hnode_mgr->chnl_buf_size = host_res->chnl_buf_size;
+ hnode_mgr->num_chnls = host_res->num_chnls;
/*
* PROC will add an API to get dsp_processorinfo.
@@ -2987,9 +2915,9 @@ static int get_proc_props(struct node_mgr *hnode_mgr,
hnode_mgr->proc_type = 6410;
hnode_mgr->min_pri = DSP_NODE_MIN_PRIORITY;
hnode_mgr->max_pri = DSP_NODE_MAX_PRIORITY;
- hnode_mgr->udsp_word_size = DSPWORDSIZE;
- hnode_mgr->udsp_data_mau_size = DSPWORDSIZE;
- hnode_mgr->udsp_mau_size = 1;
+ hnode_mgr->dsp_word_size = DSPWORDSIZE;
+ hnode_mgr->dsp_data_mau_size = DSPWORDSIZE;
+ hnode_mgr->dsp_mau_size = 1;
}
return status;
@@ -3046,24 +2974,24 @@ int node_get_uuid_props(void *hprocessor,
*/
mutex_lock(&hnode_mgr->node_mgr_lock);
- dcd_node_props.pstr_create_phase_fxn = NULL;
- dcd_node_props.pstr_execute_phase_fxn = NULL;
- dcd_node_props.pstr_delete_phase_fxn = NULL;
- dcd_node_props.pstr_i_alg_name = NULL;
+ dcd_node_props.str_create_phase_fxn = NULL;
+ dcd_node_props.str_execute_phase_fxn = NULL;
+ dcd_node_props.str_delete_phase_fxn = NULL;
+ dcd_node_props.str_i_alg_name = NULL;
- status = dcd_get_object_def(hnode_mgr->hdcd_mgr,
+ status = dcd_get_object_def(hnode_mgr->dcd_mgr,
(struct dsp_uuid *)node_uuid, DSP_DCDNODETYPE,
(struct dcd_genericobj *)&dcd_node_props);
if (!status) {
*node_props = dcd_node_props.ndb_props;
- kfree(dcd_node_props.pstr_create_phase_fxn);
+ kfree(dcd_node_props.str_create_phase_fxn);
- kfree(dcd_node_props.pstr_execute_phase_fxn);
+ kfree(dcd_node_props.str_execute_phase_fxn);
- kfree(dcd_node_props.pstr_delete_phase_fxn);
+ kfree(dcd_node_props.str_delete_phase_fxn);
- kfree(dcd_node_props.pstr_i_alg_name);
+ kfree(dcd_node_props.str_i_alg_name);
}
/* Leave the critical section, we're done. */
mutex_unlock(&hnode_mgr->node_mgr_lock);
@@ -3079,7 +3007,7 @@ func_end:
static int get_rms_fxns(struct node_mgr *hnode_mgr)
{
s32 i;
- struct dev_object *dev_obj = hnode_mgr->hdev_obj;
+ struct dev_object *dev_obj = hnode_mgr->dev_obj;
int status = 0;
static char *psz_fxns[NUMRMSFXNS] = {
@@ -3096,7 +3024,7 @@ static int get_rms_fxns(struct node_mgr *hnode_mgr)
for (i = 0; i < NUMRMSFXNS; i++) {
status = dev_get_symbol(dev_obj, psz_fxns[i],
- &(hnode_mgr->ul_fxn_addrs[i]));
+ &(hnode_mgr->fxn_addrs[i]));
if (status) {
if (status == -ESPIPE) {
/*
@@ -3137,17 +3065,17 @@ static u32 ovly(void *priv_ref, u32 dsp_run_addr, u32 dsp_load_addr,
DBC_REQUIRE(hnode);
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
- ul_size = ul_num_bytes / hnode_mgr->udsp_word_size;
- ul_timeout = hnode->utimeout;
+ ul_size = ul_num_bytes / hnode_mgr->dsp_word_size;
+ ul_timeout = hnode->timeout;
/* Call new MemCopy function */
intf_fxns = hnode_mgr->intf_fxns;
- status = dev_get_bridge_context(hnode_mgr->hdev_obj, &hbridge_context);
+ status = dev_get_bridge_context(hnode_mgr->dev_obj, &hbridge_context);
if (!status) {
status =
- (*intf_fxns->pfn_brd_mem_copy) (hbridge_context,
+ (*intf_fxns->brd_mem_copy) (hbridge_context,
dsp_run_addr, dsp_load_addr,
ul_num_bytes, (u32) mem_space);
if (!status)
@@ -3181,15 +3109,15 @@ static u32 mem_write(void *priv_ref, u32 dsp_add, void *pbuf,
DBC_REQUIRE(hnode);
DBC_REQUIRE(mem_space & DBLL_CODE || mem_space & DBLL_DATA);
- hnode_mgr = hnode->hnode_mgr;
+ hnode_mgr = hnode->node_mgr;
- ul_timeout = hnode->utimeout;
+ ul_timeout = hnode->timeout;
mem_sect_type = (mem_space & DBLL_CODE) ? RMS_CODE : RMS_DATA;
/* Call new MemWrite function */
intf_fxns = hnode_mgr->intf_fxns;
- status = dev_get_bridge_context(hnode_mgr->hdev_obj, &hbridge_context);
- status = (*intf_fxns->pfn_brd_mem_write) (hbridge_context, pbuf,
+ status = dev_get_bridge_context(hnode_mgr->dev_obj, &hbridge_context);
+ status = (*intf_fxns->brd_mem_write) (hbridge_context, pbuf,
dsp_add, ul_num_bytes, mem_sect_type);
return ul_num_bytes;
@@ -3204,23 +3132,17 @@ int node_find_addr(struct node_mgr *node_mgr, u32 sym_addr,
{
struct node_object *node_obj;
int status = -ENOENT;
- u32 n;
pr_debug("%s(0x%x, 0x%x, 0x%x, 0x%x, %s)\n", __func__,
(unsigned int) node_mgr,
sym_addr, offset_range,
(unsigned int) sym_addr_output, sym_name);
- node_obj = (struct node_object *)(node_mgr->node_list->head.next);
-
- for (n = 0; n < node_mgr->num_nodes; n++) {
+ list_for_each_entry(node_obj, &node_mgr->node_list, list_elem) {
status = nldr_find_addr(node_obj->nldr_node_obj, sym_addr,
offset_range, sym_addr_output, sym_name);
-
if (!status)
break;
-
- node_obj = (struct node_object *) (node_obj->list_elem.next);
}
return status;