Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2 | * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Holger Smolinski <Holger.Smolinski@de.ibm.com> |
| 4 | * Bugreports.to..: <Linux390@de.ibm.com> |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 5 | * Copyright IBM Corp. 2000, 2001 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Stefan Haberland | ca99dab | 2009-09-11 10:28:30 +0200 | [diff] [blame] | 9 | #define KMSG_COMPONENT "dasd-eckd" |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 10 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/timer.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/idals.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
| 14 | #define PRINTK_HEADER "dasd_erp(3990): " |
| 15 | |
| 16 | #include "dasd_int.h" |
| 17 | #include "dasd_eckd.h" |
| 18 | |
| 19 | |
| 20 | struct DCTL_data { |
| 21 | unsigned char subcommand; /* e.g Inhibit Write, Enable Write,... */ |
| 22 | unsigned char modifier; /* Subcommand modifier */ |
| 23 | unsigned short res; /* reserved */ |
| 24 | } __attribute__ ((packed)); |
| 25 | |
| 26 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 27 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | * SECTION ERP HANDLING |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 29 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | */ |
| 31 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 32 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | * 24 and 32 byte sense ERP functions |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 34 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | */ |
| 36 | |
| 37 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 38 | * DASD_3990_ERP_CLEANUP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | * |
| 40 | * DESCRIPTION |
| 41 | * Removes the already build but not necessary ERP request and sets |
| 42 | * the status of the original cqr / erp to the given (final) status |
| 43 | * |
| 44 | * PARAMETER |
| 45 | * erp request to be blocked |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 46 | * final_status either DASD_CQR_DONE or DASD_CQR_FAILED |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | * |
| 48 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 49 | * cqr original cqr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | */ |
| 51 | static struct dasd_ccw_req * |
| 52 | dasd_3990_erp_cleanup(struct dasd_ccw_req * erp, char final_status) |
| 53 | { |
| 54 | struct dasd_ccw_req *cqr = erp->refers; |
| 55 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 56 | dasd_free_erp_request(erp, erp->memdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | cqr->status = final_status; |
| 58 | return cqr; |
| 59 | |
| 60 | } /* end dasd_3990_erp_cleanup */ |
| 61 | |
| 62 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 63 | * DASD_3990_ERP_BLOCK_QUEUE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | * |
| 65 | * DESCRIPTION |
| 66 | * Block the given device request queue to prevent from further |
| 67 | * processing until the started timer has expired or an related |
| 68 | * interrupt was received. |
| 69 | */ |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 70 | static void dasd_3990_erp_block_queue(struct dasd_ccw_req *erp, int expires) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | { |
| 72 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 73 | struct dasd_device *device = erp->startdev; |
| 74 | unsigned long flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 76 | DBF_DEV_EVENT(DBF_INFO, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | "blocking request queue for %is", expires/HZ); |
| 78 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 79 | spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 80 | dasd_device_set_stop_bits(device, DASD_STOPPED_PENDING); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 81 | spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); |
| 82 | erp->status = DASD_CQR_FILLED; |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 83 | if (erp->block) |
| 84 | dasd_block_set_timer(erp->block, expires); |
| 85 | else |
| 86 | dasd_device_set_timer(device, expires); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 90 | * DASD_3990_ERP_INT_REQ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | * |
| 92 | * DESCRIPTION |
| 93 | * Handles 'Intervention Required' error. |
| 94 | * This means either device offline or not installed. |
| 95 | * |
| 96 | * PARAMETER |
| 97 | * erp current erp |
| 98 | * RETURN VALUES |
| 99 | * erp modified erp |
| 100 | */ |
| 101 | static struct dasd_ccw_req * |
| 102 | dasd_3990_erp_int_req(struct dasd_ccw_req * erp) |
| 103 | { |
| 104 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 105 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | |
| 107 | /* first time set initial retry counter and erp_function */ |
| 108 | /* and retry once without blocking queue */ |
| 109 | /* (this enables easier enqueing of the cqr) */ |
| 110 | if (erp->function != dasd_3990_erp_int_req) { |
| 111 | |
| 112 | erp->retries = 256; |
| 113 | erp->function = dasd_3990_erp_int_req; |
| 114 | |
| 115 | } else { |
| 116 | |
| 117 | /* issue a message and wait for 'device ready' interrupt */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 118 | dev_err(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | "is offline or not installed - " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 120 | "INTERVENTION REQUIRED!!\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
| 122 | dasd_3990_erp_block_queue(erp, 60*HZ); |
| 123 | } |
| 124 | |
| 125 | return erp; |
| 126 | |
| 127 | } /* end dasd_3990_erp_int_req */ |
| 128 | |
| 129 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 130 | * DASD_3990_ERP_ALTERNATE_PATH |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | * |
| 132 | * DESCRIPTION |
| 133 | * Repeat the operation on a different channel path. |
| 134 | * If all alternate paths have been tried, the request is posted with a |
| 135 | * permanent error. |
| 136 | * |
| 137 | * PARAMETER |
| 138 | * erp pointer to the current ERP |
| 139 | * |
| 140 | * RETURN VALUES |
| 141 | * erp modified pointer to the ERP |
| 142 | */ |
| 143 | static void |
| 144 | dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp) |
| 145 | { |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 146 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | __u8 opm; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 148 | unsigned long flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | |
| 150 | /* try alternate valid path */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 151 | spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | opm = ccw_device_get_path_mask(device->cdev); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 153 | spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | if (erp->lpm == 0) |
Stefan Haberland | c934615 | 2016-08-08 15:53:54 +0200 | [diff] [blame] | 155 | erp->lpm = dasd_path_get_opm(device) & |
Stefan Weinhuber | a4d26c6 | 2011-01-05 12:48:03 +0100 | [diff] [blame] | 156 | ~(erp->irb.esw.esw0.sublog.lpum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | else |
| 158 | erp->lpm &= ~(erp->irb.esw.esw0.sublog.lpum); |
| 159 | |
| 160 | if ((erp->lpm & opm) != 0x00) { |
| 161 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 162 | DBF_DEV_EVENT(DBF_WARNING, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | "try alternate lpm=%x (lpum=%x / opm=%x)", |
| 164 | erp->lpm, erp->irb.esw.esw0.sublog.lpum, opm); |
| 165 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 166 | /* reset status to submit the request again... */ |
| 167 | erp->status = DASD_CQR_FILLED; |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 168 | erp->retries = 10; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | } else { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 170 | dev_err(&device->cdev->dev, |
| 171 | "The DASD cannot be reached on any path (lpum=%x" |
| 172 | "/opm=%x)\n", erp->irb.esw.esw0.sublog.lpum, opm); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
| 174 | /* post request with permanent error */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 175 | erp->status = DASD_CQR_FAILED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | } |
| 177 | } /* end dasd_3990_erp_alternate_path */ |
| 178 | |
| 179 | /* |
| 180 | * DASD_3990_ERP_DCTL |
| 181 | * |
| 182 | * DESCRIPTION |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 183 | * Setup cqr to do the Diagnostic Control (DCTL) command with an |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | * Inhibit Write subcommand (0x20) and the given modifier. |
| 185 | * |
| 186 | * PARAMETER |
| 187 | * erp pointer to the current (failed) ERP |
| 188 | * modifier subcommand modifier |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 189 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 191 | * dctl_cqr pointer to NEW dctl_cqr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | * |
| 193 | */ |
| 194 | static struct dasd_ccw_req * |
| 195 | dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier) |
| 196 | { |
| 197 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 198 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | struct DCTL_data *DCTL_data; |
| 200 | struct ccw1 *ccw; |
| 201 | struct dasd_ccw_req *dctl_cqr; |
| 202 | |
| 203 | dctl_cqr = dasd_alloc_erp_request((char *) &erp->magic, 1, |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 204 | sizeof(struct DCTL_data), |
| 205 | device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | if (IS_ERR(dctl_cqr)) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 207 | dev_err(&device->cdev->dev, |
| 208 | "Unable to allocate DCTL-CQR\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | erp->status = DASD_CQR_FAILED; |
| 210 | return erp; |
| 211 | } |
| 212 | |
| 213 | DCTL_data = dctl_cqr->data; |
| 214 | |
| 215 | DCTL_data->subcommand = 0x02; /* Inhibit Write */ |
| 216 | DCTL_data->modifier = modifier; |
| 217 | |
| 218 | ccw = dctl_cqr->cpaddr; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 219 | memset(ccw, 0, sizeof(struct ccw1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | ccw->cmd_code = CCW_CMD_DCTL; |
| 221 | ccw->count = 4; |
| 222 | ccw->cda = (__u32)(addr_t) DCTL_data; |
Stefan Weinhuber | 7ea8d32 | 2010-10-25 16:10:08 +0200 | [diff] [blame] | 223 | dctl_cqr->flags = erp->flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | dctl_cqr->function = dasd_3990_erp_DCTL; |
| 225 | dctl_cqr->refers = erp; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 226 | dctl_cqr->startdev = device; |
| 227 | dctl_cqr->memdev = device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | dctl_cqr->magic = erp->magic; |
| 229 | dctl_cqr->expires = 5 * 60 * HZ; |
| 230 | dctl_cqr->retries = 2; |
| 231 | |
Heiko Carstens | 1aae056 | 2013-01-30 09:49:40 +0100 | [diff] [blame] | 232 | dctl_cqr->buildclk = get_tod_clock(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | |
| 234 | dctl_cqr->status = DASD_CQR_FILLED; |
| 235 | |
| 236 | return dctl_cqr; |
| 237 | |
| 238 | } /* end dasd_3990_erp_DCTL */ |
| 239 | |
| 240 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 241 | * DASD_3990_ERP_ACTION_1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | * |
| 243 | * DESCRIPTION |
| 244 | * Setup ERP to do the ERP action 1 (see Reference manual). |
| 245 | * Repeat the operation on a different channel path. |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 246 | * As deviation from the recommended recovery action, we reset the path mask |
| 247 | * after we have tried each path and go through all paths a second time. |
| 248 | * This will cover situations where only one path at a time is actually down, |
| 249 | * but all paths fail and recover just with the same sequence and timing as |
| 250 | * we try to use them (flapping links). |
| 251 | * If all alternate paths have been tried twice, the request is posted with |
| 252 | * a permanent error. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | * |
| 254 | * PARAMETER |
| 255 | * erp pointer to the current ERP |
| 256 | * |
| 257 | * RETURN VALUES |
| 258 | * erp pointer to the ERP |
| 259 | * |
| 260 | */ |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 261 | static struct dasd_ccw_req *dasd_3990_erp_action_1_sec(struct dasd_ccw_req *erp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | { |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 263 | erp->function = dasd_3990_erp_action_1_sec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | dasd_3990_erp_alternate_path(erp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | return erp; |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 266 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 268 | static struct dasd_ccw_req *dasd_3990_erp_action_1(struct dasd_ccw_req *erp) |
| 269 | { |
| 270 | erp->function = dasd_3990_erp_action_1; |
| 271 | dasd_3990_erp_alternate_path(erp); |
Stefan Weinhuber | a4d26c6 | 2011-01-05 12:48:03 +0100 | [diff] [blame] | 272 | if (erp->status == DASD_CQR_FAILED && |
| 273 | !test_bit(DASD_CQR_VERIFY_PATH, &erp->flags)) { |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 274 | erp->status = DASD_CQR_FILLED; |
| 275 | erp->retries = 10; |
Stefan Haberland | c934615 | 2016-08-08 15:53:54 +0200 | [diff] [blame] | 276 | erp->lpm = dasd_path_get_opm(erp->startdev); |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 277 | erp->function = dasd_3990_erp_action_1_sec; |
| 278 | } |
| 279 | return erp; |
| 280 | } /* end dasd_3990_erp_action_1(b) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
| 282 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 283 | * DASD_3990_ERP_ACTION_4 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | * |
| 285 | * DESCRIPTION |
| 286 | * Setup ERP to do the ERP action 4 (see Reference manual). |
| 287 | * Set the current request to PENDING to block the CQR queue for that device |
| 288 | * until the state change interrupt appears. |
| 289 | * Use a timer (20 seconds) to retry the cqr if the interrupt is still |
| 290 | * missing. |
| 291 | * |
| 292 | * PARAMETER |
| 293 | * sense sense data of the actual error |
| 294 | * erp pointer to the current ERP |
| 295 | * |
| 296 | * RETURN VALUES |
| 297 | * erp pointer to the ERP |
| 298 | * |
| 299 | */ |
| 300 | static struct dasd_ccw_req * |
| 301 | dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) |
| 302 | { |
| 303 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 304 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* first time set initial retry counter and erp_function */ |
| 307 | /* and retry once without waiting for state change pending */ |
| 308 | /* interrupt (this enables easier enqueing of the cqr) */ |
| 309 | if (erp->function != dasd_3990_erp_action_4) { |
| 310 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 311 | DBF_DEV_EVENT(DBF_INFO, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | "dasd_3990_erp_action_4: first time retry"); |
| 313 | |
| 314 | erp->retries = 256; |
| 315 | erp->function = dasd_3990_erp_action_4; |
| 316 | |
| 317 | } else { |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 318 | if (sense && (sense[25] == 0x1D)) { /* state change pending */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 320 | DBF_DEV_EVENT(DBF_INFO, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | "waiting for state change pending " |
| 322 | "interrupt, %d retries left", |
| 323 | erp->retries); |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | dasd_3990_erp_block_queue(erp, 30*HZ); |
| 326 | |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 327 | } else if (sense && (sense[25] == 0x1E)) { /* busy */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 328 | DBF_DEV_EVENT(DBF_INFO, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | "busy - redriving request later, " |
| 330 | "%d retries left", |
| 331 | erp->retries); |
| 332 | dasd_3990_erp_block_queue(erp, HZ); |
| 333 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | /* no state change pending - retry */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 335 | DBF_DEV_EVENT(DBF_INFO, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | "redriving request immediately, " |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 337 | "%d retries left", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | erp->retries); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 339 | erp->status = DASD_CQR_FILLED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | } |
| 341 | } |
| 342 | |
| 343 | return erp; |
| 344 | |
| 345 | } /* end dasd_3990_erp_action_4 */ |
| 346 | |
| 347 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 348 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | * 24 byte sense ERP functions (only) |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 350 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | */ |
| 352 | |
| 353 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 354 | * DASD_3990_ERP_ACTION_5 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | * |
| 356 | * DESCRIPTION |
| 357 | * Setup ERP to do the ERP action 5 (see Reference manual). |
| 358 | * NOTE: Further handling is done in xxx_further_erp after the retries. |
| 359 | * |
| 360 | * PARAMETER |
| 361 | * erp pointer to the current ERP |
| 362 | * |
| 363 | * RETURN VALUES |
| 364 | * erp pointer to the ERP |
| 365 | * |
| 366 | */ |
| 367 | static struct dasd_ccw_req * |
| 368 | dasd_3990_erp_action_5(struct dasd_ccw_req * erp) |
| 369 | { |
| 370 | |
| 371 | /* first of all retry */ |
| 372 | erp->retries = 10; |
| 373 | erp->function = dasd_3990_erp_action_5; |
| 374 | |
| 375 | return erp; |
| 376 | |
| 377 | } /* end dasd_3990_erp_action_5 */ |
| 378 | |
| 379 | /* |
| 380 | * DASD_3990_HANDLE_ENV_DATA |
| 381 | * |
| 382 | * DESCRIPTION |
| 383 | * Handles 24 byte 'Environmental data present'. |
| 384 | * Does a analysis of the sense data (message Format) |
| 385 | * and prints the error messages. |
| 386 | * |
| 387 | * PARAMETER |
| 388 | * sense current sense data |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 389 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | * RETURN VALUES |
| 391 | * void |
| 392 | */ |
| 393 | static void |
| 394 | dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) |
| 395 | { |
| 396 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 397 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | char msg_format = (sense[7] & 0xF0); |
| 399 | char msg_no = (sense[7] & 0x0F); |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 400 | char errorstring[ERRORLENGTH]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | |
| 402 | switch (msg_format) { |
| 403 | case 0x00: /* Format 0 - Program or System Checks */ |
| 404 | |
| 405 | if (sense[1] & 0x10) { /* check message to operator bit */ |
| 406 | |
| 407 | switch (msg_no) { |
| 408 | case 0x00: /* No Message */ |
| 409 | break; |
| 410 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 411 | dev_warn(&device->cdev->dev, |
| 412 | "FORMAT 0 - Invalid Command\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | break; |
| 414 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 415 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | "FORMAT 0 - Invalid Command " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 417 | "Sequence\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | break; |
| 419 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 420 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | "FORMAT 0 - CCW Count less than " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 422 | "required\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | break; |
| 424 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 425 | dev_warn(&device->cdev->dev, |
| 426 | "FORMAT 0 - Invalid Parameter\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | break; |
| 428 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 429 | dev_warn(&device->cdev->dev, |
| 430 | "FORMAT 0 - Diagnostic of Special" |
| 431 | " Command Violates File Mask\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 432 | break; |
| 433 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 434 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | "FORMAT 0 - Channel Returned with " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 436 | "Incorrect retry CCW\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | break; |
| 438 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 439 | dev_warn(&device->cdev->dev, |
| 440 | "FORMAT 0 - Reset Notification\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | break; |
| 442 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 443 | dev_warn(&device->cdev->dev, |
| 444 | "FORMAT 0 - Storage Path Restart\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | break; |
| 446 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 447 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | "FORMAT 0 - Channel requested " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 449 | "... %02x\n", sense[8]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | break; |
| 451 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 452 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | "FORMAT 0 - Invalid Defective/" |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 454 | "Alternate Track Pointer\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | break; |
| 456 | case 0x0C: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 457 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | "FORMAT 0 - DPS Installation " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 459 | "Check\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | break; |
| 461 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 462 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | "FORMAT 0 - Command Invalid on " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 464 | "Secondary Address\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | break; |
| 466 | case 0x0F: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 467 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | "FORMAT 0 - Status Not As " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 469 | "Required: reason %02x\n", |
| 470 | sense[8]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 471 | break; |
| 472 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 473 | dev_warn(&device->cdev->dev, |
| 474 | "FORMAT 0 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | } |
| 476 | } else { |
| 477 | switch (msg_no) { |
| 478 | case 0x00: /* No Message */ |
| 479 | break; |
| 480 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 481 | dev_warn(&device->cdev->dev, |
| 482 | "FORMAT 0 - Device Error " |
| 483 | "Source\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | break; |
| 485 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 486 | dev_warn(&device->cdev->dev, |
| 487 | "FORMAT 0 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | break; |
| 489 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 490 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | "FORMAT 0 - Device Fenced - " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 492 | "device = %02x\n", sense[4]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | break; |
| 494 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 495 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | "FORMAT 0 - Data Pinned for " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 497 | "Device\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | break; |
| 499 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 500 | dev_warn(&device->cdev->dev, |
| 501 | "FORMAT 0 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | } |
| 503 | } |
| 504 | break; |
| 505 | |
| 506 | case 0x10: /* Format 1 - Device Equipment Checks */ |
| 507 | switch (msg_no) { |
| 508 | case 0x00: /* No Message */ |
| 509 | break; |
| 510 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 511 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | "FORMAT 1 - Device Status 1 not as " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 513 | "expected\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | break; |
| 515 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 516 | dev_warn(&device->cdev->dev, |
| 517 | "FORMAT 1 - Index missing\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | break; |
| 519 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 520 | dev_warn(&device->cdev->dev, |
| 521 | "FORMAT 1 - Interruption cannot be " |
| 522 | "reset\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | break; |
| 524 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 525 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | "FORMAT 1 - Device did not respond to " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 527 | "selection\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | break; |
| 529 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 530 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | "FORMAT 1 - Device check-2 error or Set " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 532 | "Sector is not complete\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | break; |
| 534 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 535 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | "FORMAT 1 - Head address does not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 537 | "compare\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | break; |
| 539 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 540 | dev_warn(&device->cdev->dev, |
| 541 | "FORMAT 1 - Device status 1 not valid\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | break; |
| 543 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 544 | dev_warn(&device->cdev->dev, |
| 545 | "FORMAT 1 - Device not ready\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | break; |
| 547 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 548 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | "FORMAT 1 - Track physical address did " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 550 | "not compare\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | break; |
| 552 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 553 | dev_warn(&device->cdev->dev, |
| 554 | "FORMAT 1 - Missing device address bit\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | break; |
| 556 | case 0x0C: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 557 | dev_warn(&device->cdev->dev, |
| 558 | "FORMAT 1 - Drive motor switch is off\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 559 | break; |
| 560 | case 0x0D: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 561 | dev_warn(&device->cdev->dev, |
| 562 | "FORMAT 1 - Seek incomplete\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | break; |
| 564 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 565 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | "FORMAT 1 - Cylinder address did not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 567 | "compare\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | break; |
| 569 | case 0x0F: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 570 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | "FORMAT 1 - Offset active cannot be " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 572 | "reset\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | break; |
| 574 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 575 | dev_warn(&device->cdev->dev, |
| 576 | "FORMAT 1 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | } |
| 578 | break; |
| 579 | |
| 580 | case 0x20: /* Format 2 - 3990 Equipment Checks */ |
| 581 | switch (msg_no) { |
| 582 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 583 | dev_warn(&device->cdev->dev, |
| 584 | "FORMAT 2 - 3990 check-2 error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 585 | break; |
| 586 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 587 | dev_warn(&device->cdev->dev, |
| 588 | "FORMAT 2 - Support facility errors\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | break; |
| 590 | case 0x0F: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 591 | dev_warn(&device->cdev->dev, |
| 592 | "FORMAT 2 - Microcode detected error " |
| 593 | "%02x\n", |
| 594 | sense[8]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 595 | break; |
| 596 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 597 | dev_warn(&device->cdev->dev, |
| 598 | "FORMAT 2 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | } |
| 600 | break; |
| 601 | |
| 602 | case 0x30: /* Format 3 - 3990 Control Checks */ |
| 603 | switch (msg_no) { |
| 604 | case 0x0F: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 605 | dev_warn(&device->cdev->dev, |
| 606 | "FORMAT 3 - Allegiance terminated\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 607 | break; |
| 608 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 609 | dev_warn(&device->cdev->dev, |
| 610 | "FORMAT 3 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | } |
| 612 | break; |
| 613 | |
| 614 | case 0x40: /* Format 4 - Data Checks */ |
| 615 | switch (msg_no) { |
| 616 | case 0x00: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 617 | dev_warn(&device->cdev->dev, |
| 618 | "FORMAT 4 - Home address area error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | break; |
| 620 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 621 | dev_warn(&device->cdev->dev, |
| 622 | "FORMAT 4 - Count area error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | break; |
| 624 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 625 | dev_warn(&device->cdev->dev, |
| 626 | "FORMAT 4 - Key area error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 627 | break; |
| 628 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 629 | dev_warn(&device->cdev->dev, |
| 630 | "FORMAT 4 - Data area error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | break; |
| 632 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 633 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 634 | "FORMAT 4 - No sync byte in home address " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 635 | "area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | break; |
| 637 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 638 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 639 | "FORMAT 4 - No sync byte in count address " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 640 | "area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | break; |
| 642 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 643 | dev_warn(&device->cdev->dev, |
| 644 | "FORMAT 4 - No sync byte in key area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | break; |
| 646 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 647 | dev_warn(&device->cdev->dev, |
| 648 | "FORMAT 4 - No sync byte in data area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | break; |
| 650 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 651 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | "FORMAT 4 - Home address area error; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 653 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | break; |
| 655 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 656 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | "FORMAT 4 - Count area error; offset " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 658 | "active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | break; |
| 660 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 661 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | "FORMAT 4 - Key area error; offset " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 663 | "active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | break; |
| 665 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 666 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | "FORMAT 4 - Data area error; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 668 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | break; |
| 670 | case 0x0C: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 671 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 672 | "FORMAT 4 - No sync byte in home " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 673 | "address area; offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 674 | break; |
| 675 | case 0x0D: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 676 | dev_warn(&device->cdev->dev, |
Stefan Haberland | 50cff5a | 2016-11-18 14:39:05 +0100 | [diff] [blame] | 677 | "FORMAT 4 - No sync byte in count " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 678 | "address area; offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 679 | break; |
| 680 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 681 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | "FORMAT 4 - No sync byte in key area; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 683 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | break; |
| 685 | case 0x0F: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 686 | dev_warn(&device->cdev->dev, |
Stefan Haberland | 50cff5a | 2016-11-18 14:39:05 +0100 | [diff] [blame] | 687 | "FORMAT 4 - No sync byte in data area; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 688 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | break; |
| 690 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 691 | dev_warn(&device->cdev->dev, |
| 692 | "FORMAT 4 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | } |
| 694 | break; |
| 695 | |
| 696 | case 0x50: /* Format 5 - Data Check with displacement information */ |
| 697 | switch (msg_no) { |
| 698 | case 0x00: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 699 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 700 | "FORMAT 5 - Data Check in the " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 701 | "home address area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | break; |
| 703 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 704 | dev_warn(&device->cdev->dev, |
| 705 | "FORMAT 5 - Data Check in the count " |
| 706 | "area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | break; |
| 708 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 709 | dev_warn(&device->cdev->dev, |
| 710 | "FORMAT 5 - Data Check in the key area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | break; |
| 712 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 713 | dev_warn(&device->cdev->dev, |
| 714 | "FORMAT 5 - Data Check in the data " |
| 715 | "area\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 716 | break; |
| 717 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 718 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | "FORMAT 5 - Data Check in the " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 720 | "home address area; offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | break; |
| 722 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 723 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | "FORMAT 5 - Data Check in the count area; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 725 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | break; |
| 727 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 728 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | "FORMAT 5 - Data Check in the key area; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 730 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | break; |
| 732 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 733 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 734 | "FORMAT 5 - Data Check in the data area; " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 735 | "offset active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | break; |
| 737 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 738 | dev_warn(&device->cdev->dev, |
| 739 | "FORMAT 5 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 740 | } |
| 741 | break; |
| 742 | |
| 743 | case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */ |
| 744 | switch (msg_no) { |
| 745 | case 0x00: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 746 | dev_warn(&device->cdev->dev, |
| 747 | "FORMAT 6 - Overrun on channel A\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | break; |
| 749 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 750 | dev_warn(&device->cdev->dev, |
| 751 | "FORMAT 6 - Overrun on channel B\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 752 | break; |
| 753 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 754 | dev_warn(&device->cdev->dev, |
| 755 | "FORMAT 6 - Overrun on channel C\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 756 | break; |
| 757 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 758 | dev_warn(&device->cdev->dev, |
| 759 | "FORMAT 6 - Overrun on channel D\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 760 | break; |
| 761 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 762 | dev_warn(&device->cdev->dev, |
| 763 | "FORMAT 6 - Overrun on channel E\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 764 | break; |
| 765 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 766 | dev_warn(&device->cdev->dev, |
| 767 | "FORMAT 6 - Overrun on channel F\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 768 | break; |
| 769 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 770 | dev_warn(&device->cdev->dev, |
| 771 | "FORMAT 6 - Overrun on channel G\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 772 | break; |
| 773 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 774 | dev_warn(&device->cdev->dev, |
| 775 | "FORMAT 6 - Overrun on channel H\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 776 | break; |
| 777 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 778 | dev_warn(&device->cdev->dev, |
| 779 | "FORMAT 6 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | } |
| 781 | break; |
| 782 | |
| 783 | case 0x70: /* Format 7 - Device Connection Control Checks */ |
| 784 | switch (msg_no) { |
| 785 | case 0x00: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 786 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 787 | "FORMAT 7 - RCC initiated by a connection " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 788 | "check alert\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 789 | break; |
| 790 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 791 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | "FORMAT 7 - RCC 1 sequence not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 793 | "successful\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | break; |
| 795 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 796 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | "FORMAT 7 - RCC 1 and RCC 2 sequences not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 798 | "successful\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 799 | break; |
| 800 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 801 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 802 | "FORMAT 7 - Invalid tag-in during " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 803 | "selection sequence\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | break; |
| 805 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 806 | dev_warn(&device->cdev->dev, |
| 807 | "FORMAT 7 - extra RCC required\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 808 | break; |
| 809 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 810 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 811 | "FORMAT 7 - Invalid DCC selection " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 812 | "response or timeout\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 813 | break; |
| 814 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 815 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 816 | "FORMAT 7 - Missing end operation; device " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 817 | "transfer complete\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 818 | break; |
| 819 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 820 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 821 | "FORMAT 7 - Missing end operation; device " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 822 | "transfer incomplete\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 823 | break; |
| 824 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 825 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 826 | "FORMAT 7 - Invalid tag-in for an " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 827 | "immediate command sequence\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 828 | break; |
| 829 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 830 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 831 | "FORMAT 7 - Invalid tag-in for an " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 832 | "extended command sequence\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 833 | break; |
| 834 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 835 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 836 | "FORMAT 7 - 3990 microcode time out when " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 837 | "stopping selection\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 838 | break; |
| 839 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 840 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 841 | "FORMAT 7 - No response to selection " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 842 | "after a poll interruption\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | break; |
| 844 | case 0x0C: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 845 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 846 | "FORMAT 7 - Permanent path error (DASD " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 847 | "controller not available)\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 848 | break; |
| 849 | case 0x0D: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 850 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | "FORMAT 7 - DASD controller not available" |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 852 | " on disconnected command chain\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 853 | break; |
| 854 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 855 | dev_warn(&device->cdev->dev, |
| 856 | "FORMAT 7 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 857 | } |
| 858 | break; |
| 859 | |
| 860 | case 0x80: /* Format 8 - Additional Device Equipment Checks */ |
| 861 | switch (msg_no) { |
| 862 | case 0x00: /* No Message */ |
| 863 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 864 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 865 | "FORMAT 8 - Error correction code " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 866 | "hardware fault\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | break; |
| 868 | case 0x03: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 869 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 870 | "FORMAT 8 - Unexpected end operation " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 871 | "response code\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 872 | break; |
| 873 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 874 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 875 | "FORMAT 8 - End operation with transfer " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 876 | "count not zero\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 877 | break; |
| 878 | case 0x05: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 879 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 880 | "FORMAT 8 - End operation with transfer " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 881 | "count zero\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 882 | break; |
| 883 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 884 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 885 | "FORMAT 8 - DPS checks after a system " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 886 | "reset or selective reset\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 887 | break; |
| 888 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 889 | dev_warn(&device->cdev->dev, |
| 890 | "FORMAT 8 - DPS cannot be filled\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 891 | break; |
| 892 | case 0x08: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 893 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 894 | "FORMAT 8 - Short busy time-out during " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 895 | "device selection\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 896 | break; |
| 897 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 898 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 899 | "FORMAT 8 - DASD controller failed to " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 900 | "set or reset the long busy latch\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 901 | break; |
| 902 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 903 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 904 | "FORMAT 8 - No interruption from device " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 905 | "during a command chain\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 906 | break; |
| 907 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 908 | dev_warn(&device->cdev->dev, |
| 909 | "FORMAT 8 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | } |
| 911 | break; |
| 912 | |
| 913 | case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */ |
| 914 | switch (msg_no) { |
| 915 | case 0x00: |
| 916 | break; /* No Message */ |
| 917 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 918 | dev_warn(&device->cdev->dev, |
| 919 | "FORMAT 9 - Device check-2 error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 920 | break; |
| 921 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 922 | dev_warn(&device->cdev->dev, |
| 923 | "FORMAT 9 - Head address did not " |
| 924 | "compare\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 925 | break; |
| 926 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 927 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 928 | "FORMAT 9 - Track physical address did " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 929 | "not compare while oriented\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 930 | break; |
| 931 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 932 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 933 | "FORMAT 9 - Cylinder address did not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 934 | "compare\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 935 | break; |
| 936 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 937 | dev_warn(&device->cdev->dev, |
| 938 | "FORMAT 9 - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 939 | } |
| 940 | break; |
| 941 | |
| 942 | case 0xF0: /* Format F - Cache Storage Checks */ |
| 943 | switch (msg_no) { |
| 944 | case 0x00: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 945 | dev_warn(&device->cdev->dev, |
| 946 | "FORMAT F - Operation Terminated\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 947 | break; |
| 948 | case 0x01: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 949 | dev_warn(&device->cdev->dev, |
| 950 | "FORMAT F - Subsystem Processing Error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 951 | break; |
| 952 | case 0x02: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 953 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | "FORMAT F - Cache or nonvolatile storage " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 955 | "equipment failure\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 956 | break; |
| 957 | case 0x04: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 958 | dev_warn(&device->cdev->dev, |
| 959 | "FORMAT F - Caching terminated\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 960 | break; |
| 961 | case 0x06: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 962 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 963 | "FORMAT F - Cache fast write access not " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 964 | "authorized\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 965 | break; |
| 966 | case 0x07: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 967 | dev_warn(&device->cdev->dev, |
| 968 | "FORMAT F - Track format incorrect\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 969 | break; |
| 970 | case 0x09: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 971 | dev_warn(&device->cdev->dev, |
| 972 | "FORMAT F - Caching reinitiated\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 973 | break; |
| 974 | case 0x0A: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 975 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 976 | "FORMAT F - Nonvolatile storage " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 977 | "terminated\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 978 | break; |
| 979 | case 0x0B: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 980 | dev_warn(&device->cdev->dev, |
| 981 | "FORMAT F - Volume is suspended duplex\n"); |
Stefan Weinhuber | 20c6446 | 2006-03-24 03:15:25 -0800 | [diff] [blame] | 982 | /* call extended error reporting (EER) */ |
| 983 | dasd_eer_write(device, erp->refers, |
| 984 | DASD_EER_PPRCSUSPEND); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | break; |
| 986 | case 0x0C: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 987 | dev_warn(&device->cdev->dev, |
| 988 | "FORMAT F - Subsystem status cannot be " |
| 989 | "determined\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 990 | break; |
| 991 | case 0x0D: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 992 | dev_warn(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 993 | "FORMAT F - Caching status reset to " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 994 | "default\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 995 | break; |
| 996 | case 0x0E: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 997 | dev_warn(&device->cdev->dev, |
| 998 | "FORMAT F - DASD Fast Write inhibited\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 999 | break; |
| 1000 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1001 | dev_warn(&device->cdev->dev, |
Stefan Haberland | 50cff5a | 2016-11-18 14:39:05 +0100 | [diff] [blame] | 1002 | "FORMAT F - Reserved\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1003 | } |
| 1004 | break; |
| 1005 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1006 | default: /* unknown message format - should not happen |
| 1007 | internal error 03 - unknown message format */ |
| 1008 | snprintf(errorstring, ERRORLENGTH, "03 %x02", msg_format); |
| 1009 | dev_err(&device->cdev->dev, |
| 1010 | "An error occurred in the DASD device driver, " |
| 1011 | "reason=%s\n", errorstring); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1012 | break; |
| 1013 | } /* end switch message format */ |
| 1014 | |
| 1015 | } /* end dasd_3990_handle_env_data */ |
| 1016 | |
| 1017 | /* |
| 1018 | * DASD_3990_ERP_COM_REJ |
| 1019 | * |
| 1020 | * DESCRIPTION |
| 1021 | * Handles 24 byte 'Command Reject' error. |
| 1022 | * |
| 1023 | * PARAMETER |
| 1024 | * erp current erp_head |
| 1025 | * sense current sense data |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1026 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1027 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1028 | * erp 'new' erp_head - pointer to new ERP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1029 | */ |
| 1030 | static struct dasd_ccw_req * |
| 1031 | dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) |
| 1032 | { |
| 1033 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1034 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1035 | |
| 1036 | erp->function = dasd_3990_erp_com_rej; |
| 1037 | |
| 1038 | /* env data present (ACTION 10 - retry should work) */ |
| 1039 | if (sense[2] & SNS2_ENV_DATA_PRESENT) { |
| 1040 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1041 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1042 | "Command Reject - environmental data present"); |
| 1043 | |
| 1044 | dasd_3990_handle_env_data(erp, sense); |
| 1045 | |
| 1046 | erp->retries = 5; |
| 1047 | |
Stefan Weinhuber | 33b62a3 | 2010-03-08 12:26:24 +0100 | [diff] [blame] | 1048 | } else if (sense[1] & SNS1_WRITE_INHIBITED) { |
| 1049 | dev_err(&device->cdev->dev, "An I/O request was rejected" |
| 1050 | " because writing is inhibited\n"); |
| 1051 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1052 | } else { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1053 | /* fatal error - set status to FAILED |
| 1054 | internal error 09 - Command Reject */ |
Stefan Haberland | ab24fbd | 2017-03-22 11:06:20 +0100 | [diff] [blame] | 1055 | if (!test_bit(DASD_CQR_SUPPRESS_CR, &erp->flags)) |
| 1056 | dev_err(&device->cdev->dev, |
| 1057 | "An error occurred in the DASD device driver, reason=09\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1058 | |
| 1059 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 1060 | } |
| 1061 | |
| 1062 | return erp; |
| 1063 | |
| 1064 | } /* end dasd_3990_erp_com_rej */ |
| 1065 | |
| 1066 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1067 | * DASD_3990_ERP_BUS_OUT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1068 | * |
| 1069 | * DESCRIPTION |
| 1070 | * Handles 24 byte 'Bus Out Parity Check' error. |
| 1071 | * |
| 1072 | * PARAMETER |
| 1073 | * erp current erp_head |
| 1074 | * RETURN VALUES |
| 1075 | * erp new erp_head - pointer to new ERP |
| 1076 | */ |
| 1077 | static struct dasd_ccw_req * |
| 1078 | dasd_3990_erp_bus_out(struct dasd_ccw_req * erp) |
| 1079 | { |
| 1080 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1081 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1082 | |
| 1083 | /* first time set initial retry counter and erp_function */ |
| 1084 | /* and retry once without blocking queue */ |
| 1085 | /* (this enables easier enqueing of the cqr) */ |
| 1086 | if (erp->function != dasd_3990_erp_bus_out) { |
| 1087 | erp->retries = 256; |
| 1088 | erp->function = dasd_3990_erp_bus_out; |
| 1089 | |
| 1090 | } else { |
| 1091 | |
| 1092 | /* issue a message and wait for 'device ready' interrupt */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1093 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1094 | "bus out parity error or BOPC requested by " |
| 1095 | "channel"); |
| 1096 | |
| 1097 | dasd_3990_erp_block_queue(erp, 60*HZ); |
| 1098 | |
| 1099 | } |
| 1100 | |
| 1101 | return erp; |
| 1102 | |
| 1103 | } /* end dasd_3990_erp_bus_out */ |
| 1104 | |
| 1105 | /* |
| 1106 | * DASD_3990_ERP_EQUIP_CHECK |
| 1107 | * |
| 1108 | * DESCRIPTION |
| 1109 | * Handles 24 byte 'Equipment Check' error. |
| 1110 | * |
| 1111 | * PARAMETER |
| 1112 | * erp current erp_head |
| 1113 | * RETURN VALUES |
| 1114 | * erp new erp_head - pointer to new ERP |
| 1115 | */ |
| 1116 | static struct dasd_ccw_req * |
| 1117 | dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense) |
| 1118 | { |
| 1119 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1120 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1121 | |
| 1122 | erp->function = dasd_3990_erp_equip_check; |
| 1123 | |
| 1124 | if (sense[1] & SNS1_WRITE_INHIBITED) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1125 | dev_info(&device->cdev->dev, |
| 1126 | "Write inhibited path encountered\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1127 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1128 | /* vary path offline |
| 1129 | internal error 04 - Path should be varied off-line.*/ |
| 1130 | dev_err(&device->cdev->dev, "An error occurred in the DASD " |
| 1131 | "device driver, reason=%s\n", "04"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1132 | |
| 1133 | erp = dasd_3990_erp_action_1(erp); |
| 1134 | |
| 1135 | } else if (sense[2] & SNS2_ENV_DATA_PRESENT) { |
| 1136 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1137 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1138 | "Equipment Check - " "environmental data present"); |
| 1139 | |
| 1140 | dasd_3990_handle_env_data(erp, sense); |
| 1141 | |
| 1142 | erp = dasd_3990_erp_action_4(erp, sense); |
| 1143 | |
| 1144 | } else if (sense[1] & SNS1_PERM_ERR) { |
| 1145 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1146 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1147 | "Equipment Check - retry exhausted or " |
| 1148 | "undesirable"); |
| 1149 | |
| 1150 | erp = dasd_3990_erp_action_1(erp); |
| 1151 | |
| 1152 | } else { |
| 1153 | /* all other equipment checks - Action 5 */ |
| 1154 | /* rest is done when retries == 0 */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1155 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1156 | "Equipment check or processing error"); |
| 1157 | |
| 1158 | erp = dasd_3990_erp_action_5(erp); |
| 1159 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1160 | return erp; |
| 1161 | |
| 1162 | } /* end dasd_3990_erp_equip_check */ |
| 1163 | |
| 1164 | /* |
| 1165 | * DASD_3990_ERP_DATA_CHECK |
| 1166 | * |
| 1167 | * DESCRIPTION |
| 1168 | * Handles 24 byte 'Data Check' error. |
| 1169 | * |
| 1170 | * PARAMETER |
| 1171 | * erp current erp_head |
| 1172 | * RETURN VALUES |
| 1173 | * erp new erp_head - pointer to new ERP |
| 1174 | */ |
| 1175 | static struct dasd_ccw_req * |
| 1176 | dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense) |
| 1177 | { |
| 1178 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1179 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1180 | |
| 1181 | erp->function = dasd_3990_erp_data_check; |
| 1182 | |
| 1183 | if (sense[2] & SNS2_CORRECTABLE) { /* correctable data check */ |
| 1184 | |
| 1185 | /* issue message that the data has been corrected */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1186 | dev_emerg(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1187 | "Data recovered during retry with PCI " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1188 | "fetch mode active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1189 | |
| 1190 | /* not possible to handle this situation in Linux */ |
| 1191 | panic("No way to inform application about the possibly " |
| 1192 | "incorrect data"); |
| 1193 | |
| 1194 | } else if (sense[2] & SNS2_ENV_DATA_PRESENT) { |
| 1195 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1196 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1197 | "Uncorrectable data check recovered secondary " |
| 1198 | "addr of duplex pair"); |
| 1199 | |
| 1200 | erp = dasd_3990_erp_action_4(erp, sense); |
| 1201 | |
| 1202 | } else if (sense[1] & SNS1_PERM_ERR) { |
| 1203 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1204 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1205 | "Uncorrectable data check with internal " |
| 1206 | "retry exhausted"); |
| 1207 | |
| 1208 | erp = dasd_3990_erp_action_1(erp); |
| 1209 | |
| 1210 | } else { |
| 1211 | /* all other data checks */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1212 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1213 | "Uncorrectable data check with retry count " |
| 1214 | "exhausted..."); |
| 1215 | |
| 1216 | erp = dasd_3990_erp_action_5(erp); |
| 1217 | } |
| 1218 | |
| 1219 | return erp; |
| 1220 | |
| 1221 | } /* end dasd_3990_erp_data_check */ |
| 1222 | |
| 1223 | /* |
| 1224 | * DASD_3990_ERP_OVERRUN |
| 1225 | * |
| 1226 | * DESCRIPTION |
| 1227 | * Handles 24 byte 'Overrun' error. |
| 1228 | * |
| 1229 | * PARAMETER |
| 1230 | * erp current erp_head |
| 1231 | * RETURN VALUES |
| 1232 | * erp new erp_head - pointer to new ERP |
| 1233 | */ |
| 1234 | static struct dasd_ccw_req * |
| 1235 | dasd_3990_erp_overrun(struct dasd_ccw_req * erp, char *sense) |
| 1236 | { |
| 1237 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1238 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1239 | |
| 1240 | erp->function = dasd_3990_erp_overrun; |
| 1241 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1243 | "Overrun - service overrun or overrun" |
| 1244 | " error requested by channel"); |
| 1245 | |
| 1246 | erp = dasd_3990_erp_action_5(erp); |
| 1247 | |
| 1248 | return erp; |
| 1249 | |
| 1250 | } /* end dasd_3990_erp_overrun */ |
| 1251 | |
| 1252 | /* |
| 1253 | * DASD_3990_ERP_INV_FORMAT |
| 1254 | * |
| 1255 | * DESCRIPTION |
| 1256 | * Handles 24 byte 'Invalid Track Format' error. |
| 1257 | * |
| 1258 | * PARAMETER |
| 1259 | * erp current erp_head |
| 1260 | * RETURN VALUES |
| 1261 | * erp new erp_head - pointer to new ERP |
| 1262 | */ |
| 1263 | static struct dasd_ccw_req * |
| 1264 | dasd_3990_erp_inv_format(struct dasd_ccw_req * erp, char *sense) |
| 1265 | { |
| 1266 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1267 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1268 | |
| 1269 | erp->function = dasd_3990_erp_inv_format; |
| 1270 | |
| 1271 | if (sense[2] & SNS2_ENV_DATA_PRESENT) { |
| 1272 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1273 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1274 | "Track format error when destaging or " |
| 1275 | "staging data"); |
| 1276 | |
| 1277 | dasd_3990_handle_env_data(erp, sense); |
| 1278 | |
| 1279 | erp = dasd_3990_erp_action_4(erp, sense); |
| 1280 | |
| 1281 | } else { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1282 | /* internal error 06 - The track format is not valid*/ |
| 1283 | dev_err(&device->cdev->dev, |
| 1284 | "An error occurred in the DASD device driver, " |
| 1285 | "reason=%s\n", "06"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1286 | |
| 1287 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 1288 | } |
| 1289 | |
| 1290 | return erp; |
| 1291 | |
| 1292 | } /* end dasd_3990_erp_inv_format */ |
| 1293 | |
| 1294 | /* |
| 1295 | * DASD_3990_ERP_EOC |
| 1296 | * |
| 1297 | * DESCRIPTION |
| 1298 | * Handles 24 byte 'End-of-Cylinder' error. |
| 1299 | * |
| 1300 | * PARAMETER |
| 1301 | * erp already added default erp |
| 1302 | * RETURN VALUES |
| 1303 | * erp pointer to original (failed) cqr. |
| 1304 | */ |
| 1305 | static struct dasd_ccw_req * |
| 1306 | dasd_3990_erp_EOC(struct dasd_ccw_req * default_erp, char *sense) |
| 1307 | { |
| 1308 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1309 | struct dasd_device *device = default_erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1310 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1311 | dev_err(&device->cdev->dev, |
| 1312 | "The cylinder data for accessing the DASD is inconsistent\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1313 | |
| 1314 | /* implement action 7 - BUG */ |
| 1315 | return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); |
| 1316 | |
| 1317 | } /* end dasd_3990_erp_EOC */ |
| 1318 | |
| 1319 | /* |
| 1320 | * DASD_3990_ERP_ENV_DATA |
| 1321 | * |
| 1322 | * DESCRIPTION |
| 1323 | * Handles 24 byte 'Environmental-Data Present' error. |
| 1324 | * |
| 1325 | * PARAMETER |
| 1326 | * erp current erp_head |
| 1327 | * RETURN VALUES |
| 1328 | * erp new erp_head - pointer to new ERP |
| 1329 | */ |
| 1330 | static struct dasd_ccw_req * |
| 1331 | dasd_3990_erp_env_data(struct dasd_ccw_req * erp, char *sense) |
| 1332 | { |
| 1333 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1334 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1335 | |
| 1336 | erp->function = dasd_3990_erp_env_data; |
| 1337 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1338 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Environmental data present"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1339 | |
| 1340 | dasd_3990_handle_env_data(erp, sense); |
| 1341 | |
| 1342 | /* don't retry on disabled interface */ |
| 1343 | if (sense[7] != 0x0F) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1344 | erp = dasd_3990_erp_action_4(erp, sense); |
| 1345 | } else { |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1346 | erp->status = DASD_CQR_FILLED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | return erp; |
| 1350 | |
| 1351 | } /* end dasd_3990_erp_env_data */ |
| 1352 | |
| 1353 | /* |
| 1354 | * DASD_3990_ERP_NO_REC |
| 1355 | * |
| 1356 | * DESCRIPTION |
| 1357 | * Handles 24 byte 'No Record Found' error. |
| 1358 | * |
| 1359 | * PARAMETER |
| 1360 | * erp already added default ERP |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1361 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1362 | * RETURN VALUES |
| 1363 | * erp new erp_head - pointer to new ERP |
| 1364 | */ |
| 1365 | static struct dasd_ccw_req * |
| 1366 | dasd_3990_erp_no_rec(struct dasd_ccw_req * default_erp, char *sense) |
| 1367 | { |
| 1368 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1369 | struct dasd_device *device = default_erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1370 | |
Jan Höppner | 8fd5752 | 2015-08-19 13:41:20 +0200 | [diff] [blame] | 1371 | /* |
| 1372 | * In some cases the 'No Record Found' error might be expected and |
| 1373 | * log messages shouldn't be written then. |
| 1374 | * Check if the according suppress bit is set. |
| 1375 | */ |
| 1376 | if (!test_bit(DASD_CQR_SUPPRESS_NRF, &default_erp->flags)) |
| 1377 | dev_err(&device->cdev->dev, |
| 1378 | "The specified record was not found\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1379 | |
| 1380 | return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); |
| 1381 | |
| 1382 | } /* end dasd_3990_erp_no_rec */ |
| 1383 | |
| 1384 | /* |
| 1385 | * DASD_3990_ERP_FILE_PROT |
| 1386 | * |
| 1387 | * DESCRIPTION |
| 1388 | * Handles 24 byte 'File Protected' error. |
| 1389 | * Note: Seek related recovery is not implemented because |
| 1390 | * wee don't use the seek command yet. |
| 1391 | * |
| 1392 | * PARAMETER |
| 1393 | * erp current erp_head |
| 1394 | * RETURN VALUES |
| 1395 | * erp new erp_head - pointer to new ERP |
| 1396 | */ |
| 1397 | static struct dasd_ccw_req * |
| 1398 | dasd_3990_erp_file_prot(struct dasd_ccw_req * erp) |
| 1399 | { |
| 1400 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1401 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1402 | |
Jan Höppner | 8fd5752 | 2015-08-19 13:41:20 +0200 | [diff] [blame] | 1403 | /* |
| 1404 | * In some cases the 'File Protected' error might be expected and |
| 1405 | * log messages shouldn't be written then. |
| 1406 | * Check if the according suppress bit is set. |
| 1407 | */ |
| 1408 | if (!test_bit(DASD_CQR_SUPPRESS_FP, &erp->flags)) |
| 1409 | dev_err(&device->cdev->dev, |
| 1410 | "Accessing the DASD failed because of a hardware error\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1411 | |
| 1412 | return dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 1413 | |
| 1414 | } /* end dasd_3990_erp_file_prot */ |
| 1415 | |
| 1416 | /* |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1417 | * DASD_3990_ERP_INSPECT_ALIAS |
| 1418 | * |
| 1419 | * DESCRIPTION |
| 1420 | * Checks if the original request was started on an alias device. |
| 1421 | * If yes, it modifies the original and the erp request so that |
| 1422 | * the erp request can be started on a base device. |
| 1423 | * |
| 1424 | * PARAMETER |
| 1425 | * erp pointer to the currently created default ERP |
| 1426 | * |
| 1427 | * RETURN VALUES |
| 1428 | * erp pointer to the modified ERP, or NULL |
| 1429 | */ |
| 1430 | |
| 1431 | static struct dasd_ccw_req *dasd_3990_erp_inspect_alias( |
| 1432 | struct dasd_ccw_req *erp) |
| 1433 | { |
| 1434 | struct dasd_ccw_req *cqr = erp->refers; |
Stefan Haberland | 501183f | 2010-05-17 10:00:10 +0200 | [diff] [blame] | 1435 | char *sense; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1436 | |
| 1437 | if (cqr->block && |
| 1438 | (cqr->block->base != cqr->startdev)) { |
Stefan Haberland | 501183f | 2010-05-17 10:00:10 +0200 | [diff] [blame] | 1439 | |
| 1440 | sense = dasd_get_sense(&erp->refers->irb); |
| 1441 | /* |
| 1442 | * dynamic pav may have changed base alias mapping |
| 1443 | */ |
| 1444 | if (!test_bit(DASD_FLAG_OFFLINE, &cqr->startdev->flags) && sense |
| 1445 | && (sense[0] == 0x10) && (sense[7] == 0x0F) |
| 1446 | && (sense[8] == 0x67)) { |
| 1447 | /* |
| 1448 | * remove device from alias handling to prevent new |
| 1449 | * requests from being scheduled on the |
| 1450 | * wrong alias device |
| 1451 | */ |
| 1452 | dasd_alias_remove_device(cqr->startdev); |
| 1453 | |
| 1454 | /* schedule worker to reload device */ |
| 1455 | dasd_reload_device(cqr->startdev); |
| 1456 | } |
| 1457 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1458 | if (cqr->startdev->features & DASD_FEATURE_ERPLOG) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1459 | DBF_DEV_EVENT(DBF_ERR, cqr->startdev, |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1460 | "ERP on alias device for request %p," |
| 1461 | " recover on base device %s", cqr, |
Kay Sievers | 2a0217d | 2008-10-10 21:33:09 +0200 | [diff] [blame] | 1462 | dev_name(&cqr->block->base->cdev->dev)); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1463 | } |
| 1464 | dasd_eckd_reset_ccw_to_base_io(cqr); |
| 1465 | erp->startdev = cqr->block->base; |
| 1466 | erp->function = dasd_3990_erp_inspect_alias; |
| 1467 | return erp; |
| 1468 | } else |
| 1469 | return NULL; |
| 1470 | } |
| 1471 | |
| 1472 | |
| 1473 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1474 | * DASD_3990_ERP_INSPECT_24 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1475 | * |
| 1476 | * DESCRIPTION |
| 1477 | * Does a detailed inspection of the 24 byte sense data |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1478 | * and sets up a related error recovery action. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1479 | * |
| 1480 | * PARAMETER |
| 1481 | * sense sense data of the actual error |
| 1482 | * erp pointer to the currently created default ERP |
| 1483 | * |
| 1484 | * RETURN VALUES |
| 1485 | * erp pointer to the (addtitional) ERP |
| 1486 | */ |
| 1487 | static struct dasd_ccw_req * |
| 1488 | dasd_3990_erp_inspect_24(struct dasd_ccw_req * erp, char *sense) |
| 1489 | { |
| 1490 | |
| 1491 | struct dasd_ccw_req *erp_filled = NULL; |
| 1492 | |
| 1493 | /* Check sense for .... */ |
| 1494 | /* 'Command Reject' */ |
| 1495 | if ((erp_filled == NULL) && (sense[0] & SNS0_CMD_REJECT)) { |
| 1496 | erp_filled = dasd_3990_erp_com_rej(erp, sense); |
| 1497 | } |
| 1498 | /* 'Intervention Required' */ |
| 1499 | if ((erp_filled == NULL) && (sense[0] & SNS0_INTERVENTION_REQ)) { |
| 1500 | erp_filled = dasd_3990_erp_int_req(erp); |
| 1501 | } |
| 1502 | /* 'Bus Out Parity Check' */ |
| 1503 | if ((erp_filled == NULL) && (sense[0] & SNS0_BUS_OUT_CHECK)) { |
| 1504 | erp_filled = dasd_3990_erp_bus_out(erp); |
| 1505 | } |
| 1506 | /* 'Equipment Check' */ |
| 1507 | if ((erp_filled == NULL) && (sense[0] & SNS0_EQUIPMENT_CHECK)) { |
| 1508 | erp_filled = dasd_3990_erp_equip_check(erp, sense); |
| 1509 | } |
| 1510 | /* 'Data Check' */ |
| 1511 | if ((erp_filled == NULL) && (sense[0] & SNS0_DATA_CHECK)) { |
| 1512 | erp_filled = dasd_3990_erp_data_check(erp, sense); |
| 1513 | } |
| 1514 | /* 'Overrun' */ |
| 1515 | if ((erp_filled == NULL) && (sense[0] & SNS0_OVERRUN)) { |
| 1516 | erp_filled = dasd_3990_erp_overrun(erp, sense); |
| 1517 | } |
| 1518 | /* 'Invalid Track Format' */ |
| 1519 | if ((erp_filled == NULL) && (sense[1] & SNS1_INV_TRACK_FORMAT)) { |
| 1520 | erp_filled = dasd_3990_erp_inv_format(erp, sense); |
| 1521 | } |
| 1522 | /* 'End-of-Cylinder' */ |
| 1523 | if ((erp_filled == NULL) && (sense[1] & SNS1_EOC)) { |
| 1524 | erp_filled = dasd_3990_erp_EOC(erp, sense); |
| 1525 | } |
| 1526 | /* 'Environmental Data' */ |
| 1527 | if ((erp_filled == NULL) && (sense[2] & SNS2_ENV_DATA_PRESENT)) { |
| 1528 | erp_filled = dasd_3990_erp_env_data(erp, sense); |
| 1529 | } |
| 1530 | /* 'No Record Found' */ |
| 1531 | if ((erp_filled == NULL) && (sense[1] & SNS1_NO_REC_FOUND)) { |
| 1532 | erp_filled = dasd_3990_erp_no_rec(erp, sense); |
| 1533 | } |
| 1534 | /* 'File Protected' */ |
| 1535 | if ((erp_filled == NULL) && (sense[1] & SNS1_FILE_PROTECTED)) { |
| 1536 | erp_filled = dasd_3990_erp_file_prot(erp); |
| 1537 | } |
| 1538 | /* other (unknown) error - do default ERP */ |
| 1539 | if (erp_filled == NULL) { |
| 1540 | |
| 1541 | erp_filled = erp; |
| 1542 | } |
| 1543 | |
| 1544 | return erp_filled; |
| 1545 | |
| 1546 | } /* END dasd_3990_erp_inspect_24 */ |
| 1547 | |
| 1548 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1549 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1550 | * 32 byte sense ERP functions (only) |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1551 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1552 | */ |
| 1553 | |
| 1554 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1555 | * DASD_3990_ERPACTION_10_32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1556 | * |
| 1557 | * DESCRIPTION |
| 1558 | * Handles 32 byte 'Action 10' of Single Program Action Codes. |
| 1559 | * Just retry and if retry doesn't work, return with error. |
| 1560 | * |
| 1561 | * PARAMETER |
| 1562 | * erp current erp_head |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1563 | * sense current sense data |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1564 | * RETURN VALUES |
| 1565 | * erp modified erp_head |
| 1566 | */ |
| 1567 | static struct dasd_ccw_req * |
| 1568 | dasd_3990_erp_action_10_32(struct dasd_ccw_req * erp, char *sense) |
| 1569 | { |
| 1570 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1571 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1572 | |
| 1573 | erp->retries = 256; |
| 1574 | erp->function = dasd_3990_erp_action_10_32; |
| 1575 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1576 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Perform logging requested"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1577 | |
| 1578 | return erp; |
| 1579 | |
| 1580 | } /* end dasd_3990_erp_action_10_32 */ |
| 1581 | |
| 1582 | /* |
| 1583 | * DASD_3990_ERP_ACTION_1B_32 |
| 1584 | * |
| 1585 | * DESCRIPTION |
| 1586 | * Handles 32 byte 'Action 1B' of Single Program Action Codes. |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1587 | * A write operation could not be finished because of an unexpected |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1588 | * condition. |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1589 | * The already created 'default erp' is used to get the link to |
| 1590 | * the erp chain, but it can not be used for this recovery |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1591 | * action because it contains no DE/LO data space. |
| 1592 | * |
| 1593 | * PARAMETER |
| 1594 | * default_erp already added default erp. |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1595 | * sense current sense data |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | * |
| 1597 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1598 | * erp new erp or |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1599 | * default_erp in case of imprecise ending or error |
| 1600 | */ |
| 1601 | static struct dasd_ccw_req * |
| 1602 | dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) |
| 1603 | { |
| 1604 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1605 | struct dasd_device *device = default_erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1606 | __u32 cpa = 0; |
| 1607 | struct dasd_ccw_req *cqr; |
| 1608 | struct dasd_ccw_req *erp; |
| 1609 | struct DE_eckd_data *DE_data; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1610 | struct PFX_eckd_data *PFX_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1611 | char *LO_data; /* LO_eckd_data_t */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1612 | struct ccw1 *ccw, *oldccw; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1613 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1614 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1615 | "Write not finished because of unexpected condition"); |
| 1616 | |
| 1617 | default_erp->function = dasd_3990_erp_action_1B_32; |
| 1618 | |
| 1619 | /* determine the original cqr */ |
| 1620 | cqr = default_erp; |
| 1621 | |
| 1622 | while (cqr->refers != NULL) { |
| 1623 | cqr = cqr->refers; |
| 1624 | } |
| 1625 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 1626 | if (scsw_is_tm(&cqr->irb.scsw)) { |
| 1627 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
| 1628 | "32 bit sense, action 1B is not defined" |
| 1629 | " in transport mode - just retry"); |
| 1630 | return default_erp; |
| 1631 | } |
| 1632 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1633 | /* for imprecise ending just do default erp */ |
| 1634 | if (sense[1] & 0x01) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1635 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1636 | "Imprecise ending is set - just retry"); |
| 1637 | |
| 1638 | return default_erp; |
| 1639 | } |
| 1640 | |
| 1641 | /* determine the address of the CCW to be restarted */ |
| 1642 | /* Imprecise ending is not set -> addr from IRB-SCSW */ |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 1643 | cpa = default_erp->refers->irb.scsw.cmd.cpa; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1644 | |
| 1645 | if (cpa == 0) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1646 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1647 | "Unable to determine address of the CCW " |
| 1648 | "to be restarted"); |
| 1649 | |
| 1650 | return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); |
| 1651 | } |
| 1652 | |
| 1653 | /* Build new ERP request including DE/LO */ |
| 1654 | erp = dasd_alloc_erp_request((char *) &cqr->magic, |
| 1655 | 2 + 1,/* DE/LO + TIC */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1656 | sizeof(struct DE_eckd_data) + |
| 1657 | sizeof(struct LO_eckd_data), device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1658 | |
| 1659 | if (IS_ERR(erp)) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1660 | /* internal error 01 - Unable to allocate ERP */ |
| 1661 | dev_err(&device->cdev->dev, "An error occurred in the DASD " |
| 1662 | "device driver, reason=%s\n", "01"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1663 | return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); |
| 1664 | } |
| 1665 | |
| 1666 | /* use original DE */ |
| 1667 | DE_data = erp->data; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1668 | oldccw = cqr->cpaddr; |
| 1669 | if (oldccw->cmd_code == DASD_ECKD_CCW_PFX) { |
| 1670 | PFX_data = cqr->data; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 1671 | memcpy(DE_data, &PFX_data->define_extent, |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1672 | sizeof(struct DE_eckd_data)); |
| 1673 | } else |
| 1674 | memcpy(DE_data, cqr->data, sizeof(struct DE_eckd_data)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1675 | |
| 1676 | /* create LO */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1677 | LO_data = erp->data + sizeof(struct DE_eckd_data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1678 | |
| 1679 | if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1680 | /* should not */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1681 | return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); |
| 1682 | } |
| 1683 | |
| 1684 | if ((sense[7] & 0x3F) == 0x01) { |
| 1685 | /* operation code is WRITE DATA -> data area orientation */ |
| 1686 | LO_data[0] = 0x81; |
| 1687 | |
| 1688 | } else if ((sense[7] & 0x3F) == 0x03) { |
| 1689 | /* operation code is FORMAT WRITE -> index orientation */ |
| 1690 | LO_data[0] = 0xC3; |
| 1691 | |
| 1692 | } else { |
| 1693 | LO_data[0] = sense[7]; /* operation */ |
| 1694 | } |
| 1695 | |
| 1696 | LO_data[1] = sense[8]; /* auxiliary */ |
| 1697 | LO_data[2] = sense[9]; |
| 1698 | LO_data[3] = sense[3]; /* count */ |
| 1699 | LO_data[4] = sense[29]; /* seek_addr.cyl */ |
| 1700 | LO_data[5] = sense[30]; /* seek_addr.cyl 2nd byte */ |
| 1701 | LO_data[7] = sense[31]; /* seek_addr.head 2nd byte */ |
| 1702 | |
| 1703 | memcpy(&(LO_data[8]), &(sense[11]), 8); |
| 1704 | |
| 1705 | /* create DE ccw */ |
| 1706 | ccw = erp->cpaddr; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1707 | memset(ccw, 0, sizeof(struct ccw1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1708 | ccw->cmd_code = DASD_ECKD_CCW_DEFINE_EXTENT; |
| 1709 | ccw->flags = CCW_FLAG_CC; |
| 1710 | ccw->count = 16; |
| 1711 | ccw->cda = (__u32)(addr_t) DE_data; |
| 1712 | |
| 1713 | /* create LO ccw */ |
| 1714 | ccw++; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1715 | memset(ccw, 0, sizeof(struct ccw1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1716 | ccw->cmd_code = DASD_ECKD_CCW_LOCATE_RECORD; |
| 1717 | ccw->flags = CCW_FLAG_CC; |
| 1718 | ccw->count = 16; |
| 1719 | ccw->cda = (__u32)(addr_t) LO_data; |
| 1720 | |
| 1721 | /* TIC to the failed ccw */ |
| 1722 | ccw++; |
| 1723 | ccw->cmd_code = CCW_CMD_TIC; |
| 1724 | ccw->cda = cpa; |
| 1725 | |
| 1726 | /* fill erp related fields */ |
Stefan Weinhuber | 7ea8d32 | 2010-10-25 16:10:08 +0200 | [diff] [blame] | 1727 | erp->flags = default_erp->flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1728 | erp->function = dasd_3990_erp_action_1B_32; |
| 1729 | erp->refers = default_erp->refers; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1730 | erp->startdev = device; |
| 1731 | erp->memdev = device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1732 | erp->magic = default_erp->magic; |
Stefan Weinhuber | 1afcfd59 | 2011-12-27 11:27:23 +0100 | [diff] [blame] | 1733 | erp->expires = default_erp->expires; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1734 | erp->retries = 256; |
Heiko Carstens | 1aae056 | 2013-01-30 09:49:40 +0100 | [diff] [blame] | 1735 | erp->buildclk = get_tod_clock(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1736 | erp->status = DASD_CQR_FILLED; |
| 1737 | |
| 1738 | /* remove the default erp */ |
| 1739 | dasd_free_erp_request(default_erp, device); |
| 1740 | |
| 1741 | return erp; |
| 1742 | |
| 1743 | } /* end dasd_3990_erp_action_1B_32 */ |
| 1744 | |
| 1745 | /* |
| 1746 | * DASD_3990_UPDATE_1B |
| 1747 | * |
| 1748 | * DESCRIPTION |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1749 | * Handles the update to the 32 byte 'Action 1B' of Single Program |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | * Action Codes in case the first action was not successful. |
| 1751 | * The already created 'previous_erp' is the currently not successful |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1752 | * ERP. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1753 | * |
| 1754 | * PARAMETER |
| 1755 | * previous_erp already created previous erp. |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1756 | * sense current sense data |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1757 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1758 | * erp modified erp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1759 | */ |
| 1760 | static struct dasd_ccw_req * |
| 1761 | dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) |
| 1762 | { |
| 1763 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1764 | struct dasd_device *device = previous_erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1765 | __u32 cpa = 0; |
| 1766 | struct dasd_ccw_req *cqr; |
| 1767 | struct dasd_ccw_req *erp; |
| 1768 | char *LO_data; /* struct LO_eckd_data */ |
| 1769 | struct ccw1 *ccw; |
| 1770 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1771 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1772 | "Write not finished because of unexpected condition" |
| 1773 | " - follow on"); |
| 1774 | |
| 1775 | /* determine the original cqr */ |
| 1776 | cqr = previous_erp; |
| 1777 | |
| 1778 | while (cqr->refers != NULL) { |
| 1779 | cqr = cqr->refers; |
| 1780 | } |
| 1781 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 1782 | if (scsw_is_tm(&cqr->irb.scsw)) { |
| 1783 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
| 1784 | "32 bit sense, action 1B, update," |
| 1785 | " in transport mode - just retry"); |
| 1786 | return previous_erp; |
| 1787 | } |
| 1788 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1789 | /* for imprecise ending just do default erp */ |
| 1790 | if (sense[1] & 0x01) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1791 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1792 | "Imprecise ending is set - just retry"); |
| 1793 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1794 | previous_erp->status = DASD_CQR_FILLED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1795 | |
| 1796 | return previous_erp; |
| 1797 | } |
| 1798 | |
| 1799 | /* determine the address of the CCW to be restarted */ |
| 1800 | /* Imprecise ending is not set -> addr from IRB-SCSW */ |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 1801 | cpa = previous_erp->irb.scsw.cmd.cpa; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1802 | |
| 1803 | if (cpa == 0) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1804 | /* internal error 02 - |
| 1805 | Unable to determine address of the CCW to be restarted */ |
| 1806 | dev_err(&device->cdev->dev, "An error occurred in the DASD " |
| 1807 | "device driver, reason=%s\n", "02"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1808 | |
| 1809 | previous_erp->status = DASD_CQR_FAILED; |
| 1810 | |
| 1811 | return previous_erp; |
| 1812 | } |
| 1813 | |
| 1814 | erp = previous_erp; |
| 1815 | |
| 1816 | /* update the LO with the new returned sense data */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1817 | LO_data = erp->data + sizeof(struct DE_eckd_data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1818 | |
| 1819 | if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 1820 | /* should not happen */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1821 | previous_erp->status = DASD_CQR_FAILED; |
| 1822 | |
| 1823 | return previous_erp; |
| 1824 | } |
| 1825 | |
| 1826 | if ((sense[7] & 0x3F) == 0x01) { |
| 1827 | /* operation code is WRITE DATA -> data area orientation */ |
| 1828 | LO_data[0] = 0x81; |
| 1829 | |
| 1830 | } else if ((sense[7] & 0x3F) == 0x03) { |
| 1831 | /* operation code is FORMAT WRITE -> index orientation */ |
| 1832 | LO_data[0] = 0xC3; |
| 1833 | |
| 1834 | } else { |
| 1835 | LO_data[0] = sense[7]; /* operation */ |
| 1836 | } |
| 1837 | |
| 1838 | LO_data[1] = sense[8]; /* auxiliary */ |
| 1839 | LO_data[2] = sense[9]; |
| 1840 | LO_data[3] = sense[3]; /* count */ |
| 1841 | LO_data[4] = sense[29]; /* seek_addr.cyl */ |
| 1842 | LO_data[5] = sense[30]; /* seek_addr.cyl 2nd byte */ |
| 1843 | LO_data[7] = sense[31]; /* seek_addr.head 2nd byte */ |
| 1844 | |
| 1845 | memcpy(&(LO_data[8]), &(sense[11]), 8); |
| 1846 | |
| 1847 | /* TIC to the failed ccw */ |
| 1848 | ccw = erp->cpaddr; /* addr of DE ccw */ |
| 1849 | ccw++; /* addr of LE ccw */ |
| 1850 | ccw++; /* addr of TIC ccw */ |
| 1851 | ccw->cda = cpa; |
| 1852 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1853 | erp->status = DASD_CQR_FILLED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1854 | |
| 1855 | return erp; |
| 1856 | |
| 1857 | } /* end dasd_3990_update_1B */ |
| 1858 | |
| 1859 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1860 | * DASD_3990_ERP_COMPOUND_RETRY |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1861 | * |
| 1862 | * DESCRIPTION |
| 1863 | * Handles the compound ERP action retry code. |
| 1864 | * NOTE: At least one retry is done even if zero is specified |
| 1865 | * by the sense data. This makes enqueueing of the request |
| 1866 | * easier. |
| 1867 | * |
| 1868 | * PARAMETER |
| 1869 | * sense sense data of the actual error |
| 1870 | * erp pointer to the currently created ERP |
| 1871 | * |
| 1872 | * RETURN VALUES |
| 1873 | * erp modified ERP pointer |
| 1874 | * |
| 1875 | */ |
| 1876 | static void |
| 1877 | dasd_3990_erp_compound_retry(struct dasd_ccw_req * erp, char *sense) |
| 1878 | { |
| 1879 | |
| 1880 | switch (sense[25] & 0x03) { |
| 1881 | case 0x00: /* no not retry */ |
| 1882 | erp->retries = 1; |
| 1883 | break; |
| 1884 | |
| 1885 | case 0x01: /* retry 2 times */ |
| 1886 | erp->retries = 2; |
| 1887 | break; |
| 1888 | |
| 1889 | case 0x02: /* retry 10 times */ |
| 1890 | erp->retries = 10; |
| 1891 | break; |
| 1892 | |
| 1893 | case 0x03: /* retry 256 times */ |
| 1894 | erp->retries = 256; |
| 1895 | break; |
| 1896 | |
| 1897 | default: |
| 1898 | BUG(); |
| 1899 | } |
| 1900 | |
| 1901 | erp->function = dasd_3990_erp_compound_retry; |
| 1902 | |
| 1903 | } /* end dasd_3990_erp_compound_retry */ |
| 1904 | |
| 1905 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1906 | * DASD_3990_ERP_COMPOUND_PATH |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1907 | * |
| 1908 | * DESCRIPTION |
| 1909 | * Handles the compound ERP action for retry on alternate |
| 1910 | * channel path. |
| 1911 | * |
| 1912 | * PARAMETER |
| 1913 | * sense sense data of the actual error |
| 1914 | * erp pointer to the currently created ERP |
| 1915 | * |
| 1916 | * RETURN VALUES |
| 1917 | * erp modified ERP pointer |
| 1918 | * |
| 1919 | */ |
| 1920 | static void |
| 1921 | dasd_3990_erp_compound_path(struct dasd_ccw_req * erp, char *sense) |
| 1922 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1923 | if (sense[25] & DASD_SENSE_BIT_3) { |
| 1924 | dasd_3990_erp_alternate_path(erp); |
| 1925 | |
Stefan Weinhuber | a4d26c6 | 2011-01-05 12:48:03 +0100 | [diff] [blame] | 1926 | if (erp->status == DASD_CQR_FAILED && |
| 1927 | !test_bit(DASD_CQR_VERIFY_PATH, &erp->flags)) { |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1928 | /* reset the lpm and the status to be able to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1929 | * try further actions. */ |
Stefan Haberland | c934615 | 2016-08-08 15:53:54 +0200 | [diff] [blame] | 1930 | erp->lpm = dasd_path_get_opm(erp->startdev); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 1931 | erp->status = DASD_CQR_NEED_ERP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1932 | } |
| 1933 | } |
| 1934 | |
| 1935 | erp->function = dasd_3990_erp_compound_path; |
| 1936 | |
| 1937 | } /* end dasd_3990_erp_compound_path */ |
| 1938 | |
| 1939 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1940 | * DASD_3990_ERP_COMPOUND_CODE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1941 | * |
| 1942 | * DESCRIPTION |
| 1943 | * Handles the compound ERP action for retry code. |
| 1944 | * |
| 1945 | * PARAMETER |
| 1946 | * sense sense data of the actual error |
| 1947 | * erp pointer to the currently created ERP |
| 1948 | * |
| 1949 | * RETURN VALUES |
| 1950 | * erp NEW ERP pointer |
| 1951 | * |
| 1952 | */ |
| 1953 | static struct dasd_ccw_req * |
| 1954 | dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense) |
| 1955 | { |
| 1956 | |
| 1957 | if (sense[25] & DASD_SENSE_BIT_2) { |
| 1958 | |
| 1959 | switch (sense[28]) { |
| 1960 | case 0x17: |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1961 | /* issue a Diagnostic Control command with an |
Robert P. J. Day | 3a4fa0a | 2007-10-19 23:10:43 +0200 | [diff] [blame] | 1962 | * Inhibit Write subcommand and controller modifier */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1963 | erp = dasd_3990_erp_DCTL(erp, 0x20); |
| 1964 | break; |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1965 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1966 | case 0x25: |
| 1967 | /* wait for 5 seconds and retry again */ |
| 1968 | erp->retries = 1; |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1969 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1970 | dasd_3990_erp_block_queue (erp, 5*HZ); |
| 1971 | break; |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1972 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1973 | default: |
| 1974 | /* should not happen - continue */ |
| 1975 | break; |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | erp->function = dasd_3990_erp_compound_code; |
| 1980 | |
| 1981 | return erp; |
| 1982 | |
| 1983 | } /* end dasd_3990_erp_compound_code */ |
| 1984 | |
| 1985 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1986 | * DASD_3990_ERP_COMPOUND_CONFIG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1987 | * |
| 1988 | * DESCRIPTION |
| 1989 | * Handles the compound ERP action for configruation |
| 1990 | * dependent error. |
| 1991 | * Note: duplex handling is not implemented (yet). |
| 1992 | * |
| 1993 | * PARAMETER |
| 1994 | * sense sense data of the actual error |
| 1995 | * erp pointer to the currently created ERP |
| 1996 | * |
| 1997 | * RETURN VALUES |
| 1998 | * erp modified ERP pointer |
| 1999 | * |
| 2000 | */ |
| 2001 | static void |
| 2002 | dasd_3990_erp_compound_config(struct dasd_ccw_req * erp, char *sense) |
| 2003 | { |
| 2004 | |
| 2005 | if ((sense[25] & DASD_SENSE_BIT_1) && (sense[26] & DASD_SENSE_BIT_2)) { |
| 2006 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2007 | /* set to suspended duplex state then restart |
| 2008 | internal error 05 - Set device to suspended duplex state |
| 2009 | should be done */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2010 | struct dasd_device *device = erp->startdev; |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2011 | dev_err(&device->cdev->dev, |
| 2012 | "An error occurred in the DASD device driver, " |
| 2013 | "reason=%s\n", "05"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2014 | |
| 2015 | } |
| 2016 | |
| 2017 | erp->function = dasd_3990_erp_compound_config; |
| 2018 | |
| 2019 | } /* end dasd_3990_erp_compound_config */ |
| 2020 | |
| 2021 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2022 | * DASD_3990_ERP_COMPOUND |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2023 | * |
| 2024 | * DESCRIPTION |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2025 | * Does the further compound program action if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2026 | * compound retry was not successful. |
| 2027 | * |
| 2028 | * PARAMETER |
| 2029 | * sense sense data of the actual error |
| 2030 | * erp pointer to the current (failed) ERP |
| 2031 | * |
| 2032 | * RETURN VALUES |
| 2033 | * erp (additional) ERP pointer |
| 2034 | * |
| 2035 | */ |
| 2036 | static struct dasd_ccw_req * |
| 2037 | dasd_3990_erp_compound(struct dasd_ccw_req * erp, char *sense) |
| 2038 | { |
| 2039 | |
| 2040 | if ((erp->function == dasd_3990_erp_compound_retry) && |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2041 | (erp->status == DASD_CQR_NEED_ERP)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2042 | |
| 2043 | dasd_3990_erp_compound_path(erp, sense); |
| 2044 | } |
| 2045 | |
| 2046 | if ((erp->function == dasd_3990_erp_compound_path) && |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2047 | (erp->status == DASD_CQR_NEED_ERP)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2048 | |
| 2049 | erp = dasd_3990_erp_compound_code(erp, sense); |
| 2050 | } |
| 2051 | |
| 2052 | if ((erp->function == dasd_3990_erp_compound_code) && |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2053 | (erp->status == DASD_CQR_NEED_ERP)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2054 | |
| 2055 | dasd_3990_erp_compound_config(erp, sense); |
| 2056 | } |
| 2057 | |
| 2058 | /* if no compound action ERP specified, the request failed */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2059 | if (erp->status == DASD_CQR_NEED_ERP) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2060 | erp->status = DASD_CQR_FAILED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2061 | |
| 2062 | return erp; |
| 2063 | |
| 2064 | } /* end dasd_3990_erp_compound */ |
| 2065 | |
| 2066 | /* |
Stefan Haberland | f60c768 | 2008-04-17 07:46:08 +0200 | [diff] [blame] | 2067 | *DASD_3990_ERP_HANDLE_SIM |
| 2068 | * |
| 2069 | *DESCRIPTION |
| 2070 | * inspects the SIM SENSE data and starts an appropriate action |
| 2071 | * |
| 2072 | * PARAMETER |
| 2073 | * sense sense data of the actual error |
| 2074 | * |
| 2075 | * RETURN VALUES |
| 2076 | * none |
| 2077 | */ |
| 2078 | void |
| 2079 | dasd_3990_erp_handle_sim(struct dasd_device *device, char *sense) |
| 2080 | { |
| 2081 | /* print message according to log or message to operator mode */ |
| 2082 | if ((sense[24] & DASD_SIM_MSG_TO_OP) || (sense[1] & 0x10)) { |
Stefan Haberland | f60c768 | 2008-04-17 07:46:08 +0200 | [diff] [blame] | 2083 | /* print SIM SRC from RefCode */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2084 | dev_err(&device->cdev->dev, "SIM - SRC: " |
| 2085 | "%02x%02x%02x%02x\n", sense[22], |
Stefan Haberland | f60c768 | 2008-04-17 07:46:08 +0200 | [diff] [blame] | 2086 | sense[23], sense[11], sense[12]); |
| 2087 | } else if (sense[24] & DASD_SIM_LOG) { |
| 2088 | /* print SIM SRC Refcode */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2089 | dev_warn(&device->cdev->dev, "log SIM - SRC: " |
| 2090 | "%02x%02x%02x%02x\n", sense[22], |
Stefan Haberland | f60c768 | 2008-04-17 07:46:08 +0200 | [diff] [blame] | 2091 | sense[23], sense[11], sense[12]); |
| 2092 | } |
| 2093 | } |
| 2094 | |
| 2095 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2096 | * DASD_3990_ERP_INSPECT_32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2097 | * |
| 2098 | * DESCRIPTION |
| 2099 | * Does a detailed inspection of the 32 byte sense data |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2100 | * and sets up a related error recovery action. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2101 | * |
| 2102 | * PARAMETER |
| 2103 | * sense sense data of the actual error |
| 2104 | * erp pointer to the currently created default ERP |
| 2105 | * |
| 2106 | * RETURN VALUES |
| 2107 | * erp_filled pointer to the ERP |
| 2108 | * |
| 2109 | */ |
| 2110 | static struct dasd_ccw_req * |
| 2111 | dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) |
| 2112 | { |
| 2113 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2114 | struct dasd_device *device = erp->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2115 | |
| 2116 | erp->function = dasd_3990_erp_inspect_32; |
| 2117 | |
Stefan Haberland | f60c768 | 2008-04-17 07:46:08 +0200 | [diff] [blame] | 2118 | /* check for SIM sense data */ |
| 2119 | if ((sense[6] & DASD_SIM_SENSE) == DASD_SIM_SENSE) |
| 2120 | dasd_3990_erp_handle_sim(device, sense); |
| 2121 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2122 | if (sense[25] & DASD_SENSE_BIT_0) { |
| 2123 | |
| 2124 | /* compound program action codes (byte25 bit 0 == '1') */ |
| 2125 | dasd_3990_erp_compound_retry(erp, sense); |
| 2126 | |
| 2127 | } else { |
| 2128 | |
| 2129 | /* single program action codes (byte25 bit 0 == '0') */ |
| 2130 | switch (sense[25]) { |
| 2131 | |
| 2132 | case 0x00: /* success - use default ERP for retries */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2133 | DBF_DEV_EVENT(DBF_DEBUG, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2134 | "ERP called for successful request" |
| 2135 | " - just retry"); |
| 2136 | break; |
| 2137 | |
| 2138 | case 0x01: /* fatal error */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2139 | dev_err(&device->cdev->dev, |
| 2140 | "ERP failed for the DASD\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2141 | |
| 2142 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 2143 | break; |
| 2144 | |
| 2145 | case 0x02: /* intervention required */ |
| 2146 | case 0x03: /* intervention required during dual copy */ |
| 2147 | erp = dasd_3990_erp_int_req(erp); |
| 2148 | break; |
| 2149 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2150 | case 0x0F: /* length mismatch during update write command |
| 2151 | internal error 08 - update write command error*/ |
| 2152 | dev_err(&device->cdev->dev, "An error occurred in the " |
| 2153 | "DASD device driver, reason=%s\n", "08"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2154 | |
| 2155 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 2156 | break; |
| 2157 | |
| 2158 | case 0x10: /* logging required for other channel program */ |
| 2159 | erp = dasd_3990_erp_action_10_32(erp, sense); |
| 2160 | break; |
| 2161 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2162 | case 0x15: /* next track outside defined extend |
| 2163 | internal error 07 - The next track is not |
| 2164 | within the defined storage extent */ |
| 2165 | dev_err(&device->cdev->dev, |
| 2166 | "An error occurred in the DASD device driver, " |
| 2167 | "reason=%s\n", "07"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2168 | |
| 2169 | erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); |
| 2170 | break; |
| 2171 | |
| 2172 | case 0x1B: /* unexpected condition during write */ |
| 2173 | |
| 2174 | erp = dasd_3990_erp_action_1B_32(erp, sense); |
| 2175 | break; |
| 2176 | |
| 2177 | case 0x1C: /* invalid data */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2178 | dev_emerg(&device->cdev->dev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2179 | "Data recovered during retry with PCI " |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2180 | "fetch mode active\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2181 | |
| 2182 | /* not possible to handle this situation in Linux */ |
| 2183 | panic |
| 2184 | ("Invalid data - No way to inform application " |
| 2185 | "about the possibly incorrect data"); |
| 2186 | break; |
| 2187 | |
| 2188 | case 0x1D: /* state-change pending */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2189 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2190 | "A State change pending condition exists " |
| 2191 | "for the subsystem or device"); |
| 2192 | |
| 2193 | erp = dasd_3990_erp_action_4(erp, sense); |
| 2194 | break; |
| 2195 | |
| 2196 | case 0x1E: /* busy */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2197 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2198 | "Busy condition exists " |
| 2199 | "for the subsystem or device"); |
| 2200 | erp = dasd_3990_erp_action_4(erp, sense); |
| 2201 | break; |
| 2202 | |
| 2203 | default: /* all others errors - default erp */ |
| 2204 | break; |
| 2205 | } |
| 2206 | } |
| 2207 | |
| 2208 | return erp; |
| 2209 | |
| 2210 | } /* end dasd_3990_erp_inspect_32 */ |
| 2211 | |
Stefan Haberland | a521b04 | 2016-08-08 15:56:54 +0200 | [diff] [blame] | 2212 | static void dasd_3990_erp_disable_path(struct dasd_device *device, __u8 lpum) |
| 2213 | { |
| 2214 | int pos = pathmask_to_pos(lpum); |
| 2215 | |
| 2216 | /* no remaining path, cannot disable */ |
| 2217 | if (!(dasd_path_get_opm(device) & ~lpum)) |
| 2218 | return; |
| 2219 | |
| 2220 | dev_err(&device->cdev->dev, |
| 2221 | "Path %x.%02x (pathmask %02x) is disabled - IFCC threshold exceeded\n", |
| 2222 | device->path[pos].cssid, device->path[pos].chpid, lpum); |
| 2223 | dasd_path_remove_opm(device, lpum); |
| 2224 | dasd_path_add_ifccpm(device, lpum); |
| 2225 | device->path[pos].errorclk = 0; |
| 2226 | atomic_set(&device->path[pos].error_count, 0); |
| 2227 | } |
| 2228 | |
| 2229 | static void dasd_3990_erp_account_error(struct dasd_ccw_req *erp) |
| 2230 | { |
| 2231 | struct dasd_device *device = erp->startdev; |
| 2232 | __u8 lpum = erp->refers->irb.esw.esw1.lpum; |
| 2233 | int pos = pathmask_to_pos(lpum); |
| 2234 | unsigned long long clk; |
| 2235 | |
| 2236 | if (!device->path_thrhld) |
| 2237 | return; |
| 2238 | |
| 2239 | clk = get_tod_clock(); |
| 2240 | /* |
| 2241 | * check if the last error is longer ago than the timeout, |
| 2242 | * if so reset error state |
| 2243 | */ |
| 2244 | if ((tod_to_ns(clk - device->path[pos].errorclk) / NSEC_PER_SEC) |
| 2245 | >= device->path_interval) { |
| 2246 | atomic_set(&device->path[pos].error_count, 0); |
| 2247 | device->path[pos].errorclk = 0; |
| 2248 | } |
| 2249 | atomic_inc(&device->path[pos].error_count); |
| 2250 | device->path[pos].errorclk = clk; |
| 2251 | /* threshold exceeded disable path if possible */ |
| 2252 | if (atomic_read(&device->path[pos].error_count) >= |
| 2253 | device->path_thrhld) |
| 2254 | dasd_3990_erp_disable_path(device, lpum); |
| 2255 | } |
| 2256 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2257 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2258 | ***************************************************************************** |
Stefan Weil | eef35c2 | 2010-08-06 21:11:15 +0200 | [diff] [blame] | 2259 | * main ERP control functions (24 and 32 byte sense) |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2260 | ***************************************************************************** |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2261 | */ |
| 2262 | |
| 2263 | /* |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2264 | * DASD_3990_ERP_CONTROL_CHECK |
| 2265 | * |
| 2266 | * DESCRIPTION |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2267 | * Does a generic inspection if a control check occurred and sets up |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2268 | * the related error recovery procedure |
| 2269 | * |
| 2270 | * PARAMETER |
| 2271 | * erp pointer to the currently created default ERP |
| 2272 | * |
| 2273 | * RETURN VALUES |
| 2274 | * erp_filled pointer to the erp |
| 2275 | */ |
| 2276 | |
| 2277 | static struct dasd_ccw_req * |
| 2278 | dasd_3990_erp_control_check(struct dasd_ccw_req *erp) |
| 2279 | { |
| 2280 | struct dasd_device *device = erp->startdev; |
| 2281 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2282 | if (scsw_cstat(&erp->refers->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2283 | | SCHN_STAT_CHN_CTRL_CHK)) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2284 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2285 | "channel or interface control check"); |
Stefan Haberland | a521b04 | 2016-08-08 15:56:54 +0200 | [diff] [blame] | 2286 | dasd_3990_erp_account_error(erp); |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2287 | erp = dasd_3990_erp_action_4(erp, NULL); |
| 2288 | } |
| 2289 | return erp; |
| 2290 | } |
| 2291 | |
| 2292 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2293 | * DASD_3990_ERP_INSPECT |
| 2294 | * |
| 2295 | * DESCRIPTION |
| 2296 | * Does a detailed inspection for sense data by calling either |
| 2297 | * the 24-byte or the 32-byte inspection routine. |
| 2298 | * |
| 2299 | * PARAMETER |
| 2300 | * erp pointer to the currently created default ERP |
| 2301 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2302 | * erp_new contens was possibly modified |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2303 | */ |
| 2304 | static struct dasd_ccw_req * |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2305 | dasd_3990_erp_inspect(struct dasd_ccw_req *erp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2306 | { |
| 2307 | |
| 2308 | struct dasd_ccw_req *erp_new = NULL; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2309 | char *sense; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2310 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2311 | /* if this problem occurred on an alias retry on base */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2312 | erp_new = dasd_3990_erp_inspect_alias(erp); |
| 2313 | if (erp_new) |
| 2314 | return erp_new; |
| 2315 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2316 | /* sense data are located in the refers record of the |
| 2317 | * already set up new ERP ! |
| 2318 | * check if concurrent sens is available |
| 2319 | */ |
| 2320 | sense = dasd_get_sense(&erp->refers->irb); |
| 2321 | if (!sense) |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2322 | erp_new = dasd_3990_erp_control_check(erp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2323 | /* distinguish between 24 and 32 byte sense data */ |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2324 | else if (sense[27] & DASD_SENSE_BIT_0) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2325 | |
| 2326 | /* inspect the 24 byte sense data */ |
| 2327 | erp_new = dasd_3990_erp_inspect_24(erp, sense); |
| 2328 | |
| 2329 | } else { |
| 2330 | |
| 2331 | /* inspect the 32 byte sense data */ |
| 2332 | erp_new = dasd_3990_erp_inspect_32(erp, sense); |
| 2333 | |
| 2334 | } /* end distinguish between 24 and 32 byte sense data */ |
| 2335 | |
| 2336 | return erp_new; |
| 2337 | } |
| 2338 | |
| 2339 | /* |
| 2340 | * DASD_3990_ERP_ADD_ERP |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2341 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2342 | * DESCRIPTION |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2343 | * This function adds an additional request block (ERP) to the head of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2344 | * the given cqr (or erp). |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2345 | * For a command mode cqr the erp is initialized as an default erp |
| 2346 | * (retry TIC). |
| 2347 | * For transport mode we make a copy of the original TCW (points to |
| 2348 | * the original TCCB, TIDALs, etc.) but give it a fresh |
| 2349 | * TSB so the original sense data will not be changed. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2350 | * |
| 2351 | * PARAMETER |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2352 | * cqr head of the current ERP-chain (or single cqr if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2353 | * first error) |
| 2354 | * RETURN VALUES |
| 2355 | * erp pointer to new ERP-chain head |
| 2356 | */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2357 | static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2358 | { |
| 2359 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2360 | struct dasd_device *device = cqr->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2361 | struct ccw1 *ccw; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2362 | struct dasd_ccw_req *erp; |
| 2363 | int cplength, datasize; |
| 2364 | struct tcw *tcw; |
| 2365 | struct tsb *tsb; |
| 2366 | |
| 2367 | if (cqr->cpmode == 1) { |
| 2368 | cplength = 0; |
Stefan Weinhuber | 4a31ba5 | 2010-03-24 11:49:53 +0100 | [diff] [blame] | 2369 | /* TCW needs to be 64 byte aligned, so leave enough room */ |
| 2370 | datasize = 64 + sizeof(struct tcw) + sizeof(struct tsb); |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2371 | } else { |
| 2372 | cplength = 2; |
| 2373 | datasize = 0; |
| 2374 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | |
| 2376 | /* allocate additional request block */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2377 | erp = dasd_alloc_erp_request((char *) &cqr->magic, |
| 2378 | cplength, datasize, device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | if (IS_ERR(erp)) { |
| 2380 | if (cqr->retries <= 0) { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2381 | DBF_DEV_EVENT(DBF_ERR, device, "%s", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | "Unable to allocate ERP request"); |
| 2383 | cqr->status = DASD_CQR_FAILED; |
Heiko Carstens | 1aae056 | 2013-01-30 09:49:40 +0100 | [diff] [blame] | 2384 | cqr->stopclk = get_tod_clock(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | } else { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2386 | DBF_DEV_EVENT(DBF_ERR, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2387 | "Unable to allocate ERP request " |
| 2388 | "(%i retries left)", |
| 2389 | cqr->retries); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2390 | dasd_block_set_timer(device->block, (HZ << 3)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2391 | } |
Stefan Haberland | 6a5176c | 2010-04-22 17:17:02 +0200 | [diff] [blame] | 2392 | return erp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2393 | } |
| 2394 | |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 2395 | ccw = cqr->cpaddr; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2396 | if (cqr->cpmode == 1) { |
| 2397 | /* make a shallow copy of the original tcw but set new tsb */ |
| 2398 | erp->cpmode = 1; |
Stefan Weinhuber | 4a31ba5 | 2010-03-24 11:49:53 +0100 | [diff] [blame] | 2399 | erp->cpaddr = PTR_ALIGN(erp->data, 64); |
| 2400 | tcw = erp->cpaddr; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2401 | tsb = (struct tsb *) &tcw[1]; |
| 2402 | *tcw = *((struct tcw *)cqr->cpaddr); |
| 2403 | tcw->tsb = (long)tsb; |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 2404 | } else if (ccw->cmd_code == DASD_ECKD_CCW_PSF) { |
| 2405 | /* PSF cannot be chained from NOOP/TIC */ |
| 2406 | erp->cpaddr = cqr->cpaddr; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2407 | } else { |
| 2408 | /* initialize request with default TIC to current ERP/CQR */ |
| 2409 | ccw = erp->cpaddr; |
| 2410 | ccw->cmd_code = CCW_CMD_NOOP; |
| 2411 | ccw->flags = CCW_FLAG_CC; |
| 2412 | ccw++; |
| 2413 | ccw->cmd_code = CCW_CMD_TIC; |
| 2414 | ccw->cda = (long)(cqr->cpaddr); |
| 2415 | } |
| 2416 | |
Stefan Weinhuber | 7ea8d32 | 2010-10-25 16:10:08 +0200 | [diff] [blame] | 2417 | erp->flags = cqr->flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | erp->function = dasd_3990_erp_add_erp; |
| 2419 | erp->refers = cqr; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2420 | erp->startdev = device; |
| 2421 | erp->memdev = device; |
| 2422 | erp->block = cqr->block; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2423 | erp->magic = cqr->magic; |
Stefan Weinhuber | 1afcfd59 | 2011-12-27 11:27:23 +0100 | [diff] [blame] | 2424 | erp->expires = cqr->expires; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2425 | erp->retries = 256; |
Heiko Carstens | 1aae056 | 2013-01-30 09:49:40 +0100 | [diff] [blame] | 2426 | erp->buildclk = get_tod_clock(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2427 | erp->status = DASD_CQR_FILLED; |
| 2428 | |
| 2429 | return erp; |
| 2430 | } |
| 2431 | |
| 2432 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2433 | * DASD_3990_ERP_ADDITIONAL_ERP |
| 2434 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2435 | * DESCRIPTION |
| 2436 | * An additional ERP is needed to handle the current error. |
| 2437 | * Add ERP to the head of the ERP-chain containing the ERP processing |
| 2438 | * determined based on the sense data. |
| 2439 | * |
| 2440 | * PARAMETER |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2441 | * cqr head of the current ERP-chain (or single cqr if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2442 | * first error) |
| 2443 | * |
| 2444 | * RETURN VALUES |
| 2445 | * erp pointer to new ERP-chain head |
| 2446 | */ |
| 2447 | static struct dasd_ccw_req * |
| 2448 | dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr) |
| 2449 | { |
| 2450 | |
| 2451 | struct dasd_ccw_req *erp = NULL; |
| 2452 | |
| 2453 | /* add erp and initialize with default TIC */ |
| 2454 | erp = dasd_3990_erp_add_erp(cqr); |
| 2455 | |
Stefan Haberland | 6a5176c | 2010-04-22 17:17:02 +0200 | [diff] [blame] | 2456 | if (IS_ERR(erp)) |
| 2457 | return erp; |
| 2458 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2459 | /* inspect sense, determine specific ERP if possible */ |
| 2460 | if (erp != cqr) { |
| 2461 | |
| 2462 | erp = dasd_3990_erp_inspect(erp); |
| 2463 | } |
| 2464 | |
| 2465 | return erp; |
| 2466 | |
| 2467 | } /* end dasd_3990_erp_additional_erp */ |
| 2468 | |
| 2469 | /* |
| 2470 | * DASD_3990_ERP_ERROR_MATCH |
| 2471 | * |
| 2472 | * DESCRIPTION |
| 2473 | * Check if the device status of the given cqr is the same. |
| 2474 | * This means that the failed CCW and the relevant sense data |
| 2475 | * must match. |
| 2476 | * I don't distinguish between 24 and 32 byte sense because in case of |
| 2477 | * 24 byte sense byte 25 and 27 is set as well. |
| 2478 | * |
| 2479 | * PARAMETER |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2480 | * cqr1 first cqr, which will be compared with the |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2481 | * cqr2 second cqr. |
| 2482 | * |
| 2483 | * RETURN VALUES |
| 2484 | * match 'boolean' for match found |
| 2485 | * returns 1 if match found, otherwise 0. |
| 2486 | */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2487 | static int dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1, |
| 2488 | struct dasd_ccw_req *cqr2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2489 | { |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2490 | char *sense1, *sense2; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2491 | |
Stefan Weinhuber | 5c12f24 | 2008-03-05 12:37:10 +0100 | [diff] [blame] | 2492 | if (cqr1->startdev != cqr2->startdev) |
| 2493 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2494 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2495 | sense1 = dasd_get_sense(&cqr1->irb); |
| 2496 | sense2 = dasd_get_sense(&cqr2->irb); |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2497 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2498 | /* one request has sense data, the other not -> no match, return 0 */ |
| 2499 | if (!sense1 != !sense2) |
| 2500 | return 0; |
| 2501 | /* no sense data in both cases -> check cstat for IFCC */ |
| 2502 | if (!sense1 && !sense2) { |
| 2503 | if ((scsw_cstat(&cqr1->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK | |
| 2504 | SCHN_STAT_CHN_CTRL_CHK)) == |
| 2505 | (scsw_cstat(&cqr2->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK | |
| 2506 | SCHN_STAT_CHN_CTRL_CHK))) |
Stefan Haberland | 6c5f57c | 2008-02-05 16:50:46 +0100 | [diff] [blame] | 2507 | return 1; /* match with ifcc*/ |
| 2508 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2509 | /* check sense data; byte 0-2,25,27 */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2510 | if (!(sense1 && sense2 && |
| 2511 | (memcmp(sense1, sense2, 3) == 0) && |
| 2512 | (sense1[27] == sense2[27]) && |
| 2513 | (sense1[25] == sense2[25]))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2514 | |
| 2515 | return 0; /* sense doesn't match */ |
| 2516 | } |
| 2517 | |
| 2518 | return 1; /* match */ |
| 2519 | |
| 2520 | } /* end dasd_3990_erp_error_match */ |
| 2521 | |
| 2522 | /* |
| 2523 | * DASD_3990_ERP_IN_ERP |
| 2524 | * |
| 2525 | * DESCRIPTION |
| 2526 | * check if the current error already happened before. |
| 2527 | * quick exit if current cqr is not an ERP (cqr->refers=NULL) |
| 2528 | * |
| 2529 | * PARAMETER |
| 2530 | * cqr failed cqr (either original cqr or already an erp) |
| 2531 | * |
| 2532 | * RETURN VALUES |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2533 | * erp erp-pointer to the already defined error |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2534 | * recovery procedure OR |
| 2535 | * NULL if a 'new' error occurred. |
| 2536 | */ |
| 2537 | static struct dasd_ccw_req * |
| 2538 | dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr) |
| 2539 | { |
| 2540 | |
| 2541 | struct dasd_ccw_req *erp_head = cqr, /* save erp chain head */ |
| 2542 | *erp_match = NULL; /* save erp chain head */ |
| 2543 | int match = 0; /* 'boolean' for matching error found */ |
| 2544 | |
| 2545 | if (cqr->refers == NULL) { /* return if not in erp */ |
| 2546 | return NULL; |
| 2547 | } |
| 2548 | |
| 2549 | /* check the erp/cqr chain for current error */ |
| 2550 | do { |
| 2551 | match = dasd_3990_erp_error_match(erp_head, cqr->refers); |
| 2552 | erp_match = cqr; /* save possible matching erp */ |
| 2553 | cqr = cqr->refers; /* check next erp/cqr in queue */ |
| 2554 | |
| 2555 | } while ((cqr->refers != NULL) && (!match)); |
| 2556 | |
| 2557 | if (!match) { |
| 2558 | return NULL; /* no match was found */ |
| 2559 | } |
| 2560 | |
| 2561 | return erp_match; /* return address of matching erp */ |
| 2562 | |
| 2563 | } /* END dasd_3990_erp_in_erp */ |
| 2564 | |
| 2565 | /* |
| 2566 | * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense) |
| 2567 | * |
| 2568 | * DESCRIPTION |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2569 | * No retry is left for the current ERP. Check what has to be done |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2570 | * with the ERP. |
| 2571 | * - do further defined ERP action or |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2572 | * - wait for interrupt or |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2573 | * - exit with permanent error |
| 2574 | * |
| 2575 | * PARAMETER |
| 2576 | * erp ERP which is in progress with no retry left |
| 2577 | * |
| 2578 | * RETURN VALUES |
| 2579 | * erp modified/additional ERP |
| 2580 | */ |
| 2581 | static struct dasd_ccw_req * |
| 2582 | dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) |
| 2583 | { |
| 2584 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2585 | struct dasd_device *device = erp->startdev; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2586 | char *sense = dasd_get_sense(&erp->irb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2587 | |
| 2588 | /* check for 24 byte sense ERP */ |
| 2589 | if ((erp->function == dasd_3990_erp_bus_out) || |
| 2590 | (erp->function == dasd_3990_erp_action_1) || |
| 2591 | (erp->function == dasd_3990_erp_action_4)) { |
| 2592 | |
| 2593 | erp = dasd_3990_erp_action_1(erp); |
| 2594 | |
Stefan Weinhuber | eb6e199 | 2009-12-07 12:51:51 +0100 | [diff] [blame] | 2595 | } else if (erp->function == dasd_3990_erp_action_1_sec) { |
| 2596 | erp = dasd_3990_erp_action_1_sec(erp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2597 | } else if (erp->function == dasd_3990_erp_action_5) { |
| 2598 | |
| 2599 | /* retries have not been successful */ |
| 2600 | /* prepare erp for retry on different channel path */ |
| 2601 | erp = dasd_3990_erp_action_1(erp); |
| 2602 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2603 | if (sense && !(sense[2] & DASD_SENSE_BIT_0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2604 | |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2605 | /* issue a Diagnostic Control command with an |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2606 | * Inhibit Write subcommand */ |
| 2607 | |
| 2608 | switch (sense[25]) { |
| 2609 | case 0x17: |
| 2610 | case 0x57:{ /* controller */ |
| 2611 | erp = dasd_3990_erp_DCTL(erp, 0x20); |
| 2612 | break; |
| 2613 | } |
| 2614 | case 0x18: |
| 2615 | case 0x58:{ /* channel path */ |
| 2616 | erp = dasd_3990_erp_DCTL(erp, 0x40); |
| 2617 | break; |
| 2618 | } |
| 2619 | case 0x19: |
| 2620 | case 0x59:{ /* storage director */ |
| 2621 | erp = dasd_3990_erp_DCTL(erp, 0x80); |
| 2622 | break; |
| 2623 | } |
| 2624 | default: |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2625 | DBF_DEV_EVENT(DBF_WARNING, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2626 | "invalid subcommand modifier 0x%x " |
| 2627 | "for Diagnostic Control Command", |
| 2628 | sense[25]); |
| 2629 | } |
| 2630 | } |
| 2631 | |
| 2632 | /* check for 32 byte sense ERP */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2633 | } else if (sense && |
| 2634 | ((erp->function == dasd_3990_erp_compound_retry) || |
| 2635 | (erp->function == dasd_3990_erp_compound_path) || |
| 2636 | (erp->function == dasd_3990_erp_compound_code) || |
| 2637 | (erp->function == dasd_3990_erp_compound_config))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2638 | |
| 2639 | erp = dasd_3990_erp_compound(erp, sense); |
| 2640 | |
| 2641 | } else { |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2642 | /* |
| 2643 | * No retry left and no additional special handling |
| 2644 | * necessary |
| 2645 | */ |
| 2646 | dev_err(&device->cdev->dev, |
| 2647 | "ERP %p has run out of retries and failed\n", erp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2648 | |
| 2649 | erp->status = DASD_CQR_FAILED; |
| 2650 | } |
| 2651 | |
| 2652 | return erp; |
| 2653 | |
| 2654 | } /* end dasd_3990_erp_further_erp */ |
| 2655 | |
| 2656 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2657 | * DASD_3990_ERP_HANDLE_MATCH_ERP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | * |
| 2659 | * DESCRIPTION |
| 2660 | * An error occurred again and an ERP has been detected which is already |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2661 | * used to handle this error (e.g. retries). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2662 | * All prior ERP's are asumed to be successful and therefore removed |
| 2663 | * from queue. |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2664 | * If retry counter of matching erp is already 0, it is checked if further |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2665 | * action is needed (besides retry) or if the ERP has failed. |
| 2666 | * |
| 2667 | * PARAMETER |
| 2668 | * erp_head first ERP in ERP-chain |
| 2669 | * erp ERP that handles the actual error. |
| 2670 | * (matching erp) |
| 2671 | * |
| 2672 | * RETURN VALUES |
| 2673 | * erp modified/additional ERP |
| 2674 | */ |
| 2675 | static struct dasd_ccw_req * |
| 2676 | dasd_3990_erp_handle_match_erp(struct dasd_ccw_req *erp_head, |
| 2677 | struct dasd_ccw_req *erp) |
| 2678 | { |
| 2679 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2680 | struct dasd_device *device = erp_head->startdev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2681 | struct dasd_ccw_req *erp_done = erp_head; /* finished req */ |
| 2682 | struct dasd_ccw_req *erp_free = NULL; /* req to be freed */ |
| 2683 | |
| 2684 | /* loop over successful ERPs and remove them from chanq */ |
| 2685 | while (erp_done != erp) { |
| 2686 | |
| 2687 | if (erp_done == NULL) /* end of chain reached */ |
| 2688 | panic(PRINTK_HEADER "Programming error in ERP! The " |
| 2689 | "original request was lost\n"); |
| 2690 | |
| 2691 | /* remove the request from the device queue */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2692 | list_del(&erp_done->blocklist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2693 | |
| 2694 | erp_free = erp_done; |
| 2695 | erp_done = erp_done->refers; |
| 2696 | |
| 2697 | /* free the finished erp request */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2698 | dasd_free_erp_request(erp_free, erp_free->memdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2699 | |
| 2700 | } /* end while */ |
| 2701 | |
| 2702 | if (erp->retries > 0) { |
| 2703 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2704 | char *sense = dasd_get_sense(&erp->refers->irb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2705 | |
| 2706 | /* check for special retries */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2707 | if (sense && erp->function == dasd_3990_erp_action_4) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2708 | |
| 2709 | erp = dasd_3990_erp_action_4(erp, sense); |
| 2710 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2711 | } else if (sense && |
| 2712 | erp->function == dasd_3990_erp_action_1B_32) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2713 | |
| 2714 | erp = dasd_3990_update_1B(erp, sense); |
| 2715 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2716 | } else if (sense && erp->function == dasd_3990_erp_int_req) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2717 | |
| 2718 | erp = dasd_3990_erp_int_req(erp); |
| 2719 | |
| 2720 | } else { |
| 2721 | /* simple retry */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2722 | DBF_DEV_EVENT(DBF_DEBUG, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2723 | "%i retries left for erp %p", |
| 2724 | erp->retries, erp); |
| 2725 | |
| 2726 | /* handle the request again... */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2727 | erp->status = DASD_CQR_FILLED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2728 | } |
| 2729 | |
| 2730 | } else { |
| 2731 | /* no retry left - check for further necessary action */ |
| 2732 | /* if no further actions, handle rest as permanent error */ |
| 2733 | erp = dasd_3990_erp_further_erp(erp); |
| 2734 | } |
| 2735 | |
| 2736 | return erp; |
| 2737 | |
| 2738 | } /* end dasd_3990_erp_handle_match_erp */ |
| 2739 | |
| 2740 | /* |
| 2741 | * DASD_3990_ERP_ACTION |
| 2742 | * |
| 2743 | * DESCRIPTION |
Joe Perches | 5d67d16 | 2008-01-26 14:11:20 +0100 | [diff] [blame] | 2744 | * control routine for 3990 erp actions. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2745 | * Has to be called with the queue lock (namely the s390_irq_lock) acquired. |
| 2746 | * |
| 2747 | * PARAMETER |
| 2748 | * cqr failed cqr (either original cqr or already an erp) |
| 2749 | * |
| 2750 | * RETURN VALUES |
| 2751 | * erp erp-pointer to the head of the ERP action chain. |
| 2752 | * This means: |
| 2753 | * - either a ptr to an additional ERP cqr or |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2754 | * - the original given cqr (which's status might |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2755 | * be modified) |
| 2756 | */ |
| 2757 | struct dasd_ccw_req * |
| 2758 | dasd_3990_erp_action(struct dasd_ccw_req * cqr) |
| 2759 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2760 | struct dasd_ccw_req *erp = NULL; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2761 | struct dasd_device *device = cqr->startdev; |
Horst Hummel | 9575bf2 | 2006-12-08 15:54:15 +0100 | [diff] [blame] | 2762 | struct dasd_ccw_req *temp_erp = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2763 | |
Horst Hummel | 9575bf2 | 2006-12-08 15:54:15 +0100 | [diff] [blame] | 2764 | if (device->features & DASD_FEATURE_ERPLOG) { |
| 2765 | /* print current erp_chain */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2766 | dev_err(&device->cdev->dev, |
| 2767 | "ERP chain at BEGINNING of ERP-ACTION\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2768 | for (temp_erp = cqr; |
| 2769 | temp_erp != NULL; temp_erp = temp_erp->refers) { |
| 2770 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2771 | dev_err(&device->cdev->dev, |
| 2772 | "ERP %p (%02x) refers to %p\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2773 | temp_erp, temp_erp->status, |
| 2774 | temp_erp->refers); |
| 2775 | } |
| 2776 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2777 | |
Coly Li | 73ac36e | 2009-01-07 18:09:16 -0800 | [diff] [blame] | 2778 | /* double-check if current erp/cqr was successful */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 2779 | if ((scsw_cstat(&cqr->irb.scsw) == 0x00) && |
| 2780 | (scsw_dstat(&cqr->irb.scsw) == |
Peter Oberparleiter | 23d805b | 2008-07-14 09:58:50 +0200 | [diff] [blame] | 2781 | (DEV_STAT_CHN_END | DEV_STAT_DEV_END))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2782 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2783 | DBF_DEV_EVENT(DBF_DEBUG, device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2784 | "ERP called for successful request %p" |
| 2785 | " - NO ERP necessary", cqr); |
| 2786 | |
| 2787 | cqr->status = DASD_CQR_DONE; |
| 2788 | |
| 2789 | return cqr; |
| 2790 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2791 | |
| 2792 | /* check if error happened before */ |
| 2793 | erp = dasd_3990_erp_in_erp(cqr); |
| 2794 | |
| 2795 | if (erp == NULL) { |
| 2796 | /* no matching erp found - set up erp */ |
| 2797 | erp = dasd_3990_erp_additional_erp(cqr); |
Stefan Haberland | 6a5176c | 2010-04-22 17:17:02 +0200 | [diff] [blame] | 2798 | if (IS_ERR(erp)) |
| 2799 | return erp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2800 | } else { |
| 2801 | /* matching erp found - set all leading erp's to DONE */ |
| 2802 | erp = dasd_3990_erp_handle_match_erp(cqr, erp); |
| 2803 | } |
| 2804 | |
Horst Hummel | 9575bf2 | 2006-12-08 15:54:15 +0100 | [diff] [blame] | 2805 | if (device->features & DASD_FEATURE_ERPLOG) { |
| 2806 | /* print current erp_chain */ |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2807 | dev_err(&device->cdev->dev, |
| 2808 | "ERP chain at END of ERP-ACTION\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2809 | for (temp_erp = erp; |
| 2810 | temp_erp != NULL; temp_erp = temp_erp->refers) { |
| 2811 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2812 | dev_err(&device->cdev->dev, |
| 2813 | "ERP %p (%02x) refers to %p\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2814 | temp_erp, temp_erp->status, |
| 2815 | temp_erp->refers); |
| 2816 | } |
| 2817 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2818 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 2819 | /* enqueue ERP request if it's a new one */ |
| 2820 | if (list_empty(&erp->blocklist)) { |
| 2821 | cqr->status = DASD_CQR_IN_ERP; |
| 2822 | /* add erp request before the cqr */ |
| 2823 | list_add_tail(&erp->blocklist, &cqr->blocklist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2824 | } |
| 2825 | |
Stefan Haberland | fc19f38 | 2009-03-26 15:23:49 +0100 | [diff] [blame] | 2826 | |
| 2827 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2828 | return erp; |
| 2829 | |
| 2830 | } /* end dasd_3990_erp_action */ |