smc90cx6.c revision 1.57 1 1.57 dyoung /* $NetBSD: smc90cx6.c,v 1.57 2008/11/07 00:20:03 dyoung Exp $ */
2 1.2 chopps
3 1.28 is /*-
4 1.29 is * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
5 1.1 chopps * All rights reserved.
6 1.1 chopps *
7 1.28 is * This code is derived from software contributed to The NetBSD Foundation
8 1.28 is * by Ignatios Souvatzis.
9 1.28 is *
10 1.1 chopps * Redistribution and use in source and binary forms, with or without
11 1.1 chopps * modification, are permitted provided that the following conditions
12 1.1 chopps * are met:
13 1.1 chopps * 1. Redistributions of source code must retain the above copyright
14 1.1 chopps * notice, this list of conditions and the following disclaimer.
15 1.1 chopps * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 chopps * notice, this list of conditions and the following disclaimer in the
17 1.1 chopps * documentation and/or other materials provided with the distribution.
18 1.1 chopps *
19 1.28 is * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.28 is * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.28 is * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.28 is * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.28 is * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.28 is * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.28 is * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.28 is * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.28 is * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.28 is * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.28 is * POSSIBILITY OF SUCH DAMAGE.
30 1.1 chopps */
31 1.1 chopps
32 1.1 chopps /*
33 1.25 is * Chip core driver for the SMC90c26 / SMC90c56 (and SMC90c66 in '56
34 1.25 is * compatibility mode) boards
35 1.1 chopps */
36 1.39 lukem
37 1.39 lukem #include <sys/cdefs.h>
38 1.57 dyoung __KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.57 2008/11/07 00:20:03 dyoung Exp $");
39 1.1 chopps
40 1.33 is /* #define BAHSOFTCOPY */
41 1.14 chopps #define BAHRETRANSMIT /**/
42 1.16 is
43 1.24 jonathan #include "opt_inet.h"
44 1.1 chopps #include "bpfilter.h"
45 1.1 chopps
46 1.1 chopps #include <sys/param.h>
47 1.1 chopps #include <sys/systm.h>
48 1.1 chopps #include <sys/mbuf.h>
49 1.1 chopps #include <sys/buf.h>
50 1.1 chopps #include <sys/device.h>
51 1.1 chopps #include <sys/protosw.h>
52 1.1 chopps #include <sys/socket.h>
53 1.1 chopps #include <sys/syslog.h>
54 1.1 chopps #include <sys/ioctl.h>
55 1.1 chopps #include <sys/errno.h>
56 1.51 ad #include <sys/kernel.h>
57 1.51 ad #include <sys/intr.h>
58 1.1 chopps
59 1.1 chopps #include <net/if.h>
60 1.1 chopps #include <net/if_dl.h>
61 1.1 chopps #include <net/if_types.h>
62 1.25 is #include <net/if_arc.h>
63 1.1 chopps
64 1.1 chopps #ifdef INET
65 1.1 chopps #include <netinet/in.h>
66 1.1 chopps #include <netinet/in_systm.h>
67 1.1 chopps #include <netinet/in_var.h>
68 1.1 chopps #include <netinet/ip.h>
69 1.25 is #include <netinet/if_inarp.h>
70 1.1 chopps #endif
71 1.1 chopps
72 1.1 chopps #if NBPFILTER > 0
73 1.1 chopps #include <net/bpf.h>
74 1.1 chopps #include <net/bpfdesc.h>
75 1.1 chopps #endif
76 1.1 chopps
77 1.52 ad #include <sys/bus.h>
78 1.52 ad #include <sys/cpu.h>
79 1.1 chopps #include <machine/mtpr.h>
80 1.1 chopps
81 1.25 is #include <dev/ic/smc90cx6reg.h>
82 1.25 is #include <dev/ic/smc90cx6var.h>
83 1.1 chopps
84 1.1 chopps /* these should be elsewhere */
85 1.1 chopps
86 1.1 chopps #define ARC_MIN_LEN 1
87 1.1 chopps #define ARC_MIN_FORBID_LEN 254
88 1.1 chopps #define ARC_MAX_FORBID_LEN 256
89 1.1 chopps #define ARC_MAX_LEN 508
90 1.1 chopps #define ARC_ADDR_LEN 1
91 1.1 chopps
92 1.6 chopps /* for watchdog timer. This should be more than enough. */
93 1.6 chopps #define ARCTIMEOUT (5*IFNET_SLOWHZ)
94 1.6 chopps
95 1.1 chopps /*
96 1.1 chopps * This currently uses 2 bufs for tx, 2 for rx
97 1.1 chopps *
98 1.1 chopps * New rx protocol:
99 1.1 chopps *
100 1.43 perry * rx has a fillcount variable. If fillcount > (NRXBUF-1),
101 1.43 perry * rx can be switched off from rx hard int.
102 1.1 chopps * Else rx is restarted on the other receiver.
103 1.1 chopps * rx soft int counts down. if it is == (NRXBUF-1), it restarts
104 1.1 chopps * the receiver.
105 1.1 chopps * To ensure packet ordering (we need that for 1201 later), we have a counter
106 1.1 chopps * which is incremented modulo 256 on each receive and a per buffer
107 1.1 chopps * variable, which is set to the counter on filling. The soft int can
108 1.1 chopps * compare both values to determine the older packet.
109 1.1 chopps *
110 1.1 chopps * Transmit direction:
111 1.43 perry *
112 1.1 chopps * bah_start checks tx_fillcount
113 1.1 chopps * case 2: return
114 1.1 chopps *
115 1.1 chopps * else fill tx_act ^ 1 && inc tx_fillcount
116 1.1 chopps *
117 1.1 chopps * check tx_fillcount again.
118 1.1 chopps * case 2: set IFF_OACTIVE to stop arc_output from filling us.
119 1.1 chopps * case 1: start tx
120 1.1 chopps *
121 1.1 chopps * tint clears IFF_OCATIVE, decrements and checks tx_fillcount
122 1.1 chopps * case 1: start tx on tx_act ^ 1, softcall bah_start
123 1.1 chopps * case 0: softcall bah_start
124 1.1 chopps *
125 1.1 chopps * #define fill(i) get mbuf && copy mbuf to chip(i)
126 1.1 chopps */
127 1.1 chopps
128 1.42 perry void bah_init(struct bah_softc *);
129 1.42 perry void bah_reset(struct bah_softc *);
130 1.42 perry void bah_stop(struct bah_softc *);
131 1.42 perry void bah_start(struct ifnet *);
132 1.42 perry int bahintr(void *);
133 1.47 christos int bah_ioctl(struct ifnet *, unsigned long, void *);
134 1.42 perry void bah_watchdog(struct ifnet *);
135 1.42 perry void bah_srint(void *vsc);
136 1.42 perry static void bah_tint(struct bah_softc *, int);
137 1.25 is void bah_reconwatch(void *);
138 1.25 is
139 1.25 is /* short notation */
140 1.25 is
141 1.25 is #define GETREG(off) bus_space_read_1(bst_r, regs, (off))
142 1.25 is #define PUTREG(off, v) bus_space_write_1(bst_r, regs, (off), (v))
143 1.25 is #define GETMEM(off) bus_space_read_1(bst_m, mem, (off))
144 1.25 is #define PUTMEM(off, v) bus_space_write_1(bst_m, mem, (off), (v))
145 1.1 chopps
146 1.1 chopps void
147 1.25 is bah_attach_subr(sc)
148 1.25 is struct bah_softc *sc;
149 1.1 chopps {
150 1.4 mycroft struct ifnet *ifp = &sc->sc_arccom.ac_if;
151 1.25 is int s;
152 1.25 is u_int8_t linkaddress;
153 1.25 is
154 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
155 1.25 is bus_space_tag_t bst_m = sc->sc_bst_m;
156 1.25 is bus_space_handle_t regs = sc->sc_regs;
157 1.25 is bus_space_handle_t mem = sc->sc_mem;
158 1.1 chopps
159 1.1 chopps #if (defined(BAH_DEBUG) && (BAH_DEBUG > 2))
160 1.19 christos printf("\n%s: attach(0x%x, 0x%x, 0x%x)\n",
161 1.55 cegger device_xname(&sc->sc_dev), parent, self, aux);
162 1.1 chopps #endif
163 1.1 chopps s = splhigh();
164 1.1 chopps
165 1.1 chopps /*
166 1.1 chopps * read the arcnet address from the board
167 1.1 chopps */
168 1.1 chopps
169 1.25 is (*sc->sc_reset)(sc, 1);
170 1.1 chopps
171 1.1 chopps do {
172 1.25 is delay(200);
173 1.43 perry } while (!(GETREG(BAHSTAT) & BAH_POR));
174 1.1 chopps
175 1.25 is linkaddress = GETMEM(BAHMACOFF);
176 1.1 chopps
177 1.25 is printf(": link addr 0x%02x(%d)\n", linkaddress, linkaddress);
178 1.1 chopps
179 1.1 chopps /* clear the int mask... */
180 1.1 chopps
181 1.25 is sc->sc_intmask = 0;
182 1.25 is PUTREG(BAHSTAT, 0);
183 1.1 chopps
184 1.25 is PUTREG(BAHCMD, BAH_CONF(CONF_LONG));
185 1.25 is PUTREG(BAHCMD, BAH_CLR(CLR_POR|CLR_RECONFIG));
186 1.3 chopps sc->sc_recontime = sc->sc_reconcount = 0;
187 1.1 chopps
188 1.1 chopps /* and reenable kernel int level */
189 1.1 chopps splx(s);
190 1.1 chopps
191 1.1 chopps /*
192 1.1 chopps * set interface to stopped condition (reset)
193 1.1 chopps */
194 1.43 perry bah_stop(sc);
195 1.1 chopps
196 1.55 cegger strlcpy(ifp->if_xname, device_xname(&sc->sc_dev), IFNAMSIZ);
197 1.17 thorpej ifp->if_softc = sc;
198 1.1 chopps ifp->if_start = bah_start;
199 1.1 chopps ifp->if_ioctl = bah_ioctl;
200 1.6 chopps ifp->if_timer = 0;
201 1.6 chopps ifp->if_watchdog = bah_watchdog;
202 1.37 thorpej IFQ_SET_READY(&ifp->if_snd);
203 1.6 chopps
204 1.25 is ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
205 1.6 chopps
206 1.6 chopps ifp->if_mtu = ARCMTU;
207 1.1 chopps
208 1.25 is arc_ifattach(ifp, linkaddress);
209 1.1 chopps
210 1.25 is #ifdef BAHSOFTCOPY
211 1.51 ad sc->sc_rxcookie = softint_establish(SOFTINT_NET, bah_srint, sc);
212 1.51 ad sc->sc_txcookie = softint_establish(SOFTINT_NET,
213 1.42 perry (void (*)(void *))bah_start, ifp);
214 1.25 is #endif
215 1.25 is
216 1.48 he callout_init(&sc->sc_recon_ch, 0);
217 1.1 chopps }
218 1.1 chopps
219 1.1 chopps /*
220 1.1 chopps * Initialize device
221 1.1 chopps *
222 1.1 chopps */
223 1.1 chopps void
224 1.1 chopps bah_init(sc)
225 1.1 chopps struct bah_softc *sc;
226 1.1 chopps {
227 1.3 chopps struct ifnet *ifp;
228 1.1 chopps int s;
229 1.3 chopps
230 1.3 chopps ifp = &sc->sc_arccom.ac_if;
231 1.1 chopps
232 1.1 chopps if ((ifp->if_flags & IFF_RUNNING) == 0) {
233 1.13 mycroft s = splnet();
234 1.1 chopps ifp->if_flags |= IFF_RUNNING;
235 1.1 chopps bah_reset(sc);
236 1.4 mycroft bah_start(ifp);
237 1.1 chopps splx(s);
238 1.1 chopps }
239 1.1 chopps }
240 1.1 chopps
241 1.1 chopps /*
242 1.1 chopps * Reset the interface...
243 1.1 chopps *
244 1.1 chopps * this assumes that it is called inside a critical section...
245 1.1 chopps *
246 1.1 chopps */
247 1.1 chopps void
248 1.1 chopps bah_reset(sc)
249 1.1 chopps struct bah_softc *sc;
250 1.1 chopps {
251 1.3 chopps struct ifnet *ifp;
252 1.53 he uint8_t linkaddress;
253 1.1 chopps
254 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
255 1.25 is bus_space_tag_t bst_m = sc->sc_bst_m;
256 1.25 is bus_space_handle_t regs = sc->sc_regs;
257 1.25 is bus_space_handle_t mem = sc->sc_mem;
258 1.25 is
259 1.1 chopps ifp = &sc->sc_arccom.ac_if;
260 1.1 chopps
261 1.1 chopps #ifdef BAH_DEBUG
262 1.55 cegger printf("%s: reset\n", device_xname(&sc->sc_dev));
263 1.1 chopps #endif
264 1.25 is /* stop and restart hardware */
265 1.1 chopps
266 1.25 is (*sc->sc_reset)(sc, 1);
267 1.1 chopps do {
268 1.14 chopps DELAY(200);
269 1.43 perry } while (!(GETREG(BAHSTAT) & BAH_POR));
270 1.1 chopps
271 1.25 is linkaddress = GETMEM(BAHMACOFF);
272 1.6 chopps
273 1.1 chopps #if defined(BAH_DEBUG) && (BAH_DEBUG > 2)
274 1.19 christos printf("%s: reset: card reset, link addr = 0x%02x (%ld)\n",
275 1.55 cegger device_xname(&sc->sc_dev), linkaddress, linkaddress);
276 1.1 chopps #endif
277 1.6 chopps
278 1.6 chopps /* tell the routing level about the (possibly changed) link address */
279 1.57 dyoung if_set_sadl(ifp, &linkaddress, sizeof(linkaddress), false);
280 1.6 chopps
281 1.1 chopps /* POR is NMI, but we need it below: */
282 1.25 is sc->sc_intmask = BAH_RECON|BAH_POR;
283 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
284 1.25 is PUTREG(BAHCMD, BAH_CONF(CONF_LONG));
285 1.43 perry
286 1.1 chopps #ifdef BAH_DEBUG
287 1.19 christos printf("%s: reset: chip configured, status=0x%02x\n",
288 1.55 cegger device_xname(&sc->sc_dev), GETREG(BAHSTAT));
289 1.1 chopps #endif
290 1.25 is PUTREG(BAHCMD, BAH_CLR(CLR_POR|CLR_RECONFIG));
291 1.1 chopps
292 1.1 chopps #ifdef BAH_DEBUG
293 1.19 christos printf("%s: reset: bits cleared, status=0x%02x\n",
294 1.55 cegger device_xname(&sc->sc_dev), GETREG(BAHSTAT);
295 1.1 chopps #endif
296 1.1 chopps
297 1.1 chopps sc->sc_reconcount_excessive = ARC_EXCESSIVE_RECONS;
298 1.1 chopps
299 1.1 chopps /* start receiver */
300 1.1 chopps
301 1.25 is sc->sc_intmask |= BAH_RI;
302 1.14 chopps sc->sc_rx_fillcount = 0;
303 1.1 chopps sc->sc_rx_act = 2;
304 1.1 chopps
305 1.25 is PUTREG(BAHCMD, BAH_RXBC(2));
306 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
307 1.1 chopps
308 1.1 chopps #ifdef BAH_DEBUG
309 1.19 christos printf("%s: reset: started receiver, status=0x%02x\n",
310 1.55 cegger device_xname(&sc->sc_dev), GETREG(BAHSTAT);
311 1.1 chopps #endif
312 1.1 chopps
313 1.1 chopps /* and init transmitter status */
314 1.1 chopps sc->sc_tx_act = 0;
315 1.1 chopps sc->sc_tx_fillcount = 0;
316 1.1 chopps
317 1.1 chopps ifp->if_flags |= IFF_RUNNING;
318 1.1 chopps ifp->if_flags &= ~IFF_OACTIVE;
319 1.1 chopps
320 1.1 chopps bah_start(ifp);
321 1.1 chopps }
322 1.1 chopps
323 1.1 chopps /*
324 1.1 chopps * Take interface offline
325 1.1 chopps */
326 1.1 chopps void
327 1.1 chopps bah_stop(sc)
328 1.1 chopps struct bah_softc *sc;
329 1.1 chopps {
330 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
331 1.25 is bus_space_handle_t regs = sc->sc_regs;
332 1.25 is
333 1.1 chopps /* Stop the interrupts */
334 1.25 is PUTREG(BAHSTAT, 0);
335 1.1 chopps
336 1.1 chopps /* Stop the interface */
337 1.25 is (*sc->sc_reset)(sc, 0);
338 1.1 chopps
339 1.6 chopps /* Stop watchdog timer */
340 1.6 chopps sc->sc_arccom.ac_if.if_timer = 0;
341 1.1 chopps }
342 1.1 chopps
343 1.1 chopps /*
344 1.1 chopps * Start output on interface. Get another datagram to send
345 1.1 chopps * off the interface queue, and copy it to the
346 1.41 wiz * interface before starting the output
347 1.1 chopps *
348 1.1 chopps * this assumes that it is called inside a critical section...
349 1.1 chopps * XXX hm... does it still?
350 1.1 chopps *
351 1.1 chopps */
352 1.4 mycroft void
353 1.1 chopps bah_start(ifp)
354 1.1 chopps struct ifnet *ifp;
355 1.1 chopps {
356 1.25 is struct bah_softc *sc = ifp->if_softc;
357 1.1 chopps struct mbuf *m,*mp;
358 1.25 is
359 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
360 1.25 is bus_space_handle_t regs = sc->sc_regs;
361 1.25 is bus_space_tag_t bst_m = sc->sc_bst_m;
362 1.25 is bus_space_handle_t mem = sc->sc_mem;
363 1.25 is
364 1.25 is int bah_ram_ptr;
365 1.14 chopps int len, tlen, offset, s, buffer;
366 1.1 chopps #ifdef BAHTIMINGS
367 1.7 cgd u_long copystart, lencopy, perbyte;
368 1.1 chopps #endif
369 1.1 chopps
370 1.1 chopps #if defined(BAH_DEBUG) && (BAH_DEBUG > 3)
371 1.55 cegger printf("%s: start(0x%x)\n", device_xname(&sc->sc_dev), ifp);
372 1.1 chopps #endif
373 1.1 chopps
374 1.4 mycroft if ((ifp->if_flags & IFF_RUNNING) == 0)
375 1.5 chopps return;
376 1.1 chopps
377 1.13 mycroft s = splnet();
378 1.1 chopps
379 1.1 chopps if (sc->sc_tx_fillcount >= 2) {
380 1.1 chopps splx(s);
381 1.5 chopps return;
382 1.1 chopps }
383 1.1 chopps
384 1.37 thorpej IFQ_DEQUEUE(&ifp->if_snd, m);
385 1.1 chopps buffer = sc->sc_tx_act ^ 1;
386 1.1 chopps
387 1.1 chopps splx(s);
388 1.1 chopps
389 1.1 chopps if (m == 0)
390 1.5 chopps return;
391 1.1 chopps
392 1.1 chopps #if NBPFILTER > 0
393 1.1 chopps /*
394 1.1 chopps * If bpf is listening on this interface, let it
395 1.1 chopps * see the packet before we commit it to the wire
396 1.1 chopps *
397 1.1 chopps * (can't give the copy in A2060 card RAM to bpf, because
398 1.1 chopps * that RAM is just accessed as on every other byte)
399 1.1 chopps */
400 1.4 mycroft if (ifp->if_bpf)
401 1.4 mycroft bpf_mtap(ifp->if_bpf, m);
402 1.4 mycroft #endif
403 1.1 chopps
404 1.1 chopps #ifdef BAH_DEBUG
405 1.33 is if (m->m_len < ARC_HDRLEN)
406 1.33 is m = m_pullup(m, ARC_HDRLEN);/* gcc does structure padding */
407 1.19 christos printf("%s: start: filling %ld from %ld to %ld type %ld\n",
408 1.55 cegger device_xname(&sc->sc_dev), buffer, mtod(m, u_char *)[0],
409 1.7 cgd mtod(m, u_char *)[1], mtod(m, u_char *)[2]);
410 1.1 chopps #else
411 1.33 is if (m->m_len < 2)
412 1.33 is m = m_pullup(m, 2);
413 1.1 chopps #endif
414 1.25 is bah_ram_ptr = buffer*512;
415 1.1 chopps
416 1.33 is if (m == 0)
417 1.33 is return;
418 1.33 is
419 1.1 chopps /* write the addresses to RAM and throw them away */
420 1.1 chopps
421 1.1 chopps /*
422 1.1 chopps * Hardware does this: Yet Another Microsecond Saved.
423 1.1 chopps * (btw, timing code says usually 2 microseconds)
424 1.25 is * PUTMEM(bah_ram_ptr + 0, mtod(m, u_char *)[0]);
425 1.1 chopps */
426 1.25 is
427 1.25 is PUTMEM(bah_ram_ptr + 1, mtod(m, u_char *)[1]);
428 1.4 mycroft m_adj(m, 2);
429 1.43 perry
430 1.14 chopps /* get total length left at this point */
431 1.14 chopps tlen = m->m_pkthdr.len;
432 1.3 chopps if (tlen < ARC_MIN_FORBID_LEN) {
433 1.7 cgd offset = 256 - tlen;
434 1.25 is PUTMEM(bah_ram_ptr + 2, offset);
435 1.3 chopps } else {
436 1.25 is PUTMEM(bah_ram_ptr + 2, 0);
437 1.14 chopps if (tlen <= ARC_MAX_FORBID_LEN)
438 1.14 chopps offset = 255; /* !!! */
439 1.1 chopps else {
440 1.1 chopps if (tlen > ARC_MAX_LEN)
441 1.1 chopps tlen = ARC_MAX_LEN;
442 1.7 cgd offset = 512 - tlen;
443 1.1 chopps }
444 1.25 is PUTMEM(bah_ram_ptr + 3, offset);
445 1.1 chopps
446 1.1 chopps }
447 1.25 is bah_ram_ptr += offset;
448 1.1 chopps
449 1.14 chopps /* lets loop through the mbuf chain */
450 1.1 chopps
451 1.7 cgd for (mp = m; mp; mp = mp->m_next) {
452 1.14 chopps if ((len = mp->m_len)) { /* YAMS */
453 1.25 is bus_space_write_region_1(bst_m, mem, bah_ram_ptr,
454 1.47 christos mtod(mp, void *), len);
455 1.1 chopps
456 1.25 is bah_ram_ptr += len;
457 1.1 chopps }
458 1.1 chopps }
459 1.1 chopps
460 1.1 chopps sc->sc_broadcast[buffer] = (m->m_flags & M_BCAST) != 0;
461 1.4 mycroft sc->sc_retransmits[buffer] = (m->m_flags & M_BCAST) ? 1 : 5;
462 1.1 chopps
463 1.1 chopps /* actually transmit the packet */
464 1.13 mycroft s = splnet();
465 1.1 chopps
466 1.43 perry if (++sc->sc_tx_fillcount > 1) {
467 1.3 chopps /*
468 1.3 chopps * We are filled up to the rim. No more bufs for the moment,
469 1.3 chopps * please.
470 1.3 chopps */
471 1.3 chopps ifp->if_flags |= IFF_OACTIVE;
472 1.3 chopps } else {
473 1.1 chopps #ifdef BAH_DEBUG
474 1.43 perry printf("%s: start: starting transmitter on buffer %d\n",
475 1.55 cegger device_xname(&sc->sc_dev), buffer);
476 1.1 chopps #endif
477 1.1 chopps /* Transmitter was off, start it */
478 1.1 chopps sc->sc_tx_act = buffer;
479 1.1 chopps
480 1.1 chopps /*
481 1.1 chopps * We still can accept another buf, so don't:
482 1.1 chopps * ifp->if_flags |= IFF_OACTIVE;
483 1.1 chopps */
484 1.25 is sc->sc_intmask |= BAH_TA;
485 1.25 is PUTREG(BAHCMD, BAH_TX(buffer));
486 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
487 1.1 chopps
488 1.6 chopps sc->sc_arccom.ac_if.if_timer = ARCTIMEOUT;
489 1.1 chopps }
490 1.1 chopps splx(s);
491 1.1 chopps m_freem(m);
492 1.1 chopps
493 1.1 chopps /*
494 1.6 chopps * After 10 times reading the docs, I realized
495 1.6 chopps * that in the case the receiver NAKs the buffer request,
496 1.1 chopps * the hardware retries till shutdown.
497 1.6 chopps * This is integrated now in the code above.
498 1.1 chopps */
499 1.6 chopps
500 1.6 chopps return;
501 1.1 chopps }
502 1.1 chopps
503 1.1 chopps /*
504 1.1 chopps * Arcnet interface receiver soft interrupt:
505 1.1 chopps * get the stuff out of any filled buffer we find.
506 1.1 chopps */
507 1.1 chopps void
508 1.25 is bah_srint(vsc)
509 1.25 is void *vsc;
510 1.14 chopps {
511 1.25 is struct bah_softc *sc = (struct bah_softc *)vsc;
512 1.25 is int buffer, len, len1, amount, offset, s, type;
513 1.25 is int bah_ram_ptr;
514 1.3 chopps struct mbuf *m, *dst, *head;
515 1.3 chopps struct arc_header *ah;
516 1.5 chopps struct ifnet *ifp;
517 1.25 is
518 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
519 1.25 is bus_space_tag_t bst_m = sc->sc_bst_m;
520 1.25 is bus_space_handle_t regs = sc->sc_regs;
521 1.25 is bus_space_handle_t mem = sc->sc_mem;
522 1.25 is
523 1.14 chopps ifp = &sc->sc_arccom.ac_if;
524 1.3 chopps head = 0;
525 1.1 chopps
526 1.13 mycroft s = splnet();
527 1.14 chopps buffer = sc->sc_rx_act ^ 1;
528 1.1 chopps splx(s);
529 1.1 chopps
530 1.1 chopps /* Allocate header mbuf */
531 1.1 chopps MGETHDR(m, M_DONTWAIT, MT_DATA);
532 1.1 chopps
533 1.1 chopps if (m == 0) {
534 1.43 perry /*
535 1.1 chopps * in case s.th. goes wrong with mem, drop it
536 1.1 chopps * to make sure the receiver can be started again
537 1.1 chopps * count it as input error (we dont have any other
538 1.1 chopps * detectable)
539 1.1 chopps */
540 1.5 chopps ifp->if_ierrors++;
541 1.1 chopps goto cleanup;
542 1.1 chopps }
543 1.43 perry
544 1.5 chopps m->m_pkthdr.rcvif = ifp;
545 1.1 chopps
546 1.1 chopps /*
547 1.1 chopps * Align so that IP packet will be longword aligned. Here we
548 1.1 chopps * assume that m_data of new packet is longword aligned.
549 1.8 cgd * When implementing PHDS, we might have to change it to 2,
550 1.8 cgd * (2*sizeof(ulong) - ARC_HDRNEWLEN)), packet type dependent.
551 1.1 chopps */
552 1.1 chopps
553 1.25 is bah_ram_ptr = buffer*512;
554 1.25 is offset = GETMEM(bah_ram_ptr + 2);
555 1.3 chopps if (offset)
556 1.1 chopps len = 256 - offset;
557 1.3 chopps else {
558 1.25 is offset = GETMEM(bah_ram_ptr + 3);
559 1.1 chopps len = 512 - offset;
560 1.1 chopps }
561 1.33 is if (len+2 >= MINCLSIZE)
562 1.33 is MCLGET(m, M_DONTWAIT);
563 1.43 perry
564 1.33 is if (m == 0) {
565 1.33 is ifp->if_ierrors++;
566 1.33 is goto cleanup;
567 1.33 is }
568 1.33 is
569 1.25 is type = GETMEM(bah_ram_ptr + offset);
570 1.8 cgd m->m_data += 1 + arc_isphds(type);
571 1.8 cgd
572 1.8 cgd head = m;
573 1.8 cgd ah = mtod(head, struct arc_header *);
574 1.43 perry
575 1.25 is ah->arc_shost = GETMEM(bah_ram_ptr + 0);
576 1.25 is ah->arc_dhost = GETMEM(bah_ram_ptr + 1);
577 1.8 cgd
578 1.8 cgd m->m_pkthdr.len = len+2; /* whole packet length */
579 1.8 cgd m->m_len = 2; /* mbuf filled with ARCnet addresses */
580 1.25 is bah_ram_ptr += offset; /* ram buffer continues there */
581 1.1 chopps
582 1.1 chopps while (len > 0) {
583 1.43 perry
584 1.1 chopps len1 = len;
585 1.1 chopps amount = M_TRAILINGSPACE(m);
586 1.1 chopps
587 1.1 chopps if (amount == 0) {
588 1.1 chopps dst = m;
589 1.1 chopps MGET(m, M_DONTWAIT, MT_DATA);
590 1.43 perry
591 1.1 chopps if (m == 0) {
592 1.5 chopps ifp->if_ierrors++;
593 1.1 chopps goto cleanup;
594 1.1 chopps }
595 1.43 perry
596 1.25 is if (len1 >= MINCLSIZE)
597 1.1 chopps MCLGET(m, M_DONTWAIT);
598 1.43 perry
599 1.1 chopps m->m_len = 0;
600 1.1 chopps dst->m_next = m;
601 1.1 chopps amount = M_TRAILINGSPACE(m);
602 1.1 chopps }
603 1.1 chopps
604 1.1 chopps if (amount < len1)
605 1.1 chopps len1 = amount;
606 1.1 chopps
607 1.43 perry bus_space_read_region_1(bst_m, mem, bah_ram_ptr,
608 1.25 is mtod(m, u_char *) + m->m_len, len1);
609 1.1 chopps
610 1.1 chopps m->m_len += len1;
611 1.25 is bah_ram_ptr += len1;
612 1.1 chopps len -= len1;
613 1.1 chopps }
614 1.1 chopps
615 1.1 chopps #if NBPFILTER > 0
616 1.4 mycroft if (ifp->if_bpf)
617 1.4 mycroft bpf_mtap(ifp->if_bpf, head);
618 1.1 chopps #endif
619 1.1 chopps
620 1.30 thorpej (*sc->sc_arccom.ac_if.if_input)(&sc->sc_arccom.ac_if, head);
621 1.1 chopps
622 1.1 chopps head = NULL;
623 1.5 chopps ifp->if_ipackets++;
624 1.43 perry
625 1.1 chopps cleanup:
626 1.1 chopps
627 1.14 chopps if (head != NULL)
628 1.1 chopps m_freem(head);
629 1.1 chopps
630 1.16 is /* mark buffer as invalid by source id 0 */
631 1.25 is bus_space_write_1(bst_m, mem, buffer*512, 0);
632 1.13 mycroft s = splnet();
633 1.1 chopps
634 1.14 chopps if (--sc->sc_rx_fillcount == 2 - 1) {
635 1.1 chopps
636 1.1 chopps /* was off, restart it on buffer just emptied */
637 1.1 chopps sc->sc_rx_act = buffer;
638 1.25 is sc->sc_intmask |= BAH_RI;
639 1.1 chopps
640 1.40 wiz /* this also clears the RI flag interrupt: */
641 1.25 is PUTREG(BAHCMD, BAH_RXBC(buffer));
642 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
643 1.1 chopps
644 1.1 chopps #ifdef BAH_DEBUG
645 1.19 christos printf("%s: srint: restarted rx on buf %ld\n",
646 1.55 cegger device_xname(&sc->sc_dev), buffer);
647 1.1 chopps #endif
648 1.1 chopps }
649 1.1 chopps splx(s);
650 1.1 chopps }
651 1.1 chopps
652 1.45 perry inline static void
653 1.14 chopps bah_tint(sc, isr)
654 1.1 chopps struct bah_softc *sc;
655 1.14 chopps int isr;
656 1.1 chopps {
657 1.14 chopps struct ifnet *ifp;
658 1.14 chopps
659 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
660 1.25 is bus_space_handle_t regs = sc->sc_regs;
661 1.25 is
662 1.25 is
663 1.1 chopps int buffer;
664 1.14 chopps #ifdef BAHTIMINGS
665 1.1 chopps int clknow;
666 1.14 chopps #endif
667 1.1 chopps
668 1.14 chopps ifp = &(sc->sc_arccom.ac_if);
669 1.1 chopps buffer = sc->sc_tx_act;
670 1.1 chopps
671 1.6 chopps /*
672 1.43 perry * retransmit code:
673 1.41 wiz * Normal situations first for fast path:
674 1.14 chopps * If acknowledgement received ok or broadcast, we're ok.
675 1.43 perry * else if
676 1.43 perry */
677 1.1 chopps
678 1.25 is if (isr & BAH_TMA || sc->sc_broadcast[buffer])
679 1.14 chopps sc->sc_arccom.ac_if.if_opackets++;
680 1.14 chopps #ifdef BAHRETRANSMIT
681 1.43 perry else if (ifp->if_flags & IFF_LINK2 && ifp->if_timer > 0
682 1.14 chopps && --sc->sc_retransmits[buffer] > 0) {
683 1.14 chopps /* retransmit same buffer */
684 1.25 is PUTREG(BAHCMD, BAH_TX(buffer));
685 1.14 chopps return;
686 1.14 chopps }
687 1.14 chopps #endif
688 1.3 chopps else
689 1.14 chopps ifp->if_oerrors++;
690 1.43 perry
691 1.43 perry
692 1.1 chopps /* We know we can accept another buffer at this point. */
693 1.14 chopps ifp->if_flags &= ~IFF_OACTIVE;
694 1.1 chopps
695 1.1 chopps if (--sc->sc_tx_fillcount > 0) {
696 1.1 chopps
697 1.43 perry /*
698 1.1 chopps * start tx on other buffer.
699 1.1 chopps * This also clears the int flag
700 1.1 chopps */
701 1.1 chopps buffer ^= 1;
702 1.1 chopps sc->sc_tx_act = buffer;
703 1.1 chopps
704 1.1 chopps /*
705 1.1 chopps * already given:
706 1.43 perry * sc->sc_intmask |= BAH_TA;
707 1.25 is * PUTREG(BAHSTAT, sc->sc_intmask);
708 1.1 chopps */
709 1.25 is PUTREG(BAHCMD, BAH_TX(buffer));
710 1.6 chopps /* init watchdog timer */
711 1.14 chopps ifp->if_timer = ARCTIMEOUT;
712 1.1 chopps
713 1.1 chopps #if defined(BAH_DEBUG) && (BAH_DEBUG > 1)
714 1.43 perry printf("%s: tint: starting tx on buffer %d, status 0x%02x\n",
715 1.55 cegger device_xname(&sc->sc_dev), buffer, GETREG(BAHSTAT));
716 1.1 chopps #endif
717 1.1 chopps } else {
718 1.1 chopps /* have to disable TX interrupt */
719 1.25 is sc->sc_intmask &= ~BAH_TA;
720 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
721 1.6 chopps /* ... and watchdog timer */
722 1.14 chopps ifp->if_timer = 0;
723 1.1 chopps
724 1.1 chopps #ifdef BAH_DEBUG
725 1.19 christos printf("%s: tint: no more buffers to send, status 0x%02x\n",
726 1.55 cegger device_xname(&sc->sc_dev), GETREG(BAHSTAT));
727 1.1 chopps #endif
728 1.1 chopps }
729 1.1 chopps
730 1.25 is /* XXXX TODO */
731 1.1 chopps #ifdef BAHSOFTCOPY
732 1.1 chopps /* schedule soft int to fill a new buffer for us */
733 1.51 ad softint_schedule(sc->sc_txcookie);
734 1.1 chopps #else
735 1.1 chopps /* call it directly */
736 1.26 is bah_start(ifp);
737 1.1 chopps #endif
738 1.1 chopps }
739 1.1 chopps
740 1.1 chopps /*
741 1.1 chopps * Our interrupt routine
742 1.1 chopps */
743 1.1 chopps int
744 1.25 is bahintr(arg)
745 1.25 is void *arg;
746 1.1 chopps {
747 1.25 is struct bah_softc *sc = arg;
748 1.25 is
749 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
750 1.25 is bus_space_tag_t bst_m = sc->sc_bst_m;
751 1.25 is bus_space_handle_t regs = sc->sc_regs;
752 1.25 is bus_space_handle_t mem = sc->sc_mem;
753 1.25 is
754 1.11 chopps u_char isr, maskedisr;
755 1.1 chopps int buffer;
756 1.1 chopps u_long newsec;
757 1.1 chopps
758 1.25 is isr = GETREG(BAHSTAT);
759 1.11 chopps maskedisr = isr & sc->sc_intmask;
760 1.43 perry if (!maskedisr)
761 1.3 chopps return (0);
762 1.25 is do {
763 1.1 chopps
764 1.1 chopps #if defined(BAH_DEBUG) && (BAH_DEBUG>1)
765 1.25 is printf("%s: intr: status 0x%02x, intmask 0x%02x\n",
766 1.55 cegger device_xname(&sc->sc_dev), isr, sc->sc_intmask);
767 1.1 chopps #endif
768 1.1 chopps
769 1.25 is if (maskedisr & BAH_POR) {
770 1.43 perry /*
771 1.25 is * XXX We should never see this. Don't bother to store
772 1.25 is * the address.
773 1.25 is * sc->sc_arccom.ac_anaddr = GETMEM(BAHMACOFF);
774 1.25 is */
775 1.25 is PUTREG(BAHCMD, BAH_CLR(CLR_POR));
776 1.3 chopps log(LOG_WARNING,
777 1.25 is "%s: intr: got spurious power on reset int\n",
778 1.55 cegger device_xname(&sc->sc_dev));
779 1.1 chopps }
780 1.43 perry
781 1.25 is if (maskedisr & BAH_RECON) {
782 1.16 is /*
783 1.25 is * we dont need to:
784 1.25 is * PUTREG(BAHCMD, BAH_CONF(CONF_LONG));
785 1.16 is */
786 1.25 is PUTREG(BAHCMD, BAH_CLR(CLR_RECONFIG));
787 1.25 is sc->sc_arccom.ac_if.if_collisions++;
788 1.43 perry
789 1.1 chopps /*
790 1.25 is * If less than 2 seconds per reconfig:
791 1.25 is * If ARC_EXCESSIVE_RECONFIGS
792 1.46 wiz * since last burst, complain and set threshold for
793 1.25 is * warnings to ARC_EXCESSIVE_RECONS_REWARN.
794 1.25 is *
795 1.25 is * This allows for, e.g., new stations on the cable, or
796 1.25 is * cable switching as long as it is over after
797 1.25 is * (normally) 16 seconds.
798 1.25 is *
799 1.25 is * XXX TODO: check timeout bits in status word and
800 1.25 is * double time if necessary.
801 1.1 chopps */
802 1.43 perry
803 1.34 thorpej callout_stop(&sc->sc_recon_ch);
804 1.54 joerg newsec = time_second;
805 1.43 perry if ((newsec - sc->sc_recontime <= 2) &&
806 1.25 is (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) {
807 1.25 is log(LOG_WARNING,
808 1.25 is "%s: excessive token losses, "
809 1.55 cegger "cable problem?\n", device_xname(&sc->sc_dev));
810 1.25 is }
811 1.25 is sc->sc_recontime = newsec;
812 1.34 thorpej callout_reset(&sc->sc_recon_ch, 15 * hz,
813 1.34 thorpej bah_reconwatch, (void *)sc);
814 1.25 is }
815 1.25 is
816 1.25 is if (maskedisr & BAH_RI) {
817 1.25 is #if defined(BAH_DEBUG) && (BAH_DEBUG > 1)
818 1.25 is printf("%s: intr: hard rint, act %ld\n",
819 1.55 cegger device_xname(&sc->sc_dev), sc->sc_rx_act);
820 1.25 is #endif
821 1.1 chopps
822 1.25 is buffer = sc->sc_rx_act;
823 1.25 is /* look if buffer is marked invalid: */
824 1.25 is if (GETMEM(buffer*512) == 0) {
825 1.25 is /*
826 1.25 is * invalid marked buffer (or illegally
827 1.25 is * configured sender)
828 1.25 is */
829 1.43 perry log(LOG_WARNING,
830 1.40 wiz "%s: spurious RX interrupt or sender 0 "
831 1.55 cegger " (ignored)\n", device_xname(&sc->sc_dev));
832 1.25 is /*
833 1.25 is * restart receiver on same buffer.
834 1.25 is * XXX maybe better reset interface?
835 1.25 is */
836 1.25 is PUTREG(BAHCMD, BAH_RXBC(buffer));
837 1.25 is } else {
838 1.25 is if (++sc->sc_rx_fillcount > 1) {
839 1.25 is sc->sc_intmask &= ~BAH_RI;
840 1.25 is PUTREG(BAHSTAT, sc->sc_intmask);
841 1.25 is } else {
842 1.25 is buffer ^= 1;
843 1.25 is sc->sc_rx_act = buffer;
844 1.43 perry
845 1.25 is /*
846 1.25 is * Start receiver on other receive
847 1.25 is * buffer. This also clears the RI
848 1.40 wiz * interrupt flag.
849 1.25 is */
850 1.25 is PUTREG(BAHCMD, BAH_RXBC(buffer));
851 1.25 is /* in RX intr, so mask is ok for RX */
852 1.43 perry
853 1.1 chopps #ifdef BAH_DEBUG
854 1.25 is printf("%s: strt rx for buf %ld, "
855 1.25 is "stat 0x%02x\n",
856 1.55 cegger device_xname(&sc->sc_dev), sc->sc_rx_act,
857 1.25 is GETREG(BAHSTAT);
858 1.1 chopps #endif
859 1.25 is }
860 1.43 perry
861 1.1 chopps #ifdef BAHSOFTCOPY
862 1.25 is /*
863 1.25 is * this one starts a soft int to copy out
864 1.25 is * of the hw
865 1.25 is */
866 1.51 ad softint_schedule(sc->sc_rxcookie);
867 1.1 chopps #else
868 1.25 is /* this one does the copy here */
869 1.25 is bah_srint(sc);
870 1.1 chopps #endif
871 1.25 is }
872 1.25 is }
873 1.25 is if (maskedisr & BAH_TA) {
874 1.25 is bah_tint(sc, isr);
875 1.25 is }
876 1.25 is isr = GETREG(BAHSTAT);
877 1.25 is maskedisr = isr & sc->sc_intmask;
878 1.25 is } while (maskedisr);
879 1.25 is
880 1.25 is return (1);
881 1.25 is }
882 1.1 chopps
883 1.25 is void
884 1.25 is bah_reconwatch(arg)
885 1.25 is void *arg;
886 1.25 is {
887 1.25 is struct bah_softc *sc = arg;
888 1.1 chopps
889 1.25 is if (sc->sc_reconcount >= ARC_EXCESSIVE_RECONS) {
890 1.25 is sc->sc_reconcount = 0;
891 1.25 is log(LOG_WARNING, "%s: token valid again.\n",
892 1.55 cegger device_xname(&sc->sc_dev));
893 1.25 is }
894 1.25 is sc->sc_reconcount = 0;
895 1.1 chopps }
896 1.1 chopps
897 1.25 is
898 1.1 chopps /*
899 1.43 perry * Process an ioctl request.
900 1.1 chopps * This code needs some work - it looks pretty ugly.
901 1.1 chopps */
902 1.1 chopps int
903 1.50 he bah_ioctl(ifp, cmd, data)
904 1.35 augustss struct ifnet *ifp;
905 1.50 he u_long cmd;
906 1.47 christos void *data;
907 1.1 chopps {
908 1.1 chopps struct bah_softc *sc;
909 1.35 augustss struct ifaddr *ifa;
910 1.25 is struct ifreq *ifr;
911 1.3 chopps int s, error;
912 1.1 chopps
913 1.3 chopps error = 0;
914 1.17 thorpej sc = ifp->if_softc;
915 1.1 chopps ifa = (struct ifaddr *)data;
916 1.25 is ifr = (struct ifreq *)data;
917 1.13 mycroft s = splnet();
918 1.1 chopps
919 1.43 perry #if defined(BAH_DEBUG) && (BAH_DEBUG > 2)
920 1.19 christos printf("%s: ioctl() called, cmd = 0x%x\n",
921 1.55 cegger device_xname(&sc->sc_dev), cmd);
922 1.1 chopps #endif
923 1.1 chopps
924 1.50 he switch (cmd) {
925 1.57 dyoung case SIOCINITIFADDR:
926 1.1 chopps ifp->if_flags |= IFF_UP;
927 1.57 dyoung bah_init(sc);
928 1.4 mycroft switch (ifa->ifa_addr->sa_family) {
929 1.1 chopps #ifdef INET
930 1.1 chopps case AF_INET:
931 1.25 is arp_ifinit(ifp, ifa);
932 1.1 chopps break;
933 1.1 chopps #endif
934 1.1 chopps default:
935 1.1 chopps break;
936 1.1 chopps }
937 1.1 chopps
938 1.1 chopps case SIOCSIFFLAGS:
939 1.57 dyoung if ((error = ifioctl_common(ifp, cmd, data)) != 0)
940 1.57 dyoung break;
941 1.57 dyoung /* XXX re-use ether_ioctl() */
942 1.57 dyoung switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
943 1.57 dyoung case IFF_RUNNING:
944 1.1 chopps /*
945 1.43 perry * If interface is marked down and it is running,
946 1.1 chopps * then stop it.
947 1.1 chopps */
948 1.1 chopps bah_stop(sc);
949 1.1 chopps ifp->if_flags &= ~IFF_RUNNING;
950 1.57 dyoung break;
951 1.57 dyoung case IFF_UP:
952 1.1 chopps /*
953 1.1 chopps * If interface is marked up and it is stopped, then
954 1.1 chopps * start it.
955 1.1 chopps */
956 1.1 chopps bah_init(sc);
957 1.57 dyoung break;
958 1.43 perry }
959 1.1 chopps break;
960 1.1 chopps
961 1.25 is case SIOCADDMULTI:
962 1.25 is case SIOCDELMULTI:
963 1.49 dyoung switch (ifreq_getaddr(cmd, ifr)->sa_family) {
964 1.33 is case AF_INET:
965 1.33 is case AF_INET6:
966 1.25 is error = 0;
967 1.33 is break;
968 1.33 is default:
969 1.25 is error = EAFNOSUPPORT;
970 1.33 is break;
971 1.33 is }
972 1.25 is break;
973 1.4 mycroft
974 1.1 chopps default:
975 1.57 dyoung error = ether_ioctl(ifp, cmd, data);
976 1.1 chopps }
977 1.1 chopps
978 1.4 mycroft splx(s);
979 1.3 chopps return (error);
980 1.6 chopps }
981 1.6 chopps
982 1.6 chopps /*
983 1.6 chopps * watchdog routine for transmitter.
984 1.6 chopps *
985 1.6 chopps * We need this, because else a receiver whose hardware is alive, but whose
986 1.6 chopps * software has not enabled the Receiver, would make our hardware wait forever
987 1.6 chopps * Discovered this after 20 times reading the docs.
988 1.6 chopps *
989 1.6 chopps * Only thing we do is disable transmitter. We'll get an transmit timeout,
990 1.6 chopps * and the int handler will have to decide not to retransmit (in case
991 1.6 chopps * retransmission is implemented).
992 1.6 chopps *
993 1.25 is * This one assumes being called inside splnet()
994 1.6 chopps */
995 1.6 chopps
996 1.6 chopps void
997 1.17 thorpej bah_watchdog(ifp)
998 1.17 thorpej struct ifnet *ifp;
999 1.6 chopps {
1000 1.17 thorpej struct bah_softc *sc = ifp->if_softc;
1001 1.6 chopps
1002 1.25 is bus_space_tag_t bst_r = sc->sc_bst_r;
1003 1.25 is bus_space_handle_t regs = sc->sc_regs;
1004 1.25 is
1005 1.25 is PUTREG(BAHCMD, BAH_TXDIS);
1006 1.6 chopps return;
1007 1.1 chopps }
1008 1.25 is
1009