setup.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  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 <platform/hardware.h>
  49. #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
  50. struct screen_info screen_info = { 0, 24, 0, 0, 0, 80, 0, 0, 0, 24, 1, 16};
  51. #endif
  52. #ifdef CONFIG_BLK_DEV_FD
  53. extern struct fd_ops no_fd_ops;
  54. struct fd_ops *fd_ops;
  55. #endif
  56. extern struct rtc_ops no_rtc_ops;
  57. struct rtc_ops *rtc_ops;
  58. #ifdef CONFIG_BLK_DEV_INITRD
  59. extern unsigned long initrd_start;
  60. extern unsigned long initrd_end;
  61. int initrd_is_mapped = 0;
  62. extern int initrd_below_start_ok;
  63. #endif
  64. #ifdef CONFIG_OF
  65. extern u32 __dtb_start[];
  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. sysmem_info_t __initdata sysmem;
  76. extern int mem_reserve(unsigned long, unsigned long, int);
  77. extern void bootmem_init(void);
  78. extern void zones_init(void);
  79. /*
  80. * Boot parameter parsing.
  81. *
  82. * The Xtensa port uses a list of variable-sized tags to pass data to
  83. * the kernel. The first tag must be a BP_TAG_FIRST tag for the list
  84. * to be recognised. The list is terminated with a zero-sized
  85. * BP_TAG_LAST tag.
  86. */
  87. typedef struct tagtable {
  88. u32 tag;
  89. int (*parse)(const bp_tag_t*);
  90. } tagtable_t;
  91. #define __tagtable(tag, fn) static tagtable_t __tagtable_##fn \
  92. __attribute__((used, section(".taglist"))) = { tag, fn }
  93. /* parse current tag */
  94. static int __init add_sysmem_bank(unsigned long type, unsigned long start,
  95. unsigned long end)
  96. {
  97. if (sysmem.nr_banks >= SYSMEM_BANKS_MAX) {
  98. printk(KERN_WARNING
  99. "Ignoring memory bank 0x%08lx size %ldKB\n",
  100. start, end - start);
  101. return -EINVAL;
  102. }
  103. sysmem.bank[sysmem.nr_banks].type = type;
  104. sysmem.bank[sysmem.nr_banks].start = PAGE_ALIGN(start);
  105. sysmem.bank[sysmem.nr_banks].end = end & PAGE_MASK;
  106. sysmem.nr_banks++;
  107. return 0;
  108. }
  109. static int __init parse_tag_mem(const bp_tag_t *tag)
  110. {
  111. meminfo_t *mi = (meminfo_t *)(tag->data);
  112. if (mi->type != MEMORY_TYPE_CONVENTIONAL)
  113. return -1;
  114. return add_sysmem_bank(mi->type, mi->start, mi->end);
  115. }
  116. __tagtable(BP_TAG_MEMORY, parse_tag_mem);
  117. #ifdef CONFIG_BLK_DEV_INITRD
  118. static int __init parse_tag_initrd(const bp_tag_t* tag)
  119. {
  120. meminfo_t* mi;
  121. mi = (meminfo_t*)(tag->data);
  122. initrd_start = (unsigned long)__va(mi->start);
  123. initrd_end = (unsigned long)__va(mi->end);
  124. return 0;
  125. }
  126. __tagtable(BP_TAG_INITRD, parse_tag_initrd);
  127. #ifdef CONFIG_OF
  128. static int __init parse_tag_fdt(const bp_tag_t *tag)
  129. {
  130. dtb_start = __va(tag->data[0]);
  131. return 0;
  132. }
  133. __tagtable(BP_TAG_FDT, parse_tag_fdt);
  134. #endif /* CONFIG_OF */
  135. #endif /* CONFIG_BLK_DEV_INITRD */
  136. static int __init parse_tag_cmdline(const bp_tag_t* tag)
  137. {
  138. strlcpy(command_line, (char *)(tag->data), COMMAND_LINE_SIZE);
  139. return 0;
  140. }
  141. __tagtable(BP_TAG_COMMAND_LINE, parse_tag_cmdline);
  142. static int __init parse_bootparam(const bp_tag_t* tag)
  143. {
  144. extern tagtable_t __tagtable_begin, __tagtable_end;
  145. tagtable_t *t;
  146. /* Boot parameters must start with a BP_TAG_FIRST tag. */
  147. if (tag->id != BP_TAG_FIRST) {
  148. printk(KERN_WARNING "Invalid boot parameters!\n");
  149. return 0;
  150. }
  151. tag = (bp_tag_t*)((unsigned long)tag + sizeof(bp_tag_t) + tag->size);
  152. /* Parse all tags. */
  153. while (tag != NULL && tag->id != BP_TAG_LAST) {
  154. for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
  155. if (tag->id == t->tag) {
  156. t->parse(tag);
  157. break;
  158. }
  159. }
  160. if (t == &__tagtable_end)
  161. printk(KERN_WARNING "Ignoring tag "
  162. "0x%08x\n", tag->id);
  163. tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
  164. }
  165. return 0;
  166. }
  167. #ifdef CONFIG_OF
  168. bool __initdata dt_memory_scan = false;
  169. #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
  170. unsigned long xtensa_kio_paddr = XCHAL_KIO_DEFAULT_PADDR;
  171. EXPORT_SYMBOL(xtensa_kio_paddr);
  172. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  173. int depth, void *data)
  174. {
  175. const __be32 *ranges;
  176. unsigned long len;
  177. if (depth > 1)
  178. return 0;
  179. if (!of_flat_dt_is_compatible(node, "simple-bus"))
  180. return 0;
  181. ranges = of_get_flat_dt_prop(node, "ranges", &len);
  182. if (!ranges)
  183. return 1;
  184. if (len == 0)
  185. return 1;
  186. xtensa_kio_paddr = of_read_ulong(ranges+1, 1);
  187. /* round down to nearest 256MB boundary */
  188. xtensa_kio_paddr &= 0xf0000000;
  189. return 1;
  190. }
  191. #else
  192. static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
  193. int depth, void *data)
  194. {
  195. return 1;
  196. }
  197. #endif
  198. void __init early_init_dt_add_memory_arch(u64 base, u64 size)
  199. {
  200. if (!dt_memory_scan)
  201. return;
  202. size &= PAGE_MASK;
  203. add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
  204. }
  205. void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
  206. {
  207. return __alloc_bootmem(size, align, 0);
  208. }
  209. void __init early_init_devtree(void *params)
  210. {
  211. if (sysmem.nr_banks == 0)
  212. dt_memory_scan = true;
  213. early_init_dt_scan(params);
  214. of_scan_flat_dt(xtensa_dt_io_area, NULL);
  215. if (!command_line[0])
  216. strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
  217. }
  218. static int __init xtensa_device_probe(void)
  219. {
  220. of_clk_init(NULL);
  221. of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  222. return 0;
  223. }
  224. device_initcall(xtensa_device_probe);
  225. #endif /* CONFIG_OF */
  226. /*
  227. * Initialize architecture. (Early stage)
  228. */
  229. void __init init_arch(bp_tag_t *bp_start)
  230. {
  231. sysmem.nr_banks = 0;
  232. /* Parse boot parameters */
  233. if (bp_start)
  234. parse_bootparam(bp_start);
  235. #ifdef CONFIG_OF
  236. early_init_devtree(dtb_start);
  237. #endif
  238. if (sysmem.nr_banks == 0) {
  239. sysmem.nr_banks = 1;
  240. sysmem.bank[0].start = PLATFORM_DEFAULT_MEM_START;
  241. sysmem.bank[0].end = PLATFORM_DEFAULT_MEM_START
  242. + PLATFORM_DEFAULT_MEM_SIZE;
  243. }
  244. #ifdef CONFIG_CMDLINE_BOOL
  245. if (!command_line[0])
  246. strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
  247. #endif
  248. /* Early hook for platforms */
  249. platform_init(bp_start);
  250. /* Initialize MMU. */
  251. init_mmu();
  252. }
  253. /*
  254. * Initialize system. Setup memory and reserve regions.
  255. */
  256. extern char _end;
  257. extern char _stext;
  258. extern char _WindowVectors_text_start;
  259. extern char _WindowVectors_text_end;
  260. extern char _DebugInterruptVector_literal_start;
  261. extern char _DebugInterruptVector_text_end;
  262. extern char _KernelExceptionVector_literal_start;
  263. extern char _KernelExceptionVector_text_end;
  264. extern char _UserExceptionVector_literal_start;
  265. extern char _UserExceptionVector_text_end;
  266. extern char _DoubleExceptionVector_literal_start;
  267. extern char _DoubleExceptionVector_text_end;
  268. #if XCHAL_EXCM_LEVEL >= 2
  269. extern char _Level2InterruptVector_text_start;
  270. extern char _Level2InterruptVector_text_end;
  271. #endif
  272. #if XCHAL_EXCM_LEVEL >= 3
  273. extern char _Level3InterruptVector_text_start;
  274. extern char _Level3InterruptVector_text_end;
  275. #endif
  276. #if XCHAL_EXCM_LEVEL >= 4
  277. extern char _Level4InterruptVector_text_start;
  278. extern char _Level4InterruptVector_text_end;
  279. #endif
  280. #if XCHAL_EXCM_LEVEL >= 5
  281. extern char _Level5InterruptVector_text_start;
  282. extern char _Level5InterruptVector_text_end;
  283. #endif
  284. #if XCHAL_EXCM_LEVEL >= 6
  285. extern char _Level6InterruptVector_text_start;
  286. extern char _Level6InterruptVector_text_end;
  287. #endif
  288. #ifdef CONFIG_S32C1I_SELFTEST
  289. #if XCHAL_HAVE_S32C1I
  290. static int __initdata rcw_word, rcw_probe_pc, rcw_exc;
  291. /*
  292. * Basic atomic compare-and-swap, that records PC of S32C1I for probing.
  293. *
  294. * If *v == cmp, set *v = set. Return previous *v.
  295. */
  296. static inline int probed_compare_swap(int *v, int cmp, int set)
  297. {
  298. int tmp;
  299. __asm__ __volatile__(
  300. " movi %1, 1f\n"
  301. " s32i %1, %4, 0\n"
  302. " wsr %2, scompare1\n"
  303. "1: s32c1i %0, %3, 0\n"
  304. : "=a" (set), "=&a" (tmp)
  305. : "a" (cmp), "a" (v), "a" (&rcw_probe_pc), "0" (set)
  306. : "memory"
  307. );
  308. return set;
  309. }
  310. /* Handle probed exception */
  311. static void __init do_probed_exception(struct pt_regs *regs,
  312. unsigned long exccause)
  313. {
  314. if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
  315. regs->pc += 3; /* skip the s32c1i instruction */
  316. rcw_exc = exccause;
  317. } else {
  318. do_unhandled(regs, exccause);
  319. }
  320. }
  321. /* Simple test of S32C1I (soc bringup assist) */
  322. static int __init check_s32c1i(void)
  323. {
  324. int n, cause1, cause2;
  325. void *handbus, *handdata, *handaddr; /* temporarily saved handlers */
  326. rcw_probe_pc = 0;
  327. handbus = trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR,
  328. do_probed_exception);
  329. handdata = trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR,
  330. do_probed_exception);
  331. handaddr = trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR,
  332. do_probed_exception);
  333. /* First try an S32C1I that does not store: */
  334. rcw_exc = 0;
  335. rcw_word = 1;
  336. n = probed_compare_swap(&rcw_word, 0, 2);
  337. cause1 = rcw_exc;
  338. /* took exception? */
  339. if (cause1 != 0) {
  340. /* unclean exception? */
  341. if (n != 2 || rcw_word != 1)
  342. panic("S32C1I exception error");
  343. } else if (rcw_word != 1 || n != 1) {
  344. panic("S32C1I compare error");
  345. }
  346. /* Then an S32C1I that stores: */
  347. rcw_exc = 0;
  348. rcw_word = 0x1234567;
  349. n = probed_compare_swap(&rcw_word, 0x1234567, 0xabcde);
  350. cause2 = rcw_exc;
  351. if (cause2 != 0) {
  352. /* unclean exception? */
  353. if (n != 0xabcde || rcw_word != 0x1234567)
  354. panic("S32C1I exception error (b)");
  355. } else if (rcw_word != 0xabcde || n != 0x1234567) {
  356. panic("S32C1I store error");
  357. }
  358. /* Verify consistency of exceptions: */
  359. if (cause1 || cause2) {
  360. pr_warn("S32C1I took exception %d, %d\n", cause1, cause2);
  361. /* If emulation of S32C1I upon bus error gets implemented,
  362. we can get rid of this panic for single core (not SMP) */
  363. panic("S32C1I exceptions not currently supported");
  364. }
  365. if (cause1 != cause2)
  366. panic("inconsistent S32C1I exceptions");
  367. trap_set_handler(EXCCAUSE_LOAD_STORE_ERROR, handbus);
  368. trap_set_handler(EXCCAUSE_LOAD_STORE_DATA_ERROR, handdata);
  369. trap_set_handler(EXCCAUSE_LOAD_STORE_ADDR_ERROR, handaddr);
  370. return 0;
  371. }
  372. #else /* XCHAL_HAVE_S32C1I */
  373. /* This condition should not occur with a commercially deployed processor.
  374. Display reminder for early engr test or demo chips / FPGA bitstreams */
  375. static int __init check_s32c1i(void)
  376. {
  377. pr_warn("Processor configuration lacks atomic compare-and-swap support!\n");
  378. return 0;
  379. }
  380. #endif /* XCHAL_HAVE_S32C1I */
  381. early_initcall(check_s32c1i);
  382. #endif /* CONFIG_S32C1I_SELFTEST */
  383. void __init setup_arch(char **cmdline_p)
  384. {
  385. strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  386. *cmdline_p = command_line;
  387. /* Reserve some memory regions */
  388. #ifdef CONFIG_BLK_DEV_INITRD
  389. if (initrd_start < initrd_end) {
  390. initrd_is_mapped = mem_reserve(__pa(initrd_start),
  391. __pa(initrd_end), 0);
  392. initrd_below_start_ok = 1;
  393. } else {
  394. initrd_start = 0;
  395. }
  396. #endif
  397. mem_reserve(__pa(&_stext),__pa(&_end), 1);
  398. mem_reserve(__pa(&_WindowVectors_text_start),
  399. __pa(&_WindowVectors_text_end), 0);
  400. mem_reserve(__pa(&_DebugInterruptVector_literal_start),
  401. __pa(&_DebugInterruptVector_text_end), 0);
  402. mem_reserve(__pa(&_KernelExceptionVector_literal_start),
  403. __pa(&_KernelExceptionVector_text_end), 0);
  404. mem_reserve(__pa(&_UserExceptionVector_literal_start),
  405. __pa(&_UserExceptionVector_text_end), 0);
  406. mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
  407. __pa(&_DoubleExceptionVector_text_end), 0);
  408. #if XCHAL_EXCM_LEVEL >= 2
  409. mem_reserve(__pa(&_Level2InterruptVector_text_start),
  410. __pa(&_Level2InterruptVector_text_end), 0);
  411. #endif
  412. #if XCHAL_EXCM_LEVEL >= 3
  413. mem_reserve(__pa(&_Level3InterruptVector_text_start),
  414. __pa(&_Level3InterruptVector_text_end), 0);
  415. #endif
  416. #if XCHAL_EXCM_LEVEL >= 4
  417. mem_reserve(__pa(&_Level4InterruptVector_text_start),
  418. __pa(&_Level4InterruptVector_text_end), 0);
  419. #endif
  420. #if XCHAL_EXCM_LEVEL >= 5
  421. mem_reserve(__pa(&_Level5InterruptVector_text_start),
  422. __pa(&_Level5InterruptVector_text_end), 0);
  423. #endif
  424. #if XCHAL_EXCM_LEVEL >= 6
  425. mem_reserve(__pa(&_Level6InterruptVector_text_start),
  426. __pa(&_Level6InterruptVector_text_end), 0);
  427. #endif
  428. bootmem_init();
  429. unflatten_and_copy_device_tree();
  430. platform_setup(cmdline_p);
  431. #ifdef CONFIG_SMP
  432. smp_init_cpus();
  433. #endif
  434. paging_init();
  435. zones_init();
  436. #ifdef CONFIG_VT
  437. # if defined(CONFIG_VGA_CONSOLE)
  438. conswitchp = &vga_con;
  439. # elif defined(CONFIG_DUMMY_CONSOLE)
  440. conswitchp = &dummy_con;
  441. # endif
  442. #endif
  443. #ifdef CONFIG_PCI
  444. platform_pcibios_init();
  445. #endif
  446. }
  447. static DEFINE_PER_CPU(struct cpu, cpu_data);
  448. static int __init topology_init(void)
  449. {
  450. int i;
  451. for_each_possible_cpu(i) {
  452. struct cpu *cpu = &per_cpu(cpu_data, i);
  453. cpu->hotpluggable = !!i;
  454. register_cpu(cpu, i);
  455. }
  456. return 0;
  457. }
  458. subsys_initcall(topology_init);
  459. void machine_restart(char * cmd)
  460. {
  461. platform_restart();
  462. }
  463. void machine_halt(void)
  464. {
  465. platform_halt();
  466. while (1);
  467. }
  468. void machine_power_off(void)
  469. {
  470. platform_power_off();
  471. while (1);
  472. }
  473. #ifdef CONFIG_PROC_FS
  474. /*
  475. * Display some core information through /proc/cpuinfo.
  476. */
  477. static int
  478. c_show(struct seq_file *f, void *slot)
  479. {
  480. char buf[NR_CPUS * 5];
  481. cpulist_scnprintf(buf, sizeof(buf), cpu_online_mask);
  482. /* high-level stuff */
  483. seq_printf(f, "CPU count\t: %u\n"
  484. "CPU list\t: %s\n"
  485. "vendor_id\t: Tensilica\n"
  486. "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
  487. "core ID\t\t: " XCHAL_CORE_ID "\n"
  488. "build ID\t: 0x%x\n"
  489. "byte order\t: %s\n"
  490. "cpu MHz\t\t: %lu.%02lu\n"
  491. "bogomips\t: %lu.%02lu\n",
  492. num_online_cpus(),
  493. buf,
  494. XCHAL_BUILD_UNIQUE_ID,
  495. XCHAL_HAVE_BE ? "big" : "little",
  496. ccount_freq/1000000,
  497. (ccount_freq/10000) % 100,
  498. loops_per_jiffy/(500000/HZ),
  499. (loops_per_jiffy/(5000/HZ)) % 100);
  500. seq_printf(f,"flags\t\t: "
  501. #if XCHAL_HAVE_NMI
  502. "nmi "
  503. #endif
  504. #if XCHAL_HAVE_DEBUG
  505. "debug "
  506. # if XCHAL_HAVE_OCD
  507. "ocd "
  508. # endif
  509. #endif
  510. #if XCHAL_HAVE_DENSITY
  511. "density "
  512. #endif
  513. #if XCHAL_HAVE_BOOLEANS
  514. "boolean "
  515. #endif
  516. #if XCHAL_HAVE_LOOPS
  517. "loop "
  518. #endif
  519. #if XCHAL_HAVE_NSA
  520. "nsa "
  521. #endif
  522. #if XCHAL_HAVE_MINMAX
  523. "minmax "
  524. #endif
  525. #if XCHAL_HAVE_SEXT
  526. "sext "
  527. #endif
  528. #if XCHAL_HAVE_CLAMPS
  529. "clamps "
  530. #endif
  531. #if XCHAL_HAVE_MAC16
  532. "mac16 "
  533. #endif
  534. #if XCHAL_HAVE_MUL16
  535. "mul16 "
  536. #endif
  537. #if XCHAL_HAVE_MUL32
  538. "mul32 "
  539. #endif
  540. #if XCHAL_HAVE_MUL32_HIGH
  541. "mul32h "
  542. #endif
  543. #if XCHAL_HAVE_FP
  544. "fpu "
  545. #endif
  546. #if XCHAL_HAVE_S32C1I
  547. "s32c1i "
  548. #endif
  549. "\n");
  550. /* Registers. */
  551. seq_printf(f,"physical aregs\t: %d\n"
  552. "misc regs\t: %d\n"
  553. "ibreak\t\t: %d\n"
  554. "dbreak\t\t: %d\n",
  555. XCHAL_NUM_AREGS,
  556. XCHAL_NUM_MISC_REGS,
  557. XCHAL_NUM_IBREAK,
  558. XCHAL_NUM_DBREAK);
  559. /* Interrupt. */
  560. seq_printf(f,"num ints\t: %d\n"
  561. "ext ints\t: %d\n"
  562. "int levels\t: %d\n"
  563. "timers\t\t: %d\n"
  564. "debug level\t: %d\n",
  565. XCHAL_NUM_INTERRUPTS,
  566. XCHAL_NUM_EXTINTERRUPTS,
  567. XCHAL_NUM_INTLEVELS,
  568. XCHAL_NUM_TIMERS,
  569. XCHAL_DEBUGLEVEL);
  570. /* Cache */
  571. seq_printf(f,"icache line size: %d\n"
  572. "icache ways\t: %d\n"
  573. "icache size\t: %d\n"
  574. "icache flags\t: "
  575. #if XCHAL_ICACHE_LINE_LOCKABLE
  576. "lock "
  577. #endif
  578. "\n"
  579. "dcache line size: %d\n"
  580. "dcache ways\t: %d\n"
  581. "dcache size\t: %d\n"
  582. "dcache flags\t: "
  583. #if XCHAL_DCACHE_IS_WRITEBACK
  584. "writeback "
  585. #endif
  586. #if XCHAL_DCACHE_LINE_LOCKABLE
  587. "lock "
  588. #endif
  589. "\n",
  590. XCHAL_ICACHE_LINESIZE,
  591. XCHAL_ICACHE_WAYS,
  592. XCHAL_ICACHE_SIZE,
  593. XCHAL_DCACHE_LINESIZE,
  594. XCHAL_DCACHE_WAYS,
  595. XCHAL_DCACHE_SIZE);
  596. return 0;
  597. }
  598. /*
  599. * We show only CPU #0 info.
  600. */
  601. static void *
  602. c_start(struct seq_file *f, loff_t *pos)
  603. {
  604. return (*pos == 0) ? (void *)1 : NULL;
  605. }
  606. static void *
  607. c_next(struct seq_file *f, void *v, loff_t *pos)
  608. {
  609. return NULL;
  610. }
  611. static void
  612. c_stop(struct seq_file *f, void *v)
  613. {
  614. }
  615. const struct seq_operations cpuinfo_op =
  616. {
  617. .start = c_start,
  618. .next = c_next,
  619. .stop = c_stop,
  620. .show = c_show,
  621. };
  622. #endif /* CONFIG_PROC_FS */