diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2019-05-17 15:23:02 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2019-05-17 15:23:02 +0000 |
commit | 05aa6e583be3cf53a55270e03b185833c4379020 (patch) | |
tree | ebb540f16e97a5a69f9648ac172524b688f179fa | |
parent | 08ac01a92c88d944d5d3e76e36806ee96f773371 (diff) |
FCP-101: Remove ed(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=347911
-rw-r--r-- | ObsoleteFiles.inc | 2 | ||||
-rw-r--r-- | share/man/man4/Makefile | 2 | ||||
-rw-r--r-- | share/man/man4/ed.4 | 407 | ||||
-rw-r--r-- | sys/amd64/conf/NOTES | 4 | ||||
-rw-r--r-- | sys/conf/files | 5 | ||||
-rw-r--r-- | sys/dev/ed/ax88x90reg.h | 40 | ||||
-rw-r--r-- | sys/dev/ed/dl100xxreg.h | 45 | ||||
-rw-r--r-- | sys/dev/ed/if_ed.c | 1860 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_3c503.c | 374 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_hpp.c | 679 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_isa.c | 206 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_novell.c | 316 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_pccard.c | 1253 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_pci.c | 149 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_rtl80x9.c | 227 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_sic.c | 159 | ||||
-rw-r--r-- | sys/dev/ed/if_ed_wd80x3.c | 453 | ||||
-rw-r--r-- | sys/dev/ed/if_edreg.h | 1081 | ||||
-rw-r--r-- | sys/dev/ed/if_edvar.h | 304 | ||||
-rw-r--r-- | sys/dev/ed/rtl80x9reg.h | 60 | ||||
-rw-r--r-- | sys/dev/ed/tc5299jreg.h | 40 | ||||
-rw-r--r-- | sys/i386/conf/GENERIC | 2 | ||||
-rw-r--r-- | sys/i386/conf/NOTES | 4 | ||||
-rw-r--r-- | sys/modules/Makefile | 2 | ||||
-rw-r--r-- | sys/modules/ed/Makefile | 17 |
25 files changed, 2 insertions, 7689 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 72f14e0f4fa1..5a0bf6f82fcb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -43,6 +43,8 @@ OLD_FILES+=usr/share/man/man4/bm.4 OLD_FILES+=usr/share/man/man4/cs.4 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 # 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/Makefile b/share/man/man4/Makefile index a9bcd34f205b..d09526d60a82 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -136,7 +136,6 @@ MAN= aac.4 \ ds3231.4 \ ${_dtrace_provs} \ dummynet.4 \ - ed.4 \ edsc.4 \ ehci.4 \ em.4 \ @@ -627,7 +626,6 @@ MLINKS+=cxgbev.4 if_cxgbev.4 \ cxgbev.4 if_ccv.4 MLINKS+=dc.4 if_dc.4 MLINKS+=disc.4 if_disc.4 -MLINKS+=ed.4 if_ed.4 MLINKS+=edsc.4 if_edsc.4 MLINKS+=em.4 if_em.4 MLINKS+=enc.4 if_enc.4 diff --git a/share/man/man4/ed.4 b/share/man/man4/ed.4 deleted file mode 100644 index 30646be9b538..000000000000 --- a/share/man/man4/ed.4 +++ /dev/null @@ -1,407 +0,0 @@ -.\" -.\" Copyright (c) 1994, David Greenman -.\" 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 David Greenman. -.\" 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 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 AUTHOR 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. -.\" -.\" $FreeBSD$ -.\" -.Dd October 24, 2018 -.Dt ED 4 -.Os -.Sh NAME -.Nm ed -.Nd "NE-2000 and WD-80x3 Ethernet driver" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device miibus" -.Cd "device ed" -.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_ed_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 -driver provides support for 8 and 16bit Ethernet cards that are based on -the National Semiconductor DS8390 and similar NICs manufactured by -other companies. -The -.Nm -driver also supports many PC Card chips which interface via MII to a PHY. -Axiom's AX88790, AX88190 and AX88190A; -DLink's DL10019 and DL10022; and -Tamarack's TC5299J chips all support internal or external MII/PHY combinations. -Realtek's PCI and ISA RTL80x9-based cards are also supported. -For these chipsets, autonegotiation and status reporting are supported. -.Pp -In addition to the standard port and IRQ specifications, the -.Nm -driver also supports a number of -.Cd flags -which can force 8/16bit mode, enable/disable multi-buffering, and select the default -interface type (AUI/BNC, and for cards with twisted pair, AUI/10BaseT). -.Pp -The -.Cd flags -are a bit field, and are summarized as follows: -.Bl -tag -width indent -.It Li 0x01 -Disable transceiver. -On those cards which support it, this flag causes the transceiver to -be disabled and the AUI connection to be used by default. -.It Li 0x02 -Force 8bit mode. -This flag forces the card to 8bit mode regardless of how the -card identifies itself. -This may be needed for some clones which incorrectly -identify themselves as 16bit, even though they only have an 8bit interface. -This flag takes precedence over force 16bit mode. -.It Li 0x04 -Force 16bit mode. -This flag forces the card to 16bit mode regardless of how the -card identifies itself. -This may be needed for some clones which incorrectly -identify themselves as 8bit, even though they have a 16bit ISA interface. -.It Li 0x08 -Disable transmitter multi-buffering. -This flag disables the use of multiple -transmit buffers and may be necessary in rare cases where packets are sent out -faster than a machine on the other end can handle (as evidenced by severe packet -lossage). -Some -.No ( non- Ns Fx -:-)) machines have terrible Ethernet performance -and simply cannot cope with 1100K+ data rates. -Use of this flag also provides -one more packet worth of receiver buffering, and on 8bit cards, this may help -reduce receiver lossage. -.El -.Pp -When using a 3c503 card, the AUI connection may be selected by specifying the -.Cm link2 -option to -.Xr ifconfig 8 -(BNC is the default). -.Sh HARDWARE -The -.Nm -driver supports the following Ethernet NICs: -.Pp -.Bl -bullet -compact -.It -3Com 3c503 Etherlink II -.Pq Cd "options ED_3C503" -.It -AR-P500 Ethernet -.It -Accton EN1644 (old model), EN1646 (old model), EN2203 (old model) (110pin) -(flags 0xd00000) -.It -Accton EN2212/EN2216/UE2216 -.It -Allied Telesis CentreCOM LA100-PCM_V2 -.It -AmbiCom 10BaseT card (8002, 8002T, 8010 and 8610) -.It -Bay Networks NETGEAR FA410TXC Fast Ethernet -.It -Belkin F5D5020 PC Card Fast Ethernet -.It -Billionton LM5LT-10B Ethernet/Modem PC Card -.It -Billionton LNT-10TB, LNT-10TN Ethernet PC Card -.It -Bromax iPort 10/100 Ethernet PC Card -.It -Bromax iPort 10 Ethernet PC Card -.It -Buffalo LPC2-CLT, LPC3-CLT, LPC3-CLX, LPC4-TX, LPC-CTX PC Card -.It -Buffalo LPC-CF-CLT CF Card -.It -CNet BC40 adapter -.It -Compex Net-A adapter -.It -Compex RL2000 -.It -Corega Ether PCC-T/EtherII PCC-T/FEther PCC-TXF/PCC-TXD PCC-T/Fether II TXD -.It -Corega LAPCCTXD (TC5299J) -.It -CyQ've ELA-010 -.It -DEC EtherWorks DE305 -.It -Danpex EN-6200P2 -.It -D-Link DE-660, DE-660+ -.It -D-Link IC-CARD/IC-CARD+ Ethernet -.It -ELECOM Laneed LD-CDL/TX, LD-CDF, LD-CDS, LD-10/100CD, LD-CDWA (DP83902A) -.It -Hawking PN652TX PC Card (AX88790) -.It -HP PC Lan+ 27247B and 27252A -.Pq Cd "options ED_HPP" -.It -IBM Creditcard Ethernet I/II -.It -I-O DATA ET2/T-PCI -.It -I-O DATA PCLATE -.It -Kingston KNE-PC2, CIO10T, KNE-PCM/x Ethernet -.It -KTI ET32P2 PCI -.It -Linksys EC2T/PCMPC100/PCM100, PCMLM56 -.It -Linksys EtherFast 10/100 PC Card, Combo PCMCIA Ethernet Card (PCMPC100 V2) -.It -MACNICA Ethernet ME1 for JEIDA -.It -MELCO LGY-PCI-TR -.It -MELCO LPC-T/LPC2-T/LPC2-CLT/LPC2-TX/LPC3-TX/LPC3-CLX -.It -NDC Ethernet Instant-Link -.It -National Semiconductor InfoMover NE4100 -.It -NetGear FA-410TX -.It -NetVin NV5000SC -.It -Network Everywhere Ethernet 10BaseT PC Card -.It -New Media LANSurfer 10+56 Ethernet/Modem -.It -New Media LANSurfer -.It -Novell NE1000/NE2000/NE2100 -.It -PLANEX ENW-8300-T -.It -PLANEX FNW-3600-T -.It -Psion 10/100 LANGLOBAL Combine iT -.It -RealTek 8019 -.It -RealTek 8029 -.It -Relia Combo-L/M-56k PC Card -.It -SMC Elite 16 WD8013 -.It -SMC Elite Ultra -.It -SMC WD8003E/WD8003EBT/WD8003S/WD8003SBT/WD8003W/WD8013EBT/WD8013W and clones -.It -SMC EZCard PC Card, 8040-TX, 8041-TX (AX88x90), 8041-TX V.2 (TC5299J) -.It -Socket LP-E, ES-1000 Ethernet/Serial, LP-E CF, LP-FE CF -.It -Surecom EtherPerfect EP-427 -.It -Surecom NE-34 -.It -TDK 3000/3400/5670 Fast Ethernet/Modem -.It -TDK LAK-CD031, Grey Cell GCS2000 Ethernet Card -.It -TDK DFL5610WS Ethernet/Modem PC Card -.It -Telecom Device SuperSocket RE450T -.It -Toshiba LANCT00A PC Card -.It -VIA VT86C926 -.It -Winbond W89C940 -.It -Winbond W89C940F -.El -.Pp -ISA, PCI and PC Card devices are supported. -.Pp -The -.Nm -driver does not support the following Ethernet NICs: -.Pp -.Bl -bullet -compact -.It -Mitsubishi LAN Adapter B8895 -.El -.Sh DIAGNOSTICS -.Bl -diag -.It "ed%d: failed to clear shared memory at %x - check configuration." -When the card was probed at system boot time, the -.Nm -driver found that it could not clear the card's shared memory. -This is most commonly -caused by a BIOS extension ROM being configured in the same address space as the -Ethernet card's shared memory. -Either find the offending card and change its BIOS -ROM to be at an address that does not conflict, or change the -settings in -.Xr device.hints 5 -that the card's shared memory is mapped at a -non-conflicting address. -.It "ed%d: Invalid irq configuration (%d) must be 2-5 for 3c503." -The IRQ number that was specified in the -.Xr device.hints 5 -file is not valid for the 3Com 3c503 card. -The 3c503 can only be assigned to IRQs 2 through 5. -.It "ed%d: Cannot find start of RAM." -.It "ed%d: Cannot find any RAM, start : %d, x = %d." -The probe of a Gateway card was unsuccessful in configuring the card's packet memory. -This likely indicates that the card was improperly recognized as a Gateway or that -the card is defective. -.It "ed: packets buffered, but transmitter idle." -Indicates a logic problem in the driver. -Should never happen. -.It "ed%d: device timeout" -Indicates that an expected transmitter interrupt did not occur. -Usually caused by an -interrupt conflict with another card on the ISA bus. -This condition could also be caused if the kernel is configured for a -different IRQ channel than the one the card is actually using. -If that is the case, you will have to either reconfigure the card -using a DOS utility or set the jumpers on the card appropriately. -.It "ed%d: NIC memory corrupt - invalid packet length %d." -Indicates that a packet was received with a packet length that was either larger than -the maximum size or smaller than the minimum size allowed by the IEEE 802.3 standard. -Usually -caused by a conflict with another card on the ISA bus, but in some cases may also -indicate faulty cabling. -.It "ed%d: remote transmit DMA failed to complete." -This indicates that a programmed I/O transfer to an NE1000 or NE2000 style card -has failed to properly complete. -Usually caused by the ISA bus speed being set -too fast. -.It "ed%d: Invalid irq configuration (%ld) must be %s for %s" -Indicates the device has a different IRQ than supported or expected. -.It "ed%d: Cannot locate my ports!" -The device is using a different I/O port than the driver knows about. -.It "ed%d: Cannot extract MAC address" -Attempts to get the MAC address failed. -.It "ed%d: Missing mii!" -Probing for an MII bus has failed. -This indicates a coding error in the PC Card attachment, because a PHY -is required for the chips that generate this error message. -.El -.Sh SEE ALSO -.Xr altq 4 , -.Xr arp 4 , -.Xr miibus 4 , -.Xr netintro 4 , -.Xr ng_ether 4 , -.Xr device.hints 5 , -.Xr ifconfig 8 -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx 1.0 . -.Sh AUTHORS -The -.Nm -device driver and this manual page were written by -.An David Greenman . -.Sh CAVEATS -Early revision DS8390 chips have problems. -They lock up whenever the receive -ring-buffer overflows. -They occasionally switch the byte order -of the length field in the packet ring header (several different causes -of this related to an off-by-one byte alignment) - resulting in -.Qq Li "NIC memory corrupt - invalid packet length" -messages. -The card is reset -whenever these problems occur, but otherwise there is no problem with -recovering from these conditions. -.Pp -The NIC memory access to 3Com and Novell cards is much slower than it is on -WD/SMC cards; it is less than 1MB/second on 8bit boards and less than 2MB/second -on the 16bit cards. -This can lead to ring-buffer overruns resulting in -dropped packets during heavy network traffic. -.Pp -The Mitsubishi B8895 PC Card uses a DP83902, but its ASIC part is -undocumented. -Neither the NE2000 nor the WD83x0 drivers work with this card. -.Sh BUGS -The -.Nm -driver is a bit too aggressive about resetting the card whenever any bad -packets are received. -As a result, it may throw out some good packets which -have been received but not yet transferred from the card to main memory. -.Pp -The -.Nm -driver is slow by today's standards. -.Pp -PC Card attachment supports the D-Link DMF650TX LAN/Modem card's Ethernet -port only at this time. -.Pp -Some devices supported by -.Nm -do not generate the link state change events used by -.Xr devd 8 -to start -.Xr dhclient 8 . -If you have problems with -.Xr dhclient 8 -not starting and the device is always attached to the network it may -be possible to work around this by changing -.Dq Li DHCP -to -.Dq Li SYNCDHCP -in the -.Va ifconfig_ed0 -entry in -.Pa /etc/rc.conf . diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index ee59ecd00b77..a11935f447fe 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -292,9 +292,6 @@ device cpufreq # bxe: Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet # adapters. -# ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 -# HP PC Lan+, various PC Card devices -# (requires miibus) # ipw: Intel PRO/Wireless 2100 IEEE 802.11 adapter # Requires the ipw firmware module # iwi: Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters @@ -312,7 +309,6 @@ device cpufreq # Requires the wpi firmware module device bxe # Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards options ED_3C503 options ED_HPP options ED_SIC diff --git a/sys/conf/files b/sys/conf/files index 57042a8362ef..2f20e40bfb5b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1583,11 +1583,6 @@ dev/drm2/ttm/ttm_execbuf_util.c optional drm2 dev/drm2/ttm/ttm_memory.c optional drm2 dev/drm2/ttm/ttm_page_alloc.c optional drm2 dev/drm2/ttm/ttm_bo_vm.c optional drm2 -dev/ed/if_ed.c optional ed -dev/ed/if_ed_novell.c optional ed -dev/ed/if_ed_rtl80x9.c optional ed -dev/ed/if_ed_pccard.c optional ed pccard -dev/ed/if_ed_pci.c optional ed pci dev/efidev/efidev.c optional efirt dev/efidev/efirt.c optional efirt dev/efidev/efirtc.c optional efirt diff --git a/sys/dev/ed/ax88x90reg.h b/sys/dev/ed/ax88x90reg.h deleted file mode 100644 index 245d0784f5fc..000000000000 --- a/sys/dev/ed/ax88x90reg.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh. - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -/* AX88x90 based miibus defines */ -#define ED_AX88X90_MIIBUS 0x04 /* MII bus register on ASIC */ -#define ED_AX88X90_MII_CLK 0x01 -#define ED_AX88X90_MII_DIRIN 0x02 -#define ED_AX88X90_MII_DATAIN 0x04 -#define ED_AX88X90_MII_DATAOUT 0x08 -#define ED_AX88X90_TEST 0x05 /* "test" register on asic */ -#define ED_AX88X90_GPIO 0x07 /* GPIO pins */ -#define ED_AX88X90_GPIO_INT_PHY 0x10 diff --git a/sys/dev/ed/dl100xxreg.h b/sys/dev/ed/dl100xxreg.h deleted file mode 100644 index 69870c2aedf1..000000000000 --- a/sys/dev/ed/dl100xxreg.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh. - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -/* Dlink chipset used on some Netgear and Dlink PCMCIA cards */ -#define ED_DL100XX_MIIBUS 0x0c /* MII bus register on ASIC */ -#define ED_DL10022_DIAG 0x0d -#define ED_DL10022_COLLISON_DIS 4 /* Disable collision detection */ - -#define ED_DL10022_MII_RESET1 0x04 -#define ED_DL10022_MII_RESET2 0x08 - -#define ED_DL100XX_MII_DATAIN 0x10 -#define ED_DL10022_MII_DIROUT 0x20 -#define ED_DL10019_MII_DIROUT 0x10 -#define ED_DL100XX_MII_DIROUT (ED_DL10022_MII_DIROUT | ED_DL10019_MII_DIROUT) -#define ED_DL100XX_MII_DATAOUT 0x40 -#define ED_DL100XX_MII_CLK 0x80 diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c deleted file mode 100644 index 20a5b876bf94..000000000000 --- a/sys/dev/ed/if_ed.c +++ /dev/null @@ -1,1860 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* - * Device driver for National Semiconductor DS8390/WD83C690 based ethernet - * adapters. By David Greenman, 29-April-1993 - * - * Currently supports the Western Digital/SMC 8003 and 8013 series, - * the SMC Elite Ultra (8216), the 3Com 3c503, the NE1000 and NE2000, - * and a variety of similar clones. - * - */ - -#include "opt_ed.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/sysctl.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_var.h> -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> -#include <net/if_types.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> -#include <sys/kdb.h> - -devclass_t ed_devclass; - -static void ed_init(void *); -static void ed_init_locked(struct ed_softc *); -static int ed_ioctl(struct ifnet *, u_long, caddr_t); -static void ed_start(struct ifnet *); -static void ed_start_locked(struct ifnet *); -static void ed_reset(struct ifnet *); -static void ed_tick(void *); -static void ed_watchdog(struct ed_softc *); - -static void ed_ds_getmcaf(struct ed_softc *, uint32_t *); - -static void ed_get_packet(struct ed_softc *, bus_size_t, u_short); -static void ed_stop_hw(struct ed_softc *sc); - -static __inline void ed_rint(struct ed_softc *); -static __inline void ed_xmit(struct ed_softc *); -static __inline void ed_ring_copy(struct ed_softc *, bus_size_t, char *, - u_short); - -static void ed_setrcr(struct ed_softc *); - -/* - * Generic probe routine for testing for the existance of a DS8390. - * Must be called after the NIC has just been reset. This routine - * works by looking at certain register values that are guaranteed - * to be initialized a certain way after power-up or reset. Seems - * not to currently work on the 83C690. - * - * Specifically: - * - * Register reset bits set bits - * Command Register (CR) TXP, STA RD2, STP - * Interrupt Status (ISR) RST - * Interrupt Mask (IMR) All bits - * Data Control (DCR) LAS - * Transmit Config. (TCR) LB1, LB0 - * - * We only look at the CR and ISR registers, however, because looking at - * the others would require changing register pages (which would be - * intrusive if this isn't an 8390). - * - * Return 1 if 8390 was found, 0 if not. - */ - -int -ed_probe_generic8390(struct ed_softc *sc) -{ - if ((ed_nic_inb(sc, ED_P0_CR) & - (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) != - (ED_CR_RD2 | ED_CR_STP)) - return (0); - if ((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST) != ED_ISR_RST) - return (0); - - return (1); -} - -void -ed_disable_16bit_access(struct ed_softc *sc) -{ - /* - * Disable 16 bit access to shared memory - */ - if (sc->isa16bit && sc->vendor == ED_VENDOR_WD_SMC) { - if (sc->chip_type == ED_CHIP_TYPE_WD790) - ed_asic_outb(sc, ED_WD_MSR, 0x00); - ed_asic_outb(sc, ED_WD_LAAR, - sc->wd_laar_proto & ~ED_WD_LAAR_M16EN); - } -} - -void -ed_enable_16bit_access(struct ed_softc *sc) -{ - if (sc->isa16bit && sc->vendor == ED_VENDOR_WD_SMC) { - ed_asic_outb(sc, ED_WD_LAAR, - sc->wd_laar_proto | ED_WD_LAAR_M16EN); - if (sc->chip_type == ED_CHIP_TYPE_WD790) - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB); - } -} - -/* - * Allocate a port resource with the given resource id. - */ -int -ed_alloc_port(device_t dev, int rid, int size) -{ - struct ed_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - size, RF_ACTIVE); - if (res) { - sc->port_res = res; - sc->port_used = size; - sc->port_bst = rman_get_bustag(res); - sc->port_bsh = rman_get_bushandle(res); - return (0); - } - return (ENOENT); -} - -/* - * Allocate a memory resource with the given resource id. - */ -int -ed_alloc_memory(device_t dev, int rid, int size) -{ - struct ed_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, - size, RF_ACTIVE); - if (res) { - sc->mem_res = res; - sc->mem_used = size; - sc->mem_bst = rman_get_bustag(res); - sc->mem_bsh = rman_get_bushandle(res); - return (0); - } - return (ENOENT); -} - -/* - * Allocate an irq resource with the given resource id. - */ -int -ed_alloc_irq(device_t dev, int rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | flags); - if (res) { - sc->irq_res = res; - return (0); - } - return (ENOENT); -} - -/* - * Release all resources - */ -void -ed_release_resources(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - - if (sc->port_res) - bus_free_resource(dev, SYS_RES_IOPORT, sc->port_res); - if (sc->port_res2) - bus_free_resource(dev, SYS_RES_IOPORT, sc->port_res2); - if (sc->mem_res) - bus_free_resource(dev, SYS_RES_MEMORY, sc->mem_res); - if (sc->irq_res) - bus_free_resource(dev, SYS_RES_IRQ, sc->irq_res); - sc->port_res = 0; - sc->port_res2 = 0; - sc->mem_res = 0; - sc->irq_res = 0; - if (sc->ifp) - if_free(sc->ifp); -} - -/* - * Install interface into kernel networking data structures - */ -int -ed_attach(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - struct ifnet *ifp; - - sc->dev = dev; - ED_LOCK_INIT(sc); - ifp = sc->ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(dev, "can not if_alloc()\n"); - ED_LOCK_DESTROY(sc); - return (ENOSPC); - } - - if (sc->readmem == NULL) { - if (sc->mem_shared) { - if (sc->isa16bit) - sc->readmem = ed_shmem_readmem16; - else - sc->readmem = ed_shmem_readmem8; - } else { - sc->readmem = ed_pio_readmem; - } - } - if (sc->sc_write_mbufs == NULL) { - device_printf(dev, "No write mbufs routine set\n"); - return (ENXIO); - } - - callout_init_mtx(&sc->tick_ch, ED_MUTEX(sc), 0); - /* - * Set interface to stopped condition (reset) - */ - ed_stop_hw(sc); - - /* - * Initialize ifnet structure - */ - ifp->if_softc = sc; - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_start = ed_start; - ifp->if_ioctl = ed_ioctl; - ifp->if_init = ed_init; - IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; - IFQ_SET_READY(&ifp->if_snd); - ifp->if_linkmib = &sc->mibdata; - ifp->if_linkmiblen = sizeof sc->mibdata; - /* - * XXX - should do a better job. - */ - if (sc->chip_type == ED_CHIP_TYPE_WD790) - sc->mibdata.dot3StatsEtherChipSet = - DOT3CHIPSET(dot3VendorWesternDigital, - dot3ChipSetWesternDigital83C790); - else - sc->mibdata.dot3StatsEtherChipSet = - DOT3CHIPSET(dot3VendorNational, - dot3ChipSetNational8390); - sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS; - - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - /* - * Set default state for LINK2 flag (used to disable the - * tranceiver for AUI operation), based on config option. - * We only set this flag before we attach the device, so there's - * no race. It is convenient to allow users to turn this off - * by default in the kernel config, but given our more advanced - * boot time configuration options, this might no longer be needed. - */ - if (device_get_flags(dev) & ED_FLAGS_DISABLE_TRANCEIVER) - ifp->if_flags |= IFF_LINK2; - - /* - * Attach the interface - */ - ether_ifattach(ifp, sc->enaddr); - /* device attach does transition from UNCONFIGURED to IDLE state */ - - sc->tx_mem = sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - sc->rx_mem = (sc->rec_page_stop - sc->rec_page_start) * ED_PAGE_SIZE; - SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - 0, "type", CTLFLAG_RD, sc->type_str, 0, - "Type of chip in card"); - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - 1, "TxMem", CTLFLAG_RD, &sc->tx_mem, 0, - "Memory set aside for transmitting packets"); - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - 2, "RxMem", CTLFLAG_RD, &sc->rx_mem, 0, - "Memory set aside for receiving packets"); - SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - 3, "Mem", CTLFLAG_RD, &sc->mem_size, 0, - "Total Card Memory"); - if (bootverbose) { - if (sc->type_str && (*sc->type_str != 0)) - device_printf(dev, "type %s ", sc->type_str); - else - device_printf(dev, "type unknown (0x%x) ", sc->type); - -#ifdef ED_HPP - if (sc->vendor == ED_VENDOR_HP) - printf("(%s %s IO)", - (sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS) ? - "16-bit" : "32-bit", - sc->hpp_mem_start ? "memory mapped" : "regular"); - else -#endif - printf("%s", sc->isa16bit ? "(16 bit)" : "(8 bit)"); - -#if defined(ED_HPP) || defined(ED_3C503) - printf("%s", (((sc->vendor == ED_VENDOR_3COM) || - (sc->vendor == ED_VENDOR_HP)) && - (ifp->if_flags & IFF_LINK2)) ? - " tranceiver disabled" : ""); -#endif - printf("\n"); - } - - gone_by_fcp101_dev(dev); - - return (0); -} - -/* - * Detach the driver from the hardware and other systems in the kernel. - */ -int -ed_detach(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->ifp; - - if (mtx_initialized(ED_MUTEX(sc))) - ED_ASSERT_UNLOCKED(sc); - if (ifp) { - ED_LOCK(sc); - if (bus_child_present(dev)) - ed_stop(sc); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - ED_UNLOCK(sc); - ether_ifdetach(ifp); - callout_drain(&sc->tick_ch); - } - if (sc->irq_res != NULL && sc->irq_handle) - bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); - ed_release_resources(dev); - if (sc->miibus) - device_delete_child(dev, sc->miibus); - if (mtx_initialized(ED_MUTEX(sc))) - ED_LOCK_DESTROY(sc); - bus_generic_detach(dev); - return (0); -} - -/* - * Reset interface. - */ -static void -ed_reset(struct ifnet *ifp) -{ - struct ed_softc *sc = ifp->if_softc; - - ED_ASSERT_LOCKED(sc); - /* - * Stop interface and re-initialize. - */ - ed_stop(sc); - ed_init_locked(sc); -} - -static void -ed_stop_hw(struct ed_softc *sc) -{ - int n = 5000; - - /* - * Stop everything on the interface, and select page 0 registers. - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * Wait for interface to enter stopped state, but limit # of checks to - * 'n' (about 5ms). It shouldn't even take 5us on modern DS8390's, but - * just in case it's an old one. - * - * The AX88x90 chips don't seem to implement this behavor. The - * datasheets say it is only turned on when the chip enters a RESET - * state and is silent about behavior for the stopped state we just - * entered. - */ - if (sc->chip_type == ED_CHIP_TYPE_AX88190 || - sc->chip_type == ED_CHIP_TYPE_AX88790) - return; - while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST) == 0) && --n) - continue; - if (n <= 0) - device_printf(sc->dev, "ed_stop_hw RST never set\n"); -} - -/* - * Take interface offline. - */ -void -ed_stop(struct ed_softc *sc) -{ - ED_ASSERT_LOCKED(sc); - callout_stop(&sc->tick_ch); - ed_stop_hw(sc); -} - -/* - * Periodic timer used to drive the watchdog and attachment-specific - * tick handler. - */ -static void -ed_tick(void *arg) -{ - struct ed_softc *sc; - - sc = arg; - ED_ASSERT_LOCKED(sc); - if (sc->sc_tick) - sc->sc_tick(sc); - if (sc->tx_timer != 0 && --sc->tx_timer == 0) - ed_watchdog(sc); - callout_reset(&sc->tick_ch, hz, ed_tick, sc); -} - -/* - * Device timeout/watchdog routine. Entered if the device neglects to - * generate an interrupt after a transmit has been started on it. - */ -static void -ed_watchdog(struct ed_softc *sc) -{ - struct ifnet *ifp; - - ifp = sc->ifp; - log(LOG_ERR, "%s: device timeout\n", ifp->if_xname); - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - - ed_reset(ifp); -} - -/* - * Initialize device. - */ -static void -ed_init(void *xsc) -{ - struct ed_softc *sc = xsc; - - ED_ASSERT_UNLOCKED(sc); - ED_LOCK(sc); - ed_init_locked(sc); - ED_UNLOCK(sc); -} - -static void -ed_init_locked(struct ed_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - int i; - - ED_ASSERT_LOCKED(sc); - - /* - * Initialize the NIC in the exact order outlined in the NS manual. - * This init procedure is "mandatory"...don't change what or when - * things happen. - */ - - /* reset transmitter flags */ - sc->xmit_busy = 0; - sc->tx_timer = 0; - - sc->txb_inuse = 0; - sc->txb_new = 0; - sc->txb_next_tx = 0; - - /* This variable is used below - don't move this assignment */ - sc->next_packet = sc->rec_page_start + 1; - - /* - * Set interface for page 0, Remote DMA complete, Stopped - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - if (sc->isa16bit) - /* - * Set FIFO threshold to 8, No auto-init Remote DMA, byte - * order=80x86, word-wide DMA xfers, - */ - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS); - else - /* - * Same as above, but byte-wide DMA xfers - */ - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS); - - /* - * Clear Remote Byte Count Registers - */ - ed_nic_outb(sc, ED_P0_RBCR0, 0); - ed_nic_outb(sc, ED_P0_RBCR1, 0); - - /* - * For the moment, don't store incoming packets in memory. - */ - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); - - /* - * Place NIC in internal loopback mode - */ - ed_nic_outb(sc, ED_P0_TCR, ED_TCR_LB0); - - /* - * Initialize transmit/receive (ring-buffer) Page Start - */ - ed_nic_outb(sc, ED_P0_TPSR, sc->tx_page_start); - ed_nic_outb(sc, ED_P0_PSTART, sc->rec_page_start); - /* Set lower bits of byte addressable framing to 0 */ - if (sc->chip_type == ED_CHIP_TYPE_WD790) - ed_nic_outb(sc, 0x09, 0); - - /* - * Initialize Receiver (ring-buffer) Page Stop and Boundry - */ - ed_nic_outb(sc, ED_P0_PSTOP, sc->rec_page_stop); - ed_nic_outb(sc, ED_P0_BNRY, sc->rec_page_start); - - /* - * Clear all interrupts. A '1' in each bit position clears the - * corresponding flag. - */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - - /* - * Enable the following interrupts: receive/transmit complete, - * receive/transmit error, and Receiver OverWrite. - * - * Counter overflow and Remote DMA complete are *not* enabled. - */ - ed_nic_outb(sc, ED_P0_IMR, - ED_IMR_PRXE | ED_IMR_PTXE | ED_IMR_RXEE | ED_IMR_TXEE | ED_IMR_OVWE); - - /* - * Program Command Register for page 1 - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * Copy out our station address - */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) - ed_nic_outb(sc, ED_P1_PAR(i), IF_LLADDR(sc->ifp)[i]); - - /* - * Set Current Page pointer to next_packet (initialized above) - */ - ed_nic_outb(sc, ED_P1_CURR, sc->next_packet); - - /* - * Program Receiver Configuration Register and multicast filter. CR is - * set to page 0 on return. - */ - ed_setrcr(sc); - - /* - * Take interface out of loopback - */ - ed_nic_outb(sc, ED_P0_TCR, 0); - - if (sc->sc_mediachg) - sc->sc_mediachg(sc); - - /* - * Set 'running' flag, and clear output active flag. - */ - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - /* - * ...and attempt to start output - */ - ed_start_locked(ifp); - - callout_reset(&sc->tick_ch, hz, ed_tick, sc); -} - -/* - * This routine actually starts the transmission on the interface - */ -static __inline void -ed_xmit(struct ed_softc *sc) -{ - unsigned short len; - - len = sc->txb_len[sc->txb_next_tx]; - - /* - * Set NIC for page 0 register access - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * Set TX buffer start page - */ - ed_nic_outb(sc, ED_P0_TPSR, sc->tx_page_start + - sc->txb_next_tx * ED_TXBUF_SIZE); - - /* - * Set TX length - */ - ed_nic_outb(sc, ED_P0_TBCR0, len); - ed_nic_outb(sc, ED_P0_TBCR1, len >> 8); - - /* - * Set page 0, Remote DMA complete, Transmit Packet, and *Start* - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_TXP | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - sc->xmit_busy = 1; - - /* - * Point to next transmit buffer slot and wrap if necessary. - */ - sc->txb_next_tx++; - if (sc->txb_next_tx == sc->txb_cnt) - sc->txb_next_tx = 0; - - /* - * Set a timer just in case we never hear from the board again - */ - sc->tx_timer = 2; -} - -/* - * Start output on interface. - * We make two assumptions here: - * 1) that the current priority is set to splimp _before_ this code - * is called *and* is returned to the appropriate priority after - * return - * 2) that the IFF_DRV_OACTIVE flag is checked before this code is called - * (i.e. that the output part of the interface is idle) - */ -static void -ed_start(struct ifnet *ifp) -{ - struct ed_softc *sc = ifp->if_softc; - - ED_ASSERT_UNLOCKED(sc); - ED_LOCK(sc); - ed_start_locked(ifp); - ED_UNLOCK(sc); -} - -static void -ed_start_locked(struct ifnet *ifp) -{ - struct ed_softc *sc = ifp->if_softc; - struct mbuf *m0, *m; - bus_size_t buffer; - int len; - - ED_ASSERT_LOCKED(sc); -outloop: - - /* - * First, see if there are buffered packets and an idle transmitter - - * should never happen at this point. - */ - if (sc->txb_inuse && (sc->xmit_busy == 0)) { - printf("ed: packets buffered, but transmitter idle\n"); - ed_xmit(sc); - } - - /* - * See if there is room to put another packet in the buffer. - */ - if (sc->txb_inuse == sc->txb_cnt) { - - /* - * No room. Indicate this to the outside world and exit. - */ - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - return; - } - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) { - - /* - * We are using the !OACTIVE flag to indicate to the outside - * world that we can accept an additional packet rather than - * that the transmitter is _actually_ active. Indeed, the - * transmitter may be active, but if we haven't filled all the - * buffers with data then we still want to accept more. - */ - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - return; - } - - /* - * Copy the mbuf chain into the transmit buffer - */ - m0 = m; - - /* txb_new points to next open buffer slot */ - buffer = sc->mem_start + (sc->txb_new * ED_TXBUF_SIZE * ED_PAGE_SIZE); - - len = sc->sc_write_mbufs(sc, m, buffer); - if (len == 0) { - m_freem(m0); - goto outloop; - } - - sc->txb_len[sc->txb_new] = max(len, (ETHER_MIN_LEN-ETHER_CRC_LEN)); - - sc->txb_inuse++; - - /* - * Point to next buffer slot and wrap if necessary. - */ - sc->txb_new++; - if (sc->txb_new == sc->txb_cnt) - sc->txb_new = 0; - - if (sc->xmit_busy == 0) - ed_xmit(sc); - - /* - * Tap off here if there is a bpf listener. - */ - BPF_MTAP(ifp, m0); - - m_freem(m0); - - /* - * Loop back to the top to possibly buffer more packets - */ - goto outloop; -} - -/* - * Ethernet interface receiver interrupt. - */ -static __inline void -ed_rint(struct ed_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - u_char boundry; - u_short len; - struct ed_ring packet_hdr; - bus_size_t packet_ptr; - - ED_ASSERT_LOCKED(sc); - - /* - * Set NIC to page 1 registers to get 'current' pointer - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * 'sc->next_packet' is the logical beginning of the ring-buffer - - * i.e. it points to where new data has been buffered. The 'CURR' - * (current) register points to the logical end of the ring-buffer - - * i.e. it points to where additional new data will be added. We loop - * here until the logical beginning equals the logical end (or in - * other words, until the ring-buffer is empty). - */ - while (sc->next_packet != ed_nic_inb(sc, ED_P1_CURR)) { - - /* get pointer to this buffer's header structure */ - packet_ptr = sc->mem_ring + - (sc->next_packet - sc->rec_page_start) * ED_PAGE_SIZE; - - /* - * The byte count includes a 4 byte header that was added by - * the NIC. - */ - sc->readmem(sc, packet_ptr, (char *) &packet_hdr, - sizeof(packet_hdr)); - len = packet_hdr.count; - if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring)) || - len < (ETHER_MIN_LEN - ETHER_CRC_LEN + sizeof(struct ed_ring))) { - /* - * Length is a wild value. There's a good chance that - * this was caused by the NIC being old and buggy. - * The bug is that the length low byte is duplicated - * in the high byte. Try to recalculate the length - * based on the pointer to the next packet. Also, - * need ot preserve offset into page. - * - * NOTE: sc->next_packet is pointing at the current - * packet. - */ - len &= ED_PAGE_SIZE - 1; - if (packet_hdr.next_packet >= sc->next_packet) - len += (packet_hdr.next_packet - - sc->next_packet) * ED_PAGE_SIZE; - else - len += - ((packet_hdr.next_packet - sc->rec_page_start) + - (sc->rec_page_stop - sc->next_packet)) * ED_PAGE_SIZE; - /* - * because buffers are aligned on 256-byte boundary, - * the length computed above is off by 256 in almost - * all cases. Fix it... - */ - if (len & 0xff) - len -= 256; - if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN - + sizeof(struct ed_ring))) - sc->mibdata.dot3StatsFrameTooLongs++; - } - - /* - * Be fairly liberal about what we allow as a "reasonable" - * length so that a [crufty] packet will make it to BPF (and - * can thus be analyzed). Note that all that is really - * important is that we have a length that will fit into one - * mbuf cluster or less; the upper layer protocols can then - * figure out the length from their own length field(s). But - * make sure that we have at least a full ethernet header or - * we would be unable to call ether_input() later. - */ - if ((len >= sizeof(struct ed_ring) + ETHER_HDR_LEN) && - (len <= MCLBYTES) && - (packet_hdr.next_packet >= sc->rec_page_start) && - (packet_hdr.next_packet < sc->rec_page_stop)) { - /* - * Go get packet. - */ - ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring), - len - sizeof(struct ed_ring)); - if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - } else { - /* - * Really BAD. The ring pointers are corrupted. - */ - log(LOG_ERR, - "%s: NIC memory corrupt - invalid packet length %d\n", - ifp->if_xname, len); - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - ed_reset(ifp); - return; - } - - /* - * Update next packet pointer - */ - sc->next_packet = packet_hdr.next_packet; - - /* - * Update NIC boundry pointer - being careful to keep it one - * buffer behind. (as recommended by NS databook) - */ - boundry = sc->next_packet - 1; - if (boundry < sc->rec_page_start) - boundry = sc->rec_page_stop - 1; - - /* - * Set NIC to page 0 registers to update boundry register - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_BNRY, boundry); - - /* - * Set NIC to page 1 registers before looping to top (prepare - * to get 'CURR' current pointer) - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } -} - -/* - * Ethernet interface interrupt processor - */ -void -edintr(void *arg) -{ - struct ed_softc *sc = (struct ed_softc*) arg; - struct ifnet *ifp = sc->ifp; - u_char isr; - int count; - - ED_LOCK(sc); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ED_UNLOCK(sc); - return; - } - /* - * Set NIC to page 0 registers - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * loop until there are no more new interrupts. When the card goes - * away, the hardware will read back 0xff. Looking at the interrupts, - * it would appear that 0xff is impossible as ED_ISR_RST is normally - * clear. ED_ISR_RDC is also normally clear and only set while - * we're transferring memory to the card and we're holding the - * ED_LOCK (so we can't get into here). - */ - while ((isr = ed_nic_inb(sc, ED_P0_ISR)) != 0 && isr != 0xff) { - - /* - * reset all the bits that we are 'acknowledging' by writing a - * '1' to each bit position that was set (writing a '1' - * *clears* the bit) - */ - ed_nic_outb(sc, ED_P0_ISR, isr); - - /* - * The AX88190 and AX88190A has problems acking an interrupt - * and having them clear. This interferes with top-level loop - * here. Wait for all the bits to clear. - * - * We limit this to 5000 iterations. At 1us per inb/outb, - * this translates to about 15ms, which should be plenty of - * time, and also gives protection in the card eject case. - */ - if (sc->chip_type == ED_CHIP_TYPE_AX88190) { - count = 5000; /* 15ms */ - while (count-- && (ed_nic_inb(sc, ED_P0_ISR) & isr)) { - ed_nic_outb(sc, ED_P0_ISR,0); - ed_nic_outb(sc, ED_P0_ISR,isr); - } - if (count == 0) - break; - } - - /* - * Handle transmitter interrupts. Handle these first because - * the receiver will reset the board under some conditions. - */ - if (isr & (ED_ISR_PTX | ED_ISR_TXE)) { - u_char collisions = ed_nic_inb(sc, ED_P0_NCR) & 0x0f; - - /* - * Check for transmit error. If a TX completed with an - * error, we end up throwing the packet away. Really - * the only error that is possible is excessive - * collisions, and in this case it is best to allow - * the automatic mechanisms of TCP to backoff the - * flow. Of course, with UDP we're screwed, but this - * is expected when a network is heavily loaded. - */ - (void) ed_nic_inb(sc, ED_P0_TSR); - if (isr & ED_ISR_TXE) { - u_char tsr; - - /* - * Excessive collisions (16) - */ - tsr = ed_nic_inb(sc, ED_P0_TSR); - if ((tsr & ED_TSR_ABT) - && (collisions == 0)) { - - /* - * When collisions total 16, the - * P0_NCR will indicate 0, and the - * TSR_ABT is set. - */ - collisions = 16; - sc->mibdata.dot3StatsExcessiveCollisions++; - sc->mibdata.dot3StatsCollFrequencies[15]++; - } - if (tsr & ED_TSR_OWC) - sc->mibdata.dot3StatsLateCollisions++; - if (tsr & ED_TSR_CDH) - sc->mibdata.dot3StatsSQETestErrors++; - if (tsr & ED_TSR_CRS) - sc->mibdata.dot3StatsCarrierSenseErrors++; - if (tsr & ED_TSR_FU) - sc->mibdata.dot3StatsInternalMacTransmitErrors++; - - /* - * update output errors counter - */ - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - } else { - - /* - * Update total number of successfully - * transmitted packets. - */ - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); - } - - /* - * reset tx busy and output active flags - */ - sc->xmit_busy = 0; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - /* - * clear watchdog timer - */ - sc->tx_timer = 0; - - /* - * Add in total number of collisions on last - * transmission. - */ - if_inc_counter(ifp, IFCOUNTER_COLLISIONS, collisions); - switch(collisions) { - case 0: - case 16: - break; - case 1: - sc->mibdata.dot3StatsSingleCollisionFrames++; - sc->mibdata.dot3StatsCollFrequencies[0]++; - break; - default: - sc->mibdata.dot3StatsMultipleCollisionFrames++; - sc->mibdata. - dot3StatsCollFrequencies[collisions-1] - ++; - break; - } - - /* - * Decrement buffer in-use count if not zero (can only - * be zero if a transmitter interrupt occured while - * not actually transmitting). If data is ready to - * transmit, start it transmitting, otherwise defer - * until after handling receiver - */ - if (sc->txb_inuse && --sc->txb_inuse) - ed_xmit(sc); - } - - /* - * Handle receiver interrupts - */ - if (isr & (ED_ISR_PRX | ED_ISR_RXE | ED_ISR_OVW)) { - - /* - * Overwrite warning. In order to make sure that a - * lockup of the local DMA hasn't occurred, we reset - * and re-init the NIC. The NSC manual suggests only a - * partial reset/re-init is necessary - but some chips - * seem to want more. The DMA lockup has been seen - * only with early rev chips - Methinks this bug was - * fixed in later revs. -DG - */ - if (isr & ED_ISR_OVW) { - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#ifdef DIAGNOSTIC - log(LOG_WARNING, - "%s: warning - receiver ring buffer overrun\n", - ifp->if_xname); -#endif - - /* - * Stop/reset/re-init NIC - */ - ed_reset(ifp); - } else { - - /* - * Receiver Error. One or more of: CRC error, - * frame alignment error FIFO overrun, or - * missed packet. - */ - if (isr & ED_ISR_RXE) { - u_char rsr; - rsr = ed_nic_inb(sc, ED_P0_RSR); - if (rsr & ED_RSR_CRC) - sc->mibdata.dot3StatsFCSErrors++; - if (rsr & ED_RSR_FAE) - sc->mibdata.dot3StatsAlignmentErrors++; - if (rsr & ED_RSR_FO) - sc->mibdata.dot3StatsInternalMacReceiveErrors++; - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); -#ifdef ED_DEBUG - if_printf(ifp, "receive error %x\n", - ed_nic_inb(sc, ED_P0_RSR)); -#endif - } - - /* - * Go get the packet(s) XXX - Doing this on an - * error is dubious because there shouldn't be - * any data to get (we've configured the - * interface to not accept packets with - * errors). - */ - - /* - * Enable 16bit access to shared memory first - * on WD/SMC boards. - */ - ed_enable_16bit_access(sc); - ed_rint(sc); - ed_disable_16bit_access(sc); - } - } - - /* - * If it looks like the transmitter can take more data, - * attempt to start output on the interface. This is done - * after handling the receiver to give the receiver priority. - */ - if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) - ed_start_locked(ifp); - - /* - * return NIC CR to standard state: page 0, remote DMA - * complete, start (toggling the TXP bit off, even if was just - * set in the transmit routine, is *okay* - it is 'edge' - * triggered from low to high) - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * If the Network Talley Counters overflow, read them to reset - * them. It appears that old 8390's won't clear the ISR flag - * otherwise - resulting in an infinite loop. - */ - if (isr & ED_ISR_CNT) { - (void) ed_nic_inb(sc, ED_P0_CNTR0); - (void) ed_nic_inb(sc, ED_P0_CNTR1); - (void) ed_nic_inb(sc, ED_P0_CNTR2); - } - } - ED_UNLOCK(sc); -} - -/* - * Process an ioctl request. - */ -static int -ed_ioctl(struct ifnet *ifp, u_long command, caddr_t data) -{ - struct ed_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - int error = 0; - - switch (command) { - case SIOCSIFFLAGS: - /* - * If the interface is marked up and stopped, then start it. - * If we're up and already running, then it may be a mediachg. - * If it is marked down and running, then stop it. - */ - ED_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - ed_init_locked(sc); - else if (sc->sc_mediachg) - sc->sc_mediachg(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - ed_stop(sc); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - } - } - - /* - * Promiscuous flag may have changed, so reprogram the RCR. - */ - ed_setrcr(sc); - - ED_UNLOCK(sc); - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - ED_LOCK(sc); - ed_setrcr(sc); - ED_UNLOCK(sc); - error = 0; - break; - - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - if (sc->sc_media_ioctl == NULL) { - error = EINVAL; - break; - } - sc->sc_media_ioctl(sc, ifr, command); - break; - - default: - error = ether_ioctl(ifp, command, data); - break; - } - return (error); -} - -/* - * Given a source and destination address, copy 'amount' of a packet from - * the ring buffer into a linear destination buffer. Takes into account - * ring-wrap. - */ -static __inline void -ed_ring_copy(struct ed_softc *sc, bus_size_t src, char *dst, u_short amount) -{ - u_short tmp_amount; - - /* does copy wrap to lower addr in ring buffer? */ - if (src + amount > sc->mem_end) { - tmp_amount = sc->mem_end - src; - /* copy amount up to end of NIC memory */ - sc->readmem(sc, src, dst, tmp_amount); - amount -= tmp_amount; - src = sc->mem_ring; - dst += tmp_amount; - } - sc->readmem(sc, src, dst, amount); -} - -/* - * Retreive packet from shared memory and send to the next level up via - * ether_input(). - */ -static void -ed_get_packet(struct ed_softc *sc, bus_size_t buf, u_short len) -{ - struct ifnet *ifp = sc->ifp; - struct ether_header *eh; - struct mbuf *m; - - /* Allocate a header mbuf */ - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == NULL) - return; - m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.len = m->m_len = len; - - /* - * We always put the received packet in a single buffer - - * either with just an mbuf header or in a cluster attached - * to the header. The +2 is to compensate for the alignment - * fixup below. - */ - if ((len + 2) > MHLEN) { - /* Attach an mbuf cluster */ - if (!(MCLGET(m, M_NOWAIT))) { - m_freem(m); - return; - } - } - - /* - * The +2 is to longword align the start of the real packet. - * This is important for NFS. - */ - m->m_data += 2; - eh = mtod(m, struct ether_header *); - - /* - * Get packet, including link layer address, from interface. - */ - ed_ring_copy(sc, buf, (char *)eh, len); - - m->m_pkthdr.len = m->m_len = len; - - ED_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - ED_LOCK(sc); -} - -/* - * Supporting routines - */ - -/* - * Given a NIC memory source address and a host memory destination - * address, copy 'amount' from NIC to host using shared memory. - * The 'amount' is rounded up to a word - okay as long as mbufs - * are word sized. That's what the +1 is below. - * This routine accesses things as 16 bit quantities. - */ -void -ed_shmem_readmem16(struct ed_softc *sc, bus_size_t src, uint8_t *dst, - uint16_t amount) -{ - bus_space_read_region_2(sc->mem_bst, sc->mem_bsh, src, (uint16_t *)dst, - (amount + 1) / 2); -} - -/* - * Given a NIC memory source address and a host memory destination - * address, copy 'amount' from NIC to host using shared memory. - * This routine accesses things as 8 bit quantities. - */ -void -ed_shmem_readmem8(struct ed_softc *sc, bus_size_t src, uint8_t *dst, - uint16_t amount) -{ - bus_space_read_region_1(sc->mem_bst, sc->mem_bsh, src, dst, amount); -} - -/* - * Given a NIC memory source address and a host memory destination - * address, copy 'amount' from NIC to host using Programmed I/O. - * The 'amount' is rounded up to a word - okay as long as mbufs - * are word sized. - * This routine is currently Novell-specific. - */ -void -ed_pio_readmem(struct ed_softc *sc, bus_size_t src, uint8_t *dst, - uint16_t amount) -{ - /* Regular Novell cards */ - /* select page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* round up to a word */ - if (amount & 1) - ++amount; - - /* set up DMA byte count */ - ed_nic_outb(sc, ED_P0_RBCR0, amount); - ed_nic_outb(sc, ED_P0_RBCR1, amount >> 8); - - /* set up source address in NIC mem */ - ed_nic_outb(sc, ED_P0_RSAR0, src); - ed_nic_outb(sc, ED_P0_RSAR1, src >> 8); - - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD0 | ED_CR_STA); - - if (sc->isa16bit) - ed_asic_insw(sc, ED_NOVELL_DATA, dst, amount / 2); - else - ed_asic_insb(sc, ED_NOVELL_DATA, dst, amount); -} - -/* - * Stripped down routine for writing a linear buffer to NIC memory. - * Only used in the probe routine to test the memory. 'len' must - * be even. - */ -void -ed_pio_writemem(struct ed_softc *sc, uint8_t *src, uint16_t dst, uint16_t len) -{ - int maxwait = 200; /* about 240us */ - - /* select page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* reset remote DMA complete flag */ - ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); - - /* set up DMA byte count */ - ed_nic_outb(sc, ED_P0_RBCR0, len); - ed_nic_outb(sc, ED_P0_RBCR1, len >> 8); - - /* set up destination address in NIC mem */ - ed_nic_outb(sc, ED_P0_RSAR0, dst); - ed_nic_outb(sc, ED_P0_RSAR1, dst >> 8); - - /* set remote DMA write */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_STA); - - if (sc->isa16bit) - ed_asic_outsw(sc, ED_NOVELL_DATA, src, len / 2); - else - ed_asic_outsb(sc, ED_NOVELL_DATA, src, len); - - /* - * Wait for remote DMA complete. This is necessary because on the - * transmit side, data is handled internally by the NIC in bursts and - * we can't start another remote DMA until this one completes. Not - * waiting causes really bad things to happen - like the NIC - * irrecoverably jamming the ISA bus. - */ - while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && - --maxwait) - continue; -} - -/* - * Write an mbuf chain to the destination NIC memory address using - * programmed I/O. - */ -u_short -ed_pio_write_mbufs(struct ed_softc *sc, struct mbuf *m, bus_size_t dst) -{ - struct ifnet *ifp = sc->ifp; - unsigned short total_len, dma_len; - struct mbuf *mp; - int maxwait = 200; /* about 240us */ - - ED_ASSERT_LOCKED(sc); - - /* Regular Novell cards */ - /* First, count up the total number of bytes to copy */ - for (total_len = 0, mp = m; mp; mp = mp->m_next) - total_len += mp->m_len; - - dma_len = total_len; - if (sc->isa16bit && (dma_len & 1)) - dma_len++; - - /* select page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* reset remote DMA complete flag */ - ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); - - /* set up DMA byte count */ - ed_nic_outb(sc, ED_P0_RBCR0, dma_len); - ed_nic_outb(sc, ED_P0_RBCR1, dma_len >> 8); - - /* set up destination address in NIC mem */ - ed_nic_outb(sc, ED_P0_RSAR0, dst); - ed_nic_outb(sc, ED_P0_RSAR1, dst >> 8); - - /* set remote DMA write */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD1 | ED_CR_STA); - - /* - * Transfer the mbuf chain to the NIC memory. - * 16-bit cards require that data be transferred as words, and only words. - * So that case requires some extra code to patch over odd-length mbufs. - */ - - if (!sc->isa16bit) { - /* NE1000s are easy */ - while (m) { - if (m->m_len) - ed_asic_outsb(sc, ED_NOVELL_DATA, - m->m_data, m->m_len); - m = m->m_next; - } - } else { - /* NE2000s are a pain */ - uint8_t *data; - int len, wantbyte; - union { - uint16_t w; - uint8_t b[2]; - } saveword; - - wantbyte = 0; - - while (m) { - len = m->m_len; - if (len) { - data = mtod(m, caddr_t); - /* finish the last word */ - if (wantbyte) { - saveword.b[1] = *data; - ed_asic_outw(sc, ED_NOVELL_DATA, - saveword.w); - data++; - len--; - wantbyte = 0; - } - /* output contiguous words */ - if (len > 1) { - ed_asic_outsw(sc, ED_NOVELL_DATA, - data, len >> 1); - data += len & ~1; - len &= 1; - } - /* save last byte, if necessary */ - if (len == 1) { - saveword.b[0] = *data; - wantbyte = 1; - } - } - m = m->m_next; - } - /* spit last byte */ - if (wantbyte) - ed_asic_outw(sc, ED_NOVELL_DATA, saveword.w); - } - - /* - * Wait for remote DMA complete. This is necessary because on the - * transmit side, data is handled internally by the NIC in bursts and - * we can't start another remote DMA until this one completes. Not - * waiting causes really bad things to happen - like the NIC - * irrecoverably jamming the ISA bus. - */ - while (((ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RDC) != ED_ISR_RDC) && - --maxwait) - continue; - - if (!maxwait) { - log(LOG_WARNING, "%s: remote transmit DMA failed to complete\n", - ifp->if_xname); - ed_reset(ifp); - return(0); - } - return (total_len); -} - -static void -ed_setrcr(struct ed_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - int i; - u_char reg1; - - ED_ASSERT_LOCKED(sc); - - /* Bit 6 in AX88190 RCR register must be set. */ - if (sc->chip_type == ED_CHIP_TYPE_AX88190 || - sc->chip_type == ED_CHIP_TYPE_AX88790) - reg1 = ED_RCR_INTT; - else - reg1 = 0x00; - - /* set page 1 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_1 | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - if (ifp->if_flags & IFF_PROMISC) { - - /* - * Reconfigure the multicast filter. - */ - for (i = 0; i < 8; i++) - ed_nic_outb(sc, ED_P1_MAR(i), 0xff); - - /* - * And turn on promiscuous mode. Also enable reception of - * runts and packets with CRC & alignment errors. - */ - /* Set page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_PRO | ED_RCR_AM | - ED_RCR_AB | ED_RCR_AR | ED_RCR_SEP | reg1); - } else { - /* set up multicast addresses and filter modes */ - if (ifp->if_flags & IFF_MULTICAST) { - uint32_t mcaf[2]; - - if (ifp->if_flags & IFF_ALLMULTI) { - mcaf[0] = 0xffffffff; - mcaf[1] = 0xffffffff; - } else - ed_ds_getmcaf(sc, mcaf); - - /* - * Set multicast filter on chip. - */ - for (i = 0; i < 8; i++) - ed_nic_outb(sc, ED_P1_MAR(i), ((u_char *) mcaf)[i]); - - /* Set page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_AM | ED_RCR_AB | reg1); - } else { - - /* - * Initialize multicast address hashing registers to - * not accept multicasts. - */ - for (i = 0; i < 8; ++i) - ed_nic_outb(sc, ED_P1_MAR(i), 0x00); - - /* Set page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STP); - - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_AB | reg1); - } - } - - /* - * Start interface. - */ - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); -} - -/* - * Compute the multicast address filter from the - * list of multicast addresses we need to listen to. - */ -static void -ed_ds_getmcaf(struct ed_softc *sc, uint32_t *mcaf) -{ - uint32_t index; - u_char *af = (u_char *) mcaf; - struct ifmultiaddr *ifma; - - mcaf[0] = 0; - mcaf[1] = 0; - - if_maddr_rlock(sc->ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - index = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - af[index >> 3] |= 1 << (index & 7); - } - if_maddr_runlock(sc->ifp); -} - -int -ed_isa_mem_ok(device_t dev, u_long pmem, u_int memsize) -{ - if (pmem < 0xa0000 || pmem + memsize > 0x1000000) { - device_printf(dev, "Invalid ISA memory address range " - "configured: 0x%lx - 0x%lx\n", pmem, pmem + memsize); - return (ENXIO); - } - return (0); -} - -int -ed_clear_memory(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - bus_size_t i; - - bus_space_set_region_1(sc->mem_bst, sc->mem_bsh, sc->mem_start, - 0, sc->mem_size); - - for (i = 0; i < sc->mem_size; i++) { - if (bus_space_read_1(sc->mem_bst, sc->mem_bsh, - sc->mem_start + i)) { - device_printf(dev, "failed to clear shared memory at " - "0x%jx - check configuration\n", - (uintmax_t)rman_get_start(sc->mem_res) + i); - return (ENXIO); - } - } - return (0); -} - -u_short -ed_shmem_write_mbufs(struct ed_softc *sc, struct mbuf *m, bus_size_t dst) -{ - u_short len; - - /* - * Special case setup for 16 bit boards... - */ - if (sc->isa16bit) { - switch (sc->vendor) { -#ifdef ED_3C503 - /* - * For 16bit 3Com boards (which have 16k of - * memory), we have the xmit buffers in a - * different page of memory ('page 0') - so - * change pages. - */ - case ED_VENDOR_3COM: - ed_asic_outb(sc, ED_3COM_GACFR, ED_3COM_GACFR_RSEL); - break; -#endif - /* - * Enable 16bit access to shared memory on - * WD/SMC boards. - * - * XXX - same as ed_enable_16bit_access() - */ - case ED_VENDOR_WD_SMC: - ed_asic_outb(sc, ED_WD_LAAR, - sc->wd_laar_proto | ED_WD_LAAR_M16EN); - if (sc->chip_type == ED_CHIP_TYPE_WD790) - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB); - break; - } - } - for (len = 0; m != NULL; m = m->m_next) { - if (m->m_len == 0) - continue; - if (sc->isa16bit) { - if (m->m_len > 1) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), m->m_len / 2); - if ((m->m_len & 1) != 0) - bus_space_write_1(sc->mem_bst, sc->mem_bsh, - dst + m->m_len - 1, - *(mtod(m, uint8_t *) + m->m_len - 1)); - } else - bus_space_write_region_1(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint8_t *), m->m_len); - dst += m->m_len; - len += m->m_len; - } - - /* - * Restore previous shared memory access - */ - if (sc->isa16bit) { - switch (sc->vendor) { -#ifdef ED_3C503 - case ED_VENDOR_3COM: - ed_asic_outb(sc, ED_3COM_GACFR, - ED_3COM_GACFR_RSEL | ED_3COM_GACFR_MBS0); - break; -#endif - case ED_VENDOR_WD_SMC: - /* XXX - same as ed_disable_16bit_access() */ - if (sc->chip_type == ED_CHIP_TYPE_WD790) - ed_asic_outb(sc, ED_WD_MSR, 0x00); - ed_asic_outb(sc, ED_WD_LAAR, - sc->wd_laar_proto & ~ED_WD_LAAR_M16EN); - break; - } - } - return (len); -} - -/* - * Generic ifmedia support. By default, the DP8390-based cards don't know - * what their network attachment really is, or even if it is valid (except - * upon successful transmission of a packet). To play nicer with dhclient, as - * well as to fit in with a framework where some cards can provde more - * detailed information, make sure that we use this as a fallback. - */ -static int -ed_gen_ifmedia_ioctl(struct ed_softc *sc, struct ifreq *ifr, u_long command) -{ - return (ifmedia_ioctl(sc->ifp, ifr, &sc->ifmedia, command)); -} - -static int -ed_gen_ifmedia_upd(struct ifnet *ifp) -{ - return 0; -} - -static void -ed_gen_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - ifmr->ifm_active = IFM_ETHER | IFM_AUTO; - ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE; -} - -void -ed_gen_ifmedia_init(struct ed_softc *sc) -{ - sc->sc_media_ioctl = &ed_gen_ifmedia_ioctl; - ifmedia_init(&sc->ifmedia, 0, ed_gen_ifmedia_upd, ed_gen_ifmedia_sts); - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_AUTO, 0, 0); - ifmedia_set(&sc->ifmedia, IFM_ETHER | IFM_AUTO); -} diff --git a/sys/dev/ed/if_ed_3c503.c b/sys/dev/ed/if_ed_3c503.c deleted file mode 100644 index c7ff8edf448c..000000000000 --- a/sys/dev/ed/if_ed_3c503.c +++ /dev/null @@ -1,374 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#ifdef ED_3C503 - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_var.h> /* XXX: ed_3c503_mediachg() */ -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> - -static void ed_3c503_mediachg(struct ed_softc *sc); - -/* - * Probe and vendor-specific initialization routine for 3Com 3c503 boards - */ -int -ed_probe_3Com(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int i; - u_int memsize; - u_char isa16bit; - rman_res_t conf_maddr, conf_msize, irq, junk, pmem; - - error = ed_alloc_port(dev, 0, ED_3COM_IO_PORTS); - if (error) - return (error); - - sc->asic_offset = ED_3COM_ASIC_OFFSET; - sc->nic_offset = ED_3COM_NIC_OFFSET; - - /* - * Verify that the kernel configured I/O address matches the board - * configured address - */ - switch (ed_asic_inb(sc, ED_3COM_BCFR)) { - case ED_3COM_BCFR_300: - if (rman_get_start(sc->port_res) != 0x300) - return (ENXIO); - break; - case ED_3COM_BCFR_310: - if (rman_get_start(sc->port_res) != 0x310) - return (ENXIO); - break; - case ED_3COM_BCFR_330: - if (rman_get_start(sc->port_res) != 0x330) - return (ENXIO); - break; - case ED_3COM_BCFR_350: - if (rman_get_start(sc->port_res) != 0x350) - return (ENXIO); - break; - case ED_3COM_BCFR_250: - if (rman_get_start(sc->port_res) != 0x250) - return (ENXIO); - break; - case ED_3COM_BCFR_280: - if (rman_get_start(sc->port_res) != 0x280) - return (ENXIO); - break; - case ED_3COM_BCFR_2A0: - if (rman_get_start(sc->port_res) != 0x2a0) - return (ENXIO); - break; - case ED_3COM_BCFR_2E0: - if (rman_get_start(sc->port_res) != 0x2e0) - return (ENXIO); - break; - default: - return (ENXIO); - } - - error = bus_get_resource(dev, SYS_RES_MEMORY, 0, - &conf_maddr, &conf_msize); - if (error) - return (error); - - /* - * Verify that the kernel shared memory address matches the board - * configured address. - */ - switch (ed_asic_inb(sc, ED_3COM_PCFR)) { - case ED_3COM_PCFR_DC000: - if (conf_maddr != 0xdc000) - return (ENXIO); - break; - case ED_3COM_PCFR_D8000: - if (conf_maddr != 0xd8000) - return (ENXIO); - break; - case ED_3COM_PCFR_CC000: - if (conf_maddr != 0xcc000) - return (ENXIO); - break; - case ED_3COM_PCFR_C8000: - if (conf_maddr != 0xc8000) - return (ENXIO); - break; - default: - return (ENXIO); - } - - - /* - * Reset NIC and ASIC. Enable on-board transceiver throughout reset - * sequence because it'll lock up if the cable isn't connected if we - * don't. - */ - ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_RST | ED_3COM_CR_XSEL); - - /* - * Wait for a while, then un-reset it - */ - DELAY(50); - - /* - * The 3Com ASIC defaults to rather strange settings for the CR after - * a reset - it's important to set it again after the following outb - * (this is done when we map the PROM below). - */ - ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL); - - /* - * Wait a bit for the NIC to recover from the reset - */ - DELAY(5000); - - sc->vendor = ED_VENDOR_3COM; - sc->type_str = "3c503"; - sc->mem_shared = 1; - sc->cr_proto = ED_CR_RD2; - - /* - * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window - * to it. - */ - memsize = 8192; - - /* - * Get station address from on-board ROM - */ - - /* - * First, map ethernet address PROM over the top of where the NIC - * registers normally appear. - */ - ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_EALO | ED_3COM_CR_XSEL); - - for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->enaddr[i] = ed_nic_inb(sc, i); - - /* - * Unmap PROM - select NIC registers. The proper setting of the - * tranceiver is set in ed_init so that the attach code is given a - * chance to set the default based on a compile-time config option - */ - ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL); - - /* - * Determine if this is an 8bit or 16bit board - */ - - /* - * select page 0 registers - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_PAGE_0 | ED_CR_RD2 | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * Attempt to clear WTS bit. If it doesn't clear, then this is a 16bit - * board. - */ - ed_nic_outb(sc, ED_P0_DCR, 0); - - /* - * select page 2 registers - */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_PAGE_2 | ED_CR_RD2 | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* - * The 3c503 forces the WTS bit to a one if this is a 16bit board - */ - if (ed_nic_inb(sc, ED_P2_DCR) & ED_DCR_WTS) - isa16bit = 1; - else - isa16bit = 0; - - /* - * select page 0 registers - */ - ed_nic_outb(sc, ED_P2_CR, ED_CR_RD2 | ED_CR_STP); - - error = ed_alloc_memory(dev, 0, memsize); - if (error) - return (error); - - pmem = rman_get_start(sc->mem_res); - error = ed_isa_mem_ok(dev, pmem, memsize); - if (error) - return (error); - - sc->mem_start = 0; - sc->mem_size = memsize; - sc->mem_end = sc->mem_start + memsize; - - /* - * We have an entire 8k window to put the transmit buffers on the - * 16bit boards. But since the 16bit 3c503's shared memory is only - * fast enough to overlap the loading of one full-size packet, trying - * to load more than 2 buffers can actually leave the transmitter idle - * during the load. So 2 seems the best value. (Although a mix of - * variable-sized packets might change this assumption. Nonetheless, - * we optimize for linear transfers of same-size packets.) - */ - if (isa16bit) { - if (flags & ED_FLAGS_NO_MULTI_BUFFERING) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - - sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_16BIT; - sc->rec_page_start = ED_3COM_RX_PAGE_OFFSET_16BIT; - sc->rec_page_stop = memsize / ED_PAGE_SIZE + - ED_3COM_RX_PAGE_OFFSET_16BIT; - sc->mem_ring = sc->mem_start; - } else { - sc->txb_cnt = 1; - sc->tx_page_start = ED_3COM_TX_PAGE_OFFSET_8BIT; - sc->rec_page_start = ED_TXBUF_SIZE + ED_3COM_TX_PAGE_OFFSET_8BIT; - sc->rec_page_stop = memsize / ED_PAGE_SIZE + - ED_3COM_TX_PAGE_OFFSET_8BIT; - sc->mem_ring = sc->mem_start + (ED_PAGE_SIZE * ED_TXBUF_SIZE); - } - - sc->isa16bit = isa16bit; - - /* - * Initialize GA page start/stop registers. Probably only needed if - * doing DMA, but what the hell. - */ - ed_asic_outb(sc, ED_3COM_PSTR, sc->rec_page_start); - ed_asic_outb(sc, ED_3COM_PSPR, sc->rec_page_stop); - - /* - * Set IRQ. 3c503 only allows a choice of irq 2-5. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); - if (error) - return (error); - - switch (irq) { - case 2: - case 9: - ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ2); - break; - case 3: - ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ3); - break; - case 4: - ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ4); - break; - case 5: - ed_asic_outb(sc, ED_3COM_IDCFR, ED_3COM_IDCFR_IRQ5); - break; - default: - device_printf(dev, "Invalid irq configuration (%jd) must be 3-5,9 for 3c503\n", - irq); - return (ENXIO); - } - - /* - * Initialize GA configuration register. Set bank and enable shared - * mem. - */ - ed_asic_outb(sc, ED_3COM_GACFR, ED_3COM_GACFR_RSEL | - ED_3COM_GACFR_MBS0); - - /* - * Initialize "Vector Pointer" registers. These gawd-awful things are - * compared to 20 bits of the address on ISA, and if they match, the - * shared memory is disabled. We set them to 0xffff0...allegedly the - * reset vector. - */ - ed_asic_outb(sc, ED_3COM_VPTR2, 0xff); - ed_asic_outb(sc, ED_3COM_VPTR1, 0xff); - ed_asic_outb(sc, ED_3COM_VPTR0, 0x00); - - error = ed_clear_memory(dev); - if (error == 0) { - sc->sc_mediachg = ed_3c503_mediachg; - sc->sc_write_mbufs = ed_shmem_write_mbufs; - } - return (error); -} - -static void -ed_3c503_mediachg(struct ed_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - - /* - * If this is a 3Com board, the tranceiver must be software enabled - * (there is no settable hardware default). - */ - if (ifp->if_flags & IFF_LINK2) - ed_asic_outb(sc, ED_3COM_CR, 0); - else - ed_asic_outb(sc, ED_3COM_CR, ED_3COM_CR_XSEL); -} - -#endif /* ED_3C503 */ diff --git a/sys/dev/ed/if_ed_hpp.c b/sys/dev/ed/if_ed_hpp.c deleted file mode 100644 index 282b8e468e14..000000000000 --- a/sys/dev/ed/if_ed_hpp.c +++ /dev/null @@ -1,679 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#ifdef ED_HPP - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_var.h> /* XXX: ed_hpp_set_physical_link() */ -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> - -static void ed_hpp_readmem(struct ed_softc *, bus_size_t, uint8_t *, - uint16_t); -static void ed_hpp_writemem(struct ed_softc *, uint8_t *, uint16_t, - uint16_t); -static void ed_hpp_set_physical_link(struct ed_softc *sc); -static u_short ed_hpp_write_mbufs(struct ed_softc *, struct mbuf *, - bus_size_t); - -/* - * Interrupt conversion table for the HP PC LAN+ - */ -static uint16_t ed_hpp_intr_val[] = { - 0, /* 0 */ - 0, /* 1 */ - 0, /* 2 */ - 3, /* 3 */ - 4, /* 4 */ - 5, /* 5 */ - 6, /* 6 */ - 7, /* 7 */ - 0, /* 8 */ - 9, /* 9 */ - 10, /* 10 */ - 11, /* 11 */ - 12, /* 12 */ - 0, /* 13 */ - 0, /* 14 */ - 15 /* 15 */ -}; - -#define ED_HPP_TEST_SIZE 16 - -/* - * Probe and vendor specific initialization for the HP PC Lan+ Cards. - * (HP Part nos: 27247B and 27252A). - * - * The card has an asic wrapper around a DS8390 core. The asic handles - * host accesses and offers both standard register IO and memory mapped - * IO. Memory mapped I/O allows better performance at the expense of greater - * chance of an incompatibility with existing ISA cards. - * - * The card has a few caveats: it isn't tolerant of byte wide accesses, only - * short (16 bit) or word (32 bit) accesses are allowed. Some card revisions - * don't allow 32 bit accesses; these are indicated by a bit in the software - * ID register (see if_edreg.h). - * - * Other caveats are: we should read the MAC address only when the card - * is inactive. - * - * For more information; please consult the CRYNWR packet driver. - * - * The AUI port is turned on using the "link2" option on the ifconfig - * command line. - */ -int -ed_probe_HP_pclanp(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int n; /* temp var */ - int memsize; /* mem on board */ - u_char checksum; /* checksum of board address */ - u_char irq; /* board configured IRQ */ - uint8_t test_pattern[ED_HPP_TEST_SIZE]; /* read/write areas for */ - uint8_t test_buffer[ED_HPP_TEST_SIZE]; /* probing card */ - rman_res_t conf_maddr, conf_msize, conf_irq, junk; - - error = ed_alloc_port(dev, 0, ED_HPP_IO_PORTS); - if (error) - return (error); - - /* Fill in basic information */ - sc->asic_offset = ED_HPP_ASIC_OFFSET; - sc->nic_offset = ED_HPP_NIC_OFFSET; - - sc->chip_type = ED_CHIP_TYPE_DP8390; - sc->isa16bit = 0; /* the 8390 core needs to be in byte mode */ - - /* - * Look for the HP PCLAN+ signature: "0x50,0x48,0x00,0x53" - */ - - if ((ed_asic_inb(sc, ED_HPP_ID) != 0x50) || - (ed_asic_inb(sc, ED_HPP_ID + 1) != 0x48) || - ((ed_asic_inb(sc, ED_HPP_ID + 2) & 0xF0) != 0) || - (ed_asic_inb(sc, ED_HPP_ID + 3) != 0x53)) - return (ENXIO); - - /* - * Read the MAC address and verify checksum on the address. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_MAC); - for (n = 0, checksum = 0; n < ETHER_ADDR_LEN; n++) - checksum += (sc->enaddr[n] = - ed_asic_inb(sc, ED_HPP_MAC_ADDR + n)); - - checksum += ed_asic_inb(sc, ED_HPP_MAC_ADDR + ETHER_ADDR_LEN); - - if (checksum != 0xFF) - return (ENXIO); - - /* - * Verify that the software model number is 0. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_ID); - if (((sc->hpp_id = ed_asic_inw(sc, ED_HPP_PAGE_4)) & - ED_HPP_ID_SOFT_MODEL_MASK) != 0x0000) - return (ENXIO); - - /* - * Read in and save the current options configured on card. - */ - - sc->hpp_options = ed_asic_inw(sc, ED_HPP_OPTION); - - sc->hpp_options |= (ED_HPP_OPTION_NIC_RESET | - ED_HPP_OPTION_CHIP_RESET | ED_HPP_OPTION_ENABLE_IRQ); - - /* - * Reset the chip. This requires writing to the option register - * so take care to preserve the other bits. - */ - - ed_asic_outw(sc, ED_HPP_OPTION, - (sc->hpp_options & ~(ED_HPP_OPTION_NIC_RESET | - ED_HPP_OPTION_CHIP_RESET))); - - DELAY(5000); /* wait for chip reset to complete */ - - ed_asic_outw(sc, ED_HPP_OPTION, - (sc->hpp_options | (ED_HPP_OPTION_NIC_RESET | - ED_HPP_OPTION_CHIP_RESET | - ED_HPP_OPTION_ENABLE_IRQ))); - - DELAY(5000); - - if (!(ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST)) - return (ENXIO); /* reset did not complete */ - - /* - * Read out configuration information. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW); - - irq = ed_asic_inb(sc, ED_HPP_HW_IRQ); - - /* - * Check for impossible IRQ. - */ - - if (irq >= nitems(ed_hpp_intr_val)) - return (ENXIO); - - /* - * If the kernel IRQ was specified with a '?' use the cards idea - * of the IRQ. If the kernel IRQ was explicitly specified, it - * should match that of the hardware. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - bus_set_resource(dev, SYS_RES_IRQ, 0, ed_hpp_intr_val[irq], 1); - else { - if (conf_irq != ed_hpp_intr_val[irq]) - return (ENXIO); - } - - /* - * Fill in softconfig info. - */ - - sc->vendor = ED_VENDOR_HP; - sc->type = ED_TYPE_HP_PCLANPLUS; - sc->type_str = "HP-PCLAN+"; - - sc->mem_shared = 0; /* we DON'T have dual ported RAM */ - sc->mem_start = 0; /* we use offsets inside the card RAM */ - - sc->hpp_mem_start = NULL;/* no memory mapped I/O by default */ - - /* - * The board has 32KB of memory. Is there a way to determine - * this programmatically? - */ - - memsize = 32768; - - /* - * Check if memory mapping of the I/O registers possible. - */ - if (sc->hpp_options & ED_HPP_OPTION_MEM_ENABLE) { - u_long mem_addr; - - /* - * determine the memory address from the board. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW); - mem_addr = (ed_asic_inw(sc, ED_HPP_HW_MEM_MAP) << 8); - - /* - * Check that the kernel specified start of memory and - * hardware's idea of it match. - */ - error = bus_get_resource(dev, SYS_RES_MEMORY, 0, - &conf_maddr, &conf_msize); - if (error) - return (error); - - if (mem_addr != conf_maddr) - return (ENXIO); - - error = ed_alloc_memory(dev, 0, memsize); - if (error) - return (error); - - sc->hpp_mem_start = rman_get_virtual(sc->mem_res); - } - - /* - * Fill in the rest of the soft config structure. - */ - - /* - * The transmit page index. - */ - - sc->tx_page_start = ED_HPP_TX_PAGE_OFFSET; - - if (device_get_flags(dev) & ED_FLAGS_NO_MULTI_BUFFERING) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - - /* - * Memory description - */ - - sc->mem_size = memsize; - sc->mem_ring = sc->mem_start + - (sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE); - sc->mem_end = sc->mem_start + sc->mem_size; - - /* - * Receive area starts after the transmit area and - * continues till the end of memory. - */ - - sc->rec_page_start = sc->tx_page_start + - (sc->txb_cnt * ED_TXBUF_SIZE); - sc->rec_page_stop = (sc->mem_size / ED_PAGE_SIZE); - - - sc->cr_proto = 0; /* value works */ - - /* - * Set the wrap registers for string I/O reads. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_HW); - ed_asic_outw(sc, ED_HPP_HW_WRAP, - ((sc->rec_page_start / ED_PAGE_SIZE) | - (((sc->rec_page_stop / ED_PAGE_SIZE) - 1) << 8))); - - /* - * Reset the register page to normal operation. - */ - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_PERF); - - /* - * Verify that we can read/write from adapter memory. - * Create test pattern. - */ - - for (n = 0; n < ED_HPP_TEST_SIZE; n++) - test_pattern[n] = (n*n) ^ ~n; - -#undef ED_HPP_TEST_SIZE - - /* - * Check that the memory is accessible thru the I/O ports. - * Write out the contents of "test_pattern", read back - * into "test_buffer" and compare the two for any - * mismatch. - */ - - for (n = 0; n < (32768 / ED_PAGE_SIZE); n ++) { - ed_hpp_writemem(sc, test_pattern, (n * ED_PAGE_SIZE), - sizeof(test_pattern)); - ed_hpp_readmem(sc, (n * ED_PAGE_SIZE), - test_buffer, sizeof(test_pattern)); - - if (bcmp(test_pattern, test_buffer, - sizeof(test_pattern))) - return (ENXIO); - } - - sc->sc_mediachg = ed_hpp_set_physical_link; - sc->sc_write_mbufs = ed_hpp_write_mbufs; - sc->readmem = ed_hpp_readmem; - return (0); -} - -/* - * HP PC Lan+ : Set the physical link to use AUI or TP/TL. - */ - -static void -ed_hpp_set_physical_link(struct ed_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - int lan_page; - - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN); - lan_page = ed_asic_inw(sc, ED_HPP_PAGE_0); - - if (ifp->if_flags & IFF_LINK2) { - /* - * Use the AUI port. - */ - - lan_page |= ED_HPP_LAN_AUI; - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN); - ed_asic_outw(sc, ED_HPP_PAGE_0, lan_page); - } else { - /* - * Use the ThinLan interface - */ - - lan_page &= ~ED_HPP_LAN_AUI; - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_LAN); - ed_asic_outw(sc, ED_HPP_PAGE_0, lan_page); - } - - /* - * Wait for the lan card to re-initialize itself - */ - DELAY(150000); /* wait 150 ms */ - - /* - * Restore normal pages. - */ - ed_asic_outw(sc, ED_HPP_PAGING, ED_HPP_PAGE_PERF); -} - -/* - * Support routines to handle the HP PC Lan+ card. - */ - -/* - * HP PC Lan+: Read from NIC memory, using either PIO or memory mapped - * IO. - */ - -static void -ed_hpp_readmem(struct ed_softc *sc, bus_size_t src, uint8_t *dst, - uint16_t amount) -{ - int use_32bit_access = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); - - /* Program the source address in RAM */ - ed_asic_outw(sc, ED_HPP_PAGE_2, src); - - /* - * The HP PC Lan+ card supports word reads as well as - * a memory mapped i/o port that is aliased to every - * even address on the board. - */ - if (sc->hpp_mem_start) { - /* Enable memory mapped access. */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & - ~(ED_HPP_OPTION_MEM_DISABLE | - ED_HPP_OPTION_BOOT_ROM_ENB)); - - if (use_32bit_access && (amount > 3)) { - uint32_t *dl = (uint32_t *) dst; - volatile uint32_t *const sl = - (uint32_t *) sc->hpp_mem_start; - uint32_t *const fence = dl + (amount >> 2); - - /* - * Copy out NIC data. We could probably write this - * as a `movsl'. The currently generated code is lousy. - */ - while (dl < fence) - *dl++ = *sl; - - dst += (amount & ~3); - amount &= 3; - - } - - /* Finish off any words left, as a series of short reads */ - if (amount > 1) { - u_short *d = (u_short *) dst; - volatile u_short *const s = - (u_short *) sc->hpp_mem_start; - u_short *const fence = d + (amount >> 1); - - /* Copy out NIC data. */ - while (d < fence) - *d++ = *s; - - dst += (amount & ~1); - amount &= 1; - } - - /* - * read in a byte; however we need to always read 16 bits - * at a time or the hardware gets into a funny state - */ - - if (amount == 1) { - /* need to read in a short and copy LSB */ - volatile u_short *const s = - (volatile u_short *) sc->hpp_mem_start; - *dst = (*s) & 0xFF; - } - - /* Restore Boot ROM access. */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options); - } else { - /* Read in data using the I/O port */ - if (use_32bit_access && (amount > 3)) { - ed_asic_insl(sc, ED_HPP_PAGE_4, dst, amount >> 2); - dst += (amount & ~3); - amount &= 3; - } - if (amount > 1) { - ed_asic_insw(sc, ED_HPP_PAGE_4, dst, amount >> 1); - dst += (amount & ~1); - amount &= 1; - } - if (amount == 1) { /* read in a short and keep the LSB */ - *dst = ed_asic_inw(sc, ED_HPP_PAGE_4) & 0xFF; - } - } -} - -/* - * HP PC Lan+: Write to NIC memory, using either PIO or memory mapped - * IO. - * Only used in the probe routine to test the memory. 'len' must - * be even. - */ -static void -ed_hpp_writemem(struct ed_softc *sc, uint8_t *src, uint16_t dst, uint16_t len) -{ - /* reset remote DMA complete flag */ - ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); - - /* program the write address in RAM */ - ed_asic_outw(sc, ED_HPP_PAGE_0, dst); - - if (sc->hpp_mem_start) { - u_short *s = (u_short *) src; - volatile u_short *d = (u_short *) sc->hpp_mem_start; - u_short *const fence = s + (len >> 1); - - /* - * Enable memory mapped access. - */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & - ~(ED_HPP_OPTION_MEM_DISABLE | - ED_HPP_OPTION_BOOT_ROM_ENB)); - - /* - * Copy to NIC memory. - */ - while (s < fence) - *d = *s++; - - /* - * Restore Boot ROM access. - */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options); - } else { - /* write data using I/O writes */ - ed_asic_outsw(sc, ED_HPP_PAGE_4, src, len / 2); - } -} - -/* - * Write to HP PC Lan+ NIC memory. Access to the NIC can be by using - * outsw() or via the memory mapped interface to the same register. - * Writes have to be in word units; byte accesses won't work and may cause - * the NIC to behave weirdly. Long word accesses are permitted if the ASIC - * allows it. - */ - -static u_short -ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, bus_size_t dst) -{ - int len, wantbyte; - unsigned short total_len; - unsigned char savebyte[2]; - volatile u_short * const d = - (volatile u_short *) sc->hpp_mem_start; - int use_32bit_accesses = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); - - /* select page 0 registers */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_STA); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - /* reset remote DMA complete flag */ - ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); - - /* program the write address in RAM */ - ed_asic_outw(sc, ED_HPP_PAGE_0, dst); - - if (sc->hpp_mem_start) /* enable memory mapped I/O */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options & - ~(ED_HPP_OPTION_MEM_DISABLE | - ED_HPP_OPTION_BOOT_ROM_ENB)); - - wantbyte = 0; - total_len = 0; - - if (sc->hpp_mem_start) { /* Memory mapped I/O port */ - while (m) { - total_len += (len = m->m_len); - if (len) { - caddr_t data = mtod(m, caddr_t); - /* finish the last word of the previous mbuf */ - if (wantbyte) { - savebyte[1] = *data; - *d = *((u_short *) savebyte); - data++; len--; wantbyte = 0; - } - /* output contiguous words */ - if ((len > 3) && (use_32bit_accesses)) { - volatile uint32_t *const dl = - (volatile uint32_t *) d; - uint32_t *sl = (uint32_t *) data; - uint32_t *fence = sl + (len >> 2); - - while (sl < fence) - *dl = *sl++; - - data += (len & ~3); - len &= 3; - } - /* finish off remain 16 bit writes */ - if (len > 1) { - u_short *s = (u_short *) data; - u_short *fence = s + (len >> 1); - - while (s < fence) - *d = *s++; - - data += (len & ~1); - len &= 1; - } - /* save last byte if needed */ - if ((wantbyte = (len == 1)) != 0) - savebyte[0] = *data; - } - m = m->m_next; /* to next mbuf */ - } - if (wantbyte) /* write last byte */ - *d = *((u_short *) savebyte); - } else { - /* use programmed I/O */ - while (m) { - total_len += (len = m->m_len); - if (len) { - caddr_t data = mtod(m, caddr_t); - /* finish the last word of the previous mbuf */ - if (wantbyte) { - savebyte[1] = *data; - ed_asic_outw(sc, ED_HPP_PAGE_4, - *((u_short *)savebyte)); - data++; - len--; - wantbyte = 0; - } - /* output contiguous words */ - if ((len > 3) && use_32bit_accesses) { - ed_asic_outsl(sc, ED_HPP_PAGE_4, - data, len >> 2); - data += (len & ~3); - len &= 3; - } - /* finish off remaining 16 bit accesses */ - if (len > 1) { - ed_asic_outsw(sc, ED_HPP_PAGE_4, - data, len >> 1); - data += (len & ~1); - len &= 1; - } - if ((wantbyte = (len == 1)) != 0) - savebyte[0] = *data; - - } /* if len != 0 */ - m = m->m_next; - } - if (wantbyte) /* spit last byte */ - ed_asic_outw(sc, ED_HPP_PAGE_4, *(u_short *)savebyte); - - } - - if (sc->hpp_mem_start) /* turn off memory mapped i/o */ - ed_asic_outw(sc, ED_HPP_OPTION, sc->hpp_options); - - return (total_len); -} - -#endif /* ED_HPP */ diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c deleted file mode 100644 index 7cf15817a0ba..000000000000 --- a/sys/dev/ed/if_ed_isa.c +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/socket.h> -#include <sys/kernel.h> - -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_media.h> -#include <net/if_mib.h> - -#include <isa/isavar.h> - -#include <dev/ed/if_edvar.h> -#include <dev/ed/if_edreg.h> - -static int ed_isa_probe(device_t); -static int ed_isa_attach(device_t); - -static struct isa_pnp_id ed_ids[] = { - { 0x0131d805, NULL }, /* ANX3101 */ - { 0x4cf48906, NULL }, /* ATIf44c */ - { 0x01200507, NULL }, /* AXE2001 */ - { 0x0115180e, NULL }, /* CPX1501 */ - { 0x0090252a, NULL }, /* JQE9000 */ - { 0x0020832e, NULL }, /* KTC2000 */ - { 0xd680d041, NULL }, /* PNP80d6 */ - { 0x6081d041, NULL }, /* PNP8160 */ - { 0x19808c4a, NULL }, /* RTL8019 */ - { 0x1684a34d, NULL }, /* SMC8416 */ - { 0x1980635e, NULL }, /* WSC8019 */ - { 0, NULL } -}; - -static int -ed_isa_probe_Novell(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - int flags = device_get_flags(dev); - int err; - - err = ed_probe_Novell(dev, 0, flags); - if (err) - return err; - ed_Novell_read_mac(sc); - /* - * Final sanity check for Gateway Ethernet cards before - * believing that they really are Gateway AT. - * XXX I think this is stale. - */ - if ((ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) && - (sc->enaddr[2] == 0x86)) { - sc->type_str = "Gateway AT"; - } - - return (0); -} - -static int -ed_isa_probe(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - int flags = device_get_flags(dev); - int error = 0; - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); - - /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) - goto end; - - /* If we had some other problem. */ - if (!(error == 0 || error == ENOENT)) - goto end; - - /* Heuristic probes */ - - error = ed_probe_WD80x3(dev, 0, flags); - if (error == 0) - goto end; - ed_release_resources(dev); - - error = ed_probe_RTL80x9(dev, 0, flags); - if (error == 0) { - ed_Novell_read_mac(sc); - goto end; - } - ed_release_resources(dev); - -#ifdef ED_3C503 - error = ed_probe_3Com(dev, 0, flags); - if (error == 0) - goto end; - ed_release_resources(dev); -#endif - -#ifdef ED_SIC - error = ed_probe_SIC(dev, 0, flags); - if (error == 0) - goto end; - ed_release_resources(dev); -#endif - error = ed_isa_probe_Novell(dev); - if (error == 0) - goto end; - ed_release_resources(dev); - -#ifdef ED_HPP - error = ed_probe_HP_pclanp(dev, 0, flags); - if (error == 0) - goto end; - ed_release_resources(dev); -#endif -end: - if (error == 0) - error = ed_alloc_irq(dev, 0, 0); - - ed_release_resources(dev); - return (error); -} - -static int -ed_isa_attach(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - - if (sc->port_used > 0) - ed_alloc_port(dev, 0, sc->port_used); - if (sc->mem_used) - ed_alloc_memory(dev, 0, sc->mem_used); - ed_alloc_irq(dev, 0, 0); - - if (sc->sc_media_ioctl == NULL) - ed_gen_ifmedia_init(sc); - error = ed_attach(dev); - if (error) { - ed_release_resources(dev); - return (error); - } - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, edintr, sc, &sc->irq_handle); - if (error) - ed_release_resources(dev); - return (error); -} - -static device_method_t ed_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ed_isa_probe), - DEVMETHOD(device_attach, ed_isa_attach), - DEVMETHOD(device_detach, ed_detach), - - { 0, 0 } -}; - -static driver_t ed_isa_driver = { - "ed", - ed_isa_methods, - sizeof(struct ed_softc) -}; - -DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0); -MODULE_DEPEND(ed, isa, 1, 1, 1); -MODULE_DEPEND(ed, ether, 1, 1, 1); -ISA_PNP_INFO(ed_ids); diff --git a/sys/dev/ed/if_ed_novell.c b/sys/dev/ed/if_ed_novell.c deleted file mode 100644 index 5ef196bb4049..000000000000 --- a/sys/dev/ed/if_ed_novell.c +++ /dev/null @@ -1,316 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> - -static int ed_probe_gwether(device_t); - -/* - * Probe and vendor-specific initialization routine for NE1000/2000 boards - */ -int -ed_probe_Novell_generic(device_t dev, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - u_int memsize; - int error; - u_char tmp; - static char test_pattern[32] = "THIS is A memory TEST pattern"; - char test_buffer[32]; - - /* Reset the board */ - if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) { - ed_asic_outb(sc, ED_NOVELL_RESET, 0); - DELAY(200); - } - tmp = ed_asic_inb(sc, ED_NOVELL_RESET); - - /* - * I don't know if this is necessary; probably cruft leftover from - * Clarkson packet driver code. Doesn't do a thing on the boards I've - * tested. -DG - */ - ed_asic_outb(sc, ED_NOVELL_RESET, tmp); - DELAY(5000); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); - - /* Make sure that we really have an 8390 based board */ - if (!ed_probe_generic8390(sc)) - return (ENXIO); - - sc->vendor = ED_VENDOR_NOVELL; - sc->mem_shared = 0; - sc->cr_proto = ED_CR_RD2; - - /* - * Test the ability to read and write to the NIC memory. This has the - * side affect of determining if this is an NE1000 or an NE2000. - */ - - /* - * This prevents packets from being stored in the NIC memory when the - * readmem routine turns on the start bit in the CR. - */ - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); - - /* Temporarily initialize DCR for byte operations */ - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS); - - ed_nic_outb(sc, ED_P0_PSTART, 8192 / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, 16384 / ED_PAGE_SIZE); - - /* - * Some devices identify themselves. Some of those devices - * can't handle being probed, so we allow forcing a mode. If - * these flags are set, force it, otherwise probe. - */ - if (flags & ED_FLAGS_FORCE_8BIT_MODE) { - sc->isa16bit = 0; - sc->type = ED_TYPE_NE1000; - sc->type_str = "NE1000"; - } else if (flags & ED_FLAGS_FORCE_16BIT_MODE) { - sc->isa16bit = 1; - sc->type = ED_TYPE_NE2000; - sc->type_str = "NE2000"; - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - ed_nic_outb(sc, ED_P0_PSTART, 16384 / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, 32768 / ED_PAGE_SIZE); - } else { - /* - * Write a test pattern in byte mode. If this fails, then there - * probably isn't any memory at 8k - which likely means that the board - * is an NE2000. - */ - ed_pio_writemem(sc, test_pattern, 8192, sizeof(test_pattern)); - ed_pio_readmem(sc, 8192, test_buffer, sizeof(test_pattern)); - - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { - sc->type = ED_TYPE_NE1000; - sc->type_str = "NE1000"; - sc->isa16bit = 0; - } else { - /* Not an NE1000 - try NE2000 */ - sc->isa16bit = 1; - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - ed_nic_outb(sc, ED_P0_PSTART, 16384 / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, 32768 / ED_PAGE_SIZE); - /* - * Write a test pattern in word mode. If this also fails, then - * we don't know what this board is. - */ - ed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern)); - ed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern)); - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { - sc->type = ED_TYPE_NE2000; - sc->type_str = "NE2000"; - } else { - return (ENXIO); - } - } - } - sc->chip_type = ED_CHIP_TYPE_DP8390; - - /* 8k of memory plus an additional 8k if 16bit */ - memsize = 8192 + sc->isa16bit * 8192; - sc->mem_size = memsize; - - /* NIC memory doesn't start at zero on an NE board */ - /* The start address is tied to the bus width */ - sc->mem_start = 8192 + sc->isa16bit * 8192; - sc->mem_end = sc->mem_start + memsize; - sc->tx_page_start = memsize / ED_PAGE_SIZE; - - if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_GWETHER) { - error = ed_probe_gwether(dev); - if (error) - return (error); - } - - /* - * Use one xmit buffer if < 16k, two buffers otherwise (if not told - * otherwise). - */ - if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - - sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; - sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - /* clear any pending interrupts that might have occurred above */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - - sc->sc_write_mbufs = ed_pio_write_mbufs; - return (0); -} - -int -ed_probe_Novell(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - - error = ed_alloc_port(dev, port_rid, ED_NOVELL_IO_PORTS); - if (error) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - return ed_probe_Novell_generic(dev, flags); -} - -static int -ed_probe_gwether(device_t dev) -{ - int x, i, msize = 0; - bus_size_t mstart = 0; - char pbuf0[ED_PAGE_SIZE], pbuf[ED_PAGE_SIZE], tbuf[ED_PAGE_SIZE]; - struct ed_softc *sc = device_get_softc(dev); - - for (i = 0; i < ED_PAGE_SIZE; i++) - pbuf0[i] = 0; - - /* Clear all the memory. */ - for (x = 1; x < 256; x++) - ed_pio_writemem(sc, pbuf0, x * 256, ED_PAGE_SIZE); - - /* Search for the start of RAM. */ - for (x = 1; x < 256; x++) { - ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE); - if (bcmp(pbuf0, tbuf, ED_PAGE_SIZE) == 0) { - for (i = 0; i < ED_PAGE_SIZE; i++) - pbuf[i] = 255 - x; - ed_pio_writemem(sc, pbuf, x * 256, ED_PAGE_SIZE); - ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE); - if (bcmp(pbuf, tbuf, ED_PAGE_SIZE) == 0) { - mstart = x * ED_PAGE_SIZE; - msize = ED_PAGE_SIZE; - break; - } - } - } - if (mstart == 0) { - device_printf(dev, "Cannot find start of RAM.\n"); - return (ENXIO); - } - - /* Probe the size of RAM. */ - for (x = (mstart / ED_PAGE_SIZE) + 1; x < 256; x++) { - ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE); - if (bcmp(pbuf0, tbuf, ED_PAGE_SIZE) == 0) { - for (i = 0; i < ED_PAGE_SIZE; i++) - pbuf[i] = 255 - x; - ed_pio_writemem(sc, pbuf, x * 256, ED_PAGE_SIZE); - ed_pio_readmem(sc, x * 256, tbuf, ED_PAGE_SIZE); - if (bcmp(pbuf, tbuf, ED_PAGE_SIZE) == 0) - msize += ED_PAGE_SIZE; - else { - break; - } - } else { - break; - } - } - - if (msize == 0) { - device_printf(dev, - "Cannot find any RAM, start : %d, x = %d.\n", - (int)mstart, x); - return (ENXIO); - } - if (bootverbose) - device_printf(dev, - "RAM start at %d, size : %d.\n", (int)mstart, msize); - - sc->mem_size = msize; - sc->mem_start = mstart; - sc->mem_end = msize + mstart; - sc->tx_page_start = mstart / ED_PAGE_SIZE; - return 0; -} - -void -ed_Novell_read_mac(struct ed_softc *sc) -{ - int n; - uint8_t romdata[16]; - - /* - * Most ne1000/ne2000 compatible cards have their MAC address - * located in the first few words of the address space. This seems - * universally true for ISA and PCI implementations, but PC Card - * devices seem to have more variance. - */ - ed_pio_readmem(sc, 0, romdata, 16); - for (n = 0; n < ETHER_ADDR_LEN; n++) - sc->enaddr[n] = romdata[n * (sc->isa16bit + 1)]; -} diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c deleted file mode 100644 index bda04352df9f..000000000000 --- a/sys/dev/ed/if_ed_pccard.c +++ /dev/null @@ -1,1253 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -/* - * Notes for adding media support. Each chipset is somewhat different - * from the others. Linux has a table of OIDs that it uses to see what - * supports the misc register of the NS83903. But a sampling of datasheets - * I could dig up on cards I own paints a different picture. - * - * Chipset specific details: - * NS 83903/902A paired - * ccr base 0x1020 - * id register at 0x1000: 7-3 = 0, 2-0 = 1. - * (maybe this test is too week) - * misc register at 0x018: - * 6 WAIT_TOUTENABLE enable watchdog timeout - * 3 AUI/TPI 1 AUX, 0 TPI - * 2 loopback - * 1 gdlink (tpi mode only) 1 tp good, 0 tp bad - * 0 0-no mam, 1 mam connected - * - * NS83926 appears to be a NS pcmcia glue chip used on the IBM Ethernet II - * and the NEC PC9801N-J12 ccr base 0x2000! - * - * winbond 289c926 - * ccr base 0xfd0 - * cfb (am 0xff2): - * 0-1 PHY01 00 TPI, 01 10B2, 10 10B5, 11 TPI (reduced squ) - * 2 LNKEN 0 - enable link and auto switch, 1 disable - * 3 LNKSTS TPI + LNKEN=0 + link good == 1, else 0 - * sr (am 0xff4) - * 88 00 88 00 88 00, etc - * - * TMI tc3299a (cr PHY01 == 0) - * ccr base 0x3f8 - * cra (io 0xa) - * crb (io 0xb) - * 0-1 PHY01 00 auto, 01 res, 10 10B5, 11 TPI - * 2 GDLINK 1 disable checking of link - * 6 LINK 0 bad link, 1 good link - * - * EN5017A, EN5020 no data, but very popular - * Other chips? - * NetBSD supports RTL8019, but none have surfaced that I can see - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/socket.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_var.h> -#include <net/if_arp.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> -#include <dev/ed/ax88x90reg.h> -#include <dev/ed/dl100xxreg.h> -#include <dev/ed/tc5299jreg.h> -#include <dev/pccard/pccardvar.h> -#include <dev/pccard/pccardreg.h> -#include <dev/pccard/pccard_cis.h> -#include <dev/mii/mii.h> -#include <dev/mii/miivar.h> - -#include "card_if.h" -/* "device miibus" required. See GENERIC if you get errors here. */ -#include "miibus_if.h" -#include "pccarddevs.h" - -/* - * NE-2000 based PC Cards have a number of ways to get the MAC address. - * Some cards encode this as a FUNCE. Others have this in the ROMs the - * same way that ISA cards do. Some have it encoded in the attribute - * memory somewhere that isn't in the CIS. Some new chipsets have it - * in special registers in the ASIC part of the chip. - * - * For those cards that have the MAC adress stored in attribute memory - * outside of a FUNCE entry in the CIS, nearly all of them have it at - * a fixed offset (0xff0). We use that offset as a source of last - * resource if other offsets have failed. This is the address of the - * National Semiconductor DP83903A, which is the only chip's datasheet - * I've found. - */ -#define ED_DEFAULT_MAC_OFFSET 0xff0 - -static const struct ed_product { - struct pccard_product prod; - int flags; -#define NE2000DVF_DL100XX 0x0001 /* chip is D-Link DL10019/22 */ -#define NE2000DVF_AX88X90 0x0002 /* chip is ASIX AX88[17]90 */ -#define NE2000DVF_TC5299J 0x0004 /* chip is Tamarack TC5299J */ -#define NE2000DVF_TOSHIBA 0x0008 /* Toshiba DP83902A */ -#define NE2000DVF_ENADDR 0x0100 /* Get MAC from attr mem */ -#define NE2000DVF_ANYFUNC 0x0200 /* Allow any function type */ -#define NE2000DVF_MODEM 0x0400 /* Has a modem/serial */ - int enoff; -} ed_pccard_products[] = { - { PCMCIA_CARD(ACCTON, EN2212), 0}, - { PCMCIA_CARD(ACCTON, EN2216), 0}, - { PCMCIA_CARD(ALLIEDTELESIS, LA_PCM), 0}, - { PCMCIA_CARD(AMBICOM, AMB8002), 0}, - { PCMCIA_CARD(AMBICOM, AMB8002T), 0}, - { PCMCIA_CARD(AMBICOM, AMB8010), 0}, - { PCMCIA_CARD(AMBICOM, AMB8010_ALT), 0}, - { PCMCIA_CARD(AMBICOM, AMB8610), 0}, - { PCMCIA_CARD(BILLIONTON, CFLT10N), 0}, - { PCMCIA_CARD(BILLIONTON, LNA100B), NE2000DVF_AX88X90}, - { PCMCIA_CARD(BILLIONTON, LNT10TB), 0}, - { PCMCIA_CARD(BILLIONTON, LNT10TN), 0}, - { PCMCIA_CARD(BROMAX, AXNET), NE2000DVF_AX88X90}, - { PCMCIA_CARD(BROMAX, IPORT), 0}, - { PCMCIA_CARD(BROMAX, IPORT2), 0}, - { PCMCIA_CARD(BUFFALO, LPC2_CLT), 0}, - { PCMCIA_CARD(BUFFALO, LPC3_CLT), 0}, - { PCMCIA_CARD(BUFFALO, LPC3_CLX), NE2000DVF_AX88X90}, - { PCMCIA_CARD(BUFFALO, LPC4_TX), NE2000DVF_AX88X90}, - { PCMCIA_CARD(BUFFALO, LPC4_CLX), NE2000DVF_AX88X90}, - { PCMCIA_CARD(BUFFALO, LPC_CF_CLT), 0}, - { PCMCIA_CARD(CNET, NE2000), 0}, - { PCMCIA_CARD(COMPEX, AX88190), NE2000DVF_AX88X90}, - { PCMCIA_CARD(COMPEX, LANMODEM), 0}, - { PCMCIA_CARD(COMPEX, LINKPORT_ENET_B), 0}, - { PCMCIA_CARD(COREGA, ETHER_II_PCC_T), 0}, - { PCMCIA_CARD(COREGA, ETHER_II_PCC_TD), 0}, - { PCMCIA_CARD(COREGA, ETHER_PCC_T), 0}, - { PCMCIA_CARD(COREGA, ETHER_PCC_TD), 0}, - { PCMCIA_CARD(COREGA, FAST_ETHER_PCC_TX), NE2000DVF_DL100XX}, - { PCMCIA_CARD(COREGA, FETHER_PCC_TXD), NE2000DVF_AX88X90}, - { PCMCIA_CARD(COREGA, FETHER_PCC_TXF), NE2000DVF_DL100XX}, - { PCMCIA_CARD(COREGA, FETHER_II_PCC_TXD), NE2000DVF_AX88X90}, - { PCMCIA_CARD(COREGA, LAPCCTXD), 0}, - { PCMCIA_CARD(DAYNA, COMMUNICARD_E_1), 0}, - { PCMCIA_CARD(DAYNA, COMMUNICARD_E_2), 0}, - { PCMCIA_CARD(DLINK, DE650), NE2000DVF_ANYFUNC }, - { PCMCIA_CARD(DLINK, DE660), 0 }, - { PCMCIA_CARD(DLINK, DE660PLUS), 0}, - { PCMCIA_CARD(DYNALINK, L10C), 0}, - { PCMCIA_CARD(EDIMAX, EP4000A), 0}, - { PCMCIA_CARD(EPSON, EEN10B), 0}, - { PCMCIA_CARD(EXP, THINLANCOMBO), 0}, - { PCMCIA_CARD(GLOBALVILLAGE, LANMODEM), 0}, - { PCMCIA_CARD(GREY_CELL, TDK3000), 0}, - { PCMCIA_CARD(GREY_CELL, DMF650TX), - NE2000DVF_ANYFUNC | NE2000DVF_DL100XX | NE2000DVF_MODEM}, - { PCMCIA_CARD(GVC, NIC_2000P), 0}, - { PCMCIA_CARD(IBM, HOME_AND_AWAY), 0}, - { PCMCIA_CARD(IBM, INFOMOVER), 0}, - { PCMCIA_CARD(IODATA3, PCLAT), 0}, - { PCMCIA_CARD(KINGSTON, CIO10T), 0}, - { PCMCIA_CARD(KINGSTON, KNE2), 0}, - { PCMCIA_CARD(LANTECH, FASTNETTX), NE2000DVF_AX88X90}, - /* Same ID for many different cards, including generic NE2000 */ - { PCMCIA_CARD(LINKSYS, COMBO_ECARD), - NE2000DVF_DL100XX | NE2000DVF_AX88X90}, - { PCMCIA_CARD(LINKSYS, ECARD_1), 0}, - { PCMCIA_CARD(LINKSYS, ECARD_2), 0}, - { PCMCIA_CARD(LINKSYS, ETHERFAST), NE2000DVF_DL100XX}, - { PCMCIA_CARD(LINKSYS, TRUST_COMBO_ECARD), 0}, - { PCMCIA_CARD(MACNICA, ME1_JEIDA), 0}, - { PCMCIA_CARD(MAGICRAM, ETHER), 0}, - { PCMCIA_CARD(MELCO, LPC3_CLX), NE2000DVF_AX88X90}, - { PCMCIA_CARD(MELCO, LPC3_TX), NE2000DVF_AX88X90}, - { PCMCIA_CARD(MELCO2, LPC2_T), 0}, - { PCMCIA_CARD(MELCO2, LPC2_TX), 0}, - { PCMCIA_CARD(MITSUBISHI, B8895), NE2000DVF_ANYFUNC}, /* NG */ - { PCMCIA_CARD(MICRORESEARCH, MR10TPC), 0}, - { PCMCIA_CARD(NDC, ND5100_E), 0}, - { PCMCIA_CARD(NETGEAR, FA410TXC), NE2000DVF_DL100XX}, - /* Same ID as DLINK DFE-670TXD. 670 has DL10022, fa411 has ax88790 */ - { PCMCIA_CARD(NETGEAR, FA411), NE2000DVF_AX88X90 | NE2000DVF_DL100XX}, - { PCMCIA_CARD(NEXTCOM, NEXTHAWK), 0}, - { PCMCIA_CARD(NEWMEDIA, LANSURFER), NE2000DVF_ANYFUNC}, - { PCMCIA_CARD(NEWMEDIA, LIVEWIRE), 0}, - { PCMCIA_CARD(OEM2, 100BASE), NE2000DVF_AX88X90}, - { PCMCIA_CARD(OEM2, ETHERNET), 0}, - { PCMCIA_CARD(OEM2, FAST_ETHERNET), NE2000DVF_AX88X90}, - { PCMCIA_CARD(OEM2, NE2000), 0}, - { PCMCIA_CARD(PLANET, SMARTCOM2000), 0 }, - { PCMCIA_CARD(PREMAX, PE200), 0}, - { PCMCIA_CARD(PSION, LANGLOBAL), - NE2000DVF_ANYFUNC | NE2000DVF_AX88X90 | NE2000DVF_MODEM}, - { PCMCIA_CARD(RACORE, ETHERNET), 0}, - { PCMCIA_CARD(RACORE, FASTENET), NE2000DVF_AX88X90}, - { PCMCIA_CARD(RACORE, 8041TX), NE2000DVF_AX88X90 | NE2000DVF_TC5299J}, - { PCMCIA_CARD(RELIA, COMBO), 0}, - { PCMCIA_CARD(RIOS, PCCARD3), 0}, - { PCMCIA_CARD(RPTI, EP400), 0}, - { PCMCIA_CARD(RPTI, EP401), 0}, - { PCMCIA_CARD(SMC, EZCARD), 0}, - { PCMCIA_CARD(SOCKET, EA_ETHER), 0}, - { PCMCIA_CARD(SOCKET, ES_1000), 0}, - { PCMCIA_CARD(SOCKET, LP_ETHER), 0}, - { PCMCIA_CARD(SOCKET, LP_ETHER_CF), 0}, - { PCMCIA_CARD(SOCKET, LP_ETH_10_100_CF), NE2000DVF_DL100XX}, - { PCMCIA_CARD(SVEC, COMBOCARD), 0}, - { PCMCIA_CARD(SVEC, LANCARD), 0}, - { PCMCIA_CARD(TAMARACK, ETHERNET), 0}, - { PCMCIA_CARD(TDK, CFE_10), 0}, - { PCMCIA_CARD(TDK, LAK_CD031), 0}, - { PCMCIA_CARD(TDK, DFL5610WS), 0}, - { PCMCIA_CARD(TELECOMDEVICE, LM5LT), 0 }, - { PCMCIA_CARD(TELECOMDEVICE, TCD_HPC100), NE2000DVF_AX88X90}, - { PCMCIA_CARD(TJ, PTJ_LAN_T), 0 }, - { PCMCIA_CARD(TOSHIBA2, LANCT00A), NE2000DVF_ANYFUNC | NE2000DVF_TOSHIBA}, - { PCMCIA_CARD(ZONET, ZEN), 0}, - { { NULL } } -}; - -/* - * MII bit-bang glue - */ -static uint32_t ed_pccard_dl100xx_mii_bitbang_read(device_t dev); -static void ed_pccard_dl100xx_mii_bitbang_write(device_t dev, uint32_t val); - -static const struct mii_bitbang_ops ed_pccard_dl100xx_mii_bitbang_ops = { - ed_pccard_dl100xx_mii_bitbang_read, - ed_pccard_dl100xx_mii_bitbang_write, - { - ED_DL100XX_MII_DATAOUT, /* MII_BIT_MDO */ - ED_DL100XX_MII_DATAIN, /* MII_BIT_MDI */ - ED_DL100XX_MII_CLK, /* MII_BIT_MDC */ - ED_DL100XX_MII_DIROUT, /* MII_BIT_DIR_HOST_PHY */ - 0 /* MII_BIT_DIR_PHY_HOST */ - } -}; - -static uint32_t ed_pccard_ax88x90_mii_bitbang_read(device_t dev); -static void ed_pccard_ax88x90_mii_bitbang_write(device_t dev, uint32_t val); - -static const struct mii_bitbang_ops ed_pccard_ax88x90_mii_bitbang_ops = { - ed_pccard_ax88x90_mii_bitbang_read, - ed_pccard_ax88x90_mii_bitbang_write, - { - ED_AX88X90_MII_DATAOUT, /* MII_BIT_MDO */ - ED_AX88X90_MII_DATAIN, /* MII_BIT_MDI */ - ED_AX88X90_MII_CLK, /* MII_BIT_MDC */ - 0, /* MII_BIT_DIR_HOST_PHY */ - ED_AX88X90_MII_DIRIN /* MII_BIT_DIR_PHY_HOST */ - } -}; - -static uint32_t ed_pccard_tc5299j_mii_bitbang_read(device_t dev); -static void ed_pccard_tc5299j_mii_bitbang_write(device_t dev, uint32_t val); - -static const struct mii_bitbang_ops ed_pccard_tc5299j_mii_bitbang_ops = { - ed_pccard_tc5299j_mii_bitbang_read, - ed_pccard_tc5299j_mii_bitbang_write, - { - ED_TC5299J_MII_DATAOUT, /* MII_BIT_MDO */ - ED_TC5299J_MII_DATAIN, /* MII_BIT_MDI */ - ED_TC5299J_MII_CLK, /* MII_BIT_MDC */ - 0, /* MII_BIT_DIR_HOST_PHY */ - ED_AX88X90_MII_DIRIN /* MII_BIT_DIR_PHY_HOST */ - } -}; - -/* - * PC Card (PCMCIA) specific code. - */ -static int ed_pccard_probe(device_t); -static int ed_pccard_attach(device_t); -static void ed_pccard_tick(struct ed_softc *); - -static int ed_pccard_dl100xx(device_t dev, const struct ed_product *); -static void ed_pccard_dl100xx_mii_reset(struct ed_softc *sc); - -static int ed_pccard_ax88x90(device_t dev, const struct ed_product *); - -static int ed_miibus_readreg(device_t dev, int phy, int reg); -static int ed_ifmedia_upd(struct ifnet *); -static void ed_ifmedia_sts(struct ifnet *, struct ifmediareq *); - -static int ed_pccard_tc5299j(device_t dev, const struct ed_product *); - -static void -ed_pccard_print_entry(const struct ed_product *pp) -{ - int i; - - printf("Product entry: "); - if (pp->prod.pp_name) - printf("name='%s',", pp->prod.pp_name); - printf("vendor=%#x,product=%#x", pp->prod.pp_vendor, - pp->prod.pp_product); - for (i = 0; i < 4; i++) - if (pp->prod.pp_cis[i]) - printf(",CIS%d='%s'", i, pp->prod.pp_cis[i]); - printf("\n"); -} - -static int -ed_pccard_probe(device_t dev) -{ - const struct ed_product *pp, *pp2; - int error, first = 1; - 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 ((pp = (const struct ed_product *) pccard_product_lookup(dev, - (const struct pccard_product *) ed_pccard_products, - sizeof(ed_pccard_products[0]), NULL)) != NULL) { - if (pp->prod.pp_name != NULL) - device_set_desc(dev, pp->prod.pp_name); - /* - * Some devices don't ID themselves as network, but - * that's OK if the flags say so. - */ - if (!(pp->flags & NE2000DVF_ANYFUNC) && - fcn != PCCARD_FUNCTION_NETWORK) - return (ENXIO); - /* - * Some devices match multiple entries. Report that - * as a warning to help cull the table - */ - pp2 = pp; - while ((pp2 = (const struct ed_product *)pccard_product_lookup( - dev, (const struct pccard_product *)(pp2 + 1), - sizeof(ed_pccard_products[0]), NULL)) != NULL) { - if (first) { - device_printf(dev, - "Warning: card matches multiple entries. Report to imp@freebsd.org\n"); - ed_pccard_print_entry(pp); - first = 0; - } - ed_pccard_print_entry(pp2); - } - - return (0); - } - return (ENXIO); -} - -static int -ed_pccard_rom_mac(device_t dev, uint8_t *enaddr) -{ - struct ed_softc *sc = device_get_softc(dev); - uint8_t romdata[32], sum; - int i; - - /* - * Read in the rom data at location 0. Since there are no - * NE-1000 based PC Card devices, we'll assume we're 16-bit. - * - * In researching what format this takes, I've found that the - * following appears to be true for multiple cards based on - * observation as well as datasheet digging. - * - * Data is stored in some ROM and is copied out 8 bits at a time - * into 16-bit wide locations. This means that the odd locations - * of the ROM are not used (and can be either 0 or ff). - * - * The contents appears to be as follows: - * PROM RAM - * Offset Offset What - * 0 0 ENETADDR 0 - * 1 2 ENETADDR 1 - * 2 4 ENETADDR 2 - * 3 6 ENETADDR 3 - * 4 8 ENETADDR 4 - * 5 10 ENETADDR 5 - * 6-13 12-26 Reserved (varies by manufacturer) - * 14 28 0x57 - * 15 30 0x57 - * - * Some manufacturers have another image of enetaddr from - * PROM offset 0x10 to 0x15 with 0x42 in 0x1e and 0x1f, but - * this doesn't appear to be universally documented in the - * datasheets. Some manufactuers have a card type, card config - * checksums, etc encoded into PROM offset 6-13, but deciphering it - * requires more knowledge about the exact underlying chipset than - * we possess (and maybe can possess). - */ - ed_pio_readmem(sc, 0, romdata, 32); - if (bootverbose) - device_printf(dev, "ROM DATA: %32D\n", romdata, " "); - if (romdata[28] != 0x57 || romdata[30] != 0x57) - return (0); - for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) - sum |= romdata[i * 2]; - if (sum == 0) - return (0); - for (i = 0; i < ETHER_ADDR_LEN; i++) - enaddr[i] = romdata[i * 2]; - return (1); -} - -static int -ed_pccard_add_modem(device_t dev) -{ - device_printf(dev, "Need to write this code\n"); - return 0; -} - -static int -ed_pccard_kick_phy(struct ed_softc *sc) -{ - struct mii_softc *miisc; - struct mii_data *mii; - - mii = device_get_softc(sc->miibus); - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) - PHY_RESET(miisc); - return (mii_mediachg(mii)); -} - -static int -ed_pccard_media_ioctl(struct ed_softc *sc, struct ifreq *ifr, u_long command) -{ - struct mii_data *mii; - - if (sc->miibus == NULL) - return (EINVAL); - mii = device_get_softc(sc->miibus); - return (ifmedia_ioctl(sc->ifp, ifr, &mii->mii_media, command)); -} - - -static void -ed_pccard_mediachg(struct ed_softc *sc) -{ - struct mii_data *mii; - - if (sc->miibus == NULL) - return; - mii = device_get_softc(sc->miibus); - mii_mediachg(mii); -} - -static int -ed_pccard_attach(device_t dev) -{ - u_char sum; - u_char enaddr[ETHER_ADDR_LEN]; - const struct ed_product *pp; - int error, i, flags, port_rid, modem_rid; - struct ed_softc *sc = device_get_softc(dev); - u_long size; - static uint16_t *intr_vals[] = {NULL, NULL}; - - sc->dev = dev; - if ((pp = (const struct ed_product *) pccard_product_lookup(dev, - (const struct pccard_product *) ed_pccard_products, - sizeof(ed_pccard_products[0]), NULL)) == NULL) { - printf("Can't find\n"); - return (ENXIO); - } - modem_rid = port_rid = -1; - if (pp->flags & NE2000DVF_MODEM) { - for (i = 0; i < 4; i++) { - size = bus_get_resource_count(dev, SYS_RES_IOPORT, i); - if (size == ED_NOVELL_IO_PORTS) - port_rid = i; - else if (size == 8) - modem_rid = i; - } - if (port_rid == -1) { - device_printf(dev, "Cannot locate my ports!\n"); - return (ENXIO); - } - } else { - port_rid = 0; - } - /* Allocate the port resource during setup. */ - error = ed_alloc_port(dev, port_rid, ED_NOVELL_IO_PORTS); - if (error) { - printf("alloc_port failed\n"); - return (error); - } - if (rman_get_size(sc->port_res) == ED_NOVELL_IO_PORTS / 2) { - port_rid++; - sc->port_res2 = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &port_rid, RF_ACTIVE); - if (sc->port_res2 == NULL || - rman_get_size(sc->port_res2) != ED_NOVELL_IO_PORTS / 2) { - error = ENXIO; - goto bad; - } - } - error = ed_alloc_irq(dev, 0, 0); - if (error) - goto bad; - - /* - * Determine which chipset we are. Almost all the PC Card chipsets - * have the Novel ASIC and NIC offsets. There's 2 known cards that - * follow the WD80x3 conventions, which are handled as a special case. - */ - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - error = ENXIO; - flags = device_get_flags(dev); - if (error != 0) - error = ed_pccard_dl100xx(dev, pp); - if (error != 0) - error = ed_pccard_ax88x90(dev, pp); - if (error != 0) - error = ed_pccard_tc5299j(dev, pp); - if (error != 0) { - error = ed_probe_Novell_generic(dev, flags); - printf("Novell generic probe failed: %d\n", error); - } - if (error != 0 && (pp->flags & NE2000DVF_TOSHIBA)) { - flags |= ED_FLAGS_TOSH_ETHER; - flags |= ED_FLAGS_PCCARD; - sc->asic_offset = ED_WD_ASIC_OFFSET; - sc->nic_offset = ED_WD_NIC_OFFSET; - error = ed_probe_WD80x3_generic(dev, flags, intr_vals); - } - if (error) - goto bad; - - /* - * There are several ways to get the MAC address for the card. - * Some of the above probe routines can fill in the enaddr. If - * not, we run through a number of 'well known' locations: - * (1) From the PC Card FUNCE - * (2) From offset 0 in the shared memory - * (3) From a hinted offset in attribute memory - * (4) From 0xff0 in attribute memory - * If we can't get a non-zero MAC address from this list, we fail. - */ - for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) - sum |= sc->enaddr[i]; - if (sum == 0) { - pccard_get_ether(dev, enaddr); - if (bootverbose) - device_printf(dev, "CIS MAC %6D\n", enaddr, ":"); - for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) - sum |= enaddr[i]; - if (sum == 0 && ed_pccard_rom_mac(dev, enaddr)) { - if (bootverbose) - device_printf(dev, "ROM mac %6D\n", enaddr, - ":"); - sum++; - } - if (sum == 0 && pp->flags & NE2000DVF_ENADDR) { - for (i = 0; i < ETHER_ADDR_LEN; i++) { - pccard_attr_read_1(dev, pp->enoff + i * 2, - enaddr + i); - sum |= enaddr[i]; - } - if (bootverbose) - device_printf(dev, "Hint %x MAC %6D\n", - pp->enoff, enaddr, ":"); - } - if (sum == 0) { - for (i = 0; i < ETHER_ADDR_LEN; i++) { - pccard_attr_read_1(dev, ED_DEFAULT_MAC_OFFSET + - i * 2, enaddr + i); - sum |= enaddr[i]; - } - if (bootverbose) - device_printf(dev, "Fallback MAC %6D\n", - enaddr, ":"); - } - if (sum == 0) { - device_printf(dev, "Cannot extract MAC address.\n"); - ed_release_resources(dev); - return (ENXIO); - } - bcopy(enaddr, sc->enaddr, ETHER_ADDR_LEN); - } - - error = ed_attach(dev); - if (error) - goto bad; - if (sc->chip_type == ED_CHIP_TYPE_DL10019 || - sc->chip_type == ED_CHIP_TYPE_DL10022) { - /* Try to attach an MII bus, but ignore errors. */ - ed_pccard_dl100xx_mii_reset(sc); - (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, - ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, MIIF_FORCEANEG); - } else if (sc->chip_type == ED_CHIP_TYPE_AX88190 || - sc->chip_type == ED_CHIP_TYPE_AX88790 || - sc->chip_type == ED_CHIP_TYPE_TC5299J) { - error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, - ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, - MII_OFFSET_ANY, MIIF_FORCEANEG); - if (error != 0) { - device_printf(dev, "attaching PHYs failed\n"); - goto bad; - } - } - if (sc->miibus != NULL) { - sc->sc_tick = ed_pccard_tick; - sc->sc_mediachg = ed_pccard_mediachg; - sc->sc_media_ioctl = ed_pccard_media_ioctl; - ed_pccard_kick_phy(sc); - } else { - ed_gen_ifmedia_init(sc); - } - if (modem_rid != -1) - ed_pccard_add_modem(dev); - - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, edintr, sc, &sc->irq_handle); - if (error) { - device_printf(dev, "setup intr failed %d \n", error); - goto bad; - } - - return (0); -bad: - ed_detach(dev); - return (error); -} - -/* - * Probe the Ethernet MAC addrees for PCMCIA Linksys EtherFast 10/100 - * and compatible cards (DL10019C Ethernet controller). - */ -static int -ed_pccard_dl100xx(device_t dev, const struct ed_product *pp) -{ - struct ed_softc *sc = device_get_softc(dev); - u_char sum; - uint8_t id; - u_int memsize; - int i, error; - - if (!(pp->flags & NE2000DVF_DL100XX)) - return (ENXIO); - if (bootverbose) - device_printf(dev, "Trying DL100xx\n"); - error = ed_probe_Novell_generic(dev, device_get_flags(dev)); - if (bootverbose && error) - device_printf(dev, "Novell generic probe failed: %d\n", error); - if (error != 0) - return (error); - - /* - * Linksys registers(offset from ASIC base) - * - * 0x04-0x09 : Physical Address Register 0-5 (PAR0-PAR5) - * 0x0A : Card ID Register (CIR) - * 0x0B : Check Sum Register (SR) - */ - for (sum = 0, i = 0x04; i < 0x0c; i++) - sum += ed_asic_inb(sc, i); - if (sum != 0xff) { - if (bootverbose) - device_printf(dev, "Bad checksum %#x\n", sum); - return (ENXIO); /* invalid DL10019C */ - } - if (bootverbose) - device_printf(dev, "CIR is %d\n", ed_asic_inb(sc, 0xa)); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sc->enaddr[i] = ed_asic_inb(sc, 0x04 + i); - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - id = ed_asic_inb(sc, 0xf); - sc->isa16bit = 1; - /* - * Hard code values based on the datasheet. We're NE-2000 compatible - * NIC with 24kb of packet memory starting at 24k offset. These - * cards also work with 16k at 16k, but don't work with 24k at 16k - * or 32k at 16k. - */ - sc->type = ED_TYPE_NE2000; - sc->mem_start = 24 * 1024; - memsize = sc->mem_size = 24 * 1024; - sc->mem_end = sc->mem_start + memsize; - sc->tx_page_start = memsize / ED_PAGE_SIZE; - sc->txb_cnt = 3; - sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; - sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - ed_nic_outb(sc, ED_P0_PSTART, sc->mem_start / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, sc->mem_end / ED_PAGE_SIZE); - sc->vendor = ED_VENDOR_NOVELL; - sc->chip_type = (id & 0x90) == 0x90 ? - ED_CHIP_TYPE_DL10022 : ED_CHIP_TYPE_DL10019; - sc->type_str = ((id & 0x90) == 0x90) ? "DL10022" : "DL10019"; - sc->mii_bitbang_ops = &ed_pccard_dl100xx_mii_bitbang_ops; - return (0); -} - -/* MII bit-twiddling routines for cards using Dlink chipset */ - -static void -ed_pccard_dl100xx_mii_reset(struct ed_softc *sc) -{ - if (sc->chip_type != ED_CHIP_TYPE_DL10022) - return; - - ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL10022_MII_RESET2); - DELAY(10); - ed_asic_outb(sc, ED_DL100XX_MIIBUS, - ED_DL10022_MII_RESET2 | ED_DL10022_MII_RESET1); - DELAY(10); - ed_asic_outb(sc, ED_DL100XX_MIIBUS, ED_DL10022_MII_RESET2); - DELAY(10); - ed_asic_outb(sc, ED_DL100XX_MIIBUS, - ED_DL10022_MII_RESET2 | ED_DL10022_MII_RESET1); - DELAY(10); - ed_asic_outb(sc, ED_DL100XX_MIIBUS, 0); -} - -static void -ed_pccard_dl100xx_mii_bitbang_write(device_t dev, uint32_t val) -{ - struct ed_softc *sc; - - sc = device_get_softc(dev); - - ed_asic_outb(sc, ED_DL100XX_MIIBUS, val); - ed_asic_barrier(sc, ED_DL100XX_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); -} - -static uint32_t -ed_pccard_dl100xx_mii_bitbang_read(device_t dev) -{ - struct ed_softc *sc; - uint32_t val; - - sc = device_get_softc(dev); - - val = ed_asic_inb(sc, ED_DL100XX_MIIBUS); - ed_asic_barrier(sc, ED_DL100XX_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (val); -} - -static void -ed_pccard_ax88x90_reset(struct ed_softc *sc) -{ - int i; - - /* Reset Card */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP | ED_CR_PAGE_0); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_asic_outb(sc, ED_NOVELL_RESET, ed_asic_inb(sc, ED_NOVELL_RESET)); - - /* Wait for the RST bit to assert, but cap it at 10ms */ - for (i = 10000; !(ed_nic_inb(sc, ED_P0_ISR) & ED_ISR_RST) && i > 0; - i--) - continue; - ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RST); /* ACK INTR */ - if (i == 0) - device_printf(sc->dev, "Reset didn't finish\n"); -} - -/* - * Probe and vendor-specific initialization routine for ax88x90 boards - */ -static int -ed_probe_ax88x90_generic(device_t dev, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - u_int memsize; - static char test_pattern[32] = "THIS is A memory TEST pattern"; - char test_buffer[32]; - - ed_pccard_ax88x90_reset(sc); - DELAY(10*1000); - - /* Make sure that we really have an 8390 based board */ - if (!ed_probe_generic8390(sc)) - return (ENXIO); - - sc->vendor = ED_VENDOR_NOVELL; - sc->mem_shared = 0; - sc->cr_proto = ED_CR_RD2; - - /* - * This prevents packets from being stored in the NIC memory when the - * readmem routine turns on the start bit in the CR. We write some - * bytes in word mode and verify we can read them back. If we can't - * then we don't have an AX88x90 chip here. - */ - sc->isa16bit = 1; - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - ed_pio_writemem(sc, test_pattern, 16384, sizeof(test_pattern)); - ed_pio_readmem(sc, 16384, test_buffer, sizeof(test_pattern)); - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) != 0) - return (ENXIO); - - /* - * Hard code values based on the datasheet. We're NE-2000 compatible - * NIC with 16kb of packet memory starting at 16k offset. - */ - sc->type = ED_TYPE_NE2000; - memsize = sc->mem_size = 16*1024; - sc->mem_start = 16 * 1024; - if (ed_asic_inb(sc, ED_AX88X90_TEST) != 0) - sc->chip_type = ED_CHIP_TYPE_AX88790; - else { - sc->chip_type = ED_CHIP_TYPE_AX88190; - /* - * The AX88190 (not A) has external 64k SRAM. Probe for this - * here. Most of the cards I have either use the AX88190A - * part, or have only 32k SRAM for some reason, so I don't - * know if this works or not. - */ - ed_pio_writemem(sc, test_pattern, 32768, sizeof(test_pattern)); - ed_pio_readmem(sc, 32768, test_buffer, sizeof(test_pattern)); - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern)) == 0) { - sc->mem_start = 2*1024; - memsize = sc->mem_size = 62 * 1024; - } - } - sc->mem_end = sc->mem_start + memsize; - sc->tx_page_start = memsize / ED_PAGE_SIZE; - if (sc->mem_size > 16 * 1024) - sc->txb_cnt = 3; - else - sc->txb_cnt = 2; - sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; - sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - ed_nic_outb(sc, ED_P0_PSTART, sc->mem_start / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, sc->mem_end / ED_PAGE_SIZE); - - /* Get the mac before we go -- It's just at 0x400 in "SRAM" */ - ed_pio_readmem(sc, 0x400, sc->enaddr, ETHER_ADDR_LEN); - - /* clear any pending interrupts that might have occurred above */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - sc->sc_write_mbufs = ed_pio_write_mbufs; - return (0); -} - -static int -ed_pccard_ax88x90_check_mii(device_t dev, struct ed_softc *sc) -{ - int i, id; - - /* - * All AX88x90 devices have MII and a PHY, so we use this to weed out - * chips that would otherwise make it through the tests we have after - * this point. - */ - for (i = 0; i < 32; i++) { - id = ed_miibus_readreg(dev, i, MII_BMSR); - if (id != 0 && id != 0xffff) - break; - } - /* - * Found one, we're good. - */ - if (i != 32) - return (0); - /* - * Didn't find anything, so try to power up and try again. The PHY - * may be not responding because we're in power down mode. - */ - if (sc->chip_type == ED_CHIP_TYPE_AX88190) - return (ENXIO); - pccard_ccr_write_1(dev, PCCARD_CCR_STATUS, PCCARD_CCR_STATUS_PWRDWN); - for (i = 0; i < 32; i++) { - id = ed_miibus_readreg(dev, i, MII_BMSR); - if (id != 0 && id != 0xffff) - break; - } - /* - * Still no joy? We're AFU, punt. - */ - if (i == 32) - return (ENXIO); - return (0); -} - -/* - * Special setup for AX88[17]90 - */ -static int -ed_pccard_ax88x90(device_t dev, const struct ed_product *pp) -{ - int error; - int iobase; - struct ed_softc *sc = device_get_softc(dev); - - if (!(pp->flags & NE2000DVF_AX88X90)) - return (ENXIO); - - if (bootverbose) - device_printf(dev, "Checking AX88x90\n"); - - /* - * Set the IOBASE Register. The AX88x90 cards are potentially - * multifunction cards, and thus requires a slight workaround. - * We write the address the card is at, on the off chance that this - * card is not MFC. - * XXX I'm not sure that this is still needed... - */ - iobase = rman_get_start(sc->port_res); - pccard_ccr_write_1(dev, PCCARD_CCR_IOBASE0, iobase & 0xff); - pccard_ccr_write_1(dev, PCCARD_CCR_IOBASE1, (iobase >> 8) & 0xff); - - error = ed_probe_ax88x90_generic(dev, device_get_flags(dev)); - if (error) { - if (bootverbose) - device_printf(dev, "probe ax88x90 failed %d\n", - error); - return (error); - } - sc->mii_bitbang_ops = &ed_pccard_ax88x90_mii_bitbang_ops; - error = ed_pccard_ax88x90_check_mii(dev, sc); - if (error) - return (error); - sc->vendor = ED_VENDOR_NOVELL; - sc->type = ED_TYPE_NE2000; - if (sc->chip_type == ED_CHIP_TYPE_AX88190) - sc->type_str = "AX88190"; - else - sc->type_str = "AX88790"; - return (0); -} - -static void -ed_pccard_ax88x90_mii_bitbang_write(device_t dev, uint32_t val) -{ - struct ed_softc *sc; - - sc = device_get_softc(dev); - - ed_asic_outb(sc, ED_AX88X90_MIIBUS, val); - ed_asic_barrier(sc, ED_AX88X90_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); -} - -static uint32_t -ed_pccard_ax88x90_mii_bitbang_read(device_t dev) -{ - struct ed_softc *sc; - uint32_t val; - - sc = device_get_softc(dev); - - val = ed_asic_inb(sc, ED_AX88X90_MIIBUS); - ed_asic_barrier(sc, ED_AX88X90_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (val); -} - -/* - * Special setup for TC5299J - */ -static int -ed_pccard_tc5299j(device_t dev, const struct ed_product *pp) -{ - int error, i, id; - char *ts; - struct ed_softc *sc = device_get_softc(dev); - - if (!(pp->flags & NE2000DVF_TC5299J)) - return (ENXIO); - - if (bootverbose) - device_printf(dev, "Checking Tc5299j\n"); - - error = ed_probe_Novell_generic(dev, device_get_flags(dev)); - if (bootverbose) - device_printf(dev, "Novell generic probe failed: %d\n", error); - if (error != 0) - return (error); - - /* - * Check to see if we have a MII PHY ID at any address. All TC5299J - * devices have MII and a PHY, so we use this to weed out chips that - * would otherwise make it through the tests we have after this point. - */ - sc->mii_bitbang_ops = &ed_pccard_tc5299j_mii_bitbang_ops; - for (i = 0; i < 32; i++) { - id = ed_miibus_readreg(dev, i, MII_PHYIDR1); - if (id != 0 && id != 0xffff) - break; - } - if (i == 32) - return (ENXIO); - ts = "TC5299J"; - if (ed_pccard_rom_mac(dev, sc->enaddr) == 0) - return (ENXIO); - sc->vendor = ED_VENDOR_NOVELL; - sc->type = ED_TYPE_NE2000; - sc->chip_type = ED_CHIP_TYPE_TC5299J; - sc->type_str = ts; - return (0); -} - -static void -ed_pccard_tc5299j_mii_bitbang_write(device_t dev, uint32_t val) -{ - struct ed_softc *sc; - - sc = device_get_softc(dev); - - /* We are already on page 3. */ - ed_nic_outb(sc, ED_TC5299J_MIIBUS, val); - ed_nic_barrier(sc, ED_TC5299J_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); -} - -static uint32_t -ed_pccard_tc5299j_mii_bitbang_read(device_t dev) -{ - struct ed_softc *sc; - uint32_t val; - - sc = device_get_softc(dev); - - /* We are already on page 3. */ - val = ed_asic_inb(sc, ED_TC5299J_MIIBUS); - ed_nic_barrier(sc, ED_TC5299J_MIIBUS, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - return (val); -} - -/* - * MII bus support routines. - */ -static int -ed_miibus_readreg(device_t dev, int phy, int reg) -{ - struct ed_softc *sc; - int val; - uint8_t cr = 0; - - sc = device_get_softc(dev); - /* - * The AX88790 has an interesting quirk. It has an internal phy that - * needs a special bit set to access, but can also have additional - * external PHYs set for things like HomeNET media. When accessing - * the internal PHY, a bit has to be set, when accessing the external - * PHYs, it must be clear. See Errata 1, page 51, in the AX88790 - * datasheet for more details. - * - * Also, PHYs above 16 appear to be phantoms on some cards, but not - * others. Registers read for this are often the same as prior values - * read. Filter all register requests to 17-31. - */ - if (sc->chip_type == ED_CHIP_TYPE_AX88790) { - if (phy > 0x10) - return (0); - if (phy == 0x10) - ed_asic_outb(sc, ED_AX88X90_GPIO, - ED_AX88X90_GPIO_INT_PHY); - else - ed_asic_outb(sc, ED_AX88X90_GPIO, 0); - ed_asic_barrier(sc, ED_AX88X90_GPIO, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { - /* Select page 3. */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - cr = ed_nic_inb(sc, ED_P0_CR); - ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } - val = mii_bitbang_readreg(dev, sc->mii_bitbang_ops, phy, reg); - if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { - /* Restore prior page. */ - ed_nic_outb(sc, ED_P0_CR, cr); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } - return (val); -} - -static int -ed_miibus_writereg(device_t dev, int phy, int reg, int data) -{ - struct ed_softc *sc; - uint8_t cr = 0; - - sc = device_get_softc(dev); - /* See ed_miibus_readreg for details */ - if (sc->chip_type == ED_CHIP_TYPE_AX88790) { - if (phy > 0x10) - return (0); - if (phy == 0x10) - ed_asic_outb(sc, ED_AX88X90_GPIO, - ED_AX88X90_GPIO_INT_PHY); - else - ed_asic_outb(sc, ED_AX88X90_GPIO, 0); - ed_asic_barrier(sc, ED_AX88X90_GPIO, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { - /* Select page 3. */ - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - cr = ed_nic_inb(sc, ED_P0_CR); - ed_nic_outb(sc, ED_P0_CR, cr | ED_CR_PAGE_3); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } - mii_bitbang_writereg(dev, sc->mii_bitbang_ops, phy, reg, data); - if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { - /* Restore prior page. */ - ed_nic_outb(sc, ED_P0_CR, cr); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - } - return (0); -} - -static int -ed_ifmedia_upd(struct ifnet *ifp) -{ - struct ed_softc *sc; - int error; - - sc = ifp->if_softc; - ED_LOCK(sc); - if (sc->miibus == NULL) { - ED_UNLOCK(sc); - return (ENXIO); - } - - error = ed_pccard_kick_phy(sc); - ED_UNLOCK(sc); - return (error); -} - -static void -ed_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - struct ed_softc *sc; - struct mii_data *mii; - - sc = ifp->if_softc; - ED_LOCK(sc); - if (sc->miibus == NULL) { - ED_UNLOCK(sc); - return; - } - - mii = device_get_softc(sc->miibus); - mii_pollstat(mii); - ifmr->ifm_active = mii->mii_media_active; - ifmr->ifm_status = mii->mii_media_status; - ED_UNLOCK(sc); -} - -static void -ed_child_detached(device_t dev, device_t child) -{ - struct ed_softc *sc; - - sc = device_get_softc(dev); - if (child == sc->miibus) - sc->miibus = NULL; -} - -static void -ed_pccard_tick(struct ed_softc *sc) -{ - struct mii_data *mii; - int media = 0; - - ED_ASSERT_LOCKED(sc); - if (sc->miibus != NULL) { - mii = device_get_softc(sc->miibus); - media = mii->mii_media_status; - mii_tick(mii); - if (mii->mii_media_status & IFM_ACTIVE && - media != mii->mii_media_status) { - if (sc->chip_type == ED_CHIP_TYPE_DL10022) { - ed_asic_outb(sc, ED_DL10022_DIAG, - (mii->mii_media_active & IFM_FDX) ? - ED_DL10022_COLLISON_DIS : 0); -#ifdef notyet - } else if (sc->chip_type == ED_CHIP_TYPE_DL10019) { - write_asic(sc, ED_DL10019_MAGIC, - (mii->mii_media_active & IFM_FDX) ? - DL19FDUPLX : 0); -#endif - } - } - - } -} - -static device_method_t ed_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ed_pccard_probe), - DEVMETHOD(device_attach, ed_pccard_attach), - DEVMETHOD(device_detach, ed_detach), - - /* Bus interface */ - DEVMETHOD(bus_child_detached, ed_child_detached), - - /* MII interface */ - DEVMETHOD(miibus_readreg, ed_miibus_readreg), - DEVMETHOD(miibus_writereg, ed_miibus_writereg), - - DEVMETHOD_END -}; - -static driver_t ed_pccard_driver = { - "ed", - ed_pccard_methods, - sizeof(struct ed_softc) -}; - -DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, NULL); -DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, NULL); -MODULE_DEPEND(ed, miibus, 1, 1, 1); -MODULE_DEPEND(ed, ether, 1, 1, 1); -PCCARD_PNP_INFO(ed_pccard_products); diff --git a/sys/dev/ed/if_ed_pci.c b/sys/dev/ed/if_ed_pci.c deleted file mode 100644 index 8ada958abcbe..000000000000 --- a/sys/dev/ed/if_ed_pci.c +++ /dev/null @@ -1,149 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1996 Stefan Esser <se@freebsd.org> - * 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 immediately at the beginning of the file, without modification, - * 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. Absolutely no warranty of function or purpose is made by the author - * Stefan Esser. - * 4. Modifications may be freely made to this file if the above conditions - * are met. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/socket.h> -#include <sys/kernel.h> - -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_media.h> -#include <net/if_mib.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> - -#include <dev/ed/if_edvar.h> -#include <dev/ed/rtl80x9reg.h> - -static struct _pcsid -{ - uint32_t type; - const char *desc; -} pci_ids[] = -{ - { 0x140111f6, "Compex RL2000" }, - { 0x005812c3, "Holtek HT80232" }, - { 0x30008e2e, "KTI ET32P2" }, - { 0x50004a14, "NetVin NV5000SC" }, - { 0x09401050, "ProLAN" }, - { ED_RTL8029_PCI_ID, "RealTek 8029" }, /* Needs realtek full duplex */ - { 0x0e3410bd, "Surecom NE-34" }, - { 0x09261106, "VIA VT86C926" }, - { 0x19808c4a, "Winbond W89C940" }, - { 0x5a5a1050, "Winbond W89C940F" }, -#if 0 - /* some Holtek needs special lovin', disabled by default */ - /* The Holtek can report/do full duplex, but that's unimplemented */ - { 0x559812c3, "Holtek HT80229" }, /* Only 32-bit I/O, Holtek fdx, STOP_PG_60? */ -#endif - { 0x00000000, NULL } -}; - -static int ed_pci_probe(device_t); -static int ed_pci_attach(device_t); - -static int -ed_pci_probe(device_t dev) -{ - uint32_t type = pci_get_devid(dev); - struct _pcsid *ep =pci_ids; - - while (ep->type && ep->type != type) - ++ep; - if (ep->desc == NULL) - return (ENXIO); - device_set_desc(dev, ep->desc); - return (BUS_PROBE_DEFAULT); -} - -static int -ed_pci_attach(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - int error = ENXIO; - - /* - * Probe RTL8029 cards, but allow failure and try as a generic - * ne-2000. QEMU 0.9 and earlier use the RTL8029 PCI ID, but - * are areally just generic ne-2000 cards. - */ - if (pci_get_devid(dev) == ED_RTL8029_PCI_ID) - error = ed_probe_RTL80x9(dev, PCIR_BAR(0), 0); - if (error) - error = ed_probe_Novell(dev, PCIR_BAR(0), - ED_FLAGS_FORCE_16BIT_MODE); - if (error) { - ed_release_resources(dev); - return (error); - } - ed_Novell_read_mac(sc); - - error = ed_alloc_irq(dev, 0, RF_SHAREABLE); - if (error) { - ed_release_resources(dev); - return (error); - } - if (sc->sc_media_ioctl == NULL) - ed_gen_ifmedia_init(sc); - error = ed_attach(dev); - if (error) { - ed_release_resources(dev); - return (error); - } - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, edintr, sc, &sc->irq_handle); - if (error) - ed_release_resources(dev); - return (error); -} - -static device_method_t ed_pci_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ed_pci_probe), - DEVMETHOD(device_attach, ed_pci_attach), - DEVMETHOD(device_detach, ed_detach), - - { 0, 0 } -}; - -static driver_t ed_pci_driver = { - "ed", - ed_pci_methods, - sizeof(struct ed_softc), -}; - -DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0); -MODULE_DEPEND(ed, pci, 1, 1, 1); -MODULE_DEPEND(ed, ether, 1, 1, 1); -MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids, - nitems(pci_ids) - 1); diff --git a/sys/dev/ed/if_ed_rtl80x9.c b/sys/dev/ed/if_ed_rtl80x9.c deleted file mode 100644 index 3f160d05c4ad..000000000000 --- a/sys/dev/ed/if_ed_rtl80x9.c +++ /dev/null @@ -1,227 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003, David Madole - * All rights reserved. - * Copyright (c) 2005, M. Warner Losh. - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * Based on patches subitted by: David Madole, edited by M. Warner Losh. - */ - - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_var.h> -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> -#include <dev/ed/rtl80x9reg.h> - -static int ed_rtl_set_media(struct ifnet *ifp); -static void ed_rtl_get_media(struct ifnet *ifp, struct ifmediareq *); - -static int -ed_rtl80x9_media_ioctl(struct ed_softc *sc, struct ifreq *ifr, u_long command) -{ - return (ifmedia_ioctl(sc->ifp, ifr, &sc->ifmedia, command)); -} - -int -ed_probe_RTL80x9(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - char *ts; - int error; - - if ((error = ed_alloc_port(dev, port_rid, ED_NOVELL_IO_PORTS))) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - if (ed_nic_inb(sc, ED_P0_CR) & (ED_CR_PS0 | ED_CR_PS1)) - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - - if (ed_nic_inb(sc, ED_RTL80X9_80X9ID0) != ED_RTL80X9_ID0) - return (ENXIO); - - switch (ed_nic_inb(sc, ED_RTL80X9_80X9ID1)) { - case ED_RTL8019_ID1: - sc->chip_type = ED_CHIP_TYPE_RTL8019; - ts = "RTL8019"; - break; - case ED_RTL8029_ID1: - sc->chip_type = ED_CHIP_TYPE_RTL8029; - ts = "RTL8029"; - break; - default: - return (ENXIO); - } - - if ((error = ed_probe_Novell_generic(dev, flags))) - return (error); - - sc->type_str = ts; - sc->sc_media_ioctl = &ed_rtl80x9_media_ioctl; - ifmedia_init(&sc->ifmedia, 0, ed_rtl_set_media, ed_rtl_get_media); - - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX, 0, 0); - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T, 0, 0); - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_2, 0, 0); - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_5, 0, 0); - ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_AUTO, 0, 0); - - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_PAGE_3 | ED_CR_STP); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - switch (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) & ED_RTL80X9_CF2_MEDIA) { - case ED_RTL80X9_CF2_AUTO: - ifmedia_set(&sc->ifmedia, IFM_ETHER | IFM_AUTO); - break; - case ED_RTL80X9_CF2_10_5: - ifmedia_set(&sc->ifmedia, IFM_ETHER | IFM_10_5); - break; - case ED_RTL80X9_CF2_10_2: - ifmedia_set(&sc->ifmedia, IFM_ETHER | IFM_10_2); - break; - case ED_RTL80X9_CF2_10_T: - ifmedia_set(&sc->ifmedia, IFM_ETHER | IFM_10_T | - ((ed_nic_inb(sc, ED_RTL80X9_CONFIG3) - & ED_RTL80X9_CF3_FUDUP) ? IFM_FDX : 0)); - break; - } - return (0); -} - -static int -ed_rtl_set_media(struct ifnet *ifp) -{ - struct ed_softc *sc; - - sc = ifp->if_softc; - ED_LOCK(sc); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_3 - | (ed_nic_inb(sc, ED_P0_CR) & (ED_CR_STA | ED_CR_STP))); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - switch(IFM_SUBTYPE(sc->ifmedia.ifm_cur->ifm_media)) { - case IFM_10_T: - ed_nic_outb(sc, ED_RTL80X9_CONFIG2, ED_RTL80X9_CF2_10_T - | (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) - & ~ED_RTL80X9_CF2_MEDIA)); - break; - case IFM_10_2: - ed_nic_outb(sc, ED_RTL80X9_CONFIG2, ED_RTL80X9_CF2_10_2 - | (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) - & ~ED_RTL80X9_CF2_MEDIA)); - break; - case IFM_10_5: - ed_nic_outb(sc, ED_RTL80X9_CONFIG2, ED_RTL80X9_CF2_10_5 - | (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) - & ~ED_RTL80X9_CF2_MEDIA)); - break; - case IFM_AUTO: - ed_nic_outb(sc, ED_RTL80X9_CONFIG2, ED_RTL80X9_CF2_AUTO - | (ed_nic_inb(sc, ED_RTL80X9_CONFIG2) - & ~ED_RTL80X9_CF2_MEDIA)); - break; - } - ed_nic_outb(sc, ED_RTL80X9_CONFIG3, - (sc->ifmedia.ifm_cur->ifm_media & IFM_FDX) ? - (ed_nic_inb(sc, ED_RTL80X9_CONFIG3) | ED_RTL80X9_CF3_FUDUP) : - (ed_nic_inb(sc, ED_RTL80X9_CONFIG3) & ~ED_RTL80X9_CF3_FUDUP)); - - ED_UNLOCK(sc); - return (0); -} - -static void -ed_rtl_get_media(struct ifnet *ifp, struct ifmediareq *imr) -{ - struct ed_softc *sc; - - sc = ifp->if_softc; - imr->ifm_active = sc->ifmedia.ifm_cur->ifm_media; - - - if (IFM_SUBTYPE(imr->ifm_active) == IFM_AUTO) { - ED_LOCK(sc); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - ed_nic_outb(sc, ED_P0_CR, sc->cr_proto | ED_CR_PAGE_3 | - (ed_nic_inb(sc, ED_P0_CR) & (ED_CR_STA | ED_CR_STP))); - ed_nic_barrier(sc, ED_P0_CR, 1, - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - - switch (ed_nic_inb(sc, ED_RTL80X9_CONFIG0) - & (sc->chip_type == ED_CHIP_TYPE_RTL8029 ? ED_RTL80X9_CF0_BNC - : (ED_RTL80X9_CF0_AUI | ED_RTL80X9_CF0_BNC))) { - case ED_RTL80X9_CF0_BNC: - imr->ifm_active |= IFM_10_2; - break; - case ED_RTL80X9_CF0_AUI: - imr->ifm_active |= IFM_10_5; - break; - default: - imr->ifm_active |= IFM_10_T; - break; - } - ED_UNLOCK(sc); - } - imr->ifm_status = 0; -} - diff --git a/sys/dev/ed/if_ed_sic.c b/sys/dev/ed/if_ed_sic.c deleted file mode 100644 index 0a1965407734..000000000000 --- a/sys/dev/ed/if_ed_sic.c +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#ifdef ED_SIC -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> - -/* - * Probe and vendor-specific initialization routine for SIC boards - */ -int -ed_probe_SIC(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int i; - u_int memsize; - u_long pmem; - u_char sum; - - error = ed_alloc_port(dev, 0, ED_SIC_IO_PORTS); - if (error) - return (error); - - sc->asic_offset = ED_SIC_ASIC_OFFSET; - sc->nic_offset = ED_SIC_NIC_OFFSET; - - memsize = 16384; - /* XXX Needs to allow different msize */ - error = ed_alloc_memory(dev, 0, memsize); - if (error) - return (error); - - sc->mem_start = 0; - sc->mem_size = memsize; - - pmem = rman_get_start(sc->mem_res); - error = ed_isa_mem_ok(dev, pmem, memsize); - if (error) - return (error); - - /* Reset card to force it into a known state. */ - ed_asic_outb(sc, 0, 0x00); - DELAY(100); - - /* - * Here we check the card ROM, if the checksum passes, and the - * type code and ethernet address check out, then we know we have - * an SIC card. - */ - ed_asic_outb(sc, 0, 0x81); - DELAY(100); - - sum = bus_space_read_1(sc->mem_bst, sc->mem_bsh, 6); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sum ^= (sc->enaddr[i] = - bus_space_read_1(sc->mem_bst, sc->mem_bsh, i)); -#ifdef ED_DEBUG - device_printf(dev, "ed_probe_sic: got address %6D\n", - sc->enaddr, ":"); -#endif - if (sum != 0) - return (ENXIO); - if ((sc->enaddr[0] | sc->enaddr[1] | sc->enaddr[2]) == 0) - return (ENXIO); - - sc->vendor = ED_VENDOR_SIC; - sc->type_str = "SIC"; - sc->isa16bit = 0; - sc->cr_proto = 0; - - /* - * SIC RAM page 0x0000-0x3fff(or 0x7fff) - */ - ed_asic_outb(sc, 0, 0x80); - DELAY(100); - - error = ed_clear_memory(dev); - if (error) - return (error); - - sc->mem_shared = 1; - sc->mem_end = sc->mem_start + sc->mem_size; - - /* - * allocate one xmit buffer if < 16k, two buffers otherwise - */ - if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - sc->tx_page_start = 0; - - sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt; - sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - sc->sc_write_mbufs = ed_shmem_write_mbufs; - return (0); -} - -#endif /* ED_SIC */ diff --git a/sys/dev/ed/if_ed_wd80x3.c b/sys/dev/ed/if_ed_wd80x3.c deleted file mode 100644 index e736e9bd78cf..000000000000 --- a/sys/dev/ed/if_ed_wd80x3.c +++ /dev/null @@ -1,453 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_ed.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sockio.h> -#include <sys/mbuf.h> -#include <sys/kernel.h> -#include <sys/socket.h> -#include <sys/syslog.h> - -#include <sys/bus.h> - -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_dl.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <net/bpf.h> - -#include <dev/ed/if_edreg.h> -#include <dev/ed/if_edvar.h> - -/* - * Interrupt conversion table for WD/SMC ASIC/83C584 - */ -static uint16_t ed_intr_val[] = { - 9, - 3, - 5, - 7, - 10, - 11, - 15, - 4 -}; - -/* - * Interrupt conversion table for 83C790 - */ -static uint16_t ed_790_intr_val[] = { - 0, - 9, - 3, - 5, - 7, - 10, - 11, - 15 -}; - -/* - * Probe and vendor-specific initialization routine for SMC/WD80x3 boards - */ -int -ed_probe_WD80x3_generic(device_t dev, int flags, uint16_t *intr_vals[]) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int i; - u_int memsize; - u_char iptr, isa16bit, sum, totalsum; - rman_res_t irq, junk, pmem; - - sc->chip_type = ED_CHIP_TYPE_DP8390; - - if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER) { - totalsum = ED_WD_ROM_CHECKSUM_TOTAL_TOSH_ETHER; - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_POW); - DELAY(10000); - } - else - totalsum = ED_WD_ROM_CHECKSUM_TOTAL; - - /* - * Attempt to do a checksum over the station address PROM. If it - * fails, it's probably not a SMC/WD board. There is a problem with - * this, though: some clone WD boards don't pass the checksum test. - * Danpex boards for one. - */ - for (sum = 0, i = 0; i < 8; ++i) - sum += ed_asic_inb(sc, ED_WD_PROM + i); - - if (sum != totalsum) { - /* - * Checksum is invalid. This often happens with cheap WD8003E - * clones. In this case, the checksum byte (the eighth byte) - * seems to always be zero. - */ - if (ed_asic_inb(sc, ED_WD_CARD_ID) != ED_TYPE_WD8003E || - ed_asic_inb(sc, ED_WD_PROM + 7) != 0) - return (ENXIO); - } - /* reset card to force it into a known state. */ - if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER) - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_RST | ED_WD_MSR_POW); - else - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_RST); - - DELAY(100); - ed_asic_outb(sc, ED_WD_MSR, ed_asic_inb(sc, ED_WD_MSR) & ~ED_WD_MSR_RST); - /* wait in the case this card is reading its EEROM */ - DELAY(5000); - - sc->vendor = ED_VENDOR_WD_SMC; - sc->type = ed_asic_inb(sc, ED_WD_CARD_ID); - - /* - * Set initial values for width/size. - */ - memsize = 8192; - isa16bit = 0; - switch (sc->type) { - case ED_TYPE_WD8003S: - sc->type_str = "WD8003S"; - break; - case ED_TYPE_WD8003E: - sc->type_str = "WD8003E"; - break; - case ED_TYPE_WD8003EB: - sc->type_str = "WD8003EB"; - break; - case ED_TYPE_WD8003W: - sc->type_str = "WD8003W"; - break; - case ED_TYPE_WD8013EBT: - sc->type_str = "WD8013EBT"; - memsize = 16384; - isa16bit = 1; - break; - case ED_TYPE_WD8013W: - sc->type_str = "WD8013W"; - memsize = 16384; - isa16bit = 1; - break; - case ED_TYPE_WD8013EP: /* also WD8003EP */ - if (ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_16BIT) { - isa16bit = 1; - memsize = 16384; - sc->type_str = "WD8013EP"; - } else - sc->type_str = "WD8003EP"; - break; - case ED_TYPE_WD8013WC: - sc->type_str = "WD8013WC"; - memsize = 16384; - isa16bit = 1; - break; - case ED_TYPE_WD8013EBP: - sc->type_str = "WD8013EBP"; - memsize = 16384; - isa16bit = 1; - break; - case ED_TYPE_WD8013EPC: - sc->type_str = "WD8013EPC"; - memsize = 16384; - isa16bit = 1; - break; - case ED_TYPE_SMC8216C: /* 8216 has 16K shared mem -- 8416 has 8K */ - case ED_TYPE_SMC8216T: - if (sc->type == ED_TYPE_SMC8216C) - sc->type_str = "SMC8216/SMC8216C"; - else - sc->type_str = "SMC8216T"; - - ed_asic_outb(sc, ED_WD790_HWR, - ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH); - switch (ed_asic_inb(sc, ED_WD790_RAR) & ED_WD790_RAR_SZ64) { - case ED_WD790_RAR_SZ64: - memsize = 65536; - break; - case ED_WD790_RAR_SZ32: - memsize = 32768; - break; - case ED_WD790_RAR_SZ16: - memsize = 16384; - break; - case ED_WD790_RAR_SZ8: - /* 8216 has 16K shared mem -- 8416 has 8K */ - if (sc->type == ED_TYPE_SMC8216C) - sc->type_str = "SMC8416C/SMC8416BT"; - else - sc->type_str = "SMC8416T"; - memsize = 8192; - break; - } - ed_asic_outb(sc, ED_WD790_HWR, - ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH); - - isa16bit = 1; - sc->chip_type = ED_CHIP_TYPE_WD790; - break; - case ED_TYPE_TOSHIBA1: - sc->type_str = "Toshiba1"; - memsize = 32768; - isa16bit = 1; - break; - case ED_TYPE_TOSHIBA4: - sc->type_str = "Toshiba4"; - memsize = 32768; - isa16bit = 1; - break; - default: - sc->type_str = ""; - break; - } - - /* - * Make some adjustments to initial values depending on what is found - * in the ICR. - */ - if (isa16bit && (sc->type != ED_TYPE_WD8013EBT) - && (sc->type != ED_TYPE_TOSHIBA1) && (sc->type != ED_TYPE_TOSHIBA4) - && ((ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_16BIT) == 0)) { - isa16bit = 0; - memsize = 8192; - } - - /* Override memsize? XXX */ - error = ed_alloc_memory(dev, 0, memsize); - if (error) - return (error); - sc->mem_start = 0; - -#ifdef ED_DEBUG - printf("type = %x type_str=%s isa16bit=%d memsize=%d id_msize=%lu\n", - sc->type, sc->type_str, isa16bit, memsize, - rman_get_size(sc->mem_res)); - for (i = 0; i < 8; i++) - printf("%x -> %x\n", i, ed_asic_inb(sc, i)); -#endif - pmem = rman_get_start(sc->mem_res); - if (!(flags & ED_FLAGS_PCCARD)) { - error = ed_isa_mem_ok(dev, pmem, memsize); - if (error) - return (error); - } - - /* - * (note that if the user specifies both of the following flags that - * '8bit' mode intentionally has precedence) - */ - if (flags & ED_FLAGS_FORCE_16BIT_MODE) - isa16bit = 1; - if (flags & ED_FLAGS_FORCE_8BIT_MODE) - isa16bit = 0; - - /* - * If possible, get the assigned interrupt number from the card and - * use it. - */ - if ((sc->type & ED_WD_SOFTCONFIG) && - (sc->chip_type != ED_CHIP_TYPE_WD790)) { - - /* - * Assemble together the encoded interrupt number. - */ - iptr = (ed_asic_inb(sc, ED_WD_ICR) & ED_WD_ICR_IR2) | - ((ed_asic_inb(sc, ED_WD_IRR) & - (ED_WD_IRR_IR0 | ED_WD_IRR_IR1)) >> 5); - - /* - * If no interrupt specified (or "?"), use what the board tells us. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); - if (error && intr_vals[0] != NULL) - error = bus_set_resource(dev, SYS_RES_IRQ, 0, - intr_vals[0][iptr], 1); - if (error) - return (error); - - /* - * Enable the interrupt. - */ - ed_asic_outb(sc, ED_WD_IRR, - ed_asic_inb(sc, ED_WD_IRR) | ED_WD_IRR_IEN); - } - if (sc->chip_type == ED_CHIP_TYPE_WD790) { - ed_asic_outb(sc, ED_WD790_HWR, - ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH); - iptr = (((ed_asic_inb(sc, ED_WD790_GCR) & ED_WD790_GCR_IR2) >> 4) | - (ed_asic_inb(sc, ED_WD790_GCR) & - (ED_WD790_GCR_IR1 | ED_WD790_GCR_IR0)) >> 2); - ed_asic_outb(sc, ED_WD790_HWR, - ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH); - - /* - * If no interrupt specified (or "?"), use what the board tells us. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); - if (error && intr_vals[1] != NULL) - error = bus_set_resource(dev, SYS_RES_IRQ, 0, - intr_vals[1][iptr], 1); - if (error) - return (error); - - /* - * Enable interrupts. - */ - ed_asic_outb(sc, ED_WD790_ICR, - ed_asic_inb(sc, ED_WD790_ICR) | ED_WD790_ICR_EIL); - } - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, &junk); - if (error) { - device_printf(dev, "%s cards don't support auto-detected/assigned interrupts.\n", - sc->type_str); - return (ENXIO); - } - sc->isa16bit = isa16bit; - sc->mem_shared = 1; - - /* - * allocate one xmit buffer if < 16k, two buffers otherwise - */ - if (memsize < 16384 || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - sc->tx_page_start = ED_WD_PAGE_OFFSET; - sc->rec_page_start = ED_WD_PAGE_OFFSET + ED_TXBUF_SIZE * sc->txb_cnt; - sc->rec_page_stop = ED_WD_PAGE_OFFSET + memsize / ED_PAGE_SIZE; - sc->mem_ring = sc->mem_start + (ED_PAGE_SIZE * sc->rec_page_start); - sc->mem_size = memsize; - sc->mem_end = sc->mem_start + memsize; - - /* - * Get station address from on-board ROM - */ - for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->enaddr[i] = ed_asic_inb(sc, ED_WD_PROM + i); - - /* - * Set upper address bits and 8/16 bit access to shared memory. - */ - if (isa16bit) { - if (sc->chip_type == ED_CHIP_TYPE_WD790) - sc->wd_laar_proto = ed_asic_inb(sc, ED_WD_LAAR); - else - sc->wd_laar_proto = ED_WD_LAAR_L16EN | - ((pmem >> 19) & ED_WD_LAAR_ADDRHI); - /* - * Enable 16bit access - */ - ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto | - ED_WD_LAAR_M16EN); - } else { - if (((sc->type & ED_WD_SOFTCONFIG) || - (sc->type == ED_TYPE_TOSHIBA1) || - (sc->type == ED_TYPE_TOSHIBA4) || - (sc->type == ED_TYPE_WD8013EBT)) && - (sc->chip_type != ED_CHIP_TYPE_WD790)) { - sc->wd_laar_proto = (pmem >> 19) & - ED_WD_LAAR_ADDRHI; - ed_asic_outb(sc, ED_WD_LAAR, sc->wd_laar_proto); - } - } - - /* - * Set address and enable interface shared memory. - */ - if (sc->chip_type != ED_CHIP_TYPE_WD790) { - if (ED_FLAGS_GETTYPE(flags) == ED_FLAGS_TOSH_ETHER) { - ed_asic_outb(sc, ED_WD_MSR + 1, - ((pmem >> 8) & 0xe0) | 4); - ed_asic_outb(sc, ED_WD_MSR + 2, ((pmem >> 16) & 0x0f)); - ed_asic_outb(sc, ED_WD_MSR, - ED_WD_MSR_MENB | ED_WD_MSR_POW); - } else { - ed_asic_outb(sc, ED_WD_MSR, ((pmem >> 13) & - ED_WD_MSR_ADDR) | ED_WD_MSR_MENB); - } - sc->cr_proto = ED_CR_RD2; - } else { - ed_asic_outb(sc, ED_WD_MSR, ED_WD_MSR_MENB); - ed_asic_outb(sc, ED_WD790_HWR, - (ed_asic_inb(sc, ED_WD790_HWR) | ED_WD790_HWR_SWH)); - ed_asic_outb(sc, ED_WD790_RAR, - ((pmem >> 13) & 0x0f) | ((pmem >> 11) & 0x40) | - (ed_asic_inb(sc, ED_WD790_RAR) & 0xb0)); - ed_asic_outb(sc, ED_WD790_HWR, - (ed_asic_inb(sc, ED_WD790_HWR) & ~ED_WD790_HWR_SWH)); - sc->cr_proto = 0; - } - - /* - * Disable 16bit access to shared memory - we leave it - * disabled so that 1) machines reboot properly when the board - * is set 16 bit mode and there are conflicting 8bit - * devices/ROMS in the same 128k address space as this boards - * shared memory. and 2) so that other 8 bit devices with - * shared memory can be used in this 128k region, too. - */ - error = ed_clear_memory(dev); - ed_disable_16bit_access(sc); - sc->sc_write_mbufs = ed_shmem_write_mbufs; - return (error); -} - -int -ed_probe_WD80x3(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - static uint16_t *intr_vals[] = {ed_intr_val, ed_790_intr_val}; - - error = ed_alloc_port(dev, port_rid, ED_WD_IO_PORTS); - if (error) - return (error); - - sc->asic_offset = ED_WD_ASIC_OFFSET; - sc->nic_offset = ED_WD_NIC_OFFSET; - - return ed_probe_WD80x3_generic(dev, flags, intr_vals); -} diff --git a/sys/dev/ed/if_edreg.h b/sys/dev/ed/if_edreg.h deleted file mode 100644 index 84064bd03079..000000000000 --- a/sys/dev/ed/if_edreg.h +++ /dev/null @@ -1,1081 +0,0 @@ -/*- - * Copyright (C) 1993, David Greenman. This software may be used, modified, - * copied, distributed, and sold, in both source and binary form provided - * that the above copyright and these terms are retained. Under no - * circumstances is the author responsible for the proper functioning - * of this software, nor does the author assume any responsibility - * for damages incurred with its use. - * - * $FreeBSD$ - */ -/* - * National Semiconductor DS8390 NIC register definitions - * - * - * Modification history - * - * Revision 2.2 1993/11/29 16:33:39 davidg - * From Thomas Sandford <t.d.g.sandford@comp.brad.ac.uk> - * Add support for the 8013W board type - * - * Revision 2.1 1993/11/22 10:52:33 davidg - * patch to add support for SMC8216 (Elite-Ultra) boards - * from Glen H. Lowe - * - * Revision 2.0 93/09/29 00:37:15 davidg - * changed double buffering flag to multi buffering - * made changes/additions for 3c503 multi-buffering - * ...companion to Rev. 2.0 of 'ed' driver. - * - * Revision 1.1 93/06/23 03:01:07 davidg - * Initial revision - * - */ - -/* - * Page 0 register offsets - */ -#define ED_P0_CR 0x00 /* Command Register */ - -#define ED_P0_CLDA0 0x01 /* Current Local DMA Addr low (read) */ -#define ED_P0_PSTART 0x01 /* Page Start register (write) */ - -#define ED_P0_CLDA1 0x02 /* Current Local DMA Addr high (read) */ -#define ED_P0_PSTOP 0x02 /* Page Stop register (write) */ - -#define ED_P0_BNRY 0x03 /* Boundary Pointer */ - -#define ED_P0_TSR 0x04 /* Transmit Status Register (read) */ -#define ED_P0_TPSR 0x04 /* Transmit Page Start (write) */ - -#define ED_P0_NCR 0x05 /* Number of Collisions Reg (read) */ -#define ED_P0_TBCR0 0x05 /* Transmit Byte count, low (write) */ - -#define ED_P0_FIFO 0x06 /* FIFO register (read) */ -#define ED_P0_TBCR1 0x06 /* Transmit Byte count, high (write) */ - -#define ED_P0_ISR 0x07 /* Interrupt Status Register */ - -#define ED_P0_CRDA0 0x08 /* Current Remote DMA Addr low (read) */ -#define ED_P0_RSAR0 0x08 /* Remote Start Address low (write) */ - -#define ED_P0_CRDA1 0x09 /* Current Remote DMA Addr high (read) */ -#define ED_P0_RSAR1 0x09 /* Remote Start Address high (write) */ - -#define ED_P0_RBCR0 0x0a /* Remote Byte Count low (write) */ - -#define ED_P0_RBCR1 0x0b /* Remote Byte Count high (write) */ - -#define ED_P0_RSR 0x0c /* Receive Status (read) */ -#define ED_P0_RCR 0x0c /* Receive Configuration Reg (write) */ - -#define ED_P0_CNTR0 0x0d /* frame alignment error counter (read) */ -#define ED_P0_TCR 0x0d /* Transmit Configuration Reg (write) */ - -#define ED_P0_CNTR1 0x0e /* CRC error counter (read) */ -#define ED_P0_DCR 0x0e /* Data Configuration Reg (write) */ - -#define ED_P0_CNTR2 0x0f /* missed packet counter (read) */ -#define ED_P0_IMR 0x0f /* Interrupt Mask Register (write) */ - -/* - * Page 1 register offsets - */ -#define ED_P1_CR 0x00 /* Command Register */ -#define ED_P1_PAR0 0x01 /* Physical Address Register 0 */ -#define ED_P1_PAR1 0x02 /* Physical Address Register 1 */ -#define ED_P1_PAR2 0x03 /* Physical Address Register 2 */ -#define ED_P1_PAR3 0x04 /* Physical Address Register 3 */ -#define ED_P1_PAR4 0x05 /* Physical Address Register 4 */ -#define ED_P1_PAR5 0x06 /* Physical Address Register 5 */ -#define ED_P1_PAR(i) (ED_P1_PAR0 + i) -#define ED_P1_CURR 0x07 /* Current RX ring-buffer page */ -#define ED_P1_MAR0 0x08 /* Multicast Address Register 0 */ -#define ED_P1_MAR1 0x09 /* Multicast Address Register 1 */ -#define ED_P1_MAR2 0x0a /* Multicast Address Register 2 */ -#define ED_P1_MAR3 0x0b /* Multicast Address Register 3 */ -#define ED_P1_MAR4 0x0c /* Multicast Address Register 4 */ -#define ED_P1_MAR5 0x0d /* Multicast Address Register 5 */ -#define ED_P1_MAR6 0x0e /* Multicast Address Register 6 */ -#define ED_P1_MAR7 0x0f /* Multicast Address Register 7 */ -#define ED_P1_MAR(i) (ED_P1_MAR0 + i) - -/* - * Page 2 register offsets - */ -#define ED_P2_CR 0x00 /* Command Register */ -#define ED_P2_PSTART 0x01 /* Page Start (read) */ -#define ED_P2_CLDA0 0x01 /* Current Local DMA Addr 0 (write) */ -#define ED_P2_PSTOP 0x02 /* Page Stop (read) */ -#define ED_P2_CLDA1 0x02 /* Current Local DMA Addr 1 (write) */ -#define ED_P2_RNPP 0x03 /* Remote Next Packet Pointer */ -#define ED_P2_TPSR 0x04 /* Transmit Page Start (read) */ -#define ED_P2_LNPP 0x05 /* Local Next Packet Pointer */ -#define ED_P2_ACU 0x06 /* Address Counter Upper */ -#define ED_P2_ACL 0x07 /* Address Counter Lower */ -#define ED_P2_RCR 0x0c /* Receive Configuration Register (read) */ -#define ED_P2_TCR 0x0d /* Transmit Configuration Register (read) */ -#define ED_P2_DCR 0x0e /* Data Configuration Register (read) */ -#define ED_P2_IMR 0x0f /* Interrupt Mask Register (read) */ - -/* - * Command Register (CR) definitions - */ - -/* - * STP: SToP. Software reset command. Takes the controller offline. No - * packets will be received or transmitted. Any reception or - * transmission in progress will continue to completion before - * entering reset state. To exit this state, the STP bit must - * reset and the STA bit must be set. The software reset has - * executed only when indicated by the RST bit in the ISR being - * set. - */ -#define ED_CR_STP 0x01 - -/* - * STA: STArt. This bit is used to activate the NIC after either power-up, - * or when the NIC has been put in reset mode by software command - * or error. - */ -#define ED_CR_STA 0x02 - -/* - * TXP: Transmit Packet. This bit must be set to indicate transmission of - * a packet. TXP is internally reset either after the transmission is - * completed or aborted. This bit should be set only after the Transmit - * Byte Count and Transmit Page Start register have been programmed. - */ -#define ED_CR_TXP 0x04 - -/* - * RD0, RD1, RD2: Remote DMA Command. These three bits control the operation - * of the remote DMA channel. RD2 can be set to abort any remote DMA - * command in progress. The Remote Byte Count registers should be cleared - * when a remote DMA has been aborted. The Remote Start Addresses are not - * restored to the starting address if the remote DMA is aborted. - * - * RD2 RD1 RD0 function - * 0 0 0 not allowed - * 0 0 1 remote read - * 0 1 0 remote write - * 0 1 1 send packet - * 1 X X abort - */ -#define ED_CR_RD0 0x08 -#define ED_CR_RD1 0x10 -#define ED_CR_RD2 0x20 - -/* - * PS0, PS1: Page Select. The two bits select which register set or 'page' to - * access. - * - * PS1 PS0 page - * 0 0 0 - * 0 1 1 - * 1 0 2 - * 1 1 3 (some chips it is reserved) - */ -#define ED_CR_PS0 0x40 -#define ED_CR_PS1 0x80 -/* bit encoded aliases */ -#define ED_CR_PAGE_0 0x00 /* (for consistency) */ -#define ED_CR_PAGE_1 0x40 -#define ED_CR_PAGE_2 0x80 -#define ED_CR_PAGE_3 0xc0 - -/* - * Interrupt Status Register (ISR) definitions - */ - -/* - * PRX: Packet Received. Indicates packet received with no errors. - */ -#define ED_ISR_PRX 0x01 - -/* - * PTX: Packet Transmitted. Indicates packet transmitted with no errors. - */ -#define ED_ISR_PTX 0x02 - -/* - * RXE: Receive Error. Indicates that a packet was received with one or more - * the following errors: CRC error, frame alignment error, FIFO overrun, - * missed packet. - */ -#define ED_ISR_RXE 0x04 - -/* - * TXE: Transmission Error. Indicates that an attempt to transmit a packet - * resulted in one or more of the following errors: excessive - * collisions, FIFO underrun. - */ -#define ED_ISR_TXE 0x08 - -/* - * OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network - * would exceed (has exceeded?) the boundary pointer, resulting in data - * that was previously received and not yet read from the buffer to be - * overwritten. - */ -#define ED_ISR_OVW 0x10 - -/* - * CNT: Counter Overflow. Set when the MSB of one or more of the Network Talley - * Counters has been set. - */ -#define ED_ISR_CNT 0x20 - -/* - * RDC: Remote Data Complete. Indicates that a Remote DMA operation has completed. - */ -#define ED_ISR_RDC 0x40 - -/* - * RST: Reset status. Set when the NIC enters the reset state and cleared when a - * Start Command is issued to the CR. This bit is also set when a receive - * ring-buffer overrun (OverWrite) occurs and is cleared when one or more - * packets have been removed from the ring. This is a read-only bit. - */ -#define ED_ISR_RST 0x80 - -/* - * Interrupt Mask Register (IMR) definitions - */ - -/* - * PRXE: Packet Received interrupt Enable. If set, a received packet will cause - * an interrupt. - */ -#define ED_IMR_PRXE 0x01 - -/* - * PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated when - * a packet transmission completes. - */ -#define ED_IMR_PTXE 0x02 - -/* - * RXEE: Receive Error interrupt Enable. If set, an interrupt will occur whenever a - * packet is received with an error. - */ -#define ED_IMR_RXEE 0x04 - -/* - * TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur whenever - * a transmission results in an error. - */ -#define ED_IMR_TXEE 0x08 - -/* - * OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated whenever - * the receive ring-buffer is overrun. i.e. when the boundary pointer is exceeded. - */ -#define ED_IMR_OVWE 0x10 - -/* - * CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated whenever - * the MSB of one or more of the Network Statistics counters has been set. - */ -#define ED_IMR_CNTE 0x20 - -/* - * RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is generated - * when a remote DMA transfer has completed. - */ -#define ED_IMR_RDCE 0x40 - -/* - * bit 7 is unused/reserved - */ - -/* - * Data Configuration Register (DCR) definitions - */ - -/* - * WTS: Word Transfer Select. WTS establishes byte or word transfers for - * both remote and local DMA transfers - */ -#define ED_DCR_WTS 0x01 - -/* - * BOS: Byte Order Select. BOS sets the byte order for the host. - * Should be 0 for 80x86, and 1 for 68000 series processors - */ -#define ED_DCR_BOS 0x02 - -/* - * LAS: Long Address Select. When LAS is 1, the contents of the remote - * DMA registers RSAR0 and RSAR1 are used to provide A16-A31 - */ -#define ED_DCR_LAS 0x04 - -/* - * LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2 - * of the TCR must also be programmed for loopback operation. - * When 1, normal operation is selected. - */ -#define ED_DCR_LS 0x08 - -/* - * AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer - * under program control. When 1, remote DMA is automatically initiated - * and the boundary pointer is automatically updated - */ -#define ED_DCR_AR 0x10 - -/* - * FT0, FT1: Fifo Threshold select. - * FT1 FT0 Word-width Byte-width - * 0 0 1 word 2 bytes - * 0 1 2 words 4 bytes - * 1 0 4 words 8 bytes - * 1 1 8 words 12 bytes - * - * During transmission, the FIFO threshold indicates the number of bytes - * or words that the FIFO has filled from the local DMA before BREQ is - * asserted. The transmission threshold is 16 bytes minus the receiver - * threshold. - */ -#define ED_DCR_FT0 0x20 -#define ED_DCR_FT1 0x40 - -/* - * bit 7 (0x80) is unused/reserved - */ - -/* - * Transmit Configuration Register (TCR) definitions - */ - -/* - * CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC - * is not appended by the transmitter. - */ -#define ED_TCR_CRC 0x01 - -/* - * LB0, LB1: Loopback control. These two bits set the type of loopback that is - * to be performed. - * - * LB1 LB0 mode - * 0 0 0 - normal operation (DCR_LS = 0) - * 0 1 1 - internal loopback (DCR_LS = 0) - * 1 0 2 - external loopback (DCR_LS = 1) - * 1 1 3 - external loopback (DCR_LS = 0) - */ -#define ED_TCR_LB0 0x02 -#define ED_TCR_LB1 0x04 - -/* - * ATD: Auto Transmit Disable. Clear for normal operation. When set, allows - * another station to disable the NIC's transmitter by transmitting to - * a multicast address hashing to bit 62. Reception of a multicast address - * hashing to bit 63 enables the transmitter. - */ -#define ED_TCR_ATD 0x08 - -/* - * OFST: Collision Offset enable. This bit when set modifies the backoff - * algorithm to allow prioritization of nodes. - */ -#define ED_TCR_OFST 0x10 - -/* - * bits 5, 6, and 7 are unused/reserved - */ - -/* - * Transmit Status Register (TSR) definitions - */ - -/* - * PTX: Packet Transmitted. Indicates successful transmission of packet. - */ -#define ED_TSR_PTX 0x01 - -/* - * bit 1 (0x02) is unused/reserved - */ - -/* - * COL: Transmit Collided. Indicates that the transmission collided at least - * once with another station on the network. - */ -#define ED_TSR_COL 0x04 - -/* - * ABT: Transmit aborted. Indicates that the transmission was aborted due to - * excessive collisions. - */ -#define ED_TSR_ABT 0x08 - -/* - * CRS: Carrier Sense Lost. Indicates that carrier was lost during the - * transmission of the packet. (Transmission is not aborted because - * of a loss of carrier) - */ -#define ED_TSR_CRS 0x10 - -/* - * FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/ - * transmission memory before the FIFO emptied. Transmission of the - * packet was aborted. - */ -#define ED_TSR_FU 0x20 - -/* - * CDH: CD Heartbeat. Indicates that the collision detection circuitry - * isn't working correctly during a collision heartbeat test. - */ -#define ED_TSR_CDH 0x40 - -/* - * OWC: Out of Window Collision: Indicates that a collision occurred after - * a slot time (51.2us). The transmission is rescheduled just as in - * normal collisions. - */ -#define ED_TSR_OWC 0x80 - -/* - * Receiver Configuration Register (RCR) definitions - */ - -/* - * SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1, - * packets with CRC and frame errors are not discarded. - */ -#define ED_RCR_SEP 0x01 - -/* - * AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded. - * If set to 1, packets with less than 64 byte are not discarded. - */ -#define ED_RCR_AR 0x02 - -/* - * AB: Accept Broadcast. If set, packets sent to the broadcast address will be - * accepted. - */ -#define ED_RCR_AB 0x04 - -/* - * AM: Accept Multicast. If set, packets sent to a multicast address are checked - * for a match in the hashing array. If clear, multicast packets are ignored. - */ -#define ED_RCR_AM 0x08 - -/* - * PRO: Promiscuous Physical. If set, all packets with a physical addresses are - * accepted. If clear, a physical destination address must match this - * station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM - * must also be set. In addition, the multicast hashing array must be set - * to all 1's so that all multicast addresses are accepted. - */ -#define ED_RCR_PRO 0x10 - -/* - * MON: Monitor Mode. If set, packets will be checked for good CRC and framing, - * but are not stored in the ring-buffer. If clear, packets are stored (normal - * operation). - */ -#define ED_RCR_MON 0x20 - -/* - * INTT: Interrupt Trigger Mode for AX88190. - */ -#define ED_RCR_INTT 0x40 - -/* - * bit 7 is unused/reserved. - */ - -/* - * Receiver Status Register (RSR) definitions - */ - -/* - * PRX: Packet Received without error. - */ -#define ED_RSR_PRX 0x01 - -/* - * CRC: CRC error. Indicates that a packet has a CRC error. Also set for frame - * alignment errors. - */ -#define ED_RSR_CRC 0x02 - -/* - * FAE: Frame Alignment Error. Indicates that the incoming packet did not end on - * a byte boundary and the CRC did not match at the last byte boundary. - */ -#define ED_RSR_FAE 0x04 - -/* - * FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local DMA) - * causing it to overrun. Reception of the packet is aborted. - */ -#define ED_RSR_FO 0x08 - -/* - * MPA: Missed Packet. Indicates that the received packet couldn't be stored in - * the ring-buffer because of insufficient buffer space (exceeding the - * boundary pointer), or because the transfer to the ring-buffer was inhibited - * by RCR_MON - monitor mode. - */ -#define ED_RSR_MPA 0x10 - -/* - * PHY: Physical address. If 0, the packet received was sent to a physical address. - * If 1, the packet was accepted because of a multicast/broadcast address - * match. - */ -#define ED_RSR_PHY 0x20 - -/* - * DIS: Receiver Disabled. Set to indicate that the receiver has entered monitor - * mode. Cleared when the receiver exits monitor mode. - */ -#define ED_RSR_DIS 0x40 - -/* - * DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL inputs - * are active, and the transceiver has set the CD line as a result of the - * jabber. - */ -#define ED_RSR_DFR 0x80 - -/* - * receive ring descriptor - * - * The National Semiconductor DS8390 Network interface controller uses - * the following receive ring headers. The way this works is that the - * memory on the interface card is chopped up into 256 bytes blocks. - * A contiguous portion of those blocks are marked for receive packets - * by setting start and end block #'s in the NIC. For each packet that - * is put into the receive ring, one of these headers (4 bytes each) is - * tacked onto the front. The first byte is a copy of the receiver status - * register at the time the packet was received. - */ -struct ed_ring { - u_char rsr; /* receiver status */ - u_char next_packet; /* pointer to next packet */ - u_short count; /* bytes in packet (length + 4) */ -}; - -/* - * Common constants - */ -#define ED_PAGE_SIZE 256 /* Size of RAM pages in bytes */ -#define ED_TXBUF_SIZE 6 /* Size of TX buffer in pages */ - -/* - * Definitions for Western digital/SMC WD80x3 series ASIC - */ -/* - * Memory Select Register (MSR) - */ -#define ED_WD_MSR 0 - -/* next three definitions for Toshiba */ -#define ED_WD_MSR_POW 0x02 /* 0 = power save, 1 = normal (R/W) */ -#define ED_WD_MSR_BSY 0x04 /* gate array busy (R) */ -#define ED_WD_MSR_LEN 0x20 /* data bus width, 0 = 16 bits, - 1 = 8 bits (R/W) */ -#define ED_WD_MSR_ADDR 0x3f /* Memory decode bits 18-13 */ -#define ED_WD_MSR_MENB 0x40 /* Memory enable */ -#define ED_WD_MSR_RST 0x80 /* Reset board */ - -/* - * Interface Configuration Register (ICR) - */ -#define ED_WD_ICR 1 - -#define ED_WD_ICR_16BIT 0x01 /* 16-bit interface */ -#define ED_WD_ICR_OAR 0x02 /* select register. 0=BIO 1=EAR */ -#define ED_WD_ICR_IR2 0x04 /* high order bit of encoded IRQ */ -#define ED_WD_ICR_MSZ 0x08 /* memory size (0=8k 1=32k) */ -#define ED_WD_ICR_RLA 0x10 /* recall LAN address */ -#define ED_WD_ICR_RX7 0x20 /* recall all but i/o and LAN address */ -#define ED_WD_ICR_RIO 0x40 /* recall i/o address */ -#define ED_WD_ICR_STO 0x80 /* store to non-volatile memory */ -#define ED_WD_ICR_MEM 0xe0 /* shared mem address A15-A13 (R/W) */ -#define ED_WD_ICR_MSZ1 0x0f /* memory size, 0x08 = 64K, 0x04 = 32K, - 0x02 = 16K, 0x01 = 8K */ - /* 64K can only be used if mem address - above 1Mb */ - /* IAR holds address A23-A16 (R/W) */ - -/* - * IO Address Register (IAR) - */ -#define ED_WD_IAR 2 - -/* - * EEROM Address Register - */ -#define ED_WD_EAR 3 - -/* - * Interrupt Request Register (IRR) - */ -#define ED_WD_IRR 4 - -#define ED_WD_IRR_0WS 0x01 /* use 0 wait-states on 8 bit bus */ -#define ED_WD_IRR_OUT1 0x02 /* WD83C584 pin 1 output */ -#define ED_WD_IRR_OUT2 0x04 /* WD83C584 pin 2 output */ -#define ED_WD_IRR_OUT3 0x08 /* WD83C584 pin 3 output */ -#define ED_WD_IRR_FLASH 0x10 /* Flash RAM is in the ROM socket */ - -/* - * The three bits of the encoded IRQ are decoded as follows: - * - * IR2 IR1 IR0 IRQ - * 0 0 0 2/9 - * 0 0 1 3 - * 0 1 0 5 - * 0 1 1 7 - * 1 0 0 10 - * 1 0 1 11 - * 1 1 0 15 - * 1 1 1 4 - */ -#define ED_WD_IRR_IR0 0x20 /* bit 0 of encoded IRQ */ -#define ED_WD_IRR_IR1 0x40 /* bit 1 of encoded IRQ */ -#define ED_WD_IRR_IEN 0x80 /* Interrupt enable */ - -/* - * LA Address Register (LAAR) - */ -#define ED_WD_LAAR 5 - -#define ED_WD_LAAR_ADDRHI 0x1f /* bits 23-19 of RAM address */ -#define ED_WD_LAAR_0WS16 0x20 /* enable 0 wait-states on 16 bit bus */ -#define ED_WD_LAAR_L16EN 0x40 /* enable 16-bit operation */ -#define ED_WD_LAAR_M16EN 0x80 /* enable 16-bit memory access */ - -/* i/o base offset to station address/card-ID PROM */ -#define ED_WD_PROM 8 - -/* - * 83C790 specific registers - */ -/* - * Hardware Support Register (HWR) ('790) - */ -#define ED_WD790_HWR 4 - -#define WD_WD790_HWR_NUKE 0x10 /* hardware reset */ -#define ED_WD790_HWR_LPRM 0x40 /* LAN PROM select */ -#define ED_WD790_HWR_SWH 0x80 /* switch register set */ - -/* - * ICR790 Interrupt Control Register for the 83C790 - */ -#define ED_WD790_ICR 6 - -#define ED_WD790_ICR_EIL 0x01 /* enable interrupts */ - -/* - * REV/IOPA Revision / I/O Pipe register for the 83C79X - */ -#define ED_WD790_REV 7 - -#define ED_WD790 0x20 -#define ED_WD795 0x40 - -/* - * 79X RAM Address Register (RAR) - * Enabled with SWH bit=1 in HWR register - */ -#define ED_WD790_RAR 0x0b - -#define ED_WD790_RAR_SZ8 0x00 /* 8k memory buffer */ -#define ED_WD790_RAR_SZ16 0x10 /* 16k memory buffer */ -#define ED_WD790_RAR_SZ32 0x20 /* 32k memory buffer */ -#define ED_WD790_RAR_SZ64 0x30 /* 64k memory buffer */ - -/* - * General Control Register (GCR) - * Enabled with SWH bit=1 in HWR register - */ -#define ED_WD790_GCR 0x0d - -#define ED_WD790_GCR_IR0 0x04 /* bit 0 of encoded IRQ */ -#define ED_WD790_GCR_IR1 0x08 /* bit 1 of encoded IRQ */ -#define ED_WD790_GCR_ZWSEN 0x20 /* zero wait state enable */ -#define ED_WD790_GCR_IR2 0x40 /* bit 2 of encoded IRQ */ -#define ED_WD790_GCR_LIT 0x01 /* Link Integrity Test Enable */ -/* - * The three bits of the encoded IRQ are decoded as follows: - * - * IR2 IR1 IR0 IRQ - * 0 0 0 none - * 0 0 1 9 - * 0 1 0 3 - * 0 1 1 5 - * 1 0 0 7 - * 1 0 1 10 - * 1 1 0 11 - * 1 1 1 15 - */ - -/* i/o base offset to CARD ID */ -#define ED_WD_CARD_ID ED_WD_PROM+6 - -/* Board type codes in card ID */ -#define ED_TYPE_WD8003S 0x02 -#define ED_TYPE_WD8003E 0x03 -#define ED_TYPE_WD8013EBT 0x05 -#define ED_TYPE_TOSHIBA1 0x11 /* named PCETA1 */ -#define ED_TYPE_TOSHIBA2 0x12 /* named PCETA2 */ -#define ED_TYPE_TOSHIBA3 0x13 /* named PCETB */ -#define ED_TYPE_TOSHIBA4 0x14 /* named PCETC */ -#define ED_TYPE_WD8003W 0x24 -#define ED_TYPE_WD8003EB 0x25 -#define ED_TYPE_WD8013W 0x26 -#define ED_TYPE_WD8013EP 0x27 -#define ED_TYPE_WD8013WC 0x28 -#define ED_TYPE_WD8013EPC 0x29 -#define ED_TYPE_SMC8216T 0x2a -#define ED_TYPE_SMC8216C 0x2b -#define ED_TYPE_WD8013EBP 0x2c - -/* Bit definitions in card ID */ -#define ED_WD_REV_MASK 0x1f /* Revision mask */ -#define ED_WD_SOFTCONFIG 0x20 /* Soft config */ -#define ED_WD_LARGERAM 0x40 /* Large RAM */ -#define ED_MICROCHANEL 0x80 /* Microchannel bus (vs. isa) */ - -/* - * Checksum total. All 8 bytes in station address PROM will add up to this - */ -#define ED_WD_ROM_CHECKSUM_TOTAL 0xFF -#define ED_WD_ROM_CHECKSUM_TOTAL_TOSH_ETHER 0xA5 - -#define ED_WD_NIC_OFFSET 0x10 /* I/O base offset to NIC */ -#define ED_WD_ASIC_OFFSET 0 /* I/O base offset to ASIC */ -#define ED_WD_IO_PORTS 32 /* # of i/o addresses used */ - -#define ED_WD_PAGE_OFFSET 0 /* page offset for NIC access to mem */ - -/* - * Definitions for 3Com 3c503 - */ -#define ED_3COM_NIC_OFFSET 0 -#define ED_3COM_ASIC_OFFSET 0x400 /* offset to nic i/o regs */ - -/* - * XXX - The I/O address range is fragmented in the 3c503; this is the - * number of regs at iobase. - */ -#define ED_3COM_IO_PORTS 16 /* # of i/o addresses used */ - -/* tx memory starts in second bank on 8bit cards */ -#define ED_3COM_TX_PAGE_OFFSET_8BIT 0x20 - -/* tx memory starts in first bank on 16bit cards */ -#define ED_3COM_TX_PAGE_OFFSET_16BIT 0x0 - -/* ...and rx memory starts in second bank */ -#define ED_3COM_RX_PAGE_OFFSET_16BIT 0x20 - - -/* - * Page Start Register. Must match PSTART in NIC - */ -#define ED_3COM_PSTR 0 - -/* - * Page Stop Register. Must match PSTOP in NIC - */ -#define ED_3COM_PSPR 1 - -/* - * Drq Timer Register. Determines number of bytes to be transferred during - * a DMA burst. - */ -#define ED_3COM_DQTR 2 - -/* - * Base Configuration Register. Read-only register which contains the - * board-configured I/O base address of the adapter. Bit encoded. - */ -#define ED_3COM_BCFR 3 - -#define ED_3COM_BCFR_2E0 0x01 -#define ED_3COM_BCFR_2A0 0x02 -#define ED_3COM_BCFR_280 0x04 -#define ED_3COM_BCFR_250 0x08 -#define ED_3COM_BCFR_350 0x10 -#define ED_3COM_BCFR_330 0x20 -#define ED_3COM_BCFR_310 0x40 -#define ED_3COM_BCFR_300 0x80 - -/* - * EPROM Configuration Register. Read-only register which contains the - * board-configured memory base address. Bit encoded. - */ -#define ED_3COM_PCFR 4 - -#define ED_3COM_PCFR_C8000 0x10 -#define ED_3COM_PCFR_CC000 0x20 -#define ED_3COM_PCFR_D8000 0x40 -#define ED_3COM_PCFR_DC000 0x80 - -/* - * GA Configuration Register. Gate-Array Configuration Register. - */ -#define ED_3COM_GACFR 5 - -/* - * mbs2 mbs1 mbs0 start address - * 0 0 0 0x0000 - * 0 0 1 0x2000 - * 0 1 0 0x4000 - * 0 1 1 0x6000 - * - * Note that with adapters with only 8K, the setting for 0x2000 must - * always be used. - */ -#define ED_3COM_GACFR_MBS0 0x01 -#define ED_3COM_GACFR_MBS1 0x02 -#define ED_3COM_GACFR_MBS2 0x04 - -#define ED_3COM_GACFR_RSEL 0x08 /* enable shared memory */ -#define ED_3COM_GACFR_TEST 0x10 /* for GA testing */ -#define ED_3COM_GACFR_OWS 0x20 /* select 0WS access to GA */ -#define ED_3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */ -#define ED_3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */ - -/* - * Control Register. Miscellaneous control functions. - */ -#define ED_3COM_CR 6 - -#define ED_3COM_CR_RST 0x01 /* Reset GA and NIC */ -#define ED_3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */ -#define ED_3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */ -#define ED_3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */ -#define ED_3COM_CR_SHARE 0x10 /* select interrupt sharing option */ -#define ED_3COM_CR_DBSEL 0x20 /* Double buffer select */ -#define ED_3COM_CR_DDIR 0x40 /* DMA direction select */ -#define ED_3COM_CR_START 0x80 /* Start DMA controller */ - -/* - * Status Register. Miscellaneous status information. - */ -#define ED_3COM_STREG 7 - -#define ED_3COM_STREG_REV 0x07 /* GA revision */ -#define ED_3COM_STREG_DIP 0x08 /* DMA in progress */ -#define ED_3COM_STREG_DTC 0x10 /* DMA terminal count */ -#define ED_3COM_STREG_OFLW 0x20 /* Overflow */ -#define ED_3COM_STREG_UFLW 0x40 /* Underflow */ -#define ED_3COM_STREG_DPRDY 0x80 /* Data port ready */ - -/* - * Interrupt/DMA Configuration Register - */ -#define ED_3COM_IDCFR 8 - -#define ED_3COM_IDCFR_DRQ0 0x01 /* DMA request 1 select */ -#define ED_3COM_IDCFR_DRQ1 0x02 /* DMA request 2 select */ -#define ED_3COM_IDCFR_DRQ2 0x04 /* DMA request 3 select */ -#define ED_3COM_IDCFR_UNUSED 0x08 /* not used */ -#define ED_3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */ -#define ED_3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */ -#define ED_3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */ -#define ED_3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */ - -/* - * DMA Address Register MSB - */ -#define ED_3COM_DAMSB 9 - -/* - * DMA Address Register LSB - */ -#define ED_3COM_DALSB 0x0a - -/* - * Vector Pointer Register 2 - */ -#define ED_3COM_VPTR2 0x0b - -/* - * Vector Pointer Register 1 - */ -#define ED_3COM_VPTR1 0x0c - -/* - * Vector Pointer Register 0 - */ -#define ED_3COM_VPTR0 0x0d - -/* - * Register File Access MSB - */ -#define ED_3COM_RFMSB 0x0e - -/* - * Register File Access LSB - */ -#define ED_3COM_RFLSB 0x0f - -/* - * Definitions for Novell NE1000/2000 boards - */ - -/* - * Board type codes - */ -#define ED_TYPE_NE1000 0x01 -#define ED_TYPE_NE2000 0x02 - -/* - * Register offsets/total - */ -#define ED_NOVELL_NIC_OFFSET 0x00 -#define ED_NOVELL_ASIC_OFFSET 0x10 -#define ED_NOVELL_IO_PORTS 32 - -/* - * Remote DMA data register; for reading or writing to the NIC mem - * via programmed I/O (offset from ASIC base) - */ -#define ED_NOVELL_DATA 0x00 - -/* - * Reset register; reading from this register causes a board reset - */ -#define ED_NOVELL_RESET 0x0f - -/* - * Definitions for PCCARD - */ -#define ED_PC_PAGE_OFFSET 0x40 /* page offset for NIC access to mem */ -#define ED_PC_IO_PORTS 32 -#define ED_PC_ASIC_OFFSET 0x10 -#define ED_PC_RESET 0x0f /* Reset(offset from ASIC base) */ -#define ED_PC_MISC 0x08 /* Misc (offset from ASIC base) */ - -/* - * if_ze.h constants - */ - -#define ZE_PAGE_OFFSET 0x40 /* mem buffer starts at 0x4000 */ - -#define ZE_DATA_IO 0x10 -#define ZE_MISC 0x18 -#define ZE_RESET 0x1F - -/* - * Definitions for HP PC LAN Adapter Plus; based on the CRYNWR packet - * driver for the card. - */ - -#define ED_HPP_ASIC_OFFSET 0x00 /* Offset to ASIC registers */ -#define ED_HPP_NIC_OFFSET 0x10 /* Offset to 8390 registers */ - -#define ED_HPP_ID 0x00 /* ID register, always 0x4850 */ -#define ED_HPP_PAGING 0x02 /* Page select register */ -#define ED_HPP_OPTION 0x04 /* Bitmask of supported options */ -#define ED_HPP_PAGE_0 0x08 /* Page 0 */ -#define ED_HPP_PAGE_2 0x0A /* Page 2 */ -#define ED_HPP_PAGE_4 0x0C /* Page 4 */ -#define ED_HPP_PAGE_6 0x0E /* Page 6 */ - -/* PERF PAGE */ -#define ED_HPP_OUT_ADDR ED_HPP_PAGE_0 /* I/O output location */ -#define ED_HPP_IN_ADDR ED_HPP_PAGE_2 /* I/O input location */ -#define ED_HPP_DATAPORT ED_HPP_PAGE_4 /* I/O data transfer */ -/* MAC PAGE */ -#define ED_HPP_MAC_ADDR 0x08 /* Offset of MAC address in MAC page */ - -#define ED_HPP_IO_PORTS 32 /* Number of IO ports */ - -#define ED_HPP_TX_PAGE_OFFSET 0x00 /* first page of TX buffer */ -#define ED_HPP_RX_PAGE_START 0x06 /* start at page 6 */ -#define ED_HPP_RX_PAGE_STOP 0x80 /* end at page 128 */ - -/* - * Register pages supported. - */ - -#define ED_HPP_PAGE_PERF 0 /* Normal operation */ -#define ED_HPP_PAGE_MAC 1 /* The ethernet address and checksum */ -#define ED_HPP_PAGE_HW 2 /* Hardware parameters in EEPROM */ -#define ED_HPP_PAGE_LAN 4 /* Transciever selection etc */ -#define ED_HPP_PAGE_ID 6 /* ID */ - -/* - * Options supported. - */ - -#define ED_HPP_OPTION_NIC_RESET 0x0001 /* active low */ -#define ED_HPP_OPTION_CHIP_RESET 0x0002 /* active low */ -#define ED_HPP_OPTION_ENABLE_IRQ 0x0004 -#define ED_HPP_OPTION_FAKE_INTR 0x0008 -#define ED_HPP_OPTION_BOOT_ROM_ENB 0x0010 -#define ED_HPP_OPTION_IO_ENB 0x0020 -#define ED_HPP_OPTION_MEM_ENABLE 0x0040 -#define ED_HPP_OPTION_ZERO_WAIT 0x0080 -#define ED_HPP_OPTION_MEM_DISABLE 0x1000 - -/* - * Page ID configuration. - */ - -#define ED_HPP_ID_REVISION_MASK 0x0300 /* revision id */ -#define ED_HPP_ID_SOFT_MODEL_MASK 0xFC00 /* soft model number */ -#define ED_HPP_ID_16_BIT_ACCESS 0x0010 /* if set use 16 bit accesses */ -#define ED_HPP_ID_TWISTED_PAIR 0x0040 - -/* - * Hardware configuration. - */ - -#define ED_HPP_HW_MEM_MAP 0x09 /* low mem map location in HW page */ -#define ED_HPP_HW_ID 0x0C /* revision number, capabilities */ -#define ED_HPP_HW_IRQ 0x0D /* IRQ channel register in HW page */ -#define ED_HPP_HW_WRAP 0x0E /* mem wrap page for rcv */ - -/* - * Lan configuration - */ - -#define ED_HPP_LAN_AUI 0x01 /* Use AUI */ -#define ED_HPP_LAN_TL 0x40 /* Don't use AUI */ - -/* - * Card types. - */ - -#define ED_TYPE_HP_PCLANPLUS 0x00 - -/* - * Definitions for Allied-Telesis SIC - */ -#define ED_SIC_NIC_OFFSET 0 -#define ED_SIC_ASIC_OFFSET 0x10 /* offset to nic i/o regs */ - -#define ED_SIC_IO_PORTS 17 /* # of i/o addresses used */ - -/* - * Chip types. - */ -#define ED_CHIP_TYPE_AX88190 0 -#define ED_CHIP_TYPE_AX88790 1 -#define ED_CHIP_TYPE_DL10019 2 -#define ED_CHIP_TYPE_DL10022 3 -#define ED_CHIP_TYPE_DP8390 4 -#define ED_CHIP_TYPE_NS83903 5 -#define ED_CHIP_TYPE_NS83926 6 -#define ED_CHIP_TYPE_RTL8019 7 -#define ED_CHIP_TYPE_RTL8029 8 -#define ED_CHIP_TYPE_TC3299 9 -#define ED_CHIP_TYPE_TC5299J 10 -#define ED_CHIP_TYPE_W89C926 11 -#define ED_CHIP_TYPE_WD790 12 diff --git a/sys/dev/ed/if_edvar.h b/sys/dev/ed/if_edvar.h deleted file mode 100644 index d6d2d81946b1..000000000000 --- a/sys/dev/ed/if_edvar.h +++ /dev/null @@ -1,304 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1995, David Greenman - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -#ifndef SYS_DEV_ED_IF_EDVAR_H -#define SYS_DEV_ED_IF_EDVAR_H - -#include <dev/mii/mii_bitbang.h> - -/* - * ed_softc: per line info and status - */ -struct ed_softc { - struct ifnet *ifp; - struct ifmedia ifmedia; /* Media info */ - device_t dev; - struct mtx sc_mtx; - - char *type_str; /* pointer to type string */ - u_char vendor; /* interface vendor */ - u_char type; /* interface type code */ - u_char chip_type; /* the type of chip (one of ED_CHIP_TYPE_*) */ - u_char isa16bit; /* width of access to card 0=8 or 1=16 */ - u_char mem_shared; /* NIC memory is shared with host */ - u_char xmit_busy; /* transmitter is busy */ - u_char enaddr[6]; - - int port_used; /* nonzero if ports used */ - struct resource* port_res; /* resource for port range */ - struct resource* port_res2; /* resource for port range */ - bus_space_tag_t port_bst; - bus_space_handle_t port_bsh; - int mem_used; /* nonzero if memory used */ - struct resource* mem_res; /* resource for memory range */ - bus_space_tag_t mem_bst; - bus_space_handle_t mem_bsh; - struct resource* irq_res; /* resource for irq */ - void* irq_handle; /* handle for irq handler */ - int (*sc_media_ioctl)(struct ed_softc *sc, struct ifreq *ifr, - u_long command); - void (*sc_mediachg)(struct ed_softc *); - device_t miibus; /* MII bus for cards with MII. */ - mii_bitbang_ops_t mii_bitbang_ops; - struct callout tick_ch; - void (*sc_tick)(struct ed_softc *); - void (*readmem)(struct ed_softc *sc, bus_size_t src, uint8_t *dst, - uint16_t amount); - u_short (*sc_write_mbufs)(struct ed_softc *, struct mbuf *, bus_size_t); - - int tx_timer; - int nic_offset; /* NIC (DS8390) I/O bus address offset */ - int asic_offset; /* ASIC I/O bus address offset */ - -/* - * The following 'proto' variable is part of a work-around for 8013EBT asics - * being write-only. It's sort of a prototype/shadow of the real thing. - */ - u_char wd_laar_proto; - u_char cr_proto; - -/* - * HP PC LAN PLUS card support. - */ - - u_short hpp_options; /* flags controlling behaviour of the HP card */ - u_short hpp_id; /* software revision and other fields */ - caddr_t hpp_mem_start; /* Memory-mapped IO register address */ - - bus_size_t mem_start; /* NIC memory start address */ - bus_size_t mem_end; /* NIC memory end address */ - uint32_t mem_size; /* total NIC memory size */ - bus_size_t mem_ring; /* start of RX ring-buffer (in NIC mem) */ - - u_char txb_cnt; /* number of transmit buffers */ - u_char txb_inuse; /* number of TX buffers currently in-use */ - - u_char txb_new; /* pointer to where new buffer will be added */ - u_char txb_next_tx; /* pointer to next buffer ready to xmit */ - u_short txb_len[8]; /* buffered xmit buffer lengths */ - u_char tx_page_start; /* first page of TX buffer area */ - u_char rec_page_start; /* first page of RX ring-buffer */ - u_char rec_page_stop; /* last page of RX ring-buffer */ - u_char next_packet; /* pointer to next unread RX packet */ - u_int tx_mem; /* Total amount of RAM for tx */ - u_int rx_mem; /* Total amount of RAM for rx */ - struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */ -}; - -#define ed_nic_barrier(sc, port, length, flags) \ - bus_space_barrier(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (length), (flags)) - -#define ed_nic_inb(sc, port) \ - bus_space_read_1(sc->port_bst, sc->port_bsh, (sc)->nic_offset + (port)) - -#define ed_nic_outb(sc, port, value) \ - bus_space_write_1(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (value)) - -#define ed_nic_inw(sc, port) \ - bus_space_read_2(sc->port_bst, sc->port_bsh, (sc)->nic_offset + (port)) - -#define ed_nic_outw(sc, port, value) \ - bus_space_write_2(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (value)) - -#define ed_nic_insb(sc, port, addr, count) \ - bus_space_read_multi_1(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (addr), (count)) - -#define ed_nic_outsb(sc, port, addr, count) \ - bus_space_write_multi_1(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (addr), (count)) - -#define ed_nic_insw(sc, port, addr, count) \ - bus_space_read_multi_2(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (uint16_t *)(addr), (count)) - -#define ed_nic_outsw(sc, port, addr, count) \ - bus_space_write_multi_2(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (uint16_t *)(addr), (count)) - -#define ed_nic_insl(sc, port, addr, count) \ - bus_space_read_multi_4(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (uint32_t *)(addr), (count)) - -#define ed_nic_outsl(sc, port, addr, count) \ - bus_space_write_multi_4(sc->port_bst, sc->port_bsh, \ - (sc)->nic_offset + (port), (uint32_t *)(addr), (count)) - -#define ed_asic_barrier(sc, port, length, flags) \ - bus_space_barrier(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (length), (flags)) - -#define ed_asic_inb(sc, port) \ - bus_space_read_1(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port)) - -#define ed_asic_outb(sc, port, value) \ - bus_space_write_1(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (value)) - -#define ed_asic_inw(sc, port) \ - bus_space_read_2(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port)) - -#define ed_asic_outw(sc, port, value) \ - bus_space_write_2(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (value)) - -#define ed_asic_insb(sc, port, addr, count) \ - bus_space_read_multi_1(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (addr), (count)) - -#define ed_asic_outsb(sc, port, addr, count) \ - bus_space_write_multi_1(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (addr), (count)) - -#define ed_asic_insw(sc, port, addr, count) \ - bus_space_read_multi_2(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (uint16_t *)(addr), (count)) - -#define ed_asic_outsw(sc, port, addr, count) \ - bus_space_write_multi_2(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (uint16_t *)(addr), (count)) - -#define ed_asic_insl(sc, port, addr, count) \ - bus_space_read_multi_4(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (uint32_t *)(addr), (count)) - -#define ed_asic_outsl(sc, port, addr, count) \ - bus_space_write_multi_4(sc->port_bst, sc->port_bsh, \ - (sc)->asic_offset + (port), (uint32_t *)(addr), (count)) - -void ed_release_resources(device_t); -int ed_alloc_port(device_t, int, int); -int ed_alloc_memory(device_t, int, int); -int ed_alloc_irq(device_t, int, int); - -int ed_probe_generic8390(struct ed_softc *); -int ed_probe_WD80x3(device_t, int, int); -int ed_probe_WD80x3_generic(device_t, int, uint16_t *[]); -int ed_probe_RTL80x9(device_t, int, int); -#ifdef ED_3C503 -int ed_probe_3Com(device_t, int, int); -#endif -#ifdef ED_SIC -int ed_probe_SIC(device_t, int, int); -#endif -int ed_probe_Novell_generic(device_t, int); -int ed_probe_Novell(device_t, int, int); -void ed_Novell_read_mac(struct ed_softc *); -#ifdef ED_HPP -int ed_probe_HP_pclanp(device_t, int, int); -#endif - -int ed_attach(device_t); -int ed_detach(device_t); -int ed_clear_memory(device_t); -int ed_isa_mem_ok(device_t, u_long, u_int); /* XXX isa specific */ -void ed_stop(struct ed_softc *); -void ed_shmem_readmem16(struct ed_softc *, bus_size_t, uint8_t *, uint16_t); -void ed_shmem_readmem8(struct ed_softc *, bus_size_t, uint8_t *, uint16_t); -u_short ed_shmem_write_mbufs(struct ed_softc *, struct mbuf *, bus_size_t); -void ed_pio_readmem(struct ed_softc *, bus_size_t, uint8_t *, uint16_t); -void ed_pio_writemem(struct ed_softc *, uint8_t *, uint16_t, uint16_t); -u_short ed_pio_write_mbufs(struct ed_softc *, struct mbuf *, bus_size_t); - -void ed_disable_16bit_access(struct ed_softc *); -void ed_enable_16bit_access(struct ed_softc *); - -void ed_gen_ifmedia_init(struct ed_softc *); - -driver_intr_t edintr; - -extern devclass_t ed_devclass; - - -/* - * Vendor types - */ -#define ED_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */ -#define ED_VENDOR_3COM 0x01 /* 3Com */ -#define ED_VENDOR_NOVELL 0x02 /* Novell */ -#define ED_VENDOR_HP 0x03 /* Hewlett Packard */ -#define ED_VENDOR_SIC 0x04 /* Allied-Telesis SIC */ - -/* - * Configure time flags - */ -/* - * this sets the default for enabling/disabling the transceiver - */ -#define ED_FLAGS_DISABLE_TRANCEIVER 0x0001 - -/* - * This forces the board to be used in 8/16bit mode even if it - * autoconfigs differently - */ -#define ED_FLAGS_FORCE_8BIT_MODE 0x0002 -#define ED_FLAGS_FORCE_16BIT_MODE 0x0004 - -/* - * This disables the use of double transmit buffers. - */ -#define ED_FLAGS_NO_MULTI_BUFFERING 0x0008 - -/* - * This forces all operations with the NIC memory to use Programmed - * I/O (i.e. not via shared memory) - */ -#define ED_FLAGS_FORCE_PIO 0x0010 - -/* - * This forces a PC Card, and disables ISA memory range checks - */ -#define ED_FLAGS_PCCARD 0x0020 - -/* - * These are flags describing the chip type. - */ -#define ED_FLAGS_TOSH_ETHER 0x10000 -#define ED_FLAGS_GWETHER 0x20000 - -#define ED_FLAGS_GETTYPE(flg) ((flg) & 0xff0000) - -#define ED_MUTEX(_sc) (&(_sc)->sc_mtx) -#define ED_LOCK(_sc) mtx_lock(ED_MUTEX(_sc)) -#define ED_UNLOCK(_sc) mtx_unlock(ED_MUTEX(_sc)) -#define ED_LOCK_INIT(_sc) \ - mtx_init(ED_MUTEX(_sc), device_get_nameunit(_sc->dev), \ - MTX_NETWORK_LOCK, MTX_DEF) -#define ED_LOCK_DESTROY(_sc) mtx_destroy(ED_MUTEX(_sc)); -#define ED_ASSERT_LOCKED(_sc) mtx_assert(ED_MUTEX(_sc), MA_OWNED); -#define ED_ASSERT_UNLOCKED(_sc) mtx_assert(ED_MUTEX(_sc), MA_NOTOWNED); - -#endif /* SYS_DEV_ED_IF_EDVAR_H */ diff --git a/sys/dev/ed/rtl80x9reg.h b/sys/dev/ed/rtl80x9reg.h deleted file mode 100644 index 13d932b58d91..000000000000 --- a/sys/dev/ed/rtl80x9reg.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003, David Madole - * All rights reserved. - * Copyright (c) 2005, M. Warner Losh. - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * Based on patches subitted by: David Madole, edited by M. Warner Losh. - * - * $FreeBSD$ - */ - -/* - * RTL8019/8029 Specific Registers - */ - -#define ED_RTL80X9_CONFIG0 0x03 -#define ED_RTL80X9_CONFIG2 0x05 -#define ED_RTL80X9_CONFIG3 0x06 -#define ED_RTL80X9_80X9ID0 0x0a -#define ED_RTL80X9_ID0 0x50 -#define ED_RTL80X9_80X9ID1 0x0b -#define ED_RTL8019_ID1 0x70 -#define ED_RTL8029_ID1 0x43 - -#define ED_RTL80X9_CF0_BNC 0x04 -#define ED_RTL80X9_CF0_AUI 0x20 - -#define ED_RTL80X9_CF2_MEDIA 0xc0 -#define ED_RTL80X9_CF2_AUTO 0x00 -#define ED_RTL80X9_CF2_10_T 0x40 -#define ED_RTL80X9_CF2_10_5 0x80 -#define ED_RTL80X9_CF2_10_2 0xc0 - -#define ED_RTL80X9_CF3_FUDUP 0x40 - -#define ED_RTL8029_PCI_ID 0x802910ec diff --git a/sys/dev/ed/tc5299jreg.h b/sys/dev/ed/tc5299jreg.h deleted file mode 100644 index 42ab8239a110..000000000000 --- a/sys/dev/ed/tc5299jreg.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2005, M. Warner Losh. - * 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 unmodified, 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 AUTHOR 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 AUTHOR 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. - * - * $FreeBSD$ - */ - -/* Tamarack TC5299J */ -#define ED_TC5299J_CRA 0x0a /* Config Register A */ -#define ED_TC5299J_CRB 0x0b /* Config Register B */ -#define ED_TC5299J_MIIBUS 0x03 /* MII bus register on in bank 3 */ - -#define ED_TC5299J_MII_CLK 0x01 -#define ED_TC5299J_MII_DATAOUT 0x02 -#define ED_TC5299J_MII_DIRIN 0x04 -#define ED_TC5299J_MII_DATAIN 0x08 diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index fff8c599bafb..ad45768f8a5f 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -271,8 +271,6 @@ device wb # Winbond W89C840F device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') # ISA Ethernet NICs. pccard NICs included. -# 'device ed' requires 'device miibus' -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards device ex # Intel EtherExpress Pro/10 and Pro/10+ device ep # Etherlink III based cards device fe # Fujitsu MB8696x based cards diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index db2795b6828b..33d5296a51c8 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -505,9 +505,6 @@ device cpufreq # ctau: Cronyx Tau sync dual port V.35/RS-232/RS-530/RS-449/X.21/G.703/E1 # serial adaptor (requires sppp (default), or NETGRAPH if # NETGRAPH_CRONYX is configured) -# ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 -# HP PC Lan+, various PC Card devices -# (requires miibus) # ipw: Intel PRO/Wireless 2100 IEEE 802.11 adapter # iwi: Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters # Requires the iwi firmware module @@ -536,7 +533,6 @@ hint.ctau.0.port="0x240" hint.ctau.0.irq="15" hint.ctau.0.drq="7" #options NETGRAPH_CRONYX # Enable NETGRAPH support for Cronyx adapter(s) -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards options ED_3C503 options ED_HPP options ED_SIC diff --git a/sys/modules/Makefile b/sys/modules/Makefile index b7ec5a23d34a..9bbff393c4e6 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -107,7 +107,6 @@ SUBDIR= \ dcons_crom \ ${_dpms} \ dummynet \ - ${_ed} \ ${_efirt} \ ${_em} \ ${_ena} \ @@ -599,7 +598,6 @@ _cbb= cbb _cpuctl= cpuctl _cpufreq= cpufreq _dpms= dpms -_ed= ed _em= em _ep= ep _et= et diff --git a/sys/modules/ed/Makefile b/sys/modules/ed/Makefile deleted file mode 100644 index ca753aa5fc33..000000000000 --- a/sys/modules/ed/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/ed - -KMOD= if_ed -SRCS= if_ed.c -SRCS+= if_ed_novell.c if_ed_wd80x3.c if_ed_rtl80x9.c isa_if.h -SRCS+= if_ed_isa.c -SRCS.ED_HPP=if_ed_hpp.c -SRCS.ED_SIC=if_ed_sic.c -SRCS.ED_3C503=if_ed_3c503.c -SRCS+= if_ed_pccard.c pccarddevs.h card_if.h -SRCS.DEV_PCI=if_ed_pci.c pci_if.h - -SRCS+= opt_ed.h bus_if.h device_if.h miibus_if.h - -.include <bsd.kmod.mk> |