1 /* $NetBSD: smc90cx6.c,v 1.38 2001/07/07 15:57:53 thorpej Exp $ */
2 /* $FreeBSD: src/sys/dev/cm/smc90cx6.c,v 1.1.2.3 2003/02/05 18:42:14 fjoe Exp $ */
3 /* $DragonFly: src/sys/dev/netif/cm/Attic/smc90cx6.c,v 1.3 2003/08/07 21:17:00 dillon Exp $ */
6 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
9 * This code is derived from software contributed to The NetBSD Foundation
10 * by Ignatios Souvatzis.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. All advertising materials mentioning features or use of this software
21 * must display the following acknowledgement:
22 * This product includes software developed by the NetBSD
23 * Foundation, Inc. and its contributors.
24 * 4. Neither the name of The NetBSD Foundation nor the names of its
25 * contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
42 * Chip core driver for the SMC90c26 / SMC90c56 (and SMC90c66 in '56
43 * compatibility mode) boards
46 /* #define CMSOFTCOPY */
47 #define CMRETRANSMIT /**/
48 /* #define CM_DEBUG */
50 #include <sys/param.h>
51 #include <sys/systm.h>
52 #include <sys/sockio.h>
54 #include <sys/module.h>
55 #include <sys/kernel.h>
56 #include <sys/socket.h>
57 #include <sys/syslog.h>
60 #include <machine/bus.h>
62 #include <machine/resource.h>
64 #if __FreeBSD_version < 500000
65 #include <machine/clock.h>
69 #include <net/if_dl.h>
70 #include <net/if_types.h>
71 #include <net/if_arc.h>
73 #include "smc90cx6reg.h"
74 #include "smc90cx6var.h"
76 MODULE_DEPEND(if_cm, arcnet, 1, 1, 1);
78 /* these should be elsewhere */
81 #define ARC_MIN_FORBID_LEN 254
82 #define ARC_MAX_FORBID_LEN 256
83 #define ARC_MAX_LEN 508
84 #define ARC_ADDR_LEN 1
86 /* for watchdog timer. This should be more than enough. */
87 #define ARCTIMEOUT (5*IFNET_SLOWHZ)
92 bus_space_read_1(rman_get_bustag((sc)->port_res), \
93 rman_get_bushandle((sc)->port_res), \
95 #define PUTREG(off, value) \
96 bus_space_write_1(rman_get_bustag((sc)->port_res), \
97 rman_get_bushandle((sc)->port_res), \
100 bus_space_read_1(rman_get_bustag((sc)->mem_res), \
101 rman_get_bushandle((sc)->mem_res), \
103 #define PUTMEM(off, value) \
104 bus_space_write_1(rman_get_bustag((sc)->mem_res), \
105 rman_get_bushandle((sc)->mem_res), \
108 devclass_t cm_devclass;
111 * This currently uses 2 bufs for tx, 2 for rx
115 * rx has a fillcount variable. If fillcount > (NRXBUF-1),
116 * rx can be switched off from rx hard int.
117 * Else rx is restarted on the other receiver.
118 * rx soft int counts down. if it is == (NRXBUF-1), it restarts
120 * To ensure packet ordering (we need that for 1201 later), we have a counter
121 * which is incremented modulo 256 on each receive and a per buffer
122 * variable, which is set to the counter on filling. The soft int can
123 * compare both values to determine the older packet.
125 * Transmit direction:
127 * cm_start checks tx_fillcount
130 * else fill tx_act ^ 1 && inc tx_fillcount
132 * check tx_fillcount again.
133 * case 2: set IFF_OACTIVE to stop arc_output from filling us.
136 * tint clears IFF_OCATIVE, decrements and checks tx_fillcount
137 * case 1: start tx on tx_act ^ 1, softcall cm_start
138 * case 0: softcall cm_start
140 * #define fill(i) get mbuf && copy mbuf to chip(i)
143 void cm_init __P((void *));
144 void cm_reset __P((struct cm_softc *));
145 void cm_start __P((struct ifnet *));
146 int cm_ioctl __P((struct ifnet *, unsigned long, caddr_t));
147 void cm_watchdog __P((struct ifnet *));
148 void cm_srint __P((void *vsc));
149 static void cm_tint __P((struct cm_softc *, int));
150 void cm_reconwatch(void *);
157 struct cm_softc *sc = device_get_softc(dev);
159 error = cm_alloc_port(dev, 0, CM_IO_PORTS);
163 if (GETREG(CMSTAT) == 0xff)
166 error = cm_alloc_memory(dev, 0, 0x800);
174 * Allocate a port resource with the given resource id.
177 cm_alloc_port(dev, rid, size)
182 struct cm_softc *sc = device_get_softc(dev);
183 struct resource *res;
185 res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
186 0ul, ~0ul, size, RF_ACTIVE);
190 sc->port_used = size;
198 * Allocate a memory resource with the given resource id.
201 cm_alloc_memory(dev, rid, size)
206 struct cm_softc *sc = device_get_softc(dev);
207 struct resource *res;
209 res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
210 0ul, ~0ul, size, RF_ACTIVE);
222 * Allocate an irq resource with the given resource id.
225 cm_alloc_irq(dev, rid)
229 struct cm_softc *sc = device_get_softc(dev);
230 struct resource *res;
232 res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
233 0ul, ~0ul, 1, RF_ACTIVE);
244 * Release all resources
247 cm_release_resources(dev)
250 struct cm_softc *sc = device_get_softc(dev);
253 bus_deactivate_resource(dev, SYS_RES_IOPORT,
254 sc->port_rid, sc->port_res);
255 bus_release_resource(dev, SYS_RES_IOPORT,
256 sc->port_rid, sc->port_res);
260 bus_deactivate_resource(dev, SYS_RES_MEMORY,
261 sc->mem_rid, sc->mem_res);
262 bus_release_resource(dev, SYS_RES_MEMORY,
263 sc->mem_rid, sc->mem_res);
267 bus_deactivate_resource(dev, SYS_RES_IRQ,
268 sc->irq_rid, sc->irq_res);
269 bus_release_resource(dev, SYS_RES_IRQ,
270 sc->irq_rid, sc->irq_res);
280 struct ifnet *ifp = &sc->sc_arccom.ac_if;
282 u_int8_t linkaddress;
287 * read the arcnet address from the board
293 } while (!(GETREG(CMSTAT) & CM_POR));
295 linkaddress = GETMEM(CMMACOFF);
297 /* clear the int mask... */
302 PUTREG(CMCMD, CM_CONF(CONF_LONG));
303 PUTREG(CMCMD, CM_CLR(CLR_POR|CLR_RECONFIG));
304 sc->sc_recontime = sc->sc_reconcount = 0;
306 /* and reenable kernel int level */
310 * set interface to stopped condition (reset)
318 ifp->if_output = arc_output;
319 ifp->if_start = cm_start;
320 ifp->if_ioctl = cm_ioctl;
321 ifp->if_watchdog = cm_watchdog;
322 ifp->if_init = cm_init;
323 /* XXX IFQ_SET_READY(&ifp->if_snd); */
324 ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
326 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
328 arc_ifattach(ifp, linkaddress);
331 sc->sc_rxcookie = softintr_establish(IPL_SOFTNET, cm_srint, sc);
332 sc->sc_txcookie = softintr_establish(IPL_SOFTNET,
333 (void (*) __P((void *)))cm_start, ifp);
336 #if __FreeBSD_version < 500000
337 callout_init(&sc->sc_recon_ch);
339 callout_init(&sc->sc_recon_ch, 0);
343 printf("%s%d: link addr 0x%02x (%d)\n",
344 ifp->if_name, ifp->if_unit, linkaddress, linkaddress);
356 struct cm_softc *sc = (struct cm_softc *)xsc;
360 ifp = &sc->sc_arccom.ac_if;
362 if ((ifp->if_flags & IFF_RUNNING) == 0) {
364 ifp->if_flags |= IFF_RUNNING;
372 * Reset the interface...
374 * this assumes that it is called inside a critical section...
384 ifp = &sc->sc_arccom.ac_if;
387 printf("%s%d: reset\n", ifp->if_name, ifp->if_unit);
389 /* stop and restart hardware */
394 } while (!(GETREG(CMSTAT) & CM_POR));
396 linkaddress = GETMEM(CMMACOFF);
398 #if defined(CM_DEBUG) && (CM_DEBUG > 2)
399 printf("%s%d: reset: card reset, link addr = 0x%02x (%d)\n",
400 ifp->if_name, ifp->if_unit, linkaddress, linkaddress);
403 /* tell the routing level about the (possibly changed) link address */
404 arc_storelladdr(ifp, linkaddress);
407 /* POR is NMI, but we need it below: */
408 sc->sc_intmask = CM_RECON|CM_POR;
409 PUTREG(CMSTAT, sc->sc_intmask);
410 PUTREG(CMCMD, CM_CONF(CONF_LONG));
413 printf("%s%d: reset: chip configured, status=0x%02x\n",
414 ifp->if_name, ifp->if_unit, GETREG(CMSTAT));
416 PUTREG(CMCMD, CM_CLR(CLR_POR|CLR_RECONFIG));
419 printf("%s%d: reset: bits cleared, status=0x%02x\n",
420 ifp->if_name, ifp->if_unit, GETREG(CMSTAT));
423 sc->sc_reconcount_excessive = ARC_EXCESSIVE_RECONS;
427 sc->sc_intmask |= CM_RI;
428 sc->sc_rx_fillcount = 0;
431 PUTREG(CMCMD, CM_RXBC(2));
432 PUTREG(CMSTAT, sc->sc_intmask);
435 printf("%s%d: reset: started receiver, status=0x%02x\n",
436 ifp->if_name, ifp->if_unit, GETREG(CMSTAT));
439 /* and init transmitter status */
441 sc->sc_tx_fillcount = 0;
443 ifp->if_flags |= IFF_RUNNING;
444 ifp->if_flags &= ~IFF_OACTIVE;
450 * Take interface offline
456 /* Stop the interrupts */
459 /* Stop the interface */
462 /* Stop watchdog timer */
463 sc->sc_arccom.ac_if.if_timer = 0;
467 * Start output on interface. Get another datagram to send
468 * off the interface queue, and copy it to the
469 * interface becore starting the output
471 * this assumes that it is called inside a critical section...
472 * XXX hm... does it still?
479 struct cm_softc *sc = ifp->if_softc;
483 int len, tlen, offset, s, buffer;
485 u_long copystart, lencopy, perbyte;
488 #if defined(CM_DEBUG) && (CM_DEBUG > 3)
489 printf("%s%d: start(%p)\n", ifp->if_name, ifp->if_unit, ifp);
492 if ((ifp->if_flags & IFF_RUNNING) == 0)
497 if (sc->sc_tx_fillcount >= 2) {
502 m = arc_frag_next(ifp);
503 buffer = sc->sc_tx_act ^ 1;
511 if (m->m_len < ARC_HDRLEN)
512 m = m_pullup(m, ARC_HDRLEN);/* gcc does structure padding */
513 printf("%s%d: start: filling %d from %d to %d type %d\n",
514 ifp->if_name, ifp->if_unit, buffer, mtod(m, u_char *)[0],
515 mtod(m, u_char *)[1], mtod(m, u_char *)[2]);
520 cm_ram_ptr = buffer * 512;
525 /* write the addresses to RAM and throw them away */
528 * Hardware does this: Yet Another Microsecond Saved.
529 * (btw, timing code says usually 2 microseconds)
530 * PUTMEM(cm_ram_ptr + 0, mtod(m, u_char *)[0]);
533 PUTMEM(cm_ram_ptr + 1, mtod(m, u_char *)[1]);
536 /* get total length left at this point */
537 tlen = m->m_pkthdr.len;
538 if (tlen < ARC_MIN_FORBID_LEN) {
540 PUTMEM(cm_ram_ptr + 2, offset);
542 PUTMEM(cm_ram_ptr + 2, 0);
543 if (tlen <= ARC_MAX_FORBID_LEN)
544 offset = 255; /* !!! */
546 if (tlen > ARC_MAX_LEN)
550 PUTMEM(cm_ram_ptr + 3, offset);
553 cm_ram_ptr += offset;
555 /* lets loop through the mbuf chain */
557 for (mp = m; mp; mp = mp->m_next) {
558 if ((len = mp->m_len)) { /* YAMS */
559 bus_space_write_region_1(
560 rman_get_bustag(sc->mem_res),
561 rman_get_bushandle(sc->mem_res),
562 cm_ram_ptr, mtod(mp, caddr_t), len);
568 sc->sc_broadcast[buffer] = (m->m_flags & M_BCAST) != 0;
569 sc->sc_retransmits[buffer] = (m->m_flags & M_BCAST) ? 1 : 5;
571 /* actually transmit the packet */
574 if (++sc->sc_tx_fillcount > 1) {
576 * We are filled up to the rim. No more bufs for the moment,
579 ifp->if_flags |= IFF_OACTIVE;
582 printf("%s%d: start: starting transmitter on buffer %d\n",
583 ifp->if_name, ifp->if_unit, buffer);
585 /* Transmitter was off, start it */
586 sc->sc_tx_act = buffer;
589 * We still can accept another buf, so don't:
590 * ifp->if_flags |= IFF_OACTIVE;
592 sc->sc_intmask |= CM_TA;
593 PUTREG(CMCMD, CM_TX(buffer));
594 PUTREG(CMSTAT, sc->sc_intmask);
596 sc->sc_arccom.ac_if.if_timer = ARCTIMEOUT;
602 * After 10 times reading the docs, I realized
603 * that in the case the receiver NAKs the buffer request,
604 * the hardware retries till shutdown.
605 * This is integrated now in the code above.
612 * Arcnet interface receiver soft interrupt:
613 * get the stuff out of any filled buffer we find.
619 struct cm_softc *sc = (struct cm_softc *)vsc;
620 int buffer, len, offset, s, type;
623 struct arc_header *ah;
626 ifp = &sc->sc_arccom.ac_if;
629 buffer = sc->sc_rx_act ^ 1;
632 /* Allocate header mbuf */
633 MGETHDR(m, M_DONTWAIT, MT_DATA);
637 * in case s.th. goes wrong with mem, drop it
638 * to make sure the receiver can be started again
639 * count it as input error (we dont have any other
646 m->m_pkthdr.rcvif = ifp;
649 * Align so that IP packet will be longword aligned. Here we
650 * assume that m_data of new packet is longword aligned.
651 * When implementing PHDS, we might have to change it to 2,
652 * (2*sizeof(ulong) - CM_HDRNEWLEN)), packet type dependent.
655 cm_ram_ptr = buffer * 512;
656 offset = GETMEM(cm_ram_ptr + 2);
660 offset = GETMEM(cm_ram_ptr + 3);
665 * first +2 bytes for align fixup below
666 * second +2 bytes are for src/dst addresses
668 if ((len + 2 + 2) > MHLEN) {
669 /* attach an mbuf cluster */
670 MCLGET(m, M_DONTWAIT);
672 /* Insist on getting a cluster */
673 if ((m->m_flags & M_EXT) == 0) {
684 type = GETMEM(cm_ram_ptr + offset);
685 m->m_data += 1 + arc_isphds(type);
686 /* mbuf filled with ARCnet addresses */
687 m->m_pkthdr.len = m->m_len = len + 2;
689 ah = mtod(m, struct arc_header *);
690 ah->arc_shost = GETMEM(cm_ram_ptr + 0);
691 ah->arc_dhost = GETMEM(cm_ram_ptr + 1);
693 bus_space_read_region_1(
694 rman_get_bustag(sc->mem_res), rman_get_bushandle(sc->mem_res),
695 cm_ram_ptr + offset, mtod(m, u_char *) + 2, len);
707 /* mark buffer as invalid by source id 0 */
708 PUTMEM(buffer << 9, 0);
711 if (--sc->sc_rx_fillcount == 2 - 1) {
713 /* was off, restart it on buffer just emptied */
714 sc->sc_rx_act = buffer;
715 sc->sc_intmask |= CM_RI;
717 /* this also clears the RI flag interupt: */
718 PUTREG(CMCMD, CM_RXBC(buffer));
719 PUTREG(CMSTAT, sc->sc_intmask);
722 printf("%s%d: srint: restarted rx on buf %d\n",
723 ifp->if_name, ifp->if_unit, buffer);
741 ifp = &(sc->sc_arccom.ac_if);
742 buffer = sc->sc_tx_act;
746 * Normal situtations first for fast path:
747 * If acknowledgement received ok or broadcast, we're ok.
751 if (isr & CM_TMA || sc->sc_broadcast[buffer])
752 sc->sc_arccom.ac_if.if_opackets++;
754 else if (ifp->if_flags & IFF_LINK2 && ifp->if_timer > 0
755 && --sc->sc_retransmits[buffer] > 0) {
756 /* retransmit same buffer */
757 PUTREG(CMCMD, CM_TX(buffer));
765 /* We know we can accept another buffer at this point. */
766 ifp->if_flags &= ~IFF_OACTIVE;
768 if (--sc->sc_tx_fillcount > 0) {
771 * start tx on other buffer.
772 * This also clears the int flag
775 sc->sc_tx_act = buffer;
779 * sc->sc_intmask |= CM_TA;
780 * PUTREG(CMSTAT, sc->sc_intmask);
782 PUTREG(CMCMD, CM_TX(buffer));
783 /* init watchdog timer */
784 ifp->if_timer = ARCTIMEOUT;
786 #if defined(CM_DEBUG) && (CM_DEBUG > 1)
787 printf("%s%d: tint: starting tx on buffer %d, status 0x%02x\n",
788 ifp->if_name, ifp->if_unit, buffer, GETREG(CMSTAT));
791 /* have to disable TX interrupt */
792 sc->sc_intmask &= ~CM_TA;
793 PUTREG(CMSTAT, sc->sc_intmask);
794 /* ... and watchdog timer */
798 printf("%s%d: tint: no more buffers to send, status 0x%02x\n",
799 ifp->if_name, ifp->if_unit, GETREG(CMSTAT));
805 /* schedule soft int to fill a new buffer for us */
806 softintr_schedule(sc->sc_txcookie);
808 /* call it directly */
814 * Our interrupt routine
820 struct cm_softc *sc = arg;
821 struct ifnet *ifp = &sc->sc_arccom.ac_if;
823 u_char isr, maskedisr;
827 isr = GETREG(CMSTAT);
828 maskedisr = isr & sc->sc_intmask;
833 #if defined(CM_DEBUG) && (CM_DEBUG > 1)
834 printf("%s%d: intr: status 0x%02x, intmask 0x%02x\n",
835 ifp->if_name, ifp->if_unit, isr, sc->sc_intmask);
838 if (maskedisr & CM_POR) {
840 * XXX We should never see this. Don't bother to store
842 * sc->sc_arccom.ac_anaddr = GETMEM(CMMACOFF);
844 PUTREG(CMCMD, CM_CLR(CLR_POR));
846 "%s%d: intr: got spurious power on reset int\n",
847 ifp->if_name, ifp->if_unit);
850 if (maskedisr & CM_RECON) {
853 * PUTREG(CMCMD, CM_CONF(CONF_LONG));
855 PUTREG(CMCMD, CM_CLR(CLR_RECONFIG));
856 sc->sc_arccom.ac_if.if_collisions++;
859 * If less than 2 seconds per reconfig:
860 * If ARC_EXCESSIVE_RECONFIGS
861 * since last burst, complain and set treshold for
862 * warnings to ARC_EXCESSIVE_RECONS_REWARN.
864 * This allows for, e.g., new stations on the cable, or
865 * cable switching as long as it is over after
866 * (normally) 16 seconds.
868 * XXX TODO: check timeout bits in status word and
869 * double time if necessary.
872 callout_stop(&sc->sc_recon_ch);
873 newsec = time_second;
874 if ((newsec - sc->sc_recontime <= 2) &&
875 (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) {
877 "%s%d: excessive token losses, "
879 ifp->if_name, ifp->if_unit);
881 sc->sc_recontime = newsec;
882 callout_reset(&sc->sc_recon_ch, 15 * hz,
883 cm_reconwatch, (void *)sc);
886 if (maskedisr & CM_RI) {
887 #if defined(CM_DEBUG) && (CM_DEBUG > 1)
888 printf("%s%d: intr: hard rint, act %d\n",
889 ifp->if_name, ifp->if_unit, sc->sc_rx_act);
892 buffer = sc->sc_rx_act;
893 /* look if buffer is marked invalid: */
894 if (GETMEM(buffer * 512) == 0) {
896 * invalid marked buffer (or illegally
900 "%s%d: spurious RX interupt or sender 0 "
901 " (ignored)\n", ifp->if_name, ifp->if_unit);
903 * restart receiver on same buffer.
904 * XXX maybe better reset interface?
906 PUTREG(CMCMD, CM_RXBC(buffer));
908 if (++sc->sc_rx_fillcount > 1) {
909 sc->sc_intmask &= ~CM_RI;
910 PUTREG(CMSTAT, sc->sc_intmask);
913 sc->sc_rx_act = buffer;
916 * Start receiver on other receive
917 * buffer. This also clears the RI
920 PUTREG(CMCMD, CM_RXBC(buffer));
921 /* in RX intr, so mask is ok for RX */
924 printf("%s%d: strt rx for buf %d, "
926 ifp->if_name, ifp->if_unit,
927 sc->sc_rx_act, GETREG(CMSTAT));
933 * this one starts a soft int to copy out
936 softintr_schedule(sc->sc_rxcookie);
938 /* this one does the copy here */
943 if (maskedisr & CM_TA) {
946 isr = GETREG(CMSTAT);
947 maskedisr = isr & sc->sc_intmask;
949 #if defined(CM_DEBUG) && (CM_DEBUG > 1)
950 printf("%s%d: intr (exit): status 0x%02x, intmask 0x%02x\n",
951 ifp->if_name, ifp->if_unit, isr, sc->sc_intmask);
959 struct cm_softc *sc = arg;
960 struct ifnet *ifp = &sc->sc_arccom.ac_if;
962 if (sc->sc_reconcount >= ARC_EXCESSIVE_RECONS) {
963 sc->sc_reconcount = 0;
964 log(LOG_WARNING, "%s%d: token valid again.\n",
965 ifp->if_name, ifp->if_unit);
967 sc->sc_reconcount = 0;
972 * Process an ioctl request.
973 * This code needs some work - it looks pretty ugly.
976 cm_ioctl(ifp, command, data)
988 ifa = (struct ifaddr *)data;
989 ifr = (struct ifreq *)data;
992 #if defined(CM_DEBUG) && (CM_DEBUG > 2)
993 printf("%s%d: ioctl() called, cmd = 0x%lx\n",
994 ifp->if_name, ifp->if_unit, command);
1003 error = arc_ioctl(ifp, command, data);
1007 if ((ifp->if_flags & IFF_UP) == 0 &&
1008 (ifp->if_flags & IFF_RUNNING) != 0) {
1010 * If interface is marked down and it is running,
1014 ifp->if_flags &= ~IFF_RUNNING;
1015 } else if ((ifp->if_flags & IFF_UP) != 0 &&
1016 (ifp->if_flags & IFF_RUNNING) == 0) {
1018 * If interface is marked up and it is stopped, then
1035 * watchdog routine for transmitter.
1037 * We need this, because else a receiver whose hardware is alive, but whose
1038 * software has not enabled the Receiver, would make our hardware wait forever
1039 * Discovered this after 20 times reading the docs.
1041 * Only thing we do is disable transmitter. We'll get an transmit timeout,
1042 * and the int handler will have to decide not to retransmit (in case
1043 * retransmission is implemented).
1045 * This one assumes being called inside splimp()
1052 struct cm_softc *sc = ifp->if_softc;
1054 PUTREG(CMCMD, CM_TXDIS);