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