.. | .. |
---|
15 | 15 | #include <asm/page.h> |
---|
16 | 16 | #include <asm/processor.h> |
---|
17 | 17 | #include <asm/ptrace.h> |
---|
| 18 | +#include <asm/sn/agent.h> |
---|
18 | 19 | #include <asm/sn/arch.h> |
---|
19 | 20 | #include <asm/sn/gda.h> |
---|
20 | 21 | #include <asm/sn/intr.h> |
---|
21 | 22 | #include <asm/sn/klconfig.h> |
---|
22 | 23 | #include <asm/sn/launch.h> |
---|
23 | 24 | #include <asm/sn/mapped_kernel.h> |
---|
24 | | -#include <asm/sn/sn_private.h> |
---|
25 | 25 | #include <asm/sn/types.h> |
---|
26 | | -#include <asm/sn/sn0/hubpi.h> |
---|
27 | | -#include <asm/sn/sn0/hubio.h> |
---|
28 | | -#include <asm/sn/sn0/ip27.h> |
---|
29 | 26 | |
---|
30 | | -/* |
---|
31 | | - * Takes as first input the PROM assigned cpu id, and the kernel |
---|
32 | | - * assigned cpu id as the second. |
---|
33 | | - */ |
---|
34 | | -static void alloc_cpupda(cpuid_t cpu, int cpunum) |
---|
| 27 | +#include "ip27-common.h" |
---|
| 28 | + |
---|
| 29 | +static int node_scan_cpus(nasid_t nasid, int highest) |
---|
35 | 30 | { |
---|
36 | | - cnodeid_t node = get_cpu_cnode(cpu); |
---|
37 | | - nasid_t nasid = COMPACT_TO_NASID_NODEID(node); |
---|
38 | | - |
---|
39 | | - cputonasid(cpunum) = nasid; |
---|
40 | | - sn_cpu_info[cpunum].p_nodeid = node; |
---|
41 | | - cputoslice(cpunum) = get_cpu_slice(cpu); |
---|
42 | | -} |
---|
43 | | - |
---|
44 | | -static nasid_t get_actual_nasid(lboard_t *brd) |
---|
45 | | -{ |
---|
46 | | - klhub_t *hub; |
---|
47 | | - |
---|
48 | | - if (!brd) |
---|
49 | | - return INVALID_NASID; |
---|
50 | | - |
---|
51 | | - /* find out if we are a completely disabled brd. */ |
---|
52 | | - hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB); |
---|
53 | | - if (!hub) |
---|
54 | | - return INVALID_NASID; |
---|
55 | | - if (!(hub->hub_info.flags & KLINFO_ENABLE)) /* disabled node brd */ |
---|
56 | | - return hub->hub_info.physid; |
---|
57 | | - else |
---|
58 | | - return brd->brd_nasid; |
---|
59 | | -} |
---|
60 | | - |
---|
61 | | -static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest) |
---|
62 | | -{ |
---|
63 | | - static int tot_cpus_found = 0; |
---|
| 31 | + static int cpus_found; |
---|
64 | 32 | lboard_t *brd; |
---|
65 | 33 | klcpu_t *acpu; |
---|
66 | | - int cpus_found = 0; |
---|
67 | 34 | cpuid_t cpuid; |
---|
68 | 35 | |
---|
69 | 36 | brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27); |
---|
.. | .. |
---|
72 | 39 | acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU); |
---|
73 | 40 | while (acpu) { |
---|
74 | 41 | cpuid = acpu->cpu_info.virtid; |
---|
75 | | - /* cnode is not valid for completely disabled brds */ |
---|
76 | | - if (get_actual_nasid(brd) == brd->brd_nasid) |
---|
77 | | - cpuid_to_compact_node[cpuid] = cnode; |
---|
78 | | - if (cpuid > highest) |
---|
79 | | - highest = cpuid; |
---|
80 | 42 | /* Only let it join in if it's marked enabled */ |
---|
81 | 43 | if ((acpu->cpu_info.flags & KLINFO_ENABLE) && |
---|
82 | | - (tot_cpus_found != NR_CPUS)) { |
---|
| 44 | + (cpus_found != NR_CPUS)) { |
---|
| 45 | + if (cpuid > highest) |
---|
| 46 | + highest = cpuid; |
---|
83 | 47 | set_cpu_possible(cpuid, true); |
---|
84 | | - alloc_cpupda(cpuid, tot_cpus_found); |
---|
| 48 | + cputonasid(cpus_found) = nasid; |
---|
| 49 | + cputoslice(cpus_found) = acpu->cpu_info.physid; |
---|
| 50 | + sn_cpu_info[cpus_found].p_speed = |
---|
| 51 | + acpu->cpu_speed; |
---|
85 | 52 | cpus_found++; |
---|
86 | | - tot_cpus_found++; |
---|
87 | 53 | } |
---|
88 | 54 | acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu, |
---|
89 | 55 | KLSTRUCT_CPU); |
---|
.. | .. |
---|
103 | 69 | int i, highest = 0; |
---|
104 | 70 | gda_t *gdap = GDA; |
---|
105 | 71 | |
---|
106 | | - /* |
---|
107 | | - * Initialize the arrays to invalid nodeid (-1) |
---|
108 | | - */ |
---|
109 | | - for (i = 0; i < MAX_COMPACT_NODES; i++) |
---|
110 | | - compact_to_nasid_node[i] = INVALID_NASID; |
---|
111 | | - for (i = 0; i < MAX_NASIDS; i++) |
---|
112 | | - nasid_to_compact_node[i] = INVALID_CNODEID; |
---|
113 | | - for (i = 0; i < MAXCPUS; i++) |
---|
114 | | - cpuid_to_compact_node[i] = INVALID_CNODEID; |
---|
115 | | - |
---|
116 | | - /* |
---|
117 | | - * MCD - this whole "compact node" stuff can probably be dropped, |
---|
118 | | - * as we can handle sparse numbering now |
---|
119 | | - */ |
---|
120 | 72 | nodes_clear(node_online_map); |
---|
121 | | - for (i = 0; i < MAX_COMPACT_NODES; i++) { |
---|
| 73 | + for (i = 0; i < MAX_NUMNODES; i++) { |
---|
122 | 74 | nasid_t nasid = gdap->g_nasidtable[i]; |
---|
123 | 75 | if (nasid == INVALID_NASID) |
---|
124 | 76 | break; |
---|
125 | | - compact_to_nasid_node[i] = nasid; |
---|
126 | | - nasid_to_compact_node[nasid] = i; |
---|
127 | | - node_set_online(num_online_nodes()); |
---|
128 | | - highest = do_cpumask(i, nasid, highest); |
---|
| 77 | + node_set_online(nasid); |
---|
| 78 | + highest = node_scan_cpus(nasid, highest); |
---|
129 | 79 | } |
---|
130 | 80 | |
---|
131 | 81 | printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes()); |
---|
.. | .. |
---|
162 | 112 | irq += cputoslice(destid); |
---|
163 | 113 | |
---|
164 | 114 | /* |
---|
165 | | - * Convert the compact hub number to the NASID to get the correct |
---|
166 | | - * part of the address space. Then set the interrupt bit associated |
---|
167 | | - * with the CPU we want to send the interrupt to. |
---|
| 115 | + * Set the interrupt bit associated with the CPU we want to |
---|
| 116 | + * send the interrupt to. |
---|
168 | 117 | */ |
---|
169 | | - REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq); |
---|
| 118 | + REMOTE_HUB_SEND_INTR(cpu_to_node(destid), irq); |
---|
170 | 119 | } |
---|
171 | 120 | |
---|
172 | 121 | static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action) |
---|
.. | .. |
---|
177 | 126 | ip27_send_ipi_single(i, action); |
---|
178 | 127 | } |
---|
179 | 128 | |
---|
180 | | -static void ip27_init_secondary(void) |
---|
| 129 | +static void ip27_init_cpu(void) |
---|
181 | 130 | { |
---|
182 | 131 | per_cpu_init(); |
---|
183 | 132 | } |
---|
184 | 133 | |
---|
185 | 134 | static void ip27_smp_finish(void) |
---|
186 | 135 | { |
---|
187 | | - extern void hub_rt_clock_event_init(void); |
---|
188 | | - |
---|
189 | 136 | hub_rt_clock_event_init(); |
---|
190 | 137 | local_irq_enable(); |
---|
191 | 138 | } |
---|
.. | .. |
---|
208 | 155 | |
---|
209 | 156 | static void __init ip27_smp_setup(void) |
---|
210 | 157 | { |
---|
211 | | - cnodeid_t cnode; |
---|
| 158 | + nasid_t nasid; |
---|
212 | 159 | |
---|
213 | | - for_each_online_node(cnode) { |
---|
214 | | - if (cnode == 0) |
---|
| 160 | + for_each_online_node(nasid) { |
---|
| 161 | + if (nasid == 0) |
---|
215 | 162 | continue; |
---|
216 | | - intr_clear_all(COMPACT_TO_NASID_NODEID(cnode)); |
---|
| 163 | + intr_clear_all(nasid); |
---|
217 | 164 | } |
---|
218 | 165 | |
---|
219 | 166 | replicate_kernel_text(); |
---|
220 | 167 | |
---|
221 | 168 | /* |
---|
222 | | - * Assumption to be fixed: we're always booted on logical / physical |
---|
223 | | - * processor 0. While we're always running on logical processor 0 |
---|
224 | | - * this still means this is physical processor zero; it might for |
---|
225 | | - * example be disabled in the firmware. |
---|
| 169 | + * PROM sets up system, that boot cpu is always first CPU on nasid 0 |
---|
226 | 170 | */ |
---|
227 | | - alloc_cpupda(0, 0); |
---|
| 171 | + cputonasid(0) = 0; |
---|
| 172 | + cputoslice(0) = LOCAL_HUB_L(PI_CPU_NUM); |
---|
228 | 173 | } |
---|
229 | 174 | |
---|
230 | 175 | static void __init ip27_prepare_cpus(unsigned int max_cpus) |
---|
.. | .. |
---|
235 | 180 | const struct plat_smp_ops ip27_smp_ops = { |
---|
236 | 181 | .send_ipi_single = ip27_send_ipi_single, |
---|
237 | 182 | .send_ipi_mask = ip27_send_ipi_mask, |
---|
238 | | - .init_secondary = ip27_init_secondary, |
---|
| 183 | + .init_secondary = ip27_init_cpu, |
---|
239 | 184 | .smp_finish = ip27_smp_finish, |
---|
240 | 185 | .boot_secondary = ip27_boot_secondary, |
---|
241 | 186 | .smp_setup = ip27_smp_setup, |
---|
242 | 187 | .prepare_cpus = ip27_prepare_cpus, |
---|
| 188 | + .prepare_boot_cpu = ip27_init_cpu, |
---|
243 | 189 | }; |
---|