Skip to content
Snippets Groups Projects
Commit 551de216 authored by Ben Dooks's avatar Ben Dooks Committed by Leo Yu-Chi Liang
Browse files

riscv: implement local_irq_{save,restore} macros


Add implementations of the local_irq_{save,restore} macros so that
<asm/atomic.h> can be used with riscv.

Signed-off-by: default avatarBen Dooks <ben.dooks@sifive.com>
Reviewed-by: default avatarLeo Yu-Chi Liang <ycliang@andestech.com>
parent 3c874711
No related branches found
No related tags found
No related merge requests found
...@@ -7,15 +7,24 @@ ...@@ -7,15 +7,24 @@
#ifndef __ASM_RISCV_SYSTEM_H #ifndef __ASM_RISCV_SYSTEM_H
#define __ASM_RISCV_SYSTEM_H #define __ASM_RISCV_SYSTEM_H
#include <asm/csr.h>
struct event; struct event;
/* /*
* Interrupt configuring macros. * Interupt configuration macros
*
* TODO
*
*/ */
#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) */ /* Hook to set up the CPU (called from SPL too) */
int riscv_cpu_setup(void *ctx, struct event *event); int riscv_cpu_setup(void *ctx, struct event *event);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment