summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00c0055)
raw | patch | inline | side by side (parent: 00c0055)
author | Wendy Liang <jliang@xilinx.com> | |
Wed, 6 Jul 2016 05:58:57 +0000 (22:58 -0700) | ||
committer | Wendy Liang <jliang@xilinx.com> | |
Thu, 13 Oct 2016 05:01:44 +0000 (22:01 -0700) |
Use proc->ops->initialize() for the remote processor initialization,
which will initialize the hil_proc and memory map the shared
memory specified in proc_shm.
The hil_create_proc() will only link the initialized hil_proc
to the hil_proc list.
Signed-off-by: Wendy Liang <jliang@xilinx.com>
which will initialize the hil_proc and memory map the shared
memory specified in proc_shm.
The hil_create_proc() will only link the initialized hil_proc
to the hil_proc list.
Signed-off-by: Wendy Liang <jliang@xilinx.com>
diff --git a/lib/common/hil.c b/lib/common/hil.c
index 724040686c76b87cdd2846c3184995d09facd8d4..1cf9dabe3259840f2bfc988e386c2e0151066351 100644 (file)
--- a/lib/common/hil.c
+++ b/lib/common/hil.c
*/
struct hil_proc *hil_create_proc(void *pdata, int cpu_id)
{
- struct hil_proc *proc, *proc_data;
+ struct hil_proc *proc = 0, *proc_data;
struct metal_list *node;
- int status;
/* If proc already exists then return it */
metal_list_for_each(&procs, node) {
}
}
- if (!pdata)
- return NULL;
proc_data = (struct hil_proc *)pdata;
- if (!proc_data->ops || !proc_data->ops->initialize)
- return NULL;
-
- /* Allocate memory for proc instance */
- proc = env_allocate_memory(sizeof(struct hil_proc));
- if (!proc) {
- return NULL;
- }
-
- /* Get HW specfic info */
- status = proc_data->ops->initialize(pdata,
- proc, cpu_id);
- if (status) {
- env_free_memory(proc);
- return NULL;
- }
-
- /* Enable mapping for the shared memory region */
- env_map_memory((unsigned int)proc->sh_buff.start_addr,
- (unsigned int)proc->sh_buff.start_addr,
- proc->sh_buff.size, (SHARED_MEM | UNCACHED));
-
- metal_list_add_tail(&procs, &proc->node);
+ proc = proc_data->ops->initialize(pdata, cpu_id);
+ if (proc)
+ metal_list_add_tail(&procs, &proc->node);
return proc;
}
index 22409cb3262d668aa5b40b10c32861471f70cf70..fc8efd58f3767c8fbd80ab71ddc55ddcbc90e706 100644 (file)
* This function initialize remote processor with platform data.
*
* @param[in] pdata - platform data
- * @param[in] proc - pointer to the remote processor
* @param[in] cpu_id - CPU id
*
- * @return 0 on sucess, otherwise on failure
+ * @return NULL on failure, hil_proc pointer otherwise
*
*/
- int (*initialize) (void *pdata,
- struct hil_proc *proc,
- int cpu_id);
+ struct hil_proc *(*initialize) (void *pdata, int cpu_id);
/**
* release
diff --git a/lib/remoteproc/drivers/zynq_remoteproc_a9.c b/lib/remoteproc/drivers/zynq_remoteproc_a9.c
index 8c36c0b8ce5fc9661c3bf0257bf9b44dff1e5a31..fe47cc2af8e6e28f8de485a4dcfb76acd6bfb377 100644 (file)
static void _notify(int cpu_id, struct proc_intr *intr_info);
static int _boot_cpu(int cpu_id, unsigned int load_addr);
static void _shutdown_cpu(int cpu_id);
-static int _initialize(void *pdata, struct hil_proc *proc, int cpu_id);
+static struct hil_proc * _initialize(void *pdata, int cpu_id);
static void _release(struct hil_proc *proc);
/*--------------------------- Globals ---------------------------------- */
lock_slcr();
}
-static int _initialize(void *pdata,
- struct hil_proc *proc,
- int cpu_id)
+static struct hil_proc * _initialize(void *pdata, int cpu_id)
{
(void) cpu_id;
+
+ struct hil_proc *proc;
+ /* Allocate memory for proc instance */
+ proc = env_allocate_memory(sizeof(struct hil_proc));
+ if (!proc) {
+ return NULL;
+ }
+
memcpy(proc, pdata, sizeof(struct hil_proc));
- return 0;
+ /* Enable mapping for the shared memory region */
+ if (proc->sh_buff.size)
+ env_map_memory((unsigned int)proc->sh_buff.start_addr,
+ (unsigned int)proc->sh_buff.start_addr,
+ proc->sh_buff.size, (SHARED_MEM | UNCACHED));
+ return proc;
}
static void _release(struct hil_proc *proc)
diff --git a/lib/remoteproc/drivers/zynqmp_remoteproc_a53.c b/lib/remoteproc/drivers/zynqmp_remoteproc_a53.c
index 03b03214a5b9a5af9cef6f9f729758830ab5abbf..3be73e513e11ac968e6e5145298563546540f64d 100644 (file)
static void _notify(int cpu_id, struct proc_intr *intr_info);
static int _boot_cpu(int cpu_id, unsigned int load_addr);
static void _shutdown_cpu(int cpu_id);
-static int _initialize(void *pdata, struct hil_proc *proc, int cpu_id);
+static struct hil_proc *_initialize(void *pdata, int cpu_id);
static void _release(struct hil_proc *proc);
static void _ipi_handler(int vect_id, void *data);
return;
}
-static int _initialize(void *pdata,
- struct hil_proc *proc,
- int cpu_id)
+static struct hil_proc * _initialize(void *pdata, int cpu_id)
{
(void) cpu_id;
+
+ struct hil_proc *proc;
+ /* Allocate memory for proc instance */
+ proc = env_allocate_memory(sizeof(struct hil_proc));
+ if (!proc) {
+ return NULL;
+ }
+
memcpy(proc, pdata, sizeof(struct hil_proc));
- return 0;
+ /* Enable mapping for the shared memory region */
+ if (proc->sh_buff.size)
+ env_map_memory((unsigned int)proc->sh_buff.start_addr,
+ (unsigned int)proc->sh_buff.start_addr,
+ proc->sh_buff.size, (SHARED_MEM | UNCACHED));
+ return proc;
}
static void _release(struct hil_proc *proc)