setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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_SMP
  267. extern char _SecondaryResetVector_text_start;
  268. extern char _SecondaryResetVector_text_end;
  269. #endif
  270. #ifdef CONFIG_S32C1I_SELFTEST
  271. #if XCHAL_HAVE_S32C1I
  272. static int __initdata rcw_word, rcw_probe_pc, rcw_exc;
  273. /*
  274. * Basic atomic compare-and-swap, that records PC of S32C1I for probing.
  275. *
  276. * If *v == cmp, set *v = set. Return previous *v.
  277. */
  278. static inline int probed_compare_swap(int *v, int cmp, int set)
  279. {
  280. int tmp;
  281. __asm__ __volatile__(
  282. " movi %1, 1f\n"
  283. " s32i %1, %4, 0\n"
  284. " wsr %2, scompare1\n"
  285. "1: s32c1i %0, %3, 0\n"
  286. : "=a" (set), "=&a" (tmp)
  287. : "a" (cmp), "a" (v), "a" (&rcw_probe_pc), "0" (set)
  288. : "memory"
  289. );
  290. return set;
  291. }
  292. /* Handle probed exception */
  293. static void __init do_probed_exception(struct pt_regs *regs,
  294. unsigned long exccause)
  295. {
  296. if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
  297. regs->pc += 3; /* skip the s32c1i instruction */
  298. rcw_exc = exccause;
  299. } else {
  300. do_unhandled(regs, exccause);
  301. }
  302. }
  303. /* Simple test of S32C1I (soc bringup assist) */
  304. static int __init check_s32c1i(void)
  305. {
  306. int n, cause1, cause2;
  307. void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
  308. rcw_probe_pc = 0;
  309. handbus = trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR,
  310. do_probed_exception);
  311. handdata = trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR,
  312. do_probed_exception);
  313. handaddr = trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR,
  314. do_probed_exception);
  315. /* First try an S32C1I that does not store: */
  316. rcw_exc = 0;
  317. rcw_word = 1;
  318. n = probed_compare_swap(&rcw_word, 0, 2);
  319. cause1 = rcw_exc;
  320. /* took exception? */
  321. if (cause1 != 0) {
  322. /* unclean exception? */
  323. if (n != 2 || rcw_word != 1)
  324. panic("S32C1I exception error");
  325. } else if (rcw_word != 1 || n != 1) {
  326. panic("S32C1I compare error");
  327. }
  328. /* Then an S32C1I that stores: */
  329. rcw_exc = 0;
  330. rcw_word = 0x1234567;
  331. n = probed_compare_swap(&rcw_word, 0x1234567, 0xabcde);
  332. cause2 = rcw_exc;
  333. if (cause2 != 0) {
  334. /* unclean exception? */
  335. if (n != 0xabcde || rcw_word != 0x1234567)
  336. panic("S32C1I exception error (b)");
  337. } else if (rcw_word != 0xabcde || n != 0x1234567) {
  338. panic("S32C1I store error");
  339. }
  340. /* Verify consistency of exceptions: */
  341. if (cause1 || cause2) {
  342. pr_warn("S32C1I took exception %d, %d\n", cause1, cause2);
  343. /* If emulation of S32C1I upon bus error gets implemented,
  344. we can get rid of this panic for single core (not SMP) */
  345. panic("S32C1I exceptions not currently supported");
  346. }
  347. if (cause1 != cause2)
  348. panic("inconsistent S32C1I exceptions");
  349. trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
  350. trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
  351. trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
  352. return 0;
  353. }
  354. #else /* XCHAL_HAVE_S32C1I */
  355. /* This condition should not occur with a commercially deployed processor.
  356. Display reminder for early engr test or demo chips / FPGA bitstreams */
  357. static int __init check_s32c1i(void)
  358. {
  359. pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
  360. return 0;
  361. }
  362. #endif /* XCHAL_HAVE_S32C1I */
  363. early_initcall(check_s32c1i);
  364. #endif /* CONFIG_S32C1I_SELFTEST */
  365. void __init setup_arch(char **cmdline_p)
  366. {
  367. strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  368. *cmdline_p = command_line;
  369. /* Reserve some memory regions */
  370. #ifdef CONFIG_BLK_DEV_INITRD
  371. if (initrd_start < initrd_end) {
  372. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  373. __pa(initrd_end), 0) == 0;
  374. initrd_below_start_ok = 1;
  375. } else {
  376. initrd_start = 0;
  377. }
  378. #endif
  379. mem_reserve(__pa(&_stext),__pa(&_end), 1);
  380. mem_reserve(__pa(&_WindowVectors_text_start),
  381. __pa(&_WindowVectors_text_end), 0);
  382. mem_reserve(__pa(&_DebugInterruptVector_literal_start),
  383. __pa(&_DebugInterruptVector_text_end), 0);
  384. mem_reserve(__pa(&_KernelExceptionVector_literal_start),
  385. __pa(&_KernelExceptionVector_text_end), 0);
  386. mem_reserve(__pa(&_UserExceptionVector_literal_start),
  387. __pa(&_UserExceptionVector_text_end), 0);
  388. mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
  389. __pa(&_DoubleExceptionVector_text_end), 0);
  390. #if XCHAL_EXCM_LEVEL >= 2
  391. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  392. __pa(&_Level2InterruptVector_text_end), 0);
  393. #endif
  394. #if XCHAL_EXCM_LEVEL >= 3
  395. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  396. __pa(&_Level3InterruptVector_text_end), 0);
  397. #endif
  398. #if XCHAL_EXCM_LEVEL >= 4
  399. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  400. __pa(&_Level4InterruptVector_text_end), 0);
  401. #endif
  402. #if XCHAL_EXCM_LEVEL >= 5
  403. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  404. __pa(&_Level5InterruptVector_text_end), 0);
  405. #endif
  406. #if XCHAL_EXCM_LEVEL >= 6
  407. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  408. __pa(&_Level6InterruptVector_text_end), 0);
  409. #endif
  410. #ifdef CONFIG_SMP
  411. mem_reserve(__pa(&_SecondaryResetVector_text_start),
  412. __pa(&_SecondaryResetVector_text_end), 0);
  413. #endif
  414. parse_early_param();
  415. bootmem_init();
  416. unflatten_and_copy_device_tree();
  417. platform_setup(cmdline_p);
  418. #ifdef CONFIG_SMP
  419. smp_init_cpus();
  420. #endif
  421. paging_init();
  422. zones_init();
  423. #ifdef CONFIG_VT
  424. # if defined(CONFIG_VGA_CONSOLE)
  425. conswitchp = &vga_con;
  426. # elif defined(CONFIG_DUMMY_CONSOLE)
  427. conswitchp = &dummy_con;
  428. # endif
  429. #endif
  430. #ifdef CONFIG_PCI
  431. platform_pcibios_init();
  432. #endif
  433. }
  434. static DEFINE_PER_CPU(struct cpu, cpu_data);
  435. static int __init topology_init(void)
  436. {
  437. int i;
  438. for_each_possible_cpu(i) {
  439. struct cpu *cpu = &per_cpu(cpu_data, i);
  440. cpu->hotpluggable = !!i;
  441. register_cpu(cpu, i);
  442. }
  443. return 0;
  444. }
  445. subsys_initcall(topology_init);
  446. void machine_restart(char * cmd)
  447. {
  448. platform_restart();
  449. }
  450. void machine_halt(void)
  451. {
  452. platform_halt();
  453. while (1);
  454. }
  455. void machine_power_off(void)
  456. {
  457. platform_power_off();
  458. while (1);
  459. }
  460. #ifdef CONFIG_PROC_FS
  461. /*
  462. * Display some core information through /proc/cpuinfo.
  463. */
  464. static int
  465. c_show(struct seq_file *f, void *slot)
  466. {
  467. /* high-level stuff */
  468. seq_printf(f, "CPU count\t: %u\n"
  469. "CPU list\t: %*pbl\n"
  470. "vendor_id\t: Tensilica\n"
  471. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  472. "core ID\t\t: " XCHAL_CORE_ID "\n"
  473. "build ID\t: 0x%x\n"
  474. "byte order\t: %s\n"
  475. "cpu MHz\t\t: %lu.%02lu\n"
  476. "bogomips\t: %lu.%02lu\n",
  477. num_online_cpus(),
  478. cpumask_pr_args(cpu_online_mask),
  479. XCHAL_BUILD_UNIQUE_ID,
  480. XCHAL_HAVE_BE ? "big" : "little",
  481. ccount_freq/1000000,
  482. (ccount_freq/10000) % 100,
  483. loops_per_jiffy/(500000/HZ),
  484. (loops_per_jiffy/(5000/HZ)) % 100);
  485. seq_printf(f,"flags\t\t: "
  486. #if XCHAL_HAVE_NMI
  487. "nmi "
  488. #endif
  489. #if XCHAL_HAVE_DEBUG
  490. "debug "
  491. # if XCHAL_HAVE_OCD
  492. "ocd "
  493. # endif
  494. #endif
  495. #if XCHAL_HAVE_DENSITY
  496. "density "
  497. #endif
  498. #if XCHAL_HAVE_BOOLEANS
  499. "boolean "
  500. #endif
  501. #if XCHAL_HAVE_LOOPS
  502. "loop "
  503. #endif
  504. #if XCHAL_HAVE_NSA
  505. "nsa "
  506. #endif
  507. #if XCHAL_HAVE_MINMAX
  508. "minmax "
  509. #endif
  510. #if XCHAL_HAVE_SEXT
  511. "sext "
  512. #endif
  513. #if XCHAL_HAVE_CLAMPS
  514. "clamps "
  515. #endif
  516. #if XCHAL_HAVE_MAC16
  517. "mac16 "
  518. #endif
  519. #if XCHAL_HAVE_MUL16
  520. "mul16 "
  521. #endif
  522. #if XCHAL_HAVE_MUL32
  523. "mul32 "
  524. #endif
  525. #if XCHAL_HAVE_MUL32_HIGH
  526. "mul32h "
  527. #endif
  528. #if XCHAL_HAVE_FP
  529. "fpu "
  530. #endif
  531. #if XCHAL_HAVE_S32C1I
  532. "s32c1i "
  533. #endif
  534. "\n");
  535. /* Registers. */
  536. seq_printf(f,"physical aregs\t: %d\n"
  537. "misc regs\t: %d\n"
  538. "ibreak\t\t: %d\n"
  539. "dbreak\t\t: %d\n",
  540. XCHAL_NUM_AREGS,
  541. XCHAL_NUM_MISC_REGS,
  542. XCHAL_NUM_IBREAK,
  543. XCHAL_NUM_DBREAK);
  544. /* Interrupt. */
  545. seq_printf(f,"num ints\t: %d\n"
  546. "ext ints\t: %d\n"
  547. "int levels\t: %d\n"
  548. "timers\t\t: %d\n"
  549. "debug level\t: %d\n",
  550. XCHAL_NUM_INTERRUPTS,
  551. XCHAL_NUM_EXTINTERRUPTS,
  552. XCHAL_NUM_INTLEVELS,
  553. XCHAL_NUM_TIMERS,
  554. XCHAL_DEBUGLEVEL);
  555. /* Cache */
  556. seq_printf(f,"icache line size: %d\n"
  557. "icache ways\t: %d\n"
  558. "icache size\t: %d\n"
  559. "icache flags\t: "
  560. #if XCHAL_ICACHE_LINE_LOCKABLE
  561. "lock "
  562. #endif
  563. "\n"
  564. "dcache line size: %d\n"
  565. "dcache ways\t: %d\n"
  566. "dcache size\t: %d\n"
  567. "dcache flags\t: "
  568. #if XCHAL_DCACHE_IS_WRITEBACK
  569. "writeback "
  570. #endif
  571. #if XCHAL_DCACHE_LINE_LOCKABLE
  572. "lock "
  573. #endif
  574. "\n",
  575. XCHAL_ICACHE_LINESIZE,
  576. XCHAL_ICACHE_WAYS,
  577. XCHAL_ICACHE_SIZE,
  578. XCHAL_DCACHE_LINESIZE,
  579. XCHAL_DCACHE_WAYS,
  580. XCHAL_DCACHE_SIZE);
  581. return 0;
  582. }
  583. /*
  584. * We show only CPU #0 info.
  585. */
  586. static void *
  587. c_start(struct seq_file *f, loff_t *pos)
  588. {
  589. return (*pos == 0) ? (void *)1 : NULL;
  590. }
  591. static void *
  592. c_next(struct seq_file *f, void *v, loff_t *pos)
  593. {
  594. return NULL;
  595. }
  596. static void
  597. c_stop(struct seq_file *f, void *v)
  598. {
  599. }
  600. const struct seq_operations cpuinfo_op =
  601. {
  602. .start = c_start,
  603. .next = c_next,
  604. .stop = c_stop,
  605. .show = c_show,
  606. };
  607. #endif /* CONFIG_PROC_FS */