Linux Audio

Check our new training course

Loading...
v3.15
 
 1/*
 2 * IRQ flags defines.
 3 *
 4 * Copyright (C) 1998-2003 Hewlett-Packard Co
 5 *	David Mosberger-Tang <davidm@hpl.hp.com>
 6 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
 7 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
 8 */
 9
10#ifndef _ASM_IA64_IRQFLAGS_H
11#define _ASM_IA64_IRQFLAGS_H
12
13#include <asm/pal.h>
14#include <asm/kregs.h>
15
16#ifdef CONFIG_IA64_DEBUG_IRQ
17extern unsigned long last_cli_ip;
18static inline void arch_maybe_save_ip(unsigned long flags)
19{
20	if (flags & IA64_PSR_I)
21		last_cli_ip = ia64_getreg(_IA64_REG_IP);
22}
23#else
24#define arch_maybe_save_ip(flags) do {} while (0)
25#endif
26
27/*
28 * - clearing psr.i is implicitly serialized (visible by next insn)
29 * - setting psr.i requires data serialization
30 * - we need a stop-bit before reading PSR because we sometimes
31 *   write a floating-point register right before reading the PSR
32 *   and that writes to PSR.mfl
33 */
34
35static inline unsigned long arch_local_save_flags(void)
36{
37	ia64_stop();
38#ifdef CONFIG_PARAVIRT
39	return ia64_get_psr_i();
40#else
41	return ia64_getreg(_IA64_REG_PSR);
42#endif
43}
44
45static inline unsigned long arch_local_irq_save(void)
46{
47	unsigned long flags = arch_local_save_flags();
48
49	ia64_stop();
50	ia64_rsm(IA64_PSR_I);
51	arch_maybe_save_ip(flags);
52	return flags;
53}
54
55static inline void arch_local_irq_disable(void)
56{
57#ifdef CONFIG_IA64_DEBUG_IRQ
58	arch_local_irq_save();
59#else
60	ia64_stop();
61	ia64_rsm(IA64_PSR_I);
62#endif
63}
64
65static inline void arch_local_irq_enable(void)
66{
67	ia64_stop();
68	ia64_ssm(IA64_PSR_I);
69	ia64_srlz_d();
70}
71
72static inline void arch_local_irq_restore(unsigned long flags)
73{
74#ifdef CONFIG_IA64_DEBUG_IRQ
75	unsigned long old_psr = arch_local_save_flags();
76#endif
77	ia64_intrin_local_irq_restore(flags & IA64_PSR_I);
78	arch_maybe_save_ip(old_psr & ~flags);
79}
80
81static inline bool arch_irqs_disabled_flags(unsigned long flags)
82{
83	return (flags & IA64_PSR_I) == 0;
84}
85
86static inline bool arch_irqs_disabled(void)
87{
88	return arch_irqs_disabled_flags(arch_local_save_flags());
89}
90
91static inline void arch_safe_halt(void)
92{
93	arch_local_irq_enable();
94	ia64_pal_halt_light();	/* PAL_HALT_LIGHT */
95}
96
97
98#endif /* _ASM_IA64_IRQFLAGS_H */
v5.14.15
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * IRQ flags defines.
 4 *
 5 * Copyright (C) 1998-2003 Hewlett-Packard Co
 6 *	David Mosberger-Tang <davidm@hpl.hp.com>
 7 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
 8 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
 9 */
10
11#ifndef _ASM_IA64_IRQFLAGS_H
12#define _ASM_IA64_IRQFLAGS_H
13
14#include <asm/pal.h>
15#include <asm/kregs.h>
16
17#ifdef CONFIG_IA64_DEBUG_IRQ
18extern unsigned long last_cli_ip;
19static inline void arch_maybe_save_ip(unsigned long flags)
20{
21	if (flags & IA64_PSR_I)
22		last_cli_ip = ia64_getreg(_IA64_REG_IP);
23}
24#else
25#define arch_maybe_save_ip(flags) do {} while (0)
26#endif
27
28/*
29 * - clearing psr.i is implicitly serialized (visible by next insn)
30 * - setting psr.i requires data serialization
31 * - we need a stop-bit before reading PSR because we sometimes
32 *   write a floating-point register right before reading the PSR
33 *   and that writes to PSR.mfl
34 */
35
36static inline unsigned long arch_local_save_flags(void)
37{
38	ia64_stop();
 
 
 
39	return ia64_getreg(_IA64_REG_PSR);
 
40}
41
42static inline unsigned long arch_local_irq_save(void)
43{
44	unsigned long flags = arch_local_save_flags();
45
46	ia64_stop();
47	ia64_rsm(IA64_PSR_I);
48	arch_maybe_save_ip(flags);
49	return flags;
50}
51
52static inline void arch_local_irq_disable(void)
53{
54#ifdef CONFIG_IA64_DEBUG_IRQ
55	arch_local_irq_save();
56#else
57	ia64_stop();
58	ia64_rsm(IA64_PSR_I);
59#endif
60}
61
62static inline void arch_local_irq_enable(void)
63{
64	ia64_stop();
65	ia64_ssm(IA64_PSR_I);
66	ia64_srlz_d();
67}
68
69static inline void arch_local_irq_restore(unsigned long flags)
70{
71#ifdef CONFIG_IA64_DEBUG_IRQ
72	unsigned long old_psr = arch_local_save_flags();
73#endif
74	ia64_intrin_local_irq_restore(flags & IA64_PSR_I);
75	arch_maybe_save_ip(old_psr & ~flags);
76}
77
78static inline bool arch_irqs_disabled_flags(unsigned long flags)
79{
80	return (flags & IA64_PSR_I) == 0;
81}
82
83static inline bool arch_irqs_disabled(void)
84{
85	return arch_irqs_disabled_flags(arch_local_save_flags());
86}
87
88static inline void arch_safe_halt(void)
89{
90	arch_local_irq_enable();
91	ia64_pal_halt_light();	/* PAL_HALT_LIGHT */
92}
93
94
95#endif /* _ASM_IA64_IRQFLAGS_H */