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
11 #include <linux/timer.h>
12 #include <linux/slab.h>
13 #include <asm/idals.h>
14 #include <asm/todclk.h>
16 #define PRINTK_HEADER "dasd_erp(3990): "
19 #include "dasd_eckd.h"
23 unsigned char subcommand
; /* e.g Inhibit Write, Enable Write,... */
24 unsigned char modifier
; /* Subcommand modifier */
25 unsigned short res
; /* reserved */
26 } __attribute__ ((packed
));
29 *****************************************************************************
30 * SECTION ERP EXAMINATION
31 *****************************************************************************
35 * DASD_3990_ERP_EXAMINE_24
38 * Checks only for fatal (unrecoverable) error.
39 * A detailed examination of the sense data is done later outside
40 * the interrupt handler.
42 * Each bit configuration leading to an action code 2 (Exit with
43 * programming error or unusual condition indication)
44 * are handled as fatal errorĀ“s.
46 * All other configurations are handled as recoverable errors.
49 * dasd_era_fatal for all fatal (unrecoverable errors)
50 * dasd_era_recover for all others.
53 dasd_3990_erp_examine_24(struct dasd_ccw_req
* cqr
, char *sense
)
56 struct dasd_device
*device
= cqr
->device
;
58 /* check for 'Command Reject' */
59 if ((sense
[0] & SNS0_CMD_REJECT
) &&
60 (!(sense
[2] & SNS2_ENV_DATA_PRESENT
))) {
62 DEV_MESSAGE(KERN_ERR
, device
, "%s",
63 "EXAMINE 24: Command Reject detected - "
66 return dasd_era_fatal
;
69 /* check for 'Invalid Track Format' */
70 if ((sense
[1] & SNS1_INV_TRACK_FORMAT
) &&
71 (!(sense
[2] & SNS2_ENV_DATA_PRESENT
))) {
73 DEV_MESSAGE(KERN_ERR
, device
, "%s",
74 "EXAMINE 24: Invalid Track Format detected "
77 return dasd_era_fatal
;
80 /* check for 'No Record Found' */
81 if (sense
[1] & SNS1_NO_REC_FOUND
) {
83 /* FIXME: fatal error ?!? */
84 DEV_MESSAGE(KERN_ERR
, device
,
85 "EXAMINE 24: No Record Found detected %s",
86 device
->state
<= DASD_STATE_BASIC
?
87 " " : "- fatal error");
89 return dasd_era_fatal
;
92 /* return recoverable for all others */
93 return dasd_era_recover
;
94 } /* END dasd_3990_erp_examine_24 */
97 * DASD_3990_ERP_EXAMINE_32
100 * Checks only for fatal/no/recoverable error.
101 * A detailed examination of the sense data is done later outside
102 * the interrupt handler.
105 * dasd_era_none no error
106 * dasd_era_fatal for all fatal (unrecoverable errors)
107 * dasd_era_recover for recoverable others.
110 dasd_3990_erp_examine_32(struct dasd_ccw_req
* cqr
, char *sense
)
113 struct dasd_device
*device
= cqr
->device
;
117 return dasd_era_none
;
120 DEV_MESSAGE(KERN_ERR
, device
, "%s", "EXAMINE 32: fatal error");
122 return dasd_era_fatal
;
126 return dasd_era_recover
;
129 } /* end dasd_3990_erp_examine_32 */
132 * DASD_3990_ERP_EXAMINE
135 * Checks only for fatal/no/recover error.
136 * A detailed examination of the sense data is done later outside
137 * the interrupt handler.
139 * The logic is based on the 'IBM 3990 Storage Control Reference' manual
140 * 'Chapter 7. Error Recovery Procedures'.
143 * dasd_era_none no error
144 * dasd_era_fatal for all fatal (unrecoverable errors)
145 * dasd_era_recover for all others.
148 dasd_3990_erp_examine(struct dasd_ccw_req
* cqr
, struct irb
* irb
)
151 char *sense
= irb
->ecw
;
152 dasd_era_t era
= dasd_era_recover
;
153 struct dasd_device
*device
= cqr
->device
;
155 /* check for successful execution first */
156 if (irb
->scsw
.cstat
== 0x00 &&
157 irb
->scsw
.dstat
== (DEV_STAT_CHN_END
| DEV_STAT_DEV_END
))
158 return dasd_era_none
;
160 /* distinguish between 24 and 32 byte sense data */
161 if (sense
[27] & DASD_SENSE_BIT_0
) {
163 era
= dasd_3990_erp_examine_24(cqr
, sense
);
167 era
= dasd_3990_erp_examine_32(cqr
, sense
);
171 /* log the erp chain if fatal error occurred */
172 if ((era
== dasd_era_fatal
) && (device
->state
>= DASD_STATE_READY
)) {
173 dasd_log_sense(cqr
, irb
);
174 dasd_log_ccw(cqr
, 0, irb
->scsw
.cpa
);
179 } /* END dasd_3990_erp_examine */
182 *****************************************************************************
183 * SECTION ERP HANDLING
184 *****************************************************************************
187 *****************************************************************************
188 * 24 and 32 byte sense ERP functions
189 *****************************************************************************
193 * DASD_3990_ERP_CLEANUP
196 * Removes the already build but not necessary ERP request and sets
197 * the status of the original cqr / erp to the given (final) status
200 * erp request to be blocked
201 * final_status either DASD_CQR_DONE or DASD_CQR_FAILED
206 static struct dasd_ccw_req
*
207 dasd_3990_erp_cleanup(struct dasd_ccw_req
* erp
, char final_status
)
209 struct dasd_ccw_req
*cqr
= erp
->refers
;
211 dasd_free_erp_request(erp
, erp
->device
);
212 cqr
->status
= final_status
;
215 } /* end dasd_3990_erp_cleanup */
218 * DASD_3990_ERP_BLOCK_QUEUE
221 * Block the given device request queue to prevent from further
222 * processing until the started timer has expired or an related
223 * interrupt was received.
226 dasd_3990_erp_block_queue(struct dasd_ccw_req
* erp
, int expires
)
229 struct dasd_device
*device
= erp
->device
;
231 DEV_MESSAGE(KERN_INFO
, device
,
232 "blocking request queue for %is", expires
/HZ
);
234 device
->stopped
|= DASD_STOPPED_PENDING
;
235 erp
->status
= DASD_CQR_QUEUED
;
237 dasd_set_timer(device
, expires
);
241 * DASD_3990_ERP_INT_REQ
244 * Handles 'Intervention Required' error.
245 * This means either device offline or not installed.
252 static struct dasd_ccw_req
*
253 dasd_3990_erp_int_req(struct dasd_ccw_req
* erp
)
256 struct dasd_device
*device
= erp
->device
;
258 /* first time set initial retry counter and erp_function */
259 /* and retry once without blocking queue */
260 /* (this enables easier enqueing of the cqr) */
261 if (erp
->function
!= dasd_3990_erp_int_req
) {
264 erp
->function
= dasd_3990_erp_int_req
;
268 /* issue a message and wait for 'device ready' interrupt */
269 DEV_MESSAGE(KERN_ERR
, device
, "%s",
270 "is offline or not installed - "
271 "INTERVENTION REQUIRED!!");
273 dasd_3990_erp_block_queue(erp
, 60*HZ
);
278 } /* end dasd_3990_erp_int_req */
281 * DASD_3990_ERP_ALTERNATE_PATH
284 * Repeat the operation on a different channel path.
285 * If all alternate paths have been tried, the request is posted with a
289 * erp pointer to the current ERP
292 * erp modified pointer to the ERP
295 dasd_3990_erp_alternate_path(struct dasd_ccw_req
* erp
)
297 struct dasd_device
*device
= erp
->device
;
300 /* try alternate valid path */
301 opm
= ccw_device_get_path_mask(device
->cdev
);
302 //FIXME: start with get_opm ?
304 erp
->lpm
= LPM_ANYPATH
& ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
306 erp
->lpm
&= ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
308 if ((erp
->lpm
& opm
) != 0x00) {
310 DEV_MESSAGE(KERN_DEBUG
, device
,
311 "try alternate lpm=%x (lpum=%x / opm=%x)",
312 erp
->lpm
, erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
314 /* reset status to queued to handle the request again... */
315 if (erp
->status
> DASD_CQR_QUEUED
)
316 erp
->status
= DASD_CQR_QUEUED
;
319 DEV_MESSAGE(KERN_ERR
, device
,
320 "No alternate channel path left (lpum=%x / "
321 "opm=%x) -> permanent error",
322 erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
324 /* post request with permanent error */
325 if (erp
->status
> DASD_CQR_QUEUED
)
326 erp
->status
= DASD_CQR_FAILED
;
328 } /* end dasd_3990_erp_alternate_path */
334 * Setup cqr to do the Diagnostic Control (DCTL) command with an
335 * Inhibit Write subcommand (0x20) and the given modifier.
338 * erp pointer to the current (failed) ERP
339 * modifier subcommand modifier
342 * dctl_cqr pointer to NEW dctl_cqr
345 static struct dasd_ccw_req
*
346 dasd_3990_erp_DCTL(struct dasd_ccw_req
* erp
, char modifier
)
349 struct dasd_device
*device
= erp
->device
;
350 struct DCTL_data
*DCTL_data
;
352 struct dasd_ccw_req
*dctl_cqr
;
354 dctl_cqr
= dasd_alloc_erp_request((char *) &erp
->magic
, 1,
355 sizeof (struct DCTL_data
),
357 if (IS_ERR(dctl_cqr
)) {
358 DEV_MESSAGE(KERN_ERR
, device
, "%s",
359 "Unable to allocate DCTL-CQR");
360 erp
->status
= DASD_CQR_FAILED
;
364 DCTL_data
= dctl_cqr
->data
;
366 DCTL_data
->subcommand
= 0x02; /* Inhibit Write */
367 DCTL_data
->modifier
= modifier
;
369 ccw
= dctl_cqr
->cpaddr
;
370 memset(ccw
, 0, sizeof (struct ccw1
));
371 ccw
->cmd_code
= CCW_CMD_DCTL
;
373 ccw
->cda
= (__u32
)(addr_t
) DCTL_data
;
374 dctl_cqr
->function
= dasd_3990_erp_DCTL
;
375 dctl_cqr
->refers
= erp
;
376 dctl_cqr
->device
= erp
->device
;
377 dctl_cqr
->magic
= erp
->magic
;
378 dctl_cqr
->expires
= 5 * 60 * HZ
;
379 dctl_cqr
->retries
= 2;
381 dctl_cqr
->buildclk
= get_clock();
383 dctl_cqr
->status
= DASD_CQR_FILLED
;
387 } /* end dasd_3990_erp_DCTL */
390 * DASD_3990_ERP_ACTION_1
393 * Setup ERP to do the ERP action 1 (see Reference manual).
394 * Repeat the operation on a different channel path.
395 * If all alternate paths have been tried, the request is posted with a
397 * Note: duplex handling is not implemented (yet).
400 * erp pointer to the current ERP
403 * erp pointer to the ERP
406 static struct dasd_ccw_req
*
407 dasd_3990_erp_action_1(struct dasd_ccw_req
* erp
)
410 erp
->function
= dasd_3990_erp_action_1
;
412 dasd_3990_erp_alternate_path(erp
);
416 } /* end dasd_3990_erp_action_1 */
419 * DASD_3990_ERP_ACTION_4
422 * Setup ERP to do the ERP action 4 (see Reference manual).
423 * Set the current request to PENDING to block the CQR queue for that device
424 * until the state change interrupt appears.
425 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
429 * sense sense data of the actual error
430 * erp pointer to the current ERP
433 * erp pointer to the ERP
436 static struct dasd_ccw_req
*
437 dasd_3990_erp_action_4(struct dasd_ccw_req
* erp
, char *sense
)
440 struct dasd_device
*device
= erp
->device
;
442 /* first time set initial retry counter and erp_function */
443 /* and retry once without waiting for state change pending */
444 /* interrupt (this enables easier enqueing of the cqr) */
445 if (erp
->function
!= dasd_3990_erp_action_4
) {
447 DEV_MESSAGE(KERN_INFO
, device
, "%s",
448 "dasd_3990_erp_action_4: first time retry");
451 erp
->function
= dasd_3990_erp_action_4
;
455 if (sense
[25] == 0x1D) { /* state change pending */
457 DEV_MESSAGE(KERN_INFO
, device
,
458 "waiting for state change pending "
459 "interrupt, %d retries left",
462 dasd_3990_erp_block_queue(erp
, 30*HZ
);
464 } else if (sense
[25] == 0x1E) { /* busy */
465 DEV_MESSAGE(KERN_INFO
, device
,
466 "busy - redriving request later, "
469 dasd_3990_erp_block_queue(erp
, HZ
);
472 /* no state change pending - retry */
473 DEV_MESSAGE (KERN_INFO
, device
,
474 "redriving request immediately, "
477 erp
->status
= DASD_CQR_QUEUED
;
483 } /* end dasd_3990_erp_action_4 */
486 *****************************************************************************
487 * 24 byte sense ERP functions (only)
488 *****************************************************************************
492 * DASD_3990_ERP_ACTION_5
495 * Setup ERP to do the ERP action 5 (see Reference manual).
496 * NOTE: Further handling is done in xxx_further_erp after the retries.
499 * erp pointer to the current ERP
502 * erp pointer to the ERP
505 static struct dasd_ccw_req
*
506 dasd_3990_erp_action_5(struct dasd_ccw_req
* erp
)
509 /* first of all retry */
511 erp
->function
= dasd_3990_erp_action_5
;
515 } /* end dasd_3990_erp_action_5 */
518 * DASD_3990_HANDLE_ENV_DATA
521 * Handles 24 byte 'Environmental data present'.
522 * Does a analysis of the sense data (message Format)
523 * and prints the error messages.
526 * sense current sense data
532 dasd_3990_handle_env_data(struct dasd_ccw_req
* erp
, char *sense
)
535 struct dasd_device
*device
= erp
->device
;
536 char msg_format
= (sense
[7] & 0xF0);
537 char msg_no
= (sense
[7] & 0x0F);
539 switch (msg_format
) {
540 case 0x00: /* Format 0 - Program or System Checks */
542 if (sense
[1] & 0x10) { /* check message to operator bit */
545 case 0x00: /* No Message */
548 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
549 "FORMAT 0 - Invalid Command");
552 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
553 "FORMAT 0 - Invalid Command "
557 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
558 "FORMAT 0 - CCW Count less than "
562 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
563 "FORMAT 0 - Invalid Parameter");
566 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
567 "FORMAT 0 - Diagnostic of Sepecial"
568 " Command Violates File Mask");
571 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
572 "FORMAT 0 - Channel Returned with "
573 "Incorrect retry CCW");
576 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
577 "FORMAT 0 - Reset Notification");
580 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
581 "FORMAT 0 - Storage Path Restart");
584 DEV_MESSAGE(KERN_WARNING
, device
,
585 "FORMAT 0 - Channel requested "
586 "... %02x", sense
[8]);
589 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
590 "FORMAT 0 - Invalid Defective/"
591 "Alternate Track Pointer");
594 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
595 "FORMAT 0 - DPS Installation "
599 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
600 "FORMAT 0 - Command Invalid on "
601 "Secondary Address");
604 DEV_MESSAGE(KERN_WARNING
, device
,
605 "FORMAT 0 - Status Not As "
606 "Required: reason %02x", sense
[8]);
609 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
610 "FORMAT 0 - Reseved");
614 case 0x00: /* No Message */
617 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
618 "FORMAT 0 - Device Error Source");
621 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
622 "FORMAT 0 - Reserved");
625 DEV_MESSAGE(KERN_WARNING
, device
,
626 "FORMAT 0 - Device Fenced - "
627 "device = %02x", sense
[4]);
630 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
631 "FORMAT 0 - Data Pinned for "
635 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
636 "FORMAT 0 - Reserved");
641 case 0x10: /* Format 1 - Device Equipment Checks */
643 case 0x00: /* No Message */
646 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
647 "FORMAT 1 - Device Status 1 not as "
651 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
652 "FORMAT 1 - Index missing");
655 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
656 "FORMAT 1 - Interruption cannot be reset");
659 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
660 "FORMAT 1 - Device did not respond to "
664 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
665 "FORMAT 1 - Device check-2 error or Set "
666 "Sector is not complete");
669 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
670 "FORMAT 1 - Head address does not "
674 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
675 "FORMAT 1 - Device status 1 not valid");
678 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
679 "FORMAT 1 - Device not ready");
682 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
683 "FORMAT 1 - Track physical address did "
687 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
688 "FORMAT 1 - Missing device address bit");
691 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
692 "FORMAT 1 - Drive motor switch is off");
695 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
696 "FORMAT 1 - Seek incomplete");
699 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
700 "FORMAT 1 - Cylinder address did not "
704 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
705 "FORMAT 1 - Offset active cannot be "
709 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
710 "FORMAT 1 - Reserved");
714 case 0x20: /* Format 2 - 3990 Equipment Checks */
717 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
718 "FORMAT 2 - 3990 check-2 error");
721 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
722 "FORMAT 2 - Support facility errors");
725 DEV_MESSAGE(KERN_WARNING
, device
,
726 "FORMAT 2 - Microcode detected error %02x",
730 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
731 "FORMAT 2 - Reserved");
735 case 0x30: /* Format 3 - 3990 Control Checks */
738 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
739 "FORMAT 3 - Allegiance terminated");
742 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
743 "FORMAT 3 - Reserved");
747 case 0x40: /* Format 4 - Data Checks */
750 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
751 "FORMAT 4 - Home address area error");
754 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
755 "FORMAT 4 - Count area error");
758 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
759 "FORMAT 4 - Key area error");
762 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
763 "FORMAT 4 - Data area error");
766 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
767 "FORMAT 4 - No sync byte in home address "
771 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
772 "FORMAT 4 - No sync byte in count address "
776 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
777 "FORMAT 4 - No sync byte in key area");
780 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
781 "FORMAT 4 - No sync byte in data area");
784 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
785 "FORMAT 4 - Home address area error; "
789 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
790 "FORMAT 4 - Count area error; offset "
794 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
795 "FORMAT 4 - Key area error; offset "
799 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
800 "FORMAT 4 - Data area error; "
804 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
805 "FORMAT 4 - No sync byte in home "
806 "address area; offset active");
809 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
810 "FORMAT 4 - No syn byte in count "
811 "address area; offset active");
814 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
815 "FORMAT 4 - No sync byte in key area; "
819 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
820 "FORMAT 4 - No syn byte in data area; "
824 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
825 "FORMAT 4 - Reserved");
829 case 0x50: /* Format 5 - Data Check with displacement information */
832 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
833 "FORMAT 5 - Data Check in the "
834 "home address area");
837 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
838 "FORMAT 5 - Data Check in the count area");
841 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
842 "FORMAT 5 - Data Check in the key area");
845 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
846 "FORMAT 5 - Data Check in the data area");
849 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
850 "FORMAT 5 - Data Check in the "
851 "home address area; offset active");
854 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
855 "FORMAT 5 - Data Check in the count area; "
859 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
860 "FORMAT 5 - Data Check in the key area; "
864 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
865 "FORMAT 5 - Data Check in the data area; "
869 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
870 "FORMAT 5 - Reserved");
874 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
877 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
878 "FORMAT 6 - Overrun on channel A");
881 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
882 "FORMAT 6 - Overrun on channel B");
885 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
886 "FORMAT 6 - Overrun on channel C");
889 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
890 "FORMAT 6 - Overrun on channel D");
893 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
894 "FORMAT 6 - Overrun on channel E");
897 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
898 "FORMAT 6 - Overrun on channel F");
901 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
902 "FORMAT 6 - Overrun on channel G");
905 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
906 "FORMAT 6 - Overrun on channel H");
909 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
910 "FORMAT 6 - Reserved");
914 case 0x70: /* Format 7 - Device Connection Control Checks */
917 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
918 "FORMAT 7 - RCC initiated by a connection "
922 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
923 "FORMAT 7 - RCC 1 sequence not "
927 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
928 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
932 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
933 "FORMAT 7 - Invalid tag-in during "
934 "selection sequence");
937 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
938 "FORMAT 7 - extra RCC required");
941 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
942 "FORMAT 7 - Invalid DCC selection "
943 "response or timeout");
946 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
947 "FORMAT 7 - Missing end operation; device "
948 "transfer complete");
951 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
952 "FORMAT 7 - Missing end operation; device "
953 "transfer incomplete");
956 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
957 "FORMAT 7 - Invalid tag-in for an "
958 "immediate command sequence");
961 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
962 "FORMAT 7 - Invalid tag-in for an "
963 "extended command sequence");
966 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
967 "FORMAT 7 - 3990 microcode time out when "
968 "stopping selection");
971 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
972 "FORMAT 7 - No response to selection "
973 "after a poll interruption");
976 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
977 "FORMAT 7 - Permanent path error (DASD "
978 "controller not available)");
981 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
982 "FORMAT 7 - DASD controller not available"
983 " on disconnected command chain");
986 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
987 "FORMAT 7 - Reserved");
991 case 0x80: /* Format 8 - Additional Device Equipment Checks */
993 case 0x00: /* No Message */
995 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
996 "FORMAT 8 - Error correction code "
1000 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1001 "FORMAT 8 - Unexpected end operation "
1005 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1006 "FORMAT 8 - End operation with transfer "
1010 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1011 "FORMAT 8 - End operation with transfer "
1015 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1016 "FORMAT 8 - DPS checks after a system "
1017 "reset or selective reset");
1020 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1021 "FORMAT 8 - DPS cannot be filled");
1024 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1025 "FORMAT 8 - Short busy time-out during "
1026 "device selection");
1029 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1030 "FORMAT 8 - DASD controller failed to "
1031 "set or reset the long busy latch");
1034 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1035 "FORMAT 8 - No interruption from device "
1036 "during a command chain");
1039 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1040 "FORMAT 8 - Reserved");
1044 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
1047 break; /* No Message */
1049 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1050 "FORMAT 9 - Device check-2 error");
1053 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1054 "FORMAT 9 - Head address did not compare");
1057 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1058 "FORMAT 9 - Track physical address did "
1059 "not compare while oriented");
1062 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1063 "FORMAT 9 - Cylinder address did not "
1067 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1068 "FORMAT 9 - Reserved");
1072 case 0xF0: /* Format F - Cache Storage Checks */
1075 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1076 "FORMAT F - Operation Terminated");
1079 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1080 "FORMAT F - Subsystem Processing Error");
1083 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1084 "FORMAT F - Cache or nonvolatile storage "
1085 "equipment failure");
1088 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1089 "FORMAT F - Caching terminated");
1092 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1093 "FORMAT F - Cache fast write access not "
1097 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1098 "FORMAT F - Track format incorrect");
1101 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1102 "FORMAT F - Caching reinitiated");
1105 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1106 "FORMAT F - Nonvolatile storage "
1110 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1111 "FORMAT F - Volume is suspended duplex");
1114 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1115 "FORMAT F - Subsystem status connot be "
1119 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1120 "FORMAT F - Caching status reset to "
1124 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1125 "FORMAT F - DASD Fast Write inhibited");
1128 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
1129 "FORMAT D - Reserved");
1133 default: /* unknown message format - should not happen */
1134 DEV_MESSAGE (KERN_WARNING
, device
,
1135 "unknown message format %02x",
1138 } /* end switch message format */
1140 } /* end dasd_3990_handle_env_data */
1143 * DASD_3990_ERP_COM_REJ
1146 * Handles 24 byte 'Command Reject' error.
1149 * erp current erp_head
1150 * sense current sense data
1153 * erp 'new' erp_head - pointer to new ERP
1155 static struct dasd_ccw_req
*
1156 dasd_3990_erp_com_rej(struct dasd_ccw_req
* erp
, char *sense
)
1159 struct dasd_device
*device
= erp
->device
;
1161 erp
->function
= dasd_3990_erp_com_rej
;
1163 /* env data present (ACTION 10 - retry should work) */
1164 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1166 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1167 "Command Reject - environmental data present");
1169 dasd_3990_handle_env_data(erp
, sense
);
1174 /* fatal error - set status to FAILED */
1175 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1176 "Command Reject - Fatal error");
1178 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1183 } /* end dasd_3990_erp_com_rej */
1186 * DASD_3990_ERP_BUS_OUT
1189 * Handles 24 byte 'Bus Out Parity Check' error.
1192 * erp current erp_head
1194 * erp new erp_head - pointer to new ERP
1196 static struct dasd_ccw_req
*
1197 dasd_3990_erp_bus_out(struct dasd_ccw_req
* erp
)
1200 struct dasd_device
*device
= erp
->device
;
1202 /* first time set initial retry counter and erp_function */
1203 /* and retry once without blocking queue */
1204 /* (this enables easier enqueing of the cqr) */
1205 if (erp
->function
!= dasd_3990_erp_bus_out
) {
1207 erp
->function
= dasd_3990_erp_bus_out
;
1211 /* issue a message and wait for 'device ready' interrupt */
1212 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1213 "bus out parity error or BOPC requested by "
1216 dasd_3990_erp_block_queue(erp
, 60*HZ
);
1222 } /* end dasd_3990_erp_bus_out */
1225 * DASD_3990_ERP_EQUIP_CHECK
1228 * Handles 24 byte 'Equipment Check' error.
1231 * erp current erp_head
1233 * erp new erp_head - pointer to new ERP
1235 static struct dasd_ccw_req
*
1236 dasd_3990_erp_equip_check(struct dasd_ccw_req
* erp
, char *sense
)
1239 struct dasd_device
*device
= erp
->device
;
1241 erp
->function
= dasd_3990_erp_equip_check
;
1243 if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1245 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1246 "Write inhibited path encountered");
1248 /* vary path offline */
1249 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1250 "Path should be varied off-line. "
1251 "This is not implemented yet \n - please report "
1252 "to linux390@de.ibm.com");
1254 erp
= dasd_3990_erp_action_1(erp
);
1256 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1258 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1259 "Equipment Check - " "environmental data present");
1261 dasd_3990_handle_env_data(erp
, sense
);
1263 erp
= dasd_3990_erp_action_4(erp
, sense
);
1265 } else if (sense
[1] & SNS1_PERM_ERR
) {
1267 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1268 "Equipment Check - retry exhausted or "
1271 erp
= dasd_3990_erp_action_1(erp
);
1274 /* all other equipment checks - Action 5 */
1275 /* rest is done when retries == 0 */
1276 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1277 "Equipment check or processing error");
1279 erp
= dasd_3990_erp_action_5(erp
);
1284 } /* end dasd_3990_erp_equip_check */
1287 * DASD_3990_ERP_DATA_CHECK
1290 * Handles 24 byte 'Data Check' error.
1293 * erp current erp_head
1295 * erp new erp_head - pointer to new ERP
1297 static struct dasd_ccw_req
*
1298 dasd_3990_erp_data_check(struct dasd_ccw_req
* erp
, char *sense
)
1301 struct dasd_device
*device
= erp
->device
;
1303 erp
->function
= dasd_3990_erp_data_check
;
1305 if (sense
[2] & SNS2_CORRECTABLE
) { /* correctable data check */
1307 /* issue message that the data has been corrected */
1308 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
1309 "Data recovered during retry with PCI "
1310 "fetch mode active");
1312 /* not possible to handle this situation in Linux */
1313 panic("No way to inform application about the possibly "
1316 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1318 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1319 "Uncorrectable data check recovered secondary "
1320 "addr of duplex pair");
1322 erp
= dasd_3990_erp_action_4(erp
, sense
);
1324 } else if (sense
[1] & SNS1_PERM_ERR
) {
1326 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1327 "Uncorrectable data check with internal "
1330 erp
= dasd_3990_erp_action_1(erp
);
1333 /* all other data checks */
1334 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1335 "Uncorrectable data check with retry count "
1338 erp
= dasd_3990_erp_action_5(erp
);
1343 } /* end dasd_3990_erp_data_check */
1346 * DASD_3990_ERP_OVERRUN
1349 * Handles 24 byte 'Overrun' error.
1352 * erp current erp_head
1354 * erp new erp_head - pointer to new ERP
1356 static struct dasd_ccw_req
*
1357 dasd_3990_erp_overrun(struct dasd_ccw_req
* erp
, char *sense
)
1360 struct dasd_device
*device
= erp
->device
;
1362 erp
->function
= dasd_3990_erp_overrun
;
1364 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1365 "Overrun - service overrun or overrun"
1366 " error requested by channel");
1368 erp
= dasd_3990_erp_action_5(erp
);
1372 } /* end dasd_3990_erp_overrun */
1375 * DASD_3990_ERP_INV_FORMAT
1378 * Handles 24 byte 'Invalid Track Format' error.
1381 * erp current erp_head
1383 * erp new erp_head - pointer to new ERP
1385 static struct dasd_ccw_req
*
1386 dasd_3990_erp_inv_format(struct dasd_ccw_req
* erp
, char *sense
)
1389 struct dasd_device
*device
= erp
->device
;
1391 erp
->function
= dasd_3990_erp_inv_format
;
1393 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1395 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1396 "Track format error when destaging or "
1399 dasd_3990_handle_env_data(erp
, sense
);
1401 erp
= dasd_3990_erp_action_4(erp
, sense
);
1404 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1405 "Invalid Track Format - Fatal error should have "
1406 "been handled within the interrupt handler");
1408 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1413 } /* end dasd_3990_erp_inv_format */
1419 * Handles 24 byte 'End-of-Cylinder' error.
1422 * erp already added default erp
1424 * erp pointer to original (failed) cqr.
1426 static struct dasd_ccw_req
*
1427 dasd_3990_erp_EOC(struct dasd_ccw_req
* default_erp
, char *sense
)
1430 struct dasd_device
*device
= default_erp
->device
;
1432 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1433 "End-of-Cylinder - must never happen");
1435 /* implement action 7 - BUG */
1436 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1438 } /* end dasd_3990_erp_EOC */
1441 * DASD_3990_ERP_ENV_DATA
1444 * Handles 24 byte 'Environmental-Data Present' error.
1447 * erp current erp_head
1449 * erp new erp_head - pointer to new ERP
1451 static struct dasd_ccw_req
*
1452 dasd_3990_erp_env_data(struct dasd_ccw_req
* erp
, char *sense
)
1455 struct dasd_device
*device
= erp
->device
;
1457 erp
->function
= dasd_3990_erp_env_data
;
1459 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Environmental data present");
1461 dasd_3990_handle_env_data(erp
, sense
);
1463 /* don't retry on disabled interface */
1464 if (sense
[7] != 0x0F) {
1466 erp
= dasd_3990_erp_action_4(erp
, sense
);
1469 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_IN_IO
);
1474 } /* end dasd_3990_erp_env_data */
1477 * DASD_3990_ERP_NO_REC
1480 * Handles 24 byte 'No Record Found' error.
1483 * erp already added default ERP
1486 * erp new erp_head - pointer to new ERP
1488 static struct dasd_ccw_req
*
1489 dasd_3990_erp_no_rec(struct dasd_ccw_req
* default_erp
, char *sense
)
1492 struct dasd_device
*device
= default_erp
->device
;
1494 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1495 "No Record Found - Fatal error should "
1496 "have been handled within the interrupt handler");
1498 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1500 } /* end dasd_3990_erp_no_rec */
1503 * DASD_3990_ERP_FILE_PROT
1506 * Handles 24 byte 'File Protected' error.
1507 * Note: Seek related recovery is not implemented because
1508 * wee don't use the seek command yet.
1511 * erp current erp_head
1513 * erp new erp_head - pointer to new ERP
1515 static struct dasd_ccw_req
*
1516 dasd_3990_erp_file_prot(struct dasd_ccw_req
* erp
)
1519 struct dasd_device
*device
= erp
->device
;
1521 DEV_MESSAGE(KERN_ERR
, device
, "%s", "File Protected");
1523 return dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1525 } /* end dasd_3990_erp_file_prot */
1528 * DASD_3990_ERP_INSPECT_24
1531 * Does a detailed inspection of the 24 byte sense data
1532 * and sets up a related error recovery action.
1535 * sense sense data of the actual error
1536 * erp pointer to the currently created default ERP
1539 * erp pointer to the (addtitional) ERP
1541 static struct dasd_ccw_req
*
1542 dasd_3990_erp_inspect_24(struct dasd_ccw_req
* erp
, char *sense
)
1545 struct dasd_ccw_req
*erp_filled
= NULL
;
1547 /* Check sense for .... */
1548 /* 'Command Reject' */
1549 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_CMD_REJECT
)) {
1550 erp_filled
= dasd_3990_erp_com_rej(erp
, sense
);
1552 /* 'Intervention Required' */
1553 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_INTERVENTION_REQ
)) {
1554 erp_filled
= dasd_3990_erp_int_req(erp
);
1556 /* 'Bus Out Parity Check' */
1557 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_BUS_OUT_CHECK
)) {
1558 erp_filled
= dasd_3990_erp_bus_out(erp
);
1560 /* 'Equipment Check' */
1561 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_EQUIPMENT_CHECK
)) {
1562 erp_filled
= dasd_3990_erp_equip_check(erp
, sense
);
1565 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_DATA_CHECK
)) {
1566 erp_filled
= dasd_3990_erp_data_check(erp
, sense
);
1569 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_OVERRUN
)) {
1570 erp_filled
= dasd_3990_erp_overrun(erp
, sense
);
1572 /* 'Invalid Track Format' */
1573 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_INV_TRACK_FORMAT
)) {
1574 erp_filled
= dasd_3990_erp_inv_format(erp
, sense
);
1576 /* 'End-of-Cylinder' */
1577 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_EOC
)) {
1578 erp_filled
= dasd_3990_erp_EOC(erp
, sense
);
1580 /* 'Environmental Data' */
1581 if ((erp_filled
== NULL
) && (sense
[2] & SNS2_ENV_DATA_PRESENT
)) {
1582 erp_filled
= dasd_3990_erp_env_data(erp
, sense
);
1584 /* 'No Record Found' */
1585 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_NO_REC_FOUND
)) {
1586 erp_filled
= dasd_3990_erp_no_rec(erp
, sense
);
1588 /* 'File Protected' */
1589 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_FILE_PROTECTED
)) {
1590 erp_filled
= dasd_3990_erp_file_prot(erp
);
1592 /* other (unknown) error - do default ERP */
1593 if (erp_filled
== NULL
) {
1600 } /* END dasd_3990_erp_inspect_24 */
1603 *****************************************************************************
1604 * 32 byte sense ERP functions (only)
1605 *****************************************************************************
1609 * DASD_3990_ERPACTION_10_32
1612 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1613 * Just retry and if retry doesn't work, return with error.
1616 * erp current erp_head
1617 * sense current sense data
1619 * erp modified erp_head
1621 static struct dasd_ccw_req
*
1622 dasd_3990_erp_action_10_32(struct dasd_ccw_req
* erp
, char *sense
)
1625 struct dasd_device
*device
= erp
->device
;
1628 erp
->function
= dasd_3990_erp_action_10_32
;
1630 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Perform logging requested");
1634 } /* end dasd_3990_erp_action_10_32 */
1637 * DASD_3990_ERP_ACTION_1B_32
1640 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
1641 * A write operation could not be finished because of an unexpected
1643 * The already created 'default erp' is used to get the link to
1644 * the erp chain, but it can not be used for this recovery
1645 * action because it contains no DE/LO data space.
1648 * default_erp already added default erp.
1649 * sense current sense data
1653 * default_erp in case of imprecise ending or error
1655 static struct dasd_ccw_req
*
1656 dasd_3990_erp_action_1B_32(struct dasd_ccw_req
* default_erp
, char *sense
)
1659 struct dasd_device
*device
= default_erp
->device
;
1661 struct dasd_ccw_req
*cqr
;
1662 struct dasd_ccw_req
*erp
;
1663 struct DE_eckd_data
*DE_data
;
1664 char *LO_data
; /* LO_eckd_data_t */
1667 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1668 "Write not finished because of unexpected condition");
1670 default_erp
->function
= dasd_3990_erp_action_1B_32
;
1672 /* determine the original cqr */
1675 while (cqr
->refers
!= NULL
) {
1679 /* for imprecise ending just do default erp */
1680 if (sense
[1] & 0x01) {
1682 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1683 "Imprecise ending is set - just retry");
1688 /* determine the address of the CCW to be restarted */
1689 /* Imprecise ending is not set -> addr from IRB-SCSW */
1690 cpa
= default_erp
->refers
->irb
.scsw
.cpa
;
1694 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1695 "Unable to determine address of the CCW "
1698 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1701 /* Build new ERP request including DE/LO */
1702 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
1703 2 + 1,/* DE/LO + TIC */
1704 sizeof (struct DE_eckd_data
) +
1705 sizeof (struct LO_eckd_data
), device
);
1708 DEV_MESSAGE(KERN_ERR
, device
, "%s", "Unable to allocate ERP");
1709 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1712 /* use original DE */
1713 DE_data
= erp
->data
;
1714 memcpy(DE_data
, cqr
->data
, sizeof (struct DE_eckd_data
));
1717 LO_data
= erp
->data
+ sizeof (struct DE_eckd_data
);
1719 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1721 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1722 "BUG - this should not happen");
1724 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1727 if ((sense
[7] & 0x3F) == 0x01) {
1728 /* operation code is WRITE DATA -> data area orientation */
1731 } else if ((sense
[7] & 0x3F) == 0x03) {
1732 /* operation code is FORMAT WRITE -> index orientation */
1736 LO_data
[0] = sense
[7]; /* operation */
1739 LO_data
[1] = sense
[8]; /* auxiliary */
1740 LO_data
[2] = sense
[9];
1741 LO_data
[3] = sense
[3]; /* count */
1742 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1743 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1744 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1746 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1750 memset(ccw
, 0, sizeof (struct ccw1
));
1751 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
1752 ccw
->flags
= CCW_FLAG_CC
;
1754 ccw
->cda
= (__u32
)(addr_t
) DE_data
;
1758 memset(ccw
, 0, sizeof (struct ccw1
));
1759 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
1760 ccw
->flags
= CCW_FLAG_CC
;
1762 ccw
->cda
= (__u32
)(addr_t
) LO_data
;
1764 /* TIC to the failed ccw */
1766 ccw
->cmd_code
= CCW_CMD_TIC
;
1769 /* fill erp related fields */
1770 erp
->function
= dasd_3990_erp_action_1B_32
;
1771 erp
->refers
= default_erp
->refers
;
1772 erp
->device
= device
;
1773 erp
->magic
= default_erp
->magic
;
1776 erp
->buildclk
= get_clock();
1777 erp
->status
= DASD_CQR_FILLED
;
1779 /* remove the default erp */
1780 dasd_free_erp_request(default_erp
, device
);
1784 } /* end dasd_3990_erp_action_1B_32 */
1787 * DASD_3990_UPDATE_1B
1790 * Handles the update to the 32 byte 'Action 1B' of Single Program
1791 * Action Codes in case the first action was not successful.
1792 * The already created 'previous_erp' is the currently not successful
1796 * previous_erp already created previous erp.
1797 * sense current sense data
1801 static struct dasd_ccw_req
*
1802 dasd_3990_update_1B(struct dasd_ccw_req
* previous_erp
, char *sense
)
1805 struct dasd_device
*device
= previous_erp
->device
;
1807 struct dasd_ccw_req
*cqr
;
1808 struct dasd_ccw_req
*erp
;
1809 char *LO_data
; /* struct LO_eckd_data */
1812 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1813 "Write not finished because of unexpected condition"
1816 /* determine the original cqr */
1819 while (cqr
->refers
!= NULL
) {
1823 /* for imprecise ending just do default erp */
1824 if (sense
[1] & 0x01) {
1826 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1827 "Imprecise ending is set - just retry");
1829 previous_erp
->status
= DASD_CQR_QUEUED
;
1831 return previous_erp
;
1834 /* determine the address of the CCW to be restarted */
1835 /* Imprecise ending is not set -> addr from IRB-SCSW */
1836 cpa
= previous_erp
->irb
.scsw
.cpa
;
1840 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1841 "Unable to determine address of the CCW "
1844 previous_erp
->status
= DASD_CQR_FAILED
;
1846 return previous_erp
;
1851 /* update the LO with the new returned sense data */
1852 LO_data
= erp
->data
+ sizeof (struct DE_eckd_data
);
1854 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1856 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1857 "BUG - this should not happen");
1859 previous_erp
->status
= DASD_CQR_FAILED
;
1861 return previous_erp
;
1864 if ((sense
[7] & 0x3F) == 0x01) {
1865 /* operation code is WRITE DATA -> data area orientation */
1868 } else if ((sense
[7] & 0x3F) == 0x03) {
1869 /* operation code is FORMAT WRITE -> index orientation */
1873 LO_data
[0] = sense
[7]; /* operation */
1876 LO_data
[1] = sense
[8]; /* auxiliary */
1877 LO_data
[2] = sense
[9];
1878 LO_data
[3] = sense
[3]; /* count */
1879 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1880 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1881 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1883 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1885 /* TIC to the failed ccw */
1886 ccw
= erp
->cpaddr
; /* addr of DE ccw */
1887 ccw
++; /* addr of LE ccw */
1888 ccw
++; /* addr of TIC ccw */
1891 erp
->status
= DASD_CQR_QUEUED
;
1895 } /* end dasd_3990_update_1B */
1898 * DASD_3990_ERP_COMPOUND_RETRY
1901 * Handles the compound ERP action retry code.
1902 * NOTE: At least one retry is done even if zero is specified
1903 * by the sense data. This makes enqueueing of the request
1907 * sense sense data of the actual error
1908 * erp pointer to the currently created ERP
1911 * erp modified ERP pointer
1915 dasd_3990_erp_compound_retry(struct dasd_ccw_req
* erp
, char *sense
)
1918 switch (sense
[25] & 0x03) {
1919 case 0x00: /* no not retry */
1923 case 0x01: /* retry 2 times */
1927 case 0x02: /* retry 10 times */
1931 case 0x03: /* retry 256 times */
1939 erp
->function
= dasd_3990_erp_compound_retry
;
1941 } /* end dasd_3990_erp_compound_retry */
1944 * DASD_3990_ERP_COMPOUND_PATH
1947 * Handles the compound ERP action for retry on alternate
1951 * sense sense data of the actual error
1952 * erp pointer to the currently created ERP
1955 * erp modified ERP pointer
1959 dasd_3990_erp_compound_path(struct dasd_ccw_req
* erp
, char *sense
)
1962 if (sense
[25] & DASD_SENSE_BIT_3
) {
1963 dasd_3990_erp_alternate_path(erp
);
1965 if (erp
->status
== DASD_CQR_FAILED
) {
1966 /* reset the lpm and the status to be able to
1967 * try further actions. */
1971 erp
->status
= DASD_CQR_ERROR
;
1976 erp
->function
= dasd_3990_erp_compound_path
;
1978 } /* end dasd_3990_erp_compound_path */
1981 * DASD_3990_ERP_COMPOUND_CODE
1984 * Handles the compound ERP action for retry code.
1987 * sense sense data of the actual error
1988 * erp pointer to the currently created ERP
1991 * erp NEW ERP pointer
1994 static struct dasd_ccw_req
*
1995 dasd_3990_erp_compound_code(struct dasd_ccw_req
* erp
, char *sense
)
1998 if (sense
[25] & DASD_SENSE_BIT_2
) {
2000 switch (sense
[28]) {
2002 /* issue a Diagnostic Control command with an
2003 * Inhibit Write subcommand and controler modifier */
2004 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2008 /* wait for 5 seconds and retry again */
2011 dasd_3990_erp_block_queue (erp
, 5*HZ
);
2015 /* should not happen - continue */
2020 erp
->function
= dasd_3990_erp_compound_code
;
2024 } /* end dasd_3990_erp_compound_code */
2027 * DASD_3990_ERP_COMPOUND_CONFIG
2030 * Handles the compound ERP action for configruation
2032 * Note: duplex handling is not implemented (yet).
2035 * sense sense data of the actual error
2036 * erp pointer to the currently created ERP
2039 * erp modified ERP pointer
2043 dasd_3990_erp_compound_config(struct dasd_ccw_req
* erp
, char *sense
)
2046 if ((sense
[25] & DASD_SENSE_BIT_1
) && (sense
[26] & DASD_SENSE_BIT_2
)) {
2048 /* set to suspended duplex state then restart */
2049 struct dasd_device
*device
= erp
->device
;
2051 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2052 "Set device to suspended duplex state should be "
2054 "This is not implemented yet (for compound ERP)"
2055 " - please report to linux390@de.ibm.com");
2059 erp
->function
= dasd_3990_erp_compound_config
;
2061 } /* end dasd_3990_erp_compound_config */
2064 * DASD_3990_ERP_COMPOUND
2067 * Does the further compound program action if
2068 * compound retry was not successful.
2071 * sense sense data of the actual error
2072 * erp pointer to the current (failed) ERP
2075 * erp (additional) ERP pointer
2078 static struct dasd_ccw_req
*
2079 dasd_3990_erp_compound(struct dasd_ccw_req
* erp
, char *sense
)
2082 if ((erp
->function
== dasd_3990_erp_compound_retry
) &&
2083 (erp
->status
== DASD_CQR_ERROR
)) {
2085 dasd_3990_erp_compound_path(erp
, sense
);
2088 if ((erp
->function
== dasd_3990_erp_compound_path
) &&
2089 (erp
->status
== DASD_CQR_ERROR
)) {
2091 erp
= dasd_3990_erp_compound_code(erp
, sense
);
2094 if ((erp
->function
== dasd_3990_erp_compound_code
) &&
2095 (erp
->status
== DASD_CQR_ERROR
)) {
2097 dasd_3990_erp_compound_config(erp
, sense
);
2100 /* if no compound action ERP specified, the request failed */
2101 if (erp
->status
== DASD_CQR_ERROR
) {
2103 erp
->status
= DASD_CQR_FAILED
;
2108 } /* end dasd_3990_erp_compound */
2111 * DASD_3990_ERP_INSPECT_32
2114 * Does a detailed inspection of the 32 byte sense data
2115 * and sets up a related error recovery action.
2118 * sense sense data of the actual error
2119 * erp pointer to the currently created default ERP
2122 * erp_filled pointer to the ERP
2125 static struct dasd_ccw_req
*
2126 dasd_3990_erp_inspect_32(struct dasd_ccw_req
* erp
, char *sense
)
2129 struct dasd_device
*device
= erp
->device
;
2131 erp
->function
= dasd_3990_erp_inspect_32
;
2133 if (sense
[25] & DASD_SENSE_BIT_0
) {
2135 /* compound program action codes (byte25 bit 0 == '1') */
2136 dasd_3990_erp_compound_retry(erp
, sense
);
2140 /* single program action codes (byte25 bit 0 == '0') */
2141 switch (sense
[25]) {
2143 case 0x00: /* success - use default ERP for retries */
2144 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2145 "ERP called for successful request"
2149 case 0x01: /* fatal error */
2150 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2151 "Fatal error should have been "
2152 "handled within the interrupt handler");
2154 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2157 case 0x02: /* intervention required */
2158 case 0x03: /* intervention required during dual copy */
2159 erp
= dasd_3990_erp_int_req(erp
);
2162 case 0x0F: /* length mismatch during update write command */
2163 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2164 "update write command error - should not "
2166 "Please send this message together with "
2167 "the above sense data to linux390@de."
2170 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2173 case 0x10: /* logging required for other channel program */
2174 erp
= dasd_3990_erp_action_10_32(erp
, sense
);
2177 case 0x15: /* next track outside defined extend */
2178 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2179 "next track outside defined extend - "
2180 "should not happen;\n"
2181 "Please send this message together with "
2182 "the above sense data to linux390@de."
2185 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2188 case 0x1B: /* unexpected condition during write */
2190 erp
= dasd_3990_erp_action_1B_32(erp
, sense
);
2193 case 0x1C: /* invalid data */
2194 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
2195 "Data recovered during retry with PCI "
2196 "fetch mode active");
2198 /* not possible to handle this situation in Linux */
2200 ("Invalid data - No way to inform application "
2201 "about the possibly incorrect data");
2204 case 0x1D: /* state-change pending */
2205 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2206 "A State change pending condition exists "
2207 "for the subsystem or device");
2209 erp
= dasd_3990_erp_action_4(erp
, sense
);
2212 case 0x1E: /* busy */
2213 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2214 "Busy condition exists "
2215 "for the subsystem or device");
2216 erp
= dasd_3990_erp_action_4(erp
, sense
);
2219 default: /* all others errors - default erp */
2226 } /* end dasd_3990_erp_inspect_32 */
2229 *****************************************************************************
2230 * main ERP control fuctions (24 and 32 byte sense)
2231 *****************************************************************************
2235 * DASD_3990_ERP_INSPECT
2238 * Does a detailed inspection for sense data by calling either
2239 * the 24-byte or the 32-byte inspection routine.
2242 * erp pointer to the currently created default ERP
2244 * erp_new contens was possibly modified
2246 static struct dasd_ccw_req
*
2247 dasd_3990_erp_inspect(struct dasd_ccw_req
* erp
)
2250 struct dasd_ccw_req
*erp_new
= NULL
;
2251 /* sense data are located in the refers record of the */
2252 /* already set up new ERP ! */
2253 char *sense
= erp
->refers
->irb
.ecw
;
2255 /* distinguish between 24 and 32 byte sense data */
2256 if (sense
[27] & DASD_SENSE_BIT_0
) {
2258 /* inspect the 24 byte sense data */
2259 erp_new
= dasd_3990_erp_inspect_24(erp
, sense
);
2263 /* inspect the 32 byte sense data */
2264 erp_new
= dasd_3990_erp_inspect_32(erp
, sense
);
2266 } /* end distinguish between 24 and 32 byte sense data */
2272 * DASD_3990_ERP_ADD_ERP
2275 * This funtion adds an additional request block (ERP) to the head of
2276 * the given cqr (or erp).
2277 * This erp is initialized as an default erp (retry TIC)
2280 * cqr head of the current ERP-chain (or single cqr if
2283 * erp pointer to new ERP-chain head
2285 static struct dasd_ccw_req
*
2286 dasd_3990_erp_add_erp(struct dasd_ccw_req
* cqr
)
2289 struct dasd_device
*device
= cqr
->device
;
2292 /* allocate additional request block */
2293 struct dasd_ccw_req
*erp
;
2295 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
, 2, 0, cqr
->device
);
2297 if (cqr
->retries
<= 0) {
2298 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2299 "Unable to allocate ERP request");
2300 cqr
->status
= DASD_CQR_FAILED
;
2301 cqr
->stopclk
= get_clock ();
2303 DEV_MESSAGE (KERN_ERR
, device
,
2304 "Unable to allocate ERP request "
2305 "(%i retries left)",
2307 dasd_set_timer(device
, (HZ
<< 3));
2312 /* initialize request with default TIC to current ERP/CQR */
2314 ccw
->cmd_code
= CCW_CMD_NOOP
;
2315 ccw
->flags
= CCW_FLAG_CC
;
2317 ccw
->cmd_code
= CCW_CMD_TIC
;
2318 ccw
->cda
= (long)(cqr
->cpaddr
);
2319 erp
->function
= dasd_3990_erp_add_erp
;
2321 erp
->device
= cqr
->device
;
2322 erp
->magic
= cqr
->magic
;
2325 erp
->buildclk
= get_clock();
2327 erp
->status
= DASD_CQR_FILLED
;
2333 * DASD_3990_ERP_ADDITIONAL_ERP
2336 * An additional ERP is needed to handle the current error.
2337 * Add ERP to the head of the ERP-chain containing the ERP processing
2338 * determined based on the sense data.
2341 * cqr head of the current ERP-chain (or single cqr if
2345 * erp pointer to new ERP-chain head
2347 static struct dasd_ccw_req
*
2348 dasd_3990_erp_additional_erp(struct dasd_ccw_req
* cqr
)
2351 struct dasd_ccw_req
*erp
= NULL
;
2353 /* add erp and initialize with default TIC */
2354 erp
= dasd_3990_erp_add_erp(cqr
);
2356 /* inspect sense, determine specific ERP if possible */
2359 erp
= dasd_3990_erp_inspect(erp
);
2364 } /* end dasd_3990_erp_additional_erp */
2367 * DASD_3990_ERP_ERROR_MATCH
2370 * Check if the device status of the given cqr is the same.
2371 * This means that the failed CCW and the relevant sense data
2373 * I don't distinguish between 24 and 32 byte sense because in case of
2374 * 24 byte sense byte 25 and 27 is set as well.
2377 * cqr1 first cqr, which will be compared with the
2381 * match 'boolean' for match found
2382 * returns 1 if match found, otherwise 0.
2385 dasd_3990_erp_error_match(struct dasd_ccw_req
*cqr1
, struct dasd_ccw_req
*cqr2
)
2388 /* check failed CCW */
2389 if (cqr1
->irb
.scsw
.cpa
!= cqr2
->irb
.scsw
.cpa
) {
2390 // return 0; /* CCW doesn't match */
2393 /* check sense data; byte 0-2,25,27 */
2394 if (!((memcmp (cqr1
->irb
.ecw
, cqr2
->irb
.ecw
, 3) == 0) &&
2395 (cqr1
->irb
.ecw
[27] == cqr2
->irb
.ecw
[27]) &&
2396 (cqr1
->irb
.ecw
[25] == cqr2
->irb
.ecw
[25]))) {
2398 return 0; /* sense doesn't match */
2401 return 1; /* match */
2403 } /* end dasd_3990_erp_error_match */
2406 * DASD_3990_ERP_IN_ERP
2409 * check if the current error already happened before.
2410 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2413 * cqr failed cqr (either original cqr or already an erp)
2416 * erp erp-pointer to the already defined error
2417 * recovery procedure OR
2418 * NULL if a 'new' error occurred.
2420 static struct dasd_ccw_req
*
2421 dasd_3990_erp_in_erp(struct dasd_ccw_req
*cqr
)
2424 struct dasd_ccw_req
*erp_head
= cqr
, /* save erp chain head */
2425 *erp_match
= NULL
; /* save erp chain head */
2426 int match
= 0; /* 'boolean' for matching error found */
2428 if (cqr
->refers
== NULL
) { /* return if not in erp */
2432 /* check the erp/cqr chain for current error */
2434 match
= dasd_3990_erp_error_match(erp_head
, cqr
->refers
);
2435 erp_match
= cqr
; /* save possible matching erp */
2436 cqr
= cqr
->refers
; /* check next erp/cqr in queue */
2438 } while ((cqr
->refers
!= NULL
) && (!match
));
2441 return NULL
; /* no match was found */
2444 return erp_match
; /* return address of matching erp */
2446 } /* END dasd_3990_erp_in_erp */
2449 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2452 * No retry is left for the current ERP. Check what has to be done
2454 * - do further defined ERP action or
2455 * - wait for interrupt or
2456 * - exit with permanent error
2459 * erp ERP which is in progress with no retry left
2462 * erp modified/additional ERP
2464 static struct dasd_ccw_req
*
2465 dasd_3990_erp_further_erp(struct dasd_ccw_req
*erp
)
2468 struct dasd_device
*device
= erp
->device
;
2469 char *sense
= erp
->irb
.ecw
;
2471 /* check for 24 byte sense ERP */
2472 if ((erp
->function
== dasd_3990_erp_bus_out
) ||
2473 (erp
->function
== dasd_3990_erp_action_1
) ||
2474 (erp
->function
== dasd_3990_erp_action_4
)) {
2476 erp
= dasd_3990_erp_action_1(erp
);
2478 } else if (erp
->function
== dasd_3990_erp_action_5
) {
2480 /* retries have not been successful */
2481 /* prepare erp for retry on different channel path */
2482 erp
= dasd_3990_erp_action_1(erp
);
2484 if (!(sense
[2] & DASD_SENSE_BIT_0
)) {
2486 /* issue a Diagnostic Control command with an
2487 * Inhibit Write subcommand */
2489 switch (sense
[25]) {
2491 case 0x57:{ /* controller */
2492 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2496 case 0x58:{ /* channel path */
2497 erp
= dasd_3990_erp_DCTL(erp
, 0x40);
2501 case 0x59:{ /* storage director */
2502 erp
= dasd_3990_erp_DCTL(erp
, 0x80);
2506 DEV_MESSAGE(KERN_DEBUG
, device
,
2507 "invalid subcommand modifier 0x%x "
2508 "for Diagnostic Control Command",
2513 /* check for 32 byte sense ERP */
2514 } else if ((erp
->function
== dasd_3990_erp_compound_retry
) ||
2515 (erp
->function
== dasd_3990_erp_compound_path
) ||
2516 (erp
->function
== dasd_3990_erp_compound_code
) ||
2517 (erp
->function
== dasd_3990_erp_compound_config
)) {
2519 erp
= dasd_3990_erp_compound(erp
, sense
);
2522 /* No retry left and no additional special handling */
2524 DEV_MESSAGE(KERN_ERR
, device
,
2525 "no retries left for erp %p - "
2526 "set status to FAILED", erp
);
2528 erp
->status
= DASD_CQR_FAILED
;
2533 } /* end dasd_3990_erp_further_erp */
2536 * DASD_3990_ERP_HANDLE_MATCH_ERP
2539 * An error occurred again and an ERP has been detected which is already
2540 * used to handle this error (e.g. retries).
2541 * All prior ERP's are asumed to be successful and therefore removed
2543 * If retry counter of matching erp is already 0, it is checked if further
2544 * action is needed (besides retry) or if the ERP has failed.
2547 * erp_head first ERP in ERP-chain
2548 * erp ERP that handles the actual error.
2552 * erp modified/additional ERP
2554 static struct dasd_ccw_req
*
2555 dasd_3990_erp_handle_match_erp(struct dasd_ccw_req
*erp_head
,
2556 struct dasd_ccw_req
*erp
)
2559 struct dasd_device
*device
= erp_head
->device
;
2560 struct dasd_ccw_req
*erp_done
= erp_head
; /* finished req */
2561 struct dasd_ccw_req
*erp_free
= NULL
; /* req to be freed */
2563 /* loop over successful ERPs and remove them from chanq */
2564 while (erp_done
!= erp
) {
2566 if (erp_done
== NULL
) /* end of chain reached */
2567 panic(PRINTK_HEADER
"Programming error in ERP! The "
2568 "original request was lost\n");
2570 /* remove the request from the device queue */
2571 list_del(&erp_done
->list
);
2573 erp_free
= erp_done
;
2574 erp_done
= erp_done
->refers
;
2576 /* free the finished erp request */
2577 dasd_free_erp_request(erp_free
, erp_free
->device
);
2581 if (erp
->retries
> 0) {
2583 char *sense
= erp
->refers
->irb
.ecw
;
2585 /* check for special retries */
2586 if (erp
->function
== dasd_3990_erp_action_4
) {
2588 erp
= dasd_3990_erp_action_4(erp
, sense
);
2590 } else if (erp
->function
== dasd_3990_erp_action_1B_32
) {
2592 erp
= dasd_3990_update_1B(erp
, sense
);
2594 } else if (erp
->function
== dasd_3990_erp_int_req
) {
2596 erp
= dasd_3990_erp_int_req(erp
);
2600 DEV_MESSAGE(KERN_DEBUG
, device
,
2601 "%i retries left for erp %p",
2604 /* handle the request again... */
2605 erp
->status
= DASD_CQR_QUEUED
;
2609 /* no retry left - check for further necessary action */
2610 /* if no further actions, handle rest as permanent error */
2611 erp
= dasd_3990_erp_further_erp(erp
);
2616 } /* end dasd_3990_erp_handle_match_erp */
2619 * DASD_3990_ERP_ACTION
2622 * controll routine for 3990 erp actions.
2623 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2626 * cqr failed cqr (either original cqr or already an erp)
2629 * erp erp-pointer to the head of the ERP action chain.
2631 * - either a ptr to an additional ERP cqr or
2632 * - the original given cqr (which's status might
2635 struct dasd_ccw_req
*
2636 dasd_3990_erp_action(struct dasd_ccw_req
* cqr
)
2639 struct dasd_ccw_req
*erp
= NULL
;
2640 struct dasd_device
*device
= cqr
->device
;
2641 __u32 cpa
= cqr
->irb
.scsw
.cpa
;
2644 /* print current erp_chain */
2645 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2646 "ERP chain at BEGINNING of ERP-ACTION");
2648 struct dasd_ccw_req
*temp_erp
= NULL
;
2650 for (temp_erp
= cqr
;
2651 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2653 DEV_MESSAGE(KERN_ERR
, device
,
2654 " erp %p (%02x) refers to %p",
2655 temp_erp
, temp_erp
->status
,
2659 #endif /* ERP_DEBUG */
2661 /* double-check if current erp/cqr was successfull */
2662 if ((cqr
->irb
.scsw
.cstat
== 0x00) &&
2663 (cqr
->irb
.scsw
.dstat
== (DEV_STAT_CHN_END
|DEV_STAT_DEV_END
))) {
2665 DEV_MESSAGE(KERN_DEBUG
, device
,
2666 "ERP called for successful request %p"
2667 " - NO ERP necessary", cqr
);
2669 cqr
->status
= DASD_CQR_DONE
;
2673 /* check if sense data are available */
2674 if (!cqr
->irb
.ecw
) {
2675 DEV_MESSAGE(KERN_DEBUG
, device
,
2676 "ERP called witout sense data avail ..."
2677 "request %p - NO ERP possible", cqr
);
2679 cqr
->status
= DASD_CQR_FAILED
;
2685 /* check if error happened before */
2686 erp
= dasd_3990_erp_in_erp(cqr
);
2689 /* no matching erp found - set up erp */
2690 erp
= dasd_3990_erp_additional_erp(cqr
);
2692 /* matching erp found - set all leading erp's to DONE */
2693 erp
= dasd_3990_erp_handle_match_erp(cqr
, erp
);
2697 /* print current erp_chain */
2698 DEV_MESSAGE(KERN_ERR
, device
, "%s", "ERP chain at END of ERP-ACTION");
2700 struct dasd_ccw_req
*temp_erp
= NULL
;
2701 for (temp_erp
= erp
;
2702 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2704 DEV_MESSAGE(KERN_ERR
, device
,
2705 " erp %p (%02x) refers to %p",
2706 temp_erp
, temp_erp
->status
,
2710 #endif /* ERP_DEBUG */
2712 if (erp
->status
== DASD_CQR_FAILED
)
2713 dasd_log_ccw(erp
, 1, cpa
);
2715 /* enqueue added ERP request */
2716 if (erp
->status
== DASD_CQR_FILLED
) {
2717 erp
->status
= DASD_CQR_QUEUED
;
2718 list_add(&erp
->list
, &device
->ccw_queue
);
2723 } /* end dasd_3990_erp_action */
2726 * Overrides for Emacs so that we follow Linus's tabbing style.
2727 * Emacs will notice this stuff at the end of the file and automatically
2728 * adjust the settings for this buffer only. This must remain at the end
2730 * ---------------------------------------------------------------------------
2733 * c-brace-imaginary-offset: 0
2734 * c-brace-offset: -4
2735 * c-argdecl-indent: 4
2736 * c-label-offset: -4
2737 * c-continued-statement-offset: 4
2738 * c-continued-brace-offset: 0
2739 * indent-tabs-mode: 1