x86, apic: clean up ->init_apic_ldr()
[deliverable/linux.git] / arch / x86 / include / asm / numaq / apic.h
CommitLineData
edb181ac
YL
1#ifndef __ASM_NUMAQ_APIC_H
2#define __ASM_NUMAQ_APIC_H
1da177e4
LT
3
4#include <asm/io.h>
5#include <linux/mmzone.h>
6#include <linux/nodemask.h>
7
8#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
9
0a9cc20b 10static inline const cpumask_t *numaq_target_cpus(void)
1da177e4 11{
e7986739 12 return &CPU_MASK_ALL;
1da177e4
LT
13}
14
d1d7cae8
IM
15static inline unsigned long
16numaq_check_apicid_used(physid_mask_t bitmap, int apicid)
d49c4288
YL
17{
18 return physid_isset(apicid, bitmap);
19}
d1d7cae8 20static inline unsigned long numaq_check_apicid_present(int bit)
d49c4288
YL
21{
22 return physid_isset(bit, phys_cpu_present_map);
23}
1da177e4
LT
24#define apicid_cluster(apicid) (apicid & 0xF0)
25
7ed248da 26static inline int numaq_apic_id_registered(void)
1da177e4
LT
27{
28 return 1;
29}
30
a5c43296 31static inline void numaq_init_apic_ldr(void)
1da177e4
LT
32{
33 /* Already done in NUMA-Q firmware */
34}
35
3c43f039 36static inline void setup_apic_routing(void)
1da177e4
LT
37{
38 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
39 "NUMA-Q", nr_ioapics);
40}
41
42/*
43 * Skip adding the timer int on secondary nodes, which causes
44 * a small but painful rift in the time-space continuum.
45 */
46static inline int multi_timer_check(int apic, int irq)
47{
48 return apic != 0 && irq == 0;
49}
50
51static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
52{
53 /* We don't have a good way to do this yet - hack */
54 return physids_promote(0xFUL);
55}
56
57/* Mapping from cpu number to logical apicid */
58extern u8 cpu_2_logical_apicid[];
59static inline int cpu_to_logical_apicid(int cpu)
60{
9628937d
MT
61 if (cpu >= nr_cpu_ids)
62 return BAD_APICID;
1da177e4
LT
63 return (int)cpu_2_logical_apicid[cpu];
64}
65
66/*
67 * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
68 * cpu to APIC ID relation to properly interact with the intelligent
69 * mode of the cluster controller.
70 */
71static inline int cpu_present_to_apicid(int mps_cpu)
72{
73 if (mps_cpu < 60)
74 return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
75 else
76 return BAD_APICID;
77}
78
1da177e4
LT
79static inline int apicid_to_node(int logical_apicid)
80{
81 return logical_apicid >> 4;
82}
83
84static inline physid_mask_t apicid_to_cpu_present(int logical_apicid)
85{
86 int node = apicid_to_node(logical_apicid);
87 int cpu = __ffs(logical_apicid & 0xf);
88
89 return physid_mask_of_physid(cpu + 4*node);
90}
91
c7e844f0
AK
92extern void *xquad_portio;
93
1da177e4
LT
94static inline void setup_portio_remap(void)
95{
96 int num_quads = num_online_nodes();
97
98 if (num_quads <= 1)
99 return;
100
101 printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
102 xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
103 printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
104 (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
105}
106
107static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
108{
109 return (1);
110}
111
112static inline void enable_apic_mode(void)
113{
114}
115
116/*
117 * We use physical apicids here, not logical, so just return the default
118 * physical broadcast to stop people from breaking us
119 */
e7986739 120static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
1da177e4
LT
121{
122 return (int) 0xF;
123}
124
6eeb7c5a
MT
125static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
126 const struct cpumask *andmask)
95d313cf
MT
127{
128 return (int) 0xF;
129}
130
1da177e4
LT
131/* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
132static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
133{
134 return cpuid_apic >> index_msb;
135}
136
edb181ac 137#endif /* __ASM_NUMAQ_APIC_H */
This page took 0.389009 seconds and 5 git commands to generate.