162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2000-2020 Broadcom Inc. All rights reserved.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci *          Name:  mpi2.h
762306a36Sopenharmony_ci *         Title:  MPI Message independent structures and definitions
862306a36Sopenharmony_ci *                 including System Interface Register Set and
962306a36Sopenharmony_ci *                 scatter/gather formats.
1062306a36Sopenharmony_ci * Creation Date:  June 21, 2006
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *  mpi2.h Version:  02.00.54
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
1562306a36Sopenharmony_ci *       prefix are for use only on MPI v2.5 products, and must not be used
1662306a36Sopenharmony_ci *       with MPI v2.0 products. Unless otherwise noted, names beginning with
1762306a36Sopenharmony_ci *       MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
1862306a36Sopenharmony_ci *
1962306a36Sopenharmony_ci * Version History
2062306a36Sopenharmony_ci * ---------------
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * Date      Version   Description
2362306a36Sopenharmony_ci * --------  --------  ------------------------------------------------------
2462306a36Sopenharmony_ci * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
2562306a36Sopenharmony_ci * 06-04-07  02.00.01  Bumped MPI2_HEADER_VERSION_UNIT.
2662306a36Sopenharmony_ci * 06-26-07  02.00.02  Bumped MPI2_HEADER_VERSION_UNIT.
2762306a36Sopenharmony_ci * 08-31-07  02.00.03  Bumped MPI2_HEADER_VERSION_UNIT.
2862306a36Sopenharmony_ci *                     Moved ReplyPostHostIndex register to offset 0x6C of the
2962306a36Sopenharmony_ci *                     MPI2_SYSTEM_INTERFACE_REGS and modified the define for
3062306a36Sopenharmony_ci *                     MPI2_REPLY_POST_HOST_INDEX_OFFSET.
3162306a36Sopenharmony_ci *                     Added union of request descriptors.
3262306a36Sopenharmony_ci *                     Added union of reply descriptors.
3362306a36Sopenharmony_ci * 10-31-07  02.00.04  Bumped MPI2_HEADER_VERSION_UNIT.
3462306a36Sopenharmony_ci *                     Added define for MPI2_VERSION_02_00.
3562306a36Sopenharmony_ci *                     Fixed the size of the FunctionDependent5 field in the
3662306a36Sopenharmony_ci *                     MPI2_DEFAULT_REPLY structure.
3762306a36Sopenharmony_ci * 12-18-07  02.00.05  Bumped MPI2_HEADER_VERSION_UNIT.
3862306a36Sopenharmony_ci *                     Removed the MPI-defined Fault Codes and extended the
3962306a36Sopenharmony_ci *                     product specific codes up to 0xEFFF.
4062306a36Sopenharmony_ci *                     Added a sixth key value for the WriteSequence register
4162306a36Sopenharmony_ci *                     and changed the flush value to 0x0.
4262306a36Sopenharmony_ci *                     Added message function codes for Diagnostic Buffer Post
4362306a36Sopenharmony_ci *                     and Diagnsotic Release.
4462306a36Sopenharmony_ci *                     New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED
4562306a36Sopenharmony_ci *                     Moved MPI2_VERSION_UNION from mpi2_ioc.h.
4662306a36Sopenharmony_ci * 02-29-08  02.00.06  Bumped MPI2_HEADER_VERSION_UNIT.
4762306a36Sopenharmony_ci * 03-03-08  02.00.07  Bumped MPI2_HEADER_VERSION_UNIT.
4862306a36Sopenharmony_ci * 05-21-08  02.00.08  Bumped MPI2_HEADER_VERSION_UNIT.
4962306a36Sopenharmony_ci *                     Added #defines for marking a reply descriptor as unused.
5062306a36Sopenharmony_ci * 06-27-08  02.00.09  Bumped MPI2_HEADER_VERSION_UNIT.
5162306a36Sopenharmony_ci * 10-02-08  02.00.10  Bumped MPI2_HEADER_VERSION_UNIT.
5262306a36Sopenharmony_ci *                     Moved LUN field defines from mpi2_init.h.
5362306a36Sopenharmony_ci * 01-19-09  02.00.11  Bumped MPI2_HEADER_VERSION_UNIT.
5462306a36Sopenharmony_ci * 05-06-09  02.00.12  Bumped MPI2_HEADER_VERSION_UNIT.
5562306a36Sopenharmony_ci *                     In all request and reply descriptors, replaced VF_ID
5662306a36Sopenharmony_ci *                     field with MSIxIndex field.
5762306a36Sopenharmony_ci *                     Removed DevHandle field from
5862306a36Sopenharmony_ci *                     MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
5962306a36Sopenharmony_ci *                     bytes reserved.
6062306a36Sopenharmony_ci *                     Added RAID Accelerator functionality.
6162306a36Sopenharmony_ci * 07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
6262306a36Sopenharmony_ci * 10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
6362306a36Sopenharmony_ci *                     Added MSI-x index mask and shift for Reply Post Host
6462306a36Sopenharmony_ci *                     Index register.
6562306a36Sopenharmony_ci *                     Added function code for Host Based Discovery Action.
6662306a36Sopenharmony_ci * 02-10-10  02.00.15  Bumped MPI2_HEADER_VERSION_UNIT.
6762306a36Sopenharmony_ci *                     Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL.
6862306a36Sopenharmony_ci *                     Added defines for product-specific range of message
6962306a36Sopenharmony_ci *                     function codes, 0xF0 to 0xFF.
7062306a36Sopenharmony_ci * 05-12-10  02.00.16  Bumped MPI2_HEADER_VERSION_UNIT.
7162306a36Sopenharmony_ci *                     Added alternative defines for the SGE Direction bit.
7262306a36Sopenharmony_ci * 08-11-10  02.00.17  Bumped MPI2_HEADER_VERSION_UNIT.
7362306a36Sopenharmony_ci * 11-10-10  02.00.18  Bumped MPI2_HEADER_VERSION_UNIT.
7462306a36Sopenharmony_ci *                     Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define.
7562306a36Sopenharmony_ci * 02-23-11  02.00.19  Bumped MPI2_HEADER_VERSION_UNIT.
7662306a36Sopenharmony_ci *                     Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
7762306a36Sopenharmony_ci * 03-09-11  02.00.20  Bumped MPI2_HEADER_VERSION_UNIT.
7862306a36Sopenharmony_ci * 05-25-11  02.00.21  Bumped MPI2_HEADER_VERSION_UNIT.
7962306a36Sopenharmony_ci * 08-24-11  02.00.22  Bumped MPI2_HEADER_VERSION_UNIT.
8062306a36Sopenharmony_ci * 11-18-11  02.00.23  Bumped MPI2_HEADER_VERSION_UNIT.
8162306a36Sopenharmony_ci *                     Incorporating additions for MPI v2.5.
8262306a36Sopenharmony_ci * 02-06-12  02.00.24  Bumped MPI2_HEADER_VERSION_UNIT.
8362306a36Sopenharmony_ci * 03-29-12  02.00.25  Bumped MPI2_HEADER_VERSION_UNIT.
8462306a36Sopenharmony_ci *                     Added Hard Reset delay timings.
8562306a36Sopenharmony_ci * 07-10-12  02.00.26  Bumped MPI2_HEADER_VERSION_UNIT.
8662306a36Sopenharmony_ci * 07-26-12  02.00.27  Bumped MPI2_HEADER_VERSION_UNIT.
8762306a36Sopenharmony_ci * 11-27-12  02.00.28  Bumped MPI2_HEADER_VERSION_UNIT.
8862306a36Sopenharmony_ci * 12-20-12  02.00.29  Bumped MPI2_HEADER_VERSION_UNIT.
8962306a36Sopenharmony_ci *                     Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET.
9062306a36Sopenharmony_ci * 04-09-13  02.00.30  Bumped MPI2_HEADER_VERSION_UNIT.
9162306a36Sopenharmony_ci * 04-17-13  02.00.31  Bumped MPI2_HEADER_VERSION_UNIT.
9262306a36Sopenharmony_ci * 08-19-13  02.00.32  Bumped MPI2_HEADER_VERSION_UNIT.
9362306a36Sopenharmony_ci * 12-05-13  02.00.33  Bumped MPI2_HEADER_VERSION_UNIT.
9462306a36Sopenharmony_ci * 01-08-14  02.00.34  Bumped MPI2_HEADER_VERSION_UNIT
9562306a36Sopenharmony_ci * 06-13-14  02.00.35  Bumped MPI2_HEADER_VERSION_UNIT.
9662306a36Sopenharmony_ci * 11-18-14  02.00.36  Updated copyright information.
9762306a36Sopenharmony_ci *                     Bumped MPI2_HEADER_VERSION_UNIT.
9862306a36Sopenharmony_ci * 03-16-15  02.00.37  Bumped MPI2_HEADER_VERSION_UNIT.
9962306a36Sopenharmony_ci *                     Added Scratchpad registers to
10062306a36Sopenharmony_ci *                     MPI2_SYSTEM_INTERFACE_REGS.
10162306a36Sopenharmony_ci *                     Added MPI2_DIAG_SBR_RELOAD.
10262306a36Sopenharmony_ci * 03-19-15  02.00.38  Bumped MPI2_HEADER_VERSION_UNIT.
10362306a36Sopenharmony_ci * 05-25-15  02.00.39  Bumped MPI2_HEADER_VERSION_UNIT.
10462306a36Sopenharmony_ci * 08-25-15  02.00.40  Bumped MPI2_HEADER_VERSION_UNIT.
10562306a36Sopenharmony_ci * 12-15-15  02.00.41  Bumped MPI_HEADER_VERSION_UNIT
10662306a36Sopenharmony_ci * 01-01-16  02.00.42  Bumped MPI_HEADER_VERSION_UNIT
10762306a36Sopenharmony_ci * 04-05-16  02.00.43  Modified  MPI26_DIAG_BOOT_DEVICE_SELECT defines
10862306a36Sopenharmony_ci *                     to be unique within first 32 characters.
10962306a36Sopenharmony_ci *                     Removed AHCI support.
11062306a36Sopenharmony_ci *                     Removed SOP support.
11162306a36Sopenharmony_ci *                     Bumped MPI2_HEADER_VERSION_UNIT.
11262306a36Sopenharmony_ci * 04-10-16  02.00.44  Bumped MPI2_HEADER_VERSION_UNIT.
11362306a36Sopenharmony_ci * 07-06-16  02.00.45  Bumped MPI2_HEADER_VERSION_UNIT.
11462306a36Sopenharmony_ci * 09-02-16  02.00.46  Bumped MPI2_HEADER_VERSION_UNIT.
11562306a36Sopenharmony_ci * 11-23-16  02.00.47  Bumped MPI2_HEADER_VERSION_UNIT.
11662306a36Sopenharmony_ci * 02-03-17  02.00.48  Bumped MPI2_HEADER_VERSION_UNIT.
11762306a36Sopenharmony_ci * 06-13-17  02.00.49  Bumped MPI2_HEADER_VERSION_UNIT.
11862306a36Sopenharmony_ci * 09-29-17  02.00.50  Bumped MPI2_HEADER_VERSION_UNIT.
11962306a36Sopenharmony_ci * 07-22-18  02.00.51  Added SECURE_BOOT define.
12062306a36Sopenharmony_ci *                     Bumped MPI2_HEADER_VERSION_UNIT
12162306a36Sopenharmony_ci * 08-15-18  02.00.52  Bumped MPI2_HEADER_VERSION_UNIT.
12262306a36Sopenharmony_ci * 08-28-18  02.00.53  Bumped MPI2_HEADER_VERSION_UNIT.
12362306a36Sopenharmony_ci *                     Added MPI2_IOCSTATUS_FAILURE
12462306a36Sopenharmony_ci * 12-17-18  02.00.54  Bumped MPI2_HEADER_VERSION_UNIT
12562306a36Sopenharmony_ci * 06-24-19  02.00.55  Bumped MPI2_HEADER_VERSION_UNIT
12662306a36Sopenharmony_ci * 08-01-19  02.00.56  Bumped MPI2_HEADER_VERSION_UNIT
12762306a36Sopenharmony_ci * 10-02-19  02.00.57  Bumped MPI2_HEADER_VERSION_UNIT
12862306a36Sopenharmony_ci *  --------------------------------------------------------------------------
12962306a36Sopenharmony_ci */
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#ifndef MPI2_H
13262306a36Sopenharmony_ci#define MPI2_H
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/*****************************************************************************
13562306a36Sopenharmony_ci*
13662306a36Sopenharmony_ci*       MPI Version Definitions
13762306a36Sopenharmony_ci*
13862306a36Sopenharmony_ci*****************************************************************************/
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define MPI2_VERSION_MAJOR_MASK             (0xFF00)
14162306a36Sopenharmony_ci#define MPI2_VERSION_MAJOR_SHIFT            (8)
14262306a36Sopenharmony_ci#define MPI2_VERSION_MINOR_MASK             (0x00FF)
14362306a36Sopenharmony_ci#define MPI2_VERSION_MINOR_SHIFT            (0)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/*major version for all MPI v2.x */
14662306a36Sopenharmony_ci#define MPI2_VERSION_MAJOR                  (0x02)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/*minor version for MPI v2.0 compatible products */
14962306a36Sopenharmony_ci#define MPI2_VERSION_MINOR                  (0x00)
15062306a36Sopenharmony_ci#define MPI2_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
15162306a36Sopenharmony_ci					MPI2_VERSION_MINOR)
15262306a36Sopenharmony_ci#define MPI2_VERSION_02_00                  (0x0200)
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/*minor version for MPI v2.5 compatible products */
15562306a36Sopenharmony_ci#define MPI25_VERSION_MINOR                 (0x05)
15662306a36Sopenharmony_ci#define MPI25_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
15762306a36Sopenharmony_ci					MPI25_VERSION_MINOR)
15862306a36Sopenharmony_ci#define MPI2_VERSION_02_05                  (0x0205)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci/*minor version for MPI v2.6 compatible products */
16162306a36Sopenharmony_ci#define MPI26_VERSION_MINOR		    (0x06)
16262306a36Sopenharmony_ci#define MPI26_VERSION ((MPI2_VERSION_MAJOR << MPI2_VERSION_MAJOR_SHIFT) | \
16362306a36Sopenharmony_ci					MPI26_VERSION_MINOR)
16462306a36Sopenharmony_ci#define MPI2_VERSION_02_06		    (0x0206)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci/* Unit and Dev versioning for this MPI header set */
16862306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_UNIT            (0x39)
16962306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_DEV             (0x00)
17062306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_UNIT_MASK       (0xFF00)
17162306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_UNIT_SHIFT      (8)
17262306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_DEV_MASK        (0x00FF)
17362306a36Sopenharmony_ci#define MPI2_HEADER_VERSION_DEV_SHIFT       (0)
17462306a36Sopenharmony_ci#define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | \
17562306a36Sopenharmony_ci					MPI2_HEADER_VERSION_DEV)
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci/*****************************************************************************
17862306a36Sopenharmony_ci*
17962306a36Sopenharmony_ci*       IOC State Definitions
18062306a36Sopenharmony_ci*
18162306a36Sopenharmony_ci*****************************************************************************/
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define MPI2_IOC_STATE_RESET               (0x00000000)
18462306a36Sopenharmony_ci#define MPI2_IOC_STATE_READY               (0x10000000)
18562306a36Sopenharmony_ci#define MPI2_IOC_STATE_OPERATIONAL         (0x20000000)
18662306a36Sopenharmony_ci#define MPI2_IOC_STATE_FAULT               (0x40000000)
18762306a36Sopenharmony_ci#define MPI2_IOC_STATE_COREDUMP            (0x50000000)
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define MPI2_IOC_STATE_MASK                (0xF0000000)
19062306a36Sopenharmony_ci#define MPI2_IOC_STATE_SHIFT               (28)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/*Fault state range for prodcut specific codes */
19362306a36Sopenharmony_ci#define MPI2_FAULT_PRODUCT_SPECIFIC_MIN                 (0x0000)
19462306a36Sopenharmony_ci#define MPI2_FAULT_PRODUCT_SPECIFIC_MAX                 (0xEFFF)
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci/*****************************************************************************
19762306a36Sopenharmony_ci*
19862306a36Sopenharmony_ci*       System Interface Register Definitions
19962306a36Sopenharmony_ci*
20062306a36Sopenharmony_ci*****************************************************************************/
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_citypedef struct _MPI2_SYSTEM_INTERFACE_REGS {
20362306a36Sopenharmony_ci	U32 Doorbell;		/*0x00 */
20462306a36Sopenharmony_ci	U32 WriteSequence;	/*0x04 */
20562306a36Sopenharmony_ci	U32 HostDiagnostic;	/*0x08 */
20662306a36Sopenharmony_ci	U32 Reserved1;		/*0x0C */
20762306a36Sopenharmony_ci	U32 DiagRWData;		/*0x10 */
20862306a36Sopenharmony_ci	U32 DiagRWAddressLow;	/*0x14 */
20962306a36Sopenharmony_ci	U32 DiagRWAddressHigh;	/*0x18 */
21062306a36Sopenharmony_ci	U32 Reserved2[5];	/*0x1C */
21162306a36Sopenharmony_ci	U32 HostInterruptStatus;	/*0x30 */
21262306a36Sopenharmony_ci	U32 HostInterruptMask;	/*0x34 */
21362306a36Sopenharmony_ci	U32 DCRData;		/*0x38 */
21462306a36Sopenharmony_ci	U32 DCRAddress;		/*0x3C */
21562306a36Sopenharmony_ci	U32 Reserved3[2];	/*0x40 */
21662306a36Sopenharmony_ci	U32 ReplyFreeHostIndex;	/*0x48 */
21762306a36Sopenharmony_ci	U32 Reserved4[8];	/*0x4C */
21862306a36Sopenharmony_ci	U32 ReplyPostHostIndex;	/*0x6C */
21962306a36Sopenharmony_ci	U32 Reserved5;		/*0x70 */
22062306a36Sopenharmony_ci	U32 HCBSize;		/*0x74 */
22162306a36Sopenharmony_ci	U32 HCBAddressLow;	/*0x78 */
22262306a36Sopenharmony_ci	U32 HCBAddressHigh;	/*0x7C */
22362306a36Sopenharmony_ci	U32 Reserved6[12];	/*0x80 */
22462306a36Sopenharmony_ci	U32 Scratchpad[4];	/*0xB0 */
22562306a36Sopenharmony_ci	U32 RequestDescriptorPostLow;	/*0xC0 */
22662306a36Sopenharmony_ci	U32 RequestDescriptorPostHigh;	/*0xC4 */
22762306a36Sopenharmony_ci	U32 AtomicRequestDescriptorPost;/*0xC8 */
22862306a36Sopenharmony_ci	U32 Reserved7[13];	/*0xCC */
22962306a36Sopenharmony_ci} MPI2_SYSTEM_INTERFACE_REGS,
23062306a36Sopenharmony_ci	*PTR_MPI2_SYSTEM_INTERFACE_REGS,
23162306a36Sopenharmony_ci	Mpi2SystemInterfaceRegs_t,
23262306a36Sopenharmony_ci	*pMpi2SystemInterfaceRegs_t;
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci/*
23562306a36Sopenharmony_ci *Defines for working with the Doorbell register.
23662306a36Sopenharmony_ci */
23762306a36Sopenharmony_ci#define MPI2_DOORBELL_OFFSET                    (0x00000000)
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci/*IOC --> System values */
24062306a36Sopenharmony_ci#define MPI2_DOORBELL_USED                      (0x08000000)
24162306a36Sopenharmony_ci#define MPI2_DOORBELL_WHO_INIT_MASK             (0x07000000)
24262306a36Sopenharmony_ci#define MPI2_DOORBELL_WHO_INIT_SHIFT            (24)
24362306a36Sopenharmony_ci#define MPI2_DOORBELL_FAULT_CODE_MASK           (0x0000FFFF)
24462306a36Sopenharmony_ci#define MPI2_DOORBELL_DATA_MASK                 (0x0000FFFF)
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/*System --> IOC values */
24762306a36Sopenharmony_ci#define MPI2_DOORBELL_FUNCTION_MASK             (0xFF000000)
24862306a36Sopenharmony_ci#define MPI2_DOORBELL_FUNCTION_SHIFT            (24)
24962306a36Sopenharmony_ci#define MPI2_DOORBELL_ADD_DWORDS_MASK           (0x00FF0000)
25062306a36Sopenharmony_ci#define MPI2_DOORBELL_ADD_DWORDS_SHIFT          (16)
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci/*
25362306a36Sopenharmony_ci *Defines for the WriteSequence register
25462306a36Sopenharmony_ci */
25562306a36Sopenharmony_ci#define MPI2_WRITE_SEQUENCE_OFFSET              (0x00000004)
25662306a36Sopenharmony_ci#define MPI2_WRSEQ_KEY_VALUE_MASK               (0x0000000F)
25762306a36Sopenharmony_ci#define MPI2_WRSEQ_FLUSH_KEY_VALUE              (0x0)
25862306a36Sopenharmony_ci#define MPI2_WRSEQ_1ST_KEY_VALUE                (0xF)
25962306a36Sopenharmony_ci#define MPI2_WRSEQ_2ND_KEY_VALUE                (0x4)
26062306a36Sopenharmony_ci#define MPI2_WRSEQ_3RD_KEY_VALUE                (0xB)
26162306a36Sopenharmony_ci#define MPI2_WRSEQ_4TH_KEY_VALUE                (0x2)
26262306a36Sopenharmony_ci#define MPI2_WRSEQ_5TH_KEY_VALUE                (0x7)
26362306a36Sopenharmony_ci#define MPI2_WRSEQ_6TH_KEY_VALUE                (0xD)
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci/*
26662306a36Sopenharmony_ci *Defines for the HostDiagnostic register
26762306a36Sopenharmony_ci */
26862306a36Sopenharmony_ci#define MPI2_HOST_DIAGNOSTIC_OFFSET             (0x00000008)
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci#define MPI26_DIAG_SECURE_BOOT                  (0x80000000)
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci#define MPI2_DIAG_SBR_RELOAD                    (0x00002000)
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci#define MPI2_DIAG_BOOT_DEVICE_SELECT_MASK       (0x00001800)
27562306a36Sopenharmony_ci#define MPI2_DIAG_BOOT_DEVICE_SELECT_DEFAULT    (0x00000000)
27662306a36Sopenharmony_ci#define MPI2_DIAG_BOOT_DEVICE_SELECT_HCDW       (0x00000800)
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci/* Defines for V7A/V7R HostDiagnostic Register */
27962306a36Sopenharmony_ci#define MPI26_DIAG_BOOT_DEVICE_SEL_64FLASH      (0x00000000)
28062306a36Sopenharmony_ci#define MPI26_DIAG_BOOT_DEVICE_SEL_64HCDW       (0x00000800)
28162306a36Sopenharmony_ci#define MPI26_DIAG_BOOT_DEVICE_SEL_32FLASH      (0x00001000)
28262306a36Sopenharmony_ci#define MPI26_DIAG_BOOT_DEVICE_SEL_32HCDW       (0x00001800)
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci#define MPI2_DIAG_CLEAR_FLASH_BAD_SIG           (0x00000400)
28562306a36Sopenharmony_ci#define MPI2_DIAG_FORCE_HCB_ON_RESET            (0x00000200)
28662306a36Sopenharmony_ci#define MPI2_DIAG_HCB_MODE                      (0x00000100)
28762306a36Sopenharmony_ci#define MPI2_DIAG_DIAG_WRITE_ENABLE             (0x00000080)
28862306a36Sopenharmony_ci#define MPI2_DIAG_FLASH_BAD_SIG                 (0x00000040)
28962306a36Sopenharmony_ci#define MPI2_DIAG_RESET_HISTORY                 (0x00000020)
29062306a36Sopenharmony_ci#define MPI2_DIAG_DIAG_RW_ENABLE                (0x00000010)
29162306a36Sopenharmony_ci#define MPI2_DIAG_RESET_ADAPTER                 (0x00000004)
29262306a36Sopenharmony_ci#define MPI2_DIAG_HOLD_IOC_RESET                (0x00000002)
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci/*
29562306a36Sopenharmony_ci *Offsets for DiagRWData and address
29662306a36Sopenharmony_ci */
29762306a36Sopenharmony_ci#define MPI2_DIAG_RW_DATA_OFFSET                (0x00000010)
29862306a36Sopenharmony_ci#define MPI2_DIAG_RW_ADDRESS_LOW_OFFSET         (0x00000014)
29962306a36Sopenharmony_ci#define MPI2_DIAG_RW_ADDRESS_HIGH_OFFSET        (0x00000018)
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci/*
30262306a36Sopenharmony_ci *Defines for the HostInterruptStatus register
30362306a36Sopenharmony_ci */
30462306a36Sopenharmony_ci#define MPI2_HOST_INTERRUPT_STATUS_OFFSET       (0x00000030)
30562306a36Sopenharmony_ci#define MPI2_HIS_SYS2IOC_DB_STATUS              (0x80000000)
30662306a36Sopenharmony_ci#define MPI2_HIS_IOP_DOORBELL_STATUS MPI2_HIS_SYS2IOC_DB_STATUS
30762306a36Sopenharmony_ci#define MPI2_HIS_RESET_IRQ_STATUS               (0x40000000)
30862306a36Sopenharmony_ci#define MPI2_HIS_REPLY_DESCRIPTOR_INTERRUPT     (0x00000008)
30962306a36Sopenharmony_ci#define MPI2_HIS_IOC2SYS_DB_STATUS              (0x00000001)
31062306a36Sopenharmony_ci#define MPI2_HIS_DOORBELL_INTERRUPT MPI2_HIS_IOC2SYS_DB_STATUS
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci/*
31362306a36Sopenharmony_ci *Defines for the HostInterruptMask register
31462306a36Sopenharmony_ci */
31562306a36Sopenharmony_ci#define MPI2_HOST_INTERRUPT_MASK_OFFSET         (0x00000034)
31662306a36Sopenharmony_ci#define MPI2_HIM_RESET_IRQ_MASK                 (0x40000000)
31762306a36Sopenharmony_ci#define MPI2_HIM_REPLY_INT_MASK                 (0x00000008)
31862306a36Sopenharmony_ci#define MPI2_HIM_RIM                            MPI2_HIM_REPLY_INT_MASK
31962306a36Sopenharmony_ci#define MPI2_HIM_IOC2SYS_DB_MASK                (0x00000001)
32062306a36Sopenharmony_ci#define MPI2_HIM_DIM                            MPI2_HIM_IOC2SYS_DB_MASK
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci/*
32362306a36Sopenharmony_ci *Offsets for DCRData and address
32462306a36Sopenharmony_ci */
32562306a36Sopenharmony_ci#define MPI2_DCR_DATA_OFFSET                    (0x00000038)
32662306a36Sopenharmony_ci#define MPI2_DCR_ADDRESS_OFFSET                 (0x0000003C)
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci/*
32962306a36Sopenharmony_ci *Offset for the Reply Free Queue
33062306a36Sopenharmony_ci */
33162306a36Sopenharmony_ci#define MPI2_REPLY_FREE_HOST_INDEX_OFFSET       (0x00000048)
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci/*
33462306a36Sopenharmony_ci *Defines for the Reply Descriptor Post Queue
33562306a36Sopenharmony_ci */
33662306a36Sopenharmony_ci#define MPI2_REPLY_POST_HOST_INDEX_OFFSET       (0x0000006C)
33762306a36Sopenharmony_ci#define MPI2_REPLY_POST_HOST_INDEX_MASK         (0x00FFFFFF)
33862306a36Sopenharmony_ci#define MPI2_RPHI_MSIX_INDEX_MASK               (0xFF000000)
33962306a36Sopenharmony_ci#define MPI2_RPHI_MSIX_INDEX_SHIFT              (24)
34062306a36Sopenharmony_ci#define MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET  (0x0000030C) /*MPI v2.5 only*/
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci/*
34462306a36Sopenharmony_ci *Defines for the HCBSize and address
34562306a36Sopenharmony_ci */
34662306a36Sopenharmony_ci#define MPI2_HCB_SIZE_OFFSET                    (0x00000074)
34762306a36Sopenharmony_ci#define MPI2_HCB_SIZE_SIZE_MASK                 (0xFFFFF000)
34862306a36Sopenharmony_ci#define MPI2_HCB_SIZE_HCB_ENABLE                (0x00000001)
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci#define MPI2_HCB_ADDRESS_LOW_OFFSET             (0x00000078)
35162306a36Sopenharmony_ci#define MPI2_HCB_ADDRESS_HIGH_OFFSET            (0x0000007C)
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci/*
35462306a36Sopenharmony_ci *Offsets for the Scratchpad registers
35562306a36Sopenharmony_ci */
35662306a36Sopenharmony_ci#define MPI26_SCRATCHPAD0_OFFSET                (0x000000B0)
35762306a36Sopenharmony_ci#define MPI26_SCRATCHPAD1_OFFSET                (0x000000B4)
35862306a36Sopenharmony_ci#define MPI26_SCRATCHPAD2_OFFSET                (0x000000B8)
35962306a36Sopenharmony_ci#define MPI26_SCRATCHPAD3_OFFSET                (0x000000BC)
36062306a36Sopenharmony_ci
36162306a36Sopenharmony_ci/*
36262306a36Sopenharmony_ci *Offsets for the Request Descriptor Post Queue
36362306a36Sopenharmony_ci */
36462306a36Sopenharmony_ci#define MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET     (0x000000C0)
36562306a36Sopenharmony_ci#define MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET    (0x000000C4)
36662306a36Sopenharmony_ci#define MPI26_ATOMIC_REQUEST_DESCRIPTOR_POST_OFFSET (0x000000C8)
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci/*Hard Reset delay timings */
36962306a36Sopenharmony_ci#define MPI2_HARD_RESET_PCIE_FIRST_READ_DELAY_MICRO_SEC     (50000)
37062306a36Sopenharmony_ci#define MPI2_HARD_RESET_PCIE_RESET_READ_WINDOW_MICRO_SEC    (255000)
37162306a36Sopenharmony_ci#define MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC    (256000)
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci/*****************************************************************************
37462306a36Sopenharmony_ci*
37562306a36Sopenharmony_ci*       Message Descriptors
37662306a36Sopenharmony_ci*
37762306a36Sopenharmony_ci*****************************************************************************/
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_ci/*Request Descriptors */
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ci/*Default Request Descriptor */
38262306a36Sopenharmony_citypedef struct _MPI2_DEFAULT_REQUEST_DESCRIPTOR {
38362306a36Sopenharmony_ci	U8 RequestFlags;	/*0x00 */
38462306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
38562306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
38662306a36Sopenharmony_ci	U16 LMID;		/*0x04 */
38762306a36Sopenharmony_ci	U16 DescriptorTypeDependent;	/*0x06 */
38862306a36Sopenharmony_ci} MPI2_DEFAULT_REQUEST_DESCRIPTOR,
38962306a36Sopenharmony_ci	*PTR_MPI2_DEFAULT_REQUEST_DESCRIPTOR,
39062306a36Sopenharmony_ci	Mpi2DefaultRequestDescriptor_t,
39162306a36Sopenharmony_ci	*pMpi2DefaultRequestDescriptor_t;
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci/*defines for the RequestFlags field */
39462306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_TYPE_MASK               (0x1E)
39562306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_TYPE_RSHIFT             (1)
39662306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO                 (0x00)
39762306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET             (0x02)
39862306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY           (0x06)
39962306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE            (0x08)
40062306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_RAID_ACCELERATOR        (0x0A)
40162306a36Sopenharmony_ci#define MPI25_REQ_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO      (0x0C)
40262306a36Sopenharmony_ci#define MPI26_REQ_DESCRIPT_FLAGS_PCIE_ENCAPSULATED      (0x10)
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci#define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER         (0x01)
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_ci/*High Priority Request Descriptor */
40762306a36Sopenharmony_citypedef struct _MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR {
40862306a36Sopenharmony_ci	U8 RequestFlags;	/*0x00 */
40962306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
41062306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
41162306a36Sopenharmony_ci	U16 LMID;		/*0x04 */
41262306a36Sopenharmony_ci	U16 Reserved1;		/*0x06 */
41362306a36Sopenharmony_ci} MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR,
41462306a36Sopenharmony_ci	*PTR_MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR,
41562306a36Sopenharmony_ci	Mpi2HighPriorityRequestDescriptor_t,
41662306a36Sopenharmony_ci	*pMpi2HighPriorityRequestDescriptor_t;
41762306a36Sopenharmony_ci
41862306a36Sopenharmony_ci/*SCSI IO Request Descriptor */
41962306a36Sopenharmony_citypedef struct _MPI2_SCSI_IO_REQUEST_DESCRIPTOR {
42062306a36Sopenharmony_ci	U8 RequestFlags;	/*0x00 */
42162306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
42262306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
42362306a36Sopenharmony_ci	U16 LMID;		/*0x04 */
42462306a36Sopenharmony_ci	U16 DevHandle;		/*0x06 */
42562306a36Sopenharmony_ci} MPI2_SCSI_IO_REQUEST_DESCRIPTOR,
42662306a36Sopenharmony_ci	*PTR_MPI2_SCSI_IO_REQUEST_DESCRIPTOR,
42762306a36Sopenharmony_ci	Mpi2SCSIIORequestDescriptor_t,
42862306a36Sopenharmony_ci	*pMpi2SCSIIORequestDescriptor_t;
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_ci/*SCSI Target Request Descriptor */
43162306a36Sopenharmony_citypedef struct _MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR {
43262306a36Sopenharmony_ci	U8 RequestFlags;	/*0x00 */
43362306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
43462306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
43562306a36Sopenharmony_ci	U16 LMID;		/*0x04 */
43662306a36Sopenharmony_ci	U16 IoIndex;		/*0x06 */
43762306a36Sopenharmony_ci} MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR,
43862306a36Sopenharmony_ci	*PTR_MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR,
43962306a36Sopenharmony_ci	Mpi2SCSITargetRequestDescriptor_t,
44062306a36Sopenharmony_ci	*pMpi2SCSITargetRequestDescriptor_t;
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ci/*RAID Accelerator Request Descriptor */
44362306a36Sopenharmony_citypedef struct _MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR {
44462306a36Sopenharmony_ci	U8 RequestFlags;	/*0x00 */
44562306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
44662306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
44762306a36Sopenharmony_ci	U16 LMID;		/*0x04 */
44862306a36Sopenharmony_ci	U16 Reserved;		/*0x06 */
44962306a36Sopenharmony_ci} MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR,
45062306a36Sopenharmony_ci	*PTR_MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR,
45162306a36Sopenharmony_ci	Mpi2RAIDAcceleratorRequestDescriptor_t,
45262306a36Sopenharmony_ci	*pMpi2RAIDAcceleratorRequestDescriptor_t;
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci/*Fast Path SCSI IO Request Descriptor */
45562306a36Sopenharmony_citypedef MPI2_SCSI_IO_REQUEST_DESCRIPTOR
45662306a36Sopenharmony_ci	MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR,
45762306a36Sopenharmony_ci	*PTR_MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR,
45862306a36Sopenharmony_ci	Mpi25FastPathSCSIIORequestDescriptor_t,
45962306a36Sopenharmony_ci	*pMpi25FastPathSCSIIORequestDescriptor_t;
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci/*PCIe Encapsulated Request Descriptor */
46262306a36Sopenharmony_citypedef MPI2_SCSI_IO_REQUEST_DESCRIPTOR
46362306a36Sopenharmony_ci	MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR,
46462306a36Sopenharmony_ci	*PTR_MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR,
46562306a36Sopenharmony_ci	Mpi26PCIeEncapsulatedRequestDescriptor_t,
46662306a36Sopenharmony_ci	*pMpi26PCIeEncapsulatedRequestDescriptor_t;
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci/*union of Request Descriptors */
46962306a36Sopenharmony_citypedef union _MPI2_REQUEST_DESCRIPTOR_UNION {
47062306a36Sopenharmony_ci	MPI2_DEFAULT_REQUEST_DESCRIPTOR Default;
47162306a36Sopenharmony_ci	MPI2_HIGH_PRIORITY_REQUEST_DESCRIPTOR HighPriority;
47262306a36Sopenharmony_ci	MPI2_SCSI_IO_REQUEST_DESCRIPTOR SCSIIO;
47362306a36Sopenharmony_ci	MPI2_SCSI_TARGET_REQUEST_DESCRIPTOR SCSITarget;
47462306a36Sopenharmony_ci	MPI2_RAID_ACCEL_REQUEST_DESCRIPTOR RAIDAccelerator;
47562306a36Sopenharmony_ci	MPI25_FP_SCSI_IO_REQUEST_DESCRIPTOR FastPathSCSIIO;
47662306a36Sopenharmony_ci	MPI26_PCIE_ENCAPSULATED_REQUEST_DESCRIPTOR PCIeEncapsulated;
47762306a36Sopenharmony_ci	U64 Words;
47862306a36Sopenharmony_ci} MPI2_REQUEST_DESCRIPTOR_UNION,
47962306a36Sopenharmony_ci	*PTR_MPI2_REQUEST_DESCRIPTOR_UNION,
48062306a36Sopenharmony_ci	Mpi2RequestDescriptorUnion_t,
48162306a36Sopenharmony_ci	*pMpi2RequestDescriptorUnion_t;
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/*Atomic Request Descriptors */
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci/*
48662306a36Sopenharmony_ci * All Atomic Request Descriptors have the same format, so the following
48762306a36Sopenharmony_ci * structure is used for all Atomic Request Descriptors:
48862306a36Sopenharmony_ci *      Atomic Default Request Descriptor
48962306a36Sopenharmony_ci *      Atomic High Priority Request Descriptor
49062306a36Sopenharmony_ci *      Atomic SCSI IO Request Descriptor
49162306a36Sopenharmony_ci *      Atomic SCSI Target Request Descriptor
49262306a36Sopenharmony_ci *      Atomic RAID Accelerator Request Descriptor
49362306a36Sopenharmony_ci *      Atomic Fast Path SCSI IO Request Descriptor
49462306a36Sopenharmony_ci *      Atomic PCIe Encapsulated Request Descriptor
49562306a36Sopenharmony_ci */
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/*Atomic Request Descriptor */
49862306a36Sopenharmony_citypedef struct _MPI26_ATOMIC_REQUEST_DESCRIPTOR {
49962306a36Sopenharmony_ci	U8 RequestFlags;	/* 0x00 */
50062306a36Sopenharmony_ci	U8 MSIxIndex;		/* 0x01 */
50162306a36Sopenharmony_ci	U16 SMID;		/* 0x02 */
50262306a36Sopenharmony_ci} MPI26_ATOMIC_REQUEST_DESCRIPTOR,
50362306a36Sopenharmony_ci	*PTR_MPI26_ATOMIC_REQUEST_DESCRIPTOR,
50462306a36Sopenharmony_ci	Mpi26AtomicRequestDescriptor_t,
50562306a36Sopenharmony_ci	*pMpi26AtomicRequestDescriptor_t;
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci/*for the RequestFlags field, use the same
50862306a36Sopenharmony_ci *defines as MPI2_DEFAULT_REQUEST_DESCRIPTOR
50962306a36Sopenharmony_ci */
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci/*Reply Descriptors */
51262306a36Sopenharmony_ci
51362306a36Sopenharmony_ci/*Default Reply Descriptor */
51462306a36Sopenharmony_citypedef struct _MPI2_DEFAULT_REPLY_DESCRIPTOR {
51562306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
51662306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
51762306a36Sopenharmony_ci	U16 DescriptorTypeDependent1;	/*0x02 */
51862306a36Sopenharmony_ci	U32 DescriptorTypeDependent2;	/*0x04 */
51962306a36Sopenharmony_ci} MPI2_DEFAULT_REPLY_DESCRIPTOR,
52062306a36Sopenharmony_ci	*PTR_MPI2_DEFAULT_REPLY_DESCRIPTOR,
52162306a36Sopenharmony_ci	Mpi2DefaultReplyDescriptor_t,
52262306a36Sopenharmony_ci	*pMpi2DefaultReplyDescriptor_t;
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ci/*defines for the ReplyFlags field */
52562306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK                   (0x0F)
52662306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS             (0x00)
52762306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY               (0x01)
52862306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_TARGETASSIST_SUCCESS        (0x02)
52962306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER       (0x03)
53062306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_RAID_ACCELERATOR_SUCCESS    (0x05)
53162306a36Sopenharmony_ci#define MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS  (0x06)
53262306a36Sopenharmony_ci#define MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS  (0x08)
53362306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_FLAGS_UNUSED                      (0x0F)
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_ci/*values for marking a reply descriptor as unused */
53662306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_UNUSED_WORD0_MARK             (0xFFFFFFFF)
53762306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK             (0xFFFFFFFF)
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci/*Address Reply Descriptor */
54062306a36Sopenharmony_citypedef struct _MPI2_ADDRESS_REPLY_DESCRIPTOR {
54162306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
54262306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
54362306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
54462306a36Sopenharmony_ci	U32 ReplyFrameAddress;	/*0x04 */
54562306a36Sopenharmony_ci} MPI2_ADDRESS_REPLY_DESCRIPTOR,
54662306a36Sopenharmony_ci	*PTR_MPI2_ADDRESS_REPLY_DESCRIPTOR,
54762306a36Sopenharmony_ci	Mpi2AddressReplyDescriptor_t,
54862306a36Sopenharmony_ci	*pMpi2AddressReplyDescriptor_t;
54962306a36Sopenharmony_ci
55062306a36Sopenharmony_ci#define MPI2_ADDRESS_REPLY_SMID_INVALID                 (0x00)
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci/*SCSI IO Success Reply Descriptor */
55362306a36Sopenharmony_citypedef struct _MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR {
55462306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
55562306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
55662306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
55762306a36Sopenharmony_ci	U16 TaskTag;		/*0x04 */
55862306a36Sopenharmony_ci	U16 Reserved1;		/*0x06 */
55962306a36Sopenharmony_ci} MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
56062306a36Sopenharmony_ci	*PTR_MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
56162306a36Sopenharmony_ci	Mpi2SCSIIOSuccessReplyDescriptor_t,
56262306a36Sopenharmony_ci	*pMpi2SCSIIOSuccessReplyDescriptor_t;
56362306a36Sopenharmony_ci
56462306a36Sopenharmony_ci/*TargetAssist Success Reply Descriptor */
56562306a36Sopenharmony_citypedef struct _MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR {
56662306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
56762306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
56862306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
56962306a36Sopenharmony_ci	U8 SequenceNumber;	/*0x04 */
57062306a36Sopenharmony_ci	U8 Reserved1;		/*0x05 */
57162306a36Sopenharmony_ci	U16 IoIndex;		/*0x06 */
57262306a36Sopenharmony_ci} MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR,
57362306a36Sopenharmony_ci	*PTR_MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR,
57462306a36Sopenharmony_ci	Mpi2TargetAssistSuccessReplyDescriptor_t,
57562306a36Sopenharmony_ci	*pMpi2TargetAssistSuccessReplyDescriptor_t;
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_ci/*Target Command Buffer Reply Descriptor */
57862306a36Sopenharmony_citypedef struct _MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR {
57962306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
58062306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
58162306a36Sopenharmony_ci	U8 VP_ID;		/*0x02 */
58262306a36Sopenharmony_ci	U8 Flags;		/*0x03 */
58362306a36Sopenharmony_ci	U16 InitiatorDevHandle;	/*0x04 */
58462306a36Sopenharmony_ci	U16 IoIndex;		/*0x06 */
58562306a36Sopenharmony_ci} MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR,
58662306a36Sopenharmony_ci	*PTR_MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR,
58762306a36Sopenharmony_ci	Mpi2TargetCommandBufferReplyDescriptor_t,
58862306a36Sopenharmony_ci	*pMpi2TargetCommandBufferReplyDescriptor_t;
58962306a36Sopenharmony_ci
59062306a36Sopenharmony_ci/*defines for Flags field */
59162306a36Sopenharmony_ci#define MPI2_RPY_DESCRIPT_TCB_FLAGS_PHYNUM_MASK     (0x3F)
59262306a36Sopenharmony_ci
59362306a36Sopenharmony_ci/*RAID Accelerator Success Reply Descriptor */
59462306a36Sopenharmony_citypedef struct _MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR {
59562306a36Sopenharmony_ci	U8 ReplyFlags;		/*0x00 */
59662306a36Sopenharmony_ci	U8 MSIxIndex;		/*0x01 */
59762306a36Sopenharmony_ci	U16 SMID;		/*0x02 */
59862306a36Sopenharmony_ci	U32 Reserved;		/*0x04 */
59962306a36Sopenharmony_ci} MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR,
60062306a36Sopenharmony_ci	*PTR_MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR,
60162306a36Sopenharmony_ci	Mpi2RAIDAcceleratorSuccessReplyDescriptor_t,
60262306a36Sopenharmony_ci	*pMpi2RAIDAcceleratorSuccessReplyDescriptor_t;
60362306a36Sopenharmony_ci
60462306a36Sopenharmony_ci/*Fast Path SCSI IO Success Reply Descriptor */
60562306a36Sopenharmony_citypedef MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR
60662306a36Sopenharmony_ci	MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
60762306a36Sopenharmony_ci	*PTR_MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR,
60862306a36Sopenharmony_ci	Mpi25FastPathSCSIIOSuccessReplyDescriptor_t,
60962306a36Sopenharmony_ci	*pMpi25FastPathSCSIIOSuccessReplyDescriptor_t;
61062306a36Sopenharmony_ci
61162306a36Sopenharmony_ci/*PCIe Encapsulated Success Reply Descriptor */
61262306a36Sopenharmony_citypedef MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR
61362306a36Sopenharmony_ci	MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR,
61462306a36Sopenharmony_ci	*PTR_MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR,
61562306a36Sopenharmony_ci	Mpi26PCIeEncapsulatedSuccessReplyDescriptor_t,
61662306a36Sopenharmony_ci	*pMpi26PCIeEncapsulatedSuccessReplyDescriptor_t;
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ci/*union of Reply Descriptors */
61962306a36Sopenharmony_citypedef union _MPI2_REPLY_DESCRIPTORS_UNION {
62062306a36Sopenharmony_ci	MPI2_DEFAULT_REPLY_DESCRIPTOR Default;
62162306a36Sopenharmony_ci	MPI2_ADDRESS_REPLY_DESCRIPTOR AddressReply;
62262306a36Sopenharmony_ci	MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR SCSIIOSuccess;
62362306a36Sopenharmony_ci	MPI2_TARGETASSIST_SUCCESS_REPLY_DESCRIPTOR TargetAssistSuccess;
62462306a36Sopenharmony_ci	MPI2_TARGET_COMMAND_BUFFER_REPLY_DESCRIPTOR TargetCommandBuffer;
62562306a36Sopenharmony_ci	MPI2_RAID_ACCELERATOR_SUCCESS_REPLY_DESCRIPTOR RAIDAcceleratorSuccess;
62662306a36Sopenharmony_ci	MPI25_FP_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR FastPathSCSIIOSuccess;
62762306a36Sopenharmony_ci	MPI26_PCIE_ENCAPSULATED_SUCCESS_REPLY_DESCRIPTOR
62862306a36Sopenharmony_ci						PCIeEncapsulatedSuccess;
62962306a36Sopenharmony_ci	U64 Words;
63062306a36Sopenharmony_ci} MPI2_REPLY_DESCRIPTORS_UNION,
63162306a36Sopenharmony_ci	*PTR_MPI2_REPLY_DESCRIPTORS_UNION,
63262306a36Sopenharmony_ci	Mpi2ReplyDescriptorsUnion_t,
63362306a36Sopenharmony_ci	*pMpi2ReplyDescriptorsUnion_t;
63462306a36Sopenharmony_ci
63562306a36Sopenharmony_ci/*****************************************************************************
63662306a36Sopenharmony_ci*
63762306a36Sopenharmony_ci*       Message Functions
63862306a36Sopenharmony_ci*
63962306a36Sopenharmony_ci*****************************************************************************/
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_ci#define MPI2_FUNCTION_SCSI_IO_REQUEST		    (0x00)
64262306a36Sopenharmony_ci#define MPI2_FUNCTION_SCSI_TASK_MGMT		    (0x01)
64362306a36Sopenharmony_ci#define MPI2_FUNCTION_IOC_INIT                      (0x02)
64462306a36Sopenharmony_ci#define MPI2_FUNCTION_IOC_FACTS                     (0x03)
64562306a36Sopenharmony_ci#define MPI2_FUNCTION_CONFIG                        (0x04)
64662306a36Sopenharmony_ci#define MPI2_FUNCTION_PORT_FACTS                    (0x05)
64762306a36Sopenharmony_ci#define MPI2_FUNCTION_PORT_ENABLE                   (0x06)
64862306a36Sopenharmony_ci#define MPI2_FUNCTION_EVENT_NOTIFICATION            (0x07)
64962306a36Sopenharmony_ci#define MPI2_FUNCTION_EVENT_ACK                     (0x08)
65062306a36Sopenharmony_ci#define MPI2_FUNCTION_FW_DOWNLOAD                   (0x09)
65162306a36Sopenharmony_ci#define MPI2_FUNCTION_TARGET_ASSIST                 (0x0B)
65262306a36Sopenharmony_ci#define MPI2_FUNCTION_TARGET_STATUS_SEND            (0x0C)
65362306a36Sopenharmony_ci#define MPI2_FUNCTION_TARGET_MODE_ABORT             (0x0D)
65462306a36Sopenharmony_ci#define MPI2_FUNCTION_FW_UPLOAD                     (0x12)
65562306a36Sopenharmony_ci#define MPI2_FUNCTION_RAID_ACTION                   (0x15)
65662306a36Sopenharmony_ci#define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH      (0x16)
65762306a36Sopenharmony_ci#define MPI2_FUNCTION_TOOLBOX                       (0x17)
65862306a36Sopenharmony_ci#define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR      (0x18)
65962306a36Sopenharmony_ci#define MPI2_FUNCTION_SMP_PASSTHROUGH               (0x1A)
66062306a36Sopenharmony_ci#define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL           (0x1B)
66162306a36Sopenharmony_ci#define MPI2_FUNCTION_IO_UNIT_CONTROL               (0x1B)
66262306a36Sopenharmony_ci#define MPI2_FUNCTION_SATA_PASSTHROUGH              (0x1C)
66362306a36Sopenharmony_ci#define MPI2_FUNCTION_DIAG_BUFFER_POST              (0x1D)
66462306a36Sopenharmony_ci#define MPI2_FUNCTION_DIAG_RELEASE                  (0x1E)
66562306a36Sopenharmony_ci#define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST      (0x24)
66662306a36Sopenharmony_ci#define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST      (0x25)
66762306a36Sopenharmony_ci#define MPI2_FUNCTION_RAID_ACCELERATOR              (0x2C)
66862306a36Sopenharmony_ci#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION   (0x2F)
66962306a36Sopenharmony_ci#define MPI2_FUNCTION_PWR_MGMT_CONTROL              (0x30)
67062306a36Sopenharmony_ci#define MPI2_FUNCTION_SEND_HOST_MESSAGE             (0x31)
67162306a36Sopenharmony_ci#define MPI2_FUNCTION_NVME_ENCAPSULATED             (0x33)
67262306a36Sopenharmony_ci#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC          (0xF0)
67362306a36Sopenharmony_ci#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC          (0xFF)
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci/*Doorbell functions */
67662306a36Sopenharmony_ci#define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET        (0x40)
67762306a36Sopenharmony_ci#define MPI2_FUNCTION_HANDSHAKE                     (0x42)
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_ci/*****************************************************************************
68062306a36Sopenharmony_ci*
68162306a36Sopenharmony_ci*       IOC Status Values
68262306a36Sopenharmony_ci*
68362306a36Sopenharmony_ci*****************************************************************************/
68462306a36Sopenharmony_ci
68562306a36Sopenharmony_ci/*mask for IOCStatus status value */
68662306a36Sopenharmony_ci#define MPI2_IOCSTATUS_MASK                     (0x7FFF)
68762306a36Sopenharmony_ci
68862306a36Sopenharmony_ci/****************************************************************************
68962306a36Sopenharmony_ci* Common IOCStatus values for all replies
69062306a36Sopenharmony_ci****************************************************************************/
69162306a36Sopenharmony_ci
69262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SUCCESS                      (0x0000)
69362306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INVALID_FUNCTION             (0x0001)
69462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_BUSY                         (0x0002)
69562306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INVALID_SGL                  (0x0003)
69662306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INTERNAL_ERROR               (0x0004)
69762306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INVALID_VPID                 (0x0005)
69862306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES       (0x0006)
69962306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INVALID_FIELD                (0x0007)
70062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INVALID_STATE                (0x0008)
70162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED       (0x0009)
70262306a36Sopenharmony_ci/*MPI v2.6 and later */
70362306a36Sopenharmony_ci#define MPI2_IOCSTATUS_INSUFFICIENT_POWER           (0x000A)
70462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_FAILURE                      (0x000F)
70562306a36Sopenharmony_ci
70662306a36Sopenharmony_ci/****************************************************************************
70762306a36Sopenharmony_ci* Config IOCStatus values
70862306a36Sopenharmony_ci****************************************************************************/
70962306a36Sopenharmony_ci
71062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_INVALID_ACTION        (0x0020)
71162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_INVALID_TYPE          (0x0021)
71262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_INVALID_PAGE          (0x0022)
71362306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_INVALID_DATA          (0x0023)
71462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_NO_DEFAULTS           (0x0024)
71562306a36Sopenharmony_ci#define MPI2_IOCSTATUS_CONFIG_CANT_COMMIT           (0x0025)
71662306a36Sopenharmony_ci
71762306a36Sopenharmony_ci/****************************************************************************
71862306a36Sopenharmony_ci* SCSI IO Reply
71962306a36Sopenharmony_ci****************************************************************************/
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR         (0x0040)
72262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_INVALID_DEVHANDLE       (0x0042)
72362306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE        (0x0043)
72462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_DATA_OVERRUN            (0x0044)
72562306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_DATA_UNDERRUN           (0x0045)
72662306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_IO_DATA_ERROR           (0x0046)
72762306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_PROTOCOL_ERROR          (0x0047)
72862306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_TASK_TERMINATED         (0x0048)
72962306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH       (0x0049)
73062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED        (0x004A)
73162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_IOC_TERMINATED          (0x004B)
73262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SCSI_EXT_TERMINATED          (0x004C)
73362306a36Sopenharmony_ci
73462306a36Sopenharmony_ci/****************************************************************************
73562306a36Sopenharmony_ci* For use by SCSI Initiator and SCSI Target end-to-end data protection
73662306a36Sopenharmony_ci****************************************************************************/
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci#define MPI2_IOCSTATUS_EEDP_GUARD_ERROR             (0x004D)
73962306a36Sopenharmony_ci#define MPI2_IOCSTATUS_EEDP_REF_TAG_ERROR           (0x004E)
74062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_EEDP_APP_TAG_ERROR           (0x004F)
74162306a36Sopenharmony_ci
74262306a36Sopenharmony_ci/****************************************************************************
74362306a36Sopenharmony_ci* SCSI Target values
74462306a36Sopenharmony_ci****************************************************************************/
74562306a36Sopenharmony_ci
74662306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_INVALID_IO_INDEX      (0x0062)
74762306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_ABORTED               (0x0063)
74862306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_NO_CONN_RETRYABLE     (0x0064)
74962306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_NO_CONNECTION         (0x0065)
75062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH   (0x006A)
75162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_DATA_OFFSET_ERROR     (0x006D)
75262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA   (0x006E)
75362306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_IU_TOO_SHORT          (0x006F)
75462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT       (0x0070)
75562306a36Sopenharmony_ci#define MPI2_IOCSTATUS_TARGET_NAK_RECEIVED          (0x0071)
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci/****************************************************************************
75862306a36Sopenharmony_ci* Serial Attached SCSI values
75962306a36Sopenharmony_ci****************************************************************************/
76062306a36Sopenharmony_ci
76162306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SAS_SMP_REQUEST_FAILED       (0x0090)
76262306a36Sopenharmony_ci#define MPI2_IOCSTATUS_SAS_SMP_DATA_OVERRUN         (0x0091)
76362306a36Sopenharmony_ci
76462306a36Sopenharmony_ci/****************************************************************************
76562306a36Sopenharmony_ci* Diagnostic Buffer Post / Diagnostic Release values
76662306a36Sopenharmony_ci****************************************************************************/
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ci#define MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED          (0x00A0)
76962306a36Sopenharmony_ci
77062306a36Sopenharmony_ci/****************************************************************************
77162306a36Sopenharmony_ci* RAID Accelerator values
77262306a36Sopenharmony_ci****************************************************************************/
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_ci#define MPI2_IOCSTATUS_RAID_ACCEL_ERROR             (0x00B0)
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci/****************************************************************************
77762306a36Sopenharmony_ci* IOCStatus flag to indicate that log info is available
77862306a36Sopenharmony_ci****************************************************************************/
77962306a36Sopenharmony_ci
78062306a36Sopenharmony_ci#define MPI2_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE      (0x8000)
78162306a36Sopenharmony_ci
78262306a36Sopenharmony_ci/****************************************************************************
78362306a36Sopenharmony_ci* IOCLogInfo Types
78462306a36Sopenharmony_ci****************************************************************************/
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_MASK               (0xF0000000)
78762306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_SHIFT              (28)
78862306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_NONE               (0x0)
78962306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_SCSI               (0x1)
79062306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_FC                 (0x2)
79162306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_SAS                (0x3)
79262306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_TYPE_ISCSI              (0x4)
79362306a36Sopenharmony_ci#define MPI2_IOCLOGINFO_LOG_DATA_MASK           (0x0FFFFFFF)
79462306a36Sopenharmony_ci
79562306a36Sopenharmony_ci/*****************************************************************************
79662306a36Sopenharmony_ci*
79762306a36Sopenharmony_ci*       Standard Message Structures
79862306a36Sopenharmony_ci*
79962306a36Sopenharmony_ci*****************************************************************************/
80062306a36Sopenharmony_ci
80162306a36Sopenharmony_ci/****************************************************************************
80262306a36Sopenharmony_ci*Request Message Header for all request messages
80362306a36Sopenharmony_ci****************************************************************************/
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_citypedef struct _MPI2_REQUEST_HEADER {
80662306a36Sopenharmony_ci	U16 FunctionDependent1;	/*0x00 */
80762306a36Sopenharmony_ci	U8 ChainOffset;		/*0x02 */
80862306a36Sopenharmony_ci	U8 Function;		/*0x03 */
80962306a36Sopenharmony_ci	U16 FunctionDependent2;	/*0x04 */
81062306a36Sopenharmony_ci	U8 FunctionDependent3;	/*0x06 */
81162306a36Sopenharmony_ci	U8 MsgFlags;		/*0x07 */
81262306a36Sopenharmony_ci	U8 VP_ID;		/*0x08 */
81362306a36Sopenharmony_ci	U8 VF_ID;		/*0x09 */
81462306a36Sopenharmony_ci	U16 Reserved1;		/*0x0A */
81562306a36Sopenharmony_ci} MPI2_REQUEST_HEADER, *PTR_MPI2_REQUEST_HEADER,
81662306a36Sopenharmony_ci	MPI2RequestHeader_t, *pMPI2RequestHeader_t;
81762306a36Sopenharmony_ci
81862306a36Sopenharmony_ci/****************************************************************************
81962306a36Sopenharmony_ci* Default Reply
82062306a36Sopenharmony_ci****************************************************************************/
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_citypedef struct _MPI2_DEFAULT_REPLY {
82362306a36Sopenharmony_ci	U16 FunctionDependent1;	/*0x00 */
82462306a36Sopenharmony_ci	U8 MsgLength;		/*0x02 */
82562306a36Sopenharmony_ci	U8 Function;		/*0x03 */
82662306a36Sopenharmony_ci	U16 FunctionDependent2;	/*0x04 */
82762306a36Sopenharmony_ci	U8 FunctionDependent3;	/*0x06 */
82862306a36Sopenharmony_ci	U8 MsgFlags;		/*0x07 */
82962306a36Sopenharmony_ci	U8 VP_ID;		/*0x08 */
83062306a36Sopenharmony_ci	U8 VF_ID;		/*0x09 */
83162306a36Sopenharmony_ci	U16 Reserved1;		/*0x0A */
83262306a36Sopenharmony_ci	U16 FunctionDependent5;	/*0x0C */
83362306a36Sopenharmony_ci	U16 IOCStatus;		/*0x0E */
83462306a36Sopenharmony_ci	U32 IOCLogInfo;		/*0x10 */
83562306a36Sopenharmony_ci} MPI2_DEFAULT_REPLY, *PTR_MPI2_DEFAULT_REPLY,
83662306a36Sopenharmony_ci	MPI2DefaultReply_t, *pMPI2DefaultReply_t;
83762306a36Sopenharmony_ci
83862306a36Sopenharmony_ci/*common version structure/union used in messages and configuration pages */
83962306a36Sopenharmony_ci
84062306a36Sopenharmony_citypedef struct _MPI2_VERSION_STRUCT {
84162306a36Sopenharmony_ci	U8 Dev;			/*0x00 */
84262306a36Sopenharmony_ci	U8 Unit;		/*0x01 */
84362306a36Sopenharmony_ci	U8 Minor;		/*0x02 */
84462306a36Sopenharmony_ci	U8 Major;		/*0x03 */
84562306a36Sopenharmony_ci} MPI2_VERSION_STRUCT;
84662306a36Sopenharmony_ci
84762306a36Sopenharmony_citypedef union _MPI2_VERSION_UNION {
84862306a36Sopenharmony_ci	MPI2_VERSION_STRUCT Struct;
84962306a36Sopenharmony_ci	U32 Word;
85062306a36Sopenharmony_ci} MPI2_VERSION_UNION;
85162306a36Sopenharmony_ci
85262306a36Sopenharmony_ci/*LUN field defines, common to many structures */
85362306a36Sopenharmony_ci#define MPI2_LUN_FIRST_LEVEL_ADDRESSING             (0x0000FFFF)
85462306a36Sopenharmony_ci#define MPI2_LUN_SECOND_LEVEL_ADDRESSING            (0xFFFF0000)
85562306a36Sopenharmony_ci#define MPI2_LUN_THIRD_LEVEL_ADDRESSING             (0x0000FFFF)
85662306a36Sopenharmony_ci#define MPI2_LUN_FOURTH_LEVEL_ADDRESSING            (0xFFFF0000)
85762306a36Sopenharmony_ci#define MPI2_LUN_LEVEL_1_WORD                       (0xFF00)
85862306a36Sopenharmony_ci#define MPI2_LUN_LEVEL_1_DWORD                      (0x0000FF00)
85962306a36Sopenharmony_ci
86062306a36Sopenharmony_ci/*****************************************************************************
86162306a36Sopenharmony_ci*
86262306a36Sopenharmony_ci*       Fusion-MPT MPI Scatter Gather Elements
86362306a36Sopenharmony_ci*
86462306a36Sopenharmony_ci*****************************************************************************/
86562306a36Sopenharmony_ci
86662306a36Sopenharmony_ci/****************************************************************************
86762306a36Sopenharmony_ci* MPI Simple Element structures
86862306a36Sopenharmony_ci****************************************************************************/
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_citypedef struct _MPI2_SGE_SIMPLE32 {
87162306a36Sopenharmony_ci	U32 FlagsLength;
87262306a36Sopenharmony_ci	U32 Address;
87362306a36Sopenharmony_ci} MPI2_SGE_SIMPLE32, *PTR_MPI2_SGE_SIMPLE32,
87462306a36Sopenharmony_ci	Mpi2SGESimple32_t, *pMpi2SGESimple32_t;
87562306a36Sopenharmony_ci
87662306a36Sopenharmony_citypedef struct _MPI2_SGE_SIMPLE64 {
87762306a36Sopenharmony_ci	U32 FlagsLength;
87862306a36Sopenharmony_ci	U64 Address;
87962306a36Sopenharmony_ci} MPI2_SGE_SIMPLE64, *PTR_MPI2_SGE_SIMPLE64,
88062306a36Sopenharmony_ci	Mpi2SGESimple64_t, *pMpi2SGESimple64_t;
88162306a36Sopenharmony_ci
88262306a36Sopenharmony_citypedef struct _MPI2_SGE_SIMPLE_UNION {
88362306a36Sopenharmony_ci	U32 FlagsLength;
88462306a36Sopenharmony_ci	union {
88562306a36Sopenharmony_ci		U32 Address32;
88662306a36Sopenharmony_ci		U64 Address64;
88762306a36Sopenharmony_ci	} u;
88862306a36Sopenharmony_ci} MPI2_SGE_SIMPLE_UNION,
88962306a36Sopenharmony_ci	*PTR_MPI2_SGE_SIMPLE_UNION,
89062306a36Sopenharmony_ci	Mpi2SGESimpleUnion_t,
89162306a36Sopenharmony_ci	*pMpi2SGESimpleUnion_t;
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_ci/****************************************************************************
89462306a36Sopenharmony_ci* MPI Chain Element structures - for MPI v2.0 products only
89562306a36Sopenharmony_ci****************************************************************************/
89662306a36Sopenharmony_ci
89762306a36Sopenharmony_citypedef struct _MPI2_SGE_CHAIN32 {
89862306a36Sopenharmony_ci	U16 Length;
89962306a36Sopenharmony_ci	U8 NextChainOffset;
90062306a36Sopenharmony_ci	U8 Flags;
90162306a36Sopenharmony_ci	U32 Address;
90262306a36Sopenharmony_ci} MPI2_SGE_CHAIN32, *PTR_MPI2_SGE_CHAIN32,
90362306a36Sopenharmony_ci	Mpi2SGEChain32_t, *pMpi2SGEChain32_t;
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_citypedef struct _MPI2_SGE_CHAIN64 {
90662306a36Sopenharmony_ci	U16 Length;
90762306a36Sopenharmony_ci	U8 NextChainOffset;
90862306a36Sopenharmony_ci	U8 Flags;
90962306a36Sopenharmony_ci	U64 Address;
91062306a36Sopenharmony_ci} MPI2_SGE_CHAIN64, *PTR_MPI2_SGE_CHAIN64,
91162306a36Sopenharmony_ci	Mpi2SGEChain64_t, *pMpi2SGEChain64_t;
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_citypedef struct _MPI2_SGE_CHAIN_UNION {
91462306a36Sopenharmony_ci	U16 Length;
91562306a36Sopenharmony_ci	U8 NextChainOffset;
91662306a36Sopenharmony_ci	U8 Flags;
91762306a36Sopenharmony_ci	union {
91862306a36Sopenharmony_ci		U32 Address32;
91962306a36Sopenharmony_ci		U64 Address64;
92062306a36Sopenharmony_ci	} u;
92162306a36Sopenharmony_ci} MPI2_SGE_CHAIN_UNION,
92262306a36Sopenharmony_ci	*PTR_MPI2_SGE_CHAIN_UNION,
92362306a36Sopenharmony_ci	Mpi2SGEChainUnion_t,
92462306a36Sopenharmony_ci	*pMpi2SGEChainUnion_t;
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_ci/****************************************************************************
92762306a36Sopenharmony_ci* MPI Transaction Context Element structures - for MPI v2.0 products only
92862306a36Sopenharmony_ci****************************************************************************/
92962306a36Sopenharmony_ci
93062306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANSACTION32 {
93162306a36Sopenharmony_ci	U8 Reserved;
93262306a36Sopenharmony_ci	U8 ContextSize;
93362306a36Sopenharmony_ci	U8 DetailsLength;
93462306a36Sopenharmony_ci	U8 Flags;
93562306a36Sopenharmony_ci	U32 TransactionContext[1];
93662306a36Sopenharmony_ci	U32 TransactionDetails[1];
93762306a36Sopenharmony_ci} MPI2_SGE_TRANSACTION32,
93862306a36Sopenharmony_ci	*PTR_MPI2_SGE_TRANSACTION32,
93962306a36Sopenharmony_ci	Mpi2SGETransaction32_t,
94062306a36Sopenharmony_ci	*pMpi2SGETransaction32_t;
94162306a36Sopenharmony_ci
94262306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANSACTION64 {
94362306a36Sopenharmony_ci	U8 Reserved;
94462306a36Sopenharmony_ci	U8 ContextSize;
94562306a36Sopenharmony_ci	U8 DetailsLength;
94662306a36Sopenharmony_ci	U8 Flags;
94762306a36Sopenharmony_ci	U32 TransactionContext[2];
94862306a36Sopenharmony_ci	U32 TransactionDetails[1];
94962306a36Sopenharmony_ci} MPI2_SGE_TRANSACTION64,
95062306a36Sopenharmony_ci	*PTR_MPI2_SGE_TRANSACTION64,
95162306a36Sopenharmony_ci	Mpi2SGETransaction64_t,
95262306a36Sopenharmony_ci	*pMpi2SGETransaction64_t;
95362306a36Sopenharmony_ci
95462306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANSACTION96 {
95562306a36Sopenharmony_ci	U8 Reserved;
95662306a36Sopenharmony_ci	U8 ContextSize;
95762306a36Sopenharmony_ci	U8 DetailsLength;
95862306a36Sopenharmony_ci	U8 Flags;
95962306a36Sopenharmony_ci	U32 TransactionContext[3];
96062306a36Sopenharmony_ci	U32 TransactionDetails[1];
96162306a36Sopenharmony_ci} MPI2_SGE_TRANSACTION96, *PTR_MPI2_SGE_TRANSACTION96,
96262306a36Sopenharmony_ci	Mpi2SGETransaction96_t, *pMpi2SGETransaction96_t;
96362306a36Sopenharmony_ci
96462306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANSACTION128 {
96562306a36Sopenharmony_ci	U8 Reserved;
96662306a36Sopenharmony_ci	U8 ContextSize;
96762306a36Sopenharmony_ci	U8 DetailsLength;
96862306a36Sopenharmony_ci	U8 Flags;
96962306a36Sopenharmony_ci	U32 TransactionContext[4];
97062306a36Sopenharmony_ci	U32 TransactionDetails[1];
97162306a36Sopenharmony_ci} MPI2_SGE_TRANSACTION128, *PTR_MPI2_SGE_TRANSACTION128,
97262306a36Sopenharmony_ci	Mpi2SGETransaction_t128, *pMpi2SGETransaction_t128;
97362306a36Sopenharmony_ci
97462306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANSACTION_UNION {
97562306a36Sopenharmony_ci	U8 Reserved;
97662306a36Sopenharmony_ci	U8 ContextSize;
97762306a36Sopenharmony_ci	U8 DetailsLength;
97862306a36Sopenharmony_ci	U8 Flags;
97962306a36Sopenharmony_ci	union {
98062306a36Sopenharmony_ci		U32 TransactionContext32[1];
98162306a36Sopenharmony_ci		U32 TransactionContext64[2];
98262306a36Sopenharmony_ci		U32 TransactionContext96[3];
98362306a36Sopenharmony_ci		U32 TransactionContext128[4];
98462306a36Sopenharmony_ci	} u;
98562306a36Sopenharmony_ci	U32 TransactionDetails[1];
98662306a36Sopenharmony_ci} MPI2_SGE_TRANSACTION_UNION,
98762306a36Sopenharmony_ci	*PTR_MPI2_SGE_TRANSACTION_UNION,
98862306a36Sopenharmony_ci	Mpi2SGETransactionUnion_t,
98962306a36Sopenharmony_ci	*pMpi2SGETransactionUnion_t;
99062306a36Sopenharmony_ci
99162306a36Sopenharmony_ci/****************************************************************************
99262306a36Sopenharmony_ci* MPI SGE union for IO SGL's - for MPI v2.0 products only
99362306a36Sopenharmony_ci****************************************************************************/
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_citypedef struct _MPI2_MPI_SGE_IO_UNION {
99662306a36Sopenharmony_ci	union {
99762306a36Sopenharmony_ci		MPI2_SGE_SIMPLE_UNION Simple;
99862306a36Sopenharmony_ci		MPI2_SGE_CHAIN_UNION Chain;
99962306a36Sopenharmony_ci	} u;
100062306a36Sopenharmony_ci} MPI2_MPI_SGE_IO_UNION, *PTR_MPI2_MPI_SGE_IO_UNION,
100162306a36Sopenharmony_ci	Mpi2MpiSGEIOUnion_t, *pMpi2MpiSGEIOUnion_t;
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_ci/****************************************************************************
100462306a36Sopenharmony_ci* MPI SGE union for SGL's with Simple and Transaction elements - for MPI v2.0 products only
100562306a36Sopenharmony_ci****************************************************************************/
100662306a36Sopenharmony_ci
100762306a36Sopenharmony_citypedef struct _MPI2_SGE_TRANS_SIMPLE_UNION {
100862306a36Sopenharmony_ci	union {
100962306a36Sopenharmony_ci		MPI2_SGE_SIMPLE_UNION Simple;
101062306a36Sopenharmony_ci		MPI2_SGE_TRANSACTION_UNION Transaction;
101162306a36Sopenharmony_ci	} u;
101262306a36Sopenharmony_ci} MPI2_SGE_TRANS_SIMPLE_UNION,
101362306a36Sopenharmony_ci	*PTR_MPI2_SGE_TRANS_SIMPLE_UNION,
101462306a36Sopenharmony_ci	Mpi2SGETransSimpleUnion_t,
101562306a36Sopenharmony_ci	*pMpi2SGETransSimpleUnion_t;
101662306a36Sopenharmony_ci
101762306a36Sopenharmony_ci/****************************************************************************
101862306a36Sopenharmony_ci* All MPI SGE types union
101962306a36Sopenharmony_ci****************************************************************************/
102062306a36Sopenharmony_ci
102162306a36Sopenharmony_citypedef struct _MPI2_MPI_SGE_UNION {
102262306a36Sopenharmony_ci	union {
102362306a36Sopenharmony_ci		MPI2_SGE_SIMPLE_UNION Simple;
102462306a36Sopenharmony_ci		MPI2_SGE_CHAIN_UNION Chain;
102562306a36Sopenharmony_ci		MPI2_SGE_TRANSACTION_UNION Transaction;
102662306a36Sopenharmony_ci	} u;
102762306a36Sopenharmony_ci} MPI2_MPI_SGE_UNION, *PTR_MPI2_MPI_SGE_UNION,
102862306a36Sopenharmony_ci	Mpi2MpiSgeUnion_t, *pMpi2MpiSgeUnion_t;
102962306a36Sopenharmony_ci
103062306a36Sopenharmony_ci/****************************************************************************
103162306a36Sopenharmony_ci* MPI SGE field definition and masks
103262306a36Sopenharmony_ci****************************************************************************/
103362306a36Sopenharmony_ci
103462306a36Sopenharmony_ci/*Flags field bit definitions */
103562306a36Sopenharmony_ci
103662306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_LAST_ELEMENT             (0x80)
103762306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_END_OF_BUFFER            (0x40)
103862306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_ELEMENT_TYPE_MASK        (0x30)
103962306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_LOCAL_ADDRESS            (0x08)
104062306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_DIRECTION                (0x04)
104162306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_ADDRESS_SIZE             (0x02)
104262306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_END_OF_LIST              (0x01)
104362306a36Sopenharmony_ci
104462306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_SHIFT                    (24)
104562306a36Sopenharmony_ci
104662306a36Sopenharmony_ci#define MPI2_SGE_LENGTH_MASK                    (0x00FFFFFF)
104762306a36Sopenharmony_ci#define MPI2_SGE_CHAIN_LENGTH_MASK              (0x0000FFFF)
104862306a36Sopenharmony_ci
104962306a36Sopenharmony_ci/*Element Type */
105062306a36Sopenharmony_ci
105162306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_TRANSACTION_ELEMENT      (0x00)
105262306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_SIMPLE_ELEMENT           (0x10)
105362306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_CHAIN_ELEMENT            (0x30)
105462306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_ELEMENT_MASK             (0x30)
105562306a36Sopenharmony_ci
105662306a36Sopenharmony_ci/*Address location */
105762306a36Sopenharmony_ci
105862306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_SYSTEM_ADDRESS           (0x00)
105962306a36Sopenharmony_ci
106062306a36Sopenharmony_ci/*Direction */
106162306a36Sopenharmony_ci
106262306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_IOC_TO_HOST              (0x00)
106362306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_HOST_TO_IOC              (0x04)
106462306a36Sopenharmony_ci
106562306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_DEST (MPI2_SGE_FLAGS_IOC_TO_HOST)
106662306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_SOURCE (MPI2_SGE_FLAGS_HOST_TO_IOC)
106762306a36Sopenharmony_ci
106862306a36Sopenharmony_ci/*Address Size */
106962306a36Sopenharmony_ci
107062306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_32_BIT_ADDRESSING        (0x00)
107162306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_64_BIT_ADDRESSING        (0x02)
107262306a36Sopenharmony_ci
107362306a36Sopenharmony_ci/*Context Size */
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_32_BIT_CONTEXT           (0x00)
107662306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_64_BIT_CONTEXT           (0x02)
107762306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_96_BIT_CONTEXT           (0x04)
107862306a36Sopenharmony_ci#define MPI2_SGE_FLAGS_128_BIT_CONTEXT          (0x06)
107962306a36Sopenharmony_ci
108062306a36Sopenharmony_ci#define MPI2_SGE_CHAIN_OFFSET_MASK              (0x00FF0000)
108162306a36Sopenharmony_ci#define MPI2_SGE_CHAIN_OFFSET_SHIFT             (16)
108262306a36Sopenharmony_ci
108362306a36Sopenharmony_ci/****************************************************************************
108462306a36Sopenharmony_ci* MPI SGE operation Macros
108562306a36Sopenharmony_ci****************************************************************************/
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci/*SIMPLE FlagsLength manipulations... */
108862306a36Sopenharmony_ci#define MPI2_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_SGE_FLAGS_SHIFT)
108962306a36Sopenharmony_ci#define MPI2_SGE_GET_FLAGS(f) (((f) & ~MPI2_SGE_LENGTH_MASK) >> \
109062306a36Sopenharmony_ci					MPI2_SGE_FLAGS_SHIFT)
109162306a36Sopenharmony_ci#define MPI2_SGE_LENGTH(f) ((f) & MPI2_SGE_LENGTH_MASK)
109262306a36Sopenharmony_ci#define MPI2_SGE_CHAIN_LENGTH(f) ((f) & MPI2_SGE_CHAIN_LENGTH_MASK)
109362306a36Sopenharmony_ci
109462306a36Sopenharmony_ci#define MPI2_SGE_SET_FLAGS_LENGTH(f, l) (MPI2_SGE_SET_FLAGS(f) | \
109562306a36Sopenharmony_ci					MPI2_SGE_LENGTH(l))
109662306a36Sopenharmony_ci
109762306a36Sopenharmony_ci#define MPI2_pSGE_GET_FLAGS(psg) MPI2_SGE_GET_FLAGS((psg)->FlagsLength)
109862306a36Sopenharmony_ci#define MPI2_pSGE_GET_LENGTH(psg) MPI2_SGE_LENGTH((psg)->FlagsLength)
109962306a36Sopenharmony_ci#define MPI2_pSGE_SET_FLAGS_LENGTH(psg, f, l) ((psg)->FlagsLength = \
110062306a36Sopenharmony_ci					MPI2_SGE_SET_FLAGS_LENGTH(f, l))
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_ci/*CAUTION - The following are READ-MODIFY-WRITE! */
110362306a36Sopenharmony_ci#define MPI2_pSGE_SET_FLAGS(psg, f) ((psg)->FlagsLength |= \
110462306a36Sopenharmony_ci					MPI2_SGE_SET_FLAGS(f))
110562306a36Sopenharmony_ci#define MPI2_pSGE_SET_LENGTH(psg, l) ((psg)->FlagsLength |= \
110662306a36Sopenharmony_ci					MPI2_SGE_LENGTH(l))
110762306a36Sopenharmony_ci
110862306a36Sopenharmony_ci#define MPI2_GET_CHAIN_OFFSET(x) ((x & MPI2_SGE_CHAIN_OFFSET_MASK) >> \
110962306a36Sopenharmony_ci					MPI2_SGE_CHAIN_OFFSET_SHIFT)
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_ci/*****************************************************************************
111262306a36Sopenharmony_ci*
111362306a36Sopenharmony_ci*       Fusion-MPT IEEE Scatter Gather Elements
111462306a36Sopenharmony_ci*
111562306a36Sopenharmony_ci*****************************************************************************/
111662306a36Sopenharmony_ci
111762306a36Sopenharmony_ci/****************************************************************************
111862306a36Sopenharmony_ci* IEEE Simple Element structures
111962306a36Sopenharmony_ci****************************************************************************/
112062306a36Sopenharmony_ci
112162306a36Sopenharmony_ci/*MPI2_IEEE_SGE_SIMPLE32 is for MPI v2.0 products only */
112262306a36Sopenharmony_citypedef struct _MPI2_IEEE_SGE_SIMPLE32 {
112362306a36Sopenharmony_ci	U32 Address;
112462306a36Sopenharmony_ci	U32 FlagsLength;
112562306a36Sopenharmony_ci} MPI2_IEEE_SGE_SIMPLE32, *PTR_MPI2_IEEE_SGE_SIMPLE32,
112662306a36Sopenharmony_ci	Mpi2IeeeSgeSimple32_t, *pMpi2IeeeSgeSimple32_t;
112762306a36Sopenharmony_ci
112862306a36Sopenharmony_citypedef struct _MPI2_IEEE_SGE_SIMPLE64 {
112962306a36Sopenharmony_ci	U64 Address;
113062306a36Sopenharmony_ci	U32 Length;
113162306a36Sopenharmony_ci	U16 Reserved1;
113262306a36Sopenharmony_ci	U8 Reserved2;
113362306a36Sopenharmony_ci	U8 Flags;
113462306a36Sopenharmony_ci} MPI2_IEEE_SGE_SIMPLE64, *PTR_MPI2_IEEE_SGE_SIMPLE64,
113562306a36Sopenharmony_ci	Mpi2IeeeSgeSimple64_t, *pMpi2IeeeSgeSimple64_t;
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_citypedef union _MPI2_IEEE_SGE_SIMPLE_UNION {
113862306a36Sopenharmony_ci	MPI2_IEEE_SGE_SIMPLE32 Simple32;
113962306a36Sopenharmony_ci	MPI2_IEEE_SGE_SIMPLE64 Simple64;
114062306a36Sopenharmony_ci} MPI2_IEEE_SGE_SIMPLE_UNION,
114162306a36Sopenharmony_ci	*PTR_MPI2_IEEE_SGE_SIMPLE_UNION,
114262306a36Sopenharmony_ci	Mpi2IeeeSgeSimpleUnion_t,
114362306a36Sopenharmony_ci	*pMpi2IeeeSgeSimpleUnion_t;
114462306a36Sopenharmony_ci
114562306a36Sopenharmony_ci/****************************************************************************
114662306a36Sopenharmony_ci* IEEE Chain Element structures
114762306a36Sopenharmony_ci****************************************************************************/
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_ci/*MPI2_IEEE_SGE_CHAIN32 is for MPI v2.0 products only */
115062306a36Sopenharmony_citypedef MPI2_IEEE_SGE_SIMPLE32 MPI2_IEEE_SGE_CHAIN32;
115162306a36Sopenharmony_ci
115262306a36Sopenharmony_ci/*MPI2_IEEE_SGE_CHAIN64 is for MPI v2.0 products only */
115362306a36Sopenharmony_citypedef MPI2_IEEE_SGE_SIMPLE64 MPI2_IEEE_SGE_CHAIN64;
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_citypedef union _MPI2_IEEE_SGE_CHAIN_UNION {
115662306a36Sopenharmony_ci	MPI2_IEEE_SGE_CHAIN32 Chain32;
115762306a36Sopenharmony_ci	MPI2_IEEE_SGE_CHAIN64 Chain64;
115862306a36Sopenharmony_ci} MPI2_IEEE_SGE_CHAIN_UNION,
115962306a36Sopenharmony_ci	*PTR_MPI2_IEEE_SGE_CHAIN_UNION,
116062306a36Sopenharmony_ci	Mpi2IeeeSgeChainUnion_t,
116162306a36Sopenharmony_ci	*pMpi2IeeeSgeChainUnion_t;
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci/*MPI25_IEEE_SGE_CHAIN64 is for MPI v2.5 and later */
116462306a36Sopenharmony_citypedef struct _MPI25_IEEE_SGE_CHAIN64 {
116562306a36Sopenharmony_ci	U64 Address;
116662306a36Sopenharmony_ci	U32 Length;
116762306a36Sopenharmony_ci	U16 Reserved1;
116862306a36Sopenharmony_ci	U8 NextChainOffset;
116962306a36Sopenharmony_ci	U8 Flags;
117062306a36Sopenharmony_ci} MPI25_IEEE_SGE_CHAIN64,
117162306a36Sopenharmony_ci	*PTR_MPI25_IEEE_SGE_CHAIN64,
117262306a36Sopenharmony_ci	Mpi25IeeeSgeChain64_t,
117362306a36Sopenharmony_ci	*pMpi25IeeeSgeChain64_t;
117462306a36Sopenharmony_ci
117562306a36Sopenharmony_ci/****************************************************************************
117662306a36Sopenharmony_ci* All IEEE SGE types union
117762306a36Sopenharmony_ci****************************************************************************/
117862306a36Sopenharmony_ci
117962306a36Sopenharmony_ci/*MPI2_IEEE_SGE_UNION is for MPI v2.0 products only */
118062306a36Sopenharmony_citypedef struct _MPI2_IEEE_SGE_UNION {
118162306a36Sopenharmony_ci	union {
118262306a36Sopenharmony_ci		MPI2_IEEE_SGE_SIMPLE_UNION Simple;
118362306a36Sopenharmony_ci		MPI2_IEEE_SGE_CHAIN_UNION Chain;
118462306a36Sopenharmony_ci	} u;
118562306a36Sopenharmony_ci} MPI2_IEEE_SGE_UNION, *PTR_MPI2_IEEE_SGE_UNION,
118662306a36Sopenharmony_ci	Mpi2IeeeSgeUnion_t, *pMpi2IeeeSgeUnion_t;
118762306a36Sopenharmony_ci
118862306a36Sopenharmony_ci/****************************************************************************
118962306a36Sopenharmony_ci* IEEE SGE union for IO SGL's
119062306a36Sopenharmony_ci****************************************************************************/
119162306a36Sopenharmony_ci
119262306a36Sopenharmony_citypedef union _MPI25_SGE_IO_UNION {
119362306a36Sopenharmony_ci	MPI2_IEEE_SGE_SIMPLE64 IeeeSimple;
119462306a36Sopenharmony_ci	MPI25_IEEE_SGE_CHAIN64 IeeeChain;
119562306a36Sopenharmony_ci} MPI25_SGE_IO_UNION, *PTR_MPI25_SGE_IO_UNION,
119662306a36Sopenharmony_ci	Mpi25SGEIOUnion_t, *pMpi25SGEIOUnion_t;
119762306a36Sopenharmony_ci
119862306a36Sopenharmony_ci/****************************************************************************
119962306a36Sopenharmony_ci* IEEE SGE field definitions and masks
120062306a36Sopenharmony_ci****************************************************************************/
120162306a36Sopenharmony_ci
120262306a36Sopenharmony_ci/*Flags field bit definitions */
120362306a36Sopenharmony_ci
120462306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_ELEMENT_TYPE_MASK   (0x80)
120562306a36Sopenharmony_ci#define MPI25_IEEE_SGE_FLAGS_END_OF_LIST        (0x40)
120662306a36Sopenharmony_ci
120762306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_FLAGS_SHIFT             (24)
120862306a36Sopenharmony_ci
120962306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_LENGTH_MASK             (0x00FFFFFF)
121062306a36Sopenharmony_ci
121162306a36Sopenharmony_ci/*Element Type */
121262306a36Sopenharmony_ci
121362306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_SIMPLE_ELEMENT      (0x00)
121462306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_CHAIN_ELEMENT       (0x80)
121562306a36Sopenharmony_ci
121662306a36Sopenharmony_ci/*Next Segment Format */
121762306a36Sopenharmony_ci
121862306a36Sopenharmony_ci#define MPI26_IEEE_SGE_FLAGS_NSF_MASK           (0x1C)
121962306a36Sopenharmony_ci#define MPI26_IEEE_SGE_FLAGS_NSF_MPI_IEEE       (0x00)
122062306a36Sopenharmony_ci#define MPI26_IEEE_SGE_FLAGS_NSF_NVME_PRP       (0x08)
122162306a36Sopenharmony_ci#define MPI26_IEEE_SGE_FLAGS_NSF_NVME_SGL       (0x10)
122262306a36Sopenharmony_ci
122362306a36Sopenharmony_ci/*Data Location Address Space */
122462306a36Sopenharmony_ci
122562306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_ADDR_MASK           (0x03)
122662306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_SYSTEM_ADDR         (0x00)
122762306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_IOCDDR_ADDR         (0x01)
122862306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_IOCPLB_ADDR         (0x02)
122962306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR      (0x03)
123062306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR   (0x03)
123162306a36Sopenharmony_ci#define MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR \
123262306a36Sopenharmony_ci	 (MPI2_IEEE_SGE_FLAGS_SYSTEMPLBPCI_ADDR)
123362306a36Sopenharmony_ci#define MPI26_IEEE_SGE_FLAGS_IOCCTL_ADDR        (0x02)
123462306a36Sopenharmony_ci
123562306a36Sopenharmony_ci/****************************************************************************
123662306a36Sopenharmony_ci* IEEE SGE operation Macros
123762306a36Sopenharmony_ci****************************************************************************/
123862306a36Sopenharmony_ci
123962306a36Sopenharmony_ci/*SIMPLE FlagsLength manipulations... */
124062306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_SET_FLAGS(f) ((U32)(f) << MPI2_IEEE32_SGE_FLAGS_SHIFT)
124162306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_GET_FLAGS(f) (((f) & ~MPI2_IEEE32_SGE_LENGTH_MASK) \
124262306a36Sopenharmony_ci				 >> MPI2_IEEE32_SGE_FLAGS_SHIFT)
124362306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_LENGTH(f)    ((f) & MPI2_IEEE32_SGE_LENGTH_MASK)
124462306a36Sopenharmony_ci
124562306a36Sopenharmony_ci#define MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f, l) (MPI2_IEEE32_SGE_SET_FLAGS(f) |\
124662306a36Sopenharmony_ci						 MPI2_IEEE32_SGE_LENGTH(l))
124762306a36Sopenharmony_ci
124862306a36Sopenharmony_ci#define MPI2_IEEE32_pSGE_GET_FLAGS(psg) \
124962306a36Sopenharmony_ci			MPI2_IEEE32_SGE_GET_FLAGS((psg)->FlagsLength)
125062306a36Sopenharmony_ci#define MPI2_IEEE32_pSGE_GET_LENGTH(psg) \
125162306a36Sopenharmony_ci			MPI2_IEEE32_SGE_LENGTH((psg)->FlagsLength)
125262306a36Sopenharmony_ci#define MPI2_IEEE32_pSGE_SET_FLAGS_LENGTH(psg, f, l) ((psg)->FlagsLength = \
125362306a36Sopenharmony_ci					MPI2_IEEE32_SGE_SET_FLAGS_LENGTH(f, l))
125462306a36Sopenharmony_ci
125562306a36Sopenharmony_ci/*CAUTION - The following are READ-MODIFY-WRITE! */
125662306a36Sopenharmony_ci#define MPI2_IEEE32_pSGE_SET_FLAGS(psg, f) ((psg)->FlagsLength |= \
125762306a36Sopenharmony_ci					MPI2_IEEE32_SGE_SET_FLAGS(f))
125862306a36Sopenharmony_ci#define MPI2_IEEE32_pSGE_SET_LENGTH(psg, l) ((psg)->FlagsLength |= \
125962306a36Sopenharmony_ci					MPI2_IEEE32_SGE_LENGTH(l))
126062306a36Sopenharmony_ci
126162306a36Sopenharmony_ci/*****************************************************************************
126262306a36Sopenharmony_ci*
126362306a36Sopenharmony_ci*       Fusion-MPT MPI/IEEE Scatter Gather Unions
126462306a36Sopenharmony_ci*
126562306a36Sopenharmony_ci*****************************************************************************/
126662306a36Sopenharmony_ci
126762306a36Sopenharmony_citypedef union _MPI2_SIMPLE_SGE_UNION {
126862306a36Sopenharmony_ci	MPI2_SGE_SIMPLE_UNION MpiSimple;
126962306a36Sopenharmony_ci	MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple;
127062306a36Sopenharmony_ci} MPI2_SIMPLE_SGE_UNION, *PTR_MPI2_SIMPLE_SGE_UNION,
127162306a36Sopenharmony_ci	Mpi2SimpleSgeUntion_t, *pMpi2SimpleSgeUntion_t;
127262306a36Sopenharmony_ci
127362306a36Sopenharmony_citypedef union _MPI2_SGE_IO_UNION {
127462306a36Sopenharmony_ci	MPI2_SGE_SIMPLE_UNION MpiSimple;
127562306a36Sopenharmony_ci	MPI2_SGE_CHAIN_UNION MpiChain;
127662306a36Sopenharmony_ci	MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple;
127762306a36Sopenharmony_ci	MPI2_IEEE_SGE_CHAIN_UNION IeeeChain;
127862306a36Sopenharmony_ci} MPI2_SGE_IO_UNION, *PTR_MPI2_SGE_IO_UNION,
127962306a36Sopenharmony_ci	Mpi2SGEIOUnion_t, *pMpi2SGEIOUnion_t;
128062306a36Sopenharmony_ci
128162306a36Sopenharmony_ci/****************************************************************************
128262306a36Sopenharmony_ci*
128362306a36Sopenharmony_ci* Values for SGLFlags field, used in many request messages with an SGL
128462306a36Sopenharmony_ci*
128562306a36Sopenharmony_ci****************************************************************************/
128662306a36Sopenharmony_ci
128762306a36Sopenharmony_ci/*values for MPI SGL Data Location Address Space subfield */
128862306a36Sopenharmony_ci#define MPI2_SGLFLAGS_ADDRESS_SPACE_MASK            (0x0C)
128962306a36Sopenharmony_ci#define MPI2_SGLFLAGS_SYSTEM_ADDRESS_SPACE          (0x00)
129062306a36Sopenharmony_ci#define MPI2_SGLFLAGS_IOCDDR_ADDRESS_SPACE          (0x04)
129162306a36Sopenharmony_ci#define MPI2_SGLFLAGS_IOCPLB_ADDRESS_SPACE          (0x08)
129262306a36Sopenharmony_ci#define MPI26_SGLFLAGS_IOCPLB_ADDRESS_SPACE         (0x08)
129362306a36Sopenharmony_ci#define MPI2_SGLFLAGS_IOCPLBNTA_ADDRESS_SPACE       (0x0C)
129462306a36Sopenharmony_ci/*values for SGL Type subfield */
129562306a36Sopenharmony_ci#define MPI2_SGLFLAGS_SGL_TYPE_MASK                 (0x03)
129662306a36Sopenharmony_ci#define MPI2_SGLFLAGS_SGL_TYPE_MPI                  (0x00)
129762306a36Sopenharmony_ci#define MPI2_SGLFLAGS_SGL_TYPE_IEEE32               (0x01)
129862306a36Sopenharmony_ci#define MPI2_SGLFLAGS_SGL_TYPE_IEEE64               (0x02)
129962306a36Sopenharmony_ci
130062306a36Sopenharmony_ci#endif
1301