1 #ifndef CCISS_IOCTLH 2 #define CCISS_IOCTLH 3 4 #include <linux/types.h> 5 #include <linux/ioctl.h> 6 7 #define CCISS_IOC_MAGIC 'B' 8 9 10 typedef struct _cciss_pci_info_struct 11 { 12 unsigned char bus; 13 unsigned char dev_fn; 14 __u32 board_id; 15 } cciss_pci_info_struct; 16 17 typedef struct _cciss_coalint_struct 18 { 19 __u32 delay; 20 __u32 count; 21 } cciss_coalint_struct; 22 23 typedef char NodeName_type[16]; 24 25 typedef __u32 Heartbeat_type; 26 27 #define CISS_PARSCSIU2 0x0001 28 #define CISS_PARCSCIU3 0x0002 29 #define CISS_FIBRE1G 0x0100 30 #define CISS_FIBRE2G 0x0200 31 typedef __u32 BusTypes_type; 32 33 typedef char FirmwareVer_type[4]; 34 typedef __u32 DriverVer_type; 35 36 37 #ifndef CCISS_CMD_H 38 // This defines are duplicated in cciss_cmd.h in the driver directory 39 40 //general boundary defintions 41 #define SENSEINFOBYTES 32//note that this value may vary between host implementations 42 43 //Command Status value 44 #define CMD_SUCCESS 0x0000 45 #define CMD_TARGET_STATUS 0x0001 46 #define CMD_DATA_UNDERRUN 0x0002 47 #define CMD_DATA_OVERRUN 0x0003 48 #define CMD_INVALID 0x0004 49 #define CMD_PROTOCOL_ERR 0x0005 50 #define CMD_HARDWARE_ERR 0x0006 51 #define CMD_CONNECTION_LOST 0x0007 52 #define CMD_ABORTED 0x0008 53 #define CMD_ABORT_FAILED 0x0009 54 #define CMD_UNSOLICITED_ABORT 0x000A 55 #define CMD_TIMEOUT 0x000B 56 #define CMD_UNABORTABLE 0x000C 57 58 //transfer direction 59 #define XFER_NONE 0x00 60 #define XFER_WRITE 0x01 61 #define XFER_READ 0x02 62 #define XFER_RSVD 0x03 63 64 //task attribute 65 #define ATTR_UNTAGGED 0x00 66 #define ATTR_SIMPLE 0x04 67 #define ATTR_HEADOFQUEUE 0x05 68 #define ATTR_ORDERED 0x06 69 #define ATTR_ACA 0x07 70 71 //cdb type 72 #define TYPE_CMD 0x00 73 #define TYPE_MSG 0x01 74 75 // Type defs used in the following structs 76 typedef __u8 BYTE; 77 typedef __u16 WORD; 78 typedef __u16 HWORD; 79 typedef __u32 DWORD; 80 81 #define CISS_MAX_LUN 16 82 83 #define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping 84 #define LEVEL3LUN 0 85 86 #pragma pack(1) 87 88 //Command List Structure 89 typedef union _SCSI3Addr_struct { 90 struct { 91 BYTE Dev; 92 BYTE Bus:6; 93 BYTE Mode:2; // b00 94 } PeripDev; 95 struct { 96 BYTE DevLSB; 97 BYTE DevMSB:6; 98 BYTE Mode:2; // b01 99 } LogDev; 100 struct { 101 BYTE Dev:5; 102 BYTE Bus:3; 103 BYTE Targ:6; 104 BYTE Mode:2; // b10 105 } LogUnit; 106 } SCSI3Addr_struct; 107 108 typedef struct _PhysDevAddr_struct { 109 DWORD TargetId:24; 110 DWORD Bus:6; 111 DWORD Mode:2; 112 SCSI3Addr_struct Target[2]; //2 level target device addr 113 } PhysDevAddr_struct; 114 115 typedef struct _LogDevAddr_struct { 116 DWORD VolId:30; 117 DWORD Mode:2; 118 BYTE reserved[4]; 119 } LogDevAddr_struct; 120 121 typedef union _LUNAddr_struct { 122 BYTE LunAddrBytes[8]; 123 SCSI3Addr_struct SCSI3Lun[4]; 124 PhysDevAddr_struct PhysDev; 125 LogDevAddr_struct LogDev; 126 } LUNAddr_struct; 127 128 typedef struct _RequestBlock_struct { 129 BYTE CDBLen; 130 struct { 131 BYTE Type:3; 132 BYTE Attribute:3; 133 BYTE Direction:2; 134 } Type; 135 HWORD Timeout; 136 BYTE CDB[16]; 137 } RequestBlock_struct; 138 139 typedef union _MoreErrInfo_struct{ 140 struct { 141 BYTE Reserved[3]; 142 BYTE Type; 143 DWORD ErrorInfo; 144 }Common_Info; 145 struct{ 146 BYTE Reserved[2]; 147 BYTE offense_size;//size of offending entry 148 BYTE offense_num; //byte # of offense 0-base 149 DWORD offense_value; 150 }Invalid_Cmd; 151 }MoreErrInfo_struct; 152 typedef struct _ErrorInfo_struct { 153 BYTE ScsiStatus; 154 BYTE SenseLen; 155 HWORD CommandStatus; 156 DWORD ResidualCnt; 157 MoreErrInfo_struct MoreErrInfo; 158 BYTE SenseInfo[SENSEINFOBYTES]; 159 } ErrorInfo_struct; 160 161 #pragma pack() 162 #endif /* CCISS_CMD_H */ 163 164 typedef struct _IOCTL_Command_struct { 165 LUNAddr_struct LUN_info; 166 RequestBlock_struct Request; 167 ErrorInfo_struct error_info; 168 WORD buf_size; /* size in bytes of the buf */ 169 BYTE *buf; 170 } IOCTL_Command_struct; 171 172 #define MAX_KMALLOC_SIZE 128000 173 174 typedef struct _BIG_IOCTL_Command_struct { 175 LUNAddr_struct LUN_info; 176 RequestBlock_struct Request; 177 ErrorInfo_struct error_info; 178 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ 179 DWORD buf_size; /* size in bytes of the buf */ 180 /* < malloc_size * MAXSGENTRIES */ 181 BYTE *buf; 182 } BIG_IOCTL_Command_struct; 183 184 typedef struct _LogvolInfo_struct{ 185 __u32 LunID; 186 int num_opens; /* number of opens on the logical volume */ 187 int num_parts; /* number of partitions configured on logvol */ 188 } LogvolInfo_struct; 189 190 #define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct) 191 192 #define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct) 193 #define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct) 194 195 #define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type) 196 #define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type) 197 198 #define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type) 199 #define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type) 200 #define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type) 201 #define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type) 202 #define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10) /* obsolete */ 203 #define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct) 204 #define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12) 205 #define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, __u64) 206 #define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14) 207 #define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16) 208 #define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct) 209 #define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct) 210 211 #ifdef __KERNEL__ 212 #ifdef __x86_64__ 213 214 /* 32 bit compatible ioctl structs */ 215 typedef struct _IOCTL32_Command_struct { 216 LUNAddr_struct LUN_info; 217 RequestBlock_struct Request; 218 ErrorInfo_struct error_info; 219 WORD buf_size; /* size in bytes of the buf */ 220 __u32 buf; /* 32 bit pointer to data buffer */ 221 } IOCTL32_Command_struct; 222 223 typedef struct _BIG_IOCTL32_Command_struct { 224 LUNAddr_struct LUN_info; 225 RequestBlock_struct Request; 226 ErrorInfo_struct error_info; 227 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */ 228 DWORD buf_size; /* size in bytes of the buf */ 229 /* < malloc_size * MAXSGENTRIES */ 230 __u32 buf; /* 32 bit pointer to data buffer */ 231 } BIG_IOCTL32_Command_struct; 232 233 #define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct) 234 #define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct) 235 236 #endif /* __x86_64__ */ 237 #endif /* __KERNEL__ */ 238 #endif 239