Commit 007e8e73 authored by Jayan John's avatar Jayan John Committed by Hari Kanigeri

SYSLINK: ipc - fixes in proc4430 and platform.

This patch fixes the issues found in..
	<1> platform.c:
		- calling platform_mem_unmap() on all addreses
                	on which we have called platform_mem_map().
		- calling proc_mgr_detach for SysM3 and AppM3.
	<2> -proc4430.c:
		- proc4430_detach() fixed to unmap all reqd.
			addresses.
		- cleanup
Signed-off-by: default avatarJayan John <x00jayan@ti.com>
parent 1dc83a2f
...@@ -428,6 +428,11 @@ void *platform_sm_heap_phys_addr; ...@@ -428,6 +428,11 @@ void *platform_sm_heap_phys_addr;
*/ */
struct sysmgr_proc_config pc_params; struct sysmgr_proc_config pc_params;
/*!
* @brief SW DMM virtual address.
*/
void *platform_sw_dmm_virt_addr;
/* ============================================================================= /* =============================================================================
* APIS * APIS
* ============================================================================= * =============================================================================
...@@ -514,10 +519,10 @@ s32 platform_setup(struct sysmgr_config *config) ...@@ -514,10 +519,10 @@ s32 platform_setup(struct sysmgr_config *config)
status = platform_mem_map(&info); status = platform_mem_map(&info);
if (status < 0) if (status < 0)
goto mem_map_fail; goto mem_map_fail;
platform_sw_dmm_virt_addr = (void *) info.dst;
/* Create the shared region entry for the SW DMM heap */ /* Create the shared region entry for the SW DMM heap */
sharedregion_add(SMHEAP_SRINDEX_SWDMM, sharedregion_add(SMHEAP_SRINDEX_SWDMM,
(void *)info.dst, platform_sw_dmm_virt_addr,
info.size); info.size);
proc4430_get_config(&proc_config); proc4430_get_config(&proc_config);
...@@ -650,6 +655,11 @@ s32 platform_destroy(void) ...@@ -650,6 +655,11 @@ s32 platform_destroy(void)
struct platform_mem_unmap_info u_info; struct platform_mem_unmap_info u_info;
/* Delete the Processor instances */ /* Delete the Processor instances */
if (procmgr_handle_appm3 != NULL) {
status = proc_mgr_detach(procmgr_handle_appm3);
WARN_ON(status < 0);
}
if (procmgr_proc_handle_appm3 != NULL) { if (procmgr_proc_handle_appm3 != NULL) {
status = proc4430_delete(&procmgr_proc_handle_appm3); status = proc4430_delete(&procmgr_proc_handle_appm3);
WARN_ON(status < 0); WARN_ON(status < 0);
...@@ -660,6 +670,11 @@ s32 platform_destroy(void) ...@@ -660,6 +670,11 @@ s32 platform_destroy(void)
WARN_ON(status < 0); WARN_ON(status < 0);
} }
if (procmgr_handle_sysm3 != NULL) {
status = proc_mgr_detach(procmgr_handle_sysm3);
WARN_ON(status < 0);
}
if (procmgr_proc_handle_sysm3 != NULL) { if (procmgr_proc_handle_sysm3 != NULL) {
status = proc4430_delete(&procmgr_proc_handle_sysm3); status = proc4430_delete(&procmgr_proc_handle_sysm3);
WARN_ON(status < 0); WARN_ON(status < 0);
...@@ -683,10 +698,15 @@ s32 platform_destroy(void) ...@@ -683,10 +698,15 @@ s32 platform_destroy(void)
status = sysmemmgr_destroy(); status = sysmemmgr_destroy();
WARN_ON(status < 0); WARN_ON(status < 0);
/* Delete the memory map */ if (platform_sm_heap_virt_addr != NULL) {
u_info.addr = (u32) platform_sm_heap_virt_addr; u_info.addr = (u32) platform_sm_heap_virt_addr;
platform_mem_unmap(&u_info); platform_mem_unmap(&u_info);
}
if (platform_sw_dmm_virt_addr != NULL) {
u_info.addr = platform_sw_dmm_virt_addr;
platform_mem_unmap(&u_info);
}
return status; return status;
} }
......
...@@ -474,19 +474,19 @@ int proc4430_attach(void *handle, struct processor_attach_params *params) ...@@ -474,19 +474,19 @@ int proc4430_attach(void *handle, struct processor_attach_params *params)
OMAP4430PROC_MAKE_MAGICSTAMP(0), OMAP4430PROC_MAKE_MAGICSTAMP(0),
OMAP4430PROC_MAKE_MAGICSTAMP(1)) OMAP4430PROC_MAKE_MAGICSTAMP(1))
== true) { == true) {
printk(KERN_ERR "proc4430_attach failed " printk(KERN_ERR "proc4430_attach failed"
"Module not initialized"); "Module not initialized");
return -ENODEV; return -ENODEV;
} }
if (WARN_ON(handle == NULL)) { if (WARN_ON(handle == NULL)) {
printk(KERN_ERR "proc4430_attach failed " printk(KERN_ERR "proc4430_attach failed"
"Driver handle is NULL"); "Driver handle is NULL");
return -EINVAL; return -EINVAL;
} }
if (WARN_ON(params == NULL)) { if (WARN_ON(params == NULL)) {
printk(KERN_ERR "proc4430_attach failed " printk(KERN_ERR "proc4430_attach failed"
"Argument processor_attach_params * is NULL"); "Argument processor_attach_params * is NULL");
return -EINVAL; return -EINVAL;
} }
...@@ -556,7 +556,7 @@ int proc4430_detach(void *handle) ...@@ -556,7 +556,7 @@ int proc4430_detach(void *handle)
} }
if (WARN_ON(handle == NULL)) { if (WARN_ON(handle == NULL)) {
printk(KERN_ERR "proc4430_attach failed " printk(KERN_ERR "proc4430_detach failed "
"Argument Driverhandle is NULL"); "Argument Driverhandle is NULL");
return -EINVAL; return -EINVAL;
} }
...@@ -564,21 +564,19 @@ int proc4430_detach(void *handle) ...@@ -564,21 +564,19 @@ int proc4430_detach(void *handle)
proc_handle = (struct processor_object *)handle; proc_handle = (struct processor_object *)handle;
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 > 0)
&& (object->params.mem_entries[i].shared == true)) { && (object->params.mem_entries[i].shared == true)) {
unmap_info.addr = unmap_info.addr =
object->params.mem_entries[i].master_virt_addr; object->params.mem_entries[i].master_virt_addr;
unmap_info.size = object->params.mem_entries[i].size; unmap_info.size = object->params.mem_entries[i].size;
if (unmap_info.addr != 0) platform_mem_unmap(&unmap_info);
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;
} }
} }
return 0; return 0;
} }
/*========================================== /*==========================================
* Function to start the slave processor * Function to start the slave processor
* *
...@@ -602,7 +600,7 @@ int proc4430_start(void *handle, u32 entry_pt, ...@@ -602,7 +600,7 @@ int proc4430_start(void *handle, u32 entry_pt,
/*FIXME: Remove handle and entry_pt if not used */ /*FIXME: Remove handle and entry_pt if not used */
if (WARN_ON(start_params == NULL)) { if (WARN_ON(start_params == NULL)) {
printk(KERN_ERR "proc4430_attach failed " printk(KERN_ERR "proc4430_start failed "
"Argument processor_start_params * is NULL"); "Argument processor_start_params * is NULL");
return -EINVAL; return -EINVAL;
} }
......
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