1#ifndef __ASM_APIC_H 2#define __ASM_APIC_H 3 4#include <linux/config.h> 5#include <asm/apicdef.h> 6#include <asm/system.h> 7 8#define APIC_DEBUG 1 9 10#ifdef CONFIG_X86_LOCAL_APIC 11 12#if APIC_DEBUG 13#define Dprintk(x...) printk(x) 14#else 15#define Dprintk(x...) 16#endif 17 18/* 19 * Basic functions accessing APICs. 20 */ 21 22extern __inline void apic_write(unsigned long reg, unsigned long v) 23{ 24 *((volatile unsigned long *)(APIC_BASE+reg)) = v; 25} 26 27extern __inline void apic_write_atomic(unsigned long reg, unsigned long v) 28{ 29 xchg((volatile unsigned long *)(APIC_BASE+reg), v); 30} 31 32extern __inline unsigned long apic_read(unsigned long reg) 33{ 34 return *((volatile unsigned long *)(APIC_BASE+reg)); 35} 36 37static __inline__ void apic_wait_icr_idle(void) 38{ 39 do { } while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ); 40} 41 42extern unsigned int apic_timer_irqs [NR_CPUS]; 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 54extern 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 67extern int get_maxlvt(void); 68extern void connect_bsp_APIC (void); 69extern void disconnect_bsp_APIC (void); 70extern void disable_local_APIC (void); 71extern int verify_local_APIC (void); 72extern void cache_APIC_registers (void); 73extern void sync_Arb_IDs(void); 74extern void setup_local_APIC (void); 75extern void init_apic_mappings(void); 76extern void smp_local_timer_interrupt(struct pt_regs * regs); 77extern void setup_APIC_clocks(void); 78#endif 79 80#endif 81

