setup.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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/kernel.h>
  23. #include <linux/percpu.h>
  24. #include <linux/cpu.h>
  25. #include <linux/of.h>
  26. #include <linux/of_fdt.h>
  27. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  28. # include <linux/console.h>
  29. #endif
  30. #ifdef CONFIG_PROC_FS
  31. # include <linux/seq_file.h>
  32. #endif
  33. #include <asm/bootparam.h>
  34. #include <asm/kasan.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. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  46. struct screen_info screen_info = {
  47. .orig_x = 0,
  48. .orig_y = 24,
  49. .orig_video_cols = 80,
  50. .orig_video_lines = 24,
  51. .orig_video_isVGA = 1,
  52. .orig_video_points = 16,
  53. };
  54. #endif
  55. #ifdef CONFIG_BLK_DEV_INITRD
  56. extern unsigned long initrd_start;
  57. extern unsigned long initrd_end;
  58. int initrd_is_mapped = 0;
  59. extern int initrd_below_start_ok;
  60. #endif
  61. #ifdef CONFIG_OF
  62. void *dtb_start = __dtb_start;
  63. #endif
  64. extern unsigned long loops_per_jiffy;
  65. /* Command line specified as configuration option. */
  66. static char __initdata command_line[COMMAND_LINE_SIZE];
  67. #ifdef CONFIG_CMDLINE_BOOL
  68. static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
  69. #endif
  70. #ifdef CONFIG_PARSE_BOOTPARAM
  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. pr_warn("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. pr_warn("Ignoring tag 0x%08x\n", tag->id);
  138. tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
  139. }
  140. return 0;
  141. }
  142. #else
  143. static int __init parse_bootparam(const bp_tag_t *tag)
  144. {
  145. pr_info("Ignoring boot parameters at %p\n", tag);
  146. return 0;
  147. }
  148. #endif
  149. #ifdef CONFIG_OF
  150. #if !XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY
  151. unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
  152. EXPORT_SYMBOL(xtensa_kio_paddr);
  153. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  154. int depth, void *data)
  155. {
  156. const __be32 *ranges;
  157. int len;
  158. if (depth > 1)
  159. return 0;
  160. if (!of_flat_dt_is_compatible(node, "simple-bus"))
  161. return 0;
  162. ranges = of_get_flat_dt_prop(node, "ranges", &len);
  163. if (!ranges)
  164. return 1;
  165. if (len == 0)
  166. return 1;
  167. xtensa_kio_paddr = of_read_ulong(ranges+1, 1);
  168. /* round down to nearest 256MB boundary */
  169. xtensa_kio_paddr &= 0xf0000000;
  170. init_kio();
  171. return 1;
  172. }
  173. #else
  174. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  175. int depth, void *data)
  176. {
  177. return 1;
  178. }
  179. #endif
  180. void __init early_init_devtree(void *params)
  181. {
  182. early_init_dt_scan(params);
  183. of_scan_flat_dt(xtensa_dt_io_area, NULL);
  184. if (!command_line[0])
  185. strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
  186. }
  187. #endif /* CONFIG_OF */
  188. /*
  189. * Initialize architecture. (Early stage)
  190. */
  191. void __init init_arch(bp_tag_t *bp_start)
  192. {
  193. /* Initialize MMU. */
  194. init_mmu();
  195. /* Initialize initial KASAN shadow map */
  196. kasan_early_init();
  197. /* Parse boot parameters */
  198. if (bp_start)
  199. parse_bootparam(bp_start);
  200. #ifdef CONFIG_OF
  201. early_init_devtree(dtb_start);
  202. #endif
  203. #ifdef CONFIG_CMDLINE_BOOL
  204. if (!command_line[0])
  205. strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
  206. #endif
  207. /* Early hook for platforms */
  208. platform_init(bp_start);
  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_text_start;
  218. extern char _DebugInterruptVector_text_end;
  219. extern char _KernelExceptionVector_text_start;
  220. extern char _KernelExceptionVector_text_end;
  221. extern char _UserExceptionVector_text_start;
  222. extern char _UserExceptionVector_text_end;
  223. extern char _DoubleExceptionVector_text_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. pr_info("config ID: %08x:%08x\n",
  256. get_sr(SREG_EPC), get_sr(SREG_EXCSAVE));
  257. if (get_sr(SREG_EPC) != XCHAL_HW_CONFIGID0 ||
  258. get_sr(SREG_EXCSAVE) != XCHAL_HW_CONFIGID1)
  259. pr_info("built for config ID: %08x:%08x\n",
  260. XCHAL_HW_CONFIGID0, XCHAL_HW_CONFIGID1);
  261. *cmdline_p = command_line;
  262. platform_setup(cmdline_p);
  263. strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  264. /* Reserve some memory regions */
  265. #ifdef CONFIG_BLK_DEV_INITRD
  266. if (initrd_start < initrd_end) {
  267. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  268. __pa(initrd_end)) == 0;
  269. initrd_below_start_ok = 1;
  270. } else {
  271. initrd_start = 0;
  272. }
  273. #endif
  274. mem_reserve(__pa(_stext), __pa(_end));
  275. #ifdef CONFIG_VECTORS_OFFSET
  276. mem_reserve(__pa(&_WindowVectors_text_start),
  277. __pa(&_WindowVectors_text_end));
  278. mem_reserve(__pa(&_DebugInterruptVector_text_start),
  279. __pa(&_DebugInterruptVector_text_end));
  280. mem_reserve(__pa(&_KernelExceptionVector_text_start),
  281. __pa(&_KernelExceptionVector_text_end));
  282. mem_reserve(__pa(&_UserExceptionVector_text_start),
  283. __pa(&_UserExceptionVector_text_end));
  284. mem_reserve(__pa(&_DoubleExceptionVector_text_start),
  285. __pa(&_DoubleExceptionVector_text_end));
  286. #if XCHAL_EXCM_LEVEL >= 2
  287. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  288. __pa(&_Level2InterruptVector_text_end));
  289. #endif
  290. #if XCHAL_EXCM_LEVEL >= 3
  291. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  292. __pa(&_Level3InterruptVector_text_end));
  293. #endif
  294. #if XCHAL_EXCM_LEVEL >= 4
  295. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  296. __pa(&_Level4InterruptVector_text_end));
  297. #endif
  298. #if XCHAL_EXCM_LEVEL >= 5
  299. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  300. __pa(&_Level5InterruptVector_text_end));
  301. #endif
  302. #if XCHAL_EXCM_LEVEL >= 6
  303. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  304. __pa(&_Level6InterruptVector_text_end));
  305. #endif
  306. #endif /* CONFIG_VECTORS_OFFSET */
  307. #ifdef CONFIG_SMP
  308. mem_reserve(__pa(&_SecondaryResetVector_text_start),
  309. __pa(&_SecondaryResetVector_text_end));
  310. #endif
  311. parse_early_param();
  312. bootmem_init();
  313. kasan_init();
  314. unflatten_and_copy_device_tree();
  315. #ifdef CONFIG_SMP
  316. smp_init_cpus();
  317. #endif
  318. paging_init();
  319. zones_init();
  320. #ifdef CONFIG_VT
  321. # if defined(CONFIG_VGA_CONSOLE)
  322. conswitchp = &vga_con;
  323. # elif defined(CONFIG_DUMMY_CONSOLE)
  324. conswitchp = &dummy_con;
  325. # endif
  326. #endif
  327. #ifdef CONFIG_PCI
  328. platform_pcibios_init();
  329. #endif
  330. }
  331. static DEFINE_PER_CPU(struct cpu, cpu_data);
  332. static int __init topology_init(void)
  333. {
  334. int i;
  335. for_each_possible_cpu(i) {
  336. struct cpu *cpu = &per_cpu(cpu_data, i);
  337. cpu->hotpluggable = !!i;
  338. register_cpu(cpu, i);
  339. }
  340. return 0;
  341. }
  342. subsys_initcall(topology_init);
  343. void cpu_reset(void)
  344. {
  345. #if XCHAL_HAVE_PTP_MMU && IS_ENABLED(CONFIG_MMU)
  346. local_irq_disable();
  347. /*
  348. * We have full MMU: all autoload ways, ways 7, 8 and 9 of DTLB must
  349. * be flushed.
  350. * Way 4 is not currently used by linux.
  351. * Ways 5 and 6 shall not be touched on MMUv2 as they are hardwired.
  352. * Way 5 shall be flushed and way 6 shall be set to identity mapping
  353. * on MMUv3.
  354. */
  355. local_flush_tlb_all();
  356. invalidate_page_directory();
  357. #if XCHAL_HAVE_SPANNING_WAY
  358. /* MMU v3 */
  359. {
  360. unsigned long vaddr = (unsigned long)cpu_reset;
  361. unsigned long paddr = __pa(vaddr);
  362. unsigned long tmpaddr = vaddr + SZ_512M;
  363. unsigned long tmp0, tmp1, tmp2, tmp3;
  364. /*
  365. * Find a place for the temporary mapping. It must not be
  366. * in the same 512MB region with vaddr or paddr, otherwise
  367. * there may be multihit exception either on entry to the
  368. * temporary mapping, or on entry to the identity mapping.
  369. * (512MB is the biggest page size supported by TLB.)
  370. */
  371. while (((tmpaddr ^ paddr) & -SZ_512M) == 0)
  372. tmpaddr += SZ_512M;
  373. /* Invalidate mapping in the selected temporary area */
  374. if (itlb_probe(tmpaddr) & BIT(ITLB_HIT_BIT))
  375. invalidate_itlb_entry(itlb_probe(tmpaddr));
  376. if (itlb_probe(tmpaddr + PAGE_SIZE) & BIT(ITLB_HIT_BIT))
  377. invalidate_itlb_entry(itlb_probe(tmpaddr + PAGE_SIZE));
  378. /*
  379. * Map two consecutive pages starting at the physical address
  380. * of this function to the temporary mapping area.
  381. */
  382. write_itlb_entry(__pte((paddr & PAGE_MASK) |
  383. _PAGE_HW_VALID |
  384. _PAGE_HW_EXEC |
  385. _PAGE_CA_BYPASS),
  386. tmpaddr & PAGE_MASK);
  387. write_itlb_entry(__pte(((paddr & PAGE_MASK) + PAGE_SIZE) |
  388. _PAGE_HW_VALID |
  389. _PAGE_HW_EXEC |
  390. _PAGE_CA_BYPASS),
  391. (tmpaddr & PAGE_MASK) + PAGE_SIZE);
  392. /* Reinitialize TLB */
  393. __asm__ __volatile__ ("movi %0, 1f\n\t"
  394. "movi %3, 2f\n\t"
  395. "add %0, %0, %4\n\t"
  396. "add %3, %3, %5\n\t"
  397. "jx %0\n"
  398. /*
  399. * No literal, data or stack access
  400. * below this point
  401. */
  402. "1:\n\t"
  403. /* Initialize *tlbcfg */
  404. "movi %0, 0\n\t"
  405. "wsr %0, itlbcfg\n\t"
  406. "wsr %0, dtlbcfg\n\t"
  407. /* Invalidate TLB way 5 */
  408. "movi %0, 4\n\t"
  409. "movi %1, 5\n"
  410. "1:\n\t"
  411. "iitlb %1\n\t"
  412. "idtlb %1\n\t"
  413. "add %1, %1, %6\n\t"
  414. "addi %0, %0, -1\n\t"
  415. "bnez %0, 1b\n\t"
  416. /* Initialize TLB way 6 */
  417. "movi %0, 7\n\t"
  418. "addi %1, %9, 3\n\t"
  419. "addi %2, %9, 6\n"
  420. "1:\n\t"
  421. "witlb %1, %2\n\t"
  422. "wdtlb %1, %2\n\t"
  423. "add %1, %1, %7\n\t"
  424. "add %2, %2, %7\n\t"
  425. "addi %0, %0, -1\n\t"
  426. "bnez %0, 1b\n\t"
  427. /* Jump to identity mapping */
  428. "jx %3\n"
  429. "2:\n\t"
  430. /* Complete way 6 initialization */
  431. "witlb %1, %2\n\t"
  432. "wdtlb %1, %2\n\t"
  433. /* Invalidate temporary mapping */
  434. "sub %0, %9, %7\n\t"
  435. "iitlb %0\n\t"
  436. "add %0, %0, %8\n\t"
  437. "iitlb %0"
  438. : "=&a"(tmp0), "=&a"(tmp1), "=&a"(tmp2),
  439. "=&a"(tmp3)
  440. : "a"(tmpaddr - vaddr),
  441. "a"(paddr - vaddr),
  442. "a"(SZ_128M), "a"(SZ_512M),
  443. "a"(PAGE_SIZE),
  444. "a"((tmpaddr + SZ_512M) & PAGE_MASK)
  445. : "memory");
  446. }
  447. #endif
  448. #endif
  449. __asm__ __volatile__ ("movi a2, 0\n\t"
  450. "wsr a2, icountlevel\n\t"
  451. "movi a2, 0\n\t"
  452. "wsr a2, icount\n\t"
  453. #if XCHAL_NUM_IBREAK > 0
  454. "wsr a2, ibreakenable\n\t"
  455. #endif
  456. #if XCHAL_HAVE_LOOPS
  457. "wsr a2, lcount\n\t"
  458. #endif
  459. "movi a2, 0x1f\n\t"
  460. "wsr a2, ps\n\t"
  461. "isync\n\t"
  462. "jx %0\n\t"
  463. :
  464. : "a" (XCHAL_RESET_VECTOR_VADDR)
  465. : "a2");
  466. for (;;)
  467. ;
  468. }
  469. void machine_restart(char * cmd)
  470. {
  471. platform_restart();
  472. }
  473. void machine_halt(void)
  474. {
  475. platform_halt();
  476. while (1);
  477. }
  478. void machine_power_off(void)
  479. {
  480. platform_power_off();
  481. while (1);
  482. }
  483. #ifdef CONFIG_PROC_FS
  484. /*
  485. * Display some core information through /proc/cpuinfo.
  486. */
  487. static int
  488. c_show(struct seq_file *f, void *slot)
  489. {
  490. /* high-level stuff */
  491. seq_printf(f, "CPU count\t: %u\n"
  492. "CPU list\t: %*pbl\n"
  493. "vendor_id\t: Tensilica\n"
  494. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  495. "core ID\t\t: " XCHAL_CORE_ID "\n"
  496. "build ID\t: 0x%x\n"
  497. "config ID\t: %08x:%08x\n"
  498. "byte order\t: %s\n"
  499. "cpu MHz\t\t: %lu.%02lu\n"
  500. "bogomips\t: %lu.%02lu\n",
  501. num_online_cpus(),
  502. cpumask_pr_args(cpu_online_mask),
  503. XCHAL_BUILD_UNIQUE_ID,
  504. get_sr(SREG_EPC), get_sr(SREG_EXCSAVE),
  505. XCHAL_HAVE_BE ? "big" : "little",
  506. ccount_freq/1000000,
  507. (ccount_freq/10000) % 100,
  508. loops_per_jiffy/(500000/HZ),
  509. (loops_per_jiffy/(5000/HZ)) % 100);
  510. seq_puts(f, "flags\t\t: "
  511. #if XCHAL_HAVE_NMI
  512. "nmi "
  513. #endif
  514. #if XCHAL_HAVE_DEBUG
  515. "debug "
  516. # if XCHAL_HAVE_OCD
  517. "ocd "
  518. # endif
  519. #endif
  520. #if XCHAL_HAVE_DENSITY
  521. "density "
  522. #endif
  523. #if XCHAL_HAVE_BOOLEANS
  524. "boolean "
  525. #endif
  526. #if XCHAL_HAVE_LOOPS
  527. "loop "
  528. #endif
  529. #if XCHAL_HAVE_NSA
  530. "nsa "
  531. #endif
  532. #if XCHAL_HAVE_MINMAX
  533. "minmax "
  534. #endif
  535. #if XCHAL_HAVE_SEXT
  536. "sext "
  537. #endif
  538. #if XCHAL_HAVE_CLAMPS
  539. "clamps "
  540. #endif
  541. #if XCHAL_HAVE_MAC16
  542. "mac16 "
  543. #endif
  544. #if XCHAL_HAVE_MUL16
  545. "mul16 "
  546. #endif
  547. #if XCHAL_HAVE_MUL32
  548. "mul32 "
  549. #endif
  550. #if XCHAL_HAVE_MUL32_HIGH
  551. "mul32h "
  552. #endif
  553. #if XCHAL_HAVE_FP
  554. "fpu "
  555. #endif
  556. #if XCHAL_HAVE_S32C1I
  557. "s32c1i "
  558. #endif
  559. "\n");
  560. /* Registers. */
  561. seq_printf(f,"physical aregs\t: %d\n"
  562. "misc regs\t: %d\n"
  563. "ibreak\t\t: %d\n"
  564. "dbreak\t\t: %d\n",
  565. XCHAL_NUM_AREGS,
  566. XCHAL_NUM_MISC_REGS,
  567. XCHAL_NUM_IBREAK,
  568. XCHAL_NUM_DBREAK);
  569. /* Interrupt. */
  570. seq_printf(f,"num ints\t: %d\n"
  571. "ext ints\t: %d\n"
  572. "int levels\t: %d\n"
  573. "timers\t\t: %d\n"
  574. "debug level\t: %d\n",
  575. XCHAL_NUM_INTERRUPTS,
  576. XCHAL_NUM_EXTINTERRUPTS,
  577. XCHAL_NUM_INTLEVELS,
  578. XCHAL_NUM_TIMERS,
  579. XCHAL_DEBUGLEVEL);
  580. /* Cache */
  581. seq_printf(f,"icache line size: %d\n"
  582. "icache ways\t: %d\n"
  583. "icache size\t: %d\n"
  584. "icache flags\t: "
  585. #if XCHAL_ICACHE_LINE_LOCKABLE
  586. "lock "
  587. #endif
  588. "\n"
  589. "dcache line size: %d\n"
  590. "dcache ways\t: %d\n"
  591. "dcache size\t: %d\n"
  592. "dcache flags\t: "
  593. #if XCHAL_DCACHE_IS_WRITEBACK
  594. "writeback "
  595. #endif
  596. #if XCHAL_DCACHE_LINE_LOCKABLE
  597. "lock "
  598. #endif
  599. "\n",
  600. XCHAL_ICACHE_LINESIZE,
  601. XCHAL_ICACHE_WAYS,
  602. XCHAL_ICACHE_SIZE,
  603. XCHAL_DCACHE_LINESIZE,
  604. XCHAL_DCACHE_WAYS,
  605. XCHAL_DCACHE_SIZE);
  606. return 0;
  607. }
  608. /*
  609. * We show only CPU #0 info.
  610. */
  611. static void *
  612. c_start(struct seq_file *f, loff_t *pos)
  613. {
  614. return (*pos == 0) ? (void *)1 : NULL;
  615. }
  616. static void *
  617. c_next(struct seq_file *f, void *v, loff_t *pos)
  618. {
  619. return NULL;
  620. }
  621. static void
  622. c_stop(struct seq_file *f, void *v)
  623. {
  624. }
  625. const struct seq_operations cpuinfo_op =
  626. {
  627. .start = c_start,
  628. .next = c_next,
  629. .stop = c_stop,
  630. .show = c_show,
  631. };
  632. #endif /* CONFIG_PROC_FS */