xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision 0957b409)
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_lan.h
36  *          Title:  MPI LAN messages and structures
37  *  Creation Date:  June 30, 2000
38  *
39  *    mpi_lan.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  *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.
48  *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.
49  *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.
50  *  06-06-00  01.00.01  Update version number for 1.0 release.
51  *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.
52  *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.
53  *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.
54  *                      Changed transaction context usage to bucket/buffer.
55  *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition
56  *                      to lan private header file
57  *  11-02-00  01.01.01  Original release for post 1.0 work
58  *  02-20-01  01.01.02  Started using MPI_POINTER.
59  *  03-27-01  01.01.03  Added structure offset comments.
60  *  08-08-01  01.02.01  Original release for v1.2 work.
61  *  05-11-04  01.03.01  Original release for MPI v1.3.
62  *  08-19-04  01.05.01  Original release for MPI v1.5.
63  *  --------------------------------------------------------------------------
64  */
65 
66 #ifndef MPI_LAN_H
67 #define MPI_LAN_H
68 
69 
70 /******************************************************************************
71 *
72 *               L A N    M e s s a g e s
73 *
74 *******************************************************************************/
75 
76 /* LANSend messages */
77 
78 typedef struct _MSG_LAN_SEND_REQUEST
79 {
80     U16                     Reserved;           /* 00h */
81     U8                      ChainOffset;        /* 02h */
82     U8                      Function;           /* 03h */
83     U16                     Reserved2;          /* 04h */
84     U8                      PortNumber;         /* 06h */
85     U8                      MsgFlags;           /* 07h */
86     U32                     MsgContext;         /* 08h */
87     SGE_MPI_UNION           SG_List[1];         /* 0Ch */
88 } MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
89   LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
90 
91 
92 typedef struct _MSG_LAN_SEND_REPLY
93 {
94     U16                     Reserved;           /* 00h */
95     U8                      MsgLength;          /* 02h */
96     U8                      Function;           /* 03h */
97     U8                      Reserved2;          /* 04h */
98     U8                      NumberOfContexts;   /* 05h */
99     U8                      PortNumber;         /* 06h */
100     U8                      MsgFlags;           /* 07h */
101     U32                     MsgContext;         /* 08h */
102     U16                     Reserved3;          /* 0Ch */
103     U16                     IOCStatus;          /* 0Eh */
104     U32                     IOCLogInfo;         /* 10h */
105     U32                     BufferContext;      /* 14h */
106 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
107   LANSendReply_t, MPI_POINTER pLANSendReply_t;
108 
109 
110 /* LANReceivePost */
111 
112 typedef struct _MSG_LAN_RECEIVE_POST_REQUEST
113 {
114     U16                     Reserved;           /* 00h */
115     U8                      ChainOffset;        /* 02h */
116     U8                      Function;           /* 03h */
117     U16                     Reserved2;          /* 04h */
118     U8                      PortNumber;         /* 06h */
119     U8                      MsgFlags;           /* 07h */
120     U32                     MsgContext;         /* 08h */
121     U32                     BucketCount;        /* 0Ch */
122     SGE_MPI_UNION           SG_List[1];         /* 10h */
123 } MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
124   LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
125 
126 
127 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
128 {
129     U16                     Reserved;           /* 00h */
130     U8                      MsgLength;          /* 02h */
131     U8                      Function;           /* 03h */
132     U8                      Reserved2;          /* 04h */
133     U8                      NumberOfContexts;   /* 05h */
134     U8                      PortNumber;         /* 06h */
135     U8                      MsgFlags;           /* 07h */
136     U32                     MsgContext;         /* 08h */
137     U16                     Reserved3;          /* 0Ch */
138     U16                     IOCStatus;          /* 0Eh */
139     U32                     IOCLogInfo;         /* 10h */
140     U32                     BucketsRemaining;   /* 14h */
141     U32                     PacketOffset;       /* 18h */
142     U32                     PacketLength;       /* 1Ch */
143     U32                     BucketContext[1];   /* 20h */
144 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
145   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
146 
147 
148 /* LANReset */
149 
150 typedef struct _MSG_LAN_RESET_REQUEST
151 {
152     U16                     Reserved;           /* 00h */
153     U8                      ChainOffset;        /* 02h */
154     U8                      Function;           /* 03h */
155     U16                     Reserved2;          /* 04h */
156     U8                      PortNumber;         /* 05h */
157     U8                      MsgFlags;           /* 07h */
158     U32                     MsgContext;         /* 08h */
159 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
160   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
161 
162 
163 typedef struct _MSG_LAN_RESET_REPLY
164 {
165     U16                     Reserved;           /* 00h */
166     U8                      MsgLength;          /* 02h */
167     U8                      Function;           /* 03h */
168     U16                     Reserved2;          /* 04h */
169     U8                      PortNumber;         /* 06h */
170     U8                      MsgFlags;           /* 07h */
171     U32                     MsgContext;         /* 08h */
172     U16                     Reserved3;          /* 0Ch */
173     U16                     IOCStatus;          /* 0Eh */
174     U32                     IOCLogInfo;         /* 10h */
175 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
176   LANResetReply_t, MPI_POINTER pLANResetReply_t;
177 
178 
179 /****************************************************************************/
180 /* LAN Context Reply defines and macros                                     */
181 /****************************************************************************/
182 
183 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
184 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
185 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
186 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
187 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
188 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
189 #define LAN_REPLY_FORM_MASK                     (0x18000000)
190 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
191 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
192 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
193 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
194 #define LAN_REPLY_FORM_SHIFT                    (27)
195 
196 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
197                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
198 
199 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
200             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
201                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
202                                         LAN_REPLY_PACKET_LENGTH_MASK))
203 
204 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
205                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
206 
207 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
208             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
209                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
210                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
211 
212 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
213                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
214 
215 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
216             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
217                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
218                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
219 
220 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
221                                         >> LAN_REPLY_FORM_SHIFT)
222 
223 #define SET_LAN_FORM(x, frm)                                                \
224             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
225                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
226                                         LAN_REPLY_FORM_MASK))
227 
228 
229 /****************************************************************************/
230 /* LAN Current Device State defines                                         */
231 /****************************************************************************/
232 
233 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
234 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
235 
236 
237 /****************************************************************************/
238 /* LAN Loopback defines                                                     */
239 /****************************************************************************/
240 
241 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
242 
243 #endif
244 
245