diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index 5c706e85541a..a8309020bd04 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2302 2020/01/19 10:50:25 martin Exp $ +# $NetBSD: mi,v 1.2303 2020/01/19 20:00:36 thorpej Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -2366,7 +2366,7 @@ ./usr/include/net/if_stf.h comp-c-include ./usr/include/net/if_stripvar.h comp-obsolete obsolete ./usr/include/net/if_tap.h comp-c-include -./usr/include/net/if_token.h comp-c-include +./usr/include/net/if_token.h comp-obsolete obsolete ./usr/include/net/if_tun.h comp-c-include ./usr/include/net/if_types.h comp-c-include ./usr/include/net/if_vlanvar.h comp-c-include diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index da9fb617869a..bef356fdfbe1 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1672 2020/01/19 17:53:15 thorpej Exp $ +# $NetBSD: mi,v 1.1673 2020/01/19 20:00:36 thorpej Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -1845,7 +1845,7 @@ ./usr/share/man/cat4/tprof.0 man-sys-catman .cat ./usr/share/man/cat4/tps65217pmic.0 man-sys-catman .cat ./usr/share/man/cat4/tqphy.0 man-sys-catman .cat -./usr/share/man/cat4/tr.0 man-sys-catman .cat +./usr/share/man/cat4/tr.0 man-obsolete obsolete ./usr/share/man/cat4/tra.0 man-sys-catman .cat ./usr/share/man/cat4/trm.0 man-sys-catman .cat ./usr/share/man/cat4/tsllux.0 man-sys-catman .cat @@ -4955,7 +4955,7 @@ ./usr/share/man/html4/tprof.html man-sys-htmlman html ./usr/share/man/html4/tps65217pmic.html man-sys-htmlman html ./usr/share/man/html4/tqphy.html man-sys-htmlman html -./usr/share/man/html4/tr.html man-sys-htmlman html +./usr/share/man/html4/tr.html man-obsolete obsolete ./usr/share/man/html4/tra.html man-sys-htmlman html ./usr/share/man/html4/trm.html man-sys-htmlman html ./usr/share/man/html4/tsllux.html man-sys-htmlman html @@ -7985,7 +7985,7 @@ ./usr/share/man/man4/tprof.4 man-sys-man .man ./usr/share/man/man4/tps65217pmic.4 man-sys-man .man ./usr/share/man/man4/tqphy.4 man-sys-man .man -./usr/share/man/man4/tr.4 man-sys-man .man +./usr/share/man/man4/tr.4 man-obsolete obsolete ./usr/share/man/man4/tra.4 man-sys-man .man ./usr/share/man/man4/trm.4 man-sys-man .man ./usr/share/man/man4/tsllux.4 man-sys-man .man diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 052a0d77d0b0..847489ad67cc 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.696 2020/01/19 17:53:15 thorpej Exp $ +# $NetBSD: Makefile,v 1.697 2020/01/19 20:00:35 thorpej Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -63,7 +63,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ ssdfb.4 st.4 ste.4 stge.4 sti.4 stpcide.4 sv.4 \ svwsata.4 swsensor.4 swwdog.4 sysmon.4 \ tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 tea5767radio.4 termios.4 tfb.4 \ - thinkpad.4 ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tr.4 tra.4 \ + thinkpad.4 ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tra.4 \ trm.4 tsllux.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \ uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 umb.4 \ unix.4 userconf.4 \ diff --git a/share/man/man4/tr.4 b/share/man/man4/tr.4 deleted file mode 100644 index e3d2f823dfc5..000000000000 --- a/share/man/man4/tr.4 +++ /dev/null @@ -1,112 +0,0 @@ -.\" $NetBSD: tr.4,v 1.15 2008/04/30 13:10:54 martin Exp $ -.\" -.\" Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Christoph Badura. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd April 14, 1999 -.Dt TR 4 -.Os -.Sh NAME -.Nm tr -.Nd TROPIC based shared memory Token-Ring cards device driver -.Sh SYNOPSIS -.Cd "tr0 at isa? port 0xa20 iomem 0xd800 irq ?" -.Cd "tr* at isa? port ? irq ?" -.Cd "tr* at isapnp?" -.Cd "tr* at mca? slot ?" -.Cd "tr* at pcmcia? function ?" -.Sh DESCRIPTION -The -.Nm -device driver supports TROPIC I based shared-memory Token-Ring cards. -.Sh HARDWARE -Supported cards include the following IBM and 3Com models: -.Pp -.Bl -tag -width xxxx -offset indent -.It IBM -Token-Ring Network PC Adapter -.It IBM -Token-Ring Network PC Adapter II -.It IBM -Token-Ring Network Adapter/A -.It IBM -Token-Ring Network 16/4 Adapter -.It IBM -Token-Ring Network 16/4 Adapter/A -.It IBM -Token-Ring 16/4 Credit Card Adapter -.It IBM -Token Ring Auto 16/4 Credit Card Adapter -.It IBM -Turbo 16/4 Token Ring PC Card -.It IBM -16/4 ISA Adapter -.It IBM -Auto 16/4 Token-Ring ISA Adapter -.It IBM -Token Ring 16/4 Credit Card Adapter -.It IBM -Token Ring Auto 16/4 Credit Card Adapter -.It IBM -Turbo 16/4 Token Ring PC Card -.It 3Com -3C619 TokenLink -.It 3Com -3C319 TokenLink Velocity -.It 3Com -3C389 TokenLink Velocity PC Card -.El -.Sh SOURCE ROUTING -Setting IFF_LINK0 enables Token-Ring source routing. Setting -IFF_LINK1 uses all-routes broadcasts otherwise single-route broadcasts -are used. -.Sh NOTES -The MCA attachment has been only tested on -IBM Token Ring 16/4 Adapter/A so far. -It doesn't support -.Xr ifmedia 4 -yet, too. -.\".Sh MEDIA SELECTION -.\".Sh DIAGNOSTICS -.Sh SEE ALSO -.Xr ifmedia 4 , -.Xr intro 4 , -.Xr isa 4 , -.Xr isapnp 4 , -.Xr mca 4 , -.Xr pcmcia 4 , -.Xr ifconfig 8 -.Sh HISTORY -The -.Nm -driver -appeared in -.Nx 1.4 . -.Sh BUGS -The PCMCIA attachment does not work with the -.Xr cbb 4 -CardBus driver. diff --git a/sys/arch/amd64/conf/ALL b/sys/arch/amd64/conf/ALL index f10a2d957089..59871ffc41b3 100644 --- a/sys/arch/amd64/conf/ALL +++ b/sys/arch/amd64/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.138 2020/01/19 06:55:22 thorpej Exp $ +# $NetBSD: ALL,v 1.139 2020/01/19 20:00:37 thorpej Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.138 $" +#ident "ALL-$Revision: 1.139 $" maxusers 64 # estimated number of users @@ -1036,8 +1036,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLAN/IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? @@ -1069,9 +1067,6 @@ le* at bicc? ne0 at isa? port 0x280 irq 9 # NE[12]000 Ethernet cards ne1 at isa? port 0x300 irq 10 sm0 at isa? port 0x300 irq 10 # SMC91C9x Ethernet -tr0 at isa? port 0xa20 iomem 0xd8000 irq ? # IBM TROPIC based Token-Ring -tr1 at isa? port 0xa24 iomem 0xd0000 irq ? # IBM TROPIC based Token-Ring -tr* at isa? port ? irq ? # 3Com TROPIC based Token-Ring we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet we1 at isa? port 0x300 iomem 0xcc000 irq 10 diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index a0e495578d3f..efb7dafce465 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.556 2020/01/19 06:55:22 thorpej Exp $ +# $NetBSD: GENERIC,v 1.557 2020/01/19 20:00:37 thorpej Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.556 $" +#ident "GENERIC-$Revision: 1.557 $" maxusers 64 # estimated number of users @@ -852,8 +852,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? diff --git a/sys/arch/evbarm/conf/LUBBOCK b/sys/arch/evbarm/conf/LUBBOCK index 76dfb49844b1..c79ce4429b82 100644 --- a/sys/arch/evbarm/conf/LUBBOCK +++ b/sys/arch/evbarm/conf/LUBBOCK @@ -213,7 +213,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? diff --git a/sys/arch/evbarm/conf/MPCSA_GENERIC b/sys/arch/evbarm/conf/MPCSA_GENERIC index d9c7e0c9955e..b06af1b60949 100644 --- a/sys/arch/evbarm/conf/MPCSA_GENERIC +++ b/sys/arch/evbarm/conf/MPCSA_GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: MPCSA_GENERIC,v 1.68 2020/01/19 01:25:04 thorpej Exp $ +# $NetBSD: MPCSA_GENERIC,v 1.69 2020/01/19 20:00:37 thorpej Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/evbarm/conf/std.mpcsa" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.68 $" +#ident "GENERIC-$Revision: 1.69 $" maxusers 32 # estimated number of users @@ -370,8 +370,6 @@ sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives #ne* at pcmcia? function ? # NE2000-compatible Ethernet #ray* at pcmcia? function ? # Raytheon Raylink (802.11) #sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) #xirc* at pcmcia? function ? # Xircom CreditCard Ethernet #com* at xirc? diff --git a/sys/arch/evbarm/conf/TWINTAIL b/sys/arch/evbarm/conf/TWINTAIL index 7ac59164371d..e546363202c6 100644 --- a/sys/arch/evbarm/conf/TWINTAIL +++ b/sys/arch/evbarm/conf/TWINTAIL @@ -1,4 +1,4 @@ -# $NetBSD: TWINTAIL,v 1.76 2020/01/19 01:25:05 thorpej Exp $ +# $NetBSD: TWINTAIL,v 1.77 2020/01/19 20:00:37 thorpej Exp $ # # TWINTAIL -- Genetec corp. G4255EB-X002 Evaluation Board Kernel # @@ -325,8 +325,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? diff --git a/sys/arch/evbppc/conf/OPENBLOCKS266_OPT b/sys/arch/evbppc/conf/OPENBLOCKS266_OPT index 21b7b4f70308..a14118ca9152 100644 --- a/sys/arch/evbppc/conf/OPENBLOCKS266_OPT +++ b/sys/arch/evbppc/conf/OPENBLOCKS266_OPT @@ -1,4 +1,4 @@ -# $NetBSD: OPENBLOCKS266_OPT,v 1.27 2019/04/13 08:22:59 isaki Exp $ +# $NetBSD: OPENBLOCKS266_OPT,v 1.28 2020/01/19 20:00:37 thorpej Exp $ # include "arch/evbppc/conf/OPENBLOCKS266" @@ -77,8 +77,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? diff --git a/sys/arch/i386/conf/ALL b/sys/arch/i386/conf/ALL index cbd1fda06fde..e6eb5a8a5f37 100644 --- a/sys/arch/i386/conf/ALL +++ b/sys/arch/i386/conf/ALL @@ -1,4 +1,4 @@ -# $NetBSD: ALL,v 1.482 2020/01/19 06:55:23 thorpej Exp $ +# $NetBSD: ALL,v 1.483 2020/01/19 20:00:37 thorpej Exp $ # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # # ALL machine description file @@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "ALL-$Revision: 1.482 $" +#ident "ALL-$Revision: 1.483 $" maxusers 64 # estimated number of users @@ -1115,7 +1115,6 @@ ep* at isapnp? # 3Com 3c509 Ethernet fmv* at isapnp? # Fujitsu FMV-183 le* at isapnp? # AMD PCnet-ISA Ethernet ne* at isapnp? # NE2000-compatible Ethernet -tr* at isapnp? # IBM/3Com TROPIC Token-Ring # PCMCIA network interfaces an* at pcmcia? function ? # Aironet PC4500/PC4800 (802.11) @@ -1128,8 +1127,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLAN/IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? @@ -1161,9 +1158,6 @@ le* at bicc? ne0 at isa? port 0x280 irq 9 # NE[12]000 Ethernet cards ne1 at isa? port 0x300 irq 10 sm0 at isa? port 0x300 irq 10 # SMC91C9x Ethernet -tr0 at isa? port 0xa20 iomem 0xd8000 irq ? # IBM TROPIC based Token-Ring -tr1 at isa? port 0xa24 iomem 0xd0000 irq ? # IBM TROPIC based Token-Ring -tr* at isa? port ? irq ? # 3Com TROPIC based Token-Ring we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet we1 at isa? port 0x300 iomem 0xcc000 irq 10 @@ -1187,7 +1181,6 @@ ep* at mca? slot ? # 3Com EtherLink III (3c529) we* at mca? slot ? # WD/SMC Ethernet ate* at mca? slot ? # Allied Telesis AT1720 ne* at mca? slot ? # Novell NE/2 and clones -tr* at mca? slot ? # IBM Token Ring adapter tra* at mca? slot ? # Tiara LANCard/E and clones le* at mca? slot ? # SKNET Personal/MC2+ diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index 9518188782a2..dafb67b0b0fa 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1220 2020/01/19 06:55:23 thorpej Exp $ +# $NetBSD: GENERIC,v 1.1221 2020/01/19 20:00:37 thorpej Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1220 $" +#ident "GENERIC-$Revision: 1.1221 $" maxusers 64 # estimated number of users @@ -1029,7 +1029,6 @@ ep* at isapnp? # 3Com 3c509 Ethernet fmv* at isapnp? # Fujitsu FMV-183 le* at isapnp? # AMD PCnet-ISA Ethernet ne* at isapnp? # NE2000-compatible Ethernet -tr* at isapnp? # IBM/3Com TROPIC Token-Ring # PCMCIA network interfaces an* at pcmcia? function ? # Aironet PC4500/PC4800 (802.11) @@ -1042,8 +1041,6 @@ mbe* at pcmcia? function ? # MB8696x based Ethernet ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet -# tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLAN/IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? @@ -1075,9 +1072,6 @@ le* at bicc? ne0 at isa? port 0x280 irq 9 # NE[12]000 Ethernet cards ne1 at isa? port 0x300 irq 10 sm0 at isa? port 0x300 irq 10 # SMC91C9x Ethernet -tr0 at isa? port 0xa20 iomem 0xd8000 irq ? # IBM TROPIC based Token-Ring -tr1 at isa? port 0xa24 iomem 0xd0000 irq ? # IBM TROPIC based Token-Ring -tr* at isa? port ? irq ? # 3Com TROPIC based Token-Ring we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet we1 at isa? port 0x300 iomem 0xcc000 irq 10 @@ -1101,7 +1095,6 @@ ep* at mca? slot ? # 3Com EtherLink III (3c529) we* at mca? slot ? # WD/SMC Ethernet ate* at mca? slot ? # Allied Telesis AT1720 ne* at mca? slot ? # Novell NE/2 and clones -tr* at mca? slot ? # IBM Token Ring adapter tra* at mca? slot ? # Tiara LANCard/E and clones le* at mca? slot ? # SKNET Personal/MC2+ diff --git a/sys/arch/i386/conf/GENERIC_PS2TINY b/sys/arch/i386/conf/GENERIC_PS2TINY index 583b1ad3ecc1..c4e4a15a4e12 100644 --- a/sys/arch/i386/conf/GENERIC_PS2TINY +++ b/sys/arch/i386/conf/GENERIC_PS2TINY @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC_PS2TINY,v 1.80 2018/08/01 16:59:09 maxv Exp $ +# $NetBSD: GENERIC_PS2TINY,v 1.81 2020/01/19 20:00:37 thorpej Exp $ # # GENERIC-style kernel config for IBM PS/2 with MCA bus. It only contains # IBM PS/2 related stuff and has been generally trimmed down somewhat, @@ -177,7 +177,6 @@ ep* at mca? slot ? # 3Com EtherLink III (3c529) we* at mca? slot ? # WD/SMC Ethernet ate* at mca? slot ? # Allied Telesis AT1720 ne* at mca? slot ? # Novell NE/2 and clones -tr* at mca? slot ? # IBM Token Ring adapter tra* at mca? slot ? # Tiara LANCard/E and clones le* at mca? slot ? # SKNET Personal/MC2+ diff --git a/sys/arch/i386/conf/INSTALL_FLOPPY b/sys/arch/i386/conf/INSTALL_FLOPPY index da91f5b5def1..f010854e7fea 100644 --- a/sys/arch/i386/conf/INSTALL_FLOPPY +++ b/sys/arch/i386/conf/INSTALL_FLOPPY @@ -1,4 +1,4 @@ -# $NetBSD: INSTALL_FLOPPY,v 1.51 2020/01/19 06:55:23 thorpej Exp $ +# $NetBSD: INSTALL_FLOPPY,v 1.52 2020/01/19 20:00:37 thorpej Exp $ # # INSTALL - Installation kernel. # @@ -525,7 +525,6 @@ ep* at isapnp? # 3Com 3c509 Ethernet fmv* at isapnp? # Fujitsu FMV-183 le* at isapnp? # AMD PCnet-ISA Ethernet ne* at isapnp? # NE2000-compatible Ethernet -tr* at isapnp? # IBM/3Com TROPIC Token-Ring # PCMCIA network interfaces an* at pcmcia? function ? # Aironet PC4500/PC4800 (802.11) @@ -568,9 +567,6 @@ le* at bicc? ne0 at isa? port 0x280 irq 9 # NE[12]000 Ethernet cards ne1 at isa? port 0x300 irq 10 sm0 at isa? port 0x300 irq 10 # SMC91C9x Ethernet -tr0 at isa? port 0xa20 iomem 0xd8000 irq ? # IBM TROPIC based Token-Ring -tr1 at isa? port 0xa24 iomem 0xd0000 irq ? # IBM TROPIC based Token-Ring -tr* at isa? port ? irq ? # 3Com TROPIC based Token-Ring we0 at isa? port 0x280 iomem 0xd0000 irq 9 # WD/SMC Ethernet we1 at isa? port 0x300 iomem 0xcc000 irq 10 diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index 36f2af15b24e..d7e4a4c97b3c 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.220 2020/01/19 06:55:24 thorpej Exp $ +# $NetBSD: GENERIC,v 1.221 2020/01/19 20:00:37 thorpej Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/sparc64/conf/std.sparc64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.220 $" +#ident "GENERIC-$Revision: 1.221 $" maxusers 64 @@ -796,8 +796,6 @@ pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation #ne* at pcmcia? function ? # NE2000-compatible Ethernet #ray* at pcmcia? function ? # Raytheon Raylink (802.11) UT #sm* at pcmcia? function ? # Megahertz Ethernet UT -# tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring UT #wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) #xirc* at pcmcia? function ? # Xircom CreditCard Ethernet UT #com* at xirc? diff --git a/sys/conf/files b/sys/conf/files index 5cfe61f95fe6..86ad86c52447 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1250 2020/01/19 06:55:24 thorpej Exp $ +# $NetBSD: files,v 1.1251 2020/01/19 20:00:37 thorpej Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -438,14 +438,12 @@ include "dev/splash/files.splash" include "dev/videomode/files.videomode" # net device attributes - we have generic code for arc(net), ether(net), -# fddi, and token ring. +# and fddi # define arcnet define ether define fddi -define hippi define ieee1394 -define token define sppp define wlan define crypto @@ -771,11 +769,6 @@ file dev/ic/dp83905.c dp83905 define mx98905 file dev/ic/mx98905.c mx98905 -# TROPIC Token-Ring controller -# -device tr: arp, token, ifnet -file dev/ic/tropic.c tr - # NCR 5380 SCSI Bus Controller # define ncr5380sbc diff --git a/sys/dev/ic/tropic.c b/sys/dev/ic/tropic.c deleted file mode 100644 index 0c7160728904..000000000000 --- a/sys/dev/ic/tropic.c +++ /dev/null @@ -1,1744 +0,0 @@ -/* $NetBSD: tropic.c,v 1.53 2019/05/29 10:07:29 msaitoh Exp $ */ - -/* - * Ported to NetBSD by Onno van der Linden - * Many thanks to Larry Lile for sending me the IBM TROPIC documentation. - * - * Mach Operating System - * Copyright (c) 1991 Carnegie Mellon University - * Copyright (c) 1991 IBM Corporation - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation, - * and that the name IBM not be used in advertising or publicity - * pertaining to distribution of the software without specific, written - * prior permission. - * - * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: tropic.c,v 1.53 2019/05/29 10:07:29 msaitoh Exp $"); - -#include "opt_inet.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef INET -#include -#include -#include -#include -#include -#endif - -#include -#include - -#include -#include - -static void tr_shutdown(void *); -static void tr_reopen(void *); - -void tr_rint(struct tr_softc *); -void tr_xint(struct tr_softc *); -void tr_oldxint(struct tr_softc *); -struct mbuf *tr_get(struct tr_softc *, int, struct ifnet *); -void tr_opensap(struct tr_softc *, u_char); -int tr_mbcopy(struct tr_softc *, bus_size_t, struct mbuf *); -void tr_bcopy(struct tr_softc *, u_char *, int); -void tr_start(struct ifnet *); -void tr_oldstart(struct ifnet *); -void tr_watchdog(struct ifnet *); -int tr_mediachange(struct ifnet *); -void tr_mediastatus(struct ifnet *, struct ifmediareq *); -int tropic_mediachange(struct tr_softc *); -void tropic_mediastatus(struct tr_softc *, struct ifmediareq *); -void tr_reinit(void *); - -/* - * TODO: - * clean up tr_intr: more subroutines - * IFF_LINK0 == IFM_TOK_SRCRT change to link flag implies media flag change - * IFF_LINK1 == IFM_TOK_ALLR change to link flag implies media flag change - * XXX Create receive_done queue to kill "ASB not free", but does this ever - * XXX happen ? - */ - -static int media[] = { - IFM_TOKEN | IFM_TOK_UTP4, - IFM_TOKEN | IFM_TOK_STP4, - IFM_TOKEN | IFM_TOK_UTP16, - IFM_TOKEN | IFM_TOK_STP16, - IFM_TOKEN | IFM_TOK_UTP4, - IFM_TOKEN | IFM_TOK_UTP16, - IFM_TOKEN | IFM_TOK_STP4, - IFM_TOKEN | IFM_TOK_STP16 -}; - -int -tropic_mediachange(struct tr_softc *sc) -{ - if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_TOKEN) - return EINVAL; - - switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) { - case IFM_TOK_STP16: - case IFM_TOK_UTP16: - if ((sc->sc_init_status & RSP_16) == 0) { - tr_stop(sc); - if (tr_setspeed(sc, 16)) - return EINVAL; - if (tr_reset(sc)) - return EINVAL; - if (tr_config(sc)) - return EINVAL; - } - break; - case IFM_TOK_STP4: - case IFM_TOK_UTP4: - if ((sc->sc_init_status & RSP_16) != 0) { - tr_stop(sc); - if (tr_setspeed(sc, 4)) - return EINVAL; - if (tr_reset(sc)) - return EINVAL; - if (tr_config(sc)) - return EINVAL; - } - break; - } -/* - * XXX Handle Early Token Release !!!! - */ - return 0; -} - -void -tropic_mediastatus(struct tr_softc *sc, struct ifmediareq *ifmr) -{ - struct ifmedia *ifm = &sc->sc_media; - - ifmr->ifm_active = ifm->ifm_cur->ifm_media; -} - -int -tr_config(struct tr_softc *sc) -{ - if (sc->sc_init_status & FAST_PATH_TRANSMIT) { - int i; - - for (i=0; i < SRB_CFP_CMDSIZE; i++) - SRB_OUTB(sc, sc->sc_srb, i, 0); - - SRB_OUTB(sc, sc->sc_srb, SRB_CMD, DIR_CONFIG_FAST_PATH_RAM); - - SRB_OUTW(sc, sc->sc_srb, SRB_CFP_RAMSIZE, - (16 + (sc->sc_nbuf * FP_BUF_LEN) / 8)); - SRB_OUTW(sc, sc->sc_srb, SRB_CFP_BUFSIZE, FP_BUF_LEN); - - /* tell adapter: command in SRB */ - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); - - for (i = 0; i < 30000; i++) { - if (ACA_RDB(sc, ACA_ISRP_o) & SRB_RESP_INT) - break; - delay(100); - } - - if (i == 30000 && sc->sc_srb == ACA_RDW(sc, ACA_WRBR)) { - aprint_error_dev(sc->sc_dev, - "no response for fast path cfg\n"); - return 1; - } - - ACA_RSTB(sc, ACA_ISRP_o, ~(SRB_RESP_INT)); - - if ((SRB_INB(sc, sc->sc_srb, SRB_RETCODE) != 0)) { - printf("%s: cfg fast path returned: 0x%02x\n", - device_xname(sc->sc_dev), - SRB_INB(sc, sc->sc_srb, SRB_RETCODE)); - return 1; - } - - sc->sc_txca = SRB_INW(sc, sc->sc_srb, SRB_CFPRESP_FPXMIT); - sc->sc_srb = SRB_INW(sc, sc->sc_srb, SRB_CFPRESP_SRBADDR); - } else { - if (sc->sc_init_status & RSP_16) - sc->sc_maxmtu = sc->sc_dhb16maxsz; - else - sc->sc_maxmtu = sc->sc_dhb4maxsz; -/* - * XXX Not completely true because Fast Path Transmit has 514 byte buffers - * XXX and TR_MAX_LINK_HDR is only correct when source-routing is used. - * XXX depending on whether source routing is used change the calculation - * XXX use IFM_TOK_SRCRT (IFF_LINK0) - * XXX recompute sc_minbuf !! - */ - sc->sc_maxmtu -= TR_MAX_LINK_HDR; - } - return 0; -} - -int -tr_attach(struct tr_softc *sc) -{ - int nmedia, *mediaptr, *defmediaptr; - int i, temp; - u_int8_t myaddr[ISO88025_ADDR_LEN]; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - - if (sc->sc_init_status & FAST_PATH_TRANSMIT) { - int numbuf = 0; - - switch (sc->sc_memsize) { - case 65536: - numbuf = 58; - sc->sc_maxmtu = IPMTU_4MBIT_MAX; - break; - case 32768: - numbuf = 29; - sc->sc_maxmtu = IPMTU_4MBIT_MAX; - break; - case 16384: - numbuf = 13; - sc->sc_maxmtu = IPMTU_4MBIT_MAX; - break; - case 8192: - numbuf = 5; - sc->sc_maxmtu = ISO88025_MTU; - } - - sc->sc_minbuf = ((sc->sc_maxmtu + 511) / 512) + 1; - sc->sc_nbuf = numbuf; - -/* - * Create circular queues caching the buffer pointers ? - */ - } else { -/* - * MAX_MACFRAME_SIZE = DHB_SIZE - 6 - * IPMTU = MAX_MACFRAME_SIZE - (14 + 18 + 8) - * (14 = header, 18 = sroute, 8 = llcsnap) - */ - - switch (sc->sc_memsize) { - case 8192: - sc->sc_dhb4maxsz = 2048; - sc->sc_dhb16maxsz = 2048; - break; - case 16384: - sc->sc_dhb4maxsz = 4096; - sc->sc_dhb16maxsz = 4096; - break; - case 32768: - sc->sc_dhb4maxsz = 4464; - sc->sc_dhb16maxsz = 8192; - break; - case 65536: - sc->sc_dhb4maxsz = 4464; - sc->sc_dhb16maxsz = 8192; - break; - } - switch (MM_INB(sc, TR_DHB4_OFFSET)) { - case 0xF: - if (sc->sc_dhb4maxsz > 2048) - sc->sc_dhb4maxsz = 2048; - break; - case 0xE: - if (sc->sc_dhb4maxsz > 4096) - sc->sc_dhb4maxsz = 4096; - break; - case 0xD: - if (sc->sc_dhb4maxsz > 4464) - sc->sc_dhb4maxsz = 4464; - break; - } - - switch (MM_INB(sc, TR_DHB16_OFFSET)) { - case 0xF: - if (sc->sc_dhb16maxsz > 2048) - sc->sc_dhb16maxsz = 2048; - break; - case 0xE: - if (sc->sc_dhb16maxsz > 4096) - sc->sc_dhb16maxsz = 4096; - break; - case 0xD: - if (sc->sc_dhb16maxsz > 8192) - sc->sc_dhb16maxsz = 8192; - break; - case 0xC: - if (sc->sc_dhb16maxsz > 8192) - sc->sc_dhb16maxsz = 8192; - break; - case 0xB: - if (sc->sc_dhb16maxsz > 8192) - sc->sc_dhb16maxsz = 8192; - break; - } - } - - if (tr_config(sc)) - return 1; - - /* - * init network-visible interface - */ - strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); - ifp->if_softc = sc; - ifp->if_ioctl = tr_ioctl; - if (sc->sc_init_status & FAST_PATH_TRANSMIT) - ifp->if_start = tr_start; - else - ifp->if_start = tr_oldstart; - ifp->if_flags = IFF_BROADCAST; - ifp->if_watchdog = tr_watchdog; - IFQ_SET_READY(&ifp->if_snd); - - switch (MM_INB(sc, TR_MEDIAS_OFFSET)) { - case 0xF: - nmedia = 1; - mediaptr = &media[6]; - break; - case 0xE: - nmedia = 2; - mediaptr = &media[0]; - break; - case 0xD: - nmedia = 1; - mediaptr = &media[4]; - break; - default: - nmedia = 0; - mediaptr = NULL; - } - - switch (MM_INB(sc, TR_RATES_OFFSET)) { - case 0xF: - /* 4 Mbps */ - break; - case 0xE: - /* 16 Mbps */ - if (mediaptr) - mediaptr += nmedia; - break; - case 0xD: - /* 4/16 Mbps */ - nmedia *= 2; - break; - } - - switch (MM_INB(sc, TR_MEDIA_OFFSET)) { - case 0xF: - /* STP */ - defmediaptr = &media[6]; - break; - case 0xE: - /* UTP */ - defmediaptr = &media[4]; - break; - case 0xD: - /* STP and UTP == a single shielded RJ45 which supports both */ - /* XXX additional types in net/if_media.h ?? */ - defmediaptr = &media[4]; - break; - default: - defmediaptr = NULL; - } - - if (defmediaptr && (sc->sc_init_status & RSP_16)) - ++defmediaptr; - - if (sc->sc_mediachange == NULL && sc->sc_mediastatus == NULL) { - switch (MM_INB(sc, TR_TYP_OFFSET)) { - case 0x0D: - case 0x0C: - sc->sc_mediachange = tropic_mediachange; - sc->sc_mediastatus = tropic_mediastatus; - } - } - - /* Initialize ifmedia structures. */ - sc->sc_ethercom.ec_ifmedia = &sc->sc_media; - ifmedia_init(&sc->sc_media, 0, tr_mediachange, tr_mediastatus); - if (mediaptr != NULL) { - for (i = 0; i < nmedia; i++) - ifmedia_add(&sc->sc_media, mediaptr[i], 0, NULL); - if (defmediaptr) - ifmedia_set(&sc->sc_media, *defmediaptr); - else - ifmedia_set(&sc->sc_media, 0); - } else { - ifmedia_add(&sc->sc_media, IFM_TOKEN | IFM_MANUAL, 0, NULL); - ifmedia_set(&sc->sc_media, IFM_TOKEN | IFM_MANUAL); - } - - if_attach(ifp); - - for (i = 0, temp = 0; i < ISO88025_ADDR_LEN; i++, temp += 4) { - myaddr[i] = (MM_INB(sc, (TR_MAC_OFFSET + temp)) & 0xf) << 4; - myaddr[i] |= MM_INB(sc, (TR_MAC_OFFSET + temp + 2)) & 0xf; - } - - token_ifattach(ifp, myaddr); - - aprint_error_dev(sc->sc_dev, "address %s ring speed %d Mbps\n", - token_sprintf(myaddr), (sc->sc_init_status & RSP_16) ? 16 : 4); - - callout_init(&sc->sc_init_callout, 0); - callout_init(&sc->sc_reinit_callout, 0); - - sc->sc_sdhook = shutdownhook_establish(tr_shutdown, sc); - return 0; -} - -int -tr_setspeed(struct tr_softc *sc, u_int8_t speed) -{ - SRB_OUTB(sc, sc->sc_srb, SRB_CMD, DIR_SET_DEFAULT_RING_SPEED); - SRB_OUTB(sc, sc->sc_srb, CMD_RETCODE, 0xfe); - SRB_OUTB(sc, sc->sc_srb, SRB_SET_DEFRSP, speed); - /* Tell adapter: command in SRB. */ - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); - - /* Wait for it to complete. */ - tr_sleep(sc); - - if ((SRB_INB(sc, sc->sc_srb, SRB_RETCODE) != 0)) { - printf("%s: set default ringspeed returned: 0x%02x\n", - device_xname(sc->sc_dev), - SRB_INB(sc, sc->sc_srb, SRB_RETCODE)); - return 1; - } - return 0; -} - -int -tr_mediachange(struct ifnet *ifp) -{ - struct tr_softc *sc = ifp->if_softc; - - if (sc->sc_mediachange) - return ((*sc->sc_mediachange)(sc)); - return EINVAL; -} - -void -tr_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - struct tr_softc *sc = ifp->if_softc; - -/* set LINK0 and/or LINK1 */ - if (sc->sc_mediastatus) - (*sc->sc_mediastatus)(sc, ifmr); -} - -int -tr_reset(struct tr_softc *sc) -{ - int i; - - sc->sc_srb = 0; - - /* - * Reset the card. - */ - /* latch on an unconditional adapter reset */ - bus_space_write_1(sc->sc_piot, sc->sc_pioh, TR_RESET, 0); - delay(50000); /* delay 50ms */ - /* - * XXX set paging if we have the right type of card - */ - /* turn off adapter reset */ - bus_space_write_1(sc->sc_piot, sc->sc_pioh, TR_RELEASE, 0); - - /* Enable interrupts. */ - - ACA_SETB(sc, ACA_ISRP_e, INT_ENABLE); - - /* Wait for an answer from the adapter. */ - - for (i = 0; i < 35000; i++) { - if (ACA_RDB(sc, ACA_ISRP_o) & SRB_RESP_INT) - break; - delay(100); - } - - if (i == 35000 && sc->sc_srb == 0) { - aprint_error_dev(sc->sc_dev, - "no response from adapter after reset\n"); - return 1; - } - - ACA_RSTB(sc, ACA_ISRP_o, ~(SRB_RESP_INT)); - - ACA_OUTB(sc, ACA_RRR_e, (sc->sc_maddr >> 12)); - sc->sc_srb = ACA_RDW(sc, ACA_WRBR); - if (SRB_INB(sc, sc->sc_srb, SRB_CMD) != 0x80) { - aprint_error_dev(sc->sc_dev, - "initialization incomplete, status: 0x%02x\n", - SRB_INB(sc, sc->sc_srb, SRB_CMD)); - return 1; - } - if (SRB_INB(sc, sc->sc_srb, SRB_INIT_BUC) != 0) { - aprint_error_dev(sc->sc_dev, "Bring Up Code %02x\n", - SRB_INB(sc, sc->sc_srb, SRB_INIT_BUC)); - return 1; - } - - sc->sc_init_status = SRB_INB(sc, sc->sc_srb, SRB_INIT_STATUS); - - sc->sc_xmit_head = sc->sc_xmit_tail = 0; - - /* XXX should depend on sc_resvdmem. */ - if (MM_INB(sc, TR_RAM_OFFSET) == 0xB && sc->sc_memsize == 65536) - for (i = 0; i < 512; i++) - SR_OUTB(sc, 0xfe00 + i, 0); - return 0; -} - -/* - * tr_stop - stop interface (issue a DIR.CLOSE.ADAPTER command) - */ -void -tr_stop(struct tr_softc *sc) -{ - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - - if ((ifp->if_flags & IFF_RUNNING) != 0) { -/* - * transmitter cannot be used from now on - */ - ifp->if_flags |= IFF_OACTIVE; - - /* Close command. */ - SRB_OUTB(sc, sc->sc_srb, SRB_CMD, DIR_CLOSE); - /* Tell adapter: command in SRB. */ - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); - - /* Wait for it to complete. */ - tr_sleep(sc); - sc->sc_srb = ACA_RDW(sc, ACA_WRBR); - } -} - -static void -tr_shutdown(void *arg) -{ - struct tr_softc *sc = arg; - - tr_stop(sc); -} - -void -tr_reinit(void *arg) -{ - struct tr_softc *sc = arg; - int s; - - s = splnet(); - if (tr_reset(sc) == 0) { - if (tr_config(sc) == 0) - tr_init(arg); - } - splx(s); -} - -static void -tr_reopen(void *arg) -{ - int s; - - s = splnet(); - tr_init(arg); - splx(s); -} - -/* - * tr_init - initialize network interface, open adapter for packet - * - reception and start any pending output - * - must be called at splnet - */ -void -tr_init(void *arg) -{ - struct tr_softc *sc = arg; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - bus_size_t open_srb; - int num_dhb, resvdmem, availmem, dhbsize; - - if ((ifp->if_flags & IFF_RUNNING) != 0) - return; - - ifp->if_flags &= ~IFF_OACTIVE; - sc->sc_xmit_head = sc->sc_xmit_tail = 0; /* XXX tr_reset() */ - - open_srb = sc->sc_srb; - - /* Zero SRB. */ - bus_space_set_region_1(sc->sc_memt, sc->sc_sramh, - open_srb, 0, SRB_OPEN_CMDSIZE); - - /* Open command. */ - SRB_OUTB(sc, open_srb, SRB_CMD, DIR_OPEN_ADAPTER); -/* - * XXX handle IFM_TOK_ETR !!!! - */ - /* Set open parameters in SRB. */ - SRB_OUTW(sc, open_srb, SRB_OPEN_OPTIONS, OPEN_PASS_BCON_MAC); - - num_dhb = 1; - - if ((sc->sc_init_status & FAST_PATH_TRANSMIT) == 0) { - availmem = sc->sc_memsize; - resvdmem = RESVDMEM_SIZE + sc->sc_memreserved; - - /* allow MAX of two SAPS */ - SRB_OUTB(sc, open_srb, SRB_OPEN_DLCMAXSAP, 2); - resvdmem += 2 * SAPCB_SIZE; - - /* allow MAX of 4 stations */ - SRB_OUTB(sc, open_srb, SRB_OPEN_DLCMAXSTA, 4); - resvdmem += 4 * LSCB_SIZE; - - if (sc->sc_init_status & RSP_16) { - dhbsize = sc->sc_dhb16maxsz; - } else { - dhbsize = sc->sc_dhb4maxsz; - } -#if 0 /* XXXchb unneeded? */ - if (dhbsize > 2048) - num_dhb = 2; -#endif - SRB_OUTW(sc, open_srb, SRB_OPEN_DHBLEN, dhbsize); - sc->sc_nbuf = (dhbsize + 511) / 512; - /* - * Try to leave room for two fullsized packets when - * requesting DHBs. - */ - availmem -= resvdmem; - num_dhb = (availmem / dhbsize) - 2; - if (num_dhb > 2) - num_dhb = 2; /* firmware can't cope with more DHBs */ - if (num_dhb < 1) - num_dhb = 1; /* we need at least one */ - } else - SRB_OUTW(sc, open_srb, SRB_OPEN_DHBLEN, DHB_LENGTH); - - SRB_OUTB(sc, open_srb, SRB_OPEN_NUMDHB, num_dhb); - SRB_OUTW(sc, open_srb, SRB_OPEN_RCVBUFLEN, RCV_BUF_LEN); - SRB_OUTW(sc, open_srb, SRB_OPEN_NUMRCVBUF, sc->sc_nbuf); - - /* Tell adapter: command in SRB. */ - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); - -} - -/* - * tr_oldstart - Present transmit request to adapter - */ -void -tr_oldstart(struct ifnet *ifp) -{ - struct tr_softc *sc = ifp->if_softc; - bus_size_t srb = sc->sc_srb; - - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) - return; - - ifp->if_flags |= IFF_OACTIVE; - - /* Load SRB to request transmit. */ - SRB_OUTB(sc, srb, SRB_CMD, XMIT_UI_FRM); - SRB_OUTW(sc, srb, XMIT_STATIONID, sc->exsap_station); - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); -} - -void -tr_start(struct ifnet *ifp) -{ - struct tr_softc *sc = ifp->if_softc; - bus_size_t first_txbuf, txbuf; - struct mbuf *m0, *m; - int size, bufspace; - bus_size_t framedata; - - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) - return; - - -next: - if (sc->sc_xmit_buffers < sc->sc_minbuf) - return; - - /* if data in queue, copy mbuf chain to fast path buffers */ - IFQ_DEQUEUE(&ifp->if_snd, m0); - - if (m0 == 0) - return; - bpf_mtap(ifp, m0, BPF_D_OUT); - first_txbuf = txbuf = TXCA_INW(sc, TXCA_FREE_QUEUE_HEAD) - XMIT_NEXTBUF; - framedata = txbuf + XMIT_FP_DATA; - size = 0; - bufspace = FP_BUF_LEN - XMIT_FP_DATA; - for (m = m0; m; m = m->m_next) { - int len = m->m_len; - char *ptr = mtod(m, char *); - - while (len >= bufspace) { - --sc->sc_xmit_buffers; - bus_space_write_region_1(sc->sc_memt, sc->sc_sramh, - framedata, ptr, bufspace); - size += bufspace; - ptr += bufspace; - len -= bufspace; - TXB_OUTW(sc, txbuf, XMIT_BUFLEN, - (FP_BUF_LEN - XMIT_FP_DATA)); - txbuf = TXB_INW(sc, txbuf, XMIT_NEXTBUF) - XMIT_NEXTBUF; - framedata = txbuf + XMIT_FP_DATA; - bufspace = FP_BUF_LEN - XMIT_FP_DATA; - } - if (len > 0) { - bus_space_write_region_1(sc->sc_memt, sc->sc_sramh, - framedata, ptr, len); - size += len; - bufspace -= len; - framedata += len; - } - } - if (size % (FP_BUF_LEN - XMIT_FP_DATA)) { - --sc->sc_xmit_buffers; - TXB_OUTW(sc, txbuf, XMIT_BUFLEN, - (FP_BUF_LEN - XMIT_FP_DATA - bufspace)); - } - - m_freem(m0); /* free mbuf chain */ - - TXB_OUTB(sc, first_txbuf, XMIT_RETCODE, 0xfe); - TXB_OUTW(sc, first_txbuf, XMIT_FRAMELEN, size); - TXB_OUTW(sc, first_txbuf, XMIT_LASTBUF, (txbuf + XMIT_NEXTBUF)); - TXB_OUTB(sc, first_txbuf, XMIT_CMD, XMIT_DIR_FRAME); - TXB_OUTW(sc, first_txbuf, XMIT_STATIONID, 0); - TXB_OUTB(sc, first_txbuf, XMIT_CMDCORR, sc->sc_xmit_correlator); - sc->sc_xmit_correlator = (sc->sc_xmit_correlator + 1) & 0x7f; - - /* - * To prevent race conditions on 8-bit cards when reading or writing - * 16-bit values. See page 4-12 of the IBM manual. - */ - TXCA_OUTW(sc, TXCA_FREE_QUEUE_HEAD, 1); - TXCA_OUTW(sc, TXCA_FREE_QUEUE_HEAD, TXB_INW(sc, txbuf, XMIT_NEXTBUF)); - - ACA_SETB(sc, ACA_ISRA_o, XMIT_REQ); - - ifp->if_flags |= IFF_OACTIVE; - ifp->if_opackets++; -#if 1 -/* XXX do while construction */ - goto next; -#endif -} - - -/* - * tr_intr - interrupt handler. Find the cause of the interrupt and - * service it. - */ -int -tr_intr(void *arg) -{ - struct tr_softc *sc = arg; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - u_char status; /* holds status from adapter status register */ - u_char command; /* holds command from status or request block */ - u_char retcode; /* holds return value from status or request block */ - int rc = 0; /* 0 = unclaimed interrupt, 1 = interrupt claimed */ - - status = ACA_RDB(sc, ACA_ISRP_o); - while (status != 0) { - - /* Is this interrupt caused by an adapter check? */ - if (status & ADAP_CHK_INT) { - printf("%s: adapter check 0x%04x\n", - device_xname(sc->sc_dev), - (unsigned int)ntohs(ACA_RDW(sc, ACA_WWCR))); - - /* Clear this interrupt bit */ - ACA_RSTB(sc, ACA_ISRP_o, ~(ADAP_CHK_INT)); - - rc = 1; /* Claim interrupt. */ - break; /* Terminate loop. */ - } else if (status & XMIT_COMPLETE) { - ACA_RSTB(sc, ACA_ISRP_o, ~(XMIT_COMPLETE)); - tr_xint(sc); - rc = 1; - } - - /* - * Process SRB_RESP_INT, ASB_FREE_INT, ARB_CMD_INT - * & SSB_RESP_INT in that order, ISRP-L Hi to Lo - */ - else if (status & SRB_RESP_INT) { /* Adapter response in SRB? */ - bus_size_t sap_srb; - bus_size_t srb; -#ifdef TROPICDEBUG - bus_size_t log_srb; -#endif - if (sc->sc_srb == 0) - sc->sc_srb = ACA_RDW(sc, ACA_WRBR); - srb = sc->sc_srb; /* pointer to SRB */ - retcode = SRB_INB(sc, srb, SRB_RETCODE); - command = SRB_INB(sc, srb, SRB_CMD); - switch (command) { - case 0x80: /* 0x80 == initialization complete */ - case DIR_CONFIG_FAST_PATH_RAM: - break; - case XMIT_DIR_FRAME: /* Response to xmit request */ - case XMIT_UI_FRM: /* Response to xmit request */ - /* Response not valid? */ - if (retcode != 0xff) - aprint_error_dev(sc->sc_dev, "error " - "on xmit request = 0x%x\n", - retcode); - break; - - case DIR_OPEN_ADAPTER: /* open-adapter-cmd response */ - /* Open successful? */ - if (retcode == 0) { - ifp->if_flags |= IFF_UP | IFF_RUNNING; - /* Save new ACA ctrl block addresses */ - sc->sc_ssb = SRB_INW(sc, srb, - SRB_OPENRESP_SSBADDR); - sc->sc_arb = SRB_INW(sc, srb, - SRB_OPENRESP_ARBADDR); - sc->sc_srb = SRB_INW(sc, srb, - SRB_OPENRESP_SRBADDR); - sc->sc_asb = SRB_INW(sc, srb, - SRB_OPENRESP_ASBADDR); - - /* - * XXX, what about LLC_{X25,ISO}_LSAP ? - * open two more saps ..... - */ - if (sc->sc_init_status & - FAST_PATH_TRANSMIT) { - sc->sc_xmit_buffers = - TXCA_INW(sc, - TXCA_BUFFER_COUNT); - sc->sc_nbuf = - sc->sc_xmit_buffers; -#ifdef TROPICDEBUG - printf("%s: %d buffers\n", - device_xname(sc->sc_dev), - sc->sc_xmit_buffers); -#endif - sc->sc_xmit_correlator = 0; - wakeup(&sc->tr_sleepevent); - } else - tr_opensap(sc, LLC_SNAP_LSAP); - } else { - aprint_error_dev(sc->sc_dev, - "open error = 0x%x\n", - SRB_INB(sc, srb, SRB_RETCODE)); - ifp->if_flags &= ~IFF_RUNNING; - ifp->if_flags &= ~IFF_UP; -/* - * XXX untimeout depending on the error, timeout in other cases - * XXX error 0x24 && autospeed mode: open again !!!! - */ - callout_reset(&sc->sc_init_callout, - hz * 30, tr_reopen, sc); - } - break; - - case DIR_CLOSE: /* Response to close adapter command */ - /* Close not successful? */ - if (retcode != 0) - aprint_error_dev(sc->sc_dev, - "close error = 0x%x\n", retcode); - else { - ifp->if_flags &= ~IFF_RUNNING; - ifp->if_flags &= ~IFF_UP; - ifp->if_flags &= ~IFF_OACTIVE; - wakeup(&sc->tr_sleepevent); - } - break; - case DIR_SET_DEFAULT_RING_SPEED: - wakeup(&sc->tr_sleepevent); - break; - - case DLC_OPEN_SAP: /* Response to open sap cmd */ - sap_srb = sc->sc_srb; - if (SRB_INB(sc, sap_srb, SRB_OPNSAP_SAPVALUE) - == LLC_SNAP_LSAP) - sc->exsap_station = - SRB_INW(sc, sap_srb, - SRB_OPNSAP_STATIONID); - printf("%s: Token Ring opened\n", - device_xname(sc->sc_dev)); - wakeup(&sc->tr_sleepevent); - break; -/* XXX DLC_CLOSE_SAP not needed ? */ - case DLC_CLOSE_SAP: /* Response to close sap cmd */ - break; - case DIR_READ_LOG: /* Response to read log */ - /* Cmd not successful? */ - if (retcode != 0) - aprint_error_dev(sc->sc_dev, "read " - "error log cmd err = 0x%x\n", - retcode); -#ifdef TROPICDEBUG - log_srb = sc->sc_srb; - printf("%s: ERROR LOG:\n", - device_xname(sc->sc_dev)); - printf("%s: Line=%d, Internal=%d, Burst=%d\n", - device_xname(sc->sc_dev), - (SRB_INB(sc, log_srb, SRB_LOG_LINEERRS)), - (SRB_INB(sc, log_srb, SRB_LOG_INTERRS)), - (SRB_INB(sc, log_srb, SRB_LOG_BRSTERRS))); - printf("%s: A/C=%d, Abort=%d, Lost frames=%d\n", - device_xname(sc->sc_dev), - (SRB_INB(sc, log_srb, SRB_LOG_ACERRS)), - (SRB_INB(sc, log_srb, SRB_LOG_ABRTERRS)), - (SRB_INB(sc, log_srb, SRB_LOG_LOSTFRMS))); - printf("%s: Receive congestion=%d, " - "Frame copied=%d, Frequency=%d\n", - device_xname(sc->sc_dev), - (SRB_INB(sc, log_srb, SRB_LOG_RCVCONG)), - (SRB_INB(sc, log_srb, SRB_LOG_FCPYERRS)), - (SRB_INB(sc, log_srb, SRB_LOG_FREQERRS))); - printf("%s: Token=%d\n", - device_xname(sc->sc_dev), - (SRB_INB(sc, log_srb, SRB_LOG_TOKENERRS))); -#endif /* TROPICDEBUG */ - ifp->if_flags &= ~IFF_OACTIVE; - break; - default: - printf("%s: bad SRB command encountered 0x%x\n", - device_xname(sc->sc_dev), command); - break; - } - /* clear the SRB-response interrupt bit */ - ACA_RSTB(sc, ACA_ISRP_o, ~(SRB_RESP_INT)); - - } - - else if (status & ASB_FREE_INT) { /* Is ASB Free? */ - bus_size_t asb = sc->sc_asb; - - /* - * Remove message from asb queue, first element in - * structure is the command. command == REC_DATA? - * size = 8 : size = 10 - * reply in isra_l with (RESP_IN_ASB | ASB_FREE) - */ - retcode = ASB_INB(sc, asb, CMD_RETCODE); - command = ASB_INB(sc, asb, CMD_CMD); - switch (command) { - case REC_DATA: /* Receive */ - /* Response not valid? */ - if (retcode != 0xff) - aprint_error_dev(sc->sc_dev, "ASB bad " - "receive response = 0x%x\n", - retcode); - break; - case XMIT_DIR_FRAME: /* Transmit */ - case XMIT_UI_FRM: /* Transmit */ - /* Response not valid? */ - if (retcode != 0xff) - aprint_error_dev(sc->sc_dev, - "ASB response err on xmit = " - "0x%x\n", retcode); - break; - default: - aprint_error_dev(sc->sc_dev, - "invalid command in ASB = 0x%x\n",command); - break; - } - /* Clear this interrupt bit */ - ACA_RSTB(sc, ACA_ISRP_o, ~(ASB_FREE_INT)); - } else if (status & ARB_CMD_INT) { /* Command for PC to handle? */ - bus_size_t arb = sc->sc_arb; - - command = ARB_INB(sc, arb, ARB_CMD); - switch (command) { - case DLC_STATUS: /* DLC status change */ - printf("%s: ARB new DLC status = 0x%x\n", - device_xname(sc->sc_dev), - ARB_INW(sc, arb, ARB_DLCSTAT_STATUS)); - break; - case REC_DATA: /* Adapter has data for PC */ - /* Call receive interrupt handler */ - tr_rint(sc); - break; - - case RING_STAT_CHANGE: /* Ring status change */ - if (ARB_INW(sc, arb, ARB_RINGSTATUS) & - (SIGNAL_LOSS + LOBE_FAULT)){ - aprint_error_dev(sc->sc_dev, - "signal loss / lobe fault\n"); - ifp->if_flags &= ~IFF_RUNNING; - ifp->if_flags &= ~IFF_UP; - IFQ_PURGE(&ifp->if_snd); - callout_reset(&sc->sc_reinit_callout, - hz * 30, tr_reinit, sc); - } else { -#ifdef TROPICDEBUG - if (ARB_INW(sc, arb, ARB_RINGSTATUS) & - ~(SOFT_ERR)) - printf("%s: ARB new ring status" - " = 0x%x\n", - device_xname(sc->sc_dev), - ARB_INW(sc, arb, - ARB_RINGSTATUS)); -#endif /* TROPICDEBUG */ - } - if (ARB_INW(sc, arb, ARB_RINGSTATUS) & - LOG_OFLOW){ -/* - * XXX CMD_IN_SRB, handle with SRB_FREE_INT ? - */ - ifp->if_flags |= IFF_OACTIVE; - SRB_OUTB(sc, sc->sc_srb, SRB_CMD, - DIR_READ_LOG); - /* Read & reset err log cmnd in SRB. */ - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); - } - break; - - case XMIT_DATA_REQ: /* Adapter wants data to transmit */ - /* Call transmit interrupt handler */ - tr_oldxint(sc); - break; - - default: - aprint_error_dev(sc->sc_dev, - "invalid command in ARB = 0x%x\n",command); - break; - } - - /* Clear this interrupt bit */ - ACA_RSTB(sc, ACA_ISRP_o, ~(ARB_CMD_INT)); - - /* Tell adapter that ARB is now free */ - ACA_SETB(sc, ACA_ISRA_o, ARB_FREE); - } - - - else if (status & SSB_RESP_INT) { /* SSB resp. to SRB cmd? */ - bus_size_t ssb = sc->sc_ssb; - - retcode = SSB_INB(sc, ssb, SSB_RETCODE); - command = SSB_INB(sc, ssb, SSB_CMD); - switch (command) { - case XMIT_UI_FRM: - case XMIT_DIR_FRAME: /* SSB response to SRB xmit cmd */ - /* collect status on last packet */ - if (retcode != 0) { - printf("%s: xmit return code = 0x%x\n", - device_xname(sc->sc_dev), retcode); - /* XXXchb */ - if (retcode == 0x22) { - printf("%s: FS = 0x%2x\n", - device_xname(sc->sc_dev), - SSB_INB(sc, ssb, - SSB_XMITERR)); - } - ifp->if_oerrors++; - } else - ifp->if_opackets++; - - ifp->if_flags &= ~IFF_OACTIVE; -/* - * XXX should this be done here ? - */ - /* if data on send queue */ - if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) - tr_oldstart(ifp); - break; - - case XMIT_XID_CMD: - printf("tr_int: xmit XID return code = 0x%x\n", - retcode); - break; - default: - aprint_error_dev(sc->sc_dev, - "SSB error, invalid command =%x\n", - command); - } - /* clear this interrupt bit */ - ACA_RSTB(sc, ACA_ISRP_o, ~(SSB_RESP_INT)); - - /* tell adapter that SSB is available */ - ACA_SETB(sc, ACA_ISRA_o, SSB_FREE); - } - rc = 1; /* Claim responsibility for interrupt */ - status = ACA_RDB(sc, ACA_ISRP_o); - } - /* Is this interrupt caused by an adapter error or access violation? */ - if (ACA_RDB(sc, ACA_ISRP_e) & (TCR_INT | ERR_INT | ACCESS_INT)) { - printf("%s: adapter error, ISRP_e = 0x%x\n", - device_xname(sc->sc_dev), ACA_RDB(sc, ACA_ISRP_e)); - - /* Clear these interrupt bits */ - ACA_RSTB(sc, ACA_ISRP_e, ~(TCR_INT | ERR_INT | ACCESS_INT)); - rc = 1; /* Claim responsibility for interrupt */ - - } - - /* Clear IRQ latch in order to reenable interrupts. */ - bus_space_write_1(sc->sc_piot, sc->sc_pioh, TR_CLEARINT, 0); - return (rc); -} - -#ifdef notyet -int -asb_reply_rcv(void) -{ -} - -int -asb_reply_xmit(void) -{ -} - -int -asb_response(bus_size_t asb, size_t len) -{ - if (empty_queue) { - answer with RESP_IN_ASB | ASB_FREE - } else { - put asb in queue - } -} -#endif - - -/* - * U-B receive interrupt. - * - * in the original version, this routine had three tasks: - * - * 1. move the data into the receive buffer and set up various pointers - * in the tr_softc struct - * 2. switch on the type field for ip and arp, dropping all else - * 3. resetting the adaptor status block info (asb) and updating the - * tr_softc struct - * determine lan message type, pull packet off interface and - * pass to an appropriate higher-level routine - * - */ -void -tr_rint(struct tr_softc *sc) -{ - bus_size_t arb = sc->sc_arb; - bus_size_t asb = sc->sc_asb; - struct rbcb *rbc = &sc->rbc; - struct mbuf *m; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - -#ifdef TROPICDEBUG - printf("tr_rint: arb.command = %x, arb.station_id= %x\n", - ARB_INB(sc, arb, ARB_CMD), ARB_INW(sc, arb, ARB_STATIONID)); - printf("arb.buf_addr = %x, arb.lan_hdr_len = %x\n", - ARB_INW(sc, arb, ARB_RXD_BUFADDR), - ARB_INB(sc, arb, ARB_RXD_LANHDRLEN)); - printf("arb.dlc_hdr_len = %d, arb.frame_len = %d\n", - ARB_INB(sc, arb, ARB_RXD_DLCHDRLEN), - ARB_INW(sc, arb, ARB_RXD_FRAMELEN)); - printf("arb.msg_type = %x\n", ARB_INB(sc, arb, ARB_RXD_MSGTYPE)); -#endif /* TROPICDEBUG */ - /* - * copy the offset in RAM of the first receive buffer from the - * receive-data block of the adapter request block associated - * with the unit's softc struct into the receive control block. - */ - rbc->rbufp = ARB_INW(sc, arb, ARB_RXD_BUFADDR); - - /* - * copy the pointer to data in first receive buffer - */ - rbc->rbuf_datap = rbc->rbufp + RB_DATA; - /* - * the token-ring header is viewed as two header structs: the physical - * header (aka TR header) with access, frame, dest, src, and routing - * information, and the logical link control header (aka LLC header) - * with dsap, ssap, llc, proto and type fields. - * - * rfc1042 requires support for unnumbered information (UI) commands, - * but does not specify a required semantic, so we'll discard them. - * - */ - - /* - * if there is a second receive buffer, set up the next pointer - */ - if (RB_INW(sc, rbc->rbufp, RB_NEXTBUF)) - rbc->rbufp_next = RB_INW(sc, rbc->rbufp, RB_NEXTBUF) - - RB_NEXTBUF; - else - rbc->rbufp_next = 0; /* we're finished */ - - rbc->data_len = RB_INW(sc, rbc->rbufp, RB_BUFLEN); - /* - * At this point we move the packet from the adapter to a chain - * of mbufs - */ - m = tr_get(sc, ARB_INW(sc, arb, ARB_RXD_FRAMELEN), ifp); -/* - * XXX Clear ARB interrupt here? - */ -/* - * XXX create a queue where the responses are buffered - * XXX but is it really needed ? - */ - - if (ASB_INB(sc, asb, RECV_RETCODE) != 0xff) - printf("tr_rint: ASB IS NOT FREE!!!\n"); - /* - * Load receive response into ASB. - */ - ASB_OUTB(sc, asb, RECV_CMD, REC_DATA); - ASB_OUTW(sc, asb, RECV_STATIONID, ARB_INW(sc, arb, ARB_STATIONID)); - ASB_OUTW(sc, asb, RECV_RESP_RECBUFADDR, - ARB_INW(sc, arb, ARB_RXD_BUFADDR)); - - if (m == 0) { - /* - * Tell adapter data lost, no mbufs. - */ - ASB_OUTB(sc, asb, RECV_RETCODE, 0x20); - ACA_SETB(sc, ACA_ISRA_o, RESP_IN_ASB); - ++ifp->if_ierrors; -#ifdef TROPICDEBUG - printf("tr_rint: packet dropped\n"); -#endif /* TROPICDEBUG */ - } else { - /* - * Indicate successful receive. - */ - ASB_OUTB(sc, asb, RECV_RETCODE, 0); - ACA_SETB(sc, ACA_ISRA_o, RESP_IN_ASB); - - if_percpuq_enqueue(ifp->if_percpuq, m); - } -} - -/* - * Interrupt handler for old style "adapter requires data to transmit". - */ -void -tr_oldxint(struct tr_softc *sc) -{ - bus_size_t arb = sc->sc_arb; /* pointer to ARB */ - bus_size_t asb = sc->sc_asb; /* pointer to ASB */ - bus_size_t dhb; /* pointer to DHB */ - struct mbuf *m0; /* pointer to top of mbuf chain */ - u_short size = 0; - char command; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - struct token_header *trh; - int i; - u_int8_t hlen; - -/* - * XXX xmit_asb_response() - */ - if (ASB_INB(sc, asb, XMIT_RETCODE) != 0xff) - printf("tr_oldxint: ASB IS NOT FREE!!!\n"); - - /* load parameters into ASB */ - ASB_OUTB(sc, asb, XMIT_CMDCORR, ARB_INB(sc, arb, ARB_XMT_CMDCORR)); - ASB_OUTW(sc, asb, XMIT_STATIONID, ARB_INW(sc, arb, ARB_STATIONID)); - ASB_OUTB(sc, asb, XMIT_RETCODE, 0); -/* - * XXX LLC_{X25,ISO}_LSAP - */ - ASB_OUTB(sc, asb, XMIT_REMSAP, LLC_SNAP_LSAP); - - /* XXX if num_dhb == 2 this should alternate between the two buffers */ - dhb = ARB_INW(sc, arb, ARB_XMT_DHBADDR); - - command = SRB_INB(sc, sc->sc_srb, SRB_CMD); - - if (command == XMIT_XID_CMD || command == XMIT_TEST_CMD) { - ASB_OUTB(sc, asb, XMIT_CMD, command); - ASB_OUTW(sc, asb, XMIT_FRAMELEN, 0x11); -/* - * XXX 0xe == sizeof(struct token_header) - */ - ASB_OUTB(sc, asb, XMIT_HDRLEN, 0x0e); - - SR_OUTB(sc, (dhb + 0), TOKEN_AC); - SR_OUTB(sc, (dhb + 1), TOKEN_FC); - /* Load destination and source addresses. */ - for (i=0; i < ISO88025_ADDR_LEN; i++) { - SR_OUTB(sc, (dhb + 2 + i), 0xff); - SR_OUTB(sc, (dhb + 8 + i), 0x00); - } - } else { -/* - * XXX what's command here ? command = 0x0d (always ?) - */ - /* if data in queue, copy mbuf chain to DHB */ - IFQ_DEQUEUE(&ifp->if_snd, m0); - if (m0 != 0) { - bpf_mtap(ifp, m0, BPF_D_OUT); - /* Pull packet off interface send queue, fill DHB. */ - trh = mtod(m0, struct token_header *); - hlen = sizeof(struct token_header); - if (trh->token_shost[0] & TOKEN_RI_PRESENT) { -/* - * XXX assumes route info is in the same mbuf as the token-ring header - */ - struct token_rif *rif; - - rif = TOKEN_RIF(trh); - hlen += ((ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8); - } - size = tr_mbcopy(sc, dhb, m0); - m_freem(m0); - - ASB_OUTB(sc, asb, XMIT_CMD, XMIT_UI_FRM); - ASB_OUTB(sc, asb, XMIT_HDRLEN, hlen); - - /* Set size of transmission frame in ASB. */ - ASB_OUTW(sc, asb, XMIT_FRAMELEN, size); - } else { - aprint_error_dev(sc->sc_dev, - "unexpected empty mbuf send queue\n"); - - /* Set size of transmission frame in ASB to zero. */ - ASB_OUTW(sc, asb, XMIT_FRAMELEN, 0); - } - } -/* - * XXX asb_response(void *asb, len) - */ - /* tell adapter that there is a response in the ASB */ - ACA_SETB(sc, ACA_ISRA_o, RESP_IN_ASB); -} - -/* - * Interrupt handler for fast path transmit complete - */ -void -tr_xint(struct tr_softc *sc) -{ - u_short tail; - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - bus_size_t txbuf; - - /* - * To prevent race conditions on 8-bit cards when reading or writing - * 16-bit values. See page 4-12 of the IBM manual. - * XXX use volatile ? - */ - do { - tail = TXCA_INW(sc, TXCA_COMPLETION_QUEUE_TAIL); - } while (tail != TXCA_INW(sc, TXCA_COMPLETION_QUEUE_TAIL)); - while (tail != TXCA_INW(sc, TXCA_FREE_QUEUE_TAIL)) { - txbuf = TXCA_INW(sc, TXCA_FREE_QUEUE_TAIL) - XMIT_NEXTBUF; - txbuf = TXB_INW(sc, txbuf, XMIT_NEXTBUF) - XMIT_NEXTBUF; - if (TXB_INB(sc, txbuf, XMIT_RETCODE) != 0) { - ifp->if_oerrors++; - aprint_error_dev(sc->sc_dev, "xmit error = 0x%x\n", - TXB_INB(sc, txbuf, XMIT_RETCODE)); - } - sc->sc_xmit_buffers += - (TXB_INW(sc, txbuf, XMIT_FRAMELEN) + 514 - 1) / 514; - tail = TXB_INW(sc, txbuf, XMIT_LASTBUF); - TXCA_OUTW(sc, TXCA_FREE_QUEUE_TAIL, tail); - tail = TXCA_INW(sc, TXCA_COMPLETION_QUEUE_TAIL); - do { - tail = TXCA_INW(sc, TXCA_COMPLETION_QUEUE_TAIL); - } while (tail != TXCA_INW(sc, TXCA_COMPLETION_QUEUE_TAIL)); - } - if (sc->sc_xmit_buffers == sc->sc_nbuf) - ifp->if_flags &= ~IFF_OACTIVE; - tr_start(ifp); -} - - -/* - * copy out the packet byte-by-byte in reasonably optimal fashion - */ -int -tr_mbcopy(struct tr_softc *sc, bus_size_t dhb, struct mbuf *m0) -{ - bus_size_t addr = dhb; - int len, size = 0; - char *ptr; - struct mbuf *m; - - for (m = m0; m; m = m->m_next) { - len = m->m_len; - ptr = mtod(m, char *); - - bus_space_write_region_1(sc->sc_memt, sc->sc_sramh, - addr, ptr, len); - size += len; - addr += len; - } - return (size); -} - -/* - * Pull read data off an interface. - * Len is length of data, with local net header stripped. - * Off is non-zero if a trailer protocol was used, and - * gives the offset of the trailer information. - * XXX trailer information, really ???? - * We copy the trailer information and then all the normal - * data into mbufs. - * - * called from tr_rint - receive interrupt routine - */ -struct mbuf * -tr_get(struct tr_softc *sc, int totlen, struct ifnet *ifp) -{ - int len; - struct mbuf *m, *m0, *newm; - - MGETHDR(m0, M_DONTWAIT, MT_DATA); - if (m0 == 0) - return (0); - - m_set_rcvif(m0, ifp); - m0->m_pkthdr.len = totlen; - len = MHLEN; - - m = m0; - while (totlen > 0) { - if (totlen >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m0); - return 0; - } - len = MCLBYTES; - } - - /* - * Make sure data after the MAC header is aligned. - */ - if (m == m0) { - char *newdata = (char *) - ALIGN(m->m_data + sizeof(struct token_header)) - - sizeof(struct token_header); - len -= newdata - m->m_data; - m->m_data = newdata; - } - m->m_len = len = uimin(totlen, len); - tr_bcopy(sc, mtod(m, char *), len); - totlen -= len; - if (totlen > 0) { - MGET(newm, M_DONTWAIT, MT_DATA); - if (newm == 0){ - m_freem(m0); - return (0); - } - m->m_next = newm; - m = newm; - len = MLEN; - } - /* - * ignore trailers case again - */ - } - return (m0); -} - -/* - * tr_ioctl - process an ioctl request - */ -int -tr_ioctl(struct ifnet *ifp, u_long cmd, void *data) -{ - struct tr_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *) data; - int s; - int error = 0; - - s = splnet(); - - switch (cmd) { - case SIOCINITIFADDR: - if ((error = tr_enable(sc)) != 0) - break; - - /* XXX if not running */ - if ((ifp->if_flags & IFF_RUNNING) == 0) { - tr_init(sc); /* before arp_ifinit/arpwhohas */ - tr_sleep(sc); - } - switch (ifa->ifa_addr->sa_family) { -#ifdef INET - case AF_INET: - arp_ifinit(ifp, ifa); - break; -#endif /*INET*/ - default: - break; - } - break; - case SIOCSIFFLAGS: - if ((error = ifioctl_common(ifp, cmd, data)) != 0) - break; - /* - * 1- If the adapter is DOWN , turn the device off - * ie. adapter down but still running - * 2- If the adapter is UP, turn the device on - * ie. adapter up but not running yet - */ - switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) { - case IFF_RUNNING: - tr_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; - tr_disable(sc); - break; - case IFF_UP: - if ((error = tr_enable(sc)) != 0) - break; - tr_init(sc); - tr_sleep(sc); - break; - default: - /* - * XXX handle other flag changes - */ - break; - } - break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > sc->sc_maxmtu) - error = EINVAL; - else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET) - error = 0; - break; - default: - error = ifioctl_common(ifp, cmd, data); - } - splx(s); - return (error); -} - - -/* - * tr_bcopy - like bcopy except that it knows about the structure of - * adapter receive buffers. - */ -void -tr_bcopy(struct tr_softc *sc, u_char *dest, int len) - /* sc: pointer to softc struct for this adapter */ - /* dest: destination address */ - /* len: number of bytes to copy */ -{ - struct rbcb *rbc = &sc->rbc; /* pointer to rec buf ctl blk */ - - /* While amount of data needed >= amount in current receive buffer. */ - while (len >= rbc->data_len) { - /* Copy all data from receive buffer to destination. */ - - bus_space_read_region_1(sc->sc_memt, sc->sc_sramh, - rbc->rbuf_datap, dest, (bus_size_t)rbc->data_len); - len -= rbc->data_len; /* update length left to transfer */ - dest += rbc->data_len; /* update destination address */ - - /* Make next receive buffer current receive buffer. */ - rbc->rbufp = rbc->rbufp_next; - if (rbc->rbufp != 0) { /* More receive buffers? */ - - /* Calculate pointer to next receive buffer. */ - rbc->rbufp_next = RB_INW(sc, rbc->rbufp, RB_NEXTBUF); - if (rbc->rbufp_next != 0) - rbc->rbufp_next -= RB_NEXTBUF; - - /* Get pointer to data in current receive buffer. */ - rbc->rbuf_datap = rbc->rbufp + RB_DATA; - - /* Get length of data in current receive buffer. */ - rbc->data_len = RB_INW(sc, rbc->rbufp, RB_BUFLEN); - } else { - if (len != 0) /* len should equal zero. */ - printf("tr_bcopy: residual data not copied\n"); - return; - } - } - - /* Amount of data needed is < amount in current receive buffer. */ - - bus_space_read_region_1(sc->sc_memt, sc->sc_sramh, - rbc->rbuf_datap, dest, (bus_size_t)len); - rbc->data_len -= len; /* Update count of data in receive buffer. */ - rbc->rbuf_datap += len; /* Update pointer to receive buffer data. */ -} - -/* - * tr_opensap - open the token ring SAP interface - */ -void -tr_opensap(struct tr_softc *sc, u_char type) -{ - bus_size_t srb = sc->sc_srb; - -/************************************************************************ - ** To use the SAP level interface, we will have to execute a ** - ** DLC.OPEN.SAP (pg.6-61 of the Token Ring Tech. Ref.) after we have ** - ** received a good return code from the DIR.OPEN.ADAPTER command. ** - ** We will open the IP SAP x'aa'. ** - ** ** - ** STEPS: ** - ** 1) Reset SRB response interrupt bit ** - ** 2) Use the open_sap srb. ** - ** 3) Fill the following fields: ** - ** command - x'15' ** - ** sap_value - x'aa' ** - ** sap_options- x'24' ** - ** ** - ***********************************************************************/ - - ACA_RSTB(sc, ACA_ISRP_o, ~(SRB_RESP_INT)); - - SRB_OUTB(sc, srb, SRB_CMD, DLC_OPEN_SAP); - SRB_OUTB(sc, srb, SRB_RETCODE, 0x00); - SRB_OUTW(sc, srb, SRB_OPNSAP_STATIONID, 0x0000); - SRB_OUTB(sc, srb, SRB_OPNSAP_TIMERT1, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_TIMERT2, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_TIMERTI, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_MAXOUT, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_MAXIN, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_MAXOUTINCR, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_MAXRETRY, 0x00); - SRB_OUTB(sc, srb, SRB_OPNSAP_GSAPMAXMEMB, 0x00); - SRB_OUTW(sc, srb, SRB_OPNSAP_MAXIFIELD, 0x0088); - SRB_OUTB(sc, srb, SRB_OPNSAP_SAPVALUE, type); - SRB_OUTB(sc, srb, SRB_OPNSAP_SAPOPTIONS, 0x24); - SRB_OUTB(sc, srb, SRB_OPNSAP_STATIONCNT, 0x01); - SRB_OUTB(sc, srb, SRB_OPNSAP_SAPGSAPMEMB, 0x00); - - ACA_SETB(sc, ACA_ISRP_e, INT_ENABLE); - ACA_SETB(sc, ACA_ISRA_o, CMD_IN_SRB); -} - -/* - * tr_sleep - sleep to wait for adapter to open - */ -void -tr_sleep(struct tr_softc *sc) -{ - int error; - - error = tsleep(&sc->tr_sleepevent, 1, "trsleep", hz * 30); - if (error == EWOULDBLOCK) - printf("%s: sleep event timeout\n", device_xname(sc->sc_dev)); -} - -void -tr_watchdog(struct ifnet *ifp) -{ - struct tr_softc *sc = ifp->if_softc; - - log(LOG_ERR,"%s: device timeout\n", device_xname(sc->sc_dev)); - ++ifp->if_oerrors; - - tr_reset(sc); -} - -int -tr_enable(struct tr_softc *sc) -{ - if (sc->sc_enabled == 0 && sc->sc_enable != NULL) { - if ((*sc->sc_enable)(sc) != 0) { - aprint_error_dev(sc->sc_dev, "device enable failed\n"); - return (EIO); - } - } - - sc->sc_enabled = 1; - return (0); -} - -void -tr_disable(struct tr_softc *sc) -{ - if (sc->sc_enabled != 0 && sc->sc_disable != NULL) { - (*sc->sc_disable)(sc); - sc->sc_enabled = 0; - } -} - -int -tr_activate(device_t self, enum devact act) -{ - struct tr_softc *sc = device_private(self); - - switch (act) { - case DVACT_DEACTIVATE: - if_deactivate(&sc->sc_ethercom.ec_if); - return 0; - default: - return EOPNOTSUPP; - } -} - -int -tr_detach(device_t self, int flags) -{ - struct tr_softc *sc = device_private(self); - struct ifnet *ifp = &sc->sc_ethercom.ec_if; - - tr_disable(sc); - - callout_stop(&sc->sc_init_callout); - callout_stop(&sc->sc_reinit_callout); - - /* Delete all remaining media. */ - ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY); - - token_ifdetach(ifp); - if_detach(ifp); - - shutdownhook_disestablish(sc->sc_sdhook); - - return (0); -} diff --git a/sys/dev/ic/tropicreg.h b/sys/dev/ic/tropicreg.h deleted file mode 100644 index 2008095bec46..000000000000 --- a/sys/dev/ic/tropicreg.h +++ /dev/null @@ -1,555 +0,0 @@ -/* $NetBSD: tropicreg.h,v 1.6 2005/12/11 12:21:28 christos Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1991 Carnegie Mellon University - * Copyright (c) 1991 IBM Corporation - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation, - * and that the name IBM not be used in advertising or publicity - * pertaining to distribution of the software without specific, written - * prior permission. - * - * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -/* $ACIS:if_lanreg.h 12.0$ */ - -#define TR_SWITCH 0 -#define TR_RESET 1 -#define TR_RELEASE 2 -#define TR_CLEARINT 3 - -/* macros to deal with accessing the MMIO region */ -#define MM_OUTB(sc, off, val) \ - bus_space_write_1((sc)->sc_memt, (sc)->sc_mmioh, (off), (val)) -#define MM_OUTW(sc, off, val) \ - bus_space_write_2((sc)->sc_memt, (sc)->sc_mmioh, (off), htons((val))) -#define MM_INB(sc, off) \ - bus_space_read_1((sc)->sc_memt, (sc)->sc_mmioh, (off)) -#define MM_INW(sc, off) \ - ntohs(bus_space_read_2((sc)->sc_memt, (sc)->sc_mmioh, (off))) - -/* macros to deal with accesses to the shared ram */ -#define SR_INB(sc, off) \ - bus_space_read_1(sc->sc_memt, sc->sc_sramh, (off)) -#define SR_INW(sc, off) \ - htons(bus_space_read_2(sc->sc_memt, sc->sc_sramh, (off))) -#define SR_OUTB(sc, off, val) \ - bus_space_write_1((sc)->sc_memt, (sc)->sc_sramh, (off), (val)) -#define SR_OUTW(sc, off, val) \ - bus_space_write_2((sc)->sc_memt, (sc)->sc_sramh, (off), htons((val))) - -/* macros to deal with accesses to the recv buffers */ -#define RB_INB(sc, rb, reg) SR_INB(sc, (rb)+(reg)) -#define RB_INW(sc, rb, reg) SR_INW(sc, (rb)+(reg)) - -/* macros to deal with the ACA */ -#define ACA_RDB(sc, reg) MM_INB(sc, ((sc->sc_aca+(reg))|ACA_RW)) -#define ACA_RDW(sc, reg) MM_INW(sc, ((sc->sc_aca+(reg))|ACA_RW)) -#define ACA_OUTB(sc, reg, val) MM_OUTB(sc, ((sc->sc_aca+(reg))|ACA_RW), (val)) -#define ACA_SETB(sc, reg, val) MM_OUTB(sc, ((sc->sc_aca+(reg))|ACA_SET), (val)) -#define ACA_RSTB(sc, reg, val) MM_OUTB(sc, ((sc->sc_aca+(reg))|ACA_RST), (val)) - -/* macros to deal with the SSB */ -#define SSB_INB(sc, ssb, reg) SR_INB(sc, (ssb)+(reg)) - -/* macros to deal with the ARB */ -#define ARB_INB(sc, arb, reg) SR_INB(sc, (arb)+(reg)) -#define ARB_INW(sc, arb, reg) SR_INW(sc, (arb)+(reg)) - -/* macros to deal with the SRB */ -#define SRB_INB(sc, srb, reg) SR_INB(sc, (srb)+(reg)) -#define SRB_INW(sc, srb, reg) SR_INW(sc, (srb)+(reg)) -#define SRB_OUTB(sc, srb, reg, val) SR_OUTB(sc, (srb)+(reg), (val)) -#define SRB_OUTW(sc, srb, reg, val) SR_OUTW(sc, (srb)+(reg), (val)) - -/* macros to deal with the ASB */ -#define ASB_INB(sc, asb, reg) SR_INB(sc, (asb)+(reg)) -#define ASB_INW(sc, asb, reg) SR_INW(sc, (asb)+(reg)) -#define ASB_OUTB(sc, asb, reg, val) SR_OUTB(sc, (asb)+(reg), (val)) -#define ASB_OUTW(sc, asb, reg, val) SR_OUTW(sc, (asb)+(reg), (val)) - -/* macros to deal with the TXCA */ -#define TXCA_INW(sc, reg) SR_INW(sc, sc->sc_txca+(reg)) -#define TXCA_OUTW(sc, reg, val) SR_OUTW(sc, sc->sc_txca+(reg), (val)) - -/* macros to deal with the txbuffers */ -#define TXB_INB(sc, buf, reg) SR_INB(sc, (buf)+(reg)) -#define TXB_INW(sc, buf, reg) SR_INW(sc, (buf)+(reg)) -#define TXB_OUTB(sc, buf, reg, val) SR_OUTB(sc, (buf)+(reg), (val)) -#define TXB_OUTW(sc, buf, reg, val) SR_OUTW(sc, (buf)+(reg), (val)) - -/* ACA registers */ -#define ACA_RRR 0 -#define ACA_RRR_e ACA_RRR -#define ACA_RRR_o (ACA_RRR+1) -#define ACA_WRBR 2 -#define ACA_WRBR_e ACA_WRBR -#define ACA_WRBR_o (ACA_WRBR+1) -#define ACA_WWOR 4 -#define ACA_WWOR_e ACA_WWOR -#define ACA_WWOR_o (ACA_WWOR+1) -#define ACA_WWCR 6 -#define ACA_WWCR_e ACA_WWCR -#define ACA_WWCR_o (ACA_WWCR+1) -#define ACA_ISRP 8 -#define ACA_ISRP_e ACA_ISRP -#define ACA_ISRP_o (ACA_ISRP+1) -#define ACA_ISRA 10 -#define ACA_ISRA_e ACA_ISRA -#define ACA_ISRA_o (ACA_ISRA+1) -#define ACA_TCR 12 -#define ACA_TCR_e ACA_TCR -#define ACA_TCR_o (ACA_TCR+1) -#define ACA_TVR 14 -#define ACA_TVR_e ACA_TVR -#define ACA_TVR_o (ACA_TVR+1) - -/* access flags; to be or-ed into offset */ -#define ACA_RW 0 -#define ACA_RST 0x20 -#define ACA_SET 0x40 - -/* offsets valid for all command blocks */ -#define CMD_CMD 0 -#define CMD_RETCODE 2 - -/* - * Structure of SSB (System Status Block) - */ -#define SSB_SIZE 20 /* size of SSB */ -#define SSB_CMD 0 -#define SSB_CMDCORR 1 -#define SSB_RETCODE 2 -#define SSB_STATIONID 4 -#define SSB_XMITERR 6 - -/* - * Structure of ARB (Adapter Request Block) - */ -#define ARB_SIZE 28 /* size of ARB */ -#define ARB_CMD 0 -#define ARB_STATIONID 4 /* ID of receiving station */ - -/* receive data command block */ -#define ARB_RXD_BUFADDR 6 /* RAM offset of 1st rec buf */ -#define ARB_RXD_LANHDRLEN 8 /* Length of LAN header */ -#define ARB_RXD_DLCHDRLEN 9 /* Length of DLC header */ -#define ARB_RXD_FRAMELEN 10 /* Length of entire frame */ -#define ARB_RXD_MSGTYPE 12 /* Category of message */ - -/* transmit data command block */ -#define ARB_XMT_CMDCORR 1 -#define ARB_XMT_DHBADDR 6 - -/* ring status change information block */ -#define ARB_RINGSTATUS 6 - -/* DLC status change response block */ -#define ARB_DLCSTAT_STATUS 6 /* status info field */ -#define ARB_DLCSTAT_FRMRDATA 8 /* 5 bytes */ -#define ARB_DLCSTAT_ACCPRIO 13 -#define ARB_DLCSTAT_REMADDR 14 /* remote address */ -#define ARB_DLCSTAT_REMSAP 20 /* remote sap */ - -/* - * Structure of SRB (System Request Block) - */ -#define SRB_SIZE 28 /* size of SRB */ -#define SRB_CMD 0 -#define SRB_RETCODE 2 - -/* contents of SRB after adapter reset */ -#define INIT_COMPL 0x80 /* in SRB_CMD */ -#define SRB_INIT_STATUS 1 -#define RSP_DETECT 0x40 -#define FAST_PATH_TRANSMIT 0x20 -#define RING_MEASUREMENT 0x08 -#define RPL 0x02 -#define RSP_16 0x01 -#define SRB_INIT_STATUS2 2 -#define PNP 0x80 -#define SET_DEF_RSP 0x40 -#define AUTO_DEF_RSP_UPDATE 0x20 -#define SRB_INIT_BUC 6 /* bring up code */ -#define SRB_INIT_ENCADDR 8 /* offset of adapter's */ - /* permanent encoded address */ -#define SRB_INIT_LVLADDR 10 /* offset of adapter's */ - /* microcode level */ -#define SRB_INIT_ADAPADDR 12 /* offset of adapter addresses */ -#define SRB_INIT_PARMSADDR 14 /* offset of adapter parameters */ -#define SRB_INIT_MACADDR 16 /* offset of adapter MAC buffer */ -#define SRB_INIT_UTILADDR 18 /* offset of ring utilization measurement */ - -/* config fast path ram command block */ -#define SRB_CFP_CMDSIZE 12 /* length of command block */ -#define SRB_CFP_RAMSIZE 8 -#define SRB_CFP_BUFSIZE 10 - -/* config fast path transmit response block */ -#define SRB_CFPRESP_FPXMIT 8 /* offset to transmit control area */ -#define SRB_CFPRESP_SRBADDR 10 /* offset for the next SRB address */ - -/* open command block */ -#define SRB_OPEN_CMDSIZE 60 -#define SRB_OPEN_OPTIONS 8 /* open options */ -#define SRB_OPEN_NODEADDR 10 /* adapter's ring address */ -#define SRB_OPEN_GROUPADDR 16 /* adapter's group address */ -#define SRB_OPEN_FUNCTADDR 20 /* adapter's functional address */ -#define SRB_OPEN_NUMRCVBUF 24 /* number of receive buffers */ -#define SRB_OPEN_RCVBUFLEN 26 /* length of receive buffers */ -#define SRB_OPEN_DHBLEN 28 /* length of DHBs */ -#define SRB_OPEN_NUMDHB 30 /* number of DHBs */ -#define SRB_OPEN_DLCMAXSAP 32 /* max. number of SAPs */ -#define SRB_OPEN_DLCMAXSTA 33 /* max. number of link stations */ -#define SRB_OPEN_DLCMAXGSAP 34 /* max. number of group SAPs */ -#define SRB_OPEN_DLCMAXGMEM 35 /* max. members per group SAP */ -#define SRB_OPEN_DLCT1TICK1 36 /* timer T1 intvl. group one */ -#define SRB_OPEN_DLCT2TICK1 37 /* timer T7 intvl. group one */ -#define SRB_OPEN_DLCTITICK1 38 /* timer Ti intvl. group one */ -#define SRB_OPEN_DLCT1TICK2 39 /* timer T1 intvl. group two */ -#define SRB_OPEN_DLCT2TICK2 40 /* timer T7 intvl. group two */ -#define SRB_OPEN_DLCTITICK2 41 /* timer Ti intvl. group two */ -#define SRB_OPEN_PODUCTID 42 /* product id (18 bytes) */ - -/* open command response block */ -#define SRB_OPENRESP_ERRCODE 6 -#define SRB_OPENRESP_ASBADDR 8 /* offset of ASB */ -#define SRB_OPENRESP_SRBADDR 10 /* offset of SRB */ -#define SRB_OPENRESP_ARBADDR 12 /* offset of ARB */ -#define SRB_OPENRESP_SSBADDR 14 /* offset of SSB */ - -/* open sap command and response block */ -#define SRB_OPNSAP_STATIONID 4 /* ID of SAP after open */ -#define SRB_OPNSAP_TIMERT1 6 /* response timer */ -#define SRB_OPNSAP_TIMERT2 7 /* acknowledge timer */ -#define SRB_OPNSAP_TIMERTI 8 /* inactivity timer */ -#define SRB_OPNSAP_MAXOUT 9 /* max. xmits without ack */ -#define SRB_OPNSAP_MAXIN 10 /* max. recvs without ack */ -#define SRB_OPNSAP_MAXOUTINCR 11 /* window increment value */ -#define SRB_OPNSAP_MAXRETRY 12 /* N2 value */ -#define SRB_OPNSAP_GSAPMAXMEMB 13 /* max. SAPs for a group SAP */ -#define SRB_OPNSAP_MAXIFIELD 14 /* max recv info field length */ -#define SRB_OPNSAP_SAPVALUE 16 /* SAP to be opened */ -#define SRB_OPNSAP_SAPOPTIONS 17 /* options to be set */ -#define SRB_OPNSAP_STATIONCNT 18 /* num of link stations to reserve */ -#define SRB_OPNSAP_SAPGSAPMEMB 19 /* number of GSAP members */ -#define SRB_OPNSAP_GSAP1 20 /* first gsap request */ - -/* read log command and response block */ -#define SRB_RLOG_LOGDATA 14 /* 14 bytes of log data */ -#define SRB_LOG_LINEERRS (SRB_RLOG_LOGDATA+0) /* line errors */ -#define SRB_LOG_INTERRS (SRB_RLOG_LOGDATA+1) /* internal errors */ -#define SRB_LOG_BRSTERRS (SRB_RLOG_LOGDATA+2) /* burst errors */ -#define SRB_LOG_ACERRS (SRB_RLOG_LOGDATA+3) /* AC errors */ -#define SRB_LOG_ABRTERRS (SRB_RLOG_LOGDATA+4) /* abort errors */ -#define SRB_LOG_LOSTFRMS (SRB_RLOG_LOGDATA+6) /* lost frames */ -#define SRB_LOG_RCVCONG (SRB_RLOG_LOGDATA+7) /* receive congestion count */ -#define SRB_LOG_FCPYERRS (SRB_RLOG_LOGDATA+8) /* frame copied errors */ -#define SRB_LOG_FREQERRS (SRB_RLOG_LOGDATA+9) /* frequency erros */ -#define SRB_LOG_TOKENERRS (SRB_RLOG_LOGDATA+10) /* token errors */ - -/* set default ring speed command */ -#define SRB_SET_DEFRSP 6 - -/* - * Structure of ASB (Adapter Status Block) - */ -#define ASB_SIZE 12 /* size of ASB */ -#define RECV_CMD 0 -#define RECV_RETCODE 2 -#define RECV_STATIONID 4 - -#define RECV_RESP_RECBUFADDR 6 - -/* host response to xmit-req-data command */ -#define XMIT_CMD 0 -#define XMIT_CMDCORR 1 /* command correlator */ -#define XMIT_RETCODE 2 /* return code */ -#define XMIT_STATIONID 4 /* id of sending station */ -#define XMIT_FRAMELEN 6 /* length of entire frame */ -#define XMIT_HDRLEN 8 /* length of LAN header */ -#define XMIT_REMSAP 9 /* remote SAP */ -#define XMIT_DATA 10 /* offset of first data byte */ -/* fast path specific data */ -#define XMIT_LASTBUF 12 -#define XMIT_FRAMEPTR 14 -#define XMIT_NEXTBUF 16 -#define XMIT_STATUS 18 -#define XMIT_STRIPFS 19 -#define XMIT_BUFLEN 20 -#define XMIT_FP_DATA 22 /* offset of first data byte */ - -#if 0 /* XXXchb unused? */ -/* - * Adapter addresses - */ -struct adapt_addr { - unsigned char node_addr[6]; /* Adapter node address */ - unsigned char grp_addr[4]; /* Adapter group address */ - unsigned char func_addr[4]; /* Adapter functional address */ -}; - -/* - * Adapter parameters - */ -struct param_addr { - unsigned char phys_addr[4]; /* Adapter physical address */ - unsigned char up_node_addr[6]; /* Next active upstream node - * addr */ - unsigned char up_phys_addr[4]; /* Next active upstream phys - * addr */ - unsigned char poll_addr[6]; /* Last poll address */ - unsigned char res0[2];/* Reserved */ - unsigned char acc_priority[2]; /* Transmit access priority */ - unsigned char src_class[2]; /* Source class authorization */ - unsigned char att_code[2]; /* Last attention code */ - unsigned char src_addr[6]; /* Last source address */ - unsigned char bcon_type[2]; /* Last beacon type */ - unsigned char major_vector[2]; /* Last major vector */ - unsigned char ring_stat[2]; /* ring status */ - unsigned char soft_error[2]; /* soft error timer value */ - unsigned char fe_error[2]; /* front end error counter */ - unsigned char next_state[2]; /* next state indicator */ - unsigned char mon_error[2]; /* Monitor error code */ - unsigned char bcon_xmit[2]; /* Beacon transmit type */ - unsigned char bcon_receive[2]; /* Beacon receive type */ - unsigned char frame_correl[2]; /* Frame correlator save */ - unsigned char bcon_naun[6]; /* beacon station NAUN */ - unsigned char res1[4];/* Reserved */ - unsigned char bcon_phys[4]; /* Beacon station physical addr */ -}; -#endif - -#define TXCA_BUFFER_COUNT 0 -#define TXCA_FREE_QUEUE_HEAD 2 -#define TXCA_FREE_QUEUE_TAIL 4 -#define TXCA_ADAPTER_QUEUE_HEAD 6 -#define TXCA_BUFFER_SIZE 8 -#define TXCA_COMPLETION_QUEUE_TAIL 10 - -/* Adapter receive buffer structure */ -#define RB_NEXTBUF 2 /* offset of next buf plus 2 in sram */ -#define RB_FS 5 /* FS/addr match (last buf only) */ -#define RB_BUFLEN 6 /* length of data in this buffer */ -#define RB_DATA 8 /* RCV_BUF_DLEN bytes frame data */ - -/* Misc. structure sizes. */ -#define SAPCB_SIZE 64 /* size of SAP control block */ -#define LSCB_SIZE 144 /* size of DLC link station control block */ - -/* memory in shared ram area that is reserved by the adapter */ -#define PRIVRAM_SIZE 1416 /* adapter private ram area */ -#define RESVDMEM_SIZE (PRIVRAM_SIZE+ARB_SIZE+SSB_SIZE+SRB_SIZE+ASB_SIZE) - -/* Memory offsets of adapter control areas */ - -#define TR_SRAM_DEFAULT 0xd8000 - -/* Offset of MMIO region */ -#define TR_MMIO_OFFSET 0x80000 -#define TR_MMIO_MINADDR 0xc0000 -#define TR_MMIO_MAXADDR 0xde000 -#define TR_MMIO_SIZE 8192 - -#define TR_ACA_OFFSET 0x1e00 /* Offset of ACA in MMIO region */ -/* - * XXX Create AIP structure - */ -#define TR_MAC_OFFSET 0x1f00 /* Offset of MAC address in MMIO region */ -#define TR_ID_OFFSET 0x1f30 /* Offset of ID in MMIO region */ -#define TR_TYP_OFFSET 0x1fa0 /* Offset of TYP in MMIO region */ -#define TR_RATES_OFFSET 0x1fa2 /* Offset of supported speeds in MMIO region */ -#define TR_RAM_OFFSET 0x1fa6 /* Offset of available shared RAM */ -#define TR_PAGE_OFFSET 0x1fa8 /* Offset of shared-RAM paging support */ -#define TR_DHB4_OFFSET 0x1faa /* Offset of available DHB size at 4Mbit */ -#define TR_DHB16_OFFSET 0x1fac /* Offset of available DHB size at 16Mbit */ -#define TR_MEDIAS_OFFSET 0x1fb6 /* Offset of supported media types in MMIO */ -#define TR_MEDIA_OFFSET 0x1fb8 /* Offset of selected media type in MMIO */ -#define TR_IRQ_OFFSET 0x1fba /* Offset of IRQs supported in MMIO region */ - -/* Bring-Up Test results */ - -#define BUT_OK 0x0000 /* Initialization completed OK */ -#define BUT_PROCESSOR_FAIL 0x0020 /* Failed processor initialization */ -#define BUT_ROM_FAIL 0x0022 /* Failed ROM test diagnostic */ -#define BUT_RAM_FAIL 0x0024 /* Failed RAM test diagnostic */ -#define BUT_INST_FAIL 0x0026 /* Failed instruction test diag. */ -#define BUT_INTER_FAIL 0x0028 /* Failed interrupt test diagnostic */ -#define BUT_MEM_FAIL 0x002a /* Failed memory interface diag. */ -#define BUT_PROTOCOL_FAIL 0x002c /* Failed protocol handler diag. */ - - -/* Direct PC-to-adapter commands */ - -#define DIR_INTERRUPT 0x00 /* Cause adapter to interrupt the PC */ -#define DIR_MOD_OPEN_PARAMS 0x01 /* Modify open options */ -#define DIR_RESTORE_OPEN_PARMS 0x02 /* Restore open options */ -#define DIR_OPEN_ADAPTER 0x03 /* Open the adapter card */ -#define DIR_CLOSE 0x04 /* Close adapter card */ -#define DIR_SET_GRP_ADDR 0x06 /* Set adapter group address */ -#define DIR_SET_FUNC_ADDR 0x07 /* Set adapter functional addr */ -#define DIR_READ_LOG 0x08 /* Read and reset error counters */ -#define DIR_SET_BRIDGE_PARMS 0x09 -#define DIR_CONFIG_BRIDGE_RAM 0x0c -#define DIR_CONFIG_FAST_PATH_RAM 0x12 -#define DIR_SINGLE_ROUTE_BROADCAST 0x1f -#define DIR_SET_DEFAULT_RING_SPEED 0x21 - -#define XMIT_DIR_FRAME 0x0a /* Direct station transmit */ -#define XMIT_I_FRAME 0x0b -#define XMIT_UI_FRM 0x0d /* transmit unnumbered info frame */ -#define XMIT_XID_CMD 0x0e /* transmit XID command */ -#define XMIT_XID_RESP_FINAL 0x0f -#define XMIT_XID_RESP_NOT_FINAL 0x10 -#define XMIT_TEST_CMD 0x11 /* transmit TEST command */ - - -/* Adapter-Card-to-PC commands */ - -#define REC_DATA 0x81 /* Data received from ring station */ -#define XMIT_DATA_REQ 0x82 /* Adapter needs data to xmit */ -#define DLC_STATUS 0x83 /* DLC status has changed */ -#define RING_STAT_CHANGE 0x84 /* Adapter has new ring-status info */ -#define REC_BRIDGE_DATA 0x85 -#define REXMIT_DATA_REQ 0x86 - -/* Open options */ - -#define OPEN_WRAP 0x8000 /* Wrap xmit data to receive data */ -#define OPEN_NO_HARD_ERR 0x4000 /* Ring hard error and xmit beacon */ - /* conditions do not cause interrupt */ -#define OPEN_NO_SOFT_ERR 0x2000 /* Ring soft errors do not cause */ - /* interrupt */ -#define OPEN_PASS_MAC 0x1000 /* Pass all adapter-class MAC frames */ - /* received but not supported by the */ - /* adapter */ -#define OPEN_PASS_ATTN_MAC 0x0800 /* Pass all attention-class MAC */ - /* frames != the previously received */ - /* attention MAC frame */ -#define OPEN_PASS_BCON_MAC 0x0100 /* Pass the first beacon MAC frame */ - /* and all subsequent beacon MAC */ - /* frames that have a change in */ - /* source address or beacon type */ -#define OPEN_CONT 0x0080 /* Adapter will participate in */ - /* monitor contention */ - -#define NUM_RCV_BUF 4 /* Number of receive buffers in */ - /* shared RAM needed for adapter to */ - /* open */ -#define RCV_BUF_LEN 520 /* Length of each receive buffer */ -#define RCV_BUF_DLEN RCV_BUF_LEN - 8 /* Length of data in rec buf */ - -#define DHB_LENGTH 512 /* Length of each transmit buffer */ -#define FP_BUF_LEN 536 /* length of each FP transmit buffer */ - -/* - * Integrity cannot be guaranteed if number of dhbs > 2 - */ -#define NUM_DHB 1 /* Number of transmit buffers */ - -#define DLC_MAX_SAP 0 /* MAX number of SAPs */ -#define DLC_MAX_STA 0 /* MAX number of link stations */ -#define DLC_MAX_GSAP 0 /* MAX number of group SAPs */ -#define DLC_MAX_GMEM 0 /* MAX number of SAPs that can be */ - /* assigned to any given group */ -#define DLC_TICK 0 /* Zero selects default of 40ms */ - - -/* Open return codes */ - -#define OPEN_OK 0x00 /* Open completed successfully */ -#define OPEN_BAD_COMMAND 0x01 /* Invalid command code */ -#define OPEN_ALREADY 0x03 /* Adapter is ALREADY open */ -#define OPEN_MISSING_PARAMS 0x05 /* Required parameters missing */ -#define OPEN_UNRECOV_FAIL 0x07 /* Unrecoverable failure occurred */ -#define OPEN_INAD_REC_BUFS 0x30 /* Inadequate receive buffers */ -#define OPEN_BAD_NODE_ADDR 0x32 /* Invalid NODE address */ -#define OPEN_BAD_REC_BUF_LEN 0x33 /* Invalid receive buffer length */ -#define OPEN_BAD_XMIT_BUF_LEN 0x43 /* Invalid transmit buffer length */ - -/* Bit definitions of ISRA High Byte, (Adapter Status) */ -#define PARITY_ERROR 0x80 /* Parity error on the adapter's internal bus */ -#define TIMER_STAT 0x40 /* A Timer Control Reg. has an interrupt */ -#define ACCESS_STAT 0x20 /* Shared RAM or MMIO access violation */ -#define DEADMAN_TIMER 0x10 /* The deadman timer has expired */ -#define PROCESSOR_CK 0x08 /* Adapter Processor Check */ -#define H_INT_MASK 0x02 /* When on, no adapter hardware interrupts */ -#define S_INT_MASK 0x01 /* When on, no adapter software interrupts */ - -/* Bit definitions of ISRA Low Byte, (Used by PC to interrupt adapter) */ -#define XMIT_REQ 0x40 /* Transmit frame in fast path transmit buf */ -#define CMD_IN_SRB 0x20 /* Inform adapter of command in SRB */ -#define RESP_IN_ASB 0x10 /* Inform adapter of response in ASB */ -#define SRB_FREE 0x08 /* Inform PC when SRB is FREE */ -#define ASB_FREE 0x04 /* Inform PC when ASB is FREE */ -#define ARB_FREE 0x02 /* Inform adapter ARB is FREE */ -#define SSB_FREE 0x01 /* Inform adapter SSB is FREE */ - -/* Bit definitions of ISRP High Byte, (PC interrupts and interrupt control) */ -#define NMI_INT_CTL 0x80 /* 1 = all interrupts to PC interrupt level */ - /* 0 = error and timer interrupts to PC NMI */ -#define INT_ENABLE 0x40 /* Allow adapter to interrupt the PC */ -#define TCR_INT 0x10 /* Timer Control Reg. has interrupt for PC */ -#define ERR_INT 0x08 /* Adap machine check, deadman timer, overrun */ -#define ACCESS_INT 0x04 /* Shared RAM or MMIO access violation */ -#define SHARED_INT_BLK 0x02 /* Shared interrupt blocked */ -#define PRIM_ALT_ADDR 0x01 /* 0 = primary adapter address */ - /* 1 = alternate adapter address */ - -/* Bit definitions of ISRP Low Byte, (PC interrupts) */ -#define ADAP_CHK_INT 0x40 /* The adapter has an unrecoverable error */ -#define SRB_RESP_INT 0x20 /* Adapter has placed a response in the SRB */ -#define ASB_FREE_INT 0x10 /* Adapter has read response in ARB */ -#define ARB_CMD_INT 0x08 /* ARB has command for PC to act on */ -#define SSB_RESP_INT 0x04 /* SSB has response to previous SRB command */ -#define XMIT_COMPLETE 0x02 /* Fast path transmit frame complete */ - - -/* Constants for Token-Ring physical header */ -#define DLC_HDR_LEN 0x3 /* Length of DLC header */ -#define SNAP_LENGTH 0x05 /* SNAP field length */ - /* protocol id = 3 bytes */ - /* ethertype = 2 bytes */ -#define HDR_LNGTH_NOROUTE 14 /* length of header with no route info */ -#define SKIP_DSAP_SSAP 0x02 /* length of dsap and ssap in llc frame */ -#define TR_MAX_LINK_HDR 46 /* max length of link header with route info */ - -/* SAP DLC SRB commands (page 6-50 Token Ring Tech. Ref.) */ -#define DLC_RESET 0x14 -#define DLC_OPEN_SAP 0x15 /* activate service access point */ -#define DLC_CLOSE_SAP 0x16 /* de-activate SAP */ -#define DLC_REALLOCATE 0x17 -#define DLC_OPEN_STATION 0x19 -#define DLC_CLOSE_STATION 0x1a -#define DLC_CONNECT_STATION 0x1b -#define DLC_MODIFY 0x1c -#define DLC_FLOW_CONTROL 0x1d -#define DLC_STATISTICS 0x1e - - -/* ARB RING STATUS CHANGE */ -#define SIGNAL_LOSS 0x8000 /* signal loss */ -#define HARD_ERR 0x4000 /* beacon frames sent */ -#define SOFT_ERR 0x2000 /* soft error */ -#define LOBE_FAULT 0x0800 /* lobe wire fault */ -#define LOG_OFLOW 0x0080 /* adapter error log counter overflow */ -#define SINGLE_STATION 0x0040 /* single station on ring */ diff --git a/sys/dev/ic/tropicvar.h b/sys/dev/ic/tropicvar.h deleted file mode 100644 index e11af8a5b9bc..000000000000 --- a/sys/dev/ic/tropicvar.h +++ /dev/null @@ -1,117 +0,0 @@ -/* $NetBSD: tropicvar.h,v 1.14 2012/10/27 17:18:23 chs Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1991 Carnegie Mellon University - * Copyright (c) 1991 IBM Corporation - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation, - * and that the name IBM not be used in advertising or publicity - * pertaining to distribution of the software without specific, written - * prior permission. - * - * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -/* $ACIS:if_lanvar.h 12.0$ */ - -#include - -/* - * This file contains structures used in the "tr" driver for the - * IBM TOKEN-RING NETWORK PC ADAPTER - */ - -/* Receive buffer control block */ -struct rbcb { - bus_size_t rbufp; /* offset of current receive buffer */ - bus_size_t rbufp_next; /* offset of next receive buffer */ - bus_size_t rbuf_datap; /* offset of data in receive buffer */ - unsigned short data_len; /* amount of data in this rec buffer */ -}; - -/* - * Token-Ring software status per adapter - */ -struct tr_softc { - device_t sc_dev; - void *sc_ih; - struct ethercom sc_ethercom; - struct ifmedia sc_media; - u_char sc_xmit_correlator; - int sc_xmit_buffers; -#if 1 - int sc_xmit_head; - int sc_xmit_tail; -#endif - int sc_minbuf; - int sc_nbuf; - bus_size_t sc_txca; - - bus_space_tag_t sc_piot; - bus_space_tag_t sc_memt; - bus_space_handle_t sc_pioh; /* handle pio area */ - bus_space_handle_t sc_sramh; /* handle for the shared ram area */ - bus_space_handle_t sc_mmioh; /* handle for the bios/mmio area */ - - struct callout sc_init_callout; - struct callout sc_reinit_callout; - - int (*sc_mediachange)(struct tr_softc *); - void (*sc_mediastatus)(struct tr_softc *, struct ifmediareq *); - struct rbcb rbc; /* receiver buffer control block */ - bus_size_t sc_aca; /* offset of adapter ACA */ - bus_size_t sc_ssb; /* offset of System Status Block */ - bus_size_t sc_arb; /* offset of Adapter Request Block */ - bus_size_t sc_srb; /* offset of System Request Block */ - bus_size_t sc_asb; /* offset of Adapter Status Block */ - u_int sc_maddr; /* mapped shared memory address */ - u_int sc_memwinsz; /* mapped shared memory window size */ - u_int sc_memsize; /* memory installed on adapter */ - u_int sc_memreserved; /* reserved memory on adapter */ - int sc_dhb4maxsz; /* max. dhb size at 4MBIT ring speed */ - int sc_dhb16maxsz; /* max. dbh size at 16MBIT ring speed */ - int sc_maxmtu; /* max. MTU supported by adapter */ - unsigned char sc_init_status; - void * tr_sleepevent; /* tr event signalled on successful */ - /* open of adapter */ - unsigned short exsap_station; /* station assigned by open sap cmd */ - - void *sc_sdhook; - - /* Power management hooks */ - int (*sc_enable)(struct tr_softc *); - void (*sc_disable)(struct tr_softc *); - int sc_enabled; -}; - -int tr_config(struct tr_softc *); -int tr_attach(struct tr_softc *); -int tr_intr(void *); -void tr_init(void *); -int tr_ioctl(struct ifnet *, u_long, void *); -void tr_stop(struct tr_softc *); -int tr_reset(struct tr_softc *); -void tr_sleep(struct tr_softc *); -int tr_setspeed(struct tr_softc *, u_int8_t); -int tr_enable(struct tr_softc *); -void tr_disable(struct tr_softc *); -int tr_activate(device_t, enum devact); -int tr_detach(device_t, int flags); diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa index f68ca6234b5c..76e461023762 100644 --- a/sys/dev/isa/files.isa +++ b/sys/dev/isa/files.isa @@ -1,4 +1,4 @@ -# $NetBSD: files.isa,v 1.174 2019/10/25 17:39:57 martin Exp $ +# $NetBSD: files.isa,v 1.175 2020/01/19 20:00:35 thorpej Exp $ # # Config file and device description for machine-independent ISA code. # Included by ports that need it. Requires that the SCSI files be @@ -270,13 +270,6 @@ device ix: ether, ifnet, arp, i82586 attach ix at isa file dev/isa/if_ix.c ix -# TROPIC based Token-Ring (IBM/3COM) -define tr_isa -file dev/isa/if_tr_isa.c tr_isa -attach tr at isa with tr_isa: tr_isa, elink -file dev/isa/if_tribm_isa.c tr_isa -file dev/isa/if_trtcm_isa.c tr_isa - # # ISA Sound hardware # diff --git a/sys/dev/isa/if_tr_isa.c b/sys/dev/isa/if_tr_isa.c deleted file mode 100644 index 7be366d587c4..000000000000 --- a/sys/dev/isa/if_tr_isa.c +++ /dev/null @@ -1,266 +0,0 @@ -/* $NetBSD: if_tr_isa.c,v 1.26 2016/07/14 10:19:06 msaitoh Exp $ */ - -/* XXXJRT changes isa_attach_args too early!! */ - -/* - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Onno van der Linden. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tr_isa.c,v 1.26 2016/07/14 10:19:06 msaitoh Exp $"); - -#undef TRISADEBUG - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - - -int tr_isa_probe(device_t, cfdata_t, void *); -int trtcm_isa_probe(device_t, cfdata_t, void *); -int tribm_isa_probe(device_t, cfdata_t, void *); -void tr_isa_attach(device_t, device_t, void *); -int tr_isa_map_io(struct isa_attach_args *, bus_space_handle_t *, - bus_space_handle_t *); -void tr_isa_unmap_io(struct isa_attach_args *, bus_space_handle_t, - bus_space_handle_t); -int trtcm_isa_mediachange(struct tr_softc *); -void trtcm_isa_mediastatus(struct tr_softc *, struct ifmediareq *); -#ifdef TRISADEBUG -void tr_isa_dumpaip(bus_space_tag_t, bus_space_handle_t); -#endif - -/* - * List of manufacturer specific probe routines. Order is important. - */ -int (*tr_isa_probe_list[])(device_t, cfdata_t, void *) = { - trtcm_isa_probe, - tribm_isa_probe, - 0 - }; - -CFATTACH_DECL_NEW(tr_isa, sizeof(struct tr_softc), - tr_isa_probe, tr_isa_attach, NULL, NULL); - -int -tr_isa_map_io(struct isa_attach_args *ia, bus_space_handle_t *pioh, - bus_space_handle_t *mmioh) -{ - bus_size_t mmio; - u_int8_t s; - - if (bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, - ia->ia_io[0].ir_size, 0, pioh)) { - printf("tr_isa_map_io: can't map PIO ports\n"); - return 1; - } - - /* Read adapter switches and calculate addresses of MMIO. */ - s = bus_space_read_1(ia->ia_iot, *pioh, TR_SWITCH); - - if ((s & 0xfc) < ((TR_MMIO_MINADDR - TR_MMIO_OFFSET) >> 11) || - (s & 0xfc) > ((TR_MMIO_MAXADDR - TR_MMIO_OFFSET) >> 11)) { - bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); - return 1; - } - - mmio = ((s & 0xfc) << 11) + TR_MMIO_OFFSET; - if (bus_space_map(ia->ia_memt, mmio, TR_MMIO_SIZE, 0, mmioh)) { - printf("tr_isa_map_io: can't map MMIO region 0x%05lx/%d\n", - (u_long)mmio, TR_MMIO_SIZE); - bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); - return 1; - } - return 0; -} - -void -tr_isa_unmap_io(struct isa_attach_args *ia, bus_space_handle_t pioh, - bus_space_handle_t mmioh) -{ - bus_space_unmap(ia->ia_memt, mmioh, TR_MMIO_SIZE); - bus_space_unmap(ia->ia_iot, pioh, ia->ia_io[0].ir_size); -} - -static u_char tr_isa_id[] = { - 5, 0, 4, 9, 4, 3, 4, 15, 3, 6, 3, 1, 3, 1, 3, 0, 3, 9, 3, 9, 3, 0, 2, 0 -}; - -/* - * XXX handle multiple IBM TR cards (sram mapping !!) - */ - -int -tr_isa_probe(device_t parent, cfdata_t match, void *aux) -{ - struct isa_attach_args *ia = aux; - int i; - bus_size_t tr_id; - bus_space_handle_t sramh, pioh, mmioh; - int probecode; - int matched = 0; - - if (ia->ia_nio < 1) - return (0); - if (ia->ia_niomem < 1) - return (0); - if (ia->ia_nirq < 1) - return (0); - - if (ISA_DIRECT_CONFIG(ia)) - return (0); - - for (i = 0; tr_isa_probe_list[i] != 0; i++) { - probecode = tr_isa_probe_list[i](parent, match, aux); - if (probecode < 0) - return 0; /* Fail instantly. */ - if (probecode > 0) - break; /* We have a match. */ - } - if (tr_isa_probe_list[i] == 0) - return 0; /* Nothing matched. */ - if (tr_isa_map_io(ia, &pioh, &mmioh)) - return 0; - tr_id = TR_ID_OFFSET; - matched = 1; - for (i = 0; i < sizeof(tr_isa_id); i++) { - if (bus_space_read_1(ia->ia_memt, mmioh, tr_id) != - tr_isa_id[i]) - matched = 0; - tr_id += 2; - } -#ifdef TRISADEBUG - tr_isa_dumpaip(ia->ia_memt, mmioh); -#endif - tr_isa_unmap_io(ia, pioh, mmioh); - if (!matched) { - return 0; - } - if (bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, - ia->ia_iomem[0].ir_size, 0, &sramh)) { - printf("tr_isa_probe: can't map shared ram\n"); - return 0; - } - bus_space_unmap(ia->ia_memt, sramh, ia->ia_iomem[0].ir_size); - - ia->ia_nio = 1; - ia->ia_niomem = 1; - ia->ia_nirq = 1; - - ia->ia_ndrq = 0; - - return 1; -} - -int trtcm_setspeed(struct tr_softc *, int); - -void -tr_isa_attach(device_t parent, device_t self, void *aux) -{ - struct tr_softc *sc = device_private(self); - struct isa_attach_args *ia = aux; - - printf("\n"); - - sc->sc_dev = self; - sc->sc_piot = ia->ia_iot; - sc->sc_memt = ia->ia_memt; - if (tr_isa_map_io(ia, &sc->sc_pioh, &sc->sc_mmioh)) { - aprint_error("tr_isa_attach: IO space vanished\n"); - return; - } - if (bus_space_map(sc->sc_memt, ia->ia_iomem[0].ir_addr, - ia->ia_iomem[0].ir_size, 0, &sc->sc_sramh)) { - aprint_error("tr_isa_attach: shared ram space vanished\n"); - return; - } - /* set ACA offset */ - sc->sc_aca = TR_ACA_OFFSET; - sc->sc_memwinsz = ia->ia_iomem[0].ir_size; - sc->sc_maddr = ia->ia_iomem[0].ir_addr; - /* - * Determine total RAM on adapter and decide how much to use. - * XXX Since we don't use RAM paging, use sc_memwinsz for now. - */ - sc->sc_memsize = sc->sc_memwinsz; - sc->sc_memreserved = 0; - - if (tr_reset(sc) != 0) - return; - - if (ia->ia_aux != NULL) { - sc->sc_mediastatus = trtcm_isa_mediastatus; - sc->sc_mediachange = trtcm_isa_mediachange; - } - else { - sc->sc_mediastatus = NULL; - sc->sc_mediachange = NULL; - } - - if (tr_attach(sc) != 0) - return; - -/* - * XXX 3Com 619 can use LEVEL intr - */ - sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, - IST_EDGE, IPL_NET, tr_intr, sc); -} - -#ifdef TRISADEBUG -/* - * Dump the adapters AIP - */ -void -tr_isa_dumpaip(bus_space_tag_t memt, bus_space_handle_t mmioh) -{ - unsigned int off, val; - printf("AIP contents:"); - for (off=0; off < 256; off++) { - val = bus_space_read_1(memt, mmioh, TR_MAC_OFFSET + off); - if ((off % 16) == 0) - printf("\n"); - printf("%02x ", val); - } - printf("\n"); -} -#endif diff --git a/sys/dev/isa/if_tribm_isa.c b/sys/dev/isa/if_tribm_isa.c deleted file mode 100644 index 54e4f1c138f0..000000000000 --- a/sys/dev/isa/if_tribm_isa.c +++ /dev/null @@ -1,189 +0,0 @@ -/* $NetBSD: if_tribm_isa.c,v 1.14 2009/05/12 09:10:15 cegger Exp $ */ - -/* XXXJRT changes isa_attach_args too early */ - -/* - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Onno van der Linden. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tribm_isa.c,v 1.14 2009/05/12 09:10:15 cegger Exp $"); - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include - -int tribm_isa_probe(device_t, cfdata_t, void *); -int tr_isa_map_io(struct isa_attach_args *, bus_space_handle_t *, - bus_space_handle_t *); -void tr_isa_unmap_io(struct isa_attach_args *, bus_space_handle_t, - bus_space_handle_t); - -int -tribm_isa_probe(device_t parent, cfdata_t match, void *aux) -{ - struct isa_attach_args *ia = aux; - static int irq_f[4] = { 9, 3, 6, 7 }; - static int irq_e[4] = { 9, 3, 10, 11 }; - bus_space_tag_t piot = ia->ia_iot; - bus_space_tag_t memt = ia->ia_memt; - bus_space_handle_t pioh, mmioh; - int i, irq; - u_int8_t s; - - if (ia->ia_nio < 1) - return (0); - if (ia->ia_niomem < 1) - return (0); - if (ia->ia_nirq < 1) - return (0); - - if (ISA_DIRECT_CONFIG(ia)) - return (0); - -#ifdef notyet -/* XXX Try both 0xa20 and 0xa24 and store that info like 3com */ - if (ia->ia_iobase == IOBASEUNK) - ia->ia_iobase = 0xa20; -#else - if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT) - return (0); -#endif - - /* - * XXXJRT Should not modify attach_args unless we know we match! - */ - - ia->ia_io[0].ir_size = 4; - ia->ia_aux = NULL; - - if (tr_isa_map_io(ia, &pioh, &mmioh)) - return 0; - -/* - * F = Token-Ring Network PC Adapter - * Token-Ring Network PC Adapter II - * Token-Ring Network Adapter/A - * E = Token-Ring Network 16/4 Adapter/A (long card) - * Token-Ring Network 16/4 Adapter - * D = Token-Ring Network 16/4 Adapter/A (short card) - * 16/4 ISA-16 Adapter - * C = Auto 16/4 Token-Ring ISA Adapter - * Auto 16/4 Token-Ring MC Adapter - */ -/* - * XXX Both 0xD and 0xC types should be able to use 16-bit read and writes - */ - switch (bus_space_read_1(memt, mmioh, TR_TYP_OFFSET)) { - case 0xF: - case 0xE: - case 0xD: - if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM) -#ifdef notyet - ia->ia_maddr = TR_SRAM_DEFAULT; -#else - return 0; -#endif - break; - case 0xC: - i = bus_space_read_1(memt, mmioh, TR_ACA_OFFSET) << 12; - if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM) - ia->ia_iomem[0].ir_addr = i; - else if (ia->ia_iomem[0].ir_addr != i) { - printf( -"tribm_isa_probe: sram mismatch; kernel configured %x != board configured %x\n", - ia->ia_iomem[0].ir_addr, i); - tr_isa_unmap_io(ia, pioh, mmioh); - return 0; - } - break; - default: - printf("tribm_isa_probe: unknown type code %x\n", - bus_space_read_1(memt, mmioh, TR_TYP_OFFSET)); - tr_isa_unmap_io(ia, pioh, mmioh); - return 0; - } - - s = bus_space_read_1(piot, pioh, TR_SWITCH); - - switch (bus_space_read_1(memt, mmioh, TR_IRQ_OFFSET)) { - case 0xF: - irq = irq_f[s & 3]; - break; - case 0xE: - irq = irq_e[s & 3]; - break; - default: - printf("tribm_isa_probe: Unknown IRQ code %x\n", - bus_space_read_1(memt, mmioh, TR_IRQ_OFFSET)); - tr_isa_unmap_io(ia, pioh, mmioh); - return 0; - } - - if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ) - ia->ia_irq[0].ir_irq = irq; - else if (ia->ia_irq[0].ir_irq != irq) { - printf( -"tribm_isa_probe: irq mismatch; kernel configured %d != board configured %d\n", - ia->ia_irq[0].ir_irq, irq); - tr_isa_unmap_io(ia, pioh, mmioh); - return 0; - } -/* - * XXX 0x0c == MSIZEMASK (MSIZEBITS) - */ - ia->ia_iomem[0].ir_size = 8192 << - ((bus_space_read_1(memt, mmioh, TR_ACA_OFFSET + 1) & 0x0c) >> 2); - tr_isa_unmap_io(ia, pioh, mmioh); - /* Check alignment of membase. */ - if ((ia->ia_iomem[0].ir_addr & (ia->ia_iomem[0].ir_size-1)) != 0) { - printf("tribm_isa_probe: SRAM unaligned 0x%04x/%d\n", - ia->ia_iomem[0].ir_addr, ia->ia_iomem[0].ir_size); - return 0; - } - - ia->ia_nio = 1; - ia->ia_niomem = 1; - ia->ia_nirq = 1; - - ia->ia_ndrq = 0; - - return 1; -} diff --git a/sys/dev/isa/if_trtcm_isa.c b/sys/dev/isa/if_trtcm_isa.c deleted file mode 100644 index 041dc5be1049..000000000000 --- a/sys/dev/isa/if_trtcm_isa.c +++ /dev/null @@ -1,356 +0,0 @@ -/* $NetBSD: if_trtcm_isa.c,v 1.20 2019/11/10 21:16:35 chs Exp $ */ - -/* XXXJRT verify doens't change isa_attach_args too early */ - -/* - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Onno van der Linden. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_trtcm_isa.c,v 1.20 2019/11/10 21:16:35 chs Exp $"); - -#undef TRTCMISADEBUG - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include -#include - -#include - -u_int16_t tcmreadeeprom(bus_space_tag_t, bus_space_handle_t, int); -#ifdef TRTCMISADEBUG -void tcmdumpeeprom(bus_space_tag_t, bus_space_handle_t); -#endif - -int trtcm_isa_probe(device_t, cfdata_t, void *); - -int trtcm_isa_mediachange(struct tr_softc *); -void trtcm_isa_mediastatus(struct tr_softc *, struct ifmediareq *); - -/* - * TODO: - * - * if_media handling in the 3com case - * mediachange() and mediastatus() function - * certain newer cards can set their speed on the fly via - * DIR_SET_DEFAULT_RING_SPEED or set the speed in the eeprom ?? - */ - -static void tcmaddcard(int, int, int, int, u_int, int, int); - -/* - * This keeps track of which ISAs have been through a 3com probe sequence. - * A simple static variable isn't enough, since it's conceivable that - * a system might have more than one ISA bus. - * - * The "tcm_bus" member is the unit number of the parent ISA bus, e.g. "0" - * for "isa0". - */ -struct tcm_isa_done_probe { - LIST_ENTRY(tcm_isa_done_probe) tcm_link; - int tcm_bus; -}; -static LIST_HEAD(, tcm_isa_done_probe) tcm_isa_all_probes; -static int tcm_isa_probes_initialized; - -#define MAXTCMCARDS 20 /* if you have more than 20, you lose */ - -static struct tcmcard { - int bus; - int iobase; - int irq; - int maddr; - u_int msize; - long model; - char available; - char pnpmode; -} tcmcards[MAXTCMCARDS]; - -static int ntcmcards = 0; - -static void -tcmaddcard(int bus, int iobase, int irq, int maddr, u_int msiz, int model, int pnpmode) -{ - - if (ntcmcards >= MAXTCMCARDS) - return; - tcmcards[ntcmcards].bus = bus; - tcmcards[ntcmcards].iobase = iobase; - tcmcards[ntcmcards].irq = irq; - tcmcards[ntcmcards].maddr = maddr; - tcmcards[ntcmcards].msize = msiz; - tcmcards[ntcmcards].model = model; - tcmcards[ntcmcards].available = 1; - tcmcards[ntcmcards].pnpmode = pnpmode; - ntcmcards++; -} - -/* - * We get eeprom data from the id_port given an offset into the - * eeprom. Basically; after the ID_sequence is sent to all of - * the cards; they enter the ID_CMD state where they will accept - * command requests. 0x80-0xbf loads the eeprom data. We then - * read the port 16 times and with every read; the cards check - * for contention (ie: if one card writes a 0 bit and another - * writes a 1 bit then the host sees a 0. At the end of the cycle; - * each card compares the data on the bus; if there is a difference - * then that card goes into ID_WAIT state again). In the meantime; - * one bit of data is returned in the AX register which is conveniently - * returned to us by bus_space_read_1(). Hence; we read 16 times getting one - * bit of data with each read. - * - * NOTE: the caller must provide an i/o handle for ELINK_ID_PORT! - */ -u_int16_t -tcmreadeeprom(bus_space_tag_t iot, bus_space_handle_t ioh, int offset) -{ - u_int16_t data = 0; - int i; - - bus_space_write_1(iot, ioh, 0, 0x80 + offset); - delay(1000); - for (i = 0; i < 16; i++) - data = (data << 1) | (bus_space_read_2(iot, ioh, 0) & 1); - return (data); -} - -#ifdef TRTCMISADEBUG -/* - * Dump the contents of the EEPROM to the console. - */ -void -tcmdumpeeprom(bus_space_tag_t iot, bus_space_handle_t ioh) -{ - unsigned int off, val; - - printf("EEPROM contents:"); - for (off=0; off < 32; off++) { - val = tcmreadeeprom(iot, ioh, off); - if ((off % 8) == 0) - printf("\n"); - printf("%04x ", val); - } - printf("\n"); -} -#endif - -int -trtcm_isa_mediachange(struct tr_softc *sc) -{ - return EINVAL; -} - -void -trtcm_isa_mediastatus(struct tr_softc *sc, struct ifmediareq *ifmr) -{ - struct ifmedia *ifm = &sc->sc_media; - - ifmr->ifm_active = ifm->ifm_cur->ifm_media; -} - -/* XXX hard coded constants in readeeprom elink_idseq */ - -int -trtcm_isa_probe(device_t parent, cfdata_t match, void *aux) -{ - struct isa_attach_args *ia = aux; - int bus = device_unit(parent); - bus_space_tag_t iot = ia->ia_iot; - bus_space_handle_t ioh; - u_int msiz; - int slot, iobase, irq, i, maddr, rsrccfg, pnpmode; - u_int16_t vendor, model; - struct tcm_isa_done_probe *tcm; - static int irqs[] = { 7, 15, 6, 11, 3, 10, 9, 5 }; - - if (ISA_DIRECT_CONFIG(ia)) - return (0); - - if (tcm_isa_probes_initialized == 0) { - LIST_INIT(&tcm_isa_all_probes); - tcm_isa_probes_initialized = 1; - } - - /* - * Probe this bus if we haven't done so already. - */ - for (tcm = tcm_isa_all_probes.lh_first; tcm != NULL; - tcm = tcm->tcm_link.le_next) - if (tcm->tcm_bus == bus) - goto bus_probed; - - /* - * Mark this bus so we don't probe it again. - */ - tcm = malloc(sizeof(struct tcm_isa_done_probe), M_DEVBUF, M_WAITOK); - tcm->tcm_bus = bus; - LIST_INSERT_HEAD(&tcm_isa_all_probes, tcm, tcm_link); - - /* - * Map the TokenLink ID port for the probe sequence. - */ - if (bus_space_map(iot, ELINK_ID_PORT, 1, 0, &ioh)) { - printf("trtcm_isa_probe: can't map TokenLink ID port\n"); - return 0; - } - - for (slot = 0; slot < MAXTCMCARDS; slot++) { - pnpmode = 0; - elink_reset(iot, ioh, bus); - elink_idseq(iot, ioh, TLINK_619_POLY); - - /* Untag all the adapters so they will talk to us. */ - if (slot == 0) - bus_space_write_1(iot, ioh, 0, TAG_ADAPTER + 0); - - vendor = htons(tcmreadeeprom(iot, ioh, EEPROM_MFG_ID)); - if (vendor != MFG_ID) - continue; - - model = htons(tcmreadeeprom(iot, ioh, EEPROM_PROD_ID)); - if (((model & 0xfff0) != 0x6190) && - ((model & 0xfff0) != 0x3190)) { /* XXX hardcoded */ -#if 0 - printf("trtcm: unknown model 0x%04x\n", model); -#endif - continue; - } -#ifdef TRTCMISADEBUG - tcmdumpeeprom(iot, ioh); - - printf("speed: %d\n", (tcmreadeeprom(iot,ioh,8) & 2) ? 4 : 16); -#endif - - rsrccfg = iobase = tcmreadeeprom(iot, ioh, EEPROM_RESOURCE_CFG); - if (iobase & 0x20) - iobase = tcmreadeeprom(iot, ioh, EEPROM_ADDR_CFG) & 1 ? - 0xa20 : 0xa24; - else - iobase = (iobase & 0x1f) * 0x10 + 0x200; - - maddr = ((tcmreadeeprom(iot, ioh, EEPROM_OEM_ADDR0) & 0xfc00) - << 3) + 0x80000; - msiz = 65536 >> ((tcmreadeeprom(iot, ioh, 8) & 0x0c) >> 2); - - irq = tcmreadeeprom(iot, ioh, EEPROM_ADDR_CFG) & 0x180; - irq |= (tcmreadeeprom(iot, ioh, EEPROM_RESOURCE_CFG) & 0x40); - irq = irqs[irq >> 6]; - - /* Tag card so it will not respond to contention again. */ - bus_space_write_1(iot, ioh, 0, TAG_ADAPTER + 1); - - /* - * Don't attach a 3c319 in PnP mode. - * - * XXX Testing for the 13th bit in iobase being 0 might not - * be the right thing to do, but the EEPROM of the 3C319 is - * undocumented according to 3COM and this is one of the - * three bits that changed when I put the card in PnP mode. -chb - */ - if (((model & 0xffff0) == 0x3190) && - ((rsrccfg & 0x1000) == 0)) { - printf("3COM 3C319 TokenLink Velocity in PnP mode\n"); - pnpmode = 1; - } - else { - /* - * XXX: this should probably not be done here - * because it enables the drq/irq lines from - * the board. Perhaps it should be done after - * we have checked for irq/drq collisions? - */ - bus_space_write_1(iot, ioh, 0, - ACTIVATE_ADAPTER_TO_CONFIG); - } - tcmaddcard(bus, iobase, irq, maddr, msiz, model, pnpmode); - } - bus_space_unmap(iot, ioh, 1); - -bus_probed: - - if (ia->ia_nio < 1) - return (0); - if (ia->ia_niomem < 1) - return (0); - if (ia->ia_nirq < 1) - return (0); - - for (i = 0; i < ntcmcards; i++) { - if (tcmcards[i].bus != bus) - continue; - if (tcmcards[i].available == 0) - continue; - if (ia->ia_io[0].ir_addr != ISA_UNKNOWN_PORT && - ia->ia_io[0].ir_addr != tcmcards[i].iobase) - continue; - if (ia->ia_irq[0].ir_irq != ISA_UNKNOWN_IRQ && - ia->ia_irq[0].ir_irq != tcmcards[i].irq) - continue; - goto good; - } - return 0; - -good: - tcmcards[i].available = 0; - if (tcmcards[i].pnpmode) - return -1; /* XXX Don't actually probe this card. */ - - ia->ia_nio = 1; - ia->ia_io[0].ir_addr = tcmcards[i].iobase; - /* XXX probably right, but ...... */ - if (ia->ia_io[0].ir_addr == 0xa20 || ia->ia_io[0].ir_addr == 0xa24) - ia->ia_io[0].ir_size = 4; - else - ia->ia_io[0].ir_size = 16; - - ia->ia_niomem = 1; - ia->ia_iomem[0].ir_addr = tcmcards[i].maddr; - ia->ia_iomem[0].ir_size = tcmcards[i].msize; - - ia->ia_nirq = 1; - ia->ia_irq[0].ir_irq = tcmcards[i].irq; - - ia->ia_ndrq = 0; - - ia->ia_aux = (void *) tcmcards[i].model; - return 1; -} diff --git a/sys/dev/isapnp/files.isapnp b/sys/dev/isapnp/files.isapnp index 9268e7a80e9a..07ee30b74766 100644 --- a/sys/dev/isapnp/files.isapnp +++ b/sys/dev/isapnp/files.isapnp @@ -1,4 +1,4 @@ -# $NetBSD: files.isapnp,v 1.39 2018/09/22 16:22:23 maxv Exp $ +# $NetBSD: files.isapnp,v 1.40 2020/01/19 20:00:36 thorpej Exp $ # # Config file and device description for machine-independent ISAPnP code. # Included by ports that need it. @@ -30,10 +30,6 @@ file dev/isapnp/if_le_isapnp.c le_isapnp attach ne at isapnp with ne_isapnp: rtl80x9 file dev/isapnp/if_ne_isapnp.c ne_isapnp -# TROPIC based Token-Ring (IBM/3COM) -attach tr at isapnp with tr_isapnp -file dev/isapnp/if_tr_isapnp.c tr_isapnp - # Aironet 802.11 ISA attach an at isapnp with an_isapnp file dev/isapnp/if_an_isapnp.c an_isapnp diff --git a/sys/dev/isapnp/if_tr_isapnp.c b/sys/dev/isapnp/if_tr_isapnp.c deleted file mode 100644 index b40745759fea..000000000000 --- a/sys/dev/isapnp/if_tr_isapnp.c +++ /dev/null @@ -1,138 +0,0 @@ -/* $NetBSD: if_tr_isapnp.c,v 1.22 2016/07/14 10:19:06 msaitoh Exp $ */ - -/* - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Onno van der Linden. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tr_isapnp.c,v 1.22 2016/07/14 10:19:06 msaitoh Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -int tr_isapnp_match(device_t, cfdata_t, void *); -void tr_isapnp_attach(device_t, device_t, void *); - -CFATTACH_DECL_NEW(tr_isapnp, sizeof(struct tr_softc), - tr_isapnp_match, tr_isapnp_attach, NULL, NULL); - -int -tr_isapnp_match(device_t parent, cfdata_t match, void *aux) -{ - int pri, variant; - - pri = isapnp_devmatch(aux, &isapnp_tr_devinfo, &variant); - if (pri && variant > 0) - pri = 0; - return pri; -} - - -void -tr_isapnp_attach(device_t parent, device_t self, void *aux) -{ - struct tr_softc *sc = device_private(self); - struct isapnp_attach_args *ipa = aux; - int mmioidx, sramidx; - - aprint_naive("\n"); - aprint_normal("\n"); - - if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - aprint_error_dev(self, "error in region allocation\n"); - return; - } - - aprint_normal_dev(self, "%s %s\n", - ipa->ipa_devident, ipa->ipa_devclass); - - sc->sc_dev = self; - sc->sc_piot = ipa->ipa_iot; - sc->sc_pioh = ipa->ipa_io[0].h; - - if (strcmp(ipa->ipa_devlogic, "TCM3190") == 0) { - mmioidx = 0; - sramidx = 1; - } else { /* Default */ - mmioidx = 1; - sramidx = 0; - } - sc->sc_memt = ipa->ipa_memt; - sc->sc_mmioh = ipa->ipa_mem[mmioidx].h; - sc->sc_sramh = ipa->ipa_mem[sramidx].h; - sc->sc_memwinsz = ipa->ipa_mem[sramidx].length; - /* - * Determine total RAM on adapter and decide how much to use. - * XXX Since we don't use RAM paging, use sc_memwinsz for now. - */ - sc->sc_memsize = sc->sc_memwinsz; - sc->sc_memreserved = 0; - - sc->sc_aca = TR_ACA_OFFSET; - sc->sc_maddr = ipa->ipa_mem[sramidx].base; - /* - * Reset the card. - */ - if (tr_reset(sc)) - return; - - sc->sc_mediastatus = NULL; - sc->sc_mediachange = NULL; - - if (tr_attach(sc)) - return; - - sc->sc_ih = isa_intr_establish(ipa->ipa_ic, ipa->ipa_irq[0].num, - ipa->ipa_irq[0].type, IPL_NET, tr_intr, sc); -} diff --git a/sys/dev/mca/files.mca b/sys/dev/mca/files.mca index 802ea0d9b4a6..15ccea33d638 100644 --- a/sys/dev/mca/files.mca +++ b/sys/dev/mca/files.mca @@ -1,4 +1,4 @@ -# $NetBSD: files.mca,v 1.22 2005/12/11 12:22:18 christos Exp $ +# $NetBSD: files.mca,v 1.23 2020/01/19 20:00:36 thorpej Exp $ # # Config.new file and device description for machine-independent MCA code. # Included by ports that need it. @@ -24,10 +24,6 @@ file dev/mca/if_we_mca.c we_mca attach aha at mca with aha_mca file dev/mca/aha_mca.c aha_mca -# TROPIC based Token-Ring (IBM) -attach tr at mca with tr_mca -file dev/mca/if_tr_mca.c tr_mca - # 3Com 3C523 device elmc: ether, ifnet, arp, i82586 attach elmc at mca with elmc_mca diff --git a/sys/dev/mca/if_tr_mca.c b/sys/dev/mca/if_tr_mca.c deleted file mode 100644 index e1e7a778774c..000000000000 --- a/sys/dev/mca/if_tr_mca.c +++ /dev/null @@ -1,227 +0,0 @@ -/* $NetBSD: if_tr_mca.c,v 1.24 2016/07/14 04:19:27 msaitoh Exp $ */ - -/*_ - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Gregory McGarry . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tr_mca.c,v 1.24 2016/07/14 04:19:27 msaitoh Exp $"); - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -#ifdef DEBUG -#define DPRINTF(x) printf x -#else -#define DPRINTF(x) -#endif - -#define TR_PRI_IOADDR 0x0a20 -#define TR_ALT_IOADDR 0x0a24 -#define TR_PIOSIZE 4 -#define TR_MMIOSIZE 8192 -#define TR_MBPS_4 0 -#define TR_MBPS_16 1 - -int tr_mca_probe(device_t, cfdata_t, void *); -void tr_mca_attach(device_t, device_t, void *); - -CFATTACH_DECL_NEW(tr_mca, sizeof(struct tr_softc), - tr_mca_probe, tr_mca_attach, NULL, NULL); - -/* supported products */ -static const struct tr_mca_product { - u_int32_t tr_id; - const char *tr_name; -} tr_mca_products[] = { - { MCA_PRODUCT_ITR, "IBM Token Ring 16/4 Adapter/A" }, - { 0, NULL }, -}; - -static const struct tr_mca_product *tr_mca_lookup(int); - -static const struct tr_mca_product * -tr_mca_lookup(int id) -{ - const struct tr_mca_product *trp; - - for(trp = tr_mca_products; trp->tr_name; trp++) - if (trp->tr_id == id) - return (trp); - - return (NULL); -} - -int -tr_mca_probe(device_t parent, cfdata_t match, - void *aux) -{ - struct mca_attach_args *ma = aux; - - if (tr_mca_lookup(ma->ma_id) != NULL) - return (1); - - return (0); -} - - -void -tr_mca_attach(device_t parent, device_t self, void *aux) -{ - struct tr_softc *sc = device_private(self); - struct mca_attach_args *ma = aux; - bus_space_handle_t pioh, mmioh, sramh; - int iobase, irq, sram_size, sram_addr, rom_addr; - int pos2, pos3, pos4, pos5; - const struct tr_mca_product *tp; - - pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2); - pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3); - pos4 = mca_conf_read(ma->ma_mc, ma->ma_slot, 4); - pos5 = mca_conf_read(ma->ma_mc, ma->ma_slot, 5); - __USE(pos5); - - /* - * POS register 2: (adf pos0) - * - * 7 6 5 4 3 2 1 0 - * \___________/ \__ enable: 0=adapter disabled, 1=adapter enabled - * \__________ RAM addr: pos2&0xfe - * - * POS register 3: (adf pos1) - * - * 7 6 5 4 3 2 1 0 - * | \___/ | | | \__ port address: 1=0x0a24-0x0a27, 0=0x0a20-0x0a23 - * | | \ / \____ speed: 0=4Mbps, 1=16Mbps - * | | \_______ RAM size: 00=8kb, 01=16kb, 10=32kb, 11=64kb - * | \____________ reserved: 010 - * \________________ irq component: 0=2, 1=3 (see also pos4) - * - * POS register 4: (adf pos2) - * - * 7 6 5 4 3 2 1 0 - * \___________/ \__ interrupt controller: 0=1st, 1=2nd - * \__________ ROM address: pos4&0xfe - * - * POS register 5: (adf pos3) - * - * 7 6 5 4 3 2 1 0 - * | | \_____/ - * | | \_____ reserved: 0x0 - * | \__________ autosense: 0=off, 1=on - * \____________ boot rom: 0=enabled, 1=disabled - */ - - if (pos3 & 0x01) - iobase = TR_ALT_IOADDR; - else - iobase = TR_PRI_IOADDR; - - irq = 2 + (pos3 >> 7) + ((pos4 & 0x01) << 3); - if (irq == 2) - irq = 9; - - tp = tr_mca_lookup(ma->ma_id); - - printf(" slot %d irq %d: %s\n", ma->ma_slot + 1, irq, tp->tr_name); - - sram_size = 8 << (((pos3 & 0x0c) >> 2) + 10); - sram_addr = (pos2 & 0xfe) << 12; - - rom_addr = (pos4 & 0xfe) << 12; - - /* map the pio registers */ - if (bus_space_map(ma->ma_iot, iobase, TR_PIOSIZE, 0, &pioh)) { - aprint_error_dev(self, "unable to map PIO space\n"); - return; - } - - /* map the mmio registers */ - if (bus_space_map(ma->ma_memt, rom_addr, TR_MMIOSIZE, 0, &mmioh)) { - aprint_error_dev(self, "unable to map MMIO space\n"); - return; - } - - /* map the sram space */ - if (bus_space_map(ma->ma_memt, sram_addr, sram_size, 0, &sramh)) { - aprint_error_dev(self, "unable to map SRAM space\n"); - return; - } - - sc->sc_dev = self; - sc->sc_piot = ma->ma_iot; - sc->sc_pioh = pioh; - sc->sc_memt = ma->ma_memt; - sc->sc_mmioh = mmioh; - sc->sc_sramh = sramh; - - /* set ACA offset */ - sc->sc_aca = TR_ACA_OFFSET; - sc->sc_memwinsz = sram_size; - sc->sc_maddr = sram_addr; - - /* - * Determine total RAM on adapter and decide how much to use. - * XXX Since we don't use RAM paging, use sc_memwinsz for now. - */ - sc->sc_memsize = sc->sc_memwinsz; - sc->sc_memreserved = 0; - - if (tr_reset(sc) != 0) - return; - - /* XXX not implemented (yet) */ - sc->sc_mediastatus = NULL; - sc->sc_mediachange = NULL; - - /* do generic attach */ - if (tr_attach(sc) != 0) - return; - - /* establish interrupt handler */ - sc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_NET, tr_intr, sc); - if (sc->sc_ih == NULL) { - aprint_error_dev(self, - "couldn't establish interrupt handler\n"); - return; - } - -} diff --git a/sys/dev/pcmcia/files.pcmcia b/sys/dev/pcmcia/files.pcmcia index d528cb50ac3d..0816fa4f508d 100644 --- a/sys/dev/pcmcia/files.pcmcia +++ b/sys/dev/pcmcia/files.pcmcia @@ -1,4 +1,4 @@ -# $NetBSD: files.pcmcia,v 1.59 2018/09/22 16:22:23 maxv Exp $ +# $NetBSD: files.pcmcia,v 1.60 2020/01/19 20:00:36 thorpej Exp $ # # Config.new file and device description for machine-independent PCMCIA code. # Included by ports that need it. @@ -103,10 +103,6 @@ file dev/pcmcia/xirc.c xirc | com_xirc | xi_xirc needs-flag file dev/pcmcia/if_xi.c xi -# IBM Tropic-based Token Ring cards -attach tr at pcmcia with tr_pcmcia -file dev/pcmcia/if_tr_pcmcia.c tr_pcmcia - # Crystal Semiconductor CS8920 based cards attach cs at pcmcia with cs_pcmcia file dev/pcmcia/if_cs_pcmcia.c cs_pcmcia diff --git a/sys/dev/pcmcia/if_tr_pcmcia.c b/sys/dev/pcmcia/if_tr_pcmcia.c deleted file mode 100644 index b923d171702c..000000000000 --- a/sys/dev/pcmcia/if_tr_pcmcia.c +++ /dev/null @@ -1,333 +0,0 @@ -/* $NetBSD: if_tr_pcmcia.c,v 1.29 2019/11/12 13:17:44 msaitoh Exp $ */ - -/* - * Copyright (c) 2000 Soren S. Jorvang. All rights reserved. - * Copyright (c) 2000 Onno van der Linden. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * PCMCIA attachment for the following Tropic-based cards. - * - * o IBM Token Ring 16/4 Credit Card Adapter - * o IBM Token Ring Auto 16/4 Credit Card Adapter - * o IBM Turbo 16/4 Token Ring PC Card - * o 3Com TokenLink Velocity PC Card - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tr_pcmcia.c,v 1.29 2019/11/12 13:17:44 msaitoh Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#define TR_SRAM_SIZE (16 * 1024) /* Really 64KB, but conserve iomem. */ - -/* - * XXX How do host/PCMCIA/cbb memory spaces actually relate? - */ -#ifndef TR_PCMCIA_SRAM_ADDR -#define TR_PCMCIA_SRAM_ADDR 0xc8000 -#endif -#ifndef TR_PCMCIA_MMIO_ADDR -#define TR_PCMCIA_MMIO_ADDR 0xcc000 -#endif - -struct tr_pcmcia_softc { - struct tr_softc sc_tr; - - struct pcmcia_io_handle sc_pioh; - int sc_pio_window; - struct pcmcia_mem_handle sc_sramh; - int sc_sram_window; - struct pcmcia_mem_handle sc_mmioh; - int sc_mmio_window; - struct pcmcia_function *sc_pf; -}; - -static int tr_pcmcia_match(device_t, cfdata_t, void *); -static void tr_pcmcia_attach(device_t, device_t, void *); -static int tr_pcmcia_detach(device_t, int); -static int tr_pcmcia_enable(struct tr_softc *); -static int tr_pcmcia_mediachange(struct tr_softc *); -static void tr_pcmcia_mediastatus(struct tr_softc *, struct ifmediareq *); -static void tr_pcmcia_disable(struct tr_softc *); -static void tr_pcmcia_setup(struct tr_softc *); - -CFATTACH_DECL_NEW(tr_pcmcia, sizeof(struct tr_pcmcia_softc), - tr_pcmcia_match, tr_pcmcia_attach, tr_pcmcia_detach, tr_activate); - -static int -tr_pcmcia_match(device_t parent, cfdata_t match, - void *aux) -{ - struct pcmcia_attach_args *pa = aux; - - if (pa->manufacturer == PCMCIA_VENDOR_IBM) - switch (pa->product) { - case PCMCIA_PRODUCT_IBM_TROPIC: - return 1; - } - - return 0; -} - -static void -tr_pcmcia_attach(device_t parent, device_t self, void *aux) -{ - struct tr_pcmcia_softc *psc = device_private(self); - struct tr_softc *sc = &psc->sc_tr; - struct pcmcia_attach_args *pa = aux; - struct pcmcia_config_entry *cfe; - bus_size_t offset; - - psc->sc_pf = pa->pf; - sc->sc_dev = self; - - cfe = SIMPLEQ_FIRST(&pa->pf->cfe_head); - - pcmcia_function_init(pa->pf, cfe); - if (pcmcia_function_enable(pa->pf) != 0) { - aprint_error_dev(self, "function enable failed\n"); - return; - } - - if (pcmcia_io_alloc(pa->pf, cfe->iospace[0].start, - cfe->iospace[0].length, cfe->iospace[0].length, &psc->sc_pioh) - != 0) { - aprint_error_dev(self, "can't allocate pio space\n"); - goto fail1; - } - if (pcmcia_io_map(psc->sc_pf, PCMCIA_WIDTH_IO8, /* XXX _AUTO? */ - &psc->sc_pioh, &psc->sc_pio_window) != 0) { - aprint_error_dev(self, "can't map pio space\n"); - goto fail2; - } - - if (pcmcia_mem_alloc(psc->sc_pf, TR_SRAM_SIZE, &psc->sc_sramh) != 0) { - aprint_error_dev(self, "can't allocate sram space\n"); - goto fail3; - } - if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_COMMON, TR_PCMCIA_SRAM_ADDR, - TR_SRAM_SIZE, &psc->sc_sramh, &offset, &psc->sc_sram_window) != 0) { - aprint_error_dev(self, "can't map sram space\n"); - goto fail4; - } - - if (pcmcia_mem_alloc(psc->sc_pf, TR_MMIO_SIZE, &psc->sc_mmioh) != 0) { - aprint_error_dev(self, "can't allocate mmio space\n"); - goto fail5; - return; - } - if (pcmcia_mem_map(psc->sc_pf, PCMCIA_MEM_COMMON, TR_PCMCIA_MMIO_ADDR, - TR_MMIO_SIZE, &psc->sc_mmioh, &offset, &psc->sc_mmio_window) != 0) { - aprint_error_dev(self, "can't map mmio space\n"); - goto fail6; - } - - sc->sc_piot = psc->sc_pioh.iot; - sc->sc_pioh = psc->sc_pioh.ioh; - sc->sc_memt = psc->sc_sramh.memt; - sc->sc_sramh = psc->sc_sramh.memh; - sc->sc_mmioh = psc->sc_mmioh.memh; - sc->sc_init_status = RSP_16; - sc->sc_memwinsz = TR_SRAM_SIZE; - sc->sc_memsize = TR_SRAM_SIZE; - sc->sc_memreserved = 0; - sc->sc_aca = TR_ACA_OFFSET; - sc->sc_maddr = TR_PCMCIA_SRAM_ADDR; - sc->sc_mediastatus = tr_pcmcia_mediastatus; - sc->sc_mediachange = tr_pcmcia_mediachange; - sc->sc_enable = tr_pcmcia_enable; - sc->sc_disable = tr_pcmcia_disable; - - tr_pcmcia_setup(sc); - if (tr_reset(sc) == 0) - (void)tr_attach(sc); - - pcmcia_function_disable(pa->pf); - sc->sc_enabled = 0; - return; - -fail6: - pcmcia_mem_free(psc->sc_pf, &psc->sc_mmioh); -fail5: - pcmcia_mem_unmap(psc->sc_pf, psc->sc_sram_window); -fail4: - pcmcia_mem_free(psc->sc_pf, &psc->sc_sramh); -fail3: - pcmcia_io_unmap(psc->sc_pf, psc->sc_pio_window); -fail2: - pcmcia_io_free(psc->sc_pf, &psc->sc_pioh); -fail1: - pcmcia_function_disable(pa->pf); - sc->sc_enabled = 0; -} - -static int -tr_pcmcia_enable(struct tr_softc *sc) -{ - struct tr_pcmcia_softc *psc = (struct tr_pcmcia_softc *) sc; - int ret; - - sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, tr_intr, psc); - if (sc->sc_ih == NULL) { - aprint_error_dev(psc->sc_tr.sc_dev, - "couldn't establish interrupt\n"); - return 1; - } - - ret = pcmcia_function_enable(psc->sc_pf); - if (ret != 0) - return ret; - - tr_pcmcia_setup(sc); - - if (tr_reset(sc)) - return 1; - if (tr_config(sc)) - return 1; - - return 0; -} - -static void -tr_pcmcia_disable(struct tr_softc *sc) -{ - struct tr_pcmcia_softc *psc = (struct tr_pcmcia_softc *) sc; - - pcmcia_function_disable(psc->sc_pf); - pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih); -} - -static int -tr_pcmcia_mediachange(struct tr_softc *sc) -{ - int setspeed = 0; - - if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_TOKEN) - return EINVAL; - - switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) { - case IFM_TOK_STP16: - case IFM_TOK_UTP16: - if ((sc->sc_init_status & RSP_16) == 0) - setspeed = 1; - break; - case IFM_TOK_STP4: - case IFM_TOK_UTP4: - if ((sc->sc_init_status & RSP_16) != 0) - setspeed = 1; - break; - } - if (setspeed != 0) { - tr_stop(sc); - if (sc->sc_enabled) - tr_pcmcia_disable(sc); - sc->sc_init_status ^= RSP_16; /* XXX 100 Mbit/s */ - if (sc->sc_enabled) - tr_pcmcia_enable(sc); - } - /* - * XXX Handle Early Token Release !!!! - */ - - return 0; -} - -/* - * XXX Copy of tropic_mediastatus() - */ -static void -tr_pcmcia_mediastatus(struct tr_softc *sc, struct ifmediareq *ifmr) -{ - struct ifmedia *ifm = &sc->sc_media; - - ifmr->ifm_active = ifm->ifm_cur->ifm_media; -} - -int -tr_pcmcia_detach(device_t self, int flags) -{ - struct tr_pcmcia_softc *psc = device_private(self); - int rv; - - rv = tr_detach(self, flags); - - if (rv == 0) { - pcmcia_mem_unmap(psc->sc_pf, psc->sc_mmio_window); - pcmcia_mem_free(psc->sc_pf, &psc->sc_mmioh); - pcmcia_mem_unmap(psc->sc_pf, psc->sc_sram_window); - pcmcia_mem_free(psc->sc_pf, &psc->sc_sramh); - pcmcia_io_unmap(psc->sc_pf, psc->sc_pio_window); - pcmcia_io_free(psc->sc_pf, &psc->sc_pioh); - } - - return rv; -} - -static void -tr_pcmcia_setup(struct tr_softc *sc) -{ - int s; - - bus_space_write_1(sc->sc_piot, sc->sc_pioh, 0, - (TR_PCMCIA_MMIO_ADDR >> 16) & 0x0f); - - bus_space_write_1(sc->sc_piot, sc->sc_pioh, 0, - 0x10 | ((TR_PCMCIA_MMIO_ADDR >> 12) & 0x0e)); - - /* XXX Magick */ - bus_space_write_1(sc->sc_piot, sc->sc_pioh, 0, 0x20 | 0x06); - - /* 0 << 2 for 8K, 1 << 2 for 16K, 2 << 2 for 32K, 3 << 2 for 64K */ - /* 0 << 1 for 4Mbit/s, 1 << 1 for 16Mbit/s */ - /* 0 for primary, 1 for alternate */ - s = sc->sc_init_status & RSP_16 ? (1 << 1) : (0 << 1); - bus_space_write_1(sc->sc_piot, sc->sc_pioh, 0, 0x30 | 0x04 | s); - - /* Release the card. */ - bus_space_write_1(sc->sc_piot, sc->sc_pioh, 0, 0x40); -} diff --git a/sys/net/Makefile b/sys/net/Makefile index a98aa937f0f5..b02caacb99f4 100644 --- a/sys/net/Makefile +++ b/sys/net/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.39 2020/01/19 06:55:21 thorpej Exp $ +# $NetBSD: Makefile,v 1.40 2020/01/19 20:00:36 thorpej Exp $ INCSDIR= /usr/include/net @@ -6,7 +6,7 @@ INCS= bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \ if_bridgevar.h if_dl.h if_ether.h if_fddi.h if_gif.h \ if_gre.h if_ieee1394.h if_ipsec.h if_llc.h if_media.h if_mpls.h \ if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \ - if_tap.h if_token.h if_tun.h if_types.h if_vlanvar.h net_stats.h \ + if_tap.h if_tun.h if_types.h if_vlanvar.h net_stats.h \ netisr.h pfil.h pfkeyv2.h pfvar.h ppp-comp.h ppp_defs.h radix.h \ raw_cb.h route.h slcompress.h slip.h zlib.h diff --git a/sys/net/files.net b/sys/net/files.net index babed6f48c58..0314d54e3768 100644 --- a/sys/net/files.net +++ b/sys/net/files.net @@ -1,4 +1,4 @@ -# $NetBSD: files.net,v 1.22 2020/01/19 06:55:21 thorpej Exp $ +# $NetBSD: files.net,v 1.23 2020/01/19 20:00:36 thorpej Exp $ # XXX CLEANUP define net @@ -12,7 +12,7 @@ file net/if.c net file net/if_arcsubr.c arcnet needs-flag file net/if_bridge.c bridge needs-flag file net/bridgestp.c bridge -file net/if_ethersubr.c ether | fddi | netatalk | token | +file net/if_ethersubr.c ether | fddi | netatalk | wlan needs-flag file net/if_faith.c faith & (inet | inet6) needs-flag file net/if_fddisubr.c fddi needs-flag @@ -30,7 +30,6 @@ file net/if_srt.c srt file net/if_stf.c stf & inet & inet6 needs-flag file net/if_sl.c sl needs-flag file net/if_spppsubr.c sppp -file net/if_tokensubr.c token needs-flag file net/if_tap.c tap file net/if_tun.c tun file net/if_vlan.c vlan needs-flag diff --git a/sys/net/if.c b/sys/net/if.c index 46e6fcb1556f..e623a666f96c 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.466 2019/12/17 04:54:36 christos Exp $ */ +/* $NetBSD: if.c,v 1.467 2020/01/19 20:00:36 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.466 2019/12/17 04:54:36 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.467 2020/01/19 20:00:36 thorpej Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -150,7 +150,6 @@ __KERNEL_RCSID(0, "$NetBSD: if.c,v 1.466 2019/12/17 04:54:36 christos Exp $"); #include "ether.h" #include "fddi.h" -#include "token.h" #include "bridge.h" #if NBRIDGE > 0 @@ -319,7 +318,7 @@ ifinit1(void) if_pfil = pfil_head_create(PFIL_TYPE_IFNET, NULL); KASSERT(if_pfil != NULL); -#if NETHER > 0 || NFDDI > 0 || defined(NETATALK) || NTOKEN > 0 || defined(WLAN) +#if NETHER > 0 || NFDDI > 0 || defined(NETATALK) || defined(WLAN) etherinit(); #endif } diff --git a/sys/net/if_token.h b/sys/net/if_token.h deleted file mode 100644 index 5706956073a6..000000000000 --- a/sys/net/if_token.h +++ /dev/null @@ -1,127 +0,0 @@ -/* $NetBSD: if_token.h,v 1.17 2015/12/16 05:44:59 ozaki-r Exp $ */ - -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_fddi.h,v 1.2 1995/08/19 04:35:28 cgd Exp - */ - -#ifndef _NET_IF_TOKEN_H_ -#define _NET_IF_TOKEN_H_ - -#define ISO88025_ADDR_LEN 6 - -/* Token Ring physical header */ -struct token_header { - uint8_t token_ac; /* access control field */ - uint8_t token_fc; /* frame control field */ - uint8_t token_dhost[ISO88025_ADDR_LEN]; /* dest. address */ - uint8_t token_shost[ISO88025_ADDR_LEN]; /* source address */ -} __packed; - -#define TOKEN_MAX_BRIDGE 8 - -/* Token Ring routing information field */ -struct token_rif { - uint16_t tr_rcf; /* route control field */ - uint16_t tr_rdf[TOKEN_MAX_BRIDGE]; /* route-designator fields */ -} __packed; - -/* standard values for address control and frame control field */ -#define TOKEN_AC 0x10 -#define TOKEN_FC 0x40 - -#define TOKEN_RI_PRESENT 0x80 /* routing info present bit */ -#define TOKEN_RCF_LEN_MASK 0x1f00 -#define TOKEN_RCF_BROADCAST_MASK 0xe000 -#define TOKEN_RCF_BROADCAST_ALL 0x8000 /* all routes broadcast */ -#define TOKEN_RCF_BROADCAST_SINGLE 0xc000 /* single route broadcast */ - -/* - * A Token-ring frame consists of - * header + rif + llcinfo + fcs - * 14 + 2 * (0 ... 9) + x + 4 octets - * where llcinfo contains the llcsnap header (8 octets) and the IP frame - */ - /* LLC INFO (802.5PD-2) */ -#define TOKEN_RCF_FRAME0 0x0000 /* 516 */ -#define TOKEN_RCF_FRAME1 0x0010 /* 1500 */ -#define TOKEN_RCF_FRAME2 0x0020 /* 2052 */ -#define TOKEN_RCF_FRAME3 0x0030 /* 4472 */ -#define TOKEN_RCF_FRAME4 0x0040 /* 8144 */ -#define TOKEN_RCF_FRAME5 0x0050 /* 11407 */ -#define TOKEN_RCF_FRAME6 0x0060 /* 17800 */ -#define TOKEN_RCF_FRAME7 0x0070 /* 65535 */ -#define TOKEN_RCF_FRAME_MASK 0x0070 - -#define TOKEN_RCF_DIRECTION 0x0080 - -/* - * According to RFC 1042 - */ -#define IPMTU_4MBIT_MAX 4464 -#define IPMTU_16MBIT_MAX 8188 - -/* - * RFC 1042: - * It is recommended that all implementations support IP packets - * of at least 2002 octets. - */ -#define ISO88025_MTU 2002 - -/* - * This assumes that route information fields are appended to token_header. - */ -#define TOKEN_RIF(x) ((struct token_rif *) ((x) + 1)) - -#define TOKEN_RIF_LLE(lle) ((struct token_rif *) (lle)->la_opaque) -#define TOKEN_RIF_LLE_ASSERT(lle) KASSERT((lle)->la_opaque != NULL) - -/* - * This is a kludge to get at the token ring mac header and the source route - * information after m_adj() has been used on the mbuf. - * Note that m is always an mbuf with a packet header. - */ -#define M_TRHSTART(m) \ - (ALIGN(((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf : &(m)->m_pktdat[0]) \ - + sizeof (struct token_header)) - sizeof(struct token_header)) - -#if defined(_KERNEL) -/* - * XXX we need if_ethersubr.c with all these defines - */ -#define tokenbroadcastaddr etherbroadcastaddr -#define token_ipmulticast_min ether_ipmulticast_min -#define token_ipmulticast_max ether_ipmulticast_max -#define token_sprintf ether_sprintf - -void token_ifattach(struct ifnet *, void *); -void token_ifdetach(struct ifnet *); -#endif - -#endif /* !_NET_IF_TOKEN_H_ */ diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c deleted file mode 100644 index 53013d01c7bc..000000000000 --- a/sys/net/if_tokensubr.c +++ /dev/null @@ -1,526 +0,0 @@ -/* $NetBSD: if_tokensubr.c,v 1.84 2019/02/05 06:17:03 msaitoh Exp $ */ - -/* - * Copyright (c) 1982, 1989, 1993 - * The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_fddisubr.c,v 1.2 1995/08/19 04:35:29 cgd Exp - */ - -/* - * Copyright (c) 1997-1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Onno van der Linden. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1995 - * Matt Thomas. 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. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: NetBSD: if_fddisubr.c,v 1.2 1995/08/19 04:35:29 cgd Exp - */ - -#include -__KERNEL_RCSID(0, "$NetBSD: if_tokensubr.c,v 1.84 2019/02/05 06:17:03 msaitoh Exp $"); - -#ifdef _KERNEL_OPT -#include "opt_inet.h" -#include "opt_atalk.h" -#include "opt_gateway.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#ifdef INET -#include -#include -#include -#endif - -#include "carp.h" -#if NCARP > 0 -#include -#endif - -#define senderr(e) { error = (e); goto bad;} - -#define RCF_ALLROUTES (2 << 8) | TOKEN_RCF_FRAME2 | TOKEN_RCF_BROADCAST_ALL -#define RCF_SINGLEROUTE (2 << 8) | TOKEN_RCF_FRAME2 | TOKEN_RCF_BROADCAST_SINGLE - -static int token_output(struct ifnet *, struct mbuf *, - const struct sockaddr *, const struct rtentry *); -static void token_input(struct ifnet *, struct mbuf *); - -/* - * Token Ring output routine. - * Encapsulate a packet of type family for the local net. - * Assumes that ifp is actually pointer to arphdr structure. - * XXX route info has to go into the same mbuf as the header - */ -static int -token_output(struct ifnet *ifp0, struct mbuf *m0, const struct sockaddr *dst, - const struct rtentry *rt) -{ - uint16_t etype; - int error = 0; - u_char edst[ISO88025_ADDR_LEN]; - struct mbuf *m = m0; - struct mbuf *mcopy = NULL; - struct token_header *trh; -#ifdef INET - struct arphdr *ah = (struct arphdr *)ifp0; -#endif /* INET */ - struct token_rif *rif = NULL; - struct token_rif bcastrif; - struct ifnet *ifp = ifp0; - size_t riflen = 0; - -#if NCARP > 0 - if (ifp->if_type == IFT_CARP) { - struct ifaddr *ifa; - - /* loop back if this is going to the carp interface */ - if (dst != NULL && ifp0->if_link_state == LINK_STATE_UP) { - int s = pserialize_read_enter(); - ifa = ifa_ifwithaddr(dst); - if (ifa != NULL && - ifa->ifa_ifp == ifp0) { - pserialize_read_exit(s); - return (looutput(ifp0, m, dst, rt)); - } - pserialize_read_exit(s); - } - - ifp = ifp->if_carpdev; - ah = (struct arphdr *)ifp; - - if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) != - (IFF_UP|IFF_RUNNING)) - senderr(ENETDOWN); - } -#endif /* NCARP > 0 */ - - if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) - senderr(ENETDOWN); - - /* - * If the queueing discipline needs packet classification, - * do it before prepending link headers. - */ - IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family); - - switch (dst->sa_family) { - -#ifdef INET - case AF_INET: - if (m->m_flags & M_BCAST) { - if (ifp->if_flags & IFF_LINK0) { - if (ifp->if_flags & IFF_LINK1) - bcastrif.tr_rcf = htons(RCF_ALLROUTES); - else - bcastrif.tr_rcf = htons(RCF_SINGLEROUTE); - rif = &bcastrif; - riflen = sizeof(rif->tr_rcf); - } - memcpy(edst, tokenbroadcastaddr, sizeof(edst)); - } -/* - * XXX m->m_flags & M_MCAST IEEE802_MAP_IP_MULTICAST ?? - */ - else { - struct llentry *la; - - error = arpresolve(ifp, rt, m, dst, edst, sizeof(edst)); - if (error != 0) - return error == EWOULDBLOCK ? 0 : error; - - la = rt->rt_llinfo; - KASSERT(la != NULL); - TOKEN_RIF_LLE_ASSERT(la); - rif = TOKEN_RIF_LLE(la); - riflen = (ntohs(rif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8; - } - /* If broadcasting on a simplex interface, loopback a copy. */ - if ((m->m_flags & M_BCAST) && (ifp->if_flags & IFF_SIMPLEX)) - mcopy = m_copypacket(m, M_DONTWAIT); - etype = htons(ETHERTYPE_IP); - break; - case AF_ARP: -/* - * XXX source routing, assume m->m_data contains the useful stuff - */ - ah = mtod(m, struct arphdr *); - ah->ar_hrd = htons(ARPHRD_IEEE802); - - switch (ntohs(ah->ar_op)) { - case ARPOP_REVREQUEST: - case ARPOP_REVREPLY: - etype = htons(ETHERTYPE_REVARP); - break; - - case ARPOP_REQUEST: - case ARPOP_REPLY: - default: - etype = htons(ETHERTYPE_ARP); - } - - if (m->m_flags & M_BCAST) { - if (ifp->if_flags & IFF_LINK0) { - if (ifp->if_flags & IFF_LINK1) - bcastrif.tr_rcf = htons(RCF_ALLROUTES); - else - bcastrif.tr_rcf = htons(RCF_SINGLEROUTE); - rif = &bcastrif; - riflen = sizeof(rif->tr_rcf); - } - memcpy(edst, tokenbroadcastaddr, sizeof(edst)); - } - else { - void *tha = ar_tha(ah); - if (tha == NULL) { - m_freem(m); - return 0; - } - memcpy(edst, tha, sizeof(edst)); - trh = (struct token_header *)M_TRHSTART(m); - trh->token_ac = TOKEN_AC; - trh->token_fc = TOKEN_FC; - if (trh->token_shost[0] & TOKEN_RI_PRESENT) { - struct token_rif *trrif; - - trrif = TOKEN_RIF(trh); - riflen = (ntohs(trrif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8; - } - memcpy((void *)trh->token_dhost, (void *)edst, - sizeof (edst)); - memcpy((void *)trh->token_shost, CLLADDR(ifp->if_sadl), - sizeof(trh->token_shost)); - if (riflen != 0) - trh->token_shost[0] |= TOKEN_RI_PRESENT; -/* - * compare (m->m_data - m->m_pktdat) with (sizeof(struct token_header) + riflen + ... - */ - m->m_len += (sizeof(*trh) + riflen + LLC_SNAPFRAMELEN); - m->m_data -= (sizeof(*trh) + riflen + LLC_SNAPFRAMELEN); - m->m_pkthdr.len += (sizeof(*trh) + riflen + LLC_SNAPFRAMELEN); - goto send; - } - break; -#endif - - case AF_UNSPEC: - { - const struct ether_header *eh; - eh = (const struct ether_header *)dst->sa_data; - memcpy(edst, eh->ether_dhost, sizeof(edst)); - if (*edst & 1) - m->m_flags |= (M_BCAST|M_MCAST); - etype = eh->ether_type; - if (m->m_flags & M_BCAST) { - if (ifp->if_flags & IFF_LINK0) { - if (ifp->if_flags & IFF_LINK1) - bcastrif.tr_rcf = htons(RCF_ALLROUTES); - else - bcastrif.tr_rcf = htons(RCF_SINGLEROUTE); - rif = &bcastrif; - riflen = sizeof(bcastrif.tr_rcf); - } - } - break; - } - - default: - printf("%s: can't handle af%d\n", ifp->if_xname, - dst->sa_family); - senderr(EAFNOSUPPORT); - } - - - if (mcopy) - (void) looutput(ifp, mcopy, dst, rt); - if (etype != 0) { - struct llc *l; - M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - l = mtod(m, struct llc *); - l->llc_control = LLC_UI; - l->llc_dsap = l->llc_ssap = LLC_SNAP_LSAP; - l->llc_snap.org_code[0] = l->llc_snap.org_code[1] = - l->llc_snap.org_code[2] = 0; - memcpy((void *) &l->llc_snap.ether_type, (void *) &etype, - sizeof(uint16_t)); - } - - /* - * Add local net header. If no space in first mbuf, - * allocate another. - */ - - M_PREPEND(m, (riflen + sizeof (*trh)), M_DONTWAIT); - if (m == 0) - senderr(ENOBUFS); - trh = mtod(m, struct token_header *); - trh->token_ac = TOKEN_AC; - trh->token_fc = TOKEN_FC; - memcpy((void *)trh->token_dhost, (void *)edst, sizeof (edst)); - memcpy((void *)trh->token_shost, CLLADDR(ifp->if_sadl), - sizeof(trh->token_shost)); - - if (riflen != 0) { - struct token_rif *trrif; - - trh->token_shost[0] |= TOKEN_RI_PRESENT; - trrif = TOKEN_RIF(trh); - memcpy(trrif, rif, riflen); - } -#ifdef INET -send: -#endif - -#if NCARP > 0 - if (ifp0 != ifp && ifp0->if_type == IFT_CARP) { - memcpy((void *)trh->token_shost, CLLADDR(ifp0->if_sadl), - sizeof(trh->token_shost)); - } -#endif /* NCARP > 0 */ - - return ifq_enqueue(ifp, m); -bad: - if (m) - m_freem(m); - return (error); -} - -/* - * Process a received token ring packet; - * the packet is in the mbuf chain m with - * the token ring header. - */ -static void -token_input(struct ifnet *ifp, struct mbuf *m) -{ - pktqueue_t *pktq = NULL; - struct ifqueue *inq = NULL; - struct llc *l; - struct token_header *trh; - int lan_hdr_len; - int isr = 0; - - if ((ifp->if_flags & IFF_UP) == 0) { - m_freem(m); - return; - } - - trh = mtod(m, struct token_header *); - - ifp->if_ibytes += m->m_pkthdr.len; - if (memcmp(tokenbroadcastaddr, trh->token_dhost, - sizeof(tokenbroadcastaddr)) == 0) - m->m_flags |= M_BCAST; - else if (trh->token_dhost[0] & 1) - m->m_flags |= M_MCAST; - if (m->m_flags & (M_BCAST|M_MCAST)) - ifp->if_imcasts++; - - /* Skip past the Token Ring header and RIF. */ - lan_hdr_len = sizeof(struct token_header); - if (trh->token_shost[0] & TOKEN_RI_PRESENT) { - struct token_rif *trrif; - - trrif = TOKEN_RIF(trh); - lan_hdr_len += (ntohs(trrif->tr_rcf) & TOKEN_RCF_LEN_MASK) >> 8; - } - - l = (struct llc *)(mtod(m, uint8_t *) + lan_hdr_len); - - switch (l->llc_dsap) { -#if defined(INET) - case LLC_SNAP_LSAP: - { - uint16_t etype; - if (l->llc_control != LLC_UI || l->llc_ssap != LLC_SNAP_LSAP) - goto dropanyway; - if (l->llc_snap.org_code[0] != 0 || - l->llc_snap.org_code[1] != 0 || - l->llc_snap.org_code[2] != 0) - goto dropanyway; - etype = ntohs(l->llc_snap.ether_type); - m_adj(m, lan_hdr_len + LLC_SNAPFRAMELEN); -#if NCARP > 0 - if (ifp->if_carp && ifp->if_type != IFT_CARP && - (carp_input(m, (uint8_t *)&trh->token_shost, - (uint8_t *)&trh->token_dhost, l->llc_snap.ether_type) == 0)) - return; -#endif /* NCARP > 0 */ - - switch (etype) { -#ifdef INET - case ETHERTYPE_IP: - pktq = ip_pktq; - break; - - case ETHERTYPE_ARP: - isr = NETISR_ARP; - inq = &arpintrq; - break; -#endif - default: - /* - printf("token_input: unknown protocol 0x%x\n", etype); - */ - ifp->if_noproto++; - goto dropanyway; - } - break; - } -#endif /* INET */ - - default: - /* printf("token_input: unknown dsap 0x%x\n", l->llc_dsap); */ - ifp->if_noproto++; -#if defined(INET) - dropanyway: -#endif - m_freem(m); - return; - } - - if (__predict_true(pktq)) { - if (__predict_false(!pktq_enqueue(pktq, m, 0))) { - m_freem(m); - } - return; - } - - IFQ_LOCK(inq); - if (IF_QFULL(inq)) { - IF_DROP(inq); - IFQ_UNLOCK(inq); - m_freem(m); - } else { - IF_ENQUEUE(inq, m); - IFQ_UNLOCK(inq); - schednetisr(isr); - } -} - -/* - * Perform common duties while attaching to interface list - */ -void -token_ifattach(struct ifnet *ifp, void *lla) -{ - - ifp->if_type = IFT_ISO88025; - ifp->if_hdrlen = 14; - ifp->if_dlt = DLT_IEEE802; - ifp->if_mtu = ISO88025_MTU; - ifp->if_output = token_output; - ifp->_if_input = token_input; - ifp->if_broadcastaddr = tokenbroadcastaddr; - - if_set_sadl(ifp, lla, ISO88025_ADDR_LEN, true); - - bpf_attach(ifp, DLT_IEEE802, sizeof(struct token_header)); -} - -void -token_ifdetach(struct ifnet *ifp) -{ - - bpf_detach(ifp); -} diff --git a/sys/netinet/if_arp.c b/sys/netinet/if_arp.c index aac194b6609b..18bf9fce5fdb 100644 --- a/sys/netinet/if_arp.c +++ b/sys/netinet/if_arp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_arp.c,v 1.289 2019/10/11 13:32:46 roy Exp $ */ +/* $NetBSD: if_arp.c,v 1.290 2020/01/19 20:00:37 thorpej Exp $ */ /* * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.289 2019/10/11 13:32:46 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.290 2020/01/19 20:00:37 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -105,7 +105,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.289 2019/10/11 13:32:46 roy Exp $"); #include #include #include -#include #include #include #include @@ -126,7 +125,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.289 2019/10/11 13:32:46 roy Exp $"); #if NFDDI > 0 #include #endif -#include "token.h" #include "carp.h" #if NCARP > 0 #include @@ -180,9 +178,6 @@ static void arp_dad_stop(struct ifaddr *); static void arp_dad_duplicated(struct ifaddr *, const struct sockaddr_dl *); static void arp_init_llentry(struct ifnet *, struct llentry *); -#if NTOKEN > 0 -static void arp_free_llentry_tokenring(struct llentry *); -#endif struct ifqueue arpintrq = { .ifq_head = NULL, @@ -408,25 +403,12 @@ arp_init_llentry(struct ifnet *ifp, struct llentry *lle) { switch (ifp->if_type) { -#if NTOKEN > 0 - case IFT_ISO88025: - lle->la_opaque = kmem_intr_alloc(sizeof(struct token_rif), - KM_NOSLEEP); - lle->lle_ll_free = arp_free_llentry_tokenring; + default: + /* Nothing. */ break; -#endif } } -#if NTOKEN > 0 -static void -arp_free_llentry_tokenring(struct llentry *lle) -{ - - kmem_intr_free(lle->la_opaque, sizeof(struct token_rif)); -} -#endif - /* * Parallel to llc_rtrequest. */ @@ -1237,34 +1219,6 @@ in_arpinput(struct mbuf *m) KASSERT(ifp->if_sadl->sdl_alen == ifp->if_addrlen); -#if NTOKEN > 0 - /* - * XXX uses m_data and assumes the complete answer including - * XXX token-ring headers is in the same buf - */ - if (ifp->if_type == IFT_ISO88025) { - struct token_header *trh; - - trh = (struct token_header *)M_TRHSTART(m); - if (trh->token_shost[0] & TOKEN_RI_PRESENT) { - struct token_rif *rif; - size_t riflen; - - rif = TOKEN_RIF(trh); - riflen = (ntohs(rif->tr_rcf) & - TOKEN_RCF_LEN_MASK) >> 8; - - if (riflen > 2 && - riflen < sizeof(struct token_rif) && - (riflen & 1) == 0) { - rif->tr_rcf ^= htons(TOKEN_RCF_DIRECTION); - rif->tr_rcf &= htons(~TOKEN_RCF_BROADCAST_MASK); - memcpy(TOKEN_RIF_LLE(la), rif, riflen); - } - } - } -#endif - KASSERT(sizeof(la->ll_addr) >= ifp->if_addrlen); memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen); la->la_flags |= LLE_VALID; diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index aba393f9632d..6463117543a4 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_carp.c,v 1.105 2020/01/16 12:56:40 kardel Exp $ */ +/* $NetBSD: ip_carp.c,v 1.106 2020/01/19 20:00:37 thorpej Exp $ */ /* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */ /* @@ -33,7 +33,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.105 2020/01/16 12:56:40 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.106 2020/01/19 20:00:37 thorpej Exp $"); /* * TODO: @@ -77,9 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.105 2020/01/16 12:56:40 kardel Exp $") #if NFDDI > 0 #include #endif -#if NTOKEN > 0 -#include -#endif #ifdef INET #include