diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2011-04-21 18:45:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-21 18:45:45 -0400 |
commit | cb1b8209815594613650772eeb889c170107dad4 (patch) | |
tree | 9a3530e404083464992c7969cec7fcab6c972e48 /arch/sparc/kernel | |
parent | 5eb1f4fc167f5adc5f15e722e25eff6713fb3406 (diff) |
sparc: consolidate show_cpuinfo in cpu.c
We have all the cpu related info in cpu.c - so move
the remaining functions to support /proc/cpuinfo to this file.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r-- | arch/sparc/kernel/cpu.c | 127 | ||||
-rw-r--r-- | arch/sparc/kernel/kernel.h | 4 | ||||
-rw-r--r-- | arch/sparc/kernel/perf_event.c | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/setup_32.c | 69 | ||||
-rw-r--r-- | arch/sparc/kernel/setup_64.c | 78 |
5 files changed, 126 insertions, 153 deletions
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c index 7925c54f4133..c3483c71aa04 100644 --- a/arch/sparc/kernel/cpu.c +++ b/arch/sparc/kernel/cpu.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) | 4 | * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/seq_file.h> | ||
7 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
8 | #include <linux/module.h> | 9 | #include <linux/module.h> |
9 | #include <linux/init.h> | 10 | #include <linux/init.h> |
@@ -11,7 +12,9 @@ | |||
11 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
12 | 13 | ||
13 | #include <asm/spitfire.h> | 14 | #include <asm/spitfire.h> |
15 | #include <asm/pgtable.h> | ||
14 | #include <asm/oplib.h> | 16 | #include <asm/oplib.h> |
17 | #include <asm/setup.h> | ||
15 | #include <asm/page.h> | 18 | #include <asm/page.h> |
16 | #include <asm/head.h> | 19 | #include <asm/head.h> |
17 | #include <asm/psr.h> | 20 | #include <asm/psr.h> |
@@ -23,6 +26,9 @@ | |||
23 | DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; | 26 | DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; |
24 | EXPORT_PER_CPU_SYMBOL(__cpu_data); | 27 | EXPORT_PER_CPU_SYMBOL(__cpu_data); |
25 | 28 | ||
29 | int ncpus_probed; | ||
30 | unsigned int fsr_storage; | ||
31 | |||
26 | struct cpu_info { | 32 | struct cpu_info { |
27 | int psr_vers; | 33 | int psr_vers; |
28 | const char *name; | 34 | const char *name; |
@@ -247,11 +253,10 @@ static const struct manufacturer_info __initconst manufacturer_info[] = { | |||
247 | * machine type value into consideration too. I will fix this. | 253 | * machine type value into consideration too. I will fix this. |
248 | */ | 254 | */ |
249 | 255 | ||
250 | const char *sparc_cpu_type; | 256 | static const char *sparc_cpu_type; |
251 | const char *sparc_fpu_type; | 257 | static const char *sparc_fpu_type; |
252 | const char *sparc_pmu_type; | 258 | const char *sparc_pmu_type; |
253 | 259 | ||
254 | unsigned int fsr_storage; | ||
255 | 260 | ||
256 | static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) | 261 | static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) |
257 | { | 262 | { |
@@ -313,6 +318,122 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers) | |||
313 | } | 318 | } |
314 | 319 | ||
315 | #ifdef CONFIG_SPARC32 | 320 | #ifdef CONFIG_SPARC32 |
321 | static int show_cpuinfo(struct seq_file *m, void *__unused) | ||
322 | { | ||
323 | seq_printf(m, | ||
324 | "cpu\t\t: %s\n" | ||
325 | "fpu\t\t: %s\n" | ||
326 | "promlib\t\t: Version %d Revision %d\n" | ||
327 | "prom\t\t: %d.%d\n" | ||
328 | "type\t\t: %s\n" | ||
329 | "ncpus probed\t: %d\n" | ||
330 | "ncpus active\t: %d\n" | ||
331 | #ifndef CONFIG_SMP | ||
332 | "CPU0Bogo\t: %lu.%02lu\n" | ||
333 | "CPU0ClkTck\t: %ld\n" | ||
334 | #endif | ||
335 | , | ||
336 | sparc_cpu_type, | ||
337 | sparc_fpu_type , | ||
338 | romvec->pv_romvers, | ||
339 | prom_rev, | ||
340 | romvec->pv_printrev >> 16, | ||
341 | romvec->pv_printrev & 0xffff, | ||
342 | &cputypval[0], | ||
343 | ncpus_probed, | ||
344 | num_online_cpus() | ||
345 | #ifndef CONFIG_SMP | ||
346 | , cpu_data(0).udelay_val/(500000/HZ), | ||
347 | (cpu_data(0).udelay_val/(5000/HZ)) % 100, | ||
348 | cpu_data(0).clock_tick | ||
349 | #endif | ||
350 | ); | ||
351 | |||
352 | #ifdef CONFIG_SMP | ||
353 | smp_bogo(m); | ||
354 | #endif | ||
355 | mmu_info(m); | ||
356 | #ifdef CONFIG_SMP | ||
357 | smp_info(m); | ||
358 | #endif | ||
359 | return 0; | ||
360 | } | ||
361 | #endif /* CONFIG_SPARC32 */ | ||
362 | |||
363 | #ifdef CONFIG_SPARC64 | ||
364 | unsigned int dcache_parity_tl1_occurred; | ||
365 | unsigned int icache_parity_tl1_occurred; | ||
366 | |||
367 | |||
368 | static int show_cpuinfo(struct seq_file *m, void *__unused) | ||
369 | { | ||
370 | seq_printf(m, | ||
371 | "cpu\t\t: %s\n" | ||
372 | "fpu\t\t: %s\n" | ||
373 | "pmu\t\t: %s\n" | ||
374 | "prom\t\t: %s\n" | ||
375 | "type\t\t: %s\n" | ||
376 | "ncpus probed\t: %d\n" | ||
377 | "ncpus active\t: %d\n" | ||
378 | "D$ parity tl1\t: %u\n" | ||
379 | "I$ parity tl1\t: %u\n" | ||
380 | #ifndef CONFIG_SMP | ||
381 | "Cpu0ClkTck\t: %016lx\n" | ||
382 | #endif | ||
383 | , | ||
384 | sparc_cpu_type, | ||
385 | sparc_fpu_type, | ||
386 | sparc_pmu_type, | ||
387 | prom_version, | ||
388 | ((tlb_type == hypervisor) ? | ||
389 | "sun4v" : | ||
390 | "sun4u"), | ||
391 | ncpus_probed, | ||
392 | num_online_cpus(), | ||
393 | dcache_parity_tl1_occurred, | ||
394 | icache_parity_tl1_occurred | ||
395 | #ifndef CONFIG_SMP | ||
396 | , cpu_data(0).clock_tick | ||
397 | #endif | ||
398 | ); | ||
399 | #ifdef CONFIG_SMP | ||
400 | smp_bogo(m); | ||
401 | #endif | ||
402 | mmu_info(m); | ||
403 | #ifdef CONFIG_SMP | ||
404 | smp_info(m); | ||
405 | #endif | ||
406 | return 0; | ||
407 | } | ||
408 | #endif /* CONFIG_SPARC64 */ | ||
409 | |||
410 | static void *c_start(struct seq_file *m, loff_t *pos) | ||
411 | { | ||
412 | /* The pointer we are returning is arbitrary, | ||
413 | * it just has to be non-NULL and not IS_ERR | ||
414 | * in the success case. | ||
415 | */ | ||
416 | return *pos == 0 ? &c_start : NULL; | ||
417 | } | ||
418 | |||
419 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | ||
420 | { | ||
421 | ++*pos; | ||
422 | return c_start(m, pos); | ||
423 | } | ||
424 | |||
425 | static void c_stop(struct seq_file *m, void *v) | ||
426 | { | ||
427 | } | ||
428 | |||
429 | const struct seq_operations cpuinfo_op = { | ||
430 | .start =c_start, | ||
431 | .next = c_next, | ||
432 | .stop = c_stop, | ||
433 | .show = show_cpuinfo, | ||
434 | }; | ||
435 | |||
436 | #ifdef CONFIG_SPARC32 | ||
316 | void __cpuinit cpu_probe(void) | 437 | void __cpuinit cpu_probe(void) |
317 | { | 438 | { |
318 | int psr_impl, psr_vers, fpu_vers; | 439 | int psr_impl, psr_vers, fpu_vers; |
diff --git a/arch/sparc/kernel/kernel.h b/arch/sparc/kernel/kernel.h index 487d67a4e7f6..6f6544cfa0ef 100644 --- a/arch/sparc/kernel/kernel.h +++ b/arch/sparc/kernel/kernel.h | |||
@@ -6,11 +6,9 @@ | |||
6 | #include <asm/traps.h> | 6 | #include <asm/traps.h> |
7 | 7 | ||
8 | /* cpu.c */ | 8 | /* cpu.c */ |
9 | extern const char *sparc_cpu_type; | ||
10 | extern const char *sparc_pmu_type; | 9 | extern const char *sparc_pmu_type; |
11 | extern const char *sparc_fpu_type; | ||
12 | |||
13 | extern unsigned int fsr_storage; | 10 | extern unsigned int fsr_storage; |
11 | extern int ncpus_probed; | ||
14 | 12 | ||
15 | #ifdef CONFIG_SPARC32 | 13 | #ifdef CONFIG_SPARC32 |
16 | /* cpu.c */ | 14 | /* cpu.c */ |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index ee8426ede7c7..2cb0e1c001e2 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/nmi.h> | 26 | #include <asm/nmi.h> |
27 | #include <asm/pcr.h> | 27 | #include <asm/pcr.h> |
28 | 28 | ||
29 | #include "kernel.h" | ||
29 | #include "kstack.h" | 30 | #include "kstack.h" |
30 | 31 | ||
31 | /* Sparc64 chips have two performance counters, 32-bits each, with | 32 | /* Sparc64 chips have two performance counters, 32-bits each, with |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 7b8b76c9557f..8f3031f6ecf7 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -311,75 +311,6 @@ void __init setup_arch(char **cmdline_p) | |||
311 | smp_setup_cpu_possible_map(); | 311 | smp_setup_cpu_possible_map(); |
312 | } | 312 | } |
313 | 313 | ||
314 | static int ncpus_probed; | ||
315 | |||
316 | static int show_cpuinfo(struct seq_file *m, void *__unused) | ||
317 | { | ||
318 | seq_printf(m, | ||
319 | "cpu\t\t: %s\n" | ||
320 | "fpu\t\t: %s\n" | ||
321 | "promlib\t\t: Version %d Revision %d\n" | ||
322 | "prom\t\t: %d.%d\n" | ||
323 | "type\t\t: %s\n" | ||
324 | "ncpus probed\t: %d\n" | ||
325 | "ncpus active\t: %d\n" | ||
326 | #ifndef CONFIG_SMP | ||
327 | "CPU0Bogo\t: %lu.%02lu\n" | ||
328 | "CPU0ClkTck\t: %ld\n" | ||
329 | #endif | ||
330 | , | ||
331 | sparc_cpu_type, | ||
332 | sparc_fpu_type , | ||
333 | romvec->pv_romvers, | ||
334 | prom_rev, | ||
335 | romvec->pv_printrev >> 16, | ||
336 | romvec->pv_printrev & 0xffff, | ||
337 | &cputypval[0], | ||
338 | ncpus_probed, | ||
339 | num_online_cpus() | ||
340 | #ifndef CONFIG_SMP | ||
341 | , cpu_data(0).udelay_val/(500000/HZ), | ||
342 | (cpu_data(0).udelay_val/(5000/HZ)) % 100, | ||
343 | cpu_data(0).clock_tick | ||
344 | #endif | ||
345 | ); | ||
346 | |||
347 | #ifdef CONFIG_SMP | ||
348 | smp_bogo(m); | ||
349 | #endif | ||
350 | mmu_info(m); | ||
351 | #ifdef CONFIG_SMP | ||
352 | smp_info(m); | ||
353 | #endif | ||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static void *c_start(struct seq_file *m, loff_t *pos) | ||
358 | { | ||
359 | /* The pointer we are returning is arbitrary, | ||
360 | * it just has to be non-NULL and not IS_ERR | ||
361 | * in the success case. | ||
362 | */ | ||
363 | return *pos == 0 ? &c_start : NULL; | ||
364 | } | ||
365 | |||
366 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | ||
367 | { | ||
368 | ++*pos; | ||
369 | return c_start(m, pos); | ||
370 | } | ||
371 | |||
372 | static void c_stop(struct seq_file *m, void *v) | ||
373 | { | ||
374 | } | ||
375 | |||
376 | const struct seq_operations cpuinfo_op = { | ||
377 | .start =c_start, | ||
378 | .next = c_next, | ||
379 | .stop = c_stop, | ||
380 | .show = show_cpuinfo, | ||
381 | }; | ||
382 | |||
383 | extern int stop_a_enabled; | 314 | extern int stop_a_enabled; |
384 | 315 | ||
385 | void sun_do_break(void) | 316 | void sun_do_break(void) |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 29bafe051bb1..f3b6850cc8db 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -339,84 +339,6 @@ void __init setup_arch(char **cmdline_p) | |||
339 | paging_init(); | 339 | paging_init(); |
340 | } | 340 | } |
341 | 341 | ||
342 | /* BUFFER is PAGE_SIZE bytes long. */ | ||
343 | |||
344 | extern void smp_info(struct seq_file *); | ||
345 | extern void smp_bogo(struct seq_file *); | ||
346 | extern void mmu_info(struct seq_file *); | ||
347 | |||
348 | unsigned int dcache_parity_tl1_occurred; | ||
349 | unsigned int icache_parity_tl1_occurred; | ||
350 | |||
351 | int ncpus_probed; | ||
352 | |||
353 | static int show_cpuinfo(struct seq_file *m, void *__unused) | ||
354 | { | ||
355 | seq_printf(m, | ||
356 | "cpu\t\t: %s\n" | ||
357 | "fpu\t\t: %s\n" | ||
358 | "pmu\t\t: %s\n" | ||
359 | "prom\t\t: %s\n" | ||
360 | "type\t\t: %s\n" | ||
361 | "ncpus probed\t: %d\n" | ||
362 | "ncpus active\t: %d\n" | ||
363 | "D$ parity tl1\t: %u\n" | ||
364 | "I$ parity tl1\t: %u\n" | ||
365 | #ifndef CONFIG_SMP | ||
366 | "Cpu0ClkTck\t: %016lx\n" | ||
367 | #endif | ||
368 | , | ||
369 | sparc_cpu_type, | ||
370 | sparc_fpu_type, | ||
371 | sparc_pmu_type, | ||
372 | prom_version, | ||
373 | ((tlb_type == hypervisor) ? | ||
374 | "sun4v" : | ||
375 | "sun4u"), | ||
376 | ncpus_probed, | ||
377 | num_online_cpus(), | ||
378 | dcache_parity_tl1_occurred, | ||
379 | icache_parity_tl1_occurred | ||
380 | #ifndef CONFIG_SMP | ||
381 | , cpu_data(0).clock_tick | ||
382 | #endif | ||
383 | ); | ||
384 | #ifdef CONFIG_SMP | ||
385 | smp_bogo(m); | ||
386 | #endif | ||
387 | mmu_info(m); | ||
388 | #ifdef CONFIG_SMP | ||
389 | smp_info(m); | ||
390 | #endif | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | static void *c_start(struct seq_file *m, loff_t *pos) | ||
395 | { | ||
396 | /* The pointer we are returning is arbitrary, | ||
397 | * it just has to be non-NULL and not IS_ERR | ||
398 | * in the success case. | ||
399 | */ | ||
400 | return *pos == 0 ? &c_start : NULL; | ||
401 | } | ||
402 | |||
403 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | ||
404 | { | ||
405 | ++*pos; | ||
406 | return c_start(m, pos); | ||
407 | } | ||
408 | |||
409 | static void c_stop(struct seq_file *m, void *v) | ||
410 | { | ||
411 | } | ||
412 | |||
413 | const struct seq_operations cpuinfo_op = { | ||
414 | .start =c_start, | ||
415 | .next = c_next, | ||
416 | .stop = c_stop, | ||
417 | .show = show_cpuinfo, | ||
418 | }; | ||
419 | |||
420 | extern int stop_a_enabled; | 342 | extern int stop_a_enabled; |
421 | 343 | ||
422 | void sun_do_break(void) | 344 | void sun_do_break(void) |