restricted ia64 patches to ia64 again, they still break builds on
[linux-flexiantxendom0-3.2.10.git] / include / asm-i386 / hw_irq.h
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
15 #include <linux/config.h>
16 #include <linux/profile.h>
17 #include <asm/atomic.h>
18 #include <asm/irq.h>
19
20 /*
21  * Various low-level irq details needed by irq.c, process.c,
22  * time.c, io_apic.c and smp.c
23  *
24  * Interrupt entry/exit code at both C and assembly level
25  */
26
27 extern int irq_vector[NR_IRQS];
28 #define IO_APIC_VECTOR(irq)     irq_vector[irq]
29
30 extern void (*interrupt[NR_IRQS])(void);
31
32 #ifdef CONFIG_SMP
33 extern asmlinkage void reschedule_interrupt(void);
34 extern asmlinkage void invalidate_interrupt(void);
35 extern asmlinkage void call_function_interrupt(void);
36 #endif
37
38 #ifdef CONFIG_X86_LOCAL_APIC
39 extern asmlinkage void apic_timer_interrupt(void);
40 extern asmlinkage void error_interrupt(void);
41 extern asmlinkage void spurious_interrupt(void);
42 extern asmlinkage void thermal_interrupt(struct pt_regs);
43 #endif
44
45 extern void mask_irq(unsigned int irq);
46 extern void unmask_irq(unsigned int irq);
47 extern void disable_8259A_irq(unsigned int irq);
48 extern void enable_8259A_irq(unsigned int irq);
49 extern int i8259A_irq_pending(unsigned int irq);
50 extern void make_8259A_irq(unsigned int irq);
51 extern void init_8259A(int aeoi);
52 extern void FASTCALL(send_IPI_self(int vector));
53 extern void init_VISWS_APIC_irqs(void);
54 extern void setup_IO_APIC(void);
55 extern void disable_IO_APIC(void);
56 extern void print_IO_APIC(void);
57 extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
58 extern void send_IPI(int dest, int vector);
59 extern void setup_ioapic_dest(unsigned long mask);
60
61 extern unsigned long io_apic_irqs;
62
63 extern atomic_t irq_err_count;
64 extern atomic_t irq_mis_count;
65
66 extern char _stext, _etext;
67
68 #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
69
70 /*
71  * The profiling function is SMP safe. (nothing can mess
72  * around with "current", and the profiling counters are
73  * updated with atomic operations). This is especially
74  * useful with a profiling multiplier != 1
75  */
76 static inline void x86_do_profile(struct pt_regs * regs)
77 {
78         unsigned long eip;
79         extern unsigned long prof_cpu_mask;
80  
81         profile_hook(regs);
82  
83         if (user_mode(regs))
84                 return;
85  
86         if (!prof_buffer)
87                 return;
88
89         eip = regs->eip;
90  
91         /*
92          * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
93          * (default is all CPUs.)
94          */
95         if (!((1<<smp_processor_id()) & prof_cpu_mask))
96                 return;
97
98         eip -= (unsigned long) &_stext;
99         eip >>= prof_shift;
100         /*
101          * Don't ignore out-of-bounds EIP values silently,
102          * put them into the last histogram slot, so if
103          * present, they will show up as a sharp peak.
104          */
105         if (eip > prof_len-1)
106                 eip = prof_len-1;
107         atomic_inc((atomic_t *)&prof_buffer[eip]);
108 }
109  
110 #if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP)
111 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
112 {
113         if (IO_APIC_IRQ(i))
114                 send_IPI_self(IO_APIC_VECTOR(i));
115 }
116 #else
117 static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
118 #endif
119
120 #endif /* _ASM_HW_IRQ_H */