mpi.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2000-2008 LSI Corporation.
  4. *
  5. *
  6. * Name: mpi.h
  7. * Title: MPI Message independent structures and definitions
  8. * Creation Date: July 27, 2000
  9. *
  10. * mpi.h Version: 01.05.16
  11. *
  12. * Version History
  13. * ---------------
  14. *
  15. * Date Version Description
  16. * -------- -------- ------------------------------------------------------
  17. * 05-08-00 00.10.01 Original release for 0.10 spec dated 4/26/2000.
  18. * 05-24-00 00.10.02 Added MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH definition.
  19. * 06-06-00 01.00.01 Update MPI_VERSION_MAJOR and MPI_VERSION_MINOR.
  20. * 06-22-00 01.00.02 Added MPI_IOCSTATUS_LAN_ definitions.
  21. * Removed LAN_SUSPEND function definition.
  22. * Added MPI_MSGFLAGS_CONTINUATION_REPLY definition.
  23. * 06-30-00 01.00.03 Added MPI_CONTEXT_REPLY_TYPE_LAN definition.
  24. * Added MPI_GET/SET_CONTEXT_REPLY_TYPE macros.
  25. * 07-27-00 01.00.04 Added MPI_FAULT_ definitions.
  26. * Removed MPI_IOCSTATUS_MSG/DATA_XFER_ERROR definitions.
  27. * Added MPI_IOCSTATUS_INTERNAL_ERROR definition.
  28. * Added MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH.
  29. * 11-02-00 01.01.01 Original release for post 1.0 work.
  30. * 12-04-00 01.01.02 Added new function codes.
  31. * 01-09-01 01.01.03 Added more definitions to the system interface section
  32. * Added MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT.
  33. * 01-25-01 01.01.04 Changed MPI_VERSION_MINOR from 0x00 to 0x01.
  34. * 02-20-01 01.01.05 Started using MPI_POINTER.
  35. * Fixed value for MPI_DIAG_RW_ENABLE.
  36. * Added defines for MPI_DIAG_PREVENT_IOC_BOOT and
  37. * MPI_DIAG_CLEAR_FLASH_BAD_SIG.
  38. * Obsoleted MPI_IOCSTATUS_TARGET_FC_ defines.
  39. * 02-27-01 01.01.06 Removed MPI_HOST_INDEX_REGISTER define.
  40. * Added function codes for RAID.
  41. * 04-09-01 01.01.07 Added alternate define for MPI_DOORBELL_ACTIVE,
  42. * MPI_DOORBELL_USED, to better match the spec.
  43. * 08-08-01 01.02.01 Original release for v1.2 work.
  44. * Changed MPI_VERSION_MINOR from 0x01 to 0x02.
  45. * Added define MPI_FUNCTION_TOOLBOX.
  46. * 09-28-01 01.02.02 New function code MPI_SCSI_ENCLOSURE_PROCESSOR.
  47. * 11-01-01 01.02.03 Changed name to MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR.
  48. * 03-14-02 01.02.04 Added MPI_HEADER_VERSION_ defines.
  49. * 05-31-02 01.02.05 Bumped MPI_HEADER_VERSION_UNIT.
  50. * 07-12-02 01.02.06 Added define for MPI_FUNCTION_MAILBOX.
  51. * 09-16-02 01.02.07 Bumped value for MPI_HEADER_VERSION_UNIT.
  52. * 11-15-02 01.02.08 Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and
  53. * obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX.
  54. * 04-01-03 01.02.09 New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED
  55. * 06-26-03 01.02.10 Bumped MPI_HEADER_VERSION_UNIT value.
  56. * 01-16-04 01.02.11 Added define for MPI_IOCLOGINFO_TYPE_SHIFT.
  57. * 04-29-04 01.02.12 Added function codes for MPI_FUNCTION_DIAG_BUFFER_POST
  58. * and MPI_FUNCTION_DIAG_RELEASE.
  59. * Added MPI_IOCSTATUS_DIAGNOSTIC_RELEASED define.
  60. * Bumped MPI_HEADER_VERSION_UNIT value.
  61. * 05-11-04 01.03.01 Bumped MPI_VERSION_MINOR for MPI v1.3.
  62. * Added codes for Inband.
  63. * 08-19-04 01.05.01 Added defines for Host Buffer Access Control doorbell.
  64. * Added define for offset of High Priority Request Queue.
  65. * Added new function codes and new IOCStatus codes.
  66. * Added a IOCLogInfo type of SAS.
  67. * 12-07-04 01.05.02 Bumped MPI_HEADER_VERSION_UNIT.
  68. * 12-09-04 01.05.03 Bumped MPI_HEADER_VERSION_UNIT.
  69. * 01-15-05 01.05.04 Bumped MPI_HEADER_VERSION_UNIT.
  70. * 02-09-05 01.05.05 Bumped MPI_HEADER_VERSION_UNIT.
  71. * 02-22-05 01.05.06 Bumped MPI_HEADER_VERSION_UNIT.
  72. * 03-11-05 01.05.07 Removed function codes for SCSI IO 32 and
  73. * TargetAssistExtended requests.
  74. * Removed EEDP IOCStatus codes.
  75. * 06-24-05 01.05.08 Added function codes for SCSI IO 32 and
  76. * TargetAssistExtended requests.
  77. * Added EEDP IOCStatus codes.
  78. * 08-03-05 01.05.09 Bumped MPI_HEADER_VERSION_UNIT.
  79. * 08-30-05 01.05.10 Added 2 new IOCStatus codes for Target.
  80. * 03-27-06 01.05.11 Bumped MPI_HEADER_VERSION_UNIT.
  81. * 10-11-06 01.05.12 Bumped MPI_HEADER_VERSION_UNIT.
  82. * 05-24-07 01.05.13 Bumped MPI_HEADER_VERSION_UNIT.
  83. * 08-07-07 01.05.14 Bumped MPI_HEADER_VERSION_UNIT.
  84. * 01-15-08 01.05.15 Bumped MPI_HEADER_VERSION_UNIT.
  85. * 03-28-08 01.05.16 Bumped MPI_HEADER_VERSION_UNIT.
  86. * --------------------------------------------------------------------------
  87. */
  88. #ifndef MPI_H
  89. #define MPI_H
  90. /*****************************************************************************
  91. *
  92. * M P I V e r s i o n D e f i n i t i o n s
  93. *
  94. *****************************************************************************/
  95. #define MPI_VERSION_MAJOR (0x01)
  96. #define MPI_VERSION_MINOR (0x05)
  97. #define MPI_VERSION_MAJOR_MASK (0xFF00)
  98. #define MPI_VERSION_MAJOR_SHIFT (8)
  99. #define MPI_VERSION_MINOR_MASK (0x00FF)
  100. #define MPI_VERSION_MINOR_SHIFT (0)
  101. #define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) | \
  102. MPI_VERSION_MINOR)
  103. #define MPI_VERSION_01_00 (0x0100)
  104. #define MPI_VERSION_01_01 (0x0101)
  105. #define MPI_VERSION_01_02 (0x0102)
  106. #define MPI_VERSION_01_03 (0x0103)
  107. #define MPI_VERSION_01_05 (0x0105)
  108. /* Note: The major versions of 0xe0 through 0xff are reserved */
  109. /* versioning for this MPI header set */
  110. #define MPI_HEADER_VERSION_UNIT (0x13)
  111. #define MPI_HEADER_VERSION_DEV (0x00)
  112. #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
  113. #define MPI_HEADER_VERSION_UNIT_SHIFT (8)
  114. #define MPI_HEADER_VERSION_DEV_MASK (0x00FF)
  115. #define MPI_HEADER_VERSION_DEV_SHIFT (0)
  116. #define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | MPI_HEADER_VERSION_DEV)
  117. /*****************************************************************************
  118. *
  119. * I O C S t a t e D e f i n i t i o n s
  120. *
  121. *****************************************************************************/
  122. #define MPI_IOC_STATE_RESET (0x00000000)
  123. #define MPI_IOC_STATE_READY (0x10000000)
  124. #define MPI_IOC_STATE_OPERATIONAL (0x20000000)
  125. #define MPI_IOC_STATE_FAULT (0x40000000)
  126. #define MPI_IOC_STATE_MASK (0xF0000000)
  127. #define MPI_IOC_STATE_SHIFT (28)
  128. /* Fault state codes (product independent range 0x8000-0xFFFF) */
  129. #define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR (0x8111)
  130. #define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT (0x8112)
  131. #define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR (0x8113)
  132. #define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT (0x8114)
  133. #define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR (0x8115)
  134. #define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT (0x8116)
  135. #define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR (0x8117)
  136. #define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT (0x8118)
  137. /*****************************************************************************
  138. *
  139. * P C I S y s t e m I n t e r f a c e R e g i s t e r s
  140. *
  141. *****************************************************************************/
  142. /*
  143. * Defines for working with the System Doorbell register.
  144. * Values for doorbell function codes are included in the section that defines
  145. * all the function codes (further on in this file).
  146. */
  147. #define MPI_DOORBELL_OFFSET (0x00000000)
  148. #define MPI_DOORBELL_ACTIVE (0x08000000) /* DoorbellUsed */
  149. #define MPI_DOORBELL_USED (MPI_DOORBELL_ACTIVE)
  150. #define MPI_DOORBELL_ACTIVE_SHIFT (27)
  151. #define MPI_DOORBELL_WHO_INIT_MASK (0x07000000)
  152. #define MPI_DOORBELL_WHO_INIT_SHIFT (24)
  153. #define MPI_DOORBELL_FUNCTION_MASK (0xFF000000)
  154. #define MPI_DOORBELL_FUNCTION_SHIFT (24)
  155. #define MPI_DOORBELL_ADD_DWORDS_MASK (0x00FF0000)
  156. #define MPI_DOORBELL_ADD_DWORDS_SHIFT (16)
  157. #define MPI_DOORBELL_DATA_MASK (0x0000FFFF)
  158. #define MPI_DOORBELL_FUNCTION_SPECIFIC_MASK (0x0000FFFF)
  159. /* values for Host Buffer Access Control doorbell function */
  160. #define MPI_DB_HPBAC_VALUE_MASK (0x0000F000)
  161. #define MPI_DB_HPBAC_ENABLE_ACCESS (0x01)
  162. #define MPI_DB_HPBAC_DISABLE_ACCESS (0x02)
  163. #define MPI_DB_HPBAC_FREE_BUFFER (0x03)
  164. #define MPI_WRITE_SEQUENCE_OFFSET (0x00000004)
  165. #define MPI_WRSEQ_KEY_VALUE_MASK (0x0000000F)
  166. #define MPI_WRSEQ_1ST_KEY_VALUE (0x04)
  167. #define MPI_WRSEQ_2ND_KEY_VALUE (0x0B)
  168. #define MPI_WRSEQ_3RD_KEY_VALUE (0x02)
  169. #define MPI_WRSEQ_4TH_KEY_VALUE (0x07)
  170. #define MPI_WRSEQ_5TH_KEY_VALUE (0x0D)
  171. #define MPI_DIAGNOSTIC_OFFSET (0x00000008)
  172. #define MPI_DIAG_CLEAR_FLASH_BAD_SIG (0x00000400)
  173. #define MPI_DIAG_PREVENT_IOC_BOOT (0x00000200)
  174. #define MPI_DIAG_DRWE (0x00000080)
  175. #define MPI_DIAG_FLASH_BAD_SIG (0x00000040)
  176. #define MPI_DIAG_RESET_HISTORY (0x00000020)
  177. #define MPI_DIAG_RW_ENABLE (0x00000010)
  178. #define MPI_DIAG_RESET_ADAPTER (0x00000004)
  179. #define MPI_DIAG_DISABLE_ARM (0x00000002)
  180. #define MPI_DIAG_MEM_ENABLE (0x00000001)
  181. #define MPI_TEST_BASE_ADDRESS_OFFSET (0x0000000C)
  182. #define MPI_DIAG_RW_DATA_OFFSET (0x00000010)
  183. #define MPI_DIAG_RW_ADDRESS_OFFSET (0x00000014)
  184. #define MPI_HOST_INTERRUPT_STATUS_OFFSET (0x00000030)
  185. #define MPI_HIS_IOP_DOORBELL_STATUS (0x80000000)
  186. #define MPI_HIS_REPLY_MESSAGE_INTERRUPT (0x00000008)
  187. #define MPI_HIS_DOORBELL_INTERRUPT (0x00000001)
  188. #define MPI_HOST_INTERRUPT_MASK_OFFSET (0x00000034)
  189. #define MPI_HIM_RIM (0x00000008)
  190. #define MPI_HIM_DIM (0x00000001)
  191. #define MPI_REQUEST_QUEUE_OFFSET (0x00000040)
  192. #define MPI_REQUEST_POST_FIFO_OFFSET (0x00000040)
  193. #define MPI_REPLY_QUEUE_OFFSET (0x00000044)
  194. #define MPI_REPLY_POST_FIFO_OFFSET (0x00000044)
  195. #define MPI_REPLY_FREE_FIFO_OFFSET (0x00000044)
  196. #define MPI_HI_PRI_REQUEST_QUEUE_OFFSET (0x00000048)
  197. /*****************************************************************************
  198. *
  199. * M e s s a g e F r a m e D e s c r i p t o r s
  200. *
  201. *****************************************************************************/
  202. #define MPI_REQ_MF_DESCRIPTOR_NB_MASK (0x00000003)
  203. #define MPI_REQ_MF_DESCRIPTOR_F_BIT (0x00000004)
  204. #define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK (0xFFFFFFF8)
  205. #define MPI_ADDRESS_REPLY_A_BIT (0x80000000)
  206. #define MPI_ADDRESS_REPLY_ADDRESS_MASK (0x7FFFFFFF)
  207. #define MPI_CONTEXT_REPLY_A_BIT (0x80000000)
  208. #define MPI_CONTEXT_REPLY_TYPE_MASK (0x60000000)
  209. #define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT (0x00)
  210. #define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET (0x01)
  211. #define MPI_CONTEXT_REPLY_TYPE_LAN (0x02)
  212. #define MPI_CONTEXT_REPLY_TYPE_SHIFT (29)
  213. #define MPI_CONTEXT_REPLY_CONTEXT_MASK (0x1FFFFFFF)
  214. /****************************************************************************/
  215. /* Context Reply macros */
  216. /****************************************************************************/
  217. #define MPI_GET_CONTEXT_REPLY_TYPE(x) (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \
  218. >> MPI_CONTEXT_REPLY_TYPE_SHIFT)
  219. #define MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \
  220. ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \
  221. (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \
  222. MPI_CONTEXT_REPLY_TYPE_MASK))
  223. /*****************************************************************************
  224. *
  225. * M e s s a g e F u n c t i o n s
  226. * 0x80 -> 0x8F reserved for private message use per product
  227. *
  228. *
  229. *****************************************************************************/
  230. #define MPI_FUNCTION_SCSI_IO_REQUEST (0x00)
  231. #define MPI_FUNCTION_SCSI_TASK_MGMT (0x01)
  232. #define MPI_FUNCTION_IOC_INIT (0x02)
  233. #define MPI_FUNCTION_IOC_FACTS (0x03)
  234. #define MPI_FUNCTION_CONFIG (0x04)
  235. #define MPI_FUNCTION_PORT_FACTS (0x05)
  236. #define MPI_FUNCTION_PORT_ENABLE (0x06)
  237. #define MPI_FUNCTION_EVENT_NOTIFICATION (0x07)
  238. #define MPI_FUNCTION_EVENT_ACK (0x08)
  239. #define MPI_FUNCTION_FW_DOWNLOAD (0x09)
  240. #define MPI_FUNCTION_TARGET_CMD_BUFFER_POST (0x0A)
  241. #define MPI_FUNCTION_TARGET_ASSIST (0x0B)
  242. #define MPI_FUNCTION_TARGET_STATUS_SEND (0x0C)
  243. #define MPI_FUNCTION_TARGET_MODE_ABORT (0x0D)
  244. #define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST (0x0E)
  245. #define MPI_FUNCTION_FC_LINK_SRVC_RSP (0x0F)
  246. #define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND (0x10)
  247. #define MPI_FUNCTION_FC_ABORT (0x11)
  248. #define MPI_FUNCTION_FW_UPLOAD (0x12)
  249. #define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND (0x13)
  250. #define MPI_FUNCTION_FC_PRIMITIVE_SEND (0x14)
  251. #define MPI_FUNCTION_RAID_ACTION (0x15)
  252. #define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16)
  253. #define MPI_FUNCTION_TOOLBOX (0x17)
  254. #define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18)
  255. #define MPI_FUNCTION_MAILBOX (0x19)
  256. #define MPI_FUNCTION_SMP_PASSTHROUGH (0x1A)
  257. #define MPI_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B)
  258. #define MPI_FUNCTION_SATA_PASSTHROUGH (0x1C)
  259. #define MPI_FUNCTION_DIAG_BUFFER_POST (0x1D)
  260. #define MPI_FUNCTION_DIAG_RELEASE (0x1E)
  261. #define MPI_FUNCTION_SCSI_IO_32 (0x1F)
  262. #define MPI_FUNCTION_LAN_SEND (0x20)
  263. #define MPI_FUNCTION_LAN_RECEIVE (0x21)
  264. #define MPI_FUNCTION_LAN_RESET (0x22)
  265. #define MPI_FUNCTION_TARGET_ASSIST_EXTENDED (0x23)
  266. #define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24)
  267. #define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25)
  268. #define MPI_FUNCTION_INBAND_BUFFER_POST (0x28)
  269. #define MPI_FUNCTION_INBAND_SEND (0x29)
  270. #define MPI_FUNCTION_INBAND_RSP (0x2A)
  271. #define MPI_FUNCTION_INBAND_ABORT (0x2B)
  272. #define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40)
  273. #define MPI_FUNCTION_IO_UNIT_RESET (0x41)
  274. #define MPI_FUNCTION_HANDSHAKE (0x42)
  275. #define MPI_FUNCTION_REPLY_FRAME_REMOVAL (0x43)
  276. #define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL (0x44)
  277. /* standard version format */
  278. typedef struct _MPI_VERSION_STRUCT
  279. {
  280. U8 Dev; /* 00h */
  281. U8 Unit; /* 01h */
  282. U8 Minor; /* 02h */
  283. U8 Major; /* 03h */
  284. } MPI_VERSION_STRUCT, MPI_POINTER PTR_MPI_VERSION_STRUCT,
  285. MpiVersionStruct_t, MPI_POINTER pMpiVersionStruct;
  286. typedef union _MPI_VERSION_FORMAT
  287. {
  288. MPI_VERSION_STRUCT Struct;
  289. U32 Word;
  290. } MPI_VERSION_FORMAT, MPI_POINTER PTR_MPI_VERSION_FORMAT,
  291. MpiVersionFormat_t, MPI_POINTER pMpiVersionFormat_t;
  292. /*****************************************************************************
  293. *
  294. * S c a t t e r G a t h e r E l e m e n t s
  295. *
  296. *****************************************************************************/
  297. /****************************************************************************/
  298. /* Simple element structures */
  299. /****************************************************************************/
  300. typedef struct _SGE_SIMPLE32
  301. {
  302. U32 FlagsLength;
  303. U32 Address;
  304. } SGE_SIMPLE32, MPI_POINTER PTR_SGE_SIMPLE32,
  305. SGESimple32_t, MPI_POINTER pSGESimple32_t;
  306. typedef struct _SGE_SIMPLE64
  307. {
  308. U32 FlagsLength;
  309. U64 Address;
  310. } SGE_SIMPLE64, MPI_POINTER PTR_SGE_SIMPLE64,
  311. SGESimple64_t, MPI_POINTER pSGESimple64_t;
  312. typedef struct _SGE_SIMPLE_UNION
  313. {
  314. U32 FlagsLength;
  315. union
  316. {
  317. U32 Address32;
  318. U64 Address64;
  319. }u;
  320. } SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION,
  321. SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t;
  322. /****************************************************************************/
  323. /* Chain element structures */
  324. /****************************************************************************/
  325. typedef struct _SGE_CHAIN32
  326. {
  327. U16 Length;
  328. U8 NextChainOffset;
  329. U8 Flags;
  330. U32 Address;
  331. } SGE_CHAIN32, MPI_POINTER PTR_SGE_CHAIN32,
  332. SGEChain32_t, MPI_POINTER pSGEChain32_t;
  333. typedef struct _SGE_CHAIN64
  334. {
  335. U16 Length;
  336. U8 NextChainOffset;
  337. U8 Flags;
  338. U64 Address;
  339. } SGE_CHAIN64, MPI_POINTER PTR_SGE_CHAIN64,
  340. SGEChain64_t, MPI_POINTER pSGEChain64_t;
  341. typedef struct _SGE_CHAIN_UNION
  342. {
  343. U16 Length;
  344. U8 NextChainOffset;
  345. U8 Flags;
  346. union
  347. {
  348. U32 Address32;
  349. U64 Address64;
  350. }u;
  351. } SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION,
  352. SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t;
  353. /****************************************************************************/
  354. /* Transaction Context element */
  355. /****************************************************************************/
  356. typedef struct _SGE_TRANSACTION32
  357. {
  358. U8 Reserved;
  359. U8 ContextSize;
  360. U8 DetailsLength;
  361. U8 Flags;
  362. U32 TransactionContext[1];
  363. U32 TransactionDetails[1];
  364. } SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32,
  365. SGETransaction32_t, MPI_POINTER pSGETransaction32_t;
  366. typedef struct _SGE_TRANSACTION64
  367. {
  368. U8 Reserved;
  369. U8 ContextSize;
  370. U8 DetailsLength;
  371. U8 Flags;
  372. U32 TransactionContext[2];
  373. U32 TransactionDetails[1];
  374. } SGE_TRANSACTION64, MPI_POINTER PTR_SGE_TRANSACTION64,
  375. SGETransaction64_t, MPI_POINTER pSGETransaction64_t;
  376. typedef struct _SGE_TRANSACTION96
  377. {
  378. U8 Reserved;
  379. U8 ContextSize;
  380. U8 DetailsLength;
  381. U8 Flags;
  382. U32 TransactionContext[3];
  383. U32 TransactionDetails[1];
  384. } SGE_TRANSACTION96, MPI_POINTER PTR_SGE_TRANSACTION96,
  385. SGETransaction96_t, MPI_POINTER pSGETransaction96_t;
  386. typedef struct _SGE_TRANSACTION128
  387. {
  388. U8 Reserved;
  389. U8 ContextSize;
  390. U8 DetailsLength;
  391. U8 Flags;
  392. U32 TransactionContext[4];
  393. U32 TransactionDetails[1];
  394. } SGE_TRANSACTION128, MPI_POINTER PTR_SGE_TRANSACTION128,
  395. SGETransaction_t128, MPI_POINTER pSGETransaction_t128;
  396. typedef struct _SGE_TRANSACTION_UNION
  397. {
  398. U8 Reserved;
  399. U8 ContextSize;
  400. U8 DetailsLength;
  401. U8 Flags;
  402. union
  403. {
  404. U32 TransactionContext32[1];
  405. U32 TransactionContext64[2];
  406. U32 TransactionContext96[3];
  407. U32 TransactionContext128[4];
  408. }u;
  409. U32 TransactionDetails[1];
  410. } SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION,
  411. SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t;
  412. /****************************************************************************/
  413. /* SGE IO types union for IO SGL's */
  414. /****************************************************************************/
  415. typedef struct _SGE_IO_UNION
  416. {
  417. union
  418. {
  419. SGE_SIMPLE_UNION Simple;
  420. SGE_CHAIN_UNION Chain;
  421. } u;
  422. } SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION,
  423. SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t;
  424. /****************************************************************************/
  425. /* SGE union for SGL's with Simple and Transaction elements */
  426. /****************************************************************************/
  427. typedef struct _SGE_TRANS_SIMPLE_UNION
  428. {
  429. union
  430. {
  431. SGE_SIMPLE_UNION Simple;
  432. SGE_TRANSACTION_UNION Transaction;
  433. } u;
  434. } SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION,
  435. SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t;
  436. /****************************************************************************/
  437. /* All SGE types union */
  438. /****************************************************************************/
  439. typedef struct _SGE_MPI_UNION
  440. {
  441. union
  442. {
  443. SGE_SIMPLE_UNION Simple;
  444. SGE_CHAIN_UNION Chain;
  445. SGE_TRANSACTION_UNION Transaction;
  446. } u;
  447. } SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION,
  448. MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t,
  449. SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t;
  450. /****************************************************************************/
  451. /* SGE field definition and masks */
  452. /****************************************************************************/
  453. /* Flags field bit definitions */
  454. #define MPI_SGE_FLAGS_LAST_ELEMENT (0x80)
  455. #define MPI_SGE_FLAGS_END_OF_BUFFER (0x40)
  456. #define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK (0x30)
  457. #define MPI_SGE_FLAGS_LOCAL_ADDRESS (0x08)
  458. #define MPI_SGE_FLAGS_DIRECTION (0x04)
  459. #define MPI_SGE_FLAGS_ADDRESS_SIZE (0x02)
  460. #define MPI_SGE_FLAGS_END_OF_LIST (0x01)
  461. #define MPI_SGE_FLAGS_SHIFT (24)
  462. #define MPI_SGE_LENGTH_MASK (0x00FFFFFF)
  463. #define MPI_SGE_CHAIN_LENGTH_MASK (0x0000FFFF)
  464. /* Element Type */
  465. #define MPI_SGE_FLAGS_TRANSACTION_ELEMENT (0x00)
  466. #define MPI_SGE_FLAGS_SIMPLE_ELEMENT (0x10)
  467. #define MPI_SGE_FLAGS_CHAIN_ELEMENT (0x30)
  468. #define MPI_SGE_FLAGS_ELEMENT_MASK (0x30)
  469. /* Address location */
  470. #define MPI_SGE_FLAGS_SYSTEM_ADDRESS (0x00)
  471. /* Direction */
  472. #define MPI_SGE_FLAGS_IOC_TO_HOST (0x00)
  473. #define MPI_SGE_FLAGS_HOST_TO_IOC (0x04)
  474. /* Address Size */
  475. #define MPI_SGE_FLAGS_32_BIT_ADDRESSING (0x00)
  476. #define MPI_SGE_FLAGS_64_BIT_ADDRESSING (0x02)
  477. /* Context Size */
  478. #define MPI_SGE_FLAGS_32_BIT_CONTEXT (0x00)
  479. #define MPI_SGE_FLAGS_64_BIT_CONTEXT (0x02)
  480. #define MPI_SGE_FLAGS_96_BIT_CONTEXT (0x04)
  481. #define MPI_SGE_FLAGS_128_BIT_CONTEXT (0x06)
  482. #define MPI_SGE_CHAIN_OFFSET_MASK (0x00FF0000)
  483. #define MPI_SGE_CHAIN_OFFSET_SHIFT (16)
  484. /****************************************************************************/
  485. /* SGE operation Macros */
  486. /****************************************************************************/
  487. /* SIMPLE FlagsLength manipulations... */
  488. #define MPI_SGE_SET_FLAGS(f) ((U32)(f) << MPI_SGE_FLAGS_SHIFT)
  489. #define MPI_SGE_GET_FLAGS(fl) (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)
  490. #define MPI_SGE_LENGTH(fl) ((fl) & MPI_SGE_LENGTH_MASK)
  491. #define MPI_SGE_CHAIN_LENGTH(fl) ((fl) & MPI_SGE_CHAIN_LENGTH_MASK)
  492. #define MPI_SGE_SET_FLAGS_LENGTH(f,l) (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))
  493. #define MPI_pSGE_GET_FLAGS(psg) MPI_SGE_GET_FLAGS((psg)->FlagsLength)
  494. #define MPI_pSGE_GET_LENGTH(psg) MPI_SGE_LENGTH((psg)->FlagsLength)
  495. #define MPI_pSGE_SET_FLAGS_LENGTH(psg,f,l) (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f,l)
  496. /* CAUTION - The following are READ-MODIFY-WRITE! */
  497. #define MPI_pSGE_SET_FLAGS(psg,f) (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)
  498. #define MPI_pSGE_SET_LENGTH(psg,l) (psg)->FlagsLength |= MPI_SGE_LENGTH(l)
  499. #define MPI_GET_CHAIN_OFFSET(x) ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)
  500. /*****************************************************************************
  501. *
  502. * S t a n d a r d M e s s a g e S t r u c t u r e s
  503. *
  504. *****************************************************************************/
  505. /****************************************************************************/
  506. /* Standard message request header for all request messages */
  507. /****************************************************************************/
  508. typedef struct _MSG_REQUEST_HEADER
  509. {
  510. U8 Reserved[2]; /* function specific */
  511. U8 ChainOffset;
  512. U8 Function;
  513. U8 Reserved1[3]; /* function specific */
  514. U8 MsgFlags;
  515. U32 MsgContext;
  516. } MSG_REQUEST_HEADER, MPI_POINTER PTR_MSG_REQUEST_HEADER,
  517. MPIHeader_t, MPI_POINTER pMPIHeader_t;
  518. /****************************************************************************/
  519. /* Default Reply */
  520. /****************************************************************************/
  521. typedef struct _MSG_DEFAULT_REPLY
  522. {
  523. U8 Reserved[2]; /* function specific */
  524. U8 MsgLength;
  525. U8 Function;
  526. U8 Reserved1[3]; /* function specific */
  527. U8 MsgFlags;
  528. U32 MsgContext;
  529. U8 Reserved2[2]; /* function specific */
  530. U16 IOCStatus;
  531. U32 IOCLogInfo;
  532. } MSG_DEFAULT_REPLY, MPI_POINTER PTR_MSG_DEFAULT_REPLY,
  533. MPIDefaultReply_t, MPI_POINTER pMPIDefaultReply_t;
  534. /* MsgFlags definition for all replies */
  535. #define MPI_MSGFLAGS_CONTINUATION_REPLY (0x80)
  536. /*****************************************************************************
  537. *
  538. * I O C S t a t u s V a l u e s
  539. *
  540. *****************************************************************************/
  541. /****************************************************************************/
  542. /* Common IOCStatus values for all replies */
  543. /****************************************************************************/
  544. #define MPI_IOCSTATUS_SUCCESS (0x0000)
  545. #define MPI_IOCSTATUS_INVALID_FUNCTION (0x0001)
  546. #define MPI_IOCSTATUS_BUSY (0x0002)
  547. #define MPI_IOCSTATUS_INVALID_SGL (0x0003)
  548. #define MPI_IOCSTATUS_INTERNAL_ERROR (0x0004)
  549. #define MPI_IOCSTATUS_RESERVED (0x0005)
  550. #define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES (0x0006)
  551. #define MPI_IOCSTATUS_INVALID_FIELD (0x0007)
  552. #define MPI_IOCSTATUS_INVALID_STATE (0x0008)
  553. #define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED (0x0009)
  554. /****************************************************************************/
  555. /* Config IOCStatus values */
  556. /****************************************************************************/
  557. #define MPI_IOCSTATUS_CONFIG_INVALID_ACTION (0x0020)
  558. #define MPI_IOCSTATUS_CONFIG_INVALID_TYPE (0x0021)
  559. #define MPI_IOCSTATUS_CONFIG_INVALID_PAGE (0x0022)
  560. #define MPI_IOCSTATUS_CONFIG_INVALID_DATA (0x0023)
  561. #define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS (0x0024)
  562. #define MPI_IOCSTATUS_CONFIG_CANT_COMMIT (0x0025)
  563. /****************************************************************************/
  564. /* SCSIIO Reply (SPI & FCP) initiator values */
  565. /****************************************************************************/
  566. #define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR (0x0040)
  567. #define MPI_IOCSTATUS_SCSI_INVALID_BUS (0x0041)
  568. #define MPI_IOCSTATUS_SCSI_INVALID_TARGETID (0x0042)
  569. #define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE (0x0043)
  570. #define MPI_IOCSTATUS_SCSI_DATA_OVERRUN (0x0044)
  571. #define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN (0x0045)
  572. #define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR (0x0046)
  573. #define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR (0x0047)
  574. #define MPI_IOCSTATUS_SCSI_TASK_TERMINATED (0x0048)
  575. #define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH (0x0049)
  576. #define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED (0x004A)
  577. #define MPI_IOCSTATUS_SCSI_IOC_TERMINATED (0x004B)
  578. #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED (0x004C)
  579. /****************************************************************************/
  580. /* For use by SCSI Initiator and SCSI Target end-to-end data protection */
  581. /****************************************************************************/
  582. #define MPI_IOCSTATUS_EEDP_GUARD_ERROR (0x004D)
  583. #define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR (0x004E)
  584. #define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR (0x004F)
  585. /****************************************************************************/
  586. /* SCSI Target values */
  587. /****************************************************************************/
  588. #define MPI_IOCSTATUS_TARGET_PRIORITY_IO (0x0060)
  589. #define MPI_IOCSTATUS_TARGET_INVALID_PORT (0x0061)
  590. #define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX (0x0062) /* obsolete name */
  591. #define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX (0x0062)
  592. #define MPI_IOCSTATUS_TARGET_ABORTED (0x0063)
  593. #define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE (0x0064)
  594. #define MPI_IOCSTATUS_TARGET_NO_CONNECTION (0x0065)
  595. #define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A)
  596. #define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT (0x006B)
  597. #define MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR (0x006D)
  598. #define MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E)
  599. #define MPI_IOCSTATUS_TARGET_IU_TOO_SHORT (0x006F)
  600. #define MPI_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT (0x0070)
  601. #define MPI_IOCSTATUS_TARGET_NAK_RECEIVED (0x0071)
  602. /****************************************************************************/
  603. /* Additional FCP target values (obsolete) */
  604. /****************************************************************************/
  605. #define MPI_IOCSTATUS_TARGET_FC_ABORTED (0x0066) /* obsolete */
  606. #define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID (0x0067) /* obsolete */
  607. #define MPI_IOCSTATUS_TARGET_FC_DID_INVALID (0x0068) /* obsolete */
  608. #define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT (0x0069) /* obsolete */
  609. /****************************************************************************/
  610. /* Fibre Channel Direct Access values */
  611. /****************************************************************************/
  612. #define MPI_IOCSTATUS_FC_ABORTED (0x0066)
  613. #define MPI_IOCSTATUS_FC_RX_ID_INVALID (0x0067)
  614. #define MPI_IOCSTATUS_FC_DID_INVALID (0x0068)
  615. #define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT (0x0069)
  616. #define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED (0x006C)
  617. /****************************************************************************/
  618. /* LAN values */
  619. /****************************************************************************/
  620. #define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND (0x0080)
  621. #define MPI_IOCSTATUS_LAN_DEVICE_FAILURE (0x0081)
  622. #define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR (0x0082)
  623. #define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED (0x0083)
  624. #define MPI_IOCSTATUS_LAN_RECEIVE_ERROR (0x0084)
  625. #define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED (0x0085)
  626. #define MPI_IOCSTATUS_LAN_PARTIAL_PACKET (0x0086)
  627. #define MPI_IOCSTATUS_LAN_CANCELED (0x0087)
  628. /****************************************************************************/
  629. /* Serial Attached SCSI values */
  630. /****************************************************************************/
  631. #define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED (0x0090)
  632. #define MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN (0x0091)
  633. /****************************************************************************/
  634. /* Inband values */
  635. /****************************************************************************/
  636. #define MPI_IOCSTATUS_INBAND_ABORTED (0x0098)
  637. #define MPI_IOCSTATUS_INBAND_NO_CONNECTION (0x0099)
  638. /****************************************************************************/
  639. /* Diagnostic Tools values */
  640. /****************************************************************************/
  641. #define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED (0x00A0)
  642. /****************************************************************************/
  643. /* IOCStatus flag to indicate that log info is available */
  644. /****************************************************************************/
  645. #define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE (0x8000)
  646. #define MPI_IOCSTATUS_MASK (0x7FFF)
  647. /****************************************************************************/
  648. /* LogInfo Types */
  649. /****************************************************************************/
  650. #define MPI_IOCLOGINFO_TYPE_MASK (0xF0000000)
  651. #define MPI_IOCLOGINFO_TYPE_SHIFT (28)
  652. #define MPI_IOCLOGINFO_TYPE_NONE (0x0)
  653. #define MPI_IOCLOGINFO_TYPE_SCSI (0x1)
  654. #define MPI_IOCLOGINFO_TYPE_FC (0x2)
  655. #define MPI_IOCLOGINFO_TYPE_SAS (0x3)
  656. #define MPI_IOCLOGINFO_TYPE_ISCSI (0x4)
  657. #define MPI_IOCLOGINFO_LOG_DATA_MASK (0x0FFFFFFF)
  658. #endif