setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. /*
  2. * arch/sh/kernel/setup.c
  3. *
  4. * This file handles the architecture-dependent parts of initialization
  5. *
  6. * Copyright (C) 1999 Niibe Yutaka
  7. * Copyright (C) 2002 - 2007 Paul Mundt
  8. */
  9. #include <linux/screen_info.h>
  10. #include <linux/ioport.h>
  11. #include <linux/init.h>
  12. #include <linux/initrd.h>
  13. #include <linux/bootmem.h>
  14. #include <linux/console.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/root_dev.h>
  17. #include <linux/utsname.h>
  18. #include <linux/nodemask.h>
  19. #include <linux/cpu.h>
  20. #include <linux/pfn.h>
  21. #include <linux/fs.h>
  22. #include <linux/mm.h>
  23. #include <linux/kexec.h>
  24. #include <linux/module.h>
  25. #include <linux/smp.h>
  26. #include <linux/err.h>
  27. #include <linux/debugfs.h>
  28. #include <linux/crash_dump.h>
  29. #include <linux/mmzone.h>
  30. #include <linux/clk.h>
  31. #include <linux/delay.h>
  32. #include <linux/platform_device.h>
  33. #include <linux/lmb.h>
  34. #include <asm/uaccess.h>
  35. #include <asm/io.h>
  36. #include <asm/page.h>
  37. #include <asm/elf.h>
  38. #include <asm/sections.h>
  39. #include <asm/irq.h>
  40. #include <asm/setup.h>
  41. #include <asm/clock.h>
  42. #include <asm/mmu_context.h>
  43. /*
  44. * Initialize loops_per_jiffy as 10000000 (1000MIPS).
  45. * This value will be used at the very early stage of serial setup.
  46. * The bigger value means no problem.
  47. */
  48. struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
  49. [0] = {
  50. .type = CPU_SH_NONE,
  51. .family = CPU_FAMILY_UNKNOWN,
  52. .loops_per_jiffy = 10000000,
  53. },
  54. };
  55. EXPORT_SYMBOL(cpu_data);
  56. /*
  57. * The machine vector. First entry in .machvec.init, or clobbered by
  58. * sh_mv= on the command line, prior to .machvec.init teardown.
  59. */
  60. struct sh_machine_vector sh_mv = { .mv_name = "generic", };
  61. EXPORT_SYMBOL(sh_mv);
  62. #ifdef CONFIG_VT
  63. struct screen_info screen_info;
  64. #endif
  65. extern int root_mountflags;
  66. #define RAMDISK_IMAGE_START_MASK 0x07FF
  67. #define RAMDISK_PROMPT_FLAG 0x8000
  68. #define RAMDISK_LOAD_FLAG 0x4000
  69. static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
  70. static struct resource code_resource = {
  71. .name = "Kernel code",
  72. .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
  73. };
  74. static struct resource data_resource = {
  75. .name = "Kernel data",
  76. .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
  77. };
  78. static struct resource bss_resource = {
  79. .name = "Kernel bss",
  80. .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
  81. };
  82. unsigned long memory_start;
  83. EXPORT_SYMBOL(memory_start);
  84. unsigned long memory_end = 0;
  85. EXPORT_SYMBOL(memory_end);
  86. static struct resource mem_resources[MAX_NUMNODES];
  87. int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
  88. static int __init early_parse_mem(char *p)
  89. {
  90. unsigned long size;
  91. memory_start = (unsigned long)__va(__MEMORY_START);
  92. size = memparse(p, &p);
  93. if (size > __MEMORY_SIZE) {
  94. printk(KERN_ERR
  95. "Using mem= to increase the size of kernel memory "
  96. "is not allowed.\n"
  97. " Recompile the kernel with the correct value for "
  98. "CONFIG_MEMORY_SIZE.\n");
  99. return 0;
  100. }
  101. memory_end = memory_start + size;
  102. return 0;
  103. }
  104. early_param("mem", early_parse_mem);
  105. /*
  106. * Register fully available low RAM pages with the bootmem allocator.
  107. */
  108. static void __init register_bootmem_low_pages(void)
  109. {
  110. unsigned long curr_pfn, last_pfn, pages;
  111. /*
  112. * We are rounding up the start address of usable memory:
  113. */
  114. curr_pfn = PFN_UP(__MEMORY_START);
  115. /*
  116. * ... and at the end of the usable range downwards:
  117. */
  118. last_pfn = PFN_DOWN(__pa(memory_end));
  119. if (last_pfn > max_low_pfn)
  120. last_pfn = max_low_pfn;
  121. pages = last_pfn - curr_pfn;
  122. free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages));
  123. }
  124. #ifdef CONFIG_KEXEC
  125. static void __init reserve_crashkernel(void)
  126. {
  127. unsigned long long free_mem;
  128. unsigned long long crash_size, crash_base;
  129. void *vp;
  130. int ret;
  131. free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
  132. ret = parse_crashkernel(boot_command_line, free_mem,
  133. &crash_size, &crash_base);
  134. if (ret == 0 && crash_size) {
  135. if (crash_base <= 0) {
  136. vp = alloc_bootmem_nopanic(crash_size);
  137. if (!vp) {
  138. printk(KERN_INFO "crashkernel allocation "
  139. "failed\n");
  140. return;
  141. }
  142. crash_base = __pa(vp);
  143. } else if (reserve_bootmem(crash_base, crash_size,
  144. BOOTMEM_EXCLUSIVE) < 0) {
  145. printk(KERN_INFO "crashkernel reservation failed - "
  146. "memory is in use\n");
  147. return;
  148. }
  149. printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
  150. "for crashkernel (System RAM: %ldMB)\n",
  151. (unsigned long)(crash_size >> 20),
  152. (unsigned long)(crash_base >> 20),
  153. (unsigned long)(free_mem >> 20));
  154. crashk_res.start = crash_base;
  155. crashk_res.end = crash_base + crash_size - 1;
  156. insert_resource(&iomem_resource, &crashk_res);
  157. }
  158. }
  159. #else
  160. static inline void __init reserve_crashkernel(void)
  161. {}
  162. #endif
  163. void __cpuinit calibrate_delay(void)
  164. {
  165. struct clk *clk = clk_get(NULL, "cpu_clk");
  166. if (IS_ERR(clk))
  167. panic("Need a sane CPU clock definition!");
  168. loops_per_jiffy = (clk_get_rate(clk) >> 1) / HZ;
  169. printk(KERN_INFO "Calibrating delay loop (skipped)... "
  170. "%lu.%02lu BogoMIPS PRESET (lpj=%lu)\n",
  171. loops_per_jiffy/(500000/HZ),
  172. (loops_per_jiffy/(5000/HZ)) % 100,
  173. loops_per_jiffy);
  174. }
  175. void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
  176. unsigned long end_pfn)
  177. {
  178. struct resource *res = &mem_resources[nid];
  179. WARN_ON(res->name); /* max one active range per node for now */
  180. res->name = "System RAM";
  181. res->start = start_pfn << PAGE_SHIFT;
  182. res->end = (end_pfn << PAGE_SHIFT) - 1;
  183. res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
  184. if (request_resource(&iomem_resource, res)) {
  185. pr_err("unable to request memory_resource 0x%lx 0x%lx\n",
  186. start_pfn, end_pfn);
  187. return;
  188. }
  189. /*
  190. * We don't know which RAM region contains kernel data,
  191. * so we try it repeatedly and let the resource manager
  192. * test it.
  193. */
  194. request_resource(res, &code_resource);
  195. request_resource(res, &data_resource);
  196. request_resource(res, &bss_resource);
  197. add_active_range(nid, start_pfn, end_pfn);
  198. }
  199. void __init setup_bootmem_allocator(unsigned long free_pfn)
  200. {
  201. unsigned long bootmap_size;
  202. unsigned long bootmap_pages, bootmem_paddr;
  203. u64 total_pages = (lmb_end_of_DRAM() - __MEMORY_START) >> PAGE_SHIFT;
  204. int i;
  205. bootmap_pages = bootmem_bootmap_pages(total_pages);
  206. bootmem_paddr = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
  207. /*
  208. * Find a proper area for the bootmem bitmap. After this
  209. * bootstrap step all allocations (until the page allocator
  210. * is intact) must be done via bootmem_alloc().
  211. */
  212. bootmap_size = init_bootmem_node(NODE_DATA(0),
  213. bootmem_paddr >> PAGE_SHIFT,
  214. min_low_pfn, max_low_pfn);
  215. /* Add active regions with valid PFNs. */
  216. for (i = 0; i < lmb.memory.cnt; i++) {
  217. unsigned long start_pfn, end_pfn;
  218. start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
  219. end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
  220. __add_active_range(0, start_pfn, end_pfn);
  221. }
  222. /*
  223. * Add all physical memory to the bootmem map and mark each
  224. * area as present.
  225. */
  226. register_bootmem_low_pages();
  227. /* Reserve the sections we're already using. */
  228. for (i = 0; i < lmb.reserved.cnt; i++)
  229. reserve_bootmem(lmb.reserved.region[i].base,
  230. lmb_size_bytes(&lmb.reserved, i),
  231. BOOTMEM_DEFAULT);
  232. node_set_online(0);
  233. sparse_memory_present_with_active_regions(0);
  234. #ifdef CONFIG_BLK_DEV_INITRD
  235. ROOT_DEV = Root_RAM0;
  236. if (LOADER_TYPE && INITRD_START) {
  237. unsigned long initrd_start_phys = INITRD_START + __MEMORY_START;
  238. if (initrd_start_phys + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) {
  239. reserve_bootmem(initrd_start_phys, INITRD_SIZE,
  240. BOOTMEM_DEFAULT);
  241. initrd_start = (unsigned long)__va(initrd_start_phys);
  242. initrd_end = initrd_start + INITRD_SIZE;
  243. } else {
  244. printk("initrd extends beyond end of memory "
  245. "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
  246. initrd_start_phys + INITRD_SIZE,
  247. (unsigned long)PFN_PHYS(max_low_pfn));
  248. initrd_start = 0;
  249. }
  250. }
  251. #endif
  252. reserve_crashkernel();
  253. }
  254. #ifndef CONFIG_NEED_MULTIPLE_NODES
  255. static void __init setup_memory(void)
  256. {
  257. unsigned long start_pfn;
  258. u64 base = min_low_pfn << PAGE_SHIFT;
  259. u64 size = (max_low_pfn << PAGE_SHIFT) - base;
  260. /*
  261. * Partially used pages are not usable - thus
  262. * we are rounding upwards:
  263. */
  264. start_pfn = PFN_UP(__pa(_end));
  265. lmb_add(base, size);
  266. /*
  267. * Reserve the kernel text and
  268. * Reserve the bootmem bitmap. We do this in two steps (first step
  269. * was init_bootmem()), because this catches the (definitely buggy)
  270. * case of us accidentally initializing the bootmem allocator with
  271. * an invalid RAM area.
  272. */
  273. lmb_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET,
  274. (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) -
  275. (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET));
  276. /*
  277. * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET.
  278. */
  279. if (CONFIG_ZERO_PAGE_OFFSET != 0)
  280. lmb_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET);
  281. lmb_analyze();
  282. lmb_dump_all();
  283. setup_bootmem_allocator(start_pfn);
  284. }
  285. #else
  286. extern void __init setup_memory(void);
  287. #endif
  288. /*
  289. * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
  290. * is_kdump_kernel() to determine if we are booting after a panic. Hence
  291. * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
  292. */
  293. #ifdef CONFIG_CRASH_DUMP
  294. /* elfcorehdr= specifies the location of elf core header
  295. * stored by the crashed kernel.
  296. */
  297. static int __init parse_elfcorehdr(char *arg)
  298. {
  299. if (!arg)
  300. return -EINVAL;
  301. elfcorehdr_addr = memparse(arg, &arg);
  302. return 0;
  303. }
  304. early_param("elfcorehdr", parse_elfcorehdr);
  305. #endif
  306. void __init __attribute__ ((weak)) plat_early_device_setup(void)
  307. {
  308. }
  309. void __init setup_arch(char **cmdline_p)
  310. {
  311. enable_mmu();
  312. ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
  313. printk(KERN_NOTICE "Boot params:\n"
  314. "... MOUNT_ROOT_RDONLY - %08lx\n"
  315. "... RAMDISK_FLAGS - %08lx\n"
  316. "... ORIG_ROOT_DEV - %08lx\n"
  317. "... LOADER_TYPE - %08lx\n"
  318. "... INITRD_START - %08lx\n"
  319. "... INITRD_SIZE - %08lx\n",
  320. MOUNT_ROOT_RDONLY, RAMDISK_FLAGS,
  321. ORIG_ROOT_DEV, LOADER_TYPE,
  322. INITRD_START, INITRD_SIZE);
  323. #ifdef CONFIG_BLK_DEV_RAM
  324. rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK;
  325. rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0);
  326. rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0);
  327. #endif
  328. if (!MOUNT_ROOT_RDONLY)
  329. root_mountflags &= ~MS_RDONLY;
  330. init_mm.start_code = (unsigned long) _text;
  331. init_mm.end_code = (unsigned long) _etext;
  332. init_mm.end_data = (unsigned long) _edata;
  333. init_mm.brk = (unsigned long) _end;
  334. code_resource.start = virt_to_phys(_text);
  335. code_resource.end = virt_to_phys(_etext)-1;
  336. data_resource.start = virt_to_phys(_etext);
  337. data_resource.end = virt_to_phys(_edata)-1;
  338. bss_resource.start = virt_to_phys(__bss_start);
  339. bss_resource.end = virt_to_phys(_ebss)-1;
  340. memory_start = (unsigned long)__va(__MEMORY_START);
  341. if (!memory_end)
  342. memory_end = memory_start + __MEMORY_SIZE;
  343. #ifdef CONFIG_CMDLINE_OVERWRITE
  344. strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
  345. #else
  346. strlcpy(command_line, COMMAND_LINE, sizeof(command_line));
  347. #ifdef CONFIG_CMDLINE_EXTEND
  348. strlcat(command_line, " ", sizeof(command_line));
  349. strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
  350. #endif
  351. #endif
  352. /* Save unparsed command line copy for /proc/cmdline */
  353. memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
  354. *cmdline_p = command_line;
  355. parse_early_param();
  356. plat_early_device_setup();
  357. sh_mv_setup();
  358. /*
  359. * Find the highest page frame number we have available
  360. */
  361. max_pfn = PFN_DOWN(__pa(memory_end));
  362. /*
  363. * Determine low and high memory ranges:
  364. */
  365. max_low_pfn = max_pfn;
  366. min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
  367. nodes_clear(node_online_map);
  368. /* Setup bootmem with available RAM */
  369. lmb_init();
  370. setup_memory();
  371. sparse_init();
  372. #ifdef CONFIG_DUMMY_CONSOLE
  373. conswitchp = &dummy_con;
  374. #endif
  375. /* Perform the machine specific initialisation */
  376. if (likely(sh_mv.mv_setup))
  377. sh_mv.mv_setup(cmdline_p);
  378. paging_init();
  379. #ifdef CONFIG_SMP
  380. plat_smp_setup();
  381. #endif
  382. }
  383. /* processor boot mode configuration */
  384. int generic_mode_pins(void)
  385. {
  386. pr_warning("generic_mode_pins(): missing mode pin configuration\n");
  387. return 0;
  388. }
  389. int test_mode_pin(int pin)
  390. {
  391. return sh_mv.mv_mode_pins() & pin;
  392. }
  393. static const char *cpu_name[] = {
  394. [CPU_SH7201] = "SH7201",
  395. [CPU_SH7203] = "SH7203", [CPU_SH7263] = "SH7263",
  396. [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
  397. [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
  398. [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
  399. [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
  400. [CPU_SH7712] = "SH7712", [CPU_SH7720] = "SH7720",
  401. [CPU_SH7721] = "SH7721", [CPU_SH7729] = "SH7729",
  402. [CPU_SH7750] = "SH7750", [CPU_SH7750S] = "SH7750S",
  403. [CPU_SH7750R] = "SH7750R", [CPU_SH7751] = "SH7751",
  404. [CPU_SH7751R] = "SH7751R", [CPU_SH7760] = "SH7760",
  405. [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
  406. [CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770",
  407. [CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781",
  408. [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
  409. [CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
  410. [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
  411. [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
  412. [CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
  413. [CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
  414. [CPU_SH_NONE] = "Unknown"
  415. };
  416. const char *get_cpu_subtype(struct sh_cpuinfo *c)
  417. {
  418. return cpu_name[c->type];
  419. }
  420. EXPORT_SYMBOL(get_cpu_subtype);
  421. #ifdef CONFIG_PROC_FS
  422. /* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
  423. static const char *cpu_flags[] = {
  424. "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
  425. "ptea", "llsc", "l2", "op32", "pteaex", NULL
  426. };
  427. static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
  428. {
  429. unsigned long i;
  430. seq_printf(m, "cpu flags\t:");
  431. if (!c->flags) {
  432. seq_printf(m, " %s\n", cpu_flags[0]);
  433. return;
  434. }
  435. for (i = 0; cpu_flags[i]; i++)
  436. if ((c->flags & (1 << i)))
  437. seq_printf(m, " %s", cpu_flags[i+1]);
  438. seq_printf(m, "\n");
  439. }
  440. static void show_cacheinfo(struct seq_file *m, const char *type,
  441. struct cache_info info)
  442. {
  443. unsigned int cache_size;
  444. cache_size = info.ways * info.sets * info.linesz;
  445. seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
  446. type, cache_size >> 10, info.ways);
  447. }
  448. /*
  449. * Get CPU information for use by the procfs.
  450. */
  451. static int show_cpuinfo(struct seq_file *m, void *v)
  452. {
  453. struct sh_cpuinfo *c = v;
  454. unsigned int cpu = c - cpu_data;
  455. if (!cpu_online(cpu))
  456. return 0;
  457. if (cpu == 0)
  458. seq_printf(m, "machine\t\t: %s\n", get_system_type());
  459. else
  460. seq_printf(m, "\n");
  461. seq_printf(m, "processor\t: %d\n", cpu);
  462. seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
  463. seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
  464. if (c->cut_major == -1)
  465. seq_printf(m, "cut\t\t: unknown\n");
  466. else if (c->cut_minor == -1)
  467. seq_printf(m, "cut\t\t: %d.x\n", c->cut_major);
  468. else
  469. seq_printf(m, "cut\t\t: %d.%d\n", c->cut_major, c->cut_minor);
  470. show_cpuflags(m, c);
  471. seq_printf(m, "cache type\t: ");
  472. /*
  473. * Check for what type of cache we have, we support both the
  474. * unified cache on the SH-2 and SH-3, as well as the harvard
  475. * style cache on the SH-4.
  476. */
  477. if (c->icache.flags & SH_CACHE_COMBINED) {
  478. seq_printf(m, "unified\n");
  479. show_cacheinfo(m, "cache", c->icache);
  480. } else {
  481. seq_printf(m, "split (harvard)\n");
  482. show_cacheinfo(m, "icache", c->icache);
  483. show_cacheinfo(m, "dcache", c->dcache);
  484. }
  485. /* Optional secondary cache */
  486. if (c->flags & CPU_HAS_L2_CACHE)
  487. show_cacheinfo(m, "scache", c->scache);
  488. seq_printf(m, "bogomips\t: %lu.%02lu\n",
  489. c->loops_per_jiffy/(500000/HZ),
  490. (c->loops_per_jiffy/(5000/HZ)) % 100);
  491. return 0;
  492. }
  493. static void *c_start(struct seq_file *m, loff_t *pos)
  494. {
  495. return *pos < NR_CPUS ? cpu_data + *pos : NULL;
  496. }
  497. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  498. {
  499. ++*pos;
  500. return c_start(m, pos);
  501. }
  502. static void c_stop(struct seq_file *m, void *v)
  503. {
  504. }
  505. const struct seq_operations cpuinfo_op = {
  506. .start = c_start,
  507. .next = c_next,
  508. .stop = c_stop,
  509. .show = show_cpuinfo,
  510. };
  511. #endif /* CONFIG_PROC_FS */
  512. struct dentry *sh_debugfs_root;
  513. static int __init sh_debugfs_init(void)
  514. {
  515. sh_debugfs_root = debugfs_create_dir("sh", NULL);
  516. if (!sh_debugfs_root)
  517. return -ENOMEM;
  518. if (IS_ERR(sh_debugfs_root))
  519. return PTR_ERR(sh_debugfs_root);
  520. return 0;
  521. }
  522. arch_initcall(sh_debugfs_init);