1/* $FreeBSD$ */
2/*-
3 * SPDX-License-Identifier: BSD-3-Clause
4 *
5 * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 *    substantially similar to the "NO WARRANTY" disclaimer below
15 *    ("Disclaimer") and any redistribution must be conditioned upon including
16 *    a substantially similar Disclaimer requirement for further binary
17 *    redistribution.
18 * 3. Neither the name of the LSI Logic Corporation nor the names of its
19 *    contributors may be used to endorse or promote products derived from
20 *    this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
32 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 *           Name:  mpi_fc.h
36 *          Title:  MPI Fibre Channel messages and structures
37 *  Creation Date:  June 12, 2000
38 *
39 *    mpi_fc.h Version:  01.05.01
40 *
41 *  Version History
42 *  ---------------
43 *
44 *  Date      Version   Description
45 *  --------  --------  ------------------------------------------------------
46 *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
47 *  06-06-00  01.00.01  Update version number for 1.0 release.
48 *  06-12-00  01.00.02  Added _MSG_FC_ABORT_REPLY structure.
49 *  11-02-00  01.01.01  Original release for post 1.0 work
50 *  12-04-00  01.01.02  Added messages for Common Transport Send and
51 *                      Primitive Send.
52 *  01-09-01  01.01.03  Modifed some of the new flags to have an MPI prefix
53 *                      and modified the FcPrimitiveSend flags.
54 *  01-25-01  01.01.04  Move InitiatorIndex in LinkServiceRsp reply to a larger
55 *                      field.
56 *                      Added FC_ABORT_TYPE_CT_SEND_REQUEST and
57 *                      FC_ABORT_TYPE_EXLINKSEND_REQUEST for FcAbort request.
58 *                      Added MPI_FC_PRIM_SEND_FLAGS_STOP_SEND.
59 *  02-20-01  01.01.05  Started using MPI_POINTER.
60 *  03-27-01  01.01.06  Added Flags field to MSG_LINK_SERVICE_BUFFER_POST_REPLY
61 *                      and defined MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED.
62 *                      Added MPI_FC_PRIM_SEND_FLAGS_RESET_LINK define.
63 *                      Added structure offset comments.
64 *  04-09-01  01.01.07  Added RspLength field to MSG_LINK_SERVICE_RSP_REQUEST.
65 *  08-08-01  01.02.01  Original release for v1.2 work.
66 *  09-28-01  01.02.02  Change name of reserved field in
67 *                      MSG_LINK_SERVICE_RSP_REPLY.
68 *  05-31-02  01.02.03  Adding AliasIndex to FC Direct Access requests.
69 *  01-16-04  01.02.04  Added define for MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK.
70 *  05-11-04  01.03.01  Original release for MPI v1.3.
71 *  08-19-04  01.05.01  Original release for MPI v1.5.
72 *  --------------------------------------------------------------------------
73 */
74
75#ifndef MPI_FC_H
76#define MPI_FC_H
77
78
79/*****************************************************************************
80*
81*        F C    D i r e c t    A c c e s s     M e s s a g e s
82*
83*****************************************************************************/
84
85/****************************************************************************/
86/* Link Service Buffer Post messages                                        */
87/****************************************************************************/
88
89typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REQUEST
90{
91    U8                      BufferPostFlags;    /* 00h */
92    U8                      BufferCount;        /* 01h */
93    U8                      ChainOffset;        /* 02h */
94    U8                      Function;           /* 03h */
95    U16                     Reserved;           /* 04h */
96    U8                      Reserved1;          /* 06h */
97    U8                      MsgFlags;           /* 07h */
98    U32                     MsgContext;         /* 08h */
99    SGE_TRANS_SIMPLE_UNION  SGL;
100} MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
101 MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
102  LinkServiceBufferPostRequest_t, MPI_POINTER pLinkServiceBufferPostRequest_t;
103
104#define LINK_SERVICE_BUFFER_POST_FLAGS_PORT_MASK (0x01)
105
106typedef struct _WWNFORMAT
107{
108    U32                     PortNameHigh;       /* 00h */
109    U32                     PortNameLow;        /* 04h */
110    U32                     NodeNameHigh;       /* 08h */
111    U32                     NodeNameLow;        /* 0Ch */
112} WWNFORMAT,
113  WwnFormat_t;
114
115/* Link Service Buffer Post Reply */
116typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REPLY
117{
118    U8                      Flags;              /* 00h */
119    U8                      Reserved;           /* 01h */
120    U8                      MsgLength;          /* 02h */
121    U8                      Function;           /* 03h */
122    U16                     Reserved1;          /* 04h */
123    U8                      PortNumber;         /* 06h */
124    U8                      MsgFlags;           /* 07h */
125    U32                     MsgContext;         /* 08h */
126    U16                     Reserved2;          /* 0Ch */
127    U16                     IOCStatus;          /* 0Eh */
128    U32                     IOCLogInfo;         /* 10h */
129    U32                     TransferLength;     /* 14h */
130    U32                     TransactionContext; /* 18h */
131    U32                     Rctl_Did;           /* 1Ch */
132    U32                     Csctl_Sid;          /* 20h */
133    U32                     Type_Fctl;          /* 24h */
134    U16                     SeqCnt;             /* 28h */
135    U8                      Dfctl;              /* 2Ah */
136    U8                      SeqId;              /* 2Bh */
137    U16                     Rxid;               /* 2Ch */
138    U16                     Oxid;               /* 2Eh */
139    U32                     Parameter;          /* 30h */
140    WWNFORMAT               Wwn;                /* 34h */
141} MSG_LINK_SERVICE_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REPLY,
142  LinkServiceBufferPostReply_t, MPI_POINTER pLinkServiceBufferPostReply_t;
143
144#define MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED    (0x80)
145
146#define MPI_FC_DID_MASK                             (0x00FFFFFF)
147#define MPI_FC_DID_SHIFT                            (0)
148#define MPI_FC_RCTL_MASK                            (0xFF000000)
149#define MPI_FC_RCTL_SHIFT                           (24)
150#define MPI_FC_SID_MASK                             (0x00FFFFFF)
151#define MPI_FC_SID_SHIFT                            (0)
152#define MPI_FC_CSCTL_MASK                           (0xFF000000)
153#define MPI_FC_CSCTL_SHIFT                          (24)
154#define MPI_FC_FCTL_MASK                            (0x00FFFFFF)
155#define MPI_FC_FCTL_SHIFT                           (0)
156#define MPI_FC_TYPE_MASK                            (0xFF000000)
157#define MPI_FC_TYPE_SHIFT                           (24)
158
159/* obsolete name for the above */
160#define FCP_TARGET_DID_MASK                         (0x00FFFFFF)
161#define FCP_TARGET_DID_SHIFT                        (0)
162#define FCP_TARGET_RCTL_MASK                        (0xFF000000)
163#define FCP_TARGET_RCTL_SHIFT                       (24)
164#define FCP_TARGET_SID_MASK                         (0x00FFFFFF)
165#define FCP_TARGET_SID_SHIFT                        (0)
166#define FCP_TARGET_CSCTL_MASK                       (0xFF000000)
167#define FCP_TARGET_CSCTL_SHIFT                      (24)
168#define FCP_TARGET_FCTL_MASK                        (0x00FFFFFF)
169#define FCP_TARGET_FCTL_SHIFT                       (0)
170#define FCP_TARGET_TYPE_MASK                        (0xFF000000)
171#define FCP_TARGET_TYPE_SHIFT                       (24)
172
173
174/****************************************************************************/
175/* Link Service Response messages                                           */
176/****************************************************************************/
177
178typedef struct _MSG_LINK_SERVICE_RSP_REQUEST
179{
180    U8                      RspFlags;           /* 00h */
181    U8                      RspLength;          /* 01h */
182    U8                      ChainOffset;        /* 02h */
183    U8                      Function;           /* 03h */
184    U16                     Reserved1;          /* 04h */
185    U8                      Reserved2;          /* 06h */
186    U8                      MsgFlags;           /* 07h */
187    U32                     MsgContext;         /* 08h */
188    U32                     Rctl_Did;           /* 0Ch */
189    U32                     Csctl_Sid;          /* 10h */
190    U32                     Type_Fctl;          /* 14h */
191    U16                     SeqCnt;             /* 18h */
192    U8                      Dfctl;              /* 1Ah */
193    U8                      SeqId;              /* 1Bh */
194    U16                     Rxid;               /* 1Ch */
195    U16                     Oxid;               /* 1Eh */
196    U32                     Parameter;          /* 20h */
197    SGE_SIMPLE_UNION        SGL;                /* 24h */
198} MSG_LINK_SERVICE_RSP_REQUEST, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REQUEST,
199  LinkServiceRspRequest_t, MPI_POINTER pLinkServiceRspRequest_t;
200
201#define LINK_SERVICE_RSP_FLAGS_IMMEDIATE        (0x80)
202#define LINK_SERVICE_RSP_FLAGS_PORT_MASK        (0x01)
203
204
205/* Link Service Response Reply  */
206typedef struct _MSG_LINK_SERVICE_RSP_REPLY
207{
208    U16                     Reserved;           /* 00h */
209    U8                      MsgLength;          /* 02h */
210    U8                      Function;           /* 03h */
211    U16                     Reserved1;          /* 04h */
212    U8                      Reserved_0100_InitiatorIndex; /* 06h */ /* obsolete InitiatorIndex */
213    U8                      MsgFlags;           /* 07h */
214    U32                     MsgContext;         /* 08h */
215    U16                     Reserved3;          /* 0Ch */
216    U16                     IOCStatus;          /* 0Eh */
217    U32                     IOCLogInfo;         /* 10h */
218    U32                     InitiatorIndex;     /* 14h */
219} MSG_LINK_SERVICE_RSP_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REPLY,
220  LinkServiceRspReply_t, MPI_POINTER pLinkServiceRspReply_t;
221
222
223/****************************************************************************/
224/* Extended Link Service Send messages                                      */
225/****************************************************************************/
226
227typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
228{
229    U8                      SendFlags;          /* 00h */
230    U8                      AliasIndex;         /* 01h */
231    U8                      ChainOffset;        /* 02h */
232    U8                      Function;           /* 03h */
233    U32                     MsgFlags_Did;       /* 04h */
234    U32                     MsgContext;         /* 08h */
235    U32                     ElsCommandCode;     /* 0Ch */
236    SGE_SIMPLE_UNION        SGL;                /* 10h */
237} MSG_EXLINK_SERVICE_SEND_REQUEST, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REQUEST,
238  ExLinkServiceSendRequest_t, MPI_POINTER pExLinkServiceSendRequest_t;
239
240#define EX_LINK_SERVICE_SEND_DID_MASK           (0x00FFFFFF)
241#define EX_LINK_SERVICE_SEND_DID_SHIFT          (0)
242#define EX_LINK_SERVICE_SEND_MSGFLAGS_MASK      (0xFF000000)
243#define EX_LINK_SERVICE_SEND_MSGFLAGS_SHIFT     (24)
244
245
246/* Extended Link Service Send Reply */
247typedef struct _MSG_EXLINK_SERVICE_SEND_REPLY
248{
249    U8                      Reserved;           /* 00h */
250    U8                      AliasIndex;         /* 01h */
251    U8                      MsgLength;          /* 02h */
252    U8                      Function;           /* 03h */
253    U16                     Reserved1;          /* 04h */
254    U8                      Reserved2;          /* 06h */
255    U8                      MsgFlags;           /* 07h */
256    U32                     MsgContext;         /* 08h */
257    U16                     Reserved3;          /* 0Ch */
258    U16                     IOCStatus;          /* 0Eh */
259    U32                     IOCLogInfo;         /* 10h */
260    U32                     ResponseLength;     /* 14h */
261} MSG_EXLINK_SERVICE_SEND_REPLY, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REPLY,
262  ExLinkServiceSendReply_t, MPI_POINTER pExLinkServiceSendReply_t;
263
264/****************************************************************************/
265/* FC Abort messages                                                        */
266/****************************************************************************/
267
268typedef struct _MSG_FC_ABORT_REQUEST
269{
270    U8                      AbortFlags;                 /* 00h */
271    U8                      AbortType;                  /* 01h */
272    U8                      ChainOffset;                /* 02h */
273    U8                      Function;                   /* 03h */
274    U16                     Reserved1;                  /* 04h */
275    U8                      Reserved2;                  /* 06h */
276    U8                      MsgFlags;                   /* 07h */
277    U32                     MsgContext;                 /* 08h */
278    U32                     TransactionContextToAbort;  /* 0Ch */
279} MSG_FC_ABORT_REQUEST, MPI_POINTER PTR_MSG_FC_ABORT_REQUEST,
280  FcAbortRequest_t, MPI_POINTER pFcAbortRequest_t;
281
282#define FC_ABORT_FLAG_PORT_MASK                 (0x01)
283
284#define FC_ABORT_TYPE_ALL_FC_BUFFERS            (0x00)
285#define FC_ABORT_TYPE_EXACT_FC_BUFFER           (0x01)
286#define FC_ABORT_TYPE_CT_SEND_REQUEST           (0x02)
287#define FC_ABORT_TYPE_EXLINKSEND_REQUEST        (0x03)
288
289/* FC Abort Reply */
290typedef struct _MSG_FC_ABORT_REPLY
291{
292    U16                     Reserved;           /* 00h */
293    U8                      MsgLength;          /* 02h */
294    U8                      Function;           /* 03h */
295    U16                     Reserved1;          /* 04h */
296    U8                      Reserved2;          /* 06h */
297    U8                      MsgFlags;           /* 07h */
298    U32                     MsgContext;         /* 08h */
299    U16                     Reserved3;          /* 0Ch */
300    U16                     IOCStatus;          /* 0Eh */
301    U32                     IOCLogInfo;         /* 10h */
302} MSG_FC_ABORT_REPLY, MPI_POINTER PTR_MSG_FC_ABORT_REPLY,
303  FcAbortReply_t, MPI_POINTER pFcAbortReply_t;
304
305
306/****************************************************************************/
307/* FC Common Transport Send messages                                        */
308/****************************************************************************/
309
310typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
311{
312    U8                      SendFlags;          /* 00h */
313    U8                      AliasIndex;         /* 01h */
314    U8                      ChainOffset;        /* 02h */
315    U8                      Function;           /* 03h */
316    U32                     MsgFlags_Did;       /* 04h */
317    U32                     MsgContext;         /* 08h */
318    U16                     CTCommandCode;      /* 0Ch */
319    U8                      FsType;             /* 0Eh */
320    U8                      Reserved1;          /* 0Fh */
321    SGE_SIMPLE_UNION        SGL;                /* 10h */
322} MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
323 MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
324  FcCommonTransportSendRequest_t, MPI_POINTER pFcCommonTransportSendRequest_t;
325
326#define MPI_FC_CT_SEND_DID_MASK                 (0x00FFFFFF)
327#define MPI_FC_CT_SEND_DID_SHIFT                (0)
328#define MPI_FC_CT_SEND_MSGFLAGS_MASK            (0xFF000000)
329#define MPI_FC_CT_SEND_MSGFLAGS_SHIFT           (24)
330
331
332/* FC Common Transport Send Reply */
333typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY
334{
335    U8                      Reserved;           /* 00h */
336    U8                      AliasIndex;         /* 01h */
337    U8                      MsgLength;          /* 02h */
338    U8                      Function;           /* 03h */
339    U16                     Reserved1;          /* 04h */
340    U8                      Reserved2;          /* 06h */
341    U8                      MsgFlags;           /* 07h */
342    U32                     MsgContext;         /* 08h */
343    U16                     Reserved3;          /* 0Ch */
344    U16                     IOCStatus;          /* 0Eh */
345    U32                     IOCLogInfo;         /* 10h */
346    U32                     ResponseLength;     /* 14h */
347} MSG_FC_COMMON_TRANSPORT_SEND_REPLY, MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REPLY,
348  FcCommonTransportSendReply_t, MPI_POINTER pFcCommonTransportSendReply_t;
349
350
351/****************************************************************************/
352/* FC Primitive Send messages                                               */
353/****************************************************************************/
354
355typedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST
356{
357    U8                      SendFlags;          /* 00h */
358    U8                      Reserved;           /* 01h */
359    U8                      ChainOffset;        /* 02h */
360    U8                      Function;           /* 03h */
361    U16                     Reserved1;          /* 04h */
362    U8                      Reserved2;          /* 06h */
363    U8                      MsgFlags;           /* 07h */
364    U32                     MsgContext;         /* 08h */
365    U8                      FcPrimitive[4];     /* 0Ch */
366} MSG_FC_PRIMITIVE_SEND_REQUEST, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REQUEST,
367  FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;
368
369#define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK       (0x01)
370#define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK   (0x02)
371#define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK      (0x04)
372#define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND       (0x08)
373#define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE       (0x10)
374#define MPI_FC_PRIM_SEND_FLAGS_SEND_AROUND     (0x20)
375#define MPI_FC_PRIM_SEND_FLAGS_UNTIL_FULL      (0x40)
376#define MPI_FC_PRIM_SEND_FLAGS_FOREVER         (0x80)
377
378/* FC Primitive Send Reply */
379typedef struct _MSG_FC_PRIMITIVE_SEND_REPLY
380{
381    U8                      SendFlags;          /* 00h */
382    U8                      Reserved;           /* 01h */
383    U8                      MsgLength;          /* 02h */
384    U8                      Function;           /* 03h */
385    U16                     Reserved1;          /* 04h */
386    U8                      Reserved2;          /* 06h */
387    U8                      MsgFlags;           /* 07h */
388    U32                     MsgContext;         /* 08h */
389    U16                     Reserved3;          /* 0Ch */
390    U16                     IOCStatus;          /* 0Eh */
391    U32                     IOCLogInfo;         /* 10h */
392} MSG_FC_PRIMITIVE_SEND_REPLY, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REPLY,
393  FcPrimitiveSendReply_t, MPI_POINTER pFcPrimitiveSendReply_t;
394
395#endif
396
397