Deleted Added
sdiff udiff text old ( 214264 ) new ( 226995 )
full compact
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/tl/if_tl.c 214264 2010-10-24 12:51:02Z marius $");
35
36/*
37 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
38 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
39 * the National Semiconductor DP83840A physical interface and the
40 * Microchip Technology 24Cxx series serial EEPROM.
41 *
42 * Written using the following four documents:

--- 155 unchanged lines hidden (view full) ---

198#include <vm/vm.h> /* for vtophys */
199#include <vm/pmap.h> /* for vtophys */
200#include <machine/bus.h>
201#include <machine/resource.h>
202#include <sys/bus.h>
203#include <sys/rman.h>
204
205#include <dev/mii/mii.h>
206#include <dev/mii/miivar.h>
207
208#include <dev/pci/pcireg.h>
209#include <dev/pci/pcivar.h>
210
211/*
212 * Default to using PIO register access mode to pacify certain
213 * laptop docking stations with built-in ThunderLAN chips that

--- 9 unchanged lines hidden (view full) ---

223
224/* "device miibus" required. See GENERIC if you get errors here. */
225#include "miibus_if.h"
226
227/*
228 * Various supported device vendors/types and their names.
229 */
230
231static struct tl_type tl_devs[] = {
232 { TI_VENDORID, TI_DEVICEID_THUNDERLAN,
233 "Texas Instruments ThunderLAN" },
234 { COMPAQ_VENDORID, COMPAQ_DEVICEID_NETEL_10,
235 "Compaq Netelligent 10" },
236 { COMPAQ_VENDORID, COMPAQ_DEVICEID_NETEL_10_100,
237 "Compaq Netelligent 10/100" },
238 { COMPAQ_VENDORID, COMPAQ_DEVICEID_NETEL_10_100_PROLIANT,
239 "Compaq Netelligent 10/100 Proliant" },

--- 45 unchanged lines hidden (view full) ---

285static int tl_shutdown(device_t);
286static int tl_ifmedia_upd(struct ifnet *);
287static void tl_ifmedia_sts(struct ifnet *, struct ifmediareq *);
288
289static u_int8_t tl_eeprom_putbyte(struct tl_softc *, int);
290static u_int8_t tl_eeprom_getbyte(struct tl_softc *, int, u_int8_t *);
291static int tl_read_eeprom(struct tl_softc *, caddr_t, int, int);
292
293static void tl_mii_sync(struct tl_softc *);
294static void tl_mii_send(struct tl_softc *, u_int32_t, int);
295static int tl_mii_readreg(struct tl_softc *, struct tl_mii_frame *);
296static int tl_mii_writereg(struct tl_softc *, struct tl_mii_frame *);
297static int tl_miibus_readreg(device_t, int, int);
298static int tl_miibus_writereg(device_t, int, int, int);
299static void tl_miibus_statchg(device_t);
300
301static void tl_setmode(struct tl_softc *, int);
302static uint32_t tl_mchash(const uint8_t *);
303static void tl_setmulti(struct tl_softc *);
304static void tl_setfilt(struct tl_softc *, caddr_t, int);

--- 8 unchanged lines hidden (view full) ---

313static void tl_dio_write8(struct tl_softc *, int, int);
314static void tl_dio_write16(struct tl_softc *, int, int);
315static void tl_dio_write32(struct tl_softc *, int, int);
316static void tl_dio_setbit(struct tl_softc *, int, int);
317static void tl_dio_clrbit(struct tl_softc *, int, int);
318static void tl_dio_setbit16(struct tl_softc *, int, int);
319static void tl_dio_clrbit16(struct tl_softc *, int, int);
320
321#ifdef TL_USEIOSPACE
322#define TL_RES SYS_RES_IOPORT
323#define TL_RID TL_PCI_LOIO
324#else
325#define TL_RES SYS_RES_MEMORY
326#define TL_RID TL_PCI_LOMEM
327#endif
328

--- 26 unchanged lines hidden (view full) ---

355
356DRIVER_MODULE(tl, pci, tl_driver, tl_devclass, 0, 0);
357DRIVER_MODULE(miibus, tl, miibus_driver, miibus_devclass, 0, 0);
358
359static u_int8_t tl_dio_read8(sc, reg)
360 struct tl_softc *sc;
361 int reg;
362{
363 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
364 return(CSR_READ_1(sc, TL_DIO_DATA + (reg & 3)));
365}
366
367static u_int16_t tl_dio_read16(sc, reg)
368 struct tl_softc *sc;
369 int reg;
370{
371 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
372 return(CSR_READ_2(sc, TL_DIO_DATA + (reg & 3)));
373}
374
375static u_int32_t tl_dio_read32(sc, reg)
376 struct tl_softc *sc;
377 int reg;
378{
379 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
380 return(CSR_READ_4(sc, TL_DIO_DATA + (reg & 3)));
381}
382
383static void tl_dio_write8(sc, reg, val)
384 struct tl_softc *sc;
385 int reg;
386 int val;
387{
388 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
389 CSR_WRITE_1(sc, TL_DIO_DATA + (reg & 3), val);
390 return;
391}
392
393static void tl_dio_write16(sc, reg, val)
394 struct tl_softc *sc;
395 int reg;
396 int val;
397{
398 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
399 CSR_WRITE_2(sc, TL_DIO_DATA + (reg & 3), val);
400 return;
401}
402
403static void tl_dio_write32(sc, reg, val)
404 struct tl_softc *sc;
405 int reg;
406 int val;
407{
408 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
409 CSR_WRITE_4(sc, TL_DIO_DATA + (reg & 3), val);
410 return;
411}
412
413static void
414tl_dio_setbit(sc, reg, bit)
415 struct tl_softc *sc;
416 int reg;
417 int bit;
418{
419 u_int8_t f;
420
421 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
422 f = CSR_READ_1(sc, TL_DIO_DATA + (reg & 3));
423 f |= bit;
424 CSR_WRITE_1(sc, TL_DIO_DATA + (reg & 3), f);
425
426 return;
427}
428
429static void
430tl_dio_clrbit(sc, reg, bit)
431 struct tl_softc *sc;
432 int reg;
433 int bit;
434{
435 u_int8_t f;
436
437 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
438 f = CSR_READ_1(sc, TL_DIO_DATA + (reg & 3));
439 f &= ~bit;
440 CSR_WRITE_1(sc, TL_DIO_DATA + (reg & 3), f);
441
442 return;
443}
444
445static void tl_dio_setbit16(sc, reg, bit)
446 struct tl_softc *sc;
447 int reg;
448 int bit;
449{
450 u_int16_t f;
451
452 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
453 f = CSR_READ_2(sc, TL_DIO_DATA + (reg & 3));
454 f |= bit;
455 CSR_WRITE_2(sc, TL_DIO_DATA + (reg & 3), f);
456
457 return;
458}
459
460static void tl_dio_clrbit16(sc, reg, bit)
461 struct tl_softc *sc;
462 int reg;
463 int bit;
464{
465 u_int16_t f;
466
467 CSR_WRITE_2(sc, TL_DIO_ADDR, reg);
468 f = CSR_READ_2(sc, TL_DIO_DATA + (reg & 3));
469 f &= ~bit;
470 CSR_WRITE_2(sc, TL_DIO_DATA + (reg & 3), f);
471
472 return;
473}
474
475/*
476 * Send an instruction or address to the EEPROM, check for ACK.
477 */
478static u_int8_t tl_eeprom_putbyte(sc, byte)
479 struct tl_softc *sc;
480 int byte;

--- 122 unchanged lines hidden (view full) ---

603 if (err)
604 break;
605 *(dest + i) = byte;
606 }
607
608 return(err ? 1 : 0);
609}
610
611static void
612tl_mii_sync(sc)
613 struct tl_softc *sc;
614{
615 register int i;
616
617 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MTXEN);
618
619 for (i = 0; i < 32; i++) {
620 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
621 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
622 }
623
624 return;
625}
626
627static void
628tl_mii_send(sc, bits, cnt)
629 struct tl_softc *sc;
630 u_int32_t bits;
631 int cnt;
632{
633 int i;
634
635 for (i = (0x1 << (cnt - 1)); i; i >>= 1) {
636 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
637 if (bits & i) {
638 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MDATA);
639 } else {
640 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MDATA);
641 }
642 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
643 }
644}
645
646static int
647tl_mii_readreg(sc, frame)
648 struct tl_softc *sc;
649 struct tl_mii_frame *frame;
650
651{
652 int i, ack;
653 int minten = 0;
654
655 tl_mii_sync(sc);
656
657 /*
658 * Set up frame for RX.
659 */
660 frame->mii_stdelim = TL_MII_STARTDELIM;
661 frame->mii_opcode = TL_MII_READOP;
662 frame->mii_turnaround = 0;
663 frame->mii_data = 0;
664
665 /*
666 * Turn off MII interrupt by forcing MINTEN low.
667 */
668 minten = tl_dio_read8(sc, TL_NETSIO) & TL_SIO_MINTEN;
669 if (minten) {
670 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MINTEN);
671 }
672
673 /*
674 * Turn on data xmit.
675 */
676 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MTXEN);
677
678 /*
679 * Send command/address info.
680 */
681 tl_mii_send(sc, frame->mii_stdelim, 2);
682 tl_mii_send(sc, frame->mii_opcode, 2);
683 tl_mii_send(sc, frame->mii_phyaddr, 5);
684 tl_mii_send(sc, frame->mii_regaddr, 5);
685
686 /*
687 * Turn off xmit.
688 */
689 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MTXEN);
690
691 /* Idle bit */
692 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
693 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
694
695 /* Check for ack */
696 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
697 ack = tl_dio_read8(sc, TL_NETSIO) & TL_SIO_MDATA;
698
699 /* Complete the cycle */
700 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
701
702 /*
703 * Now try reading data bits. If the ack failed, we still
704 * need to clock through 16 cycles to keep the PHYs in sync.
705 */
706 if (ack) {
707 for(i = 0; i < 16; i++) {
708 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
709 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
710 }
711 goto fail;
712 }
713
714 for (i = 0x8000; i; i >>= 1) {
715 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
716 if (!ack) {
717 if (tl_dio_read8(sc, TL_NETSIO) & TL_SIO_MDATA)
718 frame->mii_data |= i;
719 }
720 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
721 }
722
723fail:
724
725 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
726 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
727
728 /* Reenable interrupts */
729 if (minten) {
730 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MINTEN);
731 }
732
733 if (ack)
734 return(1);
735 return(0);
736}
737
738static int
739tl_mii_writereg(sc, frame)
740 struct tl_softc *sc;
741 struct tl_mii_frame *frame;
742
743{
744 int minten;
745
746 tl_mii_sync(sc);
747
748 /*
749 * Set up frame for TX.
750 */
751
752 frame->mii_stdelim = TL_MII_STARTDELIM;
753 frame->mii_opcode = TL_MII_WRITEOP;
754 frame->mii_turnaround = TL_MII_TURNAROUND;
755
756 /*
757 * Turn off MII interrupt by forcing MINTEN low.
758 */
759 minten = tl_dio_read8(sc, TL_NETSIO) & TL_SIO_MINTEN;
760 if (minten) {
761 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MINTEN);
762 }
763
764 /*
765 * Turn on data output.
766 */
767 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MTXEN);
768
769 tl_mii_send(sc, frame->mii_stdelim, 2);
770 tl_mii_send(sc, frame->mii_opcode, 2);
771 tl_mii_send(sc, frame->mii_phyaddr, 5);
772 tl_mii_send(sc, frame->mii_regaddr, 5);
773 tl_mii_send(sc, frame->mii_turnaround, 2);
774 tl_mii_send(sc, frame->mii_data, 16);
775
776 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MCLK);
777 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MCLK);
778
779 /*
780 * Turn off xmit.
781 */
782 tl_dio_clrbit(sc, TL_NETSIO, TL_SIO_MTXEN);
783
784 /* Reenable interrupts */
785 if (minten)
786 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_MINTEN);
787
788 return(0);
789}
790
791static int
792tl_miibus_readreg(dev, phy, reg)
793 device_t dev;
794 int phy, reg;
795{
796 struct tl_softc *sc;
797 struct tl_mii_frame frame;
798
799 sc = device_get_softc(dev);
800 bzero((char *)&frame, sizeof(frame));
801
802 frame.mii_phyaddr = phy;
803 frame.mii_regaddr = reg;
804 tl_mii_readreg(sc, &frame);
805
806 return(frame.mii_data);
807}
808
809static int
810tl_miibus_writereg(dev, phy, reg, data)
811 device_t dev;
812 int phy, reg, data;
813{
814 struct tl_softc *sc;
815 struct tl_mii_frame frame;
816
817 sc = device_get_softc(dev);
818 bzero((char *)&frame, sizeof(frame));
819
820 frame.mii_phyaddr = phy;
821 frame.mii_regaddr = reg;
822 frame.mii_data = data;
823
824 tl_mii_writereg(sc, &frame);
825
826 return(0);
827}
828
829static void
830tl_miibus_statchg(dev)
831 device_t dev;
832{
833 struct tl_softc *sc;
834 struct mii_data *mii;
835
836 sc = device_get_softc(dev);
837 mii = device_get_softc(sc->tl_miibus);
838
839 if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) {
840 tl_dio_setbit(sc, TL_NETCMD, TL_CMD_DUPLEX);
841 } else {
842 tl_dio_clrbit(sc, TL_NETCMD, TL_CMD_DUPLEX);
843 }
844
845 return;
846}
847
848/*
849 * Set modes for bitrate devices.
850 */
851static void
852tl_setmode(sc, media)
853 struct tl_softc *sc;

--- 6 unchanged lines hidden (view full) ---

860 if ((media & IFM_GMASK) == IFM_FDX) {
861 tl_dio_clrbit(sc, TL_ACOMMIT, TL_AC_MTXD3);
862 tl_dio_setbit(sc, TL_NETCMD, TL_CMD_DUPLEX);
863 } else {
864 tl_dio_setbit(sc, TL_ACOMMIT, TL_AC_MTXD3);
865 tl_dio_clrbit(sc, TL_NETCMD, TL_CMD_DUPLEX);
866 }
867 }
868
869 return;
870}
871
872/*
873 * Calculate the hash of a MAC address for programming the multicast hash
874 * table. This hash is simply the address split into 6-bit chunks
875 * XOR'd, e.g.
876 * byte: 000000|00 1111|1111 22|222222|333333|33 4444|4444 55|555555
877 * bit: 765432|10 7654|3210 76|543210|765432|10 7654|3210 76|543210

--- 26 unchanged lines hidden (view full) ---

904{
905 int i;
906 u_int16_t regaddr;
907
908 regaddr = TL_AREG0_B5 + (slot * ETHER_ADDR_LEN);
909
910 for (i = 0; i < ETHER_ADDR_LEN; i++)
911 tl_dio_write8(sc, regaddr + i, *(addr + i));
912
913 return;
914}
915
916/*
917 * XXX In FreeBSD 3.0, multicast addresses are managed using a doubly
918 * linked list. This is fine, except addresses are added from the head
919 * end of the list. We want to arrange for 224.0.0.1 (the "all hosts")
920 * group to always be in the perfect filter, but as more groups are added,
921 * the 224.0.0.1 entry (which is always added first) gets pushed down

--- 53 unchanged lines hidden (view full) ---

975 else
976 hashes[1] |= (1 << (h - 32));
977 }
978 if_maddr_runlock(ifp);
979 }
980
981 tl_dio_write32(sc, TL_HASH1, hashes[0]);
982 tl_dio_write32(sc, TL_HASH2, hashes[1]);
983
984 return;
985}
986
987/*
988 * This routine is recommended by the ThunderLAN manual to insure that
989 * the internal PHY is powered up correctly. It also recommends a one
990 * second pause at the end to 'wait for the clocks to start' but in my
991 * experience this isn't necessary.
992 */
993static void
994tl_hardreset(dev)
995 device_t dev;
996{
997 struct tl_softc *sc;
998 int i;
999 u_int16_t flags;
1000
1001 sc = device_get_softc(dev);
1002
1003 tl_mii_sync(sc);
1004
1005 flags = BMCR_LOOP|BMCR_ISO|BMCR_PDOWN;
1006
1007 for (i = 0; i < MII_NPHY; i++)
1008 tl_miibus_writereg(dev, i, MII_BMCR, flags);
1009
1010 tl_miibus_writereg(dev, 31, MII_BMCR, BMCR_ISO);
1011 DELAY(50000);
1012 tl_miibus_writereg(dev, 31, MII_BMCR, BMCR_LOOP|BMCR_ISO);
1013 tl_mii_sync(sc);
1014 while(tl_miibus_readreg(dev, 31, MII_BMCR) & BMCR_RESET);
1015
1016 DELAY(50000);
1017 return;
1018}
1019
1020static void
1021tl_softreset(sc, internal)
1022 struct tl_softc *sc;
1023 int internal;
1024{
1025 u_int32_t cmd, dummy, i;

--- 41 unchanged lines hidden (view full) ---

1067 /* Unreset the MII */
1068 tl_dio_setbit(sc, TL_NETSIO, TL_SIO_NMRST);
1069
1070 /* Take the adapter out of reset */
1071 tl_dio_setbit(sc, TL_NETCMD, TL_CMD_NRESET|TL_CMD_NWRAP);
1072
1073 /* Wait for things to settle down a little. */
1074 DELAY(500);
1075
1076 return;
1077}
1078
1079/*
1080 * Probe for a ThunderLAN chip. Check the PCI vendor and device IDs
1081 * against our list and return its name if we find a match.
1082 */
1083static int
1084tl_probe(dev)
1085 device_t dev;
1086{
1087 struct tl_type *t;
1088
1089 t = tl_devs;
1090
1091 while(t->tl_name != NULL) {
1092 if ((pci_get_vendor(dev) == t->tl_vid) &&
1093 (pci_get_device(dev) == t->tl_did)) {
1094 device_set_desc(dev, t->tl_name);
1095 return (BUS_PROBE_DEFAULT);

--- 4 unchanged lines hidden (view full) ---

1100 return(ENXIO);
1101}
1102
1103static int
1104tl_attach(dev)
1105 device_t dev;
1106{
1107 u_int16_t did, vid;
1108 struct tl_type *t;
1109 struct ifnet *ifp;
1110 struct tl_softc *sc;
1111 int error, flags, i, rid, unit;
1112 u_char eaddr[6];
1113
1114 vid = pci_get_vendor(dev);
1115 did = pci_get_device(dev);
1116 sc = device_get_softc(dev);

--- 293 unchanged lines hidden (view full) ---

1410
1411/*
1412 * Initialize the RX lists and allocate mbufs for them.
1413 */
1414static int
1415tl_list_rx_init(sc)
1416 struct tl_softc *sc;
1417{
1418 struct tl_chain_data *cd;
1419 struct tl_list_data *ld;
1420 int i;
1421
1422 cd = &sc->tl_cdata;
1423 ld = sc->tl_ldata;
1424
1425 for (i = 0; i < TL_RX_LIST_CNT; i++) {
1426 cd->tl_rx_chain[i].tl_ptr =
1427 (struct tl_list_onefrag *)&ld->tl_rx_list[i];
1428 if (tl_newbuf(sc, &cd->tl_rx_chain[i]) == ENOBUFS)

--- 349 unchanged lines hidden (view full) ---

1778 if (r) {
1779 CMD_PUT(sc, TL_CMD_ACK | r | type);
1780 }
1781
1782 if (ifp->if_snd.ifq_head != NULL)
1783 tl_start_locked(ifp);
1784
1785 TL_UNLOCK(sc);
1786
1787 return;
1788}
1789
1790static void
1791tl_stats_update(xsc)
1792 void *xsc;
1793{
1794 struct tl_softc *sc;
1795 struct ifnet *ifp;

--- 42 unchanged lines hidden (view full) ---

1838 tl_watchdog(sc);
1839
1840 callout_reset(&sc->tl_stat_callout, hz, tl_stats_update, sc);
1841
1842 if (!sc->tl_bitrate) {
1843 mii = device_get_softc(sc->tl_miibus);
1844 mii_tick(mii);
1845 }
1846
1847 return;
1848}
1849
1850/*
1851 * Encapsulate an mbuf chain in a list by coupling the mbuf data
1852 * pointers to the fragment pointers.
1853 */
1854static int
1855tl_encap(sc, c, m_head)

--- 185 unchanged lines hidden (view full) ---

2041 sc->tl_cdata.tl_tx_tail->tl_next = start_tx;
2042 sc->tl_cdata.tl_tx_tail = cur_tx;
2043 }
2044
2045 /*
2046 * Set a timeout in case the chip goes out to lunch.
2047 */
2048 sc->tl_timer = 5;
2049
2050 return;
2051}
2052
2053static void
2054tl_init(xsc)
2055 void *xsc;
2056{
2057 struct tl_softc *sc = xsc;
2058

--- 79 unchanged lines hidden (view full) ---

2138 /* Send the RX go command */
2139 CMD_SET(sc, TL_CMD_GO|TL_CMD_NES|TL_CMD_RT);
2140
2141 ifp->if_drv_flags |= IFF_DRV_RUNNING;
2142 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
2143
2144 /* Start the stats update counter */
2145 callout_reset(&sc->tl_stat_callout, hz, tl_stats_update, sc);
2146
2147 return;
2148}
2149
2150/*
2151 * Set media options.
2152 */
2153static int
2154tl_ifmedia_upd(ifp)
2155 struct ifnet *ifp;

--- 43 unchanged lines hidden (view full) ---

2199 return;
2200 } else {
2201 mii = device_get_softc(sc->tl_miibus);
2202 mii_pollstat(mii);
2203 ifmr->ifm_active = mii->mii_media_active;
2204 ifmr->ifm_status = mii->mii_media_status;
2205 }
2206 TL_UNLOCK(sc);
2207
2208 return;
2209}
2210
2211static int
2212tl_ioctl(ifp, command, data)
2213 struct ifnet *ifp;
2214 u_long command;
2215 caddr_t data;
2216{

--- 62 unchanged lines hidden (view full) ---

2279 ifp = sc->tl_ifp;
2280
2281 if_printf(ifp, "device timeout\n");
2282
2283 ifp->if_oerrors++;
2284
2285 tl_softreset(sc, 1);
2286 tl_init_locked(sc);
2287
2288 return;
2289}
2290
2291/*
2292 * Stop the adapter and free any mbufs allocated to the
2293 * RX and TX lists.
2294 */
2295static void
2296tl_stop(sc)

--- 49 unchanged lines hidden (view full) ---

2346 m_freem(sc->tl_cdata.tl_tx_chain[i].tl_mbuf);
2347 sc->tl_cdata.tl_tx_chain[i].tl_mbuf = NULL;
2348 }
2349 }
2350 bzero((char *)&sc->tl_ldata->tl_tx_list,
2351 sizeof(sc->tl_ldata->tl_tx_list));
2352
2353 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
2354
2355 return;
2356}
2357
2358/*
2359 * Stop all chip I/O so that the kernel's probe routines don't
2360 * get confused by errant DMAs when rebooting.
2361 */
2362static int
2363tl_shutdown(dev)

--- 12 unchanged lines hidden ---