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