summaryrefslogtreecommitdiffstats
path: root/drivers/staging/tidspbridge/rmgr/mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/tidspbridge/rmgr/mgr.c')
-rw-r--r--drivers/staging/tidspbridge/rmgr/mgr.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index 57a39b9..0ea89a1 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -20,6 +20,9 @@
#include <linux/types.h>
+/* ----------------------------------- Host OS */
+#include <dspbridge/host_os.h>
+
/* ----------------------------------- DSP/BIOS Bridge */
#include <dspbridge/dbdefs.h>
@@ -27,7 +30,6 @@
#include <dspbridge/dbc.h>
/* ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/cfg.h>
#include <dspbridge/sync.h>
/* ----------------------------------- Others */
@@ -58,6 +60,7 @@ int mgr_create(struct mgr_object **mgr_obj,
{
int status = 0;
struct mgr_object *pmgr_obj = NULL;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(mgr_obj != NULL);
DBC_REQUIRE(refs > 0);
@@ -67,7 +70,14 @@ int mgr_create(struct mgr_object **mgr_obj,
status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->hdcd_mgr);
if (!status) {
/* If succeeded store the handle in the MGR Object */
- status = cfg_set_object((u32) pmgr_obj, REG_MGR_OBJECT);
+ if (drv_datap) {
+ drv_datap->mgr_object = (void *)pmgr_obj;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store MGR object\n",
+ __func__);
+ }
+
if (!status) {
*mgr_obj = pmgr_obj;
} else {
@@ -94,6 +104,7 @@ int mgr_destroy(struct mgr_object *hmgr_obj)
{
int status = 0;
struct mgr_object *pmgr_obj = (struct mgr_object *)hmgr_obj;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(refs > 0);
DBC_REQUIRE(hmgr_obj);
@@ -103,8 +114,13 @@ int mgr_destroy(struct mgr_object *hmgr_obj)
dcd_destroy_manager(hmgr_obj->hdcd_mgr);
kfree(pmgr_obj);
- /* Update the Registry with NULL for MGR Object */
- (void)cfg_set_object(0, REG_MGR_OBJECT);
+ /* Update the driver data with NULL for MGR Object */
+ if (drv_datap) {
+ drv_datap->mgr_object = NULL;
+ } else {
+ status = -EPERM;
+ pr_err("%s: Failed to store MGR object\n", __func__);
+ }
return status;
}
@@ -123,6 +139,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
u32 node_index = 0;
struct dcd_genericobj gen_obj;
struct mgr_object *pmgr_obj = NULL;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
DBC_REQUIRE(pndb_props != NULL);
DBC_REQUIRE(pu_num_nodes != NULL);
@@ -130,10 +147,14 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
DBC_REQUIRE(refs > 0);
*pu_num_nodes = 0;
- /* Get The Manager Object from the Registry */
- status = cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT);
- if (status)
+ /* Get the Manager Object from the driver data */
+ if (!drv_datap || !drv_datap->mgr_object) {
+ status = -ENODATA;
+ pr_err("%s: Failed to retrieve the object handle\n", __func__);
goto func_cont;
+ } else {
+ pmgr_obj = drv_datap->mgr_object;
+ }
DBC_ASSERT(pmgr_obj);
/* Forever loop till we hit failed or no more items in the
@@ -195,6 +216,7 @@ int mgr_enum_processor_info(u32 processor_id,
struct drv_object *hdrv_obj;
u8 dev_type;
struct cfg_devnode *dev_node;
+ struct drv_data *drv_datap = dev_get_drvdata(bridge);
bool proc_detect = false;
DBC_REQUIRE(processor_info != NULL);
@@ -203,7 +225,15 @@ int mgr_enum_processor_info(u32 processor_id,
DBC_REQUIRE(refs > 0);
*pu_num_procs = 0;
- status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
+
+ /* Retrieve the Object handle from the driver data */
+ if (!drv_datap || !drv_datap->drv_object) {
+ status = -ENODATA;
+ pr_err("%s: Failed to retrieve the object handle\n", __func__);
+ } else {
+ hdrv_obj = drv_datap->drv_object;
+ }
+
if (!status) {
status = drv_get_dev_object(processor_id, hdrv_obj, &hdev_obj);
if (!status) {
@@ -219,8 +249,10 @@ int mgr_enum_processor_info(u32 processor_id,
if (status)
goto func_end;
- /* Get The Manager Object from the Registry */
- if (cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT)) {
+ /* Get The Manager Object from the driver data */
+ if (drv_datap && drv_datap->mgr_object) {
+ pmgr_obj = drv_datap->mgr_object;
+ } else {
dev_dbg(bridge, "%s: Failed to get MGR Object\n", __func__);
goto func_end;
}
OpenPOWER on IntegriCloud