summaryrefslogtreecommitdiff
path: root/sys/dev/isa/if_wereg.h
blob: 6cfa4c27d52801fdd8171c7cbbb49e690d54a36f (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*	$OpenBSD: if_wereg.h,v 1.3 2006/03/04 19:33:21 miod Exp $	*/
/*	$NetBSD: if_wereg.h,v 1.1 1997/11/03 21:22:50 thorpej Exp $	*/

/*
 * National Semiconductor DS8390 NIC register definitions.
 *
 * Copyright (C) 1993, David Greenman.  This software may be used, modified,
 * copied, distributed, and sold, in both source and binary form provided that
 * the above copyright and these terms are retained.  Under no circumstances is
 * the author responsible for the proper functioning of this software, nor does
 * the author assume any responsibility for damages incurred with its use.
 */

/*
 * Compile-time config flags
 */
/*
 * This sets the default for enabling/disablng the transceiver.
 */
#define WE_FLAGS_DISABLE_TRANSCEIVER	0x0001

/*
 * This forces the board to be used in 8/16-bit mode even if it autoconfigs
 * differently.
 */
#define WE_FLAGS_FORCE_8BIT_MODE	0x0002
#define WE_FLAGS_FORCE_16BIT_MODE	0x0004

/*
 * This disables the use of double transmit buffers.
 */
#define WE_FLAGS_NO_MULTI_BUFFERING	0x0008

/*
 *		Definitions for Western digital/SMC WD80x3 series ASIC
 */

/*
 * Memory Select Register (MSR)
 */
#define WE_MSR	0

/* next three definitions for Toshiba */
#define	WE_MSR_POW	0x02	/* 0 = power save, 1 = normal (R/W) */
#define	WE_MSR_BSY	0x04	/* gate array busy (R) */
#define	WE_MSR_LEN	0x20	/* 0 = 16-bit, 1 = 8-bit (R/W) */

#define WE_MSR_ADDR	0x3f	/* Memory decode bits 18-13 */
#define WE_MSR_MENB	0x40	/* Memory enable */
#define WE_MSR_RST	0x80	/* Reset board */

/*
 * Interface Configuration Register (ICR)
 */
#define WE_ICR	1

#define WE_ICR_16BIT	0x01	/* 16-bit interface */
#define WE_ICR_OAR	0x02	/* select register (0=BIO 1=EAR) */
#define WE_ICR_IR2	0x04	/* high order bit of encoded IRQ */
#define WE_ICR_MSZ	0x08	/* memory size (0=8k 1=32k) */
#define WE_ICR_RLA	0x10	/* recall LAN address */
#define WE_ICR_RX7	0x20	/* recall all but i/o and LAN address */
#define	WE_ICR_RIO	0x40	/* recall i/o address */
#define WE_ICR_STO	0x80	/* store to non-volatile memory */
#ifdef TOSH_ETHER
#define	WE_ICR_MEM	0xe0	/* shared mem address A15-A13 (R/W) */
#define	WE_ICR_MSZ1	0x0f	/* memory size, 0x08 = 64K, 0x04 = 32K,
				   0x02 = 16K, 0x01 = 8K */
				/* 64K can only be used if mem address
				   above 1MB */
				/* IAR holds address A23-A16 (R/W) */
#endif

/*
 * IO Address Register (IAR)
 */
#define WE_IAR	2

/*
 * EEROM Address Register
 */
#define WE_EAR	3

/*
 * Interrupt Request Register (IRR)
 */
#define WE_IRR	4

#define	WE_IRR_0WS	0x01	/* use 0 wait-states on 8 bit bus */
#define WE_IRR_OUT1	0x02	/* WD83C584 pin 1 output */
#define WE_IRR_OUT2	0x04	/* WD83C584 pin 2 output */
#define WE_IRR_OUT3	0x08	/* WD83C584 pin 3 output */
#define WE_IRR_FLASH	0x10	/* Flash RAM is in the ROM socket */

/*
 * The three bits of the encoded IRQ are decoded as follows:
 *
 * IR2 IR1 IR0  IRQ
 *  0   0   0   2/9
 *  0   0   1   3
 *  0   1   0   5
 *  0   1   1   7
 *  1   0   0   10
 *  1   0   1   11
 *  1   1   0   15
 *  1   1   1   4
 */
#define WE_IRR_IR0	0x20	/* bit 0 of encoded IRQ */
#define WE_IRR_IR1	0x40	/* bit 1 of encoded IRQ */
#define WE_IRR_IEN	0x80	/* Interrupt enable */

/*
 * LA Address Register (LAAR)
 */
#define WE_LAAR	5

#define WE_LAAR_ADDRHI	0x1f	/* bits 23-19 of RAM address */
#define WE_LAAR_0WS16	0x20	/* enable 0 wait-states on 16 bit bus */
#define WE_LAAR_L16EN	0x40	/* enable 16-bit operation */
#define WE_LAAR_M16EN	0x80	/* enable 16-bit memory access */

/* i/o base offset to station address/card-ID PROM */
#define WE_PROM	8

/*
 *	83C790 specific registers
 */
/*
 * Hardware Support Register (HWR) ('790)
 */
#define	WE790_HWR	4

#define	WE790_HWR_RST	0x10	/* hardware reset */
#define	WE790_HWR_LPRM	0x40	/* LAN PROM select */
#define	WE790_HWR_SWH	0x80	/* switch register set */

/*
 * ICR790 Interrupt Control Register for the 83C790
 */
#define	WE790_ICR	6

#define	WE790_ICR_EIL	0x01	/* enable interrupts */

/*
 * REV/IOPA Revision / I/O Pipe register for the 83C79X
 */
#define WE790_REV	7

#define WE790_REV_790	0x20
#define WE790_REV_795	0x40

/*
 * 79X RAM Address Register (RAR)
 *      Enabled with SWH bit=1 in HWR register
 */

#define WE790_RAR	0x0b

#define WE790_RAR_SZ8	0x00	/* 8k memory buffer */
#define WE790_RAR_SZ16	0x10	/* 16k memory buffer */
#define WE790_RAR_SZ32	0x20	/* 32k memory buffer */
#define WE790_RAR_SZ64	0x30	/* 64k memory buffer */

/*
 * General Control Register (GCR)
 * Enabled with SWH bit == 1 in HWR register
 */
#define	WE790_GCR	0x0d

#define	WE790_GCR_LIT	0x01	/* on for UTP */
#define	WE790_GCR_GPOUT	0x02	/* if BNC is enabled */
#define	WE790_GCR_IR0	0x04	/* bit 0 of encoded IRQ */
#define	WE790_GCR_IR1	0x08	/* bit 1 of encoded IRQ */
#define	WE790_GCR_ZWSEN	0x20	/* zero wait state enable */
#define	WE790_GCR_IR2	0x40	/* bit 2 of encoded IRQ */
/*
 * The three bits of the encoded IRQ are decoded as follows:
 *
 * IR2 IR1 IR0  IRQ
 *  0   0   0   none
 *  0   0   1   9
 *  0   1   0   3
 *  0   1   1   5
 *  1   0   0   7
 *  1   0   1   10
 *  1   1   0   11
 *  1   1   1   15
 */

/* i/o base offset to CARD ID */
#define WE_CARD_ID	WE_PROM+6

/* Board type codes in card ID */
#define WE_TYPE_WD8003S		0x02
#define WE_TYPE_WD8003E		0x03
#define WE_TYPE_WD8013EBT	0x05
#define	WE_TYPE_TOSHIBA1	0x11	/* named PCETA1 */
#define	WE_TYPE_TOSHIBA2	0x12	/* named PCETA2 */
#define	WE_TYPE_TOSHIBA3	0x13	/* named PCETB */
#define	WE_TYPE_TOSHIBA4	0x14	/* named PCETC */
#define	WE_TYPE_WD8003W		0x24
#define	WE_TYPE_WD8003EB	0x25
#define	WE_TYPE_WD8013W		0x26
#define WE_TYPE_WD8013EP	0x27
#define WE_TYPE_WD8013WC	0x28
#define WE_TYPE_WD8013EPC	0x29
#define	WE_TYPE_SMC8216T	0x2a
#define	WE_TYPE_SMC8216C	0x2b
#define WE_TYPE_WD8013EBP	0x2c

/* Bit definitions in card ID */
#define	WE_REV_MASK		0x1f	/* Revision mask */
#define	WE_SOFTCONFIG		0x20	/* Soft config */
#define	WE_LARGERAM		0x40	/* Large RAM */
#define	WE_MICROCHANEL		0x80	/* Microchannel bus (vs. isa) */

/*
 * Checksum total.  All 8 bytes in station address PROM will add up to this.
 */
#ifdef TOSH_ETHER
#define WE_ROM_CHECKSUM_TOTAL	0xA5
#else
#define WE_ROM_CHECKSUM_TOTAL	0xFF
#endif

#define WE_NIC_OFFSET		0x10	/* I/O base offset to NIC */
#define WE_ASIC_OFFSET		0	/* I/O base offset to ASIC */
#define	WE_NIC_NPORTS		16
#define	WE_ASIC_NPORTS		16
#define WE_NPORTS		(WE_NIC_NPORTS + WE_ASIC_NPORTS)

#define WE_PAGE_OFFSET	0	/* page offset for NIC access to mem */