Lines Matching +full:ssc +full:- +full:block +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0
52 /* The ccw bus type uses this table to find devices that it sends to
134 /* set ECKD specific ccw-device options */ in dasd_eckd_probe()
140 "ccw-device options"); in dasd_eckd_probe()
163 return (d1 + (d2 - 1)) / d2; in ceil_quot()
172 switch (rdc->dev_type) { in recs_per_track()
201 geo->cyl = (__u16) cyl; in set_ch_t()
202 geo->head = cyl >> 16; in set_ch_t()
203 geo->head <<= 4; in set_ch_t()
204 geo->head |= head; in set_ch_t()
214 struct dasd_eckd_private *private = device->private; in dasd_eckd_track_from_irb()
223 return -EINVAL; in dasd_eckd_track_from_irb()
228 return -EINVAL; in dasd_eckd_track_from_irb()
242 *track = cyl * private->rdc_data.trk_per_cyl + head; in dasd_eckd_track_from_irb()
249 struct dasd_eckd_private *private = device->private; in set_timestamp()
252 rc = get_phys_clock(&data->ep_sys_time); in set_timestamp()
257 if ((rc && !private->rdc_data.facilities.XRC_supported) || in set_timestamp()
258 rc == -EOPNOTSUPP || rc == -EACCES) in set_timestamp()
261 /* switch on System Time Stamp - needed for XRC Support */ in set_timestamp()
262 data->ga_extended |= 0x08; /* switch on 'Time Stamp Valid' */ in set_timestamp()
263 data->ga_extended |= 0x02; /* switch on 'Extended Parameter' */ in set_timestamp()
266 ccw->count = sizeof(struct DE_eckd_data); in set_timestamp()
267 ccw->flags |= CCW_FLAG_SLI; in set_timestamp()
278 struct dasd_eckd_private *private = device->private; in define_extent()
284 ccw->cmd_code = DASD_ECKD_CCW_DEFINE_EXTENT; in define_extent()
285 ccw->flags = 0; in define_extent()
286 ccw->count = 16; in define_extent()
287 ccw->cda = virt_to_dma32(data); in define_extent()
300 data->mask.perm = 0x1; in define_extent()
301 data->attributes.operation = private->attrib.operation; in define_extent()
304 data->mask.perm = 0x1; in define_extent()
305 data->attributes.operation = DASD_BYPASS_CACHE; in define_extent()
309 data->mask.perm = 0x1; in define_extent()
310 data->attributes.operation = private->attrib.operation; in define_extent()
311 data->blk_size = 0; in define_extent()
317 data->mask.perm = 0x02; in define_extent()
318 data->attributes.operation = private->attrib.operation; in define_extent()
323 data->attributes.operation = DASD_BYPASS_CACHE; in define_extent()
329 data->mask.perm = 0x3; in define_extent()
330 data->mask.auth = 0x1; in define_extent()
331 data->attributes.operation = DASD_BYPASS_CACHE; in define_extent()
335 data->mask.perm = 0x03; in define_extent()
336 data->attributes.operation = private->attrib.operation; in define_extent()
337 data->blk_size = 0; in define_extent()
340 data->mask.perm = 0x02; in define_extent()
341 data->attributes.operation = private->attrib.operation; in define_extent()
342 data->blk_size = blksize; in define_extent()
346 dev_err(&device->cdev->dev, in define_extent()
351 data->attributes.mode = 0x3; /* ECKD */ in define_extent()
353 if ((private->rdc_data.cu_type == 0x2105 || in define_extent()
354 private->rdc_data.cu_type == 0x2107 || in define_extent()
355 private->rdc_data.cu_type == 0x1750) in define_extent()
356 && !(private->uses_cdl && trk < 2)) in define_extent()
357 data->ga_extended |= 0x40; /* Regular Data Format Mode */ in define_extent()
359 heads = private->rdc_data.trk_per_cyl; in define_extent()
365 /* check for sequential prestage - enhance cylinder range */ in define_extent()
366 if (data->attributes.operation == DASD_SEQ_PRESTAGE || in define_extent()
367 data->attributes.operation == DASD_SEQ_ACCESS) { in define_extent()
369 if (endcyl + private->attrib.nr_cyl < private->real_cyl) in define_extent()
370 endcyl += private->attrib.nr_cyl; in define_extent()
372 endcyl = (private->real_cyl - 1); in define_extent()
375 set_ch_t(&data->beg_ext, begcyl, beghead); in define_extent()
376 set_ch_t(&data->end_ext, endcyl, endhead); in define_extent()
386 struct dasd_eckd_private *private = device->private; in locate_record_ext()
391 ccw->cmd_code = DASD_ECKD_CCW_LOCATE_RECORD_EXT; in locate_record_ext()
392 ccw->flags = 0; in locate_record_ext()
394 ccw->count = 22; in locate_record_ext()
396 ccw->count = 20; in locate_record_ext()
397 ccw->cda = virt_to_dma32(data); in locate_record_ext()
403 switch (private->rdc_data.dev_type) { in locate_record_ext()
407 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8; in locate_record_ext()
411 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7; in locate_record_ext()
415 data->sector = sector; in locate_record_ext()
420 data->count = count; in locate_record_ext()
423 data->operation.orientation = 0x3; in locate_record_ext()
424 data->operation.operation = 0x03; in locate_record_ext()
427 data->operation.orientation = 0x3; in locate_record_ext()
428 data->operation.operation = 0x16; in locate_record_ext()
431 data->operation.orientation = 0x1; in locate_record_ext()
432 data->operation.operation = 0x03; in locate_record_ext()
433 data->count++; in locate_record_ext()
436 data->operation.orientation = 0x3; in locate_record_ext()
437 data->operation.operation = 0x16; in locate_record_ext()
438 data->count++; in locate_record_ext()
444 data->auxiliary.length_valid = 0x1; in locate_record_ext()
445 data->length = reclen; in locate_record_ext()
446 data->operation.operation = 0x01; in locate_record_ext()
450 data->auxiliary.length_valid = 0x1; in locate_record_ext()
451 data->length = reclen; in locate_record_ext()
452 data->operation.operation = 0x03; in locate_record_ext()
455 data->operation.orientation = 0x0; in locate_record_ext()
456 data->operation.operation = 0x3F; in locate_record_ext()
457 data->extended_operation = 0x11; in locate_record_ext()
458 data->length = 0; in locate_record_ext()
459 data->extended_parameter_length = 0x02; in locate_record_ext()
460 if (data->count > 8) { in locate_record_ext()
461 data->extended_parameter[0] = 0xFF; in locate_record_ext()
462 data->extended_parameter[1] = 0xFF; in locate_record_ext()
463 data->extended_parameter[1] <<= (16 - count); in locate_record_ext()
465 data->extended_parameter[0] = 0xFF; in locate_record_ext()
466 data->extended_parameter[0] <<= (8 - count); in locate_record_ext()
467 data->extended_parameter[1] = 0x00; in locate_record_ext()
469 data->sector = 0xFF; in locate_record_ext()
472 data->auxiliary.length_valid = 0x1; in locate_record_ext()
473 data->length = reclen; /* not tlf, as one might think */ in locate_record_ext()
474 data->operation.operation = 0x3F; in locate_record_ext()
475 data->extended_operation = 0x23; in locate_record_ext()
481 data->auxiliary.length_valid = 0x1; in locate_record_ext()
482 data->length = reclen; in locate_record_ext()
483 data->operation.operation = 0x06; in locate_record_ext()
487 data->auxiliary.length_valid = 0x1; in locate_record_ext()
488 data->length = reclen; in locate_record_ext()
489 data->operation.operation = 0x16; in locate_record_ext()
492 data->operation.operation = 0x06; in locate_record_ext()
495 data->operation.orientation = 0x1; in locate_record_ext()
496 data->operation.operation = 0x0C; in locate_record_ext()
497 data->extended_parameter_length = 0; in locate_record_ext()
498 data->sector = 0xFF; in locate_record_ext()
501 data->auxiliary.length_valid = 0x1; in locate_record_ext()
502 data->length = tlf; in locate_record_ext()
503 data->operation.operation = 0x0C; in locate_record_ext()
506 data->length = reclen; in locate_record_ext()
507 data->auxiliary.length_valid = 0x1; in locate_record_ext()
508 data->operation.operation = 0x0b; in locate_record_ext()
515 set_ch_t(&data->seek_addr, in locate_record_ext()
516 trk / private->rdc_data.trk_per_cyl, in locate_record_ext()
517 trk % private->rdc_data.trk_per_cyl); in locate_record_ext()
518 data->search_arg.cyl = data->seek_addr.cyl; in locate_record_ext()
519 data->search_arg.head = data->seek_addr.head; in locate_record_ext()
520 data->search_arg.record = rec_on_trk; in locate_record_ext()
534 basepriv = basedev->private; in prefix_LRE()
535 startpriv = startdev->private; in prefix_LRE()
536 dedata = &pfxdata->define_extent; in prefix_LRE()
537 lredata = &pfxdata->locate_record; in prefix_LRE()
539 ccw->cmd_code = DASD_ECKD_CCW_PFX; in prefix_LRE()
540 ccw->flags = 0; in prefix_LRE()
542 ccw->count = sizeof(*pfxdata) + 2; in prefix_LRE()
543 ccw->cda = virt_to_dma32(pfxdata); in prefix_LRE()
546 ccw->count = sizeof(*pfxdata); in prefix_LRE()
547 ccw->cda = virt_to_dma32(pfxdata); in prefix_LRE()
556 return -EINVAL; in prefix_LRE()
558 pfxdata->format = format; in prefix_LRE()
559 pfxdata->base_address = basepriv->conf.ned->unit_addr; in prefix_LRE()
560 pfxdata->base_lss = basepriv->conf.ned->ID; in prefix_LRE()
561 pfxdata->validity.define_extent = 1; in prefix_LRE()
564 if (startpriv->uid.type == UA_BASE_PAV_ALIAS) in prefix_LRE()
565 pfxdata->validity.verify_base = 1; in prefix_LRE()
567 if (startpriv->uid.type == UA_HYPER_PAV_ALIAS) { in prefix_LRE()
568 pfxdata->validity.verify_base = 1; in prefix_LRE()
569 pfxdata->validity.hyper_pav = 1; in prefix_LRE()
579 if (dedata->ga_extended & 0x08 && dedata->ga_extended & 0x02) in prefix_LRE()
580 pfxdata->validity.time_stamp = 1; /* 'Time Stamp Valid' */ in prefix_LRE()
603 struct dasd_eckd_private *private = device->private; in locate_record()
611 ccw->cmd_code = DASD_ECKD_CCW_LOCATE_RECORD; in locate_record()
612 ccw->flags = 0; in locate_record()
613 ccw->count = 16; in locate_record()
614 ccw->cda = virt_to_dma32(data); in locate_record()
619 switch (private->rdc_data.dev_type) { in locate_record()
623 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8; in locate_record()
627 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7; in locate_record()
631 data->sector = sector; in locate_record()
632 data->count = no_rec; in locate_record()
635 data->operation.orientation = 0x3; in locate_record()
636 data->operation.operation = 0x03; in locate_record()
639 data->operation.orientation = 0x3; in locate_record()
640 data->operation.operation = 0x16; in locate_record()
643 data->operation.orientation = 0x1; in locate_record()
644 data->operation.operation = 0x03; in locate_record()
645 data->count++; in locate_record()
648 data->operation.orientation = 0x3; in locate_record()
649 data->operation.operation = 0x16; in locate_record()
650 data->count++; in locate_record()
656 data->auxiliary.last_bytes_used = 0x1; in locate_record()
657 data->length = reclen; in locate_record()
658 data->operation.operation = 0x01; in locate_record()
662 data->auxiliary.last_bytes_used = 0x1; in locate_record()
663 data->length = reclen; in locate_record()
664 data->operation.operation = 0x03; in locate_record()
670 data->auxiliary.last_bytes_used = 0x1; in locate_record()
671 data->length = reclen; in locate_record()
672 data->operation.operation = 0x06; in locate_record()
676 data->auxiliary.last_bytes_used = 0x1; in locate_record()
677 data->length = reclen; in locate_record()
678 data->operation.operation = 0x16; in locate_record()
681 data->operation.operation = 0x06; in locate_record()
684 data->length = reclen; in locate_record()
685 data->auxiliary.last_bytes_used = 0x1; in locate_record()
686 data->operation.operation = 0x0b; in locate_record()
692 set_ch_t(&data->seek_addr, in locate_record()
693 trk / private->rdc_data.trk_per_cyl, in locate_record()
694 trk % private->rdc_data.trk_per_cyl); in locate_record()
695 data->search_arg.cyl = data->seek_addr.cyl; in locate_record()
696 data->search_arg.head = data->seek_addr.head; in locate_record()
697 data->search_arg.record = rec_on_trk; in locate_record()
701 * Returns 1 if the block is one of the special blocks that needs
708 * ccw->cmd_code |= 0x8;
740 memcpy(uid->vendor, conf->ned->HDA_manufacturer, in create_uid()
741 sizeof(uid->vendor) - 1); in create_uid()
742 EBCASC(uid->vendor, sizeof(uid->vendor) - 1); in create_uid()
743 memcpy(uid->serial, &conf->ned->serial, in create_uid()
744 sizeof(uid->serial) - 1); in create_uid()
745 EBCASC(uid->serial, sizeof(uid->serial) - 1); in create_uid()
746 uid->ssid = conf->gneq->subsystemID; in create_uid()
747 uid->real_unit_addr = conf->ned->unit_addr; in create_uid()
748 if (conf->sneq) { in create_uid()
749 uid->type = conf->sneq->sua_flags; in create_uid()
750 if (uid->type == UA_BASE_PAV_ALIAS) in create_uid()
751 uid->base_unit_addr = conf->sneq->base_unit_addr; in create_uid()
753 uid->type = UA_BASE_DEVICE; in create_uid()
755 if (conf->vdsneq) { in create_uid()
757 sprintf(uid->vduit+2*count, "%02x", in create_uid()
758 conf->vdsneq->uit[count]); in create_uid()
768 struct dasd_eckd_private *private = device->private; in dasd_eckd_generate_uid()
772 return -ENODEV; in dasd_eckd_generate_uid()
773 if (!private->conf.ned || !private->conf.gneq) in dasd_eckd_generate_uid()
774 return -ENODEV; in dasd_eckd_generate_uid()
775 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_generate_uid()
776 create_uid(&private->conf, &private->uid); in dasd_eckd_generate_uid()
777 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_generate_uid()
783 struct dasd_eckd_private *private = device->private; in dasd_eckd_get_uid()
787 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_get_uid()
788 *uid = private->uid; in dasd_eckd_get_uid()
789 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_get_uid()
792 return -EINVAL; in dasd_eckd_get_uid()
826 ccw = cqr->cpaddr; in dasd_eckd_fill_rcd_cqr()
827 ccw->cmd_code = DASD_ECKD_CCW_RCD; in dasd_eckd_fill_rcd_cqr()
828 ccw->flags = 0; in dasd_eckd_fill_rcd_cqr()
829 ccw->cda = virt_to_dma32(rcd_buffer); in dasd_eckd_fill_rcd_cqr()
830 ccw->count = DASD_ECKD_RCD_DATA_SIZE; in dasd_eckd_fill_rcd_cqr()
831 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_fill_rcd_cqr()
833 cqr->startdev = device; in dasd_eckd_fill_rcd_cqr()
834 cqr->memdev = device; in dasd_eckd_fill_rcd_cqr()
835 cqr->block = NULL; in dasd_eckd_fill_rcd_cqr()
836 cqr->expires = 10*HZ; in dasd_eckd_fill_rcd_cqr()
837 cqr->lpm = lpm; in dasd_eckd_fill_rcd_cqr()
838 cqr->retries = 256; in dasd_eckd_fill_rcd_cqr()
839 cqr->buildclk = get_tod_clock(); in dasd_eckd_fill_rcd_cqr()
840 cqr->status = DASD_CQR_FILLED; in dasd_eckd_fill_rcd_cqr()
841 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); in dasd_eckd_fill_rcd_cqr()
847 * the buffer has to be re-initialized with the EBCDIC "V1.0"
855 if (cqr->status != DASD_CQR_DONE) { in read_conf_cb()
856 ccw = cqr->cpaddr; in read_conf_cb()
857 rcd_buffer = dma32_to_virt(ccw->cda); in read_conf_cb()
879 ciw = ccw_device_get_ciw(device->cdev, CIW_TYPE_RCD); in dasd_eckd_read_conf_immediately()
880 if (!ciw || ciw->cmd != DASD_ECKD_CCW_RCD) in dasd_eckd_read_conf_immediately()
881 return -EOPNOTSUPP; in dasd_eckd_read_conf_immediately()
884 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_read_conf_immediately()
885 set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags); in dasd_eckd_read_conf_immediately()
886 cqr->retries = 5; in dasd_eckd_read_conf_immediately()
887 cqr->callback = read_conf_cb; in dasd_eckd_read_conf_immediately()
905 ciw = ccw_device_get_ciw(device->cdev, CIW_TYPE_RCD); in dasd_eckd_read_conf_lpm()
906 if (!ciw || ciw->cmd != DASD_ECKD_CCW_RCD) { in dasd_eckd_read_conf_lpm()
907 ret = -EOPNOTSUPP; in dasd_eckd_read_conf_lpm()
912 ret = -ENOMEM; in dasd_eckd_read_conf_lpm()
921 ret = -ENOMEM; in dasd_eckd_read_conf_lpm()
925 cqr->callback = read_conf_cb; in dasd_eckd_read_conf_lpm()
930 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_read_conf_lpm()
950 conf->ned = NULL; in dasd_eckd_identify_conf_parts()
951 conf->sneq = NULL; in dasd_eckd_identify_conf_parts()
952 conf->vdsneq = NULL; in dasd_eckd_identify_conf_parts()
953 conf->gneq = NULL; in dasd_eckd_identify_conf_parts()
954 count = conf->len / sizeof(struct dasd_sneq); in dasd_eckd_identify_conf_parts()
955 sneq = (struct dasd_sneq *)conf->data; in dasd_eckd_identify_conf_parts()
957 if (sneq->flags.identifier == 1 && sneq->format == 1) in dasd_eckd_identify_conf_parts()
958 conf->sneq = sneq; in dasd_eckd_identify_conf_parts()
959 else if (sneq->flags.identifier == 1 && sneq->format == 4) in dasd_eckd_identify_conf_parts()
960 conf->vdsneq = (struct vd_sneq *)sneq; in dasd_eckd_identify_conf_parts()
961 else if (sneq->flags.identifier == 2) in dasd_eckd_identify_conf_parts()
962 conf->gneq = (struct dasd_gneq *)sneq; in dasd_eckd_identify_conf_parts()
963 else if (sneq->flags.identifier == 3 && sneq->res1 == 1) in dasd_eckd_identify_conf_parts()
964 conf->ned = (struct dasd_ned *)sneq; in dasd_eckd_identify_conf_parts()
967 if (!conf->ned || !conf->gneq) { in dasd_eckd_identify_conf_parts()
968 conf->ned = NULL; in dasd_eckd_identify_conf_parts()
969 conf->sneq = NULL; in dasd_eckd_identify_conf_parts()
970 conf->vdsneq = NULL; in dasd_eckd_identify_conf_parts()
971 conf->gneq = NULL; in dasd_eckd_identify_conf_parts()
972 return -EINVAL; in dasd_eckd_identify_conf_parts()
987 if (gneq->flags.identifier == 2) { in dasd_eckd_path_access()
1002 struct dasd_eckd_private *private = device->private; in dasd_eckd_store_conf_data()
1010 * also replace the old private->conf_data pointer in dasd_eckd_store_conf_data()
1013 cdp = device->path[chp].conf_data; in dasd_eckd_store_conf_data()
1014 if (private->conf.data == cdp) { in dasd_eckd_store_conf_data()
1015 private->conf.data = (void *)conf_data; in dasd_eckd_store_conf_data()
1016 dasd_eckd_identify_conf_parts(&private->conf); in dasd_eckd_store_conf_data()
1018 ccw_device_get_schid(device->cdev, &sch_id); in dasd_eckd_store_conf_data()
1019 device->path[chp].conf_data = conf_data; in dasd_eckd_store_conf_data()
1020 device->path[chp].cssid = sch_id.cssid; in dasd_eckd_store_conf_data()
1021 device->path[chp].ssid = sch_id.ssid; in dasd_eckd_store_conf_data()
1022 chp_desc = ccw_device_get_chp_desc(device->cdev, chp); in dasd_eckd_store_conf_data()
1024 device->path[chp].chpid = chp_desc->chpid; in dasd_eckd_store_conf_data()
1031 struct dasd_eckd_private *private = device->private; in dasd_eckd_clear_conf_data()
1034 private->conf.data = NULL; in dasd_eckd_clear_conf_data()
1035 private->conf.len = 0; in dasd_eckd_clear_conf_data()
1037 kfree(device->path[i].conf_data); in dasd_eckd_clear_conf_data()
1038 device->path[i].conf_data = NULL; in dasd_eckd_clear_conf_data()
1039 device->path[i].cssid = 0; in dasd_eckd_clear_conf_data()
1040 device->path[i].ssid = 0; in dasd_eckd_clear_conf_data()
1041 device->path[i].chpid = 0; in dasd_eckd_clear_conf_data()
1048 struct dasd_eckd_private *private = device->private; in dasd_eckd_read_fc_security()
1054 rc = chsc_scud(private->uid.ssid, (u64 *)esm, &esm_valid); in dasd_eckd_read_fc_security()
1057 device->path[chp].fc_security = 0; in dasd_eckd_read_fc_security()
1063 device->path[chp].fc_security = esm[chp]; in dasd_eckd_read_fc_security()
1065 device->path[chp].fc_security = 0; in dasd_eckd_read_fc_security()
1083 struct dasd_eckd_private *private = device->private; in dasd_eckd_check_cabling()
1093 dasd_eckd_get_uid_string(&private->conf, print_device_uid); in dasd_eckd_check_cabling()
1094 dev_err(&device->cdev->dev, in dasd_eckd_check_cabling()
1111 private = device->private; in dasd_eckd_read_conf()
1112 opm = ccw_device_get_path_mask(device->cdev); in dasd_eckd_read_conf()
1121 if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */ in dasd_eckd_read_conf()
1122 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_read_conf()
1128 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_read_conf()
1139 private->conf.data = conf_data; in dasd_eckd_read_conf()
1140 private->conf.len = conf_len; in dasd_eckd_read_conf()
1141 if (dasd_eckd_identify_conf_parts(&private->conf)) { in dasd_eckd_read_conf()
1142 private->conf.data = NULL; in dasd_eckd_read_conf()
1143 private->conf.len = 0; in dasd_eckd_read_conf()
1155 path_err = -EINVAL; in dasd_eckd_read_conf()
1184 struct dasd_eckd_private *private = device->private; in get_fcx_max_data()
1193 fcx_in_gneq = private->conf.gneq->reserved2[7] & 0x04; in get_fcx_max_data()
1194 fcx_in_features = private->features.feature[40] & 0x80; in get_fcx_max_data()
1200 mdc = ccw_device_get_mdc(device->cdev, 0); in get_fcx_max_data()
1202 …dev_warn(&device->cdev->dev, "Detecting the maximum supported data size for zHPF requests failed\n… in get_fcx_max_data()
1211 struct dasd_eckd_private *private = device->private; in verify_fcx_max_data()
1215 if (private->fcx_max_data) { in verify_fcx_max_data()
1216 mdc = ccw_device_get_mdc(device->cdev, lpm); in verify_fcx_max_data()
1218 dev_warn(&device->cdev->dev, in verify_fcx_max_data()
1225 if (fcx_max_data < private->fcx_max_data) { in verify_fcx_max_data()
1226 dev_warn(&device->cdev->dev, in verify_fcx_max_data()
1230 private->fcx_max_data); in verify_fcx_max_data()
1231 return -EACCES; in verify_fcx_max_data()
1240 struct dasd_eckd_private *private = device->private; in rebuild_device_uid()
1242 int rc = -ENODEV; in rebuild_device_uid()
1247 memset(&data->rcd_buffer, 0, sizeof(data->rcd_buffer)); in rebuild_device_uid()
1248 memset(&data->cqr, 0, sizeof(data->cqr)); in rebuild_device_uid()
1249 data->cqr.cpaddr = &data->ccw; in rebuild_device_uid()
1250 rc = dasd_eckd_read_conf_immediately(device, &data->cqr, in rebuild_device_uid()
1251 data->rcd_buffer, in rebuild_device_uid()
1255 if (rc == -EOPNOTSUPP) /* -EOPNOTSUPP is ok */ in rebuild_device_uid()
1257 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in rebuild_device_uid()
1262 memcpy(private->conf.data, data->rcd_buffer, in rebuild_device_uid()
1264 if (dasd_eckd_identify_conf_parts(&private->conf)) { in rebuild_device_uid()
1265 rc = -ENODEV; in rebuild_device_uid()
1295 if (!(lpm & data->tbvpm)) in dasd_eckd_path_available_action()
1297 memset(&data->rcd_buffer, 0, sizeof(data->rcd_buffer)); in dasd_eckd_path_available_action()
1298 memset(&data->cqr, 0, sizeof(data->cqr)); in dasd_eckd_path_available_action()
1299 data->cqr.cpaddr = &data->ccw; in dasd_eckd_path_available_action()
1300 rc = dasd_eckd_read_conf_immediately(device, &data->cqr, in dasd_eckd_path_available_action()
1301 data->rcd_buffer, in dasd_eckd_path_available_action()
1304 switch (dasd_eckd_path_access(data->rcd_buffer, in dasd_eckd_path_available_action()
1315 } else if (rc == -EOPNOTSUPP) { in dasd_eckd_path_available_action()
1316 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_path_available_action()
1320 } else if (rc == -EAGAIN) { in dasd_eckd_path_available_action()
1321 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_path_available_action()
1326 dev_warn(&device->cdev->dev, in dasd_eckd_path_available_action()
1344 memcpy(&path_rcd_buf, data->rcd_buffer, in dasd_eckd_path_available_action()
1377 dev_err(&device->cdev->dev, in dasd_eckd_path_available_action()
1392 memcpy(conf_data, data->rcd_buffer, in dasd_eckd_path_available_action()
1413 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_path_available_action()
1428 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_path_available_action()
1440 device = data->device; in do_pe_handler_work()
1443 if (test_bit(DASD_FLAG_SUSPENDED, &device->flags)) { in do_pe_handler_work()
1448 if (test_and_set_bit(DASD_FLAG_PATH_VERIFY, &device->flags)) { in do_pe_handler_work()
1453 if (data->tbvpm) in do_pe_handler_work()
1455 if (data->fcsecpm) in do_pe_handler_work()
1458 clear_bit(DASD_FLAG_PATH_VERIFY, &device->flags); in do_pe_handler_work()
1460 if (data->isglobal) in do_pe_handler_work()
1475 data->isglobal = 1; in dasd_eckd_pe_handler()
1477 return -ENOMEM; in dasd_eckd_pe_handler()
1480 INIT_WORK(&data->worker, do_pe_handler_work); in dasd_eckd_pe_handler()
1482 data->device = device; in dasd_eckd_pe_handler()
1483 data->tbvpm = tbvpm; in dasd_eckd_pe_handler()
1484 data->fcsecpm = fcsecpm; in dasd_eckd_pe_handler()
1485 schedule_work(&data->worker); in dasd_eckd_pe_handler()
1491 struct dasd_eckd_private *private = device->private; in dasd_eckd_reset_path()
1494 if (!private->fcx_max_data) in dasd_eckd_reset_path()
1495 private->fcx_max_data = get_fcx_max_data(device); in dasd_eckd_reset_path()
1496 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_reset_path()
1499 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_reset_path()
1504 struct dasd_eckd_private *private = device->private; in dasd_eckd_read_features()
1511 memset(&private->features, 0, sizeof(struct dasd_rssd_features)); in dasd_eckd_read_features()
1517 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", "Could not " in dasd_eckd_read_features()
1521 cqr->startdev = device; in dasd_eckd_read_features()
1522 cqr->memdev = device; in dasd_eckd_read_features()
1523 cqr->block = NULL; in dasd_eckd_read_features()
1524 cqr->retries = 256; in dasd_eckd_read_features()
1525 cqr->expires = 10 * HZ; in dasd_eckd_read_features()
1528 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_read_features()
1530 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_read_features()
1531 prssdp->suborder = 0x41; /* Read Feature Codes */ in dasd_eckd_read_features()
1534 ccw = cqr->cpaddr; in dasd_eckd_read_features()
1535 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_read_features()
1536 ccw->count = sizeof(struct dasd_psf_prssd_data); in dasd_eckd_read_features()
1537 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_read_features()
1538 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_read_features()
1540 /* Read Subsystem Data - feature codes */ in dasd_eckd_read_features()
1545 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_read_features()
1546 ccw->count = sizeof(struct dasd_rssd_features); in dasd_eckd_read_features()
1547 ccw->cda = virt_to_dma32(features); in dasd_eckd_read_features()
1549 cqr->buildclk = get_tod_clock(); in dasd_eckd_read_features()
1550 cqr->status = DASD_CQR_FILLED; in dasd_eckd_read_features()
1553 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_read_features()
1555 memcpy(&private->features, features, in dasd_eckd_read_features()
1558 dev_warn(&device->cdev->dev, "Reading device feature codes" in dasd_eckd_read_features()
1560 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_read_features()
1564 /* Read Volume Information - Volume Storage Query */
1567 struct dasd_eckd_private *private = device->private; in dasd_eckd_read_vol_info()
1576 if (private->uid.type == UA_BASE_PAV_ALIAS || in dasd_eckd_read_vol_info()
1577 private->uid.type == UA_HYPER_PAV_ALIAS) in dasd_eckd_read_vol_info()
1584 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_read_vol_info()
1588 cqr = &dasd_vol_info_req->cqr; in dasd_eckd_read_vol_info()
1591 cqr->cpaddr = &dasd_vol_info_req->ccw; in dasd_eckd_read_vol_info()
1592 cqr->data = &dasd_vol_info_req->data; in dasd_eckd_read_vol_info()
1593 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_read_vol_info()
1597 prssdp = cqr->data; in dasd_eckd_read_vol_info()
1598 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_read_vol_info()
1599 prssdp->suborder = PSF_SUBORDER_VSQ; /* Volume Storage Query */ in dasd_eckd_read_vol_info()
1600 prssdp->lss = private->conf.ned->ID; in dasd_eckd_read_vol_info()
1601 prssdp->volume = private->conf.ned->unit_addr; in dasd_eckd_read_vol_info()
1603 ccw = cqr->cpaddr; in dasd_eckd_read_vol_info()
1604 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_read_vol_info()
1605 ccw->count = sizeof(*prssdp); in dasd_eckd_read_vol_info()
1606 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_read_vol_info()
1607 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_read_vol_info()
1609 /* Read Subsystem Data - Volume Storage Query */ in dasd_eckd_read_vol_info()
1614 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_read_vol_info()
1615 ccw->count = sizeof(*vsq); in dasd_eckd_read_vol_info()
1616 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_read_vol_info()
1617 ccw->cda = virt_to_dma32(vsq); in dasd_eckd_read_vol_info()
1619 cqr->buildclk = get_tod_clock(); in dasd_eckd_read_vol_info()
1620 cqr->status = DASD_CQR_FILLED; in dasd_eckd_read_vol_info()
1621 cqr->startdev = device; in dasd_eckd_read_vol_info()
1622 cqr->memdev = device; in dasd_eckd_read_vol_info()
1623 cqr->block = NULL; in dasd_eckd_read_vol_info()
1624 cqr->retries = 256; in dasd_eckd_read_vol_info()
1625 cqr->expires = device->default_expires * HZ; in dasd_eckd_read_vol_info()
1627 __set_bit(DASD_CQR_SUPPRESS_CR, &cqr->flags); in dasd_eckd_read_vol_info()
1631 memcpy(&private->vsq, vsq, sizeof(*vsq)); in dasd_eckd_read_vol_info()
1633 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_read_vol_info()
1640 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_read_vol_info()
1647 struct dasd_eckd_private *private = device->private; in dasd_eckd_is_ese()
1649 return private->vsq.vol_info.ese; in dasd_eckd_is_ese()
1654 struct dasd_eckd_private *private = device->private; in dasd_eckd_ext_pool_id()
1656 return private->vsq.extent_pool_id; in dasd_eckd_ext_pool_id()
1666 struct dasd_eckd_private *private = device->private; in dasd_eckd_space_configured()
1671 return rc ? : private->vsq.space_configured; in dasd_eckd_space_configured()
1680 struct dasd_eckd_private *private = device->private; in dasd_eckd_space_allocated()
1685 return rc ? : private->vsq.space_allocated; in dasd_eckd_space_allocated()
1690 struct dasd_eckd_private *private = device->private; in dasd_eckd_logical_capacity()
1692 return private->vsq.logical_capacity; in dasd_eckd_logical_capacity()
1702 device = data->device; in dasd_eckd_ext_pool_exhaust_work()
1703 base = data->base; in dasd_eckd_ext_pool_exhaust_work()
1710 dev_warn(&device->cdev->dev, "No space left in the extent pool\n"); in dasd_eckd_ext_pool_exhaust_work()
1725 return -ENOMEM; in dasd_eckd_ext_pool_exhaust()
1726 INIT_WORK(&data->worker, dasd_eckd_ext_pool_exhaust_work); in dasd_eckd_ext_pool_exhaust()
1728 data->device = device; in dasd_eckd_ext_pool_exhaust()
1730 if (cqr->block) in dasd_eckd_ext_pool_exhaust()
1731 data->base = cqr->block->base; in dasd_eckd_ext_pool_exhaust()
1732 else if (cqr->basedev) in dasd_eckd_ext_pool_exhaust()
1733 data->base = cqr->basedev; in dasd_eckd_ext_pool_exhaust()
1735 data->base = NULL; in dasd_eckd_ext_pool_exhaust()
1737 schedule_work(&data->worker); in dasd_eckd_ext_pool_exhaust()
1745 struct dasd_eckd_private *private = device->private; in dasd_eckd_cpy_ext_pool_data()
1750 for (i = 0; i < lcq->pool_count; i++) { in dasd_eckd_cpy_ext_pool_data()
1751 eps = lcq->ext_pool_sum[i]; in dasd_eckd_cpy_ext_pool_data()
1753 memcpy(&private->eps, &eps, in dasd_eckd_cpy_ext_pool_data()
1759 /* Read Extent Pool Information - Logical Configuration Query */
1762 struct dasd_eckd_private *private = device->private; in dasd_eckd_read_ext_pool_info()
1770 if (private->uid.type == UA_BASE_PAV_ALIAS || in dasd_eckd_read_ext_pool_info()
1771 private->uid.type == UA_HYPER_PAV_ALIAS) in dasd_eckd_read_ext_pool_info()
1777 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_read_ext_pool_info()
1783 prssdp = cqr->data; in dasd_eckd_read_ext_pool_info()
1785 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_read_ext_pool_info()
1786 prssdp->suborder = PSF_SUBORDER_LCQ; /* Logical Configuration Query */ in dasd_eckd_read_ext_pool_info()
1788 ccw = cqr->cpaddr; in dasd_eckd_read_ext_pool_info()
1789 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_read_ext_pool_info()
1790 ccw->count = sizeof(*prssdp); in dasd_eckd_read_ext_pool_info()
1791 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_read_ext_pool_info()
1792 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_read_ext_pool_info()
1798 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_read_ext_pool_info()
1799 ccw->count = sizeof(*lcq); in dasd_eckd_read_ext_pool_info()
1800 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_read_ext_pool_info()
1801 ccw->cda = virt_to_dma32(lcq); in dasd_eckd_read_ext_pool_info()
1803 cqr->buildclk = get_tod_clock(); in dasd_eckd_read_ext_pool_info()
1804 cqr->status = DASD_CQR_FILLED; in dasd_eckd_read_ext_pool_info()
1805 cqr->startdev = device; in dasd_eckd_read_ext_pool_info()
1806 cqr->memdev = device; in dasd_eckd_read_ext_pool_info()
1807 cqr->block = NULL; in dasd_eckd_read_ext_pool_info()
1808 cqr->retries = 256; in dasd_eckd_read_ext_pool_info()
1809 cqr->expires = device->default_expires * HZ; in dasd_eckd_read_ext_pool_info()
1811 __set_bit(DASD_CQR_SUPPRESS_CR, &cqr->flags); in dasd_eckd_read_ext_pool_info()
1817 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_read_ext_pool_info()
1821 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_read_ext_pool_info()
1833 struct dasd_eckd_private *private = device->private; in dasd_eckd_ext_size()
1834 struct dasd_ext_pool_sum eps = private->eps; in dasd_eckd_ext_size()
1848 struct dasd_eckd_private *private = device->private; in dasd_eckd_ext_pool_warn_thrshld()
1850 return private->eps.warn_thrshld; in dasd_eckd_ext_pool_warn_thrshld()
1855 struct dasd_eckd_private *private = device->private; in dasd_eckd_ext_pool_cap_at_warnlevel()
1857 return private->eps.flags.capacity_at_warnlevel; in dasd_eckd_ext_pool_cap_at_warnlevel()
1865 struct dasd_eckd_private *private = device->private; in dasd_eckd_ext_pool_oos()
1867 return private->eps.flags.pool_oos; in dasd_eckd_ext_pool_oos()
1871 * Build CP for Perform Subsystem Function - SSC.
1886 "Could not allocate PSF-SSC request"); in dasd_eckd_build_psf_ssc()
1889 psf_ssc_data = (struct dasd_psf_ssc_data *)cqr->data; in dasd_eckd_build_psf_ssc()
1890 psf_ssc_data->order = PSF_ORDER_SSC; in dasd_eckd_build_psf_ssc()
1891 psf_ssc_data->suborder = 0xc0; in dasd_eckd_build_psf_ssc()
1893 psf_ssc_data->suborder |= 0x08; in dasd_eckd_build_psf_ssc()
1894 psf_ssc_data->reserved[0] = 0x88; in dasd_eckd_build_psf_ssc()
1896 ccw = cqr->cpaddr; in dasd_eckd_build_psf_ssc()
1897 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_build_psf_ssc()
1898 ccw->cda = virt_to_dma32(psf_ssc_data); in dasd_eckd_build_psf_ssc()
1899 ccw->count = 66; in dasd_eckd_build_psf_ssc()
1901 cqr->startdev = device; in dasd_eckd_build_psf_ssc()
1902 cqr->memdev = device; in dasd_eckd_build_psf_ssc()
1903 cqr->block = NULL; in dasd_eckd_build_psf_ssc()
1904 cqr->retries = 256; in dasd_eckd_build_psf_ssc()
1905 cqr->expires = 10*HZ; in dasd_eckd_build_psf_ssc()
1906 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_psf_ssc()
1907 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_psf_ssc()
1931 cqr->flags |= flags; in dasd_eckd_psf_ssc()
1937 else if (cqr->intrc == -EAGAIN) in dasd_eckd_psf_ssc()
1938 rc = -EAGAIN; in dasd_eckd_psf_ssc()
1940 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_psf_ssc()
1950 struct dasd_eckd_private *private = device->private; in dasd_eckd_validate_server()
1953 if (private->uid.type == UA_BASE_PAV_ALIAS || in dasd_eckd_validate_server()
1954 private->uid.type == UA_HYPER_PAV_ALIAS) in dasd_eckd_validate_server()
1964 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "PSF-SSC for SSID %04x " in dasd_eckd_validate_server()
1965 "returned rc=%d", private->uid.ssid, rc); in dasd_eckd_validate_server()
1980 == -EAGAIN) { in dasd_eckd_do_validate_server()
1982 schedule_work(&device->kick_validate); in dasd_eckd_do_validate_server()
1993 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_eckd_kick_validate_server()
1994 device->state < DASD_STATE_ONLINE) { in dasd_eckd_kick_validate_server()
1999 if (!schedule_work(&device->kick_validate)) in dasd_eckd_kick_validate_server()
2008 if (!device->copy) in dasd_device_is_primary()
2011 if (device->copy->active->device == device) in dasd_device_is_primary()
2019 struct dasd_block *block; in dasd_eckd_alloc_block() local
2027 block = dasd_alloc_block(); in dasd_eckd_alloc_block()
2028 if (IS_ERR(block)) { in dasd_eckd_alloc_block()
2029 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_alloc_block()
2030 "could not allocate dasd block structure"); in dasd_eckd_alloc_block()
2031 return PTR_ERR(block); in dasd_eckd_alloc_block()
2033 device->block = block; in dasd_eckd_alloc_block()
2034 block->base = device; in dasd_eckd_alloc_block()
2041 struct dasd_eckd_private *private = device->private; in dasd_eckd_pprc_enabled()
2043 return private->rdc_data.facilities.PPRC_enabled; in dasd_eckd_pprc_enabled()
2053 struct dasd_eckd_private *private = device->private; in dasd_eckd_check_characteristics()
2059 INIT_WORK(&device->kick_validate, dasd_eckd_do_validate_server); in dasd_eckd_check_characteristics()
2061 INIT_WORK(&device->suc_work, dasd_alias_handle_summary_unit_check); in dasd_eckd_check_characteristics()
2063 if (!ccw_device_is_pathgroup(device->cdev)) { in dasd_eckd_check_characteristics()
2064 dev_warn(&device->cdev->dev, in dasd_eckd_check_characteristics()
2066 return -EIO; in dasd_eckd_check_characteristics()
2068 if (!ccw_device_is_multipath(device->cdev)) { in dasd_eckd_check_characteristics()
2069 dev_info(&device->cdev->dev, in dasd_eckd_check_characteristics()
2075 dev_warn(&device->cdev->dev, in dasd_eckd_check_characteristics()
2078 return -ENOMEM; in dasd_eckd_check_characteristics()
2080 device->private = private; in dasd_eckd_check_characteristics()
2085 private->init_cqr_status = -1; in dasd_eckd_check_characteristics()
2087 private->attrib.operation = DASD_NORMAL_CACHE; in dasd_eckd_check_characteristics()
2088 private->attrib.nr_cyl = 0; in dasd_eckd_check_characteristics()
2096 device->default_expires = DASD_EXPIRES; in dasd_eckd_check_characteristics()
2097 device->default_retries = DASD_RETRIES; in dasd_eckd_check_characteristics()
2098 device->path_thrhld = DASD_ECKD_PATH_THRHLD; in dasd_eckd_check_characteristics()
2099 device->path_interval = DASD_ECKD_PATH_INTERVAL; in dasd_eckd_check_characteristics()
2100 device->aq_timeouts = DASD_RETRIES_MAX; in dasd_eckd_check_characteristics()
2102 if (private->conf.gneq) { in dasd_eckd_check_characteristics()
2104 for (i = 0; i < private->conf.gneq->timeout.value; i++) in dasd_eckd_check_characteristics()
2106 value = value * private->conf.gneq->timeout.number; in dasd_eckd_check_characteristics()
2109 device->default_expires = value; in dasd_eckd_check_characteristics()
2114 &private->rdc_data, 64); in dasd_eckd_check_characteristics()
2116 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_check_characteristics()
2122 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_eckd_check_characteristics()
2125 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_check_characteristics()
2130 /* check if block device is needed and allocate in case */ in dasd_eckd_check_characteristics()
2159 if ((device->features & DASD_FEATURE_USERAW) && in dasd_eckd_check_characteristics()
2160 !(private->rdc_data.facilities.RT_in_LR)) { in dasd_eckd_check_characteristics()
2161 dev_err(&device->cdev->dev, "The storage server does not " in dasd_eckd_check_characteristics()
2162 "support raw-track access\n"); in dasd_eckd_check_characteristics()
2163 rc = -EINVAL; in dasd_eckd_check_characteristics()
2168 if (private->rdc_data.no_cyl == LV_COMPAT_CYL && in dasd_eckd_check_characteristics()
2169 private->rdc_data.long_no_cyl) in dasd_eckd_check_characteristics()
2170 private->real_cyl = private->rdc_data.long_no_cyl; in dasd_eckd_check_characteristics()
2172 private->real_cyl = private->rdc_data.no_cyl; in dasd_eckd_check_characteristics()
2174 private->fcx_max_data = get_fcx_max_data(device); in dasd_eckd_check_characteristics()
2178 set_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_eckd_check_characteristics()
2180 dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " in dasd_eckd_check_characteristics()
2182 private->rdc_data.dev_type, in dasd_eckd_check_characteristics()
2183 private->rdc_data.dev_model, in dasd_eckd_check_characteristics()
2184 private->rdc_data.cu_type, in dasd_eckd_check_characteristics()
2185 private->rdc_data.cu_model.model, in dasd_eckd_check_characteristics()
2186 private->real_cyl, in dasd_eckd_check_characteristics()
2187 private->rdc_data.trk_per_cyl, in dasd_eckd_check_characteristics()
2188 private->rdc_data.sec_per_trk, in dasd_eckd_check_characteristics()
2189 readonly ? ", read-only device" : ""); in dasd_eckd_check_characteristics()
2195 dasd_free_block(device->block); in dasd_eckd_check_characteristics()
2196 device->block = NULL; in dasd_eckd_check_characteristics()
2200 kfree(device->private); in dasd_eckd_check_characteristics()
2201 device->private = NULL; in dasd_eckd_check_characteristics()
2207 struct dasd_eckd_private *private = device->private; in dasd_eckd_uncheck_device()
2213 private->conf.ned = NULL; in dasd_eckd_uncheck_device()
2214 private->conf.sneq = NULL; in dasd_eckd_uncheck_device()
2215 private->conf.vdsneq = NULL; in dasd_eckd_uncheck_device()
2216 private->conf.gneq = NULL; in dasd_eckd_uncheck_device()
2224 struct dasd_eckd_private *private = device->private; in dasd_eckd_analysis_ccw()
2238 ccw = cqr->cpaddr; in dasd_eckd_analysis_ccw()
2240 define_extent(ccw++, cqr->data, 0, 1, in dasd_eckd_analysis_ccw()
2242 LO_data = cqr->data + sizeof(struct DE_eckd_data); in dasd_eckd_analysis_ccw()
2244 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_analysis_ccw()
2248 count_data = private->count_area; in dasd_eckd_analysis_ccw()
2250 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_analysis_ccw()
2251 ccw->cmd_code = DASD_ECKD_CCW_READ_COUNT; in dasd_eckd_analysis_ccw()
2252 ccw->flags = 0; in dasd_eckd_analysis_ccw()
2253 ccw->count = 8; in dasd_eckd_analysis_ccw()
2254 ccw->cda = virt_to_dma32(count_data); in dasd_eckd_analysis_ccw()
2260 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_analysis_ccw()
2264 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_analysis_ccw()
2265 ccw->cmd_code = DASD_ECKD_CCW_READ_COUNT; in dasd_eckd_analysis_ccw()
2266 ccw->flags = 0; in dasd_eckd_analysis_ccw()
2267 ccw->count = 8; in dasd_eckd_analysis_ccw()
2268 ccw->cda = virt_to_dma32(count_data); in dasd_eckd_analysis_ccw()
2270 cqr->block = NULL; in dasd_eckd_analysis_ccw()
2271 cqr->startdev = device; in dasd_eckd_analysis_ccw()
2272 cqr->memdev = device; in dasd_eckd_analysis_ccw()
2273 cqr->retries = 255; in dasd_eckd_analysis_ccw()
2274 cqr->buildclk = get_tod_clock(); in dasd_eckd_analysis_ccw()
2275 cqr->status = DASD_CQR_FILLED; in dasd_eckd_analysis_ccw()
2277 set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags); in dasd_eckd_analysis_ccw()
2278 set_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags); in dasd_eckd_analysis_ccw()
2287 if (init_cqr->status == DASD_CQR_DONE) in dasd_eckd_analysis_evaluation()
2289 else if (init_cqr->status == DASD_CQR_NEED_ERP || in dasd_eckd_analysis_evaluation()
2290 init_cqr->status == DASD_CQR_FAILED) { in dasd_eckd_analysis_evaluation()
2291 sense = dasd_get_sense(&init_cqr->irb); in dasd_eckd_analysis_evaluation()
2310 struct dasd_device *device = init_cqr->startdev; in dasd_eckd_analysis_callback()
2311 struct dasd_eckd_private *private = device->private; in dasd_eckd_analysis_callback()
2313 private->init_cqr_status = dasd_eckd_analysis_evaluation(init_cqr); in dasd_eckd_analysis_callback()
2318 static int dasd_eckd_start_analysis(struct dasd_block *block) in dasd_eckd_start_analysis() argument
2322 init_cqr = dasd_eckd_analysis_ccw(block->base); in dasd_eckd_start_analysis()
2325 init_cqr->callback = dasd_eckd_analysis_callback; in dasd_eckd_start_analysis()
2326 init_cqr->callback_data = NULL; in dasd_eckd_start_analysis()
2327 init_cqr->expires = 5*HZ; in dasd_eckd_start_analysis()
2331 clear_bit(DASD_CQR_FLAGS_USE_ERP, &init_cqr->flags); in dasd_eckd_start_analysis()
2332 init_cqr->retries = 0; in dasd_eckd_start_analysis()
2334 return -EAGAIN; in dasd_eckd_start_analysis()
2337 static int dasd_eckd_end_analysis(struct dasd_block *block) in dasd_eckd_end_analysis() argument
2339 struct dasd_device *device = block->base; in dasd_eckd_end_analysis()
2340 struct dasd_eckd_private *private = device->private; in dasd_eckd_end_analysis()
2346 status = private->init_cqr_status; in dasd_eckd_end_analysis()
2347 private->init_cqr_status = -1; in dasd_eckd_end_analysis()
2356 if (device->features & DASD_FEATURE_USERAW) { in dasd_eckd_end_analysis()
2357 block->bp_block = DASD_RAW_BLOCKSIZE; in dasd_eckd_end_analysis()
2359 block->s2b_shift = 3; in dasd_eckd_end_analysis()
2364 dev_warn(&device->cdev->dev, "The DASD is not formatted\n"); in dasd_eckd_end_analysis()
2365 return -EMEDIUMTYPE; in dasd_eckd_end_analysis()
2367 dev_err(&device->cdev->dev, in dasd_eckd_end_analysis()
2370 return -EIO; in dasd_eckd_end_analysis()
2373 private->uses_cdl = 1; in dasd_eckd_end_analysis()
2377 if (private->count_area[i].kl != 4 || in dasd_eckd_end_analysis()
2378 private->count_area[i].dl != dasd_eckd_cdl_reclen(i) - 4 || in dasd_eckd_end_analysis()
2379 private->count_area[i].cyl != 0 || in dasd_eckd_end_analysis()
2380 private->count_area[i].head != count_area_head[i] || in dasd_eckd_end_analysis()
2381 private->count_area[i].record != count_area_rec[i]) { in dasd_eckd_end_analysis()
2382 private->uses_cdl = 0; in dasd_eckd_end_analysis()
2387 count_area = &private->count_area[3]; in dasd_eckd_end_analysis()
2389 if (private->uses_cdl == 0) { in dasd_eckd_end_analysis()
2391 if ((private->count_area[i].kl != 0) || in dasd_eckd_end_analysis()
2392 (private->count_area[i].dl != in dasd_eckd_end_analysis()
2393 private->count_area[0].dl) || in dasd_eckd_end_analysis()
2394 private->count_area[i].cyl != 0 || in dasd_eckd_end_analysis()
2395 private->count_area[i].head != count_area_head[i] || in dasd_eckd_end_analysis()
2396 private->count_area[i].record != count_area_rec[i]) in dasd_eckd_end_analysis()
2400 count_area = &private->count_area[0]; in dasd_eckd_end_analysis()
2402 if (private->count_area[3].record == 1) in dasd_eckd_end_analysis()
2403 dev_warn(&device->cdev->dev, in dasd_eckd_end_analysis()
2407 if (count_area != NULL && count_area->kl == 0) { in dasd_eckd_end_analysis()
2409 if (dasd_check_blocksize(count_area->dl) == 0) in dasd_eckd_end_analysis()
2410 block->bp_block = count_area->dl; in dasd_eckd_end_analysis()
2412 if (block->bp_block == 0) { in dasd_eckd_end_analysis()
2413 dev_warn(&device->cdev->dev, in dasd_eckd_end_analysis()
2415 return -EMEDIUMTYPE; in dasd_eckd_end_analysis()
2417 block->s2b_shift = 0; /* bits to shift 512 to get a block */ in dasd_eckd_end_analysis()
2418 for (sb = 512; sb < block->bp_block; sb = sb << 1) in dasd_eckd_end_analysis()
2419 block->s2b_shift++; in dasd_eckd_end_analysis()
2421 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); in dasd_eckd_end_analysis()
2424 block->blocks = ((unsigned long) private->real_cyl * in dasd_eckd_end_analysis()
2425 private->rdc_data.trk_per_cyl * in dasd_eckd_end_analysis()
2428 dev_info(&device->cdev->dev, in dasd_eckd_end_analysis()
2429 "DASD with %u KB/block, %lu KB total size, %u KB/track, " in dasd_eckd_end_analysis()
2430 "%s\n", (block->bp_block >> 10), in dasd_eckd_end_analysis()
2431 (((unsigned long) private->real_cyl * in dasd_eckd_end_analysis()
2432 private->rdc_data.trk_per_cyl * in dasd_eckd_end_analysis()
2433 blk_per_trk * (block->bp_block >> 9)) >> 1), in dasd_eckd_end_analysis()
2434 ((blk_per_trk * block->bp_block) >> 10), in dasd_eckd_end_analysis()
2435 private->uses_cdl ? in dasd_eckd_end_analysis()
2441 static int dasd_eckd_do_analysis(struct dasd_block *block) in dasd_eckd_do_analysis() argument
2443 struct dasd_eckd_private *private = block->base->private; in dasd_eckd_do_analysis()
2445 if (private->init_cqr_status < 0) in dasd_eckd_do_analysis()
2446 return dasd_eckd_start_analysis(block); in dasd_eckd_do_analysis()
2448 return dasd_eckd_end_analysis(block); in dasd_eckd_do_analysis()
2458 if (cancel_work_sync(&device->reload_device)) in dasd_eckd_online_to_ready()
2460 if (cancel_work_sync(&device->kick_validate)) in dasd_eckd_online_to_ready()
2472 dasd_eckd_fill_geometry(struct dasd_block *block, struct hd_geometry *geo) in dasd_eckd_fill_geometry() argument
2474 struct dasd_eckd_private *private = block->base->private; in dasd_eckd_fill_geometry()
2476 if (dasd_check_blocksize(block->bp_block) == 0) { in dasd_eckd_fill_geometry()
2477 geo->sectors = recs_per_track(&private->rdc_data, in dasd_eckd_fill_geometry()
2478 0, block->bp_block); in dasd_eckd_fill_geometry()
2480 geo->cylinders = private->rdc_data.no_cyl; in dasd_eckd_fill_geometry()
2481 geo->heads = private->rdc_data.trk_per_cyl; in dasd_eckd_fill_geometry()
2509 start_priv = startdev->private; in dasd_eckd_build_check_tcw()
2511 count = rpt * (fdata->stop_unit - fdata->start_unit + 1); in dasd_eckd_build_check_tcw()
2523 start_priv->count++; in dasd_eckd_build_check_tcw()
2525 itcw = itcw_init(cqr->data, itcw_size, ITCW_OP_READ, 0, count, 0); in dasd_eckd_build_check_tcw()
2527 rc = -EINVAL; in dasd_eckd_build_check_tcw()
2531 cqr->cpaddr = itcw_get_tcw(itcw); in dasd_eckd_build_check_tcw()
2532 rc = prepare_itcw(itcw, fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_check_tcw()
2543 rc = -EINVAL; in dasd_eckd_build_check_tcw()
2548 last_tidaw->flags |= TIDAW_FLAGS_LAST; in dasd_eckd_build_check_tcw()
2551 cqr->cpmode = 1; in dasd_eckd_build_check_tcw()
2552 cqr->startdev = startdev; in dasd_eckd_build_check_tcw()
2553 cqr->memdev = startdev; in dasd_eckd_build_check_tcw()
2554 cqr->basedev = base; in dasd_eckd_build_check_tcw()
2555 cqr->retries = startdev->default_retries; in dasd_eckd_build_check_tcw()
2556 cqr->expires = startdev->default_expires * HZ; in dasd_eckd_build_check_tcw()
2557 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_check_tcw()
2558 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_check_tcw()
2560 set_bit(DASD_CQR_SUPPRESS_IL, &cqr->flags); in dasd_eckd_build_check_tcw()
2594 start_priv = startdev->private; in dasd_eckd_build_check()
2595 base_priv = base->private; in dasd_eckd_build_check()
2597 count = rpt * (fdata->stop_unit - fdata->start_unit + 1); in dasd_eckd_build_check()
2599 use_prefix = base_priv->features.feature[8] & 0x01; in dasd_eckd_build_check()
2615 start_priv->count++; in dasd_eckd_build_check()
2616 data = cqr->data; in dasd_eckd_build_check()
2617 ccw = cqr->cpaddr; in dasd_eckd_build_check()
2620 prefix_LRE(ccw++, data, fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_check()
2624 define_extent(ccw++, data, fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_check()
2628 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_check()
2630 locate_record(ccw++, data, fdata->start_unit, 0, count, in dasd_eckd_build_check()
2635 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_check()
2636 ccw->cmd_code = DASD_ECKD_CCW_READ_COUNT; in dasd_eckd_build_check()
2637 ccw->flags = CCW_FLAG_SLI; in dasd_eckd_build_check()
2638 ccw->count = 8; in dasd_eckd_build_check()
2639 ccw->cda = virt_to_dma32(fmt_buffer); in dasd_eckd_build_check()
2644 cqr->startdev = startdev; in dasd_eckd_build_check()
2645 cqr->memdev = startdev; in dasd_eckd_build_check()
2646 cqr->basedev = base; in dasd_eckd_build_check()
2647 cqr->retries = DASD_RETRIES; in dasd_eckd_build_check()
2648 cqr->expires = startdev->default_expires * HZ; in dasd_eckd_build_check()
2649 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_check()
2650 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_check()
2652 set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags); in dasd_eckd_build_check()
2682 start_priv = startdev->private; in dasd_eckd_build_format()
2683 base_priv = base->private; in dasd_eckd_build_format()
2685 rpt = recs_per_track(&base_priv->rdc_data, 0, fdata->blksize); in dasd_eckd_build_format()
2687 nr_tracks = fdata->stop_unit - fdata->start_unit + 1; in dasd_eckd_build_format()
2690 * fdata->intensity is a bit string that tells us what to do: in dasd_eckd_build_format()
2698 if (fdata->intensity & 0x10) { in dasd_eckd_build_format()
2700 intensity = fdata->intensity & ~0x10; in dasd_eckd_build_format()
2703 intensity = fdata->intensity; in dasd_eckd_build_format()
2706 use_prefix = base_priv->features.feature[8] & 0x01; in dasd_eckd_build_format()
2748 dev_warn(&startdev->cdev->dev, in dasd_eckd_build_format()
2750 fdata->intensity); in dasd_eckd_build_format()
2751 return ERR_PTR(-EINVAL); in dasd_eckd_build_format()
2758 start_priv->count++; in dasd_eckd_build_format()
2759 data = fcp->data; in dasd_eckd_build_format()
2760 ccw = fcp->cpaddr; in dasd_eckd_build_format()
2766 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2771 ->define_extent.ga_extended |= 0x04; in dasd_eckd_build_format()
2775 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2780 ->ga_extended |= 0x04; in dasd_eckd_build_format()
2783 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2785 fdata->start_unit, 0, rpt*nr_tracks, in dasd_eckd_build_format()
2787 fdata->blksize); in dasd_eckd_build_format()
2793 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2799 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2803 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2805 fdata->start_unit, 0, rpt * nr_tracks + 1, in dasd_eckd_build_format()
2807 base->block->bp_block); in dasd_eckd_build_format()
2813 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2818 fdata->start_unit, fdata->stop_unit, in dasd_eckd_build_format()
2822 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2824 fdata->start_unit, 0, 1, in dasd_eckd_build_format()
2833 (fdata->start_unit + j) / in dasd_eckd_build_format()
2834 base_priv->rdc_data.trk_per_cyl, in dasd_eckd_build_format()
2835 (fdata->start_unit + j) % in dasd_eckd_build_format()
2836 base_priv->rdc_data.trk_per_cyl); in dasd_eckd_build_format()
2840 ect->cyl = address.cyl; in dasd_eckd_build_format()
2841 ect->head = address.head; in dasd_eckd_build_format()
2842 ect->record = 0; in dasd_eckd_build_format()
2843 ect->kl = 0; in dasd_eckd_build_format()
2844 ect->dl = 8; in dasd_eckd_build_format()
2845 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2846 ccw->cmd_code = DASD_ECKD_CCW_WRITE_RECORD_ZERO; in dasd_eckd_build_format()
2847 ccw->flags = CCW_FLAG_SLI; in dasd_eckd_build_format()
2848 ccw->count = 8; in dasd_eckd_build_format()
2849 ccw->cda = virt_to_dma32(ect); in dasd_eckd_build_format()
2855 ect->cyl = address.cyl; in dasd_eckd_build_format()
2856 ect->head = address.head; in dasd_eckd_build_format()
2857 ect->record = 1; in dasd_eckd_build_format()
2858 ect->kl = 0; in dasd_eckd_build_format()
2859 ect->dl = 0; in dasd_eckd_build_format()
2860 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2861 ccw->cmd_code = DASD_ECKD_CCW_WRITE_CKD; in dasd_eckd_build_format()
2862 ccw->flags = CCW_FLAG_SLI; in dasd_eckd_build_format()
2863 ccw->count = 8; in dasd_eckd_build_format()
2864 ccw->cda = virt_to_dma32(ect); in dasd_eckd_build_format()
2869 ect->cyl = address.cyl; in dasd_eckd_build_format()
2870 ect->head = address.head; in dasd_eckd_build_format()
2871 ect->record = i + 1; in dasd_eckd_build_format()
2872 ect->kl = 0; in dasd_eckd_build_format()
2873 ect->dl = fdata->blksize; in dasd_eckd_build_format()
2875 * Check for special tracks 0-1 in dasd_eckd_build_format()
2881 ect->kl = 4; in dasd_eckd_build_format()
2882 ect->dl = sizes_trk0[i] - 4; in dasd_eckd_build_format()
2887 ect->kl = 44; in dasd_eckd_build_format()
2888 ect->dl = LABEL_SIZE - 44; in dasd_eckd_build_format()
2890 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_format()
2892 ccw->cmd_code = in dasd_eckd_build_format()
2895 ccw->cmd_code = in dasd_eckd_build_format()
2897 ccw->flags = CCW_FLAG_SLI; in dasd_eckd_build_format()
2898 ccw->count = 8; in dasd_eckd_build_format()
2899 ccw->cda = virt_to_dma32(ect); in dasd_eckd_build_format()
2905 fcp->startdev = startdev; in dasd_eckd_build_format()
2906 fcp->memdev = startdev; in dasd_eckd_build_format()
2907 fcp->basedev = base; in dasd_eckd_build_format()
2908 fcp->retries = 256; in dasd_eckd_build_format()
2909 fcp->expires = startdev->default_expires * HZ; in dasd_eckd_build_format()
2910 fcp->buildclk = get_tod_clock(); in dasd_eckd_build_format()
2911 fcp->status = DASD_CQR_FILLED; in dasd_eckd_build_format()
2947 struct dasd_eckd_private *private = base->private; in dasd_eckd_format_sanity_checks()
2949 if (fdata->start_unit >= in dasd_eckd_format_sanity_checks()
2950 (private->real_cyl * private->rdc_data.trk_per_cyl)) { in dasd_eckd_format_sanity_checks()
2951 dev_warn(&base->cdev->dev, in dasd_eckd_format_sanity_checks()
2953 fdata->start_unit); in dasd_eckd_format_sanity_checks()
2954 return -EINVAL; in dasd_eckd_format_sanity_checks()
2956 if (fdata->stop_unit >= in dasd_eckd_format_sanity_checks()
2957 (private->real_cyl * private->rdc_data.trk_per_cyl)) { in dasd_eckd_format_sanity_checks()
2958 dev_warn(&base->cdev->dev, in dasd_eckd_format_sanity_checks()
2960 fdata->stop_unit); in dasd_eckd_format_sanity_checks()
2961 return -EINVAL; in dasd_eckd_format_sanity_checks()
2963 if (fdata->start_unit > fdata->stop_unit) { in dasd_eckd_format_sanity_checks()
2964 dev_warn(&base->cdev->dev, in dasd_eckd_format_sanity_checks()
2966 fdata->start_unit); in dasd_eckd_format_sanity_checks()
2967 return -EINVAL; in dasd_eckd_format_sanity_checks()
2969 if (dasd_check_blocksize(fdata->blksize) != 0) { in dasd_eckd_format_sanity_checks()
2970 dev_warn(&base->cdev->dev, in dasd_eckd_format_sanity_checks()
2971 "The DASD cannot be formatted with block size %u\n", in dasd_eckd_format_sanity_checks()
2972 fdata->blksize); in dasd_eckd_format_sanity_checks()
2973 return -EINVAL; in dasd_eckd_format_sanity_checks()
2987 struct dasd_eckd_private *private = base->private; in dasd_eckd_format_process_data()
3002 old_start = fdata->start_unit; in dasd_eckd_format_process_data()
3003 old_stop = fdata->stop_unit; in dasd_eckd_format_process_data()
3014 recs_per_track(&private->rdc_data, 0, fdata->blksize); in dasd_eckd_format_process_data()
3019 while (fdata->start_unit <= old_stop) { in dasd_eckd_format_process_data()
3020 step = fdata->stop_unit - fdata->start_unit + 1; in dasd_eckd_format_process_data()
3022 fdata->stop_unit = in dasd_eckd_format_process_data()
3023 fdata->start_unit + format_step - 1; in dasd_eckd_format_process_data()
3031 if (rc == -ENOMEM) { in dasd_eckd_format_process_data()
3044 list_add_tail(&cqr->blocklist, &format_queue); in dasd_eckd_format_process_data()
3047 step = fdata->stop_unit - fdata->start_unit + 1; in dasd_eckd_format_process_data()
3050 fdata->start_unit = fdata->stop_unit + 1; in dasd_eckd_format_process_data()
3051 fdata->stop_unit = old_stop; in dasd_eckd_format_process_data()
3058 device = cqr->startdev; in dasd_eckd_format_process_data()
3059 private = device->private; in dasd_eckd_format_process_data()
3061 if (cqr->status == DASD_CQR_FAILED) { in dasd_eckd_format_process_data()
3067 sense = dasd_get_sense(&cqr->irb); in dasd_eckd_format_process_data()
3068 memcpy(irb, &cqr->irb, sizeof(*irb)); in dasd_eckd_format_process_data()
3070 rc = -EIO; in dasd_eckd_format_process_data()
3072 list_del_init(&cqr->blocklist); in dasd_eckd_format_process_data()
3074 private->count--; in dasd_eckd_format_process_data()
3077 if (rc && rc != -EIO) in dasd_eckd_format_process_data()
3079 if (rc == -EIO) { in dasd_eckd_format_process_data()
3085 * pass the -EIO to the IOCTL, therefore reset the rc in dasd_eckd_format_process_data()
3099 fdata->start_unit = old_start; in dasd_eckd_format_process_data()
3100 fdata->stop_unit = old_stop; in dasd_eckd_format_process_data()
3115 struct dasd_block *block = cqr->block; in test_and_set_format_track() local
3120 spin_lock_irqsave(&block->format_lock, flags); in test_and_set_format_track()
3121 if (cqr->trkcount != atomic_read(&block->trkcount)) { in test_and_set_format_track()
3131 list_for_each_entry(format, &block->format_list, list) { in test_and_set_format_track()
3132 if (format->track == to_format->track) { in test_and_set_format_track()
3137 list_add_tail(&to_format->list, &block->format_list); in test_and_set_format_track()
3140 spin_unlock_irqrestore(&block->format_lock, flags); in test_and_set_format_track()
3145 struct dasd_block *block) in clear_format_track() argument
3149 spin_lock_irqsave(&block->format_lock, flags); in clear_format_track()
3150 atomic_inc(&block->trkcount); in clear_format_track()
3151 list_del_init(&format->list); in clear_format_track()
3152 spin_unlock_irqrestore(&block->format_lock, flags); in clear_format_track()
3160 struct dasd_device *device = cqr->startdev; in dasd_eckd_ese_format_cb()
3161 struct dasd_eckd_private *private = device->private; in dasd_eckd_ese_format_cb()
3164 clear_format_track(format, cqr->basedev->block); in dasd_eckd_ese_format_cb()
3165 private->count--; in dasd_eckd_ese_format_cb()
3179 struct dasd_block *block; in dasd_eckd_ese_format() local
3188 block = cqr->block; in dasd_eckd_ese_format()
3189 base = block->base; in dasd_eckd_ese_format()
3190 private = base->private; in dasd_eckd_ese_format()
3191 blksize = block->bp_block; in dasd_eckd_ese_format()
3192 recs_per_trk = recs_per_track(&private->rdc_data, 0, blksize); in dasd_eckd_ese_format()
3193 format = &startdev->format_entry; in dasd_eckd_ese_format()
3195 first_trk = blk_rq_pos(req) >> block->s2b_shift; in dasd_eckd_ese_format()
3198 (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->s2b_shift; in dasd_eckd_ese_format()
3206 "ESE error track %llu not within range %llu - %llu\n", in dasd_eckd_ese_format()
3208 return ERR_PTR(-EINVAL); in dasd_eckd_ese_format()
3210 format->track = curr_trk; in dasd_eckd_ese_format()
3214 cqr->retries++; in dasd_eckd_ese_format()
3215 return ERR_PTR(-EEXIST); in dasd_eckd_ese_format()
3221 fdata.intensity = private->uses_cdl ? DASD_FMT_INT_COMPAT : 0; in dasd_eckd_ese_format()
3225 return ERR_PTR(-EINVAL); in dasd_eckd_ese_format()
3235 fcqr->callback = dasd_eckd_ese_format_cb; in dasd_eckd_ese_format()
3236 fcqr->callback_data = (void *) format; in dasd_eckd_ese_format()
3262 struct dasd_block *block; in dasd_eckd_ese_read() local
3272 req = (struct request *) cqr->callback_data; in dasd_eckd_ese_read()
3273 base = cqr->block->base; in dasd_eckd_ese_read()
3274 blksize = base->block->bp_block; in dasd_eckd_ese_read()
3275 block = cqr->block; in dasd_eckd_ese_read()
3276 private = base->private; in dasd_eckd_ese_read()
3280 recs_per_trk = recs_per_track(&private->rdc_data, 0, blksize); in dasd_eckd_ese_read()
3281 first_trk = first_blk = blk_rq_pos(req) >> block->s2b_shift; in dasd_eckd_ese_read()
3284 (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->s2b_shift; in dasd_eckd_ese_read()
3293 "ESE error track %llu not within range %llu - %llu\n", in dasd_eckd_ese_read()
3295 return -EINVAL; in dasd_eckd_ese_read()
3303 skip_block = curr_trk * recs_per_trk - first_blk; in dasd_eckd_ese_read()
3312 cqr->proc_bytes = blk_count * blksize; in dasd_eckd_ese_read()
3318 skip_block--; in dasd_eckd_ese_read()
3339 * - if data reoccurs (same head and record may reoccur), which may in dasd_eckd_count_records()
3341 * - when the head changes, because we're iterating over several tracks in dasd_eckd_count_records()
3343 * - when we've reached the end of sensible data in the buffer (the in dasd_eckd_count_records()
3356 return i - start; in dasd_eckd_count_records()
3380 trkcount = cdata->expect.stop_unit - cdata->expect.start_unit + 1; in dasd_eckd_format_evaluate_tracks()
3383 for (i = cdata->expect.start_unit; i <= cdata->expect.stop_unit; i++) { in dasd_eckd_format_evaluate_tracks()
3392 if (i != cdata->expect.start_unit) in dasd_eckd_format_evaluate_tracks()
3393 pos += rpt_max - count; in dasd_eckd_format_evaluate_tracks()
3403 cdata->result = DASD_FMT_ERR_TOO_FEW_RECORDS; in dasd_eckd_format_evaluate_tracks()
3407 cdata->result = DASD_FMT_ERR_TOO_MANY_RECORDS; in dasd_eckd_format_evaluate_tracks()
3412 blksize = cdata->expect.blksize; in dasd_eckd_format_evaluate_tracks()
3419 if ((cdata->expect.intensity & 0x08) && in dasd_eckd_format_evaluate_tracks()
3422 blksize = sizes_trk0[j] - 4; in dasd_eckd_format_evaluate_tracks()
3426 if ((cdata->expect.intensity & 0x08) && in dasd_eckd_format_evaluate_tracks()
3428 blksize = LABEL_SIZE - 44; in dasd_eckd_format_evaluate_tracks()
3434 cdata->result = DASD_FMT_ERR_BLKSIZE; in dasd_eckd_format_evaluate_tracks()
3439 cdata->result = DASD_FMT_ERR_KEY_LENGTH; in dasd_eckd_format_evaluate_tracks()
3446 cdata->result = DASD_FMT_ERR_RECORD_ID; in dasd_eckd_format_evaluate_tracks()
3457 if (!cdata->result) { in dasd_eckd_format_evaluate_tracks()
3458 i--; in dasd_eckd_format_evaluate_tracks()
3459 pos--; in dasd_eckd_format_evaluate_tracks()
3462 cdata->unit = i; in dasd_eckd_format_evaluate_tracks()
3463 cdata->num_records = count; in dasd_eckd_format_evaluate_tracks()
3464 cdata->rec = fmt_buffer[pos].record; in dasd_eckd_format_evaluate_tracks()
3465 cdata->blksize = fmt_buffer[pos].dl; in dasd_eckd_format_evaluate_tracks()
3466 cdata->key_length = fmt_buffer[pos].kl; in dasd_eckd_format_evaluate_tracks()
3476 struct dasd_eckd_private *private = base->private; in dasd_eckd_check_device_format()
3486 trk_per_cyl = private->rdc_data.trk_per_cyl; in dasd_eckd_check_device_format()
3489 rpt_max = recs_per_track(&private->rdc_data, 0, 512) + 1; in dasd_eckd_check_device_format()
3490 rpt_exp = recs_per_track(&private->rdc_data, 0, cdata->expect.blksize); in dasd_eckd_check_device_format()
3492 trkcount = cdata->expect.stop_unit - cdata->expect.start_unit + 1; in dasd_eckd_check_device_format()
3497 return -ENOMEM; in dasd_eckd_check_device_format()
3507 if ((private->features.feature[40] & 0x04) && in dasd_eckd_check_device_format()
3508 fmt_buffer_size <= private->fcx_max_data) in dasd_eckd_check_device_format()
3511 rc = dasd_eckd_format_process_data(base, &cdata->expect, enable_pav, in dasd_eckd_check_device_format()
3513 if (rc && rc != -EIO) in dasd_eckd_check_device_format()
3515 if (rc == -EIO) { in dasd_eckd_check_device_format()
3523 rc = dasd_eckd_format_process_data(base, &cdata->expect, in dasd_eckd_check_device_format()
3545 if (cqr->retries < 0) { in dasd_eckd_handle_terminated_request()
3546 cqr->status = DASD_CQR_FAILED; in dasd_eckd_handle_terminated_request()
3549 cqr->status = DASD_CQR_FILLED; in dasd_eckd_handle_terminated_request()
3550 if (cqr->block && (cqr->startdev != cqr->block->base)) { in dasd_eckd_handle_terminated_request()
3552 cqr->startdev = cqr->block->base; in dasd_eckd_handle_terminated_request()
3553 cqr->lpm = dasd_path_get_opm(cqr->block->base); in dasd_eckd_handle_terminated_request()
3560 struct dasd_device *device = (struct dasd_device *) cqr->startdev; in dasd_eckd_erp_action()
3561 struct ccw_device *cdev = device->cdev; in dasd_eckd_erp_action()
3563 switch (cdev->id.cu_type) { in dasd_eckd_erp_action()
3588 struct dasd_eckd_private *private = device->private; in dasd_eckd_check_for_device_change()
3592 if ((scsw_dstat(&irb->scsw) & mask) == mask) { in dasd_eckd_check_for_device_change()
3597 if (!device->block && private->lcu && in dasd_eckd_check_for_device_change()
3598 device->state == DASD_STATE_ONLINE && in dasd_eckd_check_for_device_change()
3599 !test_bit(DASD_FLAG_OFFLINE, &device->flags) && in dasd_eckd_check_for_device_change()
3600 !test_bit(DASD_FLAG_SUSPENDED, &device->flags)) { in dasd_eckd_check_for_device_change()
3614 (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK)) { in dasd_eckd_check_for_device_change()
3615 if (test_and_set_bit(DASD_FLAG_SUC, &device->flags)) { in dasd_eckd_check_for_device_change()
3624 clear_bit(DASD_FLAG_SUC, &device->flags); in dasd_eckd_check_for_device_change()
3628 private->suc_reason = sense[8]; in dasd_eckd_check_for_device_change()
3631 private->suc_reason); in dasd_eckd_check_for_device_change()
3633 if (!schedule_work(&device->suc_work)) in dasd_eckd_check_for_device_change()
3649 if (device->block && (sense[27] & DASD_SENSE_BIT_0) && in dasd_eckd_check_for_device_change()
3651 (scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) && in dasd_eckd_check_for_device_change()
3652 test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) { in dasd_eckd_check_for_device_change()
3653 if (device->features & DASD_FEATURE_FAILONSLCK) in dasd_eckd_check_for_device_change()
3654 set_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_eckd_check_for_device_change()
3655 clear_bit(DASD_FLAG_IS_RESERVED, &device->flags); in dasd_eckd_check_for_device_change()
3656 dev_err(&device->cdev->dev, in dasd_eckd_check_for_device_change()
3665 struct dasd_eckd_private *private = device->private; in dasd_eckd_ras_sanity_checks()
3669 trks_per_vol = private->real_cyl * private->rdc_data.trk_per_cyl; in dasd_eckd_ras_sanity_checks()
3672 dev_warn(&device->cdev->dev, in dasd_eckd_ras_sanity_checks()
3675 rc = -EINVAL; in dasd_eckd_ras_sanity_checks()
3677 dev_warn(&device->cdev->dev, in dasd_eckd_ras_sanity_checks()
3680 rc = -EINVAL; in dasd_eckd_ras_sanity_checks()
3682 dev_warn(&device->cdev->dev, in dasd_eckd_ras_sanity_checks()
3685 rc = -EINVAL; in dasd_eckd_ras_sanity_checks()
3705 tmp = from + trks_per_ext - (from % trks_per_ext) - 1; in count_exts()
3708 cur_pos = tmp - from + 1; in count_exts()
3712 if (to - (from + cur_pos) + 1 >= trks_per_ext) { in count_exts()
3713 tmp = to - ((to - trks_per_ext + 1) % trks_per_ext); in count_exts()
3714 count += (tmp - (from + cur_pos) + 1) / trks_per_ext; in count_exts()
3734 return -ENOMEM; in dasd_in_copy_relation()
3738 rc = temp->dev_info[0].state; in dasd_in_copy_relation()
3748 dasd_eckd_dso_ras(struct dasd_device *device, struct dasd_block *block, in dasd_eckd_dso_ras() argument
3752 struct dasd_eckd_private *private = device->private; in dasd_eckd_dso_ras()
3770 return ERR_PTR(-EINVAL); in dasd_eckd_dso_ras()
3778 features = &private->features; in dasd_eckd_dso_ras()
3780 trks_per_ext = dasd_eckd_ext_size(device) * private->rdc_data.trk_per_cyl; in dasd_eckd_dso_ras()
3789 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_dso_ras()
3794 ras_data = cqr->data; in dasd_eckd_dso_ras()
3797 ras_data->order = DSO_ORDER_RAS; in dasd_eckd_dso_ras()
3798 ras_data->flags.vol_type = 0; /* CKD volume */ in dasd_eckd_dso_ras()
3800 ras_data->op_flags.by_extent = by_extent; in dasd_eckd_dso_ras()
3806 if (features->feature[56] & 0x01 && !copy_relation) in dasd_eckd_dso_ras()
3807 ras_data->op_flags.guarantee_init = 1; in dasd_eckd_dso_ras()
3809 ras_data->lss = private->conf.ned->ID; in dasd_eckd_dso_ras()
3810 ras_data->dev_addr = private->conf.ned->unit_addr; in dasd_eckd_dso_ras()
3811 ras_data->nr_exts = nr_exts; in dasd_eckd_dso_ras()
3814 heads = private->rdc_data.trk_per_cyl; in dasd_eckd_dso_ras()
3816 cur_to_trk = first_trk + trks_per_ext - in dasd_eckd_dso_ras()
3817 (first_trk % trks_per_ext) - 1; in dasd_eckd_dso_ras()
3820 ras_range = (struct dasd_dso_ras_ext_range *)(cqr->data + ras_size); in dasd_eckd_dso_ras()
3828 set_ch_t(&ras_range->beg_ext, beg_cyl, beg_head); in dasd_eckd_dso_ras()
3829 set_ch_t(&ras_range->end_ext, end_cyl, end_head); in dasd_eckd_dso_ras()
3832 cur_to_trk = cur_from_trk + trks_per_ext - 1; in dasd_eckd_dso_ras()
3839 ccw = cqr->cpaddr; in dasd_eckd_dso_ras()
3840 ccw->cda = virt_to_dma32(cqr->data); in dasd_eckd_dso_ras()
3841 ccw->cmd_code = DASD_ECKD_CCW_DSO; in dasd_eckd_dso_ras()
3842 ccw->count = size; in dasd_eckd_dso_ras()
3844 cqr->startdev = device; in dasd_eckd_dso_ras()
3845 cqr->memdev = device; in dasd_eckd_dso_ras()
3846 cqr->block = block; in dasd_eckd_dso_ras()
3847 cqr->retries = 256; in dasd_eckd_dso_ras()
3848 cqr->expires = device->default_expires * HZ; in dasd_eckd_dso_ras()
3849 cqr->buildclk = get_tod_clock(); in dasd_eckd_dso_ras()
3850 cqr->status = DASD_CQR_FILLED; in dasd_eckd_dso_ras()
3866 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_release_space_full()
3874 struct dasd_eckd_private *private = device->private; in dasd_eckd_release_space_trks()
3875 struct dasd_block *block = device->block; in dasd_eckd_release_space_trks() local
3887 device_exts = private->real_cyl / dasd_eckd_ext_size(device); in dasd_eckd_release_space_trks()
3888 trks_per_ext = dasd_eckd_ext_size(device) * private->rdc_data.trk_per_cyl; in dasd_eckd_release_space_trks()
3897 stop = cur_pos + step - in dasd_eckd_release_space_trks()
3898 ((cur_pos + step) % trks_per_ext) - 1; in dasd_eckd_release_space_trks()
3905 if (rc == -ENOMEM) { in dasd_eckd_release_space_trks()
3914 spin_lock_irq(&block->queue_lock); in dasd_eckd_release_space_trks()
3915 list_add_tail(&cqr->blocklist, &ras_queue); in dasd_eckd_release_space_trks()
3916 spin_unlock_irq(&block->queue_lock); in dasd_eckd_release_space_trks()
3924 device = cqr->startdev; in dasd_eckd_release_space_trks()
3925 private = device->private; in dasd_eckd_release_space_trks()
3927 spin_lock_irq(&block->queue_lock); in dasd_eckd_release_space_trks()
3928 list_del_init(&cqr->blocklist); in dasd_eckd_release_space_trks()
3929 spin_unlock_irq(&block->queue_lock); in dasd_eckd_release_space_trks()
3931 private->count--; in dasd_eckd_release_space_trks()
3942 if (rdata->intensity & DASD_FMT_INT_ESE_FULL) in dasd_eckd_release_space()
3944 else if (rdata->intensity == 0) in dasd_eckd_release_space()
3945 return dasd_eckd_release_space_trks(device, rdata->start_unit, in dasd_eckd_release_space()
3946 rdata->stop_unit); in dasd_eckd_release_space()
3948 return -EINVAL; in dasd_eckd_release_space()
3953 struct dasd_block *block, in dasd_eckd_build_cp_cmd_single() argument
3979 basedev = block->base; in dasd_eckd_build_cp_cmd_single()
3980 private = basedev->private; in dasd_eckd_build_cp_cmd_single()
3986 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_cmd_single()
3992 if (bv.bv_len & (blksize - 1)) in dasd_eckd_build_cp_cmd_single()
3994 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_cmd_single()
3995 count += bv.bv_len >> (block->s2b_shift + 9); in dasd_eckd_build_cp_cmd_single()
3997 cidaw += bv.bv_len >> (block->s2b_shift + 9); in dasd_eckd_build_cp_cmd_single()
4000 if (count != last_rec - first_rec + 1) in dasd_eckd_build_cp_cmd_single()
4001 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_cmd_single()
4004 use_prefix = private->features.feature[8] & 0x01; in dasd_eckd_build_cp_cmd_single()
4021 if (private->uses_cdl && first_rec < 2*blk_per_trk) { in dasd_eckd_build_cp_cmd_single()
4023 count = 2*blk_per_trk - first_rec; in dasd_eckd_build_cp_cmd_single()
4032 ccw = cqr->cpaddr; in dasd_eckd_build_cp_cmd_single()
4035 if (prefix(ccw++, cqr->data, first_trk, in dasd_eckd_build_cp_cmd_single()
4036 last_trk, cmd, basedev, startdev) == -EAGAIN) { in dasd_eckd_build_cp_cmd_single()
4041 return ERR_PTR(-EAGAIN); in dasd_eckd_build_cp_cmd_single()
4043 idaws = (dma64_t *)(cqr->data + sizeof(struct PFX_eckd_data)); in dasd_eckd_build_cp_cmd_single()
4045 if (define_extent(ccw++, cqr->data, first_trk, in dasd_eckd_build_cp_cmd_single()
4046 last_trk, cmd, basedev, 0) == -EAGAIN) { in dasd_eckd_build_cp_cmd_single()
4051 return ERR_PTR(-EAGAIN); in dasd_eckd_build_cp_cmd_single()
4053 idaws = (dma64_t *)(cqr->data + sizeof(struct DE_eckd_data)); in dasd_eckd_build_cp_cmd_single()
4058 if (private->uses_cdl == 0 || recid > 2*blk_per_trk) { in dasd_eckd_build_cp_cmd_single()
4060 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_cmd_single()
4062 last_rec - recid + 1, cmd, basedev, blksize); in dasd_eckd_build_cp_cmd_single()
4079 /* Locate record for cdl special block ? */ in dasd_eckd_build_cp_cmd_single()
4080 if (private->uses_cdl && recid < 2*blk_per_trk) { in dasd_eckd_build_cp_cmd_single()
4087 blksize - count); in dasd_eckd_build_cp_cmd_single()
4089 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_cmd_single()
4095 if (private->uses_cdl && recid == 2*blk_per_trk) { in dasd_eckd_build_cp_cmd_single()
4096 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_cmd_single()
4099 last_rec - recid + 1, in dasd_eckd_build_cp_cmd_single()
4103 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_cmd_single()
4104 ccw->cmd_code = rcmd; in dasd_eckd_build_cp_cmd_single()
4105 ccw->count = count; in dasd_eckd_build_cp_cmd_single()
4107 ccw->cda = virt_to_dma32(idaws); in dasd_eckd_build_cp_cmd_single()
4108 ccw->flags = CCW_FLAG_IDA; in dasd_eckd_build_cp_cmd_single()
4111 ccw->cda = virt_to_dma32(dst); in dasd_eckd_build_cp_cmd_single()
4112 ccw->flags = 0; in dasd_eckd_build_cp_cmd_single()
4120 block->base->features & DASD_FEATURE_FAILFAST) in dasd_eckd_build_cp_cmd_single()
4121 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_build_cp_cmd_single()
4122 cqr->startdev = startdev; in dasd_eckd_build_cp_cmd_single()
4123 cqr->memdev = startdev; in dasd_eckd_build_cp_cmd_single()
4124 cqr->block = block; in dasd_eckd_build_cp_cmd_single()
4125 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ in dasd_eckd_build_cp_cmd_single()
4126 cqr->lpm = dasd_path_get_ppm(startdev); in dasd_eckd_build_cp_cmd_single()
4127 cqr->retries = startdev->default_retries; in dasd_eckd_build_cp_cmd_single()
4128 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_cp_cmd_single()
4129 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_cp_cmd_single()
4133 set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags); in dasd_eckd_build_cp_cmd_single()
4141 struct dasd_block *block, in dasd_eckd_build_cp_cmd_track() argument
4169 basedev = block->base; in dasd_eckd_build_cp_cmd_track()
4175 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_cmd_track()
4182 cidaw = last_rec - first_rec + 1; in dasd_eckd_build_cp_cmd_track()
4183 trkcount = last_trk - first_trk + 1; in dasd_eckd_build_cp_cmd_track()
4195 ccw = cqr->cpaddr; in dasd_eckd_build_cp_cmd_track()
4198 tlf = last_offs - first_offs + 1; in dasd_eckd_build_cp_cmd_track()
4203 if (prefix_LRE(ccw++, cqr->data, first_trk, in dasd_eckd_build_cp_cmd_track()
4207 tlf) == -EAGAIN) { in dasd_eckd_build_cp_cmd_track()
4212 return ERR_PTR(-EAGAIN); in dasd_eckd_build_cp_cmd_track()
4218 * - all idaws but the first and the last must address full pages in dasd_eckd_build_cp_cmd_track()
4219 * (or 2K blocks on 31-bit) in dasd_eckd_build_cp_cmd_track()
4220 * - the scope of a ccw and it's idal ends with the track boundaries in dasd_eckd_build_cp_cmd_track()
4222 idaws = (dma64_t *)(cqr->data + sizeof(struct PFX_eckd_data)); in dasd_eckd_build_cp_cmd_track()
4236 count_to_trk_end = blk_per_trk - recoffs; in dasd_eckd_build_cp_cmd_track()
4237 count = min((last_rec - recid + 1), in dasd_eckd_build_cp_cmd_track()
4240 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_cmd_track()
4241 ccw->cmd_code = cmd; in dasd_eckd_build_cp_cmd_track()
4242 ccw->count = len_to_track_end; in dasd_eckd_build_cp_cmd_track()
4243 ccw->cda = virt_to_dma32(idaws); in dasd_eckd_build_cp_cmd_track()
4244 ccw->flags = CCW_FLAG_IDA; in dasd_eckd_build_cp_cmd_track()
4259 if ((unsigned long)(dst) & (IDA_BLOCK_SIZE - 1)) { in dasd_eckd_build_cp_cmd_track()
4261 return ERR_PTR(-ERANGE); in dasd_eckd_build_cp_cmd_track()
4267 return ERR_PTR(-ERANGE); in dasd_eckd_build_cp_cmd_track()
4270 seg_len -= part_len; in dasd_eckd_build_cp_cmd_track()
4273 len_to_track_end -= part_len; in dasd_eckd_build_cp_cmd_track()
4275 * -> create an idaw in dasd_eckd_build_cp_cmd_track()
4279 if (!((unsigned long)(idaw_dst + idaw_len) & (IDA_BLOCK_SIZE - 1))) in dasd_eckd_build_cp_cmd_track()
4297 block->base->features & DASD_FEATURE_FAILFAST) in dasd_eckd_build_cp_cmd_track()
4298 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_build_cp_cmd_track()
4299 cqr->startdev = startdev; in dasd_eckd_build_cp_cmd_track()
4300 cqr->memdev = startdev; in dasd_eckd_build_cp_cmd_track()
4301 cqr->block = block; in dasd_eckd_build_cp_cmd_track()
4302 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ in dasd_eckd_build_cp_cmd_track()
4303 cqr->lpm = dasd_path_get_ppm(startdev); in dasd_eckd_build_cp_cmd_track()
4304 cqr->retries = startdev->default_retries; in dasd_eckd_build_cp_cmd_track()
4305 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_cp_cmd_track()
4306 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_cp_cmd_track()
4310 set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags); in dasd_eckd_build_cp_cmd_track()
4341 basepriv = basedev->private; in prepare_itcw()
4342 startpriv = startdev->private; in prepare_itcw()
4348 pfxdata.base_address = basepriv->conf.ned->unit_addr; in prepare_itcw()
4349 pfxdata.base_lss = basepriv->conf.ned->ID; in prepare_itcw()
4353 if (startpriv->uid.type == UA_BASE_PAV_ALIAS) in prepare_itcw()
4356 if (startpriv->uid.type == UA_HYPER_PAV_ALIAS) { in prepare_itcw()
4363 dedata->mask.perm = 0x1; in prepare_itcw()
4364 dedata->attributes.operation = basepriv->attrib.operation; in prepare_itcw()
4365 dedata->blk_size = blksize; in prepare_itcw()
4366 dedata->ga_extended |= 0x42; in prepare_itcw()
4367 lredata->operation.orientation = 0x0; in prepare_itcw()
4368 lredata->operation.operation = 0x0C; in prepare_itcw()
4369 lredata->auxiliary.check_bytes = 0x01; in prepare_itcw()
4373 dedata->mask.perm = 0x02; in prepare_itcw()
4374 dedata->attributes.operation = basepriv->attrib.operation; in prepare_itcw()
4375 dedata->blk_size = blksize; in prepare_itcw()
4377 dedata->ga_extended |= 0x42; in prepare_itcw()
4378 lredata->operation.orientation = 0x0; in prepare_itcw()
4379 lredata->operation.operation = 0x3F; in prepare_itcw()
4380 lredata->extended_operation = 0x23; in prepare_itcw()
4381 lredata->auxiliary.check_bytes = 0x2; in prepare_itcw()
4387 if (dedata->ga_extended & 0x08 && dedata->ga_extended & 0x02) in prepare_itcw()
4392 dedata->mask.perm = 0x1; in prepare_itcw()
4393 dedata->attributes.operation = DASD_BYPASS_CACHE; in prepare_itcw()
4394 dedata->ga_extended |= 0x42; in prepare_itcw()
4395 dedata->blk_size = blksize; in prepare_itcw()
4396 lredata->operation.orientation = 0x2; in prepare_itcw()
4397 lredata->operation.operation = 0x16; in prepare_itcw()
4398 lredata->auxiliary.check_bytes = 0x01; in prepare_itcw()
4410 dedata->attributes.mode = 0x3; /* ECKD */ in prepare_itcw()
4412 heads = basepriv->rdc_data.trk_per_cyl; in prepare_itcw()
4418 /* check for sequential prestage - enhance cylinder range */ in prepare_itcw()
4419 if (dedata->attributes.operation == DASD_SEQ_PRESTAGE || in prepare_itcw()
4420 dedata->attributes.operation == DASD_SEQ_ACCESS) { in prepare_itcw()
4422 if (endcyl + basepriv->attrib.nr_cyl < basepriv->real_cyl) in prepare_itcw()
4423 endcyl += basepriv->attrib.nr_cyl; in prepare_itcw()
4425 endcyl = (basepriv->real_cyl - 1); in prepare_itcw()
4428 set_ch_t(&dedata->beg_ext, begcyl, beghead); in prepare_itcw()
4429 set_ch_t(&dedata->end_ext, endcyl, endhead); in prepare_itcw()
4431 dedata->ep_format = 0x20; /* records per track is valid */ in prepare_itcw()
4432 dedata->ep_rec_per_track = blk_per_trk; in prepare_itcw()
4435 switch (basepriv->rdc_data.dev_type) { in prepare_itcw()
4439 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8; in prepare_itcw()
4443 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7; in prepare_itcw()
4449 lredata->auxiliary.length_valid = 0; in prepare_itcw()
4450 lredata->auxiliary.length_scope = 0; in prepare_itcw()
4451 lredata->sector = 0xff; in prepare_itcw()
4453 lredata->auxiliary.length_valid = 1; in prepare_itcw()
4454 lredata->auxiliary.length_scope = 1; in prepare_itcw()
4455 lredata->sector = sector; in prepare_itcw()
4457 lredata->auxiliary.imbedded_ccw_valid = 1; in prepare_itcw()
4458 lredata->length = tlf; in prepare_itcw()
4459 lredata->imbedded_ccw = cmd; in prepare_itcw()
4460 lredata->count = count; in prepare_itcw()
4461 set_ch_t(&lredata->seek_addr, begcyl, beghead); in prepare_itcw()
4462 lredata->search_arg.cyl = lredata->seek_addr.cyl; in prepare_itcw()
4463 lredata->search_arg.head = lredata->seek_addr.head; in prepare_itcw()
4464 lredata->search_arg.record = rec_on_trk; in prepare_itcw()
4473 struct dasd_block *block, in dasd_eckd_build_cp_tpm_track() argument
4504 basedev = block->base; in dasd_eckd_build_cp_tpm_track()
4512 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_tpm_track()
4520 trkcount = last_trk - first_trk + 1; in dasd_eckd_build_cp_tpm_track()
4526 ctidaw += (last_trk - first_trk); in dasd_eckd_build_cp_tpm_track()
4537 tlf = last_offs - first_offs + 1; in dasd_eckd_build_cp_tpm_track()
4542 itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); in dasd_eckd_build_cp_tpm_track()
4544 ret = -EINVAL; in dasd_eckd_build_cp_tpm_track()
4547 cqr->cpaddr = itcw_get_tcw(itcw); in dasd_eckd_build_cp_tpm_track()
4552 (last_rec - first_rec + 1) * blksize, in dasd_eckd_build_cp_tpm_track()
4553 tlf, blk_per_trk) == -EAGAIN) { in dasd_eckd_build_cp_tpm_track()
4557 ret = -EAGAIN; in dasd_eckd_build_cp_tpm_track()
4563 * We can let the block layer handle this by setting seg_boundary_mask in dasd_eckd_build_cp_tpm_track()
4579 count_to_trk_end = blk_per_trk - offs; in dasd_eckd_build_cp_tpm_track()
4580 count = min((last_rec - recid + 1), in dasd_eckd_build_cp_tpm_track()
4587 seg_len -= part_len; in dasd_eckd_build_cp_tpm_track()
4588 len_to_track_end -= part_len; in dasd_eckd_build_cp_tpm_track()
4598 ret = -EINVAL; in dasd_eckd_build_cp_tpm_track()
4610 ret = -EINVAL; in dasd_eckd_build_cp_tpm_track()
4615 last_tidaw->flags |= TIDAW_FLAGS_LAST; in dasd_eckd_build_cp_tpm_track()
4616 last_tidaw->flags &= ~TIDAW_FLAGS_INSERT_CBC; in dasd_eckd_build_cp_tpm_track()
4620 block->base->features & DASD_FEATURE_FAILFAST) in dasd_eckd_build_cp_tpm_track()
4621 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_build_cp_tpm_track()
4622 cqr->cpmode = 1; in dasd_eckd_build_cp_tpm_track()
4623 cqr->startdev = startdev; in dasd_eckd_build_cp_tpm_track()
4624 cqr->memdev = startdev; in dasd_eckd_build_cp_tpm_track()
4625 cqr->block = block; in dasd_eckd_build_cp_tpm_track()
4626 cqr->expires = startdev->default_expires * HZ; /* default 5 minutes */ in dasd_eckd_build_cp_tpm_track()
4627 cqr->lpm = dasd_path_get_ppm(startdev); in dasd_eckd_build_cp_tpm_track()
4628 cqr->retries = startdev->default_retries; in dasd_eckd_build_cp_tpm_track()
4629 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_cp_tpm_track()
4630 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_cp_tpm_track()
4634 set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags); in dasd_eckd_build_cp_tpm_track()
4635 set_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags); in dasd_eckd_build_cp_tpm_track()
4645 struct dasd_block *block, in dasd_eckd_build_cp() argument
4661 basedev = block->base; in dasd_eckd_build_cp()
4662 private = basedev->private; in dasd_eckd_build_cp()
4665 blksize = block->bp_block; in dasd_eckd_build_cp()
4666 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize); in dasd_eckd_build_cp()
4668 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp()
4669 /* Calculate record id of first and last block. */ in dasd_eckd_build_cp()
4670 first_rec = first_trk = blk_rq_pos(req) >> block->s2b_shift; in dasd_eckd_build_cp()
4673 (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->s2b_shift; in dasd_eckd_build_cp()
4675 cdlspecial = (private->uses_cdl && first_rec < 2*blk_per_trk); in dasd_eckd_build_cp()
4677 fcx_multitrack = private->features.feature[40] & 0x20; in dasd_eckd_build_cp()
4680 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp()
4683 data_size += (last_trk - first_trk) * 4; in dasd_eckd_build_cp()
4686 cmdrtd = private->features.feature[9] & 0x20; in dasd_eckd_build_cp()
4687 cmdwtd = private->features.feature[12] & 0x40; in dasd_eckd_build_cp()
4688 use_prefix = private->features.feature[8] & 0x01; in dasd_eckd_build_cp()
4693 } else if ((data_size <= private->fcx_max_data) in dasd_eckd_build_cp()
4695 cqr = dasd_eckd_build_cp_tpm_track(startdev, block, req, in dasd_eckd_build_cp()
4700 if (IS_ERR(cqr) && (PTR_ERR(cqr) != -EAGAIN) && in dasd_eckd_build_cp()
4701 (PTR_ERR(cqr) != -ENOMEM)) in dasd_eckd_build_cp()
4706 cqr = dasd_eckd_build_cp_cmd_track(startdev, block, req, in dasd_eckd_build_cp()
4711 if (IS_ERR(cqr) && (PTR_ERR(cqr) != -EAGAIN) && in dasd_eckd_build_cp()
4712 (PTR_ERR(cqr) != -ENOMEM)) in dasd_eckd_build_cp()
4716 cqr = dasd_eckd_build_cp_cmd_single(startdev, block, req, in dasd_eckd_build_cp()
4725 struct dasd_block *block, in dasd_eckd_build_cp_raw() argument
4754 end_padding_sectors = (DASD_RAW_SECTORS_PER_TRACK - end_sector_offset) % in dasd_eckd_build_cp_raw()
4756 basedev = block->base; in dasd_eckd_build_cp_raw()
4762 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_raw()
4766 last_trk = (blk_rq_pos(req) + blk_rq_sectors(req) - 1) / in dasd_eckd_build_cp_raw()
4768 trkcount = last_trk - first_trk + 1; in dasd_eckd_build_cp_raw()
4775 return ERR_PTR(-EINVAL); in dasd_eckd_build_cp_raw()
4787 base_priv = basedev->private; in dasd_eckd_build_cp_raw()
4788 use_prefix = base_priv->features.feature[8] & 0x01; in dasd_eckd_build_cp_raw()
4807 ccw = cqr->cpaddr; in dasd_eckd_build_cp_raw()
4808 data = cqr->data; in dasd_eckd_build_cp_raw()
4815 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_raw()
4822 idaws = (dma64_t *)(cqr->data + size); in dasd_eckd_build_cp_raw()
4825 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_raw()
4826 ccw->cmd_code = cmd; in dasd_eckd_build_cp_raw()
4828 ccw->count = 57326; in dasd_eckd_build_cp_raw()
4830 len_to_track_end = 65536 - start_padding_sectors * 512; in dasd_eckd_build_cp_raw()
4831 ccw->cda = virt_to_dma32(idaws); in dasd_eckd_build_cp_raw()
4832 ccw->flags |= CCW_FLAG_IDA; in dasd_eckd_build_cp_raw()
4833 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_build_cp_raw()
4844 ccw[-1].flags |= CCW_FLAG_CC; in dasd_eckd_build_cp_raw()
4845 ccw->cmd_code = cmd; in dasd_eckd_build_cp_raw()
4847 ccw->count = 57326; in dasd_eckd_build_cp_raw()
4850 ccw->cda = virt_to_dma32(idaws); in dasd_eckd_build_cp_raw()
4851 ccw->flags |= CCW_FLAG_IDA; in dasd_eckd_build_cp_raw()
4852 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_build_cp_raw()
4855 len_to_track_end -= seg_len; in dasd_eckd_build_cp_raw()
4861 block->base->features & DASD_FEATURE_FAILFAST) in dasd_eckd_build_cp_raw()
4862 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_build_cp_raw()
4863 cqr->startdev = startdev; in dasd_eckd_build_cp_raw()
4864 cqr->memdev = startdev; in dasd_eckd_build_cp_raw()
4865 cqr->block = block; in dasd_eckd_build_cp_raw()
4866 cqr->expires = startdev->default_expires * HZ; in dasd_eckd_build_cp_raw()
4867 cqr->lpm = dasd_path_get_ppm(startdev); in dasd_eckd_build_cp_raw()
4868 cqr->retries = startdev->default_retries; in dasd_eckd_build_cp_raw()
4869 cqr->buildclk = get_tod_clock(); in dasd_eckd_build_cp_raw()
4870 cqr->status = DASD_CQR_FILLED; in dasd_eckd_build_cp_raw()
4890 private = cqr->block->base->private; in dasd_eckd_free_cp()
4891 blksize = cqr->block->bp_block; in dasd_eckd_free_cp()
4892 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize); in dasd_eckd_free_cp()
4893 recid = blk_rq_pos(req) >> cqr->block->s2b_shift; in dasd_eckd_free_cp()
4894 ccw = cqr->cpaddr; in dasd_eckd_free_cp()
4897 if (private->uses_cdl == 0 || recid > 2*blk_per_trk) in dasd_eckd_free_cp()
4903 if (private->uses_cdl && recid <= 2*blk_per_trk) in dasd_eckd_free_cp()
4906 if (ccw->flags & CCW_FLAG_IDA) in dasd_eckd_free_cp()
4907 cda = dma64_to_virt(*((dma64_t *)dma32_to_virt(ccw->cda))); in dasd_eckd_free_cp()
4909 cda = dma32_to_virt(ccw->cda); in dasd_eckd_free_cp()
4923 status = cqr->status == DASD_CQR_DONE; in dasd_eckd_free_cp()
4924 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_free_cp()
4932 * Either reset cqr->startdev as well (summary unit check handling)
4943 if (cqr->cpmode == 1) { in dasd_eckd_reset_ccw_to_base_io()
4944 tcw = cqr->cpaddr; in dasd_eckd_reset_ccw_to_base_io()
4946 dcw = (struct dcw *)&tccb->tca[0]; in dasd_eckd_reset_ccw_to_base_io()
4947 pfxdata = (struct PFX_eckd_data *)&dcw->cd[0]; in dasd_eckd_reset_ccw_to_base_io()
4948 pfxdata->validity.verify_base = 0; in dasd_eckd_reset_ccw_to_base_io()
4949 pfxdata->validity.hyper_pav = 0; in dasd_eckd_reset_ccw_to_base_io()
4951 ccw = cqr->cpaddr; in dasd_eckd_reset_ccw_to_base_io()
4952 pfxdata = cqr->data; in dasd_eckd_reset_ccw_to_base_io()
4953 if (ccw->cmd_code == DASD_ECKD_CCW_PFX) { in dasd_eckd_reset_ccw_to_base_io()
4954 pfxdata->validity.verify_base = 0; in dasd_eckd_reset_ccw_to_base_io()
4955 pfxdata->validity.hyper_pav = 0; in dasd_eckd_reset_ccw_to_base_io()
4963 struct dasd_block *block, in dasd_eckd_build_alias_cp() argument
4974 private = startdev->private; in dasd_eckd_build_alias_cp()
4975 if (private->count >= DASD_ECKD_CHANQ_MAX_SIZE) in dasd_eckd_build_alias_cp()
4976 return ERR_PTR(-EBUSY); in dasd_eckd_build_alias_cp()
4978 spin_lock_irqsave(get_ccwdev_lock(startdev->cdev), flags); in dasd_eckd_build_alias_cp()
4979 private->count++; in dasd_eckd_build_alias_cp()
4980 if ((base->features & DASD_FEATURE_USERAW)) in dasd_eckd_build_alias_cp()
4981 cqr = dasd_eckd_build_cp_raw(startdev, block, req); in dasd_eckd_build_alias_cp()
4983 cqr = dasd_eckd_build_cp(startdev, block, req); in dasd_eckd_build_alias_cp()
4985 private->count--; in dasd_eckd_build_alias_cp()
4986 spin_unlock_irqrestore(get_ccwdev_lock(startdev->cdev), flags); in dasd_eckd_build_alias_cp()
4996 spin_lock_irqsave(get_ccwdev_lock(cqr->memdev->cdev), flags); in dasd_eckd_free_alias_cp()
4997 private = cqr->memdev->private; in dasd_eckd_free_alias_cp()
4998 private->count--; in dasd_eckd_free_alias_cp()
4999 spin_unlock_irqrestore(get_ccwdev_lock(cqr->memdev->cdev), flags); in dasd_eckd_free_alias_cp()
5007 struct dasd_eckd_private *private = device->private; in dasd_eckd_fill_info()
5009 info->label_block = 2; in dasd_eckd_fill_info()
5010 info->FBA_layout = private->uses_cdl ? 0 : 1; in dasd_eckd_fill_info()
5011 info->format = private->uses_cdl ? DASD_FORMAT_CDL : DASD_FORMAT_LDL; in dasd_eckd_fill_info()
5012 info->characteristics_size = sizeof(private->rdc_data); in dasd_eckd_fill_info()
5013 memcpy(info->characteristics, &private->rdc_data, in dasd_eckd_fill_info()
5014 sizeof(private->rdc_data)); in dasd_eckd_fill_info()
5015 info->confdata_size = min_t(unsigned long, private->conf.len, in dasd_eckd_fill_info()
5016 sizeof(info->configuration_data)); in dasd_eckd_fill_info()
5017 memcpy(info->configuration_data, private->conf.data, in dasd_eckd_fill_info()
5018 info->confdata_size); in dasd_eckd_fill_info()
5040 return -EACCES; in dasd_eckd_release()
5047 cqr = &dasd_reserve_req->cqr; in dasd_eckd_release()
5049 memset(&dasd_reserve_req->ccw, 0, in dasd_eckd_release()
5050 sizeof(dasd_reserve_req->ccw)); in dasd_eckd_release()
5051 cqr->cpaddr = &dasd_reserve_req->ccw; in dasd_eckd_release()
5052 cqr->data = &dasd_reserve_req->data; in dasd_eckd_release()
5053 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_release()
5055 ccw = cqr->cpaddr; in dasd_eckd_release()
5056 ccw->cmd_code = DASD_ECKD_CCW_RELEASE; in dasd_eckd_release()
5057 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_release()
5058 ccw->count = 32; in dasd_eckd_release()
5059 ccw->cda = virt_to_dma32(cqr->data); in dasd_eckd_release()
5060 cqr->startdev = device; in dasd_eckd_release()
5061 cqr->memdev = device; in dasd_eckd_release()
5062 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_release()
5063 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_release()
5064 cqr->retries = 2; /* set retry counter to enable basic ERP */ in dasd_eckd_release()
5065 cqr->expires = 2 * HZ; in dasd_eckd_release()
5066 cqr->buildclk = get_tod_clock(); in dasd_eckd_release()
5067 cqr->status = DASD_CQR_FILLED; in dasd_eckd_release()
5071 clear_bit(DASD_FLAG_IS_RESERVED, &device->flags); in dasd_eckd_release()
5076 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_release()
5095 return -EACCES; in dasd_eckd_reserve()
5102 cqr = &dasd_reserve_req->cqr; in dasd_eckd_reserve()
5104 memset(&dasd_reserve_req->ccw, 0, in dasd_eckd_reserve()
5105 sizeof(dasd_reserve_req->ccw)); in dasd_eckd_reserve()
5106 cqr->cpaddr = &dasd_reserve_req->ccw; in dasd_eckd_reserve()
5107 cqr->data = &dasd_reserve_req->data; in dasd_eckd_reserve()
5108 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_reserve()
5110 ccw = cqr->cpaddr; in dasd_eckd_reserve()
5111 ccw->cmd_code = DASD_ECKD_CCW_RESERVE; in dasd_eckd_reserve()
5112 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_reserve()
5113 ccw->count = 32; in dasd_eckd_reserve()
5114 ccw->cda = virt_to_dma32(cqr->data); in dasd_eckd_reserve()
5115 cqr->startdev = device; in dasd_eckd_reserve()
5116 cqr->memdev = device; in dasd_eckd_reserve()
5117 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_reserve()
5118 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_reserve()
5119 cqr->retries = 2; /* set retry counter to enable basic ERP */ in dasd_eckd_reserve()
5120 cqr->expires = 2 * HZ; in dasd_eckd_reserve()
5121 cqr->buildclk = get_tod_clock(); in dasd_eckd_reserve()
5122 cqr->status = DASD_CQR_FILLED; in dasd_eckd_reserve()
5126 set_bit(DASD_FLAG_IS_RESERVED, &device->flags); in dasd_eckd_reserve()
5131 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_reserve()
5136 * Steal lock ioctl - unconditional reserve device.
5149 return -EACCES; in dasd_eckd_steal_lock()
5156 cqr = &dasd_reserve_req->cqr; in dasd_eckd_steal_lock()
5158 memset(&dasd_reserve_req->ccw, 0, in dasd_eckd_steal_lock()
5159 sizeof(dasd_reserve_req->ccw)); in dasd_eckd_steal_lock()
5160 cqr->cpaddr = &dasd_reserve_req->ccw; in dasd_eckd_steal_lock()
5161 cqr->data = &dasd_reserve_req->data; in dasd_eckd_steal_lock()
5162 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_steal_lock()
5164 ccw = cqr->cpaddr; in dasd_eckd_steal_lock()
5165 ccw->cmd_code = DASD_ECKD_CCW_SLCK; in dasd_eckd_steal_lock()
5166 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_steal_lock()
5167 ccw->count = 32; in dasd_eckd_steal_lock()
5168 ccw->cda = virt_to_dma32(cqr->data); in dasd_eckd_steal_lock()
5169 cqr->startdev = device; in dasd_eckd_steal_lock()
5170 cqr->memdev = device; in dasd_eckd_steal_lock()
5171 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_steal_lock()
5172 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_steal_lock()
5173 cqr->retries = 2; /* set retry counter to enable basic ERP */ in dasd_eckd_steal_lock()
5174 cqr->expires = 2 * HZ; in dasd_eckd_steal_lock()
5175 cqr->buildclk = get_tod_clock(); in dasd_eckd_steal_lock()
5176 cqr->status = DASD_CQR_FILLED; in dasd_eckd_steal_lock()
5180 set_bit(DASD_FLAG_IS_RESERVED, &device->flags); in dasd_eckd_steal_lock()
5185 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_steal_lock()
5190 * SNID - Sense Path Group ID
5205 return -EACCES; in dasd_eckd_snid()
5208 return -EFAULT; in dasd_eckd_snid()
5217 cqr = &dasd_reserve_req->cqr; in dasd_eckd_snid()
5219 memset(&dasd_reserve_req->ccw, 0, in dasd_eckd_snid()
5220 sizeof(dasd_reserve_req->ccw)); in dasd_eckd_snid()
5221 cqr->cpaddr = &dasd_reserve_req->ccw; in dasd_eckd_snid()
5222 cqr->data = &dasd_reserve_req->data; in dasd_eckd_snid()
5223 cqr->magic = DASD_ECKD_MAGIC; in dasd_eckd_snid()
5225 ccw = cqr->cpaddr; in dasd_eckd_snid()
5226 ccw->cmd_code = DASD_ECKD_CCW_SNID; in dasd_eckd_snid()
5227 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_snid()
5228 ccw->count = 12; in dasd_eckd_snid()
5229 ccw->cda = virt_to_dma32(cqr->data); in dasd_eckd_snid()
5230 cqr->startdev = device; in dasd_eckd_snid()
5231 cqr->memdev = device; in dasd_eckd_snid()
5232 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_snid()
5233 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); in dasd_eckd_snid()
5234 set_bit(DASD_CQR_ALLOW_SLOCK, &cqr->flags); in dasd_eckd_snid()
5235 cqr->retries = 5; in dasd_eckd_snid()
5236 cqr->expires = 10 * HZ; in dasd_eckd_snid()
5237 cqr->buildclk = get_tod_clock(); in dasd_eckd_snid()
5238 cqr->status = DASD_CQR_FILLED; in dasd_eckd_snid()
5239 cqr->lpm = usrparm.path_mask; in dasd_eckd_snid()
5243 if (!rc && usrparm.path_mask && (cqr->lpm != usrparm.path_mask)) in dasd_eckd_snid()
5244 rc = -EIO; in dasd_eckd_snid()
5246 usrparm.data = *((struct dasd_snid_data *)cqr->data); in dasd_eckd_snid()
5248 rc = -EFAULT; in dasd_eckd_snid()
5254 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_snid()
5279 cqr->startdev = device; in dasd_eckd_performance()
5280 cqr->memdev = device; in dasd_eckd_performance()
5281 cqr->retries = 0; in dasd_eckd_performance()
5282 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_performance()
5283 cqr->expires = 10 * HZ; in dasd_eckd_performance()
5286 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_performance()
5288 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_performance()
5289 prssdp->suborder = 0x01; /* Performance Statistics */ in dasd_eckd_performance()
5290 prssdp->varies[1] = 0x01; /* Perf Statistics for the Subsystem */ in dasd_eckd_performance()
5292 ccw = cqr->cpaddr; in dasd_eckd_performance()
5293 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_performance()
5294 ccw->count = sizeof(struct dasd_psf_prssd_data); in dasd_eckd_performance()
5295 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_performance()
5296 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_performance()
5298 /* Read Subsystem Data - Performance Statistics */ in dasd_eckd_performance()
5303 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_performance()
5304 ccw->count = sizeof(struct dasd_rssd_perf_stats_t); in dasd_eckd_performance()
5305 ccw->cda = virt_to_dma32(stats); in dasd_eckd_performance()
5307 cqr->buildclk = get_tod_clock(); in dasd_eckd_performance()
5308 cqr->status = DASD_CQR_FILLED; in dasd_eckd_performance()
5311 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_performance()
5315 rc = -EFAULT; in dasd_eckd_performance()
5317 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_performance()
5328 struct dasd_eckd_private *private = device->private; in dasd_eckd_get_attrib()
5329 struct attrib_data_t attrib = private->attrib; in dasd_eckd_get_attrib()
5333 return -EACCES; in dasd_eckd_get_attrib()
5335 return -EINVAL; in dasd_eckd_get_attrib()
5340 rc = -EFAULT; in dasd_eckd_get_attrib()
5352 struct dasd_eckd_private *private = device->private; in dasd_eckd_set_attrib()
5356 return -EACCES; in dasd_eckd_set_attrib()
5358 return -EINVAL; in dasd_eckd_set_attrib()
5361 return -EFAULT; in dasd_eckd_set_attrib()
5362 private->attrib = attrib; in dasd_eckd_set_attrib()
5364 dev_info(&device->cdev->dev, in dasd_eckd_set_attrib()
5366 private->attrib.operation, private->attrib.nr_cyl); in dasd_eckd_set_attrib()
5384 return -EACCES; in dasd_symm_io()
5388 rc = -EFAULT; in dasd_symm_io()
5393 rc = -EINVAL; in dasd_symm_io()
5406 rc = -EINVAL; in dasd_symm_io()
5413 rc = -ENOMEM; in dasd_symm_io()
5418 rc = -EFAULT; in dasd_symm_io()
5435 cqr->startdev = device; in dasd_symm_io()
5436 cqr->memdev = device; in dasd_symm_io()
5437 cqr->retries = 3; in dasd_symm_io()
5438 cqr->expires = 10 * HZ; in dasd_symm_io()
5439 cqr->buildclk = get_tod_clock(); in dasd_symm_io()
5440 cqr->status = DASD_CQR_FILLED; in dasd_symm_io()
5443 ccw = cqr->cpaddr; in dasd_symm_io()
5446 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_symm_io()
5447 ccw->count = usrparm.psf_data_len; in dasd_symm_io()
5448 ccw->flags |= CCW_FLAG_CC; in dasd_symm_io()
5449 ccw->cda = virt_to_dma32(psf_data); in dasd_symm_io()
5454 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_symm_io()
5455 ccw->count = usrparm.rssd_result_len; in dasd_symm_io()
5456 ccw->flags = CCW_FLAG_SLI ; in dasd_symm_io()
5457 ccw->cda = virt_to_dma32(rssd_result); in dasd_symm_io()
5463 rc = -EFAULT; in dasd_symm_io()
5470 dasd_sfree_request(cqr, cqr->memdev); in dasd_symm_io()
5482 dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp) in dasd_eckd_ioctl() argument
5484 struct dasd_device *device = block->base; in dasd_eckd_ioctl()
5504 return -ENOTTY; in dasd_eckd_ioctl()
5525 if (from->flags & CCW_FLAG_IDA) in dasd_eckd_dump_ccw_range()
5526 datap = dma64_to_virt(*((dma64_t *)dma32_to_virt(from->cda))); in dasd_eckd_dump_ccw_range()
5528 datap = dma32_to_virt(from->cda); in dasd_eckd_dump_ccw_range()
5531 for (count = 0; count < from->count && count < 128; count++) { in dasd_eckd_dump_ccw_range()
5544 dev_err(&device->cdev->dev, "%s", page); in dasd_eckd_dump_ccw_range()
5555 stat = (u64 *) &irb->scsw; in dasd_eckd_dump_sense_dbf()
5580 dev = &device->cdev->dev; in dasd_eckd_dump_sense_ccw()
5592 req, scsw_cc(&irb->scsw), scsw_fctl(&irb->scsw), in dasd_eckd_dump_sense_ccw()
5593 scsw_actl(&irb->scsw), scsw_stctl(&irb->scsw), in dasd_eckd_dump_sense_ccw()
5594 scsw_dstat(&irb->scsw), scsw_cstat(&irb->scsw), in dasd_eckd_dump_sense_ccw()
5595 req ? req->intrc : 0); in dasd_eckd_dump_sense_ccw()
5597 dma32_to_virt(irb->scsw.cmd.cpa)); in dasd_eckd_dump_sense_ccw()
5598 if (irb->esw.esw0.erw.cons) { in dasd_eckd_dump_sense_ccw()
5600 len += sprintf(page + len, "Sense(hex) %2d-%2d:", in dasd_eckd_dump_sense_ccw()
5605 irb->ecw[8 * sl + sct]); in dasd_eckd_dump_sense_ccw()
5610 if (irb->ecw[27] & DASD_SENSE_BIT_0) { in dasd_eckd_dump_sense_ccw()
5614 irb->ecw[7] >> 4, irb->ecw[7] & 0x0f, in dasd_eckd_dump_sense_ccw()
5615 irb->ecw[1] & 0x10 ? "" : "no"); in dasd_eckd_dump_sense_ccw()
5620 irb->ecw[6] & 0x0f, irb->ecw[22] >> 4); in dasd_eckd_dump_sense_ccw()
5623 sprintf(page + len, "SORRY - NO VALID SENSE AVAILABLE\n"); in dasd_eckd_dump_sense_ccw()
5631 first = req->cpaddr; in dasd_eckd_dump_sense_ccw()
5632 for (last = first; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++); in dasd_eckd_dump_sense_ccw()
5638 /* scsw->cda is either valid or zero */ in dasd_eckd_dump_sense_ccw()
5640 fail = dma32_to_virt(irb->scsw.cmd.cpa); /* failing CCW */ in dasd_eckd_dump_sense_ccw()
5641 if (from < fail - 2) { in dasd_eckd_dump_sense_ccw()
5642 from = fail - 2; /* there is a gap - print header */ in dasd_eckd_dump_sense_ccw()
5651 if (from < last - 1) { in dasd_eckd_dump_sense_ccw()
5652 from = last - 1; /* there is a gap - print header */ in dasd_eckd_dump_sense_ccw()
5683 req, scsw_cc(&irb->scsw), scsw_fctl(&irb->scsw), in dasd_eckd_dump_sense_tcw()
5684 scsw_actl(&irb->scsw), scsw_stctl(&irb->scsw), in dasd_eckd_dump_sense_tcw()
5685 scsw_dstat(&irb->scsw), scsw_cstat(&irb->scsw), in dasd_eckd_dump_sense_tcw()
5686 irb->scsw.tm.fcxs, in dasd_eckd_dump_sense_tcw()
5687 (irb->scsw.tm.ifob << 7) | irb->scsw.tm.sesq, in dasd_eckd_dump_sense_tcw()
5688 req ? req->intrc : 0); in dasd_eckd_dump_sense_tcw()
5690 dma32_to_virt(irb->scsw.tm.tcw)); in dasd_eckd_dump_sense_tcw()
5694 if (irb->scsw.tm.tcw && (irb->scsw.tm.fcxs & 0x01)) in dasd_eckd_dump_sense_tcw()
5695 tsb = tcw_get_tsb(dma32_to_virt(irb->scsw.tm.tcw)); in dasd_eckd_dump_sense_tcw()
5698 len += sprintf(page + len, "tsb->length %d\n", tsb->length); in dasd_eckd_dump_sense_tcw()
5699 len += sprintf(page + len, "tsb->flags %x\n", tsb->flags); in dasd_eckd_dump_sense_tcw()
5700 len += sprintf(page + len, "tsb->dcw_offset %d\n", tsb->dcw_offset); in dasd_eckd_dump_sense_tcw()
5701 len += sprintf(page + len, "tsb->count %d\n", tsb->count); in dasd_eckd_dump_sense_tcw()
5702 residual = tsb->count - 28; in dasd_eckd_dump_sense_tcw()
5705 switch (tsb->flags & 0x07) { in dasd_eckd_dump_sense_tcw()
5707 len += sprintf(page + len, "tsb->tsa.iostat.dev_time %d\n", in dasd_eckd_dump_sense_tcw()
5708 tsb->tsa.iostat.dev_time); in dasd_eckd_dump_sense_tcw()
5709 len += sprintf(page + len, "tsb->tsa.iostat.def_time %d\n", in dasd_eckd_dump_sense_tcw()
5710 tsb->tsa.iostat.def_time); in dasd_eckd_dump_sense_tcw()
5711 len += sprintf(page + len, "tsb->tsa.iostat.queue_time %d\n", in dasd_eckd_dump_sense_tcw()
5712 tsb->tsa.iostat.queue_time); in dasd_eckd_dump_sense_tcw()
5713 len += sprintf(page + len, "tsb->tsa.iostat.dev_busy_time %d\n", in dasd_eckd_dump_sense_tcw()
5714 tsb->tsa.iostat.dev_busy_time); in dasd_eckd_dump_sense_tcw()
5715 len += sprintf(page + len, "tsb->tsa.iostat.dev_act_time %d\n", in dasd_eckd_dump_sense_tcw()
5716 tsb->tsa.iostat.dev_act_time); in dasd_eckd_dump_sense_tcw()
5717 sense = tsb->tsa.iostat.sense; in dasd_eckd_dump_sense_tcw()
5720 len += sprintf(page + len, "tsb->tsa.ddpc.rc %d\n", in dasd_eckd_dump_sense_tcw()
5721 tsb->tsa.ddpc.rc); in dasd_eckd_dump_sense_tcw()
5724 "tsb->tsa.ddpc.rcq %2d-%2d: ", in dasd_eckd_dump_sense_tcw()
5726 rcq = tsb->tsa.ddpc.rcq; in dasd_eckd_dump_sense_tcw()
5733 sense = tsb->tsa.ddpc.sense; in dasd_eckd_dump_sense_tcw()
5737 "tsb->tsa.intrg.: not supported yet\n"); in dasd_eckd_dump_sense_tcw()
5744 "Sense(hex) %2d-%2d:", in dasd_eckd_dump_sense_tcw()
5766 sprintf(page + len, "SORRY - NO VALID SENSE AVAILABLE\n"); in dasd_eckd_dump_sense_tcw()
5769 sprintf(page + len, "SORRY - NO TSB DATA AVAILABLE\n"); in dasd_eckd_dump_sense_tcw()
5771 dev_err(&device->cdev->dev, "%s", page); in dasd_eckd_dump_sense_tcw()
5787 test_bit(DASD_CQR_SUPPRESS_IT, &req->flags)) in dasd_eckd_dump_sense()
5791 test_bit(DASD_CQR_SUPPRESS_CR, &req->flags)) in dasd_eckd_dump_sense()
5795 test_bit(DASD_CQR_SUPPRESS_NRF, &req->flags)) in dasd_eckd_dump_sense()
5798 if (scsw_cstat(&irb->scsw) == 0x40 && in dasd_eckd_dump_sense()
5799 test_bit(DASD_CQR_SUPPRESS_IL, &req->flags)) in dasd_eckd_dump_sense()
5802 if (scsw_is_tm(&irb->scsw)) in dasd_eckd_dump_sense()
5810 struct dasd_eckd_private *private = device->private; in dasd_eckd_reload_device()
5822 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_reload_device()
5823 old_base = private->uid.base_unit_addr; in dasd_eckd_reload_device()
5824 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_eckd_reload_device()
5845 dasd_eckd_get_uid_string(&private->conf, print_uid); in dasd_eckd_reload_device()
5846 dev_info(&device->cdev->dev, in dasd_eckd_reload_device()
5853 return -1; in dasd_eckd_reload_device()
5871 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_read_message_buffer()
5876 cqr->lpm = lpum; in dasd_eckd_read_message_buffer()
5878 cqr->startdev = device; in dasd_eckd_read_message_buffer()
5879 cqr->memdev = device; in dasd_eckd_read_message_buffer()
5880 cqr->block = NULL; in dasd_eckd_read_message_buffer()
5881 cqr->expires = 10 * HZ; in dasd_eckd_read_message_buffer()
5882 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); in dasd_eckd_read_message_buffer()
5886 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); in dasd_eckd_read_message_buffer()
5887 cqr->retries = 256; in dasd_eckd_read_message_buffer()
5890 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_read_message_buffer()
5892 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_read_message_buffer()
5893 prssdp->suborder = 0x03; /* Message Buffer */ in dasd_eckd_read_message_buffer()
5896 ccw = cqr->cpaddr; in dasd_eckd_read_message_buffer()
5897 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_read_message_buffer()
5898 ccw->count = sizeof(struct dasd_psf_prssd_data); in dasd_eckd_read_message_buffer()
5899 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_read_message_buffer()
5900 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_read_message_buffer()
5901 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_read_message_buffer()
5903 /* Read Subsystem Data - message buffer */ in dasd_eckd_read_message_buffer()
5908 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_read_message_buffer()
5909 ccw->count = sizeof(struct dasd_rssd_messages); in dasd_eckd_read_message_buffer()
5910 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_read_message_buffer()
5911 ccw->cda = virt_to_dma32(message_buf); in dasd_eckd_read_message_buffer()
5913 cqr->buildclk = get_tod_clock(); in dasd_eckd_read_message_buffer()
5914 cqr->status = DASD_CQR_FILLED; in dasd_eckd_read_message_buffer()
5917 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_read_message_buffer()
5922 } else if (cqr->lpm) { in dasd_eckd_read_message_buffer()
5928 cqr->lpm = 0; in dasd_eckd_read_message_buffer()
5931 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_read_message_buffer()
5934 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_read_message_buffer()
5941 struct dasd_eckd_private *private = device->private; in dasd_eckd_query_host_access()
5949 if (!device->block && private->lcu->pav == HYPER_PAV) in dasd_eckd_query_host_access()
5950 return -EOPNOTSUPP; in dasd_eckd_query_host_access()
5953 if (!(private->features.feature[14] & 0x80)) in dasd_eckd_query_host_access()
5954 return -EOPNOTSUPP; in dasd_eckd_query_host_access()
5960 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_query_host_access()
5967 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_query_host_access()
5969 return -ENOMEM; in dasd_eckd_query_host_access()
5971 cqr->startdev = device; in dasd_eckd_query_host_access()
5972 cqr->memdev = device; in dasd_eckd_query_host_access()
5973 cqr->block = NULL; in dasd_eckd_query_host_access()
5974 cqr->retries = 256; in dasd_eckd_query_host_access()
5975 cqr->expires = 10 * HZ; in dasd_eckd_query_host_access()
5978 prssdp = (struct dasd_psf_prssd_data *) cqr->data; in dasd_eckd_query_host_access()
5980 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_query_host_access()
5981 prssdp->suborder = PSF_SUBORDER_QHA; /* query host access */ in dasd_eckd_query_host_access()
5983 prssdp->lss = private->conf.ned->ID; in dasd_eckd_query_host_access()
5984 prssdp->volume = private->conf.ned->unit_addr; in dasd_eckd_query_host_access()
5987 ccw = cqr->cpaddr; in dasd_eckd_query_host_access()
5988 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_query_host_access()
5989 ccw->count = sizeof(struct dasd_psf_prssd_data); in dasd_eckd_query_host_access()
5990 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_query_host_access()
5991 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_query_host_access()
5992 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_query_host_access()
5994 /* Read Subsystem Data - query host access */ in dasd_eckd_query_host_access()
5996 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_query_host_access()
5997 ccw->count = sizeof(struct dasd_psf_query_host_access); in dasd_eckd_query_host_access()
5998 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_query_host_access()
5999 ccw->cda = virt_to_dma32(host_access); in dasd_eckd_query_host_access()
6001 cqr->buildclk = get_tod_clock(); in dasd_eckd_query_host_access()
6002 cqr->status = DASD_CQR_FILLED; in dasd_eckd_query_host_access()
6004 __set_bit(DASD_CQR_SUPPRESS_CR, &cqr->flags); in dasd_eckd_query_host_access()
6009 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_query_host_access()
6012 rc = -EOPNOTSUPP; in dasd_eckd_query_host_access()
6015 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_query_host_access()
6032 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_host_access_count()
6034 return -ENOMEM; in dasd_eckd_host_access_count()
6043 access->host_access_information; in dasd_eckd_host_access_count()
6044 for (i = 0; i < info->entry_count; i++) { in dasd_eckd_host_access_count()
6046 (info->entry + i * info->entry_size); in dasd_eckd_host_access_count()
6047 if (entry->status_flags & DASD_ECKD_PG_GROUPED) in dasd_eckd_host_access_count()
6068 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_hosts_print()
6070 return -ENOMEM; in dasd_hosts_print()
6079 access->host_access_information; in dasd_hosts_print()
6080 for (i = 0; i < info->entry_count; i++) { in dasd_hosts_print()
6082 (info->entry + i * info->entry_size); in dasd_hosts_print()
6084 seq_printf(m, "pgid %*phN\n", 11, entry->pgid); in dasd_hosts_print()
6086 seq_printf(m, "status_flags %02x\n", entry->status_flags); in dasd_hosts_print()
6088 memcpy(&sysplex, &entry->sysplex_name, sizeof(sysplex) - 1); in dasd_hosts_print()
6092 seq_printf(m, "supported_cylinder %d\n", entry->cylinder); in dasd_hosts_print()
6095 entry->timestamp); in dasd_hosts_print()
6109 if (copy->entry[i].configured && in copy_relation_find_device()
6110 strncmp(copy->entry[i].busid, busid, DASD_BUS_ID_SIZE) == 0) in copy_relation_find_device()
6111 return copy->entry[i].device; in copy_relation_find_device()
6125 if (copy->entry[i].configured && in copy_pair_set_active()
6126 strncmp(copy->entry[i].busid, new_busid, in copy_pair_set_active()
6128 copy->active = ©->entry[i]; in copy_pair_set_active()
6129 copy->entry[i].primary = true; in copy_pair_set_active()
6130 } else if (copy->entry[i].configured && in copy_pair_set_active()
6131 strncmp(copy->entry[i].busid, old_busid, in copy_pair_set_active()
6133 copy->entry[i].primary = false; in copy_pair_set_active()
6143 * IO is paused on the block queue before swap and may be resumed afterwards.
6150 struct dasd_block *block; in dasd_eckd_copy_pair_swap() local
6153 copy = device->copy; in dasd_eckd_copy_pair_swap()
6156 primary = copy->active->device; in dasd_eckd_copy_pair_swap()
6160 if (strncmp(dev_name(&primary->cdev->dev), prim_busid, DASD_BUS_ID_SIZE) != 0) in dasd_eckd_copy_pair_swap()
6175 /* swap DASD internal device <> block assignment */ in dasd_eckd_copy_pair_swap()
6176 block = primary->block; in dasd_eckd_copy_pair_swap()
6177 primary->block = NULL; in dasd_eckd_copy_pair_swap()
6178 secondary->block = block; in dasd_eckd_copy_pair_swap()
6179 block->base = secondary; in dasd_eckd_copy_pair_swap()
6184 gdp = block->gdp; in dasd_eckd_copy_pair_swap()
6187 /* re-enable device */ in dasd_eckd_copy_pair_swap()
6196 * Perform Subsystem Function - Peer-to-Peer Remote Copy Extended Query
6211 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_query_pprc_status()
6215 cqr->startdev = device; in dasd_eckd_query_pprc_status()
6216 cqr->memdev = device; in dasd_eckd_query_pprc_status()
6217 cqr->block = NULL; in dasd_eckd_query_pprc_status()
6218 cqr->retries = 256; in dasd_eckd_query_pprc_status()
6219 cqr->expires = 10 * HZ; in dasd_eckd_query_pprc_status()
6222 prssdp = (struct dasd_psf_prssd_data *)cqr->data; in dasd_eckd_query_pprc_status()
6224 prssdp->order = PSF_ORDER_PRSSD; in dasd_eckd_query_pprc_status()
6225 prssdp->suborder = PSF_SUBORDER_PPRCEQ; in dasd_eckd_query_pprc_status()
6226 prssdp->varies[0] = PPRCEQ_SCOPE_4; in dasd_eckd_query_pprc_status()
6229 ccw = cqr->cpaddr; in dasd_eckd_query_pprc_status()
6230 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_query_pprc_status()
6231 ccw->count = sizeof(struct dasd_psf_prssd_data); in dasd_eckd_query_pprc_status()
6232 ccw->flags |= CCW_FLAG_CC; in dasd_eckd_query_pprc_status()
6233 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_query_pprc_status()
6234 ccw->cda = virt_to_dma32(prssdp); in dasd_eckd_query_pprc_status()
6236 /* Read Subsystem Data - query host access */ in dasd_eckd_query_pprc_status()
6238 ccw->cmd_code = DASD_ECKD_CCW_RSSD; in dasd_eckd_query_pprc_status()
6239 ccw->count = sizeof(*pprc_data); in dasd_eckd_query_pprc_status()
6240 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_query_pprc_status()
6241 ccw->cda = virt_to_dma32(pprc_data); in dasd_eckd_query_pprc_status()
6243 cqr->buildclk = get_tod_clock(); in dasd_eckd_query_pprc_status()
6244 cqr->status = DASD_CQR_FILLED; in dasd_eckd_query_pprc_status()
6250 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_query_pprc_status()
6253 rc = -EOPNOTSUPP; in dasd_eckd_query_pprc_status()
6256 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_query_pprc_status()
6261 * ECKD NOP - no operation
6271 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s", in dasd_eckd_nop()
6275 cqr->startdev = device; in dasd_eckd_nop()
6276 cqr->memdev = device; in dasd_eckd_nop()
6277 cqr->block = NULL; in dasd_eckd_nop()
6278 cqr->retries = 1; in dasd_eckd_nop()
6279 cqr->expires = 10 * HZ; in dasd_eckd_nop()
6281 ccw = cqr->cpaddr; in dasd_eckd_nop()
6282 ccw->cmd_code = DASD_ECKD_CCW_NOP; in dasd_eckd_nop()
6283 ccw->flags |= CCW_FLAG_SLI; in dasd_eckd_nop()
6285 cqr->buildclk = get_tod_clock(); in dasd_eckd_nop()
6286 cqr->status = DASD_CQR_FILLED; in dasd_eckd_nop()
6290 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, in dasd_eckd_nop()
6292 rc = -EOPNOTSUPP; in dasd_eckd_nop()
6294 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_nop()
6304 * Perform Subsystem Function - CUIR response
6322 "Could not allocate PSF-CUIR request"); in dasd_eckd_psf_cuir_response()
6326 psf_cuir = (struct dasd_psf_cuir_response *)cqr->data; in dasd_eckd_psf_cuir_response()
6327 psf_cuir->order = PSF_ORDER_CUIR_RESPONSE; in dasd_eckd_psf_cuir_response()
6328 psf_cuir->cc = response; in dasd_eckd_psf_cuir_response()
6329 psf_cuir->chpid = device->path[pos].chpid; in dasd_eckd_psf_cuir_response()
6330 psf_cuir->message_id = message_id; in dasd_eckd_psf_cuir_response()
6331 psf_cuir->cssid = device->path[pos].cssid; in dasd_eckd_psf_cuir_response()
6332 psf_cuir->ssid = device->path[pos].ssid; in dasd_eckd_psf_cuir_response()
6333 ccw = cqr->cpaddr; in dasd_eckd_psf_cuir_response()
6334 ccw->cmd_code = DASD_ECKD_CCW_PSF; in dasd_eckd_psf_cuir_response()
6335 ccw->cda = virt_to_dma32(psf_cuir); in dasd_eckd_psf_cuir_response()
6336 ccw->flags = CCW_FLAG_SLI; in dasd_eckd_psf_cuir_response()
6337 ccw->count = sizeof(struct dasd_psf_cuir_response); in dasd_eckd_psf_cuir_response()
6339 cqr->startdev = device; in dasd_eckd_psf_cuir_response()
6340 cqr->memdev = device; in dasd_eckd_psf_cuir_response()
6341 cqr->block = NULL; in dasd_eckd_psf_cuir_response()
6342 cqr->retries = 256; in dasd_eckd_psf_cuir_response()
6343 cqr->expires = 10*HZ; in dasd_eckd_psf_cuir_response()
6344 cqr->buildclk = get_tod_clock(); in dasd_eckd_psf_cuir_response()
6345 cqr->status = DASD_CQR_FILLED; in dasd_eckd_psf_cuir_response()
6346 set_bit(DASD_CQR_VERIFY_PATH, &cqr->flags); in dasd_eckd_psf_cuir_response()
6350 dasd_sfree_request(cqr, cqr->memdev); in dasd_eckd_psf_cuir_response()
6366 if (cuir->record_selector == 0) in dasd_eckd_get_ref_conf()
6369 conf_data = device->path[pos].conf_data; in dasd_eckd_get_ref_conf()
6370 if (conf_data->gneq.record_selector == in dasd_eckd_get_ref_conf()
6371 cuir->record_selector) in dasd_eckd_get_ref_conf()
6375 return device->path[pathmask_to_pos(lpum)].conf_data; in dasd_eckd_get_ref_conf()
6400 if (!cuir->ned_map || in dasd_eckd_cuir_scope()
6401 !(cuir->neq_map[0] | cuir->neq_map[1] | cuir->neq_map[2])) in dasd_eckd_cuir_scope()
6407 pos = 8 - ffs(cuir->ned_map); in dasd_eckd_cuir_scope()
6408 ref_ned = (char *)&ref_conf_data->neds[pos]; in dasd_eckd_cuir_scope()
6409 ref_gneq = (char *)&ref_conf_data->gneq; in dasd_eckd_cuir_scope()
6411 mask = cuir->neq_map[2]; in dasd_eckd_cuir_scope()
6412 mask |= cuir->neq_map[1] << 8; in dasd_eckd_cuir_scope()
6413 mask |= cuir->neq_map[0] << 16; in dasd_eckd_cuir_scope()
6418 conf_data = device->path[path].conf_data; in dasd_eckd_cuir_scope()
6419 pos = 8 - ffs(cuir->ned_map); in dasd_eckd_cuir_scope()
6420 ned = (char *) &conf_data->neds[pos]; in dasd_eckd_cuir_scope()
6424 gneq = (char *)&conf_data->gneq; in dasd_eckd_cuir_scope()
6429 pos = ffs(bitmask) - 1; in dasd_eckd_cuir_scope()
6430 if (memcmp(&ref_gneq[31 - pos], &gneq[31 - pos], 1) in dasd_eckd_cuir_scope()
6451 pos = 8 - ffs(paths); in dasd_eckd_cuir_notify_user()
6455 device->path[pos].cssid, in dasd_eckd_cuir_notify_user()
6456 device->path[pos].chpid); in dasd_eckd_cuir_notify_user()
6459 device->path[pos].cssid, in dasd_eckd_cuir_notify_user()
6460 device->path[pos].chpid); in dasd_eckd_cuir_notify_user()
6461 clear_bit(7 - pos, &paths); in dasd_eckd_cuir_notify_user()
6477 return -EINVAL; in dasd_eckd_cuir_remove_path()
6496 struct dasd_eckd_private *private = device->private; in dasd_eckd_cuir_quiesce()
6504 list_for_each_entry_safe(dev, n, &private->lcu->active_devices, in dasd_eckd_cuir_quiesce()
6506 spin_lock_irqsave(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6508 spin_unlock_irqrestore(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6514 list_for_each_entry_safe(dev, n, &private->lcu->inactive_devices, in dasd_eckd_cuir_quiesce()
6516 spin_lock_irqsave(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6518 spin_unlock_irqrestore(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6525 &private->lcu->grouplist, group) { in dasd_eckd_cuir_quiesce()
6526 list_for_each_entry_safe(dev, n, &pavgroup->baselist, in dasd_eckd_cuir_quiesce()
6528 spin_lock_irqsave(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6531 get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6536 list_for_each_entry_safe(dev, n, &pavgroup->aliaslist, in dasd_eckd_cuir_quiesce()
6538 spin_lock_irqsave(get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6541 get_ccwdev_lock(dev->cdev), flags); in dasd_eckd_cuir_quiesce()
6557 struct dasd_eckd_private *private = device->private; in dasd_eckd_cuir_resume()
6568 &private->lcu->active_devices, in dasd_eckd_cuir_resume()
6578 &private->lcu->inactive_devices, in dasd_eckd_cuir_resume()
6589 &private->lcu->grouplist, in dasd_eckd_cuir_resume()
6592 &pavgroup->baselist, in dasd_eckd_cuir_resume()
6602 &pavgroup->aliaslist, in dasd_eckd_cuir_resume()
6628 if (cuir->code == CUIR_QUIESCE) { in dasd_eckd_handle_cuir()
6634 } else if (cuir->code == CUIR_RESUME) { in dasd_eckd_handle_cuir()
6642 cuir->message_id, lpum); in dasd_eckd_handle_cuir()
6645 cuir->message_id); in dasd_eckd_handle_cuir()
6647 device->discipline->check_attention(device, lpum); in dasd_eckd_handle_cuir()
6652 struct dasd_eckd_private *private = device->private; in dasd_eckd_oos_resume()
6657 spin_lock_irqsave(&private->lcu->lock, flags); in dasd_eckd_oos_resume()
6658 list_for_each_entry_safe(dev, n, &private->lcu->active_devices, in dasd_eckd_oos_resume()
6660 if (dev->stopped & DASD_STOPPED_NOSPC) in dasd_eckd_oos_resume()
6663 list_for_each_entry_safe(dev, n, &private->lcu->inactive_devices, in dasd_eckd_oos_resume()
6665 if (dev->stopped & DASD_STOPPED_NOSPC) in dasd_eckd_oos_resume()
6670 &private->lcu->grouplist, in dasd_eckd_oos_resume()
6672 list_for_each_entry_safe(dev, n, &pavgroup->baselist, in dasd_eckd_oos_resume()
6674 if (dev->stopped & DASD_STOPPED_NOSPC) in dasd_eckd_oos_resume()
6677 list_for_each_entry_safe(dev, n, &pavgroup->aliaslist, in dasd_eckd_oos_resume()
6679 if (dev->stopped & DASD_STOPPED_NOSPC) in dasd_eckd_oos_resume()
6683 spin_unlock_irqrestore(&private->lcu->lock, flags); in dasd_eckd_oos_resume()
6691 switch (oos->code) { in dasd_eckd_handle_oos()
6694 dev_warn(&device->cdev->dev, in dasd_eckd_handle_oos()
6700 dev_warn(&device->cdev->dev, in dasd_eckd_handle_oos()
6705 dev_info(&device->cdev->dev, in dasd_eckd_handle_oos()
6714 device->discipline->check_attention(device, lpum); in dasd_eckd_handle_oos()
6725 device = data->device; in dasd_eckd_check_attention_work()
6732 rc = dasd_eckd_read_message_buffer(device, messages, data->lpum); in dasd_eckd_check_attention_work()
6736 if (messages->length == ATTENTION_LENGTH_CUIR && in dasd_eckd_check_attention_work()
6737 messages->format == ATTENTION_FORMAT_CUIR) in dasd_eckd_check_attention_work()
6738 dasd_eckd_handle_cuir(device, messages, data->lpum); in dasd_eckd_check_attention_work()
6739 if (messages->length == ATTENTION_LENGTH_OOS && in dasd_eckd_check_attention_work()
6740 messages->format == ATTENTION_FORMAT_OOS) in dasd_eckd_check_attention_work()
6741 dasd_eckd_handle_oos(device, messages, data->lpum); in dasd_eckd_check_attention_work()
6755 return -ENOMEM; in dasd_eckd_check_attention()
6756 INIT_WORK(&data->worker, dasd_eckd_check_attention_work); in dasd_eckd_check_attention()
6758 data->device = device; in dasd_eckd_check_attention()
6759 data->lpum = lpum; in dasd_eckd_check_attention()
6760 schedule_work(&data->worker); in dasd_eckd_check_attention()
6769 dev_err(&device->cdev->dev, in dasd_eckd_disable_hpf_path()
6779 struct dasd_eckd_private *private = device->private; in dasd_eckd_disable_hpf_device()
6781 dev_err(&device->cdev->dev, in dasd_eckd_disable_hpf_device()
6783 private->fcx_max_data = 0; in dasd_eckd_disable_hpf_device()
6788 struct dasd_eckd_private *private = device->private; in dasd_eckd_hpf_enabled()
6790 return private->fcx_max_data ? 1 : 0; in dasd_eckd_hpf_enabled()
6796 struct dasd_eckd_private *private = device->private; in dasd_eckd_handle_hpf_error()
6798 if (!private->fcx_max_data) { in dasd_eckd_handle_hpf_error()
6804 if (irb->scsw.tm.sesq == SCSW_SESQ_DEV_NOFCX) { in dasd_eckd_handle_hpf_error()
6806 } else if (irb->scsw.tm.sesq == SCSW_SESQ_PATH_NOFCX) { in dasd_eckd_handle_hpf_error()
6807 if (dasd_eckd_disable_hpf_path(device, irb->esw.esw1.lpum)) in dasd_eckd_handle_hpf_error()
6821 static unsigned int dasd_eckd_max_sectors(struct dasd_block *block) in dasd_eckd_max_sectors() argument
6823 if (block->base->features & DASD_FEATURE_USERAW) { in dasd_eckd_max_sectors()
6831 return DASD_ECKD_MAX_BLOCKS_RAW << block->s2b_shift; in dasd_eckd_max_sectors()
6834 return DASD_ECKD_MAX_BLOCKS << block->s2b_shift; in dasd_eckd_max_sectors()
6839 .name = "dasd-eckd",
6920 return -ENOMEM; in dasd_eckd_init()
6925 return -ENOMEM; in dasd_eckd_init()
6932 return -ENOMEM; in dasd_eckd_init()
6939 return -ENOMEM; in dasd_eckd_init()