aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-05-13 23:50:43 -0400
committerPaul Mundt <lethal@hera.kernel.org>2007-06-07 22:43:35 -0400
commit7a302a9674593259866de4a9d5ae8edc03dc1934 (patch)
treed705d89037c226d9928ce132b332b08e2f00388a
parent85f6038f2170e3335dda09c3dfb0f83110e87019 (diff)
sh: Split out CPU topology initialization.
Split out the CPU topology initialization to a separate file, and switch it to a percpu type, rather than an NR_CPUS array. At the same time, switch to only registering present CPUs, rather than using the possible CPU map. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/Makefile9
-rw-r--r--arch/sh/kernel/setup.c15
-rw-r--r--arch/sh/kernel/topology.c21
3 files changed, 26 insertions, 19 deletions
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 9104b6257644..fb623e5d1857 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -4,10 +4,9 @@
4 4
5extra-y := head.o init_task.o vmlinux.lds 5extra-y := head.o init_task.o vmlinux.lds
6 6
7obj-y := process.o signal.o traps.o irq.o \ 7obj-y := debugtraps.o io.o io_generic.o irq.o process.o ptrace.o \
8 ptrace.o setup.o time.o sys_sh.o semaphore.o \ 8 semaphore.o setup.o signal.o sys_sh.o syscalls.o \
9 io.o io_generic.o sh_ksyms.o syscalls.o \ 9 time.o topology.o traps.o
10 debugtraps.o
11 10
12obj-y += cpu/ timers/ 11obj-y += cpu/ timers/
13obj-$(CONFIG_VSYSCALL) += vsyscall/ 12obj-$(CONFIG_VSYSCALL) += vsyscall/
@@ -17,7 +16,7 @@ obj-$(CONFIG_CF_ENABLER) += cf-enabler.o
17obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o 16obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
18obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o 17obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o
19obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o 18obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
20obj-$(CONFIG_MODULES) += module.o 19obj-$(CONFIG_MODULES) += sh_ksyms.o module.o
21obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 20obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
22obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
23obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 22obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index c27729135935..61152b438325 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -23,6 +23,7 @@
23#include <linux/kexec.h> 23#include <linux/kexec.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/io.h> 25#include <asm/io.h>
26#include <asm/page.h>
26#include <asm/sections.h> 27#include <asm/sections.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/setup.h> 29#include <asm/setup.h>
@@ -389,20 +390,6 @@ struct sh_machine_vector* __init get_mv_byname(const char* name)
389 return NULL; 390 return NULL;
390} 391}
391 392
392static struct cpu cpu[NR_CPUS];
393
394static int __init topology_init(void)
395{
396 int cpu_id;
397
398 for_each_possible_cpu(cpu_id)
399 register_cpu(&cpu[cpu_id], cpu_id);
400
401 return 0;
402}
403
404subsys_initcall(topology_init);
405
406static const char *cpu_name[] = { 393static const char *cpu_name[] = {
407 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619", 394 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
408 [CPU_SH7604] = "SH7604", [CPU_SH7300] = "SH7300", 395 [CPU_SH7604] = "SH7604", [CPU_SH7300] = "SH7300",
diff --git a/arch/sh/kernel/topology.c b/arch/sh/kernel/topology.c
new file mode 100644
index 000000000000..8a4664c0ab57
--- /dev/null
+++ b/arch/sh/kernel/topology.c
@@ -0,0 +1,21 @@
1#include <linux/cpu.h>
2#include <linux/cpumask.h>
3#include <linux/init.h>
4#include <linux/percpu.h>
5
6static DEFINE_PER_CPU(struct cpu, cpu_devices);
7
8static int __init topology_init(void)
9{
10 int i, ret;
11
12 for_each_present_cpu(i) {
13 ret = register_cpu(&per_cpu(cpu_devices, i), i);
14 if (unlikely(ret))
15 printk(KERN_WARNING "%s: register_cpu %d failed (%d)\n",
16 __FUNCTION__, i, ret);
17 }
18
19 return 0;
20}
21subsys_initcall(topology_init);