apic.h 3.1 KB

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