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