12 #define KMSG_COMPONENT "dasd-eckd"
14 #include <linux/stddef.h>
15 #include <linux/kernel.h>
16 #include <linux/slab.h>
19 #include <linux/module.h>
24 #include <asm/debug.h>
28 #include <asm/uaccess.h>
39 #define PRINTK_HEADER "dasd(eckd):"
41 #define ECKD_C0(i) (i->home_bytes)
42 #define ECKD_F(i) (i->formula)
43 #define ECKD_F1(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f1):\
44 (i->factors.f_0x02.f1))
45 #define ECKD_F2(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f2):\
46 (i->factors.f_0x02.f2))
47 #define ECKD_F3(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f3):\
48 (i->factors.f_0x02.f3))
49 #define ECKD_F4(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f4):0)
50 #define ECKD_F5(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f5):0)
51 #define ECKD_F6(i) (i->factor6)
52 #define ECKD_F7(i) (i->factor7)
53 #define ECKD_F8(i) (i->factor8)
59 #define DASD_RAW_BLOCK_PER_TRACK 16
60 #define DASD_RAW_BLOCKSIZE 4096
62 #define DASD_RAW_SECTORS_PER_TRACK 128
89 #define INIT_CQR_UNFORMATTED 1
90 #define INIT_CQR_ERROR 2
125 "dasd_eckd_probe: could not set "
126 "ccw-device options");
139 static const int sizes_trk0[] = { 28, 148, 84 };
140 #define LABEL_SIZE 140
143 static const int count_area_head[] = { 0, 0, 0, 0, 2 };
144 static const int count_area_rec[] = { 1, 2, 3, 4, 1 };
146 static inline unsigned int
147 round_up_multiple(
unsigned int no,
unsigned int mult)
150 return (rem ? no - rem + mult : no);
153 static inline unsigned int
154 ceil_quot(
unsigned int d1,
unsigned int d2)
156 return (d1 + (d2 - 1)) /
d2;
161 unsigned int kl,
unsigned int dl)
168 return 1499 / (15 + 7 + ceil_quot(kl + 12, 32) +
169 ceil_quot(dl + 12, 32));
171 return 1499 / (15 + ceil_quot(dl + 12, 32));
173 dn = ceil_quot(dl + 6, 232) + 1;
175 kn = ceil_quot(kl + 6, 232) + 1;
176 return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) +
177 9 + ceil_quot(dl + 6 * dn, 34));
179 return 1729 / (10 + 9 + ceil_quot(dl + 6 * dn, 34));
181 dn = ceil_quot(dl + 6, 232) + 1;
183 kn = ceil_quot(kl + 6, 232) + 1;
184 return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) +
185 ceil_quot(dl + 6 * dn, 34));
187 return 1420 / (18 + 7 + ceil_quot(dl + 6 * dn, 34));
195 geo->
head = cyl >> 16;
201 check_XRC (
struct ccw1 *de_ccw,
209 if (!private->rdc_data.facilities.XRC_supported)
253 data->mask.
perm = 0x1;
254 data->attributes.
operation =
private->attrib.operation;
260 data->mask.
perm = 0x02;
261 data->attributes.
operation =
private->attrib.operation;
262 rc = check_XRC (ccw, data, device);
267 rc = check_XRC (ccw, data, device);
272 data->mask.
perm = 0x3;
273 data->mask.
auth = 0x1;
275 rc = check_XRC (ccw, data, device);
279 "0x%x is not a known command\n", cmd);
283 data->attributes.
mode = 0x3;
285 if ((private->rdc_data.cu_type == 0x2105 ||
286 private->rdc_data.cu_type == 0x2107 ||
287 private->rdc_data.cu_type == 0x1750)
288 && !(private->uses_cdl && trk < 2))
291 heads =
private->rdc_data.trk_per_cyl;
292 begcyl = trk /
heads;
293 beghead = trk %
heads;
294 endcyl = totrk /
heads;
295 endhead = totrk %
heads;
301 if (endcyl + private->attrib.nr_cyl < private->real_cyl)
302 endcyl +=
private->attrib.nr_cyl;
304 endcyl = (
private->real_cyl - 1);
307 set_ch_t(&data->
beg_ext, begcyl, beghead);
308 set_ch_t(&data->
end_ext, endcyl, endhead);
312 static int check_XRC_on_prefix(
struct PFX_eckd_data *pfxdata,
319 if (!private->rdc_data.facilities.XRC_supported)
334 static void fill_LRE_data(
struct LRE_eckd_data *data,
unsigned int trk,
335 unsigned int rec_on_trk,
int count,
int cmd,
345 memset(data, 0,
sizeof(*data));
348 switch (private->rdc_data.dev_type) {
350 dn = ceil_quot(reclen + 6, 232);
351 d = 9 + ceil_quot(reclen + 6 * (dn + 1), 34);
352 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8;
355 d = 7 + ceil_quot(reclen + 12, 32);
356 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7;
405 if (data->
count > 8) {
457 "fill LRE unknown opcode 0x%x", cmd);
461 trk / private->rdc_data.trk_per_cyl,
462 trk % private->rdc_data.trk_per_cyl);
469 unsigned int trk,
unsigned int totrk,
int cmd,
471 unsigned char format,
unsigned int rec_on_trk,
int count,
472 unsigned int blksize,
unsigned int tlf)
489 ccw->
count =
sizeof(*pfxdata) + 2;
491 memset(pfxdata, 0,
sizeof(*pfxdata) + 2);
493 ccw->
count =
sizeof(*pfxdata);
495 memset(pfxdata, 0,
sizeof(*pfxdata));
501 "PFX LRE unknown format 0x%x", format);
528 dedata->mask.
perm = 0x1;
533 dedata->mask.
perm = 0x1;
541 dedata->mask.
perm = 0x02;
543 rc = check_XRC_on_prefix(pfxdata, basedev);
548 rc = check_XRC_on_prefix(pfxdata, basedev);
553 dedata->mask.
perm = 0x3;
554 dedata->mask.
auth = 0x1;
556 rc = check_XRC_on_prefix(pfxdata, basedev);
559 dedata->mask.
perm = 0x03;
564 dedata->mask.
perm = 0x02;
567 rc = check_XRC_on_prefix(pfxdata, basedev);
571 "PFX LRE unknown opcode 0x%x", cmd);
576 dedata->attributes.
mode = 0x3;
578 if ((basepriv->
rdc_data.cu_type == 0x2105 ||
579 basepriv->
rdc_data.cu_type == 0x2107 ||
580 basepriv->
rdc_data.cu_type == 0x1750)
581 && !(basepriv->
uses_cdl && trk < 2))
584 heads = basepriv->
rdc_data.trk_per_cyl;
585 begcyl = trk /
heads;
586 beghead = trk %
heads;
587 endcyl = totrk /
heads;
588 endhead = totrk %
heads;
595 endcyl += basepriv->
attrib.nr_cyl;
600 set_ch_t(&dedata->
beg_ext, begcyl, beghead);
601 set_ch_t(&dedata->
end_ext, endcyl, endhead);
604 fill_LRE_data(lredata, trk, rec_on_trk, count, cmd,
605 basedev, blksize, tlf);
612 unsigned int trk,
unsigned int totrk,
int cmd,
615 return prefix_LRE(ccw, pfxdata, trk, totrk, cmd, basedev, startdev,
621 unsigned int rec_on_trk,
int no_rec,
int cmd,
631 "Locate: trk %d, rec %d, no_rec %d, cmd %d, reclen %d",
632 trk, rec_on_trk, no_rec, cmd, reclen);
642 switch (private->rdc_data.dev_type) {
644 dn = ceil_quot(reclen + 6, 232);
645 d = 9 + ceil_quot(reclen + 6 * (dn + 1), 34);
646 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8;
649 d = 7 + ceil_quot(reclen + 12, 32);
650 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7;
655 data->
count = no_rec;
716 trk / private->rdc_data.trk_per_cyl,
717 trk % private->rdc_data.trk_per_cyl);
734 dasd_eckd_cdl_special(
int blk_per_trk,
int recid)
738 if (recid < blk_per_trk)
740 if (recid < 2 * blk_per_trk)
751 dasd_eckd_cdl_reclen(
int recid)
754 return sizes_trk0[recid];
771 uid->
ssid =
private->gneq->subsystemID;
774 uid->
type =
private->sneq->sua_flags;
780 if (private->vdsneq) {
781 for (count = 0; count < 16; count++) {
783 private->vdsneq->uit[count]);
791 static int dasd_eckd_generate_uid(
struct dasd_device *device)
799 if (!private->ned || !private->gneq)
826 static int dasd_eckd_compare_path_uid(
struct dasd_device *device,
832 dasd_eckd_get_uid(device, &device_uid);
834 return memcmp(&device_uid, &private->uid,
sizeof(
struct dasd_uid));
837 static void dasd_eckd_fill_rcd_cqr(
struct dasd_device *device,
847 rcd_buffer[0] = 0xE5;
848 rcd_buffer[1] = 0xF1;
849 rcd_buffer[2] = 0x4B;
850 rcd_buffer[3] = 0xF0;
876 static void read_conf_cb(
struct dasd_ccw_req *cqr,
void *data)
884 memset(rcd_buffer, 0,
sizeof(*rcd_buffer));
886 rcd_buffer[0] = 0xE5;
887 rcd_buffer[1] = 0xF1;
888 rcd_buffer[2] = 0x4B;
889 rcd_buffer[3] = 0xF0;
894 static int dasd_eckd_read_conf_immediately(
struct dasd_device *device,
909 dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buffer, lpm);
918 static int dasd_eckd_read_conf_lpm(
struct dasd_device *device,
920 int *rcd_buffer_size,
__u8 lpm)
923 char *rcd_buf =
NULL;
946 "Could not allocate RCD request");
950 dasd_eckd_fill_rcd_cqr(device, cqr, rcd_buf, lpm);
961 *rcd_buffer = rcd_buf;
966 *rcd_buffer_size = 0;
977 private->sneq =
NULL;
978 private->vdsneq =
NULL;
979 private->gneq =
NULL;
980 count =
private->conf_len /
sizeof(
struct dasd_sneq);
981 sneq = (
struct dasd_sneq *)private->conf_data;
984 private->sneq = sneq;
986 private->vdsneq = (
struct vd_sneq *)sneq;
988 private->gneq = (
struct dasd_gneq *)sneq;
990 private->ned = (
struct dasd_ned *)sneq;
993 if (!private->ned || !private->gneq) {
995 private->sneq =
NULL;
996 private->vdsneq =
NULL;
997 private->gneq =
NULL;
1004 static unsigned char dasd_eckd_path_access(
void *
conf_data,
int conf_len)
1009 count = conf_len /
sizeof(*gneq);
1012 for (i = 0; i <
count; ++
i) {
1020 return ((
char *)gneq)[18] & 0x07;
1025 static int dasd_eckd_read_conf(
struct dasd_device *device)
1028 int conf_len, conf_data_saved;
1034 char print_path_uid[60], print_device_uid[60];
1039 conf_data_saved = 0;
1041 for (lpm = 0x80;
lpm; lpm>>= 1) {
1044 rc = dasd_eckd_read_conf_lpm(device, &conf_data,
1048 "Read configuration data returned "
1052 if (conf_data ==
NULL) {
1054 "No configuration data "
1061 if (!conf_data_saved) {
1062 kfree(private->conf_data);
1065 if (dasd_eckd_identify_conf_parts(
private)) {
1066 private->conf_data =
NULL;
1067 private->conf_len = 0;
1075 dasd_eckd_generate_uid(device);
1080 if (dasd_eckd_identify_conf_parts(
1088 if (dasd_eckd_compare_path_uid(
1089 device, &path_private)) {
1090 uid = &path_private.
uid;
1093 sizeof(print_path_uid),
1094 "%s.%s.%04x.%02x.%s",
1100 sizeof(print_path_uid),
1105 uid = &
private->uid;
1108 sizeof(print_device_uid),
1109 "%s.%s.%04x.%02x.%s",
1115 sizeof(print_device_uid),
1121 "Not all channel paths lead to "
1122 "the same device, path %02X leads to "
1123 "device %s instead of %s\n", lpm,
1124 print_path_uid, print_device_uid);
1131 switch (dasd_eckd_path_access(conf_data, conf_len)) {
1141 if (conf_data != private->conf_data)
1155 if (private->fcx_max_data) {
1159 "Detecting the maximum data size for zHPF "
1160 "requests failed (rc=%d) for a new path %x\n",
1165 if (fcx_max_data < private->fcx_max_data) {
1167 "The maximum data size for zHPF requests %u "
1168 "on a new path %x is below the active maximum "
1169 "%u\n", fcx_max_data, lpm,
1170 private->fcx_max_data);
1177 static int rebuild_device_uid(
struct dasd_device *device,
1190 for (lpm = 0x80;
lpm; lpm >>= 1) {
1195 data->
cqr.cpaddr = &data->
ccw;
1196 rc = dasd_eckd_read_conf_immediately(device, &data->
cqr,
1204 "Read configuration data "
1205 "returned error %d", rc);
1210 if (dasd_eckd_identify_conf_parts(
private)) {
1217 rc = dasd_eckd_generate_uid(device);
1230 unsigned long flags;
1247 for (lpm = 0x80;
lpm; lpm >>= 1) {
1248 if (!(lpm & data->
tbvpm))
1252 data->
cqr.cpaddr = &data->
ccw;
1253 rc = dasd_eckd_read_conf_immediately(device, &data->
cqr,
1257 switch (dasd_eckd_path_access(data->
rcd_buffer,
1270 "path verification: No configuration "
1273 }
else if (rc == -
EAGAIN) {
1275 "path verification: device is stopped,"
1276 " try again later");
1280 "Reading device feature codes failed "
1281 "(rc=%d) for new path %x\n", rc, lpm);
1284 if (verify_fcx_max_data(device, lpm)) {
1298 path_private.
conf_data = (
void *) &path_rcd_buf;
1300 if (dasd_eckd_identify_conf_parts(&path_private)) {
1313 dasd_eckd_compare_path_uid(device, &path_private)) {
1325 if (rebuild_device_uid(device, data) ||
1326 dasd_eckd_compare_path_uid(
1327 device, &path_private)) {
1328 uid = &path_private.
uid;
1330 snprintf(print_uid,
sizeof(print_uid),
1331 "%s.%s.%04x.%02x.%s",
1336 snprintf(print_uid,
sizeof(print_uid),
1342 "The newly added channel path %02X "
1343 "will not be used because it leads "
1344 "to a different device %s\n",
1372 dasd_put_device(device);
1379 static int dasd_eckd_verify_path(
struct dasd_device *device,
__u8 lpm)
1386 data = path_verification_worker;
1391 memset(data, 0,
sizeof(*data));
1395 dasd_get_device(device);
1402 static int dasd_eckd_read_features(
struct dasd_device *device)
1419 "allocate initialization request");
1420 return PTR_ERR(cqr);
1456 memcpy(&private->features, features,
1459 dev_warn(&device->
cdev->dev,
"Reading device feature codes"
1460 " failed with rc=%d\n", rc);
1482 "Could not allocate PSF-SSC request");
1513 dasd_eckd_psf_ssc(
struct dasd_device *device,
int enable_pav,
1514 unsigned long flags)
1519 cqr = dasd_eckd_build_psf_ssc(device, enable_pav);
1521 return PTR_ERR(cqr);
1543 static int dasd_eckd_validate_server(
struct dasd_device *device,
1544 unsigned long flags)
1558 rc = dasd_eckd_psf_ssc(device, enable_pav, flags);
1563 "returned rc=%d", private->uid.ssid, rc);
1570 static void dasd_eckd_do_validate_server(
struct work_struct *work)
1581 dasd_put_device(device);
1584 static void dasd_eckd_kick_validate_server(
struct dasd_device *device)
1586 dasd_get_device(device);
1590 dasd_put_device(device);
1599 #if defined(CONFIG_64BIT)
1601 int fcx_in_css, fcx_in_gneq, fcx_in_features;
1609 fcx_in_gneq = private->gneq->reserved2[7] & 0x04;
1610 fcx_in_features = private->features.feature[40] & 0x80;
1611 tpm = fcx_in_css && fcx_in_gneq && fcx_in_features;
1618 dev_warn(&device->
cdev->dev,
"Detecting the maximum supported"
1619 " data size for zHPF requests failed\n");
1633 dasd_eckd_check_characteristics(
struct dasd_device *device)
1640 unsigned long value;
1647 "A channel path group could not be established\n");
1652 "The DASD is not operating in multipath mode\n");
1659 "Allocating memory for private DASD data "
1663 device->
private = (
void *)
private;
1665 memset(
private, 0,
sizeof(*
private));
1668 private->init_cqr_status = -1;
1671 private->attrib.nr_cyl = 0;
1674 rc = dasd_eckd_read_conf(device);
1680 if (private->gneq) {
1682 for (i = 0; i <
private->gneq->timeout.value; i++)
1684 value = value *
private->gneq->timeout.number;
1690 dasd_eckd_get_uid(device, &temp_uid);
1693 if (IS_ERR(block)) {
1695 "could not allocate dasd "
1697 rc = PTR_ERR(block);
1701 block->
base = device;
1709 dasd_eckd_validate_server(device, 0);
1712 rc = dasd_eckd_read_conf(device);
1717 dasd_eckd_read_features(device);
1721 &private->rdc_data, 64);
1724 "Read device characteristic failed, rc=%d", rc);
1729 !(private->rdc_data.facilities.RT_in_LR)) {
1730 dev_err(&device->
cdev->dev,
"The storage server does not "
1731 "support raw-track access\n");
1738 private->rdc_data.long_no_cyl)
1739 private->real_cyl =
private->rdc_data.long_no_cyl;
1741 private->real_cyl =
private->rdc_data.no_cyl;
1743 private->fcx_max_data = get_fcx_max_data(device);
1749 dev_info(&device->
cdev->dev,
"New DASD %04X/%02X (CU %04X/%02X) "
1750 "with %d cylinders, %d heads, %d sectors%s\n",
1751 private->rdc_data.dev_type,
1752 private->rdc_data.dev_model,
1753 private->rdc_data.cu_type,
1754 private->rdc_data.cu_model.model,
1756 private->rdc_data.trk_per_cyl,
1757 private->rdc_data.sec_per_trk,
1758 readonly ?
", read-only device" :
"");
1767 kfree(private->conf_data);
1773 static void dasd_eckd_uncheck_device(
struct dasd_device *device)
1779 private->ned =
NULL;
1780 private->sneq =
NULL;
1781 private->vdsneq =
NULL;
1782 private->gneq =
NULL;
1783 private->conf_len = 0;
1784 kfree(private->conf_data);
1785 private->conf_data =
NULL;
1789 dasd_eckd_analysis_ccw(
struct dasd_device *device)
1796 int cplength, datasize;
1816 count_data =
private->count_area;
1817 for (i = 0; i < 4; i++) {
1848 static int dasd_eckd_analysis_evaluation(
struct dasd_ccw_req *init_cqr)
1871 static void dasd_eckd_analysis_callback(
struct dasd_ccw_req *init_cqr,
1879 private->init_cqr_status = dasd_eckd_analysis_evaluation(init_cqr);
1884 static int dasd_eckd_start_analysis(
struct dasd_block *block)
1888 init_cqr = dasd_eckd_analysis_ccw(block->
base);
1889 if (IS_ERR(init_cqr))
1890 return PTR_ERR(init_cqr);
1891 init_cqr->
callback = dasd_eckd_analysis_callback;
1903 static int dasd_eckd_end_analysis(
struct dasd_block *block)
1908 unsigned int sb, blk_per_trk;
1912 device = block->
base;
1914 status = private->init_cqr_status;
1915 private->init_cqr_status = -1;
1918 init_cqr = dasd_eckd_analysis_ccw(device);
1920 status = dasd_eckd_analysis_evaluation(init_cqr);
1932 dev_warn(&device->
cdev->dev,
"The DASD is not formatted\n");
1936 "Detecting the DASD disk layout failed because "
1937 "of an I/O error\n");
1941 private->uses_cdl = 1;
1944 for (i = 0; i < 3; i++) {
1945 if (private->count_area[i].kl != 4 ||
1946 private->count_area[i].dl != dasd_eckd_cdl_reclen(i) - 4 ||
1947 private->count_area[i].cyl != 0 ||
1948 private->count_area[i].head != count_area_head[i] ||
1949 private->count_area[i].record != count_area_rec[i]) {
1950 private->uses_cdl = 0;
1955 count_area = &
private->count_area[4];
1957 if (private->uses_cdl == 0) {
1958 for (i = 0; i < 5; i++) {
1959 if ((private->count_area[i].kl != 0) ||
1960 (private->count_area[i].dl !=
1961 private->count_area[0].dl) ||
1962 private->count_area[i].cyl != 0 ||
1963 private->count_area[i].head != count_area_head[i] ||
1964 private->count_area[i].record != count_area_rec[i])
1968 count_area = &
private->count_area[0];
1970 if (private->count_area[3].record == 1)
1972 "Track 0 has no records following the VTOC\n");
1975 if (count_area !=
NULL && count_area->
kl == 0) {
1977 if (dasd_check_blocksize(count_area->
dl) == 0)
1982 "The disk layout of the DASD is not supported\n");
1986 for (sb = 512; sb < block->
bp_block; sb = sb << 1)
1989 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->
bp_block);
1992 block->
blocks = (
private->real_cyl *
1993 private->rdc_data.trk_per_cyl *
1997 "DASD with %d KB/block, %d KB total size, %d KB/track, "
1999 ((private->real_cyl *
2000 private->rdc_data.trk_per_cyl *
2001 blk_per_trk * (block->
bp_block >> 9)) >> 1),
2002 ((blk_per_trk * block->
bp_block) >> 10),
2004 "compatible disk layout" :
"linux disk layout");
2009 static int dasd_eckd_do_analysis(
struct dasd_block *block)
2014 if (private->init_cqr_status < 0)
2015 return dasd_eckd_start_analysis(block);
2017 return dasd_eckd_end_analysis(block);
2020 static int dasd_eckd_ready_to_online(
struct dasd_device *device)
2025 static int dasd_eckd_online_to_ready(
struct dasd_device *device)
2038 if (dasd_check_blocksize(block->
bp_block) == 0) {
2039 geo->
sectors = recs_per_track(&private->rdc_data,
2042 geo->
cylinders =
private->rdc_data.no_cyl;
2043 geo->
heads =
private->rdc_data.trk_per_cyl;
2048 dasd_eckd_format_device(
struct dasd_device * device,
2058 int cplength, datasize;
2064 rpt = recs_per_track(&private->rdc_data, 0, fdata->
blksize);
2066 fdata->
start_unit / private->rdc_data.trk_per_cyl,
2067 fdata->
start_unit % private->rdc_data.trk_per_cyl);
2071 (private->real_cyl * private->rdc_data.trk_per_cyl)) {
2072 dev_warn(&device->
cdev->dev,
"Start track number %d used in "
2073 "formatting is too big\n", fdata->
start_unit);
2078 "formatting exceeds end track\n", fdata->
start_unit);
2081 if (dasd_check_blocksize(fdata->
blksize) != 0) {
2083 "The DASD cannot be formatted with block size %d\n",
2104 switch (intensity) {
2128 dev_warn(&device->
cdev->dev,
"An I/O control call used "
2129 "incorrect flags 0x%x\n", fdata->
intensity);
2140 switch (intensity & ~0x08) {
2166 device->
block->bp_block);
2181 if (intensity & 0x01) {
2196 if ((intensity & ~0x08) & 0x04) {
2210 for (i = 0; i < rpt; i++) {
2219 if ((intensity & 0x08) &&
2223 ect->
dl = sizes_trk0[
i] - 4;
2226 if ((intensity & 0x08) &&
2247 static void dasd_eckd_handle_terminated_request(
struct dasd_ccw_req *cqr)
2253 cqr->
lpm = cqr->
block->base->path_data.opm;
2263 switch (cdev->
id.cu_type) {
2282 static void dasd_eckd_check_for_device_change(
struct dasd_device *device,
2293 if ((scsw_dstat(&irb->
scsw) & mask) ==
mask) {
2298 if (!device->
block && private->lcu &&
2329 if (!cqr && !(sense[27] & DASD_SENSE_BIT_0) &&
2338 if (device->
block && (sense[27] & DASD_SENSE_BIT_0) &&
2339 (sense[7] == 0x3F) &&
2346 "The device reservation was lost\n");
2350 static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single(
2358 unsigned int first_offs,
2359 unsigned int last_offs,
2360 unsigned int blk_per_trk,
2361 unsigned int blksize)
2364 unsigned long *idaws;
2368 struct req_iterator iter;
2372 int count, cidaw, cplength, datasize;
2374 unsigned char cmd, rcmd;
2378 basedev = block->
base;
2380 if (rq_data_dir(req) ==
READ)
2382 else if (rq_data_dir(req) ==
WRITE)
2390 rq_for_each_segment(bv, req, iter) {
2391 if (bv->bv_len & (blksize - 1))
2394 count += bv->bv_len >> (block->
s2b_shift + 9);
2395 #if defined(CONFIG_64BIT)
2396 if (idal_is_needed (
page_address(bv->bv_page), bv->bv_len))
2397 cidaw += bv->bv_len >> (block->
s2b_shift + 9);
2401 if (count != last_rec - first_rec + 1)
2405 use_prefix =
private->features.feature[8] & 0x01;
2408 cplength = 2 +
count;
2412 cidaw *
sizeof(
unsigned long);
2415 cplength = 2 +
count;
2419 cidaw *
sizeof(
unsigned long);
2422 if (private->uses_cdl && first_rec < 2*blk_per_trk) {
2423 if (last_rec >= 2*blk_per_trk)
2424 count = 2*blk_per_trk - first_rec;
2437 last_trk, cmd, basedev, startdev) == -
EAGAIN) {
2444 idaws = (
unsigned long *) (cqr->
data +
2448 last_trk, cmd, basedev) == -
EAGAIN) {
2455 idaws = (
unsigned long *) (cqr->
data +
2461 if (private->uses_cdl == 0 || recid > 2*blk_per_trk) {
2465 last_rec - recid + 1, cmd, basedev, blksize);
2467 rq_for_each_segment(bv, req, iter) {
2472 if (copy && rq_data_dir(req) ==
WRITE)
2473 memcpy(copy + bv->bv_offset, dst, bv->bv_len);
2475 dst = copy + bv->bv_offset;
2477 for (off = 0; off < bv->bv_len; off += blksize) {
2479 unsigned int recoffs =
sector_div(trkid, blk_per_trk);
2483 if (private->uses_cdl && recid < 2*blk_per_trk) {
2484 if (dasd_eckd_cdl_special(blk_per_trk, recid)){
2486 count = dasd_eckd_cdl_reclen(recid);
2487 if (count < blksize &&
2488 rq_data_dir(req) ==
READ)
2489 memset(dst + count, 0xe5,
2495 1, rcmd, basedev, count);
2498 if (private->uses_cdl && recid == 2*blk_per_trk) {
2502 last_rec - recid + 1,
2503 cmd, basedev, count);
2509 if (idal_is_needed(dst, blksize)) {
2512 idaws = idal_create_words(idaws, dst, blksize);
2522 if (blk_noretry_request(req) ||
2536 static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track(
2544 unsigned int first_offs,
2545 unsigned int last_offs,
2546 unsigned int blk_per_trk,
2547 unsigned int blksize)
2549 unsigned long *idaws;
2552 struct req_iterator iter;
2554 char *
dst, *idaw_dst;
2555 unsigned int cidaw, cplength, datasize;
2560 unsigned int trkcount,
count, count_to_trk_end;
2561 unsigned int idaw_len, seg_len, part_len, len_to_track_end;
2562 unsigned char new_track, end_idaw;
2564 unsigned int recoffs;
2566 basedev = block->
base;
2567 if (rq_data_dir(req) ==
READ)
2569 else if (rq_data_dir(req) ==
WRITE)
2579 cidaw = last_rec - first_rec + 1;
2580 trkcount = last_trk - first_trk + 1;
2583 cplength = 1 + trkcount;
2589 cidaw *
sizeof(
unsigned long long);
2598 if (first_trk == last_trk)
2599 tlf = last_offs - first_offs + 1;
2601 tlf = last_offs + 1;
2604 if (prefix_LRE(ccw++, cqr->data, first_trk,
2605 last_trk, cmd, basedev, startdev,
2623 idaws = (
unsigned long *) (cqr->data +
sizeof(
struct PFX_eckd_data));
2627 len_to_track_end = 0;
2630 rq_for_each_segment(bv, req, iter) {
2632 seg_len = bv->bv_len;
2637 count_to_trk_end = blk_per_trk - recoffs;
2638 count =
min((last_rec - recid + 1),
2640 len_to_track_end = count * blksize;
2643 ccw->
count = len_to_track_end;
2666 if ((idaw_dst + idaw_len) != dst) {
2670 part_len =
min(seg_len, len_to_track_end);
2671 seg_len -= part_len;
2673 idaw_len += part_len;
2674 len_to_track_end -= part_len;
2683 if (!len_to_track_end) {
2688 idaws = idal_create_words(idaws, idaw_dst,
2697 if (blk_noretry_request(req) ||
2700 cqr->startdev = startdev;
2701 cqr->memdev = startdev;
2711 static int prepare_itcw(
struct itcw *
itcw,
2712 unsigned int trk,
unsigned int totrk,
int cmd,
2715 unsigned int rec_on_trk,
int count,
2716 unsigned int blksize,
2717 unsigned int total_data_size,
2719 unsigned int blk_per_trk)
2742 memset(&pfxdata, 0,
sizeof(pfxdata));
2757 dedata->mask.
perm = 0x1;
2767 dedata->mask.
perm = 0x02;
2770 rc = check_XRC_on_prefix(&pfxdata, basedev);
2780 "prepare itcw, unknown opcode 0x%x", cmd);
2787 dedata->attributes.
mode = 0x3;
2789 heads = basepriv->
rdc_data.trk_per_cyl;
2790 begcyl = trk /
heads;
2791 beghead = trk %
heads;
2792 endcyl = totrk /
heads;
2793 endhead = totrk %
heads;
2800 endcyl += basepriv->
attrib.nr_cyl;
2805 set_ch_t(&dedata->
beg_ext, begcyl, beghead);
2806 set_ch_t(&dedata->
end_ext, endcyl, endhead);
2812 switch (basepriv->
rdc_data.dev_type) {
2814 dn = ceil_quot(blksize + 6, 232);
2815 d = 9 + ceil_quot(blksize + 6 * (dn + 1), 34);
2816 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8;
2819 d = 7 + ceil_quot(blksize + 12, 32);
2820 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7;
2832 set_ch_t(&lredata->
seek_addr, begcyl, beghead);
2838 &pfxdata,
sizeof(pfxdata), total_data_size);
2839 return IS_ERR(dcw) ? PTR_ERR(dcw) : 0;
2842 static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2850 unsigned int first_offs,
2851 unsigned int last_offs,
2852 unsigned int blk_per_trk,
2853 unsigned int blksize)
2856 struct req_iterator iter;
2859 unsigned int trkcount, ctidaw;
2868 unsigned int seg_len, part_len, len_to_track_end;
2869 unsigned char new_track;
2872 unsigned int count, count_to_trk_end;
2875 basedev = block->
base;
2876 if (rq_data_dir(req) ==
READ) {
2879 }
else if (rq_data_dir(req) ==
WRITE) {
2891 trkcount = last_trk - first_trk + 1;
2893 rq_for_each_segment(bv, req, iter) {
2896 if (rq_data_dir(req) ==
WRITE)
2897 ctidaw += (last_trk - first_trk);
2906 if (first_trk == last_trk)
2907 tlf = last_offs - first_offs + 1;
2909 tlf = last_offs + 1;
2912 itcw =
itcw_init(cqr->
data, itcw_size, itcw_op, 0, ctidaw, 0);
2918 if (prepare_itcw(itcw, first_trk, last_trk,
2919 cmd, basedev, startdev,
2922 (last_rec - first_rec + 1) * blksize,
2923 tlf, blk_per_trk) == -
EAGAIN) {
2930 len_to_track_end = 0;
2939 if (rq_data_dir(req) ==
WRITE) {
2942 rq_for_each_segment(bv, req, iter) {
2944 seg_len = bv->bv_len;
2949 count_to_trk_end = blk_per_trk -
offs;
2950 count =
min((last_rec - recid + 1),
2952 len_to_track_end = count * blksize;
2956 part_len =
min(seg_len, len_to_track_end);
2957 seg_len -= part_len;
2958 len_to_track_end -= part_len;
2960 if (!len_to_track_end) {
2967 if (IS_ERR(last_tidaw)) {
2975 rq_for_each_segment(bv, req, iter) {
2979 if (IS_ERR(last_tidaw)) {
2989 if (blk_noretry_request(req) ||
3004 return ERR_PTR(ret);
3018 unsigned int first_offs, last_offs;
3019 unsigned int blk_per_trk, blksize;
3024 basedev = block->
base;
3029 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
3030 if (blk_per_trk == 0)
3033 first_rec = first_trk = blk_rq_pos(req) >> block->
s2b_shift;
3034 first_offs =
sector_div(first_trk, blk_per_trk);
3035 last_rec = last_trk =
3036 (blk_rq_pos(req) + blk_rq_sectors(req) - 1) >> block->
s2b_shift;
3037 last_offs =
sector_div(last_trk, blk_per_trk);
3038 cdlspecial = (
private->uses_cdl && first_rec < 2*blk_per_trk);
3040 fcx_multitrack =
private->features.feature[40] & 0x20;
3041 data_size = blk_rq_bytes(req);
3043 if (rq_data_dir(req) ==
WRITE)
3044 data_size += (last_trk - first_trk) * 4;
3047 cmdrtd =
private->features.feature[9] & 0x20;
3048 cmdwtd =
private->features.feature[12] & 0x40;
3049 use_prefix =
private->features.feature[8] & 0x01;
3055 && (fcx_multitrack || (first_trk == last_trk))) {
3056 cqr = dasd_eckd_build_cp_tpm_track(startdev, block, req,
3057 first_rec, last_rec,
3058 first_trk, last_trk,
3059 first_offs, last_offs,
3060 blk_per_trk, blksize);
3061 if (IS_ERR(cqr) && (PTR_ERR(cqr) != -
EAGAIN) &&
3062 (PTR_ERR(cqr) != -
ENOMEM))
3064 }
else if (use_prefix &&
3065 (((rq_data_dir(req) ==
READ) && cmdrtd) ||
3066 ((rq_data_dir(req) ==
WRITE) && cmdwtd))) {
3067 cqr = dasd_eckd_build_cp_cmd_track(startdev, block, req,
3068 first_rec, last_rec,
3069 first_trk, last_trk,
3070 first_offs, last_offs,
3071 blk_per_trk, blksize);
3072 if (IS_ERR(cqr) && (PTR_ERR(cqr) != -
EAGAIN) &&
3073 (PTR_ERR(cqr) != -
ENOMEM))
3077 cqr = dasd_eckd_build_cp_cmd_single(startdev, block, req,
3078 first_rec, last_rec,
3079 first_trk, last_trk,
3080 first_offs, last_offs,
3081 blk_per_trk, blksize);
3089 unsigned long *idaws;
3093 struct req_iterator iter;
3097 unsigned int trkcount;
3098 unsigned int seg_len, len_to_track_end;
3099 unsigned int first_offs;
3100 unsigned int cidaw, cplength, datasize;
3102 unsigned int pfx_datasize;
3111 if (((blk_rq_pos(req) + blk_rq_sectors(req)) %
3112 DASD_RAW_SECTORS_PER_TRACK) != 0) {
3118 last_trk = (blk_rq_pos(req) + blk_rq_sectors(req) - 1) /
3119 DASD_RAW_SECTORS_PER_TRACK;
3120 trkcount = last_trk - first_trk + 1;
3122 basedev = block->
base;
3124 if (rq_data_dir(req) ==
READ)
3126 else if (rq_data_dir(req) ==
WRITE)
3140 cplength = 1 + trkcount;
3150 datasize = pfx_datasize + cidaw *
sizeof(
unsigned long long);
3154 datasize, startdev);
3159 if (prefix_LRE(ccw++, cqr->data, first_trk, last_trk, cmd,
3160 basedev, startdev, 1 , first_offs + 1,
3161 trkcount, 0, 0) == -
EAGAIN) {
3170 idaws = (
unsigned long *)(cqr->data + pfx_datasize);
3172 len_to_track_end = 0;
3174 rq_for_each_segment(bv, req, iter) {
3176 seg_len = bv->bv_len;
3177 if (!len_to_track_end) {
3183 len_to_track_end = 65536;
3189 len_to_track_end -= seg_len;
3190 idaws = idal_create_words(idaws, dst, seg_len);
3193 if (blk_noretry_request(req) ||
3196 cqr->startdev = startdev;
3197 cqr->memdev = startdev;
3205 if (IS_ERR(cqr) && PTR_ERR(cqr) != -
EAGAIN)
3217 struct req_iterator iter;
3220 unsigned int blksize, blk_per_trk, off;
3227 blksize = cqr->
block->bp_block;
3228 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
3229 recid = blk_rq_pos(req) >> cqr->
block->s2b_shift;
3233 if (private->uses_cdl == 0 || recid > 2*blk_per_trk)
3235 rq_for_each_segment(bv, req, iter) {
3237 for (off = 0; off < bv->bv_len; off += blksize) {
3239 if (private->uses_cdl && recid <= 2*blk_per_trk)
3247 if (rq_data_dir(req) ==
READ)
3248 memcpy(dst, cda, bv->bv_len);
3282 dcw = (
struct dcw *)&tccb->
tca[0];
3288 pfxdata = cqr->
data;
3296 #define DASD_ECKD_CHANQ_MAX_SIZE 4
3304 unsigned long flags;
3312 return ERR_PTR(-
EBUSY);
3317 cqr = dasd_raw_build_cp(startdev, block, req);
3319 cqr = dasd_eckd_build_cp(startdev, block, req);
3326 static int dasd_eckd_free_alias_cp(
struct dasd_ccw_req *cqr,
3330 unsigned long flags;
3336 return dasd_eckd_free_cp(cqr, req);
3347 info->
FBA_layout = private->uses_cdl ? 0 : 1;
3384 cqr = &dasd_reserve_req->cqr;
3385 memset(cqr, 0,
sizeof(*cqr));
3386 memset(&dasd_reserve_req->ccw, 0,
3387 sizeof(dasd_reserve_req->ccw));
3388 cqr->
cpaddr = &dasd_reserve_req->ccw;
3389 cqr->
data = &dasd_reserve_req->data;
3439 cqr = &dasd_reserve_req->cqr;
3440 memset(cqr, 0,
sizeof(*cqr));
3441 memset(&dasd_reserve_req->ccw, 0,
3442 sizeof(dasd_reserve_req->ccw));
3443 cqr->
cpaddr = &dasd_reserve_req->ccw;
3444 cqr->
data = &dasd_reserve_req->data;
3493 cqr = &dasd_reserve_req->cqr;
3494 memset(cqr, 0,
sizeof(*cqr));
3495 memset(&dasd_reserve_req->ccw, 0,
3496 sizeof(dasd_reserve_req->ccw));
3497 cqr->
cpaddr = &dasd_reserve_req->ccw;
3498 cqr->
data = &dasd_reserve_req->data;
3532 static int dasd_eckd_snid(
struct dasd_device *device,
3553 cqr = &dasd_reserve_req->cqr;
3554 memset(cqr, 0,
sizeof(*cqr));
3555 memset(&dasd_reserve_req->ccw, 0,
3556 sizeof(dasd_reserve_req->ccw));
3557 cqr->
cpaddr = &dasd_reserve_req->ccw;
3558 cqr->
data = &dasd_reserve_req->data;
3575 cqr->
lpm = usrparm.path_mask;
3579 if (!rc && usrparm.path_mask && (cqr->
lpm != usrparm.path_mask))
3598 dasd_eckd_performance(
struct dasd_device *device,
void __user *argp)
3612 "Could not allocate initialization request");
3613 return PTR_ERR(cqr);
3626 prssdp->
varies[1] = 0x01;
3662 dasd_eckd_get_attrib(
struct dasd_device *device,
void __user *argp)
3687 dasd_eckd_set_attrib(
struct dasd_device *device,
void __user *argp)
3700 private->attrib =
attrib;
3703 "The DASD cache mode was set to %x (%i cylinder prestage)\n",
3704 private->attrib.operation, private->attrib.nr_cyl);
3712 static int dasd_symm_io(
struct dasd_device *device,
void __user *argp)
3732 if ((usrparm.psf_data >> 32) != 0)
3734 if ((usrparm.rssd_result >> 32) != 0)
3736 usrparm.psf_data &= 0x7fffffffULL;
3737 usrparm.rssd_result &= 0x7fffffffULL;
3742 if (!psf_data || !rssd_result) {
3750 (
void __user *)(
unsigned long) usrparm.psf_data,
3751 usrparm.psf_data_len))
3760 "Could not allocate initialization request");
3777 ccw->
count = usrparm.psf_data_len;
3785 ccw->
count = usrparm.rssd_result_len;
3794 if (
copy_to_user((
void __user *)(
unsigned long) usrparm.rssd_result,
3795 rssd_result, usrparm.rssd_result_len))
3806 "Symmetrix ioctl (0x%02x 0x%02x): rc=%d",
3807 (
int) psf0, (
int) psf1, rc);
3812 dasd_eckd_ioctl(
struct dasd_block *block,
unsigned int cmd,
void __user *argp)
3818 return dasd_eckd_get_attrib(device, argp);
3820 return dasd_eckd_set_attrib(device, argp);
3822 return dasd_eckd_performance(device, argp);
3824 return dasd_eckd_release(device);
3826 return dasd_eckd_reserve(device);
3828 return dasd_eckd_steal_lock(device);
3830 return dasd_eckd_snid(device, argp);
3832 return dasd_symm_io(device, argp);
3849 while (from <= to) {
3851 " CCW %p: %08X %08X DAT:",
3852 from, ((
int *) from)[0], ((
int *) from)[1]);
3861 for (count = 0; count < from->
count && count < 32; count++) {
3862 if (count % 8 == 0) len +=
sprintf(page + len,
" ");
3863 if (count % 4 == 0) len +=
sprintf(page + len,
" ");
3864 len +=
sprintf(page + len,
"%02x", datap[count]);
3866 len +=
sprintf(page + len,
"\n");
3873 dasd_eckd_dump_sense_dbf(
struct dasd_device *device,
struct irb *irb,
3883 "%016llx %016llx %016llx %016llx",
3884 reason, *stat, *((
u32 *) (stat + 1)),
3885 sense[0], sense[1], sense[2], sense[3]);
3888 reason, *stat, *((
u32 *) (stat + 1)),
3897 static void dasd_eckd_dump_sense_ccw(
struct dasd_device *device,
3907 "No memory to dump sense data\n");
3912 " I/O status report for device %s:\n",
3913 dev_name(&device->
cdev->dev));
3915 " in req: %p CC:%02X FC:%02X AC:%02X SC:%02X DS:%02X "
3917 req, scsw_cc(&irb->
scsw), scsw_fctl(&irb->
scsw),
3918 scsw_actl(&irb->
scsw), scsw_stctl(&irb->
scsw),
3919 scsw_dstat(&irb->
scsw), scsw_cstat(&irb->
scsw),
3920 req ? req->
intrc : 0);
3922 " device %s: Failing CCW: %p\n",
3923 dev_name(&device->
cdev->dev),
3926 for (sl = 0; sl < 4; sl++) {
3928 " Sense(hex) %2d-%2d:",
3929 (8 * sl), ((8 * sl) + 7));
3931 for (sct = 0; sct < 8; sct++) {
3932 len +=
sprintf(page + len,
" %02x",
3933 irb->
ecw[8 * sl + sct]);
3935 len +=
sprintf(page + len,
"\n");
3938 if (irb->
ecw[27] & DASD_SENSE_BIT_0) {
3941 " 24 Byte: %x MSG %x, "
3942 "%s MSGb to SYSOP\n",
3943 irb->
ecw[7] >> 4, irb->
ecw[7] & 0x0f,
3944 irb->
ecw[1] & 0x10 ?
"" :
"no");
3948 " 32 Byte: Format: %x "
3949 "Exception class %x\n",
3950 irb->
ecw[6] & 0x0f, irb->
ecw[22] >> 4);
3954 " SORRY - NO VALID SENSE AVAILABLE\n");
3964 to =
min(first + 6, last);
3966 " Related CP in req: %p\n", req);
3967 dasd_eckd_dump_ccw_range(first, to, page + len);
3976 if (from < fail - 2) {
3980 to =
min(fail + 1, last);
3981 len += dasd_eckd_dump_ccw_range(from, to, page + len);
3984 from =
max(from, ++to);
3985 if (from < last - 1) {
3989 len += dasd_eckd_dump_ccw_range(from, last, page + len);
4000 static void dasd_eckd_dump_sense_tcw(
struct dasd_device *device,
4011 "No memory to dump sense data");
4016 " I/O status report for device %s:\n",
4017 dev_name(&device->
cdev->dev));
4019 " in req: %p CC:%02X FC:%02X AC:%02X SC:%02X DS:%02X "
4020 "CS:%02X fcxs:%02X schxs:%02X RC:%d\n",
4021 req, scsw_cc(&irb->
scsw), scsw_fctl(&irb->
scsw),
4022 scsw_actl(&irb->
scsw), scsw_stctl(&irb->
scsw),
4023 scsw_dstat(&irb->
scsw), scsw_cstat(&irb->
scsw),
4025 req ? req->
intrc : 0);
4027 " device %s: Failing TCW: %p\n",
4028 dev_name(&device->
cdev->dev),
4035 (
struct tcw *)(
unsigned long)irb->
scsw.
tm.tcw);
4039 " tsb->length %d\n", tsb->
length);
4041 " tsb->flags %x\n", tsb->
flags);
4045 " tsb->count %d\n", tsb->
count);
4046 residual = tsb->
count - 28;
4048 " residual %d\n", residual);
4050 switch (tsb->
flags & 0x07) {
4053 " tsb->tsa.iostat.dev_time %d\n",
4054 tsb->tsa.
iostat.dev_time);
4056 " tsb->tsa.iostat.def_time %d\n",
4057 tsb->tsa.
iostat.def_time);
4059 " tsb->tsa.iostat.queue_time %d\n",
4060 tsb->tsa.
iostat.queue_time);
4062 " tsb->tsa.iostat.dev_busy_time %d\n",
4063 tsb->tsa.
iostat.dev_busy_time);
4065 " tsb->tsa.iostat.dev_act_time %d\n",
4066 tsb->tsa.
iostat.dev_act_time);
4067 sense = tsb->tsa.
iostat.sense;
4071 " tsb->tsa.ddpc.rc %d\n", tsb->tsa.
ddpc.rc);
4072 for (sl = 0; sl < 2; sl++) {
4075 " tsb->tsa.ddpc.rcq %2d-%2d: ",
4076 (8 * sl), ((8 * sl) + 7));
4077 rcq = tsb->tsa.
ddpc.rcq;
4078 for (sct = 0; sct < 8; sct++) {
4079 len +=
sprintf(page + len,
" %02x",
4082 len +=
sprintf(page + len,
"\n");
4084 sense = tsb->tsa.
ddpc.sense;
4088 " tsb->tsa.intrg.: not supportet yet \n");
4093 for (sl = 0; sl < 4; sl++) {
4096 " Sense(hex) %2d-%2d:",
4097 (8 * sl), ((8 * sl) + 7));
4098 for (sct = 0; sct < 8; sct++) {
4099 len +=
sprintf(page + len,
" %02x",
4100 sense[8 * sl + sct]);
4102 len +=
sprintf(page + len,
"\n");
4105 if (sense[27] & DASD_SENSE_BIT_0) {
4108 " 24 Byte: %x MSG %x, "
4109 "%s MSGb to SYSOP\n",
4110 sense[7] >> 4, sense[7] & 0x0f,
4111 sense[1] & 0x10 ?
"" :
"no");
4115 " 32 Byte: Format: %x "
4116 "Exception class %x\n",
4117 sense[6] & 0x0f, sense[22] >> 4);
4121 " SORRY - NO VALID SENSE AVAILABLE\n");
4125 " SORRY - NO TSB DATA AVAILABLE\n");
4131 static void dasd_eckd_dump_sense(
struct dasd_device *device,
4134 if (scsw_is_tm(&irb->
scsw))
4135 dasd_eckd_dump_sense_tcw(device, req, irb);
4137 dasd_eckd_dump_sense_ccw(device, req, irb);
4140 static int dasd_eckd_pm_freeze(
struct dasd_device *device)
4153 static int dasd_eckd_restore_device(
struct dasd_device *device)
4159 unsigned long flags;
4164 rc = dasd_eckd_read_conf(device);
4168 dasd_eckd_get_uid(device, &temp_uid);
4170 rc = dasd_eckd_generate_uid(device);
4172 if (
memcmp(&private->uid, &temp_uid,
sizeof(
struct dasd_uid)) != 0)
4173 dev_err(&device->
cdev->dev,
"The UID of the DASD has "
4186 rc = dasd_eckd_read_conf(device);
4191 dasd_eckd_read_features(device);
4195 &temp_rdc_data, 64);
4198 "Read device characteristic failed, rc=%d", rc);
4202 memcpy(&private->rdc_data, &temp_rdc_data,
sizeof(temp_rdc_data));
4214 static int dasd_eckd_reload_device(
struct dasd_device *device)
4220 unsigned long flags;
4225 old_base =
private->uid.base_unit_addr;
4229 rc = dasd_eckd_read_conf(device);
4233 rc = dasd_eckd_generate_uid(device);
4242 dasd_eckd_get_uid(device, &uid);
4246 snprintf(print_uid,
sizeof(print_uid),
4250 snprintf(print_uid,
sizeof(print_uid),
4255 "An Alias device was reassigned to a new base device "
4256 "with UID: %s\n", print_uid);
4264 static struct ccw_driver dasd_eckd_driver = {
4266 .name =
"dasd-eckd",
4269 .ids = dasd_eckd_ids,
4270 .probe = dasd_eckd_probe,
4273 .set_online = dasd_eckd_set_online,
4302 .check_device = dasd_eckd_check_characteristics,
4303 .uncheck_device = dasd_eckd_uncheck_device,
4304 .do_analysis = dasd_eckd_do_analysis,
4305 .verify_path = dasd_eckd_verify_path,
4306 .ready_to_online = dasd_eckd_ready_to_online,
4307 .online_to_ready = dasd_eckd_online_to_ready,
4308 .fill_geometry = dasd_eckd_fill_geometry,
4311 .handle_terminated_request = dasd_eckd_handle_terminated_request,
4312 .format_device = dasd_eckd_format_device,
4313 .erp_action = dasd_eckd_erp_action,
4314 .erp_postaction = dasd_eckd_erp_postaction,
4315 .check_for_device_change = dasd_eckd_check_for_device_change,
4316 .build_cp = dasd_eckd_build_alias_cp,
4317 .free_cp = dasd_eckd_free_alias_cp,
4318 .dump_sense = dasd_eckd_dump_sense,
4319 .dump_sense_dbf = dasd_eckd_dump_sense_dbf,
4320 .fill_info = dasd_eckd_fill_info,
4321 .ioctl = dasd_eckd_ioctl,
4322 .freeze = dasd_eckd_pm_freeze,
4323 .restore = dasd_eckd_restore_device,
4324 .reload = dasd_eckd_reload_device,
4325 .get_uid = dasd_eckd_get_uid,
4326 .kick_validate = dasd_eckd_kick_validate_server,
4330 dasd_eckd_init(
void)
4335 dasd_reserve_req =
kmalloc(
sizeof(*dasd_reserve_req),
4337 if (!dasd_reserve_req)
4339 path_verification_worker =
kmalloc(
sizeof(*path_verification_worker),
4341 if (!path_verification_worker) {
4342 kfree(dasd_reserve_req);
4349 kfree(path_verification_worker);
4350 kfree(dasd_reserve_req);
4356 dasd_eckd_cleanup(
void)
4359 kfree(path_verification_worker);
4360 kfree(dasd_reserve_req);