aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-10-26 01:44:58 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-10-26 01:44:58 -0400
commit2f98492c5375e906e48c78d88351f45bb11b6a8a (patch)
tree13373dbdc047a2b70623dbf2cd3181865266f976
parentb18cae4224bde7e5a332c19bc99247b2098ea232 (diff)
sh: Expose physical addressing mode through cpuinfo.
CPUs can be in either the legacy 29-bit or 32-bit physical addressing modes. This follows the x86 approach of tracking the phys bits in cpuinfo and exposing it to userspace through procfs. This change was requested to permit kexec-tools to detect the physical addressing mode in order to determine the appropriate address mangling. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/include/asm/processor.h1
-rw-r--r--arch/sh/kernel/cpu/init.c2
-rw-r--r--arch/sh/kernel/setup.c3
3 files changed, 6 insertions, 0 deletions
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 0a58cb25a658..c9e7cbc4768a 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -89,6 +89,7 @@ struct sh_cpuinfo {
89 struct task_struct *idle; 89 struct task_struct *idle;
90#endif 90#endif
91 91
92 unsigned int phys_bits;
92 unsigned long flags; 93 unsigned long flags;
93} __attribute__ ((aligned(L1_CACHE_BYTES))); 94} __attribute__ ((aligned(L1_CACHE_BYTES)));
94 95
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 97661061ff20..fac742e514ee 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -340,6 +340,8 @@ asmlinkage void __cpuinit cpu_init(void)
340 */ 340 */
341 current_cpu_data.asid_cache = NO_CONTEXT; 341 current_cpu_data.asid_cache = NO_CONTEXT;
342 342
343 current_cpu_data.phys_bits = __in_29bit_mode() ? 29 : 32;
344
343 speculative_execution_init(); 345 speculative_execution_init();
344 expmask_init(); 346 expmask_init();
345 347
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 4e278467f76c..82c0a0c1df0d 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -52,6 +52,7 @@ struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
52 .type = CPU_SH_NONE, 52 .type = CPU_SH_NONE,
53 .family = CPU_FAMILY_UNKNOWN, 53 .family = CPU_FAMILY_UNKNOWN,
54 .loops_per_jiffy = 10000000, 54 .loops_per_jiffy = 10000000,
55 .phys_bits = MAX_PHYSMEM_BITS,
55 }, 56 },
56}; 57};
57EXPORT_SYMBOL(cpu_data); 58EXPORT_SYMBOL(cpu_data);
@@ -432,6 +433,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
432 if (c->flags & CPU_HAS_L2_CACHE) 433 if (c->flags & CPU_HAS_L2_CACHE)
433 show_cacheinfo(m, "scache", c->scache); 434 show_cacheinfo(m, "scache", c->scache);
434 435
436 seq_printf(m, "address sizes\t: %u bits physical\n", c->phys_bits);
437
435 seq_printf(m, "bogomips\t: %lu.%02lu\n", 438 seq_printf(m, "bogomips\t: %lu.%02lu\n",
436 c->loops_per_jiffy/(500000/HZ), 439 c->loops_per_jiffy/(500000/HZ),
437 (c->loops_per_jiffy/(5000/HZ)) % 100); 440 (c->loops_per_jiffy/(5000/HZ)) % 100);