Commit 2a1e2f6f authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

ARM OMAP Syslink proc manager open fix

In proc manager open, the address translation (ducti -> mpu kernel,
ducati -> mpu user) were not populated from proc 4430 get info
function.
In this fix the adress translation tables are populated directly
from the proc instance handle memory entry tables in proc get info
function, rather than going in to proc4430 get info function for
the same. This fix is based on the approach followed in syslink code.
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 1359ebf4
...@@ -212,7 +212,6 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params) ...@@ -212,7 +212,6 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
{ {
struct processor_object *handle = NULL; struct processor_object *handle = NULL;
struct proc4430_object *object = NULL; struct proc4430_object *object = NULL;
int ret_val = 0;
BUG_ON(!IS_VALID_PROCID(proc_id)); BUG_ON(!IS_VALID_PROCID(proc_id));
BUG_ON(params == NULL); BUG_ON(params == NULL);
...@@ -230,6 +229,7 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params) ...@@ -230,6 +229,7 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
vmalloc(sizeof(struct processor_object)); vmalloc(sizeof(struct processor_object));
if (WARN_ON(handle == NULL)) if (WARN_ON(handle == NULL))
goto func_end; goto func_end;
handle->proc_fxn_table.attach = &proc4430_attach; handle->proc_fxn_table.attach = &proc4430_attach;
handle->proc_fxn_table.detach = &proc4430_detach; handle->proc_fxn_table.detach = &proc4430_detach;
handle->proc_fxn_table.start = &proc4430_start; handle->proc_fxn_table.start = &proc4430_start;
...@@ -249,23 +249,20 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params) ...@@ -249,23 +249,20 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
object = (struct proc4430_object *)handle->object; object = (struct proc4430_object *)handle->object;
/* Copy params into instance object. */ /* Copy params into instance object. */
memcpy(&(object->params), (void *)params, memcpy(&(object->params), (void *)params,
sizeof(struct proc4430_object)); sizeof(struct proc4430_params));
if (params->mem_entries != NULL && /* Allocate memory for, and copy mem_entries table*/
params->num_mem_entries > 0) { object->params.mem_entries = vmalloc(sizeof(struct
/* Allocate memory for, and copy memEntries table*/ proc4430_mem_entry) *
object->params.mem_entries = vmalloc( params->num_mem_entries);
sizeof(struct proc4430_mem_entry) * memcpy(object->params.mem_entries,
params->num_mem_entries);
ret_val = copy_from_user(object->params.mem_entries,
params->mem_entries, params->mem_entries,
(sizeof(struct proc4430_mem_entry) (sizeof(struct proc4430_mem_entry) *
* params->num_mem_entries)); params->num_mem_entries));
WARN_ON(ret_val < 0);
}
handle->boot_mode = PROC_MGR_BOOTMODE_NOLOAD; handle->boot_mode = PROC_MGR_BOOTMODE_NOLOAD;
/* Set the handle in the state object. */ /* Set the handle in the state object. */
proc4430_state.proc_handles[proc_id] = handle; proc4430_state.proc_handles[proc_id] = handle;
} }
func_end: func_end:
mutex_unlock(proc4430_state.gate_handle); mutex_unlock(proc4430_state.gate_handle);
return handle; return handle;
...@@ -386,12 +383,11 @@ int proc4430_attach(void *handle, struct processor_attach_params *params) ...@@ -386,12 +383,11 @@ int proc4430_attach(void *handle, struct processor_attach_params *params)
object->params.mem_entries[i].size); object->params.mem_entries[i].size);
object->params.mem_entries[i].master_virt_addr = object->params.mem_entries[i].master_virt_addr =
dst_addr; dst_addr;
params->mem_entries[i]. params->mem_entries[i].addr
addr[PROC_MGR_ADDRTYPE_MASTERKNLVIRT] = [PROC_MGR_ADDRTYPE_MASTERKNLVIRT] = dst_addr;
dst_addr; params->mem_entries[i].addr
params->mem_entries[i]. [PROC_MGR_ADDRTYPE_SLAVEVIRT] =
addr[PROC_MGR_ADDRTYPE_SLAVEVIRT] = (object->params.mem_entries[i].slave_virt_addr);
(object->params.mem_entries[i].phys_addr);
/* User virtual will be filled by user side. */ /* User virtual will be filled by user side. */
params->mem_entries[i].size = params->mem_entries[i].size =
object->params.mem_entries[i].size; object->params.mem_entries[i].size;
......
...@@ -59,12 +59,19 @@ struct proc_mgr_object { ...@@ -59,12 +59,19 @@ struct proc_mgr_object {
/* Processor ID associated with this ProcMgr. */ /* Processor ID associated with this ProcMgr. */
struct processor_object *proc_handle; struct processor_object *proc_handle;
/* Processor ID of the processor being represented by this instance. */ /* Processor ID of the processor being represented by this instance. */
void *loader_handle;
/*!< Handle to the Loader object associated with this ProcMgr. */
void *pwr_handle;
/*!< Handle to the PwrMgr object associated with this ProcMgr. */
/*!< Processor ID of the processor being represented by this instance */
struct proc_mgr_params params; struct proc_mgr_params params;
/* ProcMgr instance params structure */ /* ProcMgr instance params structure */
struct proc_mgr_attach_params attach_params; struct proc_mgr_attach_params attach_params;
/* ProcMgr attach params structure */ /* ProcMgr attach params structure */
struct proc_mgr_start_params start_params; struct proc_mgr_start_params start_params;
/* ProcMgr start params structure */ /* ProcMgr start params structure */
u32 file_id;
/*!< File ID of the loaded static executable */
u16 num_mem_entries; u16 num_mem_entries;
/* Number of valid memory entries */ /* Number of valid memory entries */
struct proc_mgr_addr_info mem_entries[PROCMGR_MAX_MEMORY_REGIONS]; struct proc_mgr_addr_info mem_entries[PROCMGR_MAX_MEMORY_REGIONS];
...@@ -228,8 +235,10 @@ void *proc_mgr_create(u16 proc_id, const struct proc_mgr_params *params) ...@@ -228,8 +235,10 @@ void *proc_mgr_create(u16 proc_id, const struct proc_mgr_params *params)
memcpy(&(handle->params), params, sizeof(struct proc_mgr_params)); memcpy(&(handle->params), params, sizeof(struct proc_mgr_params));
handle->proc_id = proc_id; handle->proc_id = proc_id;
handle->proc_handle = params->proc_handle; handle->proc_handle = params->proc_handle;
mutex_unlock(proc_mgr_obj_state.gate_handle); handle->loader_handle = params->loader_handle;
handle->pwr_handle = params->pwr_handle;
proc_mgr_obj_state.proc_handles[proc_id] = handle; proc_mgr_obj_state.proc_handles[proc_id] = handle;
mutex_unlock(proc_mgr_obj_state.gate_handle);
return handle; return handle;
} }
EXPORT_SYMBOL(proc_mgr_create); EXPORT_SYMBOL(proc_mgr_create);
...@@ -726,10 +735,14 @@ EXPORT_SYMBOL(proc_mgr_register_notify); ...@@ -726,10 +735,14 @@ 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 i;
int count = 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;
struct proc_mgr_proc_info proc_info_test;
if (WARN_ON(handle == NULL)) if (WARN_ON(handle == NULL))
goto error_exit; goto error_exit;
if (WARN_ON(proc_info == NULL)) if (WARN_ON(proc_info == NULL))
...@@ -739,7 +752,15 @@ int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info) ...@@ -739,7 +752,15 @@ int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info)
goto error_exit; goto error_exit;
WARN_ON(mutex_lock_interruptible(proc_mgr_obj_state.gate_handle)); WARN_ON(mutex_lock_interruptible(proc_mgr_obj_state.gate_handle));
processor_get_proc_info(proc_handle, proc_info);
processor_get_proc_info(proc_handle, &proc_info_test);
/* Return bootMode information. */
proc_info->boot_mode = proc_mgr_handle->attach_params.boot_mode;
/* Return memory information. */
proc_info->num_mem_entries = proc_mgr_handle->num_mem_entries;
memcpy(&(proc_info->mem_entries),
&(proc_mgr_handle->mem_entries),
sizeof(proc_mgr_handle->mem_entries));
mutex_unlock(proc_mgr_obj_state.gate_handle); mutex_unlock(proc_mgr_obj_state.gate_handle);
return 0; return 0;
error_exit: error_exit:
......
...@@ -112,6 +112,10 @@ struct proc_mgr_config { ...@@ -112,6 +112,10 @@ struct proc_mgr_config {
struct proc_mgr_params { struct proc_mgr_params {
void *proc_handle; void *proc_handle;
/* void * to the Processor object associated with this ProcMgr. */ /* void * to the Processor object associated with this ProcMgr. */
void *loader_handle;
/*!< Handle to the Loader object associated with this ProcMgr. */
void *pwr_handle;
/*!< Handle to the PwrMgr object associated with this ProcMgr. */
}; };
/* /*
...@@ -137,7 +141,8 @@ struct proc_mgr_start_params { ...@@ -137,7 +141,8 @@ struct proc_mgr_start_params {
* the ProcMgr module. * the ProcMgr module.
*/ */
struct proc_mgr_addr_info { struct proc_mgr_addr_info {
bool is_init; /* bool is_init; */
unsigned short is_init;
/* Is this memory region initialized? */ /* Is this memory region initialized? */
u32 addr[PROC_MGR_ADDRTYPE_ENDVALUE]; u32 addr[PROC_MGR_ADDRTYPE_ENDVALUE];
/* Addresses for each type of address space */ /* Addresses for each type of address space */
......
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