Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / s390 / block / dasd_3370_erp.c
blob84565c8f584e0361dabd8af6d26ab07e0083fa81
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 * $Revision: 1.9 $
8 */
10 #define PRINTK_HEADER "dasd_erp(3370)"
12 #include "dasd_int.h"
16 * DASD_3370_ERP_EXAMINE
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.
23 * The logic is based on the 'IBM 3880 Storage Control Reference' manual
24 * 'Chapter 7. 3370 Sense Data'.
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.
31 dasd_era_t
32 dasd_3370_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
34 char *sense = irb->ecw;
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;
43 if (sense[0] & 0x40) { /* Drive offline */
44 return dasd_era_recover;
46 if (sense[0] & 0x20) { /* Bus out parity */
47 return dasd_era_recover;
49 if (sense[0] & 0x10) { /* equipment check */
50 if (sense[1] & 0x80) {
51 return dasd_era_fatal;
53 return dasd_era_recover;
55 if (sense[0] & 0x08) { /* data check */
56 if (sense[1] & 0x80) {
57 return dasd_era_fatal;
59 return dasd_era_recover;
61 if (sense[0] & 0x04) { /* overrun */
62 if (sense[1] & 0x80) {
63 return dasd_era_fatal;
65 return dasd_era_recover;
67 if (sense[1] & 0x40) { /* invalid blocksize */
68 return dasd_era_fatal;
70 if (sense[1] & 0x04) { /* file protected */
71 return dasd_era_recover;
73 if (sense[1] & 0x01) { /* operation incomplete */
74 return dasd_era_recover;
76 if (sense[2] & 0x80) { /* check data erroor */
77 return dasd_era_recover;
79 if (sense[2] & 0x10) { /* Env. data present */
80 return dasd_era_recover;
82 /* examine the 24 byte sense data */
83 return dasd_era_recover;
85 } /* END dasd_3370_erp_examine */
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: