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