Linux Audio

Check our new training course

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