summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun/sys/mace.h
blob: 69cef51e2ea9bc7e21f66407c726e0d78cd4ac8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 1992,1997-1998 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SYS_MACE_H
#define	_SYS_MACE_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * Declarations and definitions specific to the Am79C940 MACE
 * Media Access Controller for Ethernet
 *
 * The MACE is a slave register-based Ethernet (IEEE 802.3)
 * controller chip combining MAC core, Manchester endec, and SIA
 * for AUI (10BASE5), DAI (10BASET), and GPSI network interfaces.
 * All registers are 8bits wide externally except Transmit
 * and Receive FIFO registers which are 16bits wide externally.
 * Some registers are internally wider than 8bits, these
 * have bit width denoted [xx-yy], and are accessed by
 * multiple reads/writes to the external register.
 */

/*
 * MACE Register Set.
 */
struct	mace {
	uchar_t	rcvfifo;	/* R0 receive FIFO [15-00] (R) */
	uchar_t	xmtfifo;	/* R1 transmit FIFO [15-00] (W) */
	uchar_t	xmtfc;		/* R2 transmit frame control (RW) */
	uchar_t	xmtfs;		/* R3 transmit frame status (R) */
	uchar_t	xmtrc;		/* R4 transmit retry count (R) */
	uchar_t	rcvfc;		/* R5 receive frame control (RW) */
	uchar_t	rcvfs;		/* R6 receive frame status [31-00] (RO) */
	uchar_t	fifofc;		/* R7 FIFO frame count (R) */
	uchar_t	ir;		/* R8 interrupt register (R) */
	uchar_t	imr;		/* R9 interrupt mask register (RW) */
	uchar_t	pr;		/* R10 poll register (R) */
	uchar_t	biucc;		/* R11 BIU configuration control (RW) */
	uchar_t	fifocc;		/* R12 FIFO configuration control (RW) */
	uchar_t	maccc;		/* R13 MAC configuration control (RW) */
	uchar_t	plscc;		/* R14 PLS configuration control (RW) */
	uchar_t	phycc;		/* R15 PHY configuration control (RW) */
	uchar_t	chipidlo;	/* R16 chip id register [07-00] (R) */
	uchar_t	chipidhi;	/* R17 chip id register [15-08] (R) */
	uchar_t	iac;		/* R18 internal address configuration (RW) */
	uchar_t	reserved0;	/* R19 reserved */
	uchar_t	ladrf;		/* R20 logical address filter [63-00] (RW) */
	uchar_t	padr;		/* R21 physical address [47-00] (RW) */
	uchar_t	reserved1;	/* R22 reserved */
	uchar_t	reserved2;	/* R23 reserved */
	uchar_t	mpc;		/* R24 missed packet count (R) */
	uchar_t	reserved3;	/* R25 reserved */
	uchar_t	rntpc;		/* R26 runt packet count (R) */
	uchar_t	rcvcc;		/* R27 receive collision count (R) */
	uchar_t	reserved4;	/* R28 reserved */
	uchar_t	utr;		/* R29 user test register (RW) */
	uchar_t	rtr1;		/* R30 reserved test register 1 */
	uchar_t	rtr2;		/* R31 reserved test register 2 */
};

/*
 * MACE Register Bit Masks.
 * XXX add right-shift values later.
 */

#define	MACE_XMTFC_DRTRY	(0x80)	/* disable retry */
#define	MACE_XMTFC_DXMTFCS	(0x08)	/* disable transmit fcs */
#define	MACE_XMTFC_APADXMT	(0x01)	/* auto pad transmit */

#define	MACE_XMTFS_XMTSV	(0x80)	/* transmit status valid */
#define	MACE_XMTFS_UFLO		(0x40)	/* underflow */
#define	MACE_XMTFS_LCOL		(0x20)	/* late collision */
#define	MACE_XMTFS_MORE		(0x10)	/* more than one retry */
#define	MACE_XMTFS_ONE		(0x08)	/* one retry */
#define	MACE_XMTFS_DEFER	(0x04)	/* defer */
#define	MACE_XMTFS_LCAR		(0x02)	/* loss of carrier */
#define	MACE_XMTFS_RTRY		(0x01)	/* retry error */

#define	MACE_XMTRC_EXDEF	(0x80)	/* excessive defer */
#define	MACE_XMTRC_XMTRC	(0x0f)	/* transmit retry count */

#define	MACE_RCVFC_LLRCV	(0x08)	/* low latency receive */
#define	MACE_RCVFC_MR		(0x04)	/* external address match/reject */
#define	MACE_RCVFC_ASTRPRCV	(0x01)	/* auto strip receive */

#define	MACE_RCVFS_OFLO		(0x80)	/* RFS1 overflow */
#define	MACE_RCVFS_CLSN		(0x40)	/* RFS1 receive late collision */
#define	MACE_RCVFS_FRAM		(0x20)	/* RFS1 framing error */
#define	MACE_RCVFS_FCS		(0x10)	/* RFS1 FCS error */
#define	MACE_RCVFS_RCVCNT	(0x0f)	/* RFS1 receive message byte count */

#define	MACE_FIFOFC_RCVFC	(0xf0)	/* receive FIFO frame count */
#define	MACE_FIFOFC_XMTFC	(0x0f)	/* transmit FIFO frame count */

#define	MACE_IR_JAB		(0x80)	/* jabber error */
#define	MACE_IR_BABL		(0x40)	/* babble error */
#define	MACE_IR_CERR		(0x20)	/* collision error */
#define	MACE_IR_RCVCCO		(0x10)	/* receive collision count overflow */
#define	MACE_IR_RPCO		(0x08)	/* runt packet count overflow */
#define	MACE_IR_MPCO		(0x04)	/* missed packet count overflow */
#define	MACE_IR_RCVINT		(0x02)	/* receive interrupt */
#define	MACE_IR_XMTINT		(0x01)	/* transmit interrupt */

#define	MACE_IMR_BABLM		(0x40)	/* babble error mask */
#define	MACE_IMR_CERRM		(0x20)	/* collision error mask */
#define	MACE_IMR_MPCOM		(0x04)	/* missed packet count overflow mask */
#define	MACE_IMR_RCVINTM	(0x02)	/* receive interrupt mask */
#define	MACE_IMR_XMTINTM	(0x01)	/* transmit interrupt mask */

#define	MACE_PR_XMTSV		(0x80)	/* transmit status valid */
#define	MACE_PR_TDTREQ		(0x40)	/* transmit data transfer request */
#define	MACE_PR_RDTREQ		(0x20)	/* receive data transfer request */

#define	MACE_BIU_BSWP		(0x40)	/* byte swap */
#define	MACE_BIU_XMTSP		(0x30)	/* transmit start point */
#define	MACE_BIU_XMTSPSHIFTL	(4)	/* shift left value into this field */
#define	MACE_BIU_XMTSP4		(0)	/* 4byte transmit start */
#define	MACE_BIU_XMTSP16	(1)	/* 16byte transmit start */
#define	MACE_BIU_XMTSP64	(2)	/* 64byte transmit start */
#define	MACE_BIU_XMTSP112	(3)	/* 112byte transmit start */
#define	MACE_BIU_SWSRT		(0x01)	/* software reset */

#define	MACE_FIFOCC_XMTFW	(0xc0)	/* transmit fifo watermark */
#define	MACE_FIFOCC_XMTFW8	(0x00)	/* transmit fifo 8 write cycles */
#define	MACE_FIFOCC_XMTFW16	(0x40)	/* transmit fifo 16 write cycles */
#define	MACE_FIFOCC_XMTFW32	(0x80)	/* transmit fifo 32 write cycles */
#define	MACE_FIFOCC_RCVFW	(0x30)	/* receive fifo watermark */
#define	MACE_FIFOCC_RCVFW16	(0x00)	/* receive fifo 16bytes */
#define	MACE_FIFOCC_RCVFW32	(0x10)	/* receive fifo 32bytes */
#define	MACE_FIFOCC_RCVFW64	(0x20)	/* receive fifo 64bytes */
#define	MACE_FIFOCC_XMTFWU	(0x08)	/* transmit fifo watermark update */
#define	MACE_FIFOCC_RCVFWU	(0x04)	/* receive fifo watermark update */
#define	MACE_FIFOCC_XMTBRST	(0x02)	/* transmit burst enable/disable */
#define	MACE_FIFOCC_RCVBRST	(0x01)	/* receive burst enable/disable */

#define	MACE_MACCC_PROM		(0x80)	/* promiscuous mode */
#define	MACE_MACCC_DXMT2PD	(0x40)	/* disable transmit two part deferral */
#define	MACE_MACCC_EMBA		(0x20)	/* enable modified back-off algorithm */
#define	MACE_MACCC_DRCVPA	(0x08)	/* disable receive physical address */
#define	MACE_MACCC_DRCVBC	(0x04)	/* disable receive broadcast */
#define	MACE_MACCC_ENXMT	(0x02)	/* enable transmit */
#define	MACE_MACCC_ENRCV	(0x01)	/* enable receive */

#define	MACE_PLSCC_XMTSEL	(0x08)	/* transmit mode select */
#define	MACE_PLSCC_PORTSEL	(0x06)	/* port select */
#define	MACE_PLSCC_PORTSELAUI	(0x00)	/* port select:  AUI */
#define	MACE_PLSCC_PORTSELTP	(0x02)	/* port select:  TP */
#define	MACE_PLSCC_PORTSELDAI	(0x04)	/* port select:  DAI */
#define	MACE_PLSCC_PORTSELGPSI	(0x06)	/* port select:  GPSI */
#define	MACE_PLSCC_ENPLSIO	(0x01)	/* enable PLS I/O */

#define	MACE_PHYCC_LNKST	(0x80)	/* link integrity test status */
#define	MACE_PHYCC_DLNKTST	(0x40)	/* disable link test */
#define	MACE_PHYCC_RCVPOL	(0x20)	/* receive polarity */
#define	MACE_PHYCC_DAPC		(0x10)	/* disable auto polarity correction */
#define	MACE_PHYCC_LTS		(0x08)	/* low threshold select */
#define	MACE_PHYCC_ASEL		(0x04)	/* port auto select */
#define	MACE_PHYCC_RWAKE	(0x02)	/* remote wakeup */
#define	MACE_PHYCC_AWAKE	(0x01)	/* auto wake */

#define	MACE_CHIPID0_MAGIC	(0x41)	/* chip id is 0xX941 where X=version */
#define	MACE_CHIPID1_MAGIC	(0x09)

#define	MACE_IAC_ADDRCHG	(0x80)	/* address change */
#define	MACE_IAC_PHYADDR	(0x04)	/* physical address reset */
#define	MACE_IAC_LOGADDR	(0x02)	/* logical address reset */

#define	MACE_UTR_RTRE		(0x80)	/* reserved test register enable */
#define	MACE_UTR_RTRD		(0x40)	/* reserved test register disable */
#define	MACE_UTR_RPA		(0x20)	/* runt packet accept */
#define	MACE_UTR_FCOLL		(0x10)	/* force collision */
#define	MACE_UTR_RCVFCSE	(0x08)	/* receive FCS enable */
#define	MACE_UTR_LOOP		(0x06)	/* loopback control */
#define	MACE_UTR_LOOPNO		(0x00)	/* loopback control:  no loopback */
#define	MACE_UTR_LOOPEXT	(0x02)	/* loopback control:  ext. */
#define	MACE_UTR_LOOPINT	(0x04)	/* loopback control:  int. */
#define	MACE_UTR_LOOPINTMENDEC	(0x06)	/* loopback control:  int. w/MENDEC */

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_MACE_H */