From 54f9ec883def93218a17bb1ff8f1ea468bceacdc Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Thu, 1 Jan 2015 23:18:37 +0000 Subject: [PATCH] Define a WFI macro that expands to the right form of wait-for-interrupt depending on the architecture. --- sys/arm/arm/locore-v6.S | 2 +- sys/arm/include/asm.h | 3 +++ sys/arm/include/sysreg.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S index d90dd6069e1c..1e2954536fa3 100644 --- a/sys/arm/arm/locore-v6.S +++ b/sys/arm/arm/locore-v6.S @@ -461,7 +461,7 @@ ENTRY_NP(cpu_halt) teq r4, #0 movne pc, r4 1: - wfi + WFI b 1b /* diff --git a/sys/arm/include/asm.h b/sys/arm/include/asm.h index 9122e6ea3a30..a18286307f00 100644 --- a/sys/arm/include/asm.h +++ b/sys/arm/include/asm.h @@ -227,14 +227,17 @@ #define ISB isb #define DSB dsb #define DMB dmb +#define WFI wfi #elif __ARM_ARCH == 6 #define ISB mcr CP15_CP15ISB #define DSB mcr CP15_CP15DSB #define DMB mcr CP15_CP15DMB +#define WFI mcr CP15_CP15WFI #else #define ISB mcr CP15_CP15ISB #define DSB mcr CP15_CP15DSB /* DSB and DMB are the */ #define DMB mcr CP15_CP15DSB /* same prior to v6.*/ +/* No form of WFI available on v4, define nothing to get an error on use. */ #endif #endif /* !_MACHINE_ASM_H_ */ diff --git a/sys/arm/include/sysreg.h b/sys/arm/include/sysreg.h index b1c7fd373b59..ad29703fa885 100644 --- a/sys/arm/include/sysreg.h +++ b/sys/arm/include/sysreg.h @@ -166,6 +166,7 @@ /* Only ARMv6: */ #define CP15_CP15DSB p15, 0, r0, c7, c10, 4 /* DSB */ #define CP15_CP15DMB p15, 0, r0, c7, c10, 5 /* DMB */ +#define CP15_CP15WFI p15, 0, r0, c7, c0, 4 /* WFI */ #endif #if __ARM_ARCH >= 7