blob: f96490419768a72412dcc34abd2ace8f99c533c9 [file] [log] [blame]
Paul Mundt711fa802006-10-03 13:14:04 +09001/*
Paul Mundt11c19652006-12-25 10:19:56 +09002 * arch/sh/kernel/setup.c
3 *
4 * This file handles the architecture-dependent parts of initialization
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
6 * Copyright (C) 1999 Niibe Yutaka
Paul Mundt11c19652006-12-25 10:19:56 +09007 * Copyright (C) 2002 - 2006 Paul Mundt
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
Jon Smirl894673e2006-07-10 04:44:13 -07009#include <linux/screen_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#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>
17#include <linux/utsname.h>
18#include <linux/cpu.h>
Dave Hansen22a98352006-03-27 01:16:04 -080019#include <linux/pfn.h>
Paul Mundt711fa802006-10-03 13:14:04 +090020#include <linux/fs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <asm/uaccess.h>
22#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <asm/sections.h>
24#include <asm/irq.h>
25#include <asm/setup.h>
Paul Mundtde027972006-02-01 03:06:02 -080026#include <asm/clock.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Linus Torvalds1da177e2005-04-16 15:20:36 -070028extern void * __rd_start, * __rd_end;
Paul Mundtfa5da2f2007-03-08 17:27:37 +090029
Linus Torvalds1da177e2005-04-16 15:20:36 -070030/*
31 * Machine setup..
32 */
33
34/*
35 * Initialize loops_per_jiffy as 10000000 (1000MIPS).
36 * This value will be used at the very early stage of serial setup.
37 * The bigger value means no problem.
38 */
Paul Mundtde027972006-02-01 03:06:02 -080039struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 10000000, };
Paul Mundt2c7834a2006-09-27 18:17:31 +090040#ifdef CONFIG_VT
Linus Torvalds1da177e2005-04-16 15:20:36 -070041struct screen_info screen_info;
Paul Mundt2c7834a2006-09-27 18:17:31 +090042#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44#if defined(CONFIG_SH_UNKNOWN)
45struct sh_machine_vector sh_mv;
46#endif
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048extern int root_mountflags;
49
50#define MV_NAME_SIZE 32
51
52static struct sh_machine_vector* __init get_mv_byname(const char* name);
53
54/*
55 * This is set up by the setup-routine at boot-time
56 */
57#define PARAM ((unsigned char *)empty_zero_page)
58
59#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
60#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
61#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008))
62#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c))
63#define INITRD_START (*(unsigned long *) (PARAM+0x010))
64#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
65/* ... */
66#define COMMAND_LINE ((char *) (PARAM+0x100))
67
Paul Mundt65463b72005-11-07 00:58:24 -080068#define RAMDISK_IMAGE_START_MASK 0x07FF
Linus Torvalds1da177e2005-04-16 15:20:36 -070069#define RAMDISK_PROMPT_FLAG 0x8000
Paul Mundt65463b72005-11-07 00:58:24 -080070#define RAMDISK_LOAD_FLAG 0x4000
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Alon Bar-Lev53c82622007-02-12 00:54:19 -080072static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Paul Mundt2c7834a2006-09-27 18:17:31 +090074static struct resource code_resource = { .name = "Kernel code", };
75static struct resource data_resource = { .name = "Kernel data", };
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
77unsigned long memory_start, memory_end;
78
79static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
80 struct sh_machine_vector** mvp,
Paul Mundtb641fe02006-12-12 09:00:47 +090081 unsigned long *mv_io_base)
Linus Torvalds1da177e2005-04-16 15:20:36 -070082{
83 char c = ' ', *to = command_line, *from = COMMAND_LINE;
84 int len = 0;
85
86 /* Save unparsed command line copy for /proc/cmdline */
Alon Bar-Lev53c82622007-02-12 00:54:19 -080087 memcpy(boot_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
88 boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90 memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
91 memory_end = memory_start + __MEMORY_SIZE;
92
93 for (;;) {
94 /*
95 * "mem=XXX[kKmM]" defines a size of memory.
96 */
97 if (c == ' ' && !memcmp(from, "mem=", 4)) {
98 if (to != command_line)
99 to--;
100 {
101 unsigned long mem_size;
102
103 mem_size = memparse(from+4, &from);
104 memory_end = memory_start + mem_size;
105 }
106 }
Paul Mundta80fd212006-09-27 14:26:53 +0900107
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 if (c == ' ' && !memcmp(from, "sh_mv=", 6)) {
109 char* mv_end;
110 char* mv_comma;
111 int mv_len;
112 if (to != command_line)
113 to--;
114 from += 6;
115 mv_end = strchr(from, ' ');
116 if (mv_end == NULL)
117 mv_end = from + strlen(from);
118
119 mv_comma = strchr(from, ',');
120 if ((mv_comma != NULL) && (mv_comma < mv_end)) {
121 int ints[3];
122 get_options(mv_comma+1, ARRAY_SIZE(ints), ints);
123 *mv_io_base = ints[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 mv_len = mv_comma - from;
125 } else {
126 mv_len = mv_end - from;
127 }
128 if (mv_len > (MV_NAME_SIZE-1))
129 mv_len = MV_NAME_SIZE-1;
130 memcpy(mv_name, from, mv_len);
131 mv_name[mv_len] = '\0';
132 from = mv_end;
133
134 *mvp = get_mv_byname(mv_name);
135 }
Paul Mundtb641fe02006-12-12 09:00:47 +0900136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 c = *(from++);
138 if (!c)
139 break;
140 if (COMMAND_LINE_SIZE <= ++len)
141 break;
142 *(to++) = c;
143 }
144 *to = '\0';
145 *cmdline_p = command_line;
146}
147
148static int __init sh_mv_setup(char **cmdline_p)
149{
Paul Mundt50373c12006-02-01 03:06:03 -0800150#ifdef CONFIG_SH_UNKNOWN
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 extern struct sh_machine_vector mv_unknown;
152#endif
153 struct sh_machine_vector *mv = NULL;
154 char mv_name[MV_NAME_SIZE] = "";
155 unsigned long mv_io_base = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
Paul Mundtb641fe02006-12-12 09:00:47 +0900157 parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158
Paul Mundt50373c12006-02-01 03:06:03 -0800159#ifdef CONFIG_SH_UNKNOWN
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 if (mv == NULL) {
161 mv = &mv_unknown;
162 if (*mv_name != '\0') {
163 printk("Warning: Unsupported machine %s, using unknown\n",
164 mv_name);
165 }
166 }
167 sh_mv = *mv;
168#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
170 /*
171 * Manually walk the vec, fill in anything that the board hasn't yet
172 * by hand, wrapping to the generic implementation.
173 */
174#define mv_set(elem) do { \
175 if (!sh_mv.mv_##elem) \
176 sh_mv.mv_##elem = generic_##elem; \
177} while (0)
178
179 mv_set(inb); mv_set(inw); mv_set(inl);
180 mv_set(outb); mv_set(outw); mv_set(outl);
181
182 mv_set(inb_p); mv_set(inw_p); mv_set(inl_p);
183 mv_set(outb_p); mv_set(outw_p); mv_set(outl_p);
184
185 mv_set(insb); mv_set(insw); mv_set(insl);
186 mv_set(outsb); mv_set(outsw); mv_set(outsl);
187
188 mv_set(readb); mv_set(readw); mv_set(readl);
189 mv_set(writeb); mv_set(writew); mv_set(writel);
190
Paul Mundt50373c12006-02-01 03:06:03 -0800191 mv_set(ioport_map);
192 mv_set(ioport_unmap);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 mv_set(irq_demux);
194
195#ifdef CONFIG_SH_UNKNOWN
196 __set_io_port_base(mv_io_base);
197#endif
198
Paul Mundt2c7834a2006-09-27 18:17:31 +0900199 if (!sh_mv.mv_nr_irqs)
200 sh_mv.mv_nr_irqs = NR_IRQS;
201
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202 return 0;
203}
204
205void __init setup_arch(char **cmdline_p)
206{
207 unsigned long bootmap_size;
208 unsigned long start_pfn, max_pfn, max_low_pfn;
209
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210#ifdef CONFIG_CMDLINE_BOOL
211 strcpy(COMMAND_LINE, CONFIG_CMDLINE);
212#endif
213
214 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
215
216#ifdef CONFIG_BLK_DEV_RAM
217 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
218 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
219 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
220#endif
221
222 if (!MOUNT_ROOT_RDONLY)
223 root_mountflags &= ~MS_RDONLY;
224 init_mm.start_code = (unsigned long) _text;
225 init_mm.end_code = (unsigned long) _etext;
226 init_mm.end_data = (unsigned long) _edata;
227 init_mm.brk = (unsigned long) _end;
228
Paul Mundtde027972006-02-01 03:06:02 -0800229 code_resource.start = (unsigned long)virt_to_phys(_text);
230 code_resource.end = (unsigned long)virt_to_phys(_etext)-1;
231 data_resource.start = (unsigned long)virt_to_phys(_etext);
232 data_resource.end = (unsigned long)virt_to_phys(_edata)-1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233
234 sh_mv_setup(cmdline_p);
235
Paul Mundtb641fe02006-12-12 09:00:47 +0900236
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 /*
238 * Find the highest page frame number we have available
239 */
240 max_pfn = PFN_DOWN(__pa(memory_end));
241
242 /*
243 * Determine low and high memory ranges:
244 */
245 max_low_pfn = max_pfn;
246
Paul Mundt65463b72005-11-07 00:58:24 -0800247 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248 * Partially used pages are not usable - thus
249 * we are rounding upwards:
Paul Mundt65463b72005-11-07 00:58:24 -0800250 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 start_pfn = PFN_UP(__pa(_end));
252
253 /*
254 * Find a proper area for the bootmem bitmap. After this
255 * bootstrap step all allocations (until the page allocator
256 * is intact) must be done via bootmem_alloc().
257 */
258 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
259 __MEMORY_START>>PAGE_SHIFT,
260 max_low_pfn);
261 /*
262 * Register fully available low RAM pages with the bootmem allocator.
263 */
264 {
265 unsigned long curr_pfn, last_pfn, pages;
266
267 /*
268 * We are rounding up the start address of usable memory:
269 */
270 curr_pfn = PFN_UP(__MEMORY_START);
271 /*
272 * ... and at the end of the usable range downwards:
273 */
274 last_pfn = PFN_DOWN(__pa(memory_end));
275
276 if (last_pfn > max_low_pfn)
277 last_pfn = max_low_pfn;
278
279 pages = last_pfn - curr_pfn;
280 free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn),
281 PFN_PHYS(pages));
282 }
283
Paul Mundtb641fe02006-12-12 09:00:47 +0900284
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 /*
286 * Reserve the kernel text and
287 * Reserve the bootmem bitmap. We do this in two steps (first step
288 * was init_bootmem()), because this catches the (definitely buggy)
289 * case of us accidentally initializing the bootmem allocator with
290 * an invalid RAM area.
291 */
292 reserve_bootmem_node(NODE_DATA(0), __MEMORY_START+PAGE_SIZE,
293 (PFN_PHYS(start_pfn)+bootmap_size+PAGE_SIZE-1)-__MEMORY_START);
294
295 /*
296 * reserve physical page 0 - it's a special BIOS page on many boxes,
297 * enabling clean reboots, SMP operation, laptop functions.
298 */
299 reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
300
301#ifdef CONFIG_BLK_DEV_INITRD
Paul Mundt65463b72005-11-07 00:58:24 -0800302 ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
303 if (&__rd_start != &__rd_end) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 LOADER_TYPE = 1;
Paul Mundt41504c32006-12-11 20:28:03 +0900305 INITRD_START = PHYSADDR((unsigned long)&__rd_start) -
306 __MEMORY_START;
307 INITRD_SIZE = (unsigned long)&__rd_end -
308 (unsigned long)&__rd_start;
Paul Mundt65463b72005-11-07 00:58:24 -0800309 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310
311 if (LOADER_TYPE && INITRD_START) {
312 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
Paul Mundt41504c32006-12-11 20:28:03 +0900313 reserve_bootmem_node(NODE_DATA(0), INITRD_START +
314 __MEMORY_START, INITRD_SIZE);
315 initrd_start = INITRD_START + PAGE_OFFSET +
316 __MEMORY_START;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 initrd_end = initrd_start + INITRD_SIZE;
318 } else {
319 printk("initrd extends beyond end of memory "
320 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
321 INITRD_START + INITRD_SIZE,
322 max_low_pfn << PAGE_SHIFT);
323 initrd_start = 0;
324 }
325 }
326#endif
327
328#ifdef CONFIG_DUMMY_CONSOLE
329 conswitchp = &dummy_con;
330#endif
331
332 /* Perform the machine specific initialisation */
Paul Mundt2c7834a2006-09-27 18:17:31 +0900333 if (likely(sh_mv.mv_setup))
334 sh_mv.mv_setup(cmdline_p);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335
336 paging_init();
337}
338
339struct sh_machine_vector* __init get_mv_byname(const char* name)
340{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341 extern long __machvec_start, __machvec_end;
342 struct sh_machine_vector *all_vecs =
343 (struct sh_machine_vector *)&__machvec_start;
344
345 int i, n = ((unsigned long)&__machvec_end
346 - (unsigned long)&__machvec_start)/
347 sizeof(struct sh_machine_vector);
348
349 for (i = 0; i < n; ++i) {
350 struct sh_machine_vector *mv = &all_vecs[i];
351 if (mv == NULL)
352 continue;
353 if (strcasecmp(name, get_system_type()) == 0) {
354 return mv;
355 }
356 }
357 return NULL;
358}
359
360static struct cpu cpu[NR_CPUS];
361
362static int __init topology_init(void)
363{
364 int cpu_id;
365
KAMEZAWA Hiroyukibc83db42006-03-31 02:30:02 -0800366 for_each_possible_cpu(cpu_id)
KAMEZAWA Hiroyuki76b67ed2006-06-27 02:53:41 -0700367 register_cpu(&cpu[cpu_id], cpu_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368
369 return 0;
370}
371
372subsys_initcall(topology_init);
373
374static const char *cpu_name[] = {
Paul Mundtb552c7e2006-11-20 14:14:29 +0900375 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
Paul Mundte5723e02006-09-27 17:38:11 +0900376 [CPU_SH7604] = "SH7604", [CPU_SH7300] = "SH7300",
377 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
378 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
379 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
380 [CPU_SH7729] = "SH7729", [CPU_SH7750] = "SH7750",
381 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R",
382 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R",
383 [CPU_SH7760] = "SH7760", [CPU_SH73180] = "SH73180",
384 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1",
385 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
386 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780",
387 [CPU_SH7781] = "SH7781", [CPU_SH7343] = "SH7343",
Paul Mundt41504c32006-12-11 20:28:03 +0900388 [CPU_SH7785] = "SH7785", [CPU_SH7722] = "SH7722",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 [CPU_SH_NONE] = "Unknown"
390};
391
Paul Mundt11c19652006-12-25 10:19:56 +0900392const char *get_cpu_subtype(struct sh_cpuinfo *c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393{
Paul Mundt11c19652006-12-25 10:19:56 +0900394 return cpu_name[c->type];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395}
396
397#ifdef CONFIG_PROC_FS
Paul Mundt2220d162006-09-27 18:24:28 +0900398/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399static const char *cpu_flags[] = {
Paul Mundt2220d162006-09-27 18:24:28 +0900400 "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
Paul Mundt72c35542006-09-27 18:27:43 +0900401 "ptea", "llsc", "l2", NULL
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402};
403
Paul Mundt11c19652006-12-25 10:19:56 +0900404static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405{
406 unsigned long i;
407
408 seq_printf(m, "cpu flags\t:");
409
Paul Mundt11c19652006-12-25 10:19:56 +0900410 if (!c->flags) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 seq_printf(m, " %s\n", cpu_flags[0]);
412 return;
413 }
414
Paul Mundtde027972006-02-01 03:06:02 -0800415 for (i = 0; cpu_flags[i]; i++)
Paul Mundt11c19652006-12-25 10:19:56 +0900416 if ((c->flags & (1 << i)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 seq_printf(m, " %s", cpu_flags[i+1]);
418
419 seq_printf(m, "\n");
420}
421
Paul Mundt2c7834a2006-09-27 18:17:31 +0900422static void show_cacheinfo(struct seq_file *m, const char *type,
423 struct cache_info info)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424{
425 unsigned int cache_size;
426
427 cache_size = info.ways * info.sets * info.linesz;
428
Paul Mundtde027972006-02-01 03:06:02 -0800429 seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
430 type, cache_size >> 10, info.ways);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431}
432
433/*
434 * Get CPU information for use by the procfs.
435 */
436static int show_cpuinfo(struct seq_file *m, void *v)
437{
Paul Mundt11c19652006-12-25 10:19:56 +0900438 struct sh_cpuinfo *c = v;
439 unsigned int cpu = c - cpu_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440
Paul Mundt11c19652006-12-25 10:19:56 +0900441 if (!cpu_online(cpu))
442 return 0;
443
444 if (cpu == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 seq_printf(m, "machine\t\t: %s\n", get_system_type());
446
447 seq_printf(m, "processor\t: %d\n", cpu);
Serge E. Hallyn96b644b2006-10-02 02:18:13 -0700448 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
Paul Mundt11c19652006-12-25 10:19:56 +0900449 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
Paul Mundt11c19652006-12-25 10:19:56 +0900451 show_cpuflags(m, c);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452
453 seq_printf(m, "cache type\t: ");
454
455 /*
456 * Check for what type of cache we have, we support both the
457 * unified cache on the SH-2 and SH-3, as well as the harvard
458 * style cache on the SH-4.
459 */
Paul Mundt11c19652006-12-25 10:19:56 +0900460 if (c->icache.flags & SH_CACHE_COMBINED) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 seq_printf(m, "unified\n");
Paul Mundt11c19652006-12-25 10:19:56 +0900462 show_cacheinfo(m, "cache", c->icache);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463 } else {
464 seq_printf(m, "split (harvard)\n");
Paul Mundt11c19652006-12-25 10:19:56 +0900465 show_cacheinfo(m, "icache", c->icache);
466 show_cacheinfo(m, "dcache", c->dcache);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 }
468
Paul Mundt72c35542006-09-27 18:27:43 +0900469 /* Optional secondary cache */
Paul Mundt11c19652006-12-25 10:19:56 +0900470 if (c->flags & CPU_HAS_L2_CACHE)
471 show_cacheinfo(m, "scache", c->scache);
Paul Mundt72c35542006-09-27 18:27:43 +0900472
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473 seq_printf(m, "bogomips\t: %lu.%02lu\n",
Paul Mundt11c19652006-12-25 10:19:56 +0900474 c->loops_per_jiffy/(500000/HZ),
475 (c->loops_per_jiffy/(5000/HZ)) % 100);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700476
Paul Mundtde027972006-02-01 03:06:02 -0800477 return show_clocks(m);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478}
479
Linus Torvalds1da177e2005-04-16 15:20:36 -0700480static void *c_start(struct seq_file *m, loff_t *pos)
481{
482 return *pos < NR_CPUS ? cpu_data + *pos : NULL;
483}
484static void *c_next(struct seq_file *m, void *v, loff_t *pos)
485{
486 ++*pos;
487 return c_start(m, pos);
488}
489static void c_stop(struct seq_file *m, void *v)
490{
491}
492struct seq_operations cpuinfo_op = {
493 .start = c_start,
494 .next = c_next,
495 .stop = c_stop,
496 .show = show_cpuinfo,
497};
498#endif /* CONFIG_PROC_FS */