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