blob: 24c1a57abb40b6446951438614a29e805f93c1f4 [file] [log] [blame]
Chris Zankel5a0015d2005-06-23 22:01:16 -07001/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02002 * arch/xtensa/kernel/setup.c
Chris Zankel5a0015d2005-06-23 22:01:16 -07003 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1995 Linus Torvalds
9 * Copyright (C) 2001 - 2005 Tensilica Inc.
10 *
11 * Chris Zankel <chris@zankel.net>
12 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
13 * Kevin Chea
14 * Marc Gauthier<marc@tensilica.com> <marc@alumni.uwaterloo.ca>
15 */
16
Chris Zankel5a0015d2005-06-23 22:01:16 -070017#include <linux/errno.h>
18#include <linux/init.h>
Andrea Righi27ac7922008-07-23 21:28:13 -070019#include <linux/mm.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070020#include <linux/proc_fs.h>
Jon Smirl894673e2006-07-10 04:44:13 -070021#include <linux/screen_info.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070022#include <linux/bootmem.h>
23#include <linux/kernel.h>
24
Max Filippovda844a82012-11-04 00:30:13 +040025#ifdef CONFIG_OF
26#include <linux/of_fdt.h>
27#include <linux/of_platform.h>
28#endif
29
Chris Zankel5a0015d2005-06-23 22:01:16 -070030#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
31# include <linux/console.h>
32#endif
33
34#ifdef CONFIG_RTC
35# include <linux/timex.h>
36#endif
37
38#ifdef CONFIG_PROC_FS
39# include <linux/seq_file.h>
40#endif
41
Chris Zankel5a0015d2005-06-23 22:01:16 -070042#include <asm/bootparam.h>
43#include <asm/pgtable.h>
44#include <asm/processor.h>
45#include <asm/timex.h>
46#include <asm/platform.h>
47#include <asm/page.h>
48#include <asm/setup.h>
Chris Zankelde4f6e52007-05-31 17:47:01 -070049#include <asm/param.h>
Max Filippov00273122012-11-28 11:33:02 +040050#include <asm/traps.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070051
Alexey Dobriyan5a891ed2009-03-10 12:55:49 -070052#include <platform/hardware.h>
53
Chris Zankel5a0015d2005-06-23 22:01:16 -070054#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
55struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};
56#endif
57
58#ifdef CONFIG_BLK_DEV_FD
59extern struct fd_ops no_fd_ops;
60struct fd_ops *fd_ops;
61#endif
62
Chris Zankel5a0015d2005-06-23 22:01:16 -070063extern struct rtc_ops no_rtc_ops;
64struct rtc_ops *rtc_ops;
65
Chris Zankel5a0015d2005-06-23 22:01:16 -070066#ifdef CONFIG_BLK_DEV_INITRD
67extern void *initrd_start;
68extern void *initrd_end;
Chris Zankel5a0015d2005-06-23 22:01:16 -070069int initrd_is_mapped = 0;
70extern int initrd_below_start_ok;
71#endif
72
Max Filippovda844a82012-11-04 00:30:13 +040073#ifdef CONFIG_OF
74extern u32 __dtb_start[];
75void *dtb_start = __dtb_start;
76#endif
77
Chris Zankel5a0015d2005-06-23 22:01:16 -070078unsigned char aux_device_present;
79extern unsigned long loops_per_jiffy;
80
81/* Command line specified as configuration option. */
82
Alon Bar-Levd3e9cce2007-02-12 00:54:25 -080083static char __initdata command_line[COMMAND_LINE_SIZE];
Chris Zankel5a0015d2005-06-23 22:01:16 -070084
85#ifdef CONFIG_CMDLINE_BOOL
86static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
87#endif
88
89sysmem_info_t __initdata sysmem;
90
Johannes Weinere5083a62009-03-04 16:21:31 +010091#ifdef CONFIG_MMU
Chris Zankel5a0015d2005-06-23 22:01:16 -070092extern void init_mmu(void);
Johannes Weinere5083a62009-03-04 16:21:31 +010093#else
94static inline void init_mmu(void) { }
95#endif
96
Max Filippovda844a82012-11-04 00:30:13 +040097extern int mem_reserve(unsigned long, unsigned long, int);
98extern void bootmem_init(void);
Johannes Weinere5083a62009-03-04 16:21:31 +010099extern void zones_init(void);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700100
101/*
102 * Boot parameter parsing.
103 *
104 * The Xtensa port uses a list of variable-sized tags to pass data to
105 * the kernel. The first tag must be a BP_TAG_FIRST tag for the list
106 * to be recognised. The list is terminated with a zero-sized
107 * BP_TAG_LAST tag.
108 */
109
110typedef struct tagtable {
111 u32 tag;
112 int (*parse)(const bp_tag_t*);
113} tagtable_t;
114
115#define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \
Max Filippovf4349b62012-10-15 03:55:37 +0400116 __attribute__((used, section(".taglist"))) = { tag, fn }
Chris Zankel5a0015d2005-06-23 22:01:16 -0700117
118/* parse current tag */
119
Max Filippovda844a82012-11-04 00:30:13 +0400120static int __init add_sysmem_bank(unsigned long type, unsigned long start,
121 unsigned long end)
122{
123 if (sysmem.nr_banks >= SYSMEM_BANKS_MAX) {
124 printk(KERN_WARNING
125 "Ignoring memory bank 0x%08lx size %ldKB\n",
126 start, end - start);
127 return -EINVAL;
128 }
129 sysmem.bank[sysmem.nr_banks].type = type;
130 sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(start);
131 sysmem.bank[sysmem.nr_banks].end = end & PAGE_MASK;
132 sysmem.nr_banks++;
133
134 return 0;
135}
136
Chris Zankel5a0015d2005-06-23 22:01:16 -0700137static int __init parse_tag_mem(const bp_tag_t *tag)
138{
Max Filippovda844a82012-11-04 00:30:13 +0400139 meminfo_t *mi = (meminfo_t *)(tag->data);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700140
141 if (mi->type != MEMORY_TYPE_CONVENTIONAL)
142 return -1;
143
Max Filippovda844a82012-11-04 00:30:13 +0400144 return add_sysmem_bank(mi->type, mi->start, mi->end);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700145}
146
147__tagtable(BP_TAG_MEMORY, parse_tag_mem);
148
149#ifdef CONFIG_BLK_DEV_INITRD
150
151static int __init parse_tag_initrd(const bp_tag_t* tag)
152{
153 meminfo_t* mi;
154 mi = (meminfo_t*)(tag->data);
155 initrd_start = (void*)(mi->start);
156 initrd_end = (void*)(mi->end);
157
158 return 0;
159}
160
161__tagtable(BP_TAG_INITRD, parse_tag_initrd);
162
Max Filippovda844a82012-11-04 00:30:13 +0400163#ifdef CONFIG_OF
164
165static int __init parse_tag_fdt(const bp_tag_t *tag)
166{
167 dtb_start = (void *)(tag->data[0]);
168 return 0;
169}
170
171__tagtable(BP_TAG_FDT, parse_tag_fdt);
172
173void __init early_init_dt_setup_initrd_arch(unsigned long start,
174 unsigned long end)
175{
176 initrd_start = (void *)__va(start);
177 initrd_end = (void *)__va(end);
178 initrd_below_start_ok = 1;
179}
180
181#endif /* CONFIG_OF */
182
Chris Zankel5a0015d2005-06-23 22:01:16 -0700183#endif /* CONFIG_BLK_DEV_INITRD */
184
185static int __init parse_tag_cmdline(const bp_tag_t* tag)
186{
Max Filippovda844a82012-11-04 00:30:13 +0400187 strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700188 return 0;
189}
190
191__tagtable(BP_TAG_COMMAND_LINE, parse_tag_cmdline);
192
193static int __init parse_bootparam(const bp_tag_t* tag)
194{
195 extern tagtable_t __tagtable_begin, __tagtable_end;
196 tagtable_t *t;
197
198 /* Boot parameters must start with a BP_TAG_FIRST tag. */
199
200 if (tag->id != BP_TAG_FIRST) {
201 printk(KERN_WARNING "Invalid boot parameters!\n");
202 return 0;
203 }
204
205 tag = (bp_tag_t*)((unsigned long)tag + sizeof(bp_tag_t) + tag->size);
206
207 /* Parse all tags. */
208
209 while (tag != NULL && tag->id != BP_TAG_LAST) {
210 for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
211 if (tag->id == t->tag) {
212 t->parse(tag);
213 break;
214 }
215 }
216 if (t == &__tagtable_end)
217 printk(KERN_WARNING "Ignoring tag "
218 "0x%08x\n", tag->id);
219 tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
220 }
221
222 return 0;
223}
224
Max Filippovda844a82012-11-04 00:30:13 +0400225#ifdef CONFIG_OF
226
227void __init early_init_dt_add_memory_arch(u64 base, u64 size)
228{
229 size &= PAGE_MASK;
230 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
231}
232
233void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
234{
235 return __alloc_bootmem(size, align, 0);
236}
237
238void __init early_init_devtree(void *params)
239{
240 /* Setup flat device-tree pointer */
241 initial_boot_params = params;
242
243 /* Retrieve various informations from the /chosen node of the
244 * device-tree, including the platform type, initrd location and
245 * size, TCE reserve, and more ...
246 */
247 if (!command_line[0])
248 of_scan_flat_dt(early_init_dt_scan_chosen, command_line);
249
250 /* Scan memory nodes and rebuild MEMBLOCKs */
251 of_scan_flat_dt(early_init_dt_scan_root, NULL);
252 if (sysmem.nr_banks == 0)
253 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
254}
255
256static void __init copy_devtree(void)
257{
258 void *alloc = early_init_dt_alloc_memory_arch(
259 be32_to_cpu(initial_boot_params->totalsize), 0);
260 if (alloc) {
261 memcpy(alloc, initial_boot_params,
262 be32_to_cpu(initial_boot_params->totalsize));
263 initial_boot_params = alloc;
264 }
265}
266
267static int __init xtensa_device_probe(void)
268{
269 of_platform_populate(NULL, NULL, NULL, NULL);
270 return 0;
271}
272
273device_initcall(xtensa_device_probe);
274
275#endif /* CONFIG_OF */
276
Chris Zankel5a0015d2005-06-23 22:01:16 -0700277/*
278 * Initialize architecture. (Early stage)
279 */
280
281void __init init_arch(bp_tag_t *bp_start)
282{
Chris Zankel5a0015d2005-06-23 22:01:16 -0700283 sysmem.nr_banks = 0;
284
Chris Zankel5a0015d2005-06-23 22:01:16 -0700285 /* Parse boot parameters */
286
Chris Zankelc4c45942012-11-28 16:53:51 -0800287 if (bp_start)
Max Filippovda844a82012-11-04 00:30:13 +0400288 parse_bootparam(bp_start);
289
290#ifdef CONFIG_OF
291 early_init_devtree(dtb_start);
292#endif
Chris Zankel5a0015d2005-06-23 22:01:16 -0700293
294 if (sysmem.nr_banks == 0) {
295 sysmem.nr_banks = 1;
296 sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;
297 sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START
298 + PLATFORM_DEFAULT_MEM_SIZE;
299 }
300
Max Filippovda844a82012-11-04 00:30:13 +0400301#ifdef CONFIG_CMDLINE_BOOL
302 if (!command_line[0])
303 strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
304#endif
305
Chris Zankel5a0015d2005-06-23 22:01:16 -0700306 /* Early hook for platforms */
307
308 platform_init(bp_start);
309
310 /* Initialize MMU. */
311
312 init_mmu();
313}
314
315/*
316 * Initialize system. Setup memory and reserve regions.
317 */
318
319extern char _end;
320extern char _stext;
321extern char _WindowVectors_text_start;
322extern char _WindowVectors_text_end;
323extern char _DebugInterruptVector_literal_start;
324extern char _DebugInterruptVector_text_end;
325extern char _KernelExceptionVector_literal_start;
326extern char _KernelExceptionVector_text_end;
327extern char _UserExceptionVector_literal_start;
328extern char _UserExceptionVector_text_end;
329extern char _DoubleExceptionVector_literal_start;
330extern char _DoubleExceptionVector_text_end;
331
Max Filippov00273122012-11-28 11:33:02 +0400332
333#ifdef CONFIG_S32C1I_SELFTEST
334#if XCHAL_HAVE_S32C1I
335
336static int __initdata rcw_word, rcw_probe_pc, rcw_exc;
337
338/*
339 * Basic atomic compare-and-swap, that records PC of S32C1I for probing.
340 *
341 * If *v == cmp, set *v = set. Return previous *v.
342 */
343static inline int probed_compare_swap(int *v, int cmp, int set)
344{
345 int tmp;
346
347 __asm__ __volatile__(
348 " movi %1, 1f\n"
349 " s32i %1, %4, 0\n"
350 " wsr %2, scompare1\n"
351 "1: s32c1i %0, %3, 0\n"
352 : "=a" (set), "=&a" (tmp)
353 : "a" (cmp), "a" (v), "a" (&rcw_probe_pc), "0" (set)
354 : "memory"
355 );
356 return set;
357}
358
359/* Handle probed exception */
360
361void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause)
362{
363 if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
364 regs->pc += 3; /* skip the s32c1i instruction */
365 rcw_exc = exccause;
366 } else {
367 do_unhandled(regs, exccause);
368 }
369}
370
371/* Simple test of S32C1I (soc bringup assist) */
372
373void __init check_s32c1i(void)
374{
375 int n, cause1, cause2;
376 void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
377
378 rcw_probe_pc = 0;
379 handbus = trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR,
380 do_probed_exception);
381 handdata = trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR,
382 do_probed_exception);
383 handaddr = trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR,
384 do_probed_exception);
385
386 /* First try an S32C1I that does not store: */
387 rcw_exc = 0;
388 rcw_word = 1;
389 n = probed_compare_swap(&rcw_word, 0, 2);
390 cause1 = rcw_exc;
391
392 /* took exception? */
393 if (cause1 != 0) {
394 /* unclean exception? */
395 if (n != 2 || rcw_word != 1)
396 panic("S32C1I exception error");
397 } else if (rcw_word != 1 || n != 1) {
398 panic("S32C1I compare error");
399 }
400
401 /* Then an S32C1I that stores: */
402 rcw_exc = 0;
403 rcw_word = 0x1234567;
404 n = probed_compare_swap(&rcw_word, 0x1234567, 0xabcde);
405 cause2 = rcw_exc;
406
407 if (cause2 != 0) {
408 /* unclean exception? */
409 if (n != 0xabcde || rcw_word != 0x1234567)
410 panic("S32C1I exception error (b)");
411 } else if (rcw_word != 0xabcde || n != 0x1234567) {
412 panic("S32C1I store error");
413 }
414
415 /* Verify consistency of exceptions: */
416 if (cause1 || cause2) {
417 pr_warn("S32C1I took exception %d, %d\n", cause1, cause2);
418 /* If emulation of S32C1I upon bus error gets implemented,
419 we can get rid of this panic for single core (not SMP) */
420 panic("S32C1I exceptions not currently supported");
421 }
422 if (cause1 != cause2)
423 panic("inconsistent S32C1I exceptions");
424
425 trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
426 trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
427 trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
428}
429
430#else /* XCHAL_HAVE_S32C1I */
431
432/* This condition should not occur with a commercially deployed processor.
433 Display reminder for early engr test or demo chips / FPGA bitstreams */
434void __init check_s32c1i(void)
435{
436 pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
437}
438
439#endif /* XCHAL_HAVE_S32C1I */
440#else /* CONFIG_S32C1I_SELFTEST */
441
442void __init check_s32c1i(void)
443{
444}
445
446#endif /* CONFIG_S32C1I_SELFTEST */
447
448
Chris Zankel5a0015d2005-06-23 22:01:16 -0700449void __init setup_arch(char **cmdline_p)
450{
Max Filippovda844a82012-11-04 00:30:13 +0400451 strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700452 *cmdline_p = command_line;
453
Max Filippov00273122012-11-28 11:33:02 +0400454 check_s32c1i();
455
Chris Zankel5a0015d2005-06-23 22:01:16 -0700456 /* Reserve some memory regions */
457
458#ifdef CONFIG_BLK_DEV_INITRD
459 if (initrd_start < initrd_end) {
460 initrd_is_mapped = mem_reserve(__pa(initrd_start),
461 __pa(initrd_end), 0);
462 initrd_below_start_ok = 1;
Chris Zankelc4c45942012-11-28 16:53:51 -0800463 } else {
Chris Zankel5a0015d2005-06-23 22:01:16 -0700464 initrd_start = 0;
465 }
466#endif
467
468 mem_reserve(__pa(&_stext),__pa(&_end), 1);
469
470 mem_reserve(__pa(&_WindowVectors_text_start),
471 __pa(&_WindowVectors_text_end), 0);
472
473 mem_reserve(__pa(&_DebugInterruptVector_literal_start),
474 __pa(&_DebugInterruptVector_text_end), 0);
475
476 mem_reserve(__pa(&_KernelExceptionVector_literal_start),
477 __pa(&_KernelExceptionVector_text_end), 0);
478
479 mem_reserve(__pa(&_UserExceptionVector_literal_start),
480 __pa(&_UserExceptionVector_text_end), 0);
481
482 mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
483 __pa(&_DoubleExceptionVector_text_end), 0);
484
485 bootmem_init();
486
Max Filippovda844a82012-11-04 00:30:13 +0400487#ifdef CONFIG_OF
488 copy_devtree();
489 unflatten_device_tree();
490#endif
Chris Zankel5a0015d2005-06-23 22:01:16 -0700491
Max Filippovda844a82012-11-04 00:30:13 +0400492 platform_setup(cmdline_p);
Chris Zankel5a0015d2005-06-23 22:01:16 -0700493
494 paging_init();
Johannes Weinere5083a62009-03-04 16:21:31 +0100495 zones_init();
Chris Zankel5a0015d2005-06-23 22:01:16 -0700496
497#ifdef CONFIG_VT
498# if defined(CONFIG_VGA_CONSOLE)
499 conswitchp = &vga_con;
500# elif defined(CONFIG_DUMMY_CONSOLE)
501 conswitchp = &dummy_con;
502# endif
503#endif
504
Chris Zankel288a60c2005-09-22 21:44:23 -0700505#ifdef CONFIG_PCI
Chris Zankel5a0015d2005-06-23 22:01:16 -0700506 platform_pcibios_init();
507#endif
508}
509
510void machine_restart(char * cmd)
511{
512 platform_restart();
513}
514
515void machine_halt(void)
516{
517 platform_halt();
518 while (1);
519}
520
521void machine_power_off(void)
522{
523 platform_power_off();
524 while (1);
525}
526#ifdef CONFIG_PROC_FS
527
528/*
529 * Display some core information through /proc/cpuinfo.
530 */
531
532static int
533c_show(struct seq_file *f, void *slot)
534{
535 /* high-level stuff */
536 seq_printf(f,"processor\t: 0\n"
537 "vendor_id\t: Tensilica\n"
Chris Zankel173d6682006-12-10 02:18:48 -0800538 "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
Chris Zankel5a0015d2005-06-23 22:01:16 -0700539 "core ID\t\t: " XCHAL_CORE_ID "\n"
540 "build ID\t: 0x%x\n"
541 "byte order\t: %s\n"
Chris Zankelc4c45942012-11-28 16:53:51 -0800542 "cpu MHz\t\t: %lu.%02lu\n"
Chris Zankel5a0015d2005-06-23 22:01:16 -0700543 "bogomips\t: %lu.%02lu\n",
544 XCHAL_BUILD_UNIQUE_ID,
545 XCHAL_HAVE_BE ? "big" : "little",
546 CCOUNT_PER_JIFFY/(1000000/HZ),
547 (CCOUNT_PER_JIFFY/(10000/HZ)) % 100,
548 loops_per_jiffy/(500000/HZ),
549 (loops_per_jiffy/(5000/HZ)) % 100);
550
551 seq_printf(f,"flags\t\t: "
552#if XCHAL_HAVE_NMI
553 "nmi "
554#endif
555#if XCHAL_HAVE_DEBUG
556 "debug "
557# if XCHAL_HAVE_OCD
558 "ocd "
559# endif
560#endif
561#if XCHAL_HAVE_DENSITY
562 "density "
563#endif
564#if XCHAL_HAVE_BOOLEANS
565 "boolean "
566#endif
567#if XCHAL_HAVE_LOOPS
568 "loop "
569#endif
570#if XCHAL_HAVE_NSA
571 "nsa "
572#endif
573#if XCHAL_HAVE_MINMAX
574 "minmax "
575#endif
576#if XCHAL_HAVE_SEXT
577 "sext "
578#endif
579#if XCHAL_HAVE_CLAMPS
580 "clamps "
581#endif
582#if XCHAL_HAVE_MAC16
583 "mac16 "
584#endif
585#if XCHAL_HAVE_MUL16
586 "mul16 "
587#endif
588#if XCHAL_HAVE_MUL32
589 "mul32 "
590#endif
591#if XCHAL_HAVE_MUL32_HIGH
592 "mul32h "
593#endif
594#if XCHAL_HAVE_FP
595 "fpu "
596#endif
Max Filippov2f6ea6a2012-11-11 04:44:22 +0400597#if XCHAL_HAVE_S32C1I
598 "s32c1i "
599#endif
Chris Zankel5a0015d2005-06-23 22:01:16 -0700600 "\n");
601
602 /* Registers. */
603 seq_printf(f,"physical aregs\t: %d\n"
604 "misc regs\t: %d\n"
605 "ibreak\t\t: %d\n"
606 "dbreak\t\t: %d\n",
607 XCHAL_NUM_AREGS,
608 XCHAL_NUM_MISC_REGS,
609 XCHAL_NUM_IBREAK,
610 XCHAL_NUM_DBREAK);
611
612
613 /* Interrupt. */
614 seq_printf(f,"num ints\t: %d\n"
615 "ext ints\t: %d\n"
616 "int levels\t: %d\n"
617 "timers\t\t: %d\n"
618 "debug level\t: %d\n",
619 XCHAL_NUM_INTERRUPTS,
620 XCHAL_NUM_EXTINTERRUPTS,
621 XCHAL_NUM_INTLEVELS,
622 XCHAL_NUM_TIMERS,
623 XCHAL_DEBUGLEVEL);
624
Chris Zankel5a0015d2005-06-23 22:01:16 -0700625 /* Cache */
626 seq_printf(f,"icache line size: %d\n"
627 "icache ways\t: %d\n"
628 "icache size\t: %d\n"
629 "icache flags\t: "
630#if XCHAL_ICACHE_LINE_LOCKABLE
Max Filippov415217e2012-11-11 01:29:10 +0400631 "lock "
Chris Zankel5a0015d2005-06-23 22:01:16 -0700632#endif
633 "\n"
634 "dcache line size: %d\n"
635 "dcache ways\t: %d\n"
636 "dcache size\t: %d\n"
637 "dcache flags\t: "
638#if XCHAL_DCACHE_IS_WRITEBACK
Max Filippov415217e2012-11-11 01:29:10 +0400639 "writeback "
Chris Zankel5a0015d2005-06-23 22:01:16 -0700640#endif
641#if XCHAL_DCACHE_LINE_LOCKABLE
Max Filippov415217e2012-11-11 01:29:10 +0400642 "lock "
Chris Zankel5a0015d2005-06-23 22:01:16 -0700643#endif
644 "\n",
645 XCHAL_ICACHE_LINESIZE,
646 XCHAL_ICACHE_WAYS,
647 XCHAL_ICACHE_SIZE,
648 XCHAL_DCACHE_LINESIZE,
649 XCHAL_DCACHE_WAYS,
650 XCHAL_DCACHE_SIZE);
651
Chris Zankel5a0015d2005-06-23 22:01:16 -0700652 return 0;
653}
654
655/*
656 * We show only CPU #0 info.
657 */
658static void *
659c_start(struct seq_file *f, loff_t *pos)
660{
661 return (void *) ((*pos == 0) ? (void *)1 : NULL);
662}
663
664static void *
665c_next(struct seq_file *f, void *v, loff_t *pos)
666{
667 return NULL;
668}
669
670static void
671c_stop(struct seq_file *f, void *v)
672{
673}
674
Jan Engelhardt03a44822008-02-08 04:21:19 -0800675const struct seq_operations cpuinfo_op =
Chris Zankel5a0015d2005-06-23 22:01:16 -0700676{
677 start: c_start,
678 next: c_next,
679 stop: c_stop,
680 show: c_show
681};
682
683#endif /* CONFIG_PROC_FS */