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