1 // SPDX-License-Identifier: GPL-2.0
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 * Copyright IBM Corp. 2000, 2001
10 #define KMSG_COMPONENT "dasd-eckd"
12 #include <linux/timer.h>
13 #include <asm/idals.h>
15 #define PRINTK_HEADER "dasd_erp(3990): "
18 #include "dasd_eckd.h"
22 unsigned char subcommand
; /* e.g Inhibit Write, Enable Write,... */
23 unsigned char modifier
; /* Subcommand modifier */
24 unsigned short res
; /* reserved */
25 } __attribute__ ((packed
));
28 *****************************************************************************
29 * SECTION ERP HANDLING
30 *****************************************************************************
33 *****************************************************************************
34 * 24 and 32 byte sense ERP functions
35 *****************************************************************************
39 * DASD_3990_ERP_CLEANUP
42 * Removes the already build but not necessary ERP request and sets
43 * the status of the original cqr / erp to the given (final) status
46 * erp request to be blocked
47 * final_status either DASD_CQR_DONE or DASD_CQR_FAILED
52 static struct dasd_ccw_req
*
53 dasd_3990_erp_cleanup(struct dasd_ccw_req
* erp
, char final_status
)
55 struct dasd_ccw_req
*cqr
= erp
->refers
;
57 dasd_free_erp_request(erp
, erp
->memdev
);
58 cqr
->status
= final_status
;
61 } /* end dasd_3990_erp_cleanup */
64 * DASD_3990_ERP_BLOCK_QUEUE
67 * Block the given device request queue to prevent from further
68 * processing until the started timer has expired or an related
69 * interrupt was received.
71 static void dasd_3990_erp_block_queue(struct dasd_ccw_req
*erp
, int expires
)
74 struct dasd_device
*device
= erp
->startdev
;
77 DBF_DEV_EVENT(DBF_INFO
, device
,
78 "blocking request queue for %is", expires
/HZ
);
80 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
81 dasd_device_set_stop_bits(device
, DASD_STOPPED_PENDING
);
82 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
83 erp
->status
= DASD_CQR_FILLED
;
85 dasd_block_set_timer(erp
->block
, expires
);
87 dasd_device_set_timer(device
, expires
);
91 * DASD_3990_ERP_INT_REQ
94 * Handles 'Intervention Required' error.
95 * This means either device offline or not installed.
102 static struct dasd_ccw_req
*
103 dasd_3990_erp_int_req(struct dasd_ccw_req
* erp
)
106 struct dasd_device
*device
= erp
->startdev
;
108 /* first time set initial retry counter and erp_function */
109 /* and retry once without blocking queue */
110 /* (this enables easier enqueing of the cqr) */
111 if (erp
->function
!= dasd_3990_erp_int_req
) {
114 erp
->function
= dasd_3990_erp_int_req
;
118 /* issue a message and wait for 'device ready' interrupt */
119 dev_err(&device
->cdev
->dev
,
120 "is offline or not installed - "
121 "INTERVENTION REQUIRED!!\n");
123 dasd_3990_erp_block_queue(erp
, 60*HZ
);
128 } /* end dasd_3990_erp_int_req */
131 * DASD_3990_ERP_ALTERNATE_PATH
134 * Repeat the operation on a different channel path.
135 * If all alternate paths have been tried, the request is posted with a
139 * erp pointer to the current ERP
142 * erp modified pointer to the ERP
145 dasd_3990_erp_alternate_path(struct dasd_ccw_req
* erp
)
147 struct dasd_device
*device
= erp
->startdev
;
151 /* try alternate valid path */
152 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
153 opm
= ccw_device_get_path_mask(device
->cdev
);
154 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
156 erp
->lpm
= dasd_path_get_opm(device
) &
157 ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
159 erp
->lpm
&= ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
161 if ((erp
->lpm
& opm
) != 0x00) {
163 DBF_DEV_EVENT(DBF_WARNING
, device
,
164 "try alternate lpm=%x (lpum=%x / opm=%x)",
165 erp
->lpm
, erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
167 /* reset status to submit the request again... */
168 erp
->status
= DASD_CQR_FILLED
;
171 dev_err(&device
->cdev
->dev
,
172 "The DASD cannot be reached on any path (lpum=%x"
173 "/opm=%x)\n", erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
175 /* post request with permanent error */
176 erp
->status
= DASD_CQR_FAILED
;
178 } /* end dasd_3990_erp_alternate_path */
184 * Setup cqr to do the Diagnostic Control (DCTL) command with an
185 * Inhibit Write subcommand (0x20) and the given modifier.
188 * erp pointer to the current (failed) ERP
189 * modifier subcommand modifier
192 * dctl_cqr pointer to NEW dctl_cqr
195 static struct dasd_ccw_req
*
196 dasd_3990_erp_DCTL(struct dasd_ccw_req
* erp
, char modifier
)
199 struct dasd_device
*device
= erp
->startdev
;
200 struct DCTL_data
*DCTL_data
;
202 struct dasd_ccw_req
*dctl_cqr
;
204 dctl_cqr
= dasd_alloc_erp_request((char *) &erp
->magic
, 1,
205 sizeof(struct DCTL_data
),
207 if (IS_ERR(dctl_cqr
)) {
208 dev_err(&device
->cdev
->dev
,
209 "Unable to allocate DCTL-CQR\n");
210 erp
->status
= DASD_CQR_FAILED
;
214 DCTL_data
= dctl_cqr
->data
;
216 DCTL_data
->subcommand
= 0x02; /* Inhibit Write */
217 DCTL_data
->modifier
= modifier
;
219 ccw
= dctl_cqr
->cpaddr
;
220 memset(ccw
, 0, sizeof(struct ccw1
));
221 ccw
->cmd_code
= CCW_CMD_DCTL
;
223 ccw
->cda
= (__u32
)(addr_t
) DCTL_data
;
224 dctl_cqr
->flags
= erp
->flags
;
225 dctl_cqr
->function
= dasd_3990_erp_DCTL
;
226 dctl_cqr
->refers
= erp
;
227 dctl_cqr
->startdev
= device
;
228 dctl_cqr
->memdev
= device
;
229 dctl_cqr
->magic
= erp
->magic
;
230 dctl_cqr
->expires
= 5 * 60 * HZ
;
231 dctl_cqr
->retries
= 2;
233 dctl_cqr
->buildclk
= get_tod_clock();
235 dctl_cqr
->status
= DASD_CQR_FILLED
;
239 } /* end dasd_3990_erp_DCTL */
242 * DASD_3990_ERP_ACTION_1
245 * Setup ERP to do the ERP action 1 (see Reference manual).
246 * Repeat the operation on a different channel path.
247 * As deviation from the recommended recovery action, we reset the path mask
248 * after we have tried each path and go through all paths a second time.
249 * This will cover situations where only one path at a time is actually down,
250 * but all paths fail and recover just with the same sequence and timing as
251 * we try to use them (flapping links).
252 * If all alternate paths have been tried twice, the request is posted with
256 * erp pointer to the current ERP
259 * erp pointer to the ERP
262 static struct dasd_ccw_req
*dasd_3990_erp_action_1_sec(struct dasd_ccw_req
*erp
)
264 erp
->function
= dasd_3990_erp_action_1_sec
;
265 dasd_3990_erp_alternate_path(erp
);
269 static struct dasd_ccw_req
*dasd_3990_erp_action_1(struct dasd_ccw_req
*erp
)
271 erp
->function
= dasd_3990_erp_action_1
;
272 dasd_3990_erp_alternate_path(erp
);
273 if (erp
->status
== DASD_CQR_FAILED
&&
274 !test_bit(DASD_CQR_VERIFY_PATH
, &erp
->flags
)) {
275 erp
->status
= DASD_CQR_FILLED
;
277 erp
->lpm
= dasd_path_get_opm(erp
->startdev
);
278 erp
->function
= dasd_3990_erp_action_1_sec
;
281 } /* end dasd_3990_erp_action_1(b) */
284 * DASD_3990_ERP_ACTION_4
287 * Setup ERP to do the ERP action 4 (see Reference manual).
288 * Set the current request to PENDING to block the CQR queue for that device
289 * until the state change interrupt appears.
290 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
294 * sense sense data of the actual error
295 * erp pointer to the current ERP
298 * erp pointer to the ERP
301 static struct dasd_ccw_req
*
302 dasd_3990_erp_action_4(struct dasd_ccw_req
* erp
, char *sense
)
305 struct dasd_device
*device
= erp
->startdev
;
307 /* first time set initial retry counter and erp_function */
308 /* and retry once without waiting for state change pending */
309 /* interrupt (this enables easier enqueing of the cqr) */
310 if (erp
->function
!= dasd_3990_erp_action_4
) {
312 DBF_DEV_EVENT(DBF_INFO
, device
, "%s",
313 "dasd_3990_erp_action_4: first time retry");
316 erp
->function
= dasd_3990_erp_action_4
;
319 if (sense
&& (sense
[25] == 0x1D)) { /* state change pending */
321 DBF_DEV_EVENT(DBF_INFO
, device
,
322 "waiting for state change pending "
323 "interrupt, %d retries left",
326 dasd_3990_erp_block_queue(erp
, 30*HZ
);
328 } else if (sense
&& (sense
[25] == 0x1E)) { /* busy */
329 DBF_DEV_EVENT(DBF_INFO
, device
,
330 "busy - redriving request later, "
333 dasd_3990_erp_block_queue(erp
, HZ
);
335 /* no state change pending - retry */
336 DBF_DEV_EVENT(DBF_INFO
, device
,
337 "redriving request immediately, "
340 erp
->status
= DASD_CQR_FILLED
;
346 } /* end dasd_3990_erp_action_4 */
349 *****************************************************************************
350 * 24 byte sense ERP functions (only)
351 *****************************************************************************
355 * DASD_3990_ERP_ACTION_5
358 * Setup ERP to do the ERP action 5 (see Reference manual).
359 * NOTE: Further handling is done in xxx_further_erp after the retries.
362 * erp pointer to the current ERP
365 * erp pointer to the ERP
368 static struct dasd_ccw_req
*
369 dasd_3990_erp_action_5(struct dasd_ccw_req
* erp
)
372 /* first of all retry */
374 erp
->function
= dasd_3990_erp_action_5
;
378 } /* end dasd_3990_erp_action_5 */
381 * DASD_3990_HANDLE_ENV_DATA
384 * Handles 24 byte 'Environmental data present'.
385 * Does a analysis of the sense data (message Format)
386 * and prints the error messages.
389 * sense current sense data
395 dasd_3990_handle_env_data(struct dasd_ccw_req
* erp
, char *sense
)
398 struct dasd_device
*device
= erp
->startdev
;
399 char msg_format
= (sense
[7] & 0xF0);
400 char msg_no
= (sense
[7] & 0x0F);
401 char errorstring
[ERRORLENGTH
];
403 switch (msg_format
) {
404 case 0x00: /* Format 0 - Program or System Checks */
406 if (sense
[1] & 0x10) { /* check message to operator bit */
409 case 0x00: /* No Message */
412 dev_warn(&device
->cdev
->dev
,
413 "FORMAT 0 - Invalid Command\n");
416 dev_warn(&device
->cdev
->dev
,
417 "FORMAT 0 - Invalid Command "
421 dev_warn(&device
->cdev
->dev
,
422 "FORMAT 0 - CCW Count less than "
426 dev_warn(&device
->cdev
->dev
,
427 "FORMAT 0 - Invalid Parameter\n");
430 dev_warn(&device
->cdev
->dev
,
431 "FORMAT 0 - Diagnostic of Special"
432 " Command Violates File Mask\n");
435 dev_warn(&device
->cdev
->dev
,
436 "FORMAT 0 - Channel Returned with "
437 "Incorrect retry CCW\n");
440 dev_warn(&device
->cdev
->dev
,
441 "FORMAT 0 - Reset Notification\n");
444 dev_warn(&device
->cdev
->dev
,
445 "FORMAT 0 - Storage Path Restart\n");
448 dev_warn(&device
->cdev
->dev
,
449 "FORMAT 0 - Channel requested "
450 "... %02x\n", sense
[8]);
453 dev_warn(&device
->cdev
->dev
,
454 "FORMAT 0 - Invalid Defective/"
455 "Alternate Track Pointer\n");
458 dev_warn(&device
->cdev
->dev
,
459 "FORMAT 0 - DPS Installation "
463 dev_warn(&device
->cdev
->dev
,
464 "FORMAT 0 - Command Invalid on "
465 "Secondary Address\n");
468 dev_warn(&device
->cdev
->dev
,
469 "FORMAT 0 - Status Not As "
470 "Required: reason %02x\n",
474 dev_warn(&device
->cdev
->dev
,
475 "FORMAT 0 - Reserved\n");
479 case 0x00: /* No Message */
482 dev_warn(&device
->cdev
->dev
,
483 "FORMAT 0 - Device Error "
487 dev_warn(&device
->cdev
->dev
,
488 "FORMAT 0 - Reserved\n");
491 dev_warn(&device
->cdev
->dev
,
492 "FORMAT 0 - Device Fenced - "
493 "device = %02x\n", sense
[4]);
496 dev_warn(&device
->cdev
->dev
,
497 "FORMAT 0 - Data Pinned for "
501 dev_warn(&device
->cdev
->dev
,
502 "FORMAT 0 - Reserved\n");
507 case 0x10: /* Format 1 - Device Equipment Checks */
509 case 0x00: /* No Message */
512 dev_warn(&device
->cdev
->dev
,
513 "FORMAT 1 - Device Status 1 not as "
517 dev_warn(&device
->cdev
->dev
,
518 "FORMAT 1 - Index missing\n");
521 dev_warn(&device
->cdev
->dev
,
522 "FORMAT 1 - Interruption cannot be "
526 dev_warn(&device
->cdev
->dev
,
527 "FORMAT 1 - Device did not respond to "
531 dev_warn(&device
->cdev
->dev
,
532 "FORMAT 1 - Device check-2 error or Set "
533 "Sector is not complete\n");
536 dev_warn(&device
->cdev
->dev
,
537 "FORMAT 1 - Head address does not "
541 dev_warn(&device
->cdev
->dev
,
542 "FORMAT 1 - Device status 1 not valid\n");
545 dev_warn(&device
->cdev
->dev
,
546 "FORMAT 1 - Device not ready\n");
549 dev_warn(&device
->cdev
->dev
,
550 "FORMAT 1 - Track physical address did "
554 dev_warn(&device
->cdev
->dev
,
555 "FORMAT 1 - Missing device address bit\n");
558 dev_warn(&device
->cdev
->dev
,
559 "FORMAT 1 - Drive motor switch is off\n");
562 dev_warn(&device
->cdev
->dev
,
563 "FORMAT 1 - Seek incomplete\n");
566 dev_warn(&device
->cdev
->dev
,
567 "FORMAT 1 - Cylinder address did not "
571 dev_warn(&device
->cdev
->dev
,
572 "FORMAT 1 - Offset active cannot be "
576 dev_warn(&device
->cdev
->dev
,
577 "FORMAT 1 - Reserved\n");
581 case 0x20: /* Format 2 - 3990 Equipment Checks */
584 dev_warn(&device
->cdev
->dev
,
585 "FORMAT 2 - 3990 check-2 error\n");
588 dev_warn(&device
->cdev
->dev
,
589 "FORMAT 2 - Support facility errors\n");
592 dev_warn(&device
->cdev
->dev
,
593 "FORMAT 2 - Microcode detected error "
598 dev_warn(&device
->cdev
->dev
,
599 "FORMAT 2 - Reserved\n");
603 case 0x30: /* Format 3 - 3990 Control Checks */
606 dev_warn(&device
->cdev
->dev
,
607 "FORMAT 3 - Allegiance terminated\n");
610 dev_warn(&device
->cdev
->dev
,
611 "FORMAT 3 - Reserved\n");
615 case 0x40: /* Format 4 - Data Checks */
618 dev_warn(&device
->cdev
->dev
,
619 "FORMAT 4 - Home address area error\n");
622 dev_warn(&device
->cdev
->dev
,
623 "FORMAT 4 - Count area error\n");
626 dev_warn(&device
->cdev
->dev
,
627 "FORMAT 4 - Key area error\n");
630 dev_warn(&device
->cdev
->dev
,
631 "FORMAT 4 - Data area error\n");
634 dev_warn(&device
->cdev
->dev
,
635 "FORMAT 4 - No sync byte in home address "
639 dev_warn(&device
->cdev
->dev
,
640 "FORMAT 4 - No sync byte in count address "
644 dev_warn(&device
->cdev
->dev
,
645 "FORMAT 4 - No sync byte in key area\n");
648 dev_warn(&device
->cdev
->dev
,
649 "FORMAT 4 - No sync byte in data area\n");
652 dev_warn(&device
->cdev
->dev
,
653 "FORMAT 4 - Home address area error; "
657 dev_warn(&device
->cdev
->dev
,
658 "FORMAT 4 - Count area error; offset "
662 dev_warn(&device
->cdev
->dev
,
663 "FORMAT 4 - Key area error; offset "
667 dev_warn(&device
->cdev
->dev
,
668 "FORMAT 4 - Data area error; "
672 dev_warn(&device
->cdev
->dev
,
673 "FORMAT 4 - No sync byte in home "
674 "address area; offset active\n");
677 dev_warn(&device
->cdev
->dev
,
678 "FORMAT 4 - No sync byte in count "
679 "address area; offset active\n");
682 dev_warn(&device
->cdev
->dev
,
683 "FORMAT 4 - No sync byte in key area; "
687 dev_warn(&device
->cdev
->dev
,
688 "FORMAT 4 - No sync byte in data area; "
692 dev_warn(&device
->cdev
->dev
,
693 "FORMAT 4 - Reserved\n");
697 case 0x50: /* Format 5 - Data Check with displacement information */
700 dev_warn(&device
->cdev
->dev
,
701 "FORMAT 5 - Data Check in the "
702 "home address area\n");
705 dev_warn(&device
->cdev
->dev
,
706 "FORMAT 5 - Data Check in the count "
710 dev_warn(&device
->cdev
->dev
,
711 "FORMAT 5 - Data Check in the key area\n");
714 dev_warn(&device
->cdev
->dev
,
715 "FORMAT 5 - Data Check in the data "
719 dev_warn(&device
->cdev
->dev
,
720 "FORMAT 5 - Data Check in the "
721 "home address area; offset active\n");
724 dev_warn(&device
->cdev
->dev
,
725 "FORMAT 5 - Data Check in the count area; "
729 dev_warn(&device
->cdev
->dev
,
730 "FORMAT 5 - Data Check in the key area; "
734 dev_warn(&device
->cdev
->dev
,
735 "FORMAT 5 - Data Check in the data area; "
739 dev_warn(&device
->cdev
->dev
,
740 "FORMAT 5 - Reserved\n");
744 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
747 dev_warn(&device
->cdev
->dev
,
748 "FORMAT 6 - Overrun on channel A\n");
751 dev_warn(&device
->cdev
->dev
,
752 "FORMAT 6 - Overrun on channel B\n");
755 dev_warn(&device
->cdev
->dev
,
756 "FORMAT 6 - Overrun on channel C\n");
759 dev_warn(&device
->cdev
->dev
,
760 "FORMAT 6 - Overrun on channel D\n");
763 dev_warn(&device
->cdev
->dev
,
764 "FORMAT 6 - Overrun on channel E\n");
767 dev_warn(&device
->cdev
->dev
,
768 "FORMAT 6 - Overrun on channel F\n");
771 dev_warn(&device
->cdev
->dev
,
772 "FORMAT 6 - Overrun on channel G\n");
775 dev_warn(&device
->cdev
->dev
,
776 "FORMAT 6 - Overrun on channel H\n");
779 dev_warn(&device
->cdev
->dev
,
780 "FORMAT 6 - Reserved\n");
784 case 0x70: /* Format 7 - Device Connection Control Checks */
787 dev_warn(&device
->cdev
->dev
,
788 "FORMAT 7 - RCC initiated by a connection "
792 dev_warn(&device
->cdev
->dev
,
793 "FORMAT 7 - RCC 1 sequence not "
797 dev_warn(&device
->cdev
->dev
,
798 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
802 dev_warn(&device
->cdev
->dev
,
803 "FORMAT 7 - Invalid tag-in during "
804 "selection sequence\n");
807 dev_warn(&device
->cdev
->dev
,
808 "FORMAT 7 - extra RCC required\n");
811 dev_warn(&device
->cdev
->dev
,
812 "FORMAT 7 - Invalid DCC selection "
813 "response or timeout\n");
816 dev_warn(&device
->cdev
->dev
,
817 "FORMAT 7 - Missing end operation; device "
818 "transfer complete\n");
821 dev_warn(&device
->cdev
->dev
,
822 "FORMAT 7 - Missing end operation; device "
823 "transfer incomplete\n");
826 dev_warn(&device
->cdev
->dev
,
827 "FORMAT 7 - Invalid tag-in for an "
828 "immediate command sequence\n");
831 dev_warn(&device
->cdev
->dev
,
832 "FORMAT 7 - Invalid tag-in for an "
833 "extended command sequence\n");
836 dev_warn(&device
->cdev
->dev
,
837 "FORMAT 7 - 3990 microcode time out when "
838 "stopping selection\n");
841 dev_warn(&device
->cdev
->dev
,
842 "FORMAT 7 - No response to selection "
843 "after a poll interruption\n");
846 dev_warn(&device
->cdev
->dev
,
847 "FORMAT 7 - Permanent path error (DASD "
848 "controller not available)\n");
851 dev_warn(&device
->cdev
->dev
,
852 "FORMAT 7 - DASD controller not available"
853 " on disconnected command chain\n");
856 dev_warn(&device
->cdev
->dev
,
857 "FORMAT 7 - Reserved\n");
861 case 0x80: /* Format 8 - Additional Device Equipment Checks */
863 case 0x00: /* No Message */
865 dev_warn(&device
->cdev
->dev
,
866 "FORMAT 8 - Error correction code "
870 dev_warn(&device
->cdev
->dev
,
871 "FORMAT 8 - Unexpected end operation "
875 dev_warn(&device
->cdev
->dev
,
876 "FORMAT 8 - End operation with transfer "
880 dev_warn(&device
->cdev
->dev
,
881 "FORMAT 8 - End operation with transfer "
885 dev_warn(&device
->cdev
->dev
,
886 "FORMAT 8 - DPS checks after a system "
887 "reset or selective reset\n");
890 dev_warn(&device
->cdev
->dev
,
891 "FORMAT 8 - DPS cannot be filled\n");
894 dev_warn(&device
->cdev
->dev
,
895 "FORMAT 8 - Short busy time-out during "
896 "device selection\n");
899 dev_warn(&device
->cdev
->dev
,
900 "FORMAT 8 - DASD controller failed to "
901 "set or reset the long busy latch\n");
904 dev_warn(&device
->cdev
->dev
,
905 "FORMAT 8 - No interruption from device "
906 "during a command chain\n");
909 dev_warn(&device
->cdev
->dev
,
910 "FORMAT 8 - Reserved\n");
914 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
917 break; /* No Message */
919 dev_warn(&device
->cdev
->dev
,
920 "FORMAT 9 - Device check-2 error\n");
923 dev_warn(&device
->cdev
->dev
,
924 "FORMAT 9 - Head address did not "
928 dev_warn(&device
->cdev
->dev
,
929 "FORMAT 9 - Track physical address did "
930 "not compare while oriented\n");
933 dev_warn(&device
->cdev
->dev
,
934 "FORMAT 9 - Cylinder address did not "
938 dev_warn(&device
->cdev
->dev
,
939 "FORMAT 9 - Reserved\n");
943 case 0xF0: /* Format F - Cache Storage Checks */
946 dev_warn(&device
->cdev
->dev
,
947 "FORMAT F - Operation Terminated\n");
950 dev_warn(&device
->cdev
->dev
,
951 "FORMAT F - Subsystem Processing Error\n");
954 dev_warn(&device
->cdev
->dev
,
955 "FORMAT F - Cache or nonvolatile storage "
956 "equipment failure\n");
959 dev_warn(&device
->cdev
->dev
,
960 "FORMAT F - Caching terminated\n");
963 dev_warn(&device
->cdev
->dev
,
964 "FORMAT F - Cache fast write access not "
968 dev_warn(&device
->cdev
->dev
,
969 "FORMAT F - Track format incorrect\n");
972 dev_warn(&device
->cdev
->dev
,
973 "FORMAT F - Caching reinitiated\n");
976 dev_warn(&device
->cdev
->dev
,
977 "FORMAT F - Nonvolatile storage "
981 dev_warn(&device
->cdev
->dev
,
982 "FORMAT F - Volume is suspended duplex\n");
983 /* call extended error reporting (EER) */
984 dasd_eer_write(device
, erp
->refers
,
985 DASD_EER_PPRCSUSPEND
);
988 dev_warn(&device
->cdev
->dev
,
989 "FORMAT F - Subsystem status cannot be "
993 dev_warn(&device
->cdev
->dev
,
994 "FORMAT F - Caching status reset to "
998 dev_warn(&device
->cdev
->dev
,
999 "FORMAT F - DASD Fast Write inhibited\n");
1002 dev_warn(&device
->cdev
->dev
,
1003 "FORMAT F - Reserved\n");
1007 default: /* unknown message format - should not happen
1008 internal error 03 - unknown message format */
1009 snprintf(errorstring
, ERRORLENGTH
, "03 %x02", msg_format
);
1010 dev_err(&device
->cdev
->dev
,
1011 "An error occurred in the DASD device driver, "
1012 "reason=%s\n", errorstring
);
1014 } /* end switch message format */
1016 } /* end dasd_3990_handle_env_data */
1019 * DASD_3990_ERP_COM_REJ
1022 * Handles 24 byte 'Command Reject' error.
1025 * erp current erp_head
1026 * sense current sense data
1029 * erp 'new' erp_head - pointer to new ERP
1031 static struct dasd_ccw_req
*
1032 dasd_3990_erp_com_rej(struct dasd_ccw_req
* erp
, char *sense
)
1035 struct dasd_device
*device
= erp
->startdev
;
1037 erp
->function
= dasd_3990_erp_com_rej
;
1039 /* env data present (ACTION 10 - retry should work) */
1040 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1042 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1043 "Command Reject - environmental data present");
1045 dasd_3990_handle_env_data(erp
, sense
);
1049 } else if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1050 dev_err(&device
->cdev
->dev
, "An I/O request was rejected"
1051 " because writing is inhibited\n");
1052 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1054 /* fatal error - set status to FAILED
1055 internal error 09 - Command Reject */
1056 if (!test_bit(DASD_CQR_SUPPRESS_CR
, &erp
->flags
))
1057 dev_err(&device
->cdev
->dev
,
1058 "An error occurred in the DASD device driver, reason=09\n");
1060 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1065 } /* end dasd_3990_erp_com_rej */
1068 * DASD_3990_ERP_BUS_OUT
1071 * Handles 24 byte 'Bus Out Parity Check' error.
1074 * erp current erp_head
1076 * erp new erp_head - pointer to new ERP
1078 static struct dasd_ccw_req
*
1079 dasd_3990_erp_bus_out(struct dasd_ccw_req
* erp
)
1082 struct dasd_device
*device
= erp
->startdev
;
1084 /* first time set initial retry counter and erp_function */
1085 /* and retry once without blocking queue */
1086 /* (this enables easier enqueing of the cqr) */
1087 if (erp
->function
!= dasd_3990_erp_bus_out
) {
1089 erp
->function
= dasd_3990_erp_bus_out
;
1093 /* issue a message and wait for 'device ready' interrupt */
1094 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1095 "bus out parity error or BOPC requested by "
1098 dasd_3990_erp_block_queue(erp
, 60*HZ
);
1104 } /* end dasd_3990_erp_bus_out */
1107 * DASD_3990_ERP_EQUIP_CHECK
1110 * Handles 24 byte 'Equipment Check' error.
1113 * erp current erp_head
1115 * erp new erp_head - pointer to new ERP
1117 static struct dasd_ccw_req
*
1118 dasd_3990_erp_equip_check(struct dasd_ccw_req
* erp
, char *sense
)
1121 struct dasd_device
*device
= erp
->startdev
;
1123 erp
->function
= dasd_3990_erp_equip_check
;
1125 if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1126 dev_info(&device
->cdev
->dev
,
1127 "Write inhibited path encountered\n");
1129 /* vary path offline
1130 internal error 04 - Path should be varied off-line.*/
1131 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1132 "device driver, reason=%s\n", "04");
1134 erp
= dasd_3990_erp_action_1(erp
);
1136 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1138 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1139 "Equipment Check - " "environmental data present");
1141 dasd_3990_handle_env_data(erp
, sense
);
1143 erp
= dasd_3990_erp_action_4(erp
, sense
);
1145 } else if (sense
[1] & SNS1_PERM_ERR
) {
1147 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1148 "Equipment Check - retry exhausted or "
1151 erp
= dasd_3990_erp_action_1(erp
);
1154 /* all other equipment checks - Action 5 */
1155 /* rest is done when retries == 0 */
1156 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1157 "Equipment check or processing error");
1159 erp
= dasd_3990_erp_action_5(erp
);
1163 } /* end dasd_3990_erp_equip_check */
1166 * DASD_3990_ERP_DATA_CHECK
1169 * Handles 24 byte 'Data Check' error.
1172 * erp current erp_head
1174 * erp new erp_head - pointer to new ERP
1176 static struct dasd_ccw_req
*
1177 dasd_3990_erp_data_check(struct dasd_ccw_req
* erp
, char *sense
)
1180 struct dasd_device
*device
= erp
->startdev
;
1182 erp
->function
= dasd_3990_erp_data_check
;
1184 if (sense
[2] & SNS2_CORRECTABLE
) { /* correctable data check */
1186 /* issue message that the data has been corrected */
1187 dev_emerg(&device
->cdev
->dev
,
1188 "Data recovered during retry with PCI "
1189 "fetch mode active\n");
1191 /* not possible to handle this situation in Linux */
1192 panic("No way to inform application about the possibly "
1195 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1197 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1198 "Uncorrectable data check recovered secondary "
1199 "addr of duplex pair");
1201 erp
= dasd_3990_erp_action_4(erp
, sense
);
1203 } else if (sense
[1] & SNS1_PERM_ERR
) {
1205 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1206 "Uncorrectable data check with internal "
1209 erp
= dasd_3990_erp_action_1(erp
);
1212 /* all other data checks */
1213 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1214 "Uncorrectable data check with retry count "
1217 erp
= dasd_3990_erp_action_5(erp
);
1222 } /* end dasd_3990_erp_data_check */
1225 * DASD_3990_ERP_OVERRUN
1228 * Handles 24 byte 'Overrun' 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_overrun(struct dasd_ccw_req
* erp
, char *sense
)
1239 struct dasd_device
*device
= erp
->startdev
;
1241 erp
->function
= dasd_3990_erp_overrun
;
1243 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1244 "Overrun - service overrun or overrun"
1245 " error requested by channel");
1247 erp
= dasd_3990_erp_action_5(erp
);
1251 } /* end dasd_3990_erp_overrun */
1254 * DASD_3990_ERP_INV_FORMAT
1257 * Handles 24 byte 'Invalid Track Format' error.
1260 * erp current erp_head
1262 * erp new erp_head - pointer to new ERP
1264 static struct dasd_ccw_req
*
1265 dasd_3990_erp_inv_format(struct dasd_ccw_req
* erp
, char *sense
)
1268 struct dasd_device
*device
= erp
->startdev
;
1270 erp
->function
= dasd_3990_erp_inv_format
;
1272 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1274 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1275 "Track format error when destaging or "
1278 dasd_3990_handle_env_data(erp
, sense
);
1280 erp
= dasd_3990_erp_action_4(erp
, sense
);
1283 /* internal error 06 - The track format is not valid*/
1284 dev_err(&device
->cdev
->dev
,
1285 "An error occurred in the DASD device driver, "
1286 "reason=%s\n", "06");
1288 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1293 } /* end dasd_3990_erp_inv_format */
1299 * Handles 24 byte 'End-of-Cylinder' error.
1302 * erp already added default erp
1304 * erp pointer to original (failed) cqr.
1306 static struct dasd_ccw_req
*
1307 dasd_3990_erp_EOC(struct dasd_ccw_req
* default_erp
, char *sense
)
1310 struct dasd_device
*device
= default_erp
->startdev
;
1312 dev_err(&device
->cdev
->dev
,
1313 "The cylinder data for accessing the DASD is inconsistent\n");
1315 /* implement action 7 - BUG */
1316 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1318 } /* end dasd_3990_erp_EOC */
1321 * DASD_3990_ERP_ENV_DATA
1324 * Handles 24 byte 'Environmental-Data Present' error.
1327 * erp current erp_head
1329 * erp new erp_head - pointer to new ERP
1331 static struct dasd_ccw_req
*
1332 dasd_3990_erp_env_data(struct dasd_ccw_req
* erp
, char *sense
)
1335 struct dasd_device
*device
= erp
->startdev
;
1337 erp
->function
= dasd_3990_erp_env_data
;
1339 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s", "Environmental data present");
1341 dasd_3990_handle_env_data(erp
, sense
);
1343 /* don't retry on disabled interface */
1344 if (sense
[7] != 0x0F) {
1345 erp
= dasd_3990_erp_action_4(erp
, sense
);
1347 erp
->status
= DASD_CQR_FILLED
;
1352 } /* end dasd_3990_erp_env_data */
1355 * DASD_3990_ERP_NO_REC
1358 * Handles 24 byte 'No Record Found' error.
1361 * erp already added default ERP
1364 * erp new erp_head - pointer to new ERP
1366 static struct dasd_ccw_req
*
1367 dasd_3990_erp_no_rec(struct dasd_ccw_req
* default_erp
, char *sense
)
1370 struct dasd_device
*device
= default_erp
->startdev
;
1373 * In some cases the 'No Record Found' error might be expected and
1374 * log messages shouldn't be written then.
1375 * Check if the according suppress bit is set.
1377 if (!test_bit(DASD_CQR_SUPPRESS_NRF
, &default_erp
->flags
))
1378 dev_err(&device
->cdev
->dev
,
1379 "The specified record was not found\n");
1381 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1383 } /* end dasd_3990_erp_no_rec */
1386 * DASD_3990_ERP_FILE_PROT
1389 * Handles 24 byte 'File Protected' error.
1390 * Note: Seek related recovery is not implemented because
1391 * wee don't use the seek command yet.
1394 * erp current erp_head
1396 * erp new erp_head - pointer to new ERP
1398 static struct dasd_ccw_req
*
1399 dasd_3990_erp_file_prot(struct dasd_ccw_req
* erp
)
1402 struct dasd_device
*device
= erp
->startdev
;
1405 * In some cases the 'File Protected' error might be expected and
1406 * log messages shouldn't be written then.
1407 * Check if the according suppress bit is set.
1409 if (!test_bit(DASD_CQR_SUPPRESS_FP
, &erp
->flags
))
1410 dev_err(&device
->cdev
->dev
,
1411 "Accessing the DASD failed because of a hardware error\n");
1413 return dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1415 } /* end dasd_3990_erp_file_prot */
1418 * DASD_3990_ERP_INSPECT_ALIAS
1421 * Checks if the original request was started on an alias device.
1422 * If yes, it modifies the original and the erp request so that
1423 * the erp request can be started on a base device.
1426 * erp pointer to the currently created default ERP
1429 * erp pointer to the modified ERP, or NULL
1432 static struct dasd_ccw_req
*dasd_3990_erp_inspect_alias(
1433 struct dasd_ccw_req
*erp
)
1435 struct dasd_ccw_req
*cqr
= erp
->refers
;
1439 (cqr
->block
->base
!= cqr
->startdev
)) {
1441 sense
= dasd_get_sense(&erp
->refers
->irb
);
1443 * dynamic pav may have changed base alias mapping
1445 if (!test_bit(DASD_FLAG_OFFLINE
, &cqr
->startdev
->flags
) && sense
1446 && (sense
[0] == 0x10) && (sense
[7] == 0x0F)
1447 && (sense
[8] == 0x67)) {
1449 * remove device from alias handling to prevent new
1450 * requests from being scheduled on the
1451 * wrong alias device
1453 dasd_alias_remove_device(cqr
->startdev
);
1455 /* schedule worker to reload device */
1456 dasd_reload_device(cqr
->startdev
);
1459 if (cqr
->startdev
->features
& DASD_FEATURE_ERPLOG
) {
1460 DBF_DEV_EVENT(DBF_ERR
, cqr
->startdev
,
1461 "ERP on alias device for request %p,"
1462 " recover on base device %s", cqr
,
1463 dev_name(&cqr
->block
->base
->cdev
->dev
));
1465 dasd_eckd_reset_ccw_to_base_io(cqr
);
1466 erp
->startdev
= cqr
->block
->base
;
1467 erp
->function
= dasd_3990_erp_inspect_alias
;
1475 * DASD_3990_ERP_INSPECT_24
1478 * Does a detailed inspection of the 24 byte sense data
1479 * and sets up a related error recovery action.
1482 * sense sense data of the actual error
1483 * erp pointer to the currently created default ERP
1486 * erp pointer to the (addtitional) ERP
1488 static struct dasd_ccw_req
*
1489 dasd_3990_erp_inspect_24(struct dasd_ccw_req
* erp
, char *sense
)
1492 struct dasd_ccw_req
*erp_filled
= NULL
;
1494 /* Check sense for .... */
1495 /* 'Command Reject' */
1496 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_CMD_REJECT
)) {
1497 erp_filled
= dasd_3990_erp_com_rej(erp
, sense
);
1499 /* 'Intervention Required' */
1500 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_INTERVENTION_REQ
)) {
1501 erp_filled
= dasd_3990_erp_int_req(erp
);
1503 /* 'Bus Out Parity Check' */
1504 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_BUS_OUT_CHECK
)) {
1505 erp_filled
= dasd_3990_erp_bus_out(erp
);
1507 /* 'Equipment Check' */
1508 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_EQUIPMENT_CHECK
)) {
1509 erp_filled
= dasd_3990_erp_equip_check(erp
, sense
);
1512 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_DATA_CHECK
)) {
1513 erp_filled
= dasd_3990_erp_data_check(erp
, sense
);
1516 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_OVERRUN
)) {
1517 erp_filled
= dasd_3990_erp_overrun(erp
, sense
);
1519 /* 'Invalid Track Format' */
1520 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_INV_TRACK_FORMAT
)) {
1521 erp_filled
= dasd_3990_erp_inv_format(erp
, sense
);
1523 /* 'End-of-Cylinder' */
1524 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_EOC
)) {
1525 erp_filled
= dasd_3990_erp_EOC(erp
, sense
);
1527 /* 'Environmental Data' */
1528 if ((erp_filled
== NULL
) && (sense
[2] & SNS2_ENV_DATA_PRESENT
)) {
1529 erp_filled
= dasd_3990_erp_env_data(erp
, sense
);
1531 /* 'No Record Found' */
1532 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_NO_REC_FOUND
)) {
1533 erp_filled
= dasd_3990_erp_no_rec(erp
, sense
);
1535 /* 'File Protected' */
1536 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_FILE_PROTECTED
)) {
1537 erp_filled
= dasd_3990_erp_file_prot(erp
);
1539 /* other (unknown) error - do default ERP */
1540 if (erp_filled
== NULL
) {
1547 } /* END dasd_3990_erp_inspect_24 */
1550 *****************************************************************************
1551 * 32 byte sense ERP functions (only)
1552 *****************************************************************************
1556 * DASD_3990_ERPACTION_10_32
1559 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1560 * Just retry and if retry doesn't work, return with error.
1563 * erp current erp_head
1564 * sense current sense data
1566 * erp modified erp_head
1568 static struct dasd_ccw_req
*
1569 dasd_3990_erp_action_10_32(struct dasd_ccw_req
* erp
, char *sense
)
1572 struct dasd_device
*device
= erp
->startdev
;
1575 erp
->function
= dasd_3990_erp_action_10_32
;
1577 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s", "Perform logging requested");
1581 } /* end dasd_3990_erp_action_10_32 */
1584 * DASD_3990_ERP_ACTION_1B_32
1587 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
1588 * A write operation could not be finished because of an unexpected
1590 * The already created 'default erp' is used to get the link to
1591 * the erp chain, but it can not be used for this recovery
1592 * action because it contains no DE/LO data space.
1595 * default_erp already added default erp.
1596 * sense current sense data
1600 * default_erp in case of imprecise ending or error
1602 static struct dasd_ccw_req
*
1603 dasd_3990_erp_action_1B_32(struct dasd_ccw_req
* default_erp
, char *sense
)
1606 struct dasd_device
*device
= default_erp
->startdev
;
1608 struct dasd_ccw_req
*cqr
;
1609 struct dasd_ccw_req
*erp
;
1610 struct DE_eckd_data
*DE_data
;
1611 struct PFX_eckd_data
*PFX_data
;
1612 char *LO_data
; /* LO_eckd_data_t */
1613 struct ccw1
*ccw
, *oldccw
;
1615 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1616 "Write not finished because of unexpected condition");
1618 default_erp
->function
= dasd_3990_erp_action_1B_32
;
1620 /* determine the original cqr */
1623 while (cqr
->refers
!= NULL
) {
1627 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1628 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1629 "32 bit sense, action 1B is not defined"
1630 " in transport mode - just retry");
1634 /* for imprecise ending just do default erp */
1635 if (sense
[1] & 0x01) {
1636 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1637 "Imprecise ending is set - just retry");
1642 /* determine the address of the CCW to be restarted */
1643 /* Imprecise ending is not set -> addr from IRB-SCSW */
1644 cpa
= default_erp
->refers
->irb
.scsw
.cmd
.cpa
;
1647 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1648 "Unable to determine address of the CCW "
1651 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1654 /* Build new ERP request including DE/LO */
1655 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
1656 2 + 1,/* DE/LO + TIC */
1657 sizeof(struct DE_eckd_data
) +
1658 sizeof(struct LO_eckd_data
), device
);
1661 /* internal error 01 - Unable to allocate ERP */
1662 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1663 "device driver, reason=%s\n", "01");
1664 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1667 /* use original DE */
1668 DE_data
= erp
->data
;
1669 oldccw
= cqr
->cpaddr
;
1670 if (oldccw
->cmd_code
== DASD_ECKD_CCW_PFX
) {
1671 PFX_data
= cqr
->data
;
1672 memcpy(DE_data
, &PFX_data
->define_extent
,
1673 sizeof(struct DE_eckd_data
));
1675 memcpy(DE_data
, cqr
->data
, sizeof(struct DE_eckd_data
));
1678 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1680 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1682 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1685 if ((sense
[7] & 0x3F) == 0x01) {
1686 /* operation code is WRITE DATA -> data area orientation */
1689 } else if ((sense
[7] & 0x3F) == 0x03) {
1690 /* operation code is FORMAT WRITE -> index orientation */
1694 LO_data
[0] = sense
[7]; /* operation */
1697 LO_data
[1] = sense
[8]; /* auxiliary */
1698 LO_data
[2] = sense
[9];
1699 LO_data
[3] = sense
[3]; /* count */
1700 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1701 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1702 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1704 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1708 memset(ccw
, 0, sizeof(struct ccw1
));
1709 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
1710 ccw
->flags
= CCW_FLAG_CC
;
1712 ccw
->cda
= (__u32
)(addr_t
) DE_data
;
1716 memset(ccw
, 0, sizeof(struct ccw1
));
1717 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
1718 ccw
->flags
= CCW_FLAG_CC
;
1720 ccw
->cda
= (__u32
)(addr_t
) LO_data
;
1722 /* TIC to the failed ccw */
1724 ccw
->cmd_code
= CCW_CMD_TIC
;
1727 /* fill erp related fields */
1728 erp
->flags
= default_erp
->flags
;
1729 erp
->function
= dasd_3990_erp_action_1B_32
;
1730 erp
->refers
= default_erp
->refers
;
1731 erp
->startdev
= device
;
1732 erp
->memdev
= device
;
1733 erp
->magic
= default_erp
->magic
;
1734 erp
->expires
= default_erp
->expires
;
1736 erp
->buildclk
= get_tod_clock();
1737 erp
->status
= DASD_CQR_FILLED
;
1739 /* remove the default erp */
1740 dasd_free_erp_request(default_erp
, device
);
1744 } /* end dasd_3990_erp_action_1B_32 */
1747 * DASD_3990_UPDATE_1B
1750 * Handles the update to the 32 byte 'Action 1B' of Single Program
1751 * Action Codes in case the first action was not successful.
1752 * The already created 'previous_erp' is the currently not successful
1756 * previous_erp already created previous erp.
1757 * sense current sense data
1761 static struct dasd_ccw_req
*
1762 dasd_3990_update_1B(struct dasd_ccw_req
* previous_erp
, char *sense
)
1765 struct dasd_device
*device
= previous_erp
->startdev
;
1767 struct dasd_ccw_req
*cqr
;
1768 struct dasd_ccw_req
*erp
;
1769 char *LO_data
; /* struct LO_eckd_data */
1772 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1773 "Write not finished because of unexpected condition"
1776 /* determine the original cqr */
1779 while (cqr
->refers
!= NULL
) {
1783 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1784 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1785 "32 bit sense, action 1B, update,"
1786 " in transport mode - just retry");
1787 return previous_erp
;
1790 /* for imprecise ending just do default erp */
1791 if (sense
[1] & 0x01) {
1792 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1793 "Imprecise ending is set - just retry");
1795 previous_erp
->status
= DASD_CQR_FILLED
;
1797 return previous_erp
;
1800 /* determine the address of the CCW to be restarted */
1801 /* Imprecise ending is not set -> addr from IRB-SCSW */
1802 cpa
= previous_erp
->irb
.scsw
.cmd
.cpa
;
1805 /* internal error 02 -
1806 Unable to determine address of the CCW to be restarted */
1807 dev_err(&device
->cdev
->dev
, "An error occurred in the DASD "
1808 "device driver, reason=%s\n", "02");
1810 previous_erp
->status
= DASD_CQR_FAILED
;
1812 return previous_erp
;
1817 /* update the LO with the new returned sense data */
1818 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1820 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1821 /* should not happen */
1822 previous_erp
->status
= DASD_CQR_FAILED
;
1824 return previous_erp
;
1827 if ((sense
[7] & 0x3F) == 0x01) {
1828 /* operation code is WRITE DATA -> data area orientation */
1831 } else if ((sense
[7] & 0x3F) == 0x03) {
1832 /* operation code is FORMAT WRITE -> index orientation */
1836 LO_data
[0] = sense
[7]; /* operation */
1839 LO_data
[1] = sense
[8]; /* auxiliary */
1840 LO_data
[2] = sense
[9];
1841 LO_data
[3] = sense
[3]; /* count */
1842 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1843 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1844 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1846 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1848 /* TIC to the failed ccw */
1849 ccw
= erp
->cpaddr
; /* addr of DE ccw */
1850 ccw
++; /* addr of LE ccw */
1851 ccw
++; /* addr of TIC ccw */
1854 erp
->status
= DASD_CQR_FILLED
;
1858 } /* end dasd_3990_update_1B */
1861 * DASD_3990_ERP_COMPOUND_RETRY
1864 * Handles the compound ERP action retry code.
1865 * NOTE: At least one retry is done even if zero is specified
1866 * by the sense data. This makes enqueueing of the request
1870 * sense sense data of the actual error
1871 * erp pointer to the currently created ERP
1874 * erp modified ERP pointer
1878 dasd_3990_erp_compound_retry(struct dasd_ccw_req
* erp
, char *sense
)
1881 switch (sense
[25] & 0x03) {
1882 case 0x00: /* no not retry */
1886 case 0x01: /* retry 2 times */
1890 case 0x02: /* retry 10 times */
1894 case 0x03: /* retry 256 times */
1902 erp
->function
= dasd_3990_erp_compound_retry
;
1904 } /* end dasd_3990_erp_compound_retry */
1907 * DASD_3990_ERP_COMPOUND_PATH
1910 * Handles the compound ERP action for retry on alternate
1914 * sense sense data of the actual error
1915 * erp pointer to the currently created ERP
1918 * erp modified ERP pointer
1922 dasd_3990_erp_compound_path(struct dasd_ccw_req
* erp
, char *sense
)
1924 if (sense
[25] & DASD_SENSE_BIT_3
) {
1925 dasd_3990_erp_alternate_path(erp
);
1927 if (erp
->status
== DASD_CQR_FAILED
&&
1928 !test_bit(DASD_CQR_VERIFY_PATH
, &erp
->flags
)) {
1929 /* reset the lpm and the status to be able to
1930 * try further actions. */
1931 erp
->lpm
= dasd_path_get_opm(erp
->startdev
);
1932 erp
->status
= DASD_CQR_NEED_ERP
;
1936 erp
->function
= dasd_3990_erp_compound_path
;
1938 } /* end dasd_3990_erp_compound_path */
1941 * DASD_3990_ERP_COMPOUND_CODE
1944 * Handles the compound ERP action for retry code.
1947 * sense sense data of the actual error
1948 * erp pointer to the currently created ERP
1951 * erp NEW ERP pointer
1954 static struct dasd_ccw_req
*
1955 dasd_3990_erp_compound_code(struct dasd_ccw_req
* erp
, char *sense
)
1958 if (sense
[25] & DASD_SENSE_BIT_2
) {
1960 switch (sense
[28]) {
1962 /* issue a Diagnostic Control command with an
1963 * Inhibit Write subcommand and controller modifier */
1964 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
1968 /* wait for 5 seconds and retry again */
1971 dasd_3990_erp_block_queue (erp
, 5*HZ
);
1975 /* should not happen - continue */
1980 erp
->function
= dasd_3990_erp_compound_code
;
1984 } /* end dasd_3990_erp_compound_code */
1987 * DASD_3990_ERP_COMPOUND_CONFIG
1990 * Handles the compound ERP action for configruation
1992 * Note: duplex handling is not implemented (yet).
1995 * sense sense data of the actual error
1996 * erp pointer to the currently created ERP
1999 * erp modified ERP pointer
2003 dasd_3990_erp_compound_config(struct dasd_ccw_req
* erp
, char *sense
)
2006 if ((sense
[25] & DASD_SENSE_BIT_1
) && (sense
[26] & DASD_SENSE_BIT_2
)) {
2008 /* set to suspended duplex state then restart
2009 internal error 05 - Set device to suspended duplex state
2011 struct dasd_device
*device
= erp
->startdev
;
2012 dev_err(&device
->cdev
->dev
,
2013 "An error occurred in the DASD device driver, "
2014 "reason=%s\n", "05");
2018 erp
->function
= dasd_3990_erp_compound_config
;
2020 } /* end dasd_3990_erp_compound_config */
2023 * DASD_3990_ERP_COMPOUND
2026 * Does the further compound program action if
2027 * compound retry was not successful.
2030 * sense sense data of the actual error
2031 * erp pointer to the current (failed) ERP
2034 * erp (additional) ERP pointer
2037 static struct dasd_ccw_req
*
2038 dasd_3990_erp_compound(struct dasd_ccw_req
* erp
, char *sense
)
2041 if ((erp
->function
== dasd_3990_erp_compound_retry
) &&
2042 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2044 dasd_3990_erp_compound_path(erp
, sense
);
2047 if ((erp
->function
== dasd_3990_erp_compound_path
) &&
2048 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2050 erp
= dasd_3990_erp_compound_code(erp
, sense
);
2053 if ((erp
->function
== dasd_3990_erp_compound_code
) &&
2054 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2056 dasd_3990_erp_compound_config(erp
, sense
);
2059 /* if no compound action ERP specified, the request failed */
2060 if (erp
->status
== DASD_CQR_NEED_ERP
)
2061 erp
->status
= DASD_CQR_FAILED
;
2065 } /* end dasd_3990_erp_compound */
2068 *DASD_3990_ERP_HANDLE_SIM
2071 * inspects the SIM SENSE data and starts an appropriate action
2074 * sense sense data of the actual error
2080 dasd_3990_erp_handle_sim(struct dasd_device
*device
, char *sense
)
2082 /* print message according to log or message to operator mode */
2083 if ((sense
[24] & DASD_SIM_MSG_TO_OP
) || (sense
[1] & 0x10)) {
2084 /* print SIM SRC from RefCode */
2085 dev_err(&device
->cdev
->dev
, "SIM - SRC: "
2086 "%02x%02x%02x%02x\n", sense
[22],
2087 sense
[23], sense
[11], sense
[12]);
2088 } else if (sense
[24] & DASD_SIM_LOG
) {
2089 /* print SIM SRC Refcode */
2090 dev_warn(&device
->cdev
->dev
, "log SIM - SRC: "
2091 "%02x%02x%02x%02x\n", sense
[22],
2092 sense
[23], sense
[11], sense
[12]);
2097 * DASD_3990_ERP_INSPECT_32
2100 * Does a detailed inspection of the 32 byte sense data
2101 * and sets up a related error recovery action.
2104 * sense sense data of the actual error
2105 * erp pointer to the currently created default ERP
2108 * erp_filled pointer to the ERP
2111 static struct dasd_ccw_req
*
2112 dasd_3990_erp_inspect_32(struct dasd_ccw_req
* erp
, char *sense
)
2115 struct dasd_device
*device
= erp
->startdev
;
2117 erp
->function
= dasd_3990_erp_inspect_32
;
2119 /* check for SIM sense data */
2120 if ((sense
[6] & DASD_SIM_SENSE
) == DASD_SIM_SENSE
)
2121 dasd_3990_erp_handle_sim(device
, sense
);
2123 if (sense
[25] & DASD_SENSE_BIT_0
) {
2125 /* compound program action codes (byte25 bit 0 == '1') */
2126 dasd_3990_erp_compound_retry(erp
, sense
);
2130 /* single program action codes (byte25 bit 0 == '0') */
2131 switch (sense
[25]) {
2133 case 0x00: /* success - use default ERP for retries */
2134 DBF_DEV_EVENT(DBF_DEBUG
, device
, "%s",
2135 "ERP called for successful request"
2139 case 0x01: /* fatal error */
2140 dev_err(&device
->cdev
->dev
,
2141 "ERP failed for the DASD\n");
2143 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2146 case 0x02: /* intervention required */
2147 case 0x03: /* intervention required during dual copy */
2148 erp
= dasd_3990_erp_int_req(erp
);
2151 case 0x0F: /* length mismatch during update write command
2152 internal error 08 - update write command error*/
2153 dev_err(&device
->cdev
->dev
, "An error occurred in the "
2154 "DASD device driver, reason=%s\n", "08");
2156 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2159 case 0x10: /* logging required for other channel program */
2160 erp
= dasd_3990_erp_action_10_32(erp
, sense
);
2163 case 0x15: /* next track outside defined extend
2164 internal error 07 - The next track is not
2165 within the defined storage extent */
2166 dev_err(&device
->cdev
->dev
,
2167 "An error occurred in the DASD device driver, "
2168 "reason=%s\n", "07");
2170 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2173 case 0x1B: /* unexpected condition during write */
2175 erp
= dasd_3990_erp_action_1B_32(erp
, sense
);
2178 case 0x1C: /* invalid data */
2179 dev_emerg(&device
->cdev
->dev
,
2180 "Data recovered during retry with PCI "
2181 "fetch mode active\n");
2183 /* not possible to handle this situation in Linux */
2185 ("Invalid data - No way to inform application "
2186 "about the possibly incorrect data");
2189 case 0x1D: /* state-change pending */
2190 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2191 "A State change pending condition exists "
2192 "for the subsystem or device");
2194 erp
= dasd_3990_erp_action_4(erp
, sense
);
2197 case 0x1E: /* busy */
2198 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2199 "Busy condition exists "
2200 "for the subsystem or device");
2201 erp
= dasd_3990_erp_action_4(erp
, sense
);
2204 default: /* all others errors - default erp */
2211 } /* end dasd_3990_erp_inspect_32 */
2213 static void dasd_3990_erp_disable_path(struct dasd_device
*device
, __u8 lpum
)
2215 int pos
= pathmask_to_pos(lpum
);
2217 if (!(device
->features
& DASD_FEATURE_PATH_AUTODISABLE
)) {
2218 dev_err(&device
->cdev
->dev
,
2219 "Path %x.%02x (pathmask %02x) is operational despite excessive IFCCs\n",
2220 device
->path
[pos
].cssid
, device
->path
[pos
].chpid
, lpum
);
2224 /* no remaining path, cannot disable */
2225 if (!(dasd_path_get_opm(device
) & ~lpum
)) {
2226 dev_err(&device
->cdev
->dev
,
2227 "Last path %x.%02x (pathmask %02x) is operational despite excessive IFCCs\n",
2228 device
->path
[pos
].cssid
, device
->path
[pos
].chpid
, lpum
);
2232 dev_err(&device
->cdev
->dev
,
2233 "Path %x.%02x (pathmask %02x) is disabled - IFCC threshold exceeded\n",
2234 device
->path
[pos
].cssid
, device
->path
[pos
].chpid
, lpum
);
2235 dasd_path_remove_opm(device
, lpum
);
2236 dasd_path_add_ifccpm(device
, lpum
);
2239 device
->path
[pos
].errorclk
= 0;
2240 atomic_set(&device
->path
[pos
].error_count
, 0);
2243 static void dasd_3990_erp_account_error(struct dasd_ccw_req
*erp
)
2245 struct dasd_device
*device
= erp
->startdev
;
2246 __u8 lpum
= erp
->refers
->irb
.esw
.esw1
.lpum
;
2247 int pos
= pathmask_to_pos(lpum
);
2250 if (!device
->path_thrhld
)
2253 clk
= get_tod_clock();
2255 * check if the last error is longer ago than the timeout,
2256 * if so reset error state
2258 if ((tod_to_ns(clk
- device
->path
[pos
].errorclk
) / NSEC_PER_SEC
)
2259 >= device
->path_interval
) {
2260 atomic_set(&device
->path
[pos
].error_count
, 0);
2261 device
->path
[pos
].errorclk
= 0;
2263 atomic_inc(&device
->path
[pos
].error_count
);
2264 device
->path
[pos
].errorclk
= clk
;
2265 /* threshold exceeded disable path if possible */
2266 if (atomic_read(&device
->path
[pos
].error_count
) >=
2267 device
->path_thrhld
)
2268 dasd_3990_erp_disable_path(device
, lpum
);
2272 *****************************************************************************
2273 * main ERP control functions (24 and 32 byte sense)
2274 *****************************************************************************
2278 * DASD_3990_ERP_CONTROL_CHECK
2281 * Does a generic inspection if a control check occurred and sets up
2282 * the related error recovery procedure
2285 * erp pointer to the currently created default ERP
2288 * erp_filled pointer to the erp
2291 static struct dasd_ccw_req
*
2292 dasd_3990_erp_control_check(struct dasd_ccw_req
*erp
)
2294 struct dasd_device
*device
= erp
->startdev
;
2296 if (scsw_cstat(&erp
->refers
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
2297 | SCHN_STAT_CHN_CTRL_CHK
)) {
2298 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2299 "channel or interface control check");
2300 dasd_3990_erp_account_error(erp
);
2301 erp
= dasd_3990_erp_action_4(erp
, NULL
);
2307 * DASD_3990_ERP_INSPECT
2310 * Does a detailed inspection for sense data by calling either
2311 * the 24-byte or the 32-byte inspection routine.
2314 * erp pointer to the currently created default ERP
2316 * erp_new contens was possibly modified
2318 static struct dasd_ccw_req
*
2319 dasd_3990_erp_inspect(struct dasd_ccw_req
*erp
)
2322 struct dasd_ccw_req
*erp_new
= NULL
;
2325 /* if this problem occurred on an alias retry on base */
2326 erp_new
= dasd_3990_erp_inspect_alias(erp
);
2330 /* sense data are located in the refers record of the
2331 * already set up new ERP !
2332 * check if concurrent sens is available
2334 sense
= dasd_get_sense(&erp
->refers
->irb
);
2336 erp_new
= dasd_3990_erp_control_check(erp
);
2337 /* distinguish between 24 and 32 byte sense data */
2338 else if (sense
[27] & DASD_SENSE_BIT_0
) {
2340 /* inspect the 24 byte sense data */
2341 erp_new
= dasd_3990_erp_inspect_24(erp
, sense
);
2345 /* inspect the 32 byte sense data */
2346 erp_new
= dasd_3990_erp_inspect_32(erp
, sense
);
2348 } /* end distinguish between 24 and 32 byte sense data */
2354 * DASD_3990_ERP_ADD_ERP
2357 * This function adds an additional request block (ERP) to the head of
2358 * the given cqr (or erp).
2359 * For a command mode cqr the erp is initialized as an default erp
2361 * For transport mode we make a copy of the original TCW (points to
2362 * the original TCCB, TIDALs, etc.) but give it a fresh
2363 * TSB so the original sense data will not be changed.
2366 * cqr head of the current ERP-chain (or single cqr if
2369 * erp pointer to new ERP-chain head
2371 static struct dasd_ccw_req
*dasd_3990_erp_add_erp(struct dasd_ccw_req
*cqr
)
2374 struct dasd_device
*device
= cqr
->startdev
;
2376 struct dasd_ccw_req
*erp
;
2377 int cplength
, datasize
;
2381 if (cqr
->cpmode
== 1) {
2383 /* TCW needs to be 64 byte aligned, so leave enough room */
2384 datasize
= 64 + sizeof(struct tcw
) + sizeof(struct tsb
);
2390 /* allocate additional request block */
2391 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
2392 cplength
, datasize
, device
);
2394 if (cqr
->retries
<= 0) {
2395 DBF_DEV_EVENT(DBF_ERR
, device
, "%s",
2396 "Unable to allocate ERP request");
2397 cqr
->status
= DASD_CQR_FAILED
;
2398 cqr
->stopclk
= get_tod_clock();
2400 DBF_DEV_EVENT(DBF_ERR
, device
,
2401 "Unable to allocate ERP request "
2402 "(%i retries left)",
2404 dasd_block_set_timer(device
->block
, (HZ
<< 3));
2410 if (cqr
->cpmode
== 1) {
2411 /* make a shallow copy of the original tcw but set new tsb */
2413 erp
->cpaddr
= PTR_ALIGN(erp
->data
, 64);
2415 tsb
= (struct tsb
*) &tcw
[1];
2416 *tcw
= *((struct tcw
*)cqr
->cpaddr
);
2417 tcw
->tsb
= (long)tsb
;
2418 } else if (ccw
->cmd_code
== DASD_ECKD_CCW_PSF
) {
2419 /* PSF cannot be chained from NOOP/TIC */
2420 erp
->cpaddr
= cqr
->cpaddr
;
2422 /* initialize request with default TIC to current ERP/CQR */
2424 ccw
->cmd_code
= CCW_CMD_NOOP
;
2425 ccw
->flags
= CCW_FLAG_CC
;
2427 ccw
->cmd_code
= CCW_CMD_TIC
;
2428 ccw
->cda
= (long)(cqr
->cpaddr
);
2431 erp
->flags
= cqr
->flags
;
2432 erp
->function
= dasd_3990_erp_add_erp
;
2434 erp
->startdev
= device
;
2435 erp
->memdev
= device
;
2436 erp
->block
= cqr
->block
;
2437 erp
->magic
= cqr
->magic
;
2438 erp
->expires
= cqr
->expires
;
2440 erp
->buildclk
= get_tod_clock();
2441 erp
->status
= DASD_CQR_FILLED
;
2447 * DASD_3990_ERP_ADDITIONAL_ERP
2450 * An additional ERP is needed to handle the current error.
2451 * Add ERP to the head of the ERP-chain containing the ERP processing
2452 * determined based on the sense data.
2455 * cqr head of the current ERP-chain (or single cqr if
2459 * erp pointer to new ERP-chain head
2461 static struct dasd_ccw_req
*
2462 dasd_3990_erp_additional_erp(struct dasd_ccw_req
* cqr
)
2465 struct dasd_ccw_req
*erp
= NULL
;
2467 /* add erp and initialize with default TIC */
2468 erp
= dasd_3990_erp_add_erp(cqr
);
2473 /* inspect sense, determine specific ERP if possible */
2476 erp
= dasd_3990_erp_inspect(erp
);
2481 } /* end dasd_3990_erp_additional_erp */
2484 * DASD_3990_ERP_ERROR_MATCH
2487 * Check if the device status of the given cqr is the same.
2488 * This means that the failed CCW and the relevant sense data
2490 * I don't distinguish between 24 and 32 byte sense because in case of
2491 * 24 byte sense byte 25 and 27 is set as well.
2494 * cqr1 first cqr, which will be compared with the
2498 * match 'boolean' for match found
2499 * returns 1 if match found, otherwise 0.
2501 static int dasd_3990_erp_error_match(struct dasd_ccw_req
*cqr1
,
2502 struct dasd_ccw_req
*cqr2
)
2504 char *sense1
, *sense2
;
2506 if (cqr1
->startdev
!= cqr2
->startdev
)
2509 sense1
= dasd_get_sense(&cqr1
->irb
);
2510 sense2
= dasd_get_sense(&cqr2
->irb
);
2512 /* one request has sense data, the other not -> no match, return 0 */
2513 if (!sense1
!= !sense2
)
2515 /* no sense data in both cases -> check cstat for IFCC */
2516 if (!sense1
&& !sense2
) {
2517 if ((scsw_cstat(&cqr1
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2518 SCHN_STAT_CHN_CTRL_CHK
)) ==
2519 (scsw_cstat(&cqr2
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2520 SCHN_STAT_CHN_CTRL_CHK
)))
2521 return 1; /* match with ifcc*/
2523 /* check sense data; byte 0-2,25,27 */
2524 if (!(sense1
&& sense2
&&
2525 (memcmp(sense1
, sense2
, 3) == 0) &&
2526 (sense1
[27] == sense2
[27]) &&
2527 (sense1
[25] == sense2
[25]))) {
2529 return 0; /* sense doesn't match */
2532 return 1; /* match */
2534 } /* end dasd_3990_erp_error_match */
2537 * DASD_3990_ERP_IN_ERP
2540 * check if the current error already happened before.
2541 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2544 * cqr failed cqr (either original cqr or already an erp)
2547 * erp erp-pointer to the already defined error
2548 * recovery procedure OR
2549 * NULL if a 'new' error occurred.
2551 static struct dasd_ccw_req
*
2552 dasd_3990_erp_in_erp(struct dasd_ccw_req
*cqr
)
2555 struct dasd_ccw_req
*erp_head
= cqr
, /* save erp chain head */
2556 *erp_match
= NULL
; /* save erp chain head */
2557 int match
= 0; /* 'boolean' for matching error found */
2559 if (cqr
->refers
== NULL
) { /* return if not in erp */
2563 /* check the erp/cqr chain for current error */
2565 match
= dasd_3990_erp_error_match(erp_head
, cqr
->refers
);
2566 erp_match
= cqr
; /* save possible matching erp */
2567 cqr
= cqr
->refers
; /* check next erp/cqr in queue */
2569 } while ((cqr
->refers
!= NULL
) && (!match
));
2572 return NULL
; /* no match was found */
2575 return erp_match
; /* return address of matching erp */
2577 } /* END dasd_3990_erp_in_erp */
2580 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2583 * No retry is left for the current ERP. Check what has to be done
2585 * - do further defined ERP action or
2586 * - wait for interrupt or
2587 * - exit with permanent error
2590 * erp ERP which is in progress with no retry left
2593 * erp modified/additional ERP
2595 static struct dasd_ccw_req
*
2596 dasd_3990_erp_further_erp(struct dasd_ccw_req
*erp
)
2599 struct dasd_device
*device
= erp
->startdev
;
2600 char *sense
= dasd_get_sense(&erp
->irb
);
2602 /* check for 24 byte sense ERP */
2603 if ((erp
->function
== dasd_3990_erp_bus_out
) ||
2604 (erp
->function
== dasd_3990_erp_action_1
) ||
2605 (erp
->function
== dasd_3990_erp_action_4
)) {
2607 erp
= dasd_3990_erp_action_1(erp
);
2609 } else if (erp
->function
== dasd_3990_erp_action_1_sec
) {
2610 erp
= dasd_3990_erp_action_1_sec(erp
);
2611 } else if (erp
->function
== dasd_3990_erp_action_5
) {
2613 /* retries have not been successful */
2614 /* prepare erp for retry on different channel path */
2615 erp
= dasd_3990_erp_action_1(erp
);
2617 if (sense
&& !(sense
[2] & DASD_SENSE_BIT_0
)) {
2619 /* issue a Diagnostic Control command with an
2620 * Inhibit Write subcommand */
2622 switch (sense
[25]) {
2624 case 0x57:{ /* controller */
2625 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2629 case 0x58:{ /* channel path */
2630 erp
= dasd_3990_erp_DCTL(erp
, 0x40);
2634 case 0x59:{ /* storage director */
2635 erp
= dasd_3990_erp_DCTL(erp
, 0x80);
2639 DBF_DEV_EVENT(DBF_WARNING
, device
,
2640 "invalid subcommand modifier 0x%x "
2641 "for Diagnostic Control Command",
2646 /* check for 32 byte sense ERP */
2648 ((erp
->function
== dasd_3990_erp_compound_retry
) ||
2649 (erp
->function
== dasd_3990_erp_compound_path
) ||
2650 (erp
->function
== dasd_3990_erp_compound_code
) ||
2651 (erp
->function
== dasd_3990_erp_compound_config
))) {
2653 erp
= dasd_3990_erp_compound(erp
, sense
);
2657 * No retry left and no additional special handling
2660 dev_err(&device
->cdev
->dev
,
2661 "ERP %p has run out of retries and failed\n", erp
);
2663 erp
->status
= DASD_CQR_FAILED
;
2668 } /* end dasd_3990_erp_further_erp */
2671 * DASD_3990_ERP_HANDLE_MATCH_ERP
2674 * An error occurred again and an ERP has been detected which is already
2675 * used to handle this error (e.g. retries).
2676 * All prior ERP's are asumed to be successful and therefore removed
2678 * If retry counter of matching erp is already 0, it is checked if further
2679 * action is needed (besides retry) or if the ERP has failed.
2682 * erp_head first ERP in ERP-chain
2683 * erp ERP that handles the actual error.
2687 * erp modified/additional ERP
2689 static struct dasd_ccw_req
*
2690 dasd_3990_erp_handle_match_erp(struct dasd_ccw_req
*erp_head
,
2691 struct dasd_ccw_req
*erp
)
2694 struct dasd_device
*device
= erp_head
->startdev
;
2695 struct dasd_ccw_req
*erp_done
= erp_head
; /* finished req */
2696 struct dasd_ccw_req
*erp_free
= NULL
; /* req to be freed */
2698 /* loop over successful ERPs and remove them from chanq */
2699 while (erp_done
!= erp
) {
2701 if (erp_done
== NULL
) /* end of chain reached */
2702 panic(PRINTK_HEADER
"Programming error in ERP! The "
2703 "original request was lost\n");
2705 /* remove the request from the device queue */
2706 list_del(&erp_done
->blocklist
);
2708 erp_free
= erp_done
;
2709 erp_done
= erp_done
->refers
;
2711 /* free the finished erp request */
2712 dasd_free_erp_request(erp_free
, erp_free
->memdev
);
2716 if (erp
->retries
> 0) {
2718 char *sense
= dasd_get_sense(&erp
->refers
->irb
);
2720 /* check for special retries */
2721 if (sense
&& erp
->function
== dasd_3990_erp_action_4
) {
2723 erp
= dasd_3990_erp_action_4(erp
, sense
);
2726 erp
->function
== dasd_3990_erp_action_1B_32
) {
2728 erp
= dasd_3990_update_1B(erp
, sense
);
2730 } else if (sense
&& erp
->function
== dasd_3990_erp_int_req
) {
2732 erp
= dasd_3990_erp_int_req(erp
);
2736 DBF_DEV_EVENT(DBF_DEBUG
, device
,
2737 "%i retries left for erp %p",
2740 /* handle the request again... */
2741 erp
->status
= DASD_CQR_FILLED
;
2745 /* no retry left - check for further necessary action */
2746 /* if no further actions, handle rest as permanent error */
2747 erp
= dasd_3990_erp_further_erp(erp
);
2752 } /* end dasd_3990_erp_handle_match_erp */
2755 * DASD_3990_ERP_ACTION
2758 * control routine for 3990 erp actions.
2759 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2762 * cqr failed cqr (either original cqr or already an erp)
2765 * erp erp-pointer to the head of the ERP action chain.
2767 * - either a ptr to an additional ERP cqr or
2768 * - the original given cqr (which's status might
2771 struct dasd_ccw_req
*
2772 dasd_3990_erp_action(struct dasd_ccw_req
* cqr
)
2774 struct dasd_ccw_req
*erp
= NULL
;
2775 struct dasd_device
*device
= cqr
->startdev
;
2776 struct dasd_ccw_req
*temp_erp
= NULL
;
2778 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2779 /* print current erp_chain */
2780 dev_err(&device
->cdev
->dev
,
2781 "ERP chain at BEGINNING of ERP-ACTION\n");
2782 for (temp_erp
= cqr
;
2783 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2785 dev_err(&device
->cdev
->dev
,
2786 "ERP %p (%02x) refers to %p\n",
2787 temp_erp
, temp_erp
->status
,
2792 /* double-check if current erp/cqr was successful */
2793 if ((scsw_cstat(&cqr
->irb
.scsw
) == 0x00) &&
2794 (scsw_dstat(&cqr
->irb
.scsw
) ==
2795 (DEV_STAT_CHN_END
| DEV_STAT_DEV_END
))) {
2797 DBF_DEV_EVENT(DBF_DEBUG
, device
,
2798 "ERP called for successful request %p"
2799 " - NO ERP necessary", cqr
);
2801 cqr
->status
= DASD_CQR_DONE
;
2806 /* check if error happened before */
2807 erp
= dasd_3990_erp_in_erp(cqr
);
2810 /* no matching erp found - set up erp */
2811 erp
= dasd_3990_erp_additional_erp(cqr
);
2815 /* matching erp found - set all leading erp's to DONE */
2816 erp
= dasd_3990_erp_handle_match_erp(cqr
, erp
);
2821 * For path verification work we need to stick with the path that was
2822 * originally chosen so that the per path configuration data is
2823 * assigned correctly.
2825 if (test_bit(DASD_CQR_VERIFY_PATH
, &erp
->flags
) && cqr
->lpm
) {
2826 erp
->lpm
= cqr
->lpm
;
2829 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2830 /* print current erp_chain */
2831 dev_err(&device
->cdev
->dev
,
2832 "ERP chain at END of ERP-ACTION\n");
2833 for (temp_erp
= erp
;
2834 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2836 dev_err(&device
->cdev
->dev
,
2837 "ERP %p (%02x) refers to %p\n",
2838 temp_erp
, temp_erp
->status
,
2843 /* enqueue ERP request if it's a new one */
2844 if (list_empty(&erp
->blocklist
)) {
2845 cqr
->status
= DASD_CQR_IN_ERP
;
2846 /* add erp request before the cqr */
2847 list_add_tail(&erp
->blocklist
, &cqr
->blocklist
);
2854 } /* end dasd_3990_erp_action */