Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 Dprintk(x...) |
| 11 | |
| 12 | /* |
| 13 | * Debugging macros |
| 14 | */ |
| 15 | #define APIC_QUIET 0 |
| 16 | #define APIC_VERBOSE 1 |
| 17 | #define APIC_DEBUG 2 |
| 18 | |
| 19 | extern int apic_verbosity; |
Andi Kleen | 73dea47 | 2006-02-03 21:50:50 +0100 | [diff] [blame] | 20 | extern int apic_runs_main_timer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * Define the default level of output to be very little |
| 24 | * This can be turned up by using apic=verbose for more |
| 25 | * information and apic=debug for _lots_ of information. |
| 26 | * apic_verbosity is defined in apic.c |
| 27 | */ |
| 28 | #define apic_printk(v, s, a...) do { \ |
| 29 | if ((v) <= apic_verbosity) \ |
| 30 | printk(s, ##a); \ |
| 31 | } while (0) |
| 32 | |
| 33 | #ifdef CONFIG_X86_LOCAL_APIC |
| 34 | |
| 35 | struct pt_regs; |
| 36 | |
| 37 | /* |
| 38 | * Basic functions accessing APICs. |
| 39 | */ |
| 40 | |
| 41 | static __inline void apic_write(unsigned long reg, unsigned int v) |
| 42 | { |
| 43 | *((volatile unsigned int *)(APIC_BASE+reg)) = v; |
| 44 | } |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | static __inline unsigned int apic_read(unsigned long reg) |
| 47 | { |
| 48 | return *((volatile unsigned int *)(APIC_BASE+reg)); |
| 49 | } |
| 50 | |
| 51 | static __inline__ void apic_wait_icr_idle(void) |
| 52 | { |
| 53 | while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); |
| 54 | } |
| 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |
Andi Kleen | 11a8e77 | 2006-01-11 22:46:51 +0100 | [diff] [blame] | 66 | apic_write(APIC_EOI, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | extern int get_maxlvt (void); |
| 70 | extern void clear_local_APIC (void); |
| 71 | extern void connect_bsp_APIC (void); |
Eric W. Biederman | 208fb93 | 2005-06-25 14:57:45 -0700 | [diff] [blame] | 72 | extern void disconnect_bsp_APIC (int virt_wire_setup); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | extern void disable_local_APIC (void); |
| 74 | extern int verify_local_APIC (void); |
| 75 | extern void cache_APIC_registers (void); |
| 76 | extern void sync_Arb_IDs (void); |
| 77 | extern void init_bsp_APIC (void); |
| 78 | extern void setup_local_APIC (void); |
| 79 | extern void init_apic_mappings (void); |
| 80 | extern void smp_local_timer_interrupt (struct pt_regs * regs); |
| 81 | extern void setup_boot_APIC_clock (void); |
| 82 | extern void setup_secondary_APIC_clock (void); |
| 83 | extern void setup_apic_nmi_watchdog (void); |
| 84 | extern int reserve_lapic_nmi(void); |
| 85 | extern void release_lapic_nmi(void); |
| 86 | extern void disable_timer_nmi_watchdog(void); |
| 87 | extern void enable_timer_nmi_watchdog(void); |
| 88 | extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); |
| 89 | extern int APIC_init_uniprocessor (void); |
| 90 | extern void disable_APIC_timer(void); |
| 91 | extern void enable_APIC_timer(void); |
| 92 | extern void clustered_apic_check(void); |
| 93 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | extern void nmi_watchdog_default(void); |
| 95 | extern int setup_nmi_watchdog(char *); |
| 96 | |
| 97 | extern unsigned int nmi_watchdog; |
| 98 | #define NMI_DEFAULT -1 |
| 99 | #define NMI_NONE 0 |
| 100 | #define NMI_IO_APIC 1 |
| 101 | #define NMI_LOCAL_APIC 2 |
| 102 | #define NMI_INVALID 3 |
| 103 | |
Chuck Ebbert | 66759a0 | 2005-09-12 18:49:25 +0200 | [diff] [blame] | 104 | extern int disable_timer_pin_1; |
| 105 | |
Jacob Shin | 89b831e | 2005-11-05 17:25:53 +0100 | [diff] [blame] | 106 | extern void setup_threshold_lvt(unsigned long lvt_off); |
| 107 | |
Venkatesh Pallipadi | d25bf7e | 2006-01-11 22:44:24 +0100 | [diff] [blame] | 108 | void smp_send_timer_broadcast_ipi(void); |
| 109 | void switch_APIC_timer_to_ipi(void *cpumask); |
| 110 | void switch_ipi_to_APIC_timer(void *cpumask); |
| 111 | |
| 112 | #define ARCH_APICTIMER_STOPS_ON_C3 1 |
| 113 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | #endif /* CONFIG_X86_LOCAL_APIC */ |
| 115 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | extern unsigned boot_cpu_id; |
| 117 | |
| 118 | #endif /* __ASM_APIC_H */ |