Commit 1359ebf4 authored by Hari Kanigeri's avatar Hari Kanigeri

SYSLINK:proc-added proc4430 attach and detach

This patch adds proc4430 Attach and Detach functionality.
The Attach functions does ioremap of the Ducati physical
address, sets the slave virtual address same as the
physical address. This values are returned to the caller
in the params parameter passed to the Attach.
The Detach function does the reverse of Attach, where it
does the iounmap of the Master Virtual address.
Also, fixed the compile warning in procmgr.
Signed-off-by: default avatarHari Kanigeri <h-kanigeri2@ti.com>
parent f1ecaa2b
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h>
/* Module level headers */ /* Module level headers */
#include "../procdefs.h" #include "../procdefs.h"
...@@ -363,7 +364,40 @@ EXPORT_SYMBOL(proc4430_close); ...@@ -363,7 +364,40 @@ EXPORT_SYMBOL(proc4430_close);
int proc4430_attach(void *handle, struct processor_attach_params *params) int proc4430_attach(void *handle, struct processor_attach_params *params)
{ {
int retval = 0; int retval = 0;
/* TODO */ struct processor_object *proc_handle =
(struct processor_object *)handle;
struct proc4430_object *object = NULL;
u32 map_count = 0;
u32 i;
u32 dst_addr;
object = (struct proc4430_object *)proc_handle->object;
/* Return memory information in params. */
for (i = 0; (i < object->params.num_mem_entries); i++) {
/* If the configured master virtual address is invalid, get the
* actual address by mapping the physical address into master
* kernel memory space.
*/
if ((object->params.mem_entries[i].master_virt_addr == (u32)-1)
&& (object->params.mem_entries[i].shared == true)) {
map_count++;
dst_addr = (u32)ioremap_nocache((dma_addr_t)
(object->params.mem_entries[i].phys_addr),
object->params.mem_entries[i].size);
object->params.mem_entries[i].master_virt_addr =
dst_addr;
params->mem_entries[i].
addr[PROC_MGR_ADDRTYPE_MASTERKNLVIRT] =
dst_addr;
params->mem_entries[i].
addr[PROC_MGR_ADDRTYPE_SLAVEVIRT] =
(object->params.mem_entries[i].phys_addr);
/* User virtual will be filled by user side. */
params->mem_entries[i].size =
object->params.mem_entries[i].size;
}
}
params->num_mem_entries = map_count;
return retval; return retval;
} }
...@@ -374,10 +408,22 @@ int proc4430_attach(void *handle, struct processor_attach_params *params) ...@@ -374,10 +408,22 @@ int proc4430_attach(void *handle, struct processor_attach_params *params)
*/ */
int proc4430_detach(void *handle) int proc4430_detach(void *handle)
{ {
int retval = 0; struct processor_object *proc_handle =
(struct processor_object *)handle;
struct proc4430_object *object = NULL;
u32 i;
/* TODO */ object = (struct proc4430_object *)proc_handle->object;
return retval; for (i = 0; (i < object->params.num_mem_entries); i++) {
if ((object->params.mem_entries[i].master_virt_addr == (u32)-1)
&& (object->params.mem_entries[i].shared == true)) {
iounmap((void *)object->params.mem_entries[i].
master_virt_addr);
object->params.mem_entries[i].master_virt_addr =
(u32)-1;
}
}
return 0;
} }
...@@ -393,7 +439,6 @@ int proc4430_start(void *handle, u32 entry_pt, ...@@ -393,7 +439,6 @@ int proc4430_start(void *handle, u32 entry_pt,
struct processor_start_params *params) struct processor_start_params *params)
{ {
int retval = 0; int retval = 0;
/*TODO */
return retval; return retval;
} }
......
...@@ -726,11 +726,9 @@ EXPORT_SYMBOL(proc_mgr_register_notify); ...@@ -726,11 +726,9 @@ EXPORT_SYMBOL(proc_mgr_register_notify);
*/ */
int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info) int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info)
{ {
int retval = 0;
struct proc_mgr_object *proc_mgr_handle = struct proc_mgr_object *proc_mgr_handle =
(struct proc_mgr_object *)handle; (struct proc_mgr_object *)handle;
struct processor_object *proc_handle; struct processor_object *proc_handle;
int i = 0;
if (WARN_ON(handle == NULL)) if (WARN_ON(handle == NULL))
goto error_exit; goto error_exit;
......
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