setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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. #endif /* CONFIG_BLK_DEV_INITRD */
  104. #ifdef CONFIG_OF
  105. static int __init parse_tag_fdt(const bp_tag_t *tag)
  106. {
  107. dtb_start = __va(tag->data[0]);
  108. return 0;
  109. }
  110. __tagtable(BP_TAG_FDT, parse_tag_fdt);
  111. #endif /* CONFIG_OF */
  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. *cmdline_p = command_line;
  256. platform_setup(cmdline_p);
  257. strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  258. /* Reserve some memory regions */
  259. #ifdef CONFIG_BLK_DEV_INITRD
  260. if (initrd_start < initrd_end) {
  261. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  262. __pa(initrd_end)) == 0;
  263. initrd_below_start_ok = 1;
  264. } else {
  265. initrd_start = 0;
  266. }
  267. #endif
  268. mem_reserve(__pa(&_stext), __pa(&_end));
  269. #ifdef CONFIG_VECTORS_OFFSET
  270. mem_reserve(__pa(&_WindowVectors_text_start),
  271. __pa(&_WindowVectors_text_end));
  272. mem_reserve(__pa(&_DebugInterruptVector_literal_start),
  273. __pa(&_DebugInterruptVector_text_end));
  274. mem_reserve(__pa(&_KernelExceptionVector_literal_start),
  275. __pa(&_KernelExceptionVector_text_end));
  276. mem_reserve(__pa(&_UserExceptionVector_literal_start),
  277. __pa(&_UserExceptionVector_text_end));
  278. mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
  279. __pa(&_DoubleExceptionVector_text_end));
  280. #if XCHAL_EXCM_LEVEL >= 2
  281. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  282. __pa(&_Level2InterruptVector_text_end));
  283. #endif
  284. #if XCHAL_EXCM_LEVEL >= 3
  285. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  286. __pa(&_Level3InterruptVector_text_end));
  287. #endif
  288. #if XCHAL_EXCM_LEVEL >= 4
  289. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  290. __pa(&_Level4InterruptVector_text_end));
  291. #endif
  292. #if XCHAL_EXCM_LEVEL >= 5
  293. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  294. __pa(&_Level5InterruptVector_text_end));
  295. #endif
  296. #if XCHAL_EXCM_LEVEL >= 6
  297. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  298. __pa(&_Level6InterruptVector_text_end));
  299. #endif
  300. #endif /* CONFIG_VECTORS_OFFSET */
  301. #ifdef CONFIG_SMP
  302. mem_reserve(__pa(&_SecondaryResetVector_text_start),
  303. __pa(&_SecondaryResetVector_text_end));
  304. #endif
  305. parse_early_param();
  306. bootmem_init();
  307. unflatten_and_copy_device_tree();
  308. #ifdef CONFIG_SMP
  309. smp_init_cpus();
  310. #endif
  311. paging_init();
  312. zones_init();
  313. #ifdef CONFIG_VT
  314. # if defined(CONFIG_VGA_CONSOLE)
  315. conswitchp = &vga_con;
  316. # elif defined(CONFIG_DUMMY_CONSOLE)
  317. conswitchp = &dummy_con;
  318. # endif
  319. #endif
  320. #ifdef CONFIG_PCI
  321. platform_pcibios_init();
  322. #endif
  323. }
  324. static DEFINE_PER_CPU(struct cpu, cpu_data);
  325. static int __init topology_init(void)
  326. {
  327. int i;
  328. for_each_possible_cpu(i) {
  329. struct cpu *cpu = &per_cpu(cpu_data, i);
  330. cpu->hotpluggable = !!i;
  331. register_cpu(cpu, i);
  332. }
  333. return 0;
  334. }
  335. subsys_initcall(topology_init);
  336. void cpu_reset(void)
  337. {
  338. #if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU)
  339. local_irq_disable();
  340. /*
  341. * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
  342. * be flushed.
  343. * Way 4 is not currently used by linux.
  344. * Ways 5 and 6 shall not be touched on MMUv2 as they are hardwired.
  345. * Way 5 shall be flushed and way 6 shall be set to identity mapping
  346. * on MMUv3.
  347. */
  348. local_flush_tlb_all();
  349. invalidate_page_directory();
  350. #if XCHAL_HAVE_SPANNING_WAY
  351. /* MMU v3 */
  352. {
  353. unsigned long vaddr = (unsigned long)cpu_reset;
  354. unsigned long paddr = __pa(vaddr);
  355. unsigned long tmpaddr = vaddr + SZ_512M;
  356. unsigned long tmp0, tmp1, tmp2, tmp3;
  357. /*
  358. * Find a place for the temporary mapping. It must not be
  359. * in the same 512MB region with vaddr or paddr, otherwise
  360. * there may be multihit exception either on entry to the
  361. * temporary mapping, or on entry to the identity mapping.
  362. * (512MB is the biggest page size supported by TLB.)
  363. */
  364. while (((tmpaddr ^ paddr) & -SZ_512M) == 0)
  365. tmpaddr += SZ_512M;
  366. /* Invalidate mapping in the selected temporary area */
  367. if (itlb_probe(tmpaddr) & BIT(ITLB_HIT_BIT))
  368. invalidate_itlb_entry(itlb_probe(tmpaddr));
  369. if (itlb_probe(tmpaddr + PAGE_SIZE) & BIT(ITLB_HIT_BIT))
  370. invalidate_itlb_entry(itlb_probe(tmpaddr + PAGE_SIZE));
  371. /*
  372. * Map two consecutive pages starting at the physical address
  373. * of this function to the temporary mapping area.
  374. */
  375. write_itlb_entry(__pte((paddr & PAGE_MASK) |
  376. _PAGE_HW_VALID |
  377. _PAGE_HW_EXEC |
  378. _PAGE_CA_BYPASS),
  379. tmpaddr & PAGE_MASK);
  380. write_itlb_entry(__pte(((paddr & PAGE_MASK) + PAGE_SIZE) |
  381. _PAGE_HW_VALID |
  382. _PAGE_HW_EXEC |
  383. _PAGE_CA_BYPASS),
  384. (tmpaddr & PAGE_MASK) + PAGE_SIZE);
  385. /* Reinitialize TLB */
  386. __asm__ __volatile__ ("movi %0, 1f\n\t"
  387. "movi %3, 2f\n\t"
  388. "add %0, %0, %4\n\t"
  389. "add %3, %3, %5\n\t"
  390. "jx %0\n"
  391. /*
  392. * No literal, data or stack access
  393. * below this point
  394. */
  395. "1:\n\t"
  396. /* Initialize *tlbcfg */
  397. "movi %0, 0\n\t"
  398. "wsr %0, itlbcfg\n\t"
  399. "wsr %0, dtlbcfg\n\t"
  400. /* Invalidate TLB way 5 */
  401. "movi %0, 4\n\t"
  402. "movi %1, 5\n"
  403. "1:\n\t"
  404. "iitlb %1\n\t"
  405. "idtlb %1\n\t"
  406. "add %1, %1, %6\n\t"
  407. "addi %0, %0, -1\n\t"
  408. "bnez %0, 1b\n\t"
  409. /* Initialize TLB way 6 */
  410. "movi %0, 7\n\t"
  411. "addi %1, %9, 3\n\t"
  412. "addi %2, %9, 6\n"
  413. "1:\n\t"
  414. "witlb %1, %2\n\t"
  415. "wdtlb %1, %2\n\t"
  416. "add %1, %1, %7\n\t"
  417. "add %2, %2, %7\n\t"
  418. "addi %0, %0, -1\n\t"
  419. "bnez %0, 1b\n\t"
  420. /* Jump to identity mapping */
  421. "jx %3\n"
  422. "2:\n\t"
  423. /* Complete way 6 initialization */
  424. "witlb %1, %2\n\t"
  425. "wdtlb %1, %2\n\t"
  426. /* Invalidate temporary mapping */
  427. "sub %0, %9, %7\n\t"
  428. "iitlb %0\n\t"
  429. "add %0, %0, %8\n\t"
  430. "iitlb %0"
  431. : "=&a"(tmp0), "=&a"(tmp1), "=&a"(tmp2),
  432. "=&a"(tmp3)
  433. : "a"(tmpaddr - vaddr),
  434. "a"(paddr - vaddr),
  435. "a"(SZ_128M), "a"(SZ_512M),
  436. "a"(PAGE_SIZE),
  437. "a"((tmpaddr + SZ_512M) & PAGE_MASK)
  438. : "memory");
  439. }
  440. #endif
  441. #endif
  442. __asm__ __volatile__ ("movi a2, 0\n\t"
  443. "wsr a2, icountlevel\n\t"
  444. "movi a2, 0\n\t"
  445. "wsr a2, icount\n\t"
  446. #if XCHAL_NUM_IBREAK > 0
  447. "wsr a2, ibreakenable\n\t"
  448. #endif
  449. #if XCHAL_HAVE_LOOPS
  450. "wsr a2, lcount\n\t"
  451. #endif
  452. "movi a2, 0x1f\n\t"
  453. "wsr a2, ps\n\t"
  454. "isync\n\t"
  455. "jx %0\n\t"
  456. :
  457. : "a" (XCHAL_RESET_VECTOR_VADDR)
  458. : "a2");
  459. for (;;)
  460. ;
  461. }
  462. void machine_restart(char * cmd)
  463. {
  464. platform_restart();
  465. }
  466. void machine_halt(void)
  467. {
  468. platform_halt();
  469. while (1);
  470. }
  471. void machine_power_off(void)
  472. {
  473. platform_power_off();
  474. while (1);
  475. }
  476. #ifdef CONFIG_PROC_FS
  477. /*
  478. * Display some core information through /proc/cpuinfo.
  479. */
  480. static int
  481. c_show(struct seq_file *f, void *slot)
  482. {
  483. /* high-level stuff */
  484. seq_printf(f, "CPU count\t: %u\n"
  485. "CPU list\t: %*pbl\n"
  486. "vendor_id\t: Tensilica\n"
  487. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  488. "core ID\t\t: " XCHAL_CORE_ID "\n"
  489. "build ID\t: 0x%x\n"
  490. "byte order\t: %s\n"
  491. "cpu MHz\t\t: %lu.%02lu\n"
  492. "bogomips\t: %lu.%02lu\n",
  493. num_online_cpus(),
  494. cpumask_pr_args(cpu_online_mask),
  495. XCHAL_BUILD_UNIQUE_ID,
  496. XCHAL_HAVE_BE ? "big" : "little",
  497. ccount_freq/1000000,
  498. (ccount_freq/10000) % 100,
  499. loops_per_jiffy/(500000/HZ),
  500. (loops_per_jiffy/(5000/HZ)) % 100);
  501. seq_printf(f,"flags\t\t: "
  502. #if XCHAL_HAVE_NMI
  503. "nmi "
  504. #endif
  505. #if XCHAL_HAVE_DEBUG
  506. "debug "
  507. # if XCHAL_HAVE_OCD
  508. "ocd "
  509. # endif
  510. #endif
  511. #if XCHAL_HAVE_DENSITY
  512. "density "
  513. #endif
  514. #if XCHAL_HAVE_BOOLEANS
  515. "boolean "
  516. #endif
  517. #if XCHAL_HAVE_LOOPS
  518. "loop "
  519. #endif
  520. #if XCHAL_HAVE_NSA
  521. "nsa "
  522. #endif
  523. #if XCHAL_HAVE_MINMAX
  524. "minmax "
  525. #endif
  526. #if XCHAL_HAVE_SEXT
  527. "sext "
  528. #endif
  529. #if XCHAL_HAVE_CLAMPS
  530. "clamps "
  531. #endif
  532. #if XCHAL_HAVE_MAC16
  533. "mac16 "
  534. #endif
  535. #if XCHAL_HAVE_MUL16
  536. "mul16 "
  537. #endif
  538. #if XCHAL_HAVE_MUL32
  539. "mul32 "
  540. #endif
  541. #if XCHAL_HAVE_MUL32_HIGH
  542. "mul32h "
  543. #endif
  544. #if XCHAL_HAVE_FP
  545. "fpu "
  546. #endif
  547. #if XCHAL_HAVE_S32C1I
  548. "s32c1i "
  549. #endif
  550. "\n");
  551. /* Registers. */
  552. seq_printf(f,"physical aregs\t: %d\n"
  553. "misc regs\t: %d\n"
  554. "ibreak\t\t: %d\n"
  555. "dbreak\t\t: %d\n",
  556. XCHAL_NUM_AREGS,
  557. XCHAL_NUM_MISC_REGS,
  558. XCHAL_NUM_IBREAK,
  559. XCHAL_NUM_DBREAK);
  560. /* Interrupt. */
  561. seq_printf(f,"num ints\t: %d\n"
  562. "ext ints\t: %d\n"
  563. "int levels\t: %d\n"
  564. "timers\t\t: %d\n"
  565. "debug level\t: %d\n",
  566. XCHAL_NUM_INTERRUPTS,
  567. XCHAL_NUM_EXTINTERRUPTS,
  568. XCHAL_NUM_INTLEVELS,
  569. XCHAL_NUM_TIMERS,
  570. XCHAL_DEBUGLEVEL);
  571. /* Cache */
  572. seq_printf(f,"icache line size: %d\n"
  573. "icache ways\t: %d\n"
  574. "icache size\t: %d\n"
  575. "icache flags\t: "
  576. #if XCHAL_ICACHE_LINE_LOCKABLE
  577. "lock "
  578. #endif
  579. "\n"
  580. "dcache line size: %d\n"
  581. "dcache ways\t: %d\n"
  582. "dcache size\t: %d\n"
  583. "dcache flags\t: "
  584. #if XCHAL_DCACHE_IS_WRITEBACK
  585. "writeback "
  586. #endif
  587. #if XCHAL_DCACHE_LINE_LOCKABLE
  588. "lock "
  589. #endif
  590. "\n",
  591. XCHAL_ICACHE_LINESIZE,
  592. XCHAL_ICACHE_WAYS,
  593. XCHAL_ICACHE_SIZE,
  594. XCHAL_DCACHE_LINESIZE,
  595. XCHAL_DCACHE_WAYS,
  596. XCHAL_DCACHE_SIZE);
  597. return 0;
  598. }
  599. /*
  600. * We show only CPU #0 info.
  601. */
  602. static void *
  603. c_start(struct seq_file *f, loff_t *pos)
  604. {
  605. return (*pos == 0) ? (void *)1 : NULL;
  606. }
  607. static void *
  608. c_next(struct seq_file *f, void *v, loff_t *pos)
  609. {
  610. return NULL;
  611. }
  612. static void
  613. c_stop(struct seq_file *f, void *v)
  614. {
  615. }
  616. const struct seq_operations cpuinfo_op =
  617. {
  618. .start = c_start,
  619. .next = c_next,
  620. .stop = c_stop,
  621. .show = c_show,
  622. };
  623. #endif /* CONFIG_PROC_FS */