1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
4 * Scott McNutt <smcnutt@psyent.com>
6 #ifndef __ASM_NIOS2_SYSTEM_H_
7 #define __ASM_NIOS2_SYSTEM_H_
9 #define local_irq_enable() __asm__ __volatile__ ( \
10 "rdctl r8, status\n" \
12 "wrctl status, r8\n" \
15 #define local_irq_disable() __asm__ __volatile__ ( \
16 "rdctl r8, status\n" \
17 "andi r8, r8, 0xfffe\n" \
18 "wrctl status, r8\n" \
21 #define local_save_flags(x) __asm__ __volatile__ ( \
22 "rdctl r8, status\n" \
24 : "=r" (x) : : "r8", "memory")
26 #define local_irq_restore(x) __asm__ __volatile__ ( \
28 "wrctl status, r8\n" \
29 : : "r" (x) : "r8", "memory")
31 /* For spinlocks etc */
32 #define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } \
35 #define irqs_disabled() \
37 unsigned long flags; \
38 local_save_flags(flags); \
39 ((flags & NIOS2_STATUS_PIE_MSK) == 0x0); \
42 /* indirect call to go beyond 256MB limitation of toolchain */
43 #define nios2_callr(addr) __asm__ __volatile__ ( \
47 void display_sysid(void);
49 #endif /* __ASM_NIOS2_SYSTEM_H */