1119418Sobrien/* SPDX-License-Identifier: GPL-2.0 */
265312Smsmith/*
382092Sscottl *  Copyright (c) 2000-2008 LSI Corporation.
465312Smsmith *
565312Smsmith *
665312Smsmith *           Name:  mpi_init.h
765312Smsmith *          Title:  MPI initiator mode messages and structures
865312Smsmith *  Creation Date:  June 8, 2000
965312Smsmith *
1065312Smsmith *    mpi_init.h Version:  01.05.09
1165312Smsmith *
1265312Smsmith *  Version History
1365312Smsmith *  ---------------
1465312Smsmith *
1565312Smsmith *  Date      Version   Description
1665312Smsmith *  --------  --------  ------------------------------------------------------
1765312Smsmith *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
1865312Smsmith *  05-24-00  00.10.02  Added SenseBufferLength to _MSG_SCSI_IO_REPLY.
1965312Smsmith *  06-06-00  01.00.01  Update version number for 1.0 release.
2065312Smsmith *  06-08-00  01.00.02  Added MPI_SCSI_RSP_INFO_ definitions.
2165312Smsmith *  11-02-00  01.01.01  Original release for post 1.0 work.
2265312Smsmith *  12-04-00  01.01.02  Added MPI_SCSIIO_CONTROL_NO_DISCONNECT.
2365312Smsmith *  02-20-01  01.01.03  Started using MPI_POINTER.
2465312Smsmith *  03-27-01  01.01.04  Added structure offset comments.
25128964Sscottl *  04-10-01  01.01.05  Added new MsgFlag for MSG_SCSI_TASK_MGMT.
26128964Sscottl *  08-08-01  01.02.01  Original release for v1.2 work.
27128964Sscottl *  08-29-01  01.02.02  Added MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET.
28128964Sscottl *                      Added MPI_SCSI_STATE_QUEUE_TAG_REJECTED for
29128964Sscottl *                      MSG_SCSI_IO_REPLY.
3096554Sobrien *  09-28-01  01.02.03  Added structures and defines for SCSI Enclosure
3196554Sobrien *                      Processor messages.
3282092Sscottl *  10-04-01  01.02.04  Added defines for SEP request Action field.
3382092Sscottl *  05-31-02  01.02.05  Added MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR define
3496554Sobrien *                      for SCSI IO requests.
3596554Sobrien *  11-15-02  01.02.06  Added special extended SCSI Status defines for FCP.
3696554Sobrien *  06-26-03  01.02.07  Added MPI_SCSI_STATUS_FCPEXT_UNASSIGNED define.
3796554Sobrien *  05-11-04  01.03.01  Original release for MPI v1.3.
3896554Sobrien *  08-19-04  01.05.01  Added MsgFlags defines for EEDP to SCSI IO request.
3996554Sobrien *                      Added new word to MSG_SCSI_IO_REPLY to add TaskTag field
4096554Sobrien *                      and a reserved U16.
4196554Sobrien *                      Added new MSG_SCSI_IO32_REQUEST structure.
4296554Sobrien *                      Added a TaskType of Clear Task Set to SCSI
4396554Sobrien *                      Task Management request.
4496554Sobrien *  12-07-04  01.05.02  Added support for Task Management Query Task.
4596554Sobrien *  01-15-05  01.05.03  Modified SCSI Enclosure Processor Request to support
4696554Sobrien *                      WWID addressing.
4796554Sobrien *  03-11-05  01.05.04  Removed EEDP flags from SCSI IO Request.
4896554Sobrien *                      Removed SCSI IO 32 Request.
4996554Sobrien *                      Modified SCSI Enclosure Processor Request and Reply to
5096554Sobrien *                      support Enclosure/Slot addressing rather than WWID
5196554Sobrien *                      addressing.
5296554Sobrien *  06-24-05  01.05.05  Added SCSI IO 32 structures and defines.
5396554Sobrien *                      Added four new defines for SEP SlotStatus.
5496554Sobrien *  08-03-05  01.05.06  Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them
5596554Sobrien *                      unique in the first 32 characters.
5696554Sobrien *  03-27-06  01.05.07  Added Task Management type of Clear ACA.
5796554Sobrien *  10-11-06  01.05.08  Shortened define for Task Management type of Clear ACA.
5896554Sobrien *  02-28-07  01.05.09  Defined two new MsgFlags bits for SCSI Task Management
5996554Sobrien *                      Request: Do Not Send Task IU and Soft Reset Option.
6096554Sobrien *  --------------------------------------------------------------------------
6196554Sobrien */
6296554Sobrien
6396554Sobrien#ifndef MPI_INIT_H
6496554Sobrien#define MPI_INIT_H
6596554Sobrien
6696554Sobrien
6796554Sobrien/*****************************************************************************
6896554Sobrien*
6996554Sobrien*               S C S I    I n i t i a t o r    M e s s a g e s
7096554Sobrien*
7196554Sobrien*****************************************************************************/
7296554Sobrien
7396554Sobrien/****************************************************************************/
7496554Sobrien/*  SCSI IO messages and associated structures                              */
7596554Sobrien/****************************************************************************/
7696554Sobrien
7796554Sobrientypedef struct _MSG_SCSI_IO_REQUEST
7896554Sobrien{
7996554Sobrien    U8                      TargetID;           /* 00h */
8096554Sobrien    U8                      Bus;                /* 01h */
8196554Sobrien    U8                      ChainOffset;        /* 02h */
8296554Sobrien    U8                      Function;           /* 03h */
8396554Sobrien    U8                      CDBLength;          /* 04h */
8496554Sobrien    U8                      SenseBufferLength;  /* 05h */
8596554Sobrien    U8                      Reserved;           /* 06h */
8696554Sobrien    U8                      MsgFlags;           /* 07h */
8796554Sobrien    U32                     MsgContext;         /* 08h */
8896554Sobrien    U8                      LUN[8];             /* 0Ch */
8996554Sobrien    U32                     Control;            /* 14h */
9096554Sobrien    U8                      CDB[16];            /* 18h */
9196554Sobrien    U32                     DataLength;         /* 28h */
9296554Sobrien    U32                     SenseBufferLowAddr; /* 2Ch */
9396554Sobrien    SGE_IO_UNION            SGL;                /* 30h */
9496554Sobrien} MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST,
9596554Sobrien  SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t;
9696554Sobrien
9796554Sobrien
9896554Sobrien/* SCSI IO MsgFlags bits */
9996554Sobrien
10096554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH              (0x01)
10196554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32           (0x00)
10296554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64           (0x01)
10396554Sobrien
10496554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION           (0x02)
10596554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST           (0x00)
10696554Sobrien#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC            (0x02)
10796554Sobrien
10896554Sobrien#define MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR  (0x04)
10996554Sobrien
11065312Smsmith/* SCSI IO LUN fields */
11165312Smsmith
112119418Sobrien#define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING   (0x0000FFFF)
113128786Sscottl#define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING  (0xFFFF0000)
114128786Sscottl#define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING   (0x0000FFFF)
115129879Sphk#define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING  (0xFFFF0000)
116128786Sscottl#define MPI_SCSIIO_LUN_LEVEL_1_WORD             (0xFF00)
117128786Sscottl#define MPI_SCSIIO_LUN_LEVEL_1_DWORD            (0x0000FF00)
118128786Sscottl
119128786Sscottl/* SCSI IO Control bits */
120128786Sscottl
121128786Sscottl#define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK   (0x03000000)
122128786Sscottl#define MPI_SCSIIO_CONTROL_NODATATRANSFER       (0x00000000)
123128786Sscottl#define MPI_SCSIIO_CONTROL_WRITE                (0x01000000)
124128786Sscottl#define MPI_SCSIIO_CONTROL_READ                 (0x02000000)
125128786Sscottl
126155286Sscottl#define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK       (0x3C000000)
127128786Sscottl#define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT      (26)
128128786Sscottl
129128786Sscottl#define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK   (0x00000700)
130128786Sscottl#define MPI_SCSIIO_CONTROL_SIMPLEQ              (0x00000000)
131128786Sscottl#define MPI_SCSIIO_CONTROL_HEADOFQ              (0x00000100)
132128786Sscottl#define MPI_SCSIIO_CONTROL_ORDEREDQ             (0x00000200)
133128786Sscottl#define MPI_SCSIIO_CONTROL_ACAQ                 (0x00000400)
134128786Sscottl#define MPI_SCSIIO_CONTROL_UNTAGGED             (0x00000500)
135128786Sscottl#define MPI_SCSIIO_CONTROL_NO_DISCONNECT        (0x00000700)
136128786Sscottl
137128786Sscottl#define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK      (0x00FF0000)
138128786Sscottl#define MPI_SCSIIO_CONTROL_OBSOLETE             (0x00800000)
139128786Sscottl#define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV        (0x00400000)
140128786Sscottl#define MPI_SCSIIO_CONTROL_TARGET_RESET         (0x00200000)
141143729Scognet#define MPI_SCSIIO_CONTROL_LUN_RESET_RSV        (0x00100000)
142128786Sscottl#define MPI_SCSIIO_CONTROL_RESERVED             (0x00080000)
143143729Scognet#define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV     (0x00040000)
144143729Scognet#define MPI_SCSIIO_CONTROL_ABORT_TASK_SET       (0x00020000)
145143729Scognet#define MPI_SCSIIO_CONTROL_RESERVED2            (0x00010000)
146143729Scognet
147143729Scognet
148143729Scognet/* SCSI IO reply structure */
149143729Scognettypedef struct _MSG_SCSI_IO_REPLY
150128786Sscottl{
151128786Sscottl    U8                      TargetID;           /* 00h */
152128786Sscottl    U8                      Bus;                /* 01h */
153128786Sscottl    U8                      MsgLength;          /* 02h */
154128786Sscottl    U8                      Function;           /* 03h */
155128786Sscottl    U8                      CDBLength;          /* 04h */
156128786Sscottl    U8                      SenseBufferLength;  /* 05h */
157128786Sscottl    U8                      Reserved;           /* 06h */
158128786Sscottl    U8                      MsgFlags;           /* 07h */
159128786Sscottl    U32                     MsgContext;         /* 08h */
160155286Sscottl    U8                      SCSIStatus;         /* 0Ch */
161155286Sscottl    U8                      SCSIState;          /* 0Dh */
162155286Sscottl    U16                     IOCStatus;          /* 0Eh */
163155286Sscottl    U32                     IOCLogInfo;         /* 10h */
164155286Sscottl    U32                     TransferCount;      /* 14h */
165128786Sscottl    U32                     SenseCount;         /* 18h */
166155286Sscottl    U32                     ResponseInfo;       /* 1Ch */
167128786Sscottl    U16                     TaskTag;            /* 20h */
168119418Sobrien    U16                     Reserved1;          /* 22h */
169119418Sobrien} MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY,
17096615Sobrien  SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t;
171128964Sscottl
172128964Sscottl
173128964Sscottl/* SCSI IO Reply SCSIStatus values (SAM-2 status codes) */
174128964Sscottl
175128964Sscottl#define MPI_SCSI_STATUS_SUCCESS                 (0x00)
17665312Smsmith#define MPI_SCSI_STATUS_CHECK_CONDITION         (0x02)
17765312Smsmith#define MPI_SCSI_STATUS_CONDITION_MET           (0x04)
17896554Sobrien#define MPI_SCSI_STATUS_BUSY                    (0x08)
17965312Smsmith#define MPI_SCSI_STATUS_INTERMEDIATE            (0x10)
18065312Smsmith#define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET    (0x14)
181128786Sscottl#define MPI_SCSI_STATUS_RESERVATION_CONFLICT    (0x18)
182128786Sscottl#define MPI_SCSI_STATUS_COMMAND_TERMINATED      (0x22)
183128786Sscottl#define MPI_SCSI_STATUS_TASK_SET_FULL           (0x28)
184128786Sscottl#define MPI_SCSI_STATUS_ACA_ACTIVE              (0x30)
185128786Sscottl
186128786Sscottl#define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT    (0x80)
187128786Sscottl#define MPI_SCSI_STATUS_FCPEXT_NO_LINK              (0x81)
188128786Sscottl#define MPI_SCSI_STATUS_FCPEXT_UNASSIGNED           (0x82)
189128786Sscottl
190128786Sscottl
19196554Sobrien/* SCSI IO Reply SCSIState values */
192128786Sscottl
19365312Smsmith#define MPI_SCSI_STATE_AUTOSENSE_VALID          (0x01)
19465312Smsmith#define MPI_SCSI_STATE_AUTOSENSE_FAILED         (0x02)
195128786Sscottl#define MPI_SCSI_STATE_NO_SCSI_STATUS           (0x04)
19665312Smsmith#define MPI_SCSI_STATE_TERMINATED               (0x08)
197128786Sscottl#define MPI_SCSI_STATE_RESPONSE_INFO_VALID      (0x10)
198128786Sscottl#define MPI_SCSI_STATE_QUEUE_TAG_REJECTED       (0x20)
199128786Sscottl
20065312Smsmith/* SCSI IO Reply ResponseInfo values */
201128535Sscottl/* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */
202128535Sscottl
203128535Sscottl#define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE     (0x00000000)
20465312Smsmith#define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR   (0x01000000)
20565312Smsmith#define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID   (0x02000000)
20665312Smsmith#define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR     (0x03000000)
20796554Sobrien#define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000)
20896554Sobrien#define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED      (0x05000000)
20996554Sobrien#define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE   (0x06000000)
21096554Sobrien
21165312Smsmith#define MPI_SCSI_TASKTAG_UNKNOWN                (0xFFFF)
21265312Smsmith
213128535Sscottl
214128786Sscottl/****************************************************************************/
215128786Sscottl/*  SCSI IO 32 messages and associated structures                           */
216128786Sscottl/****************************************************************************/
217128786Sscottl
218128786Sscottltypedef struct
219128786Sscottl{
220128786Sscottl    U8                      CDB[20];                    /* 00h */
221128786Sscottl    U32                     PrimaryReferenceTag;        /* 14h */
222128786Sscottl    U16                     PrimaryApplicationTag;      /* 18h */
22396554Sobrien    U16                     PrimaryApplicationTagMask;  /* 1Ah */
224128786Sscottl    U32                     TransferLength;             /* 1Ch */
225128535Sscottl} MPI_SCSI_IO32_CDB_EEDP32, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP32,
226128535Sscottl  MpiScsiIo32CdbEedp32_t, MPI_POINTER pMpiScsiIo32CdbEedp32_t;
227128535Sscottl
228128535Sscottltypedef struct
229128535Sscottl{
230128535Sscottl    U8                      CDB[16];                    /* 00h */
231128786Sscottl    U32                     DataLength;                 /* 10h */
232128786Sscottl    U32                     PrimaryReferenceTag;        /* 14h */
233128535Sscottl    U16                     PrimaryApplicationTag;      /* 18h */
234128535Sscottl    U16                     PrimaryApplicationTagMask;  /* 1Ah */
235128535Sscottl    U32                     TransferLength;             /* 1Ch */
236128535Sscottl} MPI_SCSI_IO32_CDB_EEDP16, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP16,
23765312Smsmith  MpiScsiIo32CdbEedp16_t, MPI_POINTER pMpiScsiIo32CdbEedp16_t;
238128535Sscottl
239128786Sscottltypedef union
240128535Sscottl{
241128535Sscottl    U8                       CDB32[32];
242128535Sscottl    MPI_SCSI_IO32_CDB_EEDP32 EEDP32;
24365312Smsmith    MPI_SCSI_IO32_CDB_EEDP16 EEDP16;
24465312Smsmith    SGE_SIMPLE_UNION         SGE;
24565312Smsmith} MPI_SCSI_IO32_CDB_UNION, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_UNION,
246128535Sscottl  MpiScsiIo32Cdb_t, MPI_POINTER pMpiScsiIo32Cdb_t;
247128535Sscottl
24865312Smsmithtypedef struct
249128535Sscottl{
250128535Sscottl    U8                      TargetID;           /* 00h */
25165312Smsmith    U8                      Bus;                /* 01h */
25265312Smsmith    U16                     Reserved1;          /* 02h */
253143729Scognet    U32                     Reserved2;          /* 04h */
254143729Scognet} MPI_SCSI_IO32_BUS_TARGET_ID_FORM, MPI_POINTER PTR_MPI_SCSI_IO32_BUS_TARGET_ID_FORM,
255143729Scognet  MpiScsiIo32BusTargetIdForm_t, MPI_POINTER pMpiScsiIo32BusTargetIdForm_t;
256143729Scognet
25765312Smsmithtypedef union
25865312Smsmith{
25965312Smsmith    MPI_SCSI_IO32_BUS_TARGET_ID_FORM    SCSIID;
26096554Sobrien    U64                                 WWID;
26196554Sobrien} MPI_SCSI_IO32_ADDRESS, MPI_POINTER PTR_MPI_SCSI_IO32_ADDRESS,
262128945Sscottl  MpiScsiIo32Address_t, MPI_POINTER pMpiScsiIo32Address_t;
26396554Sobrien
26496554Sobrientypedef struct _MSG_SCSI_IO32_REQUEST
26596554Sobrien{
26696554Sobrien    U8                          Port;                           /* 00h */
26796554Sobrien    U8                          Reserved1;                      /* 01h */
26865312Smsmith    U8                          ChainOffset;                    /* 02h */
26965312Smsmith    U8                          Function;                       /* 03h */
27065312Smsmith    U8                          CDBLength;                      /* 04h */
27165312Smsmith    U8                          SenseBufferLength;              /* 05h */
27296615Sobrien    U8                          Flags;                          /* 06h */
27396615Sobrien    U8                          MsgFlags;                       /* 07h */
27496615Sobrien    U32                         MsgContext;                     /* 08h */
27596615Sobrien    U8                          LUN[8];                         /* 0Ch */
27696615Sobrien    U32                         Control;                        /* 14h */
27796615Sobrien    MPI_SCSI_IO32_CDB_UNION     CDB;                            /* 18h */
27896615Sobrien    U32                         DataLength;                     /* 38h */
27996615Sobrien    U32                         BidirectionalDataLength;        /* 3Ch */
28096554Sobrien    U32                         SecondaryReferenceTag;          /* 40h */
28196554Sobrien    U16                         SecondaryApplicationTag;        /* 44h */
28265312Smsmith    U16                         Reserved2;                      /* 46h */
28365312Smsmith    U16                         EEDPFlags;                      /* 48h */
284128944Sscottl    U16                         ApplicationTagTranslationMask;  /* 4Ah */
285128944Sscottl    U32                         EEDPBlockSize;                  /* 4Ch */
286128944Sscottl    MPI_SCSI_IO32_ADDRESS       DeviceAddress;                  /* 50h */
287128944Sscottl    U8                          SGLOffset0;                     /* 58h */
28865312Smsmith    U8                          SGLOffset1;                     /* 59h */
289128944Sscottl    U8                          SGLOffset2;                     /* 5Ah */
290128944Sscottl    U8                          SGLOffset3;                     /* 5Bh */
29165312Smsmith    U32                         Reserved3;                      /* 5Ch */
29265312Smsmith    U32                         Reserved4;                      /* 60h */
29365312Smsmith    U32                         SenseBufferLowAddr;             /* 64h */
29465312Smsmith    SGE_IO_UNION                SGL;                            /* 68h */
29565312Smsmith} MSG_SCSI_IO32_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO32_REQUEST,
29665312Smsmith  SCSIIO32Request_t, MPI_POINTER pSCSIIO32Request_t;
29796554Sobrien
29896554Sobrien/* SCSI IO 32 MsgFlags bits */
29965312Smsmith#define MPI_SCSIIO32_MSGFLGS_SENSE_WIDTH                (0x01)
30065312Smsmith#define MPI_SCSIIO32_MSGFLGS_32_SENSE_WIDTH             (0x00)
30165312Smsmith#define MPI_SCSIIO32_MSGFLGS_64_SENSE_WIDTH             (0x01)
30296554Sobrien
30396554Sobrien#define MPI_SCSIIO32_MSGFLGS_SENSE_LOCATION             (0x02)
30465312Smsmith#define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_HOST             (0x00)
30565312Smsmith#define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_IOC              (0x02)
30665312Smsmith
30796554Sobrien#define MPI_SCSIIO32_MSGFLGS_CMD_DETERMINES_DATA_DIR    (0x04)
30896554Sobrien#define MPI_SCSIIO32_MSGFLGS_SGL_OFFSETS_CHAINS         (0x08)
30996554Sobrien#define MPI_SCSIIO32_MSGFLGS_MULTICAST                  (0x10)
31096554Sobrien#define MPI_SCSIIO32_MSGFLGS_BIDIRECTIONAL              (0x20)
31196554Sobrien#define MPI_SCSIIO32_MSGFLGS_LARGE_CDB                  (0x40)
31265312Smsmith
31365312Smsmith/* SCSI IO 32 Flags bits */
31496554Sobrien#define MPI_SCSIIO32_FLAGS_FORM_MASK                    (0x03)
31596554Sobrien#define MPI_SCSIIO32_FLAGS_FORM_SCSIID                  (0x00)
31696554Sobrien#define MPI_SCSIIO32_FLAGS_FORM_WWID                    (0x01)
31765312Smsmith
31865312Smsmith/* SCSI IO 32 LUN fields */
319128944Sscottl#define MPI_SCSIIO32_LUN_FIRST_LEVEL_ADDRESSING     (0x0000FFFF)
320128944Sscottl#define MPI_SCSIIO32_LUN_SECOND_LEVEL_ADDRESSING    (0xFFFF0000)
321128944Sscottl#define MPI_SCSIIO32_LUN_THIRD_LEVEL_ADDRESSING     (0x0000FFFF)
322128944Sscottl#define MPI_SCSIIO32_LUN_FOURTH_LEVEL_ADDRESSING    (0xFFFF0000)
323128944Sscottl#define MPI_SCSIIO32_LUN_LEVEL_1_WORD               (0xFF00)
324128944Sscottl#define MPI_SCSIIO32_LUN_LEVEL_1_DWORD              (0x0000FF00)
32565312Smsmith
326155286Sscottl/* SCSI IO 32 Control bits */
32796554Sobrien#define MPI_SCSIIO32_CONTROL_DATADIRECTION_MASK     (0x03000000)
328128944Sscottl#define MPI_SCSIIO32_CONTROL_NODATATRANSFER         (0x00000000)
329128944Sscottl#define MPI_SCSIIO32_CONTROL_WRITE                  (0x01000000)
330128944Sscottl#define MPI_SCSIIO32_CONTROL_READ                   (0x02000000)
331128944Sscottl#define MPI_SCSIIO32_CONTROL_BIDIRECTIONAL          (0x03000000)
332128944Sscottl
333128944Sscottl#define MPI_SCSIIO32_CONTROL_ADDCDBLEN_MASK         (0xFC000000)
33496554Sobrien#define MPI_SCSIIO32_CONTROL_ADDCDBLEN_SHIFT        (26)
33596554Sobrien
336155286Sscottl#define MPI_SCSIIO32_CONTROL_TASKATTRIBUTE_MASK     (0x00000700)
337155286Sscottl#define MPI_SCSIIO32_CONTROL_SIMPLEQ                (0x00000000)
338155286Sscottl#define MPI_SCSIIO32_CONTROL_HEADOFQ                (0x00000100)
339155286Sscottl#define MPI_SCSIIO32_CONTROL_ORDEREDQ               (0x00000200)
340155286Sscottl#define MPI_SCSIIO32_CONTROL_ACAQ                   (0x00000400)
341155286Sscottl#define MPI_SCSIIO32_CONTROL_UNTAGGED               (0x00000500)
34296554Sobrien#define MPI_SCSIIO32_CONTROL_NO_DISCONNECT          (0x00000700)
34396554Sobrien
34496554Sobrien#define MPI_SCSIIO32_CONTROL_TASKMANAGE_MASK        (0x00FF0000)
34596554Sobrien#define MPI_SCSIIO32_CONTROL_OBSOLETE               (0x00800000)
34696554Sobrien#define MPI_SCSIIO32_CONTROL_CLEAR_ACA_RSV          (0x00400000)
34796554Sobrien#define MPI_SCSIIO32_CONTROL_TARGET_RESET           (0x00200000)
34896554Sobrien#define MPI_SCSIIO32_CONTROL_LUN_RESET_RSV          (0x00100000)
349128535Sscottl#define MPI_SCSIIO32_CONTROL_RESERVED               (0x00080000)
350128535Sscottl#define MPI_SCSIIO32_CONTROL_CLR_TASK_SET_RSV       (0x00040000)
351128535Sscottl#define MPI_SCSIIO32_CONTROL_ABORT_TASK_SET         (0x00020000)
352128535Sscottl#define MPI_SCSIIO32_CONTROL_RESERVED2              (0x00010000)
353128535Sscottl
354128535Sscottl/* SCSI IO 32 EEDPFlags */
355128535Sscottl#define MPI_SCSIIO32_EEDPFLAGS_MASK_OP              (0x0007)
356128535Sscottl#define MPI_SCSIIO32_EEDPFLAGS_NOOP_OP              (0x0000)
357128535Sscottl#define MPI_SCSIIO32_EEDPFLAGS_CHK_OP               (0x0001)
35896554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_STRIP_OP             (0x0002)
35996554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_CHKRM_OP             (0x0003)
36096554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_INSERT_OP            (0x0004)
36165312Smsmith#define MPI_SCSIIO32_EEDPFLAGS_REPLACE_OP           (0x0006)
36296554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_CHKREGEN_OP          (0x0007)
363128535Sscottl
364128535Sscottl#define MPI_SCSIIO32_EEDPFLAGS_PASS_REF_TAG         (0x0008)
365128535Sscottl#define MPI_SCSIIO32_EEDPFLAGS_8_9THS_MODE          (0x0010)
366128535Sscottl
36796554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_MASK         (0x0700)
36896554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_GUARD        (0x0100)
36996554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_REFTAG       (0x0200)
37096554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_LBATAG       (0x0400)
37196554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_SHIFT        (8)
37296554Sobrien
37396554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_APPTAG       (0x1000)
37496554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_APPTAG       (0x2000)
37596554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_REFTAG       (0x4000)
37696554Sobrien#define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_REFTAG       (0x8000)
37796554Sobrien
37865312Smsmith
37996554Sobrien/* SCSIIO32 IO reply structure */
38096554Sobrientypedef struct _MSG_SCSIIO32_IO_REPLY
381130585Sphk{
38265312Smsmith    U8                      Port;                       /* 00h */
38365312Smsmith    U8                      Reserved1;                  /* 01h */
384128784Sscottl    U8                      MsgLength;                  /* 02h */
38565312Smsmith    U8                      Function;                   /* 03h */
38665312Smsmith    U8                      CDBLength;                  /* 04h */
38796554Sobrien    U8                      SenseBufferLength;          /* 05h */
38865312Smsmith    U8                      Flags;                      /* 06h */
38965312Smsmith    U8                      MsgFlags;                   /* 07h */
39065312Smsmith    U32                     MsgContext;                 /* 08h */
391154363Sscottl    U8                      SCSIStatus;                 /* 0Ch */
392154363Sscottl    U8                      SCSIState;                  /* 0Dh */
39365312Smsmith    U16                     IOCStatus;                  /* 0Eh */
394130585Sphk    U32                     IOCLogInfo;                 /* 10h */
395128784Sscottl    U32                     TransferCount;              /* 14h */
396130585Sphk    U32                     SenseCount;                 /* 18h */
397128784Sscottl    U32                     ResponseInfo;               /* 1Ch */
398130585Sphk    U16                     TaskTag;                    /* 20h */
399128784Sscottl    U16                     Reserved2;                  /* 22h */
400128784Sscottl    U32                     BidirectionalTransferCount; /* 24h */
401128784Sscottl} MSG_SCSIIO32_IO_REPLY, MPI_POINTER PTR_MSG_SCSIIO32_IO_REPLY,
402128784Sscottl  SCSIIO32Reply_t, MPI_POINTER pSCSIIO32Reply_t;
403128784Sscottl
404128784Sscottl
405128784Sscottl/****************************************************************************/
406128784Sscottl/*  SCSI Task Management messages                                           */
40765312Smsmith/****************************************************************************/
40865312Smsmith
40996554Sobrientypedef struct _MSG_SCSI_TASK_MGMT
41096554Sobrien{
41165312Smsmith    U8                      TargetID;           /* 00h */
412128784Sscottl    U8                      Bus;                /* 01h */
41396554Sobrien    U8                      ChainOffset;        /* 02h */
41496554Sobrien    U8                      Function;           /* 03h */
41596554Sobrien    U8                      Reserved;           /* 04h */
41665312Smsmith    U8                      TaskType;           /* 05h */
41765312Smsmith    U8                      Reserved1;          /* 06h */
418128784Sscottl    U8                      MsgFlags;           /* 07h */
41996554Sobrien    U32                     MsgContext;         /* 08h */
42096554Sobrien    U8                      LUN[8];             /* 0Ch */
42196554Sobrien    U32                     Reserved2[7];       /* 14h */
42265312Smsmith    U32                     TaskMsgContext;     /* 30h */
42365312Smsmith} MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT,
424128784Sscottl  SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t;
42565312Smsmith
42665312Smsmith/* TaskType values */
42765312Smsmith
42865312Smsmith#define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK            (0x01)
42965312Smsmith#define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET         (0x02)
43065312Smsmith#define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET          (0x03)
43165312Smsmith#define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS             (0x04)
432128784Sscottl#define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET    (0x05)
433126080Sphk#define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET        (0x06)
434126080Sphk#define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK            (0x07)
435111815Sphk#define MPI_SCSITASKMGMT_TASKTYPE_CLR_ACA               (0x08)
436111815Sphk
437111815Sphk/* MsgFlags bits */
438111815Sphk#define MPI_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU   (0x01)
43965312Smsmith
44065312Smsmith#define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION   (0x00)
44165312Smsmith#define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION      (0x02)
44265312Smsmith#define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04)
443128944Sscottl
444128944Sscottl#define MPI_SCSITASKMGMT_MSGFLAGS_SOFT_RESET_OPTION     (0x08)
445128944Sscottl
446128944Sscottl/* SCSI Task Management Reply */
447128944Sscottltypedef struct _MSG_SCSI_TASK_MGMT_REPLY
448128944Sscottl{
449128944Sscottl    U8                      TargetID;           /* 00h */
450128944Sscottl    U8                      Bus;                /* 01h */
451128944Sscottl    U8                      MsgLength;          /* 02h */
452128944Sscottl    U8                      Function;           /* 03h */
453128944Sscottl    U8                      ResponseCode;       /* 04h */
454128944Sscottl    U8                      TaskType;           /* 05h */
455128944Sscottl    U8                      Reserved1;          /* 06h */
456128944Sscottl    U8                      MsgFlags;           /* 07h */
457128944Sscottl    U32                     MsgContext;         /* 08h */
458128944Sscottl    U8                      Reserved2[2];       /* 0Ch */
459128944Sscottl    U16                     IOCStatus;          /* 0Eh */
460128944Sscottl    U32                     IOCLogInfo;         /* 10h */
461128944Sscottl    U32                     TerminationCount;   /* 14h */
462128944Sscottl} MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY,
463128944Sscottl  SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t;
464128944Sscottl
465128944Sscottl/* ResponseCode values */
466128944Sscottl#define MPI_SCSITASKMGMT_RSP_TM_COMPLETE                (0x00)
467128944Sscottl#define MPI_SCSITASKMGMT_RSP_INVALID_FRAME              (0x02)
468128944Sscottl#define MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED           (0x04)
469128944Sscottl#define MPI_SCSITASKMGMT_RSP_TM_FAILED                  (0x05)
470128944Sscottl#define MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED               (0x08)
471128944Sscottl#define MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN             (0x09)
472128944Sscottl#define MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC           (0x80)
473128944Sscottl
474128944Sscottl
475128944Sscottl/****************************************************************************/
476128944Sscottl/*  SCSI Enclosure Processor messages                                       */
477128944Sscottl/****************************************************************************/
478128944Sscottl
479128944Sscottltypedef struct _MSG_SEP_REQUEST
480128944Sscottl{
481128944Sscottl    U8                      TargetID;           /* 00h */
482128944Sscottl    U8                      Bus;                /* 01h */
483128944Sscottl    U8                      ChainOffset;        /* 02h */
484128944Sscottl    U8                      Function;           /* 03h */
485128944Sscottl    U8                      Action;             /* 04h */
486128944Sscottl    U8                      Flags;              /* 05h */
487128944Sscottl    U8                      Reserved1;          /* 06h */
488128944Sscottl    U8                      MsgFlags;           /* 07h */
489128944Sscottl    U32                     MsgContext;         /* 08h */
490128944Sscottl    U32                     SlotStatus;         /* 0Ch */
491128944Sscottl    U32                     Reserved2;          /* 10h */
492128944Sscottl    U32                     Reserved3;          /* 14h */
493128944Sscottl    U32                     Reserved4;          /* 18h */
494128944Sscottl    U16                     Slot;               /* 1Ch */
495128944Sscottl    U16                     EnclosureHandle;    /* 1Eh */
496128944Sscottl} MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST,
497128944Sscottl  SEPRequest_t, MPI_POINTER pSEPRequest_t;
498128944Sscottl
49965312Smsmith/* Action defines */
50096554Sobrien#define MPI_SEP_REQ_ACTION_WRITE_STATUS                 (0x00)
50165312Smsmith#define MPI_SEP_REQ_ACTION_READ_STATUS                  (0x01)
502128784Sscottl
503128812Sscottl/* Flags defines */
50465312Smsmith#define MPI_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS        (0x01)
505128784Sscottl#define MPI_SEP_REQ_FLAGS_BUS_TARGETID_ADDRESS          (0x00)
50665312Smsmith
507128812Sscottl/* SlotStatus bits for MSG_SEP_REQUEST */
508128787Sscottl#define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR                 (0x00000001)
50996554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY               (0x00000002)
51096554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING           (0x00000004)
51196554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY          (0x00000008)
51296554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY        (0x00000010)
513128908Sscottl#define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK             (0x00000020)
51496554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT          (0x00000040)
51565312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED             (0x00000080)
51665312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE                (0x00000100)
517155284Sscottl#define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED          (0x00000200)
51865312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_REQ_CONSISTENCY_CHECK    (0x00001000)
519128784Sscottl#define MPI_SEP_REQ_SLOTSTATUS_DISABLE                  (0x00002000)
520128944Sscottl#define MPI_SEP_REQ_SLOTSTATUS_REQ_RESERVED_DEVICE      (0x00004000)
52165312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST         (0x00020000)
522128784Sscottl#define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE           (0x00040000)
52365312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT           (0x00080000)
524128944Sscottl#define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE              (0x00400000)
525128944Sscottl#define MPI_SEP_REQ_SLOTSTATUS_ACTIVE                   (0x00800000)
526128944Sscottl#define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS          (0x04000000)
527128944Sscottl#define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS          (0x08000000)
52896554Sobrien#define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF                  (0x10000000)
52965312Smsmith#define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET               (0x80000000)
53065312Smsmith
53165312Smsmith
532128784Sscottltypedef struct _MSG_SEP_REPLY
533128944Sscottl{
53465312Smsmith    U8                      TargetID;           /* 00h */
535128784Sscottl    U8                      Bus;                /* 01h */
536128784Sscottl    U8                      MsgLength;          /* 02h */
537128784Sscottl    U8                      Function;           /* 03h */
53865312Smsmith    U8                      Action;             /* 04h */
53996554Sobrien    U8                      Reserved1;          /* 05h */
54096554Sobrien    U8                      Reserved2;          /* 06h */
54196554Sobrien    U8                      MsgFlags;           /* 07h */
54296554Sobrien    U32                     MsgContext;         /* 08h */
54396554Sobrien    U16                     Reserved3;          /* 0Ch */
544128944Sscottl    U16                     IOCStatus;          /* 0Eh */
54596554Sobrien    U32                     IOCLogInfo;         /* 10h */
54696554Sobrien    U32                     SlotStatus;         /* 14h */
54796554Sobrien    U32                     Reserved4;          /* 18h */
54896554Sobrien    U16                     Slot;               /* 1Ch */
549128944Sscottl    U16                     EnclosureHandle;    /* 1Eh */
550128944Sscottl} MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY,
55196554Sobrien  SEPReply_t, MPI_POINTER pSEPReply_t;
55296554Sobrien
55396554Sobrien/* SlotStatus bits for MSG_SEP_REPLY */
554128944Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR               (0x00000001)
555128944Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY             (0x00000002)
556128944Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING         (0x00000004)
55796554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY        (0x00000008)
55896554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY      (0x00000010)
55965312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK           (0x00000020)
56065312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT        (0x00000040)
56165312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED           (0x00000080)
56296554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE              (0x00000100)
56365312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED        (0x00000200)
564128784Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_CONSISTENCY_CHECK      (0x00001000)
565128944Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_DISABLE                (0x00002000)
56665312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_RESERVED_DEVICE        (0x00004000)
56796554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_REPORT                 (0x00010000)
56896554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST       (0x00020000)
56996554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY           (0x00040000)
570128812Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY           (0x00080000)
57196554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE          (0x00400000)
572155286Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_ACTIVE                 (0x00800000)
57396554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED       (0x01000000)
57465312Smsmith#define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED       (0x02000000)
57596554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS        (0x04000000)
57696554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS        (0x08000000)
57796554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF                (0x10000000)
578128812Sscottl#define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED           (0x40000000)
57996554Sobrien#define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED                (0x80000000)
58096554Sobrien
58196554Sobrien#endif
58296554Sobrien