apic.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef __ASM_NUMAQ_APIC_H
  2. #define __ASM_NUMAQ_APIC_H
  3. #include <asm/io.h>
  4. #include <linux/mmzone.h>
  5. #include <linux/nodemask.h>
  6. #define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
  7. static inline cpumask_t target_cpus(void)
  8. {
  9. return CPU_MASK_ALL;
  10. }
  11. #define NO_BALANCE_IRQ (1)
  12. #define esr_disable (1)
  13. #define INT_DELIVERY_MODE dest_LowestPrio
  14. #define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */
  15. static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
  16. {
  17. return physid_isset(apicid, bitmap);
  18. }
  19. static inline unsigned long check_apicid_present(int bit)
  20. {
  21. return physid_isset(bit, phys_cpu_present_map);
  22. }
  23. #define apicid_cluster(apicid) (apicid & 0xF0)
  24. static inline int apic_id_registered(void)
  25. {
  26. return 1;
  27. }
  28. static inline void init_apic_ldr(void)
  29. {
  30. /* Already done in NUMA-Q firmware */
  31. }
  32. static inline void setup_apic_routing(void)
  33. {
  34. printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
  35. "NUMA-Q", nr_ioapics);
  36. }
  37. /*
  38. * Skip adding the timer int on secondary nodes, which causes
  39. * a small but painful rift in the time-space continuum.
  40. */
  41. static inline int multi_timer_check(int apic, int irq)
  42. {
  43. return apic != 0 && irq == 0;
  44. }
  45. static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
  46. {
  47. /* We don't have a good way to do this yet - hack */
  48. return physids_promote(0xFUL);
  49. }
  50. /* Mapping from cpu number to logical apicid */
  51. extern u8 cpu_2_logical_apicid[];
  52. static inline int cpu_to_logical_apicid(int cpu)
  53. {
  54. if (cpu >= NR_CPUS)
  55. return BAD_APICID;
  56. return (int)cpu_2_logical_apicid[cpu];
  57. }
  58. /*
  59. * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
  60. * cpu to APIC ID relation to properly interact with the intelligent
  61. * mode of the cluster controller.
  62. */
  63. static inline int cpu_present_to_apicid(int mps_cpu)
  64. {
  65. if (mps_cpu < 60)
  66. return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
  67. else
  68. return BAD_APICID;
  69. }
  70. static inline int apicid_to_node(int logical_apicid)
  71. {
  72. return logical_apicid >> 4;
  73. }
  74. static inline physid_mask_t apicid_to_cpu_present(int logical_apicid)
  75. {
  76. int node = apicid_to_node(logical_apicid);
  77. int cpu = __ffs(logical_apicid & 0xf);
  78. return physid_mask_of_physid(cpu + 4*node);
  79. }
  80. extern void *xquad_portio;
  81. static inline void setup_portio_remap(void)
  82. {
  83. int num_quads = num_online_nodes();
  84. if (num_quads <= 1)
  85. return;
  86. printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
  87. xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
  88. printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
  89. (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
  90. }
  91. static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
  92. {
  93. return (1);
  94. }
  95. static inline void enable_apic_mode(void)
  96. {
  97. }
  98. /*
  99. * We use physical apicids here, not logical, so just return the default
  100. * physical broadcast to stop people from breaking us
  101. */
  102. static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
  103. {
  104. return (int) 0xF;
  105. }
  106. /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
  107. static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
  108. {
  109. return cpuid_apic >> index_msb;
  110. }
  111. #endif /* __ASM_NUMAQ_APIC_H */