VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-i386 / apic.h
1 #ifndef __ASM_APIC_H
2 #define __ASM_APIC_H
3
4 #include <linux/config.h>
5 #include <linux/pm.h>
6 #include <asm/fixmap.h>
7 #include <asm/apicdef.h>
8 #include <asm/system.h>
9
10 #define APIC_DEBUG 0
11
12 #if APIC_DEBUG
13 #define Dprintk(x...) printk(x)
14 #else
15 #define Dprintk(x...)
16 #endif
17
18 #ifdef CONFIG_X86_LOCAL_APIC
19
20 /*
21  * Basic functions accessing APICs.
22  */
23
24 static __inline void apic_write(unsigned long reg, unsigned long v)
25 {
26         *((volatile unsigned long *)(APIC_BASE+reg)) = v;
27 }
28
29 static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
30 {
31         xchg((volatile unsigned long *)(APIC_BASE+reg), v);
32 }
33
34 static __inline unsigned long apic_read(unsigned long reg)
35 {
36         return *((volatile unsigned long *)(APIC_BASE+reg));
37 }
38
39 static __inline__ void apic_wait_icr_idle(void)
40 {
41         do { } while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
42 }
43
44 int get_physical_broadcast(void);
45
46 #ifdef CONFIG_X86_GOOD_APIC
47 # define FORCE_READ_AROUND_WRITE 0
48 # define apic_read_around(x)
49 # define apic_write_around(x,y) apic_write((x),(y))
50 #else
51 # define FORCE_READ_AROUND_WRITE 1
52 # define apic_read_around(x) apic_read(x)
53 # define apic_write_around(x,y) apic_write_atomic((x),(y))
54 #endif
55
56 static inline void ack_APIC_irq(void)
57 {
58         /*
59          * ack_APIC_irq() actually gets compiled as a single instruction:
60          * - a single rmw on Pentium/82489DX
61          * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
62          * ... yummie.
63          */
64
65         /* Docs say use 0 for future compatibility */
66         apic_write_around(APIC_EOI, 0);
67 }
68
69 extern void (*wait_timer_tick)(void);
70
71 extern int get_maxlvt(void);
72 extern void clear_local_APIC(void);
73 extern void connect_bsp_APIC (void);
74 extern void disconnect_bsp_APIC (void);
75 extern void disable_local_APIC (void);
76 extern int verify_local_APIC (void);
77 extern void cache_APIC_registers (void);
78 extern void sync_Arb_IDs (void);
79 extern void init_bsp_APIC (void);
80 extern void setup_local_APIC (void);
81 extern void init_apic_mappings (void);
82 extern void smp_local_timer_interrupt (struct pt_regs * regs);
83 extern void setup_boot_APIC_clock (void);
84 extern void setup_secondary_APIC_clock (void);
85 extern void setup_apic_nmi_watchdog (void);
86 extern int reserve_lapic_nmi(void);
87 extern void release_lapic_nmi(void);
88 extern void disable_timer_nmi_watchdog(void);
89 extern void enable_timer_nmi_watchdog(void);
90 extern void nmi_watchdog_tick (struct pt_regs * regs);
91 extern int APIC_init_uniprocessor (void);
92 extern void disable_APIC_timer(void);
93 extern void enable_APIC_timer(void);
94
95 extern int check_nmi_watchdog (void);
96 extern void enable_NMI_through_LVT0 (void * dummy);
97
98 extern unsigned int nmi_watchdog;
99 #define NMI_NONE        0
100 #define NMI_IO_APIC     1
101 #define NMI_LOCAL_APIC  2
102 #define NMI_INVALID     3
103
104 #endif /* CONFIG_X86_LOCAL_APIC */
105
106 #endif /* __ASM_APIC_H */