xref: /linux/drivers/scsi/mpt3sas/mpi/mpi2.h (revision 0854065092a7a49a88bb592473abafb0cecd9f1c)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2f92363d1SSreekanth Reddy /*
3ff92b9ddSSuganath Prabu  * Copyright 2000-2020 Broadcom Inc. All rights reserved.
4f92363d1SSreekanth Reddy  *
5f92363d1SSreekanth Reddy  *
6f92363d1SSreekanth Reddy  *          Name:  mpi2.h
7f92363d1SSreekanth Reddy  *         Title:  MPI Message independent structures and definitions
8f92363d1SSreekanth Reddy  *                 including System Interface Register Set and
9f92363d1SSreekanth Reddy  *                 scatter/gather formats.
10f92363d1SSreekanth Reddy  * Creation Date:  June 21, 2006
11f92363d1SSreekanth Reddy  *
12635ee6c7SSuganath Prabu  *  mpi2.h Version:  02.00.54
13f92363d1SSreekanth Reddy  *
14f92363d1SSreekanth Reddy  * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
15f92363d1SSreekanth Reddy  *       prefix are for use only on MPI v2.5 products, and must not be used
16f92363d1SSreekanth Reddy  *       with MPI v2.0 products. Unless otherwise noted, names beginning with
17f92363d1SSreekanth Reddy  *       MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
18f92363d1SSreekanth Reddy  *
19f92363d1SSreekanth Reddy  * Version History
20f92363d1SSreekanth Reddy  * ---------------
21f92363d1SSreekanth Reddy  *
22f92363d1SSreekanth Reddy  * Date      Version   Description
23f92363d1SSreekanth Reddy  * --------  --------  ------------------------------------------------------
24f92363d1SSreekanth Reddy  * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
25f92363d1SSreekanth Reddy  * 06-04-07  02.00.01  Bumped MPI2_HEADER_VERSION_UNIT.
26f92363d1SSreekanth Reddy  * 06-26-07  02.00.02  Bumped MPI2_HEADER_VERSION_UNIT.
27f92363d1SSreekanth Reddy  * 08-31-07  02.00.03  Bumped MPI2_HEADER_VERSION_UNIT.
28f92363d1SSreekanth Reddy  *                     Moved ReplyPostHostIndex register to offset 0x6C of the
29f92363d1SSreekanth Reddy  *                     MPI2_SYSTEM_INTERFACE_REGS and modified the define for
30f92363d1SSreekanth Reddy  *                     MPI2_REPLY_POST_HOST_INDEX_OFFSET.
31f92363d1SSreekanth Reddy  *                     Added union of request descriptors.
32f92363d1SSreekanth Reddy  *                     Added union of reply descriptors.
33f92363d1SSreekanth Reddy  * 10-31-07  02.00.04  Bumped MPI2_HEADER_VERSION_UNIT.
34f92363d1SSreekanth Reddy  *                     Added define for MPI2_VERSION_02_00.
35f92363d1SSreekanth Reddy  *                     Fixed the size of the FunctionDependent5 field in the
36f92363d1SSreekanth Reddy  *                     MPI2_DEFAULT_REPLY structure.
37f92363d1SSreekanth Reddy  * 12-18-07  02.00.05  Bumped MPI2_HEADER_VERSION_UNIT.
38f92363d1SSreekanth Reddy  *                     Removed the MPI-defined Fault Codes and extended the
39f92363d1SSreekanth Reddy  *                     product specific codes up to 0xEFFF.
40f92363d1SSreekanth Reddy  *                     Added a sixth key value for the WriteSequence register
41f92363d1SSreekanth Reddy  *                     and changed the flush value to 0x0.
42f92363d1SSreekanth Reddy  *                     Added message function codes for Diagnostic Buffer Post
43f92363d1SSreekanth Reddy  *                     and Diagnsotic Release.
44f92363d1SSreekanth Reddy  *                     New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED
45f92363d1SSreekanth Reddy  *                     Moved MPI2_VERSION_UNION from mpi2_ioc.h.
46f92363d1SSreekanth Reddy  * 02-29-08  02.00.06  Bumped MPI2_HEADER_VERSION_UNIT.
47f92363d1SSreekanth Reddy  * 03-03-08  02.00.07  Bumped MPI2_HEADER_VERSION_UNIT.
48f92363d1SSreekanth Reddy  * 05-21-08  02.00.08  Bumped MPI2_HEADER_VERSION_UNIT.
49f92363d1SSreekanth Reddy  *                     Added #defines for marking a reply descriptor as unused.
50f92363d1SSreekanth Reddy  * 06-27-08  02.00.09  Bumped MPI2_HEADER_VERSION_UNIT.
51f92363d1SSreekanth Reddy  * 10-02-08  02.00.10  Bumped MPI2_HEADER_VERSION_UNIT.
52f92363d1SSreekanth Reddy  *                     Moved LUN field defines from mpi2_init.h.
53f92363d1SSreekanth Reddy  * 01-19-09  02.00.11  Bumped MPI2_HEADER_VERSION_UNIT.
54f92363d1SSreekanth Reddy  * 05-06-09  02.00.12  Bumped MPI2_HEADER_VERSION_UNIT.
55f92363d1SSreekanth Reddy  *                     In all request and reply descriptors, replaced VF_ID
56f92363d1SSreekanth Reddy  *                     field with MSIxIndex field.
57f92363d1SSreekanth Reddy  *                     Removed DevHandle field from
58f92363d1SSreekanth Reddy  *                     MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
59f92363d1SSreekanth Reddy  *                     bytes reserved.
60f92363d1SSreekanth Reddy  *                     Added RAID Accelerator functionality.
61f92363d1SSreekanth Reddy  * 07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
62f92363d1SSreekanth Reddy  * 10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
63f92363d1SSreekanth Reddy  *                     Added MSI-x index mask and shift for Reply Post Host
64f92363d1SSreekanth Reddy  *                     Index register.
65f92363d1SSreekanth Reddy  *                     Added function code for Host Based Discovery Action.
66f92363d1SSreekanth Reddy  * 02-10-10  02.00.15  Bumped MPI2_HEADER_VERSION_UNIT.
67f92363d1SSreekanth Reddy  *                     Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL.
68f92363d1SSreekanth Reddy  *                     Added defines for product-specific range of message
69f92363d1SSreekanth Reddy  *                     function codes, 0xF0 to 0xFF.
70f92363d1SSreekanth Reddy  * 05-12-10  02.00.16  Bumped MPI2_HEADER_VERSION_UNIT.
71f92363d1SSreekanth Reddy  *                     Added alternative defines for the SGE Direction bit.
72f92363d1SSreekanth Reddy  * 08-11-10  02.00.17  Bumped MPI2_HEADER_VERSION_UNIT.
73f92363d1SSreekanth Reddy  * 11-10-10  02.00.18  Bumped MPI2_HEADER_VERSION_UNIT.
74f92363d1SSreekanth Reddy  *                     Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define.
75f92363d1SSreekanth Reddy  * 02-23-11  02.00.19  Bumped MPI2_HEADER_VERSION_UNIT.
76f92363d1SSreekanth Reddy  *                     Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
77f92363d1SSreekanth Reddy  * 03-09-11  02.00.20  Bumped MPI2_HEADER_VERSION_UNIT.
78f92363d1SSreekanth Reddy  * 05-25-11  02.00.21  Bumped MPI2_HEADER_VERSION_UNIT.
79f92363d1SSreekanth Reddy  * 08-24-11  02.00.22  Bumped MPI2_HEADER_VERSION_UNIT.
80f92363d1SSreekanth Reddy  * 11-18-11  02.00.23  Bumped MPI2_HEADER_VERSION_UNIT.
81f92363d1SSreekanth Reddy  *                     Incorporating additions for MPI v2.5.
82f92363d1SSreekanth Reddy  * 02-06-12  02.00.24  Bumped MPI2_HEADER_VERSION_UNIT.
83f92363d1SSreekanth Reddy  * 03-29-12  02.00.25  Bumped MPI2_HEADER_VERSION_UNIT.
84f92363d1SSreekanth Reddy  *                     Added Hard Reset delay timings.
85f92363d1SSreekanth Reddy  * 07-10-12  02.00.26  Bumped MPI2_HEADER_VERSION_UNIT.
8617263e75SSreekanth Reddy  * 07-26-12  02.00.27  Bumped MPI2_HEADER_VERSION_UNIT.
8717263e75SSreekanth Reddy  * 11-27-12  02.00.28  Bumped MPI2_HEADER_VERSION_UNIT.
8817263e75SSreekanth Reddy  * 12-20-12  02.00.29  Bumped MPI2_HEADER_VERSION_UNIT.
8917263e75SSreekanth Reddy  *                     Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET.
90861ff736SSreekanth Reddy  * 04-09-13  02.00.30  Bumped MPI2_HEADER_VERSION_UNIT.
91861ff736SSreekanth Reddy  * 04-17-13  02.00.31  Bumped MPI2_HEADER_VERSION_UNIT.
92a94bea34SSreekanth Reddy  * 08-19-13  02.00.32  Bumped MPI2_HEADER_VERSION_UNIT.
93a94bea34SSreekanth Reddy  * 12-05-13  02.00.33  Bumped MPI2_HEADER_VERSION_UNIT.
9435c319b4SSreekanth Reddy  * 01-08-14  02.00.34  Bumped MPI2_HEADER_VERSION_UNIT
95a6f84009SSreekanth Reddy  * 06-13-14  02.00.35  Bumped MPI2_HEADER_VERSION_UNIT.
96b130b0d5SSuganath prabu Subramani  * 11-18-14  02.00.36  Updated copyright information.
97b130b0d5SSuganath prabu Subramani  *                     Bumped MPI2_HEADER_VERSION_UNIT.
985c739b61SSuganath prabu Subramani  * 03-16-15  02.00.37  Bumped MPI2_HEADER_VERSION_UNIT.
99b130b0d5SSuganath prabu Subramani  *                     Added Scratchpad registers to
100b130b0d5SSuganath prabu Subramani  *                     MPI2_SYSTEM_INTERFACE_REGS.
101b130b0d5SSuganath prabu Subramani  *                     Added MPI2_DIAG_SBR_RELOAD.
1025c739b61SSuganath prabu Subramani  * 03-19-15  02.00.38  Bumped MPI2_HEADER_VERSION_UNIT.
1035c739b61SSuganath prabu Subramani  * 05-25-15  02.00.39  Bumped MPI2_HEADER_VERSION_UNIT.
1044fe6bc97SChaitra P B  * 08-25-15  02.00.40  Bumped MPI2_HEADER_VERSION_UNIT.
1054fe6bc97SChaitra P B  * 12-15-15  02.00.41  Bumped MPI_HEADER_VERSION_UNIT
1064fe6bc97SChaitra P B  * 01-01-16  02.00.42  Bumped MPI_HEADER_VERSION_UNIT
10790e7a701SSreekanth Reddy  * 04-05-16  02.00.43  Modified  MPI26_DIAG_BOOT_DEVICE_SELECT defines
10890e7a701SSreekanth Reddy  *                     to be unique within first 32 characters.
10990e7a701SSreekanth Reddy  *                     Removed AHCI support.
11090e7a701SSreekanth Reddy  *                     Removed SOP support.
11190e7a701SSreekanth Reddy  *                     Bumped MPI2_HEADER_VERSION_UNIT.
11290e7a701SSreekanth Reddy  * 04-10-16  02.00.44  Bumped MPI2_HEADER_VERSION_UNIT.
11390e7a701SSreekanth Reddy  * 07-06-16  02.00.45  Bumped MPI2_HEADER_VERSION_UNIT.
11490e7a701SSreekanth Reddy  * 09-02-16  02.00.46  Bumped MPI2_HEADER_VERSION_UNIT.
11590e7a701SSreekanth Reddy  * 11-23-16  02.00.47  Bumped MPI2_HEADER_VERSION_UNIT.
11690e7a701SSreekanth Reddy  * 02-03-17  02.00.48  Bumped MPI2_HEADER_VERSION_UNIT.
11765928d1fSChaitra P B  * 06-13-17  02.00.49  Bumped MPI2_HEADER_VERSION_UNIT.
11865928d1fSChaitra P B  * 09-29-17  02.00.50  Bumped MPI2_HEADER_VERSION_UNIT.
119ff92b9ddSSuganath Prabu  * 07-22-18  02.00.51  Added SECURE_BOOT define.
120ff92b9ddSSuganath Prabu  *                     Bumped MPI2_HEADER_VERSION_UNIT
121ff92b9ddSSuganath Prabu  * 08-15-18  02.00.52  Bumped MPI2_HEADER_VERSION_UNIT.
122ff92b9ddSSuganath Prabu  * 08-28-18  02.00.53  Bumped MPI2_HEADER_VERSION_UNIT.
123ff92b9ddSSuganath Prabu  *                     Added MPI2_IOCSTATUS_FAILURE
124635ee6c7SSuganath Prabu  * 12-17-18  02.00.54  Bumped MPI2_HEADER_VERSION_UNIT
1251ade26b6SSreekanth Reddy  * 06-24-19  02.00.55  Bumped MPI2_HEADER_VERSION_UNIT
1261ade26b6SSreekanth Reddy  * 08-01-19  02.00.56  Bumped MPI2_HEADER_VERSION_UNIT
1271ade26b6SSreekanth Reddy  * 10-02-19  02.00.57  Bumped MPI2_HEADER_VERSION_UNIT
128f92363d1SSreekanth Reddy  *  --------------------------------------------------------------------------
129f92363d1SSreekanth Reddy  */
130f92363d1SSreekanth Reddy 
131f92363d1SSreekanth Reddy #ifndef MPI2_H
132f92363d1SSreekanth Reddy #define MPI2_H
133f92363d1SSreekanth Reddy 
134f92363d1SSreekanth Reddy /*****************************************************************************
135f92363d1SSreekanth Reddy *
136f92363d1SSreekanth Reddy *       MPI Version Definitions
137f92363d1SSreekanth Reddy *
138f92363d1SSreekanth Reddy *****************************************************************************/
139f92363d1SSreekanth Reddy 
140f92363d1SSreekanth Reddy #define MPI2_VERSION_MAJOR_MASK             (0xFF00)
141f92363d1SSreekanth Reddy #define MPI2_VERSION_MAJOR_SHIFT            (8)
142f92363d1SSreekanth Reddy #define MPI2_VERSION_MINOR_MASK             (0x00FF)
143f92363d1SSreekanth Reddy #define MPI2_VERSION_MINOR_SHIFT            (0)
144f92363d1SSreekanth Reddy 
145f92363d1SSreekanth Reddy /*major version for all MPI v2.x */
146f92363d1SSreekanth Reddy #define MPI2_VERSION_MAJOR                  (0x02)
147f92363d1SSreekanth Reddy 
148f92363d1SSreekanth Reddy /*minor version for MPI v2.0 compatible products */
149f92363d1SSreekanth Reddy #define MPI2_VERSION_MINOR                  (0x00)
150f92363d1SSreekanth Reddy #define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
151f92363d1SSreekanth Reddy 					MPI2_VERSION_MINOR)
152f92363d1SSreekanth Reddy #define MPI2_VERSION_02_00                  (0x0200)
153f92363d1SSreekanth Reddy 
154f92363d1SSreekanth Reddy /*minor version for MPI v2.5 compatible products */
155f92363d1SSreekanth Reddy #define MPI25_VERSION_MINOR                 (0x05)
156f92363d1SSreekanth Reddy #define MPI25_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
157f92363d1SSreekanth Reddy 					MPI25_VERSION_MINOR)
158f92363d1SSreekanth Reddy #define MPI2_VERSION_02_05                  (0x0205)
159f92363d1SSreekanth Reddy 
160b130b0d5SSuganath prabu Subramani /*minor version for MPI v2.6 compatible products */
161b130b0d5SSuganath prabu Subramani #define MPI26_VERSION_MINOR		    (0x06)
162b130b0d5SSuganath prabu Subramani #define MPI26_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
163b130b0d5SSuganath prabu Subramani 					MPI26_VERSION_MINOR)
164b130b0d5SSuganath prabu Subramani #define MPI2_VERSION_02_06		    (0x0206)
165b130b0d5SSuganath prabu Subramani 
16665928d1fSChaitra P B 
167f92363d1SSreekanth Reddy /* Unit and Dev versioning for this MPI header set */
1681ade26b6SSreekanth Reddy #define MPI2_HEADER_VERSION_UNIT            (0x39)
169f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION_DEV             (0x00)
170f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION_UNIT_MASK       (0xFF00)
171f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION_UNIT_SHIFT      (8)
172f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION_DEV_MASK        (0x00FF)
173f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION_DEV_SHIFT       (0)
174f92363d1SSreekanth Reddy #define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | \
175f92363d1SSreekanth Reddy 					MPI2_HEADER_VERSION_DEV)
176f92363d1SSreekanth Reddy 
177f92363d1SSreekanth Reddy /*****************************************************************************
178f92363d1SSreekanth Reddy *
179f92363d1SSreekanth Reddy *       IOC State Definitions
180f92363d1SSreekanth Reddy *
181f92363d1SSreekanth Reddy *****************************************************************************/
182f92363d1SSreekanth Reddy 
183f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_RESET               (0x00000000)
184f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_READY               (0x10000000)
185f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_OPERATIONAL         (0x20000000)
186f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_FAULT               (0x40000000)
1871ade26b6SSreekanth Reddy #define MPI2_IOC_STATE_COREDUMP            (0x50000000)
188f92363d1SSreekanth Reddy 
189f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_MASK                (0xF0000000)
190f92363d1SSreekanth Reddy #define MPI2_IOC_STATE_SHIFT               (28)
191f92363d1SSreekanth Reddy 
192f92363d1SSreekanth Reddy /*Fault state range for prodcut specific codes */
193f92363d1SSreekanth Reddy #define MPI2_FAULT_PRODUCT_SPECIFIC_MIN                 (0x0000)
194f92363d1SSreekanth Reddy #define MPI2_FAULT_PRODUCT_SPECIFIC_MAX                 (0xEFFF)
195f92363d1SSreekanth Reddy 
196f92363d1SSreekanth Reddy /*****************************************************************************
197f92363d1SSreekanth Reddy *
198f92363d1SSreekanth Reddy *       System Interface Register Definitions
199f92363d1SSreekanth Reddy *
200f92363d1SSreekanth Reddy *****************************************************************************/
201f92363d1SSreekanth Reddy 
202*08540650SRanjan Kumar typedef struct _MPI2_SYSTEM_INTERFACE_REGS {
203f92363d1SSreekanth Reddy 	U32 Doorbell;		/*0x00 */
204f92363d1SSreekanth Reddy 	U32 WriteSequence;	/*0x04 */
205f92363d1SSreekanth Reddy 	U32 HostDiagnostic;	/*0x08 */
206f92363d1SSreekanth Reddy 	U32 Reserved1;		/*0x0C */
207f92363d1SSreekanth Reddy 	U32 DiagRWData;		/*0x10 */
208f92363d1SSreekanth Reddy 	U32 DiagRWAddressLow;	/*0x14 */
209f92363d1SSreekanth Reddy 	U32 DiagRWAddressHigh;	/*0x18 */
210f92363d1SSreekanth Reddy 	U32 Reserved2[5];	/*0x1C */
211f92363d1SSreekanth Reddy 	U32 HostInterruptStatus;	/*0x30 */
212f92363d1SSreekanth Reddy 	U32 HostInterruptMask;	/*0x34 */
213f92363d1SSreekanth Reddy 	U32 DCRData;		/*0x38 */
214f92363d1SSreekanth Reddy 	U32 DCRAddress;		/*0x3C */
215f92363d1SSreekanth Reddy 	U32 Reserved3[2];	/*0x40 */
216f92363d1SSreekanth Reddy 	U32 ReplyFreeHostIndex;	/*0x48 */
217f92363d1SSreekanth Reddy 	U32 Reserved4[8];	/*0x4C */
218f92363d1SSreekanth Reddy 	U32 ReplyPostHostIndex;	/*0x6C */
219f92363d1SSreekanth Reddy 	U32 Reserved5;		/*0x70 */
220f92363d1SSreekanth Reddy 	U32 HCBSize;		/*0x74 */
221f92363d1SSreekanth Reddy 	U32 HCBAddressLow;	/*0x78 */
222f92363d1SSreekanth Reddy 	U32 HCBAddressHigh;	/*0x7C */
223b130b0d5SSuganath prabu Subramani 	U32 Reserved6[12];	/*0x80 */
224b130b0d5SSuganath prabu Subramani 	U32 Scratchpad[4];	/*0xB0 */
225f92363d1SSreekanth Reddy 	U32 RequestDescriptorPostLow;	/*0xC0 */
226f92363d1SSreekanth Reddy 	U32 RequestDescriptorPostHigh;	/*0xC4 */
227b130b0d5SSuganath prabu Subramani 	U32 AtomicRequestDescriptorPost;/*0xC8 */
228b130b0d5SSuganath prabu Subramani 	U32 Reserved7[13];	/*0xCC */
229f92363d1SSreekanth Reddy } MPI2_SYSTEM_INTERFACE_REGS,
230f92363d1SSreekanth Reddy 	*PTR_MPI2_SYSTEM_INTERFACE_REGS,
231f92363d1SSreekanth Reddy 	Mpi2SystemInterfaceRegs_t,
232f92363d1SSreekanth Reddy 	*pMpi2SystemInterfaceRegs_t;
233f92363d1SSreekanth Reddy 
234f92363d1SSreekanth Reddy /*
235f92363d1SSreekanth Reddy  *Defines for working with the Doorbell register.
236f92363d1SSreekanth Reddy  */
237f92363d1SSreekanth Reddy #define MPI2_DOORBELL_OFFSET                    (0x00000000)
238f92363d1SSreekanth Reddy 
239f92363d1SSreekanth Reddy /*IOC --> System values */
240f92363d1SSreekanth Reddy #define MPI2_DOORBELL_USED                      (0x08000000)
241f92363d1SSreekanth Reddy #define MPI2_DOORBELL_WHO_INIT_MASK             (0x07000000)
242f92363d1SSreekanth Reddy #define MPI2_DOORBELL_WHO_INIT_SHIFT            (24)
243f92363d1SSreekanth Reddy #define MPI2_DOORBELL_FAULT_CODE_MASK           (0x0000FFFF)
244f92363d1SSreekanth Reddy #define MPI2_DOORBELL_DATA_MASK                 (0x0000FFFF)
245f92363d1SSreekanth Reddy 
246f92363d1SSreekanth Reddy /*System --> IOC values */
247f92363d1SSreekanth Reddy #define MPI2_DOORBELL_FUNCTION_MASK             (0xFF000000)
248f92363d1SSreekanth Reddy #define MPI2_DOORBELL_FUNCTION_SHIFT            (24)
249f92363d1SSreekanth Reddy #define MPI2_DOORBELL_ADD_DWORDS_MASK           (0x00FF0000)
250f92363d1SSreekanth Reddy #define MPI2_DOORBELL_ADD_DWORDS_SHIFT          (16)
251f92363d1SSreekanth Reddy 
252f92363d1SSreekanth Reddy /*
253f92363d1SSreekanth Reddy  *Defines for the WriteSequence register
254f92363d1SSreekanth Reddy  */
255f92363d1SSreekanth Reddy #define MPI2_WRITE_SEQUENCE_OFFSET              (0x00000004)
256f92363d1SSreekanth Reddy #define MPI2_WRSEQ_KEY_VALUE_MASK               (0x0000000F)
257f92363d1SSreekanth Reddy #define MPI2_WRSEQ_FLUSH_KEY_VALUE              (0x0)
258f92363d1SSreekanth Reddy #define MPI2_WRSEQ_1ST_KEY_VALUE                (0xF)
259f92363d1SSreekanth Reddy #define MPI2_WRSEQ_2ND_KEY_VALUE                (0x4)
260f92363d1SSreekanth Reddy #define MPI2_WRSEQ_3RD_KEY_VALUE                (0xB)
261f92363d1SSreekanth Reddy #define MPI2_WRSEQ_4TH_KEY_VALUE                (0x2)
262f92363d1SSreekanth Reddy #define MPI2_WRSEQ_5TH_KEY_VALUE                (0x7)
263f92363d1SSreekanth Reddy #define MPI2_WRSEQ_6TH_KEY_VALUE                (0xD)
264f92363d1SSreekanth Reddy 
265f92363d1SSreekanth Reddy /*
266f92363d1SSreekanth Reddy  *Defines for the HostDiagnostic register
267f92363d1SSreekanth Reddy  */
268f92363d1SSreekanth Reddy #define MPI2_HOST_DIAGNOSTIC_OFFSET             (0x00000008)
269f92363d1SSreekanth Reddy 
270ff92b9ddSSuganath Prabu #define MPI26_DIAG_SECURE_BOOT                  (0x80000000)
271ff92b9ddSSuganath Prabu 
272b130b0d5SSuganath prabu Subramani #define MPI2_DIAG_SBR_RELOAD                    (0x00002000)
273b130b0d5SSuganath prabu Subramani 
274f92363d1SSreekanth Reddy #define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK       (0x00001800)
275f92363d1SSreekanth Reddy #define MPI2_DIAG_BOOT_DEVICE_SELECT_DEFAULT    (0x00000000)
276f92363d1SSreekanth Reddy #define MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW       (0x00000800)
277f92363d1SSreekanth Reddy 
27890e7a701SSreekanth Reddy /* Defines for V7A/V7R HostDiagnostic Register */
27990e7a701SSreekanth Reddy #define MPI26_DIAG_BOOT_DEVICE_SEL_64FLASH      (0x00000000)
28090e7a701SSreekanth Reddy #define MPI26_DIAG_BOOT_DEVICE_SEL_64HCDW       (0x00000800)
28190e7a701SSreekanth Reddy #define MPI26_DIAG_BOOT_DEVICE_SEL_32FLASH      (0x00001000)
28290e7a701SSreekanth Reddy #define MPI26_DIAG_BOOT_DEVICE_SEL_32HCDW       (0x00001800)
28390e7a701SSreekanth Reddy 
284f92363d1SSreekanth Reddy #define MPI2_DIAG_CLEAR_FLASH_BAD_SIG           (0x00000400)
285f92363d1SSreekanth Reddy #define MPI2_DIAG_FORCE_HCB_ON_RESET            (0x00000200)
286f92363d1SSreekanth Reddy #define MPI2_DIAG_HCB_MODE                      (0x00000100)
287f92363d1SSreekanth Reddy #define MPI2_DIAG_DIAG_WRITE_ENABLE             (0x00000080)
288f92363d1SSreekanth Reddy #define MPI2_DIAG_FLASH_BAD_SIG                 (0x00000040)
289f92363d1SSreekanth Reddy #define MPI2_DIAG_RESET_HISTORY                 (0x00000020)
290f92363d1SSreekanth Reddy #define MPI2_DIAG_DIAG_RW_ENABLE                (0x00000010)
291f92363d1SSreekanth Reddy #define MPI2_DIAG_RESET_ADAPTER                 (0x00000004)
292f92363d1SSreekanth Reddy #define MPI2_DIAG_HOLD_IOC_RESET                (0x00000002)
293f92363d1SSreekanth Reddy 
294f92363d1SSreekanth Reddy /*
295f92363d1SSreekanth Reddy  *Offsets for DiagRWData and address
296f92363d1SSreekanth Reddy  */
297f92363d1SSreekanth Reddy #define MPI2_DIAG_RW_DATA_OFFSET                (0x00000010)
298f92363d1SSreekanth Reddy #define MPI2_DIAG_RW_ADDRESS_LOW_OFFSET         (0x00000014)
299f92363d1SSreekanth Reddy #define MPI2_DIAG_RW_ADDRESS_HIGH_OFFSET        (0x00000018)
300f92363d1SSreekanth Reddy 
301f92363d1SSreekanth Reddy /*
302f92363d1SSreekanth Reddy  *Defines for the HostInterruptStatus register
303f92363d1SSreekanth Reddy  */
304f92363d1SSreekanth Reddy #define MPI2_HOST_INTERRUPT_STATUS_OFFSET       (0x00000030)
305f92363d1SSreekanth Reddy #define MPI2_HIS_SYS2IOC_DB_STATUS              (0x80000000)
306f92363d1SSreekanth Reddy #define MPI2_HIS_IOP_DOORBELL_STATUS MPI2_HIS_SYS2IOC_DB_STATUS
307f92363d1SSreekanth Reddy #define MPI2_HIS_RESET_IRQ_STATUS               (0x40000000)
308f92363d1SSreekanth Reddy #define MPI2_HIS_REPLY_DESCRIPTOR_INTERRUPT     (0x00000008)
309f92363d1SSreekanth Reddy #define MPI2_HIS_IOC2SYS_DB_STATUS              (0x00000001)
310f92363d1SSreekanth Reddy #define MPI2_HIS_DOORBELL_INTERRUPT MPI2_HIS_IOC2SYS_DB_STATUS
311f92363d1SSreekanth Reddy 
312f92363d1SSreekanth Reddy /*
313f92363d1SSreekanth Reddy  *Defines for the HostInterruptMask register
314f92363d1SSreekanth Reddy  */
315f92363d1SSreekanth Reddy #define MPI2_HOST_INTERRUPT_MASK_OFFSET         (0x00000034)
316f92363d1SSreekanth Reddy #define MPI2_HIM_RESET_IRQ_MASK                 (0x40000000)
317f92363d1SSreekanth Reddy #define MPI2_HIM_REPLY_INT_MASK                 (0x00000008)
318f92363d1SSreekanth Reddy #define MPI2_HIM_RIM                            MPI2_HIM_REPLY_INT_MASK
319f92363d1SSreekanth Reddy #define MPI2_HIM_IOC2SYS_DB_MASK                (0x00000001)
320f92363d1SSreekanth Reddy #define MPI2_HIM_DIM                            MPI2_HIM_IOC2SYS_DB_MASK
321f92363d1SSreekanth Reddy 
322f92363d1SSreekanth Reddy /*
323f92363d1SSreekanth Reddy  *Offsets for DCRData and address
324f92363d1SSreekanth Reddy  */
325f92363d1SSreekanth Reddy #define MPI2_DCR_DATA_OFFSET                    (0x00000038)
326f92363d1SSreekanth Reddy #define MPI2_DCR_ADDRESS_OFFSET                 (0x0000003C)
327f92363d1SSreekanth Reddy 
328f92363d1SSreekanth Reddy /*
329f92363d1SSreekanth Reddy  *Offset for the Reply Free Queue
330f92363d1SSreekanth Reddy  */
331f92363d1SSreekanth Reddy #define MPI2_REPLY_FREE_HOST_INDEX_OFFSET       (0x00000048)
332f92363d1SSreekanth Reddy 
333f92363d1SSreekanth Reddy /*
334f92363d1SSreekanth Reddy  *Defines for the Reply Descriptor Post Queue
335f92363d1SSreekanth Reddy  */
336f92363d1SSreekanth Reddy #define MPI2_REPLY_POST_HOST_INDEX_OFFSET       (0x0000006C)
337f92363d1SSreekanth Reddy #define MPI2_REPLY_POST_HOST_INDEX_MASK         (0x00FFFFFF)
338f92363d1SSreekanth Reddy #define MPI2_RPHI_MSIX_INDEX_MASK               (0xFF000000)
339f92363d1SSreekanth Reddy #define MPI2_RPHI_MSIX_INDEX_SHIFT              (24)
34017263e75SSreekanth Reddy #define MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET  (0x0000030C) /*MPI v2.5 only*/
34117263e75SSreekanth Reddy 
342f92363d1SSreekanth Reddy 
343f92363d1SSreekanth Reddy /*
344f92363d1SSreekanth Reddy  *Defines for the HCBSize and address
345f92363d1SSreekanth Reddy  */
346f92363d1SSreekanth Reddy #define MPI2_HCB_SIZE_OFFSET                    (0x00000074)
347f92363d1SSreekanth Reddy #define MPI2_HCB_SIZE_SIZE_MASK                 (0xFFFFF000)
348f92363d1SSreekanth Reddy #define MPI2_HCB_SIZE_HCB_ENABLE                (0x00000001)
349f92363d1SSreekanth Reddy 
350f92363d1SSreekanth Reddy #define MPI2_HCB_ADDRESS_LOW_OFFSET             (0x00000078)
351f92363d1SSreekanth Reddy #define MPI2_HCB_ADDRESS_HIGH_OFFSET            (0x0000007C)
352f92363d1SSreekanth Reddy 
353f92363d1SSreekanth Reddy /*
354b130b0d5SSuganath prabu Subramani  *Offsets for the Scratchpad registers
355b130b0d5SSuganath prabu Subramani  */
356b130b0d5SSuganath prabu Subramani #define MPI26_SCRATCHPAD0_OFFSET                (0x000000B0)
357b130b0d5SSuganath prabu Subramani #define MPI26_SCRATCHPAD1_OFFSET                (0x000000B4)
358b130b0d5SSuganath prabu Subramani #define MPI26_SCRATCHPAD2_OFFSET                (0x000000B8)
359b130b0d5SSuganath prabu Subramani #define MPI26_SCRATCHPAD3_OFFSET                (0x000000BC)
360b130b0d5SSuganath prabu Subramani 
361b130b0d5SSuganath prabu Subramani /*
362b130b0d5SSuganath prabu Subramani  *Offsets for the Request Descriptor Post Queue
363f92363d1SSreekanth Reddy  */
364f92363d1SSreekanth Reddy #define MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET     (0x000000C0)
365f92363d1SSreekanth Reddy #define MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET    (0x000000C4)
366b130b0d5SSuganath prabu Subramani #define MPI26_ATOMIC_REQUEST_DESCRIPTOR_POST_OFFSET (0x000000C8)
367f92363d1SSreekanth Reddy 
368f92363d1SSreekanth Reddy /*Hard Reset delay timings */
369f92363d1SSreekanth Reddy #define MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC     (50000)
370f92363d1SSreekanth Reddy #define MPI2_HARD_RESET_PCIE_RESET_READ_WINDOW_MICRO_SEC    (255000)
371f92363d1SSreekanth Reddy #define MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC    (256000)
372f92363d1SSreekanth Reddy 
373f92363d1SSreekanth Reddy /*****************************************************************************
374f92363d1SSreekanth Reddy *
375f92363d1SSreekanth Reddy *       Message Descriptors
376f92363d1SSreekanth Reddy *
377f92363d1SSreekanth Reddy *****************************************************************************/
378f92363d1SSreekanth Reddy 
379f92363d1SSreekanth Reddy /*Request Descriptors */
380f92363d1SSreekanth Reddy 
381f92363d1SSreekanth Reddy /*Default Request Descriptor */
382f92363d1SSreekanth Reddy typedef struct _MPI2_DEFAULT_REQUEST_DESCRIPTOR {
383f92363d1SSreekanth Reddy 	U8 RequestFlags;	/*0x00 */
384f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
385f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
386f92363d1SSreekanth Reddy 	U16 LMID;		/*0x04 */
387f92363d1SSreekanth Reddy 	U16 DescriptorTypeDependent;	/*0x06 */
388f92363d1SSreekanth Reddy } MPI2_DEFAULT_REQUEST_DESCRIPTOR,
389f92363d1SSreekanth Reddy 	*PTR_MPI2_DEFAULT_REQUEST_DESCRIPTOR,
390f92363d1SSreekanth Reddy 	Mpi2DefaultRequestDescriptor_t,
391f92363d1SSreekanth Reddy 	*pMpi2DefaultRequestDescriptor_t;
392f92363d1SSreekanth Reddy 
393f92363d1SSreekanth Reddy /*defines for the RequestFlags field */
394b130b0d5SSuganath prabu Subramani #define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK               (0x1E)
395b130b0d5SSuganath prabu Subramani #define MPI2_REQ_DESCRIPT_FLAGS_TYPE_RSHIFT             (1)
396f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO                 (0x00)
397f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET             (0x02)
398f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY           (0x06)
399f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE            (0x08)
400f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_RAID_ACCELERATOR        (0x0A)
401f92363d1SSreekanth Reddy #define MPI25_REQ_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO      (0x0C)
40290e7a701SSreekanth Reddy #define MPI26_REQ_DESCRIPT_FLAGS_PCIE_ENCAPSULATED      (0x10)
403f92363d1SSreekanth Reddy 
404f92363d1SSreekanth Reddy #define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER         (0x01)
405f92363d1SSreekanth Reddy 
406f92363d1SSreekanth Reddy /*High Priority Request Descriptor */
407f92363d1SSreekanth Reddy typedef struct _MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR {
408f92363d1SSreekanth Reddy 	U8 RequestFlags;	/*0x00 */
409f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
410f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
411f92363d1SSreekanth Reddy 	U16 LMID;		/*0x04 */
412f92363d1SSreekanth Reddy 	U16 Reserved1;		/*0x06 */
413f92363d1SSreekanth Reddy } MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR,
414f92363d1SSreekanth Reddy 	*PTR_MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR,
415f92363d1SSreekanth Reddy 	Mpi2HighPriorityRequestDescriptor_t,
416f92363d1SSreekanth Reddy 	*pMpi2HighPriorityRequestDescriptor_t;
417f92363d1SSreekanth Reddy 
418f92363d1SSreekanth Reddy /*SCSI IO Request Descriptor */
419f92363d1SSreekanth Reddy typedef struct _MPI2_SCSI_IO_REQUEST_DESCRIPTOR {
420f92363d1SSreekanth Reddy 	U8 RequestFlags;	/*0x00 */
421f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
422f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
423f92363d1SSreekanth Reddy 	U16 LMID;		/*0x04 */
424f92363d1SSreekanth Reddy 	U16 DevHandle;		/*0x06 */
425f92363d1SSreekanth Reddy } MPI2_SCSI_IO_REQUEST_DESCRIPTOR,
426f92363d1SSreekanth Reddy 	*PTR_MPI2_SCSI_IO_REQUEST_DESCRIPTOR,
427f92363d1SSreekanth Reddy 	Mpi2SCSIIORequestDescriptor_t,
428f92363d1SSreekanth Reddy 	*pMpi2SCSIIORequestDescriptor_t;
429f92363d1SSreekanth Reddy 
430f92363d1SSreekanth Reddy /*SCSI Target Request Descriptor */
431f92363d1SSreekanth Reddy typedef struct _MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR {
432f92363d1SSreekanth Reddy 	U8 RequestFlags;	/*0x00 */
433f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
434f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
435f92363d1SSreekanth Reddy 	U16 LMID;		/*0x04 */
436f92363d1SSreekanth Reddy 	U16 IoIndex;		/*0x06 */
437f92363d1SSreekanth Reddy } MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR,
438f92363d1SSreekanth Reddy 	*PTR_MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR,
439f92363d1SSreekanth Reddy 	Mpi2SCSITargetRequestDescriptor_t,
440f92363d1SSreekanth Reddy 	*pMpi2SCSITargetRequestDescriptor_t;
441f92363d1SSreekanth Reddy 
442f92363d1SSreekanth Reddy /*RAID Accelerator Request Descriptor */
443f92363d1SSreekanth Reddy typedef struct _MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR {
444f92363d1SSreekanth Reddy 	U8 RequestFlags;	/*0x00 */
445f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
446f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
447f92363d1SSreekanth Reddy 	U16 LMID;		/*0x04 */
448f92363d1SSreekanth Reddy 	U16 Reserved;		/*0x06 */
449f92363d1SSreekanth Reddy } MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR,
450f92363d1SSreekanth Reddy 	*PTR_MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR,
451f92363d1SSreekanth Reddy 	Mpi2RAIDAcceleratorRequestDescriptor_t,
452f92363d1SSreekanth Reddy 	*pMpi2RAIDAcceleratorRequestDescriptor_t;
453f92363d1SSreekanth Reddy 
454f92363d1SSreekanth Reddy /*Fast Path SCSI IO Request Descriptor */
455f92363d1SSreekanth Reddy typedef MPI2_SCSI_IO_REQUEST_DESCRIPTOR
456f92363d1SSreekanth Reddy 	MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR,
457f92363d1SSreekanth Reddy 	*PTR_MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR,
458f92363d1SSreekanth Reddy 	Mpi25FastPathSCSIIORequestDescriptor_t,
459f92363d1SSreekanth Reddy 	*pMpi25FastPathSCSIIORequestDescriptor_t;
460f92363d1SSreekanth Reddy 
46190e7a701SSreekanth Reddy /*PCIe Encapsulated Request Descriptor */
46290e7a701SSreekanth Reddy typedef MPI2_SCSI_IO_REQUEST_DESCRIPTOR
46390e7a701SSreekanth Reddy 	MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR,
46490e7a701SSreekanth Reddy 	*PTR_MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR,
46590e7a701SSreekanth Reddy 	Mpi26PCIeEncapsulatedRequestDescriptor_t,
46690e7a701SSreekanth Reddy 	*pMpi26PCIeEncapsulatedRequestDescriptor_t;
46790e7a701SSreekanth Reddy 
468f92363d1SSreekanth Reddy /*union of Request Descriptors */
469f92363d1SSreekanth Reddy typedef union _MPI2_REQUEST_DESCRIPTOR_UNION {
470f92363d1SSreekanth Reddy 	MPI2_DEFAULT_REQUEST_DESCRIPTOR Default;
471f92363d1SSreekanth Reddy 	MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority;
472f92363d1SSreekanth Reddy 	MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO;
473f92363d1SSreekanth Reddy 	MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget;
474f92363d1SSreekanth Reddy 	MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator;
475f92363d1SSreekanth Reddy 	MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR FastPathSCSIIO;
47690e7a701SSreekanth Reddy 	MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR PCIeEncapsulated;
477f92363d1SSreekanth Reddy 	U64 Words;
478f92363d1SSreekanth Reddy } MPI2_REQUEST_DESCRIPTOR_UNION,
479f92363d1SSreekanth Reddy 	*PTR_MPI2_REQUEST_DESCRIPTOR_UNION,
480f92363d1SSreekanth Reddy 	Mpi2RequestDescriptorUnion_t,
481f92363d1SSreekanth Reddy 	*pMpi2RequestDescriptorUnion_t;
482f92363d1SSreekanth Reddy 
483b130b0d5SSuganath prabu Subramani /*Atomic Request Descriptors */
484b130b0d5SSuganath prabu Subramani 
485b130b0d5SSuganath prabu Subramani /*
486b130b0d5SSuganath prabu Subramani  * All Atomic Request Descriptors have the same format, so the following
487b130b0d5SSuganath prabu Subramani  * structure is used for all Atomic Request Descriptors:
488b130b0d5SSuganath prabu Subramani  *      Atomic Default Request Descriptor
489b130b0d5SSuganath prabu Subramani  *      Atomic High Priority Request Descriptor
490b130b0d5SSuganath prabu Subramani  *      Atomic SCSI IO Request Descriptor
491b130b0d5SSuganath prabu Subramani  *      Atomic SCSI Target Request Descriptor
492b130b0d5SSuganath prabu Subramani  *      Atomic RAID Accelerator Request Descriptor
493b130b0d5SSuganath prabu Subramani  *      Atomic Fast Path SCSI IO Request Descriptor
49490e7a701SSreekanth Reddy  *      Atomic PCIe Encapsulated Request Descriptor
495b130b0d5SSuganath prabu Subramani  */
496b130b0d5SSuganath prabu Subramani 
497b130b0d5SSuganath prabu Subramani /*Atomic Request Descriptor */
498b130b0d5SSuganath prabu Subramani typedef struct _MPI26_ATOMIC_REQUEST_DESCRIPTOR {
499b130b0d5SSuganath prabu Subramani 	U8 RequestFlags;	/* 0x00 */
500b130b0d5SSuganath prabu Subramani 	U8 MSIxIndex;		/* 0x01 */
501b130b0d5SSuganath prabu Subramani 	U16 SMID;		/* 0x02 */
502b130b0d5SSuganath prabu Subramani } MPI26_ATOMIC_REQUEST_DESCRIPTOR,
503b130b0d5SSuganath prabu Subramani 	*PTR_MPI26_ATOMIC_REQUEST_DESCRIPTOR,
504b130b0d5SSuganath prabu Subramani 	Mpi26AtomicRequestDescriptor_t,
505b130b0d5SSuganath prabu Subramani 	*pMpi26AtomicRequestDescriptor_t;
506b130b0d5SSuganath prabu Subramani 
507b130b0d5SSuganath prabu Subramani /*for the RequestFlags field, use the same
508b130b0d5SSuganath prabu Subramani  *defines as MPI2_DEFAULT_REQUEST_DESCRIPTOR
509b130b0d5SSuganath prabu Subramani  */
510b130b0d5SSuganath prabu Subramani 
511f92363d1SSreekanth Reddy /*Reply Descriptors */
512f92363d1SSreekanth Reddy 
513f92363d1SSreekanth Reddy /*Default Reply Descriptor */
514f92363d1SSreekanth Reddy typedef struct _MPI2_DEFAULT_REPLY_DESCRIPTOR {
515f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
516f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
517f92363d1SSreekanth Reddy 	U16 DescriptorTypeDependent1;	/*0x02 */
518f92363d1SSreekanth Reddy 	U32 DescriptorTypeDependent2;	/*0x04 */
519f92363d1SSreekanth Reddy } MPI2_DEFAULT_REPLY_DESCRIPTOR,
520f92363d1SSreekanth Reddy 	*PTR_MPI2_DEFAULT_REPLY_DESCRIPTOR,
521f92363d1SSreekanth Reddy 	Mpi2DefaultReplyDescriptor_t,
522f92363d1SSreekanth Reddy 	*pMpi2DefaultReplyDescriptor_t;
523f92363d1SSreekanth Reddy 
524f92363d1SSreekanth Reddy /*defines for the ReplyFlags field */
525f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK                   (0x0F)
526f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS             (0x00)
527f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY               (0x01)
528f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_TARGETASSIST_SUCCESS        (0x02)
529f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER       (0x03)
530f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_RAID_ACCELERATOR_SUCCESS    (0x05)
531f92363d1SSreekanth Reddy #define MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS  (0x06)
53290e7a701SSreekanth Reddy #define MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS  (0x08)
533f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_FLAGS_UNUSED                      (0x0F)
534f92363d1SSreekanth Reddy 
535f92363d1SSreekanth Reddy /*values for marking a reply descriptor as unused */
536f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_UNUSED_WORD0_MARK             (0xFFFFFFFF)
537f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK             (0xFFFFFFFF)
538f92363d1SSreekanth Reddy 
539f92363d1SSreekanth Reddy /*Address Reply Descriptor */
540f92363d1SSreekanth Reddy typedef struct _MPI2_ADDRESS_REPLY_DESCRIPTOR {
541f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
542f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
543f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
544f92363d1SSreekanth Reddy 	U32 ReplyFrameAddress;	/*0x04 */
545f92363d1SSreekanth Reddy } MPI2_ADDRESS_REPLY_DESCRIPTOR,
546f92363d1SSreekanth Reddy 	*PTR_MPI2_ADDRESS_REPLY_DESCRIPTOR,
547f92363d1SSreekanth Reddy 	Mpi2AddressReplyDescriptor_t,
548f92363d1SSreekanth Reddy 	*pMpi2AddressReplyDescriptor_t;
549f92363d1SSreekanth Reddy 
550f92363d1SSreekanth Reddy #define MPI2_ADDRESS_REPLY_SMID_INVALID                 (0x00)
551f92363d1SSreekanth Reddy 
552f92363d1SSreekanth Reddy /*SCSI IO Success Reply Descriptor */
553f92363d1SSreekanth Reddy typedef struct _MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR {
554f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
555f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
556f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
557f92363d1SSreekanth Reddy 	U16 TaskTag;		/*0x04 */
558f92363d1SSreekanth Reddy 	U16 Reserved1;		/*0x06 */
559f92363d1SSreekanth Reddy } MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
560f92363d1SSreekanth Reddy 	*PTR_MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
561f92363d1SSreekanth Reddy 	Mpi2SCSIIOSuccessReplyDescriptor_t,
562f92363d1SSreekanth Reddy 	*pMpi2SCSIIOSuccessReplyDescriptor_t;
563f92363d1SSreekanth Reddy 
564f92363d1SSreekanth Reddy /*TargetAssist Success Reply Descriptor */
565f92363d1SSreekanth Reddy typedef struct _MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR {
566f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
567f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
568f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
569f92363d1SSreekanth Reddy 	U8 SequenceNumber;	/*0x04 */
570f92363d1SSreekanth Reddy 	U8 Reserved1;		/*0x05 */
571f92363d1SSreekanth Reddy 	U16 IoIndex;		/*0x06 */
572f92363d1SSreekanth Reddy } MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR,
573f92363d1SSreekanth Reddy 	*PTR_MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR,
574f92363d1SSreekanth Reddy 	Mpi2TargetAssistSuccessReplyDescriptor_t,
575f92363d1SSreekanth Reddy 	*pMpi2TargetAssistSuccessReplyDescriptor_t;
576f92363d1SSreekanth Reddy 
577f92363d1SSreekanth Reddy /*Target Command Buffer Reply Descriptor */
578f92363d1SSreekanth Reddy typedef struct _MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR {
579f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
580f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
581f92363d1SSreekanth Reddy 	U8 VP_ID;		/*0x02 */
582f92363d1SSreekanth Reddy 	U8 Flags;		/*0x03 */
583f92363d1SSreekanth Reddy 	U16 InitiatorDevHandle;	/*0x04 */
584f92363d1SSreekanth Reddy 	U16 IoIndex;		/*0x06 */
585f92363d1SSreekanth Reddy } MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR,
586f92363d1SSreekanth Reddy 	*PTR_MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR,
587f92363d1SSreekanth Reddy 	Mpi2TargetCommandBufferReplyDescriptor_t,
588f92363d1SSreekanth Reddy 	*pMpi2TargetCommandBufferReplyDescriptor_t;
589f92363d1SSreekanth Reddy 
590f92363d1SSreekanth Reddy /*defines for Flags field */
591f92363d1SSreekanth Reddy #define MPI2_RPY_DESCRIPT_TCB_FLAGS_PHYNUM_MASK     (0x3F)
592f92363d1SSreekanth Reddy 
593f92363d1SSreekanth Reddy /*RAID Accelerator Success Reply Descriptor */
594f92363d1SSreekanth Reddy typedef struct _MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR {
595f92363d1SSreekanth Reddy 	U8 ReplyFlags;		/*0x00 */
596f92363d1SSreekanth Reddy 	U8 MSIxIndex;		/*0x01 */
597f92363d1SSreekanth Reddy 	U16 SMID;		/*0x02 */
598f92363d1SSreekanth Reddy 	U32 Reserved;		/*0x04 */
599f92363d1SSreekanth Reddy } MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR,
600f92363d1SSreekanth Reddy 	*PTR_MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR,
601f92363d1SSreekanth Reddy 	Mpi2RAIDAcceleratorSuccessReplyDescriptor_t,
602f92363d1SSreekanth Reddy 	*pMpi2RAIDAcceleratorSuccessReplyDescriptor_t;
603f92363d1SSreekanth Reddy 
604f92363d1SSreekanth Reddy /*Fast Path SCSI IO Success Reply Descriptor */
605f92363d1SSreekanth Reddy typedef MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR
606f92363d1SSreekanth Reddy 	MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
607f92363d1SSreekanth Reddy 	*PTR_MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
608f92363d1SSreekanth Reddy 	Mpi25FastPathSCSIIOSuccessReplyDescriptor_t,
609f92363d1SSreekanth Reddy 	*pMpi25FastPathSCSIIOSuccessReplyDescriptor_t;
610f92363d1SSreekanth Reddy 
61190e7a701SSreekanth Reddy /*PCIe Encapsulated Success Reply Descriptor */
61290e7a701SSreekanth Reddy typedef MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR
61390e7a701SSreekanth Reddy 	MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR,
61490e7a701SSreekanth Reddy 	*PTR_MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR,
61590e7a701SSreekanth Reddy 	Mpi26PCIeEncapsulatedSuccessReplyDescriptor_t,
61690e7a701SSreekanth Reddy 	*pMpi26PCIeEncapsulatedSuccessReplyDescriptor_t;
61790e7a701SSreekanth Reddy 
618f92363d1SSreekanth Reddy /*union of Reply Descriptors */
619f92363d1SSreekanth Reddy typedef union _MPI2_REPLY_DESCRIPTORS_UNION {
620f92363d1SSreekanth Reddy 	MPI2_DEFAULT_REPLY_DESCRIPTOR Default;
621f92363d1SSreekanth Reddy 	MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply;
622f92363d1SSreekanth Reddy 	MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess;
623f92363d1SSreekanth Reddy 	MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess;
624f92363d1SSreekanth Reddy 	MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer;
625f92363d1SSreekanth Reddy 	MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR RAIDAcceleratorSuccess;
626f92363d1SSreekanth Reddy 	MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR FastPathSCSIIOSuccess;
62790e7a701SSreekanth Reddy 	MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR
62890e7a701SSreekanth Reddy 						PCIeEncapsulatedSuccess;
629f92363d1SSreekanth Reddy 	U64 Words;
630f92363d1SSreekanth Reddy } MPI2_REPLY_DESCRIPTORS_UNION,
631f92363d1SSreekanth Reddy 	*PTR_MPI2_REPLY_DESCRIPTORS_UNION,
632f92363d1SSreekanth Reddy 	Mpi2ReplyDescriptorsUnion_t,
633f92363d1SSreekanth Reddy 	*pMpi2ReplyDescriptorsUnion_t;
634f92363d1SSreekanth Reddy 
635f92363d1SSreekanth Reddy /*****************************************************************************
636f92363d1SSreekanth Reddy *
637f92363d1SSreekanth Reddy *       Message Functions
638f92363d1SSreekanth Reddy *
639f92363d1SSreekanth Reddy *****************************************************************************/
640f92363d1SSreekanth Reddy 
641f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SCSI_IO_REQUEST		    (0x00)
642f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SCSI_TASK_MGMT		    (0x01)
643f92363d1SSreekanth Reddy #define MPI2_FUNCTION_IOC_INIT                      (0x02)
644f92363d1SSreekanth Reddy #define MPI2_FUNCTION_IOC_FACTS                     (0x03)
645f92363d1SSreekanth Reddy #define MPI2_FUNCTION_CONFIG                        (0x04)
646f92363d1SSreekanth Reddy #define MPI2_FUNCTION_PORT_FACTS                    (0x05)
647f92363d1SSreekanth Reddy #define MPI2_FUNCTION_PORT_ENABLE                   (0x06)
648f92363d1SSreekanth Reddy #define MPI2_FUNCTION_EVENT_NOTIFICATION            (0x07)
649f92363d1SSreekanth Reddy #define MPI2_FUNCTION_EVENT_ACK                     (0x08)
650f92363d1SSreekanth Reddy #define MPI2_FUNCTION_FW_DOWNLOAD                   (0x09)
651f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TARGET_ASSIST                 (0x0B)
652f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TARGET_STATUS_SEND            (0x0C)
653f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TARGET_MODE_ABORT             (0x0D)
654f92363d1SSreekanth Reddy #define MPI2_FUNCTION_FW_UPLOAD                     (0x12)
655f92363d1SSreekanth Reddy #define MPI2_FUNCTION_RAID_ACTION                   (0x15)
656f92363d1SSreekanth Reddy #define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH      (0x16)
657f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TOOLBOX                       (0x17)
658f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR      (0x18)
659f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SMP_PASSTHROUGH               (0x1A)
660f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL           (0x1B)
661b130b0d5SSuganath prabu Subramani #define MPI2_FUNCTION_IO_UNIT_CONTROL               (0x1B)
662f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SATA_PASSTHROUGH              (0x1C)
663f92363d1SSreekanth Reddy #define MPI2_FUNCTION_DIAG_BUFFER_POST              (0x1D)
664f92363d1SSreekanth Reddy #define MPI2_FUNCTION_DIAG_RELEASE                  (0x1E)
665f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST      (0x24)
666f92363d1SSreekanth Reddy #define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST      (0x25)
667f92363d1SSreekanth Reddy #define MPI2_FUNCTION_RAID_ACCELERATOR              (0x2C)
668f92363d1SSreekanth Reddy #define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION   (0x2F)
669f92363d1SSreekanth Reddy #define MPI2_FUNCTION_PWR_MGMT_CONTROL              (0x30)
670f92363d1SSreekanth Reddy #define MPI2_FUNCTION_SEND_HOST_MESSAGE             (0x31)
67190e7a701SSreekanth Reddy #define MPI2_FUNCTION_NVME_ENCAPSULATED             (0x33)
672f92363d1SSreekanth Reddy #define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC          (0xF0)
673f92363d1SSreekanth Reddy #define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC          (0xFF)
674f92363d1SSreekanth Reddy 
675f92363d1SSreekanth Reddy /*Doorbell functions */
676f92363d1SSreekanth Reddy #define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET        (0x40)
677f92363d1SSreekanth Reddy #define MPI2_FUNCTION_HANDSHAKE                     (0x42)
678f92363d1SSreekanth Reddy 
679f92363d1SSreekanth Reddy /*****************************************************************************
680f92363d1SSreekanth Reddy *
681f92363d1SSreekanth Reddy *       IOC Status Values
682f92363d1SSreekanth Reddy *
683f92363d1SSreekanth Reddy *****************************************************************************/
684f92363d1SSreekanth Reddy 
685f92363d1SSreekanth Reddy /*mask for IOCStatus status value */
686f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_MASK                     (0x7FFF)
687f92363d1SSreekanth Reddy 
688f92363d1SSreekanth Reddy /****************************************************************************
689f92363d1SSreekanth Reddy * Common IOCStatus values for all replies
690f92363d1SSreekanth Reddy ****************************************************************************/
691f92363d1SSreekanth Reddy 
692f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SUCCESS                      (0x0000)
693f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INVALID_FUNCTION             (0x0001)
694f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_BUSY                         (0x0002)
695f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INVALID_SGL                  (0x0003)
696f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INTERNAL_ERROR               (0x0004)
697f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INVALID_VPID                 (0x0005)
698f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES       (0x0006)
699f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INVALID_FIELD                (0x0007)
700f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_INVALID_STATE                (0x0008)
701f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED       (0x0009)
702ff92b9ddSSuganath Prabu /*MPI v2.6 and later */
703b130b0d5SSuganath prabu Subramani #define MPI2_IOCSTATUS_INSUFFICIENT_POWER           (0x000A)
704ff92b9ddSSuganath Prabu #define MPI2_IOCSTATUS_FAILURE                      (0x000F)
705f92363d1SSreekanth Reddy 
706f92363d1SSreekanth Reddy /****************************************************************************
707f92363d1SSreekanth Reddy * Config IOCStatus values
708f92363d1SSreekanth Reddy ****************************************************************************/
709f92363d1SSreekanth Reddy 
710f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_INVALID_ACTION        (0x0020)
711f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_INVALID_TYPE          (0x0021)
712f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_INVALID_PAGE          (0x0022)
713f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_INVALID_DATA          (0x0023)
714f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_NO_DEFAULTS           (0x0024)
715f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_CONFIG_CANT_COMMIT           (0x0025)
716f92363d1SSreekanth Reddy 
717f92363d1SSreekanth Reddy /****************************************************************************
718f92363d1SSreekanth Reddy * SCSI IO Reply
719f92363d1SSreekanth Reddy ****************************************************************************/
720f92363d1SSreekanth Reddy 
721f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR         (0x0040)
722f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE       (0x0042)
723f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE        (0x0043)
724f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_DATA_OVERRUN            (0x0044)
725f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN           (0x0045)
726f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR           (0x0046)
727f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR          (0x0047)
728f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_TASK_TERMINATED         (0x0048)
729f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH       (0x0049)
730f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED        (0x004A)
731f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_IOC_TERMINATED          (0x004B)
732f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SCSI_EXT_TERMINATED          (0x004C)
733f92363d1SSreekanth Reddy 
734f92363d1SSreekanth Reddy /****************************************************************************
735f92363d1SSreekanth Reddy * For use by SCSI Initiator and SCSI Target end-to-end data protection
736f92363d1SSreekanth Reddy ****************************************************************************/
737f92363d1SSreekanth Reddy 
738f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_EEDP_GUARD_ERROR             (0x004D)
739f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR           (0x004E)
740f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR           (0x004F)
741f92363d1SSreekanth Reddy 
742f92363d1SSreekanth Reddy /****************************************************************************
743f92363d1SSreekanth Reddy * SCSI Target values
744f92363d1SSreekanth Reddy ****************************************************************************/
745f92363d1SSreekanth Reddy 
746f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_INVALID_IO_INDEX      (0x0062)
747f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_ABORTED               (0x0063)
748f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_NO_CONN_RETRYABLE     (0x0064)
749f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_NO_CONNECTION         (0x0065)
750f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH   (0x006A)
751f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_DATA_OFFSET_ERROR     (0x006D)
752f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA   (0x006E)
753f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_IU_TOO_SHORT          (0x006F)
754f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT       (0x0070)
755f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_TARGET_NAK_RECEIVED          (0x0071)
756f92363d1SSreekanth Reddy 
757f92363d1SSreekanth Reddy /****************************************************************************
758f92363d1SSreekanth Reddy * Serial Attached SCSI values
759f92363d1SSreekanth Reddy ****************************************************************************/
760f92363d1SSreekanth Reddy 
761f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SAS_SMP_REQUEST_FAILED       (0x0090)
762f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_SAS_SMP_DATA_OVERRUN         (0x0091)
763f92363d1SSreekanth Reddy 
764f92363d1SSreekanth Reddy /****************************************************************************
765f92363d1SSreekanth Reddy * Diagnostic Buffer Post / Diagnostic Release values
766f92363d1SSreekanth Reddy ****************************************************************************/
767f92363d1SSreekanth Reddy 
768f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED          (0x00A0)
769f92363d1SSreekanth Reddy 
770f92363d1SSreekanth Reddy /****************************************************************************
771f92363d1SSreekanth Reddy * RAID Accelerator values
772f92363d1SSreekanth Reddy ****************************************************************************/
773f92363d1SSreekanth Reddy 
774f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_RAID_ACCEL_ERROR             (0x00B0)
775f92363d1SSreekanth Reddy 
776f92363d1SSreekanth Reddy /****************************************************************************
777f92363d1SSreekanth Reddy * IOCStatus flag to indicate that log info is available
778f92363d1SSreekanth Reddy ****************************************************************************/
779f92363d1SSreekanth Reddy 
780f92363d1SSreekanth Reddy #define MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE      (0x8000)
781f92363d1SSreekanth Reddy 
782f92363d1SSreekanth Reddy /****************************************************************************
783f92363d1SSreekanth Reddy * IOCLogInfo Types
784f92363d1SSreekanth Reddy ****************************************************************************/
785f92363d1SSreekanth Reddy 
786f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_MASK               (0xF0000000)
787f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_SHIFT              (28)
788f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_NONE               (0x0)
789f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_SCSI               (0x1)
790f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_FC                 (0x2)
791f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_SAS                (0x3)
792f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_TYPE_ISCSI              (0x4)
793f92363d1SSreekanth Reddy #define MPI2_IOCLOGINFO_LOG_DATA_MASK           (0x0FFFFFFF)
794f92363d1SSreekanth Reddy 
795f92363d1SSreekanth Reddy /*****************************************************************************
796f92363d1SSreekanth Reddy *
797f92363d1SSreekanth Reddy *       Standard Message Structures
798f92363d1SSreekanth Reddy *
799f92363d1SSreekanth Reddy *****************************************************************************/
800f92363d1SSreekanth Reddy 
801f92363d1SSreekanth Reddy /****************************************************************************
802f92363d1SSreekanth Reddy *Request Message Header for all request messages
803f92363d1SSreekanth Reddy ****************************************************************************/
804f92363d1SSreekanth Reddy 
805f92363d1SSreekanth Reddy typedef struct _MPI2_REQUEST_HEADER {
806f92363d1SSreekanth Reddy 	U16 FunctionDependent1;	/*0x00 */
807f92363d1SSreekanth Reddy 	U8 ChainOffset;		/*0x02 */
808f92363d1SSreekanth Reddy 	U8 Function;		/*0x03 */
809f92363d1SSreekanth Reddy 	U16 FunctionDependent2;	/*0x04 */
810f92363d1SSreekanth Reddy 	U8 FunctionDependent3;	/*0x06 */
811f92363d1SSreekanth Reddy 	U8 MsgFlags;		/*0x07 */
812f92363d1SSreekanth Reddy 	U8 VP_ID;		/*0x08 */
813f92363d1SSreekanth Reddy 	U8 VF_ID;		/*0x09 */
814f92363d1SSreekanth Reddy 	U16 Reserved1;		/*0x0A */
815f92363d1SSreekanth Reddy } MPI2_REQUEST_HEADER, *PTR_MPI2_REQUEST_HEADER,
816f92363d1SSreekanth Reddy 	MPI2RequestHeader_t, *pMPI2RequestHeader_t;
817f92363d1SSreekanth Reddy 
818f92363d1SSreekanth Reddy /****************************************************************************
819f92363d1SSreekanth Reddy * Default Reply
820f92363d1SSreekanth Reddy ****************************************************************************/
821f92363d1SSreekanth Reddy 
822f92363d1SSreekanth Reddy typedef struct _MPI2_DEFAULT_REPLY {
823f92363d1SSreekanth Reddy 	U16 FunctionDependent1;	/*0x00 */
824f92363d1SSreekanth Reddy 	U8 MsgLength;		/*0x02 */
825f92363d1SSreekanth Reddy 	U8 Function;		/*0x03 */
826f92363d1SSreekanth Reddy 	U16 FunctionDependent2;	/*0x04 */
827f92363d1SSreekanth Reddy 	U8 FunctionDependent3;	/*0x06 */
828f92363d1SSreekanth Reddy 	U8 MsgFlags;		/*0x07 */
829f92363d1SSreekanth Reddy 	U8 VP_ID;		/*0x08 */
830f92363d1SSreekanth Reddy 	U8 VF_ID;		/*0x09 */
831f92363d1SSreekanth Reddy 	U16 Reserved1;		/*0x0A */
832f92363d1SSreekanth Reddy 	U16 FunctionDependent5;	/*0x0C */
833f92363d1SSreekanth Reddy 	U16 IOCStatus;		/*0x0E */
834f92363d1SSreekanth Reddy 	U32 IOCLogInfo;		/*0x10 */
835f92363d1SSreekanth Reddy } MPI2_DEFAULT_REPLY, *PTR_MPI2_DEFAULT_REPLY,
836f92363d1SSreekanth Reddy 	MPI2DefaultReply_t, *pMPI2DefaultReply_t;
837f92363d1SSreekanth Reddy 
838f92363d1SSreekanth Reddy /*common version structure/union used in messages and configuration pages */
839f92363d1SSreekanth Reddy 
840f92363d1SSreekanth Reddy typedef struct _MPI2_VERSION_STRUCT {
841f92363d1SSreekanth Reddy 	U8 Dev;			/*0x00 */
842f92363d1SSreekanth Reddy 	U8 Unit;		/*0x01 */
843f92363d1SSreekanth Reddy 	U8 Minor;		/*0x02 */
844f92363d1SSreekanth Reddy 	U8 Major;		/*0x03 */
845f92363d1SSreekanth Reddy } MPI2_VERSION_STRUCT;
846f92363d1SSreekanth Reddy 
847f92363d1SSreekanth Reddy typedef union _MPI2_VERSION_UNION {
848f92363d1SSreekanth Reddy 	MPI2_VERSION_STRUCT Struct;
849f92363d1SSreekanth Reddy 	U32 Word;
850f92363d1SSreekanth Reddy } MPI2_VERSION_UNION;
851f92363d1SSreekanth Reddy 
852f92363d1SSreekanth Reddy /*LUN field defines, common to many structures */
853f92363d1SSreekanth Reddy #define MPI2_LUN_FIRST_LEVEL_ADDRESSING             (0x0000FFFF)
854f92363d1SSreekanth Reddy #define MPI2_LUN_SECOND_LEVEL_ADDRESSING            (0xFFFF0000)
855f92363d1SSreekanth Reddy #define MPI2_LUN_THIRD_LEVEL_ADDRESSING             (0x0000FFFF)
856f92363d1SSreekanth Reddy #define MPI2_LUN_FOURTH_LEVEL_ADDRESSING            (0xFFFF0000)
857f92363d1SSreekanth Reddy #define MPI2_LUN_LEVEL_1_WORD                       (0xFF00)
858f92363d1SSreekanth Reddy #define MPI2_LUN_LEVEL_1_DWORD                      (0x0000FF00)
859f92363d1SSreekanth Reddy 
860f92363d1SSreekanth Reddy /*****************************************************************************
861f92363d1SSreekanth Reddy *
862f92363d1SSreekanth Reddy *       Fusion-MPT MPI Scatter Gather Elements
863f92363d1SSreekanth Reddy *
864f92363d1SSreekanth Reddy *****************************************************************************/
865f92363d1SSreekanth Reddy 
866f92363d1SSreekanth Reddy /****************************************************************************
867f92363d1SSreekanth Reddy * MPI Simple Element structures
868f92363d1SSreekanth Reddy ****************************************************************************/
869f92363d1SSreekanth Reddy 
870f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_SIMPLE32 {
871f92363d1SSreekanth Reddy 	U32 FlagsLength;
872f92363d1SSreekanth Reddy 	U32 Address;
873f92363d1SSreekanth Reddy } MPI2_SGE_SIMPLE32, *PTR_MPI2_SGE_SIMPLE32,
874f92363d1SSreekanth Reddy 	Mpi2SGESimple32_t, *pMpi2SGESimple32_t;
875f92363d1SSreekanth Reddy 
876f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_SIMPLE64 {
877f92363d1SSreekanth Reddy 	U32 FlagsLength;
878f92363d1SSreekanth Reddy 	U64 Address;
879f92363d1SSreekanth Reddy } MPI2_SGE_SIMPLE64, *PTR_MPI2_SGE_SIMPLE64,
880f92363d1SSreekanth Reddy 	Mpi2SGESimple64_t, *pMpi2SGESimple64_t;
881f92363d1SSreekanth Reddy 
882f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_SIMPLE_UNION {
883f92363d1SSreekanth Reddy 	U32 FlagsLength;
884f92363d1SSreekanth Reddy 	union {
885f92363d1SSreekanth Reddy 		U32 Address32;
886f92363d1SSreekanth Reddy 		U64 Address64;
887f92363d1SSreekanth Reddy 	} u;
888f92363d1SSreekanth Reddy } MPI2_SGE_SIMPLE_UNION,
889f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_SIMPLE_UNION,
890f92363d1SSreekanth Reddy 	Mpi2SGESimpleUnion_t,
891f92363d1SSreekanth Reddy 	*pMpi2SGESimpleUnion_t;
892f92363d1SSreekanth Reddy 
893f92363d1SSreekanth Reddy /****************************************************************************
894f92363d1SSreekanth Reddy * MPI Chain Element structures - for MPI v2.0 products only
895f92363d1SSreekanth Reddy ****************************************************************************/
896f92363d1SSreekanth Reddy 
897f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_CHAIN32 {
898f92363d1SSreekanth Reddy 	U16 Length;
899f92363d1SSreekanth Reddy 	U8 NextChainOffset;
900f92363d1SSreekanth Reddy 	U8 Flags;
901f92363d1SSreekanth Reddy 	U32 Address;
902f92363d1SSreekanth Reddy } MPI2_SGE_CHAIN32, *PTR_MPI2_SGE_CHAIN32,
903f92363d1SSreekanth Reddy 	Mpi2SGEChain32_t, *pMpi2SGEChain32_t;
904f92363d1SSreekanth Reddy 
905f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_CHAIN64 {
906f92363d1SSreekanth Reddy 	U16 Length;
907f92363d1SSreekanth Reddy 	U8 NextChainOffset;
908f92363d1SSreekanth Reddy 	U8 Flags;
909f92363d1SSreekanth Reddy 	U64 Address;
910f92363d1SSreekanth Reddy } MPI2_SGE_CHAIN64, *PTR_MPI2_SGE_CHAIN64,
911f92363d1SSreekanth Reddy 	Mpi2SGEChain64_t, *pMpi2SGEChain64_t;
912f92363d1SSreekanth Reddy 
913f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_CHAIN_UNION {
914f92363d1SSreekanth Reddy 	U16 Length;
915f92363d1SSreekanth Reddy 	U8 NextChainOffset;
916f92363d1SSreekanth Reddy 	U8 Flags;
917f92363d1SSreekanth Reddy 	union {
918f92363d1SSreekanth Reddy 		U32 Address32;
919f92363d1SSreekanth Reddy 		U64 Address64;
920f92363d1SSreekanth Reddy 	} u;
921f92363d1SSreekanth Reddy } MPI2_SGE_CHAIN_UNION,
922f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_CHAIN_UNION,
923f92363d1SSreekanth Reddy 	Mpi2SGEChainUnion_t,
924f92363d1SSreekanth Reddy 	*pMpi2SGEChainUnion_t;
925f92363d1SSreekanth Reddy 
926f92363d1SSreekanth Reddy /****************************************************************************
927f92363d1SSreekanth Reddy * MPI Transaction Context Element structures - for MPI v2.0 products only
928f92363d1SSreekanth Reddy ****************************************************************************/
929f92363d1SSreekanth Reddy 
930f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANSACTION32 {
931f92363d1SSreekanth Reddy 	U8 Reserved;
932f92363d1SSreekanth Reddy 	U8 ContextSize;
933f92363d1SSreekanth Reddy 	U8 DetailsLength;
934f92363d1SSreekanth Reddy 	U8 Flags;
935f92363d1SSreekanth Reddy 	U32 TransactionContext[1];
936f92363d1SSreekanth Reddy 	U32 TransactionDetails[1];
937f92363d1SSreekanth Reddy } MPI2_SGE_TRANSACTION32,
938f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_TRANSACTION32,
939f92363d1SSreekanth Reddy 	Mpi2SGETransaction32_t,
940f92363d1SSreekanth Reddy 	*pMpi2SGETransaction32_t;
941f92363d1SSreekanth Reddy 
942f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANSACTION64 {
943f92363d1SSreekanth Reddy 	U8 Reserved;
944f92363d1SSreekanth Reddy 	U8 ContextSize;
945f92363d1SSreekanth Reddy 	U8 DetailsLength;
946f92363d1SSreekanth Reddy 	U8 Flags;
947f92363d1SSreekanth Reddy 	U32 TransactionContext[2];
948f92363d1SSreekanth Reddy 	U32 TransactionDetails[1];
949f92363d1SSreekanth Reddy } MPI2_SGE_TRANSACTION64,
950f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_TRANSACTION64,
951f92363d1SSreekanth Reddy 	Mpi2SGETransaction64_t,
952f92363d1SSreekanth Reddy 	*pMpi2SGETransaction64_t;
953f92363d1SSreekanth Reddy 
954f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANSACTION96 {
955f92363d1SSreekanth Reddy 	U8 Reserved;
956f92363d1SSreekanth Reddy 	U8 ContextSize;
957f92363d1SSreekanth Reddy 	U8 DetailsLength;
958f92363d1SSreekanth Reddy 	U8 Flags;
959f92363d1SSreekanth Reddy 	U32 TransactionContext[3];
960f92363d1SSreekanth Reddy 	U32 TransactionDetails[1];
961f92363d1SSreekanth Reddy } MPI2_SGE_TRANSACTION96, *PTR_MPI2_SGE_TRANSACTION96,
962f92363d1SSreekanth Reddy 	Mpi2SGETransaction96_t, *pMpi2SGETransaction96_t;
963f92363d1SSreekanth Reddy 
964f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANSACTION128 {
965f92363d1SSreekanth Reddy 	U8 Reserved;
966f92363d1SSreekanth Reddy 	U8 ContextSize;
967f92363d1SSreekanth Reddy 	U8 DetailsLength;
968f92363d1SSreekanth Reddy 	U8 Flags;
969f92363d1SSreekanth Reddy 	U32 TransactionContext[4];
970f92363d1SSreekanth Reddy 	U32 TransactionDetails[1];
971f92363d1SSreekanth Reddy } MPI2_SGE_TRANSACTION128, *PTR_MPI2_SGE_TRANSACTION128,
972f92363d1SSreekanth Reddy 	Mpi2SGETransaction_t128, *pMpi2SGETransaction_t128;
973f92363d1SSreekanth Reddy 
974f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANSACTION_UNION {
975f92363d1SSreekanth Reddy 	U8 Reserved;
976f92363d1SSreekanth Reddy 	U8 ContextSize;
977f92363d1SSreekanth Reddy 	U8 DetailsLength;
978f92363d1SSreekanth Reddy 	U8 Flags;
979f92363d1SSreekanth Reddy 	union {
980f92363d1SSreekanth Reddy 		U32 TransactionContext32[1];
981f92363d1SSreekanth Reddy 		U32 TransactionContext64[2];
982f92363d1SSreekanth Reddy 		U32 TransactionContext96[3];
983f92363d1SSreekanth Reddy 		U32 TransactionContext128[4];
984f92363d1SSreekanth Reddy 	} u;
985f92363d1SSreekanth Reddy 	U32 TransactionDetails[1];
986f92363d1SSreekanth Reddy } MPI2_SGE_TRANSACTION_UNION,
987f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_TRANSACTION_UNION,
988f92363d1SSreekanth Reddy 	Mpi2SGETransactionUnion_t,
989f92363d1SSreekanth Reddy 	*pMpi2SGETransactionUnion_t;
990f92363d1SSreekanth Reddy 
991f92363d1SSreekanth Reddy /****************************************************************************
992f92363d1SSreekanth Reddy * MPI SGE union for IO SGL's - for MPI v2.0 products only
993f92363d1SSreekanth Reddy ****************************************************************************/
994f92363d1SSreekanth Reddy 
995f92363d1SSreekanth Reddy typedef struct _MPI2_MPI_SGE_IO_UNION {
996f92363d1SSreekanth Reddy 	union {
997f92363d1SSreekanth Reddy 		MPI2_SGE_SIMPLE_UNION Simple;
998f92363d1SSreekanth Reddy 		MPI2_SGE_CHAIN_UNION Chain;
999f92363d1SSreekanth Reddy 	} u;
1000f92363d1SSreekanth Reddy } MPI2_MPI_SGE_IO_UNION, *PTR_MPI2_MPI_SGE_IO_UNION,
1001f92363d1SSreekanth Reddy 	Mpi2MpiSGEIOUnion_t, *pMpi2MpiSGEIOUnion_t;
1002f92363d1SSreekanth Reddy 
1003f92363d1SSreekanth Reddy /****************************************************************************
1004f92363d1SSreekanth Reddy * MPI SGE union for SGL's with Simple and Transaction elements - for MPI v2.0 products only
1005f92363d1SSreekanth Reddy ****************************************************************************/
1006f92363d1SSreekanth Reddy 
1007f92363d1SSreekanth Reddy typedef struct _MPI2_SGE_TRANS_SIMPLE_UNION {
1008f92363d1SSreekanth Reddy 	union {
1009f92363d1SSreekanth Reddy 		MPI2_SGE_SIMPLE_UNION Simple;
1010f92363d1SSreekanth Reddy 		MPI2_SGE_TRANSACTION_UNION Transaction;
1011f92363d1SSreekanth Reddy 	} u;
1012f92363d1SSreekanth Reddy } MPI2_SGE_TRANS_SIMPLE_UNION,
1013f92363d1SSreekanth Reddy 	*PTR_MPI2_SGE_TRANS_SIMPLE_UNION,
1014f92363d1SSreekanth Reddy 	Mpi2SGETransSimpleUnion_t,
1015f92363d1SSreekanth Reddy 	*pMpi2SGETransSimpleUnion_t;
1016f92363d1SSreekanth Reddy 
1017f92363d1SSreekanth Reddy /****************************************************************************
1018f92363d1SSreekanth Reddy * All MPI SGE types union
1019f92363d1SSreekanth Reddy ****************************************************************************/
1020f92363d1SSreekanth Reddy 
1021f92363d1SSreekanth Reddy typedef struct _MPI2_MPI_SGE_UNION {
1022f92363d1SSreekanth Reddy 	union {
1023f92363d1SSreekanth Reddy 		MPI2_SGE_SIMPLE_UNION Simple;
1024f92363d1SSreekanth Reddy 		MPI2_SGE_CHAIN_UNION Chain;
1025f92363d1SSreekanth Reddy 		MPI2_SGE_TRANSACTION_UNION Transaction;
1026f92363d1SSreekanth Reddy 	} u;
1027f92363d1SSreekanth Reddy } MPI2_MPI_SGE_UNION, *PTR_MPI2_MPI_SGE_UNION,
1028f92363d1SSreekanth Reddy 	Mpi2MpiSgeUnion_t, *pMpi2MpiSgeUnion_t;
1029f92363d1SSreekanth Reddy 
1030f92363d1SSreekanth Reddy /****************************************************************************
1031f92363d1SSreekanth Reddy * MPI SGE field definition and masks
1032f92363d1SSreekanth Reddy ****************************************************************************/
1033f92363d1SSreekanth Reddy 
1034f92363d1SSreekanth Reddy /*Flags field bit definitions */
1035f92363d1SSreekanth Reddy 
1036f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_LAST_ELEMENT             (0x80)
1037f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_END_OF_BUFFER            (0x40)
1038f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_ELEMENT_TYPE_MASK        (0x30)
1039f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_LOCAL_ADDRESS            (0x08)
1040f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_DIRECTION                (0x04)
1041f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_ADDRESS_SIZE             (0x02)
1042f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_END_OF_LIST              (0x01)
1043f92363d1SSreekanth Reddy 
1044f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_SHIFT                    (24)
1045f92363d1SSreekanth Reddy 
1046f92363d1SSreekanth Reddy #define MPI2_SGE_LENGTH_MASK                    (0x00FFFFFF)
1047f92363d1SSreekanth Reddy #define MPI2_SGE_CHAIN_LENGTH_MASK              (0x0000FFFF)
1048f92363d1SSreekanth Reddy 
1049f92363d1SSreekanth Reddy /*Element Type */
1050f92363d1SSreekanth Reddy 
1051f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_TRANSACTION_ELEMENT      (0x00)
1052f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_SIMPLE_ELEMENT           (0x10)
1053f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_CHAIN_ELEMENT            (0x30)
1054f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_ELEMENT_MASK             (0x30)
1055f92363d1SSreekanth Reddy 
1056f92363d1SSreekanth Reddy /*Address location */
1057f92363d1SSreekanth Reddy 
1058f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_SYSTEM_ADDRESS           (0x00)
1059f92363d1SSreekanth Reddy 
1060f92363d1SSreekanth Reddy /*Direction */
1061f92363d1SSreekanth Reddy 
1062f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_IOC_TO_HOST              (0x00)
1063f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_HOST_TO_IOC              (0x04)
1064f92363d1SSreekanth Reddy 
1065f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST)
1066f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC)
1067f92363d1SSreekanth Reddy 
1068f92363d1SSreekanth Reddy /*Address Size */
1069f92363d1SSreekanth Reddy 
1070f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_32_BIT_ADDRESSING        (0x00)
1071f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_64_BIT_ADDRESSING        (0x02)
1072f92363d1SSreekanth Reddy 
1073f92363d1SSreekanth Reddy /*Context Size */
1074f92363d1SSreekanth Reddy 
1075f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_32_BIT_CONTEXT           (0x00)
1076f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_64_BIT_CONTEXT           (0x02)
1077f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_96_BIT_CONTEXT           (0x04)
1078f92363d1SSreekanth Reddy #define MPI2_SGE_FLAGS_128_BIT_CONTEXT          (0x06)
1079f92363d1SSreekanth Reddy 
1080f92363d1SSreekanth Reddy #define MPI2_SGE_CHAIN_OFFSET_MASK              (0x00FF0000)
1081f92363d1SSreekanth Reddy #define MPI2_SGE_CHAIN_OFFSET_SHIFT             (16)
1082f92363d1SSreekanth Reddy 
1083f92363d1SSreekanth Reddy /****************************************************************************
1084f92363d1SSreekanth Reddy * MPI SGE operation Macros
1085f92363d1SSreekanth Reddy ****************************************************************************/
1086f92363d1SSreekanth Reddy 
1087f92363d1SSreekanth Reddy /*SIMPLE FlagsLength manipulations... */
1088f92363d1SSreekanth Reddy #define MPI2_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_SGE_FLAGS_SHIFT)
1089f92363d1SSreekanth Reddy #define MPI2_SGE_GET_FLAGS(f) (((f) & ~MPI2_SGE_LENGTH_MASK) >> \
1090f92363d1SSreekanth Reddy 					MPI2_SGE_FLAGS_SHIFT)
1091f92363d1SSreekanth Reddy #define MPI2_SGE_LENGTH(f) ((f) & MPI2_SGE_LENGTH_MASK)
1092f92363d1SSreekanth Reddy #define MPI2_SGE_CHAIN_LENGTH(f) ((f) & MPI2_SGE_CHAIN_LENGTH_MASK)
1093f92363d1SSreekanth Reddy 
1094f92363d1SSreekanth Reddy #define MPI2_SGE_SET_FLAGS_LENGTH(f, l) (MPI2_SGE_SET_FLAGS(f) | \
1095f92363d1SSreekanth Reddy 					MPI2_SGE_LENGTH(l))
1096f92363d1SSreekanth Reddy 
1097f92363d1SSreekanth Reddy #define MPI2_pSGE_GET_FLAGS(psg) MPI2_SGE_GET_FLAGS((psg)->FlagsLength)
1098f92363d1SSreekanth Reddy #define MPI2_pSGE_GET_LENGTH(psg) MPI2_SGE_LENGTH((psg)->FlagsLength)
1099f92363d1SSreekanth Reddy #define MPI2_pSGE_SET_FLAGS_LENGTH(psg, f, l) ((psg)->FlagsLength = \
1100f92363d1SSreekanth Reddy 					MPI2_SGE_SET_FLAGS_LENGTH(f, l))
1101f92363d1SSreekanth Reddy 
1102f92363d1SSreekanth Reddy /*CAUTION - The following are READ-MODIFY-WRITE! */
1103f92363d1SSreekanth Reddy #define MPI2_pSGE_SET_FLAGS(psg, f) ((psg)->FlagsLength |= \
1104f92363d1SSreekanth Reddy 					MPI2_SGE_SET_FLAGS(f))
1105f92363d1SSreekanth Reddy #define MPI2_pSGE_SET_LENGTH(psg, l) ((psg)->FlagsLength |= \
1106f92363d1SSreekanth Reddy 					MPI2_SGE_LENGTH(l))
1107f92363d1SSreekanth Reddy 
1108f92363d1SSreekanth Reddy #define MPI2_GET_CHAIN_OFFSET(x) ((x & MPI2_SGE_CHAIN_OFFSET_MASK) >> \
1109f92363d1SSreekanth Reddy 					MPI2_SGE_CHAIN_OFFSET_SHIFT)
1110f92363d1SSreekanth Reddy 
1111f92363d1SSreekanth Reddy /*****************************************************************************
1112f92363d1SSreekanth Reddy *
1113f92363d1SSreekanth Reddy *       Fusion-MPT IEEE Scatter Gather Elements
1114f92363d1SSreekanth Reddy *
1115f92363d1SSreekanth Reddy *****************************************************************************/
1116f92363d1SSreekanth Reddy 
1117f92363d1SSreekanth Reddy /****************************************************************************
1118f92363d1SSreekanth Reddy * IEEE Simple Element structures
1119f92363d1SSreekanth Reddy ****************************************************************************/
1120f92363d1SSreekanth Reddy 
1121f92363d1SSreekanth Reddy /*MPI2_IEEE_SGE_SIMPLE32 is for MPI v2.0 products only */
1122f92363d1SSreekanth Reddy typedef struct _MPI2_IEEE_SGE_SIMPLE32 {
1123f92363d1SSreekanth Reddy 	U32 Address;
1124f92363d1SSreekanth Reddy 	U32 FlagsLength;
1125f92363d1SSreekanth Reddy } MPI2_IEEE_SGE_SIMPLE32, *PTR_MPI2_IEEE_SGE_SIMPLE32,
1126f92363d1SSreekanth Reddy 	Mpi2IeeeSgeSimple32_t, *pMpi2IeeeSgeSimple32_t;
1127f92363d1SSreekanth Reddy 
1128f92363d1SSreekanth Reddy typedef struct _MPI2_IEEE_SGE_SIMPLE64 {
1129f92363d1SSreekanth Reddy 	U64 Address;
1130f92363d1SSreekanth Reddy 	U32 Length;
1131f92363d1SSreekanth Reddy 	U16 Reserved1;
1132f92363d1SSreekanth Reddy 	U8 Reserved2;
1133f92363d1SSreekanth Reddy 	U8 Flags;
1134f92363d1SSreekanth Reddy } MPI2_IEEE_SGE_SIMPLE64, *PTR_MPI2_IEEE_SGE_SIMPLE64,
1135f92363d1SSreekanth Reddy 	Mpi2IeeeSgeSimple64_t, *pMpi2IeeeSgeSimple64_t;
1136f92363d1SSreekanth Reddy 
1137f92363d1SSreekanth Reddy typedef union _MPI2_IEEE_SGE_SIMPLE_UNION {
1138f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_SIMPLE32 Simple32;
1139f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_SIMPLE64 Simple64;
1140f92363d1SSreekanth Reddy } MPI2_IEEE_SGE_SIMPLE_UNION,
1141f92363d1SSreekanth Reddy 	*PTR_MPI2_IEEE_SGE_SIMPLE_UNION,
1142f92363d1SSreekanth Reddy 	Mpi2IeeeSgeSimpleUnion_t,
1143f92363d1SSreekanth Reddy 	*pMpi2IeeeSgeSimpleUnion_t;
1144f92363d1SSreekanth Reddy 
1145f92363d1SSreekanth Reddy /****************************************************************************
1146f92363d1SSreekanth Reddy * IEEE Chain Element structures
1147f92363d1SSreekanth Reddy ****************************************************************************/
1148f92363d1SSreekanth Reddy 
1149f92363d1SSreekanth Reddy /*MPI2_IEEE_SGE_CHAIN32 is for MPI v2.0 products only */
1150f92363d1SSreekanth Reddy typedef MPI2_IEEE_SGE_SIMPLE32 MPI2_IEEE_SGE_CHAIN32;
1151f92363d1SSreekanth Reddy 
1152f92363d1SSreekanth Reddy /*MPI2_IEEE_SGE_CHAIN64 is for MPI v2.0 products only */
1153f92363d1SSreekanth Reddy typedef MPI2_IEEE_SGE_SIMPLE64 MPI2_IEEE_SGE_CHAIN64;
1154f92363d1SSreekanth Reddy 
1155f92363d1SSreekanth Reddy typedef union _MPI2_IEEE_SGE_CHAIN_UNION {
1156f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_CHAIN32 Chain32;
1157f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_CHAIN64 Chain64;
1158f92363d1SSreekanth Reddy } MPI2_IEEE_SGE_CHAIN_UNION,
1159f92363d1SSreekanth Reddy 	*PTR_MPI2_IEEE_SGE_CHAIN_UNION,
1160f92363d1SSreekanth Reddy 	Mpi2IeeeSgeChainUnion_t,
1161f92363d1SSreekanth Reddy 	*pMpi2IeeeSgeChainUnion_t;
1162f92363d1SSreekanth Reddy 
1163b130b0d5SSuganath prabu Subramani /*MPI25_IEEE_SGE_CHAIN64 is for MPI v2.5 and later */
1164f92363d1SSreekanth Reddy typedef struct _MPI25_IEEE_SGE_CHAIN64 {
1165f92363d1SSreekanth Reddy 	U64 Address;
1166f92363d1SSreekanth Reddy 	U32 Length;
1167f92363d1SSreekanth Reddy 	U16 Reserved1;
1168f92363d1SSreekanth Reddy 	U8 NextChainOffset;
1169f92363d1SSreekanth Reddy 	U8 Flags;
1170f92363d1SSreekanth Reddy } MPI25_IEEE_SGE_CHAIN64,
1171f92363d1SSreekanth Reddy 	*PTR_MPI25_IEEE_SGE_CHAIN64,
1172f92363d1SSreekanth Reddy 	Mpi25IeeeSgeChain64_t,
1173f92363d1SSreekanth Reddy 	*pMpi25IeeeSgeChain64_t;
1174f92363d1SSreekanth Reddy 
1175f92363d1SSreekanth Reddy /****************************************************************************
1176f92363d1SSreekanth Reddy * All IEEE SGE types union
1177f92363d1SSreekanth Reddy ****************************************************************************/
1178f92363d1SSreekanth Reddy 
1179f92363d1SSreekanth Reddy /*MPI2_IEEE_SGE_UNION is for MPI v2.0 products only */
1180f92363d1SSreekanth Reddy typedef struct _MPI2_IEEE_SGE_UNION {
1181f92363d1SSreekanth Reddy 	union {
1182f92363d1SSreekanth Reddy 		MPI2_IEEE_SGE_SIMPLE_UNION Simple;
1183f92363d1SSreekanth Reddy 		MPI2_IEEE_SGE_CHAIN_UNION Chain;
1184f92363d1SSreekanth Reddy 	} u;
1185f92363d1SSreekanth Reddy } MPI2_IEEE_SGE_UNION, *PTR_MPI2_IEEE_SGE_UNION,
1186f92363d1SSreekanth Reddy 	Mpi2IeeeSgeUnion_t, *pMpi2IeeeSgeUnion_t;
1187f92363d1SSreekanth Reddy 
1188f92363d1SSreekanth Reddy /****************************************************************************
1189f92363d1SSreekanth Reddy * IEEE SGE union for IO SGL's
1190f92363d1SSreekanth Reddy ****************************************************************************/
1191f92363d1SSreekanth Reddy 
1192f92363d1SSreekanth Reddy typedef union _MPI25_SGE_IO_UNION {
1193f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_SIMPLE64 IeeeSimple;
1194f92363d1SSreekanth Reddy 	MPI25_IEEE_SGE_CHAIN64 IeeeChain;
1195f92363d1SSreekanth Reddy } MPI25_SGE_IO_UNION, *PTR_MPI25_SGE_IO_UNION,
1196f92363d1SSreekanth Reddy 	Mpi25SGEIOUnion_t, *pMpi25SGEIOUnion_t;
1197f92363d1SSreekanth Reddy 
1198f92363d1SSreekanth Reddy /****************************************************************************
1199f92363d1SSreekanth Reddy * IEEE SGE field definitions and masks
1200f92363d1SSreekanth Reddy ****************************************************************************/
1201f92363d1SSreekanth Reddy 
1202f92363d1SSreekanth Reddy /*Flags field bit definitions */
1203f92363d1SSreekanth Reddy 
1204f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_ELEMENT_TYPE_MASK   (0x80)
1205f92363d1SSreekanth Reddy #define MPI25_IEEE_SGE_FLAGS_END_OF_LIST        (0x40)
1206f92363d1SSreekanth Reddy 
1207f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_FLAGS_SHIFT             (24)
1208f92363d1SSreekanth Reddy 
1209f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_LENGTH_MASK             (0x00FFFFFF)
1210f92363d1SSreekanth Reddy 
1211f92363d1SSreekanth Reddy /*Element Type */
1212f92363d1SSreekanth Reddy 
1213f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_SIMPLE_ELEMENT      (0x00)
1214f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_CHAIN_ELEMENT       (0x80)
1215f92363d1SSreekanth Reddy 
1216b130b0d5SSuganath prabu Subramani /*Next Segment Format */
1217b130b0d5SSuganath prabu Subramani 
1218b130b0d5SSuganath prabu Subramani #define MPI26_IEEE_SGE_FLAGS_NSF_MASK           (0x1C)
1219b130b0d5SSuganath prabu Subramani #define MPI26_IEEE_SGE_FLAGS_NSF_MPI_IEEE       (0x00)
122090e7a701SSreekanth Reddy #define MPI26_IEEE_SGE_FLAGS_NSF_NVME_PRP       (0x08)
122190e7a701SSreekanth Reddy #define MPI26_IEEE_SGE_FLAGS_NSF_NVME_SGL       (0x10)
1222b130b0d5SSuganath prabu Subramani 
1223f92363d1SSreekanth Reddy /*Data Location Address Space */
1224f92363d1SSreekanth Reddy 
1225f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_ADDR_MASK           (0x03)
1226f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR         (0x00)
1227f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR         (0x01)
1228f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR         (0x02)
1229f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR      (0x03)
1230f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR   (0x03)
1231f92363d1SSreekanth Reddy #define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR \
1232f92363d1SSreekanth Reddy 	 (MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR)
1233b130b0d5SSuganath prabu Subramani #define MPI26_IEEE_SGE_FLAGS_IOCCTL_ADDR        (0x02)
1234f92363d1SSreekanth Reddy 
1235f92363d1SSreekanth Reddy /****************************************************************************
1236f92363d1SSreekanth Reddy * IEEE SGE operation Macros
1237f92363d1SSreekanth Reddy ****************************************************************************/
1238f92363d1SSreekanth Reddy 
1239f92363d1SSreekanth Reddy /*SIMPLE FlagsLength manipulations... */
1240f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_IEEE32_SGE_FLAGS_SHIFT)
1241f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_GET_FLAGS(f) (((f) & ~MPI2_IEEE32_SGE_LENGTH_MASK) \
1242f92363d1SSreekanth Reddy 				 >> MPI2_IEEE32_SGE_FLAGS_SHIFT)
1243f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_LENGTH(f)    ((f) & MPI2_IEEE32_SGE_LENGTH_MASK)
1244f92363d1SSreekanth Reddy 
1245f92363d1SSreekanth Reddy #define MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f, l) (MPI2_IEEE32_SGE_SET_FLAGS(f) |\
1246f92363d1SSreekanth Reddy 						 MPI2_IEEE32_SGE_LENGTH(l))
1247f92363d1SSreekanth Reddy 
1248f92363d1SSreekanth Reddy #define MPI2_IEEE32_pSGE_GET_FLAGS(psg) \
1249f92363d1SSreekanth Reddy 			MPI2_IEEE32_SGE_GET_FLAGS((psg)->FlagsLength)
1250f92363d1SSreekanth Reddy #define MPI2_IEEE32_pSGE_GET_LENGTH(psg) \
1251f92363d1SSreekanth Reddy 			MPI2_IEEE32_SGE_LENGTH((psg)->FlagsLength)
1252f92363d1SSreekanth Reddy #define MPI2_IEEE32_pSGE_SET_FLAGS_LENGTH(psg, f, l) ((psg)->FlagsLength = \
1253f92363d1SSreekanth Reddy 					MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f, l))
1254f92363d1SSreekanth Reddy 
1255f92363d1SSreekanth Reddy /*CAUTION - The following are READ-MODIFY-WRITE! */
1256f92363d1SSreekanth Reddy #define MPI2_IEEE32_pSGE_SET_FLAGS(psg, f) ((psg)->FlagsLength |= \
1257f92363d1SSreekanth Reddy 					MPI2_IEEE32_SGE_SET_FLAGS(f))
1258f92363d1SSreekanth Reddy #define MPI2_IEEE32_pSGE_SET_LENGTH(psg, l) ((psg)->FlagsLength |= \
1259f92363d1SSreekanth Reddy 					MPI2_IEEE32_SGE_LENGTH(l))
1260f92363d1SSreekanth Reddy 
1261f92363d1SSreekanth Reddy /*****************************************************************************
1262f92363d1SSreekanth Reddy *
1263f92363d1SSreekanth Reddy *       Fusion-MPT MPI/IEEE Scatter Gather Unions
1264f92363d1SSreekanth Reddy *
1265f92363d1SSreekanth Reddy *****************************************************************************/
1266f92363d1SSreekanth Reddy 
1267f92363d1SSreekanth Reddy typedef union _MPI2_SIMPLE_SGE_UNION {
1268f92363d1SSreekanth Reddy 	MPI2_SGE_SIMPLE_UNION MpiSimple;
1269f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple;
1270f92363d1SSreekanth Reddy } MPI2_SIMPLE_SGE_UNION, *PTR_MPI2_SIMPLE_SGE_UNION,
1271f92363d1SSreekanth Reddy 	Mpi2SimpleSgeUntion_t, *pMpi2SimpleSgeUntion_t;
1272f92363d1SSreekanth Reddy 
1273f92363d1SSreekanth Reddy typedef union _MPI2_SGE_IO_UNION {
1274f92363d1SSreekanth Reddy 	MPI2_SGE_SIMPLE_UNION MpiSimple;
1275f92363d1SSreekanth Reddy 	MPI2_SGE_CHAIN_UNION MpiChain;
1276f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple;
1277f92363d1SSreekanth Reddy 	MPI2_IEEE_SGE_CHAIN_UNION IeeeChain;
1278f92363d1SSreekanth Reddy } MPI2_SGE_IO_UNION, *PTR_MPI2_SGE_IO_UNION,
1279f92363d1SSreekanth Reddy 	Mpi2SGEIOUnion_t, *pMpi2SGEIOUnion_t;
1280f92363d1SSreekanth Reddy 
1281f92363d1SSreekanth Reddy /****************************************************************************
1282f92363d1SSreekanth Reddy *
1283f92363d1SSreekanth Reddy * Values for SGLFlags field, used in many request messages with an SGL
1284f92363d1SSreekanth Reddy *
1285f92363d1SSreekanth Reddy ****************************************************************************/
1286f92363d1SSreekanth Reddy 
1287f92363d1SSreekanth Reddy /*values for MPI SGL Data Location Address Space subfield */
1288f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_ADDRESS_SPACE_MASK            (0x0C)
1289f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_SYSTEM_ADDRESS_SPACE          (0x00)
1290f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_IOCDDR_ADDRESS_SPACE          (0x04)
1291f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_IOCPLB_ADDRESS_SPACE          (0x08)
1292b130b0d5SSuganath prabu Subramani #define MPI26_SGLFLAGS_IOCPLB_ADDRESS_SPACE         (0x08)
1293f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_IOCPLBNTA_ADDRESS_SPACE       (0x0C)
1294f92363d1SSreekanth Reddy /*values for SGL Type subfield */
1295f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_SGL_TYPE_MASK                 (0x03)
1296f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_SGL_TYPE_MPI                  (0x00)
1297f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_SGL_TYPE_IEEE32               (0x01)
1298f92363d1SSreekanth Reddy #define MPI2_SGLFLAGS_SGL_TYPE_IEEE64               (0x02)
1299f92363d1SSreekanth Reddy 
1300f92363d1SSreekanth Reddy #endif
1301