Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Mar 2026 19:10:52 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7a323f873662 - main - sys: Retire le(4)
Message-ID:  <69a5e0bc.19f0f.446748b8@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=7a323f873662dae95a061d1eaf8b1d9d1a0f8a23

commit 7a323f873662dae95a061d1eaf8b1d9d1a0f8a23
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-10-24 17:26:03 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-03-02 19:10:15 +0000

    sys: Retire le(4)
    
    We retired most obsolete 10 and 10/100 Ethernet NIC drivers in 2019 --
    see commits following ebcf740a32ae ("FCP-101: remove obsolete 10 and
    10/100 Ethernet drivers.).
    
    le(4) was retained with with the note "Emulated by QEMU, alternatives
    don't yet work for mips64."  MIPS has since been removed from the tree
    and emulators and virtual machines offer many other, more suitable
    devices.
    
    Reviewed by:    brooks
    Relnotes:       Yes
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D55516
---
 ObsoleteFiles.inc       |   3 +
 share/man/man4/Makefile |   2 -
 share/man/man4/le.4     | 374 ----------------------
 sys/amd64/conf/GENERIC  |   1 -
 sys/conf/NOTES          |   2 -
 sys/dev/le/am7990.c     | 616 ------------------------------------
 sys/dev/le/am79900.c    | 651 --------------------------------------
 sys/dev/le/am79900reg.h | 148 ---------
 sys/dev/le/am79900var.h |  56 ----
 sys/dev/le/am7990reg.h  | 181 -----------
 sys/dev/le/am7990var.h  |  56 ----
 sys/dev/le/if_le_isa.c  | 494 -----------------------------
 sys/dev/le/if_le_pci.c  | 498 -----------------------------
 sys/dev/le/lance.c      | 818 ------------------------------------------------
 sys/dev/le/lancereg.h   | 611 ------------------------------------
 sys/dev/le/lancevar.h   | 208 ------------
 sys/i386/conf/GENERIC   |   1 -
 sys/modules/Makefile    |   1 -
 sys/modules/le/Makefile |  12 -
 19 files changed, 3 insertions(+), 4730 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index f0e2e12a695a..1b5fe1dec9b3 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20260302: Remove obsolete le(4) ethernet driver
+OLD_FILES+=usr/share/man/man4/le.4.gz
+
 # 20260209: Moved allwinner pages to share/man/man4
 OLD_FILES+=usr/share/man/man4/arm/aw_gpio.4.gz
 OLD_FILES+=usr/share/man/man4/arm/aw_mmc.4.gz
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index a385363138d0..07320734210b 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -296,7 +296,6 @@ MAN=	aac.4 \
 	kue.4 \
 	${_kvmclock.4} \
 	lagg.4 \
-	le.4 \
 	led.4 \
 	lge.4 \
 	lindebugfs.4 \
@@ -758,7 +757,6 @@ MLINKS+=jme.4 if_jme.4
 MLINKS+=kue.4 if_kue.4
 MLINKS+=lagg.4 trunk.4
 MLINKS+=lagg.4 if_lagg.4
-MLINKS+=le.4 if_le.4
 MLINKS+=lge.4 if_lge.4
 MLINKS+=lo.4 loop.4
 MLINKS+=lp.4 plip.4
diff --git a/share/man/man4/le.4 b/share/man/man4/le.4
deleted file mode 100644
index 04b57633c91f..000000000000
--- a/share/man/man4/le.4
+++ /dev/null
@@ -1,374 +0,0 @@
-.\"	$NetBSD: le.4,v 1.22 2004/10/04 19:12:52 rumble Exp $
-.\"
-.\"-
-.\" Copyright (c) 1992, 1993
-.\"	The Regents of the University of California.  All rights reserved.
-.\"
-.\" This software was developed by the Computer Systems Engineering group
-.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
-.\" contributed to Berkeley.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"	from: Header: le.4,v 1.2 92/10/13 05:31:33 leres Exp
-.\"
-.Dd October 24, 2025
-.Dt LE 4
-.Os
-.Sh NAME
-.Nm le
-.Nd "AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following line in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device le"
-.Ed
-.Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-if_le_load="YES"
-.Ed
-.Pp
-For ISA non-PnP adapters, the port address as well as the IRQ and the DRQ
-numbers have to be specified in
-.Pa /boot/device.hints :
-.Cd hint.le.0.at="isa"
-.Cd hint.le.0.port="0x280"
-.Cd hint.le.0.irq="10"
-.Cd hint.le.0.drq="0"
-.Sh DEPRECATION NOTICE
-The
-.Nm
-driver may not be present in
-.Fx 16.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for Ethernet adapters based on the
-.Tn AMD Am7990
-and
-.Tn Am79C90
-.Pq CMOS, pin-compatible
-Local Area Network Controller for Ethernet
-.Pq Tn LANCE
-chips.
-.Pp
-The
-.Nm
-driver also supports Ethernet adapters based on the
-.Tn AMD Am79C900
-Integrated Local Area Communications Controller
-.Pq Tn ILACC
-as well as the
-.Tn Am79C9xx PCnet
-family of chips, which are single-chip implementations of a
-.Tn LANCE
-chip and a DMA engine.
-The
-.Nm
-driver treats all of these
-.Tn PCI
-bus Ethernet chips as an
-.Tn AMD Am79C970 PCnet-PCI
-and does not support the additional features like the MII bus and burst mode of
-.Tn AMD Am79C971 PCnet-FAST
-and greater chips.
-.Pp
-Generally, the
-.Nm
-driver aims at supporting as many different chips on as many different
-platforms as possible,
-partially at the cost of the best performance with some of these.
-.Pp
-The
-.Nm
-driver supports reception and transmission of extended frames for
-.Xr vlan 4 .
-Selective reception of multicast Ethernet frames is provided by a 64-bit mask;
-multicast destination addresses are hashed to a bit entry using the Ethernet
-CRC function.
-.Sh HARDWARE
-.Ss ISA
-The
-.Nm
-driver supports
-.Tn ISA
-bus Ethernet adapters which are based on the following chips:
-.Pp
-.Bl -bullet -compact
-.It
-.Tn AMD Am7990 and Am79C90 LANCE
-.It
-.Tn AMD Am79C960 PCnet-ISA
-.It
-.Tn AMD Am79C961 PCnet-ISA+
-.It
-.Tn AMD Am79C961A PCnet-ISA II
-.El
-.Pp
-This includes support for the following Ethernet adapters:
-.Pp
-ISA non-PnP:
-.Pp
-.Bl -bullet -compact
-.It
-.Tn BICC Isolan
-.\" .It
-.\" .Tn Digital DEPCA
-.It
-.Tn Novell NE2100
-.El
-.Pp
-ISA PnP:
-.Pp
-.Bl -bullet -compact
-.It
-.Tn AMD AM1500T/AM2100
-.It
-.Tn AMD PCnet-32
-.It
-.Tn AMD PCnet-ISA
-.It
-.Tn Allied Telesyn AT-1500
-.It
-.Tn Boca LANCard Combo
-.It
-.Tn Cabletron E2100 Series DNI
-.It
-.Tn Cabletron E2200 Single Chip
-.It
-.Tn Melco Inc. LGY-IV
-.It
-.Tn Novell NE2100
-.It
-.Tn Racal InterLan EtherBlaster
-.El
-.Pp
-The
-.Nm
-driver does not support the selection of media types and options via
-.Xr ifconfig 8
-with
-.Tn ISA
-bus Ethernet adapters.
-.Ss PCI
-The
-.Tn PCI
-bus Ethernet chips supported by the
-.Nm
-driver are:
-.Pp
-.Bl -bullet -compact
-.It
-.Tn AMD Am53C974/Am79C970/Am79C974 PCnet-PCI
-.It
-.Tn AMD Am79C970A PCnet-PCI II
-.It
-.Tn AMD Am79C971 PCnet-FAST
-.It
-.Tn AMD Am79C972 PCnet-FAST+
-.It
-.Tn AMD Am79C973/Am79C975 PCnet-FAST III
-.It
-.Tn AMD Am79C976 PCnet-PRO
-.It
-.Tn AMD Am79C978 PCnet-Home
-.El
-.Pp
-This includes support for the following Ethernet adapters:
-.Pp
-.Bl -bullet -compact
-.It
-.Tn AcerLAN NIC P20
-.It
-.Tn Allied Telesyn AT-2450 and AT-2700 series
-.It
-.Tn VMware emulated AMD Am79C970A PCnet-PCI II interface
-.El
-.Pp
-The
-.Nm
-driver supports the selection of the following media types via
-.Xr ifconfig 8
-with
-.Tn PCI
-bus Ethernet adapters:
-.Bl -tag -width ".Cm 10base5/AUI"
-.It Cm autoselect
-Enable autoselection of the media type.
-.It Cm 10baseT/UTP
-Select UTP media.
-.It Cm 10base5/AUI
-Select AUI/BNC media.
-.El
-.Pp
-The following media option is supported with these media types:
-.Bl -tag -width ".Cm full-duplex"
-.It Cm full-duplex
-Select full duplex operation.
-.El
-.Pp
-Note that the
-.Nm
-driver does not support selecting 100Mbps (Fast Ethernet) media types.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "le%d: overflow"
-More packets came in from the Ethernet than there was space in the
-.Tn LANCE
-receive buffers.
-Packets were missed.
-.It "le%d: receive buffer error"
-The
-.Tn LANCE
-ran out of buffer space, packet dropped.
-.It "le%d: lost carrier"
-The Ethernet carrier disappeared during an attempt to transmit.
-The
-.Tn LANCE
-will finish transmitting the current packet,
-but will not automatically retry transmission if there is a collision.
-.It "le%d: excessive collisions, tdr %d"
-The Ethernet was extremely busy or jammed,
-outbound packets were dropped after 16 attempts to retransmit.
-.Pp
-TDR
-is the abbreviation of
-.Qq Time Domain Reflectometry .
-The optionally reported TDR value is an internal counter of the interval
-between the start of a transmission and the occurrence of a collision.
-This value can be used to determine the distance from the Ethernet tap to
-the point on the Ethernet cable that is shorted or open (unterminated).
-.It "le%d: dropping chained buffer"
-A packet did not fit into a single receive buffer and was dropped.
-Since the
-.Nm
-driver allocates buffers large enough to receive maximum sized Ethernet
-packets, this means some other station on the LAN transmitted a packet
-larger than allowed by the Ethernet standard.
-.It "le%d: transmit buffer error"
-The
-.Tn LANCE
-ran out of buffer space before finishing the transmission of a packet.
-If this error occurs, the driver software has a bug.
-.It "le%d: underflow"
-The
-.Tn LANCE
-ran out of buffer space before finishing the transmission of a packet.
-If this error occurs, the driver software has a bug.
-.It "le%d: controller failed to initialize"
-Driver failed to start the
-.Tn LANCE .
-This is potentially a hardware failure.
-.It "le%d: memory error"
-RAM failed to respond within the timeout when the
-.Tn LANCE
-wanted to read or write it.
-This is potentially a hardware failure.
-.It "le%d: receiver disabled"
-The receiver of the
-.Tn LANCE
-was turned off due to an error.
-.It "le%d: transmitter disabled"
-The transmitter of the
-.Tn LANCE
-was turned off due to an error.
-.El
-.Sh SEE ALSO
-.Xr altq 4 ,
-.Xr arp 4 ,
-.Xr intro 4 ,
-.Xr netintro 4 ,
-.Xr vlan 4 ,
-.Xr ifconfig 8
-.Sh HISTORY
-The
-.Nm
-driver was ported from
-.Nx
-and first appeared in
-.Fx 6.1 .
-The
-.Nx
-version in turn was derived from the
-.Nm
-driver which first appeared in
-.Bx 4.4 .
-.Sh AUTHORS
-The
-.Nm
-driver was ported by
-.An Marius Strobl Aq Mt marius@FreeBSD.org .
-.\" .Sh BUGS
-.\" The Am7990 Revision C chips have a bug which causes garbage to be inserted
-.\" in front of the received packet occasionally.
-.\" The work-around is to ignore packets with an invalid destination address
-.\" (garbage will usually not match), by double-checking the destination
-.\" address of every packet in the driver.
-.\" This work-around can be enabled with the
-.\" .Dv LANCE_REVC_BUG
-.\" kernel option.
-.\" .Pp
-.\" When
-.\" .Dv LANCE_REVC_BUG
-.\" is enabled, the
-.\" .Nm
-.\" driver executes one or two calls to an inline Ethernet address comparison
-.\" function for every received packet.
-.\" On the
-.\" .Tn MC68000
-.\" it is exactly eight instructions of 16 bits each.
-.\" There is one comparison for each unicast packet, and two comparisons for
-.\" each broadcast packet.
-.\" .Pp
-.\" In summary, the cost of the LANCE_REVC_BUG option is:
-.\" .Bl -enum -compact
-.\" .It
-.\" loss of multicast support, and
-.\" .It
-.\" eight extra
-.\" .Tn CPU
-.\" instructions per received packet, sometimes sixteen, depending on both the
-.\" processor, and the type of packet.
-.\" .El
-.\" .Pp
-.\" All sun3 systems are presumed to have this bad revision of the Am7990,
-.\" until proven otherwise.
-.\" Alas, the only way to prove what revision of the chip is in a particular
-.\" system is inspection of the date code on the chip package,
-.\" to compare against a list of what chip revisions were fabricated between
-.\" which dates.
-.\" .Pp
-.\" Alas, the Am7990 chip is so old that
-.\" .Tn AMD
-.\" has
-.\" .Qq de-archived
-.\" the production information about it; pending a search elsewhere, we do not
-.\" know how to identify the revision C chip from the date codes.
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index c390ff7596b6..0868cdfc95e7 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -243,7 +243,6 @@ device		axp			# AMD EPYC integrated NIC (requires miibus)
 # PCI Ethernet NICs.
 device		aq			# Aquantia / Marvell AQC1xx
 device		bxe			# Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE
-device		le			# AMD Am7900 LANCE and Am79C9xx PCnet
 device		rge			# Realtek 8125/8126/8127
 device		ti			# Alteon Networks Tigon I/II gigabit Ethernet
 
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 1f734a700cd1..0114ed51c4f2 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1897,7 +1897,6 @@ device		xmphy		# XaQti XMAC II
 #	(hint of prefer_iomap can be done to prefer I/O instead of Mem mapping)
 # gem:  Apple GMAC/Sun ERI/Sun GEM
 # jme:  JMicron JMC260 Fast Ethernet/JMC250 Gigabit Ethernet based adapters.
-# le:   AMD Am7900 LANCE and Am79C9xx PCnet
 # lge:	Support for PCI gigabit ethernet adapters based on the Level 1
 #	LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX,
 #	SMC TigerCard 1000 (SMC9462SX), and some Addtron cards.
@@ -2008,7 +2007,6 @@ device		cxgb		# Chelsio T3 10 Gigabit Ethernet
 device		cxgb_t3fw	# Chelsio T3 10 Gigabit Ethernet firmware
 device		cxgbe		# Chelsio T4-T6 1/10/25/40/100 Gigabit Ethernet
 device		cxgbev		# Chelsio T4-T6 Virtual Functions
-device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
 device		mxge		# Myricom Myri-10G 10GbE NIC
 device		rge		# Realtek 8125/8126/8127
 device		oce		# Emulex 10GbE (OneConnect Ethernet)
diff --git a/sys/dev/le/am7990.c b/sys/dev/le/am7990.c
deleted file mode 100644
index 95184356f33b..000000000000
--- a/sys/dev/le/am7990.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/*	$NetBSD: am7990.c,v 1.68 2005/12/11 12:21:25 christos Exp $	*/
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause
- *
- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
- * Simulation Facility, NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Copyright (c) 1992, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/bus.h>
-#include <sys/endian.h>
-#include <sys/lock.h>
-#include <sys/mbuf.h>
-#include <sys/mutex.h>
-#include <sys/socket.h>
-
-#include <net/bpf.h>
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_var.h>
-
-#include <machine/bus.h>
-
-#include <dev/le/lancereg.h>
-#include <dev/le/lancevar.h>
-#include <dev/le/am7990reg.h>
-#include <dev/le/am7990var.h>
-
-static void	am7990_meminit(struct lance_softc *);
-static void	am7990_rint(struct lance_softc *);
-static void	am7990_tint(struct lance_softc *);
-static void	am7990_start_locked(struct lance_softc *sc);
-
-#ifdef LEDEBUG
-static void	am7990_recv_print(struct lance_softc *, int);
-static void	am7990_xmit_print(struct lance_softc *, int);
-#endif
-
-int
-am7990_config(struct am7990_softc *sc, const char* name, int unit)
-{
-	int error, mem;
-
-	sc->lsc.sc_meminit = am7990_meminit;
-	sc->lsc.sc_start_locked = am7990_start_locked;
-
-	error = lance_config(&sc->lsc, name, unit);
-	if (error != 0)
-		return (error);
-
-	mem = 0;
-	sc->lsc.sc_initaddr = mem;
-	mem += sizeof(struct leinit);
-	sc->lsc.sc_rmdaddr = mem;
-	mem += sizeof(struct lermd) * sc->lsc.sc_nrbuf;
-	sc->lsc.sc_tmdaddr = mem;
-	mem += sizeof(struct letmd) * sc->lsc.sc_ntbuf;
-	sc->lsc.sc_rbufaddr = mem;
-	mem += LEBLEN * sc->lsc.sc_nrbuf;
-	sc->lsc.sc_tbufaddr = mem;
-	mem += LEBLEN * sc->lsc.sc_ntbuf;
-
-	if (mem > sc->lsc.sc_memsize)
-		panic("%s: memsize", __func__);
-
-	lance_attach(&sc->lsc);
-
-	return (0);
-}
-
-void
-am7990_detach(struct am7990_softc *sc)
-{
-
-	lance_detach(&sc->lsc);
-}
-
-/*
- * Set up the initialization block and the descriptor rings.
- */
-static void
-am7990_meminit(struct lance_softc *sc)
-{
-	if_t ifp = sc->sc_ifp;
-	struct leinit init;
-	struct lermd rmd;
-	struct letmd tmd;
-	u_long a;
-	int bix;
-
-	LE_LOCK_ASSERT(sc, MA_OWNED);
-
-	if (if_getflags(ifp) & IFF_PROMISC)
-		init.init_mode = LE_MODE_NORMAL | LE_MODE_PROM;
-	else
-		init.init_mode = LE_MODE_NORMAL;
-
-	init.init_padr[0] = (sc->sc_enaddr[1] << 8) | sc->sc_enaddr[0];
-	init.init_padr[1] = (sc->sc_enaddr[3] << 8) | sc->sc_enaddr[2];
-	init.init_padr[2] = (sc->sc_enaddr[5] << 8) | sc->sc_enaddr[4];
-	lance_setladrf(sc, init.init_ladrf);
-
-	sc->sc_last_rd = 0;
-	sc->sc_first_td = sc->sc_last_td = sc->sc_no_td = 0;
-
-	a = sc->sc_addr + LE_RMDADDR(sc, 0);
-	init.init_rdra = a;
-	init.init_rlen = (a >> 16) | ((ffs(sc->sc_nrbuf) - 1) << 13);
-
-	a = sc->sc_addr + LE_TMDADDR(sc, 0);
-	init.init_tdra = a;
-	init.init_tlen = (a >> 16) | ((ffs(sc->sc_ntbuf) - 1) << 13);
-
-	(*sc->sc_copytodesc)(sc, &init, LE_INITADDR(sc), sizeof(init));
-
-	/*
-	 * Set up receive ring descriptors.
-	 */
-	for (bix = 0; bix < sc->sc_nrbuf; bix++) {
-		a = sc->sc_addr + LE_RBUFADDR(sc, bix);
-		rmd.rmd0 = a;
-		rmd.rmd1_hadr = a >> 16;
-		rmd.rmd1_bits = LE_R1_OWN;
-		rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
-		rmd.rmd3 = 0;
-		(*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix),
-		    sizeof(rmd));
-	}
-
-	/*
-	 * Set up transmit ring descriptors.
-	 */
-	for (bix = 0; bix < sc->sc_ntbuf; bix++) {
-		a = sc->sc_addr + LE_TBUFADDR(sc, bix);
-		tmd.tmd0 = a;
-		tmd.tmd1_hadr = a >> 16;
-		tmd.tmd1_bits = 0;
-		tmd.tmd2 = LE_XMD2_ONES;
-		tmd.tmd3 = 0;
-		(*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix),
-		    sizeof(tmd));
-	}
-}
-
-static void
-am7990_rint(struct lance_softc *sc)
-{
-	if_t ifp = sc->sc_ifp;
-	struct mbuf *m;
-	struct lermd rmd;
-	int bix, rp;
-#if defined(LANCE_REVC_BUG)
-	struct ether_header *eh;
-	/* Make sure this is short-aligned, for ether_cmp(). */
-	static uint16_t bcast_enaddr[3] = { ~0, ~0, ~0 };
-#endif
-
-	bix = sc->sc_last_rd;
-
-	/* Process all buffers with valid data. */
-	for (;;) {
-		rp = LE_RMDADDR(sc, bix);
-		(*sc->sc_copyfromdesc)(sc, &rmd, rp, sizeof(rmd));
-
-		if (rmd.rmd1_bits & LE_R1_OWN)
-			break;
-
-		m = NULL;
-		if ((rmd.rmd1_bits & (LE_R1_ERR | LE_R1_STP | LE_R1_ENP)) !=
-		    (LE_R1_STP | LE_R1_ENP)) {
-			if (rmd.rmd1_bits & LE_R1_ERR) {
-#ifdef LEDEBUG
-				if (rmd.rmd1_bits & LE_R1_ENP) {
-					if ((rmd.rmd1_bits & LE_R1_OFLO) == 0) {
-						if (rmd.rmd1_bits & LE_R1_FRAM)
-							if_printf(ifp,
-							    "framing error\n");
-						if (rmd.rmd1_bits & LE_R1_CRC)
-							if_printf(ifp,
-							    "crc mismatch\n");
-					}
-				} else
-					if (rmd.rmd1_bits & LE_R1_OFLO)
-						if_printf(ifp, "overflow\n");
-#endif
-				if (rmd.rmd1_bits & LE_R1_BUFF)
-					if_printf(ifp,
-					    "receive buffer error\n");
-			} else if ((rmd.rmd1_bits & (LE_R1_STP | LE_R1_ENP)) !=
-			    (LE_R1_STP | LE_R1_ENP))
-				if_printf(ifp, "dropping chained buffer\n");
-		} else {
-#ifdef LEDEBUG
-			if (sc->sc_flags & LE_DEBUG)
-				am7990_recv_print(sc, bix);
-#endif
-			/* Pull the packet off the interface. */
-			m = lance_get(sc, LE_RBUFADDR(sc, bix),
-			    (int)rmd.rmd3 - ETHER_CRC_LEN);
-		}
-
-		rmd.rmd1_bits = LE_R1_OWN;
-		rmd.rmd2 = -LEBLEN | LE_XMD2_ONES;
-		rmd.rmd3 = 0;
-		(*sc->sc_copytodesc)(sc, &rmd, rp, sizeof(rmd));
-
-		if (++bix == sc->sc_nrbuf)
-			bix = 0;
-
-		if (m != NULL) {
-			if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
-
-#ifdef LANCE_REVC_BUG
-			/*
-			 * The old LANCE (Rev. C) chips have a bug which
-			 * causes garbage to be inserted in front of the
-			 * received packet. The workaround is to ignore
-			 * packets with an invalid destination address
-			 * (garbage will usually not match).
-			 * Of course, this precludes multicast support...
-			 */
-			eh = mtod(m, struct ether_header *);
-			if (ether_cmp(eh->ether_dhost, sc->sc_enaddr) &&
-			    ether_cmp(eh->ether_dhost, bcast_enaddr)) {
-				m_freem(m);
-				continue;
-			}
-#endif
-
-			/* Pass the packet up. */
-			LE_UNLOCK(sc);
-			if_input(ifp, m);
-			LE_LOCK(sc);
-		} else
-			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-	}
-
-	sc->sc_last_rd = bix;
-}
-
-static void
-am7990_tint(struct lance_softc *sc)
-{
-	if_t ifp = sc->sc_ifp;
-	struct letmd tmd;
-	int bix;
-
-	bix = sc->sc_first_td;
-
-	for (;;) {
-		if (sc->sc_no_td <= 0)
-			break;
-
-		(*sc->sc_copyfromdesc)(sc, &tmd, LE_TMDADDR(sc, bix),
-		    sizeof(tmd));
-
-#ifdef LEDEBUG
-		if (sc->sc_flags & LE_DEBUG)
-			if_printf(ifp, "trans tmd: "
-			    "ladr %04x, hadr %02x, flags %02x, "
-			    "bcnt %04x, mcnt %04x\n",
-			    tmd.tmd0, tmd.tmd1_hadr, tmd.tmd1_bits,
-			    tmd.tmd2, tmd.tmd3);
-#endif
-
-		if (tmd.tmd1_bits & LE_T1_OWN)
-			break;
-
-		if_setdrvflagbits(ifp, 0, IFF_DRV_OACTIVE);
-
-		if (tmd.tmd1_bits & LE_T1_ERR) {
-			if (tmd.tmd3 & LE_T3_BUFF)
-				if_printf(ifp, "transmit buffer error\n");
-			else if (tmd.tmd3 & LE_T3_UFLO)
-				if_printf(ifp, "underflow\n");
-			if (tmd.tmd3 & (LE_T3_BUFF | LE_T3_UFLO)) {
-				lance_init_locked(sc);
-				return;
-			}
-			if (tmd.tmd3 & LE_T3_LCAR) {
-				if (sc->sc_flags & LE_CARRIER)
-					if_link_state_change(ifp,
-					    LINK_STATE_DOWN);
-				sc->sc_flags &= ~LE_CARRIER;
-				if (sc->sc_nocarrier)
-					(*sc->sc_nocarrier)(sc);
-				else
-					if_printf(ifp, "lost carrier\n");
-			}
-			if (tmd.tmd3 & LE_T3_LCOL)
-				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
-			if (tmd.tmd3 & LE_T3_RTRY) {
-#ifdef LEDEBUG
-				if_printf(ifp, "excessive collisions, tdr %d\n",
-				    tmd.tmd3 & LE_T3_TDR_MASK);
-#endif
-				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16);
-			}
-			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-		} else {
-			if (tmd.tmd1_bits & LE_T1_ONE)
-				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
-			else if (tmd.tmd1_bits & LE_T1_MORE)
-				/* Real number is unknown. */
-				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2);
-			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
-		}
-
-		if (++bix == sc->sc_ntbuf)
-			bix = 0;
-
-		--sc->sc_no_td;
-	}
-
-	sc->sc_first_td = bix;
-
-	sc->sc_wdog_timer = sc->sc_no_td > 0 ? 5 : 0;
-}
-
-/*
- * Controller interrupt
- */
-void
-am7990_intr(void *arg)
-{
-	struct lance_softc *sc = arg;
-	if_t ifp = sc->sc_ifp;
-	uint16_t isr;
-
-	LE_LOCK(sc);
-
-	if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) {
-		if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-		lance_init_locked(sc);
-		LE_UNLOCK(sc);
-		return;
-	}
-
-	isr = (*sc->sc_rdcsr)(sc, LE_CSR0);
-#if defined(LEDEBUG) && LEDEBUG > 1
-	if (sc->sc_flags & LE_DEBUG)
-		if_printf(ifp, "%s: entering with isr=%04x\n", __func__, isr);
-#endif
-	if ((isr & LE_C0_INTR) == 0) {
-		LE_UNLOCK(sc);
-		return;
-	}
-
-	/*
-	 * Clear interrupt source flags and turn off interrupts. If we
-	 * don't clear these flags before processing their sources we
-	 * could completely miss some interrupt events as the NIC can
-	 * change these flags while we're in this handler. We toggle
-	 * the interrupt enable bit in order to keep receiving them
-	 * (some chips work without this, some don't).
-	 */
-	(*sc->sc_wrcsr)(sc, LE_CSR0, isr & ~(LE_C0_INEA | LE_C0_TDMD |
-	    LE_C0_STOP | LE_C0_STRT | LE_C0_INIT));
-
-	if (isr & LE_C0_ERR) {
-		if (isr & LE_C0_BABL) {
-#ifdef LEDEBUG
-			if_printf(ifp, "babble\n");
-#endif
-			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-		}
-#if 0
-		if (isr & LE_C0_CERR) {
-			if_printf(ifp, "collision error\n");
-			if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
-		}
-#endif
-		if (isr & LE_C0_MISS) {
-#ifdef LEDEBUG
-			if_printf(ifp, "missed packet\n");
-#endif
-			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-		}
-		if (isr & LE_C0_MERR) {
-			if_printf(ifp, "memory error\n");
-			lance_init_locked(sc);
-			LE_UNLOCK(sc);
-			return;
-		}
-	}
-
-	if ((isr & LE_C0_RXON) == 0) {
-		if_printf(ifp, "receiver disabled\n");
-		if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-		lance_init_locked(sc);
-		LE_UNLOCK(sc);
-		return;
-	}
-	if ((isr & LE_C0_TXON) == 0) {
-		if_printf(ifp, "transmitter disabled\n");
-		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
-		lance_init_locked(sc);
-		LE_UNLOCK(sc);
-		return;
-	}
-
-	/*
-	 * Pretend we have carrier; if we don't this will be cleared shortly.
-	 */
-	if (!(sc->sc_flags & LE_CARRIER))
-		if_link_state_change(ifp, LINK_STATE_UP);
-	sc->sc_flags |= LE_CARRIER;
-
-	if (isr & LE_C0_RINT)
-		am7990_rint(sc);
-	if (isr & LE_C0_TINT)
-		am7990_tint(sc);
-
-	/* Enable interrupts again. */
-	(*sc->sc_wrcsr)(sc, LE_CSR0, LE_C0_INEA);
-
-	if (!if_sendq_empty(ifp))
-		am7990_start_locked(sc);
-
-	LE_UNLOCK(sc);
-}
-
-/*
- * Set up output on interface.
- * Get another datagram to send off of the interface queue, and map it to the
- * interface before starting the output.
- */
*** 3951 LINES SKIPPED ***


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a5e0bc.19f0f.446748b8>