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)
{
struct processor_object *handle = NULL;
struct proc4430_object *object = NULL;
int ret_val = 0;
BUG_ON(!IS_VALID_PROCID(proc_id));
BUG_ON(params == NULL);
......@@ -230,6 +229,7 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
vmalloc(sizeof(struct processor_object));
if (WARN_ON(handle == NULL))
goto func_end;
handle->proc_fxn_table.attach = &proc4430_attach;
handle->proc_fxn_table.detach = &proc4430_detach;
handle->proc_fxn_table.start = &proc4430_start;
......@@ -249,23 +249,20 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
object = (struct proc4430_object *)handle->object;
/* Copy params into instance object. */
memcpy(&(object->params), (void *)params,
sizeof(struct proc4430_object));
if (params->mem_entries != NULL &&
params->num_mem_entries > 0) {
/* Allocate memory for, and copy memEntries table*/
object->params.mem_entries = vmalloc(
sizeof(struct proc4430_mem_entry) *
sizeof(struct proc4430_params));
/* Allocate memory for, and copy mem_entries table*/
object->params.mem_entries = vmalloc(sizeof(struct
proc4430_mem_entry) *
params->num_mem_entries);
ret_val = copy_from_user(object->params.mem_entries,
memcpy(object->params.mem_entries,
params->mem_entries,
(sizeof(struct proc4430_mem_entry)
* params->num_mem_entries));
WARN_ON(ret_val < 0);
}
(sizeof(struct proc4430_mem_entry) *
params->num_mem_entries));
handle->boot_mode = PROC_MGR_BOOTMODE_NOLOAD;
/* Set the handle in the state object. */
proc4430_state.proc_handles[proc_id] = handle;
}
func_end:
mutex_unlock(proc4430_state.gate_handle);
return handle;
......@@ -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].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);
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].slave_virt_addr);
/* User virtual will be filled by user side. */
params->mem_entries[i].size =
object->params.mem_entries[i].size;
......
......@@ -59,12 +59,19 @@ struct proc_mgr_object {
/* Processor ID associated with this ProcMgr. */
struct processor_object *proc_handle;
/* 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;
/* ProcMgr instance params structure */
struct proc_mgr_attach_params attach_params;
/* ProcMgr attach params structure */
struct proc_mgr_start_params start_params;
/* ProcMgr start params structure */
u32 file_id;
/*!< File ID of the loaded static executable */
u16 num_mem_entries;
/* Number of valid memory entries */
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)
memcpy(&(handle->params), params, sizeof(struct proc_mgr_params));
handle->proc_id = proc_id;
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;
mutex_unlock(proc_mgr_obj_state.gate_handle);
return handle;
}
EXPORT_SYMBOL(proc_mgr_create);
......@@ -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 i;
int count = 0;
struct proc_mgr_object *proc_mgr_handle =
(struct proc_mgr_object *)handle;
struct processor_object *proc_handle;
struct proc_mgr_proc_info proc_info_test;
if (WARN_ON(handle == NULL))
goto error_exit;
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)
goto error_exit;
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);
return 0;
error_exit:
......
......@@ -112,6 +112,10 @@ struct proc_mgr_config {
struct proc_mgr_params {
void *proc_handle;
/* 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 {
* the ProcMgr module.
*/
struct proc_mgr_addr_info {
bool is_init;
/* bool is_init; */
unsigned short is_init;
/* Is this memory region initialized? */
u32 addr[PROC_MGR_ADDRTYPE_ENDVALUE];
/* 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