2 * File...........: linux/drivers/s390/block/dasd_3990_erp.c
3 * Author(s)......: Horst Hummel <Horst.Hummel@de.ibm.com>
4 * Holger Smolinski <Holger.Smolinski@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
10 #include <linux/timer.h>
11 #include <linux/slab.h>
12 #include <asm/idals.h>
13 #include <asm/todclk.h>
15 #define PRINTK_HEADER "dasd_erp(3990): "
18 #include "dasd_eckd.h"
22 unsigned char subcommand
; /* e.g Inhibit Write, Enable Write,... */
23 unsigned char modifier
; /* Subcommand modifier */
24 unsigned short res
; /* reserved */
25 } __attribute__ ((packed
));
28 *****************************************************************************
29 * SECTION ERP 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.
72 dasd_3990_erp_block_queue(struct dasd_ccw_req
* erp
, int expires
)
75 struct dasd_device
*device
= erp
->startdev
;
78 DEV_MESSAGE(KERN_INFO
, device
,
79 "blocking request queue for %is", expires
/HZ
);
81 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
82 device
->stopped
|= DASD_STOPPED_PENDING
;
83 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
84 erp
->status
= DASD_CQR_FILLED
;
85 dasd_block_set_timer(device
->block
, expires
);
89 * DASD_3990_ERP_INT_REQ
92 * Handles 'Intervention Required' error.
93 * This means either device offline or not installed.
100 static struct dasd_ccw_req
*
101 dasd_3990_erp_int_req(struct dasd_ccw_req
* erp
)
104 struct dasd_device
*device
= erp
->startdev
;
106 /* first time set initial retry counter and erp_function */
107 /* and retry once without blocking queue */
108 /* (this enables easier enqueing of the cqr) */
109 if (erp
->function
!= dasd_3990_erp_int_req
) {
112 erp
->function
= dasd_3990_erp_int_req
;
116 /* issue a message and wait for 'device ready' interrupt */
117 DEV_MESSAGE(KERN_ERR
, device
, "%s",
118 "is offline or not installed - "
119 "INTERVENTION REQUIRED!!");
121 dasd_3990_erp_block_queue(erp
, 60*HZ
);
126 } /* end dasd_3990_erp_int_req */
129 * DASD_3990_ERP_ALTERNATE_PATH
132 * Repeat the operation on a different channel path.
133 * If all alternate paths have been tried, the request is posted with a
137 * erp pointer to the current ERP
140 * erp modified pointer to the ERP
143 dasd_3990_erp_alternate_path(struct dasd_ccw_req
* erp
)
145 struct dasd_device
*device
= erp
->startdev
;
149 /* try alternate valid path */
150 spin_lock_irqsave(get_ccwdev_lock(device
->cdev
), flags
);
151 opm
= ccw_device_get_path_mask(device
->cdev
);
152 spin_unlock_irqrestore(get_ccwdev_lock(device
->cdev
), flags
);
153 //FIXME: start with get_opm ?
155 erp
->lpm
= LPM_ANYPATH
& ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
157 erp
->lpm
&= ~(erp
->irb
.esw
.esw0
.sublog
.lpum
);
159 if ((erp
->lpm
& opm
) != 0x00) {
161 DEV_MESSAGE(KERN_DEBUG
, device
,
162 "try alternate lpm=%x (lpum=%x / opm=%x)",
163 erp
->lpm
, erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
165 /* reset status to submit the request again... */
166 erp
->status
= DASD_CQR_FILLED
;
169 DEV_MESSAGE(KERN_ERR
, device
,
170 "No alternate channel path left (lpum=%x / "
171 "opm=%x) -> permanent error",
172 erp
->irb
.esw
.esw0
.sublog
.lpum
, opm
);
174 /* post request with permanent error */
175 erp
->status
= DASD_CQR_FAILED
;
177 } /* end dasd_3990_erp_alternate_path */
183 * Setup cqr to do the Diagnostic Control (DCTL) command with an
184 * Inhibit Write subcommand (0x20) and the given modifier.
187 * erp pointer to the current (failed) ERP
188 * modifier subcommand modifier
191 * dctl_cqr pointer to NEW dctl_cqr
194 static struct dasd_ccw_req
*
195 dasd_3990_erp_DCTL(struct dasd_ccw_req
* erp
, char modifier
)
198 struct dasd_device
*device
= erp
->startdev
;
199 struct DCTL_data
*DCTL_data
;
201 struct dasd_ccw_req
*dctl_cqr
;
203 dctl_cqr
= dasd_alloc_erp_request((char *) &erp
->magic
, 1,
204 sizeof(struct DCTL_data
),
206 if (IS_ERR(dctl_cqr
)) {
207 DEV_MESSAGE(KERN_ERR
, device
, "%s",
208 "Unable to allocate DCTL-CQR");
209 erp
->status
= DASD_CQR_FAILED
;
213 DCTL_data
= dctl_cqr
->data
;
215 DCTL_data
->subcommand
= 0x02; /* Inhibit Write */
216 DCTL_data
->modifier
= modifier
;
218 ccw
= dctl_cqr
->cpaddr
;
219 memset(ccw
, 0, sizeof(struct ccw1
));
220 ccw
->cmd_code
= CCW_CMD_DCTL
;
222 ccw
->cda
= (__u32
)(addr_t
) DCTL_data
;
223 dctl_cqr
->function
= dasd_3990_erp_DCTL
;
224 dctl_cqr
->refers
= erp
;
225 dctl_cqr
->startdev
= device
;
226 dctl_cqr
->memdev
= device
;
227 dctl_cqr
->magic
= erp
->magic
;
228 dctl_cqr
->expires
= 5 * 60 * HZ
;
229 dctl_cqr
->retries
= 2;
231 dctl_cqr
->buildclk
= get_clock();
233 dctl_cqr
->status
= DASD_CQR_FILLED
;
237 } /* end dasd_3990_erp_DCTL */
240 * DASD_3990_ERP_ACTION_1
243 * Setup ERP to do the ERP action 1 (see Reference manual).
244 * Repeat the operation on a different channel path.
245 * If all alternate paths have been tried, the request is posted with a
247 * Note: duplex handling is not implemented (yet).
250 * erp pointer to the current ERP
253 * erp pointer to the ERP
256 static struct dasd_ccw_req
*
257 dasd_3990_erp_action_1(struct dasd_ccw_req
* erp
)
260 erp
->function
= dasd_3990_erp_action_1
;
262 dasd_3990_erp_alternate_path(erp
);
266 } /* end dasd_3990_erp_action_1 */
269 * DASD_3990_ERP_ACTION_4
272 * Setup ERP to do the ERP action 4 (see Reference manual).
273 * Set the current request to PENDING to block the CQR queue for that device
274 * until the state change interrupt appears.
275 * Use a timer (20 seconds) to retry the cqr if the interrupt is still
279 * sense sense data of the actual error
280 * erp pointer to the current ERP
283 * erp pointer to the ERP
286 static struct dasd_ccw_req
*
287 dasd_3990_erp_action_4(struct dasd_ccw_req
* erp
, char *sense
)
290 struct dasd_device
*device
= erp
->startdev
;
292 /* first time set initial retry counter and erp_function */
293 /* and retry once without waiting for state change pending */
294 /* interrupt (this enables easier enqueing of the cqr) */
295 if (erp
->function
!= dasd_3990_erp_action_4
) {
297 DEV_MESSAGE(KERN_INFO
, device
, "%s",
298 "dasd_3990_erp_action_4: first time retry");
301 erp
->function
= dasd_3990_erp_action_4
;
304 if (sense
&& (sense
[25] == 0x1D)) { /* state change pending */
306 DEV_MESSAGE(KERN_INFO
, device
,
307 "waiting for state change pending "
308 "interrupt, %d retries left",
311 dasd_3990_erp_block_queue(erp
, 30*HZ
);
313 } else if (sense
&& (sense
[25] == 0x1E)) { /* busy */
314 DEV_MESSAGE(KERN_INFO
, device
,
315 "busy - redriving request later, "
318 dasd_3990_erp_block_queue(erp
, HZ
);
321 /* no state change pending - retry */
322 DEV_MESSAGE (KERN_INFO
, device
,
323 "redriving request immediately, "
326 erp
->status
= DASD_CQR_FILLED
;
332 } /* end dasd_3990_erp_action_4 */
335 *****************************************************************************
336 * 24 byte sense ERP functions (only)
337 *****************************************************************************
341 * DASD_3990_ERP_ACTION_5
344 * Setup ERP to do the ERP action 5 (see Reference manual).
345 * NOTE: Further handling is done in xxx_further_erp after the retries.
348 * erp pointer to the current ERP
351 * erp pointer to the ERP
354 static struct dasd_ccw_req
*
355 dasd_3990_erp_action_5(struct dasd_ccw_req
* erp
)
358 /* first of all retry */
360 erp
->function
= dasd_3990_erp_action_5
;
364 } /* end dasd_3990_erp_action_5 */
367 * DASD_3990_HANDLE_ENV_DATA
370 * Handles 24 byte 'Environmental data present'.
371 * Does a analysis of the sense data (message Format)
372 * and prints the error messages.
375 * sense current sense data
381 dasd_3990_handle_env_data(struct dasd_ccw_req
* erp
, char *sense
)
384 struct dasd_device
*device
= erp
->startdev
;
385 char msg_format
= (sense
[7] & 0xF0);
386 char msg_no
= (sense
[7] & 0x0F);
388 switch (msg_format
) {
389 case 0x00: /* Format 0 - Program or System Checks */
391 if (sense
[1] & 0x10) { /* check message to operator bit */
394 case 0x00: /* No Message */
397 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
398 "FORMAT 0 - Invalid Command");
401 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
402 "FORMAT 0 - Invalid Command "
406 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
407 "FORMAT 0 - CCW Count less than "
411 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
412 "FORMAT 0 - Invalid Parameter");
415 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
416 "FORMAT 0 - Diagnostic of Sepecial"
417 " Command Violates File Mask");
420 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
421 "FORMAT 0 - Channel Returned with "
422 "Incorrect retry CCW");
425 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
426 "FORMAT 0 - Reset Notification");
429 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
430 "FORMAT 0 - Storage Path Restart");
433 DEV_MESSAGE(KERN_WARNING
, device
,
434 "FORMAT 0 - Channel requested "
435 "... %02x", sense
[8]);
438 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
439 "FORMAT 0 - Invalid Defective/"
440 "Alternate Track Pointer");
443 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
444 "FORMAT 0 - DPS Installation "
448 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
449 "FORMAT 0 - Command Invalid on "
450 "Secondary Address");
453 DEV_MESSAGE(KERN_WARNING
, device
,
454 "FORMAT 0 - Status Not As "
455 "Required: reason %02x", sense
[8]);
458 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
459 "FORMAT 0 - Reseved");
463 case 0x00: /* No Message */
466 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
467 "FORMAT 0 - Device Error Source");
470 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
471 "FORMAT 0 - Reserved");
474 DEV_MESSAGE(KERN_WARNING
, device
,
475 "FORMAT 0 - Device Fenced - "
476 "device = %02x", sense
[4]);
479 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
480 "FORMAT 0 - Data Pinned for "
484 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
485 "FORMAT 0 - Reserved");
490 case 0x10: /* Format 1 - Device Equipment Checks */
492 case 0x00: /* No Message */
495 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
496 "FORMAT 1 - Device Status 1 not as "
500 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
501 "FORMAT 1 - Index missing");
504 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
505 "FORMAT 1 - Interruption cannot be reset");
508 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
509 "FORMAT 1 - Device did not respond to "
513 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
514 "FORMAT 1 - Device check-2 error or Set "
515 "Sector is not complete");
518 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
519 "FORMAT 1 - Head address does not "
523 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
524 "FORMAT 1 - Device status 1 not valid");
527 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
528 "FORMAT 1 - Device not ready");
531 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
532 "FORMAT 1 - Track physical address did "
536 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
537 "FORMAT 1 - Missing device address bit");
540 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
541 "FORMAT 1 - Drive motor switch is off");
544 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
545 "FORMAT 1 - Seek incomplete");
548 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
549 "FORMAT 1 - Cylinder address did not "
553 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
554 "FORMAT 1 - Offset active cannot be "
558 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
559 "FORMAT 1 - Reserved");
563 case 0x20: /* Format 2 - 3990 Equipment Checks */
566 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
567 "FORMAT 2 - 3990 check-2 error");
570 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
571 "FORMAT 2 - Support facility errors");
574 DEV_MESSAGE(KERN_WARNING
, device
,
575 "FORMAT 2 - Microcode detected error %02x",
579 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
580 "FORMAT 2 - Reserved");
584 case 0x30: /* Format 3 - 3990 Control Checks */
587 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
588 "FORMAT 3 - Allegiance terminated");
591 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
592 "FORMAT 3 - Reserved");
596 case 0x40: /* Format 4 - Data Checks */
599 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
600 "FORMAT 4 - Home address area error");
603 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
604 "FORMAT 4 - Count area error");
607 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
608 "FORMAT 4 - Key area error");
611 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
612 "FORMAT 4 - Data area error");
615 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
616 "FORMAT 4 - No sync byte in home address "
620 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
621 "FORMAT 4 - No sync byte in count address "
625 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
626 "FORMAT 4 - No sync byte in key area");
629 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
630 "FORMAT 4 - No sync byte in data area");
633 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
634 "FORMAT 4 - Home address area error; "
638 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
639 "FORMAT 4 - Count area error; offset "
643 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
644 "FORMAT 4 - Key area error; offset "
648 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
649 "FORMAT 4 - Data area error; "
653 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
654 "FORMAT 4 - No sync byte in home "
655 "address area; offset active");
658 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
659 "FORMAT 4 - No syn byte in count "
660 "address area; offset active");
663 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
664 "FORMAT 4 - No sync byte in key area; "
668 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
669 "FORMAT 4 - No syn byte in data area; "
673 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
674 "FORMAT 4 - Reserved");
678 case 0x50: /* Format 5 - Data Check with displacement information */
681 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
682 "FORMAT 5 - Data Check in the "
683 "home address area");
686 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
687 "FORMAT 5 - Data Check in the count area");
690 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
691 "FORMAT 5 - Data Check in the key area");
694 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
695 "FORMAT 5 - Data Check in the data area");
698 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
699 "FORMAT 5 - Data Check in the "
700 "home address area; offset active");
703 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
704 "FORMAT 5 - Data Check in the count area; "
708 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
709 "FORMAT 5 - Data Check in the key area; "
713 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
714 "FORMAT 5 - Data Check in the data area; "
718 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
719 "FORMAT 5 - Reserved");
723 case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */
726 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
727 "FORMAT 6 - Overrun on channel A");
730 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
731 "FORMAT 6 - Overrun on channel B");
734 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
735 "FORMAT 6 - Overrun on channel C");
738 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
739 "FORMAT 6 - Overrun on channel D");
742 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
743 "FORMAT 6 - Overrun on channel E");
746 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
747 "FORMAT 6 - Overrun on channel F");
750 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
751 "FORMAT 6 - Overrun on channel G");
754 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
755 "FORMAT 6 - Overrun on channel H");
758 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
759 "FORMAT 6 - Reserved");
763 case 0x70: /* Format 7 - Device Connection Control Checks */
766 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
767 "FORMAT 7 - RCC initiated by a connection "
771 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
772 "FORMAT 7 - RCC 1 sequence not "
776 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
777 "FORMAT 7 - RCC 1 and RCC 2 sequences not "
781 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
782 "FORMAT 7 - Invalid tag-in during "
783 "selection sequence");
786 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
787 "FORMAT 7 - extra RCC required");
790 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
791 "FORMAT 7 - Invalid DCC selection "
792 "response or timeout");
795 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
796 "FORMAT 7 - Missing end operation; device "
797 "transfer complete");
800 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
801 "FORMAT 7 - Missing end operation; device "
802 "transfer incomplete");
805 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
806 "FORMAT 7 - Invalid tag-in for an "
807 "immediate command sequence");
810 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
811 "FORMAT 7 - Invalid tag-in for an "
812 "extended command sequence");
815 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
816 "FORMAT 7 - 3990 microcode time out when "
817 "stopping selection");
820 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
821 "FORMAT 7 - No response to selection "
822 "after a poll interruption");
825 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
826 "FORMAT 7 - Permanent path error (DASD "
827 "controller not available)");
830 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
831 "FORMAT 7 - DASD controller not available"
832 " on disconnected command chain");
835 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
836 "FORMAT 7 - Reserved");
840 case 0x80: /* Format 8 - Additional Device Equipment Checks */
842 case 0x00: /* No Message */
844 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
845 "FORMAT 8 - Error correction code "
849 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
850 "FORMAT 8 - Unexpected end operation "
854 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
855 "FORMAT 8 - End operation with transfer "
859 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
860 "FORMAT 8 - End operation with transfer "
864 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
865 "FORMAT 8 - DPS checks after a system "
866 "reset or selective reset");
869 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
870 "FORMAT 8 - DPS cannot be filled");
873 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
874 "FORMAT 8 - Short busy time-out during "
878 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
879 "FORMAT 8 - DASD controller failed to "
880 "set or reset the long busy latch");
883 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
884 "FORMAT 8 - No interruption from device "
885 "during a command chain");
888 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
889 "FORMAT 8 - Reserved");
893 case 0x90: /* Format 9 - Device Read, Write, and Seek Checks */
896 break; /* No Message */
898 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
899 "FORMAT 9 - Device check-2 error");
902 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
903 "FORMAT 9 - Head address did not compare");
906 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
907 "FORMAT 9 - Track physical address did "
908 "not compare while oriented");
911 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
912 "FORMAT 9 - Cylinder address did not "
916 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
917 "FORMAT 9 - Reserved");
921 case 0xF0: /* Format F - Cache Storage Checks */
924 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
925 "FORMAT F - Operation Terminated");
928 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
929 "FORMAT F - Subsystem Processing Error");
932 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
933 "FORMAT F - Cache or nonvolatile storage "
934 "equipment failure");
937 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
938 "FORMAT F - Caching terminated");
941 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
942 "FORMAT F - Cache fast write access not "
946 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
947 "FORMAT F - Track format incorrect");
950 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
951 "FORMAT F - Caching reinitiated");
954 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
955 "FORMAT F - Nonvolatile storage "
959 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
960 "FORMAT F - Volume is suspended duplex");
961 /* call extended error reporting (EER) */
962 dasd_eer_write(device
, erp
->refers
,
963 DASD_EER_PPRCSUSPEND
);
966 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
967 "FORMAT F - Subsystem status connot be "
971 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
972 "FORMAT F - Caching status reset to "
976 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
977 "FORMAT F - DASD Fast Write inhibited");
980 DEV_MESSAGE(KERN_WARNING
, device
, "%s",
981 "FORMAT D - Reserved");
985 default: /* unknown message format - should not happen */
986 DEV_MESSAGE (KERN_WARNING
, device
,
987 "unknown message format %02x",
990 } /* end switch message format */
992 } /* end dasd_3990_handle_env_data */
995 * DASD_3990_ERP_COM_REJ
998 * Handles 24 byte 'Command Reject' error.
1001 * erp current erp_head
1002 * sense current sense data
1005 * erp 'new' erp_head - pointer to new ERP
1007 static struct dasd_ccw_req
*
1008 dasd_3990_erp_com_rej(struct dasd_ccw_req
* erp
, char *sense
)
1011 struct dasd_device
*device
= erp
->startdev
;
1013 erp
->function
= dasd_3990_erp_com_rej
;
1015 /* env data present (ACTION 10 - retry should work) */
1016 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1018 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1019 "Command Reject - environmental data present");
1021 dasd_3990_handle_env_data(erp
, sense
);
1026 /* fatal error - set status to FAILED */
1027 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1028 "Command Reject - Fatal error");
1030 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1035 } /* end dasd_3990_erp_com_rej */
1038 * DASD_3990_ERP_BUS_OUT
1041 * Handles 24 byte 'Bus Out Parity Check' error.
1044 * erp current erp_head
1046 * erp new erp_head - pointer to new ERP
1048 static struct dasd_ccw_req
*
1049 dasd_3990_erp_bus_out(struct dasd_ccw_req
* erp
)
1052 struct dasd_device
*device
= erp
->startdev
;
1054 /* first time set initial retry counter and erp_function */
1055 /* and retry once without blocking queue */
1056 /* (this enables easier enqueing of the cqr) */
1057 if (erp
->function
!= dasd_3990_erp_bus_out
) {
1059 erp
->function
= dasd_3990_erp_bus_out
;
1063 /* issue a message and wait for 'device ready' interrupt */
1064 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1065 "bus out parity error or BOPC requested by "
1068 dasd_3990_erp_block_queue(erp
, 60*HZ
);
1074 } /* end dasd_3990_erp_bus_out */
1077 * DASD_3990_ERP_EQUIP_CHECK
1080 * Handles 24 byte 'Equipment Check' error.
1083 * erp current erp_head
1085 * erp new erp_head - pointer to new ERP
1087 static struct dasd_ccw_req
*
1088 dasd_3990_erp_equip_check(struct dasd_ccw_req
* erp
, char *sense
)
1091 struct dasd_device
*device
= erp
->startdev
;
1093 erp
->function
= dasd_3990_erp_equip_check
;
1095 if (sense
[1] & SNS1_WRITE_INHIBITED
) {
1097 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1098 "Write inhibited path encountered");
1100 /* vary path offline */
1101 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1102 "Path should be varied off-line. "
1103 "This is not implemented yet \n - please report "
1104 "to linux390@de.ibm.com");
1106 erp
= dasd_3990_erp_action_1(erp
);
1108 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1110 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1111 "Equipment Check - " "environmental data present");
1113 dasd_3990_handle_env_data(erp
, sense
);
1115 erp
= dasd_3990_erp_action_4(erp
, sense
);
1117 } else if (sense
[1] & SNS1_PERM_ERR
) {
1119 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1120 "Equipment Check - retry exhausted or "
1123 erp
= dasd_3990_erp_action_1(erp
);
1126 /* all other equipment checks - Action 5 */
1127 /* rest is done when retries == 0 */
1128 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1129 "Equipment check or processing error");
1131 erp
= dasd_3990_erp_action_5(erp
);
1135 } /* end dasd_3990_erp_equip_check */
1138 * DASD_3990_ERP_DATA_CHECK
1141 * Handles 24 byte 'Data Check' error.
1144 * erp current erp_head
1146 * erp new erp_head - pointer to new ERP
1148 static struct dasd_ccw_req
*
1149 dasd_3990_erp_data_check(struct dasd_ccw_req
* erp
, char *sense
)
1152 struct dasd_device
*device
= erp
->startdev
;
1154 erp
->function
= dasd_3990_erp_data_check
;
1156 if (sense
[2] & SNS2_CORRECTABLE
) { /* correctable data check */
1158 /* issue message that the data has been corrected */
1159 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
1160 "Data recovered during retry with PCI "
1161 "fetch mode active");
1163 /* not possible to handle this situation in Linux */
1164 panic("No way to inform application about the possibly "
1167 } else if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1169 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1170 "Uncorrectable data check recovered secondary "
1171 "addr of duplex pair");
1173 erp
= dasd_3990_erp_action_4(erp
, sense
);
1175 } else if (sense
[1] & SNS1_PERM_ERR
) {
1177 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1178 "Uncorrectable data check with internal "
1181 erp
= dasd_3990_erp_action_1(erp
);
1184 /* all other data checks */
1185 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1186 "Uncorrectable data check with retry count "
1189 erp
= dasd_3990_erp_action_5(erp
);
1194 } /* end dasd_3990_erp_data_check */
1197 * DASD_3990_ERP_OVERRUN
1200 * Handles 24 byte 'Overrun' error.
1203 * erp current erp_head
1205 * erp new erp_head - pointer to new ERP
1207 static struct dasd_ccw_req
*
1208 dasd_3990_erp_overrun(struct dasd_ccw_req
* erp
, char *sense
)
1211 struct dasd_device
*device
= erp
->startdev
;
1213 erp
->function
= dasd_3990_erp_overrun
;
1215 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1216 "Overrun - service overrun or overrun"
1217 " error requested by channel");
1219 erp
= dasd_3990_erp_action_5(erp
);
1223 } /* end dasd_3990_erp_overrun */
1226 * DASD_3990_ERP_INV_FORMAT
1229 * Handles 24 byte 'Invalid Track Format' error.
1232 * erp current erp_head
1234 * erp new erp_head - pointer to new ERP
1236 static struct dasd_ccw_req
*
1237 dasd_3990_erp_inv_format(struct dasd_ccw_req
* erp
, char *sense
)
1240 struct dasd_device
*device
= erp
->startdev
;
1242 erp
->function
= dasd_3990_erp_inv_format
;
1244 if (sense
[2] & SNS2_ENV_DATA_PRESENT
) {
1246 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1247 "Track format error when destaging or "
1250 dasd_3990_handle_env_data(erp
, sense
);
1252 erp
= dasd_3990_erp_action_4(erp
, sense
);
1255 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1256 "Invalid Track Format - Fatal error");
1258 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1263 } /* end dasd_3990_erp_inv_format */
1269 * Handles 24 byte 'End-of-Cylinder' error.
1272 * erp already added default erp
1274 * erp pointer to original (failed) cqr.
1276 static struct dasd_ccw_req
*
1277 dasd_3990_erp_EOC(struct dasd_ccw_req
* default_erp
, char *sense
)
1280 struct dasd_device
*device
= default_erp
->startdev
;
1282 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1283 "End-of-Cylinder - must never happen");
1285 /* implement action 7 - BUG */
1286 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1288 } /* end dasd_3990_erp_EOC */
1291 * DASD_3990_ERP_ENV_DATA
1294 * Handles 24 byte 'Environmental-Data Present' error.
1297 * erp current erp_head
1299 * erp new erp_head - pointer to new ERP
1301 static struct dasd_ccw_req
*
1302 dasd_3990_erp_env_data(struct dasd_ccw_req
* erp
, char *sense
)
1305 struct dasd_device
*device
= erp
->startdev
;
1307 erp
->function
= dasd_3990_erp_env_data
;
1309 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Environmental data present");
1311 dasd_3990_handle_env_data(erp
, sense
);
1313 /* don't retry on disabled interface */
1314 if (sense
[7] != 0x0F) {
1315 erp
= dasd_3990_erp_action_4(erp
, sense
);
1317 erp
->status
= DASD_CQR_FILLED
;
1322 } /* end dasd_3990_erp_env_data */
1325 * DASD_3990_ERP_NO_REC
1328 * Handles 24 byte 'No Record Found' error.
1331 * erp already added default ERP
1334 * erp new erp_head - pointer to new ERP
1336 static struct dasd_ccw_req
*
1337 dasd_3990_erp_no_rec(struct dasd_ccw_req
* default_erp
, char *sense
)
1340 struct dasd_device
*device
= default_erp
->startdev
;
1342 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1343 "No Record Found - Fatal error ");
1345 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1347 } /* end dasd_3990_erp_no_rec */
1350 * DASD_3990_ERP_FILE_PROT
1353 * Handles 24 byte 'File Protected' error.
1354 * Note: Seek related recovery is not implemented because
1355 * wee don't use the seek command yet.
1358 * erp current erp_head
1360 * erp new erp_head - pointer to new ERP
1362 static struct dasd_ccw_req
*
1363 dasd_3990_erp_file_prot(struct dasd_ccw_req
* erp
)
1366 struct dasd_device
*device
= erp
->startdev
;
1368 DEV_MESSAGE(KERN_ERR
, device
, "%s", "File Protected");
1370 return dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
1372 } /* end dasd_3990_erp_file_prot */
1375 * DASD_3990_ERP_INSPECT_ALIAS
1378 * Checks if the original request was started on an alias device.
1379 * If yes, it modifies the original and the erp request so that
1380 * the erp request can be started on a base device.
1383 * erp pointer to the currently created default ERP
1386 * erp pointer to the modified ERP, or NULL
1389 static struct dasd_ccw_req
*dasd_3990_erp_inspect_alias(
1390 struct dasd_ccw_req
*erp
)
1392 struct dasd_ccw_req
*cqr
= erp
->refers
;
1395 (cqr
->block
->base
!= cqr
->startdev
)) {
1396 if (cqr
->startdev
->features
& DASD_FEATURE_ERPLOG
) {
1397 DEV_MESSAGE(KERN_ERR
, cqr
->startdev
,
1398 "ERP on alias device for request %p,"
1399 " recover on base device %s", cqr
,
1400 dev_name(&cqr
->block
->base
->cdev
->dev
));
1402 dasd_eckd_reset_ccw_to_base_io(cqr
);
1403 erp
->startdev
= cqr
->block
->base
;
1404 erp
->function
= dasd_3990_erp_inspect_alias
;
1412 * DASD_3990_ERP_INSPECT_24
1415 * Does a detailed inspection of the 24 byte sense data
1416 * and sets up a related error recovery action.
1419 * sense sense data of the actual error
1420 * erp pointer to the currently created default ERP
1423 * erp pointer to the (addtitional) ERP
1425 static struct dasd_ccw_req
*
1426 dasd_3990_erp_inspect_24(struct dasd_ccw_req
* erp
, char *sense
)
1429 struct dasd_ccw_req
*erp_filled
= NULL
;
1431 /* Check sense for .... */
1432 /* 'Command Reject' */
1433 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_CMD_REJECT
)) {
1434 erp_filled
= dasd_3990_erp_com_rej(erp
, sense
);
1436 /* 'Intervention Required' */
1437 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_INTERVENTION_REQ
)) {
1438 erp_filled
= dasd_3990_erp_int_req(erp
);
1440 /* 'Bus Out Parity Check' */
1441 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_BUS_OUT_CHECK
)) {
1442 erp_filled
= dasd_3990_erp_bus_out(erp
);
1444 /* 'Equipment Check' */
1445 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_EQUIPMENT_CHECK
)) {
1446 erp_filled
= dasd_3990_erp_equip_check(erp
, sense
);
1449 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_DATA_CHECK
)) {
1450 erp_filled
= dasd_3990_erp_data_check(erp
, sense
);
1453 if ((erp_filled
== NULL
) && (sense
[0] & SNS0_OVERRUN
)) {
1454 erp_filled
= dasd_3990_erp_overrun(erp
, sense
);
1456 /* 'Invalid Track Format' */
1457 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_INV_TRACK_FORMAT
)) {
1458 erp_filled
= dasd_3990_erp_inv_format(erp
, sense
);
1460 /* 'End-of-Cylinder' */
1461 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_EOC
)) {
1462 erp_filled
= dasd_3990_erp_EOC(erp
, sense
);
1464 /* 'Environmental Data' */
1465 if ((erp_filled
== NULL
) && (sense
[2] & SNS2_ENV_DATA_PRESENT
)) {
1466 erp_filled
= dasd_3990_erp_env_data(erp
, sense
);
1468 /* 'No Record Found' */
1469 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_NO_REC_FOUND
)) {
1470 erp_filled
= dasd_3990_erp_no_rec(erp
, sense
);
1472 /* 'File Protected' */
1473 if ((erp_filled
== NULL
) && (sense
[1] & SNS1_FILE_PROTECTED
)) {
1474 erp_filled
= dasd_3990_erp_file_prot(erp
);
1476 /* other (unknown) error - do default ERP */
1477 if (erp_filled
== NULL
) {
1484 } /* END dasd_3990_erp_inspect_24 */
1487 *****************************************************************************
1488 * 32 byte sense ERP functions (only)
1489 *****************************************************************************
1493 * DASD_3990_ERPACTION_10_32
1496 * Handles 32 byte 'Action 10' of Single Program Action Codes.
1497 * Just retry and if retry doesn't work, return with error.
1500 * erp current erp_head
1501 * sense current sense data
1503 * erp modified erp_head
1505 static struct dasd_ccw_req
*
1506 dasd_3990_erp_action_10_32(struct dasd_ccw_req
* erp
, char *sense
)
1509 struct dasd_device
*device
= erp
->startdev
;
1512 erp
->function
= dasd_3990_erp_action_10_32
;
1514 DEV_MESSAGE(KERN_DEBUG
, device
, "%s", "Perform logging requested");
1518 } /* end dasd_3990_erp_action_10_32 */
1521 * DASD_3990_ERP_ACTION_1B_32
1524 * Handles 32 byte 'Action 1B' of Single Program Action Codes.
1525 * A write operation could not be finished because of an unexpected
1527 * The already created 'default erp' is used to get the link to
1528 * the erp chain, but it can not be used for this recovery
1529 * action because it contains no DE/LO data space.
1532 * default_erp already added default erp.
1533 * sense current sense data
1537 * default_erp in case of imprecise ending or error
1539 static struct dasd_ccw_req
*
1540 dasd_3990_erp_action_1B_32(struct dasd_ccw_req
* default_erp
, char *sense
)
1543 struct dasd_device
*device
= default_erp
->startdev
;
1545 struct dasd_ccw_req
*cqr
;
1546 struct dasd_ccw_req
*erp
;
1547 struct DE_eckd_data
*DE_data
;
1548 struct PFX_eckd_data
*PFX_data
;
1549 char *LO_data
; /* LO_eckd_data_t */
1550 struct ccw1
*ccw
, *oldccw
;
1552 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1553 "Write not finished because of unexpected condition");
1555 default_erp
->function
= dasd_3990_erp_action_1B_32
;
1557 /* determine the original cqr */
1560 while (cqr
->refers
!= NULL
) {
1564 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1565 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1566 "32 bit sense, action 1B is not defined"
1567 " in transport mode - just retry");
1571 /* for imprecise ending just do default erp */
1572 if (sense
[1] & 0x01) {
1574 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1575 "Imprecise ending is set - just retry");
1580 /* determine the address of the CCW to be restarted */
1581 /* Imprecise ending is not set -> addr from IRB-SCSW */
1582 cpa
= default_erp
->refers
->irb
.scsw
.cmd
.cpa
;
1586 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1587 "Unable to determine address of the CCW "
1590 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1593 /* Build new ERP request including DE/LO */
1594 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
1595 2 + 1,/* DE/LO + TIC */
1596 sizeof(struct DE_eckd_data
) +
1597 sizeof(struct LO_eckd_data
), device
);
1600 DEV_MESSAGE(KERN_ERR
, device
, "%s", "Unable to allocate ERP");
1601 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1604 /* use original DE */
1605 DE_data
= erp
->data
;
1606 oldccw
= cqr
->cpaddr
;
1607 if (oldccw
->cmd_code
== DASD_ECKD_CCW_PFX
) {
1608 PFX_data
= cqr
->data
;
1609 memcpy(DE_data
, &PFX_data
->define_extent
,
1610 sizeof(struct DE_eckd_data
));
1612 memcpy(DE_data
, cqr
->data
, sizeof(struct DE_eckd_data
));
1615 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1617 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1619 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1620 "BUG - this should not happen");
1622 return dasd_3990_erp_cleanup(default_erp
, DASD_CQR_FAILED
);
1625 if ((sense
[7] & 0x3F) == 0x01) {
1626 /* operation code is WRITE DATA -> data area orientation */
1629 } else if ((sense
[7] & 0x3F) == 0x03) {
1630 /* operation code is FORMAT WRITE -> index orientation */
1634 LO_data
[0] = sense
[7]; /* operation */
1637 LO_data
[1] = sense
[8]; /* auxiliary */
1638 LO_data
[2] = sense
[9];
1639 LO_data
[3] = sense
[3]; /* count */
1640 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1641 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1642 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1644 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1648 memset(ccw
, 0, sizeof(struct ccw1
));
1649 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
1650 ccw
->flags
= CCW_FLAG_CC
;
1652 ccw
->cda
= (__u32
)(addr_t
) DE_data
;
1656 memset(ccw
, 0, sizeof(struct ccw1
));
1657 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
1658 ccw
->flags
= CCW_FLAG_CC
;
1660 ccw
->cda
= (__u32
)(addr_t
) LO_data
;
1662 /* TIC to the failed ccw */
1664 ccw
->cmd_code
= CCW_CMD_TIC
;
1667 /* fill erp related fields */
1668 erp
->function
= dasd_3990_erp_action_1B_32
;
1669 erp
->refers
= default_erp
->refers
;
1670 erp
->startdev
= device
;
1671 erp
->memdev
= device
;
1672 erp
->magic
= default_erp
->magic
;
1675 erp
->buildclk
= get_clock();
1676 erp
->status
= DASD_CQR_FILLED
;
1678 /* remove the default erp */
1679 dasd_free_erp_request(default_erp
, device
);
1683 } /* end dasd_3990_erp_action_1B_32 */
1686 * DASD_3990_UPDATE_1B
1689 * Handles the update to the 32 byte 'Action 1B' of Single Program
1690 * Action Codes in case the first action was not successful.
1691 * The already created 'previous_erp' is the currently not successful
1695 * previous_erp already created previous erp.
1696 * sense current sense data
1700 static struct dasd_ccw_req
*
1701 dasd_3990_update_1B(struct dasd_ccw_req
* previous_erp
, char *sense
)
1704 struct dasd_device
*device
= previous_erp
->startdev
;
1706 struct dasd_ccw_req
*cqr
;
1707 struct dasd_ccw_req
*erp
;
1708 char *LO_data
; /* struct LO_eckd_data */
1711 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1712 "Write not finished because of unexpected condition"
1715 /* determine the original cqr */
1718 while (cqr
->refers
!= NULL
) {
1722 if (scsw_is_tm(&cqr
->irb
.scsw
)) {
1723 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1724 "32 bit sense, action 1B, update,"
1725 " in transport mode - just retry");
1726 return previous_erp
;
1729 /* for imprecise ending just do default erp */
1730 if (sense
[1] & 0x01) {
1732 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1733 "Imprecise ending is set - just retry");
1735 previous_erp
->status
= DASD_CQR_FILLED
;
1737 return previous_erp
;
1740 /* determine the address of the CCW to be restarted */
1741 /* Imprecise ending is not set -> addr from IRB-SCSW */
1742 cpa
= previous_erp
->irb
.scsw
.cmd
.cpa
;
1746 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
1747 "Unable to determine address of the CCW "
1750 previous_erp
->status
= DASD_CQR_FAILED
;
1752 return previous_erp
;
1757 /* update the LO with the new returned sense data */
1758 LO_data
= erp
->data
+ sizeof(struct DE_eckd_data
);
1760 if ((sense
[3] == 0x01) && (LO_data
[1] & 0x01)) {
1762 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1763 "BUG - this should not happen");
1765 previous_erp
->status
= DASD_CQR_FAILED
;
1767 return previous_erp
;
1770 if ((sense
[7] & 0x3F) == 0x01) {
1771 /* operation code is WRITE DATA -> data area orientation */
1774 } else if ((sense
[7] & 0x3F) == 0x03) {
1775 /* operation code is FORMAT WRITE -> index orientation */
1779 LO_data
[0] = sense
[7]; /* operation */
1782 LO_data
[1] = sense
[8]; /* auxiliary */
1783 LO_data
[2] = sense
[9];
1784 LO_data
[3] = sense
[3]; /* count */
1785 LO_data
[4] = sense
[29]; /* seek_addr.cyl */
1786 LO_data
[5] = sense
[30]; /* seek_addr.cyl 2nd byte */
1787 LO_data
[7] = sense
[31]; /* seek_addr.head 2nd byte */
1789 memcpy(&(LO_data
[8]), &(sense
[11]), 8);
1791 /* TIC to the failed ccw */
1792 ccw
= erp
->cpaddr
; /* addr of DE ccw */
1793 ccw
++; /* addr of LE ccw */
1794 ccw
++; /* addr of TIC ccw */
1797 erp
->status
= DASD_CQR_FILLED
;
1801 } /* end dasd_3990_update_1B */
1804 * DASD_3990_ERP_COMPOUND_RETRY
1807 * Handles the compound ERP action retry code.
1808 * NOTE: At least one retry is done even if zero is specified
1809 * by the sense data. This makes enqueueing of the request
1813 * sense sense data of the actual error
1814 * erp pointer to the currently created ERP
1817 * erp modified ERP pointer
1821 dasd_3990_erp_compound_retry(struct dasd_ccw_req
* erp
, char *sense
)
1824 switch (sense
[25] & 0x03) {
1825 case 0x00: /* no not retry */
1829 case 0x01: /* retry 2 times */
1833 case 0x02: /* retry 10 times */
1837 case 0x03: /* retry 256 times */
1845 erp
->function
= dasd_3990_erp_compound_retry
;
1847 } /* end dasd_3990_erp_compound_retry */
1850 * DASD_3990_ERP_COMPOUND_PATH
1853 * Handles the compound ERP action for retry on alternate
1857 * sense sense data of the actual error
1858 * erp pointer to the currently created ERP
1861 * erp modified ERP pointer
1865 dasd_3990_erp_compound_path(struct dasd_ccw_req
* erp
, char *sense
)
1868 if (sense
[25] & DASD_SENSE_BIT_3
) {
1869 dasd_3990_erp_alternate_path(erp
);
1871 if (erp
->status
== DASD_CQR_FAILED
) {
1872 /* reset the lpm and the status to be able to
1873 * try further actions. */
1876 erp
->status
= DASD_CQR_NEED_ERP
;
1880 erp
->function
= dasd_3990_erp_compound_path
;
1882 } /* end dasd_3990_erp_compound_path */
1885 * DASD_3990_ERP_COMPOUND_CODE
1888 * Handles the compound ERP action for retry code.
1891 * sense sense data of the actual error
1892 * erp pointer to the currently created ERP
1895 * erp NEW ERP pointer
1898 static struct dasd_ccw_req
*
1899 dasd_3990_erp_compound_code(struct dasd_ccw_req
* erp
, char *sense
)
1902 if (sense
[25] & DASD_SENSE_BIT_2
) {
1904 switch (sense
[28]) {
1906 /* issue a Diagnostic Control command with an
1907 * Inhibit Write subcommand and controller modifier */
1908 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
1912 /* wait for 5 seconds and retry again */
1915 dasd_3990_erp_block_queue (erp
, 5*HZ
);
1919 /* should not happen - continue */
1924 erp
->function
= dasd_3990_erp_compound_code
;
1928 } /* end dasd_3990_erp_compound_code */
1931 * DASD_3990_ERP_COMPOUND_CONFIG
1934 * Handles the compound ERP action for configruation
1936 * Note: duplex handling is not implemented (yet).
1939 * sense sense data of the actual error
1940 * erp pointer to the currently created ERP
1943 * erp modified ERP pointer
1947 dasd_3990_erp_compound_config(struct dasd_ccw_req
* erp
, char *sense
)
1950 if ((sense
[25] & DASD_SENSE_BIT_1
) && (sense
[26] & DASD_SENSE_BIT_2
)) {
1952 /* set to suspended duplex state then restart */
1953 struct dasd_device
*device
= erp
->startdev
;
1955 DEV_MESSAGE(KERN_ERR
, device
, "%s",
1956 "Set device to suspended duplex state should be "
1958 "This is not implemented yet (for compound ERP)"
1959 " - please report to linux390@de.ibm.com");
1963 erp
->function
= dasd_3990_erp_compound_config
;
1965 } /* end dasd_3990_erp_compound_config */
1968 * DASD_3990_ERP_COMPOUND
1971 * Does the further compound program action if
1972 * compound retry was not successful.
1975 * sense sense data of the actual error
1976 * erp pointer to the current (failed) ERP
1979 * erp (additional) ERP pointer
1982 static struct dasd_ccw_req
*
1983 dasd_3990_erp_compound(struct dasd_ccw_req
* erp
, char *sense
)
1986 if ((erp
->function
== dasd_3990_erp_compound_retry
) &&
1987 (erp
->status
== DASD_CQR_NEED_ERP
)) {
1989 dasd_3990_erp_compound_path(erp
, sense
);
1992 if ((erp
->function
== dasd_3990_erp_compound_path
) &&
1993 (erp
->status
== DASD_CQR_NEED_ERP
)) {
1995 erp
= dasd_3990_erp_compound_code(erp
, sense
);
1998 if ((erp
->function
== dasd_3990_erp_compound_code
) &&
1999 (erp
->status
== DASD_CQR_NEED_ERP
)) {
2001 dasd_3990_erp_compound_config(erp
, sense
);
2004 /* if no compound action ERP specified, the request failed */
2005 if (erp
->status
== DASD_CQR_NEED_ERP
)
2006 erp
->status
= DASD_CQR_FAILED
;
2010 } /* end dasd_3990_erp_compound */
2013 *DASD_3990_ERP_HANDLE_SIM
2016 * inspects the SIM SENSE data and starts an appropriate action
2019 * sense sense data of the actual error
2025 dasd_3990_erp_handle_sim(struct dasd_device
*device
, char *sense
)
2027 /* print message according to log or message to operator mode */
2028 if ((sense
[24] & DASD_SIM_MSG_TO_OP
) || (sense
[1] & 0x10)) {
2030 /* print SIM SRC from RefCode */
2031 DEV_MESSAGE(KERN_ERR
, device
, "SIM - SRC: "
2032 "%02x%02x%02x%02x", sense
[22],
2033 sense
[23], sense
[11], sense
[12]);
2034 } else if (sense
[24] & DASD_SIM_LOG
) {
2035 /* print SIM SRC Refcode */
2036 DEV_MESSAGE(KERN_WARNING
, device
, "SIM - SRC: "
2037 "%02x%02x%02x%02x", sense
[22],
2038 sense
[23], sense
[11], sense
[12]);
2043 * DASD_3990_ERP_INSPECT_32
2046 * Does a detailed inspection of the 32 byte sense data
2047 * and sets up a related error recovery action.
2050 * sense sense data of the actual error
2051 * erp pointer to the currently created default ERP
2054 * erp_filled pointer to the ERP
2057 static struct dasd_ccw_req
*
2058 dasd_3990_erp_inspect_32(struct dasd_ccw_req
* erp
, char *sense
)
2061 struct dasd_device
*device
= erp
->startdev
;
2063 erp
->function
= dasd_3990_erp_inspect_32
;
2065 /* check for SIM sense data */
2066 if ((sense
[6] & DASD_SIM_SENSE
) == DASD_SIM_SENSE
)
2067 dasd_3990_erp_handle_sim(device
, sense
);
2069 if (sense
[25] & DASD_SENSE_BIT_0
) {
2071 /* compound program action codes (byte25 bit 0 == '1') */
2072 dasd_3990_erp_compound_retry(erp
, sense
);
2076 /* single program action codes (byte25 bit 0 == '0') */
2077 switch (sense
[25]) {
2079 case 0x00: /* success - use default ERP for retries */
2080 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2081 "ERP called for successful request"
2085 case 0x01: /* fatal error */
2086 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2087 "Retry not recommended - Fatal error");
2089 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2092 case 0x02: /* intervention required */
2093 case 0x03: /* intervention required during dual copy */
2094 erp
= dasd_3990_erp_int_req(erp
);
2097 case 0x0F: /* length mismatch during update write command */
2098 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2099 "update write command error - should not "
2101 "Please send this message together with "
2102 "the above sense data to linux390@de."
2105 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2108 case 0x10: /* logging required for other channel program */
2109 erp
= dasd_3990_erp_action_10_32(erp
, sense
);
2112 case 0x15: /* next track outside defined extend */
2113 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2114 "next track outside defined extend - "
2115 "should not happen;\n"
2116 "Please send this message together with "
2117 "the above sense data to linux390@de."
2120 erp
= dasd_3990_erp_cleanup(erp
, DASD_CQR_FAILED
);
2123 case 0x1B: /* unexpected condition during write */
2125 erp
= dasd_3990_erp_action_1B_32(erp
, sense
);
2128 case 0x1C: /* invalid data */
2129 DEV_MESSAGE(KERN_EMERG
, device
, "%s",
2130 "Data recovered during retry with PCI "
2131 "fetch mode active");
2133 /* not possible to handle this situation in Linux */
2135 ("Invalid data - No way to inform application "
2136 "about the possibly incorrect data");
2139 case 0x1D: /* state-change pending */
2140 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2141 "A State change pending condition exists "
2142 "for the subsystem or device");
2144 erp
= dasd_3990_erp_action_4(erp
, sense
);
2147 case 0x1E: /* busy */
2148 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2149 "Busy condition exists "
2150 "for the subsystem or device");
2151 erp
= dasd_3990_erp_action_4(erp
, sense
);
2154 default: /* all others errors - default erp */
2161 } /* end dasd_3990_erp_inspect_32 */
2164 *****************************************************************************
2165 * main ERP control fuctions (24 and 32 byte sense)
2166 *****************************************************************************
2170 * DASD_3990_ERP_CONTROL_CHECK
2173 * Does a generic inspection if a control check occured and sets up
2174 * the related error recovery procedure
2177 * erp pointer to the currently created default ERP
2180 * erp_filled pointer to the erp
2183 static struct dasd_ccw_req
*
2184 dasd_3990_erp_control_check(struct dasd_ccw_req
*erp
)
2186 struct dasd_device
*device
= erp
->startdev
;
2188 if (scsw_cstat(&erp
->refers
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
2189 | SCHN_STAT_CHN_CTRL_CHK
)) {
2190 DEV_MESSAGE(KERN_DEBUG
, device
, "%s",
2191 "channel or interface control check");
2192 erp
= dasd_3990_erp_action_4(erp
, NULL
);
2198 * DASD_3990_ERP_INSPECT
2201 * Does a detailed inspection for sense data by calling either
2202 * the 24-byte or the 32-byte inspection routine.
2205 * erp pointer to the currently created default ERP
2207 * erp_new contens was possibly modified
2209 static struct dasd_ccw_req
*
2210 dasd_3990_erp_inspect(struct dasd_ccw_req
*erp
)
2213 struct dasd_ccw_req
*erp_new
= NULL
;
2216 /* if this problem occured on an alias retry on base */
2217 erp_new
= dasd_3990_erp_inspect_alias(erp
);
2221 /* sense data are located in the refers record of the
2222 * already set up new ERP !
2223 * check if concurrent sens is available
2225 sense
= dasd_get_sense(&erp
->refers
->irb
);
2227 erp_new
= dasd_3990_erp_control_check(erp
);
2228 /* distinguish between 24 and 32 byte sense data */
2229 else if (sense
[27] & DASD_SENSE_BIT_0
) {
2231 /* inspect the 24 byte sense data */
2232 erp_new
= dasd_3990_erp_inspect_24(erp
, sense
);
2236 /* inspect the 32 byte sense data */
2237 erp_new
= dasd_3990_erp_inspect_32(erp
, sense
);
2239 } /* end distinguish between 24 and 32 byte sense data */
2245 * DASD_3990_ERP_ADD_ERP
2248 * This funtion adds an additional request block (ERP) to the head of
2249 * the given cqr (or erp).
2250 * For a command mode cqr the erp is initialized as an default erp
2252 * For transport mode we make a copy of the original TCW (points to
2253 * the original TCCB, TIDALs, etc.) but give it a fresh
2254 * TSB so the original sense data will not be changed.
2257 * cqr head of the current ERP-chain (or single cqr if
2260 * erp pointer to new ERP-chain head
2262 static struct dasd_ccw_req
*dasd_3990_erp_add_erp(struct dasd_ccw_req
*cqr
)
2265 struct dasd_device
*device
= cqr
->startdev
;
2267 struct dasd_ccw_req
*erp
;
2268 int cplength
, datasize
;
2272 if (cqr
->cpmode
== 1) {
2274 datasize
= sizeof(struct tcw
) + sizeof(struct tsb
);
2280 /* allocate additional request block */
2281 erp
= dasd_alloc_erp_request((char *) &cqr
->magic
,
2282 cplength
, datasize
, device
);
2284 if (cqr
->retries
<= 0) {
2285 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2286 "Unable to allocate ERP request");
2287 cqr
->status
= DASD_CQR_FAILED
;
2288 cqr
->stopclk
= get_clock ();
2290 DEV_MESSAGE (KERN_ERR
, device
,
2291 "Unable to allocate ERP request "
2292 "(%i retries left)",
2294 dasd_block_set_timer(device
->block
, (HZ
<< 3));
2299 if (cqr
->cpmode
== 1) {
2300 /* make a shallow copy of the original tcw but set new tsb */
2302 erp
->cpaddr
= erp
->data
;
2304 tsb
= (struct tsb
*) &tcw
[1];
2305 *tcw
= *((struct tcw
*)cqr
->cpaddr
);
2306 tcw
->tsb
= (long)tsb
;
2308 /* initialize request with default TIC to current ERP/CQR */
2310 ccw
->cmd_code
= CCW_CMD_NOOP
;
2311 ccw
->flags
= CCW_FLAG_CC
;
2313 ccw
->cmd_code
= CCW_CMD_TIC
;
2314 ccw
->cda
= (long)(cqr
->cpaddr
);
2317 erp
->function
= dasd_3990_erp_add_erp
;
2319 erp
->startdev
= device
;
2320 erp
->memdev
= device
;
2321 erp
->block
= cqr
->block
;
2322 erp
->magic
= cqr
->magic
;
2325 erp
->buildclk
= get_clock();
2326 erp
->status
= DASD_CQR_FILLED
;
2332 * DASD_3990_ERP_ADDITIONAL_ERP
2335 * An additional ERP is needed to handle the current error.
2336 * Add ERP to the head of the ERP-chain containing the ERP processing
2337 * determined based on the sense data.
2340 * cqr head of the current ERP-chain (or single cqr if
2344 * erp pointer to new ERP-chain head
2346 static struct dasd_ccw_req
*
2347 dasd_3990_erp_additional_erp(struct dasd_ccw_req
* cqr
)
2350 struct dasd_ccw_req
*erp
= NULL
;
2352 /* add erp and initialize with default TIC */
2353 erp
= dasd_3990_erp_add_erp(cqr
);
2355 /* inspect sense, determine specific ERP if possible */
2358 erp
= dasd_3990_erp_inspect(erp
);
2363 } /* end dasd_3990_erp_additional_erp */
2366 * DASD_3990_ERP_ERROR_MATCH
2369 * Check if the device status of the given cqr is the same.
2370 * This means that the failed CCW and the relevant sense data
2372 * I don't distinguish between 24 and 32 byte sense because in case of
2373 * 24 byte sense byte 25 and 27 is set as well.
2376 * cqr1 first cqr, which will be compared with the
2380 * match 'boolean' for match found
2381 * returns 1 if match found, otherwise 0.
2383 static int dasd_3990_erp_error_match(struct dasd_ccw_req
*cqr1
,
2384 struct dasd_ccw_req
*cqr2
)
2386 char *sense1
, *sense2
;
2388 if (cqr1
->startdev
!= cqr2
->startdev
)
2391 sense1
= dasd_get_sense(&cqr1
->irb
);
2392 sense2
= dasd_get_sense(&cqr2
->irb
);
2394 /* one request has sense data, the other not -> no match, return 0 */
2395 if (!sense1
!= !sense2
)
2397 /* no sense data in both cases -> check cstat for IFCC */
2398 if (!sense1
&& !sense2
) {
2399 if ((scsw_cstat(&cqr1
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2400 SCHN_STAT_CHN_CTRL_CHK
)) ==
2401 (scsw_cstat(&cqr2
->irb
.scsw
) & (SCHN_STAT_INTF_CTRL_CHK
|
2402 SCHN_STAT_CHN_CTRL_CHK
)))
2403 return 1; /* match with ifcc*/
2405 /* check sense data; byte 0-2,25,27 */
2406 if (!(sense1
&& sense2
&&
2407 (memcmp(sense1
, sense2
, 3) == 0) &&
2408 (sense1
[27] == sense2
[27]) &&
2409 (sense1
[25] == sense2
[25]))) {
2411 return 0; /* sense doesn't match */
2414 return 1; /* match */
2416 } /* end dasd_3990_erp_error_match */
2419 * DASD_3990_ERP_IN_ERP
2422 * check if the current error already happened before.
2423 * quick exit if current cqr is not an ERP (cqr->refers=NULL)
2426 * cqr failed cqr (either original cqr or already an erp)
2429 * erp erp-pointer to the already defined error
2430 * recovery procedure OR
2431 * NULL if a 'new' error occurred.
2433 static struct dasd_ccw_req
*
2434 dasd_3990_erp_in_erp(struct dasd_ccw_req
*cqr
)
2437 struct dasd_ccw_req
*erp_head
= cqr
, /* save erp chain head */
2438 *erp_match
= NULL
; /* save erp chain head */
2439 int match
= 0; /* 'boolean' for matching error found */
2441 if (cqr
->refers
== NULL
) { /* return if not in erp */
2445 /* check the erp/cqr chain for current error */
2447 match
= dasd_3990_erp_error_match(erp_head
, cqr
->refers
);
2448 erp_match
= cqr
; /* save possible matching erp */
2449 cqr
= cqr
->refers
; /* check next erp/cqr in queue */
2451 } while ((cqr
->refers
!= NULL
) && (!match
));
2454 return NULL
; /* no match was found */
2457 return erp_match
; /* return address of matching erp */
2459 } /* END dasd_3990_erp_in_erp */
2462 * DASD_3990_ERP_FURTHER_ERP (24 & 32 byte sense)
2465 * No retry is left for the current ERP. Check what has to be done
2467 * - do further defined ERP action or
2468 * - wait for interrupt or
2469 * - exit with permanent error
2472 * erp ERP which is in progress with no retry left
2475 * erp modified/additional ERP
2477 static struct dasd_ccw_req
*
2478 dasd_3990_erp_further_erp(struct dasd_ccw_req
*erp
)
2481 struct dasd_device
*device
= erp
->startdev
;
2482 char *sense
= dasd_get_sense(&erp
->irb
);
2484 /* check for 24 byte sense ERP */
2485 if ((erp
->function
== dasd_3990_erp_bus_out
) ||
2486 (erp
->function
== dasd_3990_erp_action_1
) ||
2487 (erp
->function
== dasd_3990_erp_action_4
)) {
2489 erp
= dasd_3990_erp_action_1(erp
);
2491 } else if (erp
->function
== dasd_3990_erp_action_5
) {
2493 /* retries have not been successful */
2494 /* prepare erp for retry on different channel path */
2495 erp
= dasd_3990_erp_action_1(erp
);
2497 if (sense
&& !(sense
[2] & DASD_SENSE_BIT_0
)) {
2499 /* issue a Diagnostic Control command with an
2500 * Inhibit Write subcommand */
2502 switch (sense
[25]) {
2504 case 0x57:{ /* controller */
2505 erp
= dasd_3990_erp_DCTL(erp
, 0x20);
2509 case 0x58:{ /* channel path */
2510 erp
= dasd_3990_erp_DCTL(erp
, 0x40);
2514 case 0x59:{ /* storage director */
2515 erp
= dasd_3990_erp_DCTL(erp
, 0x80);
2519 DEV_MESSAGE(KERN_DEBUG
, device
,
2520 "invalid subcommand modifier 0x%x "
2521 "for Diagnostic Control Command",
2526 /* check for 32 byte sense ERP */
2528 ((erp
->function
== dasd_3990_erp_compound_retry
) ||
2529 (erp
->function
== dasd_3990_erp_compound_path
) ||
2530 (erp
->function
== dasd_3990_erp_compound_code
) ||
2531 (erp
->function
== dasd_3990_erp_compound_config
))) {
2533 erp
= dasd_3990_erp_compound(erp
, sense
);
2536 /* No retry left and no additional special handling */
2538 DEV_MESSAGE(KERN_ERR
, device
,
2539 "no retries left for erp %p - "
2540 "set status to FAILED", erp
);
2542 erp
->status
= DASD_CQR_FAILED
;
2547 } /* end dasd_3990_erp_further_erp */
2550 * DASD_3990_ERP_HANDLE_MATCH_ERP
2553 * An error occurred again and an ERP has been detected which is already
2554 * used to handle this error (e.g. retries).
2555 * All prior ERP's are asumed to be successful and therefore removed
2557 * If retry counter of matching erp is already 0, it is checked if further
2558 * action is needed (besides retry) or if the ERP has failed.
2561 * erp_head first ERP in ERP-chain
2562 * erp ERP that handles the actual error.
2566 * erp modified/additional ERP
2568 static struct dasd_ccw_req
*
2569 dasd_3990_erp_handle_match_erp(struct dasd_ccw_req
*erp_head
,
2570 struct dasd_ccw_req
*erp
)
2573 struct dasd_device
*device
= erp_head
->startdev
;
2574 struct dasd_ccw_req
*erp_done
= erp_head
; /* finished req */
2575 struct dasd_ccw_req
*erp_free
= NULL
; /* req to be freed */
2577 /* loop over successful ERPs and remove them from chanq */
2578 while (erp_done
!= erp
) {
2580 if (erp_done
== NULL
) /* end of chain reached */
2581 panic(PRINTK_HEADER
"Programming error in ERP! The "
2582 "original request was lost\n");
2584 /* remove the request from the device queue */
2585 list_del(&erp_done
->blocklist
);
2587 erp_free
= erp_done
;
2588 erp_done
= erp_done
->refers
;
2590 /* free the finished erp request */
2591 dasd_free_erp_request(erp_free
, erp_free
->memdev
);
2595 if (erp
->retries
> 0) {
2597 char *sense
= dasd_get_sense(&erp
->refers
->irb
);
2599 /* check for special retries */
2600 if (sense
&& erp
->function
== dasd_3990_erp_action_4
) {
2602 erp
= dasd_3990_erp_action_4(erp
, sense
);
2605 erp
->function
== dasd_3990_erp_action_1B_32
) {
2607 erp
= dasd_3990_update_1B(erp
, sense
);
2609 } else if (sense
&& erp
->function
== dasd_3990_erp_int_req
) {
2611 erp
= dasd_3990_erp_int_req(erp
);
2615 DEV_MESSAGE(KERN_DEBUG
, device
,
2616 "%i retries left for erp %p",
2619 /* handle the request again... */
2620 erp
->status
= DASD_CQR_FILLED
;
2624 /* no retry left - check for further necessary action */
2625 /* if no further actions, handle rest as permanent error */
2626 erp
= dasd_3990_erp_further_erp(erp
);
2631 } /* end dasd_3990_erp_handle_match_erp */
2634 * DASD_3990_ERP_ACTION
2637 * control routine for 3990 erp actions.
2638 * Has to be called with the queue lock (namely the s390_irq_lock) acquired.
2641 * cqr failed cqr (either original cqr or already an erp)
2644 * erp erp-pointer to the head of the ERP action chain.
2646 * - either a ptr to an additional ERP cqr or
2647 * - the original given cqr (which's status might
2650 struct dasd_ccw_req
*
2651 dasd_3990_erp_action(struct dasd_ccw_req
* cqr
)
2653 struct dasd_ccw_req
*erp
= NULL
;
2654 struct dasd_device
*device
= cqr
->startdev
;
2655 struct dasd_ccw_req
*temp_erp
= NULL
;
2657 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2658 /* print current erp_chain */
2659 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2660 "ERP chain at BEGINNING of ERP-ACTION");
2661 for (temp_erp
= cqr
;
2662 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2664 DEV_MESSAGE(KERN_ERR
, device
,
2665 " erp %p (%02x) refers to %p",
2666 temp_erp
, temp_erp
->status
,
2671 /* double-check if current erp/cqr was successful */
2672 if ((scsw_cstat(&cqr
->irb
.scsw
) == 0x00) &&
2673 (scsw_dstat(&cqr
->irb
.scsw
) ==
2674 (DEV_STAT_CHN_END
| DEV_STAT_DEV_END
))) {
2676 DEV_MESSAGE(KERN_DEBUG
, device
,
2677 "ERP called for successful request %p"
2678 " - NO ERP necessary", cqr
);
2680 cqr
->status
= DASD_CQR_DONE
;
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
);
2696 if (device
->features
& DASD_FEATURE_ERPLOG
) {
2697 /* print current erp_chain */
2698 DEV_MESSAGE(KERN_ERR
, device
, "%s",
2699 "ERP chain at END of ERP-ACTION");
2700 for (temp_erp
= erp
;
2701 temp_erp
!= NULL
; temp_erp
= temp_erp
->refers
) {
2703 DEV_MESSAGE(KERN_ERR
, device
,
2704 " erp %p (%02x) refers to %p",
2705 temp_erp
, temp_erp
->status
,
2710 /* enqueue ERP request if it's a new one */
2711 if (list_empty(&erp
->blocklist
)) {
2712 cqr
->status
= DASD_CQR_IN_ERP
;
2713 /* add erp request before the cqr */
2714 list_add_tail(&erp
->blocklist
, &cqr
->blocklist
);
2719 } /* end dasd_3990_erp_action */