[PATCH] x86_64 irq: Safely cleanup an irq after moving it.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / asm-x86_64 / hw_irq.h
CommitLineData
1da177e4
LT
1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4/*
5 * linux/include/asm/hw_irq.h
6 *
7 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
8 *
9 * moved some of the old arch/i386/kernel/irq.h to here. VY
10 *
11 * IRQ/IPI changes taken from work by Thomas Radke
12 * <tomsoft@informatik.tu-chemnitz.de>
13 *
14 * hacked by Andi Kleen for x86-64.
1da177e4
LT
15 */
16
17#ifndef __ASSEMBLY__
1da177e4
LT
18#include <asm/atomic.h>
19#include <asm/irq.h>
20#include <linux/profile.h>
21#include <linux/smp.h>
550f2299 22#include <linux/percpu.h>
1da177e4
LT
23#endif
24
1a426cb7 25#define NMI_VECTOR 0x02
1da177e4
LT
26/*
27 * IDT vectors usable for external interrupt sources start
28 * at 0x20:
29 */
30#define FIRST_EXTERNAL_VECTOR 0x20
31
32#define IA32_SYSCALL_VECTOR 0x80
33
34
61014292
EB
35/* Reserve the lowest usable priority level 0x20 - 0x2f for triggering
36 * cleanup after irq migration.
37 */
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39
1da177e4
LT
40/*
41 * Vectors 0x20-0x2f are used for ISA interrupts.
42 */
61014292 43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
bc5e81a1
EB
44#define IRQ1_VECTOR IRQ0_VECTOR + 1
45#define IRQ2_VECTOR IRQ0_VECTOR + 2
46#define IRQ3_VECTOR IRQ0_VECTOR + 3
47#define IRQ4_VECTOR IRQ0_VECTOR + 4
48#define IRQ5_VECTOR IRQ0_VECTOR + 5
49#define IRQ6_VECTOR IRQ0_VECTOR + 6
50#define IRQ7_VECTOR IRQ0_VECTOR + 7
51#define IRQ8_VECTOR IRQ0_VECTOR + 8
52#define IRQ9_VECTOR IRQ0_VECTOR + 9
53#define IRQ10_VECTOR IRQ0_VECTOR + 10
54#define IRQ11_VECTOR IRQ0_VECTOR + 11
55#define IRQ12_VECTOR IRQ0_VECTOR + 12
56#define IRQ13_VECTOR IRQ0_VECTOR + 13
57#define IRQ14_VECTOR IRQ0_VECTOR + 14
58#define IRQ15_VECTOR IRQ0_VECTOR + 15
1da177e4
LT
59
60/*
61 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
62 *
63 * some of the following vectors are 'rare', they are merged
64 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
65 * TLB, reschedule and local APIC vectors are performance-critical.
1da177e4
LT
66 */
67#define SPURIOUS_APIC_VECTOR 0xff
68#define ERROR_APIC_VECTOR 0xfe
e5bc8b6b
AK
69#define RESCHEDULE_VECTOR 0xfd
70#define CALL_FUNCTION_VECTOR 0xfc
915f34e2
AK
71/* fb free - please don't readd KDB here because it's useless
72 (hint - think what a NMI bit does to a vector) */
e5bc8b6b 73#define THERMAL_APIC_VECTOR 0xfa
89b831ef 74#define THRESHOLD_APIC_VECTOR 0xf9
e080e9d6
JU
75/* f8 free */
76#define INVALIDATE_TLB_VECTOR_END 0xf7
77#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
1da177e4 78
e5bc8b6b 79#define NUM_INVALIDATE_TLB_VECTORS 8
1da177e4
LT
80
81/*
82 * Local APIC timer IRQ vector is on a different priority level,
83 * to work around the 'lost local interrupt if more than 2 IRQ
84 * sources per level' errata.
85 */
86#define LOCAL_TIMER_VECTOR 0xef
87
88/*
89 * First APIC vector available to drivers: (vectors 0x30-0xee)
61014292 90 * we start at 0x41 to spread out vectors evenly between priority
1da177e4
LT
91 * levels. (0x80 is the syscall vector)
92 */
bc5e81a1 93#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
1da177e4
LT
94#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
95
96
97#ifndef __ASSEMBLY__
550f2299
EB
98typedef int vector_irq_t[NR_VECTORS];
99DECLARE_PER_CPU(vector_irq_t, vector_irq);
70a0a535
EB
100extern void __setup_vector_irq(int cpu);
101extern spinlock_t vector_lock;
1da177e4
LT
102
103/*
104 * Various low-level irq details needed by irq.c, process.c,
105 * time.c, io_apic.c and smp.c
106 *
107 * Interrupt entry/exit code at both C and assembly level
108 */
109
110extern void disable_8259A_irq(unsigned int irq);
111extern void enable_8259A_irq(unsigned int irq);
112extern int i8259A_irq_pending(unsigned int irq);
113extern void make_8259A_irq(unsigned int irq);
114extern void init_8259A(int aeoi);
c49c5330 115extern void send_IPI_self(int vector);
1da177e4
LT
116extern void init_VISWS_APIC_irqs(void);
117extern void setup_IO_APIC(void);
118extern void disable_IO_APIC(void);
119extern void print_IO_APIC(void);
120extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
121extern void send_IPI(int dest, int vector);
122extern void setup_ioapic_dest(void);
123
124extern unsigned long io_apic_irqs;
125
126extern atomic_t irq_err_count;
127extern atomic_t irq_mis_count;
128
129#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
130
131#define __STR(x) #x
132#define STR(x) __STR(x)
133
134#include <asm/ptrace.h>
135
136#define IRQ_NAME2(nr) nr##_interrupt(void)
137#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
138
139/*
140 * SMP has a few special interrupts for IPI messages
141 */
142
143#define BUILD_IRQ(nr) \
144asmlinkage void IRQ_NAME(nr); \
145__asm__( \
146"\n.p2align\n" \
147"IRQ" #nr "_interrupt:\n\t" \
19eadf98 148 "push $~(" #nr ") ; " \
1da177e4
LT
149 "jmp common_interrupt");
150
1da177e4
LT
151#define platform_legacy_irq(irq) ((irq) < 16)
152
153#endif
154
155#endif /* _ASM_HW_IRQ_H */