Commit 94ca9d96 authored by Hari Kanigeri's avatar Hari Kanigeri

SYSLINK:proc changes to adapt to sys manager and ipc

This patch adds support to sys mananager and adapting
to new IPC.
Signed-off-by: default avatarHari Kanigeri <h-kanigeri2@ti.com>
parent 8aac8c22
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "dmm4430.h" #include "dmm4430.h"
#include <syslink/multiproc.h> #include <syslink/multiproc.h>
#include <syslink/ducatienabler.h> #include <syslink/ducatienabler.h>
#include <syslink/platform_mem.h>
#define DUCATI_DMM_START_ADDR 0xa0000000 #define DUCATI_DMM_START_ADDR 0xa0000000
#define DUCATI_DMM_POOL_SIZE 0x6000000 #define DUCATI_DMM_POOL_SIZE 0x6000000
...@@ -83,7 +84,6 @@ struct proc4430_object { ...@@ -83,7 +84,6 @@ struct proc4430_object {
static struct proc4430_module_object proc4430_state = { static struct proc4430_module_object proc4430_state = {
.is_setup = false, .is_setup = false,
.config_size = sizeof(struct proc4430_config), .config_size = sizeof(struct proc4430_config),
.def_cfg.gate_handle = NULL,
.gate_handle = NULL, .gate_handle = NULL,
.def_inst_params.num_mem_entries = 0u, .def_inst_params.num_mem_entries = 0u,
.def_inst_params.mem_entries = NULL, .def_inst_params.mem_entries = NULL,
...@@ -142,16 +142,13 @@ int proc4430_setup(struct proc4430_config *cfg) ...@@ -142,16 +142,13 @@ int proc4430_setup(struct proc4430_config *cfg)
if (proc4430_state.is_setup == false) { if (proc4430_state.is_setup == false) {
dmm_create(); dmm_create();
dmm_create_tables(DUCATI_DMM_START_ADDR, DUCATI_DMM_POOL_SIZE); dmm_create_tables(DUCATI_DMM_START_ADDR, DUCATI_DMM_POOL_SIZE);
if (cfg->gate_handle != NULL) {
proc4430_state.gate_handle = cfg->gate_handle; /* Create a default gate handle for local module protection. */
} else {
/* User has not provided any gate handle, so create a
* default handle. */
proc4430_state.gate_handle = proc4430_state.gate_handle =
kmalloc(sizeof(struct mutex), GFP_KERNEL); kmalloc(sizeof(struct mutex), GFP_KERNEL);
mutex_init(proc4430_state.gate_handle); mutex_init(proc4430_state.gate_handle);
ducati_setup(); ducati_setup();
}
/* Initialize the name to handles mapping array. */ /* Initialize the name to handles mapping array. */
memset(&proc4430_state.proc_handles, 0, memset(&proc4430_state.proc_handles, 0,
(sizeof(void *) * MULTIPROC_MAXPROCESSORS)); (sizeof(void *) * MULTIPROC_MAXPROCESSORS));
...@@ -186,12 +183,11 @@ int proc4430_destroy(void) ...@@ -186,12 +183,11 @@ int proc4430_destroy(void)
} }
/* Check if the gate_handle was created internally. */ /* Check if the gate_handle was created internally. */
if (proc4430_state.cfg.gate_handle == NULL) {
if (proc4430_state.gate_handle != NULL) { if (proc4430_state.gate_handle != NULL) {
mutex_destroy(proc4430_state.gate_handle); mutex_destroy(proc4430_state.gate_handle);
kfree(proc4430_state.gate_handle); kfree(proc4430_state.gate_handle);
} }
}
ducati_destroy(); ducati_destroy();
proc4430_state.is_setup = false; proc4430_state.is_setup = false;
return retval; return retval;
...@@ -382,7 +378,7 @@ int proc4430_attach(void *handle, struct processor_attach_params *params) ...@@ -382,7 +378,7 @@ int proc4430_attach(void *handle, struct processor_attach_params *params)
struct proc4430_object *object = NULL; struct proc4430_object *object = NULL;
u32 map_count = 0; u32 map_count = 0;
u32 i; u32 i;
u32 dst_addr; memory_map_info map_info;
object = (struct proc4430_object *)proc_handle->object; object = (struct proc4430_object *)proc_handle->object;
/* Return memory information in params. */ /* Return memory information in params. */
...@@ -394,13 +390,19 @@ int proc4430_attach(void *handle, struct processor_attach_params *params) ...@@ -394,13 +390,19 @@ int proc4430_attach(void *handle, struct processor_attach_params *params)
if ((object->params.mem_entries[i].master_virt_addr == (u32)-1) if ((object->params.mem_entries[i].master_virt_addr == (u32)-1)
&& (object->params.mem_entries[i].shared == true)) { && (object->params.mem_entries[i].shared == true)) {
map_count++; map_count++;
dst_addr = (u32)ioremap_nocache((dma_addr_t) map_info.src = object->params.mem_entries[i].phys_addr;
(object->params.mem_entries[i].phys_addr), map_info.size = object->params.mem_entries[i].size;
object->params.mem_entries[i].size); map_info.is_cached = false;
retval = platform_mem_map(&map_info);
if (retval != 0) {
printk(KERN_ERR "proc4430_attach failed\n");
return -EFAULT;
}
object->params.mem_entries[i].master_virt_addr = object->params.mem_entries[i].master_virt_addr =
dst_addr; map_info.dst;
params->mem_entries[i].addr params->mem_entries[i].addr
[PROC_MGR_ADDRTYPE_MASTERKNLVIRT] = dst_addr; [PROC_MGR_ADDRTYPE_MASTERKNLVIRT] =
map_info.dst;
params->mem_entries[i].addr params->mem_entries[i].addr
[PROC_MGR_ADDRTYPE_SLAVEVIRT] = [PROC_MGR_ADDRTYPE_SLAVEVIRT] =
(object->params.mem_entries[i].slave_virt_addr); (object->params.mem_entries[i].slave_virt_addr);
...@@ -429,13 +431,17 @@ int proc4430_detach(void *handle) ...@@ -429,13 +431,17 @@ int proc4430_detach(void *handle)
(struct processor_object *)handle; (struct processor_object *)handle;
struct proc4430_object *object = NULL; struct proc4430_object *object = NULL;
u32 i; u32 i;
memory_unmap_info unmap_info;
object = (struct proc4430_object *)proc_handle->object; object = (struct proc4430_object *)proc_handle->object;
for (i = 0; (i < object->params.num_mem_entries); i++) { for (i = 0; (i < object->params.num_mem_entries); i++) {
if ((object->params.mem_entries[i].master_virt_addr == (u32)-1) if ((object->params.mem_entries[i].master_virt_addr == (u32)-1)
&& (object->params.mem_entries[i].shared == true)) { && (object->params.mem_entries[i].shared == true)) {
iounmap((void *)object->params.mem_entries[i]. unmap_info.addr =
master_virt_addr); object->params.mem_entries[i].master_virt_addr;
unmap_info.size = object->params.mem_entries[i].size;
if (unmap_info.addr != 0)
platform_mem_unmap(&unmap_info);
object->params.mem_entries[i].master_virt_addr = object->params.mem_entries[i].master_virt_addr =
(u32)-1; (u32)-1;
} }
......
...@@ -83,9 +83,10 @@ inline int processor_detach(void *handle) ...@@ -83,9 +83,10 @@ inline int processor_detach(void *handle)
BUG_ON(proc_handle->proc_fxn_table.detach == NULL); BUG_ON(proc_handle->proc_fxn_table.detach == NULL);
retval = proc_handle->proc_fxn_table.detach(handle); retval = proc_handle->proc_fxn_table.detach(handle);
if ((proc_handle->boot_mode == PROC_MGR_BOOTMODE_BOOT) /* For all boot modes, at the end of detach, the Processor is in
|| (proc_handle->boot_mode == PROC_MGR_BOOTMODE_NOLOAD)) * unknown state.
proc_handle->state = PROC_MGR_STATE_RESET; */
proc_handle->state = PROC_MGR_STATE_UNKNOWN;
return retval; return retval;
} }
......
This diff is collapsed.
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <syslink/multiproc.h> #include <syslink/multiproc.h>
#define PROCMGR_MODULEID 0xf2ba
/* /*
* Maximum name length for ProcMgr module strings. * Maximum name length for ProcMgr module strings.
*/ */
......
...@@ -263,7 +263,7 @@ static int proc_mgr_drv_ioctl(struct inode *inode, struct file *filp, ...@@ -263,7 +263,7 @@ static int proc_mgr_drv_ioctl(struct inode *inode, struct file *filp,
sizeof(struct proc_mgr_cmd_args_close)); sizeof(struct proc_mgr_cmd_args_close));
if (WARN_ON(retval != 0)) if (WARN_ON(retval != 0))
goto func_exit; goto func_exit;
retval = proc_mgr_close(src_args.handle); retval = proc_mgr_close(&(src_args.handle));
} }
break; break;
...@@ -400,6 +400,7 @@ static int proc_mgr_drv_ioctl(struct inode *inode, struct file *filp, ...@@ -400,6 +400,7 @@ static int proc_mgr_drv_ioctl(struct inode *inode, struct file *filp,
if (WARN_ON(retval != 0)) if (WARN_ON(retval != 0))
goto func_exit; goto func_exit;
procmgrstate = proc_mgr_get_state(src_args.handle); procmgrstate = proc_mgr_get_state(src_args.handle);
src_args.proc_mgr_state = procmgrstate;
retval = copy_to_user((void *)(args), (const void *)&src_args, retval = copy_to_user((void *)(args), (const void *)&src_args,
sizeof(struct proc_mgr_cmd_args_get_state)); sizeof(struct proc_mgr_cmd_args_get_state));
WARN_ON(retval < 0); WARN_ON(retval < 0);
......
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