2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Herb Peyerl.
16 * 4. The name of Herb Peyerl may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * $FreeBSD: src/sys/dev/vx/if_vx.c,v 1.25.2.6 2002/02/13 00:43:10 dillon Exp $
35 * Created from if_ep.c driver by Fred Gray (fgray@rice.edu) to support
40 * Modified from the FreeBSD 1.1.5.1 version by:
42 * INRIA - Sophia Antipolis, France
43 * avega@sophia.inria.fr
47 * Promiscuous mode added and interrupt logic slightly changed
48 * to reduce the number of adapter failures. Transceiver select
49 * logic changed to use value from EEPROM. Autoconfiguration
53 * Chelindbank (Chelyabinsk, Russia)
54 * babkin@hq.icb.chel.su
59 #if NVX < 4 /* These cost 4 bytes apiece, so give us 4 */
65 #include <sys/param.h>
66 #include <sys/systm.h>
67 #include <sys/sockio.h>
68 #include <sys/malloc.h>
70 #include <sys/socket.h>
74 #include <net/ethernet.h>
75 #include <net/if_arp.h>
79 #include <machine/clock.h>
81 #include <dev/vx/if_vxreg.h>
83 #define ETHER_MAX_LEN 1518
84 #define ETHER_ADDR_LEN 6
86 struct vx_softc *vx_softc[NVX];
88 u_long vx_count; /* both PCI and EISA */
90 static struct connector_entry {
93 } conn_tab[VX_CONNECTORS] = {
94 #define CONNECTOR_UTP 0
96 #define CONNECTOR_AUI 1
100 #define CONNECTOR_BNC 3
102 #define CONNECTOR_TX 4
104 #define CONNECTOR_FX 5
106 #define CONNECTOR_MII 6
111 /* struct vx_softc *vxalloc __P((int)); */
112 /* void *vxfree __P((struct vx_softc *)); */
113 /* int vxattach __P((struct vx_softc *)); */
114 static void vxtxstat __P((struct vx_softc *));
115 static int vxstatus __P((struct vx_softc *));
116 static void vxinit __P((void *));
117 static int vxioctl __P((struct ifnet *, u_long, caddr_t));
118 static void vxstart __P((struct ifnet *ifp));
119 static void vxwatchdog __P((struct ifnet *));
120 static void vxreset __P((struct vx_softc *));
121 /* void vxstop __P((struct vx_softc *)); */
122 static void vxread __P((struct vx_softc *));
123 static struct mbuf *vxget __P((struct vx_softc *, u_int));
124 static void vxmbuffill __P((void *));
125 static void vxmbufempty __P((struct vx_softc *));
126 static void vxsetfilter __P((struct vx_softc *));
127 static void vxgetlink __P((struct vx_softc *));
128 static void vxsetlink __P((struct vx_softc *));
129 /* int vxbusyeeprom __P((struct vx_softc *)); */
138 printf("vx%d: unit number too high.\n", unit);
142 if (vx_softc[unit]) {
143 printf("vx%d: already allocated.\n", unit);
147 sc = malloc(sizeof(struct vx_softc), M_DEVBUF, M_NOWAIT);
149 printf("vx%d: cannot malloc.\n", unit);
152 bzero(sc, sizeof(struct vx_softc));
153 callout_handle_init(&sc->ch);
164 vx_softc[sc->unit] = NULL;
173 struct ifnet *ifp = &sc->arpcom.ac_if;
177 outw(VX_COMMAND, GLOBAL_RESET);
183 * Read the station address from the eeprom
186 for (i = 0; i < 3; i++) {
188 if (vxbusyeeprom(sc))
190 outw(BASE + VX_W0_EEPROM_COMMAND, EEPROM_CMD_RD
191 | (EEPROM_OEM_ADDR_0 + i));
192 if (vxbusyeeprom(sc))
194 x = inw(BASE + VX_W0_EEPROM_DATA);
195 sc->arpcom.ac_enaddr[(i << 1)] = x >> 8;
196 sc->arpcom.ac_enaddr[(i << 1) + 1] = x;
199 printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
201 ifp->if_unit = sc->unit;
203 ifp->if_mtu = ETHERMTU;
204 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
205 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
206 ifp->if_output = ether_output;
207 ifp->if_start = vxstart;
208 ifp->if_ioctl = vxioctl;
209 ifp->if_init = vxinit;
210 ifp->if_watchdog = vxwatchdog;
213 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
215 sc->tx_start_thresh = 20; /* probably a good starting point. */
225 * The order in here seems important. Otherwise we may not receive
232 struct vx_softc *sc = (struct vx_softc *) xsc;
233 struct ifnet *ifp = &sc->arpcom.ac_if;
240 for (i = 0; i < 6; i++) /* Reload the ether_addr. */
241 outb(BASE + VX_W2_ADDR_0 + i, sc->arpcom.ac_enaddr[i]);
243 outw(BASE + VX_COMMAND, RX_RESET);
245 outw(BASE + VX_COMMAND, TX_RESET);
248 GO_WINDOW(1); /* Window 1 is operating window */
249 for (i = 0; i < 31; i++)
250 inb(BASE + VX_W1_TX_STATUS);
252 outw(BASE + VX_COMMAND,SET_RD_0_MASK | S_CARD_FAILURE |
253 S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
254 outw(BASE + VX_COMMAND,SET_INTR_MASK | S_CARD_FAILURE |
255 S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
258 * Attempt to get rid of any stray interrupts that occured during
259 * configuration. On the i386 this isn't possible because one may
260 * already be queued. However, a single stray interrupt is
263 outw(BASE + VX_COMMAND, ACK_INTR | 0xff);
268 outw(BASE + VX_COMMAND, RX_ENABLE);
269 outw(BASE + VX_COMMAND, TX_ENABLE);
271 vxmbuffill((caddr_t) sc);
273 /* Interface is now `running', with no output active. */
274 ifp->if_flags |= IFF_RUNNING;
275 ifp->if_flags &= ~IFF_OACTIVE;
277 /* Attempt to start output, if any. */
285 register struct ifnet *ifp = &sc->arpcom.ac_if;
287 GO_WINDOW(1); /* Window 1 is operating window */
288 outw(BASE + VX_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST |
290 ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
300 sc->vx_connectors = inw(BASE + VX_W3_RESET_OPT) & 0x7f;
301 for (n = 0, k = 0; k < VX_CONNECTORS; k++) {
302 if (sc->vx_connectors & conn_tab[k].bit) {
306 printf("%s", conn_tab[k].name);
310 if (sc->vx_connectors == 0) {
311 printf("no connectors!");
315 sc->vx_connector = (inl(BASE + VX_W3_INTERNAL_CFG)
316 & INTERNAL_CONNECTOR_MASK)
317 >> INTERNAL_CONNECTOR_BITS;
318 if (sc->vx_connector & 0x10) {
319 sc->vx_connector &= 0x0f;
320 printf("[*%s*]", conn_tab[(int)sc->vx_connector].name);
321 printf(": disable 'auto select' with DOS util!");
323 printf("[*%s*]", conn_tab[(int)sc->vx_connector].name);
331 register struct ifnet *ifp = &sc->arpcom.ac_if;
333 char *reason, *warning;
334 static short prev_flags;
335 static char prev_conn = -1;
337 if (prev_conn == -1) {
338 prev_conn = sc->vx_connector;
344 * Now behavior was slightly changed:
346 * if any of flags link[0-2] is used and its connector is
347 * physically present the following connectors are used:
349 * link0 - AUI * highest precedence
351 * link2 - UTP * lowest precedence
353 * If none of them is specified then
354 * connector specified in the EEPROM is used
355 * (if present on card or UTP if not).
358 i = sc->vx_connector; /* default in EEPROM */
362 if (ifp->if_flags & IFF_LINK0) {
363 if (sc->vx_connectors & conn_tab[CONNECTOR_AUI].bit) {
367 warning = "aui not present! (link0)";
369 } else if (ifp->if_flags & IFF_LINK1) {
370 if (sc->vx_connectors & conn_tab[CONNECTOR_BNC].bit) {
374 warning = "bnc not present! (link1)";
376 } else if (ifp->if_flags & IFF_LINK2) {
377 if (sc->vx_connectors & conn_tab[CONNECTOR_UTP].bit) {
381 warning = "utp not present! (link2)";
383 } else if ((sc->vx_connectors & conn_tab[(int)sc->vx_connector].bit) == 0) {
384 warning = "strange connector type in EEPROM.";
389 /* Avoid unnecessary message. */
390 k = (prev_flags ^ ifp->if_flags) & (IFF_LINK0 | IFF_LINK1 | IFF_LINK2);
391 if ((k != 0) || (prev_conn != i)) {
393 printf("vx%d: warning: %s\n", sc->unit, warning);
395 printf("vx%d: selected %s. (%s)\n",
396 sc->unit, conn_tab[i].name, reason);
399 /* Set the selected connector. */
401 j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK;
402 outl(BASE + VX_W3_INTERNAL_CFG, j | (i <<INTERNAL_CONNECTOR_BITS));
404 /* First, disable all. */
405 outw(BASE + VX_COMMAND, STOP_TRANSCEIVER);
408 outw(BASE + VX_W4_MEDIA_TYPE, 0);
410 /* Second, enable the selected one. */
414 outw(BASE + VX_W4_MEDIA_TYPE, ENABLE_UTP);
417 outw(BASE + VX_COMMAND, START_TRANSCEIVER);
423 outw(BASE + VX_W4_MEDIA_TYPE, LINKBEAT_ENABLE);
425 default: /* AUI and MII fall here */
430 prev_flags = ifp->if_flags;
438 register struct vx_softc *sc = vx_softc[ifp->if_unit];
439 register struct mbuf *m0;
442 /* Don't transmit if interface is busy or not running */
443 if ((sc->arpcom.ac_if.if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
447 /* Sneak a peek at the next packet */
448 m0 = ifp->if_snd.ifq_head;
452 /* We need to use m->m_pkthdr.len, so require the header */
453 if ((m0->m_flags & M_PKTHDR) == 0)
454 panic("vxstart: no header mbuf");
455 len = m0->m_pkthdr.len;
460 * The 3c509 automatically pads short packets to minimum ethernet length,
461 * but we drop packets that are too large. Perhaps we should truncate
464 if (len + pad > ETHER_MAX_LEN) {
465 /* packet is obviously too large: toss it */
467 IF_DEQUEUE(&ifp->if_snd, m0);
472 if (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) {
473 outw(BASE + VX_COMMAND, SET_TX_AVAIL_THRESH | ((len + pad + 4) >> 2));
474 /* not enough room in FIFO */
475 if (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) { /* make sure */
476 ifp->if_flags |= IFF_OACTIVE;
481 outw(BASE + VX_COMMAND, SET_TX_AVAIL_THRESH | (8188 >> 2));
482 IF_DEQUEUE(&ifp->if_snd, m0);
483 if (m0 == NULL) { /* not really needed */
488 outw(BASE + VX_COMMAND, SET_TX_START_THRESH |
489 ((len / 4 + sc->tx_start_thresh) >> 2));
491 if (sc->arpcom.ac_if.if_bpf) {
492 bpf_mtap(&sc->arpcom.ac_if, m0);
496 * Do the output at splhigh() so that an interrupt from another device
497 * won't cause a FIFO underrun.
501 outl(BASE + VX_W1_TX_PIO_WR_1, len | TX_INDICATE);
505 outsl(BASE + VX_W1_TX_PIO_WR_1, mtod(m0, caddr_t), m0->m_len / 4);
507 outsb(BASE + VX_W1_TX_PIO_WR_1,
508 mtod(m0, caddr_t) + (m0->m_len & ~3) , m0->m_len & 3);
512 outb(BASE + VX_W1_TX_PIO_WR_1, 0); /* Padding */
520 if ((inw(BASE + VX_W1_RX_STATUS) & ERR_INCOMPLETE) == 0) {
521 /* We received a complete packet. */
523 if ((inw(BASE + VX_STATUS) & S_INTR_LATCH) == 0) {
525 * No interrupt, read the packet and continue
526 * Is this supposed to happen? Is my motherboard
531 /* Got an interrupt, return so that it gets serviced. */
534 /* Check if we are stuck and reset [see XXX comment] */
536 if (ifp->if_flags & IFF_DEBUG)
537 printf("vx%d: adapter reset\n", ifp->if_unit);
546 * XXX: The 3c509 card can get in a mode where both the fifo status bit
547 * FIFOS_RX_OVERRUN and the status bit ERR_INCOMPLETE are set
548 * We detect this situation and we reset the adapter.
549 * It happens at times when there is a lot of broadcast traffic
550 * on the cable (once in a blue moon).
559 * Check the FIFO status and act accordingly
562 fifost = inw(BASE + VX_W4_FIFO_DIAG);
565 if (fifost & FIFOS_RX_UNDERRUN) {
566 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
567 printf("vx%d: RX underrun\n", sc->unit);
572 if (fifost & FIFOS_RX_STATUS_OVERRUN) {
573 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
574 printf("vx%d: RX Status overrun\n", sc->unit);
578 if (fifost & FIFOS_RX_OVERRUN) {
579 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
580 printf("vx%d: RX overrun\n", sc->unit);
584 if (fifost & FIFOS_TX_OVERRUN) {
585 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
586 printf("vx%d: TX overrun\n", sc->unit);
601 * We need to read+write TX_STATUS until we get a 0 status
602 * in order to turn off the interrupt flag.
604 while ((i = inb(BASE + VX_W1_TX_STATUS)) & TXS_COMPLETE) {
605 outb(BASE + VX_W1_TX_STATUS, 0x0);
607 if (i & TXS_JABBER) {
608 ++sc->arpcom.ac_if.if_oerrors;
609 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
610 printf("vx%d: jabber (%x)\n", sc->unit, i);
612 } else if (i & TXS_UNDERRUN) {
613 ++sc->arpcom.ac_if.if_oerrors;
614 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
615 printf("vx%d: fifo underrun (%x) @%d\n",
616 sc->unit, i, sc->tx_start_thresh);
617 if (sc->tx_succ_ok < 100)
618 sc->tx_start_thresh = min(ETHER_MAX_LEN, sc->tx_start_thresh + 20);
621 } else if (i & TXS_MAX_COLLISION) {
622 ++sc->arpcom.ac_if.if_collisions;
623 outw(BASE + VX_COMMAND, TX_ENABLE);
624 sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
626 sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127;
634 register short status;
635 struct vx_softc *sc = voidsc;
636 struct ifnet *ifp = &sc->arpcom.ac_if;
639 outw(BASE + VX_COMMAND, C_INTR_LATCH);
641 status = inw(BASE + VX_STATUS);
643 if ((status & (S_TX_COMPLETE | S_TX_AVAIL |
644 S_RX_COMPLETE | S_CARD_FAILURE)) == 0)
648 * Acknowledge any interrupts. It's important that we do this
649 * first, since there would otherwise be a race condition.
650 * Due to the i386 interrupt queueing, we may get spurious
651 * interrupts occasionally.
653 outw(BASE + VX_COMMAND, ACK_INTR | status);
655 if (status & S_RX_COMPLETE)
657 if (status & S_TX_AVAIL) {
659 sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
660 vxstart(&sc->arpcom.ac_if);
662 if (status & S_CARD_FAILURE) {
663 printf("vx%d: adapter failure (%x)\n", sc->unit, status);
668 if (status & S_TX_COMPLETE) {
675 /* no more interrupts */
683 struct ifnet *ifp = &sc->arpcom.ac_if;
685 struct ether_header *eh;
688 len = inw(BASE + VX_W1_RX_STATUS);
692 if (ifp->if_flags & IFF_DEBUG) {
693 int err = len & ERR_MASK;
696 if (len & ERR_INCOMPLETE)
697 s = "incomplete packet";
698 else if (err == ERR_OVERRUN)
699 s = "packet overrun";
700 else if (err == ERR_RUNT)
702 else if (err == ERR_ALIGNMENT)
704 else if (err == ERR_CRC)
706 else if (err == ERR_OVERSIZE)
707 s = "oversized packet";
708 else if (err == ERR_DRIBBLE)
712 printf("vx%d: %s\n", sc->unit, s);
715 if (len & ERR_INCOMPLETE)
723 len &= RX_BYTES_MASK; /* Lower 11 bits = RX bytes. */
725 /* Pull packet off interface. */
734 /* We assume the header fit entirely in one mbuf. */
735 eh = mtod(m, struct ether_header *);
738 * XXX: Some cards seem to be in promiscous mode all the time.
739 * we need to make sure we only get our own stuff always.
743 if ((eh->ether_dhost[0] & 1) == 0 /* !mcast and !bcast */
744 && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0) {
749 m_adj(m, sizeof(struct ether_header));
750 ether_input(ifp, eh, m);
753 * In periods of high traffic we can actually receive enough
754 * packets so that the fifo overrun bit will be set at this point,
755 * even though we just read a packet. In this case we
756 * are not going to receive any more interrupts. We check for
757 * this condition and read again until the fifo is not full.
758 * We could simplify this test by not using vxstatus(), but
759 * rechecking the RX_STATUS register directly. This test could
760 * result in unnecessary looping in cases where there is a new
761 * packet but the fifo is not full, but it will not fix the
764 * Even with this improvement, we still get packet overrun errors
765 * which are hurting performance. Maybe when I get some more time
766 * I'll modify vxread() so that it can handle RX_EARLY interrupts.
769 len = inw(BASE + VX_W1_RX_STATUS);
770 /* Check if we are stuck and reset [see XXX comment] */
771 if (len & ERR_INCOMPLETE) {
772 if (ifp->if_flags & IFF_DEBUG)
773 printf("vx%d: adapter reset\n", sc->unit);
783 outw(BASE + VX_COMMAND, RX_DISCARD_TOP_PACK);
791 struct ifnet *ifp = &sc->arpcom.ac_if;
792 struct mbuf *top, **mp, *m;
796 m = sc->mb[sc->next_mb];
797 sc->mb[sc->next_mb] = 0;
799 MGETHDR(m, M_DONTWAIT, MT_DATA);
803 /* If the queue is no longer full, refill. */
804 if (sc->last_mb == sc->next_mb && sc->buffill_pending == 0) {
805 sc->ch = timeout(vxmbuffill, sc, 1);
806 sc->buffill_pending = 1;
808 /* Convert one of our saved mbuf's. */
809 sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
810 m->m_data = m->m_pktdat;
811 m->m_flags = M_PKTHDR;
812 bzero(&m->m_pkthdr, sizeof(m->m_pkthdr));
814 m->m_pkthdr.rcvif = ifp;
815 m->m_pkthdr.len = totlen;
821 * We read the packet at splhigh() so that an interrupt from another
822 * device doesn't cause the card's buffer to overflow while we're
823 * reading it. We may still lose packets at other times.
828 * Since we don't set allowLargePackets bit in MacControl register,
829 * we can assume that totlen <= 1500bytes.
830 * The while loop will be performed iff we have a packet with
831 * MLEN < m_len < MINCLSIZE.
835 m = sc->mb[sc->next_mb];
836 sc->mb[sc->next_mb] = 0;
838 MGET(m, M_DONTWAIT, MT_DATA);
845 sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
849 if (totlen >= MINCLSIZE) {
850 MCLGET(m, M_DONTWAIT);
851 if (m->m_flags & M_EXT)
854 len = min(totlen, len);
856 insl(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int32_t *), len / 4);
858 insb(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int8_t *) + (len & ~3),
867 outw(BASE +VX_COMMAND, RX_DISCARD_TOP_PACK);
876 vxioctl(ifp, cmd, data)
877 register struct ifnet *ifp;
881 struct vx_softc *sc = vx_softc[ifp->if_unit];
882 struct ifreq *ifr = (struct ifreq *) data;
890 ether_ioctl(ifp, cmd, data);
894 if ((ifp->if_flags & IFF_UP) == 0 &&
895 (ifp->if_flags & IFF_RUNNING) != 0) {
897 * If interface is marked up and it is stopped, then
901 ifp->if_flags &= ~IFF_RUNNING;
902 } else if ((ifp->if_flags & IFF_UP) != 0 &&
903 (ifp->if_flags & IFF_RUNNING) == 0) {
905 * If interface is marked up and it is stopped, then
911 * deal with flags changes:
912 * IFF_MULTICAST, IFF_PROMISC,
913 * IFF_LINK0, IFF_LINK1,
922 * Set the interface MTU.
924 if (ifr->ifr_mtu > ETHERMTU) {
927 ifp->if_mtu = ifr->ifr_mtu;
934 * Multicast list has changed; set the hardware filter
967 struct vx_softc *sc = vx_softc[ifp->if_unit];
969 if (ifp->if_flags & IFF_DEBUG)
970 printf("vx%d: device timeout\n", ifp->if_unit);
971 ifp->if_flags &= ~IFF_OACTIVE;
980 struct ifnet *ifp = &sc->arpcom.ac_if;
984 outw(BASE + VX_COMMAND, RX_DISABLE);
985 outw(BASE + VX_COMMAND, RX_DISCARD_TOP_PACK);
987 outw(BASE + VX_COMMAND, TX_DISABLE);
988 outw(BASE + VX_COMMAND, STOP_TRANSCEIVER);
990 outw(BASE + VX_COMMAND, RX_RESET);
992 outw(BASE + VX_COMMAND, TX_RESET);
994 outw(BASE + VX_COMMAND, C_INTR_LATCH);
995 outw(BASE + VX_COMMAND, SET_RD_0_MASK);
996 outw(BASE + VX_COMMAND, SET_INTR_MASK);
997 outw(BASE + VX_COMMAND, SET_RX_FILTER);
1004 struct vx_softc *sc;
1009 j = inw(BASE + VX_W0_EEPROM_COMMAND);
1010 if (j & EEPROM_BUSY)
1016 printf("vx%d: eeprom failed to come ready\n", sc->unit);
1026 struct vx_softc *sc = (struct vx_softc *) sp;
1032 if (sc->mb[i] == NULL)
1033 MGET(sc->mb[i], M_DONTWAIT, MT_DATA);
1034 if (sc->mb[i] == NULL)
1036 i = (i + 1) % MAX_MBS;
1037 } while (i != sc->next_mb);
1039 /* If the queue was not filled, try again. */
1040 if (sc->last_mb != sc->next_mb) {
1041 sc->ch = timeout(vxmbuffill, sc, 1);
1042 sc->buffill_pending = 1;
1044 sc->buffill_pending = 0;
1051 struct vx_softc *sc;
1056 for (i = 0; i < MAX_MBS; i++) {
1062 sc->last_mb = sc->next_mb = 0;
1063 if (sc->buffill_pending != 0)
1064 untimeout(vxmbuffill, sc, sc->ch);