xref: /freebsd/sys/dev/mpt/mpilib/mpi_fc.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
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 *        F C    D i r e c t    A c c e s s     M e s s a g e s
81 *
82 *****************************************************************************/
83 
84 /****************************************************************************/
85 /* Link Service Buffer Post messages                                        */
86 /****************************************************************************/
87 
88 typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REQUEST
89 {
90     U8                      BufferPostFlags;    /* 00h */
91     U8                      BufferCount;        /* 01h */
92     U8                      ChainOffset;        /* 02h */
93     U8                      Function;           /* 03h */
94     U16                     Reserved;           /* 04h */
95     U8                      Reserved1;          /* 06h */
96     U8                      MsgFlags;           /* 07h */
97     U32                     MsgContext;         /* 08h */
98     SGE_TRANS_SIMPLE_UNION  SGL;
99 } MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
100  MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
101   LinkServiceBufferPostRequest_t, MPI_POINTER pLinkServiceBufferPostRequest_t;
102 
103 #define LINK_SERVICE_BUFFER_POST_FLAGS_PORT_MASK (0x01)
104 
105 typedef struct _WWNFORMAT
106 {
107     U32                     PortNameHigh;       /* 00h */
108     U32                     PortNameLow;        /* 04h */
109     U32                     NodeNameHigh;       /* 08h */
110     U32                     NodeNameLow;        /* 0Ch */
111 } WWNFORMAT,
112   WwnFormat_t;
113 
114 /* Link Service Buffer Post Reply */
115 typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REPLY
116 {
117     U8                      Flags;              /* 00h */
118     U8                      Reserved;           /* 01h */
119     U8                      MsgLength;          /* 02h */
120     U8                      Function;           /* 03h */
121     U16                     Reserved1;          /* 04h */
122     U8                      PortNumber;         /* 06h */
123     U8                      MsgFlags;           /* 07h */
124     U32                     MsgContext;         /* 08h */
125     U16                     Reserved2;          /* 0Ch */
126     U16                     IOCStatus;          /* 0Eh */
127     U32                     IOCLogInfo;         /* 10h */
128     U32                     TransferLength;     /* 14h */
129     U32                     TransactionContext; /* 18h */
130     U32                     Rctl_Did;           /* 1Ch */
131     U32                     Csctl_Sid;          /* 20h */
132     U32                     Type_Fctl;          /* 24h */
133     U16                     SeqCnt;             /* 28h */
134     U8                      Dfctl;              /* 2Ah */
135     U8                      SeqId;              /* 2Bh */
136     U16                     Rxid;               /* 2Ch */
137     U16                     Oxid;               /* 2Eh */
138     U32                     Parameter;          /* 30h */
139     WWNFORMAT               Wwn;                /* 34h */
140 } MSG_LINK_SERVICE_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REPLY,
141   LinkServiceBufferPostReply_t, MPI_POINTER pLinkServiceBufferPostReply_t;
142 
143 #define MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED    (0x80)
144 
145 #define MPI_FC_DID_MASK                             (0x00FFFFFF)
146 #define MPI_FC_DID_SHIFT                            (0)
147 #define MPI_FC_RCTL_MASK                            (0xFF000000)
148 #define MPI_FC_RCTL_SHIFT                           (24)
149 #define MPI_FC_SID_MASK                             (0x00FFFFFF)
150 #define MPI_FC_SID_SHIFT                            (0)
151 #define MPI_FC_CSCTL_MASK                           (0xFF000000)
152 #define MPI_FC_CSCTL_SHIFT                          (24)
153 #define MPI_FC_FCTL_MASK                            (0x00FFFFFF)
154 #define MPI_FC_FCTL_SHIFT                           (0)
155 #define MPI_FC_TYPE_MASK                            (0xFF000000)
156 #define MPI_FC_TYPE_SHIFT                           (24)
157 
158 /* obsolete name for the above */
159 #define FCP_TARGET_DID_MASK                         (0x00FFFFFF)
160 #define FCP_TARGET_DID_SHIFT                        (0)
161 #define FCP_TARGET_RCTL_MASK                        (0xFF000000)
162 #define FCP_TARGET_RCTL_SHIFT                       (24)
163 #define FCP_TARGET_SID_MASK                         (0x00FFFFFF)
164 #define FCP_TARGET_SID_SHIFT                        (0)
165 #define FCP_TARGET_CSCTL_MASK                       (0xFF000000)
166 #define FCP_TARGET_CSCTL_SHIFT                      (24)
167 #define FCP_TARGET_FCTL_MASK                        (0x00FFFFFF)
168 #define FCP_TARGET_FCTL_SHIFT                       (0)
169 #define FCP_TARGET_TYPE_MASK                        (0xFF000000)
170 #define FCP_TARGET_TYPE_SHIFT                       (24)
171 
172 /****************************************************************************/
173 /* Link Service Response messages                                           */
174 /****************************************************************************/
175 
176 typedef struct _MSG_LINK_SERVICE_RSP_REQUEST
177 {
178     U8                      RspFlags;           /* 00h */
179     U8                      RspLength;          /* 01h */
180     U8                      ChainOffset;        /* 02h */
181     U8                      Function;           /* 03h */
182     U16                     Reserved1;          /* 04h */
183     U8                      Reserved2;          /* 06h */
184     U8                      MsgFlags;           /* 07h */
185     U32                     MsgContext;         /* 08h */
186     U32                     Rctl_Did;           /* 0Ch */
187     U32                     Csctl_Sid;          /* 10h */
188     U32                     Type_Fctl;          /* 14h */
189     U16                     SeqCnt;             /* 18h */
190     U8                      Dfctl;              /* 1Ah */
191     U8                      SeqId;              /* 1Bh */
192     U16                     Rxid;               /* 1Ch */
193     U16                     Oxid;               /* 1Eh */
194     U32                     Parameter;          /* 20h */
195     SGE_SIMPLE_UNION        SGL;                /* 24h */
196 } MSG_LINK_SERVICE_RSP_REQUEST, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REQUEST,
197   LinkServiceRspRequest_t, MPI_POINTER pLinkServiceRspRequest_t;
198 
199 #define LINK_SERVICE_RSP_FLAGS_IMMEDIATE        (0x80)
200 #define LINK_SERVICE_RSP_FLAGS_PORT_MASK        (0x01)
201 
202 /* Link Service Response Reply  */
203 typedef struct _MSG_LINK_SERVICE_RSP_REPLY
204 {
205     U16                     Reserved;           /* 00h */
206     U8                      MsgLength;          /* 02h */
207     U8                      Function;           /* 03h */
208     U16                     Reserved1;          /* 04h */
209     U8                      Reserved_0100_InitiatorIndex; /* 06h */ /* obsolete InitiatorIndex */
210     U8                      MsgFlags;           /* 07h */
211     U32                     MsgContext;         /* 08h */
212     U16                     Reserved3;          /* 0Ch */
213     U16                     IOCStatus;          /* 0Eh */
214     U32                     IOCLogInfo;         /* 10h */
215     U32                     InitiatorIndex;     /* 14h */
216 } MSG_LINK_SERVICE_RSP_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REPLY,
217   LinkServiceRspReply_t, MPI_POINTER pLinkServiceRspReply_t;
218 
219 /****************************************************************************/
220 /* Extended Link Service Send messages                                      */
221 /****************************************************************************/
222 
223 typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
224 {
225     U8                      SendFlags;          /* 00h */
226     U8                      AliasIndex;         /* 01h */
227     U8                      ChainOffset;        /* 02h */
228     U8                      Function;           /* 03h */
229     U32                     MsgFlags_Did;       /* 04h */
230     U32                     MsgContext;         /* 08h */
231     U32                     ElsCommandCode;     /* 0Ch */
232     SGE_SIMPLE_UNION        SGL;                /* 10h */
233 } MSG_EXLINK_SERVICE_SEND_REQUEST, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REQUEST,
234   ExLinkServiceSendRequest_t, MPI_POINTER pExLinkServiceSendRequest_t;
235 
236 #define EX_LINK_SERVICE_SEND_DID_MASK           (0x00FFFFFF)
237 #define EX_LINK_SERVICE_SEND_DID_SHIFT          (0)
238 #define EX_LINK_SERVICE_SEND_MSGFLAGS_MASK      (0xFF000000)
239 #define EX_LINK_SERVICE_SEND_MSGFLAGS_SHIFT     (24)
240 
241 /* Extended Link Service Send Reply */
242 typedef struct _MSG_EXLINK_SERVICE_SEND_REPLY
243 {
244     U8                      Reserved;           /* 00h */
245     U8                      AliasIndex;         /* 01h */
246     U8                      MsgLength;          /* 02h */
247     U8                      Function;           /* 03h */
248     U16                     Reserved1;          /* 04h */
249     U8                      Reserved2;          /* 06h */
250     U8                      MsgFlags;           /* 07h */
251     U32                     MsgContext;         /* 08h */
252     U16                     Reserved3;          /* 0Ch */
253     U16                     IOCStatus;          /* 0Eh */
254     U32                     IOCLogInfo;         /* 10h */
255     U32                     ResponseLength;     /* 14h */
256 } MSG_EXLINK_SERVICE_SEND_REPLY, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REPLY,
257   ExLinkServiceSendReply_t, MPI_POINTER pExLinkServiceSendReply_t;
258 
259 /****************************************************************************/
260 /* FC Abort messages                                                        */
261 /****************************************************************************/
262 
263 typedef struct _MSG_FC_ABORT_REQUEST
264 {
265     U8                      AbortFlags;                 /* 00h */
266     U8                      AbortType;                  /* 01h */
267     U8                      ChainOffset;                /* 02h */
268     U8                      Function;                   /* 03h */
269     U16                     Reserved1;                  /* 04h */
270     U8                      Reserved2;                  /* 06h */
271     U8                      MsgFlags;                   /* 07h */
272     U32                     MsgContext;                 /* 08h */
273     U32                     TransactionContextToAbort;  /* 0Ch */
274 } MSG_FC_ABORT_REQUEST, MPI_POINTER PTR_MSG_FC_ABORT_REQUEST,
275   FcAbortRequest_t, MPI_POINTER pFcAbortRequest_t;
276 
277 #define FC_ABORT_FLAG_PORT_MASK                 (0x01)
278 
279 #define FC_ABORT_TYPE_ALL_FC_BUFFERS            (0x00)
280 #define FC_ABORT_TYPE_EXACT_FC_BUFFER           (0x01)
281 #define FC_ABORT_TYPE_CT_SEND_REQUEST           (0x02)
282 #define FC_ABORT_TYPE_EXLINKSEND_REQUEST        (0x03)
283 
284 /* FC Abort Reply */
285 typedef struct _MSG_FC_ABORT_REPLY
286 {
287     U16                     Reserved;           /* 00h */
288     U8                      MsgLength;          /* 02h */
289     U8                      Function;           /* 03h */
290     U16                     Reserved1;          /* 04h */
291     U8                      Reserved2;          /* 06h */
292     U8                      MsgFlags;           /* 07h */
293     U32                     MsgContext;         /* 08h */
294     U16                     Reserved3;          /* 0Ch */
295     U16                     IOCStatus;          /* 0Eh */
296     U32                     IOCLogInfo;         /* 10h */
297 } MSG_FC_ABORT_REPLY, MPI_POINTER PTR_MSG_FC_ABORT_REPLY,
298   FcAbortReply_t, MPI_POINTER pFcAbortReply_t;
299 
300 /****************************************************************************/
301 /* FC Common Transport Send messages                                        */
302 /****************************************************************************/
303 
304 typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
305 {
306     U8                      SendFlags;          /* 00h */
307     U8                      AliasIndex;         /* 01h */
308     U8                      ChainOffset;        /* 02h */
309     U8                      Function;           /* 03h */
310     U32                     MsgFlags_Did;       /* 04h */
311     U32                     MsgContext;         /* 08h */
312     U16                     CTCommandCode;      /* 0Ch */
313     U8                      FsType;             /* 0Eh */
314     U8                      Reserved1;          /* 0Fh */
315     SGE_SIMPLE_UNION        SGL;                /* 10h */
316 } MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
317  MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
318   FcCommonTransportSendRequest_t, MPI_POINTER pFcCommonTransportSendRequest_t;
319 
320 #define MPI_FC_CT_SEND_DID_MASK                 (0x00FFFFFF)
321 #define MPI_FC_CT_SEND_DID_SHIFT                (0)
322 #define MPI_FC_CT_SEND_MSGFLAGS_MASK            (0xFF000000)
323 #define MPI_FC_CT_SEND_MSGFLAGS_SHIFT           (24)
324 
325 /* FC Common Transport Send Reply */
326 typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY
327 {
328     U8                      Reserved;           /* 00h */
329     U8                      AliasIndex;         /* 01h */
330     U8                      MsgLength;          /* 02h */
331     U8                      Function;           /* 03h */
332     U16                     Reserved1;          /* 04h */
333     U8                      Reserved2;          /* 06h */
334     U8                      MsgFlags;           /* 07h */
335     U32                     MsgContext;         /* 08h */
336     U16                     Reserved3;          /* 0Ch */
337     U16                     IOCStatus;          /* 0Eh */
338     U32                     IOCLogInfo;         /* 10h */
339     U32                     ResponseLength;     /* 14h */
340 } MSG_FC_COMMON_TRANSPORT_SEND_REPLY, MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REPLY,
341   FcCommonTransportSendReply_t, MPI_POINTER pFcCommonTransportSendReply_t;
342 
343 /****************************************************************************/
344 /* FC Primitive Send messages                                               */
345 /****************************************************************************/
346 
347 typedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST
348 {
349     U8                      SendFlags;          /* 00h */
350     U8                      Reserved;           /* 01h */
351     U8                      ChainOffset;        /* 02h */
352     U8                      Function;           /* 03h */
353     U16                     Reserved1;          /* 04h */
354     U8                      Reserved2;          /* 06h */
355     U8                      MsgFlags;           /* 07h */
356     U32                     MsgContext;         /* 08h */
357     U8                      FcPrimitive[4];     /* 0Ch */
358 } MSG_FC_PRIMITIVE_SEND_REQUEST, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REQUEST,
359   FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;
360 
361 #define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK       (0x01)
362 #define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK   (0x02)
363 #define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK      (0x04)
364 #define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND       (0x08)
365 #define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE       (0x10)
366 #define MPI_FC_PRIM_SEND_FLAGS_SEND_AROUND     (0x20)
367 #define MPI_FC_PRIM_SEND_FLAGS_UNTIL_FULL      (0x40)
368 #define MPI_FC_PRIM_SEND_FLAGS_FOREVER         (0x80)
369 
370 /* FC Primitive Send Reply */
371 typedef struct _MSG_FC_PRIMITIVE_SEND_REPLY
372 {
373     U8                      SendFlags;          /* 00h */
374     U8                      Reserved;           /* 01h */
375     U8                      MsgLength;          /* 02h */
376     U8                      Function;           /* 03h */
377     U16                     Reserved1;          /* 04h */
378     U8                      Reserved2;          /* 06h */
379     U8                      MsgFlags;           /* 07h */
380     U32                     MsgContext;         /* 08h */
381     U16                     Reserved3;          /* 0Ch */
382     U16                     IOCStatus;          /* 0Eh */
383     U32                     IOCLogInfo;         /* 10h */
384 } MSG_FC_PRIMITIVE_SEND_REPLY, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REPLY,
385   FcPrimitiveSendReply_t, MPI_POINTER pFcPrimitiveSendReply_t;
386 
387 #endif
388