setup.c 17 KB

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