Get device-specific code out of init_threads and add core_thread_init to be implemented for multicore devices.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17000 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c2a01fdc7a
commit
9ba80c9641
1 changed files with 37 additions and 14 deletions
|
@ -733,6 +733,31 @@ static void __attribute__((naked))
|
||||||
);
|
);
|
||||||
(void)core; (void)thread;
|
(void)core; (void)thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------
|
||||||
|
* Do any device-specific inits for the threads and synchronize the kernel
|
||||||
|
* initializations.
|
||||||
|
*---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
static void core_thread_init(unsigned int core)
|
||||||
|
{
|
||||||
|
if (core == CPU)
|
||||||
|
{
|
||||||
|
/* Wake up coprocessor and let it initialize kernel and threads */
|
||||||
|
#ifdef CPU_PP502x
|
||||||
|
MBX_MSG_CLR = 0x3f;
|
||||||
|
#endif
|
||||||
|
COP_CTL = PROC_WAKE;
|
||||||
|
/* Sleep until COP has finished */
|
||||||
|
CPU_CTL = PROC_SLEEP;
|
||||||
|
nop; nop; nop;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Wake the CPU and return */
|
||||||
|
CPU_CTL = PROC_WAKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif /* NUM_CORES */
|
#endif /* NUM_CORES */
|
||||||
|
|
||||||
#elif CONFIG_CPU == S3C2440
|
#elif CONFIG_CPU == S3C2440
|
||||||
|
@ -2955,24 +2980,22 @@ void init_threads(void)
|
||||||
thread->stack = stackbegin;
|
thread->stack = stackbegin;
|
||||||
thread->stack_size = (uintptr_t)stackend - (uintptr_t)stackbegin;
|
thread->stack_size = (uintptr_t)stackend - (uintptr_t)stackbegin;
|
||||||
#if NUM_CORES > 1 /* This code path will not be run on single core targets */
|
#if NUM_CORES > 1 /* This code path will not be run on single core targets */
|
||||||
/* TODO: HAL interface for this */
|
/* Wait for other processors to finish their inits since create_thread
|
||||||
/* Wake up coprocessor and let it initialize kernel and threads */
|
* isn't safe to call until the kernel inits are done. The first
|
||||||
#ifdef CPU_PP502x
|
* threads created in the system must of course be created by CPU. */
|
||||||
MBX_MSG_CLR = 0x3f;
|
core_thread_init(CPU);
|
||||||
#endif
|
|
||||||
COP_CTL = PROC_WAKE;
|
|
||||||
/* Sleep until finished */
|
|
||||||
CPU_CTL = PROC_SLEEP;
|
|
||||||
nop; nop; nop; nop;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Initial stack is the COP idle stack */
|
/* Initial stack is the idle stack */
|
||||||
thread->stack = cop_idlestackbegin;
|
thread->stack = idle_stacks[core];
|
||||||
thread->stack_size = IDLE_STACK_SIZE;
|
thread->stack_size = IDLE_STACK_SIZE;
|
||||||
/* Get COP safely primed inside switch_thread where it will remain
|
/* After last processor completes, it should signal all others to
|
||||||
* until a thread actually exists on it */
|
* proceed or may signal the next and call thread_exit(). The last one
|
||||||
CPU_CTL = PROC_WAKE;
|
* to finish will signal CPU. */
|
||||||
|
core_thread_init(core);
|
||||||
|
/* Other cores do not have a main thread - go idle inside switch_thread
|
||||||
|
* until a thread can run on the core. */
|
||||||
thread_exit();
|
thread_exit();
|
||||||
#endif /* NUM_CORES */
|
#endif /* NUM_CORES */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue