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