apic.h 3.2 KB

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