armv7: Add CPU & MP primitive instructions
To configure multi-processors, we need the intrinsic functions to get core ID, put core into idle state, and to wake up cores. Change-Id: I87a62dab6efd6c8bb0c8e46373da7c7eb7b16b35 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65112 Reviewed-on: http://review.coreboot.org/4444 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
parent
792b621ac0
commit
93951f4ed8
|
@ -48,4 +48,40 @@ struct cpuinfo_arm {
|
|||
|
||||
#endif
|
||||
|
||||
/* Primitives for CPU and MP cores. */
|
||||
|
||||
/* read Main Id register (MIDR) */
|
||||
inline static uint32_t read_midr(void)
|
||||
{
|
||||
uint32_t value;
|
||||
asm volatile ("mrc p15, 0, %0, c0, c0, 0" : "=r"(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
/* read Multiprocessor Affinity Register (MPIDR) */
|
||||
inline static uint32_t read_mpidr(void)
|
||||
{
|
||||
uint32_t value;
|
||||
asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r"(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
/* wait for interrupt. */
|
||||
inline static void wfi(void)
|
||||
{
|
||||
asm volatile ("wfi" : : : "memory");
|
||||
}
|
||||
|
||||
/* wait for event. */
|
||||
inline static void wfe(void)
|
||||
{
|
||||
asm volatile ("wfe");
|
||||
}
|
||||
|
||||
/* set event (to bring up cores in WFE state). */
|
||||
inline static void sev(void)
|
||||
{
|
||||
asm volatile ("sev");
|
||||
}
|
||||
|
||||
#endif /* __ARCH_CPU_H__ */
|
||||
|
|
Loading…
Reference in New Issue