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