Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *    Copyright IBM Corp. 2006, 2010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #ifndef __ASM_IRQFLAGS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #define __ASM_IRQFLAGS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define ARCH_IRQ_ENABLED	(3UL << (BITS_PER_LONG - 8))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /* store then OR system mask. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define __arch_local_irq_stosm(__or)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ({									\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	unsigned long __mask;						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	asm volatile(							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		"	stosm	%0,%1"					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		: "=Q" (__mask) : "i" (__or) : "memory");		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	__mask;								\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* store then AND system mask. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define __arch_local_irq_stnsm(__and)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ({									\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	unsigned long __mask;						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	asm volatile(							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		"	stnsm	%0,%1"					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		: "=Q" (__mask) : "i" (__and) : "memory");		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	__mask;								\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* set system mask. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static inline notrace void __arch_local_irq_ssm(unsigned long flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	asm volatile("ssm   %0" : : "Q" (flags) : "memory");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static inline notrace unsigned long arch_local_save_flags(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	return __arch_local_irq_stnsm(0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static inline notrace unsigned long arch_local_irq_save(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return __arch_local_irq_stnsm(0xfc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static inline notrace void arch_local_irq_disable(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	arch_local_irq_save();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline notrace void arch_local_irq_enable(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	__arch_local_irq_stosm(0x03);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) /* This only restores external and I/O interrupt state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static inline notrace void arch_local_irq_restore(unsigned long flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	/* only disabled->disabled and disabled->enabled is valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	if (flags & ARCH_IRQ_ENABLED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		arch_local_irq_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	return !(flags & ARCH_IRQ_ENABLED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) static inline notrace bool arch_irqs_disabled(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	return arch_irqs_disabled_flags(arch_local_save_flags());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #endif /* __ASM_IRQFLAGS_H */