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