xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
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 *               L A N    M e s s a g e s
72 *
73 *******************************************************************************/
74 
75 /* LANSend messages */
76 
77 typedef struct _MSG_LAN_SEND_REQUEST
78 {
79     U16                     Reserved;           /* 00h */
80     U8                      ChainOffset;        /* 02h */
81     U8                      Function;           /* 03h */
82     U16                     Reserved2;          /* 04h */
83     U8                      PortNumber;         /* 06h */
84     U8                      MsgFlags;           /* 07h */
85     U32                     MsgContext;         /* 08h */
86     SGE_MPI_UNION           SG_List[1];         /* 0Ch */
87 } MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
88   LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
89 
90 typedef struct _MSG_LAN_SEND_REPLY
91 {
92     U16                     Reserved;           /* 00h */
93     U8                      MsgLength;          /* 02h */
94     U8                      Function;           /* 03h */
95     U8                      Reserved2;          /* 04h */
96     U8                      NumberOfContexts;   /* 05h */
97     U8                      PortNumber;         /* 06h */
98     U8                      MsgFlags;           /* 07h */
99     U32                     MsgContext;         /* 08h */
100     U16                     Reserved3;          /* 0Ch */
101     U16                     IOCStatus;          /* 0Eh */
102     U32                     IOCLogInfo;         /* 10h */
103     U32                     BufferContext;      /* 14h */
104 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
105   LANSendReply_t, MPI_POINTER pLANSendReply_t;
106 
107 /* LANReceivePost */
108 
109 typedef struct _MSG_LAN_RECEIVE_POST_REQUEST
110 {
111     U16                     Reserved;           /* 00h */
112     U8                      ChainOffset;        /* 02h */
113     U8                      Function;           /* 03h */
114     U16                     Reserved2;          /* 04h */
115     U8                      PortNumber;         /* 06h */
116     U8                      MsgFlags;           /* 07h */
117     U32                     MsgContext;         /* 08h */
118     U32                     BucketCount;        /* 0Ch */
119     SGE_MPI_UNION           SG_List[1];         /* 10h */
120 } MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
121   LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
122 
123 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
124 {
125     U16                     Reserved;           /* 00h */
126     U8                      MsgLength;          /* 02h */
127     U8                      Function;           /* 03h */
128     U8                      Reserved2;          /* 04h */
129     U8                      NumberOfContexts;   /* 05h */
130     U8                      PortNumber;         /* 06h */
131     U8                      MsgFlags;           /* 07h */
132     U32                     MsgContext;         /* 08h */
133     U16                     Reserved3;          /* 0Ch */
134     U16                     IOCStatus;          /* 0Eh */
135     U32                     IOCLogInfo;         /* 10h */
136     U32                     BucketsRemaining;   /* 14h */
137     U32                     PacketOffset;       /* 18h */
138     U32                     PacketLength;       /* 1Ch */
139     U32                     BucketContext[1];   /* 20h */
140 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
141   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
142 
143 /* LANReset */
144 
145 typedef struct _MSG_LAN_RESET_REQUEST
146 {
147     U16                     Reserved;           /* 00h */
148     U8                      ChainOffset;        /* 02h */
149     U8                      Function;           /* 03h */
150     U16                     Reserved2;          /* 04h */
151     U8                      PortNumber;         /* 05h */
152     U8                      MsgFlags;           /* 07h */
153     U32                     MsgContext;         /* 08h */
154 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
155   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
156 
157 typedef struct _MSG_LAN_RESET_REPLY
158 {
159     U16                     Reserved;           /* 00h */
160     U8                      MsgLength;          /* 02h */
161     U8                      Function;           /* 03h */
162     U16                     Reserved2;          /* 04h */
163     U8                      PortNumber;         /* 06h */
164     U8                      MsgFlags;           /* 07h */
165     U32                     MsgContext;         /* 08h */
166     U16                     Reserved3;          /* 0Ch */
167     U16                     IOCStatus;          /* 0Eh */
168     U32                     IOCLogInfo;         /* 10h */
169 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
170   LANResetReply_t, MPI_POINTER pLANResetReply_t;
171 
172 /****************************************************************************/
173 /* LAN Context Reply defines and macros                                     */
174 /****************************************************************************/
175 
176 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
177 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
178 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
179 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
180 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
181 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
182 #define LAN_REPLY_FORM_MASK                     (0x18000000)
183 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
184 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
185 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
186 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
187 #define LAN_REPLY_FORM_SHIFT                    (27)
188 
189 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
190                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
191 
192 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
193             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
194                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
195                                         LAN_REPLY_PACKET_LENGTH_MASK))
196 
197 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
198                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
199 
200 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
201             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
202                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
203                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
204 
205 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
206                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
207 
208 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
209             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
210                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
211                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
212 
213 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
214                                         >> LAN_REPLY_FORM_SHIFT)
215 
216 #define SET_LAN_FORM(x, frm)                                                \
217             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
218                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
219                                         LAN_REPLY_FORM_MASK))
220 
221 /****************************************************************************/
222 /* LAN Current Device State defines                                         */
223 /****************************************************************************/
224 
225 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
226 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
227 
228 /****************************************************************************/
229 /* LAN Loopback defines                                                     */
230 /****************************************************************************/
231 
232 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
233 
234 #endif
235