2 * drivers/s390/cio/cio.c
3 * S/390 common I/O routines -- low level i/o calls
5 * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
7 * Author(s): Ingo Adlung (adlung@de.ibm.com)
8 * Cornelia Huck (cornelia.huck@de.ibm.com)
9 * Arnd Bergmann (arndb@de.ibm.com)
10 * Martin Schwidefsky (schwidefsky@de.ibm.com)
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/slab.h>
16 #include <linux/device.h>
17 #include <linux/kernel_stat.h>
18 #include <linux/interrupt.h>
20 #include <asm/delay.h>
22 #include <asm/irq_regs.h>
23 #include <asm/setup.h>
24 #include <asm/reset.h>
30 #include "blacklist.h"
31 #include "cio_debug.h"
32 #include "../s390mach.h"
34 debug_info_t *cio_debug_msg_id;
35 debug_info_t *cio_debug_trace_id;
36 debug_info_t *cio_debug_crw_id;
41 cio_setup (char *parm)
43 if (!strcmp (parm, "yes"))
45 else if (!strcmp (parm, "no"))
48 printk (KERN_ERR "cio_setup : invalid cio_msg parameter '%s'",
53 __setup ("cio_msg=", cio_setup);
56 * Function: cio_debug_init
57 * Initializes three debug logs (under /proc/s390dbf) for common I/O:
58 * - cio_msg logs the messages which are printk'ed when CONFIG_DEBUG_IO is on
59 * - cio_trace logs the calling of different functions
60 * - cio_crw logs the messages which are printk'ed when CONFIG_DEBUG_CRW is on
61 * debug levels depend on CONFIG_DEBUG_IO resp. CONFIG_DEBUG_CRW
66 cio_debug_msg_id = debug_register ("cio_msg", 16, 4, 16*sizeof (long));
67 if (!cio_debug_msg_id)
69 debug_register_view (cio_debug_msg_id, &debug_sprintf_view);
70 debug_set_level (cio_debug_msg_id, 2);
71 cio_debug_trace_id = debug_register ("cio_trace", 16, 4, 16);
72 if (!cio_debug_trace_id)
74 debug_register_view (cio_debug_trace_id, &debug_hex_ascii_view);
75 debug_set_level (cio_debug_trace_id, 2);
76 cio_debug_crw_id = debug_register ("cio_crw", 4, 4, 16*sizeof (long));
77 if (!cio_debug_crw_id)
79 debug_register_view (cio_debug_crw_id, &debug_sprintf_view);
80 debug_set_level (cio_debug_crw_id, 2);
81 pr_debug("debugging initialized\n");
86 debug_unregister (cio_debug_msg_id);
87 if (cio_debug_trace_id)
88 debug_unregister (cio_debug_trace_id);
90 debug_unregister (cio_debug_crw_id);
91 pr_debug("could not initialize debugging\n");
95 arch_initcall (cio_debug_init);
98 cio_set_options (struct subchannel *sch, int flags)
100 sch->options.suspend = (flags & DOIO_ALLOW_SUSPEND) != 0;
101 sch->options.prefetch = (flags & DOIO_DENY_PREFETCH) != 0;
102 sch->options.inter = (flags & DOIO_SUPPRESS_INTER) != 0;
106 /* FIXME: who wants to use this? */
108 cio_get_options (struct subchannel *sch)
113 if (sch->options.suspend)
114 flags |= DOIO_ALLOW_SUSPEND;
115 if (sch->options.prefetch)
116 flags |= DOIO_DENY_PREFETCH;
117 if (sch->options.inter)
118 flags |= DOIO_SUPPRESS_INTER;
123 * Use tpi to get a pending interrupt, call the interrupt handler and
124 * return a pointer to the subchannel structure.
129 struct tpi_info *tpi_info;
130 struct subchannel *sch;
133 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
136 irb = (struct irb *) __LC_IRB;
137 /* Store interrupt response block to lowcore. */
138 if (tsch (tpi_info->schid, irb) != 0)
139 /* Not status pending or not operational. */
141 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
146 spin_lock(sch->lock);
147 memcpy (&sch->schib.scsw, &irb->scsw, sizeof (struct scsw));
148 if (sch->driver && sch->driver->irq)
149 sch->driver->irq(&sch->dev);
150 spin_unlock(sch->lock);
157 cio_start_handle_notoper(struct subchannel *sch, __u8 lpm)
166 stsch (sch->schid, &sch->schib);
168 CIO_MSG_EVENT(0, "cio_start: 'not oper' status for "
169 "subchannel 0.%x.%04x!\n", sch->schid.ssid,
171 sprintf(dbf_text, "no%s", sch->dev.bus_id);
172 CIO_TRACE_EVENT(0, dbf_text);
173 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
175 return (sch->lpm ? -EACCES : -ENODEV);
179 cio_start_key (struct subchannel *sch, /* subchannel structure */
180 struct ccw1 * cpa, /* logical channel prog addr */
181 __u8 lpm, /* logical path mask */
182 __u8 key) /* storage key */
187 CIO_TRACE_EVENT (4, "stIO");
188 CIO_TRACE_EVENT (4, sch->dev.bus_id);
190 /* sch is always under 2G. */
191 sch->orb.intparm = (__u32)(unsigned long)sch;
194 sch->orb.pfch = sch->options.prefetch == 0;
195 sch->orb.spnd = sch->options.suspend;
196 sch->orb.ssic = sch->options.suspend && sch->options.inter;
197 sch->orb.lpm = (lpm != 0) ? lpm : sch->lpm;
200 * for 64 bit we always support 64 bit IDAWs with 4k page size only
205 sch->orb.key = key >> 4;
206 /* issue "Start Subchannel" */
207 sch->orb.cpa = (__u32) __pa (cpa);
208 ccode = ssch (sch->schid, &sch->orb);
210 /* process condition code */
211 sprintf (dbf_txt, "ccode:%d", ccode);
212 CIO_TRACE_EVENT (4, dbf_txt);
217 * initialize device status information
219 sch->schib.scsw.actl |= SCSW_ACTL_START_PEND;
221 case 1: /* status pending */
224 default: /* device/path not operational */
225 return cio_start_handle_notoper(sch, lpm);
230 cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
232 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
236 * resume suspended I/O operation
239 cio_resume (struct subchannel *sch)
244 CIO_TRACE_EVENT (4, "resIO");
245 CIO_TRACE_EVENT (4, sch->dev.bus_id);
247 ccode = rsch (sch->schid);
249 sprintf (dbf_txt, "ccode:%d", ccode);
250 CIO_TRACE_EVENT (4, dbf_txt);
254 sch->schib.scsw.actl |= SCSW_ACTL_RESUME_PEND;
262 * useless to wait for request completion
263 * as device is no longer operational !
273 cio_halt(struct subchannel *sch)
281 CIO_TRACE_EVENT (2, "haltIO");
282 CIO_TRACE_EVENT (2, sch->dev.bus_id);
285 * Issue "Halt subchannel" and process condition code
287 ccode = hsch (sch->schid);
289 sprintf (dbf_txt, "ccode:%d", ccode);
290 CIO_TRACE_EVENT (2, dbf_txt);
294 sch->schib.scsw.actl |= SCSW_ACTL_HALT_PEND;
296 case 1: /* status pending */
299 default: /* device not operational */
305 * Clear I/O operation
308 cio_clear(struct subchannel *sch)
316 CIO_TRACE_EVENT (2, "clearIO");
317 CIO_TRACE_EVENT (2, sch->dev.bus_id);
320 * Issue "Clear subchannel" and process condition code
322 ccode = csch (sch->schid);
324 sprintf (dbf_txt, "ccode:%d", ccode);
325 CIO_TRACE_EVENT (2, dbf_txt);
329 sch->schib.scsw.actl |= SCSW_ACTL_CLEAR_PEND;
331 default: /* device not operational */
337 * Function: cio_cancel
338 * Issues a "Cancel Subchannel" on the specified subchannel
339 * Note: We don't need any fancy intparms and flags here
340 * since xsch is executed synchronously.
341 * Only for common I/O internal use as for now.
344 cio_cancel (struct subchannel *sch)
352 CIO_TRACE_EVENT (2, "cancelIO");
353 CIO_TRACE_EVENT (2, sch->dev.bus_id);
355 ccode = xsch (sch->schid);
357 sprintf (dbf_txt, "ccode:%d", ccode);
358 CIO_TRACE_EVENT (2, dbf_txt);
361 case 0: /* success */
362 /* Update information in scsw. */
363 stsch (sch->schid, &sch->schib);
365 case 1: /* status pending */
367 case 2: /* not applicable */
369 default: /* not oper */
375 * Function: cio_modify
376 * Issues a "Modify Subchannel" on the specified subchannel
379 cio_modify (struct subchannel *sch)
381 int ccode, retry, ret;
384 for (retry = 0; retry < 5; retry++) {
385 ccode = msch_err (sch->schid, &sch->schib);
386 if (ccode < 0) /* -EIO if msch gets a program check. */
389 case 0: /* successfull */
391 case 1: /* status pending */
394 udelay (100); /* allow for recovery */
397 case 3: /* not operational */
408 cio_enable_subchannel (struct subchannel *sch, unsigned int isc)
415 CIO_TRACE_EVENT (2, "ensch");
416 CIO_TRACE_EVENT (2, sch->dev.bus_id);
418 ccode = stsch (sch->schid, &sch->schib);
422 for (retry = 5, ret = 0; retry > 0; retry--) {
423 sch->schib.pmcw.ena = 1;
424 sch->schib.pmcw.isc = isc;
425 sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
426 ret = cio_modify(sch);
431 * Got a program check in cio_modify. Try without
432 * the concurrent sense bit the next time.
434 sch->schib.pmcw.csense = 0;
436 stsch (sch->schid, &sch->schib);
437 if (sch->schib.pmcw.ena)
442 if (tsch(sch->schid, &irb) != 0)
446 sprintf (dbf_txt, "ret:%d", ret);
447 CIO_TRACE_EVENT (2, dbf_txt);
452 * Disable subchannel.
455 cio_disable_subchannel (struct subchannel *sch)
462 CIO_TRACE_EVENT (2, "dissch");
463 CIO_TRACE_EVENT (2, sch->dev.bus_id);
465 ccode = stsch (sch->schid, &sch->schib);
466 if (ccode == 3) /* Not operational. */
469 if (sch->schib.scsw.actl != 0)
471 * the disable function must not be called while there are
472 * requests pending for completion !
476 for (retry = 5, ret = 0; retry > 0; retry--) {
477 sch->schib.pmcw.ena = 0;
478 ret = cio_modify(sch);
483 * The subchannel is busy or status pending.
484 * We'll disable when the next interrupt was delivered
485 * via the state machine.
489 stsch (sch->schid, &sch->schib);
490 if (!sch->schib.pmcw.ena)
494 sprintf (dbf_txt, "ret:%d", ret);
495 CIO_TRACE_EVENT (2, dbf_txt);
499 static int cio_create_sch_lock(struct subchannel *sch)
501 sch->lock = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
504 spin_lock_init(sch->lock);
509 * cio_validate_subchannel()
511 * Find out subchannel type and initialize struct subchannel.
513 * SUBCHANNEL_TYPE_IO for a normal io subchannel
514 * SUBCHANNEL_TYPE_CHSC for a chsc subchannel
515 * SUBCHANNEL_TYPE_MESSAGE for a messaging subchannel
516 * SUBCHANNEL_TYPE_ADM for a adm(?) subchannel
517 * -ENXIO for non-defined subchannels
518 * -ENODEV for subchannels with invalid device number or blacklisted devices
521 cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
527 sprintf (dbf_txt, "valsch%x", schid.sch_no);
528 CIO_TRACE_EVENT (4, dbf_txt);
530 /* Nuke all fields. */
531 memset(sch, 0, sizeof(struct subchannel));
534 if (cio_is_console(schid)) {
535 sch->lock = cio_get_console_lock();
537 err = cio_create_sch_lock(sch);
541 mutex_init(&sch->reg_mutex);
542 /* Set a name for the subchannel */
543 snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid,
547 * The first subchannel that is not-operational (ccode==3)
548 * indicates that there aren't any more devices available.
549 * If stsch gets an exception, it means the current subchannel set
552 ccode = stsch_err (schid, &sch->schib);
554 err = (ccode == 3) ? -ENXIO : ccode;
557 /* Copy subchannel type from path management control word. */
558 sch->st = sch->schib.pmcw.st;
561 * ... just being curious we check for non I/O subchannels
564 CIO_DEBUG(KERN_INFO, 0,
565 "Subchannel 0.%x.%04x reports "
566 "non-I/O subchannel type %04X\n",
567 sch->schid.ssid, sch->schid.sch_no, sch->st);
568 /* We stop here for non-io subchannels. */
573 /* Initialization for io subchannels. */
574 if (!sch->schib.pmcw.dnv) {
575 /* io subchannel but device number is invalid. */
579 /* Devno is valid. */
580 if (is_blacklisted (sch->schid.ssid, sch->schib.pmcw.dev)) {
582 * This device must not be known to Linux. So we simply
583 * say that there is no device and return ENODEV.
585 CIO_MSG_EVENT(0, "Blacklisted device detected "
586 "at devno %04X, subchannel set %x\n",
587 sch->schib.pmcw.dev, sch->schid.ssid);
592 if (!cio_is_console(sch->schid))
593 chsc_validate_chpids(sch);
594 sch->lpm = sch->schib.pmcw.pam & sch->opm;
596 CIO_DEBUG(KERN_INFO, 0,
597 "Detected device %04x on subchannel 0.%x.%04X"
598 " - PIM = %02X, PAM = %02X, POM = %02X\n",
599 sch->schib.pmcw.dev, sch->schid.ssid,
600 sch->schid.sch_no, sch->schib.pmcw.pim,
601 sch->schib.pmcw.pam, sch->schib.pmcw.pom);
604 * We now have to initially ...
605 * ... set "interruption subclass"
606 * ... enable "concurrent sense"
607 * ... enable "multipath mode" if more than one
608 * CHPID is available. This is done regardless
609 * whether multiple paths are available for us.
611 sch->schib.pmcw.isc = 3; /* could be smth. else */
612 sch->schib.pmcw.csense = 1; /* concurrent sense */
613 sch->schib.pmcw.ena = 0;
614 if ((sch->lpm & (sch->lpm - 1)) != 0)
615 sch->schib.pmcw.mp = 1; /* multipath mode */
618 if (!cio_is_console(schid))
625 * do_IRQ() handles all normal I/O device IRQ's (the special
626 * SMP cross-CPU interrupts have their own specific
631 do_IRQ (struct pt_regs *regs)
633 struct tpi_info *tpi_info;
634 struct subchannel *sch;
636 struct pt_regs *old_regs;
638 old_regs = set_irq_regs(regs);
640 asm volatile ("mc 0,0");
641 if (S390_lowcore.int_clock >= S390_lowcore.jiffy_timer)
643 * Make sure that the i/o interrupt did not "overtake"
644 * the last HZ timer interrupt.
648 * Get interrupt information from lowcore
650 tpi_info = (struct tpi_info *) __LC_SUBCHANNEL_ID;
651 irb = (struct irb *) __LC_IRB;
653 kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++;
655 * Non I/O-subchannel thin interrupts are processed differently
657 if (tpi_info->adapter_IO == 1 &&
658 tpi_info->int_type == IO_INTERRUPT_TYPE) {
662 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
664 spin_lock(sch->lock);
665 /* Store interrupt response block to lowcore. */
666 if (tsch (tpi_info->schid, irb) == 0 && sch) {
667 /* Keep subchannel information word up to date. */
668 memcpy (&sch->schib.scsw, &irb->scsw,
670 /* Call interrupt handler if there is one. */
671 if (sch->driver && sch->driver->irq)
672 sch->driver->irq(&sch->dev);
675 spin_unlock(sch->lock);
677 * Are more interrupts pending?
678 * If so, the tpi instruction will update the lowcore
679 * to hold the info for the next interrupt.
680 * We don't do this for VM because a tpi drops the cpu
681 * out of the sie which costs more cycles than it saves.
683 } while (!MACHINE_IS_VM && tpi (NULL) != 0);
685 set_irq_regs(old_regs);
688 #ifdef CONFIG_CCW_CONSOLE
689 static struct subchannel console_subchannel;
690 static int console_subchannel_in_use;
693 * busy wait for the next interrupt on the console
698 unsigned long cr6 __attribute__ ((aligned (8)));
699 unsigned long save_cr6 __attribute__ ((aligned (8)));
702 * before entering the spinlock we may already have
703 * processed the interrupt on a different CPU...
705 if (!console_subchannel_in_use)
708 /* disable all but isc 7 (console device) */
709 __ctl_store (save_cr6, 6, 6);
711 __ctl_load (cr6, 6, 6);
714 spin_unlock(console_subchannel.lock);
717 spin_lock(console_subchannel.lock);
718 } while (console_subchannel.schib.scsw.actl != 0);
720 * restore previous isc value
722 __ctl_load (save_cr6, 6, 6);
726 cio_test_for_console(struct subchannel_id schid, void *data)
728 if (stsch_err(schid, &console_subchannel.schib) != 0)
730 if (console_subchannel.schib.pmcw.dnv &&
731 console_subchannel.schib.pmcw.dev ==
733 console_irq = schid.sch_no;
734 return 1; /* found */
741 cio_get_console_sch_no(void)
743 struct subchannel_id schid;
745 init_subchannel_id(&schid);
746 if (console_irq != -1) {
747 /* VM provided us with the irq number of the console. */
748 schid.sch_no = console_irq;
749 if (stsch(schid, &console_subchannel.schib) != 0 ||
750 !console_subchannel.schib.pmcw.dnv)
752 console_devno = console_subchannel.schib.pmcw.dev;
753 } else if (console_devno != -1) {
754 /* At least the console device number is known. */
755 for_each_subchannel(cio_test_for_console, NULL);
756 if (console_irq == -1)
759 /* unlike in 2.4, we cannot autoprobe here, since
760 * the channel subsystem is not fully initialized.
761 * With some luck, the HWC console can take over */
762 printk(KERN_WARNING "No ccw console found!\n");
769 cio_probe_console(void)
772 struct subchannel_id schid;
774 if (xchg(&console_subchannel_in_use, 1) != 0)
775 return ERR_PTR(-EBUSY);
776 sch_no = cio_get_console_sch_no();
778 console_subchannel_in_use = 0;
779 return ERR_PTR(-ENODEV);
781 memset(&console_subchannel, 0, sizeof(struct subchannel));
782 init_subchannel_id(&schid);
783 schid.sch_no = sch_no;
784 ret = cio_validate_subchannel(&console_subchannel, schid);
786 console_subchannel_in_use = 0;
787 return ERR_PTR(-ENODEV);
791 * enable console I/O-interrupt subclass 7
794 console_subchannel.schib.pmcw.isc = 7;
795 console_subchannel.schib.pmcw.intparm =
796 (__u32)(unsigned long)&console_subchannel;
797 ret = cio_modify(&console_subchannel);
799 console_subchannel_in_use = 0;
802 return &console_subchannel;
806 cio_release_console(void)
808 console_subchannel.schib.pmcw.intparm = 0;
809 cio_modify(&console_subchannel);
810 ctl_clear_bit(6, 24);
811 console_subchannel_in_use = 0;
814 /* Bah... hack to catch console special sausages. */
816 cio_is_console(struct subchannel_id schid)
818 if (!console_subchannel_in_use)
820 return schid_equal(&schid, &console_subchannel.schid);
824 cio_get_console_subchannel(void)
826 if (!console_subchannel_in_use)
828 return &console_subchannel;
833 __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
838 for (retry=0;retry<3;retry++) {
840 cc = msch(schid, schib);
842 return (cc==3?-ENODEV:-EBUSY);
844 if (!schib->pmcw.ena)
847 return -EBUSY; /* uhm... */
851 __clear_subchannel_easy(struct subchannel_id schid)
857 for (retry=0;retry<20;retry++) {
861 tsch(ti.schid, (struct irb *)__LC_IRB);
862 if (schid_equal(&ti.schid, &schid))
870 static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data)
874 if (stsch_err(schid, &schib))
878 switch(__disable_subchannel_easy(schid, &schib)) {
882 default: /* -EBUSY */
883 if (__clear_subchannel_easy(schid))
884 break; /* give up... */
885 stsch(schid, &schib);
886 __disable_subchannel_easy(schid, &schib);
891 static atomic_t chpid_reset_count;
893 static void s390_reset_chpids_mcck_handler(void)
898 /* Check for pending channel report word. */
899 mci = (struct mci *)&S390_lowcore.mcck_interruption_code;
902 /* Process channel report words. */
903 while (stcrw(&crw) == 0) {
904 /* Check for responses to RCHP. */
905 if (crw.slct && crw.rsc == CRW_RSC_CPATH)
906 atomic_dec(&chpid_reset_count);
910 #define RCHP_TIMEOUT (30 * USEC_PER_SEC)
911 static void css_reset(void)
914 unsigned long long timeout;
916 /* Reset subchannels. */
917 for_each_subchannel(__shutdown_subchannel_easy, NULL);
918 /* Reset channel paths. */
919 s390_reset_mcck_handler = s390_reset_chpids_mcck_handler;
920 /* Enable channel report machine checks. */
921 __ctl_set_bit(14, 28);
922 /* Temporarily reenable machine checks. */
924 for (i = 0; i <= __MAX_CHPID; i++) {
926 if ((ret == 0) || (ret == 2))
928 * rchp either succeeded, or another rchp is already
929 * in progress. In either case, we'll get a crw.
931 atomic_inc(&chpid_reset_count);
933 /* Wait for machine check for all channel paths. */
934 timeout = get_clock() + (RCHP_TIMEOUT << 12);
935 while (atomic_read(&chpid_reset_count) != 0) {
936 if (get_clock() > timeout)
940 /* Disable machine checks again. */
941 local_mcck_disable();
942 /* Disable channel report machine checks. */
943 __ctl_clear_bit(14, 28);
944 s390_reset_mcck_handler = NULL;
947 static struct reset_call css_reset_call = {
951 static int __init init_css_reset_call(void)
953 atomic_set(&chpid_reset_count, 0);
954 register_reset_call(&css_reset_call);
958 arch_initcall(init_css_reset_call);
960 struct sch_match_id {
961 struct subchannel_id schid;
962 struct ccw_dev_id devid;
966 static int __reipl_subchannel_match(struct subchannel_id schid, void *data)
969 struct sch_match_id *match_id = data;
971 if (stsch_err(schid, &schib))
973 if (schib.pmcw.dnv &&
974 (schib.pmcw.dev == match_id->devid.devno) &&
975 (schid.ssid == match_id->devid.ssid)) {
976 match_id->schid = schid;
983 static int reipl_find_schid(struct ccw_dev_id *devid,
984 struct subchannel_id *schid)
986 struct sch_match_id match_id;
988 match_id.devid = *devid;
989 match_id.rc = -ENODEV;
990 for_each_subchannel(__reipl_subchannel_match, &match_id);
991 if (match_id.rc == 0)
992 *schid = match_id.schid;
996 extern void do_reipl_asm(__u32 schid);
998 /* Make sure all subchannels are quiet before we re-ipl an lpar. */
999 void reipl_ccw_dev(struct ccw_dev_id *devid)
1001 struct subchannel_id schid;
1003 s390_reset_system();
1004 if (reipl_find_schid(devid, &schid) != 0)
1005 panic("IPL Device not found\n");
1006 do_reipl_asm(*((__u32*)&schid));
1009 extern struct schib ipl_schib;
1012 * ipl_save_parameters gets called very early. It is not allowed to access
1013 * anything in the bss section at all. The bss section is not cleared yet,
1014 * but may contain some ipl parameters written by the firmware.
1015 * These parameters (if present) are copied to 0x2000.
1016 * To avoid corruption of the ipl parameters, all variables used by this
1017 * function must reside on the stack or in the data section.
1019 void ipl_save_parameters(void)
1021 struct subchannel_id schid;
1022 unsigned int *ipl_ptr;
1025 schid = *(struct subchannel_id *)__LC_SUBCHANNEL_ID;
1028 if (stsch(schid, &ipl_schib))
1030 if (!ipl_schib.pmcw.dnv)
1032 ipl_devno = ipl_schib.pmcw.dev;
1033 ipl_flags |= IPL_DEVNO_VALID;
1034 if (!ipl_schib.pmcw.qf)
1036 ipl_flags |= IPL_PARMBLOCK_VALID;
1037 ipl_ptr = (unsigned int *)__LC_IPL_PARMBLOCK_PTR;
1038 src = (void *)(unsigned long)*ipl_ptr;
1039 dst = (void *)IPL_PARMBLOCK_ORIGIN;
1040 memmove(dst, src, PAGE_SIZE);
1041 *ipl_ptr = IPL_PARMBLOCK_ORIGIN;