aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/setup.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/sh/kernel/setup.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/sh/kernel/setup.c')
-rw-r--r--arch/sh/kernel/setup.c168
1 files changed, 7 insertions, 161 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index e769401a78ba..58bff45d1156 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -12,7 +12,6 @@
12#include <linux/initrd.h> 12#include <linux/initrd.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/console.h> 14#include <linux/console.h>
15#include <linux/seq_file.h>
16#include <linux/root_dev.h> 15#include <linux/root_dev.h>
17#include <linux/utsname.h> 16#include <linux/utsname.h>
18#include <linux/nodemask.h> 17#include <linux/nodemask.h>
@@ -24,7 +23,6 @@
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
26#include <linux/err.h> 25#include <linux/err.h>
27#include <linux/debugfs.h>
28#include <linux/crash_dump.h> 26#include <linux/crash_dump.h>
29#include <linux/mmzone.h> 27#include <linux/mmzone.h>
30#include <linux/clk.h> 28#include <linux/clk.h>
@@ -42,6 +40,7 @@
42#include <asm/smp.h> 40#include <asm/smp.h>
43#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
44#include <asm/mmzone.h> 42#include <asm/mmzone.h>
43#include <asm/sparsemem.h>
45 44
46/* 45/*
47 * Initialize loops_per_jiffy as 10000000 (1000MIPS). 46 * Initialize loops_per_jiffy as 10000000 (1000MIPS).
@@ -53,6 +52,7 @@ struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
53 .type = CPU_SH_NONE, 52 .type = CPU_SH_NONE,
54 .family = CPU_FAMILY_UNKNOWN, 53 .family = CPU_FAMILY_UNKNOWN,
55 .loops_per_jiffy = 10000000, 54 .loops_per_jiffy = 10000000,
55 .phys_bits = MAX_PHYSMEM_BITS,
56 }, 56 },
57}; 57};
58EXPORT_SYMBOL(cpu_data); 58EXPORT_SYMBOL(cpu_data);
@@ -136,8 +136,9 @@ void __init check_for_initrd(void)
136 goto disable; 136 goto disable;
137 } 137 }
138 138
139 if (unlikely(start < PAGE_OFFSET)) { 139 if (unlikely(start < __MEMORY_START)) {
140 pr_err("initrd start < PAGE_OFFSET\n"); 140 pr_err("initrd start (%08lx) < __MEMORY_START(%x)\n",
141 start, __MEMORY_START);
141 goto disable; 142 goto disable;
142 } 143 }
143 144
@@ -149,7 +150,7 @@ void __init check_for_initrd(void)
149 } 150 }
150 151
151 /* 152 /*
152 * If we got this far inspite of the boot loader's best efforts 153 * If we got this far in spite of the boot loader's best efforts
153 * to the contrary, assume we actually have a valid initrd and 154 * to the contrary, assume we actually have a valid initrd and
154 * fix up the root dev. 155 * fix up the root dev.
155 */ 156 */
@@ -158,7 +159,7 @@ void __init check_for_initrd(void)
158 /* 159 /*
159 * Address sanitization 160 * Address sanitization
160 */ 161 */
161 initrd_start = (unsigned long)__va(__pa(start)); 162 initrd_start = (unsigned long)__va(start);
162 initrd_end = initrd_start + INITRD_SIZE; 163 initrd_end = initrd_start + INITRD_SIZE;
163 164
164 memblock_reserve(__pa(initrd_start), INITRD_SIZE); 165 memblock_reserve(__pa(initrd_start), INITRD_SIZE);
@@ -317,158 +318,3 @@ int test_mode_pin(int pin)
317{ 318{
318 return sh_mv.mv_mode_pins() & pin; 319 return sh_mv.mv_mode_pins() & pin;
319} 320}
320
321static const char *cpu_name[] = {
322 [CPU_SH7201] = "SH7201",
323 [CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263",
324 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
325 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
326 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
327 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
328 [CPU_SH7712] = "SH7712", [CPU_SH7720] = "SH7720",
329 [CPU_SH7721] = "SH7721", [CPU_SH7729] = "SH7729",
330 [CPU_SH7750] = "SH7750", [CPU_SH7750S] = "SH7750S",
331 [CPU_SH7750R] = "SH7750R", [CPU_SH7751] = "SH7751",
332 [CPU_SH7751R] = "SH7751R", [CPU_SH7760] = "SH7760",
333 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
334 [CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770",
335 [CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781",
336 [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
337 [CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
338 [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
339 [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
340 [CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
341 [CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
342 [CPU_SH_NONE] = "Unknown"
343};
344
345const char *get_cpu_subtype(struct sh_cpuinfo *c)
346{
347 return cpu_name[c->type];
348}
349EXPORT_SYMBOL(get_cpu_subtype);
350
351#ifdef CONFIG_PROC_FS
352/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
353static const char *cpu_flags[] = {
354 "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
355 "ptea", "llsc", "l2", "op32", "pteaex", NULL
356};
357
358static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
359{
360 unsigned long i;
361
362 seq_printf(m, "cpu flags\t:");
363
364 if (!c->flags) {
365 seq_printf(m, " %s\n", cpu_flags[0]);
366 return;
367 }
368
369 for (i = 0; cpu_flags[i]; i++)
370 if ((c->flags & (1 << i)))
371 seq_printf(m, " %s", cpu_flags[i+1]);
372
373 seq_printf(m, "\n");
374}
375
376static void show_cacheinfo(struct seq_file *m, const char *type,
377 struct cache_info info)
378{
379 unsigned int cache_size;
380
381 cache_size = info.ways * info.sets * info.linesz;
382
383 seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
384 type, cache_size >> 10, info.ways);
385}
386
387/*
388 * Get CPU information for use by the procfs.
389 */
390static int show_cpuinfo(struct seq_file *m, void *v)
391{
392 struct sh_cpuinfo *c = v;
393 unsigned int cpu = c - cpu_data;
394
395 if (!cpu_online(cpu))
396 return 0;
397
398 if (cpu == 0)
399 seq_printf(m, "machine\t\t: %s\n", get_system_type());
400 else
401 seq_printf(m, "\n");
402
403 seq_printf(m, "processor\t: %d\n", cpu);
404 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
405 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
406 if (c->cut_major == -1)
407 seq_printf(m, "cut\t\t: unknown\n");
408 else if (c->cut_minor == -1)
409 seq_printf(m, "cut\t\t: %d.x\n", c->cut_major);
410 else
411 seq_printf(m, "cut\t\t: %d.%d\n", c->cut_major, c->cut_minor);
412
413 show_cpuflags(m, c);
414
415 seq_printf(m, "cache type\t: ");
416
417 /*
418 * Check for what type of cache we have, we support both the
419 * unified cache on the SH-2 and SH-3, as well as the harvard
420 * style cache on the SH-4.
421 */
422 if (c->icache.flags & SH_CACHE_COMBINED) {
423 seq_printf(m, "unified\n");
424 show_cacheinfo(m, "cache", c->icache);
425 } else {
426 seq_printf(m, "split (harvard)\n");
427 show_cacheinfo(m, "icache", c->icache);
428 show_cacheinfo(m, "dcache", c->dcache);
429 }
430
431 /* Optional secondary cache */
432 if (c->flags & CPU_HAS_L2_CACHE)
433 show_cacheinfo(m, "scache", c->scache);
434
435 seq_printf(m, "bogomips\t: %lu.%02lu\n",
436 c->loops_per_jiffy/(500000/HZ),
437 (c->loops_per_jiffy/(5000/HZ)) % 100);
438
439 return 0;
440}
441
442static void *c_start(struct seq_file *m, loff_t *pos)
443{
444 return *pos < NR_CPUS ? cpu_data + *pos : NULL;
445}
446static void *c_next(struct seq_file *m, void *v, loff_t *pos)
447{
448 ++*pos;
449 return c_start(m, pos);
450}
451static void c_stop(struct seq_file *m, void *v)
452{
453}
454const struct seq_operations cpuinfo_op = {
455 .start = c_start,
456 .next = c_next,
457 .stop = c_stop,
458 .show = show_cpuinfo,
459};
460#endif /* CONFIG_PROC_FS */
461
462struct dentry *sh_debugfs_root;
463
464static int __init sh_debugfs_init(void)
465{
466 sh_debugfs_root = debugfs_create_dir("sh", NULL);
467 if (!sh_debugfs_root)
468 return -ENOMEM;
469 if (IS_ERR(sh_debugfs_root))
470 return PTR_ERR(sh_debugfs_root);
471
472 return 0;
473}
474arch_initcall(sh_debugfs_init);