apic.h 3.2 KB

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