apic.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #ifndef __ASM_APIC_H
  2. #define __ASM_APIC_H
  3. #include <linux/pm.h>
  4. #include <asm/fixmap.h>
  5. #include <asm/apicdef.h>
  6. #include <asm/system.h>
  7. #define Dprintk(x...)
  8. /*
  9. * Debugging macros
  10. */
  11. #define APIC_QUIET 0
  12. #define APIC_VERBOSE 1
  13. #define APIC_DEBUG 2
  14. extern int apic_verbosity;
  15. extern int apic_runs_main_timer;
  16. extern int ioapic_force;
  17. extern int apic_mapped;
  18. /*
  19. * Define the default level of output to be very little
  20. * This can be turned up by using apic=verbose for more
  21. * information and apic=debug for _lots_ of information.
  22. * apic_verbosity is defined in apic.c
  23. */
  24. #define apic_printk(v, s, a...) do { \
  25. if ((v) <= apic_verbosity) \
  26. printk(s, ##a); \
  27. } while (0)
  28. struct pt_regs;
  29. /*
  30. * Basic functions accessing APICs.
  31. */
  32. static __inline void apic_write(unsigned long reg, unsigned int v)
  33. {
  34. *((volatile unsigned int *)(APIC_BASE+reg)) = v;
  35. }
  36. static __inline unsigned int apic_read(unsigned long reg)
  37. {
  38. return *((volatile unsigned int *)(APIC_BASE+reg));
  39. }
  40. static __inline__ void apic_wait_icr_idle(void)
  41. {
  42. while (apic_read( APIC_ICR ) & APIC_ICR_BUSY)
  43. cpu_relax();
  44. }
  45. static inline void ack_APIC_irq(void)
  46. {
  47. /*
  48. * ack_APIC_irq() actually gets compiled as a single instruction:
  49. * - a single rmw on Pentium/82489DX
  50. * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
  51. * ... yummie.
  52. */
  53. /* Docs say use 0 for future compatibility */
  54. apic_write(APIC_EOI, 0);
  55. }
  56. extern int get_maxlvt (void);
  57. extern void clear_local_APIC (void);
  58. extern void connect_bsp_APIC (void);
  59. extern void disconnect_bsp_APIC (int virt_wire_setup);
  60. extern void disable_local_APIC (void);
  61. extern int verify_local_APIC (void);
  62. extern void cache_APIC_registers (void);
  63. extern void sync_Arb_IDs (void);
  64. extern void init_bsp_APIC (void);
  65. extern void setup_local_APIC (void);
  66. extern void init_apic_mappings (void);
  67. extern void smp_local_timer_interrupt (void);
  68. extern void setup_boot_APIC_clock (void);
  69. extern void setup_secondary_APIC_clock (void);
  70. extern int APIC_init_uniprocessor (void);
  71. extern void disable_APIC_timer(void);
  72. extern void enable_APIC_timer(void);
  73. extern void clustered_apic_check(void);
  74. extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
  75. unsigned char msg_type, unsigned char mask);
  76. #define K8_APIC_EXT_LVT_BASE 0x500
  77. #define K8_APIC_EXT_INT_MSG_FIX 0x0
  78. #define K8_APIC_EXT_INT_MSG_SMI 0x2
  79. #define K8_APIC_EXT_INT_MSG_NMI 0x4
  80. #define K8_APIC_EXT_INT_MSG_EXT 0x7
  81. #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0
  82. void smp_send_timer_broadcast_ipi(void);
  83. void switch_APIC_timer_to_ipi(void *cpumask);
  84. void switch_ipi_to_APIC_timer(void *cpumask);
  85. #define ARCH_APICTIMER_STOPS_ON_C3 1
  86. extern unsigned boot_cpu_id;
  87. #endif /* __ASM_APIC_H */