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"
129 ".section __ex_table,\"a\"\n"
138 : "+d" (_addr), "+d" (_rc)
139 : "d" (subcode) : "cc", "memory" );
146 #define DEFINE_IPL_ATTR_RO(_prefix, _name, _format, _value) \
147 static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \
150 return sprintf(page, _format, _value); \
152 static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
153 __ATTR(_name, S_IRUGO, sys_##_prefix##_##_name##_show, NULL);
155 #define DEFINE_IPL_ATTR_RW(_prefix, _name, _fmt_out, _fmt_in, _value) \
156 static ssize_t sys_##_prefix##_##_name##_show(struct subsystem *subsys, \
159 return sprintf(page, _fmt_out, \
160 (unsigned long long) _value); \
162 static ssize_t sys_##_prefix##_##_name##_store(struct subsystem *subsys,\
163 const char *buf, size_t len) \
165 unsigned long long value; \
166 if (sscanf(buf, _fmt_in, &value) != 1) \
171 static struct subsys_attribute sys_##_prefix##_##_name##_attr = \
172 __ATTR(_name,(S_IRUGO | S_IWUSR), \
173 sys_##_prefix##_##_name##_show, \
174 sys_##_prefix##_##_name##_store);
176 static void make_attrs_ro(struct attribute **attrs)
179 (*attrs)->mode = S_IRUGO;
188 static enum ipl_type ipl_get_type(void)
190 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
192 if (!(ipl_flags & IPL_DEVNO_VALID))
193 return IPL_TYPE_UNKNOWN;
194 if (!(ipl_flags & IPL_PARMBLOCK_VALID))
196 if (ipl->hdr.version > IPL_MAX_SUPPORTED_VERSION)
197 return IPL_TYPE_UNKNOWN;
198 if (ipl->hdr.pbt != DIAG308_IPL_TYPE_FCP)
199 return IPL_TYPE_UNKNOWN;
203 static ssize_t ipl_type_show(struct subsystem *subsys, char *page)
205 return sprintf(page, "%s\n", ipl_type_str(ipl_get_type()));
208 static struct subsys_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
210 static ssize_t sys_ipl_device_show(struct subsystem *subsys, char *page)
212 struct ipl_parameter_block *ipl = IPL_PARMBLOCK_START;
214 switch (ipl_get_type()) {
216 return sprintf(page, "0.0.%04x\n", ipl_devno);
218 return sprintf(page, "0.0.%04x\n", ipl->ipl_info.fcp.devno);
224 static struct subsys_attribute sys_ipl_device_attr =
225 __ATTR(device, S_IRUGO, sys_ipl_device_show, NULL);
227 static ssize_t ipl_parameter_read(struct kobject *kobj, char *buf, loff_t off,
230 unsigned int size = IPL_PARMBLOCK_SIZE;
234 if (off + count > size)
236 memcpy(buf, (void *)IPL_PARMBLOCK_START + off, count);
240 static struct bin_attribute ipl_parameter_attr = {
242 .name = "binary_parameter",
244 .owner = THIS_MODULE,
247 .read = &ipl_parameter_read,
250 static ssize_t ipl_scp_data_read(struct kobject *kobj, char *buf, loff_t off,
253 unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len;
254 void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data;
258 if (off + count > size)
260 memcpy(buf, scp_data + off, count);
264 static struct bin_attribute ipl_scp_data_attr = {
268 .owner = THIS_MODULE,
271 .read = &ipl_scp_data_read,
274 /* FCP ipl device attributes */
276 DEFINE_IPL_ATTR_RO(ipl_fcp, wwpn, "0x%016llx\n", (unsigned long long)
277 IPL_PARMBLOCK_START->ipl_info.fcp.wwpn);
278 DEFINE_IPL_ATTR_RO(ipl_fcp, lun, "0x%016llx\n", (unsigned long long)
279 IPL_PARMBLOCK_START->ipl_info.fcp.lun);
280 DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long)
281 IPL_PARMBLOCK_START->ipl_info.fcp.bootprog);
282 DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long)
283 IPL_PARMBLOCK_START->ipl_info.fcp.br_lba);
285 static struct attribute *ipl_fcp_attrs[] = {
286 &sys_ipl_type_attr.attr,
287 &sys_ipl_device_attr.attr,
288 &sys_ipl_fcp_wwpn_attr.attr,
289 &sys_ipl_fcp_lun_attr.attr,
290 &sys_ipl_fcp_bootprog_attr.attr,
291 &sys_ipl_fcp_br_lba_attr.attr,
295 static struct attribute_group ipl_fcp_attr_group = {
296 .attrs = ipl_fcp_attrs,
299 /* CCW ipl device attributes */
301 static struct attribute *ipl_ccw_attrs[] = {
302 &sys_ipl_type_attr.attr,
303 &sys_ipl_device_attr.attr,
307 static struct attribute_group ipl_ccw_attr_group = {
308 .attrs = ipl_ccw_attrs,
311 /* UNKNOWN ipl device attributes */
313 static struct attribute *ipl_unknown_attrs[] = {
314 &sys_ipl_type_attr.attr,
318 static struct attribute_group ipl_unknown_attr_group = {
319 .attrs = ipl_unknown_attrs,
322 static decl_subsys(ipl, NULL, NULL);
328 /* FCP reipl device attributes */
330 DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%016llx\n",
331 reipl_block_fcp->ipl_info.fcp.wwpn);
332 DEFINE_IPL_ATTR_RW(reipl_fcp, lun, "0x%016llx\n", "%016llx\n",
333 reipl_block_fcp->ipl_info.fcp.lun);
334 DEFINE_IPL_ATTR_RW(reipl_fcp, bootprog, "%lld\n", "%lld\n",
335 reipl_block_fcp->ipl_info.fcp.bootprog);
336 DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n",
337 reipl_block_fcp->ipl_info.fcp.br_lba);
338 DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
339 reipl_block_fcp->ipl_info.fcp.devno);
341 static struct attribute *reipl_fcp_attrs[] = {
342 &sys_reipl_fcp_device_attr.attr,
343 &sys_reipl_fcp_wwpn_attr.attr,
344 &sys_reipl_fcp_lun_attr.attr,
345 &sys_reipl_fcp_bootprog_attr.attr,
346 &sys_reipl_fcp_br_lba_attr.attr,
350 static struct attribute_group reipl_fcp_attr_group = {
352 .attrs = reipl_fcp_attrs,
355 /* CCW reipl device attributes */
357 DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
358 reipl_block_ccw->ipl_info.ccw.devno);
360 static struct attribute *reipl_ccw_attrs[] = {
361 &sys_reipl_ccw_device_attr.attr,
365 static struct attribute_group reipl_ccw_attr_group = {
367 .attrs = reipl_ccw_attrs,
372 static int reipl_set_type(enum ipl_type type)
374 if (!(reipl_capabilities & type))
380 reipl_method = IPL_METHOD_CCW_VM;
382 reipl_method = IPL_METHOD_CCW_CIO;
385 if (diag308_set_works)
386 reipl_method = IPL_METHOD_FCP_RW_DIAG;
387 else if (MACHINE_IS_VM)
388 reipl_method = IPL_METHOD_FCP_RO_VM;
390 reipl_method = IPL_METHOD_FCP_RO_DIAG;
393 reipl_method = IPL_METHOD_NONE;
399 static ssize_t reipl_type_show(struct subsystem *subsys, char *page)
401 return sprintf(page, "%s\n", ipl_type_str(reipl_type));
404 static ssize_t reipl_type_store(struct subsystem *subsys, const char *buf,
409 if (strncmp(buf, IPL_CCW_STR, strlen(IPL_CCW_STR)) == 0)
410 rc = reipl_set_type(IPL_TYPE_CCW);
411 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0)
412 rc = reipl_set_type(IPL_TYPE_FCP);
413 return (rc != 0) ? rc : len;
416 static struct subsys_attribute reipl_type_attr =
417 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store);
419 static decl_subsys(reipl, NULL, NULL);
425 /* FCP dump device attributes */
427 DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%016llx\n",
428 dump_block_fcp->ipl_info.fcp.wwpn);
429 DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%016llx\n",
430 dump_block_fcp->ipl_info.fcp.lun);
431 DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n",
432 dump_block_fcp->ipl_info.fcp.bootprog);
433 DEFINE_IPL_ATTR_RW(dump_fcp, br_lba, "%lld\n", "%lld\n",
434 dump_block_fcp->ipl_info.fcp.br_lba);
435 DEFINE_IPL_ATTR_RW(dump_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
436 dump_block_fcp->ipl_info.fcp.devno);
438 static struct attribute *dump_fcp_attrs[] = {
439 &sys_dump_fcp_device_attr.attr,
440 &sys_dump_fcp_wwpn_attr.attr,
441 &sys_dump_fcp_lun_attr.attr,
442 &sys_dump_fcp_bootprog_attr.attr,
443 &sys_dump_fcp_br_lba_attr.attr,
447 static struct attribute_group dump_fcp_attr_group = {
449 .attrs = dump_fcp_attrs,
452 /* CCW dump device attributes */
454 DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
455 dump_block_ccw->ipl_info.ccw.devno);
457 static struct attribute *dump_ccw_attrs[] = {
458 &sys_dump_ccw_device_attr.attr,
462 static struct attribute_group dump_ccw_attr_group = {
464 .attrs = dump_ccw_attrs,
469 static int dump_set_type(enum ipl_type type)
471 if (!(dump_capabilities & type))
476 dump_method = IPL_METHOD_CCW_VM;
478 dump_method = IPL_METHOD_CCW_CIO;
481 dump_method = IPL_METHOD_FCP_RW_DIAG;
484 dump_method = IPL_METHOD_NONE;
490 static ssize_t dump_type_show(struct subsystem *subsys, char *page)
492 return sprintf(page, "%s\n", ipl_type_str(dump_type));
495 static ssize_t dump_type_store(struct subsystem *subsys, const char *buf,
500 if (strncmp(buf, IPL_NONE_STR, strlen(IPL_NONE_STR)) == 0)
501 rc = dump_set_type(IPL_TYPE_NONE);
502 else if (strncmp(buf, IPL_CCW_STR, strlen(IPL_CCW_STR)) == 0)
503 rc = dump_set_type(IPL_TYPE_CCW);
504 else if (strncmp(buf, IPL_FCP_STR, strlen(IPL_FCP_STR)) == 0)
505 rc = dump_set_type(IPL_TYPE_FCP);
506 return (rc != 0) ? rc : len;
509 static struct subsys_attribute dump_type_attr =
510 __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
512 static decl_subsys(dump, NULL, NULL);
515 static void dump_smp_stop_all(void)
519 for_each_online_cpu(cpu) {
520 if (cpu == smp_processor_id())
522 while (signal_processor(cpu, sigp_stop) == sigp_busy)
528 #define dump_smp_stop_all() do { } while (0)
532 * Shutdown actions section
535 static decl_subsys(shutdown_actions, NULL, NULL);
539 static ssize_t on_panic_show(struct subsystem *subsys, char *page)
541 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
544 static ssize_t on_panic_store(struct subsystem *subsys, const char *buf,
547 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
548 on_panic_action = SHUTDOWN_REIPL;
549 else if (strncmp(buf, SHUTDOWN_DUMP_STR,
550 strlen(SHUTDOWN_DUMP_STR)) == 0)
551 on_panic_action = SHUTDOWN_DUMP;
552 else if (strncmp(buf, SHUTDOWN_STOP_STR,
553 strlen(SHUTDOWN_STOP_STR)) == 0)
554 on_panic_action = SHUTDOWN_STOP;
561 static struct subsys_attribute on_panic_attr =
562 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
564 static void print_fcp_block(struct ipl_parameter_block *fcp_block)
566 printk(KERN_EMERG "wwpn: %016llx\n",
567 (unsigned long long)fcp_block->ipl_info.fcp.wwpn);
568 printk(KERN_EMERG "lun: %016llx\n",
569 (unsigned long long)fcp_block->ipl_info.fcp.lun);
570 printk(KERN_EMERG "bootprog: %lld\n",
571 (unsigned long long)fcp_block->ipl_info.fcp.bootprog);
572 printk(KERN_EMERG "br_lba: %lld\n",
573 (unsigned long long)fcp_block->ipl_info.fcp.br_lba);
574 printk(KERN_EMERG "device: %llx\n",
575 (unsigned long long)fcp_block->ipl_info.fcp.devno);
576 printk(KERN_EMERG "opt: %x\n", fcp_block->ipl_info.fcp.opt);
581 struct ccw_dev_id devid;
582 static char buf[100];
584 switch (reipl_type) {
586 printk(KERN_EMERG "reboot on ccw device: 0.0.%04x\n",
587 reipl_block_ccw->ipl_info.ccw.devno);
590 printk(KERN_EMERG "reboot on fcp device:\n");
591 print_fcp_block(reipl_block_fcp);
597 switch (reipl_method) {
598 case IPL_METHOD_CCW_CIO:
599 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
601 reipl_ccw_dev(&devid);
603 case IPL_METHOD_CCW_VM:
604 sprintf(buf, "IPL %X", reipl_block_ccw->ipl_info.ccw.devno);
605 cpcmd(buf, NULL, 0, NULL);
607 case IPL_METHOD_CCW_DIAG:
608 diag308(DIAG308_SET, reipl_block_ccw);
609 diag308(DIAG308_IPL, NULL);
611 case IPL_METHOD_FCP_RW_DIAG:
612 diag308(DIAG308_SET, reipl_block_fcp);
613 diag308(DIAG308_IPL, NULL);
615 case IPL_METHOD_FCP_RO_DIAG:
616 diag308(DIAG308_IPL, NULL);
618 case IPL_METHOD_FCP_RO_VM:
619 cpcmd("IPL", NULL, 0, NULL);
621 case IPL_METHOD_NONE:
624 cpcmd("IPL", NULL, 0, NULL);
625 diag308(DIAG308_IPL, NULL);
628 panic("reipl failed!\n");
631 static void do_dump(void)
633 struct ccw_dev_id devid;
634 static char buf[100];
638 printk(KERN_EMERG "Automatic dump on ccw device: 0.0.%04x\n",
639 dump_block_ccw->ipl_info.ccw.devno);
642 printk(KERN_EMERG "Automatic dump on fcp device:\n");
643 print_fcp_block(dump_block_fcp);
649 switch (dump_method) {
650 case IPL_METHOD_CCW_CIO:
652 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
654 reipl_ccw_dev(&devid);
656 case IPL_METHOD_CCW_VM:
658 sprintf(buf, "STORE STATUS");
659 cpcmd(buf, NULL, 0, NULL);
660 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
661 cpcmd(buf, NULL, 0, NULL);
663 case IPL_METHOD_CCW_DIAG:
664 diag308(DIAG308_SET, dump_block_ccw);
665 diag308(DIAG308_DUMP, NULL);
667 case IPL_METHOD_FCP_RW_DIAG:
668 diag308(DIAG308_SET, dump_block_fcp);
669 diag308(DIAG308_DUMP, NULL);
671 case IPL_METHOD_NONE:
675 printk(KERN_EMERG "Dump failed!\n");
680 static int __init ipl_register_fcp_files(void)
684 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
685 &ipl_fcp_attr_group);
688 rc = sysfs_create_bin_file(&ipl_subsys.kset.kobj,
689 &ipl_parameter_attr);
692 rc = sysfs_create_bin_file(&ipl_subsys.kset.kobj,
697 sysfs_remove_bin_file(&ipl_subsys.kset.kobj, &ipl_parameter_attr);
700 sysfs_remove_group(&ipl_subsys.kset.kobj, &ipl_fcp_attr_group);
705 static int __init ipl_init(void)
709 rc = firmware_register(&ipl_subsys);
712 switch (ipl_get_type()) {
714 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
715 &ipl_ccw_attr_group);
718 rc = ipl_register_fcp_files();
721 rc = sysfs_create_group(&ipl_subsys.kset.kobj,
722 &ipl_unknown_attr_group);
726 firmware_unregister(&ipl_subsys);
730 static void __init reipl_probe(void)
734 buffer = (void *) get_zeroed_page(GFP_KERNEL);
737 if (diag308(DIAG308_STORE, buffer) == DIAG308_RC_OK)
738 diag308_set_works = 1;
739 free_page((unsigned long)buffer);
742 static int __init reipl_ccw_init(void)
746 reipl_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
747 if (!reipl_block_ccw)
749 rc = sysfs_create_group(&reipl_subsys.kset.kobj, &reipl_ccw_attr_group);
751 free_page((unsigned long)reipl_block_ccw);
754 reipl_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
755 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
756 reipl_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw);
757 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
758 if (ipl_get_type() == IPL_TYPE_CCW)
759 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
760 reipl_capabilities |= IPL_TYPE_CCW;
764 static int __init reipl_fcp_init(void)
768 if ((!diag308_set_works) && (ipl_get_type() != IPL_TYPE_FCP))
770 if ((!diag308_set_works) && (ipl_get_type() == IPL_TYPE_FCP))
771 make_attrs_ro(reipl_fcp_attrs);
773 reipl_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
774 if (!reipl_block_fcp)
776 rc = sysfs_create_group(&reipl_subsys.kset.kobj, &reipl_fcp_attr_group);
778 free_page((unsigned long)reipl_block_fcp);
781 if (ipl_get_type() == IPL_TYPE_FCP) {
782 memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE);
784 reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
785 reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
786 reipl_block_fcp->hdr.blk0_len =
787 sizeof(reipl_block_fcp->ipl_info.fcp);
788 reipl_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
789 reipl_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_IPL;
791 reipl_capabilities |= IPL_TYPE_FCP;
795 static int __init reipl_init(void)
799 rc = firmware_register(&reipl_subsys);
802 rc = subsys_create_file(&reipl_subsys, &reipl_type_attr);
804 firmware_unregister(&reipl_subsys);
807 rc = reipl_ccw_init();
810 rc = reipl_fcp_init();
813 rc = reipl_set_type(ipl_get_type());
819 static int __init dump_ccw_init(void)
823 dump_block_ccw = (void *) get_zeroed_page(GFP_KERNEL);
826 rc = sysfs_create_group(&dump_subsys.kset.kobj, &dump_ccw_attr_group);
828 free_page((unsigned long)dump_block_ccw);
831 dump_block_ccw->hdr.len = IPL_PARM_BLK_CCW_LEN;
832 dump_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
833 dump_block_ccw->hdr.blk0_len = sizeof(reipl_block_ccw->ipl_info.ccw);
834 dump_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
835 dump_capabilities |= IPL_TYPE_CCW;
839 extern char s390_readinfo_sccb[];
841 static int __init dump_fcp_init(void)
845 if(!(s390_readinfo_sccb[91] & 0x2))
846 return 0; /* LDIPL DUMP is not installed */
847 if (!diag308_set_works)
849 dump_block_fcp = (void *) get_zeroed_page(GFP_KERNEL);
852 rc = sysfs_create_group(&dump_subsys.kset.kobj, &dump_fcp_attr_group);
854 free_page((unsigned long)dump_block_fcp);
857 dump_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN;
858 dump_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION;
859 dump_block_fcp->hdr.blk0_len = sizeof(dump_block_fcp->ipl_info.fcp);
860 dump_block_fcp->hdr.pbt = DIAG308_IPL_TYPE_FCP;
861 dump_block_fcp->ipl_info.fcp.opt = DIAG308_IPL_OPT_DUMP;
862 dump_capabilities |= IPL_TYPE_FCP;
866 #define SHUTDOWN_ON_PANIC_PRIO 0
868 static int shutdown_on_panic_notify(struct notifier_block *self,
869 unsigned long event, void *data)
871 if (on_panic_action == SHUTDOWN_DUMP)
873 else if (on_panic_action == SHUTDOWN_REIPL)
878 static struct notifier_block shutdown_on_panic_nb = {
879 .notifier_call = shutdown_on_panic_notify,
880 .priority = SHUTDOWN_ON_PANIC_PRIO
883 static int __init dump_init(void)
887 rc = firmware_register(&dump_subsys);
890 rc = subsys_create_file(&dump_subsys, &dump_type_attr);
892 firmware_unregister(&dump_subsys);
895 rc = dump_ccw_init();
898 rc = dump_fcp_init();
901 dump_set_type(IPL_TYPE_NONE);
905 static int __init shutdown_actions_init(void)
909 rc = firmware_register(&shutdown_actions_subsys);
912 rc = subsys_create_file(&shutdown_actions_subsys, &on_panic_attr);
914 firmware_unregister(&shutdown_actions_subsys);
917 atomic_notifier_chain_register(&panic_notifier_list,
918 &shutdown_on_panic_nb);
922 static int __init s390_ipl_init(void)
936 rc = shutdown_actions_init();
942 __initcall(s390_ipl_init);