1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 *  Copyright (c) 2000-2008 LSI Corporation.
4 *
5 *
6 *           Name:  mpi_fc.h
7 *          Title:  MPI Fibre Channel messages and structures
8 *  Creation Date:  June 12, 2000
9 *
10 *    mpi_fc.h Version:  01.05.01
11 *
12 *  Version History
13 *  ---------------
14 *
15 *  Date      Version   Description
16 *  --------  --------  ------------------------------------------------------
17 *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
18 *  06-06-00  01.00.01  Update version number for 1.0 release.
19 *  06-12-00  01.00.02  Added _MSG_FC_ABORT_REPLY structure.
20 *  11-02-00  01.01.01  Original release for post 1.0 work
21 *  12-04-00  01.01.02  Added messages for Common Transport Send and
22 *                      Primitive Send.
23 *  01-09-01  01.01.03  Modifed some of the new flags to have an MPI prefix
24 *                      and modified the FcPrimitiveSend flags.
25 *  01-25-01  01.01.04  Move InitiatorIndex in LinkServiceRsp reply to a larger
26 *                      field.
27 *                      Added FC_ABORT_TYPE_CT_SEND_REQUEST and
28 *                      FC_ABORT_TYPE_EXLINKSEND_REQUEST for FcAbort request.
29 *                      Added MPI_FC_PRIM_SEND_FLAGS_STOP_SEND.
30 *  02-20-01  01.01.05  Started using MPI_POINTER.
31 *  03-27-01  01.01.06  Added Flags field to MSG_LINK_SERVICE_BUFFER_POST_REPLY
32 *                      and defined MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED.
33 *                      Added MPI_FC_PRIM_SEND_FLAGS_RESET_LINK define.
34 *                      Added structure offset comments.
35 *  04-09-01  01.01.07  Added RspLength field to MSG_LINK_SERVICE_RSP_REQUEST.
36 *  08-08-01  01.02.01  Original release for v1.2 work.
37 *  09-28-01  01.02.02  Change name of reserved field in
38 *                      MSG_LINK_SERVICE_RSP_REPLY.
39 *  05-31-02  01.02.03  Adding AliasIndex to FC Direct Access requests.
40 *  01-16-04  01.02.04  Added define for MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK.
41 *  05-11-04  01.03.01  Original release for MPI v1.3.
42 *  08-19-04  01.05.01  Original release for MPI v1.5.
43 *  --------------------------------------------------------------------------
44 */
45
46#ifndef MPI_FC_H
47#define MPI_FC_H
48
49
50/*****************************************************************************
51*
52*        F C    D i r e c t    A c c e s s     M e s s a g e s
53*
54*****************************************************************************/
55
56/****************************************************************************/
57/* Link Service Buffer Post messages                                        */
58/****************************************************************************/
59
60typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REQUEST
61{
62    U8                      BufferPostFlags;    /* 00h */
63    U8                      BufferCount;        /* 01h */
64    U8                      ChainOffset;        /* 02h */
65    U8                      Function;           /* 03h */
66    U16                     Reserved;           /* 04h */
67    U8                      Reserved1;          /* 06h */
68    U8                      MsgFlags;           /* 07h */
69    U32                     MsgContext;         /* 08h */
70    SGE_TRANS_SIMPLE_UNION  SGL;
71} MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
72 MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
73  LinkServiceBufferPostRequest_t, MPI_POINTER pLinkServiceBufferPostRequest_t;
74
75#define LINK_SERVICE_BUFFER_POST_FLAGS_PORT_MASK (0x01)
76
77typedef struct _WWNFORMAT
78{
79    U32                     PortNameHigh;       /* 00h */
80    U32                     PortNameLow;        /* 04h */
81    U32                     NodeNameHigh;       /* 08h */
82    U32                     NodeNameLow;        /* 0Ch */
83} WWNFORMAT,
84  WwnFormat_t;
85
86/* Link Service Buffer Post Reply */
87typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REPLY
88{
89    U8                      Flags;              /* 00h */
90    U8                      Reserved;           /* 01h */
91    U8                      MsgLength;          /* 02h */
92    U8                      Function;           /* 03h */
93    U16                     Reserved1;          /* 04h */
94    U8                      PortNumber;         /* 06h */
95    U8                      MsgFlags;           /* 07h */
96    U32                     MsgContext;         /* 08h */
97    U16                     Reserved2;          /* 0Ch */
98    U16                     IOCStatus;          /* 0Eh */
99    U32                     IOCLogInfo;         /* 10h */
100    U32                     TransferLength;     /* 14h */
101    U32                     TransactionContext; /* 18h */
102    U32                     Rctl_Did;           /* 1Ch */
103    U32                     Csctl_Sid;          /* 20h */
104    U32                     Type_Fctl;          /* 24h */
105    U16                     SeqCnt;             /* 28h */
106    U8                      Dfctl;              /* 2Ah */
107    U8                      SeqId;              /* 2Bh */
108    U16                     Rxid;               /* 2Ch */
109    U16                     Oxid;               /* 2Eh */
110    U32                     Parameter;          /* 30h */
111    WWNFORMAT               Wwn;                /* 34h */
112} MSG_LINK_SERVICE_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REPLY,
113  LinkServiceBufferPostReply_t, MPI_POINTER pLinkServiceBufferPostReply_t;
114
115#define MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED    (0x80)
116
117#define MPI_FC_DID_MASK                             (0x00FFFFFF)
118#define MPI_FC_DID_SHIFT                            (0)
119#define MPI_FC_RCTL_MASK                            (0xFF000000)
120#define MPI_FC_RCTL_SHIFT                           (24)
121#define MPI_FC_SID_MASK                             (0x00FFFFFF)
122#define MPI_FC_SID_SHIFT                            (0)
123#define MPI_FC_CSCTL_MASK                           (0xFF000000)
124#define MPI_FC_CSCTL_SHIFT                          (24)
125#define MPI_FC_FCTL_MASK                            (0x00FFFFFF)
126#define MPI_FC_FCTL_SHIFT                           (0)
127#define MPI_FC_TYPE_MASK                            (0xFF000000)
128#define MPI_FC_TYPE_SHIFT                           (24)
129
130/* obsolete name for the above */
131#define FCP_TARGET_DID_MASK                         (0x00FFFFFF)
132#define FCP_TARGET_DID_SHIFT                        (0)
133#define FCP_TARGET_RCTL_MASK                        (0xFF000000)
134#define FCP_TARGET_RCTL_SHIFT                       (24)
135#define FCP_TARGET_SID_MASK                         (0x00FFFFFF)
136#define FCP_TARGET_SID_SHIFT                        (0)
137#define FCP_TARGET_CSCTL_MASK                       (0xFF000000)
138#define FCP_TARGET_CSCTL_SHIFT                      (24)
139#define FCP_TARGET_FCTL_MASK                        (0x00FFFFFF)
140#define FCP_TARGET_FCTL_SHIFT                       (0)
141#define FCP_TARGET_TYPE_MASK                        (0xFF000000)
142#define FCP_TARGET_TYPE_SHIFT                       (24)
143
144
145/****************************************************************************/
146/* Link Service Response messages                                           */
147/****************************************************************************/
148
149typedef struct _MSG_LINK_SERVICE_RSP_REQUEST
150{
151    U8                      RspFlags;           /* 00h */
152    U8                      RspLength;          /* 01h */
153    U8                      ChainOffset;        /* 02h */
154    U8                      Function;           /* 03h */
155    U16                     Reserved1;          /* 04h */
156    U8                      Reserved2;          /* 06h */
157    U8                      MsgFlags;           /* 07h */
158    U32                     MsgContext;         /* 08h */
159    U32                     Rctl_Did;           /* 0Ch */
160    U32                     Csctl_Sid;          /* 10h */
161    U32                     Type_Fctl;          /* 14h */
162    U16                     SeqCnt;             /* 18h */
163    U8                      Dfctl;              /* 1Ah */
164    U8                      SeqId;              /* 1Bh */
165    U16                     Rxid;               /* 1Ch */
166    U16                     Oxid;               /* 1Eh */
167    U32                     Parameter;          /* 20h */
168    SGE_SIMPLE_UNION        SGL;                /* 24h */
169} MSG_LINK_SERVICE_RSP_REQUEST, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REQUEST,
170  LinkServiceRspRequest_t, MPI_POINTER pLinkServiceRspRequest_t;
171
172#define LINK_SERVICE_RSP_FLAGS_IMMEDIATE        (0x80)
173#define LINK_SERVICE_RSP_FLAGS_PORT_MASK        (0x01)
174
175
176/* Link Service Response Reply  */
177typedef struct _MSG_LINK_SERVICE_RSP_REPLY
178{
179    U16                     Reserved;           /* 00h */
180    U8                      MsgLength;          /* 02h */
181    U8                      Function;           /* 03h */
182    U16                     Reserved1;          /* 04h */
183    U8                      Reserved_0100_InitiatorIndex; /* 06h */ /* obsolete InitiatorIndex */
184    U8                      MsgFlags;           /* 07h */
185    U32                     MsgContext;         /* 08h */
186    U16                     Reserved3;          /* 0Ch */
187    U16                     IOCStatus;          /* 0Eh */
188    U32                     IOCLogInfo;         /* 10h */
189    U32                     InitiatorIndex;     /* 14h */
190} MSG_LINK_SERVICE_RSP_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REPLY,
191  LinkServiceRspReply_t, MPI_POINTER pLinkServiceRspReply_t;
192
193
194/****************************************************************************/
195/* Extended Link Service Send messages                                      */
196/****************************************************************************/
197
198typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
199{
200    U8                      SendFlags;          /* 00h */
201    U8                      AliasIndex;         /* 01h */
202    U8                      ChainOffset;        /* 02h */
203    U8                      Function;           /* 03h */
204    U32                     MsgFlags_Did;       /* 04h */
205    U32                     MsgContext;         /* 08h */
206    U32                     ElsCommandCode;     /* 0Ch */
207    SGE_SIMPLE_UNION        SGL;                /* 10h */
208} MSG_EXLINK_SERVICE_SEND_REQUEST, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REQUEST,
209  ExLinkServiceSendRequest_t, MPI_POINTER pExLinkServiceSendRequest_t;
210
211#define EX_LINK_SERVICE_SEND_DID_MASK           (0x00FFFFFF)
212#define EX_LINK_SERVICE_SEND_DID_SHIFT          (0)
213#define EX_LINK_SERVICE_SEND_MSGFLAGS_MASK      (0xFF000000)
214#define EX_LINK_SERVICE_SEND_MSGFLAGS_SHIFT     (24)
215
216
217/* Extended Link Service Send Reply */
218typedef struct _MSG_EXLINK_SERVICE_SEND_REPLY
219{
220    U8                      Reserved;           /* 00h */
221    U8                      AliasIndex;         /* 01h */
222    U8                      MsgLength;          /* 02h */
223    U8                      Function;           /* 03h */
224    U16                     Reserved1;          /* 04h */
225    U8                      Reserved2;          /* 06h */
226    U8                      MsgFlags;           /* 07h */
227    U32                     MsgContext;         /* 08h */
228    U16                     Reserved3;          /* 0Ch */
229    U16                     IOCStatus;          /* 0Eh */
230    U32                     IOCLogInfo;         /* 10h */
231    U32                     ResponseLength;     /* 14h */
232} MSG_EXLINK_SERVICE_SEND_REPLY, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REPLY,
233  ExLinkServiceSendReply_t, MPI_POINTER pExLinkServiceSendReply_t;
234
235/****************************************************************************/
236/* FC Abort messages                                                        */
237/****************************************************************************/
238
239typedef struct _MSG_FC_ABORT_REQUEST
240{
241    U8                      AbortFlags;                 /* 00h */
242    U8                      AbortType;                  /* 01h */
243    U8                      ChainOffset;                /* 02h */
244    U8                      Function;                   /* 03h */
245    U16                     Reserved1;                  /* 04h */
246    U8                      Reserved2;                  /* 06h */
247    U8                      MsgFlags;                   /* 07h */
248    U32                     MsgContext;                 /* 08h */
249    U32                     TransactionContextToAbort;  /* 0Ch */
250} MSG_FC_ABORT_REQUEST, MPI_POINTER PTR_MSG_FC_ABORT_REQUEST,
251  FcAbortRequest_t, MPI_POINTER pFcAbortRequest_t;
252
253#define FC_ABORT_FLAG_PORT_MASK                 (0x01)
254
255#define FC_ABORT_TYPE_ALL_FC_BUFFERS            (0x00)
256#define FC_ABORT_TYPE_EXACT_FC_BUFFER           (0x01)
257#define FC_ABORT_TYPE_CT_SEND_REQUEST           (0x02)
258#define FC_ABORT_TYPE_EXLINKSEND_REQUEST        (0x03)
259
260/* FC Abort Reply */
261typedef struct _MSG_FC_ABORT_REPLY
262{
263    U16                     Reserved;           /* 00h */
264    U8                      MsgLength;          /* 02h */
265    U8                      Function;           /* 03h */
266    U16                     Reserved1;          /* 04h */
267    U8                      Reserved2;          /* 06h */
268    U8                      MsgFlags;           /* 07h */
269    U32                     MsgContext;         /* 08h */
270    U16                     Reserved3;          /* 0Ch */
271    U16                     IOCStatus;          /* 0Eh */
272    U32                     IOCLogInfo;         /* 10h */
273} MSG_FC_ABORT_REPLY, MPI_POINTER PTR_MSG_FC_ABORT_REPLY,
274  FcAbortReply_t, MPI_POINTER pFcAbortReply_t;
275
276
277/****************************************************************************/
278/* FC Common Transport Send messages                                        */
279/****************************************************************************/
280
281typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
282{
283    U8                      SendFlags;          /* 00h */
284    U8                      AliasIndex;         /* 01h */
285    U8                      ChainOffset;        /* 02h */
286    U8                      Function;           /* 03h */
287    U32                     MsgFlags_Did;       /* 04h */
288    U32                     MsgContext;         /* 08h */
289    U16                     CTCommandCode;      /* 0Ch */
290    U8                      FsType;             /* 0Eh */
291    U8                      Reserved1;          /* 0Fh */
292    SGE_SIMPLE_UNION        SGL;                /* 10h */
293} MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
294 MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
295  FcCommonTransportSendRequest_t, MPI_POINTER pFcCommonTransportSendRequest_t;
296
297#define MPI_FC_CT_SEND_DID_MASK                 (0x00FFFFFF)
298#define MPI_FC_CT_SEND_DID_SHIFT                (0)
299#define MPI_FC_CT_SEND_MSGFLAGS_MASK            (0xFF000000)
300#define MPI_FC_CT_SEND_MSGFLAGS_SHIFT           (24)
301
302
303/* FC Common Transport Send Reply */
304typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY
305{
306    U8                      Reserved;           /* 00h */
307    U8                      AliasIndex;         /* 01h */
308    U8                      MsgLength;          /* 02h */
309    U8                      Function;           /* 03h */
310    U16                     Reserved1;          /* 04h */
311    U8                      Reserved2;          /* 06h */
312    U8                      MsgFlags;           /* 07h */
313    U32                     MsgContext;         /* 08h */
314    U16                     Reserved3;          /* 0Ch */
315    U16                     IOCStatus;          /* 0Eh */
316    U32                     IOCLogInfo;         /* 10h */
317    U32                     ResponseLength;     /* 14h */
318} MSG_FC_COMMON_TRANSPORT_SEND_REPLY, MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REPLY,
319  FcCommonTransportSendReply_t, MPI_POINTER pFcCommonTransportSendReply_t;
320
321
322/****************************************************************************/
323/* FC Primitive Send messages                                               */
324/****************************************************************************/
325
326typedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST
327{
328    U8                      SendFlags;          /* 00h */
329    U8                      Reserved;           /* 01h */
330    U8                      ChainOffset;        /* 02h */
331    U8                      Function;           /* 03h */
332    U16                     Reserved1;          /* 04h */
333    U8                      Reserved2;          /* 06h */
334    U8                      MsgFlags;           /* 07h */
335    U32                     MsgContext;         /* 08h */
336    U8                      FcPrimitive[4];     /* 0Ch */
337} MSG_FC_PRIMITIVE_SEND_REQUEST, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REQUEST,
338  FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;
339
340#define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK       (0x01)
341#define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK   (0x02)
342#define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK      (0x04)
343#define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND       (0x08)
344#define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE       (0x10)
345#define MPI_FC_PRIM_SEND_FLAGS_SEND_AROUND     (0x20)
346#define MPI_FC_PRIM_SEND_FLAGS_UNTIL_FULL      (0x40)
347#define MPI_FC_PRIM_SEND_FLAGS_FOREVER         (0x80)
348
349/* FC Primitive Send Reply */
350typedef struct _MSG_FC_PRIMITIVE_SEND_REPLY
351{
352    U8                      SendFlags;          /* 00h */
353    U8                      Reserved;           /* 01h */
354    U8                      MsgLength;          /* 02h */
355    U8                      Function;           /* 03h */
356    U16                     Reserved1;          /* 04h */
357    U8                      Reserved2;          /* 06h */
358    U8                      MsgFlags;           /* 07h */
359    U32                     MsgContext;         /* 08h */
360    U16                     Reserved3;          /* 0Ch */
361    U16                     IOCStatus;          /* 0Eh */
362    U32                     IOCLogInfo;         /* 10h */
363} MSG_FC_PRIMITIVE_SEND_REPLY, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REPLY,
364  FcPrimitiveSendReply_t, MPI_POINTER pFcPrimitiveSendReply_t;
365
366#endif
367
368