|
43 | 43 | #include <sof/schedule.h> |
44 | 44 | #include <sof/dma-trace.h> |
45 | 45 | #include <sof/pm_runtime.h> |
| 46 | +#include <platform/idc.h> |
46 | 47 | #include <platform/platform.h> |
| 48 | +#include <arch/cpu.h> |
47 | 49 |
|
48 | 50 | /* main firmware context */ |
49 | 51 | static struct sof sof; |
50 | 52 |
|
51 | | -int main(int argc, char *argv[]) |
| 53 | +int master_core_init(struct sof *sof) |
52 | 54 | { |
53 | 55 | int err; |
54 | 56 |
|
55 | | - trace_point(TRACE_BOOT_START); |
56 | | - |
57 | | - /* setup context */ |
58 | | - sof.argc = argc; |
59 | | - sof.argv = argv; |
60 | | - |
61 | 57 | /* init architecture */ |
62 | 58 | trace_point(TRACE_BOOT_ARCH); |
63 | | - err = arch_init(&sof); |
| 59 | + err = arch_init(sof); |
64 | 60 | if (err < 0) |
65 | 61 | panic(SOF_IPC_PANIC_ARCH); |
66 | 62 |
|
67 | 63 | /* initialise system services */ |
68 | 64 | trace_point(TRACE_BOOT_SYS_HEAP); |
69 | | - init_heap(&sof); |
| 65 | + init_heap(sof); |
70 | 66 |
|
71 | | - trace_init(&sof); |
| 67 | + trace_init(sof); |
72 | 68 |
|
73 | 69 | trace_point(TRACE_BOOT_SYS_NOTE); |
74 | | - init_system_notify(&sof); |
| 70 | + init_system_notify(sof); |
75 | 71 |
|
76 | 72 | trace_point(TRACE_BOOT_SYS_SCHED); |
77 | | - scheduler_init(&sof); |
| 73 | + scheduler_init(sof); |
78 | 74 |
|
79 | 75 | trace_point(TRACE_BOOT_SYS_POWER); |
80 | 76 | pm_runtime_init(); |
81 | 77 |
|
82 | 78 | /* init the platform */ |
83 | | - err = platform_init(&sof); |
| 79 | + err = platform_init(sof); |
84 | 80 | if (err < 0) |
85 | 81 | panic(SOF_IPC_PANIC_PLATFORM); |
86 | 82 |
|
87 | 83 | trace_point(TRACE_BOOT_PLATFORM); |
88 | 84 |
|
89 | 85 | /* should not return */ |
90 | | - err = do_task(&sof); |
| 86 | + err = do_task_master_core(sof); |
| 87 | + |
| 88 | + return err; |
| 89 | +} |
| 90 | + |
| 91 | +int slave_core_init(struct sof *sof) |
| 92 | +{ |
| 93 | + int err; |
| 94 | + |
| 95 | + /* init architecture */ |
| 96 | + trace_point(TRACE_BOOT_ARCH); |
| 97 | + err = arch_init(sof); |
| 98 | + if (err < 0) |
| 99 | + panic(SOF_IPC_PANIC_ARCH); |
| 100 | + |
| 101 | + trace_point(TRACE_BOOT_SYS_SCHED); |
| 102 | + scheduler_init(sof); |
| 103 | + |
| 104 | + platform_interrupt_init(); |
| 105 | + |
| 106 | + /* initialize IDC mechanism */ |
| 107 | + trace_point(TRACE_BOOT_PLATFORM_IDC); |
| 108 | + idc_init(); |
| 109 | + |
| 110 | + trace_point(TRACE_BOOT_PLATFORM); |
| 111 | + |
| 112 | + /* should not return */ |
| 113 | + err = do_task_slave_core(sof); |
| 114 | + |
| 115 | + return err; |
| 116 | +} |
| 117 | + |
| 118 | +int main(int argc, char *argv[]) |
| 119 | +{ |
| 120 | + int err; |
| 121 | + |
| 122 | + trace_point(TRACE_BOOT_START); |
| 123 | + |
| 124 | + /* setup context */ |
| 125 | + sof.argc = argc; |
| 126 | + sof.argv = argv; |
| 127 | + |
| 128 | + if (cpu_get_id() == PLATFORM_MASTER_CORE_ID) |
| 129 | + err = master_core_init(&sof); |
| 130 | + else |
| 131 | + err = slave_core_init(&sof); |
91 | 132 |
|
92 | 133 | /* should never get here */ |
93 | 134 | panic(SOF_IPC_PANIC_TASK); |
|
0 commit comments