2 * File...........: linux/drivers/s390/block/dasd_3990_erp.c
3 * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com>
4 * Holger Smolinski <Holger.Smolinski@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
10 #define KMSG_COMPONENT "dasd-eckd"
12 #include <linux/timer.h>
13 #include <asm/idals.h>
15 #define PRINTK_HEADER "dasd_erp(3990): "
18 #include "dasd_eckd.h"
22 unsigned char subcommand
; /* e.g Inhibit Write, Enable Write,... */
23 unsigned char modifier
; /* Subcommand modifier */
24 unsigned short res
; /* reserved */
25 } __attribute__ ((packed
));
28 *****************************************************************************
29 * SECTION ERP HANDLING
30 *****************************************************************************
33 *****************************************************************************
34 * 24 and 32 byte sense ERP functions
35 *****************************************************************************
39 * DASD_3990_ERP_CLEANUP
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
46 * erp request to be blocked
47 * final_status either DASD_CQR_DONE or DASD_CQR_FAILED
52 static struct dasd_ccw_req
*
53 dasd_3990_erp_cleanup(struct dasd_ccw_req
* erp
, char final_status
)
55 struct dasd_ccw_req
*cqr
= erp
->refers
;
57 dasd_free_erp_request(erp
, erp
->memdev
);
58 cqr
->status
= final_status
;
61 } /* end dasd_3990_erp_cleanup */
64 * DASD_3990_ERP_BLOCK_QUEUE
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.
71 static void dasd_3990_erp_block_queue(struct dasd_ccw_req
*erp
, int expires
)
74 struct dasd_device
*device
= erp
->startdev
;
77 DBF_DEV_EVENT(DBF_INFO
, device
,
78 "blocking request queue for %is", expires
/HZ
);
80 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
81 dasd_device_set_stop_bits(device
, DASD_STOPPED_PENDING
);
82 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
83 erp
->status
= DASD_CQR_FILLED
;
85 dasd_block_set_timer(erp
->block
, expires
);
87 dasd_device_set_timer(device
, expires
);
91 * DASD_3990_ERP_INT_REQ
94 * Handles 'Intervention Required' error.
95 * This means either device offline or not installed.
102 static struct dasd_ccw_req
*
103 dasd_3990_erp_int_req(struct dasd_ccw_req
* erp
)
106 struct dasd_device
*device
= erp
->startdev
;
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
) {
114 erp
->function
= dasd_3990_erp_int_req
;
118 /* issue a message and wait for 'device ready' interrupt */
119 dev_err(&device
->cdev
->dev
,
120 "is offline or not installed - "
121 "INTERVENTION REQUIRED!!\n");
123 dasd_3990_erp_block_queue(erp
, 60*HZ
);
128 } /* end dasd_3990_erp_int_req */
131 * DASD_3990_ERP_ALTERNATE_PATH
134 * Repeat the operation on a different channel path.
135 * If all alternate paths have been tried, the request is posted with a
139 * erp pointer to the current ERP
142 * erp modified pointer to the ERP
145 dasd_3990_erp_alternate_path(struct dasd_ccw_req
* erp
)
147 struct dasd_device
*device
= erp
->startdev
;
151 /* try alternate valid path */
152 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
153 opm
= ccw_device_get_path_mask(device
->cdev
);
154 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
155 //FIXME: start with get_opm ?
157 erp
->lpm
= LPM_ANYPATH
& ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
159 erp
->lpm
&= ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
161 if ((erp
->lpm
& opm
) != 0x00) {
163 DBF_DEV_EVENT(DBF_WARNING
, device
,
164 "try alternate lpm=%x (lpum=%x / opm=%x)",
165 erp
->lpm
, erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
167 /* reset status to submit the request again... */
168 erp
->status
= DASD_CQR_FILLED
;
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
);
175 /* post request with permanent error */
176 erp
->status
= DASD_CQR_FAILED
;
178 } /* end dasd_3990_erp_alternate_path */
184 * Setup cqr to do the Diagnostic Control (DCTL) command with an
185 * Inhibit Write subcommand (0x20) and the given modifier.
188 * erp pointer to the current (failed) ERP
189 * modifier subcommand modifier
192 * dctl_cqr pointer to NEW dctl_cqr
195 static struct dasd_ccw_req
*
196 dasd_3990_erp_DCTL(struct dasd_ccw_req
* erp
, char modifier
)
199 struct dasd_device
*device
= erp
->startdev
;
200 struct DCTL_data
*DCTL_data
;
202 struct dasd_ccw_req
*dctl_cqr
;
204 dctl_cqr
= dasd_alloc_erp_request((char *) &erp
->magic
, 1,
205 sizeof(struct DCTL_data
),
207 if (IS_ERR(dctl_cqr
)) {
208 dev_err(&device
->cdev
->dev
,
209 "Unable to allocate DCTL-CQR\n");
210 erp
->status
= DASD_CQR_FAILED
;
214 DCTL_data
= dctl_cqr
->data
;
216 DCTL_data
->subcommand
= 0x02; /* Inhibit Write */
217 DCTL_data
->modifier
= modifier
;
219 ccw
= dctl_cqr
->cpaddr
;
220 memset(ccw
, 0, sizeof(struct ccw1
));
221 ccw
->cmd_code
= CCW_CMD_DCTL
;
223 ccw
->cda
= (__u32
)(addr_t
) DCTL_data
;
224 dctl_cqr
->function
= dasd_3990_erp_DCTL
;
225 dctl_cqr
->refers
= erp
;
226 dctl_cqr
->startdev
= device
;
227 dctl_cqr
->memdev
= device
;
228 dctl_cqr
->magic
= erp
->magic
;
229 dctl_cqr
->expires
= 5 * 60 * HZ
;
230 dctl_cqr
->retries
= 2;
232 dctl_cqr
->buildclk
= get_clock();
234 dctl_cqr
->status
= DASD_CQR_FILLED
;
238 } /* end dasd_3990_erp_DCTL */
241 * DASD_3990_ERP_ACTION_1
244 * Setup ERP to do the ERP action 1 (see Reference manual).
245 * Repeat the operation on a different channel path.
246 * As deviation from the recommended recovery action, we reset the path mask
247 * after we have tried each path and go through all paths a second time.
248 * This will cover situations where only one path at a time is actually down,
249 * but all paths fail and recover just with the same sequence and timing as
250 * we try to use them (flapping links).
251 * If all alternate paths have been tried twice, the request is posted with
255 * erp pointer to the current ERP
258 * erp pointer to the ERP
261 static struct dasd_ccw_req
*dasd_3990_erp_action_1_sec(struct dasd_ccw_req
*erp
)
263 erp
->function
= dasd_3990_erp_action_1_sec
;
264 dasd_3990_erp_alternate_path(erp
);
268 static struct dasd_ccw_req
*dasd_3990_erp_action_1(struct dasd_ccw_req
*erp
)
270 erp
->function
= dasd_3990_erp_action_1
;
271 dasd_3990_erp_alternate_path(erp
);
272 if (erp
->status
== DASD_CQR_FAILED
) {
273 erp
->status
= DASD_CQR_FILLED
;
275 erp
->lpm
= LPM_ANYPATH
;
276 erp
->function
= dasd_3990_erp_action_1_sec
;
279 } /* end dasd_3990_erp_action_1(b) */
282 * DASD_3990_ERP_ACTION_4
285 * Setup ERP to do the ERP action 4 (see Reference manual).
286 * Set the current request to PENDING to block the CQR queue for that device
287 * until the state change interrupt appears.
288 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
292 * sense sense data of the actual error
293 * erp pointer to the current ERP
296 * erp pointer to the ERP
299 static struct dasd_ccw_req
*
300 dasd_3990_erp_action_4(struct dasd_ccw_req
* erp
, char *sense
)
303 struct dasd_device
*device
= erp
->startdev
;
305 /* first time set initial retry counter and erp_function */
306 /* and retry once without waiting for state change pending */
307 /* interrupt (this enables easier enqueing of the cqr) */
308 if (erp
->function
!= dasd_3990_erp_action_4
) {
310 DBF_DEV_EVENT(DBF_INFO
, device
, "%s",
311 "dasd_3990_erp_action_4: first time retry");
314 erp
->function
= dasd_3990_erp_action_4
;
317 if (sense
&& (sense
[25] == 0x1D)) { /* state change pending */
319 DBF_DEV_EVENT(DBF_INFO
, device
,
320 "waiting for state change pending "
321 "interrupt, %d retries left",
324 dasd_3990_erp_block_queue(erp
, 30*HZ
);
326 } else if (sense
&& (sense
[25] == 0x1E)) { /* busy */
327 DBF_DEV_EVENT(DBF_INFO
, device
,
328 "busy - redriving request later, "
331 dasd_3990_erp_block_queue(erp
, HZ
);
333 /* no state change pending - retry */
334 DBF_DEV_EVENT(DBF_INFO
, device
,
335 "redriving request immediately, "
338 erp
->status
= DASD_CQR_FILLED
;
344 } /* end dasd_3990_erp_action_4 */
347 *****************************************************************************
348 * 24 byte sense ERP functions (only)
349 *****************************************************************************
353 * DASD_3990_ERP_ACTION_5
356 * Setup ERP to do the ERP action 5 (see Reference manual).
357 * NOTE: Further handling is done in xxx_further_erp after the retries.
360 * erp pointer to the current ERP
363 * erp pointer to the ERP
366 static struct dasd_ccw_req
*
367 dasd_3990_erp_action_5(struct dasd_ccw_req
* erp
)
370 /* first of all retry */
372 erp
->function
= dasd_3990_erp_action_5
;
376 } /* end dasd_3990_erp_action_5 */
379 * DASD_3990_HANDLE_ENV_DATA
382 * Handles 24 byte 'Environmental data present'.
383 * Does a analysis of the sense data (message Format)
384 * and prints the error messages.
387 * sense current sense data
393 dasd_3990_handle_env_data(struct dasd_ccw_req
* erp
, char *sense
)
396 struct dasd_device
*device
= erp
->startdev
;
397 char msg_format
= (sense
[7] & 0xF0);
398 char msg_no
= (sense
[7] & 0x0F);
399 char errorstring
[ERRORLENGTH
];
401 switch (msg_format
) {
402 case 0x00: /* Format 0 - Program or System Checks */
404 if (sense
[1] & 0x10) { /* check message to operator bit */
407 case 0x00: /* No Message */
410 dev_warn(&device
->cdev
->dev
,
411 "FORMAT 0 - Invalid Command\n");
414 dev_warn(&device
->cdev
->dev
,
415 "FORMAT 0 - Invalid Command "
419 dev_warn(&device
->cdev
->dev
,
420 "FORMAT 0 - CCW Count less than "
424 dev_warn(&device
->cdev
->dev
,
425 "FORMAT 0 - Invalid Parameter\n");
428 dev_warn(&device
->cdev
->dev
,
429 "FORMAT 0 - Diagnostic of Special"
430 " Command Violates File Mask\n");
433 dev_warn(&device
->cdev
->dev
,
434 "FORMAT 0 - Channel Returned with "
435 "Incorrect retry CCW\n");
438 dev_warn(&device
->cdev
->dev
,
439 "FORMAT 0 - Reset Notification\n");
442 dev_warn(&device
->cdev
->dev
,
443 "FORMAT 0 - Storage Path Restart\n");
446 dev_warn(&device
->cdev
->dev
,
447 "FORMAT 0 - Channel requested "
448 "... %02x\n", sense
[8]);
451 dev_warn(&device
->cdev
->dev
,
452 "FORMAT 0 - Invalid Defective/"
453 "Alternate Track Pointer\n");
456 dev_warn(&device
->cdev
->dev
,
457 "FORMAT 0 - DPS Installation "
461 dev_warn(&device
->cdev
->dev
,
462 "FORMAT 0 - Command Invalid on "
463 "Secondary Address\n");
466 dev_warn(&device
->cdev
->dev
,
467 "FORMAT 0 - Status Not As "
468 "Required: reason %02x\n",
472 dev_warn(&device
->cdev
->dev
,
473 "FORMAT 0 - Reserved\n");
477 case 0x00: /* No Message */
480 dev_warn(&device
->cdev
->dev
,
481 "FORMAT 0 - Device Error "
485 dev_warn(&device
->cdev
->dev
,
486 "FORMAT 0 - Reserved\n");
489 dev_warn(&device
->cdev
->dev
,
490 "FORMAT 0 - Device Fenced - "
491 "device = %02x\n", sense
[4]);
494 dev_warn(&device
->cdev
->dev
,
495 "FORMAT 0 - Data Pinned for "
499 dev_warn(&device
->cdev
->dev
,
500 "FORMAT 0 - Reserved\n");
505 case 0x10: /* Format 1 - Device Equipment Checks */
507 case 0x00: /* No Message */
510 dev_warn(&device
->cdev
->dev
,
511 "FORMAT 1 - Device Status 1 not as "
515 dev_warn(&device
->cdev
->dev
,
516 "FORMAT 1 - Index missing\n");
519 dev_warn(&device
->cdev
->dev
,
520 "FORMAT 1 - Interruption cannot be "
524 dev_warn(&device
->cdev
->dev
,
525 "FORMAT 1 - Device did not respond to "
529 dev_warn(&device
->cdev
->dev
,
530 "FORMAT 1 - Device check-2 error or Set "
531 "Sector is not complete\n");
534 dev_warn(&device
->cdev
->dev
,
535 "FORMAT 1 - Head address does not "
539 dev_warn(&device
->cdev
->dev
,
540 "FORMAT 1 - Device status 1 not valid\n");
543 dev_warn(&device
->cdev
->dev
,
544 "FORMAT 1 - Device not ready\n");
547 dev_warn(&device
->cdev
->dev
,
548 "FORMAT 1 - Track physical address did "
552 dev_warn(&device
->cdev
->dev
,
553 "FORMAT 1 - Missing device address bit\n");
556 dev_warn(&device
->cdev
->dev
,
557 "FORMAT 1 - Drive motor switch is off\n");
560 dev_warn(&device
->cdev
->dev
,
561 "FORMAT 1 - Seek incomplete\n");
564 dev_warn(&device
->cdev
->dev
,
565 "FORMAT 1 - Cylinder address did not "
569 dev_warn(&device
->cdev
->dev
,
570 "FORMAT 1 - Offset active cannot be "
574 dev_warn(&device
->cdev
->dev
,
575 "FORMAT 1 - Reserved\n");
579 case 0x20: /* Format 2 - 3990 Equipment Checks */
582 dev_warn(&device
->cdev
->dev
,
583 "FORMAT 2 - 3990 check-2 error\n");
586 dev_warn(&device
->cdev
->dev
,
587 "FORMAT 2 - Support facility errors\n");
590 dev_warn(&device
->cdev
->dev
,
591 "FORMAT 2 - Microcode detected error "
596 dev_warn(&device
->cdev
->dev
,
597 "FORMAT 2 - Reserved\n");
601 case 0x30: /* Format 3 - 3990 Control Checks */
604 dev_warn(&device
->cdev
->dev
,
605 "FORMAT 3 - Allegiance terminated\n");
608 dev_warn(&device
->cdev
->dev
,
609 "FORMAT 3 - Reserved\n");
613 case 0x40: /* Format 4 - Data Checks */
616 dev_warn(&device
->cdev
->dev
,
617 "FORMAT 4 - Home address area error\n");
620 dev_warn(&device
->cdev
->dev
,
621 "FORMAT 4 - Count area error\n");
624 dev_warn(&device
->cdev
->dev
,
625 "FORMAT 4 - Key area error\n");
628 dev_warn(&device
->cdev
->dev
,
629 "FORMAT 4 - Data area error\n");
632 dev_warn(&device
->cdev
->dev
,
633 "FORMAT 4 - No sync byte in home address "
637 dev_warn(&device
->cdev
->dev
,
638 "FORMAT 4 - No sync byte in count address "
642 dev_warn(&device
->cdev
->dev
,
643 "FORMAT 4 - No sync byte in key area\n");
646 dev_warn(&device
->cdev
->dev
,
647 "FORMAT 4 - No sync byte in data area\n");
650 dev_warn(&device
->cdev
->dev
,
651 "FORMAT 4 - Home address area error; "
655 dev_warn(&device
->cdev
->dev
,
656 "FORMAT 4 - Count area error; offset "
660 dev_warn(&device
->cdev
->dev
,
661 "FORMAT 4 - Key area error; offset "
665 dev_warn(&device
->cdev
->dev
,
666 "FORMAT 4 - Data area error; "
670 dev_warn(&device
->cdev
->dev
,
671 "FORMAT 4 - No sync byte in home "
672 "address area; offset active\n");
675 dev_warn(&device
->cdev
->dev
,
676 "FORMAT 4 - No syn byte in count "
677 "address area; offset active\n");
680 dev_warn(&device
->cdev
->dev
,
681 "FORMAT 4 - No sync byte in key area; "
685 dev_warn(&device
->cdev
->dev
,
686 "FORMAT 4 - No syn byte in data area; "
690 dev_warn(&device
->cdev
->dev
,
691 "FORMAT 4 - Reserved\n");
695 case 0x50: /* Format 5 - Data Check with displacement information */
698 dev_warn(&device
->cdev
->dev
,
699 "FORMAT 5 - Data Check in the "
700 "home address area\n");
703 dev_warn(&device
->cdev
->dev
,
704 "FORMAT 5 - Data Check in the count "
708 dev_warn(&device
->cdev
->dev
,
709 "FORMAT 5 - Data Check in the key area\n");
712 dev_warn(&device
->cdev
->dev
,
713 "FORMAT 5 - Data Check in the data "
717 dev_warn(&device
->cdev
->dev
,
718 "FORMAT 5 - Data Check in the "
719 "home address area; offset active\n");
722 dev_warn(&device
->cdev
->dev
,
723 "FORMAT 5 - Data Check in the count area; "
727 dev_warn(&device
->cdev
->dev
,
728 "FORMAT 5 - Data Check in the key area; "
732 dev_warn(&device
->cdev
->dev
,
733 "FORMAT 5 - Data Check in the data area; "
737 dev_warn(&device
->cdev
->dev
,
738 "FORMAT 5 - Reserved\n");
742 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
745 dev_warn(&device
->cdev
->dev
,
746 "FORMAT 6 - Overrun on channel A\n");
749 dev_warn(&device
->cdev
->dev
,
750 "FORMAT 6 - Overrun on channel B\n");
753 dev_warn(&device
->cdev
->dev
,
754 "FORMAT 6 - Overrun on channel C\n");
757 dev_warn(&device
->cdev
->dev
,
758 "FORMAT 6 - Overrun on channel D\n");
761 dev_warn(&device
->cdev
->dev
,
762 "FORMAT 6 - Overrun on channel E\n");
765 dev_warn(&device
->cdev
->dev
,
766 "FORMAT 6 - Overrun on channel F\n");
769 dev_warn(&device
->cdev
->dev
,
770 "FORMAT 6 - Overrun on channel G\n");
773 dev_warn(&device
->cdev
->dev
,
774 "FORMAT 6 - Overrun on channel H\n");
777 dev_warn(&device
->cdev
->dev
,
778 "FORMAT 6 - Reserved\n");
782 case 0x70: /* Format 7 - Device Connection Control Checks */
785 dev_warn(&device
->cdev
->dev
,
786 "FORMAT 7 - RCC initiated by a connection "
790 dev_warn(&device
->cdev
->dev
,
791 "FORMAT 7 - RCC 1 sequence not "
795 dev_warn(&device
->cdev
->dev
,
796 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
800 dev_warn(&device
->cdev
->dev
,
801 "FORMAT 7 - Invalid tag-in during "
802 "selection sequence\n");
805 dev_warn(&device
->cdev
->dev
,
806 "FORMAT 7 - extra RCC required\n");
809 dev_warn(&device
->cdev
->dev
,
810 "FORMAT 7 - Invalid DCC selection "
811 "response or timeout\n");
814 dev_warn(&device
->cdev
->dev
,
815 "FORMAT 7 - Missing end operation; device "
816 "transfer complete\n");
819 dev_warn(&device
->cdev
->dev
,
820 "FORMAT 7 - Missing end operation; device "
821 "transfer incomplete\n");
824 dev_warn(&device
->cdev
->dev
,
825 "FORMAT 7 - Invalid tag-in for an "
826 "immediate command sequence\n");
829 dev_warn(&device
->cdev
->dev
,
830 "FORMAT 7 - Invalid tag-in for an "
831 "extended command sequence\n");
834 dev_warn(&device
->cdev
->dev
,
835 "FORMAT 7 - 3990 microcode time out when "
836 "stopping selection\n");
839 dev_warn(&device
->cdev
->dev
,
840 "FORMAT 7 - No response to selection "
841 "after a poll interruption\n");
844 dev_warn(&device
->cdev
->dev
,
845 "FORMAT 7 - Permanent path error (DASD "
846 "controller not available)\n");
849 dev_warn(&device
->cdev
->dev
,
850 "FORMAT 7 - DASD controller not available"
851 " on disconnected command chain\n");
854 dev_warn(&device
->cdev
->dev
,
855 "FORMAT 7 - Reserved\n");
859 case 0x80: /* Format 8 - Additional Device Equipment Checks */
861 case 0x00: /* No Message */
863 dev_warn(&device
->cdev
->dev
,
864 "FORMAT 8 - Error correction code "
868 dev_warn(&device
->cdev
->dev
,
869 "FORMAT 8 - Unexpected end operation "
873 dev_warn(&device
->cdev
->dev
,
874 "FORMAT 8 - End operation with transfer "
878 dev_warn(&device
->cdev
->dev
,
879 "FORMAT 8 - End operation with transfer "
883 dev_warn(&device
->cdev
->dev
,
884 "FORMAT 8 - DPS checks after a system "
885 "reset or selective reset\n");
888 dev_warn(&device
->cdev
->dev
,
889 "FORMAT 8 - DPS cannot be filled\n");
892 dev_warn(&device
->cdev
->dev
,
893 "FORMAT 8 - Short busy time-out during "
894 "device selection\n");
897 dev_warn(&device
->cdev
->dev
,
898 "FORMAT 8 - DASD controller failed to "
899 "set or reset the long busy latch\n");
902 dev_warn(&device
->cdev
->dev
,
903 "FORMAT 8 - No interruption from device "
904 "during a command chain\n");
907 dev_warn(&device
->cdev
->dev
,
908 "FORMAT 8 - Reserved\n");
912 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
915 break; /* No Message */
917 dev_warn(&device
->cdev
->dev
,
918 "FORMAT 9 - Device check-2 error\n");
921 dev_warn(&device
->cdev
->dev
,
922 "FORMAT 9 - Head address did not "
926 dev_warn(&device
->cdev
->dev
,
927 "FORMAT 9 - Track physical address did "
928 "not compare while oriented\n");
931 dev_warn(&device
->cdev
->dev
,
932 "FORMAT 9 - Cylinder address did not "
936 dev_warn(&device
->cdev
->dev
,
937 "FORMAT 9 - Reserved\n");
941 case 0xF0: /* Format F - Cache Storage Checks */
944 dev_warn(&device
->cdev
->dev
,
945 "FORMAT F - Operation Terminated\n");
948 dev_warn(&device
->cdev
->dev
,
949 "FORMAT F - Subsystem Processing Error\n");
952 dev_warn(&device
->cdev
->dev
,
953 "FORMAT F - Cache or nonvolatile storage "
954 "equipment failure\n");
957 dev_warn(&device
->cdev
->dev
,
958 "FORMAT F - Caching terminated\n");
961 dev_warn(&device
->cdev
->dev
,
962 "FORMAT F - Cache fast write access not "
966 dev_warn(&device
->cdev
->dev
,
967 "FORMAT F - Track format incorrect\n");
970 dev_warn(&device
->cdev
->dev
,
971 "FORMAT F - Caching reinitiated\n");
974 dev_warn(&device
->cdev
->dev
,
975 "FORMAT F - Nonvolatile storage "
979 dev_warn(&device
->cdev
->dev
,
980 "FORMAT F - Volume is suspended duplex\n");
981 /* call extended error reporting (EER) */
982 dasd_eer_write(device
, erp
->refers
,
983 DASD_EER_PPRCSUSPEND
);
986 dev_warn(&device
->cdev
->dev
,
987 "FORMAT F - Subsystem status cannot be "
991 dev_warn(&device
->cdev
->dev
,
992 "FORMAT F - Caching status reset to "
996 dev_warn(&device
->cdev
->dev
,
997 "FORMAT F - DASD Fast Write inhibited\n");
1000 dev_warn(&device
->cdev
->dev
,
1001 "FORMAT D - Reserved\n");
1005 default: /* unknown message format - should not happen
1006 internal error 03 - unknown message format */
1007 snprintf(errorstring
, ERRORLENGTH
, "03 %x02", msg_format
);
1008 dev_err(&device
->cdev
->dev
,
1009 "An error occurred in the DASD device driver, "
1010 "reason=%s\n", errorstring
);
1012 } /* end switch message format */
1014 } /* end dasd_3990_handle_env_data */
1017 * DASD_3990_ERP_COM_REJ
1020 * Handles 24 byte 'Command Reject' error.
1023 * erp current erp_head
1024 * sense current sense data
1027 * erp 'new' erp_head - pointer to new ERP
1029 static struct dasd_ccw_req
*
1030 dasd_3990_erp_com_rej(struct dasd_ccw_req
* erp
, char *sense
)
1033 struct dasd_device
*device
= erp
->startdev
;
1035 erp
->function
= dasd_3990_erp_com_rej
;
1037 /* env data present (ACTION 10 - retry should work) */
1038 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1040 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1041 "Command Reject - environmental data present");
1043 dasd_3990_handle_env_data(erp
, sense
);
1047 } else if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1048 dev_err(&device
->cdev
->dev
, "An I/O request was rejected"
1049 " because writing is inhibited\n");
1050 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1052 /* fatal error - set status to FAILED
1053 internal error 09 - Command Reject */
1054 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1055 "device driver, reason=%s\n", "09");
1057 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1062 } /* end dasd_3990_erp_com_rej */
1065 * DASD_3990_ERP_BUS_OUT
1068 * Handles 24 byte 'Bus Out Parity Check' error.
1071 * erp current erp_head
1073 * erp new erp_head - pointer to new ERP
1075 static struct dasd_ccw_req
*
1076 dasd_3990_erp_bus_out(struct dasd_ccw_req
* erp
)
1079 struct dasd_device
*device
= erp
->startdev
;
1081 /* first time set initial retry counter and erp_function */
1082 /* and retry once without blocking queue */
1083 /* (this enables easier enqueing of the cqr) */
1084 if (erp
->function
!= dasd_3990_erp_bus_out
) {
1086 erp
->function
= dasd_3990_erp_bus_out
;
1090 /* issue a message and wait for 'device ready' interrupt */
1091 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1092 "bus out parity error or BOPC requested by "
1095 dasd_3990_erp_block_queue(erp
, 60*HZ
);
1101 } /* end dasd_3990_erp_bus_out */
1104 * DASD_3990_ERP_EQUIP_CHECK
1107 * Handles 24 byte 'Equipment Check' error.
1110 * erp current erp_head
1112 * erp new erp_head - pointer to new ERP
1114 static struct dasd_ccw_req
*
1115 dasd_3990_erp_equip_check(struct dasd_ccw_req
* erp
, char *sense
)
1118 struct dasd_device
*device
= erp
->startdev
;
1120 erp
->function
= dasd_3990_erp_equip_check
;
1122 if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1123 dev_info(&device
->cdev
->dev
,
1124 "Write inhibited path encountered\n");
1126 /* vary path offline
1127 internal error 04 - Path should be varied off-line.*/
1128 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1129 "device driver, reason=%s\n", "04");
1131 erp
= dasd_3990_erp_action_1(erp
);
1133 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1135 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1136 "Equipment Check - " "environmental data present");
1138 dasd_3990_handle_env_data(erp
, sense
);
1140 erp
= dasd_3990_erp_action_4(erp
, sense
);
1142 } else if (sense
[1] & SNS1_PERM_ERR
) {
1144 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1145 "Equipment Check - retry exhausted or "
1148 erp
= dasd_3990_erp_action_1(erp
);
1151 /* all other equipment checks - Action 5 */
1152 /* rest is done when retries == 0 */
1153 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1154 "Equipment check or processing error");
1156 erp
= dasd_3990_erp_action_5(erp
);
1160 } /* end dasd_3990_erp_equip_check */
1163 * DASD_3990_ERP_DATA_CHECK
1166 * Handles 24 byte 'Data Check' error.
1169 * erp current erp_head
1171 * erp new erp_head - pointer to new ERP
1173 static struct dasd_ccw_req
*
1174 dasd_3990_erp_data_check(struct dasd_ccw_req
* erp
, char *sense
)
1177 struct dasd_device
*device
= erp
->startdev
;
1179 erp
->function
= dasd_3990_erp_data_check
;
1181 if (sense
[2] & SNS2_CORRECTABLE
) { /* correctable data check */
1183 /* issue message that the data has been corrected */
1184 dev_emerg(&device
->cdev
->dev
,
1185 "Data recovered during retry with PCI "
1186 "fetch mode active\n");
1188 /* not possible to handle this situation in Linux */
1189 panic("No way to inform application about the possibly "
1192 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1194 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1195 "Uncorrectable data check recovered secondary "
1196 "addr of duplex pair");
1198 erp
= dasd_3990_erp_action_4(erp
, sense
);
1200 } else if (sense
[1] & SNS1_PERM_ERR
) {
1202 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1203 "Uncorrectable data check with internal "
1206 erp
= dasd_3990_erp_action_1(erp
);
1209 /* all other data checks */
1210 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1211 "Uncorrectable data check with retry count "
1214 erp
= dasd_3990_erp_action_5(erp
);
1219 } /* end dasd_3990_erp_data_check */
1222 * DASD_3990_ERP_OVERRUN
1225 * Handles 24 byte 'Overrun' error.
1228 * erp current erp_head
1230 * erp new erp_head - pointer to new ERP
1232 static struct dasd_ccw_req
*
1233 dasd_3990_erp_overrun(struct dasd_ccw_req
* erp
, char *sense
)
1236 struct dasd_device
*device
= erp
->startdev
;
1238 erp
->function
= dasd_3990_erp_overrun
;
1240 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1241 "Overrun - service overrun or overrun"
1242 " error requested by channel");
1244 erp
= dasd_3990_erp_action_5(erp
);
1248 } /* end dasd_3990_erp_overrun */
1251 * DASD_3990_ERP_INV_FORMAT
1254 * Handles 24 byte 'Invalid Track Format' error.
1257 * erp current erp_head
1259 * erp new erp_head - pointer to new ERP
1261 static struct dasd_ccw_req
*
1262 dasd_3990_erp_inv_format(struct dasd_ccw_req
* erp
, char *sense
)
1265 struct dasd_device
*device
= erp
->startdev
;
1267 erp
->function
= dasd_3990_erp_inv_format
;
1269 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1271 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1272 "Track format error when destaging or "
1275 dasd_3990_handle_env_data(erp
, sense
);
1277 erp
= dasd_3990_erp_action_4(erp
, sense
);
1280 /* internal error 06 - The track format is not valid*/
1281 dev_err(&device
->cdev
->dev
,
1282 "An error occurred in the DASD device driver, "
1283 "reason=%s\n", "06");
1285 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1290 } /* end dasd_3990_erp_inv_format */
1296 * Handles 24 byte 'End-of-Cylinder' error.
1299 * erp already added default erp
1301 * erp pointer to original (failed) cqr.
1303 static struct dasd_ccw_req
*
1304 dasd_3990_erp_EOC(struct dasd_ccw_req
* default_erp
, char *sense
)
1307 struct dasd_device
*device
= default_erp
->startdev
;
1309 dev_err(&device
->cdev
->dev
,
1310 "The cylinder data for accessing the DASD is inconsistent\n");
1312 /* implement action 7 - BUG */
1313 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1315 } /* end dasd_3990_erp_EOC */
1318 * DASD_3990_ERP_ENV_DATA
1321 * Handles 24 byte 'Environmental-Data Present' error.
1324 * erp current erp_head
1326 * erp new erp_head - pointer to new ERP
1328 static struct dasd_ccw_req
*
1329 dasd_3990_erp_env_data(struct dasd_ccw_req
* erp
, char *sense
)
1332 struct dasd_device
*device
= erp
->startdev
;
1334 erp
->function
= dasd_3990_erp_env_data
;
1336 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s", "Environmental data present");
1338 dasd_3990_handle_env_data(erp
, sense
);
1340 /* don't retry on disabled interface */
1341 if (sense
[7] != 0x0F) {
1342 erp
= dasd_3990_erp_action_4(erp
, sense
);
1344 erp
->status
= DASD_CQR_FILLED
;
1349 } /* end dasd_3990_erp_env_data */
1352 * DASD_3990_ERP_NO_REC
1355 * Handles 24 byte 'No Record Found' error.
1358 * erp already added default ERP
1361 * erp new erp_head - pointer to new ERP
1363 static struct dasd_ccw_req
*
1364 dasd_3990_erp_no_rec(struct dasd_ccw_req
* default_erp
, char *sense
)
1367 struct dasd_device
*device
= default_erp
->startdev
;
1369 dev_err(&device
->cdev
->dev
,
1370 "The specified record was not found\n");
1372 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1374 } /* end dasd_3990_erp_no_rec */
1377 * DASD_3990_ERP_FILE_PROT
1380 * Handles 24 byte 'File Protected' error.
1381 * Note: Seek related recovery is not implemented because
1382 * wee don't use the seek command yet.
1385 * erp current erp_head
1387 * erp new erp_head - pointer to new ERP
1389 static struct dasd_ccw_req
*
1390 dasd_3990_erp_file_prot(struct dasd_ccw_req
* erp
)
1393 struct dasd_device
*device
= erp
->startdev
;
1395 dev_err(&device
->cdev
->dev
, "Accessing the DASD failed because of "
1396 "a hardware error\n");
1398 return dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1400 } /* end dasd_3990_erp_file_prot */
1403 * DASD_3990_ERP_INSPECT_ALIAS
1406 * Checks if the original request was started on an alias device.
1407 * If yes, it modifies the original and the erp request so that
1408 * the erp request can be started on a base device.
1411 * erp pointer to the currently created default ERP
1414 * erp pointer to the modified ERP, or NULL
1417 static struct dasd_ccw_req
*dasd_3990_erp_inspect_alias(
1418 struct dasd_ccw_req
*erp
)
1420 struct dasd_ccw_req
*cqr
= erp
->refers
;
1423 (cqr
->block
->base
!= cqr
->startdev
)) {
1424 if (cqr
->startdev
->features
& DASD_FEATURE_ERPLOG
) {
1425 DBF_DEV_EVENT(DBF_ERR
, cqr
->startdev
,
1426 "ERP on alias device for request %p,"
1427 " recover on base device %s", cqr
,
1428 dev_name(&cqr
->block
->base
->cdev
->dev
));
1430 dasd_eckd_reset_ccw_to_base_io(cqr
);
1431 erp
->startdev
= cqr
->block
->base
;
1432 erp
->function
= dasd_3990_erp_inspect_alias
;
1440 * DASD_3990_ERP_INSPECT_24
1443 * Does a detailed inspection of the 24 byte sense data
1444 * and sets up a related error recovery action.
1447 * sense sense data of the actual error
1448 * erp pointer to the currently created default ERP
1451 * erp pointer to the (addtitional) ERP
1453 static struct dasd_ccw_req
*
1454 dasd_3990_erp_inspect_24(struct dasd_ccw_req
* erp
, char *sense
)
1457 struct dasd_ccw_req
*erp_filled
= NULL
;
1459 /* Check sense for .... */
1460 /* 'Command Reject' */
1461 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_CMD_REJECT
)) {
1462 erp_filled
= dasd_3990_erp_com_rej(erp
, sense
);
1464 /* 'Intervention Required' */
1465 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_INTERVENTION_REQ
)) {
1466 erp_filled
= dasd_3990_erp_int_req(erp
);
1468 /* 'Bus Out Parity Check' */
1469 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_BUS_OUT_CHECK
)) {
1470 erp_filled
= dasd_3990_erp_bus_out(erp
);
1472 /* 'Equipment Check' */
1473 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_EQUIPMENT_CHECK
)) {
1474 erp_filled
= dasd_3990_erp_equip_check(erp
, sense
);
1477 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_DATA_CHECK
)) {
1478 erp_filled
= dasd_3990_erp_data_check(erp
, sense
);
1481 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_OVERRUN
)) {
1482 erp_filled
= dasd_3990_erp_overrun(erp
, sense
);
1484 /* 'Invalid Track Format' */
1485 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_INV_TRACK_FORMAT
)) {
1486 erp_filled
= dasd_3990_erp_inv_format(erp
, sense
);
1488 /* 'End-of-Cylinder' */
1489 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_EOC
)) {
1490 erp_filled
= dasd_3990_erp_EOC(erp
, sense
);
1492 /* 'Environmental Data' */
1493 if ((erp_filled
== NULL
) && (sense
[2] & SNS2_ENV_DATA_PRESENT
)) {
1494 erp_filled
= dasd_3990_erp_env_data(erp
, sense
);
1496 /* 'No Record Found' */
1497 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_NO_REC_FOUND
)) {
1498 erp_filled
= dasd_3990_erp_no_rec(erp
, sense
);
1500 /* 'File Protected' */
1501 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_FILE_PROTECTED
)) {
1502 erp_filled
= dasd_3990_erp_file_prot(erp
);
1504 /* other (unknown) error - do default ERP */
1505 if (erp_filled
== NULL
) {
1512 } /* END dasd_3990_erp_inspect_24 */
1515 *****************************************************************************
1516 * 32 byte sense ERP functions (only)
1517 *****************************************************************************
1521 * DASD_3990_ERPACTION_10_32
1524 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1525 * Just retry and if retry doesn't work, return with error.
1528 * erp current erp_head
1529 * sense current sense data
1531 * erp modified erp_head
1533 static struct dasd_ccw_req
*
1534 dasd_3990_erp_action_10_32(struct dasd_ccw_req
* erp
, char *sense
)
1537 struct dasd_device
*device
= erp
->startdev
;
1540 erp
->function
= dasd_3990_erp_action_10_32
;
1542 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s", "Perform logging requested");
1546 } /* end dasd_3990_erp_action_10_32 */
1549 * DASD_3990_ERP_ACTION_1B_32
1552 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
1553 * A write operation could not be finished because of an unexpected
1555 * The already created 'default erp' is used to get the link to
1556 * the erp chain, but it can not be used for this recovery
1557 * action because it contains no DE/LO data space.
1560 * default_erp already added default erp.
1561 * sense current sense data
1565 * default_erp in case of imprecise ending or error
1567 static struct dasd_ccw_req
*
1568 dasd_3990_erp_action_1B_32(struct dasd_ccw_req
* default_erp
, char *sense
)
1571 struct dasd_device
*device
= default_erp
->startdev
;
1573 struct dasd_ccw_req
*cqr
;
1574 struct dasd_ccw_req
*erp
;
1575 struct DE_eckd_data
*DE_data
;
1576 struct PFX_eckd_data
*PFX_data
;
1577 char *LO_data
; /* LO_eckd_data_t */
1578 struct ccw1
*ccw
, *oldccw
;
1580 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1581 "Write not finished because of unexpected condition");
1583 default_erp
->function
= dasd_3990_erp_action_1B_32
;
1585 /* determine the original cqr */
1588 while (cqr
->refers
!= NULL
) {
1592 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1593 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1594 "32 bit sense, action 1B is not defined"
1595 " in transport mode - just retry");
1599 /* for imprecise ending just do default erp */
1600 if (sense
[1] & 0x01) {
1601 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1602 "Imprecise ending is set - just retry");
1607 /* determine the address of the CCW to be restarted */
1608 /* Imprecise ending is not set -> addr from IRB-SCSW */
1609 cpa
= default_erp
->refers
->irb
.scsw
.cmd
.cpa
;
1612 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1613 "Unable to determine address of the CCW "
1616 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1619 /* Build new ERP request including DE/LO */
1620 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
1621 2 + 1,/* DE/LO + TIC */
1622 sizeof(struct DE_eckd_data
) +
1623 sizeof(struct LO_eckd_data
), device
);
1626 /* internal error 01 - Unable to allocate ERP */
1627 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1628 "device driver, reason=%s\n", "01");
1629 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1632 /* use original DE */
1633 DE_data
= erp
->data
;
1634 oldccw
= cqr
->cpaddr
;
1635 if (oldccw
->cmd_code
== DASD_ECKD_CCW_PFX
) {
1636 PFX_data
= cqr
->data
;
1637 memcpy(DE_data
, &PFX_data
->define_extent
,
1638 sizeof(struct DE_eckd_data
));
1640 memcpy(DE_data
, cqr
->data
, sizeof(struct DE_eckd_data
));
1643 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1645 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1647 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1650 if ((sense
[7] & 0x3F) == 0x01) {
1651 /* operation code is WRITE DATA -> data area orientation */
1654 } else if ((sense
[7] & 0x3F) == 0x03) {
1655 /* operation code is FORMAT WRITE -> index orientation */
1659 LO_data
[0] = sense
[7]; /* operation */
1662 LO_data
[1] = sense
[8]; /* auxiliary */
1663 LO_data
[2] = sense
[9];
1664 LO_data
[3] = sense
[3]; /* count */
1665 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1666 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1667 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1669 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1673 memset(ccw
, 0, sizeof(struct ccw1
));
1674 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
1675 ccw
->flags
= CCW_FLAG_CC
;
1677 ccw
->cda
= (__u32
)(addr_t
) DE_data
;
1681 memset(ccw
, 0, sizeof(struct ccw1
));
1682 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
1683 ccw
->flags
= CCW_FLAG_CC
;
1685 ccw
->cda
= (__u32
)(addr_t
) LO_data
;
1687 /* TIC to the failed ccw */
1689 ccw
->cmd_code
= CCW_CMD_TIC
;
1692 /* fill erp related fields */
1693 erp
->function
= dasd_3990_erp_action_1B_32
;
1694 erp
->refers
= default_erp
->refers
;
1695 erp
->startdev
= device
;
1696 erp
->memdev
= device
;
1697 erp
->magic
= default_erp
->magic
;
1700 erp
->buildclk
= get_clock();
1701 erp
->status
= DASD_CQR_FILLED
;
1703 /* remove the default erp */
1704 dasd_free_erp_request(default_erp
, device
);
1708 } /* end dasd_3990_erp_action_1B_32 */
1711 * DASD_3990_UPDATE_1B
1714 * Handles the update to the 32 byte 'Action 1B' of Single Program
1715 * Action Codes in case the first action was not successful.
1716 * The already created 'previous_erp' is the currently not successful
1720 * previous_erp already created previous erp.
1721 * sense current sense data
1725 static struct dasd_ccw_req
*
1726 dasd_3990_update_1B(struct dasd_ccw_req
* previous_erp
, char *sense
)
1729 struct dasd_device
*device
= previous_erp
->startdev
;
1731 struct dasd_ccw_req
*cqr
;
1732 struct dasd_ccw_req
*erp
;
1733 char *LO_data
; /* struct LO_eckd_data */
1736 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1737 "Write not finished because of unexpected condition"
1740 /* determine the original cqr */
1743 while (cqr
->refers
!= NULL
) {
1747 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1748 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1749 "32 bit sense, action 1B, update,"
1750 " in transport mode - just retry");
1751 return previous_erp
;
1754 /* for imprecise ending just do default erp */
1755 if (sense
[1] & 0x01) {
1756 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1757 "Imprecise ending is set - just retry");
1759 previous_erp
->status
= DASD_CQR_FILLED
;
1761 return previous_erp
;
1764 /* determine the address of the CCW to be restarted */
1765 /* Imprecise ending is not set -> addr from IRB-SCSW */
1766 cpa
= previous_erp
->irb
.scsw
.cmd
.cpa
;
1769 /* internal error 02 -
1770 Unable to determine address of the CCW to be restarted */
1771 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1772 "device driver, reason=%s\n", "02");
1774 previous_erp
->status
= DASD_CQR_FAILED
;
1776 return previous_erp
;
1781 /* update the LO with the new returned sense data */
1782 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1784 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1785 /* should not happen */
1786 previous_erp
->status
= DASD_CQR_FAILED
;
1788 return previous_erp
;
1791 if ((sense
[7] & 0x3F) == 0x01) {
1792 /* operation code is WRITE DATA -> data area orientation */
1795 } else if ((sense
[7] & 0x3F) == 0x03) {
1796 /* operation code is FORMAT WRITE -> index orientation */
1800 LO_data
[0] = sense
[7]; /* operation */
1803 LO_data
[1] = sense
[8]; /* auxiliary */
1804 LO_data
[2] = sense
[9];
1805 LO_data
[3] = sense
[3]; /* count */
1806 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1807 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1808 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1810 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1812 /* TIC to the failed ccw */
1813 ccw
= erp
->cpaddr
; /* addr of DE ccw */
1814 ccw
++; /* addr of LE ccw */
1815 ccw
++; /* addr of TIC ccw */
1818 erp
->status
= DASD_CQR_FILLED
;
1822 } /* end dasd_3990_update_1B */
1825 * DASD_3990_ERP_COMPOUND_RETRY
1828 * Handles the compound ERP action retry code.
1829 * NOTE: At least one retry is done even if zero is specified
1830 * by the sense data. This makes enqueueing of the request
1834 * sense sense data of the actual error
1835 * erp pointer to the currently created ERP
1838 * erp modified ERP pointer
1842 dasd_3990_erp_compound_retry(struct dasd_ccw_req
* erp
, char *sense
)
1845 switch (sense
[25] & 0x03) {
1846 case 0x00: /* no not retry */
1850 case 0x01: /* retry 2 times */
1854 case 0x02: /* retry 10 times */
1858 case 0x03: /* retry 256 times */
1866 erp
->function
= dasd_3990_erp_compound_retry
;
1868 } /* end dasd_3990_erp_compound_retry */
1871 * DASD_3990_ERP_COMPOUND_PATH
1874 * Handles the compound ERP action for retry on alternate
1878 * sense sense data of the actual error
1879 * erp pointer to the currently created ERP
1882 * erp modified ERP pointer
1886 dasd_3990_erp_compound_path(struct dasd_ccw_req
* erp
, char *sense
)
1889 if (sense
[25] & DASD_SENSE_BIT_3
) {
1890 dasd_3990_erp_alternate_path(erp
);
1892 if (erp
->status
== DASD_CQR_FAILED
) {
1893 /* reset the lpm and the status to be able to
1894 * try further actions. */
1897 erp
->status
= DASD_CQR_NEED_ERP
;
1901 erp
->function
= dasd_3990_erp_compound_path
;
1903 } /* end dasd_3990_erp_compound_path */
1906 * DASD_3990_ERP_COMPOUND_CODE
1909 * Handles the compound ERP action for retry code.
1912 * sense sense data of the actual error
1913 * erp pointer to the currently created ERP
1916 * erp NEW ERP pointer
1919 static struct dasd_ccw_req
*
1920 dasd_3990_erp_compound_code(struct dasd_ccw_req
* erp
, char *sense
)
1923 if (sense
[25] & DASD_SENSE_BIT_2
) {
1925 switch (sense
[28]) {
1927 /* issue a Diagnostic Control command with an
1928 * Inhibit Write subcommand and controller modifier */
1929 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
1933 /* wait for 5 seconds and retry again */
1936 dasd_3990_erp_block_queue (erp
, 5*HZ
);
1940 /* should not happen - continue */
1945 erp
->function
= dasd_3990_erp_compound_code
;
1949 } /* end dasd_3990_erp_compound_code */
1952 * DASD_3990_ERP_COMPOUND_CONFIG
1955 * Handles the compound ERP action for configruation
1957 * Note: duplex handling is not implemented (yet).
1960 * sense sense data of the actual error
1961 * erp pointer to the currently created ERP
1964 * erp modified ERP pointer
1968 dasd_3990_erp_compound_config(struct dasd_ccw_req
* erp
, char *sense
)
1971 if ((sense
[25] & DASD_SENSE_BIT_1
) && (sense
[26] & DASD_SENSE_BIT_2
)) {
1973 /* set to suspended duplex state then restart
1974 internal error 05 - Set device to suspended duplex state
1976 struct dasd_device
*device
= erp
->startdev
;
1977 dev_err(&device
->cdev
->dev
,
1978 "An error occurred in the DASD device driver, "
1979 "reason=%s\n", "05");
1983 erp
->function
= dasd_3990_erp_compound_config
;
1985 } /* end dasd_3990_erp_compound_config */
1988 * DASD_3990_ERP_COMPOUND
1991 * Does the further compound program action if
1992 * compound retry was not successful.
1995 * sense sense data of the actual error
1996 * erp pointer to the current (failed) ERP
1999 * erp (additional) ERP pointer
2002 static struct dasd_ccw_req
*
2003 dasd_3990_erp_compound(struct dasd_ccw_req
* erp
, char *sense
)
2006 if ((erp
->function
== dasd_3990_erp_compound_retry
) &&
2007 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2009 dasd_3990_erp_compound_path(erp
, sense
);
2012 if ((erp
->function
== dasd_3990_erp_compound_path
) &&
2013 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2015 erp
= dasd_3990_erp_compound_code(erp
, sense
);
2018 if ((erp
->function
== dasd_3990_erp_compound_code
) &&
2019 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2021 dasd_3990_erp_compound_config(erp
, sense
);
2024 /* if no compound action ERP specified, the request failed */
2025 if (erp
->status
== DASD_CQR_NEED_ERP
)
2026 erp
->status
= DASD_CQR_FAILED
;
2030 } /* end dasd_3990_erp_compound */
2033 *DASD_3990_ERP_HANDLE_SIM
2036 * inspects the SIM SENSE data and starts an appropriate action
2039 * sense sense data of the actual error
2045 dasd_3990_erp_handle_sim(struct dasd_device
*device
, char *sense
)
2047 /* print message according to log or message to operator mode */
2048 if ((sense
[24] & DASD_SIM_MSG_TO_OP
) || (sense
[1] & 0x10)) {
2049 /* print SIM SRC from RefCode */
2050 dev_err(&device
->cdev
->dev
, "SIM - SRC: "
2051 "%02x%02x%02x%02x\n", sense
[22],
2052 sense
[23], sense
[11], sense
[12]);
2053 } else if (sense
[24] & DASD_SIM_LOG
) {
2054 /* print SIM SRC Refcode */
2055 dev_warn(&device
->cdev
->dev
, "log SIM - SRC: "
2056 "%02x%02x%02x%02x\n", sense
[22],
2057 sense
[23], sense
[11], sense
[12]);
2062 * DASD_3990_ERP_INSPECT_32
2065 * Does a detailed inspection of the 32 byte sense data
2066 * and sets up a related error recovery action.
2069 * sense sense data of the actual error
2070 * erp pointer to the currently created default ERP
2073 * erp_filled pointer to the ERP
2076 static struct dasd_ccw_req
*
2077 dasd_3990_erp_inspect_32(struct dasd_ccw_req
* erp
, char *sense
)
2080 struct dasd_device
*device
= erp
->startdev
;
2082 erp
->function
= dasd_3990_erp_inspect_32
;
2084 /* check for SIM sense data */
2085 if ((sense
[6] & DASD_SIM_SENSE
) == DASD_SIM_SENSE
)
2086 dasd_3990_erp_handle_sim(device
, sense
);
2088 if (sense
[25] & DASD_SENSE_BIT_0
) {
2090 /* compound program action codes (byte25 bit 0 == '1') */
2091 dasd_3990_erp_compound_retry(erp
, sense
);
2095 /* single program action codes (byte25 bit 0 == '0') */
2096 switch (sense
[25]) {
2098 case 0x00: /* success - use default ERP for retries */
2099 DBF_DEV_EVENT(DBF_DEBUG
, device
, "%s",
2100 "ERP called for successful request"
2104 case 0x01: /* fatal error */
2105 dev_err(&device
->cdev
->dev
,
2106 "ERP failed for the DASD\n");
2108 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2111 case 0x02: /* intervention required */
2112 case 0x03: /* intervention required during dual copy */
2113 erp
= dasd_3990_erp_int_req(erp
);
2116 case 0x0F: /* length mismatch during update write command
2117 internal error 08 - update write command error*/
2118 dev_err(&device
->cdev
->dev
, "An error occurred in the "
2119 "DASD device driver, reason=%s\n", "08");
2121 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2124 case 0x10: /* logging required for other channel program */
2125 erp
= dasd_3990_erp_action_10_32(erp
, sense
);
2128 case 0x15: /* next track outside defined extend
2129 internal error 07 - The next track is not
2130 within the defined storage extent */
2131 dev_err(&device
->cdev
->dev
,
2132 "An error occurred in the DASD device driver, "
2133 "reason=%s\n", "07");
2135 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2138 case 0x1B: /* unexpected condition during write */
2140 erp
= dasd_3990_erp_action_1B_32(erp
, sense
);
2143 case 0x1C: /* invalid data */
2144 dev_emerg(&device
->cdev
->dev
,
2145 "Data recovered during retry with PCI "
2146 "fetch mode active\n");
2148 /* not possible to handle this situation in Linux */
2150 ("Invalid data - No way to inform application "
2151 "about the possibly incorrect data");
2154 case 0x1D: /* state-change pending */
2155 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2156 "A State change pending condition exists "
2157 "for the subsystem or device");
2159 erp
= dasd_3990_erp_action_4(erp
, sense
);
2162 case 0x1E: /* busy */
2163 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2164 "Busy condition exists "
2165 "for the subsystem or device");
2166 erp
= dasd_3990_erp_action_4(erp
, sense
);
2169 default: /* all others errors - default erp */
2176 } /* end dasd_3990_erp_inspect_32 */
2179 *****************************************************************************
2180 * main ERP control fuctions (24 and 32 byte sense)
2181 *****************************************************************************
2185 * DASD_3990_ERP_CONTROL_CHECK
2188 * Does a generic inspection if a control check occured and sets up
2189 * the related error recovery procedure
2192 * erp pointer to the currently created default ERP
2195 * erp_filled pointer to the erp
2198 static struct dasd_ccw_req
*
2199 dasd_3990_erp_control_check(struct dasd_ccw_req
*erp
)
2201 struct dasd_device
*device
= erp
->startdev
;
2203 if (scsw_cstat(&erp
->refers
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
2204 | SCHN_STAT_CHN_CTRL_CHK
)) {
2205 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2206 "channel or interface control check");
2207 erp
= dasd_3990_erp_action_4(erp
, NULL
);
2213 * DASD_3990_ERP_INSPECT
2216 * Does a detailed inspection for sense data by calling either
2217 * the 24-byte or the 32-byte inspection routine.
2220 * erp pointer to the currently created default ERP
2222 * erp_new contens was possibly modified
2224 static struct dasd_ccw_req
*
2225 dasd_3990_erp_inspect(struct dasd_ccw_req
*erp
)
2228 struct dasd_ccw_req
*erp_new
= NULL
;
2231 /* if this problem occured on an alias retry on base */
2232 erp_new
= dasd_3990_erp_inspect_alias(erp
);
2236 /* sense data are located in the refers record of the
2237 * already set up new ERP !
2238 * check if concurrent sens is available
2240 sense
= dasd_get_sense(&erp
->refers
->irb
);
2242 erp_new
= dasd_3990_erp_control_check(erp
);
2243 /* distinguish between 24 and 32 byte sense data */
2244 else if (sense
[27] & DASD_SENSE_BIT_0
) {
2246 /* inspect the 24 byte sense data */
2247 erp_new
= dasd_3990_erp_inspect_24(erp
, sense
);
2251 /* inspect the 32 byte sense data */
2252 erp_new
= dasd_3990_erp_inspect_32(erp
, sense
);
2254 } /* end distinguish between 24 and 32 byte sense data */
2260 * DASD_3990_ERP_ADD_ERP
2263 * This funtion adds an additional request block (ERP) to the head of
2264 * the given cqr (or erp).
2265 * For a command mode cqr the erp is initialized as an default erp
2267 * For transport mode we make a copy of the original TCW (points to
2268 * the original TCCB, TIDALs, etc.) but give it a fresh
2269 * TSB so the original sense data will not be changed.
2272 * cqr head of the current ERP-chain (or single cqr if
2275 * erp pointer to new ERP-chain head
2277 static struct dasd_ccw_req
*dasd_3990_erp_add_erp(struct dasd_ccw_req
*cqr
)
2280 struct dasd_device
*device
= cqr
->startdev
;
2282 struct dasd_ccw_req
*erp
;
2283 int cplength
, datasize
;
2287 if (cqr
->cpmode
== 1) {
2289 /* TCW needs to be 64 byte aligned, so leave enough room */
2290 datasize
= 64 + sizeof(struct tcw
) + sizeof(struct tsb
);
2296 /* allocate additional request block */
2297 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
2298 cplength
, datasize
, device
);
2300 if (cqr
->retries
<= 0) {
2301 DBF_DEV_EVENT(DBF_ERR
, device
, "%s",
2302 "Unable to allocate ERP request");
2303 cqr
->status
= DASD_CQR_FAILED
;
2304 cqr
->stopclk
= get_clock ();
2306 DBF_DEV_EVENT(DBF_ERR
, device
,
2307 "Unable to allocate ERP request "
2308 "(%i retries left)",
2310 dasd_block_set_timer(device
->block
, (HZ
<< 3));
2316 if (cqr
->cpmode
== 1) {
2317 /* make a shallow copy of the original tcw but set new tsb */
2319 erp
->cpaddr
= PTR_ALIGN(erp
->data
, 64);
2321 tsb
= (struct tsb
*) &tcw
[1];
2322 *tcw
= *((struct tcw
*)cqr
->cpaddr
);
2323 tcw
->tsb
= (long)tsb
;
2324 } else if (ccw
->cmd_code
== DASD_ECKD_CCW_PSF
) {
2325 /* PSF cannot be chained from NOOP/TIC */
2326 erp
->cpaddr
= cqr
->cpaddr
;
2328 /* initialize request with default TIC to current ERP/CQR */
2330 ccw
->cmd_code
= CCW_CMD_NOOP
;
2331 ccw
->flags
= CCW_FLAG_CC
;
2333 ccw
->cmd_code
= CCW_CMD_TIC
;
2334 ccw
->cda
= (long)(cqr
->cpaddr
);
2337 erp
->function
= dasd_3990_erp_add_erp
;
2339 erp
->startdev
= device
;
2340 erp
->memdev
= device
;
2341 erp
->block
= cqr
->block
;
2342 erp
->magic
= cqr
->magic
;
2345 erp
->buildclk
= get_clock();
2346 erp
->status
= DASD_CQR_FILLED
;
2352 * DASD_3990_ERP_ADDITIONAL_ERP
2355 * An additional ERP is needed to handle the current error.
2356 * Add ERP to the head of the ERP-chain containing the ERP processing
2357 * determined based on the sense data.
2360 * cqr head of the current ERP-chain (or single cqr if
2364 * erp pointer to new ERP-chain head
2366 static struct dasd_ccw_req
*
2367 dasd_3990_erp_additional_erp(struct dasd_ccw_req
* cqr
)
2370 struct dasd_ccw_req
*erp
= NULL
;
2372 /* add erp and initialize with default TIC */
2373 erp
= dasd_3990_erp_add_erp(cqr
);
2378 /* inspect sense, determine specific ERP if possible */
2381 erp
= dasd_3990_erp_inspect(erp
);
2386 } /* end dasd_3990_erp_additional_erp */
2389 * DASD_3990_ERP_ERROR_MATCH
2392 * Check if the device status of the given cqr is the same.
2393 * This means that the failed CCW and the relevant sense data
2395 * I don't distinguish between 24 and 32 byte sense because in case of
2396 * 24 byte sense byte 25 and 27 is set as well.
2399 * cqr1 first cqr, which will be compared with the
2403 * match 'boolean' for match found
2404 * returns 1 if match found, otherwise 0.
2406 static int dasd_3990_erp_error_match(struct dasd_ccw_req
*cqr1
,
2407 struct dasd_ccw_req
*cqr2
)
2409 char *sense1
, *sense2
;
2411 if (cqr1
->startdev
!= cqr2
->startdev
)
2414 sense1
= dasd_get_sense(&cqr1
->irb
);
2415 sense2
= dasd_get_sense(&cqr2
->irb
);
2417 /* one request has sense data, the other not -> no match, return 0 */
2418 if (!sense1
!= !sense2
)
2420 /* no sense data in both cases -> check cstat for IFCC */
2421 if (!sense1
&& !sense2
) {
2422 if ((scsw_cstat(&cqr1
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2423 SCHN_STAT_CHN_CTRL_CHK
)) ==
2424 (scsw_cstat(&cqr2
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2425 SCHN_STAT_CHN_CTRL_CHK
)))
2426 return 1; /* match with ifcc*/
2428 /* check sense data; byte 0-2,25,27 */
2429 if (!(sense1
&& sense2
&&
2430 (memcmp(sense1
, sense2
, 3) == 0) &&
2431 (sense1
[27] == sense2
[27]) &&
2432 (sense1
[25] == sense2
[25]))) {
2434 return 0; /* sense doesn't match */
2437 return 1; /* match */
2439 } /* end dasd_3990_erp_error_match */
2442 * DASD_3990_ERP_IN_ERP
2445 * check if the current error already happened before.
2446 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2449 * cqr failed cqr (either original cqr or already an erp)
2452 * erp erp-pointer to the already defined error
2453 * recovery procedure OR
2454 * NULL if a 'new' error occurred.
2456 static struct dasd_ccw_req
*
2457 dasd_3990_erp_in_erp(struct dasd_ccw_req
*cqr
)
2460 struct dasd_ccw_req
*erp_head
= cqr
, /* save erp chain head */
2461 *erp_match
= NULL
; /* save erp chain head */
2462 int match
= 0; /* 'boolean' for matching error found */
2464 if (cqr
->refers
== NULL
) { /* return if not in erp */
2468 /* check the erp/cqr chain for current error */
2470 match
= dasd_3990_erp_error_match(erp_head
, cqr
->refers
);
2471 erp_match
= cqr
; /* save possible matching erp */
2472 cqr
= cqr
->refers
; /* check next erp/cqr in queue */
2474 } while ((cqr
->refers
!= NULL
) && (!match
));
2477 return NULL
; /* no match was found */
2480 return erp_match
; /* return address of matching erp */
2482 } /* END dasd_3990_erp_in_erp */
2485 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2488 * No retry is left for the current ERP. Check what has to be done
2490 * - do further defined ERP action or
2491 * - wait for interrupt or
2492 * - exit with permanent error
2495 * erp ERP which is in progress with no retry left
2498 * erp modified/additional ERP
2500 static struct dasd_ccw_req
*
2501 dasd_3990_erp_further_erp(struct dasd_ccw_req
*erp
)
2504 struct dasd_device
*device
= erp
->startdev
;
2505 char *sense
= dasd_get_sense(&erp
->irb
);
2507 /* check for 24 byte sense ERP */
2508 if ((erp
->function
== dasd_3990_erp_bus_out
) ||
2509 (erp
->function
== dasd_3990_erp_action_1
) ||
2510 (erp
->function
== dasd_3990_erp_action_4
)) {
2512 erp
= dasd_3990_erp_action_1(erp
);
2514 } else if (erp
->function
== dasd_3990_erp_action_1_sec
) {
2515 erp
= dasd_3990_erp_action_1_sec(erp
);
2516 } else if (erp
->function
== dasd_3990_erp_action_5
) {
2518 /* retries have not been successful */
2519 /* prepare erp for retry on different channel path */
2520 erp
= dasd_3990_erp_action_1(erp
);
2522 if (sense
&& !(sense
[2] & DASD_SENSE_BIT_0
)) {
2524 /* issue a Diagnostic Control command with an
2525 * Inhibit Write subcommand */
2527 switch (sense
[25]) {
2529 case 0x57:{ /* controller */
2530 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2534 case 0x58:{ /* channel path */
2535 erp
= dasd_3990_erp_DCTL(erp
, 0x40);
2539 case 0x59:{ /* storage director */
2540 erp
= dasd_3990_erp_DCTL(erp
, 0x80);
2544 DBF_DEV_EVENT(DBF_WARNING
, device
,
2545 "invalid subcommand modifier 0x%x "
2546 "for Diagnostic Control Command",
2551 /* check for 32 byte sense ERP */
2553 ((erp
->function
== dasd_3990_erp_compound_retry
) ||
2554 (erp
->function
== dasd_3990_erp_compound_path
) ||
2555 (erp
->function
== dasd_3990_erp_compound_code
) ||
2556 (erp
->function
== dasd_3990_erp_compound_config
))) {
2558 erp
= dasd_3990_erp_compound(erp
, sense
);
2562 * No retry left and no additional special handling
2565 dev_err(&device
->cdev
->dev
,
2566 "ERP %p has run out of retries and failed\n", erp
);
2568 erp
->status
= DASD_CQR_FAILED
;
2573 } /* end dasd_3990_erp_further_erp */
2576 * DASD_3990_ERP_HANDLE_MATCH_ERP
2579 * An error occurred again and an ERP has been detected which is already
2580 * used to handle this error (e.g. retries).
2581 * All prior ERP's are asumed to be successful and therefore removed
2583 * If retry counter of matching erp is already 0, it is checked if further
2584 * action is needed (besides retry) or if the ERP has failed.
2587 * erp_head first ERP in ERP-chain
2588 * erp ERP that handles the actual error.
2592 * erp modified/additional ERP
2594 static struct dasd_ccw_req
*
2595 dasd_3990_erp_handle_match_erp(struct dasd_ccw_req
*erp_head
,
2596 struct dasd_ccw_req
*erp
)
2599 struct dasd_device
*device
= erp_head
->startdev
;
2600 struct dasd_ccw_req
*erp_done
= erp_head
; /* finished req */
2601 struct dasd_ccw_req
*erp_free
= NULL
; /* req to be freed */
2603 /* loop over successful ERPs and remove them from chanq */
2604 while (erp_done
!= erp
) {
2606 if (erp_done
== NULL
) /* end of chain reached */
2607 panic(PRINTK_HEADER
"Programming error in ERP! The "
2608 "original request was lost\n");
2610 /* remove the request from the device queue */
2611 list_del(&erp_done
->blocklist
);
2613 erp_free
= erp_done
;
2614 erp_done
= erp_done
->refers
;
2616 /* free the finished erp request */
2617 dasd_free_erp_request(erp_free
, erp_free
->memdev
);
2621 if (erp
->retries
> 0) {
2623 char *sense
= dasd_get_sense(&erp
->refers
->irb
);
2625 /* check for special retries */
2626 if (sense
&& erp
->function
== dasd_3990_erp_action_4
) {
2628 erp
= dasd_3990_erp_action_4(erp
, sense
);
2631 erp
->function
== dasd_3990_erp_action_1B_32
) {
2633 erp
= dasd_3990_update_1B(erp
, sense
);
2635 } else if (sense
&& erp
->function
== dasd_3990_erp_int_req
) {
2637 erp
= dasd_3990_erp_int_req(erp
);
2641 DBF_DEV_EVENT(DBF_DEBUG
, device
,
2642 "%i retries left for erp %p",
2645 /* handle the request again... */
2646 erp
->status
= DASD_CQR_FILLED
;
2650 /* no retry left - check for further necessary action */
2651 /* if no further actions, handle rest as permanent error */
2652 erp
= dasd_3990_erp_further_erp(erp
);
2657 } /* end dasd_3990_erp_handle_match_erp */
2660 * DASD_3990_ERP_ACTION
2663 * control routine for 3990 erp actions.
2664 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2667 * cqr failed cqr (either original cqr or already an erp)
2670 * erp erp-pointer to the head of the ERP action chain.
2672 * - either a ptr to an additional ERP cqr or
2673 * - the original given cqr (which's status might
2676 struct dasd_ccw_req
*
2677 dasd_3990_erp_action(struct dasd_ccw_req
* cqr
)
2679 struct dasd_ccw_req
*erp
= NULL
;
2680 struct dasd_device
*device
= cqr
->startdev
;
2681 struct dasd_ccw_req
*temp_erp
= NULL
;
2683 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2684 /* print current erp_chain */
2685 dev_err(&device
->cdev
->dev
,
2686 "ERP chain at BEGINNING of ERP-ACTION\n");
2687 for (temp_erp
= cqr
;
2688 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2690 dev_err(&device
->cdev
->dev
,
2691 "ERP %p (%02x) refers to %p\n",
2692 temp_erp
, temp_erp
->status
,
2697 /* double-check if current erp/cqr was successful */
2698 if ((scsw_cstat(&cqr
->irb
.scsw
) == 0x00) &&
2699 (scsw_dstat(&cqr
->irb
.scsw
) ==
2700 (DEV_STAT_CHN_END
| DEV_STAT_DEV_END
))) {
2702 DBF_DEV_EVENT(DBF_DEBUG
, device
,
2703 "ERP called for successful request %p"
2704 " - NO ERP necessary", cqr
);
2706 cqr
->status
= DASD_CQR_DONE
;
2711 /* check if error happened before */
2712 erp
= dasd_3990_erp_in_erp(cqr
);
2715 /* no matching erp found - set up erp */
2716 erp
= dasd_3990_erp_additional_erp(cqr
);
2720 /* matching erp found - set all leading erp's to DONE */
2721 erp
= dasd_3990_erp_handle_match_erp(cqr
, erp
);
2724 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2725 /* print current erp_chain */
2726 dev_err(&device
->cdev
->dev
,
2727 "ERP chain at END of ERP-ACTION\n");
2728 for (temp_erp
= erp
;
2729 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2731 dev_err(&device
->cdev
->dev
,
2732 "ERP %p (%02x) refers to %p\n",
2733 temp_erp
, temp_erp
->status
,
2738 /* enqueue ERP request if it's a new one */
2739 if (list_empty(&erp
->blocklist
)) {
2740 cqr
->status
= DASD_CQR_IN_ERP
;
2741 /* add erp request before the cqr */
2742 list_add_tail(&erp
->blocklist
, &cqr
->blocklist
);
2749 } /* end dasd_3990_erp_action */