aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2019-05-17 15:23:10 +0000
committerBrooks Davis <brooks@FreeBSD.org>2019-05-17 15:23:10 +0000
commite153ee663af128fb3c938e5cb31f223ea4f0de58 (patch)
tree072c71c95434b289bb3c3eba9acf181c33788c8f
parent05aa6e583be3cf53a55270e03b185833c4379020 (diff)
downloadsrc-e153ee663af1.tar.gz
src-e153ee663af1.zip
FCP-101: Remove ep(4).
Relnotes: yes FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md Reviewed by: jhb, imp Differential Revision: https://reviews.freebsd.org/D20230
Notes
Notes: svn path=/head/; revision=347912
-rw-r--r--ObsoleteFiles.inc1
-rw-r--r--share/man/man4/man4.i386/Makefile1
-rw-r--r--share/man/man4/man4.i386/ep.4209
-rw-r--r--sys/conf/NOTES3
-rw-r--r--sys/conf/files3
-rw-r--r--sys/conf/files.i3861
-rw-r--r--sys/dev/ep/elink.c98
-rw-r--r--sys/dev/ep/elink.h43
-rw-r--r--sys/dev/ep/if_ep.c1008
-rw-r--r--sys/dev/ep/if_ep_isa.c398
-rw-r--r--sys/dev/ep/if_ep_pccard.c240
-rw-r--r--sys/dev/ep/if_epreg.h434
-rw-r--r--sys/dev/ep/if_epvar.h111
-rw-r--r--sys/i386/conf/GENERIC1
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/ep/Makefile17
16 files changed, 1 insertions, 2569 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 5a0bf6f82fcb..59b886b939ff 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -45,6 +45,7 @@ OLD_FILES+=usr/share/man/man4/de.4
OLD_FILES+=usr/share/man/man4/if_de.4
OLD_FILES+=usr/share/man/man4/ed.4
OLD_FILES+=usr/share/man/man4/if_ed.4
+OLD_FILES+=usr/share/man/man4/ep.4
# 20190513: libcap_sysctl interface change
OLD_FILES+=lib/casper/libcap_sysctl.1
# 20190509: tests/sys/opencrypto requires the net/py-dpkt package.
diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
index 605e204e7389..05d6312f4c7f 100644
--- a/share/man/man4/man4.i386/Makefile
+++ b/share/man/man4/man4.i386/Makefile
@@ -8,7 +8,6 @@ MAN= apm.4 \
CPU_ELAN.4 \
ctau.4 \
cx.4 \
- ep.4 \
ex.4 \
fe.4 \
glxiic.4 \
diff --git a/share/man/man4/man4.i386/ep.4 b/share/man/man4/man4.i386/ep.4
deleted file mode 100644
index 17b008dddd28..000000000000
--- a/share/man/man4/man4.i386/ep.4
+++ /dev/null
@@ -1,209 +0,0 @@
-.\"
-.\" Copyright (c) 1994 Herb Peyerl
-.\" All rights reserved.
-.\"
-.\" 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. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Herb Peyerl
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 24, 2018
-.Dt EP 4 i386
-.Os
-.Sh NAME
-.Nm ep
-.Nd "Ethernet driver for 3Com Etherlink III (3c5x9) interfaces"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following line in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device ep"
-.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_ep_load="YES"
-.Ed
-.Sh DEPRECATION NOTICE
-The
-.Nm
-driver is not present in
-.Fx 13.0
-and later.
-See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more
-information.
-.Sh DESCRIPTION
-The
-.Nm
-device driver supports network adapters based on the 3Com 3C5x9 Etherlink III
-Parallel Tasking chipset.
-.Pp
-Various models of these cards come with a different assortment of
-connectors:
-.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
-.It AUI/DIX
-Standard 15 pin connector, also known as 10base5 (thick-net)
-.It 10Base2
-BNC, also known as thin-net
-.It 10BaseT
-UTP, also known as twisted pair
-.El
-.Pp
-The default port to use is the port that has been selected with the
-setup utility.
-To override this, use the following media options with
-.Xr ifconfig 8
-or in your
-.Pa /etc/rc.conf
-file.
-.Bl -tag -width xxxxxxxxxxxxxxxxxxxx
-.It 10base5/AUI
-Use the AUI port.
-.It 10base2/BNC
-Use the BNC port.
-.It 10baseT/UTP
-Use the UTP port.
-.El
-.Sh HARDWARE
-The
-.Nm
-driver supports Ethernet adapters based on the
-3Com 3C5x9 Etherlink III Parallel Tasking chipset, including:
-.Pp
-.Bl -bullet -compact
-.It
-3Com 3C1 CF
-.It
-3Com 3C509-TP, 3C509-BNC, 3C509-Combo, 3C509-TPO, 3C509-TPC ISA
-.It
-3Com 3C509B-TP, 3C509B-BNC, 3C509B-Combo, 3C509B-TPO, 3C509B-TPC ISA
-.It
-3Com 3C562/3C563 PCMCIA
-.It
-3Com 3C574, 3C574TX, 3C574-TX, 3CCFE574BT, 3CXFE574BT, 3C3FE574BT PCMCIA
-.It
-3Com 3C589, 3C589B, 3C589C, 3C589D, 3CXE589DT PCMCIA
-.It
-3Com 3CCFEM556B, 3CCFEM556BI PCMCIA
-.It
-3Com 3CXE589EC, 3CCE589EC, 3CXE589ET, 3CCE589ET PCMCIA
-.It
-3Com Megahertz 3CCEM556, 3CXEM556, 3CCEM556B, 3CXEM556B, 3C3FEM556C PCMCIA
-.It
-3Com OfficeConnect 3CXSH572BT, 3CCSH572BT PCMCIA
-.It
-Farallon EtherWave and EtherMac PC Card (P/n 595/895 with BLUE arrow)
-.El
-.Sh NOTES
-The 3c509 card has no jumpers to set the address.
-3Com supplies software to set the address of the card in software.
-To find the card on the ISA bus, the kernel performs a complex
-scan operation at IO address 0x110.
-Beware!
-Avoid placing other cards at that address!
-.Pp
-Furthermore, the 3c509 should not be configured in EISA mode.
-.Pp
-Cards in PnP mode may conflict with other resources in the system.
-Ensure your BIOS is configured correctly to exclude resources used by
-the 3c509, especially IRQs, to avoid unpredictable behavior.
-.Pp
-Many different companies sold the 3Com PC Cards under their own private
-label.
-These cards also work.
-.Pp
-The Farallon EtherWave and EtherMac card came in two varieties.
-The
-.Nm
-driver supports the 595 and 895 cards.
-These cards have the blue arrow on the front along with a 3Com logo.
-The Farallon 595a cards, which have a red arrow on the front,
-are also called EtherWave and EtherMac.
-They are supported by the
-.Xr sn 4
-driver.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "ep0: reset (status: %x)"
-The driver has encountered a FIFO underrun or overrun.
-The driver will reset the card and the packet will be lost.
-This is not fatal.
-.It "ep0: eeprom failed to come ready"
-The eeprom failed to come ready.
-This probably means the card is wedged.
-.It "ep0: 3c509 in test mode. Erase pencil mark!"
-This means that someone has scribbled with pencil
-in the test area on the card.
-Erase the pencil mark and reboot.
-(This is not a joke).
-.It "ep0: No I/O space?!"
-The driver was unable to allocate the I/O space that it thinks
-should be there.
-Look for conflicts with other devices.
-.It "ep0: No irq?!"
-The driver could not allocate the interrupt it wanted.
-Look for conflicts, although sharing interrupts for PC Card is normal.
-.It "ep0: No connectors!"
-The driver queried the hardware for what ethernet attachment were
-present, but the hardware reported none that the driver recognized.
-.It "ep0: Unable to get Ethernet address!"
-The driver was unable to read the ethernet address from the EEPROM.
-This is likely the result of the card being wedged.
-.It "ep0: if_alloc() failed"
-The driver was unable to allocate a ifnet structure.
-This may happen in extremely low memory conditions.
-.It "ep0: strange connector type in EEPROM: assuming AUI"
-The driver does not know what to do with the information the EEPROM
-has about connectors, so it is assuming the worst.
-.It "ep0: unknown ID 0xXXXXXXXX"
-The driver has found an ID that it believes it supports, but does not
-have a specific identification string to present to the user.
-.It "ep0: <%s> at port 0x%03x in EISA mode, ignored."
-The 3C509 ISA card is in EISA mode.
-The card will be ignored until it is taken out of EISA mode.
-.It "ep0: <%s> at x0%03x in PnP mode"
-This card appears to be in Plug and Play mode.
-It should be probed as part of the plug and play phase of the ISA
-probes.
-.It "ep0: Invalid EEPROM checksum!"
-The EEPROM has a bad checksum, so the driver is ignoring the card.
-.It "ep0: bus_setup_intr() failed!"
-The driver was unable to setup the interrupt handler.
-This should never happen.
-.El
-.Sh SEE ALSO
-.Xr altq 4 ,
-.Xr ed 4 ,
-.Xr intro 4 ,
-.Xr ng_ether 4 ,
-.Xr sn 4 ,
-.Xr vx 4 ,
-.Xr ifconfig 8
-.Sh STANDARDS
-are great.
-There is so many to choose from.
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 31f8722d7b31..0adc65b17e9d 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1937,8 +1937,6 @@ device xmphy # XaQti XMAC II
# LinkSys LNE100TX, LNE100TX V2.0, Jaton XpressNet, Alfa Inc GFC2204,
# KNE110TX.
# em: Intel Pro/1000 Gigabit Ethernet 82542, 82543, 82544 based adapters.
-# ep: 3Com 3C509, 3C529, 3C556, 3C562D, 3C563D, 3C572, 3C574X, 3C579, 3C589
-# and PC Card devices using these chipsets.
# ex: Intel EtherExpress Pro/10 and other i82595-based adapters,
# Olicom Ethernet PC Card devices.
# fe: Fujitsu MB86960A/MB86965A Ethernet
@@ -2044,7 +2042,6 @@ device xmphy # XaQti XMAC II
# Order for ISA devices is important here
-device ep
device ex
device fe
hint.fe.0.at="isa"
diff --git a/sys/conf/files b/sys/conf/files
index 2f20e40bfb5b..73c6abc6556a 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1633,9 +1633,6 @@ dev/ena/ena_sysctl.c optional ena \
compile-with "${NORMAL_C} -I$S/contrib"
contrib/ena-com/ena_com.c optional ena
contrib/ena-com/ena_eth_com.c optional ena
-dev/ep/if_ep.c optional ep
-dev/ep/if_ep_isa.c optional ep isa
-dev/ep/if_ep_pccard.c optional ep pccard
dev/esp/esp_pci.c optional esp pci
dev/esp/ncr53c9x.c optional esp
dev/etherswitch/arswitch/arswitch.c optional arswitch
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index a9d208716277..f2298ce02438 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -199,7 +199,6 @@ dev/ed/if_ed_isa.c optional ed isa
dev/ed/if_ed_wd80x3.c optional ed isa
dev/ed/if_ed_hpp.c optional ed isa ed_hpp
dev/ed/if_ed_sic.c optional ed isa ed_sic
-dev/ep/elink.c optional ep
dev/fb/fb.c optional fb | vga
dev/fb/s3_pci.c optional s3pci
dev/fb/vesa.c optional vga vesa
diff --git a/sys/dev/ep/elink.c b/sys/dev/ep/elink.c
deleted file mode 100644
index 1e1589a853df..000000000000
--- a/sys/dev/ep/elink.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
- *
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $NetBSD: elink.c,v 1.6 1995/01/07 21:37:54 mycroft Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Common code for dealing with 3COM ethernet cards.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-
-#include <machine/cpufunc.h>
-
-#include <dev/ep/elink.h>
-
-/*
- * Issue a `global reset' to all cards, and reset the ID state machines. We
- * have to be careful to do the global reset only once during autoconfig, to
- * prevent resetting boards that have already been configured.
- */
-void
-elink_reset()
-{
- static int x = 0;
-
- if (x == 0) {
- x = 1;
- outb(ELINK_ID_PORT, ELINK_RESET);
- }
- outb(ELINK_ID_PORT, 0x00);
- outb(ELINK_ID_PORT, 0x00);
-
- return;
-}
-
-/*
- * The `ID sequence' is really just snapshots of an 8-bit CRC register as 0
- * bits are shifted in. Different board types use different polynomials.
- */
-void
-elink_idseq(u_char p)
-{
- int i;
- u_char c;
-
- c = 0xff;
- for (i = 255; i; i--) {
- outb(ELINK_ID_PORT, c);
- if (c & 0x80) {
- c <<= 1;
- c ^= p;
- } else
- c <<= 1;
- }
-}
-
-static moduledata_t elink_mod = {
- "elink",/* module name */
- NULL, /* event handler */
- 0 /* extra data */
-};
-
-DECLARE_MODULE(elink, elink_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
-MODULE_VERSION(elink, 1);
diff --git a/sys/dev/ep/elink.h b/sys/dev/ep/elink.h
deleted file mode 100644
index 070205d7f9de..000000000000
--- a/sys/dev/ep/elink.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1994 Charles Hannum. All rights reserved.
- *
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $NetBSD: elink.h,v 1.3 1994/10/27 04:17:11 cgd Exp $
- * $FreeBSD$
- */
-
-#define ELINK_ID_PORT 0x100
-#define ELINK_RESET 0xc0
-
-#define ELINK_507_POLY 0xe7
-#define ELINK_509_POLY 0xcf
-#define TLINK_619_POLY 0x63
-
-void elink_reset(void);
-void elink_idseq(u_char p);
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
deleted file mode 100644
index 62b0418fc080..000000000000
--- a/sys/dev/ep/if_ep.c
+++ /dev/null
@@ -1,1008 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
- * All rights reserved.
- *
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Herb Peyerl.
- * 4. The name of Herb Peyerl may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * Modified from the FreeBSD 1.1.5.1 version by:
- * Andres Vega Garcia
- * INRIA - Sophia Antipolis, France
- * avega@sophia.inria.fr
- */
-
-/*
- * Promiscuous mode added and interrupt logic slightly changed
- * to reduce the number of adapter failures. Transceiver select
- * logic changed to use value from EEPROM. Autoconfiguration
- * features added.
- * Done by:
- * Serge Babkin
- * Chelindbank (Chelyabinsk, Russia)
- * babkin@hq.icb.chel.su
- */
-
-/*
- * Pccard support for 3C589 by:
- * HAMADA Naoki
- * nao@tom-yam.or.jp
- */
-
-/*
- * MAINTAINER: Matthew N. Dodd <winter@jurai.net>
- * <mdodd@FreeBSD.org>
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_dl.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-#include <net/ethernet.h>
-#include <net/bpf.h>
-
-#include <dev/ep/if_epreg.h>
-#include <dev/ep/if_epvar.h>
-
-/* Exported variables */
-devclass_t ep_devclass;
-
-static int ep_media2if_media[] =
-{IFM_10_T, IFM_10_5, IFM_NONE, IFM_10_2, IFM_NONE};
-
-/* if functions */
-static void epinit(void *);
-static int epioctl(struct ifnet *, u_long, caddr_t);
-static void epstart(struct ifnet *);
-
-static void ep_intr_locked(struct ep_softc *);
-static void epstart_locked(struct ifnet *);
-static void epinit_locked(struct ep_softc *);
-static void eptick(void *);
-static void epwatchdog(struct ep_softc *);
-
-/* if_media functions */
-static int ep_ifmedia_upd(struct ifnet *);
-static void ep_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-static void epstop(struct ep_softc *);
-static void epread(struct ep_softc *);
-static int eeprom_rdy(struct ep_softc *);
-
-#define EP_FTST(sc, f) (sc->stat & (f))
-#define EP_FSET(sc, f) (sc->stat |= (f))
-#define EP_FRST(sc, f) (sc->stat &= ~(f))
-
-static int
-eeprom_rdy(struct ep_softc *sc)
-{
- int i;
-
- for (i = 0; is_eeprom_busy(sc) && i < MAX_EEPROMBUSY; i++)
- DELAY(100);
-
- if (i >= MAX_EEPROMBUSY) {
- device_printf(sc->dev, "eeprom failed to come ready.\n");
- return (ENXIO);
- }
-
- return (0);
-}
-
-/*
- * get_e: gets a 16 bits word from the EEPROM. we must have set the window
- * before
- */
-int
-ep_get_e(struct ep_softc *sc, uint16_t offset, uint16_t *result)
-{
-
- if (eeprom_rdy(sc))
- return (ENXIO);
-
- CSR_WRITE_2(sc, EP_W0_EEPROM_COMMAND,
- (EEPROM_CMD_RD << sc->epb.cmd_off) | offset);
-
- if (eeprom_rdy(sc))
- return (ENXIO);
-
- (*result) = CSR_READ_2(sc, EP_W0_EEPROM_DATA);
-
- return (0);
-}
-
-static int
-ep_get_macaddr(struct ep_softc *sc, u_char *addr)
-{
- int i;
- uint16_t result;
- int error;
- uint16_t *macaddr;
-
- macaddr = (uint16_t *) addr;
-
- GO_WINDOW(sc, 0);
- for (i = EEPROM_NODE_ADDR_0; i <= EEPROM_NODE_ADDR_2; i++) {
- error = ep_get_e(sc, i, &result);
- if (error)
- return (error);
- macaddr[i] = htons(result);
- }
- return (0);
-}
-
-int
-ep_alloc(device_t dev)
-{
- struct ep_softc *sc = device_get_softc(dev);
- int rid;
- int error = 0;
- uint16_t result;
-
- rid = 0;
- sc->iobase = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
- RF_ACTIVE);
- if (!sc->iobase) {
- device_printf(dev, "No I/O space?!\n");
- error = ENXIO;
- goto bad;
- }
- rid = 0;
- sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
- if (!sc->irq) {
- device_printf(dev, "No irq?!\n");
- error = ENXIO;
- goto bad;
- }
- sc->dev = dev;
- sc->stat = 0; /* 16 bit access */
-
- sc->bst = rman_get_bustag(sc->iobase);
- sc->bsh = rman_get_bushandle(sc->iobase);
-
- sc->ep_connectors = 0;
- sc->ep_connector = 0;
-
- GO_WINDOW(sc, 0);
-
- error = ep_get_e(sc, EEPROM_PROD_ID, &result);
- if (error)
- goto bad;
- sc->epb.prod_id = result;
-
- error = ep_get_e(sc, EEPROM_RESOURCE_CFG, &result);
- if (error)
- goto bad;
- sc->epb.res_cfg = result;
-
-bad:
- if (error != 0)
- ep_free(dev);
- return (error);
-}
-
-void
-ep_get_media(struct ep_softc *sc)
-{
- uint16_t config;
-
- GO_WINDOW(sc, 0);
- config = CSR_READ_2(sc, EP_W0_CONFIG_CTRL);
- if (config & IS_AUI)
- sc->ep_connectors |= AUI;
- if (config & IS_BNC)
- sc->ep_connectors |= BNC;
- if (config & IS_UTP)
- sc->ep_connectors |= UTP;
-
- if (!(sc->ep_connectors & 7))
- if (bootverbose)
- device_printf(sc->dev, "no connectors!\n");
-
- /*
- * This works for most of the cards so we'll do it here.
- * The cards that require something different can override
- * this later on.
- */
- sc->ep_connector = CSR_READ_2(sc, EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS;
-}
-
-void
-ep_free(device_t dev)
-{
- struct ep_softc *sc = device_get_softc(dev);
-
- if (sc->ep_intrhand)
- bus_teardown_intr(dev, sc->irq, sc->ep_intrhand);
- if (sc->iobase)
- bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->iobase);
- if (sc->irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
- sc->ep_intrhand = 0;
- sc->iobase = 0;
- sc->irq = 0;
-}
-
-static void
-ep_setup_station(struct ep_softc *sc, u_char *enaddr)
-{
- int i;
-
- /*
- * Setup the station address
- */
- GO_WINDOW(sc, 2);
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- CSR_WRITE_1(sc, EP_W2_ADDR_0 + i, enaddr[i]);
-}
-
-int
-ep_attach(struct ep_softc *sc)
-{
- struct ifnet *ifp = NULL;
- struct ifmedia *ifm = NULL;
- int error;
-
- sc->gone = 0;
- EP_LOCK_INIT(sc);
- if (! (sc->stat & F_ENADDR_SKIP)) {
- error = ep_get_macaddr(sc, sc->eaddr);
- if (error) {
- device_printf(sc->dev, "Unable to get MAC address!\n");
- EP_LOCK_DESTROY(sc);
- return (ENXIO);
- }
- }
- ep_setup_station(sc, sc->eaddr);
- ifp = sc->ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(sc->dev, "if_alloc() failed\n");
- EP_LOCK_DESTROY(sc);
- return (ENOSPC);
- }
-
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_start = epstart;
- ifp->if_ioctl = epioctl;
- ifp->if_init = epinit;
- IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
- ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
- IFQ_SET_READY(&ifp->if_snd);
-
- callout_init_mtx(&sc->watchdog_timer, &sc->sc_mtx, 0);
- if (!sc->epb.mii_trans) {
- ifmedia_init(&sc->ifmedia, 0, ep_ifmedia_upd, ep_ifmedia_sts);
-
- if (sc->ep_connectors & AUI)
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER | IFM_10_5, 0, NULL);
- if (sc->ep_connectors & UTP)
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER | IFM_10_T, 0, NULL);
- if (sc->ep_connectors & BNC)
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER | IFM_10_2, 0, NULL);
- if (!sc->ep_connectors)
- ifmedia_add(&sc->ifmedia,
- IFM_ETHER | IFM_NONE, 0, NULL);
-
- ifmedia_set(&sc->ifmedia,
- IFM_ETHER | ep_media2if_media[sc->ep_connector]);
-
- ifm = &sc->ifmedia;
- ifm->ifm_media = ifm->ifm_cur->ifm_media;
- ep_ifmedia_upd(ifp);
- }
- ether_ifattach(ifp, sc->eaddr);
-
-#ifdef EP_LOCAL_STATS
- sc->rx_no_first = sc->rx_no_mbuf = sc->rx_bpf_disc =
- sc->rx_overrunf = sc->rx_overrunl = sc->tx_underrun = 0;
-#endif
- EP_FSET(sc, F_RX_FIRST);
- sc->top = sc->mcur = 0;
-
- EP_LOCK(sc);
- epstop(sc);
- EP_UNLOCK(sc);
-
- gone_by_fcp101_dev(sc->dev);
-
- return (0);
-}
-
-int
-ep_detach(device_t dev)
-{
- struct ep_softc *sc;
- struct ifnet *ifp;
-
- sc = device_get_softc(dev);
- ifp = sc->ifp;
- EP_ASSERT_UNLOCKED(sc);
- EP_LOCK(sc);
- if (bus_child_present(dev))
- epstop(sc);
- sc->gone = 1;
- ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
- EP_UNLOCK(sc);
- ether_ifdetach(ifp);
- callout_drain(&sc->watchdog_timer);
- ep_free(dev);
-
- if_free(ifp);
- EP_LOCK_DESTROY(sc);
-
- return (0);
-}
-
-static void
-epinit(void *xsc)
-{
- struct ep_softc *sc = xsc;
- EP_LOCK(sc);
- epinit_locked(sc);
- EP_UNLOCK(sc);
-}
-
-/*
- * The order in here seems important. Otherwise we may not receive
- * interrupts. ?!
- */
-static void
-epinit_locked(struct ep_softc *sc)
-{
- struct ifnet *ifp = sc->ifp;
- int i;
-
- if (sc->gone)
- return;
-
- EP_ASSERT_LOCKED(sc);
- EP_BUSY_WAIT(sc);
-
- GO_WINDOW(sc, 0);
- CSR_WRITE_2(sc, EP_COMMAND, STOP_TRANSCEIVER);
- GO_WINDOW(sc, 4);
- CSR_WRITE_2(sc, EP_W4_MEDIA_TYPE, DISABLE_UTP);
- GO_WINDOW(sc, 0);
-
- /* Disable the card */
- CSR_WRITE_2(sc, EP_W0_CONFIG_CTRL, 0);
-
- /* Enable the card */
- CSR_WRITE_2(sc, EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
-
- GO_WINDOW(sc, 2);
- /* Reload the ether_addr. */
- ep_setup_station(sc, IF_LLADDR(sc->ifp));
-
- CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
- CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
- EP_BUSY_WAIT(sc);
-
- /* Window 1 is operating window */
- GO_WINDOW(sc, 1);
- for (i = 0; i < 31; i++)
- CSR_READ_1(sc, EP_W1_TX_STATUS);
-
- /* get rid of stray intr's */
- CSR_WRITE_2(sc, EP_COMMAND, ACK_INTR | 0xff);
-
- CSR_WRITE_2(sc, EP_COMMAND, SET_RD_0_MASK | S_5_INTS);
- CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-
- if (ifp->if_flags & IFF_PROMISC)
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- FIL_MULTICAST | FIL_BRDCST | FIL_PROMISC);
- else
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_FILTER | FIL_INDIVIDUAL |
- FIL_MULTICAST | FIL_BRDCST);
-
- if (!sc->epb.mii_trans)
- ep_ifmedia_upd(ifp);
-
- if (sc->stat & F_HAS_TX_PLL)
- CSR_WRITE_2(sc, EP_COMMAND, TX_PLL_ENABLE);
- CSR_WRITE_2(sc, EP_COMMAND, RX_ENABLE);
- CSR_WRITE_2(sc, EP_COMMAND, TX_ENABLE);
-
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* just in case */
-
-#ifdef EP_LOCAL_STATS
- sc->rx_no_first = sc->rx_no_mbuf =
- sc->rx_overrunf = sc->rx_overrunl = sc->tx_underrun = 0;
-#endif
- EP_FSET(sc, F_RX_FIRST);
- if (sc->top) {
- m_freem(sc->top);
- sc->top = sc->mcur = 0;
- }
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH);
- CSR_WRITE_2(sc, EP_COMMAND, SET_TX_START_THRESH | 16);
-
- GO_WINDOW(sc, 1);
- epstart_locked(ifp);
- callout_reset(&sc->watchdog_timer, hz, eptick, sc);
-}
-
-static void
-epstart(struct ifnet *ifp)
-{
- struct ep_softc *sc;
- sc = ifp->if_softc;
- EP_LOCK(sc);
- epstart_locked(ifp);
- EP_UNLOCK(sc);
-}
-
-static void
-epstart_locked(struct ifnet *ifp)
-{
- struct ep_softc *sc;
- u_int len;
- struct mbuf *m, *m0;
- int pad, started;
-
- sc = ifp->if_softc;
- if (sc->gone)
- return;
- EP_ASSERT_LOCKED(sc);
- EP_BUSY_WAIT(sc);
- if (ifp->if_drv_flags & IFF_DRV_OACTIVE)
- return;
- started = 0;
-startagain:
- /* Sneak a peek at the next packet */
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m0);
- if (m0 == NULL)
- return;
- if (!started && (sc->stat & F_HAS_TX_PLL))
- CSR_WRITE_2(sc, EP_COMMAND, TX_PLL_ENABLE);
- started++;
- for (len = 0, m = m0; m != NULL; m = m->m_next)
- len += m->m_len;
-
- pad = (4 - len) & 3;
-
- /*
- * The 3c509 automatically pads short packets to minimum
- * ethernet length, but we drop packets that are too large.
- * Perhaps we should truncate them instead?
- */
- if (len + pad > ETHER_MAX_LEN) {
- /* packet is obviously too large: toss it */
- if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
- m_freem(m0);
- goto readcheck;
- }
- if (CSR_READ_2(sc, EP_W1_FREE_TX) < len + pad + 4) {
- /* no room in FIFO */
- CSR_WRITE_2(sc, EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4));
- /* make sure */
- if (CSR_READ_2(sc, EP_W1_FREE_TX) < len + pad + 4) {
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- IFQ_DRV_PREPEND(&ifp->if_snd, m0);
- goto done;
- }
- } else
- CSR_WRITE_2(sc, EP_COMMAND,
- SET_TX_AVAIL_THRESH | EP_THRESH_DISABLE);
-
- CSR_WRITE_2(sc, EP_W1_TX_PIO_WR_1, len);
- /* Second dword meaningless */
- CSR_WRITE_2(sc, EP_W1_TX_PIO_WR_1, 0x0);
-
- for (m = m0; m != NULL; m = m->m_next) {
- if (m->m_len > 1)
- CSR_WRITE_MULTI_2(sc, EP_W1_TX_PIO_WR_1,
- mtod(m, uint16_t *), m->m_len / 2);
- if (m->m_len & 1)
- CSR_WRITE_1(sc, EP_W1_TX_PIO_WR_1,
- *(mtod(m, uint8_t *)+m->m_len - 1));
- }
-
- while (pad--)
- CSR_WRITE_1(sc, EP_W1_TX_PIO_WR_1, 0); /* Padding */
-
- /* XXX and drop splhigh here */
-
- BPF_MTAP(ifp, m0);
-
- sc->tx_timer = 2;
- if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
- m_freem(m0);
-
- /*
- * Is another packet coming in? We don't want to overflow
- * the tiny RX fifo.
- */
-readcheck:
- if (CSR_READ_2(sc, EP_W1_RX_STATUS) & RX_BYTES_MASK) {
- /*
- * we check if we have packets left, in that case
- * we prepare to come back later
- */
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- CSR_WRITE_2(sc, EP_COMMAND, SET_TX_AVAIL_THRESH | 8);
- goto done;
- }
- goto startagain;
-done:;
- return;
-}
-
-void
-ep_intr(void *arg)
-{
- struct ep_softc *sc;
-
- sc = (struct ep_softc *) arg;
- EP_LOCK(sc);
- ep_intr_locked(sc);
- EP_UNLOCK(sc);
-}
-
-static void
-ep_intr_locked(struct ep_softc *sc)
-{
- int status;
- struct ifnet *ifp;
-
- /* XXX 4.x splbio'd here to reduce interruptability */
-
- /*
- * quick fix: Try to detect an interrupt when the card goes away.
- */
- if (sc->gone || CSR_READ_2(sc, EP_STATUS) == 0xffff)
- return;
- ifp = sc->ifp;
-
- CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK); /* disable all Ints */
-
-rescan:
-
- while ((status = CSR_READ_2(sc, EP_STATUS)) & S_5_INTS) {
-
- /* first acknowledge all interrupt sources */
- CSR_WRITE_2(sc, EP_COMMAND, ACK_INTR | (status & S_MASK));
-
- if (status & (S_RX_COMPLETE | S_RX_EARLY))
- epread(sc);
- if (status & S_TX_AVAIL) {
- /* we need ACK */
- sc->tx_timer = 0;
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- GO_WINDOW(sc, 1);
- CSR_READ_2(sc, EP_W1_FREE_TX);
- epstart_locked(ifp);
- }
- if (status & S_CARD_FAILURE) {
- sc->tx_timer = 0;
-#ifdef EP_LOCAL_STATS
- device_printf(sc->dev, "\n\tStatus: %x\n", status);
- GO_WINDOW(sc, 4);
- printf("\tFIFO Diagnostic: %x\n",
- CSR_READ_2(sc, EP_W4_FIFO_DIAG));
- printf("\tStat: %x\n", sc->stat);
- printf("\tIpackets=%d, Opackets=%d\n",
- ifp->if_get_counter(ifp, IFCOUNTER_IPACKETS),
- ifp->if_get_counter(ifp, IFCOUNTER_OPACKETS));
- printf("\tNOF=%d, NOMB=%d, RXOF=%d, RXOL=%d, TXU=%d\n",
- sc->rx_no_first, sc->rx_no_mbuf, sc->rx_overrunf,
- sc->rx_overrunl, sc->tx_underrun);
-#else
-
-#ifdef DIAGNOSTIC
- device_printf(sc->dev,
- "Status: %x (input buffer overflow)\n", status);
-#else
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
-#endif
-
-#endif
- epinit_locked(sc);
- return;
- }
- if (status & S_TX_COMPLETE) {
- sc->tx_timer = 0;
- /*
- * We need ACK. We do it at the end.
- *
- * We need to read TX_STATUS until we get a
- * 0 status in order to turn off the interrupt flag.
- */
- while ((status = CSR_READ_1(sc, EP_W1_TX_STATUS)) &
- TXS_COMPLETE) {
- if (status & TXS_SUCCES_INTR_REQ)
- ; /* nothing */
- else if (status &
- (TXS_UNDERRUN | TXS_JABBER |
- TXS_MAX_COLLISION)) {
- CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
- if (status & TXS_UNDERRUN) {
-#ifdef EP_LOCAL_STATS
- sc->tx_underrun++;
-#endif
- }
- if (status & TXS_MAX_COLLISION) {
- /*
- * TXS_MAX_COLLISION we
- * shouldn't get here
- */
- if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
- }
- if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
- CSR_WRITE_2(sc, EP_COMMAND, TX_ENABLE);
- /*
- * To have a tx_avail_int but giving
- * the chance to the Reception
- */
- if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- CSR_WRITE_2(sc, EP_COMMAND,
- SET_TX_AVAIL_THRESH | 8);
- }
- /* pops up the next status */
- CSR_WRITE_1(sc, EP_W1_TX_STATUS, 0x0);
- } /* while */
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- GO_WINDOW(sc, 1);
- CSR_READ_2(sc, EP_W1_FREE_TX);
- epstart_locked(ifp);
- } /* end TX_COMPLETE */
- }
-
- CSR_WRITE_2(sc, EP_COMMAND, C_INTR_LATCH); /* ACK int Latch */
-
- if ((status = CSR_READ_2(sc, EP_STATUS)) & S_5_INTS)
- goto rescan;
-
- /* re-enable Ints */
- CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-}
-
-static void
-epread(struct ep_softc *sc)
-{
- struct mbuf *top, *mcur, *m;
- struct ifnet *ifp;
- int lenthisone;
- short rx_fifo2, status;
- short rx_fifo;
-
-/* XXX Must be called with sc locked */
-
- ifp = sc->ifp;
- status = CSR_READ_2(sc, EP_W1_RX_STATUS);
-
-read_again:
-
- if (status & ERR_RX) {
- if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
- if (status & ERR_RX_OVERRUN) {
- /*
- * We can think the rx latency is actually
- * greather than we expect
- */
-#ifdef EP_LOCAL_STATS
- if (EP_FTST(sc, F_RX_FIRST))
- sc->rx_overrunf++;
- else
- sc->rx_overrunl++;
-#endif
- }
- goto out;
- }
- rx_fifo = rx_fifo2 = status & RX_BYTES_MASK;
-
- if (EP_FTST(sc, F_RX_FIRST)) {
- MGETHDR(m, M_NOWAIT, MT_DATA);
- if (!m)
- goto out;
- if (rx_fifo >= MINCLSIZE)
- MCLGET(m, M_NOWAIT);
- sc->top = sc->mcur = top = m;
-#define EROUND ((sizeof(struct ether_header) + 3) & ~3)
-#define EOFF (EROUND - sizeof(struct ether_header))
- top->m_data += EOFF;
-
- /* Read what should be the header. */
- CSR_READ_MULTI_2(sc, EP_W1_RX_PIO_RD_1,
- mtod(top, uint16_t *), sizeof(struct ether_header) / 2);
- top->m_len = sizeof(struct ether_header);
- rx_fifo -= sizeof(struct ether_header);
- sc->cur_len = rx_fifo2;
- } else {
- /* come here if we didn't have a complete packet last time */
- top = sc->top;
- m = sc->mcur;
- sc->cur_len += rx_fifo2;
- }
-
- /* Reads what is left in the RX FIFO */
- while (rx_fifo > 0) {
- lenthisone = min(rx_fifo, M_TRAILINGSPACE(m));
- if (lenthisone == 0) { /* no room in this one */
- mcur = m;
- MGET(m, M_NOWAIT, MT_DATA);
- if (!m)
- goto out;
- if (rx_fifo >= MINCLSIZE)
- MCLGET(m, M_NOWAIT);
- m->m_len = 0;
- mcur->m_next = m;
- lenthisone = min(rx_fifo, M_TRAILINGSPACE(m));
- }
- CSR_READ_MULTI_2(sc, EP_W1_RX_PIO_RD_1,
- (uint16_t *)(mtod(m, caddr_t)+m->m_len),
- lenthisone / 2);
- m->m_len += lenthisone;
- if (lenthisone & 1)
- *(mtod(m, caddr_t)+m->m_len - 1) =
- CSR_READ_1(sc, EP_W1_RX_PIO_RD_1);
- rx_fifo -= lenthisone;
- }
-
- if (status & ERR_RX_INCOMPLETE) {
- /* we haven't received the complete packet */
- sc->mcur = m;
-#ifdef EP_LOCAL_STATS
- /* to know how often we come here */
- sc->rx_no_first++;
-#endif
- EP_FRST(sc, F_RX_FIRST);
- status = CSR_READ_2(sc, EP_W1_RX_STATUS);
- if (!(status & ERR_RX_INCOMPLETE)) {
- /*
- * We see if by now, the packet has completly
- * arrived
- */
- goto read_again;
- }
- CSR_WRITE_2(sc, EP_COMMAND,
- SET_RX_EARLY_THRESH | RX_NEXT_EARLY_THRESH);
- return;
- }
- CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
- if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
- EP_FSET(sc, F_RX_FIRST);
- top->m_pkthdr.rcvif = sc->ifp;
- top->m_pkthdr.len = sc->cur_len;
-
- /*
- * Drop locks before calling if_input() since it may re-enter
- * ep_start() in the netisr case. This would result in a
- * lock reversal. Better performance might be obtained by
- * chaining all packets received, dropping the lock, and then
- * calling if_input() on each one.
- */
- EP_UNLOCK(sc);
- (*ifp->if_input) (ifp, top);
- EP_LOCK(sc);
- sc->top = 0;
- EP_BUSY_WAIT(sc);
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH);
- return;
-
-out:
- CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
- if (sc->top) {
- m_freem(sc->top);
- sc->top = 0;
-#ifdef EP_LOCAL_STATS
- sc->rx_no_mbuf++;
-#endif
- }
- EP_FSET(sc, F_RX_FIRST);
- EP_BUSY_WAIT(sc);
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_EARLY_THRESH | RX_INIT_EARLY_THRESH);
-}
-
-static int
-ep_ifmedia_upd(struct ifnet *ifp)
-{
- struct ep_softc *sc = ifp->if_softc;
- int i = 0, j;
-
- GO_WINDOW(sc, 0);
- CSR_WRITE_2(sc, EP_COMMAND, STOP_TRANSCEIVER);
- GO_WINDOW(sc, 4);
- CSR_WRITE_2(sc, EP_W4_MEDIA_TYPE, DISABLE_UTP);
- GO_WINDOW(sc, 0);
-
- switch (IFM_SUBTYPE(sc->ifmedia.ifm_media)) {
- case IFM_10_T:
- if (sc->ep_connectors & UTP) {
- i = ACF_CONNECTOR_UTP;
- GO_WINDOW(sc, 4);
- CSR_WRITE_2(sc, EP_W4_MEDIA_TYPE, ENABLE_UTP);
- }
- break;
- case IFM_10_2:
- if (sc->ep_connectors & BNC) {
- i = ACF_CONNECTOR_BNC;
- CSR_WRITE_2(sc, EP_COMMAND, START_TRANSCEIVER);
- DELAY(DELAY_MULTIPLE * 1000);
- }
- break;
- case IFM_10_5:
- if (sc->ep_connectors & AUI)
- i = ACF_CONNECTOR_AUI;
- break;
- default:
- i = sc->ep_connector;
- device_printf(sc->dev,
- "strange connector type in EEPROM: assuming AUI\n");
- }
-
- GO_WINDOW(sc, 0);
- j = CSR_READ_2(sc, EP_W0_ADDRESS_CFG) & 0x3fff;
- CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, j | (i << ACF_CONNECTOR_BITS));
-
- return (0);
-}
-
-static void
-ep_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
-{
- struct ep_softc *sc = ifp->if_softc;
- uint16_t ms;
-
- switch (IFM_SUBTYPE(sc->ifmedia.ifm_media)) {
- case IFM_10_T:
- GO_WINDOW(sc, 4);
- ms = CSR_READ_2(sc, EP_W4_MEDIA_TYPE);
- GO_WINDOW(sc, 0);
- ifmr->ifm_status = IFM_AVALID;
- if (ms & MT_LB) {
- ifmr->ifm_status |= IFM_ACTIVE;
- ifmr->ifm_active = IFM_ETHER | IFM_10_T;
- } else {
- ifmr->ifm_active = IFM_ETHER | IFM_NONE;
- }
- break;
- default:
- ifmr->ifm_active = sc->ifmedia.ifm_media;
- break;
- }
-}
-
-static int
-epioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct ep_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- int error = 0;
-
- switch (cmd) {
- case SIOCSIFFLAGS:
- EP_LOCK(sc);
- if (((ifp->if_flags & IFF_UP) == 0) &&
- (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
- epstop(sc);
- } else
- /* reinitialize card on any parameter change */
- epinit_locked(sc);
- EP_UNLOCK(sc);
- break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- /*
- * The Etherlink III has no programmable multicast
- * filter. We always initialize the card to be
- * promiscuous to multicast, since we're always a
- * member of the ALL-SYSTEMS group, so there's no
- * need to process SIOC*MULTI requests.
- */
- error = 0;
- break;
- case SIOCSIFMEDIA:
- case SIOCGIFMEDIA:
- if (!sc->epb.mii_trans)
- error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, cmd);
- else
- error = EINVAL;
- break;
- default:
- error = ether_ioctl(ifp, cmd, data);
- break;
- }
- return (error);
-}
-
-static void
-eptick(void *arg)
-{
- struct ep_softc *sc;
-
- sc = arg;
- if (sc->tx_timer != 0 && --sc->tx_timer == 0)
- epwatchdog(sc);
- callout_reset(&sc->watchdog_timer, hz, eptick, sc);
-}
-
-static void
-epwatchdog(struct ep_softc *sc)
-{
- struct ifnet *ifp;
-
- ifp = sc->ifp;
- if (sc->gone)
- return;
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- epstart_locked(ifp);
- ep_intr_locked(sc);
-}
-
-static void
-epstop(struct ep_softc *sc)
-{
-
- EP_ASSERT_LOCKED(sc);
-
- CSR_WRITE_2(sc, EP_COMMAND, RX_DISABLE);
- CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
- EP_BUSY_WAIT(sc);
-
- CSR_WRITE_2(sc, EP_COMMAND, TX_DISABLE);
- CSR_WRITE_2(sc, EP_COMMAND, STOP_TRANSCEIVER);
- DELAY(800);
-
- CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
- EP_BUSY_WAIT(sc);
- CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
- EP_BUSY_WAIT(sc);
-
- CSR_WRITE_2(sc, EP_COMMAND, C_INTR_LATCH);
- CSR_WRITE_2(sc, EP_COMMAND, SET_RD_0_MASK);
- CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK);
- CSR_WRITE_2(sc, EP_COMMAND, SET_RX_FILTER);
-
- sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
- callout_stop(&sc->watchdog_timer);
-}
diff --git a/sys/dev/ep/if_ep_isa.c b/sys/dev/ep/if_ep_isa.c
deleted file mode 100644
index 32ed8e2db88d..000000000000
--- a/sys/dev/ep/if_ep_isa.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
- * All rights reserved.
- *
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Herb Peyerl.
- * 4. The name of Herb Peyerl may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-
-#include <isa/isavar.h>
-
-#include <dev/ep/if_epreg.h>
-#include <dev/ep/if_epvar.h>
-
-#ifdef __i386__
-#include <dev/ep/elink.h>
-#endif
-
-#ifdef __i386__
-static uint16_t get_eeprom_data(int, int);
-static void ep_isa_identify(driver_t *, device_t);
-#endif
-
-static int ep_isa_probe(device_t);
-static int ep_isa_attach(device_t);
-static int ep_eeprom_cksum(struct ep_softc *);
-
-struct isa_ident {
- uint32_t id;
- char *name;
-};
-const char *ep_isa_match_id(uint32_t, struct isa_ident *);
-
-#define ISA_ID_3C509_XXX 0x0506d509
-#define ISA_ID_3C509_TP 0x506d5090
-#define ISA_ID_3C509_BNC 0x506d5091
-#define ISA_ID_3C509_COMBO 0x506d5094
-#define ISA_ID_3C509_TPO 0x506d5095
-#define ISA_ID_3C509_TPC 0x506d5098
-
-#ifdef __i386__
-static struct isa_ident ep_isa_devs[] = {
- {ISA_ID_3C509_TP, "3Com 3C509-TP EtherLink III"},
- {ISA_ID_3C509_BNC, "3Com 3C509-BNC EtherLink III"},
- {ISA_ID_3C509_COMBO, "3Com 3C509-Combo EtherLink III"},
- {ISA_ID_3C509_TPO, "3Com 3C509-TPO EtherLink III"},
- {ISA_ID_3C509_TPC, "3Com 3C509-TPC EtherLink III"},
- {0, NULL},
-};
-#endif
-
-static struct isa_pnp_id ep_ids[] = {
- {0x90506d50, "3Com 3C509B-TP EtherLink III (PnP)"}, /* TCM5090 */
- {0x91506d50, "3Com 3C509B-BNC EtherLink III (PnP)"}, /* TCM5091 */
- {0x94506d50, "3Com 3C509B-Combo EtherLink III (PnP)"}, /* TCM5094 */
- {0x95506d50, "3Com 3C509B-TPO EtherLink III (PnP)"}, /* TCM5095 */
- {0x98506d50, "3Com 3C509B-TPC EtherLink III (PnP)"}, /* TCM5098 */
- {0xf780d041, NULL}, /* PNP80f7 */
- {0, NULL},
-};
-
-/*
- * We get eeprom data from the id_port given an offset into the eeprom.
- * Basically; after the ID_sequence is sent to all of the cards; they enter
- * the ID_CMD state where they will accept command requests. 0x80-0xbf loads
- * the eeprom data. We then read the port 16 times and with every read; the
- * cards check for contention (ie: if one card writes a 0 bit and another
- * writes a 1 bit then the host sees a 0. At the end of the cycle; each card
- * compares the data on the bus; if there is a difference then that card goes
- * into ID_WAIT state again). In the meantime; one bit of data is returned in
- * the AX register which is conveniently returned to us by inb(). Hence; we
- * read 16 times getting one bit of data with each read.
- */
-#ifdef __i386__
-static uint16_t
-get_eeprom_data(int id_port, int offset)
-{
- int i;
- uint16_t data = 0;
-
- outb(id_port, EEPROM_CMD_RD | offset);
- DELAY(BIT_DELAY_MULTIPLE * 1000);
- for (i = 0; i < 16; i++) {
- DELAY(50);
- data = (data << 1) | (inw(id_port) & 1);
- }
- return (data);
-}
-#endif
-
-const char *
-ep_isa_match_id(uint32_t id, struct isa_ident *isa_devs)
-{
- struct isa_ident *i = isa_devs;
-
- while (i->name != NULL) {
- if (id == i->id)
- return (i->name);
- i++;
- }
- /*
- * If we see a card that is likely to be a 3c509
- * return something so that it will work; be annoying
- * so that the user will tell us about it though.
- */
- if ((id >> 4) == ISA_ID_3C509_XXX)
- return ("Unknown 3c509; notify maintainer!");
- return (NULL);
-}
-
-#ifdef __i386__
-static void
-ep_isa_identify(driver_t * driver, device_t parent)
-{
- int tag = EP_LAST_TAG;
- int found = 0;
- int i;
- int j;
- const char *desc;
- uint16_t data;
- uint32_t irq;
- uint32_t ioport;
- uint32_t isa_id;
- device_t child;
-
- outb(ELINK_ID_PORT, 0);
- outb(ELINK_ID_PORT, 0);
- elink_idseq(ELINK_509_POLY);
- elink_reset();
-
- DELAY(DELAY_MULTIPLE * 10000);
-
- for (i = 0; i < EP_MAX_BOARDS; i++) {
-
- outb(ELINK_ID_PORT, 0);
- outb(ELINK_ID_PORT, 0);
- elink_idseq(ELINK_509_POLY);
- DELAY(400);
-
- /*
- * For the first probe, clear all board's tag registers.
- * Otherwise kill off already-found boards. -- linux 3c509.c
- */
- if (i == 0)
- outb(ELINK_ID_PORT, 0xd0);
- else
- outb(ELINK_ID_PORT, 0xd8);
-
- /* Get out of loop if we're out of cards. */
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
- if (data != MFG_ID)
- break;
- /* resolve contention using the Ethernet address */
- for (j = 0; j < 3; j++)
- (void)get_eeprom_data(ELINK_ID_PORT, j);
-
- /*
- * Construct an 'isa_id' in 'EISA' format.
- */
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
- isa_id = (htons(data) << 16);
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
- isa_id |= htons(data);
-
- /* Find known ISA boards */
- desc = ep_isa_match_id(isa_id, ep_isa_devs);
- if (!desc) {
- if (bootverbose)
- device_printf(parent,
- "unknown ID 0x%08x\n", isa_id);
- continue;
- }
- /* Retreive IRQ */
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
- irq = (data >> 12);
-
- /* Retreive IOPORT */
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
- ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200);
-
- if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
- device_printf(parent,
- "<%s> at port 0x%03x in EISA mode, ignoring!\n",
- desc, ioport);
- /*
- * Set the adaptor tag so that the next card can be
- * found.
- */
- outb(ELINK_ID_PORT, tag--);
- continue;
- }
- /* Test for an adapter with PnP support. */
- data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
- if (data == CAP_ISA) {
- data = get_eeprom_data(ELINK_ID_PORT,
- EEPROM_INT_CONFIG_1);
- if (data & ICW1_IAS_PNP) {
- if (bootverbose)
- device_printf(parent,
- "<%s> at 0x%03x "
- "in PnP mode!\n",
- desc, ioport);
- /*
- * Set the adaptor tag so that the next card
- * can be found.
- */
- outb(ELINK_ID_PORT, tag--);
- continue;
- }
- }
- /* Set the adaptor tag so that the next card can be found. */
- outb(ELINK_ID_PORT, tag--);
-
- /* Activate the adaptor at the EEPROM location. */
- outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
-
- /* Test for an adapter in TEST mode. */
- outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
- data = inw(ioport + EP_W0_EEPROM_COMMAND);
- if (data & EEPROM_TST_MODE) {
- device_printf(parent,
- "<%s> at port 0x%03x in TEST mode!"
- " Erase pencil mark.\n",
- desc, ioport);
- continue;
- }
- child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
- device_set_desc_copy(child, desc);
- device_set_driver(child, driver);
- bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
- bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
-
- if (bootverbose)
- device_printf(parent,
- "<%s>"
- " at port 0x%03x-0x%03x irq %d\n",
- desc, ioport, ioport + EP_IOSIZE, irq);
- found++;
- }
-}
-#endif
-
-static int
-ep_isa_probe(device_t dev)
-{
- int error = 0;
-
- /* Check isapnp ids */
- error = ISA_PNP_PROBE(device_get_parent(dev), dev, ep_ids);
-
- /* If the card had a PnP ID that didn't match any we know about */
- if (error == ENXIO)
- return (error);
-
- /* If we had some other problem. */
- if (!(error == 0 || error == ENOENT))
- return (error);
-
- /* If we have the resources we need then we're good to go. */
- if ((bus_get_resource_start(dev, SYS_RES_IOPORT, 0) != 0) &&
- (bus_get_resource_start(dev, SYS_RES_IRQ, 0) != 0))
- return (0);
-
- return (ENXIO);
-}
-
-static int
-ep_isa_attach(device_t dev)
-{
- struct ep_softc *sc = device_get_softc(dev);
- int error = 0;
-
- if ((error = ep_alloc(dev)))
- goto bad;
- ep_get_media(sc);
-
- GO_WINDOW(sc, 0);
- SET_IRQ(sc, rman_get_start(sc->irq));
-
- if ((error = ep_attach(sc)))
- goto bad;
- error = ep_eeprom_cksum(sc);
- if (error) {
- device_printf(sc->dev, "Invalid EEPROM checksum!\n");
- goto bad;
- }
- if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, ep_intr, sc, &sc->ep_intrhand))) {
- device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
- goto bad;
- }
- return (0);
-bad:
- ep_free(dev);
- return (error);
-}
-
-static int
-ep_eeprom_cksum(struct ep_softc *sc)
-{
- int i;
- int error;
- uint16_t val;
- uint16_t cksum;
- uint8_t cksum_high = 0;
- uint8_t cksum_low = 0;
-
- error = ep_get_e(sc, 0x0f, &val);
- if (error)
- return (ENXIO);
- cksum = val;
-
- for (i = 0; i < 0x0f; i++) {
- error = ep_get_e(sc, i, &val);
- if (error)
- return (ENXIO);
- switch (i) {
- case 0x08:
- case 0x09:
- case 0x0d:
- cksum_low ^= (uint8_t) (val & 0x00ff) ^
- (uint8_t)((val & 0xff00) >> 8);
- break;
- default:
- cksum_high ^= (uint8_t) (val & 0x00ff) ^
- (uint8_t)((val & 0xff00) >> 8);
- break;
- }
- }
- return (cksum != ((uint16_t)cksum_low | (uint16_t)(cksum_high << 8)));
-}
-
-static device_method_t ep_isa_methods[] = {
- /* Device interface */
-#ifdef __i386__
- DEVMETHOD(device_identify, ep_isa_identify),
-#endif
- DEVMETHOD(device_probe, ep_isa_probe),
- DEVMETHOD(device_attach, ep_isa_attach),
- DEVMETHOD(device_detach, ep_detach),
-
- DEVMETHOD_END
-};
-
-static driver_t ep_isa_driver = {
- "ep",
- ep_isa_methods,
- sizeof(struct ep_softc),
-};
-
-extern devclass_t ep_devclass;
-
-DRIVER_MODULE(ep, isa, ep_isa_driver, ep_devclass, 0, 0);
-#ifdef __i386__
-MODULE_DEPEND(ep, elink, 1, 1, 1);
-#endif
-ISA_PNP_INFO(ep_ids);
diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c
deleted file mode 100644
index 4a202b2557df..000000000000
--- a/sys/dev/ep/if_ep_pccard.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
- * All rights reserved.
- *
- * 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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Herb Peyerl.
- * 4. The name of Herb Peyerl may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * Pccard support for 3C589 by:
- * HAMADA Naoki
- * nao@tom-yam.or.jp
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/resource.h>
-
-#include <net/ethernet.h>
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-
-#include <dev/ep/if_epreg.h>
-#include <dev/ep/if_epvar.h>
-
-#include <dev/pccard/pccardvar.h>
-#include <dev/pccard/pccard_cis.h>
-
-#include "pccarddevs.h"
-
-struct ep_pccard_product
-{
- struct pccard_product prod;
- int chipset;
-};
-
-#define EP_CHIP_589 1 /* Classic 3c5x9 chipset */
-#define EP_CHIP_574 2 /* Roadrunner */
-#define EP_CHIP_C1 3 /* 3c1 */
-
-static const struct ep_pccard_product ep_pccard_products[] = {
- { PCMCIA_CARD(3COM, 3C1), EP_CHIP_C1 },
- { PCMCIA_CARD(3COM, 3C562), EP_CHIP_589 },
- { PCMCIA_CARD(3COM, 3C589), EP_CHIP_589 },
- { PCMCIA_CARD(3COM, 3CXEM556), EP_CHIP_589 },
- { PCMCIA_CARD(3COM, 3CXEM556INT), EP_CHIP_589 },
- { PCMCIA_CARD(3COM, 3C574), EP_CHIP_574 },
- { PCMCIA_CARD(3COM, 3CCFEM556BI), EP_CHIP_574 },
- { { NULL } }
-};
-
-static const struct ep_pccard_product *
-ep_pccard_lookup(device_t dev)
-{
- return ((const struct ep_pccard_product *)pccard_product_lookup(dev,
- (const struct pccard_product *)ep_pccard_products,
- sizeof(ep_pccard_products[0]), NULL));
-}
-
-static int
-ep_pccard_probe(device_t dev)
-{
- const struct ep_pccard_product *pp;
- int error;
- uint32_t fcn = PCCARD_FUNCTION_UNSPEC;
-
- /* Make sure we're a network function */
- error = pccard_get_function(dev, &fcn);
- if (error != 0)
- return (error);
- if (fcn != PCCARD_FUNCTION_NETWORK)
- return (ENXIO);
-
- /* Check to see if we know about this card */
- if ((pp = ep_pccard_lookup(dev)) == NULL)
- return EIO;
- if (pp->prod.pp_name != NULL)
- device_set_desc(dev, pp->prod.pp_name);
-
- return 0;
-}
-
-static int
-ep_pccard_mac(const struct pccard_tuple *tuple, void *argp)
-{
- uint8_t *enaddr = argp;
- int i;
-
- /* Code 0x88 is 3com's special cis node contianing the MAC */
- if (tuple->code != 0x88)
- return (0);
-
- /* Make sure this is a sane node */
- if (tuple->length < ETHER_ADDR_LEN)
- return (0);
-
- /* Copy the MAC ADDR and return success */
- for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
- enaddr[i] = pccard_tuple_read_1(tuple, i + 1);
- enaddr[i + 1] = pccard_tuple_read_1(tuple, i);
- }
- return (1);
-}
-
-static int
-ep_pccard_attach(device_t dev)
-{
- struct ep_softc *sc = device_get_softc(dev);
- uint16_t result;
- int error = 0;
- const struct ep_pccard_product *pp;
-
- if ((pp = ep_pccard_lookup(dev)) == NULL)
- panic("ep_pccard_attach: can't find product in attach.");
-
- if (pp->chipset == EP_CHIP_574) {
- sc->epb.mii_trans = 1;
- sc->epb.cmd_off = 2;
- } else {
- sc->epb.mii_trans = 0;
- sc->epb.cmd_off = 0;
- }
- if ((error = ep_alloc(dev))) {
- device_printf(dev, "ep_alloc() failed! (%d)\n", error);
- goto bad;
- }
-
- if (pp->chipset == EP_CHIP_C1)
- sc->stat |= F_HAS_TX_PLL;
-
- /* ROM size = 0, ROM base = 0 */
- /* For now, ignore AUTO SELECT feature of 3C589B and later. */
- error = ep_get_e(sc, EEPROM_ADDR_CFG, &result);
- CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000);
-
- /*
- * Fake IRQ must be 3 for 3C589 and 3C589B. 3C589D and newer
- * ignore this value. 3C589C is unknown, as are the other
- * cards supported by this driver, but it appears to never hurt
- * and always helps.
- */
- SET_IRQ(sc, 3);
- CSR_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id);
-
- if (sc->epb.mii_trans) {
- /*
- * turn on the MII transciever
- */
- GO_WINDOW(sc, 3);
- CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
- DELAY(1000);
- CSR_WRITE_2(sc, EP_W3_OPTIONS, 0xc040);
- CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
- CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
- EP_BUSY_WAIT(sc);
- DELAY(1000);
- CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
- } else
- ep_get_media(sc);
-
- /*
- * The 3C562 (a-c revisions) stores the MAC in the CIS in a
- * way that's unique to 3com. If we have one of these cards,
- * scan the CIS for that MAC address, and use it if we find
- * it. The NetBSD driver says that the ROADRUNNER chips also
- * do this, which may be true, but none of the cards that I
- * have include this TUPLE. Always prefer the MAC addr in the
- * CIS tuple to the one returned by the card, as it appears that
- * only those cards that need it have this special tuple.
- */
- if (pccard_cis_scan(dev, ep_pccard_mac, sc->eaddr))
- sc->stat |= F_ENADDR_SKIP;
- if ((error = ep_attach(sc))) {
- device_printf(dev, "ep_attach() failed! (%d)\n", error);
- goto bad;
- }
- if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, ep_intr, sc, &sc->ep_intrhand))) {
- device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
- goto bad;
- }
- return (0);
-bad:
- ep_free(dev);
- return (error);
-}
-
-static device_method_t ep_pccard_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, ep_pccard_probe),
- DEVMETHOD(device_attach, ep_pccard_attach),
- DEVMETHOD(device_detach, ep_detach),
-
- DEVMETHOD_END
-};
-
-static driver_t ep_pccard_driver = {
- "ep",
- ep_pccard_methods,
- sizeof(struct ep_softc),
-};
-
-extern devclass_t ep_devclass;
-
-DRIVER_MODULE(ep, pccard, ep_pccard_driver, ep_devclass, 0, 0);
-PCCARD_PNP_INFO(ep_pccard_products);
diff --git a/sys/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h
deleted file mode 100644
index 15f937579f0d..000000000000
--- a/sys/dev/ep/if_epreg.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/*-
- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
- *
- * 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. The name
- * of the author may not be used to endorse or promote products derived from
- * this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-/*
- * DELAY_MULTIPLE: How much to boost "base" delays, except
- * for the inter-bit delays in get_eeprom_data. A cyrix Media GX needed this.
- */
-#define DELAY_MULTIPLE 10
-#define BIT_DELAY_MULTIPLE 10
-
-/*
- * Some global constants
- */
-#define TX_INIT_RATE 16
-#define TX_INIT_MAX_RATE 64
-#define RX_INIT_LATENCY 64
-#define RX_INIT_EARLY_THRESH 208/* not less than MINCLSIZE */
-#define RX_NEXT_EARLY_THRESH 500
-
-#define EEPROMSIZE 0x40
-#define MAX_EEPROMBUSY 1000
-#define EP_LAST_TAG 0xd7
-#define EP_MAX_BOARDS 16
-#define EP_IOSIZE 16 /* 16 bytes of I/O space used. */
-
-/*
- * Commands to read/write EEPROM trough EEPROM command register (Window 0,
- * Offset 0xa)
- */
-#define EEPROM_CMD_RD 0x0080 /* Read: Address required (5 bits) */
-#define EEPROM_CMD_WR 0x0040 /* Write: Address required (5 bits) */
-#define EEPROM_CMD_ERASE 0x00c0 /* Erase: Address required (5 bits) */
-#define EEPROM_CMD_EWEN 0x0030 /* Erase/Write Enable: No data required */
-
-#define EEPROM_BUSY (1<<15)
-#define EEPROM_TST_MODE (1<<14)
-
-/*
- * Some short functions, worth to let them be a macro
- */
-#define is_eeprom_busy(sc) (CSR_READ_2(sc, EP_W0_EEPROM_COMMAND)&EEPROM_BUSY)
-#define GO_WINDOW(sc, x) CSR_WRITE_2(sc, EP_COMMAND, WINDOW_SELECT|(x))
-
-/**************************************************************************
- * *
- * These define the EEPROM data structure. They are used in the probe
- * function to verify the existence of the adapter after having sent
- * the ID_Sequence.
- *
- **************************************************************************/
-
-#define EEPROM_NODE_ADDR_0 0x0 /* Word */
-#define EEPROM_NODE_ADDR_1 0x1 /* Word */
-#define EEPROM_NODE_ADDR_2 0x2 /* Word */
-#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
-#define EEPROM_MFG_DATE 0x4 /* Manufacturing date */
-#define EEPROM_MFG_DIVSION 0x5 /* Manufacturing division */
-#define EEPROM_MFG_PRODUCT 0x6 /* Product code */
-#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
-#define EEPROM_ADDR_CFG 0x8 /* Base addr */
-#define ADDR_CFG_EISA 0x1f
-#define ADDR_CFG_MASK 0x1f
-#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
-#define EEPROM_OEM_ADDR0 0xa
-#define EEPROM_OEM_ADDR1 0xb
-#define EEPROM_OEM_ADDR2 0xc
-#define EEPROM_SOFTINFO 0xd
-#define EEPROM_COMPAT 0xe
-#define EEPROM_SOFTINFO2 0xf
-#define EEPROM_CAP 0x10
-#define CAP_ISA 0x2083
-#define CAP_PCMCIA 0x2082
-#define EEPROM_INT_CONFIG_0 0x12
-#define EEPROM_INT_CONFIG_1 0x13
-/* RAM Partition TX FIFO/RX FIFO */
-#define ICW1_RAM_PART_MASK 0x03
-#define ICW1_RAM_PART_35 0x00 /* 2:5 (only legal if RAM size == 000b
- * default power-up/reset */
-#define ICW1_RAM_PART_13 0x01 /* 1:3 (only legal if RAM size ==
- * 000b) */
-#define ICW1_RAM_PART_11 0x10 /* 1:1 */
-#define ICW1_RAM_PART_RESV 0x11 /* Reserved */
-/* ISA Adapter Selection */
-#define ICW1_IAS_MASK 0x0c
-#define ICW1_IAS_DIS 0x00 /* Both mechanisms disabled (default) */
-#define ICW1_IAS_ISA 0x04 /* ISA contention only */
-#define ICW1_IAS_PNP 0x08 /* ISA Plug and Play only */
-#define ICW1_IAS_BOTH 0x0c /* Both mechanisms enabled */
-
-#define EEPROM_CHECKSUM_EL3 0x17
-
-/**************************************************************************
- * *
- * These are the registers for the 3Com 3c509 and their bit patterns when *
- * applicable. They have been taken out the "EtherLink III Parallel *
- * Tasking EISA and ISA Technical Reference" "Beta Draft 10/30/92" manual *
- * from 3com. *
- * *
- **************************************************************************/
-
-#define EP_COMMAND 0x0e /* Write. BASE+0x0e is always a
- * command reg. */
-#define EP_STATUS 0x0e /* Read. BASE+0x0e is always status
- * reg. */
-#define EP_WINDOW 0x0f /* Read. BASE+0x0f is always window
- * reg. */
-/*
- * Window 0 registers. Setup.
- */
-/* Write */
-#define EP_W0_EEPROM_DATA 0x0c
-#define EP_W0_EEPROM_COMMAND 0x0a
-#define EP_W0_RESOURCE_CFG 0x08
-#define EP_W0_ADDRESS_CFG 0x06
-#define EP_W0_CONFIG_CTRL 0x04
- /* Read */
-#define EP_W0_PRODUCT_ID 0x02
-#define EP_W0_MFG_ID 0x00
-
-/*
- * Window 1 registers. Operating Set.
- */
-/* Write */
-#define EP_W1_TX_PIO_WR_2 0x02
-#define EP_W1_TX_PIO_WR_1 0x00
-/* Read */
-#define EP_W1_FREE_TX 0x0c
-#define EP_W1_TX_STATUS 0x0b /* byte */
-#define EP_W1_TIMER 0x0a /* byte */
-#define EP_W1_RX_STATUS 0x08
-#define EP_W1_RX_PIO_RD_2 0x02
-#define EP_W1_RX_PIO_RD_1 0x00
-
-/*
- * Window 2 registers. Station Address Setup/Read
- */
-/* Read/Write */
-#define EP_W2_PHY_MGMT 0x0c
-#define EP_W2_ALT_EEPROM 0x0a
-#define EP_W2_ADDR_5 0x05
-#define EP_W2_ADDR_4 0x04
-#define EP_W2_ADDR_3 0x03
-#define EP_W2_ADDR_2 0x02
-#define EP_W2_ADDR_1 0x01
-#define EP_W2_ADDR_0 0x00
-
-/*
- * Window 3 registers. FIFO Management.
- */
-/* Read */
-#define EP_W3_FREE_TX 0x0c
-#define EP_W3_FREE_RX 0x0a
-#define EP_W3_OPTIONS 0x08
-
-/*
- * Window 4 registers. Diagnostics.
- */
-/* Read/Write */
-#define EP_W4_MEDIA_TYPE 0x0a
-#define EP_W4_CTRLR_STATUS 0x08
-#define EP_W4_NET_DIAG 0x06
-#define EP_W4_FIFO_DIAG 0x04
-#define EP_W4_HOST_DIAG 0x02
-#define EP_W4_TX_DIAG 0x00
-
-/*
- * Window 5 Registers. Results and Internal status.
- */
-/* Read */
-#define EP_W5_READ_0_MASK 0x0c
-#define EP_W5_INTR_MASK 0x0a
-#define EP_W5_RX_FILTER 0x08
-#define EP_W5_RX_EARLY_THRESH 0x06
-#define EP_W5_TX_AVAIL_THRESH 0x02
-#define EP_W5_TX_START_THRESH 0x00
-
-/*
- * Window 6 registers. Statistics.
- */
-/* Read/Write */
-#define TX_TOTAL_OK 0x0c
-#define RX_TOTAL_OK 0x0a
-#define TX_DEFERRALS 0x08
-#define RX_FRAMES_OK 0x07
-#define TX_FRAMES_OK 0x06
-#define RX_OVERRUNS 0x05
-#define TX_COLLISIONS 0x04
-#define TX_AFTER_1_COLLISION 0x03
-#define TX_AFTER_X_COLLISIONS 0x02
-#define TX_NO_SQE 0x01
-#define TX_CD_LOST 0x00
-
-/****************************************
- *
- * Register definitions.
- *
- ****************************************/
-
-/*
- * Command parameter that disables threshold interrupts
- * PIO (3c509) cards use 2044. The fifo word-oriented and 2044--2047 work.
- * "busmastering" cards need 8188.
- * The implicit two-bit upshift done by busmastering cards means
- * a value of 2047 disables threshold interrupts on both.
- */
-#define EP_THRESH_DISABLE 2047
-
-/*
- * Command register. All windows.
- *
- * 16 bit register.
- * 15-11: 5-bit code for command to be executed.
- * 10-0: 11-bit arg if any. For commands with no args;
- * this can be set to anything.
- */
-#define GLOBAL_RESET (u_short) 0x0000 /* Wait at least 1ms
- * after issuing */
-#define WINDOW_SELECT (u_short) (0x1<<11)
-#define START_TRANSCEIVER (u_short) (0x2<<11) /* Read ADDR_CFG reg to
- * determine whether
- * this is needed. If
- * so; wait 800 uSec
- * before using trans-
- * ceiver. */
-#define RX_DISABLE (u_short) (0x3<<11) /* state disabled on
- * power-up */
-#define RX_ENABLE (u_short) (0x4<<11)
-#define RX_RESET (u_short) (0x5<<11)
-#define RX_DISCARD_TOP_PACK (u_short) (0x8<<11)
-#define TX_ENABLE (u_short) (0x9<<11)
-#define TX_DISABLE (u_short) (0xa<<11)
-#define TX_RESET (u_short) (0xb<<11)
-#define REQ_INTR (u_short) (0xc<<11)
-/*
- * The following C_* acknowledge the various interrupts. Some of them don't
- * do anything. See the manual.
- */
-#define ACK_INTR (u_short) (0x6800)
-# define C_INTR_LATCH (u_short) (ACK_INTR|0x1)
-# define C_CARD_FAILURE (u_short) (ACK_INTR|0x2)
-# define C_TX_COMPLETE (u_short) (ACK_INTR|0x4)
-# define C_TX_AVAIL (u_short) (ACK_INTR|0x8)
-# define C_RX_COMPLETE (u_short) (ACK_INTR|0x10)
-# define C_RX_EARLY (u_short) (ACK_INTR|0x20)
-# define C_INT_RQD (u_short) (ACK_INTR|0x40)
-# define C_UPD_STATS (u_short) (ACK_INTR|0x80)
-#define SET_INTR_MASK (u_short) (0xe<<11)
-#define SET_RD_0_MASK (u_short) (0xf<<11)
-#define SET_RX_FILTER (u_short) (0x10<<11)
-# define FIL_INDIVIDUAL (u_short) (0x1)
-# define FIL_MULTICAST (u_short) (0x02)
-# define FIL_BRDCST (u_short) (0x04)
-# define FIL_PROMISC (u_short) (0x08)
-#define SET_RX_EARLY_THRESH (u_short) (0x11<<11)
-#define SET_TX_AVAIL_THRESH (u_short) (0x12<<11)
-#define SET_TX_START_THRESH (u_short) (0x13<<11)
-#define STATS_ENABLE (u_short) (0x15<<11)
-#define STATS_DISABLE (u_short) (0x16<<11)
-#define STOP_TRANSCEIVER (u_short) (0x17<<11)
-#define TX_PLL_ENABLE (u_short) (0x18<<11)
-#define TX_PLL_DISABLE (u_short) (0x19<<11)
-#define POWER_UP (u_short) (0x1b<<11)
-#define POWER_DOWN (u_short) (0x1b<<11)
-#define POWER_AUTO (u_short) (0x1b<<11)
-
-/*
- * Status register. All windows.
- *
- * 15-13: Window number(0-7).
- * 12: Command_in_progress.
- * 11: reserved.
- * 10: reserved.
- * 9: reserved.
- * 8: reserved.
- * 7: Update Statistics.
- * 6: Interrupt Requested.
- * 5: RX Early.
- * 4: RX Complete.
- * 3: TX Available.
- * 2: TX Complete.
- * 1: Adapter Failure.
- * 0: Interrupt Latch.
- */
-#define S_INTR_LATCH (u_short) (0x1)
-#define S_CARD_FAILURE (u_short) (0x2)
-#define S_TX_COMPLETE (u_short) (0x4)
-#define S_TX_AVAIL (u_short) (0x8)
-#define S_RX_COMPLETE (u_short) (0x10)
-#define S_RX_EARLY (u_short) (0x20)
-#define S_INT_RQD (u_short) (0x40)
-#define S_UPD_STATS (u_short) (0x80)
-#define S_MASK (u_short) 0xFF /* mask of S_* */
-#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\
- S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
-#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
-
-#define EP_BUSY_WAIT(sc) while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS)
-
-/* Address Config. Register.
- * Window 0/Port 06
- */
-
-#define ACF_CONNECTOR_BITS 14
-#define ACF_CONNECTOR_UTP 0
-#define ACF_CONNECTOR_AUI 1
-#define ACF_CONNECTOR_BNC 3
-
-/* Resource configuration register.
- * Window 0/Port 08
- *
- */
-
-#define SET_IRQ(sc, irq) CSR_WRITE_2((sc), EP_W0_RESOURCE_CFG, \
- ((CSR_READ_2((sc), EP_W0_RESOURCE_CFG) & 0x0fff) | \
- ((u_short)(irq)<<12)) ) /* set IRQ i */
-
-/*
- * FIFO Registers.
- * RX Status. Window 1/Port 08
- *
- * 15: Incomplete or FIFO empty.
- * 14: 1: Error in RX Packet 0: Incomplete or no error.
- * 13-11: Type of error.
- * 1000 = Overrun.
- * 1011 = Run Packet Error.
- * 1100 = Alignment Error.
- * 1101 = CRC Error.
- * 1001 = Oversize Packet Error (>1514 bytes)
- * 0010 = Dribble Bits.
- * (all other error codes, no errors.)
- *
- * 10-0: RX Bytes (0-1514)
- */
-#define ERR_RX_INCOMPLETE (u_short) (0x1<<15)
-#define ERR_RX (u_short) (0x1<<14)
-#define ERR_RX_OVERRUN (u_short) (0x8<<11)
-#define ERR_RX_RUN_PKT (u_short) (0xb<<11)
-#define ERR_RX_ALIGN (u_short) (0xc<<11)
-#define ERR_RX_CRC (u_short) (0xd<<11)
-#define ERR_RX_OVERSIZE (u_short) (0x9<<11)
-#define ERR_RX_DRIBBLE (u_short) (0x2<<11)
-
-/*
- * FIFO Registers.
- * TX Status. Window 1/Port 0B
- *
- * Reports the transmit status of a completed transmission. Writing this
- * register pops the transmit completion stack.
- *
- * Window 1/Port 0x0b.
- *
- * 7: Complete
- * 6: Interrupt on successful transmission requested.
- * 5: Jabber Error (TP Only, TX Reset required. )
- * 4: Underrun (TX Reset required. )
- * 3: Maximum Collisions.
- * 2: TX Status Overflow.
- * 1-0: Undefined.
- *
- */
-#define TXS_COMPLETE 0x80
-#define TXS_SUCCES_INTR_REQ 0x40
-#define TXS_JABBER 0x20
-#define TXS_UNDERRUN 0x10
-#define TXS_MAX_COLLISION 0x8
-#define TXS_STATUS_OVERFLOW 0x4
-
-/*
- * Configuration control register.
- * Window 0/Port 04
- */
-/* Read */
-#define IS_AUI (1<<13)
-#define IS_BNC (1<<12)
-#define IS_UTP (1<<9)
-/* Write */
-#define ENABLE_DRQ_IRQ 0x0001
-#define W0_P4_CMD_RESET_ADAPTER 0x4
-#define W0_P4_CMD_ENABLE_ADAPTER 0x1
-
-/*
- * Media type and status.
- * Window 4/Port 0A
- */
-#define JABBER_GUARD_ENABLE 0x40
-#define LINKBEAT_ENABLE 0x80
-#define ENABLE_UTP (JABBER_GUARD_ENABLE | LINKBEAT_ENABLE)
-#define DISABLE_UTP 0x0
-#define MT_CSD 0x0004 /* CRC Strip disable */
-#define MT_SQE 0x0008 /* SQE Enable */
-#define MT_C0 0x0010 /* Collison */
-#define MT_CS 0x0020 /* Carrier Sense */
-#define MT_J 0x0200 /* Jabber detected */
-#define MT_PL 0x0400 /* Plarity Inverted */
-#define MT_LB 0x0800 /* Link Beat detected */
-#define MT_SQ 0x1000 /* SQE Present */
-#define MT_IN 0x2000 /* Reserved */
-#define MT_CE 0x4000 /* Coax */
-#define MT_TPE 0x8000
-
-/*
- * Misc defines for various things.
- */
-#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
-#define MFG_ID 0x6d50 /* in EEPROM and W0
- * ADDR_CONFIG */
-#define PROD_ID 0x9150
-
-#define AUI 0x1
-#define BNC 0x2
-#define UTP 0x4
-
-#define RX_BYTES_MASK (u_short) (0x07ff)
diff --git a/sys/dev/ep/if_epvar.h b/sys/dev/ep/if_epvar.h
deleted file mode 100644
index a7ad8ea45364..000000000000
--- a/sys/dev/ep/if_epvar.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved.
- *
- * 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. The name
- * of the author may not be used to endorse or promote products derived from
- * this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-struct ep_board {
- u_short prod_id; /* product ID */
- int cmd_off; /* command offset (bit shift) */
- int mii_trans; /* activate MII transiever */
- u_short res_cfg; /* resource configuration */
-};
-
-/*
- * Ethernet software status per interface.
- */
-struct ep_softc {
- struct ifnet *ifp;
- struct ifmedia ifmedia; /* media info */
- device_t dev;
-
- struct mtx sc_mtx;
- struct resource *iobase;
- struct resource *irq;
-
- bus_space_handle_t bsh;
- bus_space_tag_t bst;
- void *ep_intrhand;
-
- struct callout watchdog_timer;
- int tx_timer;
-
- u_short ep_connectors; /* Connectors on this card. */
- u_char ep_connector; /* Configured connector. */
-
- struct mbuf *top;
- struct mbuf *mcur;
- short cur_len;
-
- int stat; /* some flags */
-#define F_RX_FIRST 0x001
-#define F_ENADDR_SKIP 0x002
-#define F_PROMISC 0x008
-#define F_HAS_TX_PLL 0x200
-
- int gone; /* adapter is not present (for PCCARD) */
- struct ep_board epb;
- uint8_t eaddr[6];
-
-#ifdef EP_LOCAL_STATS
- short tx_underrun;
- short rx_no_first;
- short rx_no_mbuf;
- short rx_overrunf;
- short rx_overrunl;
-#endif
-};
-
-int ep_alloc(device_t);
-void ep_free(device_t);
-int ep_detach(device_t);
-void ep_get_media(struct ep_softc *);
-int ep_attach(struct ep_softc *);
-void ep_intr(void *);
-int ep_get_e(struct ep_softc *, uint16_t, uint16_t *);
-
-#define CSR_READ_1(sc, off) (bus_space_read_1((sc)->bst, (sc)->bsh, off))
-#define CSR_READ_2(sc, off) (bus_space_read_2((sc)->bst, (sc)->bsh, off))
-#define CSR_WRITE_1(sc, off, val) \
- bus_space_write_1(sc->bst, sc->bsh, off, val)
-#define CSR_WRITE_2(sc, off, val) \
- bus_space_write_2(sc->bst, sc->bsh, off, val)
-#define CSR_WRITE_MULTI_1(sc, off, addr, count) \
- bus_space_write_multi_1(sc->bst, sc->bsh, off, addr, count)
-#define CSR_WRITE_MULTI_2(sc, off, addr, count) \
- bus_space_write_multi_2(sc->bst, sc->bsh, off, addr, count)
-#define CSR_WRITE_MULTI_4(sc, off, addr, count) \
- bus_space_write_multi_4(sc->bst, sc->bsh, off, addr, count)
-#define CSR_READ_MULTI_1(sc, off, addr, count) \
- bus_space_read_multi_1(sc->bst, sc->bsh, off, addr, count)
-#define CSR_READ_MULTI_2(sc, off, addr, count) \
- bus_space_read_multi_2(sc->bst, sc->bsh, off, addr, count)
-#define CSR_READ_MULTI_4(sc, off, addr, count) \
- bus_space_read_multi_4(sc->bst, sc->bsh, off, addr, count)
-
-#define EP_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
-#define EP_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
-#define EP_LOCK_INIT(_sc) \
- mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \
- MTX_NETWORK_LOCK, MTX_DEF)
-#define EP_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
-#define EP_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED);
-#define EP_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED);
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index ad45768f8a5f..7754886a925b 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -272,7 +272,6 @@ device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'')
# ISA Ethernet NICs. pccard NICs included.
device ex # Intel EtherExpress Pro/10 and Pro/10+
-device ep # Etherlink III based cards
device fe # Fujitsu MB8696x based cards
device sn # SMC's 9000 series of Ethernet chips
device xe # Xircom pccard Ethernet
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 9bbff393c4e6..181725145f37 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -110,7 +110,6 @@ SUBDIR= \
${_efirt} \
${_em} \
${_ena} \
- ${_ep} \
${_epic} \
esp \
${_et} \
@@ -599,7 +598,6 @@ _cpuctl= cpuctl
_cpufreq= cpufreq
_dpms= dpms
_em= em
-_ep= ep
_et= et
_exca= exca
_fe= fe
diff --git a/sys/modules/ep/Makefile b/sys/modules/ep/Makefile
deleted file mode 100644
index 78d0173c21aa..000000000000
--- a/sys/modules/ep/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $FreeBSD$
-
-SYSDIR?=${SRCTOP}/sys
-.include "${SYSDIR}/conf/kern.opts.mk"
-
-.PATH: ${SYSDIR}/dev/ep
-
-KMOD= if_ep
-SRCS= if_ep.c
-.if ${MACHINE_CPUARCH} == "i386"
-SRCS+= elink.c
-.endif
-SRCS+= if_ep_pccard.c pccarddevs.h card_if.h
-SRCS+= if_ep_isa.c isa_if.h
-SRCS+= bus_if.h device_if.h
-
-.include <bsd.kmod.mk>