2 * drivers/s390/cio/cio.c
3 * S/390 common I/O routines -- low level i/o calls
5 * Copyright (C) IBM Corp. 1999,2006
6 * Author(s): Ingo Adlung (adlung@de.ibm.com)
7 * Cornelia Huck (cornelia.huck@de.ibm.com)
8 * Arnd Bergmann (arndb@de.ibm.com)
9 * Martin Schwidefsky (schwidefsky@de.ibm.com)
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/slab.h>
15 #include <linux/device.h>
16 #include <linux/kernel_stat.h>
17 #include <linux/interrupt.h>
19 #include <asm/delay.h>
21 #include <asm/irq_regs.h>
22 #include <asm/setup.h>
23 #include <asm/reset.h>
25 #include <asm/chpid.h>
33 #include "blacklist.h"
34 #include "cio_debug.h"
36 #include "../s390mach.h"
38 debug_info_t *cio_debug_msg_id;
39 debug_info_t *cio_debug_trace_id;
40 debug_info_t *cio_debug_crw_id;
45 cio_setup (char *parm)
47 if (!strcmp (parm, "yes"))
49 else if (!strcmp (parm, "no"))
52 printk(KERN_ERR "cio: cio_setup: "
53 "invalid cio_msg parameter '%s'", parm);
57 __setup ("cio_msg=", cio_setup);
60 * Function: cio_debug_init
61 * Initializes three debug logs for common I/O:
62 * - cio_msg logs generic cio messages
63 * - cio_trace logs the calling of different functions
64 * - cio_crw logs machine check related cio messages
66 static int __init cio_debug_init(void)
68 cio_debug_msg_id = debug_register("cio_msg", 16, 1, 16 * sizeof(long));
69 if (!cio_debug_msg_id)
71 debug_register_view(cio_debug_msg_id, &debug_sprintf_view);
72 debug_set_level(cio_debug_msg_id, 2);
73 cio_debug_trace_id = debug_register("cio_trace", 16, 1, 16);
74 if (!cio_debug_trace_id)
76 debug_register_view(cio_debug_trace_id, &debug_hex_ascii_view);
77 debug_set_level(cio_debug_trace_id, 2);
78 cio_debug_crw_id = debug_register("cio_crw", 16, 1, 16 * sizeof(long));
79 if (!cio_debug_crw_id)
81 debug_register_view(cio_debug_crw_id, &debug_sprintf_view);
82 debug_set_level(cio_debug_crw_id, 4);
87 debug_unregister(cio_debug_msg_id);
88 if (cio_debug_trace_id)
89 debug_unregister(cio_debug_trace_id);
91 debug_unregister(cio_debug_crw_id);
92 printk(KERN_WARNING"cio: could not initialize debugging\n");
96 arch_initcall (cio_debug_init);
99 cio_set_options (struct subchannel *sch, int flags)
101 sch->options.suspend = (flags & DOIO_ALLOW_SUSPEND) != 0;
102 sch->options.prefetch = (flags & DOIO_DENY_PREFETCH) != 0;
103 sch->options.inter = (flags & DOIO_SUPPRESS_INTER) != 0;
107 /* FIXME: who wants to use this? */
109 cio_get_options (struct subchannel *sch)
114 if (sch->options.suspend)
115 flags |= DOIO_ALLOW_SUSPEND;
116 if (sch->options.prefetch)
117 flags |= DOIO_DENY_PREFETCH;
118 if (sch->options.inter)
119 flags |= DOIO_SUPPRESS_INTER;
124 * Use tpi to get a pending interrupt, call the interrupt handler and
125 * return a pointer to the subchannel structure.
130 struct tpi_info *tpi_info;
131 struct subchannel *sch;
134 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
137 irb = (struct irb *) __LC_IRB;
138 /* Store interrupt response block to lowcore. */
139 if (tsch (tpi_info->schid, irb) != 0)
140 /* Not status pending or not operational. */
142 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
147 spin_lock(sch->lock);
148 memcpy (&sch->schib.scsw, &irb->scsw, sizeof (struct scsw));
149 if (sch->driver && sch->driver->irq)
150 sch->driver->irq(sch);
151 spin_unlock(sch->lock);
158 cio_start_handle_notoper(struct subchannel *sch, __u8 lpm)
167 stsch (sch->schid, &sch->schib);
169 CIO_MSG_EVENT(0, "cio_start: 'not oper' status for "
170 "subchannel 0.%x.%04x!\n", sch->schid.ssid,
172 sprintf(dbf_text, "no%s", sch->dev.bus_id);
173 CIO_TRACE_EVENT(0, dbf_text);
174 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
176 return (sch->lpm ? -EACCES : -ENODEV);
180 cio_start_key (struct subchannel *sch, /* subchannel structure */
181 struct ccw1 * cpa, /* logical channel prog addr */
182 __u8 lpm, /* logical path mask */
183 __u8 key) /* storage key */
189 CIO_TRACE_EVENT(4, "stIO");
190 CIO_TRACE_EVENT(4, sch->dev.bus_id);
192 orb = &to_io_private(sch)->orb;
193 /* sch is always under 2G. */
194 orb->intparm = (u32)(addr_t)sch;
197 orb->pfch = sch->options.prefetch == 0;
198 orb->spnd = sch->options.suspend;
199 orb->ssic = sch->options.suspend && sch->options.inter;
200 orb->lpm = (lpm != 0) ? lpm : sch->lpm;
203 * for 64 bit we always support 64 bit IDAWs with 4k page size only
209 /* issue "Start Subchannel" */
210 orb->cpa = (__u32) __pa(cpa);
211 ccode = ssch(sch->schid, orb);
213 /* process condition code */
214 sprintf(dbf_txt, "ccode:%d", ccode);
215 CIO_TRACE_EVENT(4, dbf_txt);
220 * initialize device status information
222 sch->schib.scsw.actl |= SCSW_ACTL_START_PEND;
224 case 1: /* status pending */
227 default: /* device/path not operational */
228 return cio_start_handle_notoper(sch, lpm);
233 cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
235 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
239 * resume suspended I/O operation
242 cio_resume (struct subchannel *sch)
247 CIO_TRACE_EVENT (4, "resIO");
248 CIO_TRACE_EVENT (4, sch->dev.bus_id);
250 ccode = rsch (sch->schid);
252 sprintf (dbf_txt, "ccode:%d", ccode);
253 CIO_TRACE_EVENT (4, dbf_txt);
257 sch->schib.scsw.actl |= SCSW_ACTL_RESUME_PEND;
265 * useless to wait for request completion
266 * as device is no longer operational !
276 cio_halt(struct subchannel *sch)
284 CIO_TRACE_EVENT (2, "haltIO");
285 CIO_TRACE_EVENT (2, sch->dev.bus_id);
288 * Issue "Halt subchannel" and process condition code
290 ccode = hsch (sch->schid);
292 sprintf (dbf_txt, "ccode:%d", ccode);
293 CIO_TRACE_EVENT (2, dbf_txt);
297 sch->schib.scsw.actl |= SCSW_ACTL_HALT_PEND;
299 case 1: /* status pending */
302 default: /* device not operational */
308 * Clear I/O operation
311 cio_clear(struct subchannel *sch)
319 CIO_TRACE_EVENT (2, "clearIO");
320 CIO_TRACE_EVENT (2, sch->dev.bus_id);
323 * Issue "Clear subchannel" and process condition code
325 ccode = csch (sch->schid);
327 sprintf (dbf_txt, "ccode:%d", ccode);
328 CIO_TRACE_EVENT (2, dbf_txt);
332 sch->schib.scsw.actl |= SCSW_ACTL_CLEAR_PEND;
334 default: /* device not operational */
340 * Function: cio_cancel
341 * Issues a "Cancel Subchannel" on the specified subchannel
342 * Note: We don't need any fancy intparms and flags here
343 * since xsch is executed synchronously.
344 * Only for common I/O internal use as for now.
347 cio_cancel (struct subchannel *sch)
355 CIO_TRACE_EVENT (2, "cancelIO");
356 CIO_TRACE_EVENT (2, sch->dev.bus_id);
358 ccode = xsch (sch->schid);
360 sprintf (dbf_txt, "ccode:%d", ccode);
361 CIO_TRACE_EVENT (2, dbf_txt);
364 case 0: /* success */
365 /* Update information in scsw. */
366 stsch (sch->schid, &sch->schib);
368 case 1: /* status pending */
370 case 2: /* not applicable */
372 default: /* not oper */
378 * Function: cio_modify
379 * Issues a "Modify Subchannel" on the specified subchannel
382 cio_modify (struct subchannel *sch)
384 int ccode, retry, ret;
387 for (retry = 0; retry < 5; retry++) {
388 ccode = msch_err (sch->schid, &sch->schib);
389 if (ccode < 0) /* -EIO if msch gets a program check. */
392 case 0: /* successfull */
394 case 1: /* status pending */
397 udelay (100); /* allow for recovery */
400 case 3: /* not operational */
410 int cio_enable_subchannel(struct subchannel *sch, unsigned int isc,
418 CIO_TRACE_EVENT (2, "ensch");
419 CIO_TRACE_EVENT (2, sch->dev.bus_id);
421 if (sch_is_pseudo_sch(sch))
423 ccode = stsch (sch->schid, &sch->schib);
427 for (retry = 5, ret = 0; retry > 0; retry--) {
428 sch->schib.pmcw.ena = 1;
429 sch->schib.pmcw.isc = isc;
430 sch->schib.pmcw.intparm = intparm;
431 ret = cio_modify(sch);
436 * Got a program check in cio_modify. Try without
437 * the concurrent sense bit the next time.
439 sch->schib.pmcw.csense = 0;
441 stsch (sch->schid, &sch->schib);
442 if (sch->schib.pmcw.ena)
447 if (tsch(sch->schid, &irb) != 0)
451 sprintf (dbf_txt, "ret:%d", ret);
452 CIO_TRACE_EVENT (2, dbf_txt);
457 * Disable subchannel.
460 cio_disable_subchannel (struct subchannel *sch)
467 CIO_TRACE_EVENT (2, "dissch");
468 CIO_TRACE_EVENT (2, sch->dev.bus_id);
470 if (sch_is_pseudo_sch(sch))
472 ccode = stsch (sch->schid, &sch->schib);
473 if (ccode == 3) /* Not operational. */
476 if (sch->schib.scsw.actl != 0)
478 * the disable function must not be called while there are
479 * requests pending for completion !
483 for (retry = 5, ret = 0; retry > 0; retry--) {
484 sch->schib.pmcw.ena = 0;
485 ret = cio_modify(sch);
490 * The subchannel is busy or status pending.
491 * We'll disable when the next interrupt was delivered
492 * via the state machine.
496 stsch (sch->schid, &sch->schib);
497 if (!sch->schib.pmcw.ena)
501 sprintf (dbf_txt, "ret:%d", ret);
502 CIO_TRACE_EVENT (2, dbf_txt);
506 int cio_create_sch_lock(struct subchannel *sch)
508 sch->lock = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
511 spin_lock_init(sch->lock);
516 * cio_validate_subchannel()
518 * Find out subchannel type and initialize struct subchannel.
520 * SUBCHANNEL_TYPE_IO for a normal io subchannel
521 * SUBCHANNEL_TYPE_CHSC for a chsc subchannel
522 * SUBCHANNEL_TYPE_MESSAGE for a messaging subchannel
523 * SUBCHANNEL_TYPE_ADM for a adm(?) subchannel
524 * -ENXIO for non-defined subchannels
525 * -ENODEV for subchannels with invalid device number or blacklisted devices
528 cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
534 sprintf (dbf_txt, "valsch%x", schid.sch_no);
535 CIO_TRACE_EVENT (4, dbf_txt);
537 /* Nuke all fields. */
538 memset(sch, 0, sizeof(struct subchannel));
541 if (cio_is_console(schid)) {
542 sch->lock = cio_get_console_lock();
544 err = cio_create_sch_lock(sch);
548 mutex_init(&sch->reg_mutex);
549 /* Set a name for the subchannel */
550 snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid,
554 * The first subchannel that is not-operational (ccode==3)
555 * indicates that there aren't any more devices available.
556 * If stsch gets an exception, it means the current subchannel set
559 ccode = stsch_err (schid, &sch->schib);
561 err = (ccode == 3) ? -ENXIO : ccode;
564 /* Copy subchannel type from path management control word. */
565 sch->st = sch->schib.pmcw.st;
568 * ... just being curious we check for non I/O subchannels
571 CIO_DEBUG(KERN_INFO, 0,
572 "Subchannel 0.%x.%04x reports "
573 "non-I/O subchannel type %04X\n",
574 sch->schid.ssid, sch->schid.sch_no, sch->st);
575 /* We stop here for non-io subchannels. */
580 /* Initialization for io subchannels. */
581 if (!css_sch_is_valid(&sch->schib)) {
586 /* Devno is valid. */
587 if (is_blacklisted (sch->schid.ssid, sch->schib.pmcw.dev)) {
589 * This device must not be known to Linux. So we simply
590 * say that there is no device and return ENODEV.
592 CIO_MSG_EVENT(4, "Blacklisted device detected "
593 "at devno %04X, subchannel set %x\n",
594 sch->schib.pmcw.dev, sch->schid.ssid);
598 if (cio_is_console(sch->schid))
601 sch->opm = chp_get_sch_opm(sch);
602 sch->lpm = sch->schib.pmcw.pam & sch->opm;
604 CIO_DEBUG(KERN_INFO, 0,
605 "Detected device %04x on subchannel 0.%x.%04X"
606 " - PIM = %02X, PAM = %02X, POM = %02X\n",
607 sch->schib.pmcw.dev, sch->schid.ssid,
608 sch->schid.sch_no, sch->schib.pmcw.pim,
609 sch->schib.pmcw.pam, sch->schib.pmcw.pom);
612 * We now have to initially ...
613 * ... set "interruption subclass"
614 * ... enable "concurrent sense"
615 * ... enable "multipath mode" if more than one
616 * CHPID is available. This is done regardless
617 * whether multiple paths are available for us.
619 sch->schib.pmcw.isc = 3; /* could be smth. else */
620 sch->schib.pmcw.csense = 1; /* concurrent sense */
621 sch->schib.pmcw.ena = 0;
622 if ((sch->lpm & (sch->lpm - 1)) != 0)
623 sch->schib.pmcw.mp = 1; /* multipath mode */
624 /* clean up possible residual cmf stuff */
625 sch->schib.pmcw.mme = 0;
626 sch->schib.pmcw.mbfc = 0;
627 sch->schib.pmcw.mbi = 0;
631 if (!cio_is_console(schid))
638 * do_IRQ() handles all normal I/O device IRQ's (the special
639 * SMP cross-CPU interrupts have their own specific
644 do_IRQ (struct pt_regs *regs)
646 struct tpi_info *tpi_info;
647 struct subchannel *sch;
649 struct pt_regs *old_regs;
651 old_regs = set_irq_regs(regs);
654 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)
655 /* Serve timer interrupts first. */
656 clock_comparator_work();
658 * Get interrupt information from lowcore
660 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
661 irb = (struct irb *) __LC_IRB;
663 kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++;
665 * Non I/O-subchannel thin interrupts are processed differently
667 if (tpi_info->adapter_IO == 1 &&
668 tpi_info->int_type == IO_INTERRUPT_TYPE) {
672 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
674 /* Clear pending interrupt condition. */
675 tsch(tpi_info->schid, irb);
678 spin_lock(sch->lock);
679 /* Store interrupt response block to lowcore. */
680 if (tsch(tpi_info->schid, irb) == 0) {
681 /* Keep subchannel information word up to date. */
682 memcpy (&sch->schib.scsw, &irb->scsw,
684 /* Call interrupt handler if there is one. */
685 if (sch->driver && sch->driver->irq)
686 sch->driver->irq(sch);
688 spin_unlock(sch->lock);
690 * Are more interrupts pending?
691 * If so, the tpi instruction will update the lowcore
692 * to hold the info for the next interrupt.
693 * We don't do this for VM because a tpi drops the cpu
694 * out of the sie which costs more cycles than it saves.
696 } while (!MACHINE_IS_VM && tpi (NULL) != 0);
698 set_irq_regs(old_regs);
701 #ifdef CONFIG_CCW_CONSOLE
702 static struct subchannel console_subchannel;
703 static struct io_subchannel_private console_priv;
704 static int console_subchannel_in_use;
706 void *cio_get_console_priv(void)
708 return &console_priv;
712 * busy wait for the next interrupt on the console
714 void wait_cons_dev(void)
715 __releases(console_subchannel.lock)
716 __acquires(console_subchannel.lock)
718 unsigned long cr6 __attribute__ ((aligned (8)));
719 unsigned long save_cr6 __attribute__ ((aligned (8)));
722 * before entering the spinlock we may already have
723 * processed the interrupt on a different CPU...
725 if (!console_subchannel_in_use)
728 /* disable all but isc 7 (console device) */
729 __ctl_store (save_cr6, 6, 6);
731 __ctl_load (cr6, 6, 6);
734 spin_unlock(console_subchannel.lock);
737 spin_lock(console_subchannel.lock);
738 } while (console_subchannel.schib.scsw.actl != 0);
740 * restore previous isc value
742 __ctl_load (save_cr6, 6, 6);
746 cio_test_for_console(struct subchannel_id schid, void *data)
748 if (stsch_err(schid, &console_subchannel.schib) != 0)
750 if ((console_subchannel.schib.pmcw.st == SUBCHANNEL_TYPE_IO) &&
751 console_subchannel.schib.pmcw.dnv &&
752 (console_subchannel.schib.pmcw.dev == console_devno)) {
753 console_irq = schid.sch_no;
754 return 1; /* found */
761 cio_get_console_sch_no(void)
763 struct subchannel_id schid;
765 init_subchannel_id(&schid);
766 if (console_irq != -1) {
767 /* VM provided us with the irq number of the console. */
768 schid.sch_no = console_irq;
769 if (stsch(schid, &console_subchannel.schib) != 0 ||
770 (console_subchannel.schib.pmcw.st != SUBCHANNEL_TYPE_IO) ||
771 !console_subchannel.schib.pmcw.dnv)
773 console_devno = console_subchannel.schib.pmcw.dev;
774 } else if (console_devno != -1) {
775 /* At least the console device number is known. */
776 for_each_subchannel(cio_test_for_console, NULL);
777 if (console_irq == -1)
780 /* unlike in 2.4, we cannot autoprobe here, since
781 * the channel subsystem is not fully initialized.
782 * With some luck, the HWC console can take over */
783 printk(KERN_WARNING "cio: No ccw console found!\n");
790 cio_probe_console(void)
793 struct subchannel_id schid;
795 if (xchg(&console_subchannel_in_use, 1) != 0)
796 return ERR_PTR(-EBUSY);
797 sch_no = cio_get_console_sch_no();
799 console_subchannel_in_use = 0;
800 return ERR_PTR(-ENODEV);
802 memset(&console_subchannel, 0, sizeof(struct subchannel));
803 init_subchannel_id(&schid);
804 schid.sch_no = sch_no;
805 ret = cio_validate_subchannel(&console_subchannel, schid);
807 console_subchannel_in_use = 0;
808 return ERR_PTR(-ENODEV);
812 * enable console I/O-interrupt subclass 7
815 console_subchannel.schib.pmcw.isc = 7;
816 console_subchannel.schib.pmcw.intparm =
817 (u32)(addr_t)&console_subchannel;
818 ret = cio_modify(&console_subchannel);
820 console_subchannel_in_use = 0;
823 return &console_subchannel;
827 cio_release_console(void)
829 console_subchannel.schib.pmcw.intparm = 0;
830 cio_modify(&console_subchannel);
831 ctl_clear_bit(6, 24);
832 console_subchannel_in_use = 0;
835 /* Bah... hack to catch console special sausages. */
837 cio_is_console(struct subchannel_id schid)
839 if (!console_subchannel_in_use)
841 return schid_equal(&schid, &console_subchannel.schid);
845 cio_get_console_subchannel(void)
847 if (!console_subchannel_in_use)
849 return &console_subchannel;
854 __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
859 for (retry=0;retry<3;retry++) {
861 cc = msch(schid, schib);
863 return (cc==3?-ENODEV:-EBUSY);
865 if (!schib->pmcw.ena)
868 return -EBUSY; /* uhm... */
871 /* we can't use the normal udelay here, since it enables external interrupts */
873 static void udelay_reset(unsigned long usecs)
875 uint64_t start_cc, end_cc;
877 asm volatile ("STCK %0" : "=m" (start_cc));
880 asm volatile ("STCK %0" : "=m" (end_cc));
881 } while (((end_cc - start_cc)/4096) < usecs);
885 __clear_subchannel_easy(struct subchannel_id schid)
891 for (retry=0;retry<20;retry++) {
895 tsch(ti.schid, (struct irb *)__LC_IRB);
896 if (schid_equal(&ti.schid, &schid))
904 static int pgm_check_occured;
906 static void cio_reset_pgm_check_handler(void)
908 pgm_check_occured = 1;
911 static int stsch_reset(struct subchannel_id schid, volatile struct schib *addr)
915 pgm_check_occured = 0;
916 s390_base_pgm_handler_fn = cio_reset_pgm_check_handler;
917 rc = stsch(schid, addr);
918 s390_base_pgm_handler_fn = NULL;
920 /* The program check handler could have changed pgm_check_occured. */
923 if (pgm_check_occured)
929 static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data)
933 if (stsch_reset(schid, &schib))
937 switch(__disable_subchannel_easy(schid, &schib)) {
941 default: /* -EBUSY */
942 if (__clear_subchannel_easy(schid))
943 break; /* give up... */
944 stsch(schid, &schib);
945 __disable_subchannel_easy(schid, &schib);
950 static atomic_t chpid_reset_count;
952 static void s390_reset_chpids_mcck_handler(void)
957 /* Check for pending channel report word. */
958 mci = (struct mci *)&S390_lowcore.mcck_interruption_code;
961 /* Process channel report words. */
962 while (stcrw(&crw) == 0) {
963 /* Check for responses to RCHP. */
964 if (crw.slct && crw.rsc == CRW_RSC_CPATH)
965 atomic_dec(&chpid_reset_count);
969 #define RCHP_TIMEOUT (30 * USEC_PER_SEC)
970 static void css_reset(void)
973 unsigned long long timeout;
976 /* Reset subchannels. */
977 for_each_subchannel(__shutdown_subchannel_easy, NULL);
978 /* Reset channel paths. */
979 s390_base_mcck_handler_fn = s390_reset_chpids_mcck_handler;
980 /* Enable channel report machine checks. */
981 __ctl_set_bit(14, 28);
982 /* Temporarily reenable machine checks. */
985 for (i = 0; i <= __MAX_CHPID; i++) {
988 if ((ret == 0) || (ret == 2))
990 * rchp either succeeded, or another rchp is already
991 * in progress. In either case, we'll get a crw.
993 atomic_inc(&chpid_reset_count);
995 /* Wait for machine check for all channel paths. */
996 timeout = get_clock() + (RCHP_TIMEOUT << 12);
997 while (atomic_read(&chpid_reset_count) != 0) {
998 if (get_clock() > timeout)
1002 /* Disable machine checks again. */
1003 local_mcck_disable();
1004 /* Disable channel report machine checks. */
1005 __ctl_clear_bit(14, 28);
1006 s390_base_mcck_handler_fn = NULL;
1009 static struct reset_call css_reset_call = {
1013 static int __init init_css_reset_call(void)
1015 atomic_set(&chpid_reset_count, 0);
1016 register_reset_call(&css_reset_call);
1020 arch_initcall(init_css_reset_call);
1022 struct sch_match_id {
1023 struct subchannel_id schid;
1024 struct ccw_dev_id devid;
1028 static int __reipl_subchannel_match(struct subchannel_id schid, void *data)
1031 struct sch_match_id *match_id = data;
1033 if (stsch_reset(schid, &schib))
1035 if ((schib.pmcw.st == SUBCHANNEL_TYPE_IO) && schib.pmcw.dnv &&
1036 (schib.pmcw.dev == match_id->devid.devno) &&
1037 (schid.ssid == match_id->devid.ssid)) {
1038 match_id->schid = schid;
1045 static int reipl_find_schid(struct ccw_dev_id *devid,
1046 struct subchannel_id *schid)
1048 struct sch_match_id match_id;
1050 match_id.devid = *devid;
1051 match_id.rc = -ENODEV;
1052 for_each_subchannel(__reipl_subchannel_match, &match_id);
1053 if (match_id.rc == 0)
1054 *schid = match_id.schid;
1058 extern void do_reipl_asm(__u32 schid);
1060 /* Make sure all subchannels are quiet before we re-ipl an lpar. */
1061 void reipl_ccw_dev(struct ccw_dev_id *devid)
1063 struct subchannel_id schid;
1065 s390_reset_system();
1066 if (reipl_find_schid(devid, &schid) != 0)
1067 panic("IPL Device not found\n");
1068 do_reipl_asm(*((__u32*)&schid));
1071 int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo)
1073 struct subchannel_id schid;
1076 schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID;
1079 if (stsch(schid, &schib))
1081 if (schib.pmcw.st != SUBCHANNEL_TYPE_IO)
1083 if (!schib.pmcw.dnv)
1085 iplinfo->devno = schib.pmcw.dev;
1086 iplinfo->is_qdio = schib.pmcw.qf;