diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2006-02-01 06:06:02 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:19 -0500 |
| commit | de02797aa744c96a90f47be7bc081ce2f74b17fd (patch) | |
| tree | 24e507b19a7180e8ae08d786598061479f660369 | |
| parent | 091904ae5fc6f018680f83d71301ceac4f39d77f (diff) | |
[PATCH] sh: Cleanup struct sh_cpuinfo for clock framework changes
Now that the clock framework changes have been integrated, the manual clock
accounting that was done in sh_cpuinfo can be dropped.
Also correct a bug with running past the end of the CPU flags when there's a
mismatch between the added flags and printed ones.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | arch/sh/kernel/setup.c | 38 | ||||
| -rw-r--r-- | include/asm-sh/processor.h | 36 |
2 files changed, 30 insertions, 44 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 036050b377cd..0f1fbe72cce4 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
| @@ -22,10 +22,10 @@ | |||
| 22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
| 25 | #include <asm/io_generic.h> | ||
| 26 | #include <asm/sections.h> | 25 | #include <asm/sections.h> |
| 27 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
| 28 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
| 28 | #include <asm/clock.h> | ||
| 29 | 29 | ||
| 30 | #ifdef CONFIG_SH_KGDB | 30 | #ifdef CONFIG_SH_KGDB |
| 31 | #include <asm/kgdb.h> | 31 | #include <asm/kgdb.h> |
| @@ -41,7 +41,7 @@ extern void * __rd_start, * __rd_end; | |||
| 41 | * This value will be used at the very early stage of serial setup. | 41 | * This value will be used at the very early stage of serial setup. |
| 42 | * The bigger value means no problem. | 42 | * The bigger value means no problem. |
| 43 | */ | 43 | */ |
| 44 | struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 0, 10000000, }; | 44 | struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 10000000, }; |
| 45 | struct screen_info screen_info; | 45 | struct screen_info screen_info; |
| 46 | 46 | ||
| 47 | #if defined(CONFIG_SH_UNKNOWN) | 47 | #if defined(CONFIG_SH_UNKNOWN) |
| @@ -273,10 +273,10 @@ void __init setup_arch(char **cmdline_p) | |||
| 273 | init_mm.end_data = (unsigned long) _edata; | 273 | init_mm.end_data = (unsigned long) _edata; |
| 274 | init_mm.brk = (unsigned long) _end; | 274 | init_mm.brk = (unsigned long) _end; |
| 275 | 275 | ||
| 276 | code_resource.start = virt_to_bus(_text); | 276 | code_resource.start = (unsigned long)virt_to_phys(_text); |
| 277 | code_resource.end = virt_to_bus(_etext)-1; | 277 | code_resource.end = (unsigned long)virt_to_phys(_etext)-1; |
| 278 | data_resource.start = virt_to_bus(_etext); | 278 | data_resource.start = (unsigned long)virt_to_phys(_etext); |
| 279 | data_resource.end = virt_to_bus(_edata)-1; | 279 | data_resource.end = (unsigned long)virt_to_phys(_edata)-1; |
| 280 | 280 | ||
| 281 | sh_mv_setup(cmdline_p); | 281 | sh_mv_setup(cmdline_p); |
| 282 | 282 | ||
| @@ -435,6 +435,9 @@ static const char *cpu_name[] = { | |||
| 435 | [CPU_ST40GX1] = "ST40GX1", | 435 | [CPU_ST40GX1] = "ST40GX1", |
| 436 | [CPU_SH4_202] = "SH4-202", | 436 | [CPU_SH4_202] = "SH4-202", |
| 437 | [CPU_SH4_501] = "SH4-501", | 437 | [CPU_SH4_501] = "SH4-501", |
| 438 | [CPU_SH7770] = "SH7770", | ||
| 439 | [CPU_SH7780] = "SH7780", | ||
| 440 | [CPU_SH7781] = "SH7781", | ||
| 438 | [CPU_SH_NONE] = "Unknown" | 441 | [CPU_SH_NONE] = "Unknown" |
| 439 | }; | 442 | }; |
| 440 | 443 | ||
| @@ -445,7 +448,7 @@ const char *get_cpu_subtype(void) | |||
| 445 | 448 | ||
| 446 | #ifdef CONFIG_PROC_FS | 449 | #ifdef CONFIG_PROC_FS |
| 447 | static const char *cpu_flags[] = { | 450 | static const char *cpu_flags[] = { |
| 448 | "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", | 451 | "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", "ptea", NULL |
| 449 | }; | 452 | }; |
| 450 | 453 | ||
| 451 | static void show_cpuflags(struct seq_file *m) | 454 | static void show_cpuflags(struct seq_file *m) |
| @@ -459,7 +462,7 @@ static void show_cpuflags(struct seq_file *m) | |||
| 459 | return; | 462 | return; |
| 460 | } | 463 | } |
| 461 | 464 | ||
| 462 | for (i = 0; i < cpu_data->flags; i++) | 465 | for (i = 0; cpu_flags[i]; i++) |
| 463 | if ((cpu_data->flags & (1 << i))) | 466 | if ((cpu_data->flags & (1 << i))) |
| 464 | seq_printf(m, " %s", cpu_flags[i+1]); | 467 | seq_printf(m, " %s", cpu_flags[i+1]); |
| 465 | 468 | ||
| @@ -472,7 +475,8 @@ static void show_cacheinfo(struct seq_file *m, const char *type, struct cache_in | |||
| 472 | 475 | ||
| 473 | cache_size = info.ways * info.sets * info.linesz; | 476 | cache_size = info.ways * info.sets * info.linesz; |
| 474 | 477 | ||
| 475 | seq_printf(m, "%s size\t: %dKiB\n", type, cache_size >> 10); | 478 | seq_printf(m, "%s size\t: %2dKiB (%d-way)\n", |
| 479 | type, cache_size >> 10, info.ways); | ||
| 476 | } | 480 | } |
| 477 | 481 | ||
| 478 | /* | 482 | /* |
| @@ -511,21 +515,9 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 511 | boot_cpu_data.loops_per_jiffy/(500000/HZ), | 515 | boot_cpu_data.loops_per_jiffy/(500000/HZ), |
| 512 | (boot_cpu_data.loops_per_jiffy/(5000/HZ)) % 100); | 516 | (boot_cpu_data.loops_per_jiffy/(5000/HZ)) % 100); |
| 513 | 517 | ||
| 514 | #define PRINT_CLOCK(name, value) \ | 518 | return show_clocks(m); |
| 515 | seq_printf(m, name " clock\t: %d.%02dMHz\n", \ | ||
| 516 | ((value) / 1000000), ((value) % 1000000)/10000) | ||
| 517 | |||
| 518 | PRINT_CLOCK("cpu", boot_cpu_data.cpu_clock); | ||
| 519 | PRINT_CLOCK("bus", boot_cpu_data.bus_clock); | ||
| 520 | #ifdef CONFIG_CPU_SUBTYPE_ST40STB1 | ||
| 521 | PRINT_CLOCK("memory", boot_cpu_data.memory_clock); | ||
| 522 | #endif | ||
| 523 | PRINT_CLOCK("module", boot_cpu_data.module_clock); | ||
| 524 | |||
| 525 | return 0; | ||
| 526 | } | 519 | } |
| 527 | 520 | ||
| 528 | |||
| 529 | static void *c_start(struct seq_file *m, loff_t *pos) | 521 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 530 | { | 522 | { |
| 531 | return *pos < NR_CPUS ? cpu_data + *pos : NULL; | 523 | return *pos < NR_CPUS ? cpu_data + *pos : NULL; |
| @@ -596,7 +588,7 @@ static int __init kgdb_parse_options(char *options) | |||
| 596 | options += map->namelen + 1; | 588 | options += map->namelen + 1; |
| 597 | 589 | ||
| 598 | options = (*options == ',') ? options+1 : options; | 590 | options = (*options == ',') ? options+1 : options; |
| 599 | 591 | ||
| 600 | /* Read optional parameters (baud/parity/bits) */ | 592 | /* Read optional parameters (baud/parity/bits) */ |
| 601 | baud = simple_strtoul(options, &options, 10); | 593 | baud = simple_strtoul(options, &options, 10); |
| 602 | if (baud != 0) { | 594 | if (baud != 0) { |
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index c4904797d6df..fa5bd2d8803e 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <asm/page.h> | 12 | #include <asm/page.h> |
| 13 | #include <asm/types.h> | 13 | #include <asm/types.h> |
| 14 | #include <asm/cache.h> | 14 | #include <asm/cache.h> |
| 15 | #include <linux/threads.h> | ||
| 16 | #include <asm/ptrace.h> | 15 | #include <asm/ptrace.h> |
| 17 | 16 | ||
| 18 | /* | 17 | /* |
| @@ -30,7 +29,7 @@ | |||
| 30 | * CPU type and hardware bug flags. Kept separately for each CPU. | 29 | * CPU type and hardware bug flags. Kept separately for each CPU. |
| 31 | * | 30 | * |
| 32 | * Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry | 31 | * Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry |
| 33 | * in arch/sh/Kconfig, as well as an entry in arch/sh/kernel/setup.c | 32 | * in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c |
| 34 | * for parsing the subtype in get_cpu_subtype(). | 33 | * for parsing the subtype in get_cpu_subtype(). |
| 35 | */ | 34 | */ |
| 36 | enum cpu_type { | 35 | enum cpu_type { |
| @@ -44,7 +43,7 @@ enum cpu_type { | |||
| 44 | /* SH-4 types */ | 43 | /* SH-4 types */ |
| 45 | CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, | 44 | CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, |
| 46 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, | 45 | CPU_SH7760, CPU_ST40RA, CPU_ST40GX1, CPU_SH4_202, CPU_SH4_501, |
| 47 | CPU_SH73180, | 46 | CPU_SH73180, CPU_SH7770, CPU_SH7780, CPU_SH7781, |
| 48 | 47 | ||
| 49 | /* Unknown subtype */ | 48 | /* Unknown subtype */ |
| 50 | CPU_SH_NONE | 49 | CPU_SH_NONE |
| @@ -52,14 +51,8 @@ enum cpu_type { | |||
| 52 | 51 | ||
| 53 | struct sh_cpuinfo { | 52 | struct sh_cpuinfo { |
| 54 | enum cpu_type type; | 53 | enum cpu_type type; |
| 55 | char hard_math; | ||
| 56 | unsigned long loops_per_jiffy; | 54 | unsigned long loops_per_jiffy; |
| 57 | 55 | ||
| 58 | unsigned int cpu_clock, master_clock, bus_clock, module_clock; | ||
| 59 | #ifdef CONFIG_CPU_SUBTYPE_ST40STB1 | ||
| 60 | unsigned int memory_clock; | ||
| 61 | #endif | ||
| 62 | |||
| 63 | struct cache_info icache; | 56 | struct cache_info icache; |
| 64 | struct cache_info dcache; | 57 | struct cache_info dcache; |
| 65 | 58 | ||
| @@ -131,7 +124,7 @@ union sh_fpu_union { | |||
| 131 | struct sh_fpu_soft_struct soft; | 124 | struct sh_fpu_soft_struct soft; |
| 132 | }; | 125 | }; |
| 133 | 126 | ||
| 134 | /* | 127 | /* |
| 135 | * Processor flags | 128 | * Processor flags |
| 136 | */ | 129 | */ |
| 137 | 130 | ||
| @@ -140,6 +133,7 @@ union sh_fpu_union { | |||
| 140 | #define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */ | 133 | #define CPU_HAS_MMU_PAGE_ASSOC 0x0004 /* SH3: TLB way selection bit support */ |
| 141 | #define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */ | 134 | #define CPU_HAS_DSP 0x0008 /* SH-DSP: DSP support */ |
| 142 | #define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */ | 135 | #define CPU_HAS_PERF_COUNTER 0x0010 /* Hardware performance counters */ |
| 136 | #define CPU_HAS_PTEA 0x0020 /* PTEA register */ | ||
| 143 | 137 | ||
| 144 | struct thread_struct { | 138 | struct thread_struct { |
| 145 | unsigned long sp; | 139 | unsigned long sp; |
| @@ -160,10 +154,10 @@ extern int ubc_usercnt; | |||
| 160 | #define INIT_THREAD { \ | 154 | #define INIT_THREAD { \ |
| 161 | sizeof(init_stack) + (long) &init_stack, /* sp */ \ | 155 | sizeof(init_stack) + (long) &init_stack, /* sp */ \ |
| 162 | 0, /* pc */ \ | 156 | 0, /* pc */ \ |
| 163 | 0, 0, \ | 157 | 0, 0, \ |
| 164 | 0, \ | 158 | 0, \ |
| 165 | 0, \ | 159 | 0, \ |
| 166 | {{{0,}},} /* fpu state */ \ | 160 | {{{0,}},} /* fpu state */ \ |
| 167 | } | 161 | } |
| 168 | 162 | ||
| 169 | /* | 163 | /* |
| @@ -171,7 +165,7 @@ extern int ubc_usercnt; | |||
| 171 | */ | 165 | */ |
| 172 | #define start_thread(regs, new_pc, new_sp) \ | 166 | #define start_thread(regs, new_pc, new_sp) \ |
| 173 | set_fs(USER_DS); \ | 167 | set_fs(USER_DS); \ |
| 174 | regs->pr = 0; \ | 168 | regs->pr = 0; \ |
| 175 | regs->sr = SR_FD; /* User mode. */ \ | 169 | regs->sr = SR_FD; /* User mode. */ \ |
| 176 | regs->pc = new_pc; \ | 170 | regs->pc = new_pc; \ |
| 177 | regs->regs[15] = new_sp | 171 | regs->regs[15] = new_sp |
| @@ -239,16 +233,16 @@ extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); | |||
| 239 | #define save_fpu(tsk) do { } while (0) | 233 | #define save_fpu(tsk) do { } while (0) |
| 240 | #endif | 234 | #endif |
| 241 | 235 | ||
| 242 | #define unlazy_fpu(tsk, regs) do { \ | 236 | #define unlazy_fpu(tsk, regs) do { \ |
| 243 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | 237 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ |
| 244 | save_fpu(tsk, regs); \ | 238 | save_fpu(tsk, regs); \ |
| 245 | } \ | 239 | } \ |
| 246 | } while (0) | 240 | } while (0) |
| 247 | 241 | ||
| 248 | #define clear_fpu(tsk, regs) do { \ | 242 | #define clear_fpu(tsk, regs) do { \ |
| 249 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | 243 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ |
| 250 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); \ | 244 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); \ |
| 251 | release_fpu(regs); \ | 245 | release_fpu(regs); \ |
| 252 | } \ | 246 | } \ |
| 253 | } while (0) | 247 | } while (0) |
| 254 | 248 | ||
