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