setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. /*
  2. * arch/xtensa/kernel/setup.c
  3. *
  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. #include <linux/errno.h>
  17. #include <linux/init.h>
  18. #include <linux/mm.h>
  19. #include <linux/proc_fs.h>
  20. #include <linux/screen_info.h>
  21. #include <linux/bootmem.h>
  22. #include <linux/kernel.h>
  23. #ifdef CONFIG_OF
  24. #include <linux/of_fdt.h>
  25. #include <linux/of_platform.h>
  26. #endif
  27. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  28. # include <linux/console.h>
  29. #endif
  30. #ifdef CONFIG_RTC
  31. # include <linux/timex.h>
  32. #endif
  33. #ifdef CONFIG_PROC_FS
  34. # include <linux/seq_file.h>
  35. #endif
  36. #include <asm/bootparam.h>
  37. #include <asm/pgtable.h>
  38. #include <asm/processor.h>
  39. #include <asm/timex.h>
  40. #include <asm/platform.h>
  41. #include <asm/page.h>
  42. #include <asm/setup.h>
  43. #include <asm/param.h>
  44. #include <asm/traps.h>
  45. #include <platform/hardware.h>
  46. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  47. struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};
  48. #endif
  49. #ifdef CONFIG_BLK_DEV_FD
  50. extern struct fd_ops no_fd_ops;
  51. struct fd_ops *fd_ops;
  52. #endif
  53. extern struct rtc_ops no_rtc_ops;
  54. struct rtc_ops *rtc_ops;
  55. #ifdef CONFIG_BLK_DEV_INITRD
  56. extern void *initrd_start;
  57. extern void *initrd_end;
  58. int initrd_is_mapped = 0;
  59. extern int initrd_below_start_ok;
  60. #endif
  61. #ifdef CONFIG_OF
  62. extern u32 __dtb_start[];
  63. void *dtb_start = __dtb_start;
  64. #endif
  65. unsigned char aux_device_present;
  66. extern unsigned long loops_per_jiffy;
  67. /* Command line specified as configuration option. */
  68. static char __initdata command_line[COMMAND_LINE_SIZE];
  69. #ifdef CONFIG_CMDLINE_BOOL
  70. static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
  71. #endif
  72. sysmem_info_t __initdata sysmem;
  73. #ifdef CONFIG_MMU
  74. extern void init_mmu(void);
  75. #else
  76. static inline void init_mmu(void) { }
  77. #endif
  78. extern int mem_reserve(unsigned long, unsigned long, int);
  79. extern void bootmem_init(void);
  80. extern void zones_init(void);
  81. /*
  82. * Boot parameter parsing.
  83. *
  84. * The Xtensa port uses a list of variable-sized tags to pass data to
  85. * the kernel. The first tag must be a BP_TAG_FIRST tag for the list
  86. * to be recognised. The list is terminated with a zero-sized
  87. * BP_TAG_LAST tag.
  88. */
  89. typedef struct tagtable {
  90. u32 tag;
  91. int (*parse)(const bp_tag_t*);
  92. } tagtable_t;
  93. #define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \
  94. __attribute__((used, section(".taglist"))) = { tag, fn }
  95. /* parse current tag */
  96. static int __init add_sysmem_bank(unsigned long type, unsigned long start,
  97. unsigned long end)
  98. {
  99. if (sysmem.nr_banks >= SYSMEM_BANKS_MAX) {
  100. printk(KERN_WARNING
  101. "Ignoring memory bank 0x%08lx size %ldKB\n",
  102. start, end - start);
  103. return -EINVAL;
  104. }
  105. sysmem.bank[sysmem.nr_banks].type = type;
  106. sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(start);
  107. sysmem.bank[sysmem.nr_banks].end = end & PAGE_MASK;
  108. sysmem.nr_banks++;
  109. return 0;
  110. }
  111. static int __init parse_tag_mem(const bp_tag_t *tag)
  112. {
  113. meminfo_t *mi = (meminfo_t *)(tag->data);
  114. if (mi->type != MEMORY_TYPE_CONVENTIONAL)
  115. return -1;
  116. return add_sysmem_bank(mi->type, mi->start, mi->end);
  117. }
  118. __tagtable(BP_TAG_MEMORY, parse_tag_mem);
  119. #ifdef CONFIG_BLK_DEV_INITRD
  120. static int __init parse_tag_initrd(const bp_tag_t* tag)
  121. {
  122. meminfo_t* mi;
  123. mi = (meminfo_t*)(tag->data);
  124. initrd_start = (void*)(mi->start);
  125. initrd_end = (void*)(mi->end);
  126. return 0;
  127. }
  128. __tagtable(BP_TAG_INITRD, parse_tag_initrd);
  129. #ifdef CONFIG_OF
  130. static int __init parse_tag_fdt(const bp_tag_t *tag)
  131. {
  132. dtb_start = (void *)(tag->data[0]);
  133. return 0;
  134. }
  135. __tagtable(BP_TAG_FDT, parse_tag_fdt);
  136. void __init early_init_dt_setup_initrd_arch(unsigned long start,
  137. unsigned long end)
  138. {
  139. initrd_start = (void *)__va(start);
  140. initrd_end = (void *)__va(end);
  141. initrd_below_start_ok = 1;
  142. }
  143. #endif /* CONFIG_OF */
  144. #endif /* CONFIG_BLK_DEV_INITRD */
  145. static int __init parse_tag_cmdline(const bp_tag_t* tag)
  146. {
  147. strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
  148. return 0;
  149. }
  150. __tagtable(BP_TAG_COMMAND_LINE, parse_tag_cmdline);
  151. static int __init parse_bootparam(const bp_tag_t* tag)
  152. {
  153. extern tagtable_t __tagtable_begin, __tagtable_end;
  154. tagtable_t *t;
  155. /* Boot parameters must start with a BP_TAG_FIRST tag. */
  156. if (tag->id != BP_TAG_FIRST) {
  157. printk(KERN_WARNING "Invalid boot parameters!\n");
  158. return 0;
  159. }
  160. tag = (bp_tag_t*)((unsigned long)tag + sizeof(bp_tag_t) + tag->size);
  161. /* Parse all tags. */
  162. while (tag != NULL && tag->id != BP_TAG_LAST) {
  163. for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
  164. if (tag->id == t->tag) {
  165. t->parse(tag);
  166. break;
  167. }
  168. }
  169. if (t == &__tagtable_end)
  170. printk(KERN_WARNING "Ignoring tag "
  171. "0x%08x\n", tag->id);
  172. tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
  173. }
  174. return 0;
  175. }
  176. #ifdef CONFIG_OF
  177. void __init early_init_dt_add_memory_arch(u64 base, u64 size)
  178. {
  179. size &= PAGE_MASK;
  180. add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
  181. }
  182. void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
  183. {
  184. return __alloc_bootmem(size, align, 0);
  185. }
  186. void __init early_init_devtree(void *params)
  187. {
  188. /* Setup flat device-tree pointer */
  189. initial_boot_params = params;
  190. /* Retrieve various informations from the /chosen node of the
  191. * device-tree, including the platform type, initrd location and
  192. * size, TCE reserve, and more ...
  193. */
  194. if (!command_line[0])
  195. of_scan_flat_dt(early_init_dt_scan_chosen, command_line);
  196. /* Scan memory nodes and rebuild MEMBLOCKs */
  197. of_scan_flat_dt(early_init_dt_scan_root, NULL);
  198. if (sysmem.nr_banks == 0)
  199. of_scan_flat_dt(early_init_dt_scan_memory, NULL);
  200. }
  201. static void __init copy_devtree(void)
  202. {
  203. void *alloc = early_init_dt_alloc_memory_arch(
  204. be32_to_cpu(initial_boot_params->totalsize), 0);
  205. if (alloc) {
  206. memcpy(alloc, initial_boot_params,
  207. be32_to_cpu(initial_boot_params->totalsize));
  208. initial_boot_params = alloc;
  209. }
  210. }
  211. static int __init xtensa_device_probe(void)
  212. {
  213. of_platform_populate(NULL, NULL, NULL, NULL);
  214. return 0;
  215. }
  216. device_initcall(xtensa_device_probe);
  217. #endif /* CONFIG_OF */
  218. /*
  219. * Initialize architecture. (Early stage)
  220. */
  221. void __init init_arch(bp_tag_t *bp_start)
  222. {
  223. sysmem.nr_banks = 0;
  224. /* Parse boot parameters */
  225. if (bp_start)
  226. parse_bootparam(bp_start);
  227. #ifdef CONFIG_OF
  228. early_init_devtree(dtb_start);
  229. #endif
  230. if (sysmem.nr_banks == 0) {
  231. sysmem.nr_banks = 1;
  232. sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;
  233. sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START
  234. + PLATFORM_DEFAULT_MEM_SIZE;
  235. }
  236. #ifdef CONFIG_CMDLINE_BOOL
  237. if (!command_line[0])
  238. strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
  239. #endif
  240. /* Early hook for platforms */
  241. platform_init(bp_start);
  242. /* Initialize MMU. */
  243. init_mmu();
  244. }
  245. /*
  246. * Initialize system. Setup memory and reserve regions.
  247. */
  248. extern char _end;
  249. extern char _stext;
  250. extern char _WindowVectors_text_start;
  251. extern char _WindowVectors_text_end;
  252. extern char _DebugInterruptVector_literal_start;
  253. extern char _DebugInterruptVector_text_end;
  254. extern char _KernelExceptionVector_literal_start;
  255. extern char _KernelExceptionVector_text_end;
  256. extern char _UserExceptionVector_literal_start;
  257. extern char _UserExceptionVector_text_end;
  258. extern char _DoubleExceptionVector_literal_start;
  259. extern char _DoubleExceptionVector_text_end;
  260. #if XCHAL_EXCM_LEVEL >= 2
  261. extern char _Level2InterruptVector_text_start;
  262. extern char _Level2InterruptVector_text_end;
  263. #endif
  264. #if XCHAL_EXCM_LEVEL >= 3
  265. extern char _Level3InterruptVector_text_start;
  266. extern char _Level3InterruptVector_text_end;
  267. #endif
  268. #if XCHAL_EXCM_LEVEL >= 4
  269. extern char _Level4InterruptVector_text_start;
  270. extern char _Level4InterruptVector_text_end;
  271. #endif
  272. #if XCHAL_EXCM_LEVEL >= 5
  273. extern char _Level5InterruptVector_text_start;
  274. extern char _Level5InterruptVector_text_end;
  275. #endif
  276. #if XCHAL_EXCM_LEVEL >= 6
  277. extern char _Level6InterruptVector_text_start;
  278. extern char _Level6InterruptVector_text_end;
  279. #endif
  280. #ifdef CONFIG_S32C1I_SELFTEST
  281. #if XCHAL_HAVE_S32C1I
  282. static int __initdata rcw_word, rcw_probe_pc, rcw_exc;
  283. /*
  284. * Basic atomic compare-and-swap, that records PC of S32C1I for probing.
  285. *
  286. * If *v == cmp, set *v = set. Return previous *v.
  287. */
  288. static inline int probed_compare_swap(int *v, int cmp, int set)
  289. {
  290. int tmp;
  291. __asm__ __volatile__(
  292. " movi %1, 1f\n"
  293. " s32i %1, %4, 0\n"
  294. " wsr %2, scompare1\n"
  295. "1: s32c1i %0, %3, 0\n"
  296. : "=a" (set), "=&a" (tmp)
  297. : "a" (cmp), "a" (v), "a" (&rcw_probe_pc), "0" (set)
  298. : "memory"
  299. );
  300. return set;
  301. }
  302. /* Handle probed exception */
  303. void __init do_probed_exception(struct pt_regs *regs, unsigned long exccause)
  304. {
  305. if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
  306. regs->pc += 3; /* skip the s32c1i instruction */
  307. rcw_exc = exccause;
  308. } else {
  309. do_unhandled(regs, exccause);
  310. }
  311. }
  312. /* Simple test of S32C1I (soc bringup assist) */
  313. void __init check_s32c1i(void)
  314. {
  315. int n, cause1, cause2;
  316. void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
  317. rcw_probe_pc = 0;
  318. handbus = trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR,
  319. do_probed_exception);
  320. handdata = trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR,
  321. do_probed_exception);
  322. handaddr = trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR,
  323. do_probed_exception);
  324. /* First try an S32C1I that does not store: */
  325. rcw_exc = 0;
  326. rcw_word = 1;
  327. n = probed_compare_swap(&rcw_word, 0, 2);
  328. cause1 = rcw_exc;
  329. /* took exception? */
  330. if (cause1 != 0) {
  331. /* unclean exception? */
  332. if (n != 2 || rcw_word != 1)
  333. panic("S32C1I exception error");
  334. } else if (rcw_word != 1 || n != 1) {
  335. panic("S32C1I compare error");
  336. }
  337. /* Then an S32C1I that stores: */
  338. rcw_exc = 0;
  339. rcw_word = 0x1234567;
  340. n = probed_compare_swap(&rcw_word, 0x1234567, 0xabcde);
  341. cause2 = rcw_exc;
  342. if (cause2 != 0) {
  343. /* unclean exception? */
  344. if (n != 0xabcde || rcw_word != 0x1234567)
  345. panic("S32C1I exception error (b)");
  346. } else if (rcw_word != 0xabcde || n != 0x1234567) {
  347. panic("S32C1I store error");
  348. }
  349. /* Verify consistency of exceptions: */
  350. if (cause1 || cause2) {
  351. pr_warn("S32C1I took exception %d, %d\n", cause1, cause2);
  352. /* If emulation of S32C1I upon bus error gets implemented,
  353. we can get rid of this panic for single core (not SMP) */
  354. panic("S32C1I exceptions not currently supported");
  355. }
  356. if (cause1 != cause2)
  357. panic("inconsistent S32C1I exceptions");
  358. trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
  359. trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
  360. trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
  361. }
  362. #else /* XCHAL_HAVE_S32C1I */
  363. /* This condition should not occur with a commercially deployed processor.
  364. Display reminder for early engr test or demo chips / FPGA bitstreams */
  365. void __init check_s32c1i(void)
  366. {
  367. pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
  368. }
  369. #endif /* XCHAL_HAVE_S32C1I */
  370. #else /* CONFIG_S32C1I_SELFTEST */
  371. void __init check_s32c1i(void)
  372. {
  373. }
  374. #endif /* CONFIG_S32C1I_SELFTEST */
  375. void __init setup_arch(char **cmdline_p)
  376. {
  377. strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  378. *cmdline_p = command_line;
  379. check_s32c1i();
  380. /* Reserve some memory regions */
  381. #ifdef CONFIG_BLK_DEV_INITRD
  382. if (initrd_start < initrd_end) {
  383. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  384. __pa(initrd_end), 0);
  385. initrd_below_start_ok = 1;
  386. } else {
  387. initrd_start = 0;
  388. }
  389. #endif
  390. mem_reserve(__pa(&_stext),__pa(&_end), 1);
  391. mem_reserve(__pa(&_WindowVectors_text_start),
  392. __pa(&_WindowVectors_text_end), 0);
  393. mem_reserve(__pa(&_DebugInterruptVector_literal_start),
  394. __pa(&_DebugInterruptVector_text_end), 0);
  395. mem_reserve(__pa(&_KernelExceptionVector_literal_start),
  396. __pa(&_KernelExceptionVector_text_end), 0);
  397. mem_reserve(__pa(&_UserExceptionVector_literal_start),
  398. __pa(&_UserExceptionVector_text_end), 0);
  399. mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
  400. __pa(&_DoubleExceptionVector_text_end), 0);
  401. #if XCHAL_EXCM_LEVEL >= 2
  402. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  403. __pa(&_Level2InterruptVector_text_end), 0);
  404. #endif
  405. #if XCHAL_EXCM_LEVEL >= 3
  406. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  407. __pa(&_Level3InterruptVector_text_end), 0);
  408. #endif
  409. #if XCHAL_EXCM_LEVEL >= 4
  410. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  411. __pa(&_Level4InterruptVector_text_end), 0);
  412. #endif
  413. #if XCHAL_EXCM_LEVEL >= 5
  414. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  415. __pa(&_Level5InterruptVector_text_end), 0);
  416. #endif
  417. #if XCHAL_EXCM_LEVEL >= 6
  418. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  419. __pa(&_Level6InterruptVector_text_end), 0);
  420. #endif
  421. bootmem_init();
  422. #ifdef CONFIG_OF
  423. copy_devtree();
  424. unflatten_device_tree();
  425. #endif
  426. platform_setup(cmdline_p);
  427. paging_init();
  428. zones_init();
  429. #ifdef CONFIG_VT
  430. # if defined(CONFIG_VGA_CONSOLE)
  431. conswitchp = &vga_con;
  432. # elif defined(CONFIG_DUMMY_CONSOLE)
  433. conswitchp = &dummy_con;
  434. # endif
  435. #endif
  436. #ifdef CONFIG_PCI
  437. platform_pcibios_init();
  438. #endif
  439. }
  440. void machine_restart(char * cmd)
  441. {
  442. platform_restart();
  443. }
  444. void machine_halt(void)
  445. {
  446. platform_halt();
  447. while (1);
  448. }
  449. void machine_power_off(void)
  450. {
  451. platform_power_off();
  452. while (1);
  453. }
  454. #ifdef CONFIG_PROC_FS
  455. /*
  456. * Display some core information through /proc/cpuinfo.
  457. */
  458. static int
  459. c_show(struct seq_file *f, void *slot)
  460. {
  461. /* high-level stuff */
  462. seq_printf(f,"processor\t: 0\n"
  463. "vendor_id\t: Tensilica\n"
  464. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  465. "core ID\t\t: " XCHAL_CORE_ID "\n"
  466. "build ID\t: 0x%x\n"
  467. "byte order\t: %s\n"
  468. "cpu MHz\t\t: %lu.%02lu\n"
  469. "bogomips\t: %lu.%02lu\n",
  470. XCHAL_BUILD_UNIQUE_ID,
  471. XCHAL_HAVE_BE ? "big" : "little",
  472. CCOUNT_PER_JIFFY/(1000000/HZ),
  473. (CCOUNT_PER_JIFFY/(10000/HZ)) % 100,
  474. loops_per_jiffy/(500000/HZ),
  475. (loops_per_jiffy/(5000/HZ)) % 100);
  476. seq_printf(f,"flags\t\t: "
  477. #if XCHAL_HAVE_NMI
  478. "nmi "
  479. #endif
  480. #if XCHAL_HAVE_DEBUG
  481. "debug "
  482. # if XCHAL_HAVE_OCD
  483. "ocd "
  484. # endif
  485. #endif
  486. #if XCHAL_HAVE_DENSITY
  487. "density "
  488. #endif
  489. #if XCHAL_HAVE_BOOLEANS
  490. "boolean "
  491. #endif
  492. #if XCHAL_HAVE_LOOPS
  493. "loop "
  494. #endif
  495. #if XCHAL_HAVE_NSA
  496. "nsa "
  497. #endif
  498. #if XCHAL_HAVE_MINMAX
  499. "minmax "
  500. #endif
  501. #if XCHAL_HAVE_SEXT
  502. "sext "
  503. #endif
  504. #if XCHAL_HAVE_CLAMPS
  505. "clamps "
  506. #endif
  507. #if XCHAL_HAVE_MAC16
  508. "mac16 "
  509. #endif
  510. #if XCHAL_HAVE_MUL16
  511. "mul16 "
  512. #endif
  513. #if XCHAL_HAVE_MUL32
  514. "mul32 "
  515. #endif
  516. #if XCHAL_HAVE_MUL32_HIGH
  517. "mul32h "
  518. #endif
  519. #if XCHAL_HAVE_FP
  520. "fpu "
  521. #endif
  522. #if XCHAL_HAVE_S32C1I
  523. "s32c1i "
  524. #endif
  525. "\n");
  526. /* Registers. */
  527. seq_printf(f,"physical aregs\t: %d\n"
  528. "misc regs\t: %d\n"
  529. "ibreak\t\t: %d\n"
  530. "dbreak\t\t: %d\n",
  531. XCHAL_NUM_AREGS,
  532. XCHAL_NUM_MISC_REGS,
  533. XCHAL_NUM_IBREAK,
  534. XCHAL_NUM_DBREAK);
  535. /* Interrupt. */
  536. seq_printf(f,"num ints\t: %d\n"
  537. "ext ints\t: %d\n"
  538. "int levels\t: %d\n"
  539. "timers\t\t: %d\n"
  540. "debug level\t: %d\n",
  541. XCHAL_NUM_INTERRUPTS,
  542. XCHAL_NUM_EXTINTERRUPTS,
  543. XCHAL_NUM_INTLEVELS,
  544. XCHAL_NUM_TIMERS,
  545. XCHAL_DEBUGLEVEL);
  546. /* Cache */
  547. seq_printf(f,"icache line size: %d\n"
  548. "icache ways\t: %d\n"
  549. "icache size\t: %d\n"
  550. "icache flags\t: "
  551. #if XCHAL_ICACHE_LINE_LOCKABLE
  552. "lock "
  553. #endif
  554. "\n"
  555. "dcache line size: %d\n"
  556. "dcache ways\t: %d\n"
  557. "dcache size\t: %d\n"
  558. "dcache flags\t: "
  559. #if XCHAL_DCACHE_IS_WRITEBACK
  560. "writeback "
  561. #endif
  562. #if XCHAL_DCACHE_LINE_LOCKABLE
  563. "lock "
  564. #endif
  565. "\n",
  566. XCHAL_ICACHE_LINESIZE,
  567. XCHAL_ICACHE_WAYS,
  568. XCHAL_ICACHE_SIZE,
  569. XCHAL_DCACHE_LINESIZE,
  570. XCHAL_DCACHE_WAYS,
  571. XCHAL_DCACHE_SIZE);
  572. return 0;
  573. }
  574. /*
  575. * We show only CPU #0 info.
  576. */
  577. static void *
  578. c_start(struct seq_file *f, loff_t *pos)
  579. {
  580. return (void *) ((*pos == 0) ? (void *)1 : NULL);
  581. }
  582. static void *
  583. c_next(struct seq_file *f, void *v, loff_t *pos)
  584. {
  585. return NULL;
  586. }
  587. static void
  588. c_stop(struct seq_file *f, void *v)
  589. {
  590. }
  591. const struct seq_operations cpuinfo_op =
  592. {
  593. start: c_start,
  594. next: c_next,
  595. stop: c_stop,
  596. show: c_show
  597. };
  598. #endif /* CONFIG_PROC_FS */