hpsa_cmd.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*
  2. * Disk Array driver for HP Smart Array SAS controllers
  3. * Copyright 2000, 2014 Hewlett-Packard Development Company, L.P.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; version 2 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  12. * NON INFRINGEMENT. See the GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. *
  18. * Questions/Comments/Bugfixes to iss_storagedev@hp.com
  19. *
  20. */
  21. #ifndef HPSA_CMD_H
  22. #define HPSA_CMD_H
  23. /* general boundary defintions */
  24. #define SENSEINFOBYTES 32 /* may vary between hbas */
  25. #define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */
  26. #define HPSA_SG_CHAIN 0x80000000
  27. #define HPSA_SG_LAST 0x40000000
  28. #define MAXREPLYQS 256
  29. /* Command Status value */
  30. #define CMD_SUCCESS 0x0000
  31. #define CMD_TARGET_STATUS 0x0001
  32. #define CMD_DATA_UNDERRUN 0x0002
  33. #define CMD_DATA_OVERRUN 0x0003
  34. #define CMD_INVALID 0x0004
  35. #define CMD_PROTOCOL_ERR 0x0005
  36. #define CMD_HARDWARE_ERR 0x0006
  37. #define CMD_CONNECTION_LOST 0x0007
  38. #define CMD_ABORTED 0x0008
  39. #define CMD_ABORT_FAILED 0x0009
  40. #define CMD_UNSOLICITED_ABORT 0x000A
  41. #define CMD_TIMEOUT 0x000B
  42. #define CMD_UNABORTABLE 0x000C
  43. #define CMD_IOACCEL_DISABLED 0x000E
  44. /* Unit Attentions ASC's as defined for the MSA2012sa */
  45. #define POWER_OR_RESET 0x29
  46. #define STATE_CHANGED 0x2a
  47. #define UNIT_ATTENTION_CLEARED 0x2f
  48. #define LUN_FAILED 0x3e
  49. #define REPORT_LUNS_CHANGED 0x3f
  50. /* Unit Attentions ASCQ's as defined for the MSA2012sa */
  51. /* These ASCQ's defined for ASC = POWER_OR_RESET */
  52. #define POWER_ON_RESET 0x00
  53. #define POWER_ON_REBOOT 0x01
  54. #define SCSI_BUS_RESET 0x02
  55. #define MSA_TARGET_RESET 0x03
  56. #define CONTROLLER_FAILOVER 0x04
  57. #define TRANSCEIVER_SE 0x05
  58. #define TRANSCEIVER_LVD 0x06
  59. /* These ASCQ's defined for ASC = STATE_CHANGED */
  60. #define RESERVATION_PREEMPTED 0x03
  61. #define ASYM_ACCESS_CHANGED 0x06
  62. #define LUN_CAPACITY_CHANGED 0x09
  63. /* transfer direction */
  64. #define XFER_NONE 0x00
  65. #define XFER_WRITE 0x01
  66. #define XFER_READ 0x02
  67. #define XFER_RSVD 0x03
  68. /* task attribute */
  69. #define ATTR_UNTAGGED 0x00
  70. #define ATTR_SIMPLE 0x04
  71. #define ATTR_HEADOFQUEUE 0x05
  72. #define ATTR_ORDERED 0x06
  73. #define ATTR_ACA 0x07
  74. /* cdb type */
  75. #define TYPE_CMD 0x00
  76. #define TYPE_MSG 0x01
  77. #define TYPE_IOACCEL2_CMD 0x81 /* 0x81 is not used by hardware */
  78. /* Message Types */
  79. #define HPSA_TASK_MANAGEMENT 0x00
  80. #define HPSA_RESET 0x01
  81. #define HPSA_SCAN 0x02
  82. #define HPSA_NOOP 0x03
  83. #define HPSA_CTLR_RESET_TYPE 0x00
  84. #define HPSA_BUS_RESET_TYPE 0x01
  85. #define HPSA_TARGET_RESET_TYPE 0x03
  86. #define HPSA_LUN_RESET_TYPE 0x04
  87. #define HPSA_NEXUS_RESET_TYPE 0x05
  88. /* Task Management Functions */
  89. #define HPSA_TMF_ABORT_TASK 0x00
  90. #define HPSA_TMF_ABORT_TASK_SET 0x01
  91. #define HPSA_TMF_CLEAR_ACA 0x02
  92. #define HPSA_TMF_CLEAR_TASK_SET 0x03
  93. #define HPSA_TMF_QUERY_TASK 0x04
  94. #define HPSA_TMF_QUERY_TASK_SET 0x05
  95. #define HPSA_TMF_QUERY_ASYNCEVENT 0x06
  96. /* config space register offsets */
  97. #define CFG_VENDORID 0x00
  98. #define CFG_DEVICEID 0x02
  99. #define CFG_I2OBAR 0x10
  100. #define CFG_MEM1BAR 0x14
  101. /* i2o space register offsets */
  102. #define I2O_IBDB_SET 0x20
  103. #define I2O_IBDB_CLEAR 0x70
  104. #define I2O_INT_STATUS 0x30
  105. #define I2O_INT_MASK 0x34
  106. #define I2O_IBPOST_Q 0x40
  107. #define I2O_OBPOST_Q 0x44
  108. #define I2O_DMA1_CFG 0x214
  109. /* Configuration Table */
  110. #define CFGTBL_ChangeReq 0x00000001l
  111. #define CFGTBL_AccCmds 0x00000001l
  112. #define DOORBELL_CTLR_RESET 0x00000004l
  113. #define DOORBELL_CTLR_RESET2 0x00000020l
  114. #define DOORBELL_CLEAR_EVENTS 0x00000040l
  115. #define CFGTBL_Trans_Simple 0x00000002l
  116. #define CFGTBL_Trans_Performant 0x00000004l
  117. #define CFGTBL_Trans_io_accel1 0x00000080l
  118. #define CFGTBL_Trans_io_accel2 0x00000100l
  119. #define CFGTBL_Trans_use_short_tags 0x20000000l
  120. #define CFGTBL_Trans_enable_directed_msix (1 << 30)
  121. #define CFGTBL_BusType_Ultra2 0x00000001l
  122. #define CFGTBL_BusType_Ultra3 0x00000002l
  123. #define CFGTBL_BusType_Fibre1G 0x00000100l
  124. #define CFGTBL_BusType_Fibre2G 0x00000200l
  125. /* VPD Inquiry types */
  126. #define HPSA_VPD_SUPPORTED_PAGES 0x00
  127. #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1
  128. #define HPSA_VPD_LV_IOACCEL_STATUS 0xC2
  129. #define HPSA_VPD_LV_STATUS 0xC3
  130. #define HPSA_VPD_HEADER_SZ 4
  131. /* Logical volume states */
  132. #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff
  133. #define HPSA_LV_OK 0x0
  134. #define HPSA_LV_UNDERGOING_ERASE 0x0F
  135. #define HPSA_LV_UNDERGOING_RPI 0x12
  136. #define HPSA_LV_PENDING_RPI 0x13
  137. #define HPSA_LV_ENCRYPTED_NO_KEY 0x14
  138. #define HPSA_LV_PLAINTEXT_IN_ENCRYPT_ONLY_CONTROLLER 0x15
  139. #define HPSA_LV_UNDERGOING_ENCRYPTION 0x16
  140. #define HPSA_LV_UNDERGOING_ENCRYPTION_REKEYING 0x17
  141. #define HPSA_LV_ENCRYPTED_IN_NON_ENCRYPTED_CONTROLLER 0x18
  142. #define HPSA_LV_PENDING_ENCRYPTION 0x19
  143. #define HPSA_LV_PENDING_ENCRYPTION_REKEYING 0x1A
  144. struct vals32 {
  145. u32 lower;
  146. u32 upper;
  147. };
  148. union u64bit {
  149. struct vals32 val32;
  150. u64 val;
  151. };
  152. /* FIXME this is a per controller value (barf!) */
  153. #define HPSA_MAX_LUN 1024
  154. #define HPSA_MAX_PHYS_LUN 1024
  155. #define MAX_EXT_TARGETS 32
  156. #define HPSA_MAX_DEVICES (HPSA_MAX_PHYS_LUN + HPSA_MAX_LUN + \
  157. MAX_EXT_TARGETS + 1) /* + 1 is for the controller itself */
  158. /* SCSI-3 Commands */
  159. #pragma pack(1)
  160. #define HPSA_INQUIRY 0x12
  161. struct InquiryData {
  162. u8 data_byte[36];
  163. };
  164. #define HPSA_REPORT_LOG 0xc2 /* Report Logical LUNs */
  165. #define HPSA_REPORT_PHYS 0xc3 /* Report Physical LUNs */
  166. #define HPSA_REPORT_PHYS_EXTENDED 0x02
  167. #define HPSA_CISS_READ 0xc0 /* CISS Read */
  168. #define HPSA_GET_RAID_MAP 0xc8 /* CISS Get RAID Layout Map */
  169. #define RAID_MAP_MAX_ENTRIES 256
  170. struct raid_map_disk_data {
  171. u32 ioaccel_handle; /**< Handle to access this disk via the
  172. * I/O accelerator */
  173. u8 xor_mult[2]; /**< XOR multipliers for this position,
  174. * valid for data disks only */
  175. u8 reserved[2];
  176. };
  177. struct raid_map_data {
  178. u32 structure_size; /* Size of entire structure in bytes */
  179. u32 volume_blk_size; /* bytes / block in the volume */
  180. u64 volume_blk_cnt; /* logical blocks on the volume */
  181. u8 phys_blk_shift; /* Shift factor to convert between
  182. * units of logical blocks and physical
  183. * disk blocks */
  184. u8 parity_rotation_shift; /* Shift factor to convert between units
  185. * of logical stripes and physical
  186. * stripes */
  187. u16 strip_size; /* blocks used on each disk / stripe */
  188. u64 disk_starting_blk; /* First disk block used in volume */
  189. u64 disk_blk_cnt; /* disk blocks used by volume / disk */
  190. u16 data_disks_per_row; /* data disk entries / row in the map */
  191. u16 metadata_disks_per_row; /* mirror/parity disk entries / row
  192. * in the map */
  193. u16 row_cnt; /* rows in each layout map */
  194. u16 layout_map_count; /* layout maps (1 map per mirror/parity
  195. * group) */
  196. u16 flags; /* Bit 0 set if encryption enabled */
  197. #define RAID_MAP_FLAG_ENCRYPT_ON 0x01
  198. u16 dekindex; /* Data encryption key index. */
  199. u8 reserved[16];
  200. struct raid_map_disk_data data[RAID_MAP_MAX_ENTRIES];
  201. };
  202. struct ReportLUNdata {
  203. u8 LUNListLength[4];
  204. u8 extended_response_flag;
  205. u8 reserved[3];
  206. u8 LUN[HPSA_MAX_LUN][8];
  207. };
  208. struct ext_report_lun_entry {
  209. u8 lunid[8];
  210. u8 wwid[8];
  211. u8 device_type;
  212. u8 device_flags;
  213. u8 lun_count; /* multi-lun device, how many luns */
  214. u8 redundant_paths;
  215. u32 ioaccel_handle; /* ioaccel1 only uses lower 16 bits */
  216. };
  217. struct ReportExtendedLUNdata {
  218. u8 LUNListLength[4];
  219. u8 extended_response_flag;
  220. u8 reserved[3];
  221. struct ext_report_lun_entry LUN[HPSA_MAX_LUN];
  222. };
  223. struct SenseSubsystem_info {
  224. u8 reserved[36];
  225. u8 portname[8];
  226. u8 reserved1[1108];
  227. };
  228. /* BMIC commands */
  229. #define BMIC_READ 0x26
  230. #define BMIC_WRITE 0x27
  231. #define BMIC_CACHE_FLUSH 0xc2
  232. #define HPSA_CACHE_FLUSH 0x01 /* C2 was already being used by HPSA */
  233. #define BMIC_FLASH_FIRMWARE 0xF7
  234. #define BMIC_SENSE_CONTROLLER_PARAMETERS 0x64
  235. /* Command List Structure */
  236. union SCSI3Addr {
  237. struct {
  238. u8 Dev;
  239. u8 Bus:6;
  240. u8 Mode:2; /* b00 */
  241. } PeripDev;
  242. struct {
  243. u8 DevLSB;
  244. u8 DevMSB:6;
  245. u8 Mode:2; /* b01 */
  246. } LogDev;
  247. struct {
  248. u8 Dev:5;
  249. u8 Bus:3;
  250. u8 Targ:6;
  251. u8 Mode:2; /* b10 */
  252. } LogUnit;
  253. };
  254. struct PhysDevAddr {
  255. u32 TargetId:24;
  256. u32 Bus:6;
  257. u32 Mode:2;
  258. /* 2 level target device addr */
  259. union SCSI3Addr Target[2];
  260. };
  261. struct LogDevAddr {
  262. u32 VolId:30;
  263. u32 Mode:2;
  264. u8 reserved[4];
  265. };
  266. union LUNAddr {
  267. u8 LunAddrBytes[8];
  268. union SCSI3Addr SCSI3Lun[4];
  269. struct PhysDevAddr PhysDev;
  270. struct LogDevAddr LogDev;
  271. };
  272. struct CommandListHeader {
  273. u8 ReplyQueue;
  274. u8 SGList;
  275. u16 SGTotal;
  276. struct vals32 Tag;
  277. union LUNAddr LUN;
  278. };
  279. struct RequestBlock {
  280. u8 CDBLen;
  281. struct {
  282. u8 Type:3;
  283. u8 Attribute:3;
  284. u8 Direction:2;
  285. } Type;
  286. u16 Timeout;
  287. u8 CDB[16];
  288. };
  289. struct ErrDescriptor {
  290. struct vals32 Addr;
  291. u32 Len;
  292. };
  293. struct SGDescriptor {
  294. struct vals32 Addr;
  295. u32 Len;
  296. u32 Ext;
  297. };
  298. union MoreErrInfo {
  299. struct {
  300. u8 Reserved[3];
  301. u8 Type;
  302. u32 ErrorInfo;
  303. } Common_Info;
  304. struct {
  305. u8 Reserved[2];
  306. u8 offense_size; /* size of offending entry */
  307. u8 offense_num; /* byte # of offense 0-base */
  308. u32 offense_value;
  309. } Invalid_Cmd;
  310. };
  311. struct ErrorInfo {
  312. u8 ScsiStatus;
  313. u8 SenseLen;
  314. u16 CommandStatus;
  315. u32 ResidualCnt;
  316. union MoreErrInfo MoreErrInfo;
  317. u8 SenseInfo[SENSEINFOBYTES];
  318. };
  319. /* Command types */
  320. #define CMD_IOCTL_PEND 0x01
  321. #define CMD_SCSI 0x03
  322. #define CMD_IOACCEL1 0x04
  323. #define CMD_IOACCEL2 0x05
  324. #define DIRECT_LOOKUP_SHIFT 5
  325. #define DIRECT_LOOKUP_BIT 0x10
  326. #define DIRECT_LOOKUP_MASK (~((1 << DIRECT_LOOKUP_SHIFT) - 1))
  327. #define HPSA_ERROR_BIT 0x02
  328. struct ctlr_info; /* defined in hpsa.h */
  329. /* The size of this structure needs to be divisible by 32
  330. * on all architectures because low 5 bits of the addresses
  331. * are used as follows:
  332. *
  333. * bit 0: to device, used to indicate "performant mode" command
  334. * from device, indidcates error status.
  335. * bit 1-3: to device, indicates block fetch table entry for
  336. * reducing DMA in fetching commands from host memory.
  337. * bit 4: used to indicate whether tag is "direct lookup" (index),
  338. * or a bus address.
  339. */
  340. #define COMMANDLIST_ALIGNMENT 128
  341. struct CommandList {
  342. struct CommandListHeader Header;
  343. struct RequestBlock Request;
  344. struct ErrDescriptor ErrDesc;
  345. struct SGDescriptor SG[SG_ENTRIES_IN_CMD];
  346. /* information associated with the command */
  347. u32 busaddr; /* physical addr of this record */
  348. struct ErrorInfo *err_info; /* pointer to the allocated mem */
  349. struct ctlr_info *h;
  350. int cmd_type;
  351. long cmdindex;
  352. struct list_head list;
  353. struct completion *waiting;
  354. void *scsi_cmd;
  355. } __aligned(COMMANDLIST_ALIGNMENT);
  356. /* Max S/G elements in I/O accelerator command */
  357. #define IOACCEL1_MAXSGENTRIES 24
  358. #define IOACCEL2_MAXSGENTRIES 28
  359. /*
  360. * Structure for I/O accelerator (mode 1) commands.
  361. * Note that this structure must be 128-byte aligned in size.
  362. */
  363. #define IOACCEL1_COMMANDLIST_ALIGNMENT 128
  364. struct io_accel1_cmd {
  365. u16 dev_handle; /* 0x00 - 0x01 */
  366. u8 reserved1; /* 0x02 */
  367. u8 function; /* 0x03 */
  368. u8 reserved2[8]; /* 0x04 - 0x0B */
  369. u32 err_info; /* 0x0C - 0x0F */
  370. u8 reserved3[2]; /* 0x10 - 0x11 */
  371. u8 err_info_len; /* 0x12 */
  372. u8 reserved4; /* 0x13 */
  373. u8 sgl_offset; /* 0x14 */
  374. u8 reserved5[7]; /* 0x15 - 0x1B */
  375. u32 transfer_len; /* 0x1C - 0x1F */
  376. u8 reserved6[4]; /* 0x20 - 0x23 */
  377. u16 io_flags; /* 0x24 - 0x25 */
  378. u8 reserved7[14]; /* 0x26 - 0x33 */
  379. u8 LUN[8]; /* 0x34 - 0x3B */
  380. u32 control; /* 0x3C - 0x3F */
  381. u8 CDB[16]; /* 0x40 - 0x4F */
  382. u8 reserved8[16]; /* 0x50 - 0x5F */
  383. u16 host_context_flags; /* 0x60 - 0x61 */
  384. u16 timeout_sec; /* 0x62 - 0x63 */
  385. u8 ReplyQueue; /* 0x64 */
  386. u8 reserved9[3]; /* 0x65 - 0x67 */
  387. struct vals32 Tag; /* 0x68 - 0x6F */
  388. struct vals32 host_addr; /* 0x70 - 0x77 */
  389. u8 CISS_LUN[8]; /* 0x78 - 0x7F */
  390. struct SGDescriptor SG[IOACCEL1_MAXSGENTRIES];
  391. } __aligned(IOACCEL1_COMMANDLIST_ALIGNMENT);
  392. #define IOACCEL1_FUNCTION_SCSIIO 0x00
  393. #define IOACCEL1_SGLOFFSET 32
  394. #define IOACCEL1_IOFLAGS_IO_REQ 0x4000
  395. #define IOACCEL1_IOFLAGS_CDBLEN_MASK 0x001F
  396. #define IOACCEL1_IOFLAGS_CDBLEN_MAX 16
  397. #define IOACCEL1_CONTROL_NODATAXFER 0x00000000
  398. #define IOACCEL1_CONTROL_DATA_OUT 0x01000000
  399. #define IOACCEL1_CONTROL_DATA_IN 0x02000000
  400. #define IOACCEL1_CONTROL_TASKPRIO_MASK 0x00007800
  401. #define IOACCEL1_CONTROL_TASKPRIO_SHIFT 11
  402. #define IOACCEL1_CONTROL_SIMPLEQUEUE 0x00000000
  403. #define IOACCEL1_CONTROL_HEADOFQUEUE 0x00000100
  404. #define IOACCEL1_CONTROL_ORDEREDQUEUE 0x00000200
  405. #define IOACCEL1_CONTROL_ACA 0x00000400
  406. #define IOACCEL1_HCFLAGS_CISS_FORMAT 0x0013
  407. #define IOACCEL1_BUSADDR_CMDTYPE 0x00000060
  408. struct ioaccel2_sg_element {
  409. u64 address;
  410. u32 length;
  411. u8 reserved[3];
  412. u8 chain_indicator;
  413. #define IOACCEL2_CHAIN 0x80
  414. };
  415. /*
  416. * SCSI Response Format structure for IO Accelerator Mode 2
  417. */
  418. struct io_accel2_scsi_response {
  419. u8 IU_type;
  420. #define IOACCEL2_IU_TYPE_SRF 0x60
  421. u8 reserved1[3];
  422. u8 req_id[4]; /* request identifier */
  423. u8 reserved2[4];
  424. u8 serv_response; /* service response */
  425. #define IOACCEL2_SERV_RESPONSE_COMPLETE 0x000
  426. #define IOACCEL2_SERV_RESPONSE_FAILURE 0x001
  427. #define IOACCEL2_SERV_RESPONSE_TMF_COMPLETE 0x002
  428. #define IOACCEL2_SERV_RESPONSE_TMF_SUCCESS 0x003
  429. #define IOACCEL2_SERV_RESPONSE_TMF_REJECTED 0x004
  430. #define IOACCEL2_SERV_RESPONSE_TMF_WRONG_LUN 0x005
  431. u8 status; /* status */
  432. #define IOACCEL2_STATUS_SR_TASK_COMP_GOOD 0x00
  433. #define IOACCEL2_STATUS_SR_TASK_COMP_CHK_COND 0x02
  434. #define IOACCEL2_STATUS_SR_TASK_COMP_BUSY 0x08
  435. #define IOACCEL2_STATUS_SR_TASK_COMP_RES_CON 0x18
  436. #define IOACCEL2_STATUS_SR_TASK_COMP_SET_FULL 0x28
  437. #define IOACCEL2_STATUS_SR_TASK_COMP_ABORTED 0x40
  438. #define IOACCEL2_STATUS_SR_IOACCEL_DISABLED 0x0E
  439. u8 data_present; /* low 2 bits */
  440. #define IOACCEL2_NO_DATAPRESENT 0x000
  441. #define IOACCEL2_RESPONSE_DATAPRESENT 0x001
  442. #define IOACCEL2_SENSE_DATA_PRESENT 0x002
  443. #define IOACCEL2_RESERVED 0x003
  444. u8 sense_data_len; /* sense/response data length */
  445. u8 resid_cnt[4]; /* residual count */
  446. u8 sense_data_buff[32]; /* sense/response data buffer */
  447. };
  448. /*
  449. * Structure for I/O accelerator (mode 2 or m2) commands.
  450. * Note that this structure must be 128-byte aligned in size.
  451. */
  452. #define IOACCEL2_COMMANDLIST_ALIGNMENT 128
  453. struct io_accel2_cmd {
  454. u8 IU_type; /* IU Type */
  455. u8 direction; /* direction, memtype, and encryption */
  456. #define IOACCEL2_DIRECTION_MASK 0x03 /* bits 0,1: direction */
  457. #define IOACCEL2_DIRECTION_MEMTYPE_MASK 0x04 /* bit 2: memtype source/dest */
  458. /* 0b=PCIe, 1b=DDR */
  459. #define IOACCEL2_DIRECTION_ENCRYPT_MASK 0x08 /* bit 3: encryption flag */
  460. /* 0=off, 1=on */
  461. u8 reply_queue; /* Reply Queue ID */
  462. u8 reserved1; /* Reserved */
  463. u32 scsi_nexus; /* Device Handle */
  464. u32 Tag; /* cciss tag, lower 4 bytes only */
  465. u32 tweak_lower; /* Encryption tweak, lower 4 bytes */
  466. u8 cdb[16]; /* SCSI Command Descriptor Block */
  467. u8 cciss_lun[8]; /* 8 byte SCSI address */
  468. u32 data_len; /* Total bytes to transfer */
  469. u8 cmd_priority_task_attr; /* priority and task attrs */
  470. #define IOACCEL2_PRIORITY_MASK 0x78
  471. #define IOACCEL2_ATTR_MASK 0x07
  472. u8 sg_count; /* Number of sg elements */
  473. u16 dekindex; /* Data encryption key index */
  474. u64 err_ptr; /* Error Pointer */
  475. u32 err_len; /* Error Length*/
  476. u32 tweak_upper; /* Encryption tweak, upper 4 bytes */
  477. struct ioaccel2_sg_element sg[IOACCEL2_MAXSGENTRIES];
  478. struct io_accel2_scsi_response error_data;
  479. } __aligned(IOACCEL2_COMMANDLIST_ALIGNMENT);
  480. /*
  481. * defines for Mode 2 command struct
  482. * FIXME: this can't be all I need mfm
  483. */
  484. #define IOACCEL2_IU_TYPE 0x40
  485. #define IOACCEL2_IU_TMF_TYPE 0x41
  486. #define IOACCEL2_DIR_NO_DATA 0x00
  487. #define IOACCEL2_DIR_DATA_IN 0x01
  488. #define IOACCEL2_DIR_DATA_OUT 0x02
  489. /*
  490. * SCSI Task Management Request format for Accelerator Mode 2
  491. */
  492. struct hpsa_tmf_struct {
  493. u8 iu_type; /* Information Unit Type */
  494. u8 reply_queue; /* Reply Queue ID */
  495. u8 tmf; /* Task Management Function */
  496. u8 reserved1; /* byte 3 Reserved */
  497. u32 it_nexus; /* SCSI I-T Nexus */
  498. u8 lun_id[8]; /* LUN ID for TMF request */
  499. struct vals32 Tag; /* cciss tag associated w/ request */
  500. struct vals32 abort_tag;/* cciss tag of SCSI cmd or task to abort */
  501. u64 error_ptr; /* Error Pointer */
  502. u32 error_len; /* Error Length */
  503. };
  504. /* Configuration Table Structure */
  505. struct HostWrite {
  506. u32 TransportRequest;
  507. u32 command_pool_addr_hi;
  508. u32 CoalIntDelay;
  509. u32 CoalIntCount;
  510. };
  511. #define SIMPLE_MODE 0x02
  512. #define PERFORMANT_MODE 0x04
  513. #define MEMQ_MODE 0x08
  514. #define IOACCEL_MODE_1 0x80
  515. #define DRIVER_SUPPORT_UA_ENABLE 0x00000001
  516. struct CfgTable {
  517. u8 Signature[4];
  518. u32 SpecValence;
  519. u32 TransportSupport;
  520. u32 TransportActive;
  521. struct HostWrite HostWrite;
  522. u32 CmdsOutMax;
  523. u32 BusTypes;
  524. u32 TransMethodOffset;
  525. u8 ServerName[16];
  526. u32 HeartBeat;
  527. u32 driver_support;
  528. #define ENABLE_SCSI_PREFETCH 0x100
  529. #define ENABLE_UNIT_ATTN 0x01
  530. u32 MaxScatterGatherElements;
  531. u32 MaxLogicalUnits;
  532. u32 MaxPhysicalDevices;
  533. u32 MaxPhysicalDrivesPerLogicalUnit;
  534. u32 MaxPerformantModeCommands;
  535. u32 MaxBlockFetch;
  536. u32 PowerConservationSupport;
  537. u32 PowerConservationEnable;
  538. u32 TMFSupportFlags;
  539. u8 TMFTagMask[8];
  540. u8 reserved[0x78 - 0x70];
  541. u32 misc_fw_support; /* offset 0x78 */
  542. #define MISC_FW_DOORBELL_RESET (0x02)
  543. #define MISC_FW_DOORBELL_RESET2 (0x010)
  544. #define MISC_FW_RAID_OFFLOAD_BASIC (0x020)
  545. #define MISC_FW_EVENT_NOTIFY (0x080)
  546. u8 driver_version[32];
  547. u32 max_cached_write_size;
  548. u8 driver_scratchpad[16];
  549. u32 max_error_info_length;
  550. u32 io_accel_max_embedded_sg_count;
  551. u32 io_accel_request_size_offset;
  552. u32 event_notify;
  553. #define HPSA_EVENT_NOTIFY_ACCEL_IO_PATH_STATE_CHANGE (1 << 30)
  554. #define HPSA_EVENT_NOTIFY_ACCEL_IO_PATH_CONFIG_CHANGE (1 << 31)
  555. u32 clear_event_notify;
  556. };
  557. #define NUM_BLOCKFETCH_ENTRIES 8
  558. struct TransTable_struct {
  559. u32 BlockFetch[NUM_BLOCKFETCH_ENTRIES];
  560. u32 RepQSize;
  561. u32 RepQCount;
  562. u32 RepQCtrAddrLow32;
  563. u32 RepQCtrAddrHigh32;
  564. #define MAX_REPLY_QUEUES 64
  565. struct vals32 RepQAddr[MAX_REPLY_QUEUES];
  566. };
  567. struct hpsa_pci_info {
  568. unsigned char bus;
  569. unsigned char dev_fn;
  570. unsigned short domain;
  571. u32 board_id;
  572. };
  573. #pragma pack()
  574. #endif /* HPSA_CMD_H */