From 4da174e1f7f0b8918490931cd066d06743caf64c Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Sun, 14 Feb 2021 16:31:22 -0800 Subject: [PATCH] arch/xtensa: Remove XTOS dependency in irq_lock() This whole file is written to assume XEA2, so there's no value to using an abstraction call here. Write to the RSIL instruction directly. Signed-off-by: Andy Ross --- include/arch/xtensa/irq.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/arch/xtensa/irq.h b/include/arch/xtensa/irq.h index fd114516973..6dd1bea1f18 100644 --- a/include/arch/xtensa/irq.h +++ b/include/arch/xtensa/irq.h @@ -6,7 +6,8 @@ #ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_XTENSA_IRQ_H_ #define ZEPHYR_INCLUDE_ARCH_XTENSA_XTENSA_IRQ_H_ -#include +#include +#include #define CONFIG_GEN_IRQ_START_VECTOR 0 @@ -105,13 +106,17 @@ static ALWAYS_INLINE void z_xtensa_irq_disable(uint32_t irq) static ALWAYS_INLINE unsigned int arch_irq_lock(void) { - unsigned int key = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); + unsigned int key; + + __asm__ volatile("rsil %0, %1" + : "=r"(key) : "i"(XCHAL_EXCM_LEVEL) : "memory"); return key; } static ALWAYS_INLINE void arch_irq_unlock(unsigned int key) { - XTOS_RESTORE_INTLEVEL(key); + __asm__ volatile("wsr.ps %0; rsync" + :: "r"(key) : "memory"); } static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)