if_stereg.h revision 1.5 1 1.5 martin /* $NetBSD: if_stereg.h,v 1.5 2008/04/28 20:23:55 martin Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Jason R. Thorpe.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.1 thorpej */
31 1.1 thorpej
32 1.1 thorpej #ifndef _DEV_PCI_IF_STEREG_H_
33 1.1 thorpej #define _DEV_PCI_IF_STEREG_H_
34 1.1 thorpej
35 1.1 thorpej /*
36 1.1 thorpej * Register description for the Sundance Tech. ST-201 10/100
37 1.1 thorpej * Ethernet controller.
38 1.1 thorpej */
39 1.1 thorpej
40 1.1 thorpej /*
41 1.1 thorpej * ST-201 buffer fragment descriptor.
42 1.1 thorpej */
43 1.1 thorpej struct ste_frag {
44 1.1 thorpej uint32_t frag_addr; /* buffer address */
45 1.1 thorpej uint32_t frag_len; /* buffer length */
46 1.4 perry } __packed;
47 1.1 thorpej
48 1.1 thorpej #define FRAG_LEN 0x00001fff /* length mask */
49 1.1 thorpej #define FRAG_LAST (1U << 31) /* last frag in list */
50 1.1 thorpej
51 1.1 thorpej /*
52 1.1 thorpej * ST-201 Transmit Frame Descriptor. Note the number of fragments
53 1.1 thorpej * here is arbitrary, but we can't exceed 512 bytes of TFD.
54 1.1 thorpej */
55 1.2 thorpej #define STE_NTXFRAGS 16
56 1.1 thorpej struct ste_tfd {
57 1.1 thorpej uint32_t tfd_next; /* next TFD in list */
58 1.1 thorpej uint32_t tfd_control; /* control bits */
59 1.1 thorpej /* the buffer fragments */
60 1.1 thorpej struct ste_frag tfd_frags[STE_NTXFRAGS];
61 1.4 perry } __packed;
62 1.1 thorpej
63 1.1 thorpej #define TFD_WordAlign_dword 0 /* align to dword in TxFIFO */
64 1.1 thorpej #define TFD_WordAlign_word 2 /* align to word in TxFIFO */
65 1.1 thorpej #define TFD_WordAlign_disable 1 /* disable alignment */
66 1.1 thorpej #define TFD_FrameId(x) ((x) << 2)
67 1.1 thorpej #define TFD_FrameId_MAX 0xff
68 1.1 thorpej #define TFD_FcsAppendDisable (1U << 13)
69 1.1 thorpej #define TFD_TxIndicate (1U << 15)
70 1.1 thorpej #define TFD_TxDMAComplete (1U << 16)
71 1.1 thorpej #define TFD_TxDMAIndicate (1U << 31)
72 1.1 thorpej
73 1.1 thorpej /*
74 1.1 thorpej * ST-201 Receive Frame Descriptor. Note the number of fragments
75 1.1 thorpej * here is arbitrary (we only use one), but we can't exceed 512
76 1.1 thorpej * bytes of RFD.
77 1.1 thorpej */
78 1.1 thorpej struct ste_rfd {
79 1.1 thorpej uint32_t rfd_next; /* next RFD in list */
80 1.1 thorpej uint32_t rfd_status; /* status bits */
81 1.1 thorpej struct ste_frag rfd_frag; /* the buffer */
82 1.4 perry } __packed;
83 1.1 thorpej
84 1.1 thorpej #define RFD_RxDMAFrameLen(x) ((x) & FRAG_LEN)
85 1.1 thorpej #define RFD_RxFrameError (1U << 14)
86 1.1 thorpej #define RFD_RxDMAComplete (1U << 15)
87 1.1 thorpej #define RFD_RxFIFOOverrun (1U << 16)
88 1.1 thorpej #define RFD_RxRuntFrame (1U << 17)
89 1.1 thorpej #define RFD_RxAlignmentError (1U << 18)
90 1.1 thorpej #define RFD_RxFCSError (1U << 19)
91 1.1 thorpej #define RFD_RxOversizedFrame (1U << 20)
92 1.1 thorpej #define RFD_DribbleBits (1U << 23)
93 1.1 thorpej #define RFD_RxDMAOverflow (1U << 24)
94 1.1 thorpej #define RFD_ImpliedBufferEnable (1U << 28)
95 1.1 thorpej
96 1.1 thorpej /*
97 1.1 thorpej * PCI configuration registers used by the ST-201.
98 1.1 thorpej */
99 1.1 thorpej
100 1.1 thorpej #define STE_PCI_IOBA (PCI_MAPREG_START + 0x00)
101 1.1 thorpej #define STE_PCI_MMBA (PCI_MAPREG_START + 0x04)
102 1.1 thorpej
103 1.1 thorpej /*
104 1.1 thorpej * EEPROM offsets.
105 1.1 thorpej */
106 1.1 thorpej #define STE_EEPROM_ConfigParam 0x00
107 1.1 thorpej #define STE_EEPROM_AsicCtrl 0x02
108 1.1 thorpej #define STE_EEPROM_SubSystemVendorId 0x04
109 1.1 thorpej #define STE_EEPROM_SubSystemId 0x06
110 1.1 thorpej #define STE_EEPROM_StationAddress0 0x10
111 1.1 thorpej #define STE_EEPROM_StationAddress1 0x12
112 1.1 thorpej #define STE_EEPROM_StationAddress2 0x14
113 1.1 thorpej
114 1.1 thorpej /*
115 1.1 thorpej * The ST-201 register space.
116 1.1 thorpej */
117 1.1 thorpej
118 1.1 thorpej #define STE_DMACtrl 0x00 /* 32-bit */
119 1.1 thorpej #define DC_RxDMAHalted (1U << 0)
120 1.1 thorpej #define DC_TxDMACmplReq (1U << 1)
121 1.1 thorpej #define DC_TxDMAHalted (1U << 2)
122 1.1 thorpej #define DC_RxDMAComplete (1U << 3)
123 1.1 thorpej #define DC_TxDMAComplete (1U << 4)
124 1.1 thorpej #define DC_RxDMAHalt (1U << 8)
125 1.1 thorpej #define DC_RxDMAResume (1U << 9)
126 1.1 thorpej #define DC_TxDMAHalt (1U << 10)
127 1.1 thorpej #define DC_TxDMAResume (1U << 11)
128 1.1 thorpej #define DC_TxDMAInProg (1U << 14)
129 1.1 thorpej #define DC_DMAHaltBusy (1U << 15)
130 1.1 thorpej #define DC_RxEarlyEnable (1U << 17)
131 1.1 thorpej #define DC_CountdownSpeed (1U << 18)
132 1.1 thorpej #define DC_CountdownMode (1U << 19)
133 1.1 thorpej #define DC_MWIDisable (1U << 20)
134 1.1 thorpej #define DC_RxDMAOverrunFrame (1U << 22)
135 1.1 thorpej #define DC_CountdownIntEnable (1U << 23)
136 1.1 thorpej #define DC_TargetAbort (1U << 30)
137 1.1 thorpej #define DC_MasterAbort (1U << 31)
138 1.1 thorpej
139 1.1 thorpej #define STE_TxDMAListPtr 0x04 /* 32-bit */
140 1.1 thorpej
141 1.1 thorpej #define STE_TxDMABurstThresh 0x08 /* 8-bit */
142 1.1 thorpej
143 1.1 thorpej #define STE_TxDMAUrgentThresh 0x09 /* 8-bit */
144 1.1 thorpej
145 1.1 thorpej #define STE_TxDMAPollPeriod 0x0a /* 8-bit */
146 1.1 thorpej
147 1.1 thorpej #define STE_RxDMAStatus 0x0c /* 32-bit */
148 1.1 thorpej #define RDS_RxDMAFrameLen(x) ((x) & 0x1fff)
149 1.1 thorpej #define RDS_RxFrameError (1U << 14)
150 1.1 thorpej #define RDS_RxDMAComplete (1U << 15)
151 1.1 thorpej #define RDS_RxFIFOOverrun (1U << 16)
152 1.1 thorpej #define RDS_RxRuntFrame (1U << 17)
153 1.1 thorpej #define RDS_RxAlignmentError (1U << 18)
154 1.1 thorpej #define RDS_RxFCSError (1U << 19)
155 1.1 thorpej #define RDS_RxOversizedFrame (1U << 20)
156 1.1 thorpej #define RDS_DribbleBits (1U << 23)
157 1.1 thorpej #define RDS_RxDMAOverflow (1U << 24)
158 1.1 thorpej
159 1.1 thorpej #define STE_RxDMAListPtr 0x10 /* 32-bit */
160 1.1 thorpej
161 1.3 bouyer #define STE_RxDMABurstThresh 0x14 /* 8-bit */
162 1.1 thorpej
163 1.1 thorpej #define STE_RxDMAUrgentThresh 0x15 /* 8-bit */
164 1.1 thorpej
165 1.1 thorpej #define STE_RxDMAPollPeriod 0x16 /* 8-bit */
166 1.1 thorpej
167 1.1 thorpej #define STE_DebugCtrl 0x1a /* 16-bit */
168 1.1 thorpej #define DC_GPIO0Ctrl (1U << 0) /* 1 = input */
169 1.1 thorpej #define DC_GPIO1Ctrl (1U << 1) /* 1 = input */
170 1.1 thorpej #define DC_GPIO0 (1U << 2)
171 1.1 thorpej #define DC_GPIO1 (1U << 3)
172 1.1 thorpej
173 1.1 thorpej #define STE_AsicCtrl 0x30 /* 32-bit */
174 1.1 thorpej #define AC_ExpRomSize (1U << 1) /* 0 = 32K, 1 = 64K */
175 1.1 thorpej #define AC_TxLargeEnable (1U << 2) /* > 2K */
176 1.1 thorpej #define AC_RxLargeEnable (1U << 3) /* > 2K */
177 1.1 thorpej #define AC_ExpRomDisable (1U << 4)
178 1.1 thorpej #define AC_PhySpeed10 (1U << 5)
179 1.1 thorpej #define AC_PhySpeed100 (1U << 6)
180 1.1 thorpej #define AC_PhyMedia(x) (((x) >> 7) & 0x7)
181 1.1 thorpej #define AC_PhyMedia_10T 1
182 1.1 thorpej #define AC_PhyMedia_100T 2
183 1.1 thorpej #define AC_PhyMedia_10_100T 3
184 1.1 thorpej #define AC_PhyMedia_10F 5
185 1.1 thorpej #define AC_PhyMedia_100F 6
186 1.1 thorpej #define AC_PhyMedia_10_100F 7
187 1.1 thorpej #define AC_ForcedConfig(x) (((x) >> 8) & 0x7)
188 1.1 thorpej #define AC_D3ResetDisable (1U << 11)
189 1.1 thorpej #define AC_SpeedupMode (1U << 13)
190 1.1 thorpej #define AC_LEDMode (1U << 14)
191 1.1 thorpej #define AC_RstOutPolarity (1U << 15)
192 1.1 thorpej #define AC_GlobalReset (1U << 16)
193 1.1 thorpej #define AC_RxReset (1U << 17)
194 1.1 thorpej #define AC_TxReset (1U << 18)
195 1.1 thorpej #define AC_DMA (1U << 19)
196 1.1 thorpej #define AC_FIFO (1U << 20)
197 1.1 thorpej #define AC_Network (1U << 21)
198 1.1 thorpej #define AC_Host (1U << 22)
199 1.1 thorpej #define AC_AutoInit (1U << 23)
200 1.1 thorpej #define AC_RstOut (1U << 24)
201 1.1 thorpej #define AC_InterruptRequest (1U << 25)
202 1.1 thorpej #define AC_ResetBusy (1U << 26)
203 1.1 thorpej
204 1.1 thorpej #define STE_EepromData 0x34 /* 16-bit */
205 1.1 thorpej
206 1.1 thorpej #define STE_EepromCtrl 0x36 /* 16-bit */
207 1.1 thorpej #define EC_EepromAddress(x) ((x) & 0xff)
208 1.1 thorpej #define EC_EepromOpcode(x) ((x) << 8)
209 1.1 thorpej #define EC_OP_WE 0
210 1.1 thorpej #define EC_OP_W 1
211 1.1 thorpej #define EC_OP_R 2
212 1.1 thorpej #define EC_OP_E 3
213 1.1 thorpej #define EC_EepromBusy (1U << 15)
214 1.1 thorpej
215 1.1 thorpej #define STE_FIFOCtrl 0x3a /* 16-bit */
216 1.1 thorpej #define FC_RAMTestMode (1U << 0)
217 1.1 thorpej #define FC_RxOverrunFrame (1U << 9)
218 1.1 thorpej #define FC_RxFIFOFull (1U << 11)
219 1.1 thorpej #define FC_Transmitting (1U << 14)
220 1.1 thorpej #define FC_Receiving (1U << 15)
221 1.1 thorpej
222 1.1 thorpej #define STE_TxStartThresh 0x3c /* 16-bit */
223 1.1 thorpej
224 1.1 thorpej #define STE_RxEarlyThresh 0x3e /* 16-bit */
225 1.1 thorpej
226 1.1 thorpej #define STE_ExpRomAddr 0x40 /* 32-bit */
227 1.1 thorpej
228 1.1 thorpej #define STE_ExpRomData 0x44 /* 8-bit */
229 1.1 thorpej
230 1.1 thorpej #define STE_WakeEvent 0x45 /* 8-bit */
231 1.1 thorpej #define WE_WakePktEnable (1U << 0)
232 1.1 thorpej #define WE_MagicPktEnable (1U << 1)
233 1.1 thorpej #define WE_LinkEventEnable (1U << 2)
234 1.1 thorpej #define WE_WakePolarity (1U << 3)
235 1.1 thorpej #define WE_WakePktEvent (1U << 4)
236 1.1 thorpej #define WE_MagicPktEvent (1U << 5)
237 1.1 thorpej #define WE_LinkEvent (1U << 6)
238 1.1 thorpej #define WE_WakeOnLanEnable (1U << 7)
239 1.1 thorpej
240 1.1 thorpej #define STE_TxStatus 0x46 /* 8-bit */
241 1.1 thorpej #define TS_TxReleaseError (1U << 1)
242 1.1 thorpej #define TS_TxStatusOverflow (1U << 2)
243 1.1 thorpej #define TS_MaxCollisions (1U << 3)
244 1.1 thorpej #define TS_TxUnderrun (1U << 4)
245 1.1 thorpej #define TS_TxIndicateReqd (1U << 6)
246 1.1 thorpej #define TS_TxComplete (1U << 7)
247 1.1 thorpej
248 1.1 thorpej #define STE_TxFrameId 0x47 /* 8-bit */
249 1.1 thorpej
250 1.1 thorpej #define STE_Countdown 0x48 /* 16-bit */
251 1.1 thorpej
252 1.1 thorpej #define STE_IntStatusAck 0x4a /* 16-bit */
253 1.1 thorpej
254 1.1 thorpej #define STE_IntEnable 0x4c /* 16-bit */
255 1.1 thorpej #define IE_HostError (1U << 1)
256 1.1 thorpej #define IE_TxComplete (1U << 2)
257 1.1 thorpej #define IE_MACControlFrame (1U << 3)
258 1.1 thorpej #define IE_RxComplete (1U << 4)
259 1.1 thorpej #define IE_RxEarly (1U << 5)
260 1.1 thorpej #define IE_IntRequested (1U << 6)
261 1.1 thorpej #define IE_UpdateStats (1U << 7)
262 1.1 thorpej #define IE_LinkEvent (1U << 8)
263 1.1 thorpej #define IE_TxDMAComplete (1U << 9)
264 1.1 thorpej #define IE_RxDMAComplete (1U << 10)
265 1.1 thorpej
266 1.1 thorpej #define STE_IntStatus 0x4e /* 16-bit */
267 1.1 thorpej #define IS_InterruptStatus (1U << 0)
268 1.1 thorpej
269 1.1 thorpej #define STE_MacCtrl0 0x50 /* 16-bit */
270 1.1 thorpej #define MC0_IFSSelect(x) ((x) << 0)
271 1.1 thorpej #define MC0_FullDuplexEnable (1U << 5)
272 1.1 thorpej #define MC0_RcvLargeFrames (1U << 6)
273 1.1 thorpej #define MC0_FlowControlEnable (1U << 8)
274 1.1 thorpej #define MC0_RcvFCS (1U << 9)
275 1.1 thorpej #define MC0_FIFOLoopback (1U << 10)
276 1.1 thorpej #define MC0_MACLoopback (1U << 11)
277 1.1 thorpej
278 1.1 thorpej #define STE_MacCtrl1 0x52 /* 16-bit */
279 1.1 thorpej #define MC1_CollsionDetect (1U << 0)
280 1.1 thorpej #define MC1_CarrierSense (1U << 1)
281 1.1 thorpej #define MC1_TxInProg (1U << 2)
282 1.1 thorpej #define MC1_TxError (1U << 3)
283 1.1 thorpej #define MC1_StatisticsEnable (1U << 5)
284 1.1 thorpej #define MC1_StatisticsDisable (1U << 6)
285 1.1 thorpej #define MC1_StatisticsEnabled (1U << 7)
286 1.1 thorpej #define MC1_TxEnable (1U << 8)
287 1.1 thorpej #define MC1_TxDisable (1U << 9)
288 1.1 thorpej #define MC1_TxEnabled (1U << 10)
289 1.1 thorpej #define MC1_RxEnable (1U << 11)
290 1.1 thorpej #define MC1_RxDisable (1U << 12)
291 1.1 thorpej #define MC1_RxEnabled (1U << 13)
292 1.1 thorpej #define MC1_Paused (1U << 14)
293 1.1 thorpej
294 1.1 thorpej #define STE_StationAddress0 0x54 /* 16-bit */
295 1.1 thorpej
296 1.1 thorpej #define STE_StationAddress1 0x56 /* 16-bit */
297 1.1 thorpej
298 1.1 thorpej #define STE_StationAddress2 0x58 /* 16-bit */
299 1.1 thorpej
300 1.1 thorpej #define STE_MaxFrameSize 0x5a /* 16-bit */
301 1.1 thorpej
302 1.1 thorpej #define STE_ReceiveMode 0x5c /* 8-bit */
303 1.1 thorpej #define RM_ReceiveUnicast (1U << 0)
304 1.1 thorpej #define RM_ReceiveMulticast (1U << 1)
305 1.1 thorpej #define RM_ReceiveBroadcast (1U << 2)
306 1.1 thorpej #define RM_ReceiveAllFrames (1U << 3)
307 1.1 thorpej #define RM_ReceiveMulticastHash (1U << 4)
308 1.1 thorpej #define RM_ReceiveIPMulticast (1U << 5)
309 1.1 thorpej
310 1.1 thorpej #define STE_TxReleaseThresh 0x5d /* 8-bit */
311 1.1 thorpej
312 1.1 thorpej #define STE_PhyCtrl 0x5e /* 8-bit */
313 1.1 thorpej #define PC_MgmtClk (1U << 0)
314 1.1 thorpej #define PC_MgmtData (1U << 1)
315 1.1 thorpej #define PC_MgmtDir (1U << 2) /* 1 = MAC->Phy */
316 1.1 thorpej #define PC_DisableClk25 (1U << 3)
317 1.1 thorpej #define PC_PhyDuplexPolarity (1U << 4)
318 1.1 thorpej #define PC_PhyDuplexStatus (1U << 5)
319 1.1 thorpej #define PC_PhySpeedStatus (1U << 6)
320 1.1 thorpej #define PC_PhyLinkStatus (1U << 7)
321 1.1 thorpej
322 1.1 thorpej #define STE_HashTable0 0x60 /* 16-bit */
323 1.1 thorpej
324 1.1 thorpej #define STE_HashTable1 0x62 /* 16-bit */
325 1.1 thorpej
326 1.1 thorpej #define STE_HashTable2 0x64 /* 16-bit */
327 1.1 thorpej
328 1.1 thorpej #define STE_HashTable3 0x66 /* 16-bit */
329 1.1 thorpej
330 1.1 thorpej #define STE_OctetsReceivedOk0 0x68 /* 16-bit */
331 1.1 thorpej
332 1.1 thorpej #define STE_OctetsReceivedOk1 0x6a /* 16-bit */
333 1.1 thorpej
334 1.1 thorpej #define STE_OctetsTransmittedOk0 0x6c /* 16-bit */
335 1.1 thorpej
336 1.1 thorpej #define STE_OctetsTransmittedOk1 0x6e /* 16-bit */
337 1.1 thorpej
338 1.1 thorpej #define STE_FramesTransmittedOK 0x70 /* 16-bit */
339 1.1 thorpej
340 1.1 thorpej #define STE_FramesReceivedOK 0x72 /* 16-bit */
341 1.1 thorpej
342 1.1 thorpej #define STE_CarrierSenseErrors 0x74 /* 8-bit */
343 1.1 thorpej
344 1.1 thorpej #define STE_LateCollisions 0x75 /* 8-bit */
345 1.1 thorpej
346 1.1 thorpej #define STE_MultipleColFrames 0x76 /* 8-bit */
347 1.1 thorpej
348 1.1 thorpej #define STE_SingleColFrames 0x77 /* 8-bit */
349 1.1 thorpej
350 1.1 thorpej #define STE_FramesWDeferredXmt 0x78 /* 8-bit */
351 1.1 thorpej
352 1.1 thorpej #define STE_FramesLostRxErrors 0x79 /* 8-bit */
353 1.1 thorpej
354 1.1 thorpej #define STE_FramesWExDeferral 0x7a /* 8-bit */
355 1.1 thorpej
356 1.1 thorpej #define STE_FramesXbortXSColls 0x7b /* 8-bit */
357 1.1 thorpej
358 1.1 thorpej #define STE_BcstFramesXmtdOk 0x7c /* 8-bit */
359 1.1 thorpej
360 1.1 thorpej #define STE_BcstFramesRcvdOk 0x7d /* 8-bit */
361 1.1 thorpej
362 1.1 thorpej #define STE_McstFramesXmtdOk 0x7e /* 8-bit */
363 1.1 thorpej
364 1.1 thorpej #define STE_McstFramesRcvdOk 0x7f /* 8-bit */
365 1.1 thorpej
366 1.1 thorpej #endif /* _DEV_PCI_IF_STEREG_H_ */
367