ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / s390 / block / dasd_3370_erp.c
1 /* 
2  * File...........: linux/drivers/s390/block/dasd_3370_erp.c
3  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4  * Bugreports.to..: <Linux390@de.ibm.com>
5  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000
6  *
7  * $Revision: 1.9 $
8  */
9
10 #define PRINTK_HEADER "dasd_erp(3370)"
11
12 #include "dasd_int.h"
13
14
15 /*
16  * DASD_3370_ERP_EXAMINE 
17  *
18  * DESCRIPTION
19  *   Checks only for fatal/no/recover error. 
20  *   A detailed examination of the sense data is done later outside
21  *   the interrupt handler.
22  *
23  *   The logic is based on the 'IBM 3880 Storage Control Reference' manual
24  *   'Chapter 7. 3370 Sense Data'.
25  *
26  * RETURN VALUES
27  *   dasd_era_none      no error 
28  *   dasd_era_fatal     for all fatal (unrecoverable errors)
29  *   dasd_era_recover   for all others.
30  */
31 dasd_era_t
32 dasd_3370_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
33 {
34         char *sense = irb->ecw;
35
36         /* check for successful execution first */
37         if (irb->scsw.cstat == 0x00 &&
38             irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
39                 return dasd_era_none;
40         if (sense[0] & 0x80) {  /* CMD reject */
41                 return dasd_era_fatal;
42         }
43         if (sense[0] & 0x40) {  /* Drive offline */
44                 return dasd_era_recover;
45         }
46         if (sense[0] & 0x20) {  /* Bus out parity */
47                 return dasd_era_recover;
48         }
49         if (sense[0] & 0x10) {  /* equipment check */
50                 if (sense[1] & 0x80) {
51                         return dasd_era_fatal;
52                 }
53                 return dasd_era_recover;
54         }
55         if (sense[0] & 0x08) {  /* data check */
56                 if (sense[1] & 0x80) {
57                         return dasd_era_fatal;
58                 }
59                 return dasd_era_recover;
60         }
61         if (sense[0] & 0x04) {  /* overrun */
62                 if (sense[1] & 0x80) {
63                         return dasd_era_fatal;
64                 }
65                 return dasd_era_recover;
66         }
67         if (sense[1] & 0x40) {  /* invalid blocksize */
68                 return dasd_era_fatal;
69         }
70         if (sense[1] & 0x04) {  /* file protected */
71                 return dasd_era_recover;
72         }
73         if (sense[1] & 0x01) {  /* operation incomplete */
74                 return dasd_era_recover;
75         }
76         if (sense[2] & 0x80) {  /* check data erroor */
77                 return dasd_era_recover;
78         }
79         if (sense[2] & 0x10) {  /* Env. data present */
80                 return dasd_era_recover;
81         }
82         /* examine the 24 byte sense data */
83         return dasd_era_recover;
84
85 }                               /* END dasd_3370_erp_examine */
86
87 /*
88  * Overrides for Emacs so that we follow Linus's tabbing style.
89  * Emacs will notice this stuff at the end of the file and automatically
90  * adjust the settings for this buffer only.  This must remain at the end
91  * of the file.
92  * ---------------------------------------------------------------------------
93  * Local variables:
94  * c-indent-level: 4 
95  * c-brace-imaginary-offset: 0
96  * c-brace-offset: -4
97  * c-argdecl-indent: 4
98  * c-label-offset: -4
99  * c-continued-statement-offset: 4
100  * c-continued-brace-offset: 0
101  * indent-tabs-mode: 1
102  * tab-width: 8
103  * End:
104  */