diff options
author | Yuval Peress <peress@chromium.org> | 2021-02-15 23:48:41 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-18 01:10:46 +0000 |
commit | c8090e9f301c5a5313327f869f30db5dd26f7750 (patch) | |
tree | e51e1c01c97e83500884690cb19f650fb0da7ca6 /common/system.c | |
parent | b9588a7499d15e4539720ec87624351a68011337 (diff) | |
download | chrome-ec-c8090e9f301c5a5313327f869f30db5dd26f7750.tar.gz |
zephyr: implement cortex-m's interrupt_disable()
Add implementation in lieu of Zephyr APIs. Zephyr's support for
irq_disable() doesn't disable all interrupts (see Zephyr's
include/arch/arm/aarch32/asm_inline_gcc.h for more information). The
implementation is done via a #define inside the system.c file, this is
done on purpose to avoid leaking the interrupt_disable() functionality
outside of sysjump. All other uses of disabling interrupts should be
done via irq_lock().
BRANCH=none
BUG=b:174481378
TEST=build/flash volteer, run sysjump command
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: Idccb93211296f81796ce4ba200c62adc5c19e691
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2695959
Diffstat (limited to 'common/system.c')
-rw-r--r-- | common/system.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c index 76561f786f..a8b9961b74 100644 --- a/common/system.c +++ b/common/system.c @@ -46,6 +46,18 @@ /* Round up to a multiple of 4 */ #define ROUNDUP4(x) (((x) + 3) & ~3) +#ifdef CONFIG_ZEPHYR +#ifdef CONFIG_CPU_CORTEX_M +/* + * For cortex-m we cannot use irq_lock() for disabling all the interrupts + * because it leaves some (NMI and faults) still enabled. + */ +#define interrupt_disable_all() __asm__("cpsid i") +#endif +#else /* !CONFIG_ZEPHYR */ +#define interrupt_disable_all() interrupt_disable() +#endif /* CONFIG_ZEPHYR */ + /* Data for an individual jump tag */ struct jump_tag { uint16_t tag; /* Tag ID */ @@ -550,7 +562,7 @@ static void jump_to_image(uintptr_t init_addr) hook_notify(HOOK_SYSJUMP); /* Disable interrupts before jump */ - interrupt_disable(); + interrupt_disable_all(); #ifdef CONFIG_DMA /* Disable all DMA channels to avoid memory corruption */ |