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