xref: /freebsd/sys/dev/ic/i82586.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1963a0adeSRodney W. Grimes /*-
2*df57947fSPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
3*df57947fSPedro F. Giffuni  *
4963a0adeSRodney W. Grimes  * Copyright (c) 1992, University of Vermont and State Agricultural College.
5963a0adeSRodney W. Grimes  * Copyright (c) 1992, Garrett A. Wollman.
6963a0adeSRodney W. Grimes  * All rights reserved.
7963a0adeSRodney W. Grimes  *
8963a0adeSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9963a0adeSRodney W. Grimes  * modification, are permitted provided that the following conditions
10963a0adeSRodney W. Grimes  * are met:
11963a0adeSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12963a0adeSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13963a0adeSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14963a0adeSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15963a0adeSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16963a0adeSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
17963a0adeSRodney W. Grimes  *    must display the following acknowledgement:
18963a0adeSRodney W. Grimes  *	This product includes software developed by the University of
19963a0adeSRodney W. Grimes  *	Vermont and State Agricultural College and Garrett A. Wollman.
20963a0adeSRodney W. Grimes  * 4. Neither the name of the University nor the name of the author
21963a0adeSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
22963a0adeSRodney W. Grimes  *    without specific prior written permission.
23963a0adeSRodney W. Grimes  *
24963a0adeSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25963a0adeSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26963a0adeSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27963a0adeSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
28963a0adeSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29963a0adeSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30963a0adeSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31963a0adeSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32963a0adeSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33963a0adeSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34963a0adeSRodney W. Grimes  * SUCH DAMAGE.
35963a0adeSRodney W. Grimes  */
36963a0adeSRodney W. Grimes 
37963a0adeSRodney W. Grimes /*
38963a0adeSRodney W. Grimes  * Intel 82586 Ethernet chip
39963a0adeSRodney W. Grimes  * Register, bit, and structure definitions.
40963a0adeSRodney W. Grimes  *
41963a0adeSRodney W. Grimes  * Written by GAW with reference to the Clarkson Packet Driver code for this
42963a0adeSRodney W. Grimes  * chip written by Russ Nelson and others.
43963a0adeSRodney W. Grimes  */
44963a0adeSRodney W. Grimes 
45963a0adeSRodney W. Grimes struct ie_en_addr {
46963a0adeSRodney W. Grimes 	u_char data[6];
47963a0adeSRodney W. Grimes };
48963a0adeSRodney W. Grimes 
49963a0adeSRodney W. Grimes /*
50963a0adeSRodney W. Grimes  * This is the master configuration block.  It tells the hardware where all
51963a0adeSRodney W. Grimes  * the rest of the stuff is.
52963a0adeSRodney W. Grimes  */
53963a0adeSRodney W. Grimes struct ie_sys_conf_ptr {
54963a0adeSRodney W. Grimes 	u_short mbz;			/* must be zero */
55963a0adeSRodney W. Grimes 	u_char ie_bus_use;		/* true if 8-bit only */
56963a0adeSRodney W. Grimes 	u_char mbz2[5];			/* must be zero */
57963a0adeSRodney W. Grimes 	caddr_t ie_iscp_ptr;		/* 24-bit physaddr of ISCP */
58963a0adeSRodney W. Grimes };
59963a0adeSRodney W. Grimes 
60963a0adeSRodney W. Grimes /*
61963a0adeSRodney W. Grimes  * Note that this is wired in hardware; the SCP is always located here, no
62963a0adeSRodney W. Grimes  * matter what.
63963a0adeSRodney W. Grimes  */
64963a0adeSRodney W. Grimes #define IE_SCP_ADDR 0xfffff4
65963a0adeSRodney W. Grimes 
66963a0adeSRodney W. Grimes /*
67963a0adeSRodney W. Grimes  * The tells the hardware where all the rest of the stuff is, too.
68963a0adeSRodney W. Grimes  * FIXME: some of these should be re-commented after we figure out their
69963a0adeSRodney W. Grimes  * REAL function.
70963a0adeSRodney W. Grimes  */
71963a0adeSRodney W. Grimes struct ie_int_sys_conf_ptr {
72963a0adeSRodney W. Grimes 	u_char ie_busy;			/* zeroed after init */
73963a0adeSRodney W. Grimes 	u_char mbz;
74963a0adeSRodney W. Grimes 	u_short ie_scb_offset;		/* 16-bit physaddr of next struct */
75963a0adeSRodney W. Grimes 	caddr_t ie_base;		/* 24-bit physaddr for all 16-bit vars */
76963a0adeSRodney W. Grimes };
77963a0adeSRodney W. Grimes 
78963a0adeSRodney W. Grimes /*
79963a0adeSRodney W. Grimes  * This FINALLY tells the hardware what to do and where to put it.
80963a0adeSRodney W. Grimes  */
81963a0adeSRodney W. Grimes struct ie_sys_ctl_block {
82963a0adeSRodney W. Grimes 	u_short ie_status;		/* status word */
83963a0adeSRodney W. Grimes 	u_short ie_command;		/* command word */
84963a0adeSRodney W. Grimes 	u_short ie_command_list;	/* 16-pointer to command block list */
85963a0adeSRodney W. Grimes 	u_short ie_recv_list;		/* 16-pointer to receive frame list */
86963a0adeSRodney W. Grimes 	u_short ie_err_crc;		/* CRC errors */
87963a0adeSRodney W. Grimes 	u_short ie_err_align;		/* Alignment errors */
88963a0adeSRodney W. Grimes 	u_short ie_err_resource;	/* Resource errors */
89963a0adeSRodney W. Grimes 	u_short ie_err_overrun;		/* Overrun errors */
90963a0adeSRodney W. Grimes };
91963a0adeSRodney W. Grimes 
92963a0adeSRodney W. Grimes /* Command values */
93963a0adeSRodney W. Grimes #define IE_RU_COMMAND	0x0070	/* mask for RU command */
94963a0adeSRodney W. Grimes #define IE_RU_NOP	0	/* for completeness */
95963a0adeSRodney W. Grimes #define IE_RU_START	0x0010	/* start receive unit command */
96963a0adeSRodney W. Grimes #define IE_RU_ENABLE	0x0020	/* enable receiver command */
97963a0adeSRodney W. Grimes #define IE_RU_DISABLE	0x0030	/* disable receiver command */
98963a0adeSRodney W. Grimes #define IE_RU_ABORT	0x0040	/* abort current receive operation */
99963a0adeSRodney W. Grimes 
100963a0adeSRodney W. Grimes #define IE_CU_COMMAND	0x0700	/* mask for CU command */
101963a0adeSRodney W. Grimes #define IE_CU_NOP	0	/* included for completeness */
102963a0adeSRodney W. Grimes #define IE_CU_START	0x0100	/* do-command command */
103963a0adeSRodney W. Grimes #define IE_CU_RESUME	0x0200	/* resume a suspended cmd list */
104963a0adeSRodney W. Grimes #define IE_CU_STOP	0x0300	/* SUSPEND was already taken */
105963a0adeSRodney W. Grimes #define IE_CU_ABORT	0x0400	/* abort current command */
106963a0adeSRodney W. Grimes 
107963a0adeSRodney W. Grimes #define IE_ACK_COMMAND	0xf000	/* mask for ACK command */
108963a0adeSRodney W. Grimes #define IE_ACK_CX	0x8000	/* ack IE_ST_DONE */
109963a0adeSRodney W. Grimes #define IE_ACK_FR	0x4000	/* ack IE_ST_RECV */
110963a0adeSRodney W. Grimes #define IE_ACK_CNA	0x2000	/* ack IE_ST_ALLDONE */
111963a0adeSRodney W. Grimes #define IE_ACK_RNR	0x1000	/* ack IE_ST_RNR */
112963a0adeSRodney W. Grimes 
113963a0adeSRodney W. Grimes #define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
114963a0adeSRodney W. Grimes 				/* is this command an action command? */
115963a0adeSRodney W. Grimes 
116963a0adeSRodney W. Grimes /* Status values */
117963a0adeSRodney W. Grimes #define IE_ST_WHENCE	0xf000	/* mask for cause of interrupt */
118963a0adeSRodney W. Grimes #define IE_ST_DONE	0x8000	/* command with I bit completed */
119963a0adeSRodney W. Grimes #define IE_ST_RECV	0x4000	/* frame received */
120963a0adeSRodney W. Grimes #define IE_ST_ALLDONE	0x2000	/* all commands completed */
121963a0adeSRodney W. Grimes #define IE_ST_RNR	0x1000	/* receive not ready */
122963a0adeSRodney W. Grimes 
123963a0adeSRodney W. Grimes #define IE_CU_STATUS	0x700	/* mask for command unit status */
124963a0adeSRodney W. Grimes #define IE_CU_ACTIVE	0x200	/* command unit is active */
125963a0adeSRodney W. Grimes #define IE_CU_SUSPEND	0x100	/* command unit is suspended */
126963a0adeSRodney W. Grimes 
127963a0adeSRodney W. Grimes #define IE_RU_STATUS	0x70	/* mask for receiver unit status */
128963a0adeSRodney W. Grimes #define IE_RU_SUSPEND	0x10	/* receiver is suspended */
129963a0adeSRodney W. Grimes #define IE_RU_NOSPACE	0x20	/* receiver has no resources */
130963a0adeSRodney W. Grimes #define IE_RU_READY	0x40	/* reveiver is ready */
131963a0adeSRodney W. Grimes 
132963a0adeSRodney W. Grimes /*
133963a0adeSRodney W. Grimes  * This is filled in partially by the chip, partially by us.
134963a0adeSRodney W. Grimes  */
135963a0adeSRodney W. Grimes struct ie_recv_frame_desc {
136963a0adeSRodney W. Grimes 	u_short ie_fd_status;		/* status for this frame */
137963a0adeSRodney W. Grimes 	u_short ie_fd_last;		/* end of frame list flag */
138963a0adeSRodney W. Grimes 	u_short ie_fd_next;		/* 16-pointer to next RFD */
139963a0adeSRodney W. Grimes 	u_short ie_fd_buf_desc;		/* 16-pointer to list of buffer desc's */
140963a0adeSRodney W. Grimes 	struct ie_en_addr dest;		/* destination ether */
141963a0adeSRodney W. Grimes 	struct ie_en_addr src;		/* source ether */
142963a0adeSRodney W. Grimes 	u_short ie_length;		/* 802 length/Ether type */
143963a0adeSRodney W. Grimes 	u_short mbz;			/* must be zero */
144963a0adeSRodney W. Grimes };
145963a0adeSRodney W. Grimes 
146963a0adeSRodney W. Grimes #define IE_FD_LAST	0x8000	/* last rfd in list */
147963a0adeSRodney W. Grimes #define IE_FD_SUSP	0x4000	/* suspend RU after receipt */
148963a0adeSRodney W. Grimes 
149963a0adeSRodney W. Grimes #define IE_FD_COMPLETE	0x8000	/* frame is complete */
150963a0adeSRodney W. Grimes #define IE_FD_BUSY	0x4000	/* frame is busy */
151963a0adeSRodney W. Grimes #define IE_FD_OK	0x2000	/* frame is bad */
152963a0adeSRodney W. Grimes #define IE_FD_RNR	0x0200	/* receiver out of resources here */
153963a0adeSRodney W. Grimes 
154963a0adeSRodney W. Grimes /*
155963a0adeSRodney W. Grimes  * linked list of buffers...
156963a0adeSRodney W. Grimes  */
157963a0adeSRodney W. Grimes struct ie_recv_buf_desc {
158963a0adeSRodney W. Grimes 	u_short ie_rbd_actual;		/* status for this buffer */
159963a0adeSRodney W. Grimes 	u_short ie_rbd_next;		/* 16-pointer to next RBD */
160963a0adeSRodney W. Grimes 	caddr_t ie_rbd_buffer;		/* 24-pointer to buffer for this RBD */
161963a0adeSRodney W. Grimes 	u_short ie_rbd_length;		/* length of the buffer */
162963a0adeSRodney W. Grimes 	u_short mbz;			/* must be zero */
163963a0adeSRodney W. Grimes };
164963a0adeSRodney W. Grimes 
165963a0adeSRodney W. Grimes #define IE_RBD_LAST	0x8000	/* last buffer */
166963a0adeSRodney W. Grimes #define IE_RBD_USED	0x4000	/* this buffer has data */
167963a0adeSRodney W. Grimes /*
168963a0adeSRodney W. Grimes  * All commands share this in common.
169963a0adeSRodney W. Grimes  */
170963a0adeSRodney W. Grimes struct ie_cmd_common {
171963a0adeSRodney W. Grimes 	u_short ie_cmd_status;		/* status of this command */
172963a0adeSRodney W. Grimes 	u_short ie_cmd_cmd;		/* command word */
173963a0adeSRodney W. Grimes 	u_short ie_cmd_link;		/* link to next command */
174963a0adeSRodney W. Grimes };
175963a0adeSRodney W. Grimes 
176963a0adeSRodney W. Grimes #define IE_STAT_COMPL	0x8000	/* command is completed */
177963a0adeSRodney W. Grimes #define IE_STAT_BUSY	0x4000	/* command is running now */
178963a0adeSRodney W. Grimes #define IE_STAT_OK	0x2000	/* command completed successfully */
179963a0adeSRodney W. Grimes 
180963a0adeSRodney W. Grimes #define IE_CMD_NOP	0x0000	/* NOP */
181963a0adeSRodney W. Grimes #define IE_CMD_IASETUP	0x0001	/* initial address setup */
182963a0adeSRodney W. Grimes #define IE_CMD_CONFIG	0x0002	/* configure command */
183963a0adeSRodney W. Grimes #define IE_CMD_MCAST	0x0003	/* multicast setup command */
184963a0adeSRodney W. Grimes #define IE_CMD_XMIT	0x0004	/* transmit command */
185963a0adeSRodney W. Grimes #define IE_CMD_TDR	0x0005	/* time-domain reflectometer command */
186963a0adeSRodney W. Grimes #define IE_CMD_DUMP	0x0006	/* dump command */
187963a0adeSRodney W. Grimes #define IE_CMD_DIAGNOSE	0x0007	/* diagnostics command */
188963a0adeSRodney W. Grimes 
189963a0adeSRodney W. Grimes #define IE_CMD_LAST	0x8000	/* this is the last command in the list */
190963a0adeSRodney W. Grimes #define IE_CMD_SUSPEND	0x4000	/* suspend CU after this command */
191963a0adeSRodney W. Grimes #define IE_CMD_INTR	0x2000	/* post an interrupt after completion */
192963a0adeSRodney W. Grimes 
193963a0adeSRodney W. Grimes /*
194963a0adeSRodney W. Grimes  * This is the command to transmit a frame.
195963a0adeSRodney W. Grimes  */
196963a0adeSRodney W. Grimes struct ie_xmit_cmd {
197963a0adeSRodney W. Grimes 	struct ie_cmd_common com;	/* common part */
198963a0adeSRodney W. Grimes #define ie_xmit_status com.ie_cmd_status
199963a0adeSRodney W. Grimes 
200963a0adeSRodney W. Grimes 	u_short ie_xmit_desc;		/* 16-pointer to buffer descriptor */
201963a0adeSRodney W. Grimes 	struct ie_en_addr ie_xmit_addr; /* destination address */
202963a0adeSRodney W. Grimes 
203963a0adeSRodney W. Grimes 	u_short ie_xmit_length;		/* 802.3 length/Ether type field */
204963a0adeSRodney W. Grimes };
205963a0adeSRodney W. Grimes 
206963a0adeSRodney W. Grimes #define IE_XS_MAXCOLL  	0x000f	/* number of collisions during transmit */
207963a0adeSRodney W. Grimes #define IE_XS_EXCMAX	0x0020	/* exceeded maximum number of collisions */
208963a0adeSRodney W. Grimes #define IE_XS_SQE	0x0040	/* SQE positive */
209963a0adeSRodney W. Grimes #define IE_XS_DEFERRED	0x0080	/* transmission deferred */
210963a0adeSRodney W. Grimes #define IE_XS_UNDERRUN	0x0100	/* DMA underrun */
211963a0adeSRodney W. Grimes #define IE_XS_LOSTCTS	0x0200	/* Lost CTS */
212963a0adeSRodney W. Grimes #define IE_XS_NOCARRIER	0x0400	/* No Carrier */
213963a0adeSRodney W. Grimes #define IE_XS_LATECOLL	0x0800	/* Late collision */
214963a0adeSRodney W. Grimes 
215963a0adeSRodney W. Grimes /*
216963a0adeSRodney W. Grimes  * This is a buffer descriptor for a frame to be transmitted.
217963a0adeSRodney W. Grimes  */
218963a0adeSRodney W. Grimes 
219963a0adeSRodney W. Grimes struct ie_xmit_buf {
220963a0adeSRodney W. Grimes 	u_short ie_xmit_flags;		/* see below */
221963a0adeSRodney W. Grimes 	u_short ie_xmit_next;		/* 16-pointer to next desc. */
222963a0adeSRodney W. Grimes 	caddr_t ie_xmit_buf;		/* 24-pointer to the actual buffer */
223963a0adeSRodney W. Grimes };
224963a0adeSRodney W. Grimes 
225963a0adeSRodney W. Grimes #define IE_XMIT_LAST 0x8000	/* this TBD is the last one */
226963a0adeSRodney W. Grimes /* The rest of the `flags' word is actually the length. */
227963a0adeSRodney W. Grimes 
228963a0adeSRodney W. Grimes /*
229963a0adeSRodney W. Grimes  * Multicast setup command.
230963a0adeSRodney W. Grimes  */
231963a0adeSRodney W. Grimes 
232963a0adeSRodney W. Grimes #define MAXMCAST 50		/* must fit in transmit buffer */
233963a0adeSRodney W. Grimes 
234963a0adeSRodney W. Grimes struct ie_mcast_cmd {
235963a0adeSRodney W. Grimes 	struct ie_cmd_common com;	/* common part */
236963a0adeSRodney W. Grimes #define ie_mcast_status com.ie_cmd_status
237963a0adeSRodney W. Grimes 
238963a0adeSRodney W. Grimes 	u_short ie_mcast_bytes;	/* size (in bytes) of multicast addresses */
239963a0adeSRodney W. Grimes 	struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1];	/* space for them */
240963a0adeSRodney W. Grimes };
241963a0adeSRodney W. Grimes 
242963a0adeSRodney W. Grimes /*
243963a0adeSRodney W. Grimes  * Time Domain Reflectometer command.
244963a0adeSRodney W. Grimes  */
245963a0adeSRodney W. Grimes 
246963a0adeSRodney W. Grimes struct ie_tdr_cmd {
247963a0adeSRodney W. Grimes 	struct ie_cmd_common com;	/* common part */
248963a0adeSRodney W. Grimes #define ie_tdr_status com.ie_cmd_status
249963a0adeSRodney W. Grimes 
250963a0adeSRodney W. Grimes 	u_short ie_tdr_time;		/* error bits and time */
251963a0adeSRodney W. Grimes };
252963a0adeSRodney W. Grimes 
253963a0adeSRodney W. Grimes #define IE_TDR_SUCCESS	0x8000	/* TDR succeeded without error */
254963a0adeSRodney W. Grimes #define IE_TDR_XCVR	0x4000	/* detected a transceiver problem */
255963a0adeSRodney W. Grimes #define IE_TDR_OPEN	0x2000	/* detected an open */
256963a0adeSRodney W. Grimes #define IE_TDR_SHORT	0x1000	/* TDR detected a short */
257963a0adeSRodney W. Grimes #define IE_TDR_TIME	0x07ff	/* mask for reflection time */
258963a0adeSRodney W. Grimes 
259963a0adeSRodney W. Grimes /*
260963a0adeSRodney W. Grimes  * Initial Address Setup command
261963a0adeSRodney W. Grimes  */
262963a0adeSRodney W. Grimes struct ie_iasetup_cmd {
263963a0adeSRodney W. Grimes 	struct ie_cmd_common com;
264963a0adeSRodney W. Grimes #define ie_iasetup_status com.ie_cmd_status
265963a0adeSRodney W. Grimes 
266963a0adeSRodney W. Grimes 	struct ie_en_addr ie_address;
267963a0adeSRodney W. Grimes };
268963a0adeSRodney W. Grimes 
269963a0adeSRodney W. Grimes /*
270963a0adeSRodney W. Grimes  * Configuration command
271963a0adeSRodney W. Grimes  */
272963a0adeSRodney W. Grimes struct ie_config_cmd {
273963a0adeSRodney W. Grimes 	struct ie_cmd_common com;	/* common part */
274963a0adeSRodney W. Grimes #define ie_config_status com.ie_cmd_status
275963a0adeSRodney W. Grimes 
276963a0adeSRodney W. Grimes 	u_char ie_config_count;		/* byte count (0x0c) */
277963a0adeSRodney W. Grimes 	u_char ie_fifo;			/* fifo (8) */
278963a0adeSRodney W. Grimes 	u_char ie_save_bad;		/* save bad frames (0x40) */
279963a0adeSRodney W. Grimes 	u_char ie_addr_len;		/* address length (0x2e) (AL-LOC == 1) */
280963a0adeSRodney W. Grimes 	u_char ie_priority;		/* priority and backoff (0x0) */
281963a0adeSRodney W. Grimes 	u_char ie_ifs;			/* inter-frame spacing (0x60) */
282963a0adeSRodney W. Grimes 	u_char ie_slot_low;		/* slot time, LSB (0x0) */
283963a0adeSRodney W. Grimes 	u_char ie_slot_high;		/* slot time, MSN, and retries (0xf2) */
284963a0adeSRodney W. Grimes 	u_char ie_promisc;		/* 1 if promiscuous, else 0 */
285963a0adeSRodney W. Grimes 	u_char ie_crs_cdt;		/* CSMA/CD parameters (0x0) */
286963a0adeSRodney W. Grimes 	u_char ie_min_len;		/* min frame length (0x40) */
287963a0adeSRodney W. Grimes 	u_char ie_junk;			/* stuff for 82596 (0xff) */
288963a0adeSRodney W. Grimes };
289963a0adeSRodney W. Grimes 
290963a0adeSRodney W. Grimes /*
291963a0adeSRodney W. Grimes  * Here are a few useful functions.  We could have done these as macros,
292963a0adeSRodney W. Grimes  * but since we have the inline facility, it makes sense to use that
293963a0adeSRodney W. Grimes  * instead.
294963a0adeSRodney W. Grimes  */
295c1087c13SBruce Evans static __inline void
ie_setup_config(volatile struct ie_config_cmd * cmd,int promiscuous,int manchester)296963a0adeSRodney W. Grimes ie_setup_config(volatile struct ie_config_cmd *cmd,
297963a0adeSRodney W. Grimes 		int promiscuous, int manchester) {
298963a0adeSRodney W. Grimes 	cmd->ie_config_count = 0x0c;
299963a0adeSRodney W. Grimes 	cmd->ie_fifo = 8;
300963a0adeSRodney W. Grimes 	cmd->ie_save_bad = 0x40;
301963a0adeSRodney W. Grimes 	cmd->ie_addr_len = 0x2e;
302963a0adeSRodney W. Grimes 	cmd->ie_priority = 0;
303963a0adeSRodney W. Grimes 	cmd->ie_ifs = 0x60;
304963a0adeSRodney W. Grimes 	cmd->ie_slot_low = 0;
305963a0adeSRodney W. Grimes 	cmd->ie_slot_high = 0xf2;
306963a0adeSRodney W. Grimes 	cmd->ie_promisc = !!promiscuous | manchester << 2;
307963a0adeSRodney W. Grimes 	cmd->ie_crs_cdt = 0;
308963a0adeSRodney W. Grimes 	cmd->ie_min_len = 64;
309963a0adeSRodney W. Grimes 	cmd->ie_junk = 0xff;
310963a0adeSRodney W. Grimes }
311963a0adeSRodney W. Grimes 
312c151de31SBruce Evans static __inline void *
Align(void * ptr)313c151de31SBruce Evans Align(void *ptr) {
314b97fc948SBruce Evans 	uintptr_t l = (uintptr_t)ptr;
315963a0adeSRodney W. Grimes 	l = (l + 3) & ~3L;
316c151de31SBruce Evans 	return (void *)l;
317c151de31SBruce Evans }
318c151de31SBruce Evans 
319c151de31SBruce Evans static __inline volatile void *
Alignvol(volatile void * ptr)320c151de31SBruce Evans Alignvol(volatile void *ptr) {
321c151de31SBruce Evans 	uintptr_t l = (uintptr_t)ptr;
322c151de31SBruce Evans 	l = (l + 3) & ~3L;
323c151de31SBruce Evans 	return (volatile void *)l;
324963a0adeSRodney W. Grimes }
325963a0adeSRodney W. Grimes 
3260e91b7d5SMatthew N. Dodd #if 0
327c1087c13SBruce Evans static __inline void
328963a0adeSRodney W. Grimes ie_ack(volatile struct ie_sys_ctl_block *scb,
329963a0adeSRodney W. Grimes 				  u_int mask, int unit,
330963a0adeSRodney W. Grimes 				  void (*ca)(int)) {
331963a0adeSRodney W. Grimes 	scb->ie_command = scb->ie_status & mask;
332963a0adeSRodney W. Grimes 	(*ca)(unit);
333963a0adeSRodney W. Grimes }
3340e91b7d5SMatthew N. Dodd #endif
335