2 * S/390 common I/O routines -- channel subsystem call
4 * Copyright IBM Corp. 1999, 2010
5 * Author(s): Ingo Adlung (adlung@de.ibm.com)
6 * Cornelia Huck (cornelia.huck@de.ibm.com)
7 * Arnd Bergmann (arndb@de.ibm.com)
10 #define KMSG_COMPONENT "cio"
11 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13 #include <linux/module.h>
14 #include <linux/slab.h>
15 #include <linux/init.h>
16 #include <linux/device.h>
19 #include <asm/chpid.h>
25 #include "cio_debug.h"
30 static void *sei_page;
31 static void *chsc_page;
32 static DEFINE_SPINLOCK(chsc_page_lock);
35 * chsc_error_from_response() - convert a chsc response to an error
36 * @response: chsc response code
38 * Returns an appropriate Linux error code for @response.
40 int chsc_error_from_response(int response)
64 EXPORT_SYMBOL_GPL(chsc_error_from_response);
66 struct chsc_ssd_area {
67 struct chsc_header request;
71 u16 f_sch; /* first subchannel */
73 u16 l_sch; /* last subchannel */
75 struct chsc_header response;
79 u8 st : 3; /* subchannel type */
81 u8 unit_addr; /* unit address */
82 u16 devno; /* device number */
85 u16 sch; /* subchannel */
86 u8 chpid[8]; /* chpids 0-7 */
87 u16 fla[8]; /* full link addresses 0-7 */
88 } __attribute__ ((packed));
90 int chsc_get_ssd_info(struct subchannel_id schid, struct chsc_ssd_info *ssd)
92 struct chsc_ssd_area *ssd_area;
98 spin_lock_irq(&chsc_page_lock);
99 memset(chsc_page, 0, PAGE_SIZE);
100 ssd_area = chsc_page;
101 ssd_area->request.length = 0x0010;
102 ssd_area->request.code = 0x0004;
103 ssd_area->ssid = schid.ssid;
104 ssd_area->f_sch = schid.sch_no;
105 ssd_area->l_sch = schid.sch_no;
107 ccode = chsc(ssd_area);
108 /* Check response. */
110 ret = (ccode == 3) ? -ENODEV : -EBUSY;
113 ret = chsc_error_from_response(ssd_area->response.code);
115 CIO_MSG_EVENT(2, "chsc: ssd failed for 0.%x.%04x (rc=%04x)\n",
116 schid.ssid, schid.sch_no,
117 ssd_area->response.code);
120 if (!ssd_area->sch_valid) {
126 memset(ssd, 0, sizeof(struct chsc_ssd_info));
127 if ((ssd_area->st != SUBCHANNEL_TYPE_IO) &&
128 (ssd_area->st != SUBCHANNEL_TYPE_MSG))
130 ssd->path_mask = ssd_area->path_mask;
131 ssd->fla_valid_mask = ssd_area->fla_valid_mask;
132 for (i = 0; i < 8; i++) {
134 if (ssd_area->path_mask & mask) {
135 chp_id_init(&ssd->chpid[i]);
136 ssd->chpid[i].id = ssd_area->chpid[i];
138 if (ssd_area->fla_valid_mask & mask)
139 ssd->fla[i] = ssd_area->fla[i];
142 spin_unlock_irq(&chsc_page_lock);
146 static int s390_subchannel_remove_chpid(struct subchannel *sch, void *data)
148 spin_lock_irq(sch->lock);
149 if (sch->driver && sch->driver->chp_event)
150 if (sch->driver->chp_event(sch, data, CHP_OFFLINE) != 0)
152 spin_unlock_irq(sch->lock);
157 spin_unlock_irq(sch->lock);
158 css_schedule_eval(sch->schid);
162 void chsc_chp_offline(struct chp_id chpid)
165 struct chp_link link;
167 sprintf(dbf_txt, "chpr%x.%02x", chpid.cssid, chpid.id);
168 CIO_TRACE_EVENT(2, dbf_txt);
170 if (chp_get_status(chpid) <= 0)
172 memset(&link, 0, sizeof(struct chp_link));
174 /* Wait until previous actions have settled. */
175 css_wait_for_slow_path();
176 for_each_subchannel_staged(s390_subchannel_remove_chpid, NULL, &link);
179 static int s390_process_res_acc_new_sch(struct subchannel_id schid, void *data)
183 * We don't know the device yet, but since a path
184 * may be available now to the device we'll have
185 * to do recognition again.
186 * Since we don't have any idea about which chpid
187 * that beast may be on we'll have to do a stsch
188 * on all devices, grr...
190 if (stsch_err(schid, &schib))
194 /* Put it on the slow path. */
195 css_schedule_eval(schid);
199 static int __s390_process_res_acc(struct subchannel *sch, void *data)
201 spin_lock_irq(sch->lock);
202 if (sch->driver && sch->driver->chp_event)
203 sch->driver->chp_event(sch, data, CHP_ONLINE);
204 spin_unlock_irq(sch->lock);
209 static void s390_process_res_acc(struct chp_link *link)
213 sprintf(dbf_txt, "accpr%x.%02x", link->chpid.cssid,
215 CIO_TRACE_EVENT( 2, dbf_txt);
216 if (link->fla != 0) {
217 sprintf(dbf_txt, "fla%x", link->fla);
218 CIO_TRACE_EVENT( 2, dbf_txt);
220 /* Wait until previous actions have settled. */
221 css_wait_for_slow_path();
223 * I/O resources may have become accessible.
224 * Scan through all subchannels that may be concerned and
225 * do a validation on those.
226 * The more information we have (info), the less scanning
227 * will we have to do.
229 for_each_subchannel_staged(__s390_process_res_acc,
230 s390_process_res_acc_new_sch, link);
234 __get_chpid_from_lir(void *data)
240 /* incident-node descriptor */
242 /* attached-node descriptor */
244 /* incident-specific information */
246 } __attribute__ ((packed)) *lir;
250 /* NULL link incident record */
252 if (!(lir->indesc[0]&0xc0000000))
253 /* node descriptor not valid */
255 if (!(lir->indesc[0]&0x10000000))
256 /* don't handle device-type nodes - FIXME */
258 /* Byte 3 contains the chpid. Could also be CTCA, but we don't care */
260 return (u16) (lir->indesc[0]&0x000000ff);
263 struct chsc_sei_area {
264 struct chsc_header request;
268 struct chsc_header response;
271 u8 vf; /* validity flags */
272 u8 rs; /* reporting source */
273 u8 cc; /* content code */
274 u16 fla; /* full link address */
275 u16 rsid; /* reporting source id */
278 u8 ccdf[4096 - 16 - 24]; /* content-code dependent field */
279 /* ccdf has to be big enough for a link-incident record */
280 } __attribute__ ((packed));
282 static void chsc_process_sei_link_incident(struct chsc_sei_area *sei_area)
287 CIO_CRW_EVENT(4, "chsc: link incident (rs=%02x, rs_id=%04x)\n",
288 sei_area->rs, sei_area->rsid);
289 if (sei_area->rs != 4)
291 id = __get_chpid_from_lir(sei_area->ccdf);
293 CIO_CRW_EVENT(4, "chsc: link incident - invalid LIR\n");
297 chsc_chp_offline(chpid);
301 static void chsc_process_sei_res_acc(struct chsc_sei_area *sei_area)
303 struct chp_link link;
307 CIO_CRW_EVENT(4, "chsc: resource accessibility event (rs=%02x, "
308 "rs_id=%04x)\n", sei_area->rs, sei_area->rsid);
309 if (sei_area->rs != 4)
312 chpid.id = sei_area->rsid;
313 /* allocate a new channel path structure, if needed */
314 status = chp_get_status(chpid);
319 memset(&link, 0, sizeof(struct chp_link));
321 if ((sei_area->vf & 0xc0) != 0) {
322 link.fla = sei_area->fla;
323 if ((sei_area->vf & 0xc0) == 0xc0)
324 /* full link address */
325 link.fla_mask = 0xffff;
328 link.fla_mask = 0xff00;
330 s390_process_res_acc(&link);
333 static void chsc_process_sei_chp_avail(struct chsc_sei_area *sei_area)
335 struct channel_path *chp;
340 CIO_CRW_EVENT(4, "chsc: channel path availability information\n");
341 if (sei_area->rs != 0)
343 data = sei_area->ccdf;
345 for (num = 0; num <= __MAX_CHPID; num++) {
346 if (!chp_test_bit(data, num))
350 CIO_CRW_EVENT(4, "Update information for channel path "
351 "%x.%02x\n", chpid.cssid, chpid.id);
352 chp = chpid_to_chp(chpid);
357 mutex_lock(&chp->lock);
358 chsc_determine_base_channel_path_desc(chpid, &chp->desc);
359 mutex_unlock(&chp->lock);
363 struct chp_config_data {
369 static void chsc_process_sei_chp_config(struct chsc_sei_area *sei_area)
371 struct chp_config_data *data;
374 char *events[3] = {"configure", "deconfigure", "cancel deconfigure"};
376 CIO_CRW_EVENT(4, "chsc: channel-path-configuration notification\n");
377 if (sei_area->rs != 0)
379 data = (struct chp_config_data *) &(sei_area->ccdf);
381 for (num = 0; num <= __MAX_CHPID; num++) {
382 if (!chp_test_bit(data->map, num))
385 pr_notice("Processing %s for channel path %x.%02x\n",
386 events[data->op], chpid.cssid, chpid.id);
389 chp_cfg_schedule(chpid, 1);
392 chp_cfg_schedule(chpid, 0);
395 chp_cfg_cancel_deconfigure(chpid);
401 static void chsc_process_sei_scm_change(struct chsc_sei_area *sei_area)
405 CIO_CRW_EVENT(4, "chsc: scm change notification\n");
406 if (sei_area->rs != 7)
409 ret = scm_update_information();
411 CIO_CRW_EVENT(0, "chsc: updating change notification"
412 " failed (rc=%d).\n", ret);
415 static void chsc_process_sei(struct chsc_sei_area *sei_area)
417 /* Check if we might have lost some information. */
418 if (sei_area->flags & 0x40) {
419 CIO_CRW_EVENT(2, "chsc: event overflow\n");
420 css_schedule_eval_all();
422 /* which kind of information was stored? */
423 switch (sei_area->cc) {
424 case 1: /* link incident*/
425 chsc_process_sei_link_incident(sei_area);
427 case 2: /* i/o resource accessibility */
428 chsc_process_sei_res_acc(sei_area);
430 case 7: /* channel-path-availability information */
431 chsc_process_sei_chp_avail(sei_area);
433 case 8: /* channel-path-configuration notification */
434 chsc_process_sei_chp_config(sei_area);
436 case 12: /* scm change notification */
437 chsc_process_sei_scm_change(sei_area);
439 default: /* other stuff */
440 CIO_CRW_EVENT(4, "chsc: unhandled sei content code %d\n",
446 static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
448 struct chsc_sei_area *sei_area;
451 css_schedule_eval_all();
454 CIO_CRW_EVENT(2, "CRW reports slct=%d, oflw=%d, "
455 "chn=%d, rsc=%X, anc=%d, erc=%X, rsid=%X\n",
456 crw0->slct, crw0->oflw, crw0->chn, crw0->rsc, crw0->anc,
457 crw0->erc, crw0->rsid);
460 /* Access to sei_page is serialized through machine check handler
461 * thread, so no need for locking. */
464 CIO_TRACE_EVENT(2, "prcss");
466 memset(sei_area, 0, sizeof(*sei_area));
467 sei_area->request.length = 0x0010;
468 sei_area->request.code = 0x000e;
472 if (sei_area->response.code == 0x0001) {
473 CIO_CRW_EVENT(4, "chsc: sei successful\n");
474 chsc_process_sei(sei_area);
476 CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n",
477 sei_area->response.code);
480 } while (sei_area->flags & 0x80);
483 void chsc_chp_online(struct chp_id chpid)
486 struct chp_link link;
488 sprintf(dbf_txt, "cadd%x.%02x", chpid.cssid, chpid.id);
489 CIO_TRACE_EVENT(2, dbf_txt);
491 if (chp_get_status(chpid) != 0) {
492 memset(&link, 0, sizeof(struct chp_link));
494 /* Wait until previous actions have settled. */
495 css_wait_for_slow_path();
496 for_each_subchannel_staged(__s390_process_res_acc, NULL,
501 static void __s390_subchannel_vary_chpid(struct subchannel *sch,
502 struct chp_id chpid, int on)
505 struct chp_link link;
507 memset(&link, 0, sizeof(struct chp_link));
509 spin_lock_irqsave(sch->lock, flags);
510 if (sch->driver && sch->driver->chp_event)
511 sch->driver->chp_event(sch, &link,
512 on ? CHP_VARY_ON : CHP_VARY_OFF);
513 spin_unlock_irqrestore(sch->lock, flags);
516 static int s390_subchannel_vary_chpid_off(struct subchannel *sch, void *data)
518 struct chp_id *chpid = data;
520 __s390_subchannel_vary_chpid(sch, *chpid, 0);
524 static int s390_subchannel_vary_chpid_on(struct subchannel *sch, void *data)
526 struct chp_id *chpid = data;
528 __s390_subchannel_vary_chpid(sch, *chpid, 1);
533 __s390_vary_chpid_on(struct subchannel_id schid, void *data)
537 if (stsch_err(schid, &schib))
540 /* Put it on the slow path. */
541 css_schedule_eval(schid);
546 * chsc_chp_vary - propagate channel-path vary operation to subchannels
547 * @chpid: channl-path ID
548 * @on: non-zero for vary online, zero for vary offline
550 int chsc_chp_vary(struct chp_id chpid, int on)
552 struct channel_path *chp = chpid_to_chp(chpid);
554 /* Wait until previous actions have settled. */
555 css_wait_for_slow_path();
557 * Redo PathVerification on the devices the chpid connects to
560 /* Try to update the channel path descritor. */
561 chsc_determine_base_channel_path_desc(chpid, &chp->desc);
562 for_each_subchannel_staged(s390_subchannel_vary_chpid_on,
563 __s390_vary_chpid_on, &chpid);
565 for_each_subchannel_staged(s390_subchannel_vary_chpid_off,
572 chsc_remove_cmg_attr(struct channel_subsystem *css)
576 for (i = 0; i <= __MAX_CHPID; i++) {
579 chp_remove_cmg_attr(css->chps[i]);
584 chsc_add_cmg_attr(struct channel_subsystem *css)
589 for (i = 0; i <= __MAX_CHPID; i++) {
592 ret = chp_add_cmg_attr(css->chps[i]);
598 for (--i; i >= 0; i--) {
601 chp_remove_cmg_attr(css->chps[i]);
606 int __chsc_do_secm(struct channel_subsystem *css, int enable)
609 struct chsc_header request;
610 u32 operation_code : 2;
619 struct chsc_header response;
624 } __attribute__ ((packed)) *secm_area;
627 spin_lock_irq(&chsc_page_lock);
628 memset(chsc_page, 0, PAGE_SIZE);
629 secm_area = chsc_page;
630 secm_area->request.length = 0x0050;
631 secm_area->request.code = 0x0016;
633 secm_area->key = PAGE_DEFAULT_KEY >> 4;
634 secm_area->cub_addr1 = (u64)(unsigned long)css->cub_addr1;
635 secm_area->cub_addr2 = (u64)(unsigned long)css->cub_addr2;
637 secm_area->operation_code = enable ? 0 : 1;
639 ccode = chsc(secm_area);
641 ret = (ccode == 3) ? -ENODEV : -EBUSY;
645 switch (secm_area->response.code) {
651 ret = chsc_error_from_response(secm_area->response.code);
654 CIO_CRW_EVENT(2, "chsc: secm failed (rc=%04x)\n",
655 secm_area->response.code);
657 spin_unlock_irq(&chsc_page_lock);
662 chsc_secm(struct channel_subsystem *css, int enable)
666 if (enable && !css->cm_enabled) {
667 css->cub_addr1 = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
668 css->cub_addr2 = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
669 if (!css->cub_addr1 || !css->cub_addr2) {
670 free_page((unsigned long)css->cub_addr1);
671 free_page((unsigned long)css->cub_addr2);
675 ret = __chsc_do_secm(css, enable);
677 css->cm_enabled = enable;
678 if (css->cm_enabled) {
679 ret = chsc_add_cmg_attr(css);
681 __chsc_do_secm(css, 0);
685 chsc_remove_cmg_attr(css);
687 if (!css->cm_enabled) {
688 free_page((unsigned long)css->cub_addr1);
689 free_page((unsigned long)css->cub_addr2);
694 int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
695 int c, int m, void *page)
697 struct chsc_scpd *scpd_area;
700 if ((rfmt == 1) && !css_general_characteristics.fcs)
702 if ((rfmt == 2) && !css_general_characteristics.cib)
705 memset(page, 0, PAGE_SIZE);
707 scpd_area->request.length = 0x0010;
708 scpd_area->request.code = 0x0002;
709 scpd_area->cssid = chpid.cssid;
710 scpd_area->first_chpid = chpid.id;
711 scpd_area->last_chpid = chpid.id;
714 scpd_area->fmt = fmt;
715 scpd_area->rfmt = rfmt;
717 ccode = chsc(scpd_area);
719 return (ccode == 3) ? -ENODEV : -EBUSY;
721 ret = chsc_error_from_response(scpd_area->response.code);
723 CIO_CRW_EVENT(2, "chsc: scpd failed (rc=%04x)\n",
724 scpd_area->response.code);
727 EXPORT_SYMBOL_GPL(chsc_determine_channel_path_desc);
729 int chsc_determine_base_channel_path_desc(struct chp_id chpid,
730 struct channel_path_desc *desc)
732 struct chsc_response_struct *chsc_resp;
733 struct chsc_scpd *scpd_area;
737 spin_lock_irqsave(&chsc_page_lock, flags);
738 scpd_area = chsc_page;
739 ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, scpd_area);
742 chsc_resp = (void *)&scpd_area->response;
743 memcpy(desc, &chsc_resp->data, sizeof(*desc));
745 spin_unlock_irqrestore(&chsc_page_lock, flags);
749 int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
750 struct channel_path_desc_fmt1 *desc)
752 struct chsc_response_struct *chsc_resp;
753 struct chsc_scpd *scpd_area;
756 spin_lock_irq(&chsc_page_lock);
757 scpd_area = chsc_page;
758 ret = chsc_determine_channel_path_desc(chpid, 0, 0, 1, 0, scpd_area);
761 chsc_resp = (void *)&scpd_area->response;
762 memcpy(desc, &chsc_resp->data, sizeof(*desc));
764 spin_unlock_irq(&chsc_page_lock);
769 chsc_initialize_cmg_chars(struct channel_path *chp, u8 cmcv,
770 struct cmg_chars *chars)
772 struct cmg_chars *cmg_chars;
775 cmg_chars = chp->cmg_chars;
776 for (i = 0; i < NR_MEASUREMENT_CHARS; i++) {
777 mask = 0x80 >> (i + 3);
779 cmg_chars->values[i] = chars->values[i];
781 cmg_chars->values[i] = 0;
785 int chsc_get_channel_measurement_chars(struct channel_path *chp)
787 struct cmg_chars *cmg_chars;
791 struct chsc_header request;
797 struct chsc_header response;
808 u32 data[NR_MEASUREMENT_CHARS];
809 } __attribute__ ((packed)) *scmc_area;
811 chp->cmg_chars = NULL;
812 cmg_chars = kmalloc(sizeof(*cmg_chars), GFP_KERNEL);
816 spin_lock_irq(&chsc_page_lock);
817 memset(chsc_page, 0, PAGE_SIZE);
818 scmc_area = chsc_page;
819 scmc_area->request.length = 0x0010;
820 scmc_area->request.code = 0x0022;
821 scmc_area->first_chpid = chp->chpid.id;
822 scmc_area->last_chpid = chp->chpid.id;
824 ccode = chsc(scmc_area);
826 ret = (ccode == 3) ? -ENODEV : -EBUSY;
830 ret = chsc_error_from_response(scmc_area->response.code);
832 CIO_CRW_EVENT(2, "chsc: scmc failed (rc=%04x)\n",
833 scmc_area->response.code);
836 if (scmc_area->not_valid) {
841 chp->cmg = scmc_area->cmg;
842 chp->shared = scmc_area->shared;
843 if (chp->cmg != 2 && chp->cmg != 3) {
844 /* No cmg-dependent data. */
847 chp->cmg_chars = cmg_chars;
848 chsc_initialize_cmg_chars(chp, scmc_area->cmcv,
849 (struct cmg_chars *) &scmc_area->data);
851 spin_unlock_irq(&chsc_page_lock);
858 int __init chsc_init(void)
862 sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
863 chsc_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
864 if (!sei_page || !chsc_page) {
868 ret = crw_register_handler(CRW_RSC_CSS, chsc_process_crw);
873 free_page((unsigned long)chsc_page);
874 free_page((unsigned long)sei_page);
878 void __init chsc_init_cleanup(void)
880 crw_unregister_handler(CRW_RSC_CSS);
881 free_page((unsigned long)chsc_page);
882 free_page((unsigned long)sei_page);
885 int chsc_enable_facility(int operation_code)
890 struct chsc_header request;
897 u32 operation_data_area[252];
898 struct chsc_header response;
902 } __attribute__ ((packed)) *sda_area;
904 spin_lock_irqsave(&chsc_page_lock, flags);
905 memset(chsc_page, 0, PAGE_SIZE);
906 sda_area = chsc_page;
907 sda_area->request.length = 0x0400;
908 sda_area->request.code = 0x0031;
909 sda_area->operation_code = operation_code;
911 ret = chsc(sda_area);
913 ret = (ret == 3) ? -ENODEV : -EBUSY;
917 switch (sda_area->response.code) {
922 ret = chsc_error_from_response(sda_area->response.code);
925 CIO_CRW_EVENT(2, "chsc: sda (oc=%x) failed (rc=%04x)\n",
926 operation_code, sda_area->response.code);
928 spin_unlock_irqrestore(&chsc_page_lock, flags);
932 struct css_general_char css_general_characteristics;
933 struct css_chsc_char css_chsc_characteristics;
936 chsc_determine_css_characteristics(void)
940 struct chsc_header request;
944 struct chsc_header response;
946 u32 general_char[510];
948 } __attribute__ ((packed)) *scsc_area;
950 spin_lock_irq(&chsc_page_lock);
951 memset(chsc_page, 0, PAGE_SIZE);
952 scsc_area = chsc_page;
953 scsc_area->request.length = 0x0010;
954 scsc_area->request.code = 0x0010;
956 result = chsc(scsc_area);
958 result = (result == 3) ? -ENODEV : -EBUSY;
962 result = chsc_error_from_response(scsc_area->response.code);
964 memcpy(&css_general_characteristics, scsc_area->general_char,
965 sizeof(css_general_characteristics));
966 memcpy(&css_chsc_characteristics, scsc_area->chsc_char,
967 sizeof(css_chsc_characteristics));
969 CIO_CRW_EVENT(2, "chsc: scsc failed (rc=%04x)\n",
970 scsc_area->response.code);
972 spin_unlock_irq(&chsc_page_lock);
976 EXPORT_SYMBOL_GPL(css_general_characteristics);
977 EXPORT_SYMBOL_GPL(css_chsc_characteristics);
979 int chsc_sstpc(void *page, unsigned int op, u16 ctrl)
982 struct chsc_header request;
985 unsigned int rsvd1 : 8;
986 unsigned int ctrl : 16;
987 unsigned int rsvd2[5];
988 struct chsc_header response;
989 unsigned int rsvd3[7];
990 } __attribute__ ((packed)) *rr;
993 memset(page, 0, PAGE_SIZE);
995 rr->request.length = 0x0020;
996 rr->request.code = 0x0033;
1002 rc = (rr->response.code == 0x0001) ? 0 : -EIO;
1006 int chsc_sstpi(void *page, void *result, size_t size)
1009 struct chsc_header request;
1010 unsigned int rsvd0[3];
1011 struct chsc_header response;
1013 } __attribute__ ((packed)) *rr;
1016 memset(page, 0, PAGE_SIZE);
1018 rr->request.length = 0x0010;
1019 rr->request.code = 0x0038;
1023 memcpy(result, &rr->data, size);
1024 return (rr->response.code == 0x0001) ? 0 : -EIO;
1027 int chsc_siosl(struct subchannel_id schid)
1030 struct chsc_header request;
1032 struct subchannel_id sid;
1034 struct chsc_header response;
1036 } __attribute__ ((packed)) *siosl_area;
1037 unsigned long flags;
1041 spin_lock_irqsave(&chsc_page_lock, flags);
1042 memset(chsc_page, 0, PAGE_SIZE);
1043 siosl_area = chsc_page;
1044 siosl_area->request.length = 0x0010;
1045 siosl_area->request.code = 0x0046;
1046 siosl_area->word1 = 0x80000000;
1047 siosl_area->sid = schid;
1049 ccode = chsc(siosl_area);
1055 CIO_MSG_EVENT(2, "chsc: chsc failed for 0.%x.%04x (ccode=%d)\n",
1056 schid.ssid, schid.sch_no, ccode);
1059 rc = chsc_error_from_response(siosl_area->response.code);
1061 CIO_MSG_EVENT(2, "chsc: siosl failed for 0.%x.%04x (rc=%04x)\n",
1062 schid.ssid, schid.sch_no,
1063 siosl_area->response.code);
1065 CIO_MSG_EVENT(4, "chsc: siosl succeeded for 0.%x.%04x\n",
1066 schid.ssid, schid.sch_no);
1068 spin_unlock_irqrestore(&chsc_page_lock, flags);
1071 EXPORT_SYMBOL_GPL(chsc_siosl);
1074 * chsc_scm_info() - store SCM information (SSI)
1075 * @scm_area: request and response block for SSI
1076 * @token: continuation token
1078 * Returns 0 on success.
1080 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token)
1084 memset(scm_area, 0, sizeof(*scm_area));
1085 scm_area->request.length = 0x0020;
1086 scm_area->request.code = 0x004C;
1087 scm_area->reqtok = token;
1089 ccode = chsc(scm_area);
1091 ret = (ccode == 3) ? -ENODEV : -EBUSY;
1094 ret = chsc_error_from_response(scm_area->response.code);
1096 CIO_MSG_EVENT(2, "chsc: scm info failed (rc=%04x)\n",
1097 scm_area->response.code);
1101 EXPORT_SYMBOL_GPL(chsc_scm_info);