Pull platform-drivers into test branch
[linux-2.6/x86.git] / drivers / s390 / block / dasd_3370_erp.c
blob1ddab8991d92fe1020c1c8309180d175700f954b
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
7 */
9 #define PRINTK_HEADER "dasd_erp(3370)"
11 #include "dasd_int.h"
15 * DASD_3370_ERP_EXAMINE
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.
22 * The logic is based on the 'IBM 3880 Storage Control Reference' manual
23 * 'Chapter 7. 3370 Sense Data'.
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.
30 dasd_era_t
31 dasd_3370_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
33 char *sense = irb->ecw;
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;
42 if (sense[0] & 0x40) { /* Drive offline */
43 return dasd_era_recover;
45 if (sense[0] & 0x20) { /* Bus out parity */
46 return dasd_era_recover;
48 if (sense[0] & 0x10) { /* equipment check */
49 if (sense[1] & 0x80) {
50 return dasd_era_fatal;
52 return dasd_era_recover;
54 if (sense[0] & 0x08) { /* data check */
55 if (sense[1] & 0x80) {
56 return dasd_era_fatal;
58 return dasd_era_recover;
60 if (sense[0] & 0x04) { /* overrun */
61 if (sense[1] & 0x80) {
62 return dasd_era_fatal;
64 return dasd_era_recover;
66 if (sense[1] & 0x40) { /* invalid blocksize */
67 return dasd_era_fatal;
69 if (sense[1] & 0x04) { /* file protected */
70 return dasd_era_recover;
72 if (sense[1] & 0x01) { /* operation incomplete */
73 return dasd_era_recover;
75 if (sense[2] & 0x80) { /* check data erroor */
76 return dasd_era_recover;
78 if (sense[2] & 0x10) { /* Env. data present */
79 return dasd_era_recover;
81 /* examine the 24 byte sense data */
82 return dasd_era_recover;
84 } /* END dasd_3370_erp_examine */