setup.c 16 KB

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