cciss_defs.h 3.2 KB

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