1 #ifndef CCISS_CMD_H 2 #define CCISS_CMD_H 3 /* ########################################################################## */ 4 /* DEFINES */ 5 /* ########################################################################## */ 6 #define CISS_VERSION "1.00" 7 8 /* general boundary defintions */ 9 #define SENSEINFOBYTES 32 /* note that this value may vary */ 10 /* between host implementations */ 11 #define MAXSGENTRIES 31 12 #define MAXREPLYQS 256 13 14 /* Command Status value */ 15 #define CMD_SUCCESS 0x0000 16 #define CMD_TARGET_STATUS 0x0001 17 #define CMD_DATA_UNDERRUN 0x0002 18 #define CMD_DATA_OVERRUN 0x0003 19 #define CMD_INVALID 0x0004 20 #define CMD_PROTOCOL_ERR 0x0005 21 #define CMD_HARDWARE_ERR 0x0006 22 #define CMD_CONNECTION_LOST 0x0007 23 #define CMD_ABORTED 0x0008 24 #define CMD_ABORT_FAILED 0x0009 25 #define CMD_UNSOLICITED_ABORT 0x000A 26 #define CMD_TIMEOUT 0x000B 27 #define CMD_UNABORTABLE 0x000C 28 29 /* transfer direction */ 30 #define XFER_NONE 0x00 31 #define XFER_WRITE 0x01 32 #define XFER_READ 0x02 33 #define XFER_RSVD 0x03 34 35 /* task attribute */ 36 #define ATTR_UNTAGGED 0x00 37 #define ATTR_SIMPLE 0x04 38 #define ATTR_HEADOFQUEUE 0x05 39 #define ATTR_ORDERED 0x06 40 #define ATTR_ACA 0x07 41 42 /* cdb type */ 43 #define TYPE_CMD 0x00 44 #define TYPE_MSG 0x01 45 46 /* config space register offsets */ 47 #define CFG_VENDORID 0x00 48 #define CFG_DEVICEID 0x02 49 #define CFG_I2OBAR 0x10 50 #define CFG_MEM1BAR 0x14 51 52 /* i2o space register offsets */ 53 #define I2O_IBDB_SET 0x20 54 #define I2O_IBDB_CLEAR 0x70 55 #define I2O_INT_STATUS 0x30 56 #define I2O_INT_MASK 0x34 57 #define I2O_IBPOST_Q 0x40 58 #define I2O_OBPOST_Q 0x44 59 60 /* Configuration Table */ 61 #define CFGTBL_ChangeReq 0x00000001l 62 #define CFGTBL_AccCmds 0x00000001l 63 64 #define CFGTBL_Trans_Simple 0x00000002l 65 66 #define CFGTBL_BusType_Ultra2 0x00000001l 67 #define CFGTBL_BusType_Ultra3 0x00000002l 68 #define CFGTBL_BusType_Fibre1G 0x00000100l 69 #define CFGTBL_BusType_Fibre2G 0x00000200l 70 typedef struct _vals32 71 { 72 __u32 lower; 73 __u32 upper; 74 } vals32; 75 76 typedef union _u64bit 77 { 78 vals32 val32; 79 __u64 val; 80 } u64bit; 81 82 /* Type defs used in the following structs */ 83 typedef __u8 BYTE; 84 typedef __u16 WORD; 85 typedef __u16 HWORD; 86 typedef __u32 DWORD; 87 typedef vals32 QWORD; 88 89 /* ######################################################################### */ 90 /* STRUCTURES */ 91 /* ######################################################################### */ 92 #define CISS_MAX_LUN 16 93 #define CISS_MAX_PHYS_LUN 1024 94 /* SCSI-3 Cmmands */ 95 96 #pragma pack(1) 97 98 #define CISS_INQUIRY 0x12 99 /* Data returned */ 100 typedef struct _InquiryData_struct 101 { 102 BYTE data_byte[36]; 103 } InquiryData_struct; 104 105 #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ 106 #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ 107 /* Data returned */ 108 typedef struct _ReportLUNdata_struct 109 { 110 BYTE LUNListLength[4]; 111 DWORD reserved; 112 BYTE LUN[CISS_MAX_LUN][8]; 113 } ReportLunData_struct; 114 115 #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ 116 typedef struct _ReadCapdata_struct 117 { 118 BYTE total_size[4]; /* Total size in blocks */ 119 BYTE block_size[4]; /* Size of blocks in bytes */ 120 } ReadCapdata_struct; 121 122 /* 12 byte commands not implemented in firmware yet. */ 123 /* #define CCISS_READ 0xa8 Read(12) */ 124 /* #define CCISS_WRITE 0xaa Write(12) */ 125 #define CCISS_READ 0x28 /* Read(10) */ 126 #define CCISS_WRITE 0x2a /* Write(10) */ 127 128 /* BMIC commands */ 129 #define BMIC_READ 0x26 130 #define BMIC_WRITE 0x27 131 #define BMIC_CACHE_FLUSH 0xc2 132 #define CCISS_CACHE_FLUSH 0x01 /* 0xC2 was already being used by CCISS */ 133 134 /* Command List Structure */ 135 typedef union _SCSI3Addr_struct { 136 struct { 137 BYTE Dev; 138 BYTE Bus:6; 139 BYTE Mode:2; /* b00 */ 140 } PeripDev; 141 struct { 142 BYTE DevLSB; 143 BYTE DevMSB:6; 144 BYTE Mode:2; /* b01 */ 145 } LogDev; 146 struct { 147 BYTE Dev:5; 148 BYTE Bus:3; 149 BYTE Targ:6; 150 BYTE Mode:2; /* b10 */ 151 } LogUnit; 152 } SCSI3Addr_struct; 153 154 typedef struct _PhysDevAddr_struct { 155 DWORD TargetId:24; 156 DWORD Bus:6; 157 DWORD Mode:2; 158 SCSI3Addr_struct Target[2]; /* 2 level target device addr */ 159 } PhysDevAddr_struct; 160 161 typedef struct _LogDevAddr_struct { 162 DWORD VolId:30; 163 DWORD Mode:2; 164 BYTE reserved[4]; 165 } LogDevAddr_struct; 166 167 typedef union _LUNAddr_struct { 168 BYTE LunAddrBytes[8]; 169 SCSI3Addr_struct SCSI3Lun[4]; 170 PhysDevAddr_struct PhysDev; 171 LogDevAddr_struct LogDev; 172 } LUNAddr_struct; 173 174 typedef struct _CommandListHeader_struct { 175 BYTE ReplyQueue; 176 BYTE SGList; 177 HWORD SGTotal; 178 QWORD Tag; 179 LUNAddr_struct LUN; 180 } CommandListHeader_struct; 181 typedef struct _RequestBlock_struct { 182 BYTE CDBLen; 183 struct { 184 BYTE Type:3; 185 BYTE Attribute:3; 186 BYTE Direction:2; 187 } Type; 188 HWORD Timeout; 189 BYTE CDB[16]; 190 } RequestBlock_struct; 191 typedef struct _ErrDescriptor_struct { 192 QWORD Addr; 193 DWORD Len; 194 } ErrDescriptor_struct; 195 typedef struct _SGDescriptor_struct { 196 QWORD Addr; 197 DWORD Len; 198 DWORD Ext; 199 } SGDescriptor_struct; 200 201 typedef union _MoreErrInfo_struct{ 202 struct { 203 BYTE Reserved[3]; 204 BYTE Type; 205 DWORD ErrorInfo; 206 }Common_Info; 207 struct{ 208 BYTE Reserved[2]; 209 BYTE offense_size; /* size of offending entry */ 210 BYTE offense_num; /* byte # of offense 0-base */ 211 DWORD offense_value; 212 }Invalid_Cmd; 213 }MoreErrInfo_struct; 214 typedef struct _ErrorInfo_struct { 215 BYTE ScsiStatus; 216 BYTE SenseLen; 217 HWORD CommandStatus; 218 DWORD ResidualCnt; 219 MoreErrInfo_struct MoreErrInfo; 220 BYTE SenseInfo[SENSEINFOBYTES]; 221 } ErrorInfo_struct; 222 223 /* Command types */ 224 #define CMD_RWREQ 0x00 225 #define CMD_IOCTL_PEND 0x01 226 #define CMD_SCSI 0x03 227 #define CMD_MSG_DONE 0x04 228 #define CMD_MSG_TIMEOUT 0x05 229 230 typedef struct _CommandList_struct { 231 CommandListHeader_struct Header; 232 RequestBlock_struct Request; 233 ErrDescriptor_struct ErrDesc; 234 SGDescriptor_struct SG[MAXSGENTRIES]; 235 /* information associated with the command */ 236 __u32 busaddr; /* physical address of this record */ 237 ErrorInfo_struct * err_info; /* pointer to the allocated mem */ 238 int ctlr; 239 int cmd_type; 240 struct _CommandList_struct *prev; 241 struct _CommandList_struct *next; 242 struct request * rq; 243 struct completion *waiting; 244 int retry_count; 245 #ifdef CONFIG_CISS_SCSI_TAPE 246 void * scsi_cmd; 247 #endif 248 } CommandList_struct; 249 250 /* Configuration Table Structure */ 251 typedef struct _HostWrite_struct { 252 DWORD TransportRequest; 253 DWORD Reserved; 254 DWORD CoalIntDelay; 255 DWORD CoalIntCount; 256 } HostWrite_struct; 257 258 typedef struct _CfgTable_struct { 259 BYTE Signature[4]; 260 DWORD SpecValence; 261 DWORD TransportSupport; 262 DWORD TransportActive; 263 HostWrite_struct HostWrite; 264 DWORD CmdsOutMax; 265 DWORD BusTypes; 266 DWORD Reserved; 267 BYTE ServerName[16]; 268 DWORD HeartBeat; 269 DWORD SCSI_Prefetch; 270 } CfgTable_struct; 271 #pragma pack() 272 #endif /* CCISS_CMD_H */ 273