1 #ifndef __ASM_NUMAQ_APIC_H
2 #define __ASM_NUMAQ_APIC_H
5 #include <linux/mmzone.h>
6 #include <linux/nodemask.h>
8 #define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
10 static inline const cpumask_t
*numaq_target_cpus(void)
15 static inline unsigned long
16 numaq_check_apicid_used(physid_mask_t bitmap
, int apicid
)
18 return physid_isset(apicid
, bitmap
);
20 static inline unsigned long numaq_check_apicid_present(int bit
)
22 return physid_isset(bit
, phys_cpu_present_map
);
24 #define apicid_cluster(apicid) (apicid & 0xF0)
26 static inline int numaq_apic_id_registered(void)
31 static inline void numaq_init_apic_ldr(void)
33 /* Already done in NUMA-Q firmware */
36 static inline void numaq_setup_apic_routing(void)
38 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
39 "NUMA-Q", nr_ioapics
);
43 * Skip adding the timer int on secondary nodes, which causes
44 * a small but painful rift in the time-space continuum.
46 static inline int numaq_multi_timer_check(int apic
, int irq
)
48 return apic
!= 0 && irq
== 0;
51 static inline physid_mask_t
numaq_ioapic_phys_id_map(physid_mask_t phys_map
)
53 /* We don't have a good way to do this yet - hack */
54 return physids_promote(0xFUL
);
57 /* Mapping from cpu number to logical apicid */
58 extern u8 cpu_2_logical_apicid
[];
60 static inline int numaq_cpu_to_logical_apicid(int cpu
)
62 if (cpu
>= nr_cpu_ids
)
64 return (int)cpu_2_logical_apicid
[cpu
];
68 * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
69 * cpu to APIC ID relation to properly interact with the intelligent
70 * mode of the cluster controller.
72 static inline int numaq_cpu_present_to_apicid(int mps_cpu
)
75 return ((mps_cpu
>> 2) << 4) | (1 << (mps_cpu
& 0x3));
80 static inline int numaq_apicid_to_node(int logical_apicid
)
82 return logical_apicid
>> 4;
85 static inline physid_mask_t
numaq_apicid_to_cpu_present(int logical_apicid
)
87 int node
= numaq_apicid_to_node(logical_apicid
);
88 int cpu
= __ffs(logical_apicid
& 0xf);
90 return physid_mask_of_physid(cpu
+ 4*node
);
93 extern void *xquad_portio
;
95 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid
)
100 static inline void enable_apic_mode(void)
105 * We use physical apicids here, not logical, so just return the default
106 * physical broadcast to stop people from breaking us
108 static inline unsigned int cpu_mask_to_apicid(const cpumask_t
*cpumask
)
113 static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask
*cpumask
,
114 const struct cpumask
*andmask
)
119 /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
120 static inline u32
phys_pkg_id(u32 cpuid_apic
, int index_msb
)
122 return cpuid_apic
>> index_msb
;
125 #endif /* __ASM_NUMAQ_APIC_H */