apic.h 3.5 KB

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