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 #include <linux/timer.h>
11 #include <linux/slab.h>
12 #include <asm/idals.h>
13 #include <asm/todclk.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 EXAMINATION
30 *****************************************************************************
34 * DASD_3990_ERP_EXAMINE_24
37 * Checks only for fatal (unrecoverable) error.
38 * A detailed examination of the sense data is done later outside
39 * the interrupt handler.
41 * Each bit configuration leading to an action code 2 (Exit with
42 * programming error or unusual condition indication)
43 * are handled as fatal errorĀ“s.
45 * All other configurations are handled as recoverable errors.
48 * dasd_era_fatal for all fatal (unrecoverable errors)
49 * dasd_era_recover for all others.
52 dasd_3990_erp_examine_24(struct dasd_ccw_req
* cqr
, char *sense
)
55 struct dasd_device
*device
= cqr
->device
;
57 /* check for 'Command Reject' */
58 if ((sense
[0] & SNS0_CMD_REJECT
) &&
59 (!(sense
[2] & SNS2_ENV_DATA_PRESENT
))) {
61 DEV_MESSAGE(KERN_ERR
, device
, "%s",
62 "EXAMINE 24: Command Reject detected - "
65 return dasd_era_fatal
;
68 /* check for 'Invalid Track Format' */
69 if ((sense
[1] & SNS1_INV_TRACK_FORMAT
) &&
70 (!(sense
[2] & SNS2_ENV_DATA_PRESENT
))) {
72 DEV_MESSAGE(KERN_ERR
, device
, "%s",
73 "EXAMINE 24: Invalid Track Format detected "
76 return dasd_era_fatal
;
79 /* check for 'No Record Found' */
80 if (sense
[1] & SNS1_NO_REC_FOUND
) {
82 /* FIXME: fatal error ?!? */
83 DEV_MESSAGE(KERN_ERR
, device
,
84 "EXAMINE 24: No Record Found detected %s",
85 device
->state
<= DASD_STATE_BASIC
?
86 " " : "- fatal error");
88 return dasd_era_fatal
;
91 /* return recoverable for all others */
92 return dasd_era_recover
;
93 } /* END dasd_3990_erp_examine_24 */
96 * DASD_3990_ERP_EXAMINE_32
99 * Checks only for fatal/no/recoverable error.
100 * A detailed examination of the sense data is done later outside
101 * the interrupt handler.
104 * dasd_era_none no error
105 * dasd_era_fatal for all fatal (unrecoverable errors)
106 * dasd_era_recover for recoverable others.
109 dasd_3990_erp_examine_32(struct dasd_ccw_req
* cqr
, char *sense
)
112 struct dasd_device
*device
= cqr
->device
;
116 return dasd_era_none
;
119 DEV_MESSAGE(KERN_ERR
, device
, "%s", "EXAMINE 32: fatal error");
121 return dasd_era_fatal
;
125 return dasd_era_recover
;
128 } /* end dasd_3990_erp_examine_32 */
131 * DASD_3990_ERP_EXAMINE
134 * Checks only for fatal/no/recover error.
135 * A detailed examination of the sense data is done later outside
136 * the interrupt handler.
138 * The logic is based on the 'IBM 3990 Storage Control Reference' manual
139 * 'Chapter 7. Error Recovery Procedures'.
142 * dasd_era_none no error
143 * dasd_era_fatal for all fatal (unrecoverable errors)
144 * dasd_era_recover for all others.
147 dasd_3990_erp_examine(struct dasd_ccw_req
* cqr
, struct irb
* irb
)
150 char *sense
= irb
->ecw
;
151 dasd_era_t era
= dasd_era_recover
;
152 struct dasd_device
*device
= cqr
->device
;
154 /* check for successful execution first */
155 if (irb
->scsw
.cstat
== 0x00 &&
156 irb
->scsw
.dstat
== (DEV_STAT_CHN_END
| DEV_STAT_DEV_END
))
157 return dasd_era_none
;
159 /* distinguish between 24 and 32 byte sense data */
160 if (sense
[27] & DASD_SENSE_BIT_0
) {
162 era
= dasd_3990_erp_examine_24(cqr
, sense
);
166 era
= dasd_3990_erp_examine_32(cqr
, sense
);
170 /* log the erp chain if fatal error occurred */
171 if ((era
== dasd_era_fatal
) && (device
->state
>= DASD_STATE_READY
)) {
172 dasd_log_sense(cqr
, irb
);
177 } /* END dasd_3990_erp_examine */
180 *****************************************************************************
181 * SECTION ERP HANDLING
182 *****************************************************************************
185 *****************************************************************************
186 * 24 and 32 byte sense ERP functions
187 *****************************************************************************
191 * DASD_3990_ERP_CLEANUP
194 * Removes the already build but not necessary ERP request and sets
195 * the status of the original cqr / erp to the given (final) status
198 * erp request to be blocked
199 * final_status either DASD_CQR_DONE or DASD_CQR_FAILED
204 static struct dasd_ccw_req
*
205 dasd_3990_erp_cleanup(struct dasd_ccw_req
* erp
, char final_status
)
207 struct dasd_ccw_req
*cqr
= erp
->refers
;
209 dasd_free_erp_request(erp
, erp
->device
);
210 cqr
->status
= final_status
;
213 } /* end dasd_3990_erp_cleanup */
216 * DASD_3990_ERP_BLOCK_QUEUE
219 * Block the given device request queue to prevent from further
220 * processing until the started timer has expired or an related
221 * interrupt was received.
224 dasd_3990_erp_block_queue(struct dasd_ccw_req
* erp
, int expires
)
227 struct dasd_device
*device
= erp
->device
;
229 DEV_MESSAGE(KERN_INFO
, device
,
230 "blocking request queue for %is", expires
/HZ
);
232 device
->stopped
|= DASD_STOPPED_PENDING
;
233 erp
->status
= DASD_CQR_QUEUED
;
235 dasd_set_timer(device
, expires
);
239 * DASD_3990_ERP_INT_REQ
242 * Handles 'Intervention Required' error.
243 * This means either device offline or not installed.
250 static struct dasd_ccw_req
*
251 dasd_3990_erp_int_req(struct dasd_ccw_req
* erp
)
254 struct dasd_device
*device
= erp
->device
;
256 /* first time set initial retry counter and erp_function */
257 /* and retry once without blocking queue */
258 /* (this enables easier enqueing of the cqr) */
259 if (erp
->function
!= dasd_3990_erp_int_req
) {
262 erp
->function
= dasd_3990_erp_int_req
;
266 /* issue a message and wait for 'device ready' interrupt */
267 DEV_MESSAGE(KERN_ERR
, device
, "%s",
268 "is offline or not installed - "
269 "INTERVENTION REQUIRED!!");
271 dasd_3990_erp_block_queue(erp
, 60*HZ
);
276 } /* end dasd_3990_erp_int_req */
279 * DASD_3990_ERP_ALTERNATE_PATH
282 * Repeat the operation on a different channel path.
283 * If all alternate paths have been tried, the request is posted with a
287 * erp pointer to the current ERP
290 * erp modified pointer to the ERP
293 dasd_3990_erp_alternate_path(struct dasd_ccw_req
* erp
)
295 struct dasd_device
*device
= erp
->device
;
298 /* try alternate valid path */
299 opm
= ccw_device_get_path_mask(device
->cdev
);
300 //FIXME: start with get_opm ?
302 erp
->lpm
= LPM_ANYPATH
& ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
304 erp
->lpm
&= ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
306 if ((erp
->lpm
& opm
) != 0x00) {
308 DEV_MESSAGE(KERN_DEBUG
, device
,
309 "try alternate lpm=%x (lpum=%x / opm=%x)",
310 erp
->lpm
, erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
312 /* reset status to queued to handle the request again... */
313 if (erp
->status
> DASD_CQR_QUEUED
)
314 erp
->status
= DASD_CQR_QUEUED
;
317 DEV_MESSAGE(KERN_ERR
, device
,
318 "No alternate channel path left (lpum=%x / "
319 "opm=%x) -> permanent error",
320 erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
322 /* post request with permanent error */
323 if (erp
->status
> DASD_CQR_QUEUED
)
324 erp
->status
= DASD_CQR_FAILED
;
326 } /* end dasd_3990_erp_alternate_path */
332 * Setup cqr to do the Diagnostic Control (DCTL) command with an
333 * Inhibit Write subcommand (0x20) and the given modifier.
336 * erp pointer to the current (failed) ERP
337 * modifier subcommand modifier
340 * dctl_cqr pointer to NEW dctl_cqr
343 static struct dasd_ccw_req
*
344 dasd_3990_erp_DCTL(struct dasd_ccw_req
* erp
, char modifier
)
347 struct dasd_device
*device
= erp
->device
;
348 struct DCTL_data
*DCTL_data
;
350 struct dasd_ccw_req
*dctl_cqr
;
352 dctl_cqr
= dasd_alloc_erp_request((char *) &erp
->magic
, 1,
353 sizeof (struct DCTL_data
),
355 if (IS_ERR(dctl_cqr
)) {
356 DEV_MESSAGE(KERN_ERR
, device
, "%s",
357 "Unable to allocate DCTL-CQR");
358 erp
->status
= DASD_CQR_FAILED
;
362 DCTL_data
= dctl_cqr
->data
;
364 DCTL_data
->subcommand
= 0x02; /* Inhibit Write */
365 DCTL_data
->modifier
= modifier
;
367 ccw
= dctl_cqr
->cpaddr
;
368 memset(ccw
, 0, sizeof (struct ccw1
));
369 ccw
->cmd_code
= CCW_CMD_DCTL
;
371 ccw
->cda
= (__u32
)(addr_t
) DCTL_data
;
372 dctl_cqr
->function
= dasd_3990_erp_DCTL
;
373 dctl_cqr
->refers
= erp
;
374 dctl_cqr
->device
= erp
->device
;
375 dctl_cqr
->magic
= erp
->magic
;
376 dctl_cqr
->expires
= 5 * 60 * HZ
;
377 dctl_cqr
->retries
= 2;
379 dctl_cqr
->buildclk
= get_clock();
381 dctl_cqr
->status
= DASD_CQR_FILLED
;
385 } /* end dasd_3990_erp_DCTL */
388 * DASD_3990_ERP_ACTION_1
391 * Setup ERP to do the ERP action 1 (see Reference manual).
392 * Repeat the operation on a different channel path.
393 * If all alternate paths have been tried, the request is posted with a
395 * Note: duplex handling is not implemented (yet).
398 * erp pointer to the current ERP
401 * erp pointer to the ERP
404 static struct dasd_ccw_req
*
405 dasd_3990_erp_action_1(struct dasd_ccw_req
* erp
)
408 erp
->function
= dasd_3990_erp_action_1
;
410 dasd_3990_erp_alternate_path(erp
);
414 } /* end dasd_3990_erp_action_1 */
417 * DASD_3990_ERP_ACTION_4
420 * Setup ERP to do the ERP action 4 (see Reference manual).
421 * Set the current request to PENDING to block the CQR queue for that device
422 * until the state change interrupt appears.
423 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
427 * sense sense data of the actual error
428 * erp pointer to the current ERP
431 * erp pointer to the ERP
434 static struct dasd_ccw_req
*
435 dasd_3990_erp_action_4(struct dasd_ccw_req
* erp
, char *sense
)
438 struct dasd_device
*device
= erp
->device
;
440 /* first time set initial retry counter and erp_function */
441 /* and retry once without waiting for state change pending */
442 /* interrupt (this enables easier enqueing of the cqr) */
443 if (erp
->function
!= dasd_3990_erp_action_4
) {
445 DEV_MESSAGE(KERN_INFO
, device
, "%s",
446 "dasd_3990_erp_action_4: first time retry");
449 erp
->function
= dasd_3990_erp_action_4
;
453 if (sense
[25] == 0x1D) { /* state change pending */
455 DEV_MESSAGE(KERN_INFO
, device
,
456 "waiting for state change pending "
457 "interrupt, %d retries left",
460 dasd_3990_erp_block_queue(erp
, 30*HZ
);
462 } else if (sense
[25] == 0x1E) { /* busy */
463 DEV_MESSAGE(KERN_INFO
, device
,
464 "busy - redriving request later, "
467 dasd_3990_erp_block_queue(erp
, HZ
);
470 /* no state change pending - retry */
471 DEV_MESSAGE (KERN_INFO
, device
,
472 "redriving request immediately, "
475 erp
->status
= DASD_CQR_QUEUED
;
481 } /* end dasd_3990_erp_action_4 */
484 *****************************************************************************
485 * 24 byte sense ERP functions (only)
486 *****************************************************************************
490 * DASD_3990_ERP_ACTION_5
493 * Setup ERP to do the ERP action 5 (see Reference manual).
494 * NOTE: Further handling is done in xxx_further_erp after the retries.
497 * erp pointer to the current ERP
500 * erp pointer to the ERP
503 static struct dasd_ccw_req
*
504 dasd_3990_erp_action_5(struct dasd_ccw_req
* erp
)
507 /* first of all retry */
509 erp
->function
= dasd_3990_erp_action_5
;
513 } /* end dasd_3990_erp_action_5 */
516 * DASD_3990_HANDLE_ENV_DATA
519 * Handles 24 byte 'Environmental data present'.
520 * Does a analysis of the sense data (message Format)
521 * and prints the error messages.
524 * sense current sense data
530 dasd_3990_handle_env_data(struct dasd_ccw_req
* erp
, char *sense
)
533 struct dasd_device
*device
= erp
->device
;
534 char msg_format
= (sense
[7] & 0xF0);
535 char msg_no
= (sense
[7] & 0x0F);
537 switch (msg_format
) {
538 case 0x00: /* Format 0 - Program or System Checks */
540 if (sense
[1] & 0x10) { /* check message to operator bit */
543 case 0x00: /* No Message */
546 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
547 "FORMAT 0 - Invalid Command");
550 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
551 "FORMAT 0 - Invalid Command "
555 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
556 "FORMAT 0 - CCW Count less than "
560 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
561 "FORMAT 0 - Invalid Parameter");
564 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
565 "FORMAT 0 - Diagnostic of Sepecial"
566 " Command Violates File Mask");
569 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
570 "FORMAT 0 - Channel Returned with "
571 "Incorrect retry CCW");
574 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
575 "FORMAT 0 - Reset Notification");
578 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
579 "FORMAT 0 - Storage Path Restart");
582 DEV_MESSAGE(KERN_WARNING
, device
,
583 "FORMAT 0 - Channel requested "
584 "... %02x", sense
[8]);
587 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
588 "FORMAT 0 - Invalid Defective/"
589 "Alternate Track Pointer");
592 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
593 "FORMAT 0 - DPS Installation "
597 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
598 "FORMAT 0 - Command Invalid on "
599 "Secondary Address");
602 DEV_MESSAGE(KERN_WARNING
, device
,
603 "FORMAT 0 - Status Not As "
604 "Required: reason %02x", sense
[8]);
607 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
608 "FORMAT 0 - Reseved");
612 case 0x00: /* No Message */
615 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
616 "FORMAT 0 - Device Error Source");
619 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
620 "FORMAT 0 - Reserved");
623 DEV_MESSAGE(KERN_WARNING
, device
,
624 "FORMAT 0 - Device Fenced - "
625 "device = %02x", sense
[4]);
628 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
629 "FORMAT 0 - Data Pinned for "
633 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
634 "FORMAT 0 - Reserved");
639 case 0x10: /* Format 1 - Device Equipment Checks */
641 case 0x00: /* No Message */
644 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
645 "FORMAT 1 - Device Status 1 not as "
649 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
650 "FORMAT 1 - Index missing");
653 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
654 "FORMAT 1 - Interruption cannot be reset");
657 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
658 "FORMAT 1 - Device did not respond to "
662 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
663 "FORMAT 1 - Device check-2 error or Set "
664 "Sector is not complete");
667 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
668 "FORMAT 1 - Head address does not "
672 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
673 "FORMAT 1 - Device status 1 not valid");
676 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
677 "FORMAT 1 - Device not ready");
680 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
681 "FORMAT 1 - Track physical address did "
685 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
686 "FORMAT 1 - Missing device address bit");
689 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
690 "FORMAT 1 - Drive motor switch is off");
693 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
694 "FORMAT 1 - Seek incomplete");
697 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
698 "FORMAT 1 - Cylinder address did not "
702 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
703 "FORMAT 1 - Offset active cannot be "
707 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
708 "FORMAT 1 - Reserved");
712 case 0x20: /* Format 2 - 3990 Equipment Checks */
715 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
716 "FORMAT 2 - 3990 check-2 error");
719 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
720 "FORMAT 2 - Support facility errors");
723 DEV_MESSAGE(KERN_WARNING
, device
,
724 "FORMAT 2 - Microcode detected error %02x",
728 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
729 "FORMAT 2 - Reserved");
733 case 0x30: /* Format 3 - 3990 Control Checks */
736 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
737 "FORMAT 3 - Allegiance terminated");
740 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
741 "FORMAT 3 - Reserved");
745 case 0x40: /* Format 4 - Data Checks */
748 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
749 "FORMAT 4 - Home address area error");
752 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
753 "FORMAT 4 - Count area error");
756 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
757 "FORMAT 4 - Key area error");
760 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
761 "FORMAT 4 - Data area error");
764 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
765 "FORMAT 4 - No sync byte in home address "
769 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
770 "FORMAT 4 - No sync byte in count address "
774 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
775 "FORMAT 4 - No sync byte in key area");
778 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
779 "FORMAT 4 - No sync byte in data area");
782 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
783 "FORMAT 4 - Home address area error; "
787 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
788 "FORMAT 4 - Count area error; offset "
792 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
793 "FORMAT 4 - Key area error; offset "
797 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
798 "FORMAT 4 - Data area error; "
802 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
803 "FORMAT 4 - No sync byte in home "
804 "address area; offset active");
807 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
808 "FORMAT 4 - No syn byte in count "
809 "address area; offset active");
812 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
813 "FORMAT 4 - No sync byte in key area; "
817 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
818 "FORMAT 4 - No syn byte in data area; "
822 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
823 "FORMAT 4 - Reserved");
827 case 0x50: /* Format 5 - Data Check with displacement information */
830 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
831 "FORMAT 5 - Data Check in the "
832 "home address area");
835 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
836 "FORMAT 5 - Data Check in the count area");
839 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
840 "FORMAT 5 - Data Check in the key area");
843 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
844 "FORMAT 5 - Data Check in the data area");
847 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
848 "FORMAT 5 - Data Check in the "
849 "home address area; offset active");
852 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
853 "FORMAT 5 - Data Check in the count area; "
857 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
858 "FORMAT 5 - Data Check in the key area; "
862 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
863 "FORMAT 5 - Data Check in the data area; "
867 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
868 "FORMAT 5 - Reserved");
872 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
875 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
876 "FORMAT 6 - Overrun on channel A");
879 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
880 "FORMAT 6 - Overrun on channel B");
883 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
884 "FORMAT 6 - Overrun on channel C");
887 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
888 "FORMAT 6 - Overrun on channel D");
891 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
892 "FORMAT 6 - Overrun on channel E");
895 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
896 "FORMAT 6 - Overrun on channel F");
899 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
900 "FORMAT 6 - Overrun on channel G");
903 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
904 "FORMAT 6 - Overrun on channel H");
907 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
908 "FORMAT 6 - Reserved");
912 case 0x70: /* Format 7 - Device Connection Control Checks */
915 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
916 "FORMAT 7 - RCC initiated by a connection "
920 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
921 "FORMAT 7 - RCC 1 sequence not "
925 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
926 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
930 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
931 "FORMAT 7 - Invalid tag-in during "
932 "selection sequence");
935 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
936 "FORMAT 7 - extra RCC required");
939 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
940 "FORMAT 7 - Invalid DCC selection "
941 "response or timeout");
944 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
945 "FORMAT 7 - Missing end operation; device "
946 "transfer complete");
949 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
950 "FORMAT 7 - Missing end operation; device "
951 "transfer incomplete");
954 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
955 "FORMAT 7 - Invalid tag-in for an "
956 "immediate command sequence");
959 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
960 "FORMAT 7 - Invalid tag-in for an "
961 "extended command sequence");
964 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
965 "FORMAT 7 - 3990 microcode time out when "
966 "stopping selection");
969 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
970 "FORMAT 7 - No response to selection "
971 "after a poll interruption");
974 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
975 "FORMAT 7 - Permanent path error (DASD "
976 "controller not available)");
979 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
980 "FORMAT 7 - DASD controller not available"
981 " on disconnected command chain");
984 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
985 "FORMAT 7 - Reserved");
989 case 0x80: /* Format 8 - Additional Device Equipment Checks */
991 case 0x00: /* No Message */
993 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
994 "FORMAT 8 - Error correction code "
998 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
999 "FORMAT 8 - Unexpected end operation "
1003 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1004 "FORMAT 8 - End operation with transfer "
1008 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1009 "FORMAT 8 - End operation with transfer "
1013 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1014 "FORMAT 8 - DPS checks after a system "
1015 "reset or selective reset");
1018 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1019 "FORMAT 8 - DPS cannot be filled");
1022 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1023 "FORMAT 8 - Short busy time-out during "
1024 "device selection");
1027 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1028 "FORMAT 8 - DASD controller failed to "
1029 "set or reset the long busy latch");
1032 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1033 "FORMAT 8 - No interruption from device "
1034 "during a command chain");
1037 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1038 "FORMAT 8 - Reserved");
1042 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
1045 break; /* No Message */
1047 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1048 "FORMAT 9 - Device check-2 error");
1051 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1052 "FORMAT 9 - Head address did not compare");
1055 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1056 "FORMAT 9 - Track physical address did "
1057 "not compare while oriented");
1060 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1061 "FORMAT 9 - Cylinder address did not "
1065 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1066 "FORMAT 9 - Reserved");
1070 case 0xF0: /* Format F - Cache Storage Checks */
1073 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1074 "FORMAT F - Operation Terminated");
1077 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1078 "FORMAT F - Subsystem Processing Error");
1081 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1082 "FORMAT F - Cache or nonvolatile storage "
1083 "equipment failure");
1086 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1087 "FORMAT F - Caching terminated");
1090 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1091 "FORMAT F - Cache fast write access not "
1095 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1096 "FORMAT F - Track format incorrect");
1099 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1100 "FORMAT F - Caching reinitiated");
1103 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1104 "FORMAT F - Nonvolatile storage "
1108 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1109 "FORMAT F - Volume is suspended duplex");
1110 /* call extended error reporting (EER) */
1111 dasd_eer_write(device
, erp
->refers
,
1112 DASD_EER_PPRCSUSPEND
);
1115 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1116 "FORMAT F - Subsystem status connot be "
1120 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1121 "FORMAT F - Caching status reset to "
1125 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1126 "FORMAT F - DASD Fast Write inhibited");
1129 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1130 "FORMAT D - Reserved");
1134 default: /* unknown message format - should not happen */
1135 DEV_MESSAGE (KERN_WARNING
, device
,
1136 "unknown message format %02x",
1139 } /* end switch message format */
1141 } /* end dasd_3990_handle_env_data */
1144 * DASD_3990_ERP_COM_REJ
1147 * Handles 24 byte 'Command Reject' error.
1150 * erp current erp_head
1151 * sense current sense data
1154 * erp 'new' erp_head - pointer to new ERP
1156 static struct dasd_ccw_req
*
1157 dasd_3990_erp_com_rej(struct dasd_ccw_req
* erp
, char *sense
)
1160 struct dasd_device
*device
= erp
->device
;
1162 erp
->function
= dasd_3990_erp_com_rej
;
1164 /* env data present (ACTION 10 - retry should work) */
1165 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1167 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1168 "Command Reject - environmental data present");
1170 dasd_3990_handle_env_data(erp
, sense
);
1175 /* fatal error - set status to FAILED */
1176 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1177 "Command Reject - Fatal error");
1179 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1184 } /* end dasd_3990_erp_com_rej */
1187 * DASD_3990_ERP_BUS_OUT
1190 * Handles 24 byte 'Bus Out Parity Check' error.
1193 * erp current erp_head
1195 * erp new erp_head - pointer to new ERP
1197 static struct dasd_ccw_req
*
1198 dasd_3990_erp_bus_out(struct dasd_ccw_req
* erp
)
1201 struct dasd_device
*device
= erp
->device
;
1203 /* first time set initial retry counter and erp_function */
1204 /* and retry once without blocking queue */
1205 /* (this enables easier enqueing of the cqr) */
1206 if (erp
->function
!= dasd_3990_erp_bus_out
) {
1208 erp
->function
= dasd_3990_erp_bus_out
;
1212 /* issue a message and wait for 'device ready' interrupt */
1213 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1214 "bus out parity error or BOPC requested by "
1217 dasd_3990_erp_block_queue(erp
, 60*HZ
);
1223 } /* end dasd_3990_erp_bus_out */
1226 * DASD_3990_ERP_EQUIP_CHECK
1229 * Handles 24 byte 'Equipment Check' error.
1232 * erp current erp_head
1234 * erp new erp_head - pointer to new ERP
1236 static struct dasd_ccw_req
*
1237 dasd_3990_erp_equip_check(struct dasd_ccw_req
* erp
, char *sense
)
1240 struct dasd_device
*device
= erp
->device
;
1242 erp
->function
= dasd_3990_erp_equip_check
;
1244 if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1246 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1247 "Write inhibited path encountered");
1249 /* vary path offline */
1250 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1251 "Path should be varied off-line. "
1252 "This is not implemented yet \n - please report "
1253 "to linux390@de.ibm.com");
1255 erp
= dasd_3990_erp_action_1(erp
);
1257 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1259 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1260 "Equipment Check - " "environmental data present");
1262 dasd_3990_handle_env_data(erp
, sense
);
1264 erp
= dasd_3990_erp_action_4(erp
, sense
);
1266 } else if (sense
[1] & SNS1_PERM_ERR
) {
1268 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1269 "Equipment Check - retry exhausted or "
1272 erp
= dasd_3990_erp_action_1(erp
);
1275 /* all other equipment checks - Action 5 */
1276 /* rest is done when retries == 0 */
1277 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1278 "Equipment check or processing error");
1280 erp
= dasd_3990_erp_action_5(erp
);
1285 } /* end dasd_3990_erp_equip_check */
1288 * DASD_3990_ERP_DATA_CHECK
1291 * Handles 24 byte 'Data Check' error.
1294 * erp current erp_head
1296 * erp new erp_head - pointer to new ERP
1298 static struct dasd_ccw_req
*
1299 dasd_3990_erp_data_check(struct dasd_ccw_req
* erp
, char *sense
)
1302 struct dasd_device
*device
= erp
->device
;
1304 erp
->function
= dasd_3990_erp_data_check
;
1306 if (sense
[2] & SNS2_CORRECTABLE
) { /* correctable data check */
1308 /* issue message that the data has been corrected */
1309 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
1310 "Data recovered during retry with PCI "
1311 "fetch mode active");
1313 /* not possible to handle this situation in Linux */
1314 panic("No way to inform application about the possibly "
1317 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1319 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1320 "Uncorrectable data check recovered secondary "
1321 "addr of duplex pair");
1323 erp
= dasd_3990_erp_action_4(erp
, sense
);
1325 } else if (sense
[1] & SNS1_PERM_ERR
) {
1327 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1328 "Uncorrectable data check with internal "
1331 erp
= dasd_3990_erp_action_1(erp
);
1334 /* all other data checks */
1335 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1336 "Uncorrectable data check with retry count "
1339 erp
= dasd_3990_erp_action_5(erp
);
1344 } /* end dasd_3990_erp_data_check */
1347 * DASD_3990_ERP_OVERRUN
1350 * Handles 24 byte 'Overrun' error.
1353 * erp current erp_head
1355 * erp new erp_head - pointer to new ERP
1357 static struct dasd_ccw_req
*
1358 dasd_3990_erp_overrun(struct dasd_ccw_req
* erp
, char *sense
)
1361 struct dasd_device
*device
= erp
->device
;
1363 erp
->function
= dasd_3990_erp_overrun
;
1365 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1366 "Overrun - service overrun or overrun"
1367 " error requested by channel");
1369 erp
= dasd_3990_erp_action_5(erp
);
1373 } /* end dasd_3990_erp_overrun */
1376 * DASD_3990_ERP_INV_FORMAT
1379 * Handles 24 byte 'Invalid Track Format' error.
1382 * erp current erp_head
1384 * erp new erp_head - pointer to new ERP
1386 static struct dasd_ccw_req
*
1387 dasd_3990_erp_inv_format(struct dasd_ccw_req
* erp
, char *sense
)
1390 struct dasd_device
*device
= erp
->device
;
1392 erp
->function
= dasd_3990_erp_inv_format
;
1394 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1396 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1397 "Track format error when destaging or "
1400 dasd_3990_handle_env_data(erp
, sense
);
1402 erp
= dasd_3990_erp_action_4(erp
, sense
);
1405 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1406 "Invalid Track Format - Fatal error should have "
1407 "been handled within the interrupt handler");
1409 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1414 } /* end dasd_3990_erp_inv_format */
1420 * Handles 24 byte 'End-of-Cylinder' error.
1423 * erp already added default erp
1425 * erp pointer to original (failed) cqr.
1427 static struct dasd_ccw_req
*
1428 dasd_3990_erp_EOC(struct dasd_ccw_req
* default_erp
, char *sense
)
1431 struct dasd_device
*device
= default_erp
->device
;
1433 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1434 "End-of-Cylinder - must never happen");
1436 /* implement action 7 - BUG */
1437 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1439 } /* end dasd_3990_erp_EOC */
1442 * DASD_3990_ERP_ENV_DATA
1445 * Handles 24 byte 'Environmental-Data Present' error.
1448 * erp current erp_head
1450 * erp new erp_head - pointer to new ERP
1452 static struct dasd_ccw_req
*
1453 dasd_3990_erp_env_data(struct dasd_ccw_req
* erp
, char *sense
)
1456 struct dasd_device
*device
= erp
->device
;
1458 erp
->function
= dasd_3990_erp_env_data
;
1460 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Environmental data present");
1462 dasd_3990_handle_env_data(erp
, sense
);
1464 /* don't retry on disabled interface */
1465 if (sense
[7] != 0x0F) {
1467 erp
= dasd_3990_erp_action_4(erp
, sense
);
1470 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_IN_IO
);
1475 } /* end dasd_3990_erp_env_data */
1478 * DASD_3990_ERP_NO_REC
1481 * Handles 24 byte 'No Record Found' error.
1484 * erp already added default ERP
1487 * erp new erp_head - pointer to new ERP
1489 static struct dasd_ccw_req
*
1490 dasd_3990_erp_no_rec(struct dasd_ccw_req
* default_erp
, char *sense
)
1493 struct dasd_device
*device
= default_erp
->device
;
1495 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1496 "No Record Found - Fatal error should "
1497 "have been handled within the interrupt handler");
1499 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1501 } /* end dasd_3990_erp_no_rec */
1504 * DASD_3990_ERP_FILE_PROT
1507 * Handles 24 byte 'File Protected' error.
1508 * Note: Seek related recovery is not implemented because
1509 * wee don't use the seek command yet.
1512 * erp current erp_head
1514 * erp new erp_head - pointer to new ERP
1516 static struct dasd_ccw_req
*
1517 dasd_3990_erp_file_prot(struct dasd_ccw_req
* erp
)
1520 struct dasd_device
*device
= erp
->device
;
1522 DEV_MESSAGE(KERN_ERR
, device
, "%s", "File Protected");
1524 return dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1526 } /* end dasd_3990_erp_file_prot */
1529 * DASD_3990_ERP_INSPECT_24
1532 * Does a detailed inspection of the 24 byte sense data
1533 * and sets up a related error recovery action.
1536 * sense sense data of the actual error
1537 * erp pointer to the currently created default ERP
1540 * erp pointer to the (addtitional) ERP
1542 static struct dasd_ccw_req
*
1543 dasd_3990_erp_inspect_24(struct dasd_ccw_req
* erp
, char *sense
)
1546 struct dasd_ccw_req
*erp_filled
= NULL
;
1548 /* Check sense for .... */
1549 /* 'Command Reject' */
1550 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_CMD_REJECT
)) {
1551 erp_filled
= dasd_3990_erp_com_rej(erp
, sense
);
1553 /* 'Intervention Required' */
1554 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_INTERVENTION_REQ
)) {
1555 erp_filled
= dasd_3990_erp_int_req(erp
);
1557 /* 'Bus Out Parity Check' */
1558 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_BUS_OUT_CHECK
)) {
1559 erp_filled
= dasd_3990_erp_bus_out(erp
);
1561 /* 'Equipment Check' */
1562 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_EQUIPMENT_CHECK
)) {
1563 erp_filled
= dasd_3990_erp_equip_check(erp
, sense
);
1566 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_DATA_CHECK
)) {
1567 erp_filled
= dasd_3990_erp_data_check(erp
, sense
);
1570 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_OVERRUN
)) {
1571 erp_filled
= dasd_3990_erp_overrun(erp
, sense
);
1573 /* 'Invalid Track Format' */
1574 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_INV_TRACK_FORMAT
)) {
1575 erp_filled
= dasd_3990_erp_inv_format(erp
, sense
);
1577 /* 'End-of-Cylinder' */
1578 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_EOC
)) {
1579 erp_filled
= dasd_3990_erp_EOC(erp
, sense
);
1581 /* 'Environmental Data' */
1582 if ((erp_filled
== NULL
) && (sense
[2] & SNS2_ENV_DATA_PRESENT
)) {
1583 erp_filled
= dasd_3990_erp_env_data(erp
, sense
);
1585 /* 'No Record Found' */
1586 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_NO_REC_FOUND
)) {
1587 erp_filled
= dasd_3990_erp_no_rec(erp
, sense
);
1589 /* 'File Protected' */
1590 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_FILE_PROTECTED
)) {
1591 erp_filled
= dasd_3990_erp_file_prot(erp
);
1593 /* other (unknown) error - do default ERP */
1594 if (erp_filled
== NULL
) {
1601 } /* END dasd_3990_erp_inspect_24 */
1604 *****************************************************************************
1605 * 32 byte sense ERP functions (only)
1606 *****************************************************************************
1610 * DASD_3990_ERPACTION_10_32
1613 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1614 * Just retry and if retry doesn't work, return with error.
1617 * erp current erp_head
1618 * sense current sense data
1620 * erp modified erp_head
1622 static struct dasd_ccw_req
*
1623 dasd_3990_erp_action_10_32(struct dasd_ccw_req
* erp
, char *sense
)
1626 struct dasd_device
*device
= erp
->device
;
1629 erp
->function
= dasd_3990_erp_action_10_32
;
1631 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Perform logging requested");
1635 } /* end dasd_3990_erp_action_10_32 */
1638 * DASD_3990_ERP_ACTION_1B_32
1641 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
1642 * A write operation could not be finished because of an unexpected
1644 * The already created 'default erp' is used to get the link to
1645 * the erp chain, but it can not be used for this recovery
1646 * action because it contains no DE/LO data space.
1649 * default_erp already added default erp.
1650 * sense current sense data
1654 * default_erp in case of imprecise ending or error
1656 static struct dasd_ccw_req
*
1657 dasd_3990_erp_action_1B_32(struct dasd_ccw_req
* default_erp
, char *sense
)
1660 struct dasd_device
*device
= default_erp
->device
;
1662 struct dasd_ccw_req
*cqr
;
1663 struct dasd_ccw_req
*erp
;
1664 struct DE_eckd_data
*DE_data
;
1665 char *LO_data
; /* LO_eckd_data_t */
1668 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1669 "Write not finished because of unexpected condition");
1671 default_erp
->function
= dasd_3990_erp_action_1B_32
;
1673 /* determine the original cqr */
1676 while (cqr
->refers
!= NULL
) {
1680 /* for imprecise ending just do default erp */
1681 if (sense
[1] & 0x01) {
1683 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1684 "Imprecise ending is set - just retry");
1689 /* determine the address of the CCW to be restarted */
1690 /* Imprecise ending is not set -> addr from IRB-SCSW */
1691 cpa
= default_erp
->refers
->irb
.scsw
.cpa
;
1695 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1696 "Unable to determine address of the CCW "
1699 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1702 /* Build new ERP request including DE/LO */
1703 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
1704 2 + 1,/* DE/LO + TIC */
1705 sizeof (struct DE_eckd_data
) +
1706 sizeof (struct LO_eckd_data
), device
);
1709 DEV_MESSAGE(KERN_ERR
, device
, "%s", "Unable to allocate ERP");
1710 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1713 /* use original DE */
1714 DE_data
= erp
->data
;
1715 memcpy(DE_data
, cqr
->data
, sizeof (struct DE_eckd_data
));
1718 LO_data
= erp
->data
+ sizeof (struct DE_eckd_data
);
1720 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1722 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1723 "BUG - this should not happen");
1725 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1728 if ((sense
[7] & 0x3F) == 0x01) {
1729 /* operation code is WRITE DATA -> data area orientation */
1732 } else if ((sense
[7] & 0x3F) == 0x03) {
1733 /* operation code is FORMAT WRITE -> index orientation */
1737 LO_data
[0] = sense
[7]; /* operation */
1740 LO_data
[1] = sense
[8]; /* auxiliary */
1741 LO_data
[2] = sense
[9];
1742 LO_data
[3] = sense
[3]; /* count */
1743 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1744 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1745 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1747 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1751 memset(ccw
, 0, sizeof (struct ccw1
));
1752 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
1753 ccw
->flags
= CCW_FLAG_CC
;
1755 ccw
->cda
= (__u32
)(addr_t
) DE_data
;
1759 memset(ccw
, 0, sizeof (struct ccw1
));
1760 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
1761 ccw
->flags
= CCW_FLAG_CC
;
1763 ccw
->cda
= (__u32
)(addr_t
) LO_data
;
1765 /* TIC to the failed ccw */
1767 ccw
->cmd_code
= CCW_CMD_TIC
;
1770 /* fill erp related fields */
1771 erp
->function
= dasd_3990_erp_action_1B_32
;
1772 erp
->refers
= default_erp
->refers
;
1773 erp
->device
= device
;
1774 erp
->magic
= default_erp
->magic
;
1777 erp
->buildclk
= get_clock();
1778 erp
->status
= DASD_CQR_FILLED
;
1780 /* remove the default erp */
1781 dasd_free_erp_request(default_erp
, device
);
1785 } /* end dasd_3990_erp_action_1B_32 */
1788 * DASD_3990_UPDATE_1B
1791 * Handles the update to the 32 byte 'Action 1B' of Single Program
1792 * Action Codes in case the first action was not successful.
1793 * The already created 'previous_erp' is the currently not successful
1797 * previous_erp already created previous erp.
1798 * sense current sense data
1802 static struct dasd_ccw_req
*
1803 dasd_3990_update_1B(struct dasd_ccw_req
* previous_erp
, char *sense
)
1806 struct dasd_device
*device
= previous_erp
->device
;
1808 struct dasd_ccw_req
*cqr
;
1809 struct dasd_ccw_req
*erp
;
1810 char *LO_data
; /* struct LO_eckd_data */
1813 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1814 "Write not finished because of unexpected condition"
1817 /* determine the original cqr */
1820 while (cqr
->refers
!= NULL
) {
1824 /* for imprecise ending just do default erp */
1825 if (sense
[1] & 0x01) {
1827 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1828 "Imprecise ending is set - just retry");
1830 previous_erp
->status
= DASD_CQR_QUEUED
;
1832 return previous_erp
;
1835 /* determine the address of the CCW to be restarted */
1836 /* Imprecise ending is not set -> addr from IRB-SCSW */
1837 cpa
= previous_erp
->irb
.scsw
.cpa
;
1841 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1842 "Unable to determine address of the CCW "
1845 previous_erp
->status
= DASD_CQR_FAILED
;
1847 return previous_erp
;
1852 /* update the LO with the new returned sense data */
1853 LO_data
= erp
->data
+ sizeof (struct DE_eckd_data
);
1855 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1857 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1858 "BUG - this should not happen");
1860 previous_erp
->status
= DASD_CQR_FAILED
;
1862 return previous_erp
;
1865 if ((sense
[7] & 0x3F) == 0x01) {
1866 /* operation code is WRITE DATA -> data area orientation */
1869 } else if ((sense
[7] & 0x3F) == 0x03) {
1870 /* operation code is FORMAT WRITE -> index orientation */
1874 LO_data
[0] = sense
[7]; /* operation */
1877 LO_data
[1] = sense
[8]; /* auxiliary */
1878 LO_data
[2] = sense
[9];
1879 LO_data
[3] = sense
[3]; /* count */
1880 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1881 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1882 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1884 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1886 /* TIC to the failed ccw */
1887 ccw
= erp
->cpaddr
; /* addr of DE ccw */
1888 ccw
++; /* addr of LE ccw */
1889 ccw
++; /* addr of TIC ccw */
1892 erp
->status
= DASD_CQR_QUEUED
;
1896 } /* end dasd_3990_update_1B */
1899 * DASD_3990_ERP_COMPOUND_RETRY
1902 * Handles the compound ERP action retry code.
1903 * NOTE: At least one retry is done even if zero is specified
1904 * by the sense data. This makes enqueueing of the request
1908 * sense sense data of the actual error
1909 * erp pointer to the currently created ERP
1912 * erp modified ERP pointer
1916 dasd_3990_erp_compound_retry(struct dasd_ccw_req
* erp
, char *sense
)
1919 switch (sense
[25] & 0x03) {
1920 case 0x00: /* no not retry */
1924 case 0x01: /* retry 2 times */
1928 case 0x02: /* retry 10 times */
1932 case 0x03: /* retry 256 times */
1940 erp
->function
= dasd_3990_erp_compound_retry
;
1942 } /* end dasd_3990_erp_compound_retry */
1945 * DASD_3990_ERP_COMPOUND_PATH
1948 * Handles the compound ERP action for retry on alternate
1952 * sense sense data of the actual error
1953 * erp pointer to the currently created ERP
1956 * erp modified ERP pointer
1960 dasd_3990_erp_compound_path(struct dasd_ccw_req
* erp
, char *sense
)
1963 if (sense
[25] & DASD_SENSE_BIT_3
) {
1964 dasd_3990_erp_alternate_path(erp
);
1966 if (erp
->status
== DASD_CQR_FAILED
) {
1967 /* reset the lpm and the status to be able to
1968 * try further actions. */
1972 erp
->status
= DASD_CQR_ERROR
;
1977 erp
->function
= dasd_3990_erp_compound_path
;
1979 } /* end dasd_3990_erp_compound_path */
1982 * DASD_3990_ERP_COMPOUND_CODE
1985 * Handles the compound ERP action for retry code.
1988 * sense sense data of the actual error
1989 * erp pointer to the currently created ERP
1992 * erp NEW ERP pointer
1995 static struct dasd_ccw_req
*
1996 dasd_3990_erp_compound_code(struct dasd_ccw_req
* erp
, char *sense
)
1999 if (sense
[25] & DASD_SENSE_BIT_2
) {
2001 switch (sense
[28]) {
2003 /* issue a Diagnostic Control command with an
2004 * Inhibit Write subcommand and controler modifier */
2005 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2009 /* wait for 5 seconds and retry again */
2012 dasd_3990_erp_block_queue (erp
, 5*HZ
);
2016 /* should not happen - continue */
2021 erp
->function
= dasd_3990_erp_compound_code
;
2025 } /* end dasd_3990_erp_compound_code */
2028 * DASD_3990_ERP_COMPOUND_CONFIG
2031 * Handles the compound ERP action for configruation
2033 * Note: duplex handling is not implemented (yet).
2036 * sense sense data of the actual error
2037 * erp pointer to the currently created ERP
2040 * erp modified ERP pointer
2044 dasd_3990_erp_compound_config(struct dasd_ccw_req
* erp
, char *sense
)
2047 if ((sense
[25] & DASD_SENSE_BIT_1
) && (sense
[26] & DASD_SENSE_BIT_2
)) {
2049 /* set to suspended duplex state then restart */
2050 struct dasd_device
*device
= erp
->device
;
2052 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2053 "Set device to suspended duplex state should be "
2055 "This is not implemented yet (for compound ERP)"
2056 " - please report to linux390@de.ibm.com");
2060 erp
->function
= dasd_3990_erp_compound_config
;
2062 } /* end dasd_3990_erp_compound_config */
2065 * DASD_3990_ERP_COMPOUND
2068 * Does the further compound program action if
2069 * compound retry was not successful.
2072 * sense sense data of the actual error
2073 * erp pointer to the current (failed) ERP
2076 * erp (additional) ERP pointer
2079 static struct dasd_ccw_req
*
2080 dasd_3990_erp_compound(struct dasd_ccw_req
* erp
, char *sense
)
2083 if ((erp
->function
== dasd_3990_erp_compound_retry
) &&
2084 (erp
->status
== DASD_CQR_ERROR
)) {
2086 dasd_3990_erp_compound_path(erp
, sense
);
2089 if ((erp
->function
== dasd_3990_erp_compound_path
) &&
2090 (erp
->status
== DASD_CQR_ERROR
)) {
2092 erp
= dasd_3990_erp_compound_code(erp
, sense
);
2095 if ((erp
->function
== dasd_3990_erp_compound_code
) &&
2096 (erp
->status
== DASD_CQR_ERROR
)) {
2098 dasd_3990_erp_compound_config(erp
, sense
);
2101 /* if no compound action ERP specified, the request failed */
2102 if (erp
->status
== DASD_CQR_ERROR
) {
2104 erp
->status
= DASD_CQR_FAILED
;
2109 } /* end dasd_3990_erp_compound */
2112 * DASD_3990_ERP_INSPECT_32
2115 * Does a detailed inspection of the 32 byte sense data
2116 * and sets up a related error recovery action.
2119 * sense sense data of the actual error
2120 * erp pointer to the currently created default ERP
2123 * erp_filled pointer to the ERP
2126 static struct dasd_ccw_req
*
2127 dasd_3990_erp_inspect_32(struct dasd_ccw_req
* erp
, char *sense
)
2130 struct dasd_device
*device
= erp
->device
;
2132 erp
->function
= dasd_3990_erp_inspect_32
;
2134 if (sense
[25] & DASD_SENSE_BIT_0
) {
2136 /* compound program action codes (byte25 bit 0 == '1') */
2137 dasd_3990_erp_compound_retry(erp
, sense
);
2141 /* single program action codes (byte25 bit 0 == '0') */
2142 switch (sense
[25]) {
2144 case 0x00: /* success - use default ERP for retries */
2145 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2146 "ERP called for successful request"
2150 case 0x01: /* fatal error */
2151 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2152 "Fatal error should have been "
2153 "handled within the interrupt handler");
2155 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2158 case 0x02: /* intervention required */
2159 case 0x03: /* intervention required during dual copy */
2160 erp
= dasd_3990_erp_int_req(erp
);
2163 case 0x0F: /* length mismatch during update write command */
2164 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2165 "update write command error - should not "
2167 "Please send this message together with "
2168 "the above sense data to linux390@de."
2171 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2174 case 0x10: /* logging required for other channel program */
2175 erp
= dasd_3990_erp_action_10_32(erp
, sense
);
2178 case 0x15: /* next track outside defined extend */
2179 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2180 "next track outside defined extend - "
2181 "should not happen;\n"
2182 "Please send this message together with "
2183 "the above sense data to linux390@de."
2186 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2189 case 0x1B: /* unexpected condition during write */
2191 erp
= dasd_3990_erp_action_1B_32(erp
, sense
);
2194 case 0x1C: /* invalid data */
2195 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
2196 "Data recovered during retry with PCI "
2197 "fetch mode active");
2199 /* not possible to handle this situation in Linux */
2201 ("Invalid data - No way to inform application "
2202 "about the possibly incorrect data");
2205 case 0x1D: /* state-change pending */
2206 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2207 "A State change pending condition exists "
2208 "for the subsystem or device");
2210 erp
= dasd_3990_erp_action_4(erp
, sense
);
2213 case 0x1E: /* busy */
2214 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2215 "Busy condition exists "
2216 "for the subsystem or device");
2217 erp
= dasd_3990_erp_action_4(erp
, sense
);
2220 default: /* all others errors - default erp */
2227 } /* end dasd_3990_erp_inspect_32 */
2230 *****************************************************************************
2231 * main ERP control fuctions (24 and 32 byte sense)
2232 *****************************************************************************
2236 * DASD_3990_ERP_INSPECT
2239 * Does a detailed inspection for sense data by calling either
2240 * the 24-byte or the 32-byte inspection routine.
2243 * erp pointer to the currently created default ERP
2245 * erp_new contens was possibly modified
2247 static struct dasd_ccw_req
*
2248 dasd_3990_erp_inspect(struct dasd_ccw_req
* erp
)
2251 struct dasd_ccw_req
*erp_new
= NULL
;
2252 /* sense data are located in the refers record of the */
2253 /* already set up new ERP ! */
2254 char *sense
= erp
->refers
->irb
.ecw
;
2256 /* distinguish between 24 and 32 byte sense data */
2257 if (sense
[27] & DASD_SENSE_BIT_0
) {
2259 /* inspect the 24 byte sense data */
2260 erp_new
= dasd_3990_erp_inspect_24(erp
, sense
);
2264 /* inspect the 32 byte sense data */
2265 erp_new
= dasd_3990_erp_inspect_32(erp
, sense
);
2267 } /* end distinguish between 24 and 32 byte sense data */
2273 * DASD_3990_ERP_ADD_ERP
2276 * This funtion adds an additional request block (ERP) to the head of
2277 * the given cqr (or erp).
2278 * This erp is initialized as an default erp (retry TIC)
2281 * cqr head of the current ERP-chain (or single cqr if
2284 * erp pointer to new ERP-chain head
2286 static struct dasd_ccw_req
*
2287 dasd_3990_erp_add_erp(struct dasd_ccw_req
* cqr
)
2290 struct dasd_device
*device
= cqr
->device
;
2293 /* allocate additional request block */
2294 struct dasd_ccw_req
*erp
;
2296 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
, 2, 0, cqr
->device
);
2298 if (cqr
->retries
<= 0) {
2299 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2300 "Unable to allocate ERP request");
2301 cqr
->status
= DASD_CQR_FAILED
;
2302 cqr
->stopclk
= get_clock ();
2304 DEV_MESSAGE (KERN_ERR
, device
,
2305 "Unable to allocate ERP request "
2306 "(%i retries left)",
2308 dasd_set_timer(device
, (HZ
<< 3));
2313 /* initialize request with default TIC to current ERP/CQR */
2315 ccw
->cmd_code
= CCW_CMD_NOOP
;
2316 ccw
->flags
= CCW_FLAG_CC
;
2318 ccw
->cmd_code
= CCW_CMD_TIC
;
2319 ccw
->cda
= (long)(cqr
->cpaddr
);
2320 erp
->function
= dasd_3990_erp_add_erp
;
2322 erp
->device
= cqr
->device
;
2323 erp
->magic
= cqr
->magic
;
2326 erp
->buildclk
= get_clock();
2328 erp
->status
= DASD_CQR_FILLED
;
2334 * DASD_3990_ERP_ADDITIONAL_ERP
2337 * An additional ERP is needed to handle the current error.
2338 * Add ERP to the head of the ERP-chain containing the ERP processing
2339 * determined based on the sense data.
2342 * cqr head of the current ERP-chain (or single cqr if
2346 * erp pointer to new ERP-chain head
2348 static struct dasd_ccw_req
*
2349 dasd_3990_erp_additional_erp(struct dasd_ccw_req
* cqr
)
2352 struct dasd_ccw_req
*erp
= NULL
;
2354 /* add erp and initialize with default TIC */
2355 erp
= dasd_3990_erp_add_erp(cqr
);
2357 /* inspect sense, determine specific ERP if possible */
2360 erp
= dasd_3990_erp_inspect(erp
);
2365 } /* end dasd_3990_erp_additional_erp */
2368 * DASD_3990_ERP_ERROR_MATCH
2371 * Check if the device status of the given cqr is the same.
2372 * This means that the failed CCW and the relevant sense data
2374 * I don't distinguish between 24 and 32 byte sense because in case of
2375 * 24 byte sense byte 25 and 27 is set as well.
2378 * cqr1 first cqr, which will be compared with the
2382 * match 'boolean' for match found
2383 * returns 1 if match found, otherwise 0.
2386 dasd_3990_erp_error_match(struct dasd_ccw_req
*cqr1
, struct dasd_ccw_req
*cqr2
)
2389 /* check failed CCW */
2390 if (cqr1
->irb
.scsw
.cpa
!= cqr2
->irb
.scsw
.cpa
) {
2391 // return 0; /* CCW doesn't match */
2394 /* check sense data; byte 0-2,25,27 */
2395 if (!((memcmp (cqr1
->irb
.ecw
, cqr2
->irb
.ecw
, 3) == 0) &&
2396 (cqr1
->irb
.ecw
[27] == cqr2
->irb
.ecw
[27]) &&
2397 (cqr1
->irb
.ecw
[25] == cqr2
->irb
.ecw
[25]))) {
2399 return 0; /* sense doesn't match */
2402 return 1; /* match */
2404 } /* end dasd_3990_erp_error_match */
2407 * DASD_3990_ERP_IN_ERP
2410 * check if the current error already happened before.
2411 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2414 * cqr failed cqr (either original cqr or already an erp)
2417 * erp erp-pointer to the already defined error
2418 * recovery procedure OR
2419 * NULL if a 'new' error occurred.
2421 static struct dasd_ccw_req
*
2422 dasd_3990_erp_in_erp(struct dasd_ccw_req
*cqr
)
2425 struct dasd_ccw_req
*erp_head
= cqr
, /* save erp chain head */
2426 *erp_match
= NULL
; /* save erp chain head */
2427 int match
= 0; /* 'boolean' for matching error found */
2429 if (cqr
->refers
== NULL
) { /* return if not in erp */
2433 /* check the erp/cqr chain for current error */
2435 match
= dasd_3990_erp_error_match(erp_head
, cqr
->refers
);
2436 erp_match
= cqr
; /* save possible matching erp */
2437 cqr
= cqr
->refers
; /* check next erp/cqr in queue */
2439 } while ((cqr
->refers
!= NULL
) && (!match
));
2442 return NULL
; /* no match was found */
2445 return erp_match
; /* return address of matching erp */
2447 } /* END dasd_3990_erp_in_erp */
2450 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2453 * No retry is left for the current ERP. Check what has to be done
2455 * - do further defined ERP action or
2456 * - wait for interrupt or
2457 * - exit with permanent error
2460 * erp ERP which is in progress with no retry left
2463 * erp modified/additional ERP
2465 static struct dasd_ccw_req
*
2466 dasd_3990_erp_further_erp(struct dasd_ccw_req
*erp
)
2469 struct dasd_device
*device
= erp
->device
;
2470 char *sense
= erp
->irb
.ecw
;
2472 /* check for 24 byte sense ERP */
2473 if ((erp
->function
== dasd_3990_erp_bus_out
) ||
2474 (erp
->function
== dasd_3990_erp_action_1
) ||
2475 (erp
->function
== dasd_3990_erp_action_4
)) {
2477 erp
= dasd_3990_erp_action_1(erp
);
2479 } else if (erp
->function
== dasd_3990_erp_action_5
) {
2481 /* retries have not been successful */
2482 /* prepare erp for retry on different channel path */
2483 erp
= dasd_3990_erp_action_1(erp
);
2485 if (!(sense
[2] & DASD_SENSE_BIT_0
)) {
2487 /* issue a Diagnostic Control command with an
2488 * Inhibit Write subcommand */
2490 switch (sense
[25]) {
2492 case 0x57:{ /* controller */
2493 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2497 case 0x58:{ /* channel path */
2498 erp
= dasd_3990_erp_DCTL(erp
, 0x40);
2502 case 0x59:{ /* storage director */
2503 erp
= dasd_3990_erp_DCTL(erp
, 0x80);
2507 DEV_MESSAGE(KERN_DEBUG
, device
,
2508 "invalid subcommand modifier 0x%x "
2509 "for Diagnostic Control Command",
2514 /* check for 32 byte sense ERP */
2515 } else if ((erp
->function
== dasd_3990_erp_compound_retry
) ||
2516 (erp
->function
== dasd_3990_erp_compound_path
) ||
2517 (erp
->function
== dasd_3990_erp_compound_code
) ||
2518 (erp
->function
== dasd_3990_erp_compound_config
)) {
2520 erp
= dasd_3990_erp_compound(erp
, sense
);
2523 /* No retry left and no additional special handling */
2525 DEV_MESSAGE(KERN_ERR
, device
,
2526 "no retries left for erp %p - "
2527 "set status to FAILED", erp
);
2529 erp
->status
= DASD_CQR_FAILED
;
2534 } /* end dasd_3990_erp_further_erp */
2537 * DASD_3990_ERP_HANDLE_MATCH_ERP
2540 * An error occurred again and an ERP has been detected which is already
2541 * used to handle this error (e.g. retries).
2542 * All prior ERP's are asumed to be successful and therefore removed
2544 * If retry counter of matching erp is already 0, it is checked if further
2545 * action is needed (besides retry) or if the ERP has failed.
2548 * erp_head first ERP in ERP-chain
2549 * erp ERP that handles the actual error.
2553 * erp modified/additional ERP
2555 static struct dasd_ccw_req
*
2556 dasd_3990_erp_handle_match_erp(struct dasd_ccw_req
*erp_head
,
2557 struct dasd_ccw_req
*erp
)
2560 struct dasd_device
*device
= erp_head
->device
;
2561 struct dasd_ccw_req
*erp_done
= erp_head
; /* finished req */
2562 struct dasd_ccw_req
*erp_free
= NULL
; /* req to be freed */
2564 /* loop over successful ERPs and remove them from chanq */
2565 while (erp_done
!= erp
) {
2567 if (erp_done
== NULL
) /* end of chain reached */
2568 panic(PRINTK_HEADER
"Programming error in ERP! The "
2569 "original request was lost\n");
2571 /* remove the request from the device queue */
2572 list_del(&erp_done
->list
);
2574 erp_free
= erp_done
;
2575 erp_done
= erp_done
->refers
;
2577 /* free the finished erp request */
2578 dasd_free_erp_request(erp_free
, erp_free
->device
);
2582 if (erp
->retries
> 0) {
2584 char *sense
= erp
->refers
->irb
.ecw
;
2586 /* check for special retries */
2587 if (erp
->function
== dasd_3990_erp_action_4
) {
2589 erp
= dasd_3990_erp_action_4(erp
, sense
);
2591 } else if (erp
->function
== dasd_3990_erp_action_1B_32
) {
2593 erp
= dasd_3990_update_1B(erp
, sense
);
2595 } else if (erp
->function
== dasd_3990_erp_int_req
) {
2597 erp
= dasd_3990_erp_int_req(erp
);
2601 DEV_MESSAGE(KERN_DEBUG
, device
,
2602 "%i retries left for erp %p",
2605 /* handle the request again... */
2606 erp
->status
= DASD_CQR_QUEUED
;
2610 /* no retry left - check for further necessary action */
2611 /* if no further actions, handle rest as permanent error */
2612 erp
= dasd_3990_erp_further_erp(erp
);
2617 } /* end dasd_3990_erp_handle_match_erp */
2620 * DASD_3990_ERP_ACTION
2623 * controll routine for 3990 erp actions.
2624 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2627 * cqr failed cqr (either original cqr or already an erp)
2630 * erp erp-pointer to the head of the ERP action chain.
2632 * - either a ptr to an additional ERP cqr or
2633 * - the original given cqr (which's status might
2636 struct dasd_ccw_req
*
2637 dasd_3990_erp_action(struct dasd_ccw_req
* cqr
)
2640 struct dasd_ccw_req
*erp
= NULL
;
2641 struct dasd_device
*device
= cqr
->device
;
2642 struct dasd_ccw_req
*temp_erp
= NULL
;
2644 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2645 /* print current erp_chain */
2646 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2647 "ERP chain at BEGINNING of ERP-ACTION");
2648 for (temp_erp
= cqr
;
2649 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2651 DEV_MESSAGE(KERN_ERR
, device
,
2652 " erp %p (%02x) refers to %p",
2653 temp_erp
, temp_erp
->status
,
2658 /* double-check if current erp/cqr was successfull */
2659 if ((cqr
->irb
.scsw
.cstat
== 0x00) &&
2660 (cqr
->irb
.scsw
.dstat
== (DEV_STAT_CHN_END
|DEV_STAT_DEV_END
))) {
2662 DEV_MESSAGE(KERN_DEBUG
, device
,
2663 "ERP called for successful request %p"
2664 " - NO ERP necessary", cqr
);
2666 cqr
->status
= DASD_CQR_DONE
;
2670 /* check if sense data are available */
2671 if (!cqr
->irb
.ecw
) {
2672 DEV_MESSAGE(KERN_DEBUG
, device
,
2673 "ERP called witout sense data avail ..."
2674 "request %p - NO ERP possible", cqr
);
2676 cqr
->status
= DASD_CQR_FAILED
;
2682 /* check if error happened before */
2683 erp
= dasd_3990_erp_in_erp(cqr
);
2686 /* no matching erp found - set up erp */
2687 erp
= dasd_3990_erp_additional_erp(cqr
);
2689 /* matching erp found - set all leading erp's to DONE */
2690 erp
= dasd_3990_erp_handle_match_erp(cqr
, erp
);
2693 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2694 /* print current erp_chain */
2695 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2696 "ERP chain at END of ERP-ACTION");
2697 for (temp_erp
= erp
;
2698 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2700 DEV_MESSAGE(KERN_ERR
, device
,
2701 " erp %p (%02x) refers to %p",
2702 temp_erp
, temp_erp
->status
,
2707 /* enqueue added ERP request */
2708 if (erp
->status
== DASD_CQR_FILLED
) {
2709 erp
->status
= DASD_CQR_QUEUED
;
2710 list_add(&erp
->list
, &device
->ccw_queue
);
2715 } /* end dasd_3990_erp_action */