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