1
0

sg_err.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef SG_ERR_H
  2. #define SG_ERR_H
  3. /* Borrowed for the u3-tool project from: sg3_utils
  4. * see (http://sg.torque.net/sg/)
  5. */
  6. /* Feel free to copy and modify this GPL-ed code into your applications. */
  7. /* Version 0.84 (20010115)
  8. - all output now sent to stderr rather than stdout
  9. - remove header files included in this file
  10. */
  11. /* Some of the following error/status codes are exchanged between the
  12. various layers of the SCSI sub-system in Linux and should never
  13. reach the user. They are placed here for completeness. What appears
  14. here is copied from drivers/scsi/scsi.h which is not visible in
  15. the user space. */
  16. /* The following are 'host_status' codes */
  17. #ifndef DID_OK
  18. #define DID_OK 0x00
  19. #endif
  20. #ifndef DID_NO_CONNECT
  21. #define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */
  22. #define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */
  23. #define DID_TIME_OUT 0x03 /* Timed out for some other reason */
  24. #define DID_BAD_TARGET 0x04 /* Bad target (id?) */
  25. #define DID_ABORT 0x05 /* Told to abort for some other reason */
  26. #define DID_PARITY 0x06 /* Parity error (on SCSI bus) */
  27. #define DID_ERROR 0x07 /* Internal error */
  28. #define DID_RESET 0x08 /* Reset by somebody */
  29. #define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */
  30. #define DID_PASSTHROUGH 0x0a /* Force command past mid-level */
  31. #define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */
  32. #endif
  33. /* These defines are to isolate applictaions from kernel define changes */
  34. #define SG_ERR_DID_OK DID_OK
  35. #define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT
  36. #define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY
  37. #define SG_ERR_DID_TIME_OUT DID_TIME_OUT
  38. #define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET
  39. #define SG_ERR_DID_ABORT DID_ABORT
  40. #define SG_ERR_DID_PARITY DID_PARITY
  41. #define SG_ERR_DID_ERROR DID_ERROR
  42. #define SG_ERR_DID_RESET DID_RESET
  43. #define SG_ERR_DID_BAD_INTR DID_BAD_INTR
  44. #define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH
  45. #define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR
  46. /* The following are 'driver_status' codes */
  47. #ifndef DRIVER_OK
  48. #define DRIVER_OK 0x00
  49. #endif
  50. #ifndef DRIVER_BUSY
  51. #define DRIVER_BUSY 0x01
  52. #define DRIVER_SOFT 0x02
  53. #define DRIVER_MEDIA 0x03
  54. #define DRIVER_ERROR 0x04
  55. #define DRIVER_INVALID 0x05
  56. #define DRIVER_TIMEOUT 0x06
  57. #define DRIVER_HARD 0x07
  58. #define DRIVER_SENSE 0x08 /* Sense_buffer has been set */
  59. /* Following "suggests" are "or-ed" with one of previous 8 entries */
  60. #define SUGGEST_RETRY 0x10
  61. #define SUGGEST_ABORT 0x20
  62. #define SUGGEST_REMAP 0x30
  63. #define SUGGEST_DIE 0x40
  64. #define SUGGEST_SENSE 0x80
  65. #define SUGGEST_IS_OK 0xff
  66. #endif
  67. #ifndef DRIVER_MASK
  68. #define DRIVER_MASK 0x0f
  69. #endif
  70. #ifndef SUGGEST_MASK
  71. #define SUGGEST_MASK 0xf0
  72. #endif
  73. /* These defines are to isolate applictaions from kernel define changes */
  74. #define SG_ERR_DRIVER_OK DRIVER_OK
  75. #define SG_ERR_DRIVER_BUSY DRIVER_BUSY
  76. #define SG_ERR_DRIVER_SOFT DRIVER_SOFT
  77. #define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA
  78. #define SG_ERR_DRIVER_ERROR DRIVER_ERROR
  79. #define SG_ERR_DRIVER_INVALID DRIVER_INVALID
  80. #define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT
  81. #define SG_ERR_DRIVER_HARD DRIVER_HARD
  82. #define SG_ERR_DRIVER_SENSE DRIVER_SENSE
  83. #define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY
  84. #define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT
  85. #define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP
  86. #define SG_ERR_SUGGEST_DIE SUGGEST_DIE
  87. #define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE
  88. #define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK
  89. #define SG_ERR_DRIVER_MASK DRIVER_MASK
  90. #define SG_ERR_SUGGEST_MASK SUGGEST_MASK
  91. /* The following "category" function returns one of the following */
  92. #define SG_ERR_CAT_CLEAN 0 /* No errors or other information */
  93. #define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */
  94. #define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */
  95. #define SG_ERR_CAT_TIMEOUT 3
  96. #define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */
  97. #define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */
  98. #define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */
  99. #endif