162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Copyright (c) 2000-2008 LSI Corporation.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci *           Name:  mpi.h
762306a36Sopenharmony_ci *          Title:  MPI Message independent structures and definitions
862306a36Sopenharmony_ci *  Creation Date:  July 27, 2000
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci *    mpi.h Version:  01.05.16
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *  Version History
1362306a36Sopenharmony_ci *  ---------------
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci *  Date      Version   Description
1662306a36Sopenharmony_ci *  --------  --------  ------------------------------------------------------
1762306a36Sopenharmony_ci *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
1862306a36Sopenharmony_ci *  05-24-00  00.10.02  Added MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH definition.
1962306a36Sopenharmony_ci *  06-06-00  01.00.01  Update MPI_VERSION_MAJOR and MPI_VERSION_MINOR.
2062306a36Sopenharmony_ci *  06-22-00  01.00.02  Added MPI_IOCSTATUS_LAN_ definitions.
2162306a36Sopenharmony_ci *                      Removed LAN_SUSPEND function definition.
2262306a36Sopenharmony_ci *                      Added MPI_MSGFLAGS_CONTINUATION_REPLY definition.
2362306a36Sopenharmony_ci *  06-30-00  01.00.03  Added MPI_CONTEXT_REPLY_TYPE_LAN definition.
2462306a36Sopenharmony_ci *                      Added MPI_GET/SET_CONTEXT_REPLY_TYPE macros.
2562306a36Sopenharmony_ci *  07-27-00  01.00.04  Added MPI_FAULT_ definitions.
2662306a36Sopenharmony_ci *                      Removed MPI_IOCSTATUS_MSG/DATA_XFER_ERROR definitions.
2762306a36Sopenharmony_ci *                      Added MPI_IOCSTATUS_INTERNAL_ERROR definition.
2862306a36Sopenharmony_ci *                      Added MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH.
2962306a36Sopenharmony_ci *  11-02-00  01.01.01  Original release for post 1.0 work.
3062306a36Sopenharmony_ci *  12-04-00  01.01.02  Added new function codes.
3162306a36Sopenharmony_ci *  01-09-01  01.01.03  Added more definitions to the system interface section
3262306a36Sopenharmony_ci *                      Added MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT.
3362306a36Sopenharmony_ci *  01-25-01  01.01.04  Changed MPI_VERSION_MINOR from 0x00 to 0x01.
3462306a36Sopenharmony_ci *  02-20-01  01.01.05  Started using MPI_POINTER.
3562306a36Sopenharmony_ci *                      Fixed value for MPI_DIAG_RW_ENABLE.
3662306a36Sopenharmony_ci *                      Added defines for MPI_DIAG_PREVENT_IOC_BOOT and
3762306a36Sopenharmony_ci *                      MPI_DIAG_CLEAR_FLASH_BAD_SIG.
3862306a36Sopenharmony_ci *                      Obsoleted MPI_IOCSTATUS_TARGET_FC_ defines.
3962306a36Sopenharmony_ci *  02-27-01  01.01.06  Removed MPI_HOST_INDEX_REGISTER define.
4062306a36Sopenharmony_ci *                      Added function codes for RAID.
4162306a36Sopenharmony_ci *  04-09-01  01.01.07  Added alternate define for MPI_DOORBELL_ACTIVE,
4262306a36Sopenharmony_ci *                      MPI_DOORBELL_USED, to better match the spec.
4362306a36Sopenharmony_ci *  08-08-01  01.02.01  Original release for v1.2 work.
4462306a36Sopenharmony_ci *                      Changed MPI_VERSION_MINOR from 0x01 to 0x02.
4562306a36Sopenharmony_ci *                      Added define MPI_FUNCTION_TOOLBOX.
4662306a36Sopenharmony_ci *  09-28-01  01.02.02  New function code MPI_SCSI_ENCLOSURE_PROCESSOR.
4762306a36Sopenharmony_ci *  11-01-01  01.02.03  Changed name to MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR.
4862306a36Sopenharmony_ci *  03-14-02  01.02.04  Added MPI_HEADER_VERSION_ defines.
4962306a36Sopenharmony_ci *  05-31-02  01.02.05  Bumped MPI_HEADER_VERSION_UNIT.
5062306a36Sopenharmony_ci *  07-12-02  01.02.06  Added define for MPI_FUNCTION_MAILBOX.
5162306a36Sopenharmony_ci *  09-16-02  01.02.07  Bumped value for MPI_HEADER_VERSION_UNIT.
5262306a36Sopenharmony_ci *  11-15-02  01.02.08  Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and
5362306a36Sopenharmony_ci *                      obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX.
5462306a36Sopenharmony_ci *  04-01-03  01.02.09  New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED
5562306a36Sopenharmony_ci *  06-26-03  01.02.10  Bumped MPI_HEADER_VERSION_UNIT value.
5662306a36Sopenharmony_ci *  01-16-04  01.02.11  Added define for MPI_IOCLOGINFO_TYPE_SHIFT.
5762306a36Sopenharmony_ci *  04-29-04  01.02.12  Added function codes for MPI_FUNCTION_DIAG_BUFFER_POST
5862306a36Sopenharmony_ci *                      and MPI_FUNCTION_DIAG_RELEASE.
5962306a36Sopenharmony_ci *                      Added MPI_IOCSTATUS_DIAGNOSTIC_RELEASED define.
6062306a36Sopenharmony_ci *                      Bumped MPI_HEADER_VERSION_UNIT value.
6162306a36Sopenharmony_ci *  05-11-04  01.03.01  Bumped MPI_VERSION_MINOR for MPI v1.3.
6262306a36Sopenharmony_ci *                      Added codes for Inband.
6362306a36Sopenharmony_ci *  08-19-04  01.05.01  Added defines for Host Buffer Access Control doorbell.
6462306a36Sopenharmony_ci *                      Added define for offset of High Priority Request Queue.
6562306a36Sopenharmony_ci *                      Added new function codes and new IOCStatus codes.
6662306a36Sopenharmony_ci *                      Added a IOCLogInfo type of SAS.
6762306a36Sopenharmony_ci *  12-07-04  01.05.02  Bumped MPI_HEADER_VERSION_UNIT.
6862306a36Sopenharmony_ci *  12-09-04  01.05.03  Bumped MPI_HEADER_VERSION_UNIT.
6962306a36Sopenharmony_ci *  01-15-05  01.05.04  Bumped MPI_HEADER_VERSION_UNIT.
7062306a36Sopenharmony_ci *  02-09-05  01.05.05  Bumped MPI_HEADER_VERSION_UNIT.
7162306a36Sopenharmony_ci *  02-22-05  01.05.06  Bumped MPI_HEADER_VERSION_UNIT.
7262306a36Sopenharmony_ci *  03-11-05  01.05.07  Removed function codes for SCSI IO 32 and
7362306a36Sopenharmony_ci *                      TargetAssistExtended requests.
7462306a36Sopenharmony_ci *                      Removed EEDP IOCStatus codes.
7562306a36Sopenharmony_ci *  06-24-05  01.05.08  Added function codes for SCSI IO 32 and
7662306a36Sopenharmony_ci *                      TargetAssistExtended requests.
7762306a36Sopenharmony_ci *                      Added EEDP IOCStatus codes.
7862306a36Sopenharmony_ci *  08-03-05  01.05.09  Bumped MPI_HEADER_VERSION_UNIT.
7962306a36Sopenharmony_ci *  08-30-05  01.05.10  Added 2 new IOCStatus codes for Target.
8062306a36Sopenharmony_ci *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.
8162306a36Sopenharmony_ci *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.
8262306a36Sopenharmony_ci *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.
8362306a36Sopenharmony_ci *  08-07-07  01.05.14  Bumped MPI_HEADER_VERSION_UNIT.
8462306a36Sopenharmony_ci *  01-15-08  01.05.15  Bumped MPI_HEADER_VERSION_UNIT.
8562306a36Sopenharmony_ci *  03-28-08  01.05.16  Bumped MPI_HEADER_VERSION_UNIT.
8662306a36Sopenharmony_ci *  --------------------------------------------------------------------------
8762306a36Sopenharmony_ci */
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#ifndef MPI_H
9062306a36Sopenharmony_ci#define MPI_H
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/*****************************************************************************
9462306a36Sopenharmony_ci*
9562306a36Sopenharmony_ci*        M P I    V e r s i o n    D e f i n i t i o n s
9662306a36Sopenharmony_ci*
9762306a36Sopenharmony_ci*****************************************************************************/
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci#define MPI_VERSION_MAJOR                   (0x01)
10062306a36Sopenharmony_ci#define MPI_VERSION_MINOR                   (0x05)
10162306a36Sopenharmony_ci#define MPI_VERSION_MAJOR_MASK              (0xFF00)
10262306a36Sopenharmony_ci#define MPI_VERSION_MAJOR_SHIFT             (8)
10362306a36Sopenharmony_ci#define MPI_VERSION_MINOR_MASK              (0x00FF)
10462306a36Sopenharmony_ci#define MPI_VERSION_MINOR_SHIFT             (0)
10562306a36Sopenharmony_ci#define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) |   \
10662306a36Sopenharmony_ci                                      MPI_VERSION_MINOR)
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci#define MPI_VERSION_01_00                   (0x0100)
10962306a36Sopenharmony_ci#define MPI_VERSION_01_01                   (0x0101)
11062306a36Sopenharmony_ci#define MPI_VERSION_01_02                   (0x0102)
11162306a36Sopenharmony_ci#define MPI_VERSION_01_03                   (0x0103)
11262306a36Sopenharmony_ci#define MPI_VERSION_01_05                   (0x0105)
11362306a36Sopenharmony_ci/* Note: The major versions of 0xe0 through 0xff are reserved */
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* versioning for this MPI header set */
11662306a36Sopenharmony_ci#define MPI_HEADER_VERSION_UNIT             (0x13)
11762306a36Sopenharmony_ci#define MPI_HEADER_VERSION_DEV              (0x00)
11862306a36Sopenharmony_ci#define MPI_HEADER_VERSION_UNIT_MASK        (0xFF00)
11962306a36Sopenharmony_ci#define MPI_HEADER_VERSION_UNIT_SHIFT       (8)
12062306a36Sopenharmony_ci#define MPI_HEADER_VERSION_DEV_MASK         (0x00FF)
12162306a36Sopenharmony_ci#define MPI_HEADER_VERSION_DEV_SHIFT        (0)
12262306a36Sopenharmony_ci#define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | MPI_HEADER_VERSION_DEV)
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci/*****************************************************************************
12562306a36Sopenharmony_ci*
12662306a36Sopenharmony_ci*        I O C    S t a t e    D e f i n i t i o n s
12762306a36Sopenharmony_ci*
12862306a36Sopenharmony_ci*****************************************************************************/
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define MPI_IOC_STATE_RESET                 (0x00000000)
13162306a36Sopenharmony_ci#define MPI_IOC_STATE_READY                 (0x10000000)
13262306a36Sopenharmony_ci#define MPI_IOC_STATE_OPERATIONAL           (0x20000000)
13362306a36Sopenharmony_ci#define MPI_IOC_STATE_FAULT                 (0x40000000)
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci#define MPI_IOC_STATE_MASK                  (0xF0000000)
13662306a36Sopenharmony_ci#define MPI_IOC_STATE_SHIFT                 (28)
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci/* Fault state codes (product independent range 0x8000-0xFFFF) */
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR  (0x8111)
14162306a36Sopenharmony_ci#define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT     (0x8112)
14262306a36Sopenharmony_ci#define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR    (0x8113)
14362306a36Sopenharmony_ci#define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT       (0x8114)
14462306a36Sopenharmony_ci#define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR        (0x8115)
14562306a36Sopenharmony_ci#define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT           (0x8116)
14662306a36Sopenharmony_ci#define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR     (0x8117)
14762306a36Sopenharmony_ci#define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT        (0x8118)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci/*****************************************************************************
15162306a36Sopenharmony_ci*
15262306a36Sopenharmony_ci*        P C I    S y s t e m    I n t e r f a c e    R e g i s t e r s
15362306a36Sopenharmony_ci*
15462306a36Sopenharmony_ci*****************************************************************************/
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/*
15762306a36Sopenharmony_ci * Defines for working with the System Doorbell register.
15862306a36Sopenharmony_ci * Values for doorbell function codes are included in the section that defines
15962306a36Sopenharmony_ci * all the function codes (further on in this file).
16062306a36Sopenharmony_ci */
16162306a36Sopenharmony_ci#define MPI_DOORBELL_OFFSET                 (0x00000000)
16262306a36Sopenharmony_ci#define MPI_DOORBELL_ACTIVE                 (0x08000000) /* DoorbellUsed */
16362306a36Sopenharmony_ci#define MPI_DOORBELL_USED                   (MPI_DOORBELL_ACTIVE)
16462306a36Sopenharmony_ci#define MPI_DOORBELL_ACTIVE_SHIFT           (27)
16562306a36Sopenharmony_ci#define MPI_DOORBELL_WHO_INIT_MASK          (0x07000000)
16662306a36Sopenharmony_ci#define MPI_DOORBELL_WHO_INIT_SHIFT         (24)
16762306a36Sopenharmony_ci#define MPI_DOORBELL_FUNCTION_MASK          (0xFF000000)
16862306a36Sopenharmony_ci#define MPI_DOORBELL_FUNCTION_SHIFT         (24)
16962306a36Sopenharmony_ci#define MPI_DOORBELL_ADD_DWORDS_MASK        (0x00FF0000)
17062306a36Sopenharmony_ci#define MPI_DOORBELL_ADD_DWORDS_SHIFT       (16)
17162306a36Sopenharmony_ci#define MPI_DOORBELL_DATA_MASK              (0x0000FFFF)
17262306a36Sopenharmony_ci#define MPI_DOORBELL_FUNCTION_SPECIFIC_MASK (0x0000FFFF)
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci/* values for Host Buffer Access Control doorbell function */
17562306a36Sopenharmony_ci#define MPI_DB_HPBAC_VALUE_MASK             (0x0000F000)
17662306a36Sopenharmony_ci#define MPI_DB_HPBAC_ENABLE_ACCESS          (0x01)
17762306a36Sopenharmony_ci#define MPI_DB_HPBAC_DISABLE_ACCESS         (0x02)
17862306a36Sopenharmony_ci#define MPI_DB_HPBAC_FREE_BUFFER            (0x03)
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci#define MPI_WRITE_SEQUENCE_OFFSET           (0x00000004)
18262306a36Sopenharmony_ci#define MPI_WRSEQ_KEY_VALUE_MASK            (0x0000000F)
18362306a36Sopenharmony_ci#define MPI_WRSEQ_1ST_KEY_VALUE             (0x04)
18462306a36Sopenharmony_ci#define MPI_WRSEQ_2ND_KEY_VALUE             (0x0B)
18562306a36Sopenharmony_ci#define MPI_WRSEQ_3RD_KEY_VALUE             (0x02)
18662306a36Sopenharmony_ci#define MPI_WRSEQ_4TH_KEY_VALUE             (0x07)
18762306a36Sopenharmony_ci#define MPI_WRSEQ_5TH_KEY_VALUE             (0x0D)
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci#define MPI_DIAGNOSTIC_OFFSET               (0x00000008)
19062306a36Sopenharmony_ci#define MPI_DIAG_CLEAR_FLASH_BAD_SIG        (0x00000400)
19162306a36Sopenharmony_ci#define MPI_DIAG_PREVENT_IOC_BOOT           (0x00000200)
19262306a36Sopenharmony_ci#define MPI_DIAG_DRWE                       (0x00000080)
19362306a36Sopenharmony_ci#define MPI_DIAG_FLASH_BAD_SIG              (0x00000040)
19462306a36Sopenharmony_ci#define MPI_DIAG_RESET_HISTORY              (0x00000020)
19562306a36Sopenharmony_ci#define MPI_DIAG_RW_ENABLE                  (0x00000010)
19662306a36Sopenharmony_ci#define MPI_DIAG_RESET_ADAPTER              (0x00000004)
19762306a36Sopenharmony_ci#define MPI_DIAG_DISABLE_ARM                (0x00000002)
19862306a36Sopenharmony_ci#define MPI_DIAG_MEM_ENABLE                 (0x00000001)
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci#define MPI_TEST_BASE_ADDRESS_OFFSET        (0x0000000C)
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci#define MPI_DIAG_RW_DATA_OFFSET             (0x00000010)
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci#define MPI_DIAG_RW_ADDRESS_OFFSET          (0x00000014)
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci#define MPI_HOST_INTERRUPT_STATUS_OFFSET    (0x00000030)
20762306a36Sopenharmony_ci#define MPI_HIS_IOP_DOORBELL_STATUS         (0x80000000)
20862306a36Sopenharmony_ci#define MPI_HIS_REPLY_MESSAGE_INTERRUPT     (0x00000008)
20962306a36Sopenharmony_ci#define MPI_HIS_DOORBELL_INTERRUPT          (0x00000001)
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci#define MPI_HOST_INTERRUPT_MASK_OFFSET      (0x00000034)
21262306a36Sopenharmony_ci#define MPI_HIM_RIM                         (0x00000008)
21362306a36Sopenharmony_ci#define MPI_HIM_DIM                         (0x00000001)
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci#define MPI_REQUEST_QUEUE_OFFSET            (0x00000040)
21662306a36Sopenharmony_ci#define MPI_REQUEST_POST_FIFO_OFFSET        (0x00000040)
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci#define MPI_REPLY_QUEUE_OFFSET              (0x00000044)
21962306a36Sopenharmony_ci#define MPI_REPLY_POST_FIFO_OFFSET          (0x00000044)
22062306a36Sopenharmony_ci#define MPI_REPLY_FREE_FIFO_OFFSET          (0x00000044)
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#define MPI_HI_PRI_REQUEST_QUEUE_OFFSET     (0x00000048)
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/*****************************************************************************
22762306a36Sopenharmony_ci*
22862306a36Sopenharmony_ci*        M e s s a g e    F r a m e    D e s c r i p t o r s
22962306a36Sopenharmony_ci*
23062306a36Sopenharmony_ci*****************************************************************************/
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci#define MPI_REQ_MF_DESCRIPTOR_NB_MASK       (0x00000003)
23362306a36Sopenharmony_ci#define MPI_REQ_MF_DESCRIPTOR_F_BIT         (0x00000004)
23462306a36Sopenharmony_ci#define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK  (0xFFFFFFF8)
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci#define MPI_ADDRESS_REPLY_A_BIT             (0x80000000)
23762306a36Sopenharmony_ci#define MPI_ADDRESS_REPLY_ADDRESS_MASK      (0x7FFFFFFF)
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_A_BIT             (0x80000000)
24062306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_TYPE_MASK         (0x60000000)
24162306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT    (0x00)
24262306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET  (0x01)
24362306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_TYPE_LAN          (0x02)
24462306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_TYPE_SHIFT        (29)
24562306a36Sopenharmony_ci#define MPI_CONTEXT_REPLY_CONTEXT_MASK      (0x1FFFFFFF)
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci/****************************************************************************/
24962306a36Sopenharmony_ci/* Context Reply macros                                                     */
25062306a36Sopenharmony_ci/****************************************************************************/
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci#define MPI_GET_CONTEXT_REPLY_TYPE(x)  (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \
25362306a36Sopenharmony_ci                                          >> MPI_CONTEXT_REPLY_TYPE_SHIFT)
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci#define MPI_SET_CONTEXT_REPLY_TYPE(x, typ)                                  \
25662306a36Sopenharmony_ci            ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) |                   \
25762306a36Sopenharmony_ci                            (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) &      \
25862306a36Sopenharmony_ci                                        MPI_CONTEXT_REPLY_TYPE_MASK))
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci/*****************************************************************************
26262306a36Sopenharmony_ci*
26362306a36Sopenharmony_ci*        M e s s a g e    F u n c t i o n s
26462306a36Sopenharmony_ci*              0x80 -> 0x8F reserved for private message use per product
26562306a36Sopenharmony_ci*
26662306a36Sopenharmony_ci*
26762306a36Sopenharmony_ci*****************************************************************************/
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci#define MPI_FUNCTION_SCSI_IO_REQUEST                (0x00)
27062306a36Sopenharmony_ci#define MPI_FUNCTION_SCSI_TASK_MGMT                 (0x01)
27162306a36Sopenharmony_ci#define MPI_FUNCTION_IOC_INIT                       (0x02)
27262306a36Sopenharmony_ci#define MPI_FUNCTION_IOC_FACTS                      (0x03)
27362306a36Sopenharmony_ci#define MPI_FUNCTION_CONFIG                         (0x04)
27462306a36Sopenharmony_ci#define MPI_FUNCTION_PORT_FACTS                     (0x05)
27562306a36Sopenharmony_ci#define MPI_FUNCTION_PORT_ENABLE                    (0x06)
27662306a36Sopenharmony_ci#define MPI_FUNCTION_EVENT_NOTIFICATION             (0x07)
27762306a36Sopenharmony_ci#define MPI_FUNCTION_EVENT_ACK                      (0x08)
27862306a36Sopenharmony_ci#define MPI_FUNCTION_FW_DOWNLOAD                    (0x09)
27962306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_CMD_BUFFER_POST         (0x0A)
28062306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_ASSIST                  (0x0B)
28162306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_STATUS_SEND             (0x0C)
28262306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_MODE_ABORT              (0x0D)
28362306a36Sopenharmony_ci#define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST          (0x0E)
28462306a36Sopenharmony_ci#define MPI_FUNCTION_FC_LINK_SRVC_RSP               (0x0F)
28562306a36Sopenharmony_ci#define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND           (0x10)
28662306a36Sopenharmony_ci#define MPI_FUNCTION_FC_ABORT                       (0x11)
28762306a36Sopenharmony_ci#define MPI_FUNCTION_FW_UPLOAD                      (0x12)
28862306a36Sopenharmony_ci#define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND       (0x13)
28962306a36Sopenharmony_ci#define MPI_FUNCTION_FC_PRIMITIVE_SEND              (0x14)
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci#define MPI_FUNCTION_RAID_ACTION                    (0x15)
29262306a36Sopenharmony_ci#define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH       (0x16)
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci#define MPI_FUNCTION_TOOLBOX                        (0x17)
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci#define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR       (0x18)
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci#define MPI_FUNCTION_MAILBOX                        (0x19)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define MPI_FUNCTION_SMP_PASSTHROUGH                (0x1A)
30162306a36Sopenharmony_ci#define MPI_FUNCTION_SAS_IO_UNIT_CONTROL            (0x1B)
30262306a36Sopenharmony_ci#define MPI_FUNCTION_SATA_PASSTHROUGH               (0x1C)
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci#define MPI_FUNCTION_DIAG_BUFFER_POST               (0x1D)
30562306a36Sopenharmony_ci#define MPI_FUNCTION_DIAG_RELEASE                   (0x1E)
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci#define MPI_FUNCTION_SCSI_IO_32                     (0x1F)
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci#define MPI_FUNCTION_LAN_SEND                       (0x20)
31062306a36Sopenharmony_ci#define MPI_FUNCTION_LAN_RECEIVE                    (0x21)
31162306a36Sopenharmony_ci#define MPI_FUNCTION_LAN_RESET                      (0x22)
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_ASSIST_EXTENDED         (0x23)
31462306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST       (0x24)
31562306a36Sopenharmony_ci#define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST       (0x25)
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#define MPI_FUNCTION_INBAND_BUFFER_POST             (0x28)
31862306a36Sopenharmony_ci#define MPI_FUNCTION_INBAND_SEND                    (0x29)
31962306a36Sopenharmony_ci#define MPI_FUNCTION_INBAND_RSP                     (0x2A)
32062306a36Sopenharmony_ci#define MPI_FUNCTION_INBAND_ABORT                   (0x2B)
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci#define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET         (0x40)
32362306a36Sopenharmony_ci#define MPI_FUNCTION_IO_UNIT_RESET                  (0x41)
32462306a36Sopenharmony_ci#define MPI_FUNCTION_HANDSHAKE                      (0x42)
32562306a36Sopenharmony_ci#define MPI_FUNCTION_REPLY_FRAME_REMOVAL            (0x43)
32662306a36Sopenharmony_ci#define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL    (0x44)
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci/* standard version format */
33062306a36Sopenharmony_citypedef struct _MPI_VERSION_STRUCT
33162306a36Sopenharmony_ci{
33262306a36Sopenharmony_ci    U8                      Dev;                        /* 00h */
33362306a36Sopenharmony_ci    U8                      Unit;                       /* 01h */
33462306a36Sopenharmony_ci    U8                      Minor;                      /* 02h */
33562306a36Sopenharmony_ci    U8                      Major;                      /* 03h */
33662306a36Sopenharmony_ci} MPI_VERSION_STRUCT, MPI_POINTER PTR_MPI_VERSION_STRUCT,
33762306a36Sopenharmony_ci  MpiVersionStruct_t, MPI_POINTER pMpiVersionStruct;
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_citypedef union _MPI_VERSION_FORMAT
34062306a36Sopenharmony_ci{
34162306a36Sopenharmony_ci    MPI_VERSION_STRUCT      Struct;
34262306a36Sopenharmony_ci    U32                     Word;
34362306a36Sopenharmony_ci} MPI_VERSION_FORMAT, MPI_POINTER PTR_MPI_VERSION_FORMAT,
34462306a36Sopenharmony_ci  MpiVersionFormat_t, MPI_POINTER pMpiVersionFormat_t;
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci/*****************************************************************************
34862306a36Sopenharmony_ci*
34962306a36Sopenharmony_ci*        S c a t t e r    G a t h e r    E l e m e n t s
35062306a36Sopenharmony_ci*
35162306a36Sopenharmony_ci*****************************************************************************/
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci/****************************************************************************/
35462306a36Sopenharmony_ci/*  Simple element structures                                               */
35562306a36Sopenharmony_ci/****************************************************************************/
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_citypedef struct _SGE_SIMPLE32
35862306a36Sopenharmony_ci{
35962306a36Sopenharmony_ci    U32                     FlagsLength;
36062306a36Sopenharmony_ci    U32                     Address;
36162306a36Sopenharmony_ci} SGE_SIMPLE32, MPI_POINTER PTR_SGE_SIMPLE32,
36262306a36Sopenharmony_ci  SGESimple32_t, MPI_POINTER pSGESimple32_t;
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_citypedef struct _SGE_SIMPLE64
36562306a36Sopenharmony_ci{
36662306a36Sopenharmony_ci    U32                     FlagsLength;
36762306a36Sopenharmony_ci    U64                     Address;
36862306a36Sopenharmony_ci} SGE_SIMPLE64, MPI_POINTER PTR_SGE_SIMPLE64,
36962306a36Sopenharmony_ci  SGESimple64_t, MPI_POINTER pSGESimple64_t;
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_citypedef struct _SGE_SIMPLE_UNION
37262306a36Sopenharmony_ci{
37362306a36Sopenharmony_ci    U32                     FlagsLength;
37462306a36Sopenharmony_ci    union
37562306a36Sopenharmony_ci    {
37662306a36Sopenharmony_ci        U32                 Address32;
37762306a36Sopenharmony_ci        U64                 Address64;
37862306a36Sopenharmony_ci    }u;
37962306a36Sopenharmony_ci} SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION,
38062306a36Sopenharmony_ci  SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t;
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci/****************************************************************************/
38362306a36Sopenharmony_ci/*  Chain element structures                                                */
38462306a36Sopenharmony_ci/****************************************************************************/
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_citypedef struct _SGE_CHAIN32
38762306a36Sopenharmony_ci{
38862306a36Sopenharmony_ci    U16                     Length;
38962306a36Sopenharmony_ci    U8                      NextChainOffset;
39062306a36Sopenharmony_ci    U8                      Flags;
39162306a36Sopenharmony_ci    U32                     Address;
39262306a36Sopenharmony_ci} SGE_CHAIN32, MPI_POINTER PTR_SGE_CHAIN32,
39362306a36Sopenharmony_ci  SGEChain32_t, MPI_POINTER pSGEChain32_t;
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_citypedef struct _SGE_CHAIN64
39662306a36Sopenharmony_ci{
39762306a36Sopenharmony_ci    U16                     Length;
39862306a36Sopenharmony_ci    U8                      NextChainOffset;
39962306a36Sopenharmony_ci    U8                      Flags;
40062306a36Sopenharmony_ci    U64                     Address;
40162306a36Sopenharmony_ci} SGE_CHAIN64, MPI_POINTER PTR_SGE_CHAIN64,
40262306a36Sopenharmony_ci  SGEChain64_t, MPI_POINTER pSGEChain64_t;
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_citypedef struct _SGE_CHAIN_UNION
40562306a36Sopenharmony_ci{
40662306a36Sopenharmony_ci    U16                     Length;
40762306a36Sopenharmony_ci    U8                      NextChainOffset;
40862306a36Sopenharmony_ci    U8                      Flags;
40962306a36Sopenharmony_ci    union
41062306a36Sopenharmony_ci    {
41162306a36Sopenharmony_ci        U32                 Address32;
41262306a36Sopenharmony_ci        U64                 Address64;
41362306a36Sopenharmony_ci    }u;
41462306a36Sopenharmony_ci} SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION,
41562306a36Sopenharmony_ci  SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t;
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ci/****************************************************************************/
41862306a36Sopenharmony_ci/*  Transaction Context element                                             */
41962306a36Sopenharmony_ci/****************************************************************************/
42062306a36Sopenharmony_ci
42162306a36Sopenharmony_citypedef struct _SGE_TRANSACTION32
42262306a36Sopenharmony_ci{
42362306a36Sopenharmony_ci    U8                      Reserved;
42462306a36Sopenharmony_ci    U8                      ContextSize;
42562306a36Sopenharmony_ci    U8                      DetailsLength;
42662306a36Sopenharmony_ci    U8                      Flags;
42762306a36Sopenharmony_ci    U32                     TransactionContext;
42862306a36Sopenharmony_ci    U32                     TransactionDetails[];
42962306a36Sopenharmony_ci} SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32,
43062306a36Sopenharmony_ci  SGETransaction32_t, MPI_POINTER pSGETransaction32_t;
43162306a36Sopenharmony_ci
43262306a36Sopenharmony_citypedef struct _SGE_TRANSACTION64
43362306a36Sopenharmony_ci{
43462306a36Sopenharmony_ci    U8                      Reserved;
43562306a36Sopenharmony_ci    U8                      ContextSize;
43662306a36Sopenharmony_ci    U8                      DetailsLength;
43762306a36Sopenharmony_ci    U8                      Flags;
43862306a36Sopenharmony_ci    U32                     TransactionContext[2];
43962306a36Sopenharmony_ci    U32                     TransactionDetails[1];
44062306a36Sopenharmony_ci} SGE_TRANSACTION64, MPI_POINTER PTR_SGE_TRANSACTION64,
44162306a36Sopenharmony_ci  SGETransaction64_t, MPI_POINTER pSGETransaction64_t;
44262306a36Sopenharmony_ci
44362306a36Sopenharmony_citypedef struct _SGE_TRANSACTION96
44462306a36Sopenharmony_ci{
44562306a36Sopenharmony_ci    U8                      Reserved;
44662306a36Sopenharmony_ci    U8                      ContextSize;
44762306a36Sopenharmony_ci    U8                      DetailsLength;
44862306a36Sopenharmony_ci    U8                      Flags;
44962306a36Sopenharmony_ci    U32                     TransactionContext[3];
45062306a36Sopenharmony_ci    U32                     TransactionDetails[1];
45162306a36Sopenharmony_ci} SGE_TRANSACTION96, MPI_POINTER PTR_SGE_TRANSACTION96,
45262306a36Sopenharmony_ci  SGETransaction96_t, MPI_POINTER pSGETransaction96_t;
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_citypedef struct _SGE_TRANSACTION128
45562306a36Sopenharmony_ci{
45662306a36Sopenharmony_ci    U8                      Reserved;
45762306a36Sopenharmony_ci    U8                      ContextSize;
45862306a36Sopenharmony_ci    U8                      DetailsLength;
45962306a36Sopenharmony_ci    U8                      Flags;
46062306a36Sopenharmony_ci    U32                     TransactionContext[4];
46162306a36Sopenharmony_ci    U32                     TransactionDetails[1];
46262306a36Sopenharmony_ci} SGE_TRANSACTION128, MPI_POINTER PTR_SGE_TRANSACTION128,
46362306a36Sopenharmony_ci  SGETransaction_t128, MPI_POINTER pSGETransaction_t128;
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_citypedef struct _SGE_TRANSACTION_UNION
46662306a36Sopenharmony_ci{
46762306a36Sopenharmony_ci    U8                      Reserved;
46862306a36Sopenharmony_ci    U8                      ContextSize;
46962306a36Sopenharmony_ci    U8                      DetailsLength;
47062306a36Sopenharmony_ci    U8                      Flags;
47162306a36Sopenharmony_ci    union
47262306a36Sopenharmony_ci    {
47362306a36Sopenharmony_ci        U32                 TransactionContext32[1];
47462306a36Sopenharmony_ci        U32                 TransactionContext64[2];
47562306a36Sopenharmony_ci        U32                 TransactionContext96[3];
47662306a36Sopenharmony_ci        U32                 TransactionContext128[4];
47762306a36Sopenharmony_ci    }u;
47862306a36Sopenharmony_ci    U32                     TransactionDetails[1];
47962306a36Sopenharmony_ci} SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION,
48062306a36Sopenharmony_ci  SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t;
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci/****************************************************************************/
48462306a36Sopenharmony_ci/*  SGE IO types union  for IO SGL's                                        */
48562306a36Sopenharmony_ci/****************************************************************************/
48662306a36Sopenharmony_ci
48762306a36Sopenharmony_citypedef struct _SGE_IO_UNION
48862306a36Sopenharmony_ci{
48962306a36Sopenharmony_ci    union
49062306a36Sopenharmony_ci    {
49162306a36Sopenharmony_ci        SGE_SIMPLE_UNION    Simple;
49262306a36Sopenharmony_ci        SGE_CHAIN_UNION     Chain;
49362306a36Sopenharmony_ci    } u;
49462306a36Sopenharmony_ci} SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION,
49562306a36Sopenharmony_ci  SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t;
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/****************************************************************************/
49862306a36Sopenharmony_ci/*  SGE union for SGL's with Simple and Transaction elements                */
49962306a36Sopenharmony_ci/****************************************************************************/
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_citypedef struct _SGE_TRANS_SIMPLE_UNION
50262306a36Sopenharmony_ci{
50362306a36Sopenharmony_ci    union
50462306a36Sopenharmony_ci    {
50562306a36Sopenharmony_ci        SGE_SIMPLE_UNION        Simple;
50662306a36Sopenharmony_ci        SGE_TRANSACTION_UNION   Transaction;
50762306a36Sopenharmony_ci    } u;
50862306a36Sopenharmony_ci} SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION,
50962306a36Sopenharmony_ci  SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t;
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci/****************************************************************************/
51262306a36Sopenharmony_ci/*  All SGE types union                                                     */
51362306a36Sopenharmony_ci/****************************************************************************/
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_citypedef struct _SGE_MPI_UNION
51662306a36Sopenharmony_ci{
51762306a36Sopenharmony_ci    union
51862306a36Sopenharmony_ci    {
51962306a36Sopenharmony_ci        SGE_SIMPLE_UNION        Simple;
52062306a36Sopenharmony_ci        SGE_CHAIN_UNION         Chain;
52162306a36Sopenharmony_ci        SGE_TRANSACTION_UNION   Transaction;
52262306a36Sopenharmony_ci    } u;
52362306a36Sopenharmony_ci} SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION,
52462306a36Sopenharmony_ci  MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t,
52562306a36Sopenharmony_ci  SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t;
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ci/****************************************************************************/
52962306a36Sopenharmony_ci/*  SGE field definition and masks                                          */
53062306a36Sopenharmony_ci/****************************************************************************/
53162306a36Sopenharmony_ci
53262306a36Sopenharmony_ci/* Flags field bit definitions */
53362306a36Sopenharmony_ci
53462306a36Sopenharmony_ci#define MPI_SGE_FLAGS_LAST_ELEMENT              (0x80)
53562306a36Sopenharmony_ci#define MPI_SGE_FLAGS_END_OF_BUFFER             (0x40)
53662306a36Sopenharmony_ci#define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK         (0x30)
53762306a36Sopenharmony_ci#define MPI_SGE_FLAGS_LOCAL_ADDRESS             (0x08)
53862306a36Sopenharmony_ci#define MPI_SGE_FLAGS_DIRECTION                 (0x04)
53962306a36Sopenharmony_ci#define MPI_SGE_FLAGS_ADDRESS_SIZE              (0x02)
54062306a36Sopenharmony_ci#define MPI_SGE_FLAGS_END_OF_LIST               (0x01)
54162306a36Sopenharmony_ci
54262306a36Sopenharmony_ci#define MPI_SGE_FLAGS_SHIFT                     (24)
54362306a36Sopenharmony_ci
54462306a36Sopenharmony_ci#define MPI_SGE_LENGTH_MASK                     (0x00FFFFFF)
54562306a36Sopenharmony_ci#define MPI_SGE_CHAIN_LENGTH_MASK               (0x0000FFFF)
54662306a36Sopenharmony_ci
54762306a36Sopenharmony_ci/* Element Type */
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci#define MPI_SGE_FLAGS_TRANSACTION_ELEMENT       (0x00)
55062306a36Sopenharmony_ci#define MPI_SGE_FLAGS_SIMPLE_ELEMENT            (0x10)
55162306a36Sopenharmony_ci#define MPI_SGE_FLAGS_CHAIN_ELEMENT             (0x30)
55262306a36Sopenharmony_ci#define MPI_SGE_FLAGS_ELEMENT_MASK              (0x30)
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ci/* Address location */
55562306a36Sopenharmony_ci
55662306a36Sopenharmony_ci#define MPI_SGE_FLAGS_SYSTEM_ADDRESS            (0x00)
55762306a36Sopenharmony_ci
55862306a36Sopenharmony_ci/* Direction */
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ci#define MPI_SGE_FLAGS_IOC_TO_HOST               (0x00)
56162306a36Sopenharmony_ci#define MPI_SGE_FLAGS_HOST_TO_IOC               (0x04)
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci/* Address Size */
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci#define MPI_SGE_FLAGS_32_BIT_ADDRESSING         (0x00)
56662306a36Sopenharmony_ci#define MPI_SGE_FLAGS_64_BIT_ADDRESSING         (0x02)
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci/* Context Size */
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci#define MPI_SGE_FLAGS_32_BIT_CONTEXT            (0x00)
57162306a36Sopenharmony_ci#define MPI_SGE_FLAGS_64_BIT_CONTEXT            (0x02)
57262306a36Sopenharmony_ci#define MPI_SGE_FLAGS_96_BIT_CONTEXT            (0x04)
57362306a36Sopenharmony_ci#define MPI_SGE_FLAGS_128_BIT_CONTEXT           (0x06)
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci#define MPI_SGE_CHAIN_OFFSET_MASK               (0x00FF0000)
57662306a36Sopenharmony_ci#define MPI_SGE_CHAIN_OFFSET_SHIFT              (16)
57762306a36Sopenharmony_ci
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci/****************************************************************************/
58062306a36Sopenharmony_ci/*  SGE operation Macros                                                    */
58162306a36Sopenharmony_ci/****************************************************************************/
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci         /* SIMPLE FlagsLength manipulations... */
58462306a36Sopenharmony_ci#define  MPI_SGE_SET_FLAGS(f)           ((U32)(f) << MPI_SGE_FLAGS_SHIFT)
58562306a36Sopenharmony_ci#define  MPI_SGE_GET_FLAGS(fl)          (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)
58662306a36Sopenharmony_ci#define  MPI_SGE_LENGTH(fl)             ((fl) & MPI_SGE_LENGTH_MASK)
58762306a36Sopenharmony_ci#define  MPI_SGE_CHAIN_LENGTH(fl)       ((fl) & MPI_SGE_CHAIN_LENGTH_MASK)
58862306a36Sopenharmony_ci
58962306a36Sopenharmony_ci#define  MPI_SGE_SET_FLAGS_LENGTH(f,l)  (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci#define  MPI_pSGE_GET_FLAGS(psg)        MPI_SGE_GET_FLAGS((psg)->FlagsLength)
59262306a36Sopenharmony_ci#define  MPI_pSGE_GET_LENGTH(psg)       MPI_SGE_LENGTH((psg)->FlagsLength)
59362306a36Sopenharmony_ci#define  MPI_pSGE_SET_FLAGS_LENGTH(psg,f,l)  (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f,l)
59462306a36Sopenharmony_ci         /* CAUTION - The following are READ-MODIFY-WRITE! */
59562306a36Sopenharmony_ci#define  MPI_pSGE_SET_FLAGS(psg,f)      (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)
59662306a36Sopenharmony_ci#define  MPI_pSGE_SET_LENGTH(psg,l)     (psg)->FlagsLength |= MPI_SGE_LENGTH(l)
59762306a36Sopenharmony_ci
59862306a36Sopenharmony_ci#define  MPI_GET_CHAIN_OFFSET(x) ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)
59962306a36Sopenharmony_ci
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci
60262306a36Sopenharmony_ci/*****************************************************************************
60362306a36Sopenharmony_ci*
60462306a36Sopenharmony_ci*        S t a n d a r d    M e s s a g e    S t r u c t u r e s
60562306a36Sopenharmony_ci*
60662306a36Sopenharmony_ci*****************************************************************************/
60762306a36Sopenharmony_ci
60862306a36Sopenharmony_ci/****************************************************************************/
60962306a36Sopenharmony_ci/* Standard message request header for all request messages                 */
61062306a36Sopenharmony_ci/****************************************************************************/
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_citypedef struct _MSG_REQUEST_HEADER
61362306a36Sopenharmony_ci{
61462306a36Sopenharmony_ci    U8                      Reserved[2];      /* function specific */
61562306a36Sopenharmony_ci    U8                      ChainOffset;
61662306a36Sopenharmony_ci    U8                      Function;
61762306a36Sopenharmony_ci    U8                      Reserved1[3];     /* function specific */
61862306a36Sopenharmony_ci    U8                      MsgFlags;
61962306a36Sopenharmony_ci    U32                     MsgContext;
62062306a36Sopenharmony_ci} MSG_REQUEST_HEADER, MPI_POINTER PTR_MSG_REQUEST_HEADER,
62162306a36Sopenharmony_ci  MPIHeader_t, MPI_POINTER pMPIHeader_t;
62262306a36Sopenharmony_ci
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci/****************************************************************************/
62562306a36Sopenharmony_ci/*  Default Reply                                                           */
62662306a36Sopenharmony_ci/****************************************************************************/
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_citypedef struct _MSG_DEFAULT_REPLY
62962306a36Sopenharmony_ci{
63062306a36Sopenharmony_ci    U8                      Reserved[2];      /* function specific */
63162306a36Sopenharmony_ci    U8                      MsgLength;
63262306a36Sopenharmony_ci    U8                      Function;
63362306a36Sopenharmony_ci    U8                      Reserved1[3];     /* function specific */
63462306a36Sopenharmony_ci    U8                      MsgFlags;
63562306a36Sopenharmony_ci    U32                     MsgContext;
63662306a36Sopenharmony_ci    U8                      Reserved2[2];     /* function specific */
63762306a36Sopenharmony_ci    U16                     IOCStatus;
63862306a36Sopenharmony_ci    U32                     IOCLogInfo;
63962306a36Sopenharmony_ci} MSG_DEFAULT_REPLY, MPI_POINTER PTR_MSG_DEFAULT_REPLY,
64062306a36Sopenharmony_ci  MPIDefaultReply_t, MPI_POINTER pMPIDefaultReply_t;
64162306a36Sopenharmony_ci
64262306a36Sopenharmony_ci
64362306a36Sopenharmony_ci/* MsgFlags definition for all replies */
64462306a36Sopenharmony_ci
64562306a36Sopenharmony_ci#define MPI_MSGFLAGS_CONTINUATION_REPLY         (0x80)
64662306a36Sopenharmony_ci
64762306a36Sopenharmony_ci
64862306a36Sopenharmony_ci/*****************************************************************************
64962306a36Sopenharmony_ci*
65062306a36Sopenharmony_ci*               I O C    S t a t u s   V a l u e s
65162306a36Sopenharmony_ci*
65262306a36Sopenharmony_ci*****************************************************************************/
65362306a36Sopenharmony_ci
65462306a36Sopenharmony_ci/****************************************************************************/
65562306a36Sopenharmony_ci/*  Common IOCStatus values for all replies                                 */
65662306a36Sopenharmony_ci/****************************************************************************/
65762306a36Sopenharmony_ci
65862306a36Sopenharmony_ci#define MPI_IOCSTATUS_SUCCESS                   (0x0000)
65962306a36Sopenharmony_ci#define MPI_IOCSTATUS_INVALID_FUNCTION          (0x0001)
66062306a36Sopenharmony_ci#define MPI_IOCSTATUS_BUSY                      (0x0002)
66162306a36Sopenharmony_ci#define MPI_IOCSTATUS_INVALID_SGL               (0x0003)
66262306a36Sopenharmony_ci#define MPI_IOCSTATUS_INTERNAL_ERROR            (0x0004)
66362306a36Sopenharmony_ci#define MPI_IOCSTATUS_RESERVED                  (0x0005)
66462306a36Sopenharmony_ci#define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES    (0x0006)
66562306a36Sopenharmony_ci#define MPI_IOCSTATUS_INVALID_FIELD             (0x0007)
66662306a36Sopenharmony_ci#define MPI_IOCSTATUS_INVALID_STATE             (0x0008)
66762306a36Sopenharmony_ci#define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED    (0x0009)
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci/****************************************************************************/
67062306a36Sopenharmony_ci/*  Config IOCStatus values                                                 */
67162306a36Sopenharmony_ci/****************************************************************************/
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_INVALID_ACTION     (0x0020)
67462306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_INVALID_TYPE       (0x0021)
67562306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_INVALID_PAGE       (0x0022)
67662306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_INVALID_DATA       (0x0023)
67762306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS        (0x0024)
67862306a36Sopenharmony_ci#define MPI_IOCSTATUS_CONFIG_CANT_COMMIT        (0x0025)
67962306a36Sopenharmony_ci
68062306a36Sopenharmony_ci/****************************************************************************/
68162306a36Sopenharmony_ci/*  SCSIIO Reply (SPI & FCP) initiator values                               */
68262306a36Sopenharmony_ci/****************************************************************************/
68362306a36Sopenharmony_ci
68462306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR      (0x0040)
68562306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_INVALID_BUS          (0x0041)
68662306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_INVALID_TARGETID     (0x0042)
68762306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE     (0x0043)
68862306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_DATA_OVERRUN         (0x0044)
68962306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN        (0x0045)
69062306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR        (0x0046)
69162306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR       (0x0047)
69262306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_TASK_TERMINATED      (0x0048)
69362306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH    (0x0049)
69462306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED     (0x004A)
69562306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_IOC_TERMINATED       (0x004B)
69662306a36Sopenharmony_ci#define MPI_IOCSTATUS_SCSI_EXT_TERMINATED       (0x004C)
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_ci/****************************************************************************/
69962306a36Sopenharmony_ci/*  For use by SCSI Initiator and SCSI Target end-to-end data protection    */
70062306a36Sopenharmony_ci/****************************************************************************/
70162306a36Sopenharmony_ci
70262306a36Sopenharmony_ci#define MPI_IOCSTATUS_EEDP_GUARD_ERROR          (0x004D)
70362306a36Sopenharmony_ci#define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR        (0x004E)
70462306a36Sopenharmony_ci#define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR        (0x004F)
70562306a36Sopenharmony_ci
70662306a36Sopenharmony_ci
70762306a36Sopenharmony_ci/****************************************************************************/
70862306a36Sopenharmony_ci/*  SCSI Target values                                                      */
70962306a36Sopenharmony_ci/****************************************************************************/
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_PRIORITY_IO         (0x0060)
71262306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_INVALID_PORT        (0x0061)
71362306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX    (0x0062)   /* obsolete name */
71462306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX    (0x0062)
71562306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_ABORTED             (0x0063)
71662306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE   (0x0064)
71762306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_NO_CONNECTION       (0x0065)
71862306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A)
71962306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT   (0x006B)
72062306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR   (0x006D)
72162306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E)
72262306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_IU_TOO_SHORT        (0x006F)
72362306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT     (0x0070)
72462306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_NAK_RECEIVED        (0x0071)
72562306a36Sopenharmony_ci
72662306a36Sopenharmony_ci/****************************************************************************/
72762306a36Sopenharmony_ci/*  Additional FCP target values (obsolete)                                 */
72862306a36Sopenharmony_ci/****************************************************************************/
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_FC_ABORTED         (0x0066)    /* obsolete */
73162306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID   (0x0067)    /* obsolete */
73262306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_FC_DID_INVALID     (0x0068)    /* obsolete */
73362306a36Sopenharmony_ci#define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT (0x0069)    /* obsolete */
73462306a36Sopenharmony_ci
73562306a36Sopenharmony_ci/****************************************************************************/
73662306a36Sopenharmony_ci/*  Fibre Channel Direct Access values                                      */
73762306a36Sopenharmony_ci/****************************************************************************/
73862306a36Sopenharmony_ci
73962306a36Sopenharmony_ci#define MPI_IOCSTATUS_FC_ABORTED                (0x0066)
74062306a36Sopenharmony_ci#define MPI_IOCSTATUS_FC_RX_ID_INVALID          (0x0067)
74162306a36Sopenharmony_ci#define MPI_IOCSTATUS_FC_DID_INVALID            (0x0068)
74262306a36Sopenharmony_ci#define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT        (0x0069)
74362306a36Sopenharmony_ci#define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED      (0x006C)
74462306a36Sopenharmony_ci
74562306a36Sopenharmony_ci/****************************************************************************/
74662306a36Sopenharmony_ci/*  LAN values                                                              */
74762306a36Sopenharmony_ci/****************************************************************************/
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND      (0x0080)
75062306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_DEVICE_FAILURE        (0x0081)
75162306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR        (0x0082)
75262306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED      (0x0083)
75362306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_RECEIVE_ERROR         (0x0084)
75462306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED       (0x0085)
75562306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_PARTIAL_PACKET        (0x0086)
75662306a36Sopenharmony_ci#define MPI_IOCSTATUS_LAN_CANCELED              (0x0087)
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci/****************************************************************************/
75962306a36Sopenharmony_ci/*  Serial Attached SCSI values                                             */
76062306a36Sopenharmony_ci/****************************************************************************/
76162306a36Sopenharmony_ci
76262306a36Sopenharmony_ci#define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED    (0x0090)
76362306a36Sopenharmony_ci#define MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN      (0x0091)
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_ci/****************************************************************************/
76662306a36Sopenharmony_ci/*  Inband values                                                           */
76762306a36Sopenharmony_ci/****************************************************************************/
76862306a36Sopenharmony_ci
76962306a36Sopenharmony_ci#define MPI_IOCSTATUS_INBAND_ABORTED            (0x0098)
77062306a36Sopenharmony_ci#define MPI_IOCSTATUS_INBAND_NO_CONNECTION      (0x0099)
77162306a36Sopenharmony_ci
77262306a36Sopenharmony_ci/****************************************************************************/
77362306a36Sopenharmony_ci/*  Diagnostic Tools values                                                 */
77462306a36Sopenharmony_ci/****************************************************************************/
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci#define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED       (0x00A0)
77762306a36Sopenharmony_ci
77862306a36Sopenharmony_ci
77962306a36Sopenharmony_ci/****************************************************************************/
78062306a36Sopenharmony_ci/*  IOCStatus flag to indicate that log info is available                   */
78162306a36Sopenharmony_ci/****************************************************************************/
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci#define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE   (0x8000)
78462306a36Sopenharmony_ci#define MPI_IOCSTATUS_MASK                      (0x7FFF)
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci/****************************************************************************/
78762306a36Sopenharmony_ci/*  LogInfo Types                                                           */
78862306a36Sopenharmony_ci/****************************************************************************/
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_MASK                (0xF0000000)
79162306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_SHIFT               (28)
79262306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_NONE                (0x0)
79362306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_SCSI                (0x1)
79462306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_FC                  (0x2)
79562306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_SAS                 (0x3)
79662306a36Sopenharmony_ci#define MPI_IOCLOGINFO_TYPE_ISCSI               (0x4)
79762306a36Sopenharmony_ci#define MPI_IOCLOGINFO_LOG_DATA_MASK            (0x0FFFFFFF)
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci#endif
801