zephyr: move primary_core_init() to POST_KERNEL

Zephyr has an elaborate subsystem initialisation framework. Use it
for primary_core_init() instead of calling it from main(). This
prepares for a migration of module initialisation to that framework
too.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2023-01-24 12:25:21 +01:00 committed by Kai Vehmanen
parent 389d7e1bcd
commit dfaa45c95e
3 changed files with 24 additions and 8 deletions

View File

@ -122,5 +122,6 @@ void task_main_init(void);
void task_main_free(void);
int task_main_start(struct sof *sof);
int start_complete(void);
#endif /* __SOF_SCHEDULE_TASK_H__ */

View File

@ -10,6 +10,7 @@
*/
#include <sof/debug/panic.h>
#include <rtos/init.h>
#include <rtos/interrupt.h>
#include <sof/init.h>
#include <sof/lib/cpu.h>
@ -315,6 +316,17 @@ int sof_main(int argc, char *argv[])
{
trace_point(TRACE_BOOT_START);
return primary_core_init(argc, argv, &sof);
return start_complete();
}
struct device;
static int sof_init(const struct device *dev)
{
ARG_UNUSED(dev);
return primary_core_init(0, NULL, &sof);
}
SYS_INIT(sof_init, POST_KERNEL, 99);
#endif

View File

@ -258,8 +258,6 @@ int task_main_start(struct sof *sof)
{
_smex_placeholder = smex_placeholder_f();
int ret;
/* init default audio components */
sys_comp_init(sof);
@ -269,6 +267,14 @@ int task_main_start(struct sof *sof)
/* host is mandatory */
sys_comp_host_init();
/* init pipeline position offsets */
pipeline_posn_init(sof);
return 0;
}
int start_complete(void)
{
if (IS_ENABLED(CONFIG_COMP_VOLUME)) {
#if CONFIG_COMP_LEGACY_INTERFACE
sys_comp_volume_init();
@ -388,8 +394,6 @@ int task_main_start(struct sof *sof)
if (IS_ENABLED(CONFIG_PROBE))
sys_comp_probe_init();
#endif
/* init pipeline position offsets */
pipeline_posn_init(sof);
/* init chain dma manager*/
if (IS_ENABLED(CONFIG_COMP_CHAIN_DMA))
@ -410,10 +414,9 @@ int task_main_start(struct sof *sof)
pm_policy_state_lock_get(PM_STATE_RUNTIME_IDLE, PM_ALL_SUBSTATES);
pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES);
#endif
/* let host know DSP boot is complete */
ret = platform_boot_complete(0);
return ret;
/* let host know DSP boot is complete */
return platform_boot_complete(0);
}
/*