apic.h 3.1 KB

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