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