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