mach_apic.h 3.2 KB

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