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 $
31 * $DragonFly: src/sys/dev/netif/vx/if_vx.c,v 1.6 2003/11/20 22:07:32 dillon Exp $
36 * Created from if_ep.c driver by Fred Gray (fgray@rice.edu) to support
41 * Modified from the FreeBSD 1.1.5.1 version by:
43 * INRIA - Sophia Antipolis, France
44 * avega@sophia.inria.fr
48 * Promiscuous mode added and interrupt logic slightly changed
49 * to reduce the number of adapter failures. Transceiver select
50 * logic changed to use value from EEPROM. Autoconfiguration
54 * Chelindbank (Chelyabinsk, Russia)
55 * babkin@hq.icb.chel.su
60 #if NVX < 4 /* These cost 4 bytes apiece, so give us 4 */
66 #include <sys/param.h>
67 #include <sys/systm.h>
68 #include <sys/sockio.h>
69 #include <sys/malloc.h>
71 #include <sys/socket.h>
72 #include <sys/linker_set.h>
73 #include <sys/module.h>
77 #include <net/ethernet.h>
78 #include <net/if_arp.h>
82 #include <machine/clock.h>
86 #define ETHER_MAX_LEN 1518
87 #define ETHER_ADDR_LEN 6
89 DECLARE_DUMMY_MODULE(if_vx);
91 struct vx_softc *vx_softc[NVX];
93 u_long vx_count; /* both PCI and EISA */
95 static struct connector_entry {
98 } conn_tab[VX_CONNECTORS] = {
99 #define CONNECTOR_UTP 0
101 #define CONNECTOR_AUI 1
105 #define CONNECTOR_BNC 3
107 #define CONNECTOR_TX 4
109 #define CONNECTOR_FX 5
111 #define CONNECTOR_MII 6
116 /* struct vx_softc *vxalloc (int); */
117 /* void *vxfree (struct vx_softc *); */
118 /* int vxattach (struct vx_softc *); */
119 static void vxtxstat (struct vx_softc *);
120 static int vxstatus (struct vx_softc *);
121 static void vxinit (void *);
122 static int vxioctl (struct ifnet *, u_long, caddr_t);
123 static void vxstart (struct ifnet *ifp);
124 static void vxwatchdog (struct ifnet *);
125 static void vxreset (struct vx_softc *);
126 /* void vxstop (struct vx_softc *); */
127 static void vxread (struct vx_softc *);
128 static struct mbuf *vxget (struct vx_softc *, u_int);
129 static void vxmbuffill (void *);
130 static void vxmbufempty (struct vx_softc *);
131 static void vxsetfilter (struct vx_softc *);
132 static void vxgetlink (struct vx_softc *);
133 static void vxsetlink (struct vx_softc *);
134 /* int vxbusyeeprom (struct vx_softc *); */
143 printf("vx%d: unit number too high.\n", unit);
147 if (vx_softc[unit]) {
148 printf("vx%d: already allocated.\n", unit);
152 sc = malloc(sizeof(struct vx_softc), M_DEVBUF, M_NOWAIT);
154 printf("vx%d: cannot malloc.\n", unit);
157 bzero(sc, sizeof(struct vx_softc));
158 callout_handle_init(&sc->ch);
169 vx_softc[sc->unit] = NULL;
178 struct ifnet *ifp = &sc->arpcom.ac_if;
182 outw(VX_COMMAND, GLOBAL_RESET);
188 * Read the station address from the eeprom
191 for (i = 0; i < 3; i++) {
193 if (vxbusyeeprom(sc))
195 outw(BASE + VX_W0_EEPROM_COMMAND, EEPROM_CMD_RD
196 | (EEPROM_OEM_ADDR_0 + i));
197 if (vxbusyeeprom(sc))
199 x = inw(BASE + VX_W0_EEPROM_DATA);
200 sc->arpcom.ac_enaddr[(i << 1)] = x >> 8;
201 sc->arpcom.ac_enaddr[(i << 1) + 1] = x;
204 printf(" address %6D\n", sc->arpcom.ac_enaddr, ":");
206 ifp->if_unit = sc->unit;
208 ifp->if_mtu = ETHERMTU;
209 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
210 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
211 ifp->if_output = ether_output;
212 ifp->if_start = vxstart;
213 ifp->if_ioctl = vxioctl;
214 ifp->if_init = vxinit;
215 ifp->if_watchdog = vxwatchdog;
218 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
220 sc->tx_start_thresh = 20; /* probably a good starting point. */
230 * The order in here seems important. Otherwise we may not receive
237 struct vx_softc *sc = (struct vx_softc *) xsc;
238 struct ifnet *ifp = &sc->arpcom.ac_if;
245 for (i = 0; i < 6; i++) /* Reload the ether_addr. */
246 outb(BASE + VX_W2_ADDR_0 + i, sc->arpcom.ac_enaddr[i]);
248 outw(BASE + VX_COMMAND, RX_RESET);
250 outw(BASE + VX_COMMAND, TX_RESET);
253 GO_WINDOW(1); /* Window 1 is operating window */
254 for (i = 0; i < 31; i++)
255 inb(BASE + VX_W1_TX_STATUS);
257 outw(BASE + VX_COMMAND,SET_RD_0_MASK | S_CARD_FAILURE |
258 S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
259 outw(BASE + VX_COMMAND,SET_INTR_MASK | S_CARD_FAILURE |
260 S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
263 * Attempt to get rid of any stray interrupts that occured during
264 * configuration. On the i386 this isn't possible because one may
265 * already be queued. However, a single stray interrupt is
268 outw(BASE + VX_COMMAND, ACK_INTR | 0xff);
273 outw(BASE + VX_COMMAND, RX_ENABLE);
274 outw(BASE + VX_COMMAND, TX_ENABLE);
276 vxmbuffill((caddr_t) sc);
278 /* Interface is now `running', with no output active. */
279 ifp->if_flags |= IFF_RUNNING;
280 ifp->if_flags &= ~IFF_OACTIVE;
282 /* Attempt to start output, if any. */
290 struct ifnet *ifp = &sc->arpcom.ac_if;
292 GO_WINDOW(1); /* Window 1 is operating window */
293 outw(BASE + VX_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST |
295 ((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
305 sc->vx_connectors = inw(BASE + VX_W3_RESET_OPT) & 0x7f;
306 for (n = 0, k = 0; k < VX_CONNECTORS; k++) {
307 if (sc->vx_connectors & conn_tab[k].bit) {
311 printf("%s", conn_tab[k].name);
315 if (sc->vx_connectors == 0) {
316 printf("no connectors!");
320 sc->vx_connector = (inl(BASE + VX_W3_INTERNAL_CFG)
321 & INTERNAL_CONNECTOR_MASK)
322 >> INTERNAL_CONNECTOR_BITS;
323 if (sc->vx_connector & 0x10) {
324 sc->vx_connector &= 0x0f;
325 printf("[*%s*]", conn_tab[(int)sc->vx_connector].name);
326 printf(": disable 'auto select' with DOS util!");
328 printf("[*%s*]", conn_tab[(int)sc->vx_connector].name);
336 struct ifnet *ifp = &sc->arpcom.ac_if;
338 char *reason, *warning;
339 static short prev_flags;
340 static char prev_conn = -1;
342 if (prev_conn == -1) {
343 prev_conn = sc->vx_connector;
349 * Now behavior was slightly changed:
351 * if any of flags link[0-2] is used and its connector is
352 * physically present the following connectors are used:
354 * link0 - AUI * highest precedence
356 * link2 - UTP * lowest precedence
358 * If none of them is specified then
359 * connector specified in the EEPROM is used
360 * (if present on card or UTP if not).
363 i = sc->vx_connector; /* default in EEPROM */
367 if (ifp->if_flags & IFF_LINK0) {
368 if (sc->vx_connectors & conn_tab[CONNECTOR_AUI].bit) {
372 warning = "aui not present! (link0)";
374 } else if (ifp->if_flags & IFF_LINK1) {
375 if (sc->vx_connectors & conn_tab[CONNECTOR_BNC].bit) {
379 warning = "bnc not present! (link1)";
381 } else if (ifp->if_flags & IFF_LINK2) {
382 if (sc->vx_connectors & conn_tab[CONNECTOR_UTP].bit) {
386 warning = "utp not present! (link2)";
388 } else if ((sc->vx_connectors & conn_tab[(int)sc->vx_connector].bit) == 0) {
389 warning = "strange connector type in EEPROM.";
394 /* Avoid unnecessary message. */
395 k = (prev_flags ^ ifp->if_flags) & (IFF_LINK0 | IFF_LINK1 | IFF_LINK2);
396 if ((k != 0) || (prev_conn != i)) {
398 printf("vx%d: warning: %s\n", sc->unit, warning);
400 printf("vx%d: selected %s. (%s)\n",
401 sc->unit, conn_tab[i].name, reason);
404 /* Set the selected connector. */
406 j = inl(BASE + VX_W3_INTERNAL_CFG) & ~INTERNAL_CONNECTOR_MASK;
407 outl(BASE + VX_W3_INTERNAL_CFG, j | (i <<INTERNAL_CONNECTOR_BITS));
409 /* First, disable all. */
410 outw(BASE + VX_COMMAND, STOP_TRANSCEIVER);
413 outw(BASE + VX_W4_MEDIA_TYPE, 0);
415 /* Second, enable the selected one. */
419 outw(BASE + VX_W4_MEDIA_TYPE, ENABLE_UTP);
422 outw(BASE + VX_COMMAND, START_TRANSCEIVER);
428 outw(BASE + VX_W4_MEDIA_TYPE, LINKBEAT_ENABLE);
430 default: /* AUI and MII fall here */
435 prev_flags = ifp->if_flags;
443 struct vx_softc *sc = vx_softc[ifp->if_unit];
447 /* Don't transmit if interface is busy or not running */
448 if ((sc->arpcom.ac_if.if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
452 /* Sneak a peek at the next packet */
453 m0 = ifp->if_snd.ifq_head;
457 /* We need to use m->m_pkthdr.len, so require the header */
458 if ((m0->m_flags & M_PKTHDR) == 0)
459 panic("vxstart: no header mbuf");
460 len = m0->m_pkthdr.len;
465 * The 3c509 automatically pads short packets to minimum ethernet length,
466 * but we drop packets that are too large. Perhaps we should truncate
469 if (len + pad > ETHER_MAX_LEN) {
470 /* packet is obviously too large: toss it */
472 IF_DEQUEUE(&ifp->if_snd, m0);
477 if (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) {
478 outw(BASE + VX_COMMAND, SET_TX_AVAIL_THRESH | ((len + pad + 4) >> 2));
479 /* not enough room in FIFO */
480 if (inw(BASE + VX_W1_FREE_TX) < len + pad + 4) { /* make sure */
481 ifp->if_flags |= IFF_OACTIVE;
486 outw(BASE + VX_COMMAND, SET_TX_AVAIL_THRESH | (8188 >> 2));
487 IF_DEQUEUE(&ifp->if_snd, m0);
488 if (m0 == NULL) { /* not really needed */
493 outw(BASE + VX_COMMAND, SET_TX_START_THRESH |
494 ((len / 4 + sc->tx_start_thresh) >> 2));
496 if (sc->arpcom.ac_if.if_bpf) {
497 bpf_mtap(&sc->arpcom.ac_if, m0);
501 * Do the output at splhigh() so that an interrupt from another device
502 * won't cause a FIFO underrun.
506 outl(BASE + VX_W1_TX_PIO_WR_1, len | TX_INDICATE);
510 outsl(BASE + VX_W1_TX_PIO_WR_1, mtod(m0, caddr_t), m0->m_len / 4);
512 outsb(BASE + VX_W1_TX_PIO_WR_1,
513 mtod(m0, caddr_t) + (m0->m_len & ~3) , m0->m_len & 3);
517 outb(BASE + VX_W1_TX_PIO_WR_1, 0); /* Padding */
525 if ((inw(BASE + VX_W1_RX_STATUS) & ERR_INCOMPLETE) == 0) {
526 /* We received a complete packet. */
528 if ((inw(BASE + VX_STATUS) & S_INTR_LATCH) == 0) {
530 * No interrupt, read the packet and continue
531 * Is this supposed to happen? Is my motherboard
536 /* Got an interrupt, return so that it gets serviced. */
539 /* Check if we are stuck and reset [see XXX comment] */
541 if (ifp->if_flags & IFF_DEBUG)
542 printf("vx%d: adapter reset\n", ifp->if_unit);
551 * XXX: The 3c509 card can get in a mode where both the fifo status bit
552 * FIFOS_RX_OVERRUN and the status bit ERR_INCOMPLETE are set
553 * We detect this situation and we reset the adapter.
554 * It happens at times when there is a lot of broadcast traffic
555 * on the cable (once in a blue moon).
564 * Check the FIFO status and act accordingly
567 fifost = inw(BASE + VX_W4_FIFO_DIAG);
570 if (fifost & FIFOS_RX_UNDERRUN) {
571 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
572 printf("vx%d: RX underrun\n", sc->unit);
577 if (fifost & FIFOS_RX_STATUS_OVERRUN) {
578 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
579 printf("vx%d: RX Status overrun\n", sc->unit);
583 if (fifost & FIFOS_RX_OVERRUN) {
584 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
585 printf("vx%d: RX overrun\n", sc->unit);
589 if (fifost & FIFOS_TX_OVERRUN) {
590 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
591 printf("vx%d: TX overrun\n", sc->unit);
606 * We need to read+write TX_STATUS until we get a 0 status
607 * in order to turn off the interrupt flag.
609 while ((i = inb(BASE + VX_W1_TX_STATUS)) & TXS_COMPLETE) {
610 outb(BASE + VX_W1_TX_STATUS, 0x0);
612 if (i & TXS_JABBER) {
613 ++sc->arpcom.ac_if.if_oerrors;
614 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
615 printf("vx%d: jabber (%x)\n", sc->unit, i);
617 } else if (i & TXS_UNDERRUN) {
618 ++sc->arpcom.ac_if.if_oerrors;
619 if (sc->arpcom.ac_if.if_flags & IFF_DEBUG)
620 printf("vx%d: fifo underrun (%x) @%d\n",
621 sc->unit, i, sc->tx_start_thresh);
622 if (sc->tx_succ_ok < 100)
623 sc->tx_start_thresh = min(ETHER_MAX_LEN, sc->tx_start_thresh + 20);
626 } else if (i & TXS_MAX_COLLISION) {
627 ++sc->arpcom.ac_if.if_collisions;
628 outw(BASE + VX_COMMAND, TX_ENABLE);
629 sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
631 sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127;
640 struct vx_softc *sc = voidsc;
641 struct ifnet *ifp = &sc->arpcom.ac_if;
644 outw(BASE + VX_COMMAND, C_INTR_LATCH);
646 status = inw(BASE + VX_STATUS);
648 if ((status & (S_TX_COMPLETE | S_TX_AVAIL |
649 S_RX_COMPLETE | S_CARD_FAILURE)) == 0)
653 * Acknowledge any interrupts. It's important that we do this
654 * first, since there would otherwise be a race condition.
655 * Due to the i386 interrupt queueing, we may get spurious
656 * interrupts occasionally.
658 outw(BASE + VX_COMMAND, ACK_INTR | status);
660 if (status & S_RX_COMPLETE)
662 if (status & S_TX_AVAIL) {
664 sc->arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
665 vxstart(&sc->arpcom.ac_if);
667 if (status & S_CARD_FAILURE) {
668 printf("vx%d: adapter failure (%x)\n", sc->unit, status);
673 if (status & S_TX_COMPLETE) {
680 /* no more interrupts */
688 struct ifnet *ifp = &sc->arpcom.ac_if;
690 struct ether_header *eh;
693 len = inw(BASE + VX_W1_RX_STATUS);
697 if (ifp->if_flags & IFF_DEBUG) {
698 int err = len & ERR_MASK;
701 if (len & ERR_INCOMPLETE)
702 s = "incomplete packet";
703 else if (err == ERR_OVERRUN)
704 s = "packet overrun";
705 else if (err == ERR_RUNT)
707 else if (err == ERR_ALIGNMENT)
709 else if (err == ERR_CRC)
711 else if (err == ERR_OVERSIZE)
712 s = "oversized packet";
713 else if (err == ERR_DRIBBLE)
717 printf("vx%d: %s\n", sc->unit, s);
720 if (len & ERR_INCOMPLETE)
728 len &= RX_BYTES_MASK; /* Lower 11 bits = RX bytes. */
730 /* Pull packet off interface. */
739 /* We assume the header fit entirely in one mbuf. */
740 eh = mtod(m, struct ether_header *);
743 * XXX: Some cards seem to be in promiscous mode all the time.
744 * we need to make sure we only get our own stuff always.
748 if ((eh->ether_dhost[0] & 1) == 0 /* !mcast and !bcast */
749 && bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) != 0) {
754 m_adj(m, sizeof(struct ether_header));
755 ether_input(ifp, eh, m);
758 * In periods of high traffic we can actually receive enough
759 * packets so that the fifo overrun bit will be set at this point,
760 * even though we just read a packet. In this case we
761 * are not going to receive any more interrupts. We check for
762 * this condition and read again until the fifo is not full.
763 * We could simplify this test by not using vxstatus(), but
764 * rechecking the RX_STATUS register directly. This test could
765 * result in unnecessary looping in cases where there is a new
766 * packet but the fifo is not full, but it will not fix the
769 * Even with this improvement, we still get packet overrun errors
770 * which are hurting performance. Maybe when I get some more time
771 * I'll modify vxread() so that it can handle RX_EARLY interrupts.
774 len = inw(BASE + VX_W1_RX_STATUS);
775 /* Check if we are stuck and reset [see XXX comment] */
776 if (len & ERR_INCOMPLETE) {
777 if (ifp->if_flags & IFF_DEBUG)
778 printf("vx%d: adapter reset\n", sc->unit);
788 outw(BASE + VX_COMMAND, RX_DISCARD_TOP_PACK);
796 struct ifnet *ifp = &sc->arpcom.ac_if;
797 struct mbuf *top, **mp, *m;
801 m = sc->mb[sc->next_mb];
802 sc->mb[sc->next_mb] = 0;
804 MGETHDR(m, M_DONTWAIT, MT_DATA);
808 /* If the queue is no longer full, refill. */
809 if (sc->last_mb == sc->next_mb && sc->buffill_pending == 0) {
810 sc->ch = timeout(vxmbuffill, sc, 1);
811 sc->buffill_pending = 1;
813 /* Convert one of our saved mbuf's. */
814 sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
815 m->m_data = m->m_pktdat;
816 m->m_flags = M_PKTHDR;
817 bzero(&m->m_pkthdr, sizeof(m->m_pkthdr));
819 m->m_pkthdr.rcvif = ifp;
820 m->m_pkthdr.len = totlen;
826 * We read the packet at splhigh() so that an interrupt from another
827 * device doesn't cause the card's buffer to overflow while we're
828 * reading it. We may still lose packets at other times.
833 * Since we don't set allowLargePackets bit in MacControl register,
834 * we can assume that totlen <= 1500bytes.
835 * The while loop will be performed iff we have a packet with
836 * MLEN < m_len < MINCLSIZE.
840 m = sc->mb[sc->next_mb];
841 sc->mb[sc->next_mb] = 0;
843 MGET(m, M_DONTWAIT, MT_DATA);
850 sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
854 if (totlen >= MINCLSIZE) {
855 MCLGET(m, M_DONTWAIT);
856 if (m->m_flags & M_EXT)
859 len = min(totlen, len);
861 insl(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int32_t *), len / 4);
863 insb(BASE + VX_W1_RX_PIO_RD_1, mtod(m, u_int8_t *) + (len & ~3),
872 outw(BASE +VX_COMMAND, RX_DISCARD_TOP_PACK);
881 vxioctl(ifp, cmd, data)
886 struct vx_softc *sc = vx_softc[ifp->if_unit];
887 struct ifreq *ifr = (struct ifreq *) data;
895 ether_ioctl(ifp, cmd, data);
899 if ((ifp->if_flags & IFF_UP) == 0 &&
900 (ifp->if_flags & IFF_RUNNING) != 0) {
902 * If interface is marked up and it is stopped, then
906 ifp->if_flags &= ~IFF_RUNNING;
907 } else if ((ifp->if_flags & IFF_UP) != 0 &&
908 (ifp->if_flags & IFF_RUNNING) == 0) {
910 * If interface is marked up and it is stopped, then
916 * deal with flags changes:
917 * IFF_MULTICAST, IFF_PROMISC,
918 * IFF_LINK0, IFF_LINK1,
927 * Set the interface MTU.
929 if (ifr->ifr_mtu > ETHERMTU) {
932 ifp->if_mtu = ifr->ifr_mtu;
939 * Multicast list has changed; set the hardware filter
972 struct vx_softc *sc = vx_softc[ifp->if_unit];
974 if (ifp->if_flags & IFF_DEBUG)
975 printf("vx%d: device timeout\n", ifp->if_unit);
976 ifp->if_flags &= ~IFF_OACTIVE;
985 struct ifnet *ifp = &sc->arpcom.ac_if;
989 outw(BASE + VX_COMMAND, RX_DISABLE);
990 outw(BASE + VX_COMMAND, RX_DISCARD_TOP_PACK);
992 outw(BASE + VX_COMMAND, TX_DISABLE);
993 outw(BASE + VX_COMMAND, STOP_TRANSCEIVER);
995 outw(BASE + VX_COMMAND, RX_RESET);
997 outw(BASE + VX_COMMAND, TX_RESET);
999 outw(BASE + VX_COMMAND, C_INTR_LATCH);
1000 outw(BASE + VX_COMMAND, SET_RD_0_MASK);
1001 outw(BASE + VX_COMMAND, SET_INTR_MASK);
1002 outw(BASE + VX_COMMAND, SET_RX_FILTER);
1009 struct vx_softc *sc;
1014 j = inw(BASE + VX_W0_EEPROM_COMMAND);
1015 if (j & EEPROM_BUSY)
1021 printf("vx%d: eeprom failed to come ready\n", sc->unit);
1031 struct vx_softc *sc = (struct vx_softc *) sp;
1037 if (sc->mb[i] == NULL)
1038 MGET(sc->mb[i], M_DONTWAIT, MT_DATA);
1039 if (sc->mb[i] == NULL)
1041 i = (i + 1) % MAX_MBS;
1042 } while (i != sc->next_mb);
1044 /* If the queue was not filled, try again. */
1045 if (sc->last_mb != sc->next_mb) {
1046 sc->ch = timeout(vxmbuffill, sc, 1);
1047 sc->buffill_pending = 1;
1049 sc->buffill_pending = 0;
1056 struct vx_softc *sc;
1061 for (i = 0; i < MAX_MBS; i++) {
1067 sc->last_mb = sc->next_mb = 0;
1068 if (sc->buffill_pending != 0)
1069 untimeout(vxmbuffill, sc, sc->ch);