setup.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /*
  2. * arch/s390/kernel/setup.c
  3. *
  4. * S390 version
  5. * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Hartmut Penner (hp@de.ibm.com),
  7. * Martin Schwidefsky (schwidefsky@de.ibm.com)
  8. *
  9. * Derived from "arch/i386/kernel/setup.c"
  10. * Copyright (C) 1995, Linus Torvalds
  11. */
  12. /*
  13. * This file handles the architecture-dependent parts of initialization
  14. */
  15. #include <linux/errno.h>
  16. #include <linux/module.h>
  17. #include <linux/sched.h>
  18. #include <linux/kernel.h>
  19. #include <linux/mm.h>
  20. #include <linux/stddef.h>
  21. #include <linux/unistd.h>
  22. #include <linux/ptrace.h>
  23. #include <linux/slab.h>
  24. #include <linux/user.h>
  25. #include <linux/a.out.h>
  26. #include <linux/tty.h>
  27. #include <linux/ioport.h>
  28. #include <linux/delay.h>
  29. #include <linux/config.h>
  30. #include <linux/init.h>
  31. #include <linux/initrd.h>
  32. #include <linux/bootmem.h>
  33. #include <linux/root_dev.h>
  34. #include <linux/console.h>
  35. #include <linux/seq_file.h>
  36. #include <linux/kernel_stat.h>
  37. #include <asm/uaccess.h>
  38. #include <asm/system.h>
  39. #include <asm/smp.h>
  40. #include <asm/mmu_context.h>
  41. #include <asm/cpcmd.h>
  42. #include <asm/lowcore.h>
  43. #include <asm/irq.h>
  44. /*
  45. * Machine setup..
  46. */
  47. unsigned int console_mode = 0;
  48. unsigned int console_devno = -1;
  49. unsigned int console_irq = -1;
  50. unsigned long memory_size = 0;
  51. unsigned long machine_flags = 0;
  52. unsigned int default_storage_key = 0;
  53. struct {
  54. unsigned long addr, size, type;
  55. } memory_chunk[MEMORY_CHUNKS] = { { 0 } };
  56. #define CHUNK_READ_WRITE 0
  57. #define CHUNK_READ_ONLY 1
  58. volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
  59. /*
  60. * Setup options
  61. */
  62. extern int _text,_etext, _edata, _end;
  63. /*
  64. * This is set up by the setup-routine at boot-time
  65. * for S390 need to find out, what we have to setup
  66. * using address 0x10400 ...
  67. */
  68. #include <asm/setup.h>
  69. static char 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. /*
  79. * cpu_init() initializes state that is per-CPU.
  80. */
  81. void __devinit cpu_init (void)
  82. {
  83. int addr = hard_smp_processor_id();
  84. /*
  85. * Store processor id in lowcore (used e.g. in timer_interrupt)
  86. */
  87. asm volatile ("stidp %0": "=m" (S390_lowcore.cpu_data.cpu_id));
  88. S390_lowcore.cpu_data.cpu_addr = addr;
  89. /*
  90. * Force FPU initialization:
  91. */
  92. clear_thread_flag(TIF_USEDFPU);
  93. clear_used_math();
  94. atomic_inc(&init_mm.mm_count);
  95. current->active_mm = &init_mm;
  96. if (current->mm)
  97. BUG();
  98. enter_lazy_tlb(&init_mm, current);
  99. }
  100. /*
  101. * VM halt and poweroff setup routines
  102. */
  103. char vmhalt_cmd[128] = "";
  104. char vmpoff_cmd[128] = "";
  105. static inline void strncpy_skip_quote(char *dst, char *src, int n)
  106. {
  107. int sx, dx;
  108. dx = 0;
  109. for (sx = 0; src[sx] != 0; sx++) {
  110. if (src[sx] == '"') continue;
  111. dst[dx++] = src[sx];
  112. if (dx >= n) break;
  113. }
  114. }
  115. static int __init vmhalt_setup(char *str)
  116. {
  117. strncpy_skip_quote(vmhalt_cmd, str, 127);
  118. vmhalt_cmd[127] = 0;
  119. return 1;
  120. }
  121. __setup("vmhalt=", vmhalt_setup);
  122. static int __init vmpoff_setup(char *str)
  123. {
  124. strncpy_skip_quote(vmpoff_cmd, str, 127);
  125. vmpoff_cmd[127] = 0;
  126. return 1;
  127. }
  128. __setup("vmpoff=", vmpoff_setup);
  129. /*
  130. * condev= and conmode= setup parameter.
  131. */
  132. static int __init condev_setup(char *str)
  133. {
  134. int vdev;
  135. vdev = simple_strtoul(str, &str, 0);
  136. if (vdev >= 0 && vdev < 65536) {
  137. console_devno = vdev;
  138. console_irq = -1;
  139. }
  140. return 1;
  141. }
  142. __setup("condev=", condev_setup);
  143. static int __init conmode_setup(char *str)
  144. {
  145. #if defined(CONFIG_SCLP_CONSOLE)
  146. if (strncmp(str, "hwc", 4) == 0 || strncmp(str, "sclp", 5) == 0)
  147. SET_CONSOLE_SCLP;
  148. #endif
  149. #if defined(CONFIG_TN3215_CONSOLE)
  150. if (strncmp(str, "3215", 5) == 0)
  151. SET_CONSOLE_3215;
  152. #endif
  153. #if defined(CONFIG_TN3270_CONSOLE)
  154. if (strncmp(str, "3270", 5) == 0)
  155. SET_CONSOLE_3270;
  156. #endif
  157. return 1;
  158. }
  159. __setup("conmode=", conmode_setup);
  160. static void __init conmode_default(void)
  161. {
  162. char query_buffer[1024];
  163. char *ptr;
  164. if (MACHINE_IS_VM) {
  165. __cpcmd("QUERY CONSOLE", query_buffer, 1024);
  166. console_devno = simple_strtoul(query_buffer + 5, NULL, 16);
  167. ptr = strstr(query_buffer, "SUBCHANNEL =");
  168. console_irq = simple_strtoul(ptr + 13, NULL, 16);
  169. __cpcmd("QUERY TERM", query_buffer, 1024);
  170. ptr = strstr(query_buffer, "CONMODE");
  171. /*
  172. * Set the conmode to 3215 so that the device recognition
  173. * will set the cu_type of the console to 3215. If the
  174. * conmode is 3270 and we don't set it back then both
  175. * 3215 and the 3270 driver will try to access the console
  176. * device (3215 as console and 3270 as normal tty).
  177. */
  178. __cpcmd("TERM CONMODE 3215", NULL, 0);
  179. if (ptr == NULL) {
  180. #if defined(CONFIG_SCLP_CONSOLE)
  181. SET_CONSOLE_SCLP;
  182. #endif
  183. return;
  184. }
  185. if (strncmp(ptr + 8, "3270", 4) == 0) {
  186. #if defined(CONFIG_TN3270_CONSOLE)
  187. SET_CONSOLE_3270;
  188. #elif defined(CONFIG_TN3215_CONSOLE)
  189. SET_CONSOLE_3215;
  190. #elif defined(CONFIG_SCLP_CONSOLE)
  191. SET_CONSOLE_SCLP;
  192. #endif
  193. } else if (strncmp(ptr + 8, "3215", 4) == 0) {
  194. #if defined(CONFIG_TN3215_CONSOLE)
  195. SET_CONSOLE_3215;
  196. #elif defined(CONFIG_TN3270_CONSOLE)
  197. SET_CONSOLE_3270;
  198. #elif defined(CONFIG_SCLP_CONSOLE)
  199. SET_CONSOLE_SCLP;
  200. #endif
  201. }
  202. } else if (MACHINE_IS_P390) {
  203. #if defined(CONFIG_TN3215_CONSOLE)
  204. SET_CONSOLE_3215;
  205. #elif defined(CONFIG_TN3270_CONSOLE)
  206. SET_CONSOLE_3270;
  207. #endif
  208. } else {
  209. #if defined(CONFIG_SCLP_CONSOLE)
  210. SET_CONSOLE_SCLP;
  211. #endif
  212. }
  213. }
  214. #ifdef CONFIG_SMP
  215. extern void machine_restart_smp(char *);
  216. extern void machine_halt_smp(void);
  217. extern void machine_power_off_smp(void);
  218. void (*_machine_restart)(char *command) = machine_restart_smp;
  219. void (*_machine_halt)(void) = machine_halt_smp;
  220. void (*_machine_power_off)(void) = machine_power_off_smp;
  221. #else
  222. /*
  223. * Reboot, halt and power_off routines for non SMP.
  224. */
  225. extern void reipl(unsigned long devno);
  226. static void do_machine_restart_nonsmp(char * __unused)
  227. {
  228. if (MACHINE_IS_VM)
  229. cpcmd ("IPL", NULL, 0);
  230. else
  231. reipl (0x10000 | S390_lowcore.ipl_device);
  232. }
  233. static void do_machine_halt_nonsmp(void)
  234. {
  235. if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
  236. cpcmd(vmhalt_cmd, NULL, 0);
  237. signal_processor(smp_processor_id(), sigp_stop_and_store_status);
  238. }
  239. static void do_machine_power_off_nonsmp(void)
  240. {
  241. if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
  242. cpcmd(vmpoff_cmd, NULL, 0);
  243. signal_processor(smp_processor_id(), sigp_stop_and_store_status);
  244. }
  245. void (*_machine_restart)(char *command) = do_machine_restart_nonsmp;
  246. void (*_machine_halt)(void) = do_machine_halt_nonsmp;
  247. void (*_machine_power_off)(void) = do_machine_power_off_nonsmp;
  248. #endif
  249. /*
  250. * Reboot, halt and power_off stubs. They just call _machine_restart,
  251. * _machine_halt or _machine_power_off.
  252. */
  253. void machine_restart(char *command)
  254. {
  255. console_unblank();
  256. _machine_restart(command);
  257. }
  258. EXPORT_SYMBOL(machine_restart);
  259. void machine_halt(void)
  260. {
  261. console_unblank();
  262. _machine_halt();
  263. }
  264. EXPORT_SYMBOL(machine_halt);
  265. void machine_power_off(void)
  266. {
  267. console_unblank();
  268. _machine_power_off();
  269. }
  270. EXPORT_SYMBOL(machine_power_off);
  271. /*
  272. * Setup function called from init/main.c just after the banner
  273. * was printed.
  274. */
  275. extern char _pstart, _pend, _stext;
  276. void __init setup_arch(char **cmdline_p)
  277. {
  278. unsigned long bootmap_size;
  279. unsigned long memory_start, memory_end;
  280. char c = ' ', cn, *to = command_line, *from = COMMAND_LINE;
  281. unsigned long start_pfn, end_pfn;
  282. static unsigned int smptrap=0;
  283. unsigned long delay = 0;
  284. struct _lowcore *lc;
  285. int i;
  286. if (smptrap)
  287. return;
  288. smptrap=1;
  289. /*
  290. * print what head.S has found out about the machine
  291. */
  292. #ifndef CONFIG_ARCH_S390X
  293. printk((MACHINE_IS_VM) ?
  294. "We are running under VM (31 bit mode)\n" :
  295. "We are running native (31 bit mode)\n");
  296. printk((MACHINE_HAS_IEEE) ?
  297. "This machine has an IEEE fpu\n" :
  298. "This machine has no IEEE fpu\n");
  299. #else /* CONFIG_ARCH_S390X */
  300. printk((MACHINE_IS_VM) ?
  301. "We are running under VM (64 bit mode)\n" :
  302. "We are running native (64 bit mode)\n");
  303. #endif /* CONFIG_ARCH_S390X */
  304. ROOT_DEV = Root_RAM0;
  305. memory_start = (unsigned long) &_end; /* fixit if use $CODELO etc*/
  306. #ifndef CONFIG_ARCH_S390X
  307. memory_end = memory_size & ~0x400000UL; /* align memory end to 4MB */
  308. /*
  309. * We need some free virtual space to be able to do vmalloc.
  310. * On a machine with 2GB memory we make sure that we have at
  311. * least 128 MB free space for vmalloc.
  312. */
  313. if (memory_end > 1920*1024*1024)
  314. memory_end = 1920*1024*1024;
  315. #else /* CONFIG_ARCH_S390X */
  316. memory_end = memory_size & ~0x200000UL; /* detected in head.s */
  317. #endif /* CONFIG_ARCH_S390X */
  318. init_mm.start_code = PAGE_OFFSET;
  319. init_mm.end_code = (unsigned long) &_etext;
  320. init_mm.end_data = (unsigned long) &_edata;
  321. init_mm.brk = (unsigned long) &_end;
  322. code_resource.start = (unsigned long) &_text;
  323. code_resource.end = (unsigned long) &_etext - 1;
  324. data_resource.start = (unsigned long) &_etext;
  325. data_resource.end = (unsigned long) &_edata - 1;
  326. /* Save unparsed command line copy for /proc/cmdline */
  327. memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
  328. saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
  329. for (;;) {
  330. /*
  331. * "mem=XXX[kKmM]" sets memsize
  332. */
  333. if (c == ' ' && strncmp(from, "mem=", 4) == 0) {
  334. memory_end = simple_strtoul(from+4, &from, 0);
  335. if ( *from == 'K' || *from == 'k' ) {
  336. memory_end = memory_end << 10;
  337. from++;
  338. } else if ( *from == 'M' || *from == 'm' ) {
  339. memory_end = memory_end << 20;
  340. from++;
  341. }
  342. }
  343. /*
  344. * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes
  345. */
  346. if (c == ' ' && strncmp(from, "ipldelay=", 9) == 0) {
  347. delay = simple_strtoul(from+9, &from, 0);
  348. if (*from == 's' || *from == 'S') {
  349. delay = delay*1000000;
  350. from++;
  351. } else if (*from == 'm' || *from == 'M') {
  352. delay = delay*60*1000000;
  353. from++;
  354. }
  355. /* now wait for the requested amount of time */
  356. udelay(delay);
  357. }
  358. cn = *(from++);
  359. if (!cn)
  360. break;
  361. if (cn == '\n')
  362. cn = ' '; /* replace newlines with space */
  363. if (cn == 0x0d)
  364. cn = ' '; /* replace 0x0d with space */
  365. if (cn == ' ' && c == ' ')
  366. continue; /* remove additional spaces */
  367. c = cn;
  368. if (to - command_line >= COMMAND_LINE_SIZE)
  369. break;
  370. *(to++) = c;
  371. }
  372. if (c == ' ' && to > command_line) to--;
  373. *to = '\0';
  374. *cmdline_p = command_line;
  375. /*
  376. * partially used pages are not usable - thus
  377. * we are rounding upwards:
  378. */
  379. start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT;
  380. end_pfn = max_pfn = memory_end >> PAGE_SHIFT;
  381. /*
  382. * Initialize the boot-time allocator (with low memory only):
  383. */
  384. bootmap_size = init_bootmem(start_pfn, end_pfn);
  385. /*
  386. * Register RAM areas with the bootmem allocator.
  387. */
  388. for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) {
  389. unsigned long start_chunk, end_chunk;
  390. if (memory_chunk[i].type != CHUNK_READ_WRITE)
  391. continue;
  392. start_chunk = (memory_chunk[i].addr + PAGE_SIZE - 1);
  393. start_chunk >>= PAGE_SHIFT;
  394. end_chunk = (memory_chunk[i].addr + memory_chunk[i].size);
  395. end_chunk >>= PAGE_SHIFT;
  396. if (start_chunk < start_pfn)
  397. start_chunk = start_pfn;
  398. if (end_chunk > end_pfn)
  399. end_chunk = end_pfn;
  400. if (start_chunk < end_chunk)
  401. free_bootmem(start_chunk << PAGE_SHIFT,
  402. (end_chunk - start_chunk) << PAGE_SHIFT);
  403. }
  404. /*
  405. * Reserve the bootmem bitmap itself as well. We do this in two
  406. * steps (first step was init_bootmem()) because this catches
  407. * the (very unlikely) case of us accidentally initializing the
  408. * bootmem allocator with an invalid RAM area.
  409. */
  410. reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size);
  411. #ifdef CONFIG_BLK_DEV_INITRD
  412. if (INITRD_START) {
  413. if (INITRD_START + INITRD_SIZE <= memory_end) {
  414. reserve_bootmem(INITRD_START, INITRD_SIZE);
  415. initrd_start = INITRD_START;
  416. initrd_end = initrd_start + INITRD_SIZE;
  417. } else {
  418. printk("initrd extends beyond end of memory "
  419. "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
  420. initrd_start + INITRD_SIZE, memory_end);
  421. initrd_start = initrd_end = 0;
  422. }
  423. }
  424. #endif
  425. for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) {
  426. struct resource *res;
  427. res = alloc_bootmem_low(sizeof(struct resource));
  428. res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
  429. switch (memory_chunk[i].type) {
  430. case CHUNK_READ_WRITE:
  431. res->name = "System RAM";
  432. break;
  433. case CHUNK_READ_ONLY:
  434. res->name = "System ROM";
  435. res->flags |= IORESOURCE_READONLY;
  436. break;
  437. default:
  438. res->name = "reserved";
  439. }
  440. res->start = memory_chunk[i].addr;
  441. res->end = memory_chunk[i].addr + memory_chunk[i].size - 1;
  442. request_resource(&iomem_resource, res);
  443. request_resource(res, &code_resource);
  444. request_resource(res, &data_resource);
  445. }
  446. /*
  447. * Setup lowcore for boot cpu
  448. */
  449. #ifndef CONFIG_ARCH_S390X
  450. lc = (struct _lowcore *) __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0);
  451. memset(lc, 0, PAGE_SIZE);
  452. #else /* CONFIG_ARCH_S390X */
  453. lc = (struct _lowcore *) __alloc_bootmem(2*PAGE_SIZE, 2*PAGE_SIZE, 0);
  454. memset(lc, 0, 2*PAGE_SIZE);
  455. #endif /* CONFIG_ARCH_S390X */
  456. lc->restart_psw.mask = PSW_BASE_BITS;
  457. lc->restart_psw.addr =
  458. PSW_ADDR_AMODE | (unsigned long) restart_int_handler;
  459. lc->external_new_psw.mask = PSW_KERNEL_BITS;
  460. lc->external_new_psw.addr =
  461. PSW_ADDR_AMODE | (unsigned long) ext_int_handler;
  462. lc->svc_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_IO | PSW_MASK_EXT;
  463. lc->svc_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) system_call;
  464. lc->program_new_psw.mask = PSW_KERNEL_BITS;
  465. lc->program_new_psw.addr =
  466. PSW_ADDR_AMODE | (unsigned long)pgm_check_handler;
  467. lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
  468. lc->mcck_new_psw.addr =
  469. PSW_ADDR_AMODE | (unsigned long) mcck_int_handler;
  470. lc->io_new_psw.mask = PSW_KERNEL_BITS;
  471. lc->io_new_psw.addr = PSW_ADDR_AMODE | (unsigned long) io_int_handler;
  472. lc->ipl_device = S390_lowcore.ipl_device;
  473. lc->jiffy_timer = -1LL;
  474. lc->kernel_stack = ((unsigned long) &init_thread_union) + THREAD_SIZE;
  475. lc->async_stack = (unsigned long)
  476. __alloc_bootmem(ASYNC_SIZE, ASYNC_SIZE, 0) + ASYNC_SIZE;
  477. #ifdef CONFIG_CHECK_STACK
  478. lc->panic_stack = (unsigned long)
  479. __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE;
  480. #endif
  481. lc->current_task = (unsigned long) init_thread_union.thread_info.task;
  482. lc->thread_info = (unsigned long) &init_thread_union;
  483. #ifdef CONFIG_ARCH_S390X
  484. if (MACHINE_HAS_DIAG44)
  485. lc->diag44_opcode = 0x83000044;
  486. else
  487. lc->diag44_opcode = 0x07000700;
  488. #endif /* CONFIG_ARCH_S390X */
  489. set_prefix((u32)(unsigned long) lc);
  490. cpu_init();
  491. __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
  492. /*
  493. * Create kernel page tables and switch to virtual addressing.
  494. */
  495. paging_init();
  496. /* Setup default console */
  497. conmode_default();
  498. }
  499. void print_cpu_info(struct cpuinfo_S390 *cpuinfo)
  500. {
  501. printk("cpu %d "
  502. #ifdef CONFIG_SMP
  503. "phys_idx=%d "
  504. #endif
  505. "vers=%02X ident=%06X machine=%04X unused=%04X\n",
  506. cpuinfo->cpu_nr,
  507. #ifdef CONFIG_SMP
  508. cpuinfo->cpu_addr,
  509. #endif
  510. cpuinfo->cpu_id.version,
  511. cpuinfo->cpu_id.ident,
  512. cpuinfo->cpu_id.machine,
  513. cpuinfo->cpu_id.unused);
  514. }
  515. /*
  516. * show_cpuinfo - Get information on one CPU for use by procfs.
  517. */
  518. static int show_cpuinfo(struct seq_file *m, void *v)
  519. {
  520. struct cpuinfo_S390 *cpuinfo;
  521. unsigned long n = (unsigned long) v - 1;
  522. if (!n) {
  523. seq_printf(m, "vendor_id : IBM/S390\n"
  524. "# processors : %i\n"
  525. "bogomips per cpu: %lu.%02lu\n",
  526. num_online_cpus(), loops_per_jiffy/(500000/HZ),
  527. (loops_per_jiffy/(5000/HZ))%100);
  528. }
  529. if (cpu_online(n)) {
  530. #ifdef CONFIG_SMP
  531. if (smp_processor_id() == n)
  532. cpuinfo = &S390_lowcore.cpu_data;
  533. else
  534. cpuinfo = &lowcore_ptr[n]->cpu_data;
  535. #else
  536. cpuinfo = &S390_lowcore.cpu_data;
  537. #endif
  538. seq_printf(m, "processor %li: "
  539. "version = %02X, "
  540. "identification = %06X, "
  541. "machine = %04X\n",
  542. n, cpuinfo->cpu_id.version,
  543. cpuinfo->cpu_id.ident,
  544. cpuinfo->cpu_id.machine);
  545. }
  546. return 0;
  547. }
  548. static void *c_start(struct seq_file *m, loff_t *pos)
  549. {
  550. return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL;
  551. }
  552. static void *c_next(struct seq_file *m, void *v, loff_t *pos)
  553. {
  554. ++*pos;
  555. return c_start(m, pos);
  556. }
  557. static void c_stop(struct seq_file *m, void *v)
  558. {
  559. }
  560. struct seq_operations cpuinfo_op = {
  561. .start = c_start,
  562. .next = c_next,
  563. .stop = c_stop,
  564. .show = show_cpuinfo,
  565. };