Commit 41638be7 authored by C A Subramaniam's avatar C A Subramaniam Committed by Hari Kanigeri

SYSLINK NOTIFY Patch to migrate Notify module to Syslink version 2.0.0.12

Patch Introduces additional tracking of notify driver
handles.
Signed-off-by: default avatarC A Subramaniam <subramaniam.ca@ti.com>
Signed-off-by: default avatarRamesh Gupta G <grgupta@ti.com>
parent 25ca34bd
...@@ -394,6 +394,7 @@ struct notify_driver_object { ...@@ -394,6 +394,7 @@ struct notify_driver_object {
struct notify_driver_attrs attrs; struct notify_driver_attrs attrs;
u32 *disable_flag[NOTIFY_MAXNESTDEPTH]; u32 *disable_flag[NOTIFY_MAXNESTDEPTH];
void *driver_object; void *driver_object;
int index;
}; };
......
...@@ -102,6 +102,7 @@ struct notify_ducatidrv_module { ...@@ -102,6 +102,7 @@ struct notify_ducatidrv_module {
struct notify_ducatidrv_config def_cfg; struct notify_ducatidrv_config def_cfg;
struct notify_ducatidrv_params def_inst_params; struct notify_ducatidrv_params def_inst_params;
struct mutex *gate_handle; struct mutex *gate_handle;
struct notify_driver_object *drv_handles[NOTIFY_MAX_DRIVERS];
} ; } ;
...@@ -250,6 +251,7 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -250,6 +251,7 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
int proc_id; int proc_id;
int i; int i;
u32 shm_va; u32 shm_va;
int tmp_status = NOTIFY_SUCCESS;
int slot = false; int slot = false;
...@@ -275,6 +277,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -275,6 +277,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
proc_id = PROC_DUCATI; proc_id = PROC_DUCATI;
tmp_status = notify_get_driver_handle(driver_name, &drv_handle);
if (tmp_status != NOTIFY_E_NOTFOUND) {
status = -EEXIST;
goto func_end;
}
/* Fill in information about driver attributes. */ /* Fill in information about driver attributes. */
/* This driver supports interaction with one other remote /* This driver supports interaction with one other remote
* processor.*/ * processor.*/
...@@ -412,56 +421,58 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -412,56 +421,58 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
mutex_unlock(notify_ducatidriver_state.gate_handle); mutex_unlock(notify_ducatidriver_state.gate_handle);
omap_mbox_enable_irq(ducati_mbox, IRQ_RX); omap_mbox_enable_irq(ducati_mbox, IRQ_RX);
status = 0; status = 0;
if (status == 0) { if (status == 0) {
driver_obj = drv_handle->driver_object; notify_ducatidriver_state.drv_handles[drv_handle->index]
ctrl_ptr->reg_mask.mask = 0x0; = drv_handle;
ctrl_ptr->reg_mask.enable_mask = 0xFFFFFFFF; driver_obj = drv_handle->driver_object;
ctrl_ptr->recv_init_status = NOTIFYSHMDRV_INIT_STAMP; ctrl_ptr->reg_mask.mask = 0x0;
ctrl_ptr->send_init_status = NOTIFYSHMDRV_INIT_STAMP; ctrl_ptr->reg_mask.enable_mask = 0xFFFFFFFF;
drv_handle->is_init = NOTIFY_DRIVERINITSTATUS_DONE; ctrl_ptr->recv_init_status = NOTIFYSHMDRV_INIT_STAMP;
} else { ctrl_ptr->send_init_status = NOTIFYSHMDRV_INIT_STAMP;
/* Check if drvHandle was drv_handle->is_init = NOTIFY_DRIVERINITSTATUS_DONE;
registered with Notify module. */ } else {
if (drv_handle != NULL) { /* Check if drvHandle was
/* Unregister driver from the Notify module*/ registered with Notify module. */
notify_unregister_driver(drv_handle); if (drv_handle != NULL) {
if (ctrl_ptr != NULL) { /* Unregister driver from the Notify module*/
/* Clear initialization status in notify_unregister_driver(drv_handle);
shared memory. */ if (ctrl_ptr != NULL) {
ctrl_ptr->recv_init_status = 0x0; /* Clear initialization status in
ctrl_ptr->send_init_status = 0x0; shared memory. */
ctrl_ptr = NULL; ctrl_ptr->recv_init_status = 0x0;
} ctrl_ptr->send_init_status = 0x0;
/* Check if driverObj was allocated. */ ctrl_ptr = NULL;
if (driver_obj != NULL) { }
/* Check if event List was allocated. */ /* Check if driverObj was allocated. */
if (driver_obj->event_list != NULL) { if (driver_obj != NULL) {
/* Check if lists were /* Check if event List was allocated. */
created. */ if (driver_obj->event_list != NULL) {
for (i = 0 ; /* Check if lists were
i < params->num_events ; i++) { created. */
list_del( for (i = 0 ;
(struct list_head *) i < params->num_events ; i++) {
&driver_obj-> list_del(
event_list[i]. (struct list_head *)
listeners); &driver_obj->
} event_list[i].
kfree(driver_obj->event_list); listeners);
driver_obj->event_list = NULL;
}
/* Check if regChart was allocated. */
if (driver_obj->reg_chart != NULL) {
kfree(driver_obj->reg_chart);
driver_obj->reg_chart
= NULL;
} }
kfree(driver_obj); kfree(driver_obj->event_list);
driver_obj->event_list = NULL;
} }
drv_handle->is_init = /* Check if regChart was allocated. */
NOTIFY_DRIVERINITSTATUS_NOTDONE; if (driver_obj->reg_chart != NULL) {
drv_handle = NULL; kfree(driver_obj->reg_chart);
driver_obj->reg_chart
= NULL;
}
kfree(driver_obj);
} }
drv_handle->is_init =
NOTIFY_DRIVERINITSTATUS_NOTDONE;
drv_handle = NULL;
} }
}
func_end: func_end:
/* Leave critical section protection. */ /* Leave critical section protection. */
...@@ -504,6 +515,8 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -504,6 +515,8 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if (drv_handle != NULL) { if (drv_handle != NULL) {
status = notify_unregister_driver(drv_handle); status = notify_unregister_driver(drv_handle);
driver_obj = drv_handle->driver_object; driver_obj = drv_handle->driver_object;
BUG_ON(drv_handle->index >= NOTIFY_MAX_DRIVERS);
notify_ducatidriver_state.drv_handles[drv_handle->index] = NULL;
} }
if (status != NOTIFY_SUCCESS) if (status != NOTIFY_SUCCESS)
printk(KERN_WARNING "driver is not registerd\n"); printk(KERN_WARNING "driver is not registerd\n");
...@@ -581,6 +594,7 @@ EXPORT_SYMBOL(notify_ducatidrv_delete); ...@@ -581,6 +594,7 @@ EXPORT_SYMBOL(notify_ducatidrv_delete);
int notify_ducatidrv_destroy(void) int notify_ducatidrv_destroy(void)
{ {
int status = 0; int status = 0;
int i = 0;
if (atomic_cmpmask_and_lt(&(notify_ducatidriver_state.ref_count), if (atomic_cmpmask_and_lt(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0), NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0),
...@@ -592,13 +606,21 @@ int notify_ducatidrv_destroy(void) ...@@ -592,13 +606,21 @@ int notify_ducatidrv_destroy(void)
if (atomic_dec_return(&(notify_ducatidriver_state.ref_count)) == if (atomic_dec_return(&(notify_ducatidriver_state.ref_count)) ==
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)) { NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)) {
/* Temprarily increment the refcount */
atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1));
for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) {
if (ducati_isr_params[i])
notify_ducatidrv_delete(
&(notify_ducatidriver_state.drv_handles[i]));
}
/* Check if the gate_handle was created internally. */ /* Check if the gate_handle was created internally. */
if (notify_ducatidriver_state.gate_handle != NULL) if (notify_ducatidriver_state.gate_handle != NULL)
kfree(notify_ducatidriver_state.gate_handle); kfree(notify_ducatidriver_state.gate_handle);
/* FIXME- Why do we need to reset this if we already
* decremented it to 0 */
atomic_set(&(notify_ducatidriver_state.ref_count), atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)); NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
...@@ -663,8 +685,10 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg) ...@@ -663,8 +685,10 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
cfg, sizeof(struct notify_ducatidrv_config)); cfg, sizeof(struct notify_ducatidrv_config));
} }
for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) {
ducati_isr_params[i] = NULL; ducati_isr_params[i] = NULL;
notify_ducatidriver_state.drv_handles[i] = NULL;
}
/* Initialize the maibox modulde for ducati */ /* Initialize the maibox modulde for ducati */
if (ducati_mbox == NULL) { if (ducati_mbox == NULL) {
ducati_mbox = omap_mbox_get("mailbox-2"); ducati_mbox = omap_mbox_get("mailbox-2");
......
...@@ -76,6 +76,7 @@ int notify_register_driver(char *driver_name, ...@@ -76,6 +76,7 @@ int notify_register_driver(char *driver_name,
/* Found an empty slot, so block it. */ /* Found an empty slot, so block it. */
drv_handle->is_init = drv_handle->is_init =
NOTIFY_DRIVERINITSTATUS_INPROGRESS; NOTIFY_DRIVERINITSTATUS_INPROGRESS;
drv_handle->index = i;
status = NOTIFY_SUCCESS; status = NOTIFY_SUCCESS;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment