diff options
author | David Feng <fenghua@phytium.com.cn> | 2013-12-14 11:47:35 +0800 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2014-01-09 16:08:44 +0100 |
commit | 0ae7653128c80a4f2920cbe9b124792c2fd9d9e0 (patch) | |
tree | 14fea7a80e4ea84c7b6a3bc32298daeec55054c7 /arch/arm/include/asm/macro.h | |
parent | 54799e4596bf8af33fd4a8dee153be7011c06d8d (diff) | |
download | u-boot-imx-0ae7653128c80a4f2920cbe9b124792c2fd9d9e0.zip u-boot-imx-0ae7653128c80a4f2920cbe9b124792c2fd9d9e0.tar.gz u-boot-imx-0ae7653128c80a4f2920cbe9b124792c2fd9d9e0.tar.bz2 |
arm64: core support
Relocation code based on a patch by Scott Wood, which is:
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Feng <fenghua@phytium.com.cn>
Diffstat (limited to 'arch/arm/include/asm/macro.h')
-rw-r--r-- | arch/arm/include/asm/macro.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h index ff13f36..f77e4b8 100644 --- a/arch/arm/include/asm/macro.h +++ b/arch/arm/include/asm/macro.h @@ -54,5 +54,58 @@ bcs 1b .endm +#ifdef CONFIG_ARM64 +/* + * Register aliases. + */ +lr .req x30 + +/* + * Branch according to exception level + */ +.macro switch_el, xreg, el3_label, el2_label, el1_label + mrs \xreg, CurrentEL + cmp \xreg, 0xc + b.eq \el3_label + cmp \xreg, 0x8 + b.eq \el2_label + cmp \xreg, 0x4 + b.eq \el1_label +.endm + +/* + * Branch if current processor is a slave, + * choose processor with all zero affinity value as the master. + */ +.macro branch_if_slave, xreg, slave_label + mrs \xreg, mpidr_el1 + tst \xreg, #0xff /* Test Affinity 0 */ + b.ne \slave_label + lsr \xreg, \xreg, #8 + tst \xreg, #0xff /* Test Affinity 1 */ + b.ne \slave_label + lsr \xreg, \xreg, #8 + tst \xreg, #0xff /* Test Affinity 2 */ + b.ne \slave_label + lsr \xreg, \xreg, #16 + tst \xreg, #0xff /* Test Affinity 3 */ + b.ne \slave_label +.endm + +/* + * Branch if current processor is a master, + * choose processor with all zero affinity value as the master. + */ +.macro branch_if_master, xreg1, xreg2, master_label + mrs \xreg1, mpidr_el1 + lsr \xreg2, \xreg1, #32 + lsl \xreg1, \xreg1, #40 + lsr \xreg1, \xreg1, #40 + orr \xreg1, \xreg1, \xreg2 + cbz \xreg1, \master_label +.endm + +#endif /* CONFIG_ARM64 */ + #endif /* __ASSEMBLY__ */ #endif /* __ASM_ARM_MACRO_H__ */ |