apic.h 3.5 KB

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