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