aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/setup.c
diff options
context:
space:
mode:
authorBob Breuer <breuerr@mc.net>2006-06-20 03:28:33 -0400
committerDavid S. Miller <davem@davemloft.net>2006-06-20 03:28:33 -0400
commita8cbdcea341ac2f404ee81aa1c19d54aaa0416b4 (patch)
treeb9aa7ac16fcbe287001bd27080a27b41db7eeb5b /arch/sparc/kernel/setup.c
parent25f42b6af09e34c3f92107b36b5aa6edc2fdba2f (diff)
[SPARC]: Add topology_init()
Fix a crash in SMP mode by adding the missing topology_init. Also makes /proc/cpuinfo backwards compatible with 2.4. Signed-off-by: Bob Breuer <breuerr@mc.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/setup.c')
-rw-r--r--arch/sparc/kernel/setup.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 3509e4305532..8531a8e15832 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -31,6 +31,7 @@
31#include <linux/console.h> 31#include <linux/console.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/root_dev.h> 33#include <linux/root_dev.h>
34#include <linux/cpu.h>
34 35
35#include <asm/system.h> 36#include <asm/system.h>
36#include <asm/io.h> 37#include <asm/io.h>
@@ -389,6 +390,8 @@ console_initcall(set_preferred_console);
389extern char *sparc_cpu_type; 390extern char *sparc_cpu_type;
390extern char *sparc_fpu_type; 391extern char *sparc_fpu_type;
391 392
393static int ncpus_probed;
394
392static int show_cpuinfo(struct seq_file *m, void *__unused) 395static int show_cpuinfo(struct seq_file *m, void *__unused)
393{ 396{
394 seq_printf(m, 397 seq_printf(m,
@@ -411,7 +414,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
411 romvec->pv_printrev >> 16, 414 romvec->pv_printrev >> 16,
412 romvec->pv_printrev & 0xffff, 415 romvec->pv_printrev & 0xffff,
413 &cputypval, 416 &cputypval,
414 num_possible_cpus(), 417 ncpus_probed,
415 num_online_cpus() 418 num_online_cpus()
416#ifndef CONFIG_SMP 419#ifndef CONFIG_SMP
417 , cpu_data(0).udelay_val/(500000/HZ), 420 , cpu_data(0).udelay_val/(500000/HZ),
@@ -471,3 +474,30 @@ void sun_do_break(void)
471 474
472int serial_console = -1; 475int serial_console = -1;
473int stop_a_enabled = 1; 476int stop_a_enabled = 1;
477
478static int __init topology_init(void)
479{
480 int i, ncpus, err;
481
482 /* Count the number of physically present processors in
483 * the machine, even on uniprocessor, so that /proc/cpuinfo
484 * output is consistent with 2.4.x
485 */
486 ncpus = 0;
487 while (!cpu_find_by_instance(ncpus, NULL, NULL))
488 ncpus++;
489 ncpus_probed = ncpus;
490
491 err = 0;
492 for_each_online_cpu(i) {
493 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
494 if (!p)
495 err = -ENOMEM;
496 else
497 register_cpu(p, i, NULL);
498 }
499
500 return err;
501}
502
503subsys_initcall(topology_init);