dasd_3370_erp.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:3k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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. #include <asm/ccwcache.h>
  8. #include "dasd_int.h"
  9. #include "dasd_3370_erp.h"
  10. #ifdef PRINTK_HEADER
  11. #undef PRINTK_HEADER
  12. #define PRINTK_HEADER "dasd_erp(3370)"
  13. #endif /* PRINTK_HEADER */
  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 (ccw_req_t * cqr, devstat_t * stat)
  32. {
  33. char *sense = stat->ii.sense.data;
  34. /* check for successful execution first */
  35. if (stat->cstat == 0x00 &&
  36.     stat->dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
  37.     return dasd_era_none;
  38. if (sense[0] & 0x80) { /* CMD reject */
  39. return dasd_era_fatal;
  40. }
  41. if (sense[0] & 0x40) { /* Drive offline */
  42. return dasd_era_recover;
  43. }
  44. if (sense[0] & 0x20) { /* Bus out parity */
  45. return dasd_era_recover;
  46. }
  47. if (sense[0] & 0x10) { /* equipment check */
  48. if (sense[1] & 0x80) {
  49. return dasd_era_fatal;
  50. }
  51. return dasd_era_recover;
  52. }
  53. if (sense[0] & 0x08) { /* data check */
  54. if (sense[1] & 0x80) {
  55. return dasd_era_fatal;
  56. }
  57. return dasd_era_recover;
  58. }
  59. if (sense[0] & 0x04) { /* overrun */
  60. if (sense[1] & 0x80) {
  61. return dasd_era_fatal;
  62. }
  63. return dasd_era_recover;
  64. }
  65. if (sense[1] & 0x40) { /* invalid blocksize */
  66. return dasd_era_fatal;
  67. }
  68. if (sense[1] & 0x04) { /* file protected */
  69. return dasd_era_recover;
  70. }
  71. if (sense[1] & 0x01) { /* operation incomplete */
  72. return dasd_era_recover;
  73. }
  74. if (sense[2] & 0x80) { /* check data erroor */
  75. return dasd_era_recover;
  76. }
  77. if (sense[2] & 0x10) { /* Env. data present */
  78. return dasd_era_recover;
  79. }
  80. /* examine the 24 byte sense data */
  81. return dasd_era_recover;
  82. } /* END dasd_3370_erp_examine */
  83. /*
  84.  * Overrides for Emacs so that we follow Linus's tabbing style.
  85.  * Emacs will notice this stuff at the end of the file and automatically
  86.  * adjust the settings for this buffer only.  This must remain at the end
  87.  * of the file.
  88.  * ---------------------------------------------------------------------------
  89.  * Local variables:
  90.  * c-indent-level: 4 
  91.  * c-brace-imaginary-offset: 0
  92.  * c-brace-offset: -4
  93.  * c-argdecl-indent: 4
  94.  * c-label-offset: -4
  95.  * c-continued-statement-offset: 4
  96.  * c-continued-brace-offset: 0
  97.  * indent-tabs-mode: nil
  98.  * tab-width: 8
  99.  * End:
  100.  */