blob: ffa7649f3f9e16125d408b99c0b2afb6eb25454f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rick Chen76c0a242017-12-26 13:55:51 +08002/*
3 * Copyright (C) 2017 Andes Technology Corporation
4 * Rick Chen, Andes Technology Corporation <rick@andestech.com>
Rick Chen76c0a242017-12-26 13:55:51 +08005 */
6
7#ifndef __ASM_RISCV_SYSTEM_H
8#define __ASM_RISCV_SYSTEM_H
9
Ben Dooks0cd077d2023-05-05 09:02:06 +010010#include <asm/csr.h>
11
Simon Glassfc557362022-03-04 08:43:05 -070012struct event;
13
Rick Chen76c0a242017-12-26 13:55:51 +080014/*
Ben Dooks0cd077d2023-05-05 09:02:06 +010015 * Interupt configuration macros
Rick Chen76c0a242017-12-26 13:55:51 +080016 */
17
Ben Dooks0cd077d2023-05-05 09:02:06 +010018#define local_irq_save(__flags) \
19 do { \
20 __flags = csr_read_clear(CSR_SSTATUS, SR_SIE) & SR_SIE; \
21 } while (0)
22
23#define local_irq_restore(__flags) \
24 do { \
25 csr_set(CSR_SSTATUS, __flags & SR_SIE); \
26 } while (0)
27
Simon Glassfc557362022-03-04 08:43:05 -070028/* Hook to set up the CPU (called from SPL too) */
29int riscv_cpu_setup(void *ctx, struct event *event);
30
Rick Chen76c0a242017-12-26 13:55:51 +080031#endif /* __ASM_RISCV_SYSTEM_H */