Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #define PRINTK_HEADER "dasd_erp(3370)" |
| 10 | |
| 11 | #include "dasd_int.h" |
| 12 | |
| 13 | |
| 14 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 15 | * DASD_3370_ERP_EXAMINE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | * |
| 17 | * DESCRIPTION |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 18 | * Checks only for fatal/no/recover error. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 26 | * dasd_era_none no error |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 */ |