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