xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision 6780ab54325a71e7e70112b11657973edde8655e)
1 /* $FreeBSD$ */
2 /*
3  * Copyright (c) 2000, 2001 by LSI Logic Corporation
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice immediately at the beginning of the file, without modification,
10  *    this list of conditions, and the following disclaimer.
11  * 2. The name of the author may not be used to endorse or promote products
12  *    derived from this software without specific prior written permission.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
18  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  *
27  *           Name:  MPI_LAN.H
28  *          Title:  MPI LAN messages and structures
29  *  Creation Date:  June 30, 2000
30  *
31  *    MPI Version:  01.02.01
32  *
33  *  Version History
34  *  ---------------
35  *
36  *  Date      Version   Description
37  *  --------  --------  ------------------------------------------------------
38  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
39  *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.
40  *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.
41  *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.
42  *  06-06-00  01.00.01  Update version number for 1.0 release.
43  *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.
44  *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.
45  *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.
46  *                      Changed transaction context usage to bucket/buffer.
47  *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition
48  *                      to lan private header file
49  *  11-02-00  01.01.01  Original release for post 1.0 work
50  *  02-20-01  01.01.02  Started using MPI_POINTER.
51  *  03-27-01  01.01.03  Added structure offset comments.
52  *  08-08-01  01.02.01  Original release for v1.2 work.
53  *  --------------------------------------------------------------------------
54  */
55 
56 #ifndef MPI_LAN_H
57 #define MPI_LAN_H
58 
59 
60 /******************************************************************************
61 *
62 *               L A N    M e s s a g e s
63 *
64 *******************************************************************************/
65 
66 /* LANSend messages */
67 
68 typedef struct _MSG_LAN_SEND_REQUEST
69 {
70     U16                     Reserved;           /* 00h */
71     U8                      ChainOffset;        /* 02h */
72     U8                      Function;           /* 03h */
73     U16                     Reserved2;          /* 04h */
74     U8                      PortNumber;         /* 06h */
75     U8                      MsgFlags;           /* 07h */
76     U32                     MsgContext;         /* 08h */
77     SGE_MPI_UNION           SG_List[1];         /* 0Ch */
78 } MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
79   LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
80 
81 
82 typedef struct _MSG_LAN_SEND_REPLY
83 {
84     U16                     Reserved;           /* 00h */
85     U8                      MsgLength;          /* 02h */
86     U8                      Function;           /* 03h */
87     U8                      Reserved2;          /* 04h */
88     U8                      NumberOfContexts;   /* 05h */
89     U8                      PortNumber;         /* 06h */
90     U8                      MsgFlags;           /* 07h */
91     U32                     MsgContext;         /* 08h */
92     U16                     Reserved3;          /* 0Ch */
93     U16                     IOCStatus;          /* 0Eh */
94     U32                     IOCLogInfo;         /* 10h */
95     U32                     BufferContext;      /* 14h */
96 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
97   LANSendReply_t, MPI_POINTER pLANSendReply_t;
98 
99 
100 /* LANReceivePost */
101 
102 typedef struct _MSG_LAN_RECEIVE_POST_REQUEST
103 {
104     U16                     Reserved;           /* 00h */
105     U8                      ChainOffset;        /* 02h */
106     U8                      Function;           /* 03h */
107     U16                     Reserved2;          /* 04h */
108     U8                      PortNumber;         /* 06h */
109     U8                      MsgFlags;           /* 07h */
110     U32                     MsgContext;         /* 08h */
111     U32                     BucketCount;        /* 0Ch */
112     SGE_MPI_UNION           SG_List[1];         /* 10h */
113 } MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
114   LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
115 
116 
117 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
118 {
119     U16                     Reserved;           /* 00h */
120     U8                      MsgLength;          /* 02h */
121     U8                      Function;           /* 03h */
122     U8                      Reserved2;          /* 04h */
123     U8                      NumberOfContexts;   /* 05h */
124     U8                      PortNumber;         /* 06h */
125     U8                      MsgFlags;           /* 07h */
126     U32                     MsgContext;         /* 08h */
127     U16                     Reserved3;          /* 0Ch */
128     U16                     IOCStatus;          /* 0Eh */
129     U32                     IOCLogInfo;         /* 10h */
130     U32                     BucketsRemaining;   /* 14h */
131     U32                     PacketOffset;       /* 18h */
132     U32                     PacketLength;       /* 1Ch */
133     U32                     BucketContext[1];   /* 20h */
134 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
135   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
136 
137 
138 /* LANReset */
139 
140 typedef struct _MSG_LAN_RESET_REQUEST
141 {
142     U16                     Reserved;           /* 00h */
143     U8                      ChainOffset;        /* 02h */
144     U8                      Function;           /* 03h */
145     U16                     Reserved2;          /* 04h */
146     U8                      PortNumber;         /* 05h */
147     U8                      MsgFlags;           /* 07h */
148     U32                     MsgContext;         /* 08h */
149 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
150   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
151 
152 
153 typedef struct _MSG_LAN_RESET_REPLY
154 {
155     U16                     Reserved;           /* 00h */
156     U8                      MsgLength;          /* 02h */
157     U8                      Function;           /* 03h */
158     U16                     Reserved2;          /* 04h */
159     U8                      PortNumber;         /* 06h */
160     U8                      MsgFlags;           /* 07h */
161     U32                     MsgContext;         /* 08h */
162     U16                     Reserved3;          /* 0Ch */
163     U16                     IOCStatus;          /* 0Eh */
164     U32                     IOCLogInfo;         /* 10h */
165 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
166   LANResetReply_t, MPI_POINTER pLANResetReply_t;
167 
168 
169 /****************************************************************************/
170 /* LAN Context Reply defines and macros                                     */
171 /****************************************************************************/
172 
173 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
174 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
175 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
176 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
177 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
178 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
179 #define LAN_REPLY_FORM_MASK                     (0x18000000)
180 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
181 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
182 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
183 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
184 #define LAN_REPLY_FORM_SHIFT                    (27)
185 
186 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
187                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
188 
189 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
190             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
191                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
192                                         LAN_REPLY_PACKET_LENGTH_MASK))
193 
194 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
195                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
196 
197 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
198             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
199                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
200                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
201 
202 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
203                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
204 
205 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
206             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
207                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
208                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
209 
210 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
211                                         >> LAN_REPLY_FORM_SHIFT)
212 
213 #define SET_LAN_FORM(x, frm)                                                \
214             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
215                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
216                                         LAN_REPLY_FORM_MASK))
217 
218 
219 /****************************************************************************/
220 /* LAN Current Device State defines                                         */
221 /****************************************************************************/
222 
223 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
224 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
225 
226 
227 /****************************************************************************/
228 /* LAN Loopback defines                                                     */
229 /****************************************************************************/
230 
231 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
232 
233 #endif
234 
235