apic.h 3.6 KB

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