init: init sequence supporting slave cores

Change initialization sequence to support slave cores.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2018-07-03 15:21:18 +02:00
parent 0cda98d727
commit 7e430f2b11
4 changed files with 102 additions and 39 deletions

View File

@ -36,8 +36,10 @@ struct sof;
/* main firmware entry point - argc and argv not currently used */
int main(int argc, char *argv[]);
int master_core_init(struct sof *sof);
int slave_core_init(struct sof *sof);
int arch_init(struct sof *sof);
void __memmap_init(void);
#endif

View File

@ -36,7 +36,9 @@
struct sof;
struct task;
int do_task(struct sof *sof);
int do_task_master_core(struct sof *sof);
int do_task_slave_core(struct sof *sof);
static inline void allocate_tasks(void)
{

View File

@ -43,11 +43,78 @@
#include <sof/schedule.h>
#include <sof/dma-trace.h>
#include <sof/pm_runtime.h>
#include <platform/idc.h>
#include <platform/platform.h>
#include <arch/cpu.h>
/* main firmware context */
static struct sof sof;
int master_core_init(struct sof *sof)
{
int err;
/* init architecture */
trace_point(TRACE_BOOT_ARCH);
err = arch_init(sof);
if (err < 0)
panic(SOF_IPC_PANIC_ARCH);
/* initialise system services */
trace_point(TRACE_BOOT_SYS_HEAP);
init_heap(sof);
trace_init(sof);
trace_point(TRACE_BOOT_SYS_NOTE);
init_system_notify(sof);
trace_point(TRACE_BOOT_SYS_SCHED);
scheduler_init(sof);
trace_point(TRACE_BOOT_SYS_POWER);
pm_runtime_init();
/* init the platform */
err = platform_init(sof);
if (err < 0)
panic(SOF_IPC_PANIC_PLATFORM);
trace_point(TRACE_BOOT_PLATFORM);
/* should not return */
err = do_task_master_core(sof);
return err;
}
int slave_core_init(struct sof *sof)
{
int err;
/* init architecture */
trace_point(TRACE_BOOT_ARCH);
err = arch_init(sof);
if (err < 0)
panic(SOF_IPC_PANIC_ARCH);
trace_point(TRACE_BOOT_SYS_SCHED);
scheduler_init(sof);
platform_interrupt_init();
/* initialize IDC mechanism */
trace_point(TRACE_BOOT_PLATFORM_IDC);
idc_init();
trace_point(TRACE_BOOT_PLATFORM);
/* should not return */
err = do_task_slave_core(sof);
return err;
}
int main(int argc, char *argv[])
{
int err;
@ -58,36 +125,10 @@ int main(int argc, char *argv[])
sof.argc = argc;
sof.argv = argv;
/* init architecture */
trace_point(TRACE_BOOT_ARCH);
err = arch_init(&sof);
if (err < 0)
panic(SOF_IPC_PANIC_ARCH);
/* initialise system services */
trace_point(TRACE_BOOT_SYS_HEAP);
init_heap(&sof);
trace_init(&sof);
trace_point(TRACE_BOOT_SYS_NOTE);
init_system_notify(&sof);
trace_point(TRACE_BOOT_SYS_SCHED);
scheduler_init(&sof);
trace_point(TRACE_BOOT_SYS_POWER);
pm_runtime_init();
/* init the platform */
err = platform_init(&sof);
if (err < 0)
panic(SOF_IPC_PANIC_PLATFORM);
trace_point(TRACE_BOOT_PLATFORM);
/* should not return */
err = do_task(&sof);
if (cpu_get_id() == PLATFORM_MASTER_CORE_ID)
err = master_core_init(&sof);
else
err = slave_core_init(&sof);
/* should never get here */
panic(SOF_IPC_PANIC_TASK);

View File

@ -37,6 +37,7 @@
#include <sof/interrupt.h>
#include <sof/ipc.h>
#include <sof/agent.h>
#include <platform/idc.h>
#include <platform/interrupt.h>
#include <platform/shim.h>
#include <sof/audio/pipeline.h>
@ -51,7 +52,7 @@ struct audio_data {
struct pipeline *p;
};
int do_task(struct sof *sof)
int do_task_master_core(struct sof *sof)
{
#ifdef STATIC_PIPE
struct audio_data pdata;
@ -64,10 +65,10 @@ int do_task(struct sof *sof)
sys_comp_mux_init();
sys_comp_switch_init();
sys_comp_volume_init();
sys_comp_src_init();
sys_comp_tone_init();
sys_comp_eq_iir_init();
sys_comp_eq_fir_init();
sys_comp_src_init();
sys_comp_tone_init();
sys_comp_eq_iir_init();
sys_comp_eq_fir_init();
#if STATIC_PIPE
/* init static pipeline */
@ -80,7 +81,6 @@ int do_task(struct sof *sof)
/* main audio IPC processing loop */
while (1) {
/* sleep until next IPC or DMA */
sa_enter_idle(sof);
wait_for_interrupt(0);
@ -95,3 +95,21 @@ int do_task(struct sof *sof)
/* something bad happened */
return -EIO;
}
int do_task_slave_core(struct sof *sof)
{
/* main audio IDC processing loop */
while (1) {
/* sleep until next IDC */
wait_for_interrupt(0);
/* now process any IDC messages from master core */
idc_process_msg_queue();
/* schedule any idle tasks */
schedule();
}
/* something bad happened */
return -EIO;
}