apic.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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/alternative.h>
  6. #include <asm/fixmap.h>
  7. #include <asm/apicdef.h>
  8. #include <asm/processor.h>
  9. #include <asm/system.h>
  10. #define ARCH_APICTIMER_STOPS_ON_C3 1
  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 unsigned int apic_verbosity;
  30. extern int local_apic_timer_c2_ok;
  31. extern int ioapic_force;
  32. extern int disable_apic;
  33. /*
  34. * Basic functions accessing APICs.
  35. */
  36. #ifdef CONFIG_PARAVIRT
  37. #include <asm/paravirt.h>
  38. #else
  39. #define apic_write native_apic_write
  40. #define apic_read native_apic_read
  41. #define setup_boot_clock setup_boot_APIC_clock
  42. #define setup_secondary_clock setup_secondary_APIC_clock
  43. #endif
  44. extern int is_vsmp_box(void);
  45. extern void xapic_wait_icr_idle(void);
  46. extern u32 safe_xapic_wait_icr_idle(void);
  47. extern u64 xapic_icr_read(void);
  48. extern void xapic_icr_write(u32, u32);
  49. extern int setup_profiling_timer(unsigned int);
  50. static inline void native_apic_write(unsigned long reg, u32 v)
  51. {
  52. volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
  53. alternative_io("movl %0, %1", "xchgl %0, %1", X86_FEATURE_11AP,
  54. ASM_OUTPUT2("=r" (v), "=m" (*addr)),
  55. ASM_OUTPUT2("0" (v), "m" (*addr)));
  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. static inline void ack_APIC_irq(void)
  65. {
  66. /*
  67. * ack_APIC_irq() actually gets compiled as a single instruction
  68. * ... yummie.
  69. */
  70. /* Docs say use 0 for future compatibility */
  71. apic_write(APIC_EOI, 0);
  72. }
  73. extern int lapic_get_maxlvt(void);
  74. extern void clear_local_APIC(void);
  75. extern void connect_bsp_APIC(void);
  76. extern void disconnect_bsp_APIC(int virt_wire_setup);
  77. extern void disable_local_APIC(void);
  78. extern void lapic_shutdown(void);
  79. extern int verify_local_APIC(void);
  80. extern void cache_APIC_registers(void);
  81. extern void sync_Arb_IDs(void);
  82. extern void init_bsp_APIC(void);
  83. extern void setup_local_APIC(void);
  84. extern void end_local_APIC_setup(void);
  85. extern void init_apic_mappings(void);
  86. extern void setup_boot_APIC_clock(void);
  87. extern void setup_secondary_APIC_clock(void);
  88. extern int APIC_init_uniprocessor(void);
  89. extern void enable_NMI_through_LVT0(void);
  90. /*
  91. * On 32bit this is mach-xxx local
  92. */
  93. #ifdef CONFIG_X86_64
  94. extern void early_init_lapic_mapping(void);
  95. extern int apic_is_clustered_box(void);
  96. #else
  97. static inline int apic_is_clustered_box(void)
  98. {
  99. return 0;
  100. }
  101. #endif
  102. extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
  103. extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
  104. #else /* !CONFIG_X86_LOCAL_APIC */
  105. static inline void lapic_shutdown(void) { }
  106. #define local_apic_timer_c2_ok 1
  107. static inline void init_apic_mappings(void) { }
  108. #endif /* !CONFIG_X86_LOCAL_APIC */
  109. #endif /* ASM_X86__APIC_H */