cciss_defs.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef CCISS_DEFS_H
  2. #define CCISS_DEFS_H
  3. #include <linux/types.h>
  4. /* general boundary definitions */
  5. #define SENSEINFOBYTES 32 /* note that this value may vary
  6. between host implementations */
  7. /* Command Status value */
  8. #define CMD_SUCCESS 0x0000
  9. #define CMD_TARGET_STATUS 0x0001
  10. #define CMD_DATA_UNDERRUN 0x0002
  11. #define CMD_DATA_OVERRUN 0x0003
  12. #define CMD_INVALID 0x0004
  13. #define CMD_PROTOCOL_ERR 0x0005
  14. #define CMD_HARDWARE_ERR 0x0006
  15. #define CMD_CONNECTION_LOST 0x0007
  16. #define CMD_ABORTED 0x0008
  17. #define CMD_ABORT_FAILED 0x0009
  18. #define CMD_UNSOLICITED_ABORT 0x000A
  19. #define CMD_TIMEOUT 0x000B
  20. #define CMD_UNABORTABLE 0x000C
  21. /* transfer direction */
  22. #define XFER_NONE 0x00
  23. #define XFER_WRITE 0x01
  24. #define XFER_READ 0x02
  25. #define XFER_RSVD 0x03
  26. /* task attribute */
  27. #define ATTR_UNTAGGED 0x00
  28. #define ATTR_SIMPLE 0x04
  29. #define ATTR_HEADOFQUEUE 0x05
  30. #define ATTR_ORDERED 0x06
  31. #define ATTR_ACA 0x07
  32. /* cdb type */
  33. #define TYPE_CMD 0x00
  34. #define TYPE_MSG 0x01
  35. /* Type defs used in the following structs */
  36. #define BYTE __u8
  37. #define WORD __u16
  38. #define HWORD __u16
  39. #define DWORD __u32
  40. #define CISS_MAX_LUN 1024
  41. #define LEVEL2LUN 1 /* index into Target(x) structure, due to byte swapping */
  42. #define LEVEL3LUN 0
  43. #pragma pack(1)
  44. /* Command List Structure */
  45. typedef union _SCSI3Addr_struct {
  46. struct {
  47. BYTE Dev;
  48. BYTE Bus:6;
  49. BYTE Mode:2; /* b00 */
  50. } PeripDev;
  51. struct {
  52. BYTE DevLSB;
  53. BYTE DevMSB:6;
  54. BYTE Mode:2; /* b01 */
  55. } LogDev;
  56. struct {
  57. BYTE Dev:5;
  58. BYTE Bus:3;
  59. BYTE Targ:6;
  60. BYTE Mode:2; /* b10 */
  61. } LogUnit;
  62. } SCSI3Addr_struct;
  63. typedef struct _PhysDevAddr_struct {
  64. DWORD TargetId:24;
  65. DWORD Bus:6;
  66. DWORD Mode:2;
  67. SCSI3Addr_struct Target[2]; /* 2 level target device addr */
  68. } PhysDevAddr_struct;
  69. typedef struct _LogDevAddr_struct {
  70. DWORD VolId:30;
  71. DWORD Mode:2;
  72. BYTE reserved[4];
  73. } LogDevAddr_struct;
  74. typedef union _LUNAddr_struct {
  75. BYTE LunAddrBytes[8];
  76. SCSI3Addr_struct SCSI3Lun[4];
  77. PhysDevAddr_struct PhysDev;
  78. LogDevAddr_struct LogDev;
  79. } LUNAddr_struct;
  80. typedef struct _RequestBlock_struct {
  81. BYTE CDBLen;
  82. struct {
  83. BYTE Type:3;
  84. BYTE Attribute:3;
  85. BYTE Direction:2;
  86. } Type;
  87. HWORD Timeout;
  88. BYTE CDB[16];
  89. } RequestBlock_struct;
  90. typedef union _MoreErrInfo_struct{
  91. struct {
  92. BYTE Reserved[3];
  93. BYTE Type;
  94. DWORD ErrorInfo;
  95. } Common_Info;
  96. struct{
  97. BYTE Reserved[2];
  98. BYTE offense_size; /* size of offending entry */
  99. BYTE offense_num; /* byte # of offense 0-base */
  100. DWORD offense_value;
  101. } Invalid_Cmd;
  102. } MoreErrInfo_struct;
  103. typedef struct _ErrorInfo_struct {
  104. BYTE ScsiStatus;
  105. BYTE SenseLen;
  106. HWORD CommandStatus;
  107. DWORD ResidualCnt;
  108. MoreErrInfo_struct MoreErrInfo;
  109. BYTE SenseInfo[SENSEINFOBYTES];
  110. } ErrorInfo_struct;
  111. #pragma pack()
  112. #endif /* CCISS_DEFS_H */