apic.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #ifndef _ASM_X86_APIC_H
  2. #define _ASM_X86_APIC_H
  3. #include <linux/pm.h>
  4. #include <linux/delay.h>
  5. #include <asm/fixmap.h>
  6. #include <asm/apicdef.h>
  7. #include <asm/processor.h>
  8. #include <asm/system.h>
  9. #define ARCH_APICTIMER_STOPS_ON_C3 1
  10. #define Dprintk(x...)
  11. /*
  12. * Debugging macros
  13. */
  14. #define APIC_QUIET 0
  15. #define APIC_VERBOSE 1
  16. #define APIC_DEBUG 2
  17. /*
  18. * Define the default level of output to be very little
  19. * This can be turned up by using apic=verbose for more
  20. * information and apic=debug for _lots_ of information.
  21. * apic_verbosity is defined in apic.c
  22. */
  23. #define apic_printk(v, s, a...) do { \
  24. if ((v) <= apic_verbosity) \
  25. printk(s, ##a); \
  26. } while (0)
  27. extern void generic_apic_probe(void);
  28. #ifdef CONFIG_X86_LOCAL_APIC
  29. extern int apic_verbosity;
  30. extern int timer_over_8254;
  31. extern int local_apic_timer_c2_ok;
  32. extern int local_apic_timer_disabled;
  33. extern int apic_runs_main_timer;
  34. extern int ioapic_force;
  35. extern int disable_apic;
  36. extern int disable_apic_timer;
  37. /*
  38. * Basic functions accessing APICs.
  39. */
  40. #ifdef CONFIG_PARAVIRT
  41. #include <asm/paravirt.h>
  42. #else
  43. #define apic_write native_apic_write
  44. #define apic_write_atomic native_apic_write_atomic
  45. #define apic_read native_apic_read
  46. #define setup_boot_clock setup_boot_APIC_clock
  47. #define setup_secondary_clock setup_secondary_APIC_clock
  48. #endif
  49. extern int is_vsmp_box(void);
  50. static inline void native_apic_write(unsigned long reg, u32 v)
  51. {
  52. *((volatile u32 *)(APIC_BASE + reg)) = v;
  53. }
  54. static inline void native_apic_write_atomic(unsigned long reg, u32 v)
  55. {
  56. (void)xchg((u32 *)(APIC_BASE + reg), v);
  57. }
  58. static inline u32 native_apic_read(unsigned long reg)
  59. {
  60. return *((volatile u32 *)(APIC_BASE + reg));
  61. }
  62. extern void apic_wait_icr_idle(void);
  63. extern u32 safe_apic_wait_icr_idle(void);
  64. extern int get_physical_broadcast(void);
  65. #ifdef CONFIG_X86_GOOD_APIC
  66. # define FORCE_READ_AROUND_WRITE 0
  67. # define apic_read_around(x)
  68. # define apic_write_around(x, y) apic_write((x), (y))
  69. #else
  70. # define FORCE_READ_AROUND_WRITE 1
  71. # define apic_read_around(x) apic_read(x)
  72. # define apic_write_around(x, y) apic_write_atomic((x), (y))
  73. #endif
  74. static inline void ack_APIC_irq(void)
  75. {
  76. /*
  77. * ack_APIC_irq() actually gets compiled as a single instruction:
  78. * - a single rmw on Pentium/82489DX
  79. * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
  80. * ... yummie.
  81. */
  82. /* Docs say use 0 for future compatibility */
  83. apic_write_around(APIC_EOI, 0);
  84. }
  85. extern int lapic_get_maxlvt(void);
  86. extern void clear_local_APIC(void);
  87. extern void connect_bsp_APIC(void);
  88. extern void disconnect_bsp_APIC(int virt_wire_setup);
  89. extern void disable_local_APIC(void);
  90. extern void lapic_shutdown(void);
  91. extern int verify_local_APIC(void);
  92. extern void cache_APIC_registers(void);
  93. extern void sync_Arb_IDs(void);
  94. extern void init_bsp_APIC(void);
  95. extern void setup_local_APIC(void);
  96. extern void end_local_APIC_setup(void);
  97. extern void init_apic_mappings(void);
  98. extern void setup_boot_APIC_clock(void);
  99. extern void setup_secondary_APIC_clock(void);
  100. extern int APIC_init_uniprocessor(void);
  101. extern void enable_NMI_through_LVT0(void);
  102. /*
  103. * On 32bit this is mach-xxx local
  104. */
  105. #ifdef CONFIG_X86_64
  106. extern void early_init_lapic_mapping(void);
  107. #endif
  108. extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
  109. extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
  110. extern int apic_is_clustered_box(void);
  111. #else /* !CONFIG_X86_LOCAL_APIC */
  112. static inline void lapic_shutdown(void) { }
  113. #define local_apic_timer_c2_ok 1
  114. #endif /* !CONFIG_X86_LOCAL_APIC */
  115. #endif /* __ASM_APIC_H */