apic.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 local_apic_timer_c2_ok;
  31. extern int local_apic_timer_disabled;
  32. extern int apic_runs_main_timer;
  33. extern int ioapic_force;
  34. extern int disable_apic;
  35. extern int disable_apic_timer;
  36. /*
  37. * Basic functions accessing APICs.
  38. */
  39. #ifdef CONFIG_PARAVIRT
  40. #include <asm/paravirt.h>
  41. #else
  42. #define apic_write native_apic_write
  43. #define apic_write_atomic native_apic_write_atomic
  44. #define apic_read native_apic_read
  45. #define setup_boot_clock setup_boot_APIC_clock
  46. #define setup_secondary_clock setup_secondary_APIC_clock
  47. #endif
  48. extern int is_vsmp_box(void);
  49. static inline void native_apic_write(unsigned long reg, u32 v)
  50. {
  51. *((volatile u32 *)(APIC_BASE + reg)) = v;
  52. }
  53. static inline void native_apic_write_atomic(unsigned long reg, u32 v)
  54. {
  55. (void)xchg((u32 *)(APIC_BASE + reg), v);
  56. }
  57. static inline u32 native_apic_read(unsigned long reg)
  58. {
  59. return *((volatile u32 *)(APIC_BASE + reg));
  60. }
  61. extern void apic_wait_icr_idle(void);
  62. extern u32 safe_apic_wait_icr_idle(void);
  63. extern int get_physical_broadcast(void);
  64. #ifdef CONFIG_X86_GOOD_APIC
  65. # define FORCE_READ_AROUND_WRITE 0
  66. # define apic_read_around(x)
  67. # define apic_write_around(x, y) apic_write((x), (y))
  68. #else
  69. # define FORCE_READ_AROUND_WRITE 1
  70. # define apic_read_around(x) apic_read(x)
  71. # define apic_write_around(x, y) apic_write_atomic((x), (y))
  72. #endif
  73. static inline void ack_APIC_irq(void)
  74. {
  75. /*
  76. * ack_APIC_irq() actually gets compiled as a single instruction:
  77. * - a single rmw on Pentium/82489DX
  78. * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
  79. * ... yummie.
  80. */
  81. /* Docs say use 0 for future compatibility */
  82. apic_write_around(APIC_EOI, 0);
  83. }
  84. extern int lapic_get_maxlvt(void);
  85. extern void clear_local_APIC(void);
  86. extern void connect_bsp_APIC(void);
  87. extern void disconnect_bsp_APIC(int virt_wire_setup);
  88. extern void disable_local_APIC(void);
  89. extern void lapic_shutdown(void);
  90. extern int verify_local_APIC(void);
  91. extern void cache_APIC_registers(void);
  92. extern void sync_Arb_IDs(void);
  93. extern void init_bsp_APIC(void);
  94. extern void setup_local_APIC(void);
  95. extern void end_local_APIC_setup(void);
  96. extern void init_apic_mappings(void);
  97. extern void setup_boot_APIC_clock(void);
  98. extern void setup_secondary_APIC_clock(void);
  99. extern int APIC_init_uniprocessor(void);
  100. extern void enable_NMI_through_LVT0(void);
  101. /*
  102. * On 32bit this is mach-xxx local
  103. */
  104. #ifdef CONFIG_X86_64
  105. extern void early_init_lapic_mapping(void);
  106. #endif
  107. extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
  108. extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
  109. extern int apic_is_clustered_box(void);
  110. #else /* !CONFIG_X86_LOCAL_APIC */
  111. static inline void lapic_shutdown(void) { }
  112. #define local_apic_timer_c2_ok 1
  113. #endif /* !CONFIG_X86_LOCAL_APIC */
  114. #endif /* __ASM_APIC_H */