setup.c (53c82622c2db808c015953336faecefc0ebf29bc) | setup.c (11c1965687b0a472add948d4240dfe65a2fcb298) |
---|---|
1/* | 1/* |
2 * linux/arch/sh/kernel/setup.c | 2 * arch/sh/kernel/setup.c |
3 * | 3 * |
4 * This file handles the architecture-dependent parts of initialization 5 * |
|
4 * Copyright (C) 1999 Niibe Yutaka | 6 * Copyright (C) 1999 Niibe Yutaka |
5 * Copyright (C) 2002, 2003 Paul Mundt | 7 * Copyright (C) 2002 - 2006 Paul Mundt |
6 */ | 8 */ |
7 8/* 9 * This file handles the architecture-dependent parts of initialization 10 */ 11 | |
12#include <linux/screen_info.h> 13#include <linux/ioport.h> 14#include <linux/init.h> 15#include <linux/initrd.h> 16#include <linux/bootmem.h> 17#include <linux/console.h> 18#include <linux/seq_file.h> 19#include <linux/root_dev.h> --- 370 unchanged lines hidden (view full) --- 390 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1", 391 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", 392 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", 393 [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343", 394 [CPU_SH7785] = "SH7785", [CPU_SH7722] = "SH7722", 395 [CPU_SH_NONE] = "Unknown" 396}; 397 | 9#include <linux/screen_info.h> 10#include <linux/ioport.h> 11#include <linux/init.h> 12#include <linux/initrd.h> 13#include <linux/bootmem.h> 14#include <linux/console.h> 15#include <linux/seq_file.h> 16#include <linux/root_dev.h> --- 370 unchanged lines hidden (view full) --- 387 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1", 388 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", 389 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", 390 [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343", 391 [CPU_SH7785] = "SH7785", [CPU_SH7722] = "SH7722", 392 [CPU_SH_NONE] = "Unknown" 393}; 394 |
398const char *get_cpu_subtype(void) | 395const char *get_cpu_subtype(struct sh_cpuinfo *c) |
399{ | 396{ |
400 return cpu_name[boot_cpu_data.type]; | 397 return cpu_name[c->type]; |
401} 402 403#ifdef CONFIG_PROC_FS 404/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */ 405static const char *cpu_flags[] = { 406 "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", 407 "ptea", "llsc", "l2", NULL 408}; 409 | 398} 399 400#ifdef CONFIG_PROC_FS 401/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */ 402static const char *cpu_flags[] = { 403 "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", 404 "ptea", "llsc", "l2", NULL 405}; 406 |
410static void show_cpuflags(struct seq_file *m) | 407static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c) |
411{ 412 unsigned long i; 413 414 seq_printf(m, "cpu flags\t:"); 415 | 408{ 409 unsigned long i; 410 411 seq_printf(m, "cpu flags\t:"); 412 |
416 if (!cpu_data->flags) { | 413 if (!c->flags) { |
417 seq_printf(m, " %s\n", cpu_flags[0]); 418 return; 419 } 420 421 for (i = 0; cpu_flags[i]; i++) | 414 seq_printf(m, " %s\n", cpu_flags[0]); 415 return; 416 } 417 418 for (i = 0; cpu_flags[i]; i++) |
422 if ((cpu_data->flags & (1 << i))) | 419 if ((c->flags & (1 << i))) |
423 seq_printf(m, " %s", cpu_flags[i+1]); 424 425 seq_printf(m, "\n"); 426} 427 428static void show_cacheinfo(struct seq_file *m, const char *type, 429 struct cache_info info) 430{ --- 5 unchanged lines hidden (view full) --- 436 type, cache_size >> 10, info.ways); 437} 438 439/* 440 * Get CPU information for use by the procfs. 441 */ 442static int show_cpuinfo(struct seq_file *m, void *v) 443{ | 420 seq_printf(m, " %s", cpu_flags[i+1]); 421 422 seq_printf(m, "\n"); 423} 424 425static void show_cacheinfo(struct seq_file *m, const char *type, 426 struct cache_info info) 427{ --- 5 unchanged lines hidden (view full) --- 433 type, cache_size >> 10, info.ways); 434} 435 436/* 437 * Get CPU information for use by the procfs. 438 */ 439static int show_cpuinfo(struct seq_file *m, void *v) 440{ |
444 unsigned int cpu = smp_processor_id(); | 441 struct sh_cpuinfo *c = v; 442 unsigned int cpu = c - cpu_data; |
445 | 443 |
446 if (!cpu && cpu_online(cpu)) | 444 if (!cpu_online(cpu)) 445 return 0; 446 447 if (cpu == 0) |
447 seq_printf(m, "machine\t\t: %s\n", get_system_type()); 448 449 seq_printf(m, "processor\t: %d\n", cpu); 450 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); | 448 seq_printf(m, "machine\t\t: %s\n", get_system_type()); 449 450 seq_printf(m, "processor\t: %d\n", cpu); 451 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); |
451 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype()); | 452 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c)); |
452 | 453 |
453 show_cpuflags(m); | 454 show_cpuflags(m, c); |
454 455 seq_printf(m, "cache type\t: "); 456 457 /* 458 * Check for what type of cache we have, we support both the 459 * unified cache on the SH-2 and SH-3, as well as the harvard 460 * style cache on the SH-4. 461 */ | 455 456 seq_printf(m, "cache type\t: "); 457 458 /* 459 * Check for what type of cache we have, we support both the 460 * unified cache on the SH-2 and SH-3, as well as the harvard 461 * style cache on the SH-4. 462 */ |
462 if (boot_cpu_data.icache.flags & SH_CACHE_COMBINED) { | 463 if (c->icache.flags & SH_CACHE_COMBINED) { |
463 seq_printf(m, "unified\n"); | 464 seq_printf(m, "unified\n"); |
464 show_cacheinfo(m, "cache", boot_cpu_data.icache); | 465 show_cacheinfo(m, "cache", c->icache); |
465 } else { 466 seq_printf(m, "split (harvard)\n"); | 466 } else { 467 seq_printf(m, "split (harvard)\n"); |
467 show_cacheinfo(m, "icache", boot_cpu_data.icache); 468 show_cacheinfo(m, "dcache", boot_cpu_data.dcache); | 468 show_cacheinfo(m, "icache", c->icache); 469 show_cacheinfo(m, "dcache", c->dcache); |
469 } 470 471 /* Optional secondary cache */ | 470 } 471 472 /* Optional secondary cache */ |
472 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) 473 show_cacheinfo(m, "scache", boot_cpu_data.scache); | 473 if (c->flags & CPU_HAS_L2_CACHE) 474 show_cacheinfo(m, "scache", c->scache); |
474 475 seq_printf(m, "bogomips\t: %lu.%02lu\n", | 475 476 seq_printf(m, "bogomips\t: %lu.%02lu\n", |
476 boot_cpu_data.loops_per_jiffy/(500000/HZ), 477 (boot_cpu_data.loops_per_jiffy/(5000/HZ)) % 100); | 477 c->loops_per_jiffy/(500000/HZ), 478 (c->loops_per_jiffy/(5000/HZ)) % 100); |
478 479 return show_clocks(m); 480} 481 482static void *c_start(struct seq_file *m, loff_t *pos) 483{ 484 return *pos < NR_CPUS ? cpu_data + *pos : NULL; 485} --- 104 unchanged lines hidden --- | 479 480 return show_clocks(m); 481} 482 483static void *c_start(struct seq_file *m, loff_t *pos) 484{ 485 return *pos < NR_CPUS ? cpu_data + *pos : NULL; 486} --- 104 unchanged lines hidden --- |