aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/setup-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/setup-common.c')
-rw-r--r--arch/powerpc/kernel/setup-common.c86
1 files changed, 47 insertions, 39 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 48f0a008b20b..5e4d852f640c 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -161,45 +161,44 @@ extern u32 cpu_temp_both(unsigned long cpu);
161DEFINE_PER_CPU(unsigned int, cpu_pvr); 161DEFINE_PER_CPU(unsigned int, cpu_pvr);
162#endif 162#endif
163 163
164static int show_cpuinfo(struct seq_file *m, void *v) 164static void show_cpuinfo_summary(struct seq_file *m)
165{ 165{
166 unsigned long cpu_id = (unsigned long)v - 1; 166 struct device_node *root;
167 unsigned int pvr; 167 const char *model = NULL;
168 unsigned short maj;
169 unsigned short min;
170
171 if (cpu_id == NR_CPUS) {
172 struct device_node *root;
173 const char *model = NULL;
174#if defined(CONFIG_SMP) && defined(CONFIG_PPC32) 168#if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
175 unsigned long bogosum = 0; 169 unsigned long bogosum = 0;
176 int i; 170 int i;
177 for_each_online_cpu(i) 171 for_each_online_cpu(i)
178 bogosum += loops_per_jiffy; 172 bogosum += loops_per_jiffy;
179 seq_printf(m, "total bogomips\t: %lu.%02lu\n", 173 seq_printf(m, "total bogomips\t: %lu.%02lu\n",
180 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); 174 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
181#endif /* CONFIG_SMP && CONFIG_PPC32 */ 175#endif /* CONFIG_SMP && CONFIG_PPC32 */
182 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); 176 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
183 if (ppc_md.name) 177 if (ppc_md.name)
184 seq_printf(m, "platform\t: %s\n", ppc_md.name); 178 seq_printf(m, "platform\t: %s\n", ppc_md.name);
185 root = of_find_node_by_path("/"); 179 root = of_find_node_by_path("/");
186 if (root) 180 if (root)
187 model = of_get_property(root, "model", NULL); 181 model = of_get_property(root, "model", NULL);
188 if (model) 182 if (model)
189 seq_printf(m, "model\t\t: %s\n", model); 183 seq_printf(m, "model\t\t: %s\n", model);
190 of_node_put(root); 184 of_node_put(root);
191 185
192 if (ppc_md.show_cpuinfo != NULL) 186 if (ppc_md.show_cpuinfo != NULL)
193 ppc_md.show_cpuinfo(m); 187 ppc_md.show_cpuinfo(m);
194 188
195#ifdef CONFIG_PPC32 189#ifdef CONFIG_PPC32
196 /* Display the amount of memory */ 190 /* Display the amount of memory */
197 seq_printf(m, "Memory\t\t: %d MB\n", 191 seq_printf(m, "Memory\t\t: %d MB\n",
198 (unsigned int)(total_memory / (1024 * 1024))); 192 (unsigned int)(total_memory / (1024 * 1024)));
199#endif 193#endif
194}
200 195
201 return 0; 196static int show_cpuinfo(struct seq_file *m, void *v)
202 } 197{
198 unsigned long cpu_id = (unsigned long)v - 1;
199 unsigned int pvr;
200 unsigned short maj;
201 unsigned short min;
203 202
204 /* We only show online cpus: disable preempt (overzealous, I 203 /* We only show online cpus: disable preempt (overzealous, I
205 * knew) to prevent cpu going down. */ 204 * knew) to prevent cpu going down. */
@@ -308,19 +307,28 @@ static int show_cpuinfo(struct seq_file *m, void *v)
308#endif 307#endif
309 308
310 preempt_enable(); 309 preempt_enable();
310
311 /* If this is the last cpu, print the summary */
312 if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
313 show_cpuinfo_summary(m);
314
311 return 0; 315 return 0;
312} 316}
313 317
314static void *c_start(struct seq_file *m, loff_t *pos) 318static void *c_start(struct seq_file *m, loff_t *pos)
315{ 319{
316 unsigned long i = *pos; 320 if (*pos == 0) /* just in case, cpu 0 is not the first */
317 321 *pos = cpumask_first(cpu_online_mask);
318 return i <= NR_CPUS ? (void *)(i + 1) : NULL; 322 else
323 *pos = cpumask_next(*pos - 1, cpu_online_mask);
324 if ((*pos) < nr_cpu_ids)
325 return (void *)(unsigned long)(*pos + 1);
326 return NULL;
319} 327}
320 328
321static void *c_next(struct seq_file *m, void *v, loff_t *pos) 329static void *c_next(struct seq_file *m, void *v, loff_t *pos)
322{ 330{
323 ++*pos; 331 (*pos)++;
324 return c_start(m, pos); 332 return c_start(m, pos);
325} 333}
326 334
@@ -386,14 +394,14 @@ static void __init cpu_init_thread_core_maps(int tpc)
386 394
387/** 395/**
388 * setup_cpu_maps - initialize the following cpu maps: 396 * setup_cpu_maps - initialize the following cpu maps:
389 * cpu_possible_map 397 * cpu_possible_mask
390 * cpu_present_map 398 * cpu_present_mask
391 * 399 *
392 * Having the possible map set up early allows us to restrict allocations 400 * Having the possible map set up early allows us to restrict allocations
393 * of things like irqstacks to num_possible_cpus() rather than NR_CPUS. 401 * of things like irqstacks to num_possible_cpus() rather than NR_CPUS.
394 * 402 *
395 * We do not initialize the online map here; cpus set their own bits in 403 * We do not initialize the online map here; cpus set their own bits in
396 * cpu_online_map as they come up. 404 * cpu_online_mask as they come up.
397 * 405 *
398 * This function is valid only for Open Firmware systems. finish_device_tree 406 * This function is valid only for Open Firmware systems. finish_device_tree
399 * must be called before using this. 407 * must be called before using this.