2 * arch/s390/kernel/ipl.c
3 * ipl/reipl/dump support for Linux on s390.
5 * Copyright (C) IBM Corp. 2005,2006
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com>
8 * Volker Sameske <sameske@de.ibm.com>
11 #include <linux/types.h>
12 #include <linux/module.h>
13 #include <linux/device.h>
14 #include <linux/delay.h>
15 #include <linux/reboot.h>
17 #include <asm/setup.h>
18 #include <asm/cpcmd.h>
21 #define IPL_PARM_BLOCK_VERSION 0
30 #define IPL_NONE_STR "none"
31 #define IPL_UNKNOWN_STR "unknown"
32 #define IPL_CCW_STR "ccw"
33 #define IPL_FCP_STR "fcp"
35 static char *ipl_type_str(enum ipl_type type)
44 case IPL_TYPE_UNKNOWN:
46 return IPL_UNKNOWN_STR;
55 IPL_METHOD_FCP_RO_DIAG,
56 IPL_METHOD_FCP_RW_DIAG,
60 enum shutdown_action {
66 #define SHUTDOWN_REIPL_STR "reipl"
67 #define SHUTDOWN_DUMP_STR "dump"
68 #define SHUTDOWN_STOP_STR "stop"
70 static char *shutdown_action_str(enum shutdown_action action)
74 return SHUTDOWN_REIPL_STR;
76 return SHUTDOWN_DUMP_STR;
78 return SHUTDOWN_STOP_STR;
84 enum diag308_subcode {
91 enum diag308_ipl_type {
92 DIAG308_IPL_TYPE_FCP = 0,
93 DIAG308_IPL_TYPE_CCW = 2,
97 DIAG308_IPL_OPT_IPL = 0x10,
98 DIAG308_IPL_OPT_DUMP = 0x20,
105 static int diag308_set_works = 0;
107 static int reipl_capabilities = IPL_TYPE_UNKNOWN;
108 static enum ipl_type reipl_type = IPL_TYPE_UNKNOWN;
109 static enum ipl_method reipl_method = IPL_METHOD_NONE;
110 static struct ipl_parameter_block *reipl_block_fcp;
111 static struct ipl_parameter_block *reipl_block_ccw;
113 static int dump_capabilities = IPL_TYPE_NONE;
114 static enum ipl_type dump_type = IPL_TYPE_NONE;
115 static enum ipl_method dump_method = IPL_METHOD_NONE;
116 static struct ipl_parameter_block *dump_block_fcp;
117 static struct ipl_parameter_block *dump_block_ccw;
119 static enum shutdown_action on_panic_action = SHUTDOWN_STOP;
121 static int diag308(unsigned long subcode, void *addr)
123 register unsigned long _addr asm("0") = (unsigned long) addr;
124 register unsigned long _rc asm("1") = 0;
127 " diag %0,%2,0x308\n"
130 : "+d" (_addr), "+d" (_rc)
131 : "d" (subcode) : "cc", "memory");
137 #define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
138 static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \
141 return sprintf(page, _format, _value); \
143 static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
144 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
146 #define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
147 static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \
150 return sprintf(page, _fmt_out, \
151 (unsigned long long) _value); \
153 static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\
154 const char *buf, size_t len) \
156 unsigned long long value; \
157 if (sscanf(buf, _fmt_in, &value) != 1) \
162 static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
163 __ATTR(_name,(S_IRUGO | S_IWUSR), \
164 sys_##_prefix##_##_name##_show, \
165 sys_##_prefix##_##_name##_store);
167 static void make_attrs_ro(struct attribute **attrs)
170 (*attrs)->mode = S_IRUGO;
179 static enum ipl_type ipl_get_type(void)
181 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
183 if (!(ipl_flags & IPL_DEVNO_VALID))
184 return IPL_TYPE_UNKNOWN;
185 if (!(ipl_flags & IPL_PARMBLOCK_VALID))
187 if (ipl->hdr.version > IPL_MAX_SUPPORTED_VERSION)
188 return IPL_TYPE_UNKNOWN;
189 if (ipl->hdr.pbt != DIAG308_IPL_TYPE_FCP)
190 return IPL_TYPE_UNKNOWN;
194 static ssize_t ipl_type_show(struct subsystem *subsys, char *page)
196 return sprintf(page, "%s\n", ipl_type_str(ipl_get_type()));
199 static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
201 static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page)
203 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
205 switch (ipl_get_type()) {
207 return sprintf(page, "0.0.%04x\n", ipl_devno);
209 return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno);
215 static struct subsys_attribute sys_ipl_device_attr =
216 __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL);
218 static ssize_t ipl_parameter_read(struct kobject *kobj, char *buf, loff_t off,
221 unsigned int size = IPL_PARMBLOCK_SIZE;
225 if (off + count > size)
227 memcpy(buf, (void *)IPL_PARMBLOCK_START + off, count);
231 static struct bin_attribute ipl_parameter_attr = {
233 .name = "binary_parameter",
235 .owner = THIS_MODULE,
238 .read = &ipl_parameter_read,
241 static ssize_t ipl_scp_data_read(struct kobject *kobj, char *buf, loff_t off,
244 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len;
245 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data;
249 if (off + count > size)
251 memcpy(buf, scp_data + off, count);
255 static struct bin_attribute ipl_scp_data_attr = {
259 .owner = THIS_MODULE,
262 .read = &ipl_scp_data_read,
265 /* FCP ipl device attributes */
267 DEFINE_IPL_ATTR_RO(ipl_fcp, wwpn, "0x%016llx\n", (unsigned long long)
268 IPL_PARMBLOCK_START->ipl_info.fcp.wwpn);
269 DEFINE_IPL_ATTR_RO(ipl_fcp, lun, "0x%016llx\n", (unsigned long long)
270 IPL_PARMBLOCK_START->ipl_info.fcp.lun);
271 DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long)
272 IPL_PARMBLOCK_START->ipl_info.fcp.bootprog);
273 DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long)
274 IPL_PARMBLOCK_START->ipl_info.fcp.br_lba);
276 static struct attribute *ipl_fcp_attrs[] = {
277 &sys_ipl_type_attr.attr,
278 &sys_ipl_device_attr.attr,
279 &sys_ipl_fcp_wwpn_attr.attr,
280 &sys_ipl_fcp_lun_attr.attr,
281 &sys_ipl_fcp_bootprog_attr.attr,
282 &sys_ipl_fcp_br_lba_attr.attr,
286 static struct attribute_group ipl_fcp_attr_group = {
287 .attrs = ipl_fcp_attrs,
290 /* CCW ipl device attributes */
292 static struct attribute *ipl_ccw_attrs[] = {
293 &sys_ipl_type_attr.attr,
294 &sys_ipl_device_attr.attr,
298 static struct attribute_group ipl_ccw_attr_group = {
299 .attrs = ipl_ccw_attrs,
302 /* UNKNOWN ipl device attributes */
304 static struct attribute *ipl_unknown_attrs[] = {
305 &sys_ipl_type_attr.attr,
309 static struct attribute_group ipl_unknown_attr_group = {
310 .attrs = ipl_unknown_attrs,
313 static decl_subsys(ipl, NULL, NULL);
319 /* FCP reipl device attributes */
321 DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%016llx\n",
322 reipl_block_fcp->ipl_info.fcp.wwpn);
323 DEFINE_IPL_ATTR_RW(reipl_fcp, lun, "0x%016llx\n", "%016llx\n",
324 reipl_block_fcp->ipl_info.fcp.lun);
325 DEFINE_IPL_ATTR_RW(reipl_fcp, bootprog, "%lld\n", "%lld\n",
326 reipl_block_fcp->ipl_info.fcp.bootprog);
327 DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n",
328 reipl_block_fcp->ipl_info.fcp.br_lba);
329 DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
330 reipl_block_fcp->ipl_info.fcp.devno);
332 static struct attribute *reipl_fcp_attrs[] = {
333 &sys_reipl_fcp_device_attr.attr,
334 &sys_reipl_fcp_wwpn_attr.attr,
335 &sys_reipl_fcp_lun_attr.attr,
336 &sys_reipl_fcp_bootprog_attr.attr,
337 &sys_reipl_fcp_br_lba_attr.attr,
341 static struct attribute_group reipl_fcp_attr_group = {
343 .attrs = reipl_fcp_attrs,
346 /* CCW reipl device attributes */
348 DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
349 reipl_block_ccw->ipl_info.ccw.devno);
351 static struct attribute *reipl_ccw_attrs[] = {
352 &sys_reipl_ccw_device_attr.attr,
356 static struct attribute_group reipl_ccw_attr_group = {
358 .attrs = reipl_ccw_attrs,
363 static int reipl_set_type(enum ipl_type type)
365 if (!(reipl_capabilities & type))
371 reipl_method = IPL_METHOD_CCW_VM;
373 reipl_method = IPL_METHOD_CCW_CIO;
376 if (diag308_set_works)
377 reipl_method = IPL_METHOD_FCP_RW_DIAG;
378 else if (MACHINE_IS_VM)
379 reipl_method = IPL_METHOD_FCP_RO_VM;
381 reipl_method = IPL_METHOD_FCP_RO_DIAG;
384 reipl_method = IPL_METHOD_NONE;
390 static ssize_t reipl_type_show(struct subsystem *subsys, char *page)
392 return sprintf(page, "%s\n", ipl_type_str(reipl_type));
395 static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf,
400 if (strncmp(buf, IPL_CCW_STR, strlen(IPL_CCW_STR)) == 0)
401 rc = reipl_set_type(IPL_TYPE_CCW);
402 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0)
403 rc = reipl_set_type(IPL_TYPE_FCP);
404 return (rc != 0) ? rc : len;
407 static struct subsys_attribute reipl_type_attr =
408 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store);
410 static decl_subsys(reipl, NULL, NULL);
416 /* FCP dump device attributes */
418 DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%016llx\n",
419 dump_block_fcp->ipl_info.fcp.wwpn);
420 DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%016llx\n",
421 dump_block_fcp->ipl_info.fcp.lun);
422 DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n",
423 dump_block_fcp->ipl_info.fcp.bootprog);
424 DEFINE_IPL_ATTR_RW(dump_fcp, br_lba, "%lld\n", "%lld\n",
425 dump_block_fcp->ipl_info.fcp.br_lba);
426 DEFINE_IPL_ATTR_RW(dump_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
427 dump_block_fcp->ipl_info.fcp.devno);
429 static struct attribute *dump_fcp_attrs[] = {
430 &sys_dump_fcp_device_attr.attr,
431 &sys_dump_fcp_wwpn_attr.attr,
432 &sys_dump_fcp_lun_attr.attr,
433 &sys_dump_fcp_bootprog_attr.attr,
434 &sys_dump_fcp_br_lba_attr.attr,
438 static struct attribute_group dump_fcp_attr_group = {
440 .attrs = dump_fcp_attrs,
443 /* CCW dump device attributes */
445 DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
446 dump_block_ccw->ipl_info.ccw.devno);
448 static struct attribute *dump_ccw_attrs[] = {
449 &sys_dump_ccw_device_attr.attr,
453 static struct attribute_group dump_ccw_attr_group = {
455 .attrs = dump_ccw_attrs,
460 static int dump_set_type(enum ipl_type type)
462 if (!(dump_capabilities & type))
467 dump_method = IPL_METHOD_CCW_VM;
469 dump_method = IPL_METHOD_CCW_CIO;
472 dump_method = IPL_METHOD_FCP_RW_DIAG;
475 dump_method = IPL_METHOD_NONE;
481 static ssize_t dump_type_show(struct subsystem *subsys, char *page)
483 return sprintf(page, "%s\n", ipl_type_str(dump_type));
486 static ssize_t dump_type_store(struct subsystem *subsys, const char *buf,
491 if (strncmp(buf, IPL_NONE_STR, strlen(IPL_NONE_STR)) == 0)
492 rc = dump_set_type(IPL_TYPE_NONE);
493 else if (strncmp(buf, IPL_CCW_STR, strlen(IPL_CCW_STR)) == 0)
494 rc = dump_set_type(IPL_TYPE_CCW);
495 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0)
496 rc = dump_set_type(IPL_TYPE_FCP);
497 return (rc != 0) ? rc : len;
500 static struct subsys_attribute dump_type_attr =
501 __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
503 static decl_subsys(dump, NULL, NULL);
506 static void dump_smp_stop_all(void)
510 for_each_online_cpu(cpu) {
511 if (cpu == smp_processor_id())
513 while (signal_processor(cpu, sigp_stop) == sigp_busy)
519 #define dump_smp_stop_all() do { } while (0)
523 * Shutdown actions section
526 static decl_subsys(shutdown_actions, NULL, NULL);
530 static ssize_t on_panic_show(struct subsystem *subsys, char *page)
532 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
535 static ssize_t on_panic_store(struct subsystem *subsys, const char *buf,
538 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
539 on_panic_action = SHUTDOWN_REIPL;
540 else if (strncmp(buf, SHUTDOWN_DUMP_STR,
541 strlen(SHUTDOWN_DUMP_STR)) == 0)
542 on_panic_action = SHUTDOWN_DUMP;
543 else if (strncmp(buf, SHUTDOWN_STOP_STR,
544 strlen(SHUTDOWN_STOP_STR)) == 0)
545 on_panic_action = SHUTDOWN_STOP;
552 static struct subsys_attribute on_panic_attr =
553 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
555 static void print_fcp_block(struct ipl_parameter_block *fcp_block)
557 printk(KERN_EMERG "wwpn: %016llx\n",
558 (unsigned long long)fcp_block->ipl_info.fcp.wwpn);
559 printk(KERN_EMERG "lun: %016llx\n",
560 (unsigned long long)fcp_block->ipl_info.fcp.lun);
561 printk(KERN_EMERG "bootprog: %lld\n",
562 (unsigned long long)fcp_block->ipl_info.fcp.bootprog);
563 printk(KERN_EMERG "br_lba: %lld\n",
564 (unsigned long long)fcp_block->ipl_info.fcp.br_lba);
565 printk(KERN_EMERG "device: %llx\n",
566 (unsigned long long)fcp_block->ipl_info.fcp.devno);
567 printk(KERN_EMERG "opt: %x\n", fcp_block->ipl_info.fcp.opt);
572 struct ccw_dev_id devid;
573 static char buf[100];
575 switch (reipl_type) {
577 printk(KERN_EMERG "reboot on ccw device: 0.0.%04x\n",
578 reipl_block_ccw->ipl_info.ccw.devno);
581 printk(KERN_EMERG "reboot on fcp device:\n");
582 print_fcp_block(reipl_block_fcp);
588 switch (reipl_method) {
589 case IPL_METHOD_CCW_CIO:
590 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
592 reipl_ccw_dev(&devid);
594 case IPL_METHOD_CCW_VM:
595 sprintf(buf, "IPL %X", reipl_block_ccw->ipl_info.ccw.devno);
596 cpcmd(buf, NULL, 0, NULL);
598 case IPL_METHOD_CCW_DIAG:
599 diag308(DIAG308_SET, reipl_block_ccw);
600 diag308(DIAG308_IPL, NULL);
602 case IPL_METHOD_FCP_RW_DIAG:
603 diag308(DIAG308_SET, reipl_block_fcp);
604 diag308(DIAG308_IPL, NULL);
606 case IPL_METHOD_FCP_RO_DIAG:
607 diag308(DIAG308_IPL, NULL);
609 case IPL_METHOD_FCP_RO_VM:
610 cpcmd("IPL", NULL, 0, NULL);
612 case IPL_METHOD_NONE:
615 cpcmd("IPL", NULL, 0, NULL);
616 diag308(DIAG308_IPL, NULL);
619 panic("reipl failed!\n");
622 static void do_dump(void)
624 struct ccw_dev_id devid;
625 static char buf[100];
629 printk(KERN_EMERG "Automatic dump on ccw device: 0.0.%04x\n",
630 dump_block_ccw->ipl_info.ccw.devno);
633 printk(KERN_EMERG "Automatic dump on fcp device:\n");
634 print_fcp_block(dump_block_fcp);
640 switch (dump_method) {
641 case IPL_METHOD_CCW_CIO:
643 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
645 reipl_ccw_dev(&devid);
647 case IPL_METHOD_CCW_VM:
649 sprintf(buf, "STORE STATUS");
650 cpcmd(buf, NULL, 0, NULL);
651 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
652 cpcmd(buf, NULL, 0, NULL);
654 case IPL_METHOD_CCW_DIAG:
655 diag308(DIAG308_SET, dump_block_ccw);
656 diag308(DIAG308_DUMP, NULL);
658 case IPL_METHOD_FCP_RW_DIAG:
659 diag308(DIAG308_SET, dump_block_fcp);
660 diag308(DIAG308_DUMP, NULL);
662 case IPL_METHOD_NONE:
666 printk(KERN_EMERG "Dump failed!\n");
671 static int __init ipl_register_fcp_files(void)
675 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
676 &ipl_fcp_attr_group);
679 rc = sysfs_create_bin_file(&ipl_subsys.kset.kobj,
680 &ipl_parameter_attr);
683 rc = sysfs_create_bin_file(&ipl_subsys.kset.kobj,
688 sysfs_remove_bin_file(&ipl_subsys.kset.kobj, &ipl_parameter_attr);
691 sysfs_remove_group(&ipl_subsys.kset.kobj, &ipl_fcp_attr_group);
696 static int __init ipl_init(void)
700 rc = firmware_register(&ipl_subsys);
703 switch (ipl_get_type()) {
705 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
706 &ipl_ccw_attr_group);
709 rc = ipl_register_fcp_files();
712 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
713 &ipl_unknown_attr_group);
717 firmware_unregister(&ipl_subsys);
721 static void __init reipl_probe(void)
725 buffer = (void *) get_zeroed_page(GFP_KERNEL);
728 if (diag308(DIAG308_STORE, buffer) == DIAG308_RC_OK)
729 diag308_set_works = 1;
730 free_page((unsigned long)buffer);
733 static int __init reipl_ccw_init(void)
737 reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
738 if (!reipl_block_ccw)
740 rc = sysfs_create_group(&reipl_subsys.kset.kobj, &reipl_ccw_attr_group);
742 free_page((unsigned long)reipl_block_ccw);
745 reipl_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
746 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
747 reipl_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw);
748 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
749 if (ipl_get_type() == IPL_TYPE_CCW)
750 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
751 reipl_capabilities |= IPL_TYPE_CCW;
755 static int __init reipl_fcp_init(void)
759 if ((!diag308_set_works) && (ipl_get_type() != IPL_TYPE_FCP))
761 if ((!diag308_set_works) && (ipl_get_type() == IPL_TYPE_FCP))
762 make_attrs_ro(reipl_fcp_attrs);
764 reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
765 if (!reipl_block_fcp)
767 rc = sysfs_create_group(&reipl_subsys.kset.kobj, &reipl_fcp_attr_group);
769 free_page((unsigned long)reipl_block_fcp);
772 if (ipl_get_type() == IPL_TYPE_FCP) {
773 memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE);
775 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
776 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
777 reipl_block_fcp->hdr.blk0_len =
778 sizeof(reipl_block_fcp->ipl_info.fcp);
779 reipl_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
780 reipl_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_IPL;
782 reipl_capabilities |= IPL_TYPE_FCP;
786 static int __init reipl_init(void)
790 rc = firmware_register(&reipl_subsys);
793 rc = subsys_create_file(&reipl_subsys, &reipl_type_attr);
795 firmware_unregister(&reipl_subsys);
798 rc = reipl_ccw_init();
801 rc = reipl_fcp_init();
804 rc = reipl_set_type(ipl_get_type());
810 static int __init dump_ccw_init(void)
814 dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
817 rc = sysfs_create_group(&dump_subsys.kset.kobj, &dump_ccw_attr_group);
819 free_page((unsigned long)dump_block_ccw);
822 dump_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
823 dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
824 dump_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw);
825 dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
826 dump_capabilities |= IPL_TYPE_CCW;
830 extern char s390_readinfo_sccb[];
832 static int __init dump_fcp_init(void)
836 if(!(s390_readinfo_sccb[91] & 0x2))
837 return 0; /* LDIPL DUMP is not installed */
838 if (!diag308_set_works)
840 dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
843 rc = sysfs_create_group(&dump_subsys.kset.kobj, &dump_fcp_attr_group);
845 free_page((unsigned long)dump_block_fcp);
848 dump_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
849 dump_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
850 dump_block_fcp->hdr.blk0_len = sizeof(dump_block_fcp->ipl_info.fcp);
851 dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
852 dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP;
853 dump_capabilities |= IPL_TYPE_FCP;
857 #define SHUTDOWN_ON_PANIC_PRIO 0
859 static int shutdown_on_panic_notify(struct notifier_block *self,
860 unsigned long event, void *data)
862 if (on_panic_action == SHUTDOWN_DUMP)
864 else if (on_panic_action == SHUTDOWN_REIPL)
869 static struct notifier_block shutdown_on_panic_nb = {
870 .notifier_call = shutdown_on_panic_notify,
871 .priority = SHUTDOWN_ON_PANIC_PRIO
874 static int __init dump_init(void)
878 rc = firmware_register(&dump_subsys);
881 rc = subsys_create_file(&dump_subsys, &dump_type_attr);
883 firmware_unregister(&dump_subsys);
886 rc = dump_ccw_init();
889 rc = dump_fcp_init();
892 dump_set_type(IPL_TYPE_NONE);
896 static int __init shutdown_actions_init(void)
900 rc = firmware_register(&shutdown_actions_subsys);
903 rc = subsys_create_file(&shutdown_actions_subsys, &on_panic_attr);
905 firmware_unregister(&shutdown_actions_subsys);
908 atomic_notifier_chain_register(&panic_notifier_list,
909 &shutdown_on_panic_nb);
913 static int __init s390_ipl_init(void)
927 rc = shutdown_actions_init();
933 __initcall(s390_ipl_init);