1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * C6X IRQ flag handling
5 * Copyright (C) 2010 Texas Instruments Incorporated
6 * Written by Mark Salter (msalter@redhat.com)
9 #ifndef _ASM_IRQFLAGS_H
10 #define _ASM_IRQFLAGS_H
14 /* read interrupt enabled status */
15 static inline unsigned long arch_local_save_flags(void)
19 asm volatile (" mvc .s2 CSR,%0\n" : "=b"(flags
));
23 /* set interrupt enabled status */
24 static inline void arch_local_irq_restore(unsigned long flags
)
26 asm volatile (" mvc .s2 %0,CSR\n" : : "b"(flags
) : "memory");
29 /* unconditionally enable interrupts */
30 static inline void arch_local_irq_enable(void)
32 unsigned long flags
= arch_local_save_flags();
34 arch_local_irq_restore(flags
);
37 /* unconditionally disable interrupts */
38 static inline void arch_local_irq_disable(void)
40 unsigned long flags
= arch_local_save_flags();
42 arch_local_irq_restore(flags
);
45 /* get status and disable interrupts */
46 static inline unsigned long arch_local_irq_save(void)
50 flags
= arch_local_save_flags();
51 arch_local_irq_restore(flags
& ~1);
56 static inline int arch_irqs_disabled_flags(unsigned long flags
)
58 return (flags
& 1) == 0;
61 /* test hardware interrupt enable bit */
62 static inline int arch_irqs_disabled(void)
64 return arch_irqs_disabled_flags(arch_local_save_flags());
67 #endif /* __ASSEMBLY__ */
68 #endif /* __ASM_IRQFLAGS_H */