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