diff options
| author | Anton Blanchard <anton@samba.org> | 2010-04-26 11:32:39 -0400 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-05-06 03:41:54 -0400 |
| commit | 2c2df038450cbf628426183c9efffc17cfea3406 (patch) | |
| tree | 694f8085050d2e5a27177c88428114b416560ddd | |
| parent | 64fe220c13440a12d0bd8e32ebdf679e869e3ce3 (diff) | |
powerpc/cpumask: Refactor /proc/cpuinfo code
This separates the per cpu output from the summary output at the end of the
file, making it easier to convert to the new cpumask API in a subsequent
patch.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/kernel/setup-common.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 48f0a008b20b..58699a43eaa2 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
| @@ -161,6 +161,38 @@ extern u32 cpu_temp_both(unsigned long cpu); | |||
| 161 | DEFINE_PER_CPU(unsigned int, cpu_pvr); | 161 | DEFINE_PER_CPU(unsigned int, cpu_pvr); |
| 162 | #endif | 162 | #endif |
| 163 | 163 | ||
| 164 | static void show_cpuinfo_summary(struct seq_file *m) | ||
| 165 | { | ||
| 166 | struct device_node *root; | ||
| 167 | const char *model = NULL; | ||
| 168 | #if defined(CONFIG_SMP) && defined(CONFIG_PPC32) | ||
| 169 | unsigned long bogosum = 0; | ||
| 170 | int i; | ||
| 171 | for_each_online_cpu(i) | ||
| 172 | bogosum += loops_per_jiffy; | ||
| 173 | seq_printf(m, "total bogomips\t: %lu.%02lu\n", | ||
| 174 | bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); | ||
| 175 | #endif /* CONFIG_SMP && CONFIG_PPC32 */ | ||
| 176 | seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); | ||
| 177 | if (ppc_md.name) | ||
| 178 | seq_printf(m, "platform\t: %s\n", ppc_md.name); | ||
| 179 | root = of_find_node_by_path("/"); | ||
| 180 | if (root) | ||
| 181 | model = of_get_property(root, "model", NULL); | ||
| 182 | if (model) | ||
| 183 | seq_printf(m, "model\t\t: %s\n", model); | ||
| 184 | of_node_put(root); | ||
| 185 | |||
| 186 | if (ppc_md.show_cpuinfo != NULL) | ||
| 187 | ppc_md.show_cpuinfo(m); | ||
| 188 | |||
| 189 | #ifdef CONFIG_PPC32 | ||
| 190 | /* Display the amount of memory */ | ||
| 191 | seq_printf(m, "Memory\t\t: %d MB\n", | ||
| 192 | (unsigned int)(total_memory / (1024 * 1024))); | ||
| 193 | #endif | ||
| 194 | } | ||
| 195 | |||
| 164 | static int show_cpuinfo(struct seq_file *m, void *v) | 196 | static int show_cpuinfo(struct seq_file *m, void *v) |
| 165 | { | 197 | { |
| 166 | unsigned long cpu_id = (unsigned long)v - 1; | 198 | unsigned long cpu_id = (unsigned long)v - 1; |
| @@ -169,35 +201,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 169 | unsigned short min; | 201 | unsigned short min; |
| 170 | 202 | ||
| 171 | if (cpu_id == NR_CPUS) { | 203 | if (cpu_id == NR_CPUS) { |
| 172 | struct device_node *root; | 204 | show_cpuinfo_summary(m); |
| 173 | const char *model = NULL; | ||
| 174 | #if defined(CONFIG_SMP) && defined(CONFIG_PPC32) | ||
| 175 | unsigned long bogosum = 0; | ||
| 176 | int i; | ||
| 177 | for_each_online_cpu(i) | ||
| 178 | bogosum += loops_per_jiffy; | ||
| 179 | seq_printf(m, "total bogomips\t: %lu.%02lu\n", | ||
| 180 | bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); | ||
| 181 | #endif /* CONFIG_SMP && CONFIG_PPC32 */ | ||
| 182 | seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); | ||
| 183 | if (ppc_md.name) | ||
| 184 | seq_printf(m, "platform\t: %s\n", ppc_md.name); | ||
| 185 | root = of_find_node_by_path("/"); | ||
| 186 | if (root) | ||
| 187 | model = of_get_property(root, "model", NULL); | ||
| 188 | if (model) | ||
| 189 | seq_printf(m, "model\t\t: %s\n", model); | ||
| 190 | of_node_put(root); | ||
| 191 | |||
| 192 | if (ppc_md.show_cpuinfo != NULL) | ||
| 193 | ppc_md.show_cpuinfo(m); | ||
| 194 | |||
| 195 | #ifdef CONFIG_PPC32 | ||
| 196 | /* Display the amount of memory */ | ||
| 197 | seq_printf(m, "Memory\t\t: %d MB\n", | ||
| 198 | (unsigned int)(total_memory / (1024 * 1024))); | ||
| 199 | #endif | ||
| 200 | |||
| 201 | return 0; | 205 | return 0; |
| 202 | } | 206 | } |
| 203 | 207 | ||
