1101704Smjacob/* $FreeBSD$ */
2139749Simp/*-
3233425Smarius * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
4147883Sscottl * All rights reserved.
5147883Sscottl *
6102599Smjacob * Redistribution and use in source and binary forms, with or without
7147883Sscottl * modification, are permitted provided that the following conditions are
8147883Sscottl * met:
9102599Smjacob * 1. Redistributions of source code must retain the above copyright
10147883Sscottl *    notice, this list of conditions and the following disclaimer.
11147883Sscottl * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12147883Sscottl *    substantially similar to the "NO WARRANTY" disclaimer below
13147883Sscottl *    ("Disclaimer") and any redistribution must be conditioned upon including
14147883Sscottl *    a substantially similar Disclaimer requirement for further binary
15147883Sscottl *    redistribution.
16147883Sscottl * 3. Neither the name of the LSI Logic Corporation nor the names of its
17147883Sscottl *    contributors may be used to endorse or promote products derived from
18147883Sscottl *    this software without specific prior written permission.
19147883Sscottl *
20147883Sscottl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21147883Sscottl * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22102599Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23147883Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24147883Sscottl * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25147883Sscottl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26147883Sscottl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27147883Sscottl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28147883Sscottl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29147883Sscottl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
30147883Sscottl * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31154603Smjacob *
32154603Smjacob *
33154603Smjacob *           Name:  mpi_lan.h
34101704Smjacob *          Title:  MPI LAN messages and structures
35101704Smjacob *  Creation Date:  June 30, 2000
36101704Smjacob *
37154603Smjacob *    mpi_lan.h Version:  01.05.01
38101704Smjacob *
39101704Smjacob *  Version History
40101704Smjacob *  ---------------
41101704Smjacob *
42101704Smjacob *  Date      Version   Description
43101704Smjacob *  --------  --------  ------------------------------------------------------
44101704Smjacob *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
45101704Smjacob *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.
46101704Smjacob *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.
47101704Smjacob *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.
48101704Smjacob *  06-06-00  01.00.01  Update version number for 1.0 release.
49101704Smjacob *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.
50101704Smjacob *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.
51101704Smjacob *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.
52101704Smjacob *                      Changed transaction context usage to bucket/buffer.
53101704Smjacob *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition
54101704Smjacob *                      to lan private header file
55101704Smjacob *  11-02-00  01.01.01  Original release for post 1.0 work
56101704Smjacob *  02-20-01  01.01.02  Started using MPI_POINTER.
57101704Smjacob *  03-27-01  01.01.03  Added structure offset comments.
58101704Smjacob *  08-08-01  01.02.01  Original release for v1.2 work.
59154603Smjacob *  05-11-04  01.03.01  Original release for MPI v1.3.
60154603Smjacob *  08-19-04  01.05.01  Original release for MPI v1.5.
61101704Smjacob *  --------------------------------------------------------------------------
62101704Smjacob */
63101704Smjacob
64101704Smjacob#ifndef MPI_LAN_H
65101704Smjacob#define MPI_LAN_H
66101704Smjacob
67101704Smjacob
68101704Smjacob/******************************************************************************
69101704Smjacob*
70101704Smjacob*               L A N    M e s s a g e s
71101704Smjacob*
72101704Smjacob*******************************************************************************/
73101704Smjacob
74101704Smjacob/* LANSend messages */
75101704Smjacob
76101704Smjacobtypedef struct _MSG_LAN_SEND_REQUEST
77101704Smjacob{
78101704Smjacob    U16                     Reserved;           /* 00h */
79101704Smjacob    U8                      ChainOffset;        /* 02h */
80101704Smjacob    U8                      Function;           /* 03h */
81101704Smjacob    U16                     Reserved2;          /* 04h */
82101704Smjacob    U8                      PortNumber;         /* 06h */
83101704Smjacob    U8                      MsgFlags;           /* 07h */
84101704Smjacob    U32                     MsgContext;         /* 08h */
85101704Smjacob    SGE_MPI_UNION           SG_List[1];         /* 0Ch */
86101704Smjacob} MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
87101704Smjacob  LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
88101704Smjacob
89101704Smjacob
90101704Smjacobtypedef struct _MSG_LAN_SEND_REPLY
91101704Smjacob{
92101704Smjacob    U16                     Reserved;           /* 00h */
93101704Smjacob    U8                      MsgLength;          /* 02h */
94101704Smjacob    U8                      Function;           /* 03h */
95101704Smjacob    U8                      Reserved2;          /* 04h */
96101704Smjacob    U8                      NumberOfContexts;   /* 05h */
97101704Smjacob    U8                      PortNumber;         /* 06h */
98101704Smjacob    U8                      MsgFlags;           /* 07h */
99101704Smjacob    U32                     MsgContext;         /* 08h */
100101704Smjacob    U16                     Reserved3;          /* 0Ch */
101101704Smjacob    U16                     IOCStatus;          /* 0Eh */
102101704Smjacob    U32                     IOCLogInfo;         /* 10h */
103101704Smjacob    U32                     BufferContext;      /* 14h */
104101704Smjacob} MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
105101704Smjacob  LANSendReply_t, MPI_POINTER pLANSendReply_t;
106101704Smjacob
107101704Smjacob
108101704Smjacob/* LANReceivePost */
109101704Smjacob
110101704Smjacobtypedef struct _MSG_LAN_RECEIVE_POST_REQUEST
111101704Smjacob{
112101704Smjacob    U16                     Reserved;           /* 00h */
113101704Smjacob    U8                      ChainOffset;        /* 02h */
114101704Smjacob    U8                      Function;           /* 03h */
115101704Smjacob    U16                     Reserved2;          /* 04h */
116101704Smjacob    U8                      PortNumber;         /* 06h */
117101704Smjacob    U8                      MsgFlags;           /* 07h */
118101704Smjacob    U32                     MsgContext;         /* 08h */
119101704Smjacob    U32                     BucketCount;        /* 0Ch */
120101704Smjacob    SGE_MPI_UNION           SG_List[1];         /* 10h */
121101704Smjacob} MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
122101704Smjacob  LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
123101704Smjacob
124101704Smjacob
125101704Smjacobtypedef struct _MSG_LAN_RECEIVE_POST_REPLY
126101704Smjacob{
127101704Smjacob    U16                     Reserved;           /* 00h */
128101704Smjacob    U8                      MsgLength;          /* 02h */
129101704Smjacob    U8                      Function;           /* 03h */
130101704Smjacob    U8                      Reserved2;          /* 04h */
131101704Smjacob    U8                      NumberOfContexts;   /* 05h */
132101704Smjacob    U8                      PortNumber;         /* 06h */
133101704Smjacob    U8                      MsgFlags;           /* 07h */
134101704Smjacob    U32                     MsgContext;         /* 08h */
135101704Smjacob    U16                     Reserved3;          /* 0Ch */
136101704Smjacob    U16                     IOCStatus;          /* 0Eh */
137101704Smjacob    U32                     IOCLogInfo;         /* 10h */
138101704Smjacob    U32                     BucketsRemaining;   /* 14h */
139101704Smjacob    U32                     PacketOffset;       /* 18h */
140101704Smjacob    U32                     PacketLength;       /* 1Ch */
141101704Smjacob    U32                     BucketContext[1];   /* 20h */
142101704Smjacob} MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
143101704Smjacob  LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
144101704Smjacob
145101704Smjacob
146101704Smjacob/* LANReset */
147101704Smjacob
148101704Smjacobtypedef struct _MSG_LAN_RESET_REQUEST
149101704Smjacob{
150101704Smjacob    U16                     Reserved;           /* 00h */
151101704Smjacob    U8                      ChainOffset;        /* 02h */
152101704Smjacob    U8                      Function;           /* 03h */
153101704Smjacob    U16                     Reserved2;          /* 04h */
154101704Smjacob    U8                      PortNumber;         /* 05h */
155101704Smjacob    U8                      MsgFlags;           /* 07h */
156101704Smjacob    U32                     MsgContext;         /* 08h */
157101704Smjacob} MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
158101704Smjacob  LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
159101704Smjacob
160101704Smjacob
161101704Smjacobtypedef struct _MSG_LAN_RESET_REPLY
162101704Smjacob{
163101704Smjacob    U16                     Reserved;           /* 00h */
164101704Smjacob    U8                      MsgLength;          /* 02h */
165101704Smjacob    U8                      Function;           /* 03h */
166101704Smjacob    U16                     Reserved2;          /* 04h */
167101704Smjacob    U8                      PortNumber;         /* 06h */
168101704Smjacob    U8                      MsgFlags;           /* 07h */
169101704Smjacob    U32                     MsgContext;         /* 08h */
170101704Smjacob    U16                     Reserved3;          /* 0Ch */
171101704Smjacob    U16                     IOCStatus;          /* 0Eh */
172101704Smjacob    U32                     IOCLogInfo;         /* 10h */
173101704Smjacob} MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
174101704Smjacob  LANResetReply_t, MPI_POINTER pLANResetReply_t;
175101704Smjacob
176101704Smjacob
177101704Smjacob/****************************************************************************/
178101704Smjacob/* LAN Context Reply defines and macros                                     */
179101704Smjacob/****************************************************************************/
180101704Smjacob
181101704Smjacob#define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
182101704Smjacob#define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
183101704Smjacob#define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
184101704Smjacob#define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
185101704Smjacob#define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
186101704Smjacob#define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
187101704Smjacob#define LAN_REPLY_FORM_MASK                     (0x18000000)
188101704Smjacob#define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
189101704Smjacob#define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
190101704Smjacob#define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
191101704Smjacob#define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
192101704Smjacob#define LAN_REPLY_FORM_SHIFT                    (27)
193101704Smjacob
194101704Smjacob#define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
195101704Smjacob                                        >> LAN_REPLY_PACKET_LENGTH_SHIFT)
196101704Smjacob
197101704Smjacob#define SET_LAN_PACKET_LENGTH(x, lth)                                       \
198101704Smjacob            ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
199101704Smjacob                            (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
200101704Smjacob                                        LAN_REPLY_PACKET_LENGTH_MASK))
201101704Smjacob
202101704Smjacob#define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
203101704Smjacob                                        >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
204101704Smjacob
205101704Smjacob#define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
206101704Smjacob            ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
207101704Smjacob                            (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
208101704Smjacob                                        LAN_REPLY_BUCKET_CONTEXT_MASK))
209101704Smjacob
210101704Smjacob#define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
211101704Smjacob                                        >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
212101704Smjacob
213101704Smjacob#define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
214101704Smjacob            ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
215101704Smjacob                            (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
216101704Smjacob                                        LAN_REPLY_BUFFER_CONTEXT_MASK))
217101704Smjacob
218101704Smjacob#define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
219101704Smjacob                                        >> LAN_REPLY_FORM_SHIFT)
220101704Smjacob
221101704Smjacob#define SET_LAN_FORM(x, frm)                                                \
222101704Smjacob            ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
223101704Smjacob                            (((frm) << LAN_REPLY_FORM_SHIFT) &              \
224101704Smjacob                                        LAN_REPLY_FORM_MASK))
225101704Smjacob
226101704Smjacob
227101704Smjacob/****************************************************************************/
228101704Smjacob/* LAN Current Device State defines                                         */
229101704Smjacob/****************************************************************************/
230101704Smjacob
231101704Smjacob#define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
232101704Smjacob#define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
233101704Smjacob
234101704Smjacob
235101704Smjacob/****************************************************************************/
236101704Smjacob/* LAN Loopback defines                                                     */
237101704Smjacob/****************************************************************************/
238101704Smjacob
239101704Smjacob#define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
240101704Smjacob
241101704Smjacob#endif
242101704Smjacob
243