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>
31 #include "blacklist.h"
32 #include "cio_debug.h"
34 #include "../s390mach.h"
36 debug_info_t *cio_debug_msg_id;
37 debug_info_t *cio_debug_trace_id;
38 debug_info_t *cio_debug_crw_id;
43 cio_setup (char *parm)
45 if (!strcmp (parm, "yes"))
47 else if (!strcmp (parm, "no"))
50 printk (KERN_ERR "cio_setup : invalid cio_msg parameter '%s'",
55 __setup ("cio_msg=", cio_setup);
58 * Function: cio_debug_init
59 * Initializes three debug logs (under /proc/s390dbf) for common I/O:
60 * - cio_msg logs the messages which are printk'ed when CONFIG_DEBUG_IO is on
61 * - cio_trace logs the calling of different functions
62 * - cio_crw logs the messages which are printk'ed when CONFIG_DEBUG_CRW is on
63 * debug levels depend on CONFIG_DEBUG_IO resp. CONFIG_DEBUG_CRW
68 cio_debug_msg_id = debug_register ("cio_msg", 16, 4, 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, 4, 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", 4, 4, 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, 2);
83 pr_debug("debugging initialized\n");
88 debug_unregister (cio_debug_msg_id);
89 if (cio_debug_trace_id)
90 debug_unregister (cio_debug_trace_id);
92 debug_unregister (cio_debug_crw_id);
93 pr_debug("could not initialize debugging\n");
97 arch_initcall (cio_debug_init);
100 cio_set_options (struct subchannel *sch, int flags)
102 sch->options.suspend = (flags & DOIO_ALLOW_SUSPEND) != 0;
103 sch->options.prefetch = (flags & DOIO_DENY_PREFETCH) != 0;
104 sch->options.inter = (flags & DOIO_SUPPRESS_INTER) != 0;
108 /* FIXME: who wants to use this? */
110 cio_get_options (struct subchannel *sch)
115 if (sch->options.suspend)
116 flags |= DOIO_ALLOW_SUSPEND;
117 if (sch->options.prefetch)
118 flags |= DOIO_DENY_PREFETCH;
119 if (sch->options.inter)
120 flags |= DOIO_SUPPRESS_INTER;
125 * Use tpi to get a pending interrupt, call the interrupt handler and
126 * return a pointer to the subchannel structure.
131 struct tpi_info *tpi_info;
132 struct subchannel *sch;
135 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
138 irb = (struct irb *) __LC_IRB;
139 /* Store interrupt response block to lowcore. */
140 if (tsch (tpi_info->schid, irb) != 0)
141 /* Not status pending or not operational. */
143 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
148 spin_lock(sch->lock);
149 memcpy (&sch->schib.scsw, &irb->scsw, sizeof (struct scsw));
150 if (sch->driver && sch->driver->irq)
151 sch->driver->irq(&sch->dev);
152 spin_unlock(sch->lock);
159 cio_start_handle_notoper(struct subchannel *sch, __u8 lpm)
168 stsch (sch->schid, &sch->schib);
170 CIO_MSG_EVENT(0, "cio_start: 'not oper' status for "
171 "subchannel 0.%x.%04x!\n", sch->schid.ssid,
173 sprintf(dbf_text, "no%s", sch->dev.bus_id);
174 CIO_TRACE_EVENT(0, dbf_text);
175 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
177 return (sch->lpm ? -EACCES : -ENODEV);
181 cio_start_key (struct subchannel *sch, /* subchannel structure */
182 struct ccw1 * cpa, /* logical channel prog addr */
183 __u8 lpm, /* logical path mask */
184 __u8 key) /* storage key */
189 CIO_TRACE_EVENT (4, "stIO");
190 CIO_TRACE_EVENT (4, sch->dev.bus_id);
192 /* sch is always under 2G. */
193 sch->orb.intparm = (__u32)(unsigned long)sch;
196 sch->orb.pfch = sch->options.prefetch == 0;
197 sch->orb.spnd = sch->options.suspend;
198 sch->orb.ssic = sch->options.suspend && sch->options.inter;
199 sch->orb.lpm = (lpm != 0) ? lpm : sch->lpm;
202 * for 64 bit we always support 64 bit IDAWs with 4k page size only
207 sch->orb.key = key >> 4;
208 /* issue "Start Subchannel" */
209 sch->orb.cpa = (__u32) __pa (cpa);
210 ccode = ssch (sch->schid, &sch->orb);
212 /* process condition code */
213 sprintf (dbf_txt, "ccode:%d", ccode);
214 CIO_TRACE_EVENT (4, dbf_txt);
219 * initialize device status information
221 sch->schib.scsw.actl |= SCSW_ACTL_START_PEND;
223 case 1: /* status pending */
226 default: /* device/path not operational */
227 return cio_start_handle_notoper(sch, lpm);
232 cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
234 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
238 * resume suspended I/O operation
241 cio_resume (struct subchannel *sch)
246 CIO_TRACE_EVENT (4, "resIO");
247 CIO_TRACE_EVENT (4, sch->dev.bus_id);
249 ccode = rsch (sch->schid);
251 sprintf (dbf_txt, "ccode:%d", ccode);
252 CIO_TRACE_EVENT (4, dbf_txt);
256 sch->schib.scsw.actl |= SCSW_ACTL_RESUME_PEND;
264 * useless to wait for request completion
265 * as device is no longer operational !
275 cio_halt(struct subchannel *sch)
283 CIO_TRACE_EVENT (2, "haltIO");
284 CIO_TRACE_EVENT (2, sch->dev.bus_id);
287 * Issue "Halt subchannel" and process condition code
289 ccode = hsch (sch->schid);
291 sprintf (dbf_txt, "ccode:%d", ccode);
292 CIO_TRACE_EVENT (2, dbf_txt);
296 sch->schib.scsw.actl |= SCSW_ACTL_HALT_PEND;
298 case 1: /* status pending */
301 default: /* device not operational */
307 * Clear I/O operation
310 cio_clear(struct subchannel *sch)
318 CIO_TRACE_EVENT (2, "clearIO");
319 CIO_TRACE_EVENT (2, sch->dev.bus_id);
322 * Issue "Clear subchannel" and process condition code
324 ccode = csch (sch->schid);
326 sprintf (dbf_txt, "ccode:%d", ccode);
327 CIO_TRACE_EVENT (2, dbf_txt);
331 sch->schib.scsw.actl |= SCSW_ACTL_CLEAR_PEND;
333 default: /* device not operational */
339 * Function: cio_cancel
340 * Issues a "Cancel Subchannel" on the specified subchannel
341 * Note: We don't need any fancy intparms and flags here
342 * since xsch is executed synchronously.
343 * Only for common I/O internal use as for now.
346 cio_cancel (struct subchannel *sch)
354 CIO_TRACE_EVENT (2, "cancelIO");
355 CIO_TRACE_EVENT (2, sch->dev.bus_id);
357 ccode = xsch (sch->schid);
359 sprintf (dbf_txt, "ccode:%d", ccode);
360 CIO_TRACE_EVENT (2, dbf_txt);
363 case 0: /* success */
364 /* Update information in scsw. */
365 stsch (sch->schid, &sch->schib);
367 case 1: /* status pending */
369 case 2: /* not applicable */
371 default: /* not oper */
377 * Function: cio_modify
378 * Issues a "Modify Subchannel" on the specified subchannel
381 cio_modify (struct subchannel *sch)
383 int ccode, retry, ret;
386 for (retry = 0; retry < 5; retry++) {
387 ccode = msch_err (sch->schid, &sch->schib);
388 if (ccode < 0) /* -EIO if msch gets a program check. */
391 case 0: /* successfull */
393 case 1: /* status pending */
396 udelay (100); /* allow for recovery */
399 case 3: /* not operational */
410 cio_enable_subchannel (struct subchannel *sch, unsigned int isc)
417 CIO_TRACE_EVENT (2, "ensch");
418 CIO_TRACE_EVENT (2, sch->dev.bus_id);
420 if (sch_is_pseudo_sch(sch))
422 ccode = stsch (sch->schid, &sch->schib);
426 for (retry = 5, ret = 0; retry > 0; retry--) {
427 sch->schib.pmcw.ena = 1;
428 sch->schib.pmcw.isc = isc;
429 sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
430 ret = cio_modify(sch);
435 * Got a program check in cio_modify. Try without
436 * the concurrent sense bit the next time.
438 sch->schib.pmcw.csense = 0;
440 stsch (sch->schid, &sch->schib);
441 if (sch->schib.pmcw.ena)
446 if (tsch(sch->schid, &irb) != 0)
450 sprintf (dbf_txt, "ret:%d", ret);
451 CIO_TRACE_EVENT (2, dbf_txt);
456 * Disable subchannel.
459 cio_disable_subchannel (struct subchannel *sch)
466 CIO_TRACE_EVENT (2, "dissch");
467 CIO_TRACE_EVENT (2, sch->dev.bus_id);
469 if (sch_is_pseudo_sch(sch))
471 ccode = stsch (sch->schid, &sch->schib);
472 if (ccode == 3) /* Not operational. */
475 if (sch->schib.scsw.actl != 0)
477 * the disable function must not be called while there are
478 * requests pending for completion !
482 for (retry = 5, ret = 0; retry > 0; retry--) {
483 sch->schib.pmcw.ena = 0;
484 ret = cio_modify(sch);
489 * The subchannel is busy or status pending.
490 * We'll disable when the next interrupt was delivered
491 * via the state machine.
495 stsch (sch->schid, &sch->schib);
496 if (!sch->schib.pmcw.ena)
500 sprintf (dbf_txt, "ret:%d", ret);
501 CIO_TRACE_EVENT (2, dbf_txt);
505 int cio_create_sch_lock(struct subchannel *sch)
507 sch->lock = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
510 spin_lock_init(sch->lock);
515 * cio_validate_subchannel()
517 * Find out subchannel type and initialize struct subchannel.
519 * SUBCHANNEL_TYPE_IO for a normal io subchannel
520 * SUBCHANNEL_TYPE_CHSC for a chsc subchannel
521 * SUBCHANNEL_TYPE_MESSAGE for a messaging subchannel
522 * SUBCHANNEL_TYPE_ADM for a adm(?) subchannel
523 * -ENXIO for non-defined subchannels
524 * -ENODEV for subchannels with invalid device number or blacklisted devices
527 cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
533 sprintf (dbf_txt, "valsch%x", schid.sch_no);
534 CIO_TRACE_EVENT (4, dbf_txt);
536 /* Nuke all fields. */
537 memset(sch, 0, sizeof(struct subchannel));
540 if (cio_is_console(schid)) {
541 sch->lock = cio_get_console_lock();
543 err = cio_create_sch_lock(sch);
547 mutex_init(&sch->reg_mutex);
548 /* Set a name for the subchannel */
549 snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid,
553 * The first subchannel that is not-operational (ccode==3)
554 * indicates that there aren't any more devices available.
555 * If stsch gets an exception, it means the current subchannel set
558 ccode = stsch_err (schid, &sch->schib);
560 err = (ccode == 3) ? -ENXIO : ccode;
563 /* Copy subchannel type from path management control word. */
564 sch->st = sch->schib.pmcw.st;
567 * ... just being curious we check for non I/O subchannels
570 CIO_DEBUG(KERN_INFO, 0,
571 "Subchannel 0.%x.%04x reports "
572 "non-I/O subchannel type %04X\n",
573 sch->schid.ssid, sch->schid.sch_no, sch->st);
574 /* We stop here for non-io subchannels. */
579 /* Initialization for io subchannels. */
580 if (!sch->schib.pmcw.dnv) {
581 /* io subchannel but device number is invalid. */
585 /* Devno is valid. */
586 if (is_blacklisted (sch->schid.ssid, sch->schib.pmcw.dev)) {
588 * This device must not be known to Linux. So we simply
589 * say that there is no device and return ENODEV.
591 CIO_MSG_EVENT(4, "Blacklisted device detected "
592 "at devno %04X, subchannel set %x\n",
593 sch->schib.pmcw.dev, sch->schid.ssid);
597 if (cio_is_console(sch->schid))
600 sch->opm = chp_get_sch_opm(sch);
601 sch->lpm = sch->schib.pmcw.pam & sch->opm;
603 CIO_DEBUG(KERN_INFO, 0,
604 "Detected device %04x on subchannel 0.%x.%04X"
605 " - PIM = %02X, PAM = %02X, POM = %02X\n",
606 sch->schib.pmcw.dev, sch->schid.ssid,
607 sch->schid.sch_no, sch->schib.pmcw.pim,
608 sch->schib.pmcw.pam, sch->schib.pmcw.pom);
611 * We now have to initially ...
612 * ... set "interruption subclass"
613 * ... enable "concurrent sense"
614 * ... enable "multipath mode" if more than one
615 * CHPID is available. This is done regardless
616 * whether multiple paths are available for us.
618 sch->schib.pmcw.isc = 3; /* could be smth. else */
619 sch->schib.pmcw.csense = 1; /* concurrent sense */
620 sch->schib.pmcw.ena = 0;
621 if ((sch->lpm & (sch->lpm - 1)) != 0)
622 sch->schib.pmcw.mp = 1; /* multipath mode */
625 if (!cio_is_console(schid))
632 * do_IRQ() handles all normal I/O device IRQ's (the special
633 * SMP cross-CPU interrupts have their own specific
638 do_IRQ (struct pt_regs *regs)
640 struct tpi_info *tpi_info;
641 struct subchannel *sch;
643 struct pt_regs *old_regs;
645 old_regs = set_irq_regs(regs);
647 asm volatile ("mc 0,0");
648 if (S390_lowcore.int_clock >= S390_lowcore.jiffy_timer)
650 * Make sure that the i/o interrupt did not "overtake"
651 * the last HZ timer interrupt.
653 account_ticks(S390_lowcore.int_clock);
655 * Get interrupt information from lowcore
657 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
658 irb = (struct irb *) __LC_IRB;
660 kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++;
662 * Non I/O-subchannel thin interrupts are processed differently
664 if (tpi_info->adapter_IO == 1 &&
665 tpi_info->int_type == IO_INTERRUPT_TYPE) {
669 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
671 spin_lock(sch->lock);
672 /* Store interrupt response block to lowcore. */
673 if (tsch (tpi_info->schid, irb) == 0 && sch) {
674 /* Keep subchannel information word up to date. */
675 memcpy (&sch->schib.scsw, &irb->scsw,
677 /* Call interrupt handler if there is one. */
678 if (sch->driver && sch->driver->irq)
679 sch->driver->irq(&sch->dev);
682 spin_unlock(sch->lock);
684 * Are more interrupts pending?
685 * If so, the tpi instruction will update the lowcore
686 * to hold the info for the next interrupt.
687 * We don't do this for VM because a tpi drops the cpu
688 * out of the sie which costs more cycles than it saves.
690 } while (!MACHINE_IS_VM && tpi (NULL) != 0);
692 set_irq_regs(old_regs);
695 #ifdef CONFIG_CCW_CONSOLE
696 static struct subchannel console_subchannel;
697 static int console_subchannel_in_use;
700 * busy wait for the next interrupt on the console
705 unsigned long cr6 __attribute__ ((aligned (8)));
706 unsigned long save_cr6 __attribute__ ((aligned (8)));
709 * before entering the spinlock we may already have
710 * processed the interrupt on a different CPU...
712 if (!console_subchannel_in_use)
715 /* disable all but isc 7 (console device) */
716 __ctl_store (save_cr6, 6, 6);
718 __ctl_load (cr6, 6, 6);
721 spin_unlock(console_subchannel.lock);
724 spin_lock(console_subchannel.lock);
725 } while (console_subchannel.schib.scsw.actl != 0);
727 * restore previous isc value
729 __ctl_load (save_cr6, 6, 6);
733 cio_test_for_console(struct subchannel_id schid, void *data)
735 if (stsch_err(schid, &console_subchannel.schib) != 0)
737 if (console_subchannel.schib.pmcw.dnv &&
738 console_subchannel.schib.pmcw.dev ==
740 console_irq = schid.sch_no;
741 return 1; /* found */
748 cio_get_console_sch_no(void)
750 struct subchannel_id schid;
752 init_subchannel_id(&schid);
753 if (console_irq != -1) {
754 /* VM provided us with the irq number of the console. */
755 schid.sch_no = console_irq;
756 if (stsch(schid, &console_subchannel.schib) != 0 ||
757 !console_subchannel.schib.pmcw.dnv)
759 console_devno = console_subchannel.schib.pmcw.dev;
760 } else if (console_devno != -1) {
761 /* At least the console device number is known. */
762 for_each_subchannel(cio_test_for_console, NULL);
763 if (console_irq == -1)
766 /* unlike in 2.4, we cannot autoprobe here, since
767 * the channel subsystem is not fully initialized.
768 * With some luck, the HWC console can take over */
769 printk(KERN_WARNING "No ccw console found!\n");
776 cio_probe_console(void)
779 struct subchannel_id schid;
781 if (xchg(&console_subchannel_in_use, 1) != 0)
782 return ERR_PTR(-EBUSY);
783 sch_no = cio_get_console_sch_no();
785 console_subchannel_in_use = 0;
786 return ERR_PTR(-ENODEV);
788 memset(&console_subchannel, 0, sizeof(struct subchannel));
789 init_subchannel_id(&schid);
790 schid.sch_no = sch_no;
791 ret = cio_validate_subchannel(&console_subchannel, schid);
793 console_subchannel_in_use = 0;
794 return ERR_PTR(-ENODEV);
798 * enable console I/O-interrupt subclass 7
801 console_subchannel.schib.pmcw.isc = 7;
802 console_subchannel.schib.pmcw.intparm =
803 (__u32)(unsigned long)&console_subchannel;
804 ret = cio_modify(&console_subchannel);
806 console_subchannel_in_use = 0;
809 return &console_subchannel;
813 cio_release_console(void)
815 console_subchannel.schib.pmcw.intparm = 0;
816 cio_modify(&console_subchannel);
817 ctl_clear_bit(6, 24);
818 console_subchannel_in_use = 0;
821 /* Bah... hack to catch console special sausages. */
823 cio_is_console(struct subchannel_id schid)
825 if (!console_subchannel_in_use)
827 return schid_equal(&schid, &console_subchannel.schid);
831 cio_get_console_subchannel(void)
833 if (!console_subchannel_in_use)
835 return &console_subchannel;
840 __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
845 for (retry=0;retry<3;retry++) {
847 cc = msch(schid, schib);
849 return (cc==3?-ENODEV:-EBUSY);
851 if (!schib->pmcw.ena)
854 return -EBUSY; /* uhm... */
857 /* we can't use the normal udelay here, since it enables external interrupts */
859 static void udelay_reset(unsigned long usecs)
861 uint64_t start_cc, end_cc;
863 asm volatile ("STCK %0" : "=m" (start_cc));
866 asm volatile ("STCK %0" : "=m" (end_cc));
867 } while (((end_cc - start_cc)/4096) < usecs);
871 __clear_subchannel_easy(struct subchannel_id schid)
877 for (retry=0;retry<20;retry++) {
881 tsch(ti.schid, (struct irb *)__LC_IRB);
882 if (schid_equal(&ti.schid, &schid))
890 static int pgm_check_occured;
892 static void cio_reset_pgm_check_handler(void)
894 pgm_check_occured = 1;
897 static int stsch_reset(struct subchannel_id schid, volatile struct schib *addr)
901 pgm_check_occured = 0;
902 s390_base_pgm_handler_fn = cio_reset_pgm_check_handler;
903 rc = stsch(schid, addr);
904 s390_base_pgm_handler_fn = NULL;
906 /* The program check handler could have changed pgm_check_occured. */
909 if (pgm_check_occured)
915 static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data)
919 if (stsch_reset(schid, &schib))
923 switch(__disable_subchannel_easy(schid, &schib)) {
927 default: /* -EBUSY */
928 if (__clear_subchannel_easy(schid))
929 break; /* give up... */
930 stsch(schid, &schib);
931 __disable_subchannel_easy(schid, &schib);
936 static atomic_t chpid_reset_count;
938 static void s390_reset_chpids_mcck_handler(void)
943 /* Check for pending channel report word. */
944 mci = (struct mci *)&S390_lowcore.mcck_interruption_code;
947 /* Process channel report words. */
948 while (stcrw(&crw) == 0) {
949 /* Check for responses to RCHP. */
950 if (crw.slct && crw.rsc == CRW_RSC_CPATH)
951 atomic_dec(&chpid_reset_count);
955 #define RCHP_TIMEOUT (30 * USEC_PER_SEC)
956 static void css_reset(void)
959 unsigned long long timeout;
962 /* Reset subchannels. */
963 for_each_subchannel(__shutdown_subchannel_easy, NULL);
964 /* Reset channel paths. */
965 s390_base_mcck_handler_fn = s390_reset_chpids_mcck_handler;
966 /* Enable channel report machine checks. */
967 __ctl_set_bit(14, 28);
968 /* Temporarily reenable machine checks. */
971 for (i = 0; i <= __MAX_CHPID; i++) {
974 if ((ret == 0) || (ret == 2))
976 * rchp either succeeded, or another rchp is already
977 * in progress. In either case, we'll get a crw.
979 atomic_inc(&chpid_reset_count);
981 /* Wait for machine check for all channel paths. */
982 timeout = get_clock() + (RCHP_TIMEOUT << 12);
983 while (atomic_read(&chpid_reset_count) != 0) {
984 if (get_clock() > timeout)
988 /* Disable machine checks again. */
989 local_mcck_disable();
990 /* Disable channel report machine checks. */
991 __ctl_clear_bit(14, 28);
992 s390_base_mcck_handler_fn = NULL;
995 static struct reset_call css_reset_call = {
999 static int __init init_css_reset_call(void)
1001 atomic_set(&chpid_reset_count, 0);
1002 register_reset_call(&css_reset_call);
1006 arch_initcall(init_css_reset_call);
1008 struct sch_match_id {
1009 struct subchannel_id schid;
1010 struct ccw_dev_id devid;
1014 static int __reipl_subchannel_match(struct subchannel_id schid, void *data)
1017 struct sch_match_id *match_id = data;
1019 if (stsch_reset(schid, &schib))
1021 if (schib.pmcw.dnv &&
1022 (schib.pmcw.dev == match_id->devid.devno) &&
1023 (schid.ssid == match_id->devid.ssid)) {
1024 match_id->schid = schid;
1031 static int reipl_find_schid(struct ccw_dev_id *devid,
1032 struct subchannel_id *schid)
1034 struct sch_match_id match_id;
1036 match_id.devid = *devid;
1037 match_id.rc = -ENODEV;
1038 for_each_subchannel(__reipl_subchannel_match, &match_id);
1039 if (match_id.rc == 0)
1040 *schid = match_id.schid;
1044 extern void do_reipl_asm(__u32 schid);
1046 /* Make sure all subchannels are quiet before we re-ipl an lpar. */
1047 void reipl_ccw_dev(struct ccw_dev_id *devid)
1049 struct subchannel_id schid;
1051 s390_reset_system();
1052 if (reipl_find_schid(devid, &schid) != 0)
1053 panic("IPL Device not found\n");
1054 do_reipl_asm(*((__u32*)&schid));
1057 int __init cio_get_iplinfo(struct cio_iplinfo *iplinfo)
1059 struct subchannel_id schid;
1062 schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID;
1065 if (stsch(schid, &schib))
1067 if (!schib.pmcw.dnv)
1069 iplinfo->devno = schib.pmcw.dev;
1070 iplinfo->is_qdio = schib.pmcw.qf;