xref: /openbmc/linux/arch/s390/include/asm/irq.h (revision 4f6cce39)
1 #ifndef _ASM_IRQ_H
2 #define _ASM_IRQ_H
3 
4 #define EXT_INTERRUPT	0
5 #define IO_INTERRUPT	1
6 #define THIN_INTERRUPT	2
7 
8 #define NR_IRQS_BASE	3
9 
10 #define NR_IRQS	NR_IRQS_BASE
11 #define NR_IRQS_LEGACY NR_IRQS_BASE
12 
13 /* External interruption codes */
14 #define EXT_IRQ_INTERRUPT_KEY	0x0040
15 #define EXT_IRQ_CLK_COMP	0x1004
16 #define EXT_IRQ_CPU_TIMER	0x1005
17 #define EXT_IRQ_WARNING_TRACK	0x1007
18 #define EXT_IRQ_MALFUNC_ALERT	0x1200
19 #define EXT_IRQ_EMERGENCY_SIG	0x1201
20 #define EXT_IRQ_EXTERNAL_CALL	0x1202
21 #define EXT_IRQ_TIMING_ALERT	0x1406
22 #define EXT_IRQ_MEASURE_ALERT	0x1407
23 #define EXT_IRQ_SERVICE_SIG	0x2401
24 #define EXT_IRQ_CP_SERVICE	0x2603
25 #define EXT_IRQ_IUCV		0x4000
26 
27 #ifndef __ASSEMBLY__
28 
29 #include <linux/hardirq.h>
30 #include <linux/percpu.h>
31 #include <linux/cache.h>
32 #include <linux/types.h>
33 
34 enum interruption_class {
35 	IRQEXT_CLK,
36 	IRQEXT_EXC,
37 	IRQEXT_EMS,
38 	IRQEXT_TMR,
39 	IRQEXT_TLA,
40 	IRQEXT_PFL,
41 	IRQEXT_DSD,
42 	IRQEXT_VRT,
43 	IRQEXT_SCP,
44 	IRQEXT_IUC,
45 	IRQEXT_CMS,
46 	IRQEXT_CMC,
47 	IRQEXT_FTP,
48 	IRQIO_CIO,
49 	IRQIO_QAI,
50 	IRQIO_DAS,
51 	IRQIO_C15,
52 	IRQIO_C70,
53 	IRQIO_TAP,
54 	IRQIO_VMR,
55 	IRQIO_LCS,
56 	IRQIO_CTC,
57 	IRQIO_APB,
58 	IRQIO_ADM,
59 	IRQIO_CSC,
60 	IRQIO_PCI,
61 	IRQIO_MSI,
62 	IRQIO_VIR,
63 	IRQIO_VAI,
64 	NMI_NMI,
65 	CPU_RST,
66 	NR_ARCH_IRQS
67 };
68 
69 struct irq_stat {
70 	unsigned int irqs[NR_ARCH_IRQS];
71 };
72 
73 DECLARE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
74 
75 static __always_inline void inc_irq_stat(enum interruption_class irq)
76 {
77 	__this_cpu_inc(irq_stat.irqs[irq]);
78 }
79 
80 struct ext_code {
81 	unsigned short subcode;
82 	unsigned short code;
83 };
84 
85 typedef void (*ext_int_handler_t)(struct ext_code, unsigned int, unsigned long);
86 
87 int register_external_irq(u16 code, ext_int_handler_t handler);
88 int unregister_external_irq(u16 code, ext_int_handler_t handler);
89 
90 enum irq_subclass {
91 	IRQ_SUBCLASS_MEASUREMENT_ALERT = 5,
92 	IRQ_SUBCLASS_SERVICE_SIGNAL = 9,
93 };
94 
95 #define CR0_IRQ_SUBCLASS_MASK					  \
96 	((1UL << (63 - 30))  /* Warning Track */		| \
97 	 (1UL << (63 - 48))  /* Malfunction Alert */		| \
98 	 (1UL << (63 - 49))  /* Emergency Signal */		| \
99 	 (1UL << (63 - 50))  /* External Call */		| \
100 	 (1UL << (63 - 52))  /* Clock Comparator */		| \
101 	 (1UL << (63 - 53))  /* CPU Timer */			| \
102 	 (1UL << (63 - 54))  /* Service Signal */		| \
103 	 (1UL << (63 - 57))  /* Interrupt Key */		| \
104 	 (1UL << (63 - 58))  /* Measurement Alert */		| \
105 	 (1UL << (63 - 59))  /* Timing Alert */			| \
106 	 (1UL << (63 - 62))) /* IUCV */
107 
108 void irq_subclass_register(enum irq_subclass subclass);
109 void irq_subclass_unregister(enum irq_subclass subclass);
110 
111 #define irq_canonicalize(irq)  (irq)
112 
113 #endif /* __ASSEMBLY__ */
114 
115 #endif /* _ASM_IRQ_H */
116