setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  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. * Copyright (C) 2014 - 2016 Cadence Design Systems Inc.
  11. *
  12. * Chris Zankel <chris@zankel.net>
  13. * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
  14. * Kevin Chea
  15. * Marc Gauthier<marc@tensilica.com> <marc@alumni.uwaterloo.ca>
  16. */
  17. #include <linux/errno.h>
  18. #include <linux/init.h>
  19. #include <linux/mm.h>
  20. #include <linux/proc_fs.h>
  21. #include <linux/screen_info.h>
  22. #include <linux/bootmem.h>
  23. #include <linux/kernel.h>
  24. #include <linux/percpu.h>
  25. #include <linux/cpu.h>
  26. #include <linux/of.h>
  27. #include <linux/of_fdt.h>
  28. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  29. # include <linux/console.h>
  30. #endif
  31. #ifdef CONFIG_PROC_FS
  32. # include <linux/seq_file.h>
  33. #endif
  34. #include <asm/bootparam.h>
  35. #include <asm/mmu_context.h>
  36. #include <asm/pgtable.h>
  37. #include <asm/processor.h>
  38. #include <asm/timex.h>
  39. #include <asm/platform.h>
  40. #include <asm/page.h>
  41. #include <asm/setup.h>
  42. #include <asm/param.h>
  43. #include <asm/smp.h>
  44. #include <asm/sysmem.h>
  45. #include <platform/hardware.h>
  46. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  47. struct screen_info screen_info = {
  48. .orig_x = 0,
  49. .orig_y = 24,
  50. .orig_video_cols = 80,
  51. .orig_video_lines = 24,
  52. .orig_video_isVGA = 1,
  53. .orig_video_points = 16,
  54. };
  55. #endif
  56. #ifdef CONFIG_BLK_DEV_INITRD
  57. extern unsigned long initrd_start;
  58. extern unsigned long initrd_end;
  59. int initrd_is_mapped = 0;
  60. extern int initrd_below_start_ok;
  61. #endif
  62. #ifdef CONFIG_OF
  63. void *dtb_start = __dtb_start;
  64. #endif
  65. extern unsigned long loops_per_jiffy;
  66. /* Command line specified as configuration option. */
  67. static char __initdata command_line[COMMAND_LINE_SIZE];
  68. #ifdef CONFIG_CMDLINE_BOOL
  69. static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
  70. #endif
  71. /*
  72. * Boot parameter parsing.
  73. *
  74. * The Xtensa port uses a list of variable-sized tags to pass data to
  75. * the kernel. The first tag must be a BP_TAG_FIRST tag for the list
  76. * to be recognised. The list is terminated with a zero-sized
  77. * BP_TAG_LAST tag.
  78. */
  79. typedef struct tagtable {
  80. u32 tag;
  81. int (*parse)(const bp_tag_t*);
  82. } tagtable_t;
  83. #define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \
  84. __attribute__((used, section(".taglist"))) = { tag, fn }
  85. /* parse current tag */
  86. static int __init parse_tag_mem(const bp_tag_t *tag)
  87. {
  88. struct bp_meminfo *mi = (struct bp_meminfo *)(tag->data);
  89. if (mi->type != MEMORY_TYPE_CONVENTIONAL)
  90. return -1;
  91. return memblock_add(mi->start, mi->end - mi->start);
  92. }
  93. __tagtable(BP_TAG_MEMORY, parse_tag_mem);
  94. #ifdef CONFIG_BLK_DEV_INITRD
  95. static int __init parse_tag_initrd(const bp_tag_t* tag)
  96. {
  97. struct bp_meminfo *mi = (struct bp_meminfo *)(tag->data);
  98. initrd_start = (unsigned long)__va(mi->start);
  99. initrd_end = (unsigned long)__va(mi->end);
  100. return 0;
  101. }
  102. __tagtable(BP_TAG_INITRD, parse_tag_initrd);
  103. #ifdef CONFIG_OF
  104. static int __init parse_tag_fdt(const bp_tag_t *tag)
  105. {
  106. dtb_start = __va(tag->data[0]);
  107. return 0;
  108. }
  109. __tagtable(BP_TAG_FDT, parse_tag_fdt);
  110. #endif /* CONFIG_OF */
  111. #endif /* CONFIG_BLK_DEV_INITRD */
  112. static int __init parse_tag_cmdline(const bp_tag_t* tag)
  113. {
  114. strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
  115. return 0;
  116. }
  117. __tagtable(BP_TAG_COMMAND_LINE, parse_tag_cmdline);
  118. static int __init parse_bootparam(const bp_tag_t* tag)
  119. {
  120. extern tagtable_t __tagtable_begin, __tagtable_end;
  121. tagtable_t *t;
  122. /* Boot parameters must start with a BP_TAG_FIRST tag. */
  123. if (tag->id != BP_TAG_FIRST) {
  124. printk(KERN_WARNING "Invalid boot parameters!\n");
  125. return 0;
  126. }
  127. tag = (bp_tag_t*)((unsigned long)tag + sizeof(bp_tag_t) + tag->size);
  128. /* Parse all tags. */
  129. while (tag != NULL && tag->id != BP_TAG_LAST) {
  130. for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
  131. if (tag->id == t->tag) {
  132. t->parse(tag);
  133. break;
  134. }
  135. }
  136. if (t == &__tagtable_end)
  137. printk(KERN_WARNING "Ignoring tag "
  138. "0x%08x\n", tag->id);
  139. tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
  140. }
  141. return 0;
  142. }
  143. #ifdef CONFIG_OF
  144. #if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY
  145. unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
  146. EXPORT_SYMBOL(xtensa_kio_paddr);
  147. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  148. int depth, void *data)
  149. {
  150. const __be32 *ranges;
  151. int len;
  152. if (depth > 1)
  153. return 0;
  154. if (!of_flat_dt_is_compatible(node, "simple-bus"))
  155. return 0;
  156. ranges = of_get_flat_dt_prop(node, "ranges", &len);
  157. if (!ranges)
  158. return 1;
  159. if (len == 0)
  160. return 1;
  161. xtensa_kio_paddr = of_read_ulong(ranges+1, 1);
  162. /* round down to nearest 256MB boundary */
  163. xtensa_kio_paddr &= 0xf0000000;
  164. return 1;
  165. }
  166. #else
  167. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  168. int depth, void *data)
  169. {
  170. return 1;
  171. }
  172. #endif
  173. void __init early_init_dt_add_memory_arch(u64 base, u64 size)
  174. {
  175. size &= PAGE_MASK;
  176. memblock_add(base, size);
  177. }
  178. void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
  179. {
  180. return __alloc_bootmem(size, align, 0);
  181. }
  182. void __init early_init_devtree(void *params)
  183. {
  184. early_init_dt_scan(params);
  185. of_scan_flat_dt(xtensa_dt_io_area, NULL);
  186. if (!command_line[0])
  187. strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
  188. }
  189. #endif /* CONFIG_OF */
  190. /*
  191. * Initialize architecture. (Early stage)
  192. */
  193. void __init init_arch(bp_tag_t *bp_start)
  194. {
  195. /* Parse boot parameters */
  196. if (bp_start)
  197. parse_bootparam(bp_start);
  198. #ifdef CONFIG_OF
  199. early_init_devtree(dtb_start);
  200. #endif
  201. #ifdef CONFIG_CMDLINE_BOOL
  202. if (!command_line[0])
  203. strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
  204. #endif
  205. /* Early hook for platforms */
  206. platform_init(bp_start);
  207. /* Initialize MMU. */
  208. init_mmu();
  209. }
  210. /*
  211. * Initialize system. Setup memory and reserve regions.
  212. */
  213. extern char _end;
  214. extern char _stext;
  215. extern char _WindowVectors_text_start;
  216. extern char _WindowVectors_text_end;
  217. extern char _DebugInterruptVector_literal_start;
  218. extern char _DebugInterruptVector_text_end;
  219. extern char _KernelExceptionVector_literal_start;
  220. extern char _KernelExceptionVector_text_end;
  221. extern char _UserExceptionVector_literal_start;
  222. extern char _UserExceptionVector_text_end;
  223. extern char _DoubleExceptionVector_literal_start;
  224. extern char _DoubleExceptionVector_text_end;
  225. #if XCHAL_EXCM_LEVEL >= 2
  226. extern char _Level2InterruptVector_text_start;
  227. extern char _Level2InterruptVector_text_end;
  228. #endif
  229. #if XCHAL_EXCM_LEVEL >= 3
  230. extern char _Level3InterruptVector_text_start;
  231. extern char _Level3InterruptVector_text_end;
  232. #endif
  233. #if XCHAL_EXCM_LEVEL >= 4
  234. extern char _Level4InterruptVector_text_start;
  235. extern char _Level4InterruptVector_text_end;
  236. #endif
  237. #if XCHAL_EXCM_LEVEL >= 5
  238. extern char _Level5InterruptVector_text_start;
  239. extern char _Level5InterruptVector_text_end;
  240. #endif
  241. #if XCHAL_EXCM_LEVEL >= 6
  242. extern char _Level6InterruptVector_text_start;
  243. extern char _Level6InterruptVector_text_end;
  244. #endif
  245. #ifdef CONFIG_SMP
  246. extern char _SecondaryResetVector_text_start;
  247. extern char _SecondaryResetVector_text_end;
  248. #endif
  249. static inline int mem_reserve(unsigned long start, unsigned long end)
  250. {
  251. return memblock_reserve(start, end - start);
  252. }
  253. void __init setup_arch(char **cmdline_p)
  254. {
  255. strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  256. *cmdline_p = command_line;
  257. /* Reserve some memory regions */
  258. #ifdef CONFIG_BLK_DEV_INITRD
  259. if (initrd_start < initrd_end) {
  260. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  261. __pa(initrd_end)) == 0;
  262. initrd_below_start_ok = 1;
  263. } else {
  264. initrd_start = 0;
  265. }
  266. #endif
  267. mem_reserve(__pa(&_stext), __pa(&_end));
  268. mem_reserve(__pa(&_WindowVectors_text_start),
  269. __pa(&_WindowVectors_text_end));
  270. mem_reserve(__pa(&_DebugInterruptVector_literal_start),
  271. __pa(&_DebugInterruptVector_text_end));
  272. mem_reserve(__pa(&_KernelExceptionVector_literal_start),
  273. __pa(&_KernelExceptionVector_text_end));
  274. mem_reserve(__pa(&_UserExceptionVector_literal_start),
  275. __pa(&_UserExceptionVector_text_end));
  276. mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
  277. __pa(&_DoubleExceptionVector_text_end));
  278. #if XCHAL_EXCM_LEVEL >= 2
  279. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  280. __pa(&_Level2InterruptVector_text_end));
  281. #endif
  282. #if XCHAL_EXCM_LEVEL >= 3
  283. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  284. __pa(&_Level3InterruptVector_text_end));
  285. #endif
  286. #if XCHAL_EXCM_LEVEL >= 4
  287. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  288. __pa(&_Level4InterruptVector_text_end));
  289. #endif
  290. #if XCHAL_EXCM_LEVEL >= 5
  291. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  292. __pa(&_Level5InterruptVector_text_end));
  293. #endif
  294. #if XCHAL_EXCM_LEVEL >= 6
  295. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  296. __pa(&_Level6InterruptVector_text_end));
  297. #endif
  298. #ifdef CONFIG_SMP
  299. mem_reserve(__pa(&_SecondaryResetVector_text_start),
  300. __pa(&_SecondaryResetVector_text_end));
  301. #endif
  302. parse_early_param();
  303. bootmem_init();
  304. unflatten_and_copy_device_tree();
  305. platform_setup(cmdline_p);
  306. #ifdef CONFIG_SMP
  307. smp_init_cpus();
  308. #endif
  309. paging_init();
  310. zones_init();
  311. #ifdef CONFIG_VT
  312. # if defined(CONFIG_VGA_CONSOLE)
  313. conswitchp = &vga_con;
  314. # elif defined(CONFIG_DUMMY_CONSOLE)
  315. conswitchp = &dummy_con;
  316. # endif
  317. #endif
  318. #ifdef CONFIG_PCI
  319. platform_pcibios_init();
  320. #endif
  321. }
  322. static DEFINE_PER_CPU(struct cpu, cpu_data);
  323. static int __init topology_init(void)
  324. {
  325. int i;
  326. for_each_possible_cpu(i) {
  327. struct cpu *cpu = &per_cpu(cpu_data, i);
  328. cpu->hotpluggable = !!i;
  329. register_cpu(cpu, i);
  330. }
  331. return 0;
  332. }
  333. subsys_initcall(topology_init);
  334. void cpu_reset(void)
  335. {
  336. #if XCHAL_HAVE_PTP_MMU
  337. local_irq_disable();
  338. /*
  339. * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
  340. * be flushed.
  341. * Way 4 is not currently used by linux.
  342. * Ways 5 and 6 shall not be touched on MMUv2 as they are hardwired.
  343. * Way 5 shall be flushed and way 6 shall be set to identity mapping
  344. * on MMUv3.
  345. */
  346. local_flush_tlb_all();
  347. invalidate_page_directory();
  348. #if XCHAL_HAVE_SPANNING_WAY
  349. /* MMU v3 */
  350. {
  351. unsigned long vaddr = (unsigned long)cpu_reset;
  352. unsigned long paddr = __pa(vaddr);
  353. unsigned long tmpaddr = vaddr + SZ_512M;
  354. unsigned long tmp0, tmp1, tmp2, tmp3;
  355. /*
  356. * Find a place for the temporary mapping. It must not be
  357. * in the same 512MB region with vaddr or paddr, otherwise
  358. * there may be multihit exception either on entry to the
  359. * temporary mapping, or on entry to the identity mapping.
  360. * (512MB is the biggest page size supported by TLB.)
  361. */
  362. while (((tmpaddr ^ paddr) & -SZ_512M) == 0)
  363. tmpaddr += SZ_512M;
  364. /* Invalidate mapping in the selected temporary area */
  365. if (itlb_probe(tmpaddr) & 0x8)
  366. invalidate_itlb_entry(itlb_probe(tmpaddr));
  367. if (itlb_probe(tmpaddr + PAGE_SIZE) & 0x8)
  368. invalidate_itlb_entry(itlb_probe(tmpaddr + PAGE_SIZE));
  369. /*
  370. * Map two consecutive pages starting at the physical address
  371. * of this function to the temporary mapping area.
  372. */
  373. write_itlb_entry(__pte((paddr & PAGE_MASK) |
  374. _PAGE_HW_VALID |
  375. _PAGE_HW_EXEC |
  376. _PAGE_CA_BYPASS),
  377. tmpaddr & PAGE_MASK);
  378. write_itlb_entry(__pte(((paddr & PAGE_MASK) + PAGE_SIZE) |
  379. _PAGE_HW_VALID |
  380. _PAGE_HW_EXEC |
  381. _PAGE_CA_BYPASS),
  382. (tmpaddr & PAGE_MASK) + PAGE_SIZE);
  383. /* Reinitialize TLB */
  384. __asm__ __volatile__ ("movi %0, 1f\n\t"
  385. "movi %3, 2f\n\t"
  386. "add %0, %0, %4\n\t"
  387. "add %3, %3, %5\n\t"
  388. "jx %0\n"
  389. /*
  390. * No literal, data or stack access
  391. * below this point
  392. */
  393. "1:\n\t"
  394. /* Initialize *tlbcfg */
  395. "movi %0, 0\n\t"
  396. "wsr %0, itlbcfg\n\t"
  397. "wsr %0, dtlbcfg\n\t"
  398. /* Invalidate TLB way 5 */
  399. "movi %0, 4\n\t"
  400. "movi %1, 5\n"
  401. "1:\n\t"
  402. "iitlb %1\n\t"
  403. "idtlb %1\n\t"
  404. "add %1, %1, %6\n\t"
  405. "addi %0, %0, -1\n\t"
  406. "bnez %0, 1b\n\t"
  407. /* Initialize TLB way 6 */
  408. "movi %0, 7\n\t"
  409. "addi %1, %9, 3\n\t"
  410. "addi %2, %9, 6\n"
  411. "1:\n\t"
  412. "witlb %1, %2\n\t"
  413. "wdtlb %1, %2\n\t"
  414. "add %1, %1, %7\n\t"
  415. "add %2, %2, %7\n\t"
  416. "addi %0, %0, -1\n\t"
  417. "bnez %0, 1b\n\t"
  418. /* Jump to identity mapping */
  419. "jx %3\n"
  420. "2:\n\t"
  421. /* Complete way 6 initialization */
  422. "witlb %1, %2\n\t"
  423. "wdtlb %1, %2\n\t"
  424. /* Invalidate temporary mapping */
  425. "sub %0, %9, %7\n\t"
  426. "iitlb %0\n\t"
  427. "add %0, %0, %8\n\t"
  428. "iitlb %0"
  429. : "=&a"(tmp0), "=&a"(tmp1), "=&a"(tmp2),
  430. "=&a"(tmp3)
  431. : "a"(tmpaddr - vaddr),
  432. "a"(paddr - vaddr),
  433. "a"(SZ_128M), "a"(SZ_512M),
  434. "a"(PAGE_SIZE),
  435. "a"((tmpaddr + SZ_512M) & PAGE_MASK)
  436. : "memory");
  437. }
  438. #endif
  439. #endif
  440. __asm__ __volatile__ ("movi a2, 0\n\t"
  441. "wsr a2, icountlevel\n\t"
  442. "movi a2, 0\n\t"
  443. "wsr a2, icount\n\t"
  444. #if XCHAL_NUM_IBREAK > 0
  445. "wsr a2, ibreakenable\n\t"
  446. #endif
  447. #if XCHAL_HAVE_LOOPS
  448. "wsr a2, lcount\n\t"
  449. #endif
  450. "movi a2, 0x1f\n\t"
  451. "wsr a2, ps\n\t"
  452. "isync\n\t"
  453. "jx %0\n\t"
  454. :
  455. : "a" (XCHAL_RESET_VECTOR_VADDR)
  456. : "a2");
  457. for (;;)
  458. ;
  459. }
  460. void machine_restart(char * cmd)
  461. {
  462. platform_restart();
  463. }
  464. void machine_halt(void)
  465. {
  466. platform_halt();
  467. while (1);
  468. }
  469. void machine_power_off(void)
  470. {
  471. platform_power_off();
  472. while (1);
  473. }
  474. #ifdef CONFIG_PROC_FS
  475. /*
  476. * Display some core information through /proc/cpuinfo.
  477. */
  478. static int
  479. c_show(struct seq_file *f, void *slot)
  480. {
  481. /* high-level stuff */
  482. seq_printf(f, "CPU count\t: %u\n"
  483. "CPU list\t: %*pbl\n"
  484. "vendor_id\t: Tensilica\n"
  485. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  486. "core ID\t\t: " XCHAL_CORE_ID "\n"
  487. "build ID\t: 0x%x\n"
  488. "byte order\t: %s\n"
  489. "cpu MHz\t\t: %lu.%02lu\n"
  490. "bogomips\t: %lu.%02lu\n",
  491. num_online_cpus(),
  492. cpumask_pr_args(cpu_online_mask),
  493. XCHAL_BUILD_UNIQUE_ID,
  494. XCHAL_HAVE_BE ? "big" : "little",
  495. ccount_freq/1000000,
  496. (ccount_freq/10000) % 100,
  497. loops_per_jiffy/(500000/HZ),
  498. (loops_per_jiffy/(5000/HZ)) % 100);
  499. seq_printf(f,"flags\t\t: "
  500. #if XCHAL_HAVE_NMI
  501. "nmi "
  502. #endif
  503. #if XCHAL_HAVE_DEBUG
  504. "debug "
  505. # if XCHAL_HAVE_OCD
  506. "ocd "
  507. # endif
  508. #endif
  509. #if XCHAL_HAVE_DENSITY
  510. "density "
  511. #endif
  512. #if XCHAL_HAVE_BOOLEANS
  513. "boolean "
  514. #endif
  515. #if XCHAL_HAVE_LOOPS
  516. "loop "
  517. #endif
  518. #if XCHAL_HAVE_NSA
  519. "nsa "
  520. #endif
  521. #if XCHAL_HAVE_MINMAX
  522. "minmax "
  523. #endif
  524. #if XCHAL_HAVE_SEXT
  525. "sext "
  526. #endif
  527. #if XCHAL_HAVE_CLAMPS
  528. "clamps "
  529. #endif
  530. #if XCHAL_HAVE_MAC16
  531. "mac16 "
  532. #endif
  533. #if XCHAL_HAVE_MUL16
  534. "mul16 "
  535. #endif
  536. #if XCHAL_HAVE_MUL32
  537. "mul32 "
  538. #endif
  539. #if XCHAL_HAVE_MUL32_HIGH
  540. "mul32h "
  541. #endif
  542. #if XCHAL_HAVE_FP
  543. "fpu "
  544. #endif
  545. #if XCHAL_HAVE_S32C1I
  546. "s32c1i "
  547. #endif
  548. "\n");
  549. /* Registers. */
  550. seq_printf(f,"physical aregs\t: %d\n"
  551. "misc regs\t: %d\n"
  552. "ibreak\t\t: %d\n"
  553. "dbreak\t\t: %d\n",
  554. XCHAL_NUM_AREGS,
  555. XCHAL_NUM_MISC_REGS,
  556. XCHAL_NUM_IBREAK,
  557. XCHAL_NUM_DBREAK);
  558. /* Interrupt. */
  559. seq_printf(f,"num ints\t: %d\n"
  560. "ext ints\t: %d\n"
  561. "int levels\t: %d\n"
  562. "timers\t\t: %d\n"
  563. "debug level\t: %d\n",
  564. XCHAL_NUM_INTERRUPTS,
  565. XCHAL_NUM_EXTINTERRUPTS,
  566. XCHAL_NUM_INTLEVELS,
  567. XCHAL_NUM_TIMERS,
  568. XCHAL_DEBUGLEVEL);
  569. /* Cache */
  570. seq_printf(f,"icache line size: %d\n"
  571. "icache ways\t: %d\n"
  572. "icache size\t: %d\n"
  573. "icache flags\t: "
  574. #if XCHAL_ICACHE_LINE_LOCKABLE
  575. "lock "
  576. #endif
  577. "\n"
  578. "dcache line size: %d\n"
  579. "dcache ways\t: %d\n"
  580. "dcache size\t: %d\n"
  581. "dcache flags\t: "
  582. #if XCHAL_DCACHE_IS_WRITEBACK
  583. "writeback "
  584. #endif
  585. #if XCHAL_DCACHE_LINE_LOCKABLE
  586. "lock "
  587. #endif
  588. "\n",
  589. XCHAL_ICACHE_LINESIZE,
  590. XCHAL_ICACHE_WAYS,
  591. XCHAL_ICACHE_SIZE,
  592. XCHAL_DCACHE_LINESIZE,
  593. XCHAL_DCACHE_WAYS,
  594. XCHAL_DCACHE_SIZE);
  595. return 0;
  596. }
  597. /*
  598. * We show only CPU #0 info.
  599. */
  600. static void *
  601. c_start(struct seq_file *f, loff_t *pos)
  602. {
  603. return (*pos == 0) ? (void *)1 : NULL;
  604. }
  605. static void *
  606. c_next(struct seq_file *f, void *v, loff_t *pos)
  607. {
  608. return NULL;
  609. }
  610. static void
  611. c_stop(struct seq_file *f, void *v)
  612. {
  613. }
  614. const struct seq_operations cpuinfo_op =
  615. {
  616. .start = c_start,
  617. .next = c_next,
  618. .stop = c_stop,
  619. .show = c_show,
  620. };
  621. #endif /* CONFIG_PROC_FS */