Commit a8cbdcea authored by Bob Breuer's avatar Bob Breuer Committed by David S. Miller

[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: default avatarBob Breuer <breuerr@mc.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25f42b6a
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/cpu.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -389,6 +390,8 @@ console_initcall(set_preferred_console); ...@@ -389,6 +390,8 @@ console_initcall(set_preferred_console);
extern char *sparc_cpu_type; extern char *sparc_cpu_type;
extern char *sparc_fpu_type; extern char *sparc_fpu_type;
static int ncpus_probed;
static int show_cpuinfo(struct seq_file *m, void *__unused) static int show_cpuinfo(struct seq_file *m, void *__unused)
{ {
seq_printf(m, seq_printf(m,
...@@ -411,7 +414,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused) ...@@ -411,7 +414,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
romvec->pv_printrev >> 16, romvec->pv_printrev >> 16,
romvec->pv_printrev & 0xffff, romvec->pv_printrev & 0xffff,
&cputypval, &cputypval,
num_possible_cpus(), ncpus_probed,
num_online_cpus() num_online_cpus()
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
, cpu_data(0).udelay_val/(500000/HZ), , cpu_data(0).udelay_val/(500000/HZ),
...@@ -471,3 +474,30 @@ void sun_do_break(void) ...@@ -471,3 +474,30 @@ void sun_do_break(void)
int serial_console = -1; int serial_console = -1;
int stop_a_enabled = 1; int stop_a_enabled = 1;
static int __init topology_init(void)
{
int i, ncpus, err;
/* Count the number of physically present processors in
* the machine, even on uniprocessor, so that /proc/cpuinfo
* output is consistent with 2.4.x
*/
ncpus = 0;
while (!cpu_find_by_instance(ncpus, NULL, NULL))
ncpus++;
ncpus_probed = ncpus;
err = 0;
for_each_online_cpu(i) {
struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
err = -ENOMEM;
else
register_cpu(p, i, NULL);
}
return err;
}
subsys_initcall(topology_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment