From: Ben Dooks Date: Fri, 5 May 2023 08:02:06 +0000 (+0100) Subject: riscv: implement local_irq_{save,restore} macros X-Git-Url: http://git.dujemihanovic.xyz/posts?a=commitdiff_plain;h=551de2169a49962f9d6c02ee3faa4ccc41f32107;p=u-boot.git riscv: implement local_irq_{save,restore} macros Add implementations of the local_irq_{save,restore} macros so that can be used with riscv. Signed-off-by: Ben Dooks Reviewed-by: Leo Yu-Chi Liang --- diff --git a/arch/riscv/include/asm/system.h b/arch/riscv/include/asm/system.h index 9d8e43e394..ffa7649f3f 100644 --- a/arch/riscv/include/asm/system.h +++ b/arch/riscv/include/asm/system.h @@ -7,15 +7,24 @@ #ifndef __ASM_RISCV_SYSTEM_H #define __ASM_RISCV_SYSTEM_H +#include + struct event; /* - * Interrupt configuring macros. - * - * TODO - * + * Interupt configuration macros */ +#define local_irq_save(__flags) \ + do { \ + __flags = csr_read_clear(CSR_SSTATUS, SR_SIE) & SR_SIE; \ + } while (0) + +#define local_irq_restore(__flags) \ + do { \ + csr_set(CSR_SSTATUS, __flags & SR_SIE); \ + } while (0) + /* Hook to set up the CPU (called from SPL too) */ int riscv_cpu_setup(void *ctx, struct event *event);