From 35c0325946946ac7b2b98a2a34d1de8a67e48d21 Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 24 Apr 2017 21:21:49 +0000 Subject: [PATCH] Remove the NATM framework including the en(4), fatm(4), hatm(4), and patm(4) devices. Maintaining an address family and framework has real costs when we make infrastructure improvements. In the case of NATM we support no devices manufactured in the last 20 years and some will not even work in modern motherboards (some newer devices that patm(4) could be updated to support apparently exist, but we do not currently have support). With this change, support remains for some netgraph modules that don't require NATM support code. It is unclear if all these should remain, though ng_atmllc certainly stands alone. Note well: FreeBSD 11 supports NATM and will continue to do so until at least September 30, 2021. Improvements to the code in FreeBSD 11 are certainly welcome. Reviewed by: philip Approved by: harti --- ObsoleteFiles.inc | 38 + etc/mtree/BSD.usr.dist | 2 - include/Makefile | 4 +- lib/libc/net/getnameinfo.c | 1 - rescue/rescue/Makefile | 4 - sbin/Makefile | 1 - sbin/atm/Makefile | 28 - sbin/atm/Makefile.inc | 26 - sbin/atm/atmconfig/Makefile | 44 - sbin/atm/atmconfig/Makefile.depend | 22 - sbin/atm/atmconfig/atm_oid.list | 20 - sbin/atm/atmconfig/atmconfig.8 | 323 - sbin/atm/atmconfig/atmconfig.h | 102 - sbin/atm/atmconfig/atmconfig.help | 223 - sbin/atm/atmconfig/atmconfig_device.c | 444 - sbin/atm/atmconfig/atmconfig_device.h | 75 - sbin/atm/atmconfig/atmconfig_device.help | 62 - sbin/atm/atmconfig/diag.c | 1122 -- sbin/atm/atmconfig/diag.h | 49 - sbin/atm/atmconfig/main.c | 880 -- sbin/atm/atmconfig/natm.c | 680 -- sbin/atm/atmconfig/private.h | 62 - share/man/man4/Makefile | 12 - share/man/man4/en.4 | 78 - share/man/man4/fatm.4 | 115 - share/man/man4/hatm.4 | 282 - share/man/man4/natm.4 | 102 - share/man/man4/natmip.4 | 248 - share/man/man4/ng_atm.4 | 406 - share/man/man4/patm.4 | 192 - share/man/man4/utopia.4 | 196 - sys/boot/forth/loader.conf | 5 - sys/conf/NOTES | 37 +- sys/conf/config.mk | 4 +- sys/conf/files | 24 - sys/conf/options | 4 - sys/dev/en/if_en_pci.c | 496 - sys/dev/en/midway.c | 3367 ------ sys/dev/en/midwayreg.h | 282 - sys/dev/en/midwayvar.h | 240 - sys/dev/fatm/firmware.h | 2393 ----- sys/dev/fatm/if_fatm.c | 3091 ------ sys/dev/fatm/if_fatm_rate.h | 294 - sys/dev/fatm/if_fatmreg.h | 499 - sys/dev/fatm/if_fatmvar.h | 395 - sys/dev/hatm/if_hatm.c | 2419 ----- sys/dev/hatm/if_hatm_intr.c | 731 -- sys/dev/hatm/if_hatm_ioctl.c | 385 - sys/dev/hatm/if_hatm_rx.c | 331 - sys/dev/hatm/if_hatm_tx.c | 827 -- sys/dev/hatm/if_hatmconf.h | 104 - sys/dev/hatm/if_hatmreg.h | 641 -- sys/dev/hatm/if_hatmvar.h | 640 -- sys/dev/patm/genrtab/Makefile | 12 - sys/dev/patm/genrtab/genrtab.c | 458 - sys/dev/patm/idt77252reg.h | 476 - sys/dev/patm/if_patm.c | 512 - sys/dev/patm/if_patm_attach.c | 1076 -- sys/dev/patm/if_patm_intr.c | 554 - sys/dev/patm/if_patm_ioctl.c | 412 - sys/dev/patm/if_patm_rtables.c | 9079 ----------------- sys/dev/patm/if_patm_rx.c | 526 - sys/dev/patm/if_patm_tx.c | 1277 --- sys/dev/patm/if_patmvar.h | 520 - sys/dev/utopia/idtphy.c | 494 - sys/dev/utopia/idtphy.h | 761 -- sys/dev/utopia/suni.c | 545 - sys/dev/utopia/suni.h | 1515 --- sys/dev/utopia/utopia.c | 675 -- sys/dev/utopia/utopia.h | 203 - sys/dev/utopia/utopia_priv.h | 46 - sys/modules/Makefile | 6 - sys/modules/en/Makefile | 11 - sys/modules/fatm/Makefile | 12 - sys/modules/hatm/Makefile | 14 - sys/modules/netgraph/atm/Makefile | 1 - sys/modules/netgraph/atm/atm/Makefile | 11 - sys/modules/patm/Makefile | 15 - sys/modules/utopia/Makefile | 8 - sys/net/if_atm.h | 337 - sys/net/if_atmsubr.c | 504 - sys/net/netisr.h | 1 - sys/netgraph/atm/ng_atm.c | 1448 --- sys/netgraph/atm/ng_atm.h | 248 - sys/netgraph/ng_atmllc.c | 13 +- sys/netinet/if_atm.c | 372 - sys/netinet/if_atm.h | 47 - sys/netnatm/natm.c | 490 - sys/netnatm/natm.h | 120 - sys/netnatm/natm_pcb.c | 167 - sys/netnatm/natm_proto.c | 116 - sys/sys/param.h | 2 +- usr.sbin/bsnmpd/modules/Makefile | 6 +- .../snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt | 101 - usr.sbin/bsnmpd/modules/snmp_atm/Makefile | 21 - .../bsnmpd/modules/snmp_atm/Makefile.depend | 22 - .../bsnmpd/modules/snmp_atm/atm_freebsd.def | 56 - usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c | 301 - usr.sbin/ppp/Makefile | 10 - usr.sbin/ppp/atm.c | 237 - usr.sbin/ppp/atm.h | 35 - usr.sbin/ppp/physical.c | 7 - 102 files changed, 56 insertions(+), 46876 deletions(-) delete mode 100644 sbin/atm/Makefile delete mode 100644 sbin/atm/Makefile.inc delete mode 100644 sbin/atm/atmconfig/Makefile delete mode 100644 sbin/atm/atmconfig/Makefile.depend delete mode 100644 sbin/atm/atmconfig/atm_oid.list delete mode 100644 sbin/atm/atmconfig/atmconfig.8 delete mode 100644 sbin/atm/atmconfig/atmconfig.h delete mode 100644 sbin/atm/atmconfig/atmconfig.help delete mode 100644 sbin/atm/atmconfig/atmconfig_device.c delete mode 100644 sbin/atm/atmconfig/atmconfig_device.h delete mode 100644 sbin/atm/atmconfig/atmconfig_device.help delete mode 100644 sbin/atm/atmconfig/diag.c delete mode 100644 sbin/atm/atmconfig/diag.h delete mode 100644 sbin/atm/atmconfig/main.c delete mode 100644 sbin/atm/atmconfig/natm.c delete mode 100644 sbin/atm/atmconfig/private.h delete mode 100644 share/man/man4/en.4 delete mode 100644 share/man/man4/fatm.4 delete mode 100644 share/man/man4/hatm.4 delete mode 100644 share/man/man4/natm.4 delete mode 100644 share/man/man4/natmip.4 delete mode 100644 share/man/man4/ng_atm.4 delete mode 100644 share/man/man4/patm.4 delete mode 100644 share/man/man4/utopia.4 delete mode 100644 sys/dev/en/if_en_pci.c delete mode 100644 sys/dev/en/midway.c delete mode 100644 sys/dev/en/midwayreg.h delete mode 100644 sys/dev/en/midwayvar.h delete mode 100644 sys/dev/fatm/firmware.h delete mode 100644 sys/dev/fatm/if_fatm.c delete mode 100644 sys/dev/fatm/if_fatm_rate.h delete mode 100644 sys/dev/fatm/if_fatmreg.h delete mode 100644 sys/dev/fatm/if_fatmvar.h delete mode 100644 sys/dev/hatm/if_hatm.c delete mode 100644 sys/dev/hatm/if_hatm_intr.c delete mode 100644 sys/dev/hatm/if_hatm_ioctl.c delete mode 100644 sys/dev/hatm/if_hatm_rx.c delete mode 100644 sys/dev/hatm/if_hatm_tx.c delete mode 100644 sys/dev/hatm/if_hatmconf.h delete mode 100644 sys/dev/hatm/if_hatmreg.h delete mode 100644 sys/dev/hatm/if_hatmvar.h delete mode 100644 sys/dev/patm/genrtab/Makefile delete mode 100644 sys/dev/patm/genrtab/genrtab.c delete mode 100644 sys/dev/patm/idt77252reg.h delete mode 100644 sys/dev/patm/if_patm.c delete mode 100644 sys/dev/patm/if_patm_attach.c delete mode 100644 sys/dev/patm/if_patm_intr.c delete mode 100644 sys/dev/patm/if_patm_ioctl.c delete mode 100644 sys/dev/patm/if_patm_rtables.c delete mode 100644 sys/dev/patm/if_patm_rx.c delete mode 100644 sys/dev/patm/if_patm_tx.c delete mode 100644 sys/dev/patm/if_patmvar.h delete mode 100644 sys/dev/utopia/idtphy.c delete mode 100644 sys/dev/utopia/idtphy.h delete mode 100644 sys/dev/utopia/suni.c delete mode 100644 sys/dev/utopia/suni.h delete mode 100644 sys/dev/utopia/utopia.c delete mode 100644 sys/dev/utopia/utopia.h delete mode 100644 sys/dev/utopia/utopia_priv.h delete mode 100644 sys/modules/en/Makefile delete mode 100644 sys/modules/fatm/Makefile delete mode 100644 sys/modules/hatm/Makefile delete mode 100644 sys/modules/netgraph/atm/atm/Makefile delete mode 100644 sys/modules/patm/Makefile delete mode 100644 sys/modules/utopia/Makefile delete mode 100644 sys/net/if_atm.h delete mode 100644 sys/net/if_atmsubr.c delete mode 100644 sys/netgraph/atm/ng_atm.c delete mode 100644 sys/netgraph/atm/ng_atm.h delete mode 100644 sys/netinet/if_atm.c delete mode 100644 sys/netinet/if_atm.h delete mode 100644 sys/netnatm/natm.c delete mode 100644 sys/netnatm/natm.h delete mode 100644 sys/netnatm/natm_pcb.c delete mode 100644 sys/netnatm/natm_proto.c delete mode 100644 usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt delete mode 100644 usr.sbin/bsnmpd/modules/snmp_atm/Makefile delete mode 100644 usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend delete mode 100644 usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def delete mode 100644 usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c delete mode 100644 usr.sbin/ppp/atm.c delete mode 100644 usr.sbin/ppp/atm.h diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 958a54fc1688..af5c27a6f277 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,44 @@ # xargs -n1 | sort | uniq -d; # done +# 20170424: NATM support removed +OLD_FILES+=rescue/atmconfig +OLD_FILES+=sbin/atmconfig +OLD_FILES+=usr/include/bsnmp/snmp_atm.h +OLD_FILES+=usr/include/dev/utopia/idtphy.h +OLD_FILES+=usr/include/dev/utopia/suni.h +OLD_FILES+=usr/include/dev/utopia/utopia.h +OLD_FILES+=usr/include/dev/utopia/utopia_priv.h +OLD_DIRS+=usr/include/dev/utopia +OLD_FILES+=usr/include/net/if_atm.h +OLD_FILES+=usr/include/netgraph/atm/ng_atm.h +OLD_FILES+=usr/include/netinet/if_atm.h +OLD_FILES+=usr/include/netnatm/natm.h +OLD_FILES+=usr/lib/debug/sbin/atmconfig.debug +OLD_FILES+=usr/lib/debug/usr/lib/snmp_atm.so.6.debug +OLD_FILES+=usr/lib/snmp_atm.so +OLD_FILES+=usr/lib/snmp_atm.so.6 +OLD_FILES+=usr/share/doc/atm/atmconfig.help +OLD_FILES+=usr/share/doc/atm/atmconfig_device.help +OLD_DIRS+=usr/share/doc/atm +OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz +OLD_FILES+=usr/share/man/man4/en.4.gz +OLD_FILES+=usr/share/man/man4/fatm.4.gz +OLD_FILES+=usr/share/man/man4/hatm.4.gz +OLD_FILES+=usr/share/man/man4/if_en.4.gz +OLD_FILES+=usr/share/man/man4/if_fatm.4.gz +OLD_FILES+=usr/share/man/man4/if_hatm.4.gz +OLD_FILES+=usr/share/man/man4/if_patm.4.gz +OLD_FILES+=usr/share/man/man4/natm.4.gz +OLD_FILES+=usr/share/man/man4/natmip.4.gz +OLD_FILES+=usr/share/man/man4/ng_atm.4.gz +OLD_FILES+=usr/share/man/man4/patm.4.gz +OLD_FILES+=usr/share/man/man4/utopia.4.gz +OLD_FILES+=usr/share/man/man8/atmconfig.8.gz +OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def +OLD_FILES+=usr/share/snmp/defs/atm_tree.def +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM-FREEBSD-MIB.txt +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM.txt # 20170420: remove GNU diff OLD_FILES+=usr/share/man/man7/diff.7.gz # 20170322: rename to _test to match the FreeBSD test suite name scheme diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 76ea9e792406..b1fd5b5ea392 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -189,8 +189,6 @@ .. atf .. - atm - .. legal .. llvm diff --git a/include/Makefile b/include/Makefile index e8ad0030a7c7..b4d7904cdaf5 100644 --- a/include/Makefile +++ b/include/Makefile @@ -40,14 +40,14 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ syslog.h ucontext.h LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ - netipsec netnatm netsmb nfs nfsclient nfsserver sys vm + netipsec netsmb nfs nfsclient nfsserver sys vm LSUBDIRS= cam/ata cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ - dev/speaker dev/utopia dev/vkbd dev/wi \ + dev/speaker dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c index 54f232449fc2..89cf825ea013 100644 --- a/lib/libc/net/getnameinfo.c +++ b/lib/libc/net/getnameinfo.c @@ -455,7 +455,6 @@ getnameinfo_link(const struct afd *afd, host, hostlen); /* * The following have zero-length addresses. - * IFT_ATM (net/if_atmsubr.c) * IFT_GIF (net/if_gif.c) * IFT_LOOP (net/if_loop.c) * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c) diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 454dfcdfef67..56285f72c927 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -101,10 +101,6 @@ CRUNCH_PROGS_sbin= badsect \ restore rcorder route savecore \ shutdown spppcontrol swapon sysctl tunefs umount -.if ${MK_ATM} != "no" -CRUNCH_PROGS_sbin+= atmconfig -.endif - .if ${MK_CCD} != "no" CRUNCH_PROGS_sbin+= ccdconfig .endif diff --git a/sbin/Makefile b/sbin/Makefile index 39e417acbacf..51e80bae8001 100644 --- a/sbin/Makefile +++ b/sbin/Makefile @@ -70,7 +70,6 @@ SUBDIR=adjkerntz \ tunefs \ umount -SUBDIR.${MK_ATM}+= atm SUBDIR.${MK_CCD}+= ccdconfig SUBDIR.${MK_CXX}+= devd SUBDIR.${MK_HAST}+= hastctl diff --git a/sbin/atm/Makefile b/sbin/atm/Makefile deleted file mode 100644 index 4145d219e635..000000000000 --- a/sbin/atm/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# =================================== -# HARP | Host ATM Research Platform -# =================================== -# -# This Host ATM Research Platform ("HARP") file (the "Software") is -# made available by Network Computing Services, Inc. ("NetworkCS") -# "AS IS". NetworkCS does not provide maintenance, improvements or -# support of any kind. -# -# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED, -# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE -# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE. -# In no event shall NetworkCS be responsible for any damages, including -# but not limited to consequential damages, arising from or relating to -# any use of the Software or related support. -# -# Copyright 1994-1998 Network Computing Services, Inc. -# -# Copies of this Software may be made, however, the above copyright -# notice must be reproduced on all copies. -# -# @(#) $Id: Makefile,v 1.5 1998/07/10 16:01:58 jpt Exp $ -# $FreeBSD$ - -SUBDIR= atmconfig - -.include diff --git a/sbin/atm/Makefile.inc b/sbin/atm/Makefile.inc deleted file mode 100644 index 3d5738afdbc4..000000000000 --- a/sbin/atm/Makefile.inc +++ /dev/null @@ -1,26 +0,0 @@ -# =================================== -# HARP | Host ATM Research Platform -# =================================== -# -# This Host ATM Research Platform ("HARP") file (the "Software") is -# made available by Network Computing Services, Inc. ("NetworkCS") -# "AS IS". NetworkCS does not provide maintenance, improvements or -# support of any kind. -# -# NETWORKCS MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED, -# INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE, AS TO ANY ELEMENT OF THE -# SOFTWARE OR ANY SUPPORT PROVIDED IN CONNECTION WITH THIS SOFTWARE. -# In no event shall NetworkCS be responsible for any damages, including -# but not limited to consequential damages, arising from or relating to -# any use of the Software or related support. -# -# Copyright 1994-1998 Network Computing Services, Inc. -# -# Copies of this Software may be made, however, the above copyright -# notice must be reproduced on all copies. -# -# @(#) $Id: Makefile.inc,v 1.5 1998/07/10 16:01:58 jpt Exp $ -# $FreeBSD$ - -.include "../Makefile.inc" diff --git a/sbin/atm/atmconfig/Makefile b/sbin/atm/atmconfig/Makefile deleted file mode 100644 index 9e8196f76465..000000000000 --- a/sbin/atm/atmconfig/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2001-2003 -# Fraunhofer Institute for Open Communication Systems (FhG Fokus). -# All rights reserved. -# Author: Harti Brandt -# -# $FreeBSD$ - -.include - -PACKAGE=atm -PROG= atmconfig -SRCS= main.c diag.c natm.c -MAN= atmconfig.8 -# CFLAGS+= -DPATH_HELP='".:${SHAREDIR}/doc/atm:/usr/local/share/doc/atm"' - -CFLAGS+= -I${.OBJDIR} - -.if !defined(RESCUE) && ${MK_BSNMP} != "no" -CFLAGS+= -DWITH_BSNMP -SRCS+= oid.h atmconfig_device.c -LIBADD+= bsnmp -. if ${MK_DYNAMICROOT} == "no" && ${MK_OPENSSL} != "no" -LIBADD+= crypto -. endif -.endif - -CLEANFILES+= oid.h - -# XXX - this is verboten -.if ${MACHINE_CPUARCH} == "arm" -WARNS?= 3 -.endif - -FILES= atmconfig.help atmconfig_device.help -FILESDIR= ${SHAREDIR}/doc/atm - -SNMP_ATM_DEF= ${SRCTOP}/contrib/ngatm/snmp_atm/atm_tree.def \ - ${SRCTOP}/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def - -oid.h: atm_oid.list ${SNMP_ATM_DEF} - cat ${SNMP_ATM_DEF} | gensnmptree -e `tail -n +2 ${.CURDIR}/atm_oid.list` \ - > ${.TARGET} - -.include diff --git a/sbin/atm/atmconfig/Makefile.depend b/sbin/atm/atmconfig/Makefile.depend deleted file mode 100644 index 6c9b39660895..000000000000 --- a/sbin/atm/atmconfig/Makefile.depend +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - gnu/lib/libgcc \ - include \ - include/arpa \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libbsnmp/libbsnmp \ - lib/libc \ - lib/libcompiler_rt \ - lib/libnetgraph \ - secure/lib/libcrypto \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sbin/atm/atmconfig/atm_oid.list b/sbin/atm/atmconfig/atm_oid.list deleted file mode 100644 index ca64afa44267..000000000000 --- a/sbin/atm/atmconfig/atm_oid.list +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ -begemotAtmIfTable -begemotAtmIfName -begemotAtmIfNodeId -begemotAtmIfPcr -begemotAtmIfMedia -begemotAtmIfVpiBits -begemotAtmIfVciBits -begemotAtmIfMaxVpcs -begemotAtmIfMaxVccs -begemotAtmIfEsi -begemotAtmIfCarrierStatus -begemotAtmIfMode -begemotAtmIfTableLastChange -begemotAtmHWTable -begemotAtmHWVendor -begemotAtmHWDevice -begemotAtmHWSerial -begemotAtmHWVersion -begemotAtmHWSoftVersion diff --git a/sbin/atm/atmconfig/atmconfig.8 b/sbin/atm/atmconfig/atmconfig.8 deleted file mode 100644 index 0cb04e86120f..000000000000 --- a/sbin/atm/atmconfig/atmconfig.8 +++ /dev/null @@ -1,323 +0,0 @@ -.\" -.\" Copyright (c) 2001-2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.Dd October 5, 2016 -.Dt ATMCONFIG 8 -.Os -.Sh NAME -.Nm atmconfig -.Nd "ATM configuration tool" -.Sh SYNOPSIS -.Nm -.Op Fl htv -.Op Ar command Op Ar sub-command Op ... -.Op Ar options -.Op Ar arg ... -.Sh DESCRIPTION -The -.Nm -tool is used to configure the Netgraph ATM network sub-system. -.Pp -The command line of -.Nm -generally consists of common options followed by a command string, optionally -followed by sub-command strings, optional command specific options and -command specific arguments. -Commands and sub-commands as well as command -specific options may be abbreviated as -long as there is only one match possible. -.Ss Common Options -The following common options change the overall behaviour of -.Nm : -.Bl -tag -width indent -.It Fl h -Print a very short usage info and exit. -.It Fl t -Several show-type commands output a header and then several lines -of information. -If this option is given, the header is omitted, simplifying the parsing -of the output. -.It Fl v -Be more verbose. -.El -.Ss Obtaining Help -The -.Ic help -command has a number of useful sub-commands. -.Pp -To get general help use: -.D1 Nm Ic help -.Pp -To get a list of available commands use: -.D1 Nm Ic help Cm commands -.Pp -To get a list of available sub-commands use: -.D1 Nm Ic help Ar command -.Pp -or (if there are deeper levels of sub-commands): -.D1 Nm Ic help Ar command sub-command ... -.Pp -To get a list of options and arguments for a command use: -.D1 Nm Ic help Ar command sub-command ... -(given that there are no further sub-command levels). -.Pp -To get a list of common options use: -.D1 Nm Ic help Cm options -.Ss The Ic diag Command -The -.Ic diag -command allows the inspection of the ATM interfaces on the local host -and the modification of device parameters. -Sub-commands are: -.Cm list -(print a list of interfaces), -.Cm config -(print hardware configuration), -.Cm phy -(access PHY chip), -.Cm stats -(print statistics) and -.Cm vcc -(print list of VCCs). -.Bl -tag -width indent -.\"---------------------------------------- -.It Nm Ic diag Cm list -This sub-command lists all ATM interfaces in the system. -It takes no options or arguments. -.\"---------------------------------------- -.It Xo -.Nm Ic diag Cm config -.Op Fl atm -.Op Fl hardware -.Op Ar device ... -.Xc -This command prints the configuration of ATM interfaces. -If no -.Ar device -is given, all devices are listed, otherwise only the specified devices. -The option -.Fl atm -instructs the command to print ATM layer configuration parameters like -the number of VCI and VPI bits, whereas the -.Fl hardware -option requests card specific information like the vendor or the serial -number. -If none of the options is given, the defaults is to assume -.Fl atm . -.\"---------------------------------------- -.It Xo -.Nm Ic diag Cm phy print -.Op Fl numeric -.Ar device -.Xc -This command prints the PHY registers in a (potential) -human comprehensible format. -If -.Fl numeric -is given, the format is hex bytes. -Otherwise, textual representation will be printed. -.\"---------------------------------------- -.It Nm Ic diag Cm phy show Op Ar device ... -This sub-command prints static information about the PHY device used -in the ATM card like the type of the PHY and the media. -.\"---------------------------------------- -.It Xo -.Nm Ic diag Cm phy set -.Ar device -.Ar reg -.Ar mask -.Ar val -.Xc -This sub-command allows one to change bits in PHY registers. -This should be used with great care. -The bits of the given PHY chip register for which the corresponding bit in -.Ar mask -is one are set to the values of the corresponding bits in -.Ar val . -All register bits that have a zero in -.Ar mask -are written back with their original value. -.\"---------------------------------------- -.It Xo -.Nm Ic diag Cm phy stats -.Op Fl clear -.Ar device -.Xc -Print the PHY statistics for the given -.Ar device . -When the optional -.Fl clear -is given, the statistics are cleared atomically. -.\"---------------------------------------- -.It Xo -.Nm Ic diag Cm vcc -.Op Fl abr -.Op Fl channel -.Op Fl traffic -.Op Ar device -.Xc -Retrieve the list of currently active channels on either all -or the specified interfaces. -For each channel, the following information is printed depending -on the options (default is -.Fl channel ) . -.Bl -tag -width ".Fl traffic" -.It Fl abr -Print ABR specific traffic parameters: ICR, TBE, NRM, TRM, ADTF, RIF, RDF, -CDF. -.It Fl channel -Print basic information: VPI, VCI, AAL, traffic type, MTU and flags. -.It Fl traffic -Print traffic parameters: PCR, SCR, MBS, MCR. -.El -.\"---------------------------------------- -.It Nm Ic diag Cm stats Ar device -Print driver specific statistics. -.El -.Ss The Ic natm Command -The -.Ic natm -command is used to change -.Xr natmip 4 -routes on the local host. -The sub-commands for the routing table are: -.Cm add -(to add a new route), -.Cm delete -(to delete an existing route) and -.Cm show -(to print the currently installed NATM routes). -.Pp -.Bl -tag -width indent -compact -.\"---------------------------------------- -.It Xo -.Nm Ic natm Cm add -.Ar dest -.Ar device -.Ar vpi -.Ar vci -.Ar encaps -.Xc -.It Xo -.Nm Ic natm Cm add -.Ar dest -.Ar device -.Ar vpi -.Ar vci -.Ar encaps -.Cm ubr Op Ar pcr -.Xc -.It Xo -.Nm Ic natm Cm add -.Ar dest -.Ar device -.Ar vpi -.Ar vci -.Ar encaps -.Cm cbr Ar pcr -.Xc -.It Xo -.Nm Ic natm Cm add -.Ar dest -.Ar device -.Ar vpi -.Ar vci -.Ar encaps -.Cm vbr Ar pcr scr mbs -.Xc -.It Xo -.Nm Ic natm Cm add -.Ar dest -.Ar device -.Ar vpi -.Ar vci -.Ar encaps -.Cm abr Ar pcr mcr icr tbe nrm trm adtf rif rdf cdf -.Xc -Add a new route to the routing table. -The destination address (the address -on the other end of the link) is given in -.Ar dest . -The -.Ar device , -.Ar vpi -and -.Ar vci -arguments -are the name of the ATM device and the VPI and VCI values for the link. -The -.Ar encaps -argument -may be either -.Cm AAL5 -or -.Cm LLC/SNAP -both of which specify AAL5 encapsulation, the first one without additional -encapsulation, the second one with LLC/SNAP headers. -The first two forms of the command add an UBR (unspecified bit rate) channel, -where the second form allows the optional specification of a peak cell -rate (PCR). -The third form adds a CBR (constant bit rate) channel where a PCR -must be given. -The fourth form adds a VBR (variable bit rate) channel. -The arguments are the peak cell rate, the sustainable cell rate and the -maximum bursts size. -The last form of the command adds an ABR (available bit rate) channel. -.\"---------------------------------------- -.Pp -.It Nm Ic natm Cm delete Ar dest -.It Xo -.Nm Ic natm Cm delete -.Ar device -.Ar vpi -.Ar vci -.Xc -This commands deletes an NATM route. -The route may be specified either by the destination address or -by the -.Ar device , vpi -and -.Ar vci -triple. -.\"---------------------------------------- -.Pp -.It Nm Ic natm Cm show -List all NATM routes. -.El -.Sh SEE ALSO -.Xr natm 4 , -.Xr natmip 4 -.Sh HISTORY -An -.Nm -command appeared in -.Fx 3.0 . -.Sh AUTHORS -.An Hartmut Brandt Aq Mt harti@FreeBSD.org diff --git a/sbin/atm/atmconfig/atmconfig.h b/sbin/atm/atmconfig/atmconfig.h deleted file mode 100644 index 5e5b04172cb0..000000000000 --- a/sbin/atm/atmconfig/atmconfig.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - */ -#ifndef _ATMCONFIG_H -#define _ATMCONFIG_H - -#include -#include -#include -#include - -#define DEFAULT_INTERFACE "hatm0" - -struct cmdtab { - const char *string; - const struct cmdtab *sub; - void (*func)(int, char *[]); -}; - -/* - * client configuration info - */ -struct amodule { - const struct cmdtab *cmd; -}; - -#define DEF_MODULE(CMDTAB) \ -struct amodule amodule_1 = { CMDTAB } - -/* for compiled-in modules */ -void register_module(const struct amodule *); - -/* print a message if we are verbose */ -void verb(const char *, ...) __printflike(1, 2); - -/* print heading */ -void heading(const char *, ...) __printflike(1, 2); - -/* before starting output */ -void heading_init(void); - -/* stringify an enumerated value */ -struct penum { - int32_t value; - const char *str; -}; -const char *penum(int32_t value, const struct penum *strtab, char *buf); -int pparse(int32_t *, const struct penum *, const char *); - -enum { - OPT_NONE, - OPT_UINT, - OPT_INT, - OPT_UINT32, - OPT_INT32, - OPT_UINT64, - OPT_INT64, - OPT_FLAG, - OPT_VCI, - OPT_STRING, - OPT_SIMPLE, -}; -struct option { - const char *optstr; - int opttype; - void *optarg; -}; - -int parse_options(int *_pargc, char ***_pargv, - const struct option *_opts); - -/* XXX while this is compiled in */ -void device_register(void); - -#endif /* _ATMCONFIG_H */ diff --git a/sbin/atm/atmconfig/atmconfig.help b/sbin/atm/atmconfig/atmconfig.help deleted file mode 100644 index 8c6e7cec7f2f..000000000000 --- a/sbin/atm/atmconfig/atmconfig.help +++ /dev/null @@ -1,223 +0,0 @@ -# -# Copyright (c) 2001-2003 -# Fraunhofer Institute for Open Communication Systems (FhG Fokus). -# All rights reserved. -# Copyright (c) 2004 -# Hartmut Brandt. -# All rights reserved. -# -# Author: Hartmut Brandt -# -# 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 AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# Help file for the atmconfig utility -# -# $FreeBSD$ -# -^0 intro -ATM configuration utility. -usage: - atmconfig [common-options] command [subcommand] [options] - -Use 'atmconfig help' for general help or 'atmconfig help ' for -help on 'command' or 'atmconfig help commands' for a list of commands. - -^0 help -^^ help show help information -Use one of the following commands to get help on atmconfig: - - atmconfig help options - gives you help on common command line options - atmconfig help commands - prints a list of available commands (and help items) - atmconfig help - prints help on the given command (including a list of subcommands) - atmconfig help - gives help on the given subcommand - -^0 options -^^ help options list common options -Common command line options can be specified for all commands. They -are written immediately before the command. The following options are -available: - - -h print short help - -t don't print headings for 'show'-type commands - -v be verbose about all actions. - -^0 commands -^^ help commands show available commands -The following commands are available: - -$MAIN - -^0 diag -^^ diag show/modify ATM hardware interfaces -This command shows information about the ATM hardware interfaces in the -system. A list of ATM devices is obtained by: - - atmconfig [common-options] diag list - -Information about the hardware configuration of the ATM interfaces is -reported by: - - atmconfig [common-options] diag config [options] [ ...] - -The phy chip can be access with: - - atmconfig [common-options] diag phy print [options] - atmconfig [common-options] diag phy show - atmconfig [common-options] diag phy set - atmconfig [common-options] diag phy set stats [options] - -A list of open VCCs can be obtained with: - - atmconfig [common-options] diag vcc [ ...] - -Driver internal statistics are printed with - - atmconfig [common-options] diag stats - -^1 list -usage: atmconfig [common-options] diag list - -List all known ATM devices in the system. - -^1 config -usage: atmconfig [common-options] diag config [-hardware] [-atm] [device ...] -options: - -hardware print hardware related information - -atm print ATM related information - -If now device is given as argument information about all devices is shown. -The default is to print only ATM related information. - -^1 phy -To show the type of the PHY and its state: - - atmconfig [common-options] diag phy show - -Change a PHY register (use with care): - - atmconfig [common-options] diag phy set - -Print the PHY registers in a human readable form: - - atmconfig [common-options] diag phy print [-numeric] - -The PHY statistics can be printed with: - - atmconfig [common-options] diag phy stats [-clear] - -^2 show -usage: atmconfig [common-options] diag phy show - -Show configuration and state information about the PHY chip on the given -ATM interface. - -^2 set -usage: atmconfig [common-options] diag phy set - -Set the bits of given PHY chip register for which the corresponding bit in - is one to the value of the corresponding bit in . All register -bits that have a zero in are written back with there original value. - -^2 print -usage: atmconfig [common-options] diag phy print [-numeric] -options: - -numeric print registers in hex - -Print the registers of the PHY chip in a human readable format. - -^2 stats -usage: atmconfig [common-options] diag phy stats [-clear] -options: - -clear clear the statistics atomically after reading them - -Prints the PHY layer statistics of the PHY chip and optionally clears them. - -^1 vcc -usage: atmconfig [common-options] diag vcc [-abr] [-channel] [-traffic] - [ ...] -options: - -abr print ABR specific traffic parameters - -channel print VPI, VCI, AAL, traffic type and flags (default) - -traffic print traffic parameters - -Prints a list of all open vccs. The default output is -channel. - -^1 stats -usage: atmconfig [common-options] diag stats - -Prints the driver-internal statistics. - -^0 natm -^^ natm simple IP over ATM management (see natmip(4)) -The group of CLIP commands is used to manage classical IP over ATM -networking via NATM (see natm(4) and natmip(4)). A new PVC is added -to a CLIP via: - - atmconfig [common-options] natm add - [ [ ...]] - -The PVC can be deleted with: - - atmconfig [common-options] natm del - -The list of PVC that are currently active is retrieved with: - - atmconfig [common-options] natm show - -^1 add -usage: atmconfig [common-options] natm add [-printonly] - [ [ ...]] -options: - -printonly don't execute, print the route(8) command - -This subcommand adds a new CLIP PVC on the ATM interface . The -host on the other end of the PVC has IP address . is one -of llc/snap (LLC/SNAP encapsulated frames in AAL5) or aal5 (AAL5 frames -without LLC/SNAP). specifies the traffic type of the PVC -and is one of UBR, CBR, VBR or ABR. If not given UBR is assumed. Depending -on the traffic type none or more parameters can follow: - - ubr [] - cbr - vbr - abr - -^1 delete -usage: atmconfig [common-options] natm delete [-printonly] - or: atmconfig [common-options] natm delete [-printonly] -options: - -printonly don't execute, print the route(8) command - -This subcommand deletes and existing CLIP PVC that can bei either identified -by the destination address or by the triple. - -^1 show -usage: atmconfig [common-options] natm show [-abr] [-numeric] -options: - -abr show ABR parameters for ABR connections - -numeric print IP addresses numerically - -This subcommand prints all ATM routes. diff --git a/sbin/atm/atmconfig/atmconfig_device.c b/sbin/atm/atmconfig/atmconfig_device.c deleted file mode 100644 index f2f08380dcdf..000000000000 --- a/sbin/atm/atmconfig/atmconfig_device.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (c) 2001-2002 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * Copyright (c) 2003-2004 - * Hartmut Brandt. - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "atmconfig.h" -#include "atmconfig_device.h" -#include "private.h" -#include "oid.h" - -#include -#include -#include - -/* - * Description of the begemotAtmIfTable - */ -static const struct snmp_table atmif_table = { - OIDX_begemotAtmIfTable, - OIDX_begemotAtmIfTableLastChange, 2, - sizeof(struct atmif), - 1, 0x7ffULL, - { - { 0, - SNMP_SYNTAX_INTEGER, offsetof(struct atmif, index) }, - { OID_begemotAtmIfName, - SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmif, ifname) }, - { OID_begemotAtmIfPcr, - SNMP_SYNTAX_GAUGE, offsetof(struct atmif, pcr) }, - { OID_begemotAtmIfMedia, - SNMP_SYNTAX_INTEGER, offsetof(struct atmif, media) }, - { OID_begemotAtmIfVpiBits, - SNMP_SYNTAX_GAUGE, offsetof(struct atmif, vpi_bits) }, - { OID_begemotAtmIfVciBits, - SNMP_SYNTAX_GAUGE, offsetof(struct atmif, vci_bits) }, - { OID_begemotAtmIfMaxVpcs, - SNMP_SYNTAX_GAUGE, offsetof(struct atmif, max_vpcs) }, - { OID_begemotAtmIfMaxVccs, - SNMP_SYNTAX_GAUGE, offsetof(struct atmif, max_vccs) }, - { OID_begemotAtmIfEsi, - SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmif, esi) }, - { OID_begemotAtmIfCarrierStatus, - SNMP_SYNTAX_INTEGER, offsetof(struct atmif, carrier) }, - { OID_begemotAtmIfMode, - SNMP_SYNTAX_INTEGER, offsetof(struct atmif, mode) }, - { 0, SNMP_SYNTAX_NULL, 0 } - } -}; - -/* List of all ATM interfaces */ -struct atmif_list atmif_list = TAILQ_HEAD_INITIALIZER(atmif_list); - -/* - * ATM hardware table - */ -struct atmhw { - TAILQ_ENTRY(atmhw) link; - uint64_t found; - int32_t index; - u_char *vendor; - size_t vendorlen; - u_char *device; - size_t devicelen; - uint32_t serial; - uint32_t version; - uint32_t soft_version; -}; -TAILQ_HEAD(atmhw_list, atmhw); - -/* list of ATM hardware */ -static struct atmhw_list atmhw_list; - -/* - * Read ATM hardware table - */ -static const struct snmp_table atmhw_table = { - OIDX_begemotAtmHWTable, - OIDX_begemotAtmIfTableLastChange, 2, - sizeof(struct atmhw), - 1, 0x3fULL, - { - { 0, - SNMP_SYNTAX_INTEGER, offsetof(struct atmhw, index) }, - { OID_begemotAtmHWVendor, - SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmhw, vendor) }, - { OID_begemotAtmHWDevice, - SNMP_SYNTAX_OCTETSTRING, offsetof(struct atmhw, device) }, - { OID_begemotAtmHWSerial, - SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, serial) }, - { OID_begemotAtmHWVersion, - SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, version) }, - { OID_begemotAtmHWSoftVersion, - SNMP_SYNTAX_GAUGE, offsetof(struct atmhw, soft_version) }, - { 0, SNMP_SYNTAX_NULL, 0 } - } -}; - -static void device_status(int, char *[]); -static void device_hardware(int, char *[]); -static void device_modify(int, char *[]); - -static const struct cmdtab device_tab[] = { - { "hardware", NULL, device_hardware }, - { "status", NULL, device_status }, - { "modify", NULL, device_modify }, - { NULL, NULL, NULL } -}; - -static const struct cmdtab entry = - { "device", device_tab, NULL }; - -static DEF_MODULE(&entry); - -/* - * Carrier state to string - */ -static const struct penum strcarrier[] = { - { 1, "on" }, - { 2, "off" }, - { 3, "unknown" }, - { 4, "none" }, - { 0, NULL } -}; -/* - * SUNI mode to string - */ -static const struct penum strsunimode[] = { - { 1, "sonet" }, - { 2, "sdh" }, - { 3, "unknown" }, - { 0, NULL } -}; - -/* - * OIDs - */ -static const struct asn_oid - oid_begemotAtmIfMode = OIDX_begemotAtmIfMode; - -/* - * Print 1st status line - */ -static void -dev_status1(const struct atmif *aif) -{ - char buf[100]; - - printf("%-5u %-8s %-6u %-4u %-5u %-4u %-5u " - "%02x:%02x:%02x:%02x:%02x:%02x %s\n", aif->index, - aif->ifname, aif->pcr, - (1 << aif->vpi_bits) - 1, (1 << aif->vci_bits) - 1, - aif->max_vpcs, aif->max_vccs, aif->esi[0], - aif->esi[1], aif->esi[2], aif->esi[3], aif->esi[4], aif->esi[5], - penum(aif->carrier, strcarrier, buf)); -} - -/* - * Print 2nd status line - */ -static void -dev_status2(const struct atmif *aif) -{ - char buf[100]; - - printf("%-5u %-8s %s\n", aif->index, aif->ifname, - penum(aif->mode, strsunimode, buf)); -} - -/* - * Implement the 'device status' command - */ -static void -device_status(int argc, char *argv[]) -{ - int opt, i; - struct atmif *aif; - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - const char dev1[] = - "Interface Max Max\n" - "Index Name PCR VPI VCI VPCs VCCs ESI Carrier\n"; - const char dev2[] = - "Interface\n" - "Index Name Mode\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - snmp_open(NULL, NULL, NULL, NULL); - atexit(snmp_close); - - atmif_fetchtable(); - - if (TAILQ_EMPTY(&atmif_list)) - errx(1, "no ATM interfaces found"); - - if (argc > 0) { - heading_init(); - for (i = 0; i < argc; i++) { - if ((aif = atmif_find_name(argv[i])) == NULL) { - warnx("%s: no such ATM interface", argv[i]); - continue; - } - heading(dev1); - dev_status1(aif); - } - heading_init(); - for (i = 0; i < argc; i++) { - if ((aif = atmif_find_name(argv[i])) == NULL) - continue; - heading(dev2); - dev_status2(aif); - } - } else { - heading_init(); - TAILQ_FOREACH(aif, &atmif_list, link) { - heading(dev1); - dev_status1(aif); - } - heading_init(); - TAILQ_FOREACH(aif, &atmif_list, link) { - heading(dev2); - dev_status2(aif); - } - } -} - -/* - * Print hardware info line - */ -static void -dev_hardware(const struct atmif *aif) -{ - const struct atmhw *hw; - - TAILQ_FOREACH(hw, &atmhw_list, link) - if (aif->index == hw->index) - break; - if (hw == NULL) { - warnx("hardware info not found for '%s'", aif->ifname); - return; - } - - printf("%-5u %-8s %-16s%-10s %-10u %-10u %u\n", aif->index, - aif->ifname, hw->vendor, hw->device, hw->serial, - hw->version, hw->soft_version); -} - -/* - * Show hardware configuration - */ -static void -device_hardware(int argc, char *argv[]) -{ - int opt, i; - struct atmif *aif; - - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - static const char headline[] = - "Interface \n" - "Index Name Vendor Card Serial HW SW\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - snmp_open(NULL, NULL, NULL, NULL); - atexit(snmp_close); - - atmif_fetchtable(); - - if (snmp_table_fetch(&atmhw_table, &atmhw_list) != 0) - errx(1, "AtmHW table: %s", snmp_client.error); - - if (argc > 0) { - heading_init(); - for (i = 0; i < argc; i++) { - if ((aif = atmif_find_name(argv[i])) == NULL) { - warnx("interface not found '%s'", argv[i]); - continue; - } - heading(headline); - dev_hardware(aif); - } - } else { - heading_init(); - TAILQ_FOREACH(aif, &atmif_list, link) { - heading(headline); - dev_hardware(aif); - } - } -} - -/* - * Change device parameters - */ -static void -device_modify(int argc, char *argv[]) -{ - int opt; - struct atmif *aif; - int mode = 0; - int n; - struct snmp_pdu pdu, resp; - - static const struct option opts[] = { -#define MODIFY_MODE 0 - { "mode", OPT_STRING, NULL }, - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - - case MODIFY_MODE: - if (pparse(&mode, strsunimode, optarg) == -1 || - mode == 3) - errx(1, "illegal mode for -m '%s'", optarg); - break; - } - - if (argc != 1) - errx(1, "device modify needs one argument"); - - snmp_open(NULL, NULL, NULL, NULL); - - atexit(snmp_close); - atmif_fetchtable(); - - if ((aif = atmif_find_name(argv[0])) == NULL) - errx(1, "%s: no such ATM interface", argv[0]); - - snmp_pdu_create(&pdu, SNMP_PDU_SET); - if (mode != 0) { - n = snmp_add_binding(&pdu, - &oid_begemotAtmIfMode, SNMP_SYNTAX_INTEGER, - NULL); - snmp_oid_append(&pdu.bindings[n + 0].var, "i", - (asn_subid_t)aif->index); - pdu.bindings[n + 0].v.integer = mode; - } - - if (pdu.nbindings == 0) - errx(1, "must specify something to modify"); - - if (snmp_dialog(&pdu, &resp)) - errx(1, "No response from '%s': %s", snmp_client.chost, - snmp_client.error); - - if (snmp_pdu_check(&pdu, &resp) <= 0) - errx(1, "Error modifying device"); - - snmp_pdu_free(&resp); - snmp_pdu_free(&pdu); -} - -/* XXX while this is compiled in */ -void -device_register(void) -{ - register_module(&amodule_1); -} - -/* - * Fetch the ATM interface table - */ -void -atmif_fetchtable(void) -{ - struct atmif *aif; - - while ((aif = TAILQ_FIRST(&atmif_list)) != NULL) { - free(aif->ifname); - free(aif->esi); - TAILQ_REMOVE(&atmif_list, aif, link); - free(aif); - } - - if (snmp_table_fetch(&atmif_table, &atmif_list) != 0) - errx(1, "AtmIf table: %s", snmp_client.error); -} - -/* - * Find a named ATM interface - */ -struct atmif * -atmif_find_name(const char *ifname) -{ - struct atmif *atmif; - - TAILQ_FOREACH(atmif, &atmif_list, link) - if (strcmp(atmif->ifname, ifname) == 0) - return (atmif); - return (NULL); -} -/* - * find an ATM interface by index - */ -struct atmif * -atmif_find(u_int idx) -{ - struct atmif *atmif; - - TAILQ_FOREACH(atmif, &atmif_list, link) - if (atmif->index == (int32_t)idx) - return (atmif); - return (NULL); -} diff --git a/sbin/atm/atmconfig/atmconfig_device.h b/sbin/atm/atmconfig/atmconfig_device.h deleted file mode 100644 index 1c099fcdc79a..000000000000 --- a/sbin/atm/atmconfig/atmconfig_device.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2001-2002 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * Copyright (c) 2003-2004 - * Hartmut Brandt. - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -#ifndef ATMCONFIG_DEVICE_H_ -#define ATMCONFIG_DEVICE_H_ - -#include -#include -#include - -/* - * ATM interface table - */ -struct atmif { - TAILQ_ENTRY(atmif) link; - uint64_t found; - int32_t index; - char *ifname; - size_t ifnamelen; - uint32_t pcr; - int32_t media; - uint32_t vpi_bits; - uint32_t vci_bits; - uint32_t max_vpcs; - uint32_t max_vccs; - u_char *esi; - size_t esilen; - int32_t carrier; - int32_t mode; -}; -TAILQ_HEAD(atmif_list, atmif); - -/* list of all ATM interfaces */ -extern struct atmif_list atmif_list; - -/* fetch this table */ -void atmif_fetchtable(void); - -/* find an ATM interface by name */ -struct atmif *atmif_find_name(const char *); - -/* find an ATM interface by index */ -struct atmif *atmif_find(u_int); - -#endif diff --git a/sbin/atm/atmconfig/atmconfig_device.help b/sbin/atm/atmconfig/atmconfig_device.help deleted file mode 100644 index 27237c8cb7b9..000000000000 --- a/sbin/atm/atmconfig/atmconfig_device.help +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2003-2004 -# Hartmut Brandt. -# All rights reserved. -# -# Author: Hartmut Brandt -# -# 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 AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# Help file for the atmconfig utility -# -# $FreeBSD$ -# -^0 device -^^ device show information about ATM hardware interfaces -This command shows information about the ATM hardware interfaces on the -system. Status information can be obtained by: - - atmconfig [common-options] device status [options] [device ...] - -Information about the hardware of the ATM interfaces is reported by: - - atmconfig [common-options] device hardware [options] [device ...] - -The parameters of the a device can be changed by: - - atmconfig [common-options] device modify [options] - -^1 status -usage: atmconfig [common-options] device status [device ...] - -If no device is given as argument information about all devices is shown. - -^1 hardware -usage: atmconfig [common-options] device hardware [device ...] - -If now device is given as argument information about all devices is shown. - -^1 modify -usage: atmconfig [common-options] device modify [-mode mode] - -options: - -mode switch the SUNI mode to either 'sonet' or 'sdh'. - diff --git a/sbin/atm/atmconfig/diag.c b/sbin/atm/atmconfig/diag.c deleted file mode 100644 index 3225e107e2b6..000000000000 --- a/sbin/atm/atmconfig/diag.c +++ /dev/null @@ -1,1122 +0,0 @@ -/* - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "atmconfig.h" -#include "private.h" -#include "diag.h" - -static void diag_list(int, char *[]); -static void diag_config(int, char *[]); -static void diag_vcc(int, char *[]); -static void diag_phy_show(int, char *[]); -static void diag_phy_set(int, char *[]); -static void diag_phy_print(int, char *[]); -static void diag_phy_stats(int, char *[]); -static void diag_stats(int, char *[]); - -static const struct cmdtab diag_phy_tab[] = { - { "show", NULL, diag_phy_show }, - { "set", NULL, diag_phy_set }, - { "stats", NULL, diag_phy_stats }, - { "print", NULL, diag_phy_print }, - { NULL, NULL, NULL }, -}; - -const struct cmdtab diag_tab[] = { - { "list", NULL, diag_list }, - { "config", NULL, diag_config }, - { "phy", diag_phy_tab, NULL }, - { "stats", NULL, diag_stats }, - { "vcc", NULL, diag_vcc }, - { NULL, NULL, NULL } -}; - -static const struct utopia_print suni_lite[] = { SUNI_PRINT_LITE }; -static const struct utopia_print suni_ultra[] = { SUNI_PRINT_ULTRA }; -static const struct utopia_print suni_622[] = { SUNI_PRINT_622 }; -static const struct utopia_print idt77105[] = { IDTPHY_PRINT_77105 }; -static const struct utopia_print idt77155[] = { IDTPHY_PRINT_77155 }; - -static const struct { - const struct utopia_print *tab; - u_int len; - u_int type; -} phy_print[] = { - { suni_lite, sizeof(suni_lite) / sizeof(suni_lite[0]), - UTP_TYPE_SUNI_LITE }, - { suni_ultra, sizeof(suni_ultra) / sizeof(suni_ultra[0]), - UTP_TYPE_SUNI_ULTRA }, - { suni_622, sizeof(suni_622) / sizeof(suni_622[0]), - UTP_TYPE_SUNI_622 }, - { idt77105, sizeof(idt77105) / sizeof(idt77105[0]), - UTP_TYPE_IDT77105 }, - { idt77155, sizeof(idt77155) / sizeof(idt77155[0]), - UTP_TYPE_IDT77155 }, -}; - -static const u_int utopia_addreg[] = { UTP_REG_ADD }; - -/* - * Driver statistics printing - */ -static const char *const print_stats_pca200e[] = { - "cmd_queue_full:", - "get_stat_errors:", - "clr_stat_errors:", - "get_prom_errors:", - "suni_reg_errors:", - "tx_queue_full:", - "tx_queue_almost_full:", - "tx_pdu2big:", - "tx_too_many_segs:", - "tx_retry:", - "fix_empty:", - "fix_addr_copy:", - "fix_addr_noext:", - "fix_addr_ext:", - "fix_len_noext:", - "fix_len_copy:", - "fix_len:", - "rx_badvc:", - "rx_closed:", - NULL -}; -static const char *const print_stats_he[] = { - "tdprq_full:", - "hbuf_error:", - "crc_error:", - "len_error:", - "flow_closed:", - "flow_drop:", - "tpd_no_mem:", - "rx_seg:", - "empty_hbuf:", - "short_aal5:", - "badlen_aal5:", - "bug_bad_isw:", - "bug_no_irq_upd:", - "itype_tbrq:", - "itype_tpd:", - "itype_rbps:", - "itype_rbpl:", - "itype_rbrq:", - "itype_rbrqt:", - "itype_unknown:", - "itype_phys:", - "itype_err:", - "defrag:", - "mcc:", - "oec:", - "dcc:", - "cec:", - "no_rcv_mbuf:", - NULL -}; -static const char *const print_stats_eni[] = { - "ttrash:", - "mfixaddr:", - "mfixlen:", - "mfixfail:", - "txmbovr:", - "dmaovr:", - "txoutspace:", - "txdtqout:", - "launch:", - "hwpull:", - "swadd:", - "rxqnotus:", - "rxqus:", - "rxdrqout:", - "rxmbufout:", - "txnomap:", - "vtrash:", - "otrash:", - NULL -}; - -static const char *const print_stats_idt77211[] = { - "need_copy:", - "copy_failed:", - "out_of_tbds:", - "no_txmaps:", - "tx_load_err:", - "tx_qfull:", - NULL -}; -static const char *const print_stats_idt77252[] = { - "raw_cells:", - "raw_no_vcc:", - "raw_no_buf:", - "tx_qfull:", - "tx_out_of_tbds:", - "tx_out_of_maps:", - "tx_load_err:", - NULL -}; -static const char *const print_stats_virtual[] = { - "dummy:", - NULL -}; -static const char *const *const print_stats[] = { - [ATM_DEVICE_UNKNOWN] = NULL, - [ATM_DEVICE_PCA200E] = print_stats_pca200e, - [ATM_DEVICE_HE155] = print_stats_he, - [ATM_DEVICE_HE622] = print_stats_he, - [ATM_DEVICE_ENI155P] = print_stats_eni, - [ATM_DEVICE_ADP155P] = print_stats_eni, - [ATM_DEVICE_FORELE25] = print_stats_idt77211, - [ATM_DEVICE_FORELE155] = print_stats_idt77211, - [ATM_DEVICE_NICSTAR25] = print_stats_idt77211, - [ATM_DEVICE_NICSTAR155] = print_stats_idt77211, - [ATM_DEVICE_IDTABR25] = print_stats_idt77252, - [ATM_DEVICE_IDTABR155] = print_stats_idt77252, - [ATM_DEVICE_PROATM25] = print_stats_idt77252, - [ATM_DEVICE_PROATM155] = print_stats_idt77252, - [ATM_DEVICE_VIRTUAL] = print_stats_virtual, -}; - -struct diagif_list diagif_list = TAILQ_HEAD_INITIALIZER(diagif_list); - -/* - * Fetch a phy sysctl - */ -static int -phy_fetch(const char *ifname, const char *var, void *val, size_t len, - int err_fatal) -{ - char *str; - - if (asprintf(&str, "hw.atm.%s.phy_%s", ifname, var) == -1) - err(1, NULL); - if (sysctlbyname(str, val, &len, NULL, 0) == -1) { - if (err_fatal || errno != ENOENT) - err(1, "%s", str); - free(str); - return (-1); - } - free(str); - return (0); -} - -/* - * Fetch the list of all ATM network interfaces and their MIBs. - */ -void -diagif_fetch(void) -{ - size_t len; - int count; - int name[6]; - struct ifmibdata mib; - struct ifatm_mib atm; - int idx; - struct diagif *d; - - while ((d = TAILQ_FIRST(&diagif_list)) != NULL) { - if (d->vtab != NULL) - free(d->vtab); - TAILQ_REMOVE(&diagif_list, d, link); - free(d); - } - - len = sizeof(count); - if (sysctlbyname("net.link.generic.system.ifcount", &count, &len, - NULL, 0) == -1) - err(1, "ifcount"); - - name[0] = CTL_NET; - name[1] = PF_LINK; - name[2] = NETLINK_GENERIC; - name[3] = IFMIB_IFDATA; - - for (idx = 1; idx <= count; idx++) { - name[4] = idx; - name[5] = IFDATA_GENERAL; - len = sizeof(mib); - if (sysctl(name, 6, &mib, &len, NULL, 0) == -1) - err(1, "interface %d: general mib", idx); - if (mib.ifmd_data.ifi_type == IFT_ATM) { - name[5] = IFDATA_LINKSPECIFIC; - len = sizeof(atm); - if (sysctl(name, 6, &atm, &len, NULL, 0) == -1) - err(1, "interface %d: ATM mib", idx); - - d = malloc(sizeof(*d)); - if (d == NULL) - err(1, NULL); - bzero(d, sizeof(*d)); - d->mib = atm; - d->index = idx; - strcpy(d->ifname, mib.ifmd_name); - TAILQ_INSERT_TAIL(&diagif_list, d, link); - - if (phy_fetch(d->ifname, "type", &d->phy_type, - sizeof(d->phy_type), 0) == 0) { - d->phy_present = 1; - phy_fetch(d->ifname, "loopback", - &d->phy_loopback, - sizeof(d->phy_loopback), 1); - phy_fetch(d->ifname, "name", &d->phy_name, - sizeof(d->phy_name), 1); - phy_fetch(d->ifname, "state", &d->phy_state, - sizeof(d->phy_state), 1); - phy_fetch(d->ifname, "carrier", &d->phy_carrier, - sizeof(d->phy_carrier), 1); - } - } - } -} - -/* - * "STRING\011STRING\012STRING" - */ -static char * -printb8(uint32_t val, const char *descr) -{ - static char buffer[1000]; - char *ptr; - int tmp = 0; - u_char mask, pattern; - - if (*descr++ == '\010') - sprintf(buffer, "%#o", val); - else - sprintf(buffer, "%#x", val); - ptr = buffer + strlen(buffer); - - *ptr++ = '<'; - while (*descr) { - if (*descr == '\11') { - descr++; - mask = *descr++; - pattern = *descr++; - if ((val & mask) == pattern) { - if (tmp++) - *ptr++ = ','; - while (*descr >= ' ') - *ptr++ = *descr++; - } else { - while (*descr >= ' ') - descr++; - } - } else if (*descr == '\12') { - descr++; - mask = *descr++; - pattern = *descr++; - if (tmp++) - *ptr++ = ','; - while (*descr >= ' ') - *ptr++ = *descr++; - *ptr++ = '='; - if (pattern == 8) - sprintf(ptr, "%#o", - (val & mask) >> (ffs(mask)-1)); - else if (pattern == 10) - sprintf(ptr, "%u", - (val & mask) >> (ffs(mask)-1)); - else - sprintf(ptr, "%#x", - (val & mask) >> (ffs(mask)-1)); - ptr += strlen(ptr); - } else { - if (val & (1 << (*descr++ - 1))) { - if (tmp++) - *ptr++ = ','; - while (*descr >= ' ') - *ptr++ = *descr++; - } else { - while (*descr >= ' ') - descr++; - } - } - } - *ptr++ = '>'; - *ptr++ = '\0'; - - return (buffer); -} - -/* - * "STRINGSTRING" - */ -static char * -printb(uint32_t val, const char *descr) -{ - static char buffer[1000]; - char *ptr; - int tmp = 0; - - if (*descr++ == '\010') - sprintf(buffer, "%#o", val); - else - sprintf(buffer, "%#x", val); - ptr = buffer + strlen(buffer); - - *ptr++ = '<'; - while (*descr) { - if (val & (1 << (*descr++ - 1))) { - if (tmp++) - *ptr++ = ','; - while (*descr > ' ') - *ptr++ = *descr++; - } else { - while (*descr > ' ') - descr++; - } - } - *ptr++ = '>'; - *ptr++ = '\0'; - - return (buffer); -} - - -static void -diag_loop(int argc, char *argv[], const char *text, - void (*func)(const struct diagif *)) -{ - int i; - struct diagif *aif; - - heading_init(); - if (argc > 0) { - for (i = 0; i < argc; i++) { - TAILQ_FOREACH(aif, &diagif_list, link) { - if (strcmp(argv[i], aif->ifname) == 0) { - heading("%s", text); - (*func)(aif); - break; - } - } - if (aif == NULL) - warnx("%s: no such ATM interface", argv[i]); - } - } else { - TAILQ_FOREACH(aif, &diagif_list, link) { - heading("%s", text); - (*func)(aif); - } - } -} - -/* - * Print the config line for the given interface - */ -static void -config_line1(const struct diagif *aif) -{ - printf("%-6u%-9s%-8u%-5u%-6u%-5u%-6u%02x:%02x:%02x:%02x:%02x:%02x\n", - aif->index, aif->ifname, aif->mib.pcr, (1 << aif->mib.vpi_bits) - 1, - (1 << aif->mib.vci_bits) - 1, aif->mib.max_vpcs, aif->mib.max_vccs, - aif->mib.esi[0], aif->mib.esi[1], aif->mib.esi[2], - aif->mib.esi[3], aif->mib.esi[4], aif->mib.esi[5]); -} - -static void -config_line2(const struct diagif *aif) -{ - u_int d, i; - - static const struct { - const char *dev; - const char *vendor; - } devs[] = { - ATM_DEVICE_NAMES - }; - static const struct { - u_int media; - const char *const name; - } medias[] = IFM_SUBTYPE_ATM_DESCRIPTIONS; - - for (i = 0; medias[i].name; i++) - if (aif->mib.media == medias[i].media) - break; - - if ((d = aif->mib.device) >= sizeof(devs) / sizeof(devs[0])) - d = 0; - - printf("%-6u%-9s%-12.11s%-13.12s%-8u%-6x%-6x %s\n", aif->index, - aif->ifname, devs[d].vendor, devs[d].dev, aif->mib.serial, - aif->mib.hw_version, aif->mib.sw_version, - medias[i].name ? medias[i].name : "unknown"); -} - -static void -diag_config(int argc, char *argv[]) -{ - int opt; - - static int hardware; - static int atm; - - static const struct option opts[] = { - { "hardware", OPT_SIMPLE, &hardware }, - { "atm", OPT_SIMPLE, &atm }, - { NULL, 0, NULL } - }; - - static const char config_text1[] = - "Interface Max Max\n" - "Index Name PCR VPI VCI VPCs VCCs ESI\n"; - static const char config_text2[] = - "Interface Version\n" - "Index Name Vendor Card " - "Serial HW SW Media\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - diagif_fetch(); - if (TAILQ_EMPTY(&diagif_list)) - errx(1, "no ATM interfaces found"); - - if (!atm && !hardware) - atm = 1; - - if (atm) - diag_loop(argc, argv, config_text1, config_line1); - if (hardware) - diag_loop(argc, argv, config_text2, config_line2); - -} - -static void -diag_list(int argc, char *argv[]) -{ - int opt; - struct diagif *aif; - - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc > 0) - errx(1, "no arguments required for 'diag list'"); - - diagif_fetch(); - if (TAILQ_EMPTY(&diagif_list)) - errx(1, "no ATM interfaces found"); - - TAILQ_FOREACH(aif, &diagif_list, link) - printf("%s ", aif->ifname); - printf("\n"); -} - -/* - * Print the config line for the given interface - */ -static void -phy_show_line(const struct diagif *aif) -{ - printf("%-6u%-9s", aif->index, aif->ifname); - if (aif->phy_present) - printf("%-5u%-25s0x%-9x", aif->phy_type, - aif->phy_name, aif->phy_loopback); - printf("\n"); -} - -static void -diag_phy_show(int argc, char *argv[]) -{ - int opt; - - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - static const char phy_show_text[] = - "Interface Phy\n" - "Index Name Type Name Loopback State\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - diagif_fetch(); - if (TAILQ_EMPTY(&diagif_list)) - errx(1, "no ATM interfaces found"); - - diag_loop(argc, argv, phy_show_text, phy_show_line); -} - -/* - * Make sure the interface exists and has a phy - */ -static struct diagif * -diagif_get_phy(const char *arg) -{ - struct diagif *aif; - - diagif_fetch(); - TAILQ_FOREACH(aif, &diagif_list, link) - if (strcmp(aif->ifname, arg) == 0) - break; - if (aif == NULL) - errx(1, "no such interface: %s", arg); - if (!aif->phy_present) - errx(1, "interface %s has no phy", arg); - - return (aif); -} - -static void -diag_phy_set(int argc, char *argv[]) -{ - int opt; - uint8_t reg[3]; - u_long res; - char *end; - char *str; - - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc != 4) - errx(1, "missing arguments for 'diag phy set'"); - - errno = 0; - res = strtoul(argv[1], &end, 0); - if (errno != 0) - err(1, "register number"); - if (*end != '\0') - errx(1, "malformed register number '%s'", argv[1]); - if (res > 0xff) - errx(1, "register number too large"); - reg[0] = res; - - errno = 0; - res = strtoul(argv[2], &end, 0); - if (errno != 0) - err(1, "mask"); - if (*end != '\0') - errx(1, "malformed mask '%s'", argv[1]); - if (res > 0xff) - errx(1, "mask too large"); - reg[1] = res; - - errno = 0; - res = strtoul(argv[3], &end, 0); - if (errno != 0) - err(1, "value"); - if (*end != '\0') - errx(1, "malformed value '%s'", argv[1]); - if (res > 0xff) - errx(1, "value too large"); - reg[2] = res; - - (void)diagif_get_phy(argv[0]); - - if (asprintf(&str, "hw.atm.%s.phy_regs", argv[0]) == -1) - err(1, NULL); - - if (sysctlbyname(str, NULL, NULL, reg, 3 * sizeof(uint8_t))) - err(1, "%s", str); - - free(str); -} - -static void -diag_phy_print(int argc, char *argv[]) -{ - int opt; - char *str; - size_t len, len1; - uint8_t *regs; - u_int type, i; - const struct utopia_print *p; - - static int numeric; - - static const struct option opts[] = { - { "numeric", OPT_SIMPLE, &numeric }, - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc != 1) - errx(1, "need device name for 'diag phy print'"); - - (void)diagif_get_phy(argv[0]); - - if (asprintf(&str, "hw.atm.%s.phy_regs", argv[0]) == -1) - err(1, NULL); - len = 0; - if (sysctlbyname(str, NULL, &len, NULL, 0)) - err(1, "'%s' not found", str); - - regs = malloc(len); - if (regs == NULL) - err(1, NULL); - - if (sysctlbyname(str, regs, &len, NULL, 0)) - err(1, "'%s' not found", str); - free(str); - - if (numeric) { - for (i = 0; i < len; i++) { - if (i % 16 == 0) - printf("%02x: ", i); - if (i % 16 == 8) - printf(" "); - printf(" %02x", regs[i]); - if (i % 16 == 15) - printf("\n"); - } - if (i % 16 != 0) - printf("\n"); - } else { - if (asprintf(&str, "hw.atm.%s.phy_type", argv[0]) == -1) - err(1, NULL); - len1 = sizeof(type); - if (sysctlbyname(str, &type, &len1, NULL, 0)) - err(1, "'%s' not found", str); - free(str); - - for (i = 0; i < sizeof(phy_print) / sizeof(phy_print[0]); i++) - if (type == phy_print[i].type) - break; - if (i == sizeof(phy_print) / sizeof(phy_print[0])) - errx(1, "unknown PHY chip type %u\n", type); - - for (p = phy_print[i].tab; - p < phy_print[i].tab + phy_print[i].len; - p++) { - if (p->reg + utopia_addreg[p->type] > len) - /* don't have this register */ - continue; - - printf("%s:%*s", p->name, 40 - (int)strlen(p->name),""); - - switch (p->type) { - - case UTP_REGT_BITS: - printf("%s\n", printb8(regs[p->reg], p->fmt)); - break; - - case UTP_REGT_INT8: - printf("%#x\n", regs[p->reg]); - break; - - case UTP_REGT_INT10BITS: - printf("%#x %s\n", regs[p->reg] | - ((regs[p->reg + 1] & 0x3) << 8), - printb8(regs[p->reg + 1], p->fmt)); - break; - - case UTP_REGT_INT12: - printf("%#x\n", regs[p->reg] | - ((regs[p->reg + 1] & 0xf) << 8)); - break; - - case UTP_REGT_INT16: - printf("%#x\n", regs[p->reg] | - (regs[p->reg + 1] << 8)); - break; - - case UTP_REGT_INT19: - printf("%#x\n", regs[p->reg] | - (regs[p->reg + 1] << 8) | - ((regs[p->reg + 2] & 0x7) << 16)); - break; - - case UTP_REGT_INT20: - printf("%#x\n", regs[p->reg] | - (regs[p->reg + 1] << 8) | - ((regs[p->reg + 2] & 0xf) << 16)); - break; - - case UTP_REGT_INT21: - printf("%#x\n", regs[p->reg] | - (regs[p->reg + 1] << 8) | - ((regs[p->reg + 2] & 0x1f) << 16)); - break; - - default: - abort(); - } - } - } - free(regs); -} - -static void -diag_phy_stats(int argc, char *argv[]) -{ - int opt; - size_t len; - char *str; - struct utopia_stats1 stats1; - u_int foo; - - static int clear; - - static const struct option opts[] = { - { "clear", OPT_SIMPLE, &clear }, - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc != 1) - errx(1, "need device name for 'diag phy stats'"); - - (void)diagif_get_phy(argv[0]); - - if (asprintf(&str, "hw.atm.%s.phy_stats", argv[0]) == -1) - err(1, NULL); - - len = sizeof(stats1); - if (sysctlbyname(str, &stats1, &len, - clear ? &foo : NULL, clear ? sizeof(foo) : 0)) - err(1, "'%s' not found", str); - if (len < sizeof(stats1.version)) - errx(1, "phy statistics too short %zu", len); - - switch (stats1.version) { - - case 1: - if (len != sizeof(stats1)) - errx(1, "bad phy stats length %zu (expecting %zu)", - len, sizeof(stats1)); - break; - - default: - errx(1, "unknown phy stats version %u", stats1.version); - } - - free(str); - - printf("rx_sbip: %llu\n", (unsigned long long)stats1.rx_sbip); - printf("rx_lbip: %llu\n", (unsigned long long)stats1.rx_lbip); - printf("rx_lfebe: %llu\n", (unsigned long long)stats1.rx_lfebe); - printf("rx_pbip: %llu\n", (unsigned long long)stats1.rx_pbip); - printf("rx_pfebe: %llu\n", (unsigned long long)stats1.rx_pfebe); - printf("rx_cells: %llu\n", (unsigned long long)stats1.rx_cells); - printf("rx_corr: %llu\n", (unsigned long long)stats1.rx_corr); - printf("rx_uncorr: %llu\n", (unsigned long long)stats1.rx_uncorr); - printf("rx_symerr: %llu\n", (unsigned long long)stats1.rx_symerr); - printf("tx_cells: %llu\n", (unsigned long long)stats1.tx_cells); -} - -/* - * Fetch the table of open vccs - */ -void -diagif_fetch_vcc(struct diagif *aif, int fd) -{ - struct ifreq ifr; - - if (aif->vtab != NULL) - return; - - strncpy(ifr.ifr_name, aif->ifname, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ - 1] = '\0'; - - aif->vtab = malloc(sizeof(*aif->vtab) + sizeof(aif->vtab->vccs[0]) * - aif->mib.max_vccs); - if (aif->vtab == NULL) - err(1, NULL); - ifr.ifr_data = (caddr_t)aif->vtab; - - if (ioctl(fd, SIOCATMGVCCS, &ifr) == -1) - err(1, "SIOCATMGVCCS"); -} - -/* - * Print the VCC table for this interface. - */ -static void -print_channel(const struct diagif *aif) -{ - const struct atmio_vcc *v; - - static const char *const aal_tab[] = { - [ATMIO_AAL_0] = "0", - [ATMIO_AAL_34] = "3/4", - [ATMIO_AAL_5] = "5", - [ATMIO_AAL_RAW] = "raw", - }; - static const char *const traffic_tab[] = { - [ATMIO_TRAFFIC_UBR] = "ubr", - [ATMIO_TRAFFIC_CBR] = "cbr", - [ATMIO_TRAFFIC_ABR] = "abr", - [ATMIO_TRAFFIC_VBR] = "vbr", - }; - - for (v = aif->vtab->vccs; v < &aif->vtab->vccs[aif->vtab->count]; v++) { - printf("%-6u%-9s%-4u%-6u", aif->index, aif->ifname, - v->vpi, v->vci); - - if (v->aal >= sizeof(aal_tab)/sizeof(aal_tab[0]) || - aal_tab[v->aal] == NULL) - printf("bad "); - else - printf("%-4s", aal_tab[v->aal]); - - if (v->traffic >= sizeof(traffic_tab)/sizeof(traffic_tab[0]) || - traffic_tab[v->traffic] == NULL) - printf("bad "); - else - printf("%-8s", traffic_tab[v->traffic]); - - printf("%-6u%-6u%s\n", v->rmtu, v->tmtu, - printb(v->flags, ATMIO_FLAGS)); - } -} - -/* - * Print the VCC table for this interface, traffic parameters. - */ -static void -print_traffic(const struct diagif *aif) -{ - const struct atmio_vcc *v; - - for (v = aif->vtab->vccs; v < &aif->vtab->vccs[aif->vtab->count]; v++) { - printf("%-6u%-9s%-4u%-6u", aif->index, aif->ifname, - v->vpi, v->vci); - - switch (v->traffic) { - - case ATMIO_TRAFFIC_CBR: - printf("%u", v->tparam.pcr); - break; - - case ATMIO_TRAFFIC_UBR: - printf("%-8u %u", v->tparam.pcr, - v->tparam.mcr); - break; - - case ATMIO_TRAFFIC_VBR: - printf("%-8u%-8u%-8u", v->tparam.pcr, v->tparam.scr, - v->tparam.mbs); - break; - - case ATMIO_TRAFFIC_ABR: - printf("%-8u %-8u", - v->tparam.pcr, v->tparam.mcr); - break; - } - printf("\n"); - } -} - -/* - * Print the VCC table for this interface, ABR traffic parameters. - */ -static void -print_abr(const struct diagif *aif) -{ - const struct atmio_vcc *v; - - for (v = aif->vtab->vccs; v < &aif->vtab->vccs[aif->vtab->count]; v++) { - printf("%-6u%-9s%-4u%-6u", aif->index, aif->ifname, - v->vpi, v->vci); - - if (v->traffic == ATMIO_TRAFFIC_ABR) { - printf("%-8u%-8u%-4u%-4u%-5u%-5u%-5u%u", - v->tparam.icr, v->tparam.tbe, v->tparam.nrm, - v->tparam.trm, v->tparam.adtf, v->tparam.rif, - v->tparam.rdf, v->tparam.cdf); - } - printf("\n"); - } -} - -static void -diag_vcc_loop(void (*func)(const struct diagif *), const char *text, - int argc, char *argv[], int fd) -{ - struct diagif *aif; - - heading_init(); - if (argc == 0) { - TAILQ_FOREACH(aif, &diagif_list, link) { - diagif_fetch_vcc(aif, fd); - if (aif->vtab->count != 0) { - heading("%s", text); - (*func)(aif); - } - } - - } else { - for (optind = 0; optind < argc; optind++) { - TAILQ_FOREACH(aif, &diagif_list, link) - if (strcmp(aif->ifname, argv[optind]) == 0) { - diagif_fetch_vcc(aif, fd); - if (aif->vtab->count != 0) { - heading("%s", text); - (*func)(aif); - } - break; - } - if (aif == NULL) - warnx("no such interface '%s'", argv[optind]); - } - } -} - -static void -diag_vcc(int argc, char *argv[]) -{ - int opt, fd; - - static int channel, traffic, abr; - static const struct option opts[] = { - { "abr", OPT_SIMPLE, &abr }, - { "channel", OPT_SIMPLE, &channel }, - { "traffic", OPT_SIMPLE, &traffic }, - { NULL, 0, NULL } - }; - static const char head_channel[] = - "Interface\n" - "Index Name VPI VCI AAL Traffic RxMTU TxMTU Flags\n"; - static const char head_traffic[] = - "Interface Traffic parameters\n" - "Index Name VPI VCI PCR SCR MBS MCR\n"; - static const char head_abr[] = - "Interface ABR traffic parameters\n" - "Index Name VPI VCI ICR TBE NRM TRM ADTF RIF RDF " - "CDF\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - fd = socket(PF_NATM, SOCK_STREAM, PROTO_NATMAAL5); - if (fd < 0) - err(1, "socket"); - - diagif_fetch(); - if (TAILQ_EMPTY(&diagif_list)) - errx(1, "no ATM interfaces found"); - - if (!channel && !traffic && !abr) - channel = 1; - - if (channel) - diag_vcc_loop(print_channel, head_channel, argc, argv, fd); - if (traffic) - diag_vcc_loop(print_traffic, head_traffic, argc, argv, fd); - if (abr) - diag_vcc_loop(print_abr, head_abr, argc, argv, fd); -} - -/* - * Print driver-internal statistics - */ -static void -diag_stats(int argc, char *argv[]) -{ - int opt; - char *str; - size_t len; - uint32_t *stats; - struct diagif *aif; - u_int i; - - static const struct option opts[] = { - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc != 1) - errx(1, "need one arg for 'diag stats'"); - - diagif_fetch(); - TAILQ_FOREACH(aif, &diagif_list, link) - if (strcmp(aif->ifname, argv[0]) == 0) - break; - - if (aif == NULL) - errx(1, "interface '%s' not found", argv[0]); - - if (asprintf(&str, "hw.atm.%s.istats", argv[0]) == -1) - err(1, NULL); - len = 0; - if (sysctlbyname(str, NULL, &len, NULL, 0)) - err(1, "'%s' not found", str); - - stats = malloc(len); - if (stats == NULL) - err(1, NULL); - - if (sysctlbyname(str, stats, &len, NULL, 0)) - err(1, "'%s' not found", str); - free(str); - - if (aif->mib.device >= sizeof(print_stats) / sizeof(print_stats[0]) || - print_stats[aif->mib.device] == NULL) - errx(1, "unknown stats format (%u)", aif->mib.device); - - for (i = 0; print_stats[aif->mib.device][i] != NULL; i++) { - if (i * sizeof(uint32_t) >= len) - errx(1, "debug info too short (version mismatch?)"); - printf("%-22s%u\n", print_stats[aif->mib.device][i], stats[i]); - } - free(stats); - - if (i != len / sizeof(uint32_t)) - errx(1, "debug info too long (version mismatch?)"); -} diff --git a/sbin/atm/atmconfig/diag.h b/sbin/atm/atmconfig/diag.h deleted file mode 100644 index 8b36cd44e1f5..000000000000 --- a/sbin/atm/atmconfig/diag.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - */ - -struct diagif { - TAILQ_ENTRY(diagif) link; - char ifname[IFNAMSIZ]; - u_int index; - struct ifatm_mib mib; - int phy_present : 1; - u_int phy_type; - u_int phy_loopback; - char phy_name[100]; - u_int phy_state; - u_int phy_carrier; - struct atmio_vcctable *vtab; -}; -TAILQ_HEAD(diagif_list, diagif); -extern struct diagif_list diagif_list; - -void diagif_fetch(void); -void diagif_fetch_vcc(struct diagif *aif, int fd); diff --git a/sbin/atm/atmconfig/main.c b/sbin/atm/atmconfig/main.c deleted file mode 100644 index 137421830a50..000000000000 --- a/sbin/atm/atmconfig/main.c +++ /dev/null @@ -1,880 +0,0 @@ -/* - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef WITH_BSNMP -#include -#include -#include -#endif - -#include "atmconfig.h" -#include "private.h" - -/* verbosity level */ -static int verbose; - -/* notitle option */ -static int notitle; - -/* need to put heading before next output */ -static int need_heading; - -/* - * TOP LEVEL commands - */ -static void help_func(int argc, char *argv[]) __dead2; - -static const struct cmdtab static_main_tab[] = { - { "help", NULL, help_func }, - { "options", NULL, NULL }, - { "commands", NULL, NULL }, - { "diag", diag_tab, NULL }, - { "natm", natm_tab, NULL }, - { NULL, NULL, NULL } -}; - -static struct cmdtab *main_tab = NULL; -static size_t main_tab_size = sizeof(static_main_tab) / - sizeof(static_main_tab[0]); - -static int -substr(const char *s1, const char *s2) -{ - return (strlen(s1) <= strlen(s2) && strncmp(s1, s2, strlen(s1)) == 0); -} - -/* - * Current help file state - */ -struct help_file { - int file_state; /* 0:looking for main file, 1:found, 2:other */ - const char *p_start; /* current path pointer */ - const char *p_end; /* end of current path in path */ - char *dirname; /* directory name */ - DIR *dir; /* open directory */ - char *fname; /* current filename */ - FILE *fp; /* open file */ - char line[LINE_MAX]; /* current line */ - u_int fcnt; /* count of files found */ -}; - -struct help_pos { - off_t pos; /* file position */ - u_int fcnt; /* number of file */ - char *fname; /* name of file */ - const char *p_start; /* current path pointer */ - const char *p_end; /* end of current path in path */ -}; - -static int -help_next_file(struct help_file *hp) -{ - const char *fpat; - struct dirent *ent; - - if (hp->file_state == 3) - return (-1); - - if (hp->file_state == 0) - fpat = FILE_HELP; - else - fpat = FILE_HELP_OTHERS; - - if (hp->file_state == 0 || hp->file_state == 1) { - /* start from beginning */ - hp->p_start = PATH_HELP; - hp->file_state++; - } - - try_file: - if (hp->dir != NULL) { - /* directory open (must be state 2) */ - while ((ent = readdir(hp->dir)) != NULL) { - if (fnmatch(fpat, ent->d_name, FNM_NOESCAPE) != 0) - continue; - if (asprintf(&hp->fname, "%s/%s", hp->dirname, - ent->d_name) == -1) - err(1, NULL); - if ((hp->fp = fopen(hp->fname, "r")) != NULL) { - hp->fcnt++; - return (0); - } - free(hp->fname); - } - /* end of directory */ - closedir(hp->dir); - hp->dir = NULL; - free(hp->dirname); - goto next_path; - } - - /* nothing open - advanc to new path element */ - try_path: - for (hp->p_end = hp->p_start; *hp->p_end != '\0' && - *hp->p_end != ':'; hp->p_end++) - ; - - if (asprintf(&hp->dirname, "%.*s", (int)(hp->p_end - hp->p_start), - hp->p_start) == -1) - err(1, NULL); - - if (hp->file_state == 1) { - /* just try to open */ - if (asprintf(&hp->fname, "%s/%s", hp->dirname, fpat) == -1) - err(1, NULL); - if ((hp->fp = fopen(hp->fname, "r")) != NULL) { - hp->fcnt++; - return (0); - } - free(hp->fname); - - goto next_path; - } - - /* open directory */ - if ((hp->dir = opendir(hp->dirname)) != NULL) - goto try_file; - - free(hp->dirname); - - next_path: - hp->p_start = hp->p_end; - if (*hp->p_start == '\0') { - /* end of path */ - if (hp->file_state == 1) - errx(1, "help file not found"); - return (-1); - } - hp->p_start++; - goto try_path; - -} - -/* - * Save current file position - */ -static void -help_file_tell(struct help_file *hp, struct help_pos *pos) -{ - if (pos->fname != NULL) - free(pos->fname); - if ((pos->fname = strdup(hp->fname)) == NULL) - err(1, NULL); - pos->fcnt = hp->fcnt; - pos->p_start = hp->p_start; - pos->p_end = hp->p_end; - if ((pos->pos = ftello(hp->fp)) == -1) - err(1, "%s", pos->fname); -} - -/* - * Go to that position - * - * We can go either to the original help file or back in the current file. - */ -static void -help_file_seek(struct help_file *hp, struct help_pos *pos) -{ - hp->p_start = pos->p_start; - hp->p_end = pos->p_end; - hp->fcnt = pos->fcnt; - - if (hp->dir != NULL) { - free(hp->dirname); - closedir(hp->dir); - hp->dir = NULL; - } - - if (hp->fp != NULL &&strcmp(hp->fname, pos->fname) != 0) { - free(hp->fname); - fclose(hp->fp); - hp->fp = NULL; - } - if (hp->fp == NULL) { - if ((hp->fname = strdup(pos->fname)) == NULL) - err(1, NULL); - if ((hp->fp = fopen(hp->fname, "r")) == NULL) - err(1, "reopen %s", hp->fname); - } - if (fseeko(hp->fp, pos->pos, SEEK_SET) == -1) - err(1, "seek %s", hp->fname); - - if (pos->fcnt == 1) - /* go back to state 1 */ - hp->file_state = 1; - else - /* lock */ - hp->file_state = 3; -} - -/* - * Rewind to position 0 - */ -static void -help_file_rewind(struct help_file *hp) -{ - - if (hp->file_state == 1) { - if (fseeko(hp->fp, (off_t)0, SEEK_SET) == -1) - err(1, "rewind help file"); - return; - } - - if (hp->dir != NULL) { - free(hp->dirname); - closedir(hp->dir); - hp->dir = NULL; - } - - if (hp->fp != NULL) { - free(hp->fname); - fclose(hp->fp); - hp->fp = NULL; - } - memset(hp, 0, sizeof(*hp)); -} - -/* - * Get next line from a help file - */ -static const char * -help_next_line(struct help_file *hp) -{ - for (;;) { - if (hp->fp != NULL) { - if (fgets(hp->line, sizeof(hp->line), hp->fp) != NULL) - return (hp->line); - if (ferror(hp->fp)) - err(1, "%s", hp->fname); - free(hp->fname); - - fclose(hp->fp); - hp->fp = NULL; - } - if (help_next_file(hp) == -1) - return (NULL); - } - -} - -/* - * This function prints the available 0-level help topics from all - * other help files by scanning the files. It assumes, that this is called - * only from the main help file. - */ -static void -help_get_0topics(struct help_file *hp) -{ - struct help_pos save; - const char *line; - - memset(&save, 0, sizeof(save)); - help_file_tell(hp, &save); - - help_file_rewind(hp); - while ((line = help_next_line(hp)) != NULL) { - if (line[0] == '^' && line[1] == '^') - printf("%s", line + 2); - } - help_file_seek(hp, &save); -} - -/* - * Function to print help. The help argument is in argv[0] here. - */ -static void -help_func(int argc, char *argv[]) -{ - struct help_file hfile; - struct help_pos match, last_match; - const char *line; - char key[100]; - int level; - int i, has_sub_topics; - - memset(&hfile, 0, sizeof(hfile)); - memset(&match, 0, sizeof(match)); - memset(&last_match, 0, sizeof(last_match)); - - if (argc == 0) { - /* only 'help' - show intro */ - if ((argv[0] = strdup("intro")) == NULL) - err(1, NULL); - argc = 1; - } - - optind = 0; - match.pos = -1; - last_match.pos = -1; - for (;;) { - /* read next line */ - if ((line = help_next_line(&hfile)) == NULL) { - /* EOF */ - level = 999; - goto stop; - } - if (line[0] != '^' || line[1] == '^') - continue; - - if (sscanf(line + 1, "%d%99s", &level, key) != 2) - errx(1, "error in help file '%s'", line); - - if (level < optind) { - stop: - /* next higher level entry - stop this level */ - if (match.pos == -1) { - /* not found */ - goto not_found; - } - /* go back to the match */ - help_file_seek(&hfile, &match); - last_match = match; - memset(&match, 0, sizeof(match)); - match.pos = -1; - - /* go to next key */ - if (++optind >= argc) - break; - } - if (level == optind) { - if (substr(argv[optind], key)) { - if (match.pos != -1) { - printf("Ambiguous topic."); - goto list_topics; - } - help_file_tell(&hfile, &match); - } - } - } - - /* before breaking above we have seeked back to the matching point */ - for (;;) { - if ((line = help_next_line(&hfile)) == NULL) - break; - - if (line[0] == '#') - continue; - if (line[0] == '^') { - if (line[1] == '^') - continue; - break; - } - if (strncmp(line, "$MAIN", 5) == 0) { - help_get_0topics(&hfile); - continue; - } - printf("%s", line); - } - - exit(0); - - not_found: - printf("Topic not found."); - - list_topics: - printf(" Use one of:\natmconfig help"); - for (i = 0; i < optind; i++) - printf(" %s", argv[i]); - - printf(" ["); - - /* list all the keys at this level */ - if (last_match.pos == -1) - /* go back to start of help */ - help_file_rewind(&hfile); - else - help_file_seek(&hfile, &last_match); - - has_sub_topics = 0; - while ((line = help_next_line(&hfile)) != NULL) { - if (line[0] == '#' || line[0] != '^' || line[1] == '^') - continue; - - if (sscanf(line + 1, "%d%99s", &level, key) != 2) - errx(1, "error in help file '%s'", line); - - if (level < optind) - break; - if (level == optind) { - has_sub_topics = 1; - printf(" %s", key); - } - } - printf(" ]."); - if (!has_sub_topics) - printf(" No sub-topics found."); - printf("\n"); - exit(1); -} - -#ifdef WITH_BSNMP -/* - * Parse a server specification - * - * syntax is [trans::][community@][server][:port] - */ -static void -parse_server(char *name) -{ - char *p, *s = name; - - /* look for a double colon */ - for (p = s; *p != '\0'; p++) { - if (*p == '\\' && p[1] != '\0') { - p++; - continue; - } - if (*p == ':' && p[1] == ':') - break; - } - if (*p != '\0') { - if (p > s) { - if (p - s == 3 && strncmp(s, "udp", 3) == 0) - snmp_client.trans = SNMP_TRANS_UDP; - else if (p - s == 6 && strncmp(s, "stream", 6) == 0) - snmp_client.trans = SNMP_TRANS_LOC_STREAM; - else if (p - s == 5 && strncmp(s, "dgram", 5) == 0) - snmp_client.trans = SNMP_TRANS_LOC_DGRAM; - else - errx(1, "unknown SNMP transport '%.*s'", - (int)(p - s), s); - } - s = p + 2; - } - - /* look for a @ */ - for (p = s; *p != '\0'; p++) { - if (*p == '\\' && p[1] != '\0') { - p++; - continue; - } - if (*p == '@') - break; - } - - if (*p != '\0') { - if (p - s > SNMP_COMMUNITY_MAXLEN) - err(1, "community string too long"); - strncpy(snmp_client.read_community, s, p - s); - snmp_client.read_community[p - s] = '\0'; - strncpy(snmp_client.write_community, s, p - s); - snmp_client.write_community[p - s] = '\0'; - s = p + 1; - } - - /* look for a colon */ - for (p = s; *p != '\0'; p++) { - if (*p == '\\' && p[1] != '\0') { - p++; - continue; - } - if (*p == ':') - break; - } - - if (*p == ':') { - if (p > s) { - *p = '\0'; - snmp_client_set_host(&snmp_client, s); - *p = ':'; - } - snmp_client_set_port(&snmp_client, p + 1); - } else if (p > s) - snmp_client_set_host(&snmp_client, s); -} -#endif - -int -main(int argc, char *argv[]) -{ - int opt, i; - const struct cmdtab *match, *cc, *tab; - -#ifdef WITH_BSNMP - snmp_client_init(&snmp_client); - snmp_client.trans = SNMP_TRANS_LOC_STREAM; - snmp_client_set_host(&snmp_client, PATH_ILMI_SOCK); -#endif - -#ifdef WITH_BSNMP -#define OPTSTR "htvs:" -#else -#define OPTSTR "htv" -#endif - - while ((opt = getopt(argc, argv, OPTSTR)) != -1) - switch (opt) { - - case 'h': - help_func(0, argv); - -#ifdef WITH_BSNMP - case 's': - parse_server(optarg); - break; -#endif - - case 'v': - verbose++; - break; - - case 't': - notitle = 1; - break; - } - - if (argv[optind] == NULL) - help_func(0, argv); - - argc -= optind; - argv += optind; - - if ((main_tab = malloc(sizeof(static_main_tab))) == NULL) - err(1, NULL); - memcpy(main_tab, static_main_tab, sizeof(static_main_tab)); - -#ifdef WITH_BSNMP - /* XXX while this is compiled in */ - device_register(); -#endif - - cc = main_tab; - i = 0; - for (;;) { - /* - * Scan the table for a match - */ - tab = cc; - match = NULL; - while (cc->string != NULL) { - if (substr(argv[i], cc->string)) { - if (match != NULL) { - printf("Ambiguous option '%s'", - argv[i]); - cc = tab; - goto subopts; - } - match = cc; - } - cc++; - } - if ((cc = match) == NULL) { - printf("Unknown option '%s'", argv[i]); - cc = tab; - goto subopts; - } - - /* - * Have a match. If there is no subtable, there must - * be either a handler or the command is only a help entry. - */ - if (cc->sub == NULL) { - if (cc->func != NULL) - break; - printf("Unknown option '%s'", argv[i]); - cc = tab; - goto subopts; - } - - /* - * Look at the next argument. If it doesn't exist or it - * looks like a switch, terminate the scan here. - */ - if (argv[i + 1] == NULL || argv[i + 1][0] == '-') { - if (cc->func != NULL) - break; - printf("Need sub-option for '%s'", argv[i]); - cc = cc->sub; - goto subopts; - } - - cc = cc->sub; - i++; - } - - argc -= i + 1; - argv += i + 1; - - (*cc->func)(argc, argv); - - return (0); - - subopts: - printf(". Select one of:\n"); - while (cc->string != NULL) { - if (cc->func != NULL || cc->sub != NULL) - printf("%s ", cc->string); - cc++; - } - printf("\n"); - - return (1); -} - -void -verb(const char *fmt, ...) -{ - va_list ap; - - if (verbose) { - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - va_end(ap); - } -} - -void -heading(const char *fmt, ...) -{ - va_list ap; - - if (need_heading) { - need_heading = 0; - if (!notitle) { - va_start(ap, fmt); - fprintf(stdout, fmt, ap); - va_end(ap); - } - } -} - -void -heading_init(void) -{ - need_heading = 1; -} - -/* - * stringify an enumerated value - */ -const char * -penum(int32_t value, const struct penum *strtab, char *buf) -{ - while (strtab->str != NULL) { - if (strtab->value == value) { - strcpy(buf, strtab->str); - return (buf); - } - strtab++; - } - warnx("illegal value for enumerated variable '%d'", value); - strcpy(buf, "?"); - return (buf); -} - -/* - * And the other way 'round - */ -int -pparse(int32_t *val, const struct penum *tab, const char *str) -{ - - while (tab->str != NULL) { - if (strcmp(tab->str, str) == 0) { - *val = tab->value; - return (0); - } - tab++; - } - return (-1); -} - -/* - * Parse command line options - */ -int -parse_options(int *pargc, char ***pargv, const struct option *opts) -{ - const struct option *o, *m; - char *arg; - u_long ularg, ularg1; - long larg; - char *end; - - if (*pargc == 0) - return (-1); - arg = (*pargv)[0]; - if (arg[0] != '-' || arg[1] == '\0') - return (-1); - if (arg[1] == '-' && arg[2] == '\0') { - (*pargv)++; - (*pargc)--; - return (-1); - } - - m = NULL; - for (o = opts; o->optstr != NULL; o++) { - if (strlen(arg + 1) <= strlen(o->optstr) && - strncmp(arg + 1, o->optstr, strlen(arg + 1)) == 0) { - if (m != NULL) - errx(1, "ambiguous option '%s'", arg); - m = o; - } - } - if (m == NULL) - errx(1, "unknown option '%s'", arg); - - (*pargv)++; - (*pargc)--; - - if (m->opttype == OPT_NONE) - return (m - opts); - - if (m->opttype == OPT_SIMPLE) { - *(int *)m->optarg = 1; - return (m - opts); - } - - if (*pargc == 0) - errx(1, "option requires argument '%s'", arg); - optarg = *(*pargv)++; - (*pargc)--; - - switch (m->opttype) { - - case OPT_UINT: - ularg = strtoul(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad unsigned integer argument for '%s'", arg); - if (ularg > UINT_MAX) - errx(1, "argument to large for option '%s'", arg); - *(u_int *)m->optarg = (u_int)ularg; - break; - - case OPT_INT: - larg = strtol(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad integer argument for '%s'", arg); - if (larg > INT_MAX || larg < INT_MIN) - errx(1, "argument out of range for option '%s'", arg); - *(int *)m->optarg = (int)larg; - break; - - case OPT_UINT32: - ularg = strtoul(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad unsigned integer argument for '%s'", arg); - if (ularg > UINT32_MAX) - errx(1, "argument to large for option '%s'", arg); - *(uint32_t *)m->optarg = (uint32_t)ularg; - break; - - case OPT_INT32: - larg = strtol(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad integer argument for '%s'", arg); - if (larg > INT32_MAX || larg < INT32_MIN) - errx(1, "argument out of range for option '%s'", arg); - *(int32_t *)m->optarg = (int32_t)larg; - break; - - case OPT_UINT64: - *(uint64_t *)m->optarg = strtoull(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad unsigned integer argument for '%s'", arg); - break; - - case OPT_INT64: - *(int64_t *)m->optarg = strtoll(optarg, &end, 0); - if (*end != '\0') - errx(1, "bad integer argument for '%s'", arg); - break; - - case OPT_FLAG: - if (strcasecmp(optarg, "enable") == 0 || - strcasecmp(optarg, "yes") == 0 || - strcasecmp(optarg, "true") == 0 || - strcasecmp(optarg, "on") == 0 || - strcmp(optarg, "1") == 0) - *(int *)m->optarg = 1; - else if (strcasecmp(optarg, "disable") == 0 || - strcasecmp(optarg, "no") == 0 || - strcasecmp(optarg, "false") == 0 || - strcasecmp(optarg, "off") == 0 || - strcmp(optarg, "0") == 0) - *(int *)m->optarg = 0; - else - errx(1, "bad boolean argument to '%s'", arg); - break; - - case OPT_VCI: - ularg = strtoul(optarg, &end, 0); - if (*end == '.') { - ularg1 = strtoul(end + 1, &end, 0); - } else { - ularg1 = ularg; - ularg = 0; - } - if (*end != '\0') - errx(1, "bad VCI value for option '%s'", arg); - if (ularg > 0xff) - errx(1, "VPI value too large for option '%s'", arg); - if (ularg1 > 0xffff) - errx(1, "VCI value too large for option '%s'", arg); - ((u_int *)m->optarg)[0] = ularg; - ((u_int *)m->optarg)[1] = ularg1; - break; - - case OPT_STRING: - if (m->optarg != NULL) - *(const char **)m->optarg = optarg; - break; - - default: - errx(1, "(internal) bad option type %u for '%s'", - m->opttype, arg); - } - return (m - opts); -} - -/* - * for compiled-in modules - */ -void -register_module(const struct amodule *mod) -{ - main_tab_size++; - if ((main_tab = realloc(main_tab, main_tab_size * sizeof(main_tab[0]))) - == NULL) - err(1, NULL); - main_tab[main_tab_size - 2] = *mod->cmd; - memset(&main_tab[main_tab_size - 1], 0, sizeof(main_tab[0])); -} diff --git a/sbin/atm/atmconfig/natm.c b/sbin/atm/atmconfig/natm.c deleted file mode 100644 index cac3880e8edf..000000000000 --- a/sbin/atm/atmconfig/natm.c +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "atmconfig.h" -#include "private.h" -#include "diag.h" - -static void natm_add(int, char *[]); -static void natm_delete(int, char *[]); -static void natm_show(int, char *[]); - -const struct cmdtab natm_tab[] = { - { "add", NULL, natm_add }, - { "delete", NULL, natm_delete }, - { "show", NULL, natm_show }, - { NULL, NULL, NULL } -}; - -/* - * Structure to hold a route - */ -struct natm_route { - TAILQ_ENTRY(natm_route) link; - struct in_addr host; - struct diagif *aif; - u_int flags; - int llcsnap; - u_int vpi, vci; - u_int traffic; - u_int pcr, scr, mbs, icr, mcr; - u_int tbe, nrm, trm, adtf, rif, rdf, cdf; -}; -static TAILQ_HEAD(, natm_route) natm_route_list = - TAILQ_HEAD_INITIALIZER(natm_route_list); - -static void -store_route(struct rt_msghdr *rtm) -{ - u_int i; - struct natm_route *r; - char *cp; - struct sockaddr *sa; - struct sockaddr_in *sain; - struct sockaddr_dl *sdl; - struct diagif *aif; - u_int n; - - r = malloc(sizeof(*r)); - if (r == NULL) - err(1, "allocate route"); - - r->flags = rtm->rtm_flags; - cp = (char *)(rtm + 1); - for (i = 1; i != 0; i <<= 1) { - if (rtm->rtm_addrs & i) { - sa = (struct sockaddr *)cp; - cp += roundup(sa->sa_len, sizeof(long)); - switch (i) { - - case RTA_DST: - if (sa->sa_family != AF_INET) { - warnx("RTA_DST not AF_INET %u", sa->sa_family); - goto fail; - } - sain = (struct sockaddr_in *)(void *)sa; - if (sain->sin_len < 4) - r->host.s_addr = INADDR_ANY; - else - r->host = sain->sin_addr; - break; - - case RTA_GATEWAY: - if (sa->sa_family != AF_LINK) { - warnx("RTA_GATEWAY not AF_LINK"); - goto fail; - } - sdl = (struct sockaddr_dl *)(void *)sa; - TAILQ_FOREACH(aif, &diagif_list, link) - if (strlen(aif->ifname) == - sdl->sdl_nlen && - strncmp(aif->ifname, sdl->sdl_data, - sdl->sdl_nlen) == 0) - break; - if (aif == NULL) { - warnx("interface '%.*s' not found", - sdl->sdl_nlen, sdl->sdl_data); - goto fail; - } - r->aif = aif; - - /* parse ATM stuff */ - -#define GET3() (((sdl->sdl_data[n] & 0xff) << 16) | \ - ((sdl->sdl_data[n + 1] & 0xff) << 8) | \ - ((sdl->sdl_data[n + 2] & 0xff) << 0)) -#define GET2() (((sdl->sdl_data[n] & 0xff) << 8) | \ - ((sdl->sdl_data[n + 1] & 0xff) << 0)) -#define GET1() (((sdl->sdl_data[n] & 0xff) << 0)) - - n = sdl->sdl_nlen; - if (sdl->sdl_alen < 4) { - warnx("RTA_GATEWAY alen too short"); - goto fail; - } - r->llcsnap = GET1() & ATM_PH_LLCSNAP; - n++; - r->vpi = GET1(); - n++; - r->vci = GET2(); - n += 2; - if (sdl->sdl_alen == 4) { - /* old address */ - r->traffic = ATMIO_TRAFFIC_UBR; - r->pcr = 0; - break; - } - /* new address */ - r->traffic = GET1(); - n++; - switch (r->traffic) { - - case ATMIO_TRAFFIC_UBR: - if (sdl->sdl_alen >= 5 + 3) { - r->pcr = GET3(); - n += 3; - } else - r->pcr = 0; - break; - - case ATMIO_TRAFFIC_CBR: - if (sdl->sdl_alen < 5 + 3) { - warnx("CBR address too short"); - goto fail; - } - r->pcr = GET3(); - n += 3; - break; - - case ATMIO_TRAFFIC_VBR: - if (sdl->sdl_alen < 5 + 3 * 3) { - warnx("VBR address too short"); - goto fail; - } - r->pcr = GET3(); - n += 3; - r->scr = GET3(); - n += 3; - r->mbs = GET3(); - n += 3; - break; - - case ATMIO_TRAFFIC_ABR: - if (sdl->sdl_alen < 5 + 4 * 3 + 2 + - 1 * 2 + 3) { - warnx("ABR address too short"); - goto fail; - } - r->pcr = GET3(); - n += 3; - r->mcr = GET3(); - n += 3; - r->icr = GET3(); - n += 3; - r->tbe = GET3(); - n += 3; - r->nrm = GET1(); - n++; - r->trm = GET1(); - n++; - r->adtf = GET2(); - n += 2; - r->rif = GET1(); - n++; - r->rdf = GET1(); - n++; - r->cdf = GET1(); - n++; - break; - - default: - goto fail; - } - break; - } - } - } - - TAILQ_INSERT_TAIL(&natm_route_list, r, link); - - return; - fail: - free(r); -} - -/* - * Fetch the INET routes that a ours - */ -static void -natm_route_fetch(void) -{ - int name[6]; - size_t needed; - u_char *buf, *next; - struct rt_msghdr *rtm; - - name[0] = CTL_NET; - name[1] = PF_ROUTE; - name[2] = 0; - name[3] = AF_INET; - name[4] = NET_RT_DUMP; - name[5] = 0; - - if (sysctl(name, 6, NULL, &needed, NULL, 0) == -1) - err(1, "rtable estimate"); - needed *= 2; - if ((buf = malloc(needed)) == NULL) - err(1, "rtable buffer (%zu)", needed); - if (sysctl(name, 6, buf, &needed, NULL, 0) == -1) - err(1, "rtable get"); - - next = buf; - while (next < buf + needed) { - rtm = (struct rt_msghdr *)(void *)next; - next += rtm->rtm_msglen; - - if (rtm->rtm_type == RTM_GET) { - if ((rtm->rtm_flags & (RTF_UP | RTF_HOST | - RTF_STATIC)) == (RTF_UP | RTF_HOST | RTF_STATIC) && - (rtm->rtm_addrs & (RTA_DST | RTA_GATEWAY | - RTA_IFP)) == (RTA_DST | RTA_GATEWAY | RTA_IFP)) - store_route(rtm); - } - } -} - -static u_long -parse_num(const char *arg, const char *name, u_long limit) -{ - u_long res; - char *end; - - errno = 0; - res = strtoul(arg, &end, 10); - if (*end != '\0' || end == arg || errno != 0) - errx(1, "cannot parse %s '%s'", name, arg); - if (res > limit) - errx(1, "%s out of range (0...%lu)", name, limit); - return (res); -} - -static void -do_route(u_int type, u_int flags, const struct sockaddr_in *sain, - const struct sockaddr_dl *sdl) -{ - struct { - struct rt_msghdr h; - char space[512]; - } msg; - char *ptr; - int s; - ssize_t rlen; - - /* create routing message */ - bzero(&msg, sizeof(msg)); - msg.h.rtm_msglen = sizeof(msg.h); - msg.h.rtm_version = RTM_VERSION; - msg.h.rtm_type = type; - msg.h.rtm_index = 0; - msg.h.rtm_flags = flags; - msg.h.rtm_addrs = RTA_DST | (sdl != NULL ? RTA_GATEWAY : 0); - msg.h.rtm_pid = getpid(); - - ptr = (char *)&msg + sizeof(msg.h); - memcpy(ptr, sain, sain->sin_len); - ptr += roundup(sain->sin_len, sizeof(long)); - msg.h.rtm_msglen += roundup(sain->sin_len, sizeof(long)); - - if (sdl != NULL) { - memcpy(ptr, sdl, sdl->sdl_len); - ptr += roundup(sdl->sdl_len, sizeof(long)); - msg.h.rtm_msglen += roundup(sdl->sdl_len, sizeof(long)); - } - - /* open socket */ - s = socket(PF_ROUTE, SOCK_RAW, AF_INET); - if (s == -1) - err(1, "cannot open routing socket"); - - rlen = write(s, &msg, msg.h.rtm_msglen); - if (rlen == -1) - err(1, "writing to routing socket"); - if ((size_t)rlen != msg.h.rtm_msglen) - errx(1, "short write to routing socket: %zu %u", - (size_t)rlen, msg.h.rtm_msglen); - close(s); -} - -/* - * Add a new NATM route - */ -static void -natm_add(int argc, char *argv[]) -{ - int opt; - struct hostent *hp; - struct sockaddr_in sain; - struct sockaddr_dl sdl; - struct diagif *aif; - u_long num, num1; - u_int idx; - - static int printonly; - - static const struct option opts[] = { - { "printonly", OPT_SIMPLE, &printonly }, - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - if (argc < 5) - errx(1, "missing arguments for 'natm add'"); - - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - - /* get the IP address for */ - memset(&sain, 0, sizeof(sain)); - hp = gethostbyname(argv[0]); - if (hp == NULL) - errx(1, "bad hostname %s: %s", argv[0], hstrerror(h_errno)); - if (hp->h_addrtype != AF_INET) - errx(1, "bad address type for %s", argv[0]); - sain.sin_len = sizeof(sain); - sain.sin_family = AF_INET; - memcpy(&sain.sin_addr, hp->h_addr, sizeof(sain.sin_addr)); - - /* find interface */ - diagif_fetch(); - TAILQ_FOREACH(aif, &diagif_list, link) - if (strcmp(aif->ifname, argv[1]) == 0) - break; - if (aif == NULL) - errx(1, "unknown ATM interface '%s'", argv[1]); - sdl.sdl_index = aif->index; - strcpy(sdl.sdl_data, aif->ifname); - idx = sdl.sdl_nlen = strlen(aif->ifname); - idx++; - - /* verify VPI/VCI */ - num = parse_num(argv[2], "VPI", (1U << aif->mib.vpi_bits)); - sdl.sdl_data[idx++] = num & 0xff; - num = parse_num(argv[3], "VCI", (1U << aif->mib.vci_bits)); - if (num == 0) - errx(1, "VCI may not be 0"); - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = num & 0xff; - - /* encapsulation */ - if (strcasecmp(argv[4], "llc/snap") == 0) { - sdl.sdl_data[sdl.sdl_nlen] = ATM_PH_LLCSNAP; - } else if (strcasecmp(argv[4], "aal5") == 0) { - sdl.sdl_data[sdl.sdl_nlen] = 0; - } else - errx(1, "bad encapsulation type '%s'", argv[4]); - - /* look at the traffic */ - argc -= 5; - argv += 5; - - if (argc != 0) { - if (strcasecmp(argv[0], "ubr") == 0) { - sdl.sdl_data[idx++] = ATMIO_TRAFFIC_UBR; - if (argc == 1) - /* ok */; - else if (argc == 2) { - num = parse_num(argv[1], "PCR", aif->mib.pcr); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - } else - errx(1, "too many parameters for UBR"); - - } else if (strcasecmp(argv[0], "cbr") == 0) { - sdl.sdl_data[idx++] = ATMIO_TRAFFIC_CBR; - if (argc == 1) - errx(1, "missing PCR for CBR"); - if (argc > 2) - errx(1, "too many parameters for CBR"); - num = parse_num(argv[1], "PCR", aif->mib.pcr); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - } else if (strcasecmp(argv[0], "vbr") == 0) { - sdl.sdl_data[idx++] = ATMIO_TRAFFIC_VBR; - - if (argc < 4) - errx(1, "missing arg(s) for VBR"); - if (argc > 4) - errx(1, "too many parameters for VBR"); - - num = parse_num(argv[1], "PCR", aif->mib.pcr); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - num = parse_num(argv[2], "SCR", num); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - num = parse_num(argv[3], "MBS", 0xffffffLU); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - } else if (strcasecmp(argv[0], "abr") == 0) { - sdl.sdl_data[idx++] = ATMIO_TRAFFIC_ABR; - if (argc < 11) - errx(1, "missing arg(s) for ABR"); - if (argc > 11) - errx(1, "too many parameters for ABR"); - - num = parse_num(argv[1], "PCR", aif->mib.pcr); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num1 = parse_num(argv[2], "MCR", num); - sdl.sdl_data[idx++] = (num1 >> 16) & 0xff; - sdl.sdl_data[idx++] = (num1 >> 8) & 0xff; - sdl.sdl_data[idx++] = (num1 >> 0) & 0xff; - - num = parse_num(argv[3], "ICR", num); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - if (num < num1) - errx(1, "ICR must be >= MCR"); - - num = parse_num(argv[4], "TBE", 0xffffffUL); - sdl.sdl_data[idx++] = (num >> 16) & 0xff; - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[5], "NRM", 0x7UL); - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[6], "TRM", 0x7UL); - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[7], "ADTF", 0x3ffUL); - sdl.sdl_data[idx++] = (num >> 8) & 0xff; - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[8], "RIF", 0xfUL); - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[9], "RDF", 0xfUL); - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - num = parse_num(argv[10], "CDF", 0x7UL); - sdl.sdl_data[idx++] = (num >> 0) & 0xff; - - } else - errx(1, "bad traffic type '%s'", argv[0]); - } else - sdl.sdl_data[idx++] = ATMIO_TRAFFIC_UBR; - - sdl.sdl_alen = idx - sdl.sdl_nlen; - sdl.sdl_len += sdl.sdl_nlen + sdl.sdl_alen; - - if (printonly) { - printf("route add -iface %s -link %.*s", - inet_ntoa(sain.sin_addr), sdl.sdl_nlen, sdl.sdl_data); - for (idx = 0; idx < sdl.sdl_alen; idx++) - printf("%c%x", ".:"[idx == 0], - (u_int)sdl.sdl_data[sdl.sdl_nlen + idx] & 0xffU); - printf("\n"); - exit(0); - } - - do_route(RTM_ADD, RTF_HOST | RTF_STATIC | RTF_UP, &sain, &sdl); -} - -/* - * Delete an NATM route - */ -static void -natm_delete(int argc, char *argv[]) -{ - int opt; - struct hostent *hp; - struct sockaddr_in sain; - u_int vpi, vci; - struct diagif *aif; - struct natm_route *r; - - static int printonly; - - static const struct option opts[] = { - { "printonly", OPT_SIMPLE, &printonly }, - { NULL, 0, NULL } - }; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - diagif_fetch(); - natm_route_fetch(); - - memset(&sain, 0, sizeof(sain)); - sain.sin_len = sizeof(sain); - sain.sin_family = AF_INET; - - if (argc == 1) { - /* get the IP address for */ - hp = gethostbyname(argv[0]); - if (hp == NULL) - errx(1, "bad hostname %s: %s", argv[0], - hstrerror(h_errno)); - if (hp->h_addrtype != AF_INET) - errx(1, "bad address type for %s", argv[0]); - memcpy(&sain.sin_addr, hp->h_addr, sizeof(sain.sin_addr)); - - TAILQ_FOREACH(r, &natm_route_list, link) - if (r->host.s_addr == sain.sin_addr.s_addr) - break; - if (r == NULL) - errx(1, "no NATM route to host '%s' (%s)", argv[0], - inet_ntoa(sain.sin_addr)); - - } else if (argc == 3) { - TAILQ_FOREACH(aif, &diagif_list, link) - if (strcmp(aif->ifname, argv[0]) == 0) - break; - if (aif == NULL) - errx(1, "no such interface '%s'", argv[0]); - - vpi = parse_num(argv[1], "VPI", 0xff); - vci = parse_num(argv[2], "VCI", 0xffff); - - TAILQ_FOREACH(r, &natm_route_list, link) - if (r->aif == aif && r->vpi == vpi && r->vci == vci) - break; - if (r == NULL) - errx(1, "no such NATM route %s %u %u", argv[0], - vpi, vci); - sain.sin_addr = r->host; - - } else - errx(1, "bad number of arguments for 'natm delete'"); - - if (printonly) { - printf("route delete %s\n", inet_ntoa(r->host)); - exit(0); - } - - do_route(RTM_DELETE, r->flags, &sain, NULL); -} - -/* - * Show NATM routes - */ -static void -natm_show(int argc, char *argv[]) -{ - int opt; - struct natm_route *r; - struct hostent *hp; - - static const char *const traffics[] = { - [ATMIO_TRAFFIC_UBR] = "UBR", - [ATMIO_TRAFFIC_CBR] = "CBR", - [ATMIO_TRAFFIC_VBR] = "VBR", - [ATMIO_TRAFFIC_ABR] = "ABR" - }; - - static int numeric, abr; - - static const struct option opts[] = { - { "abr", OPT_SIMPLE, &abr }, - { "numeric", OPT_SIMPLE, &numeric }, - { NULL, 0, NULL } - }; - - static const char head[] = - "Destination Iface VPI VCI Encaps Trf PCR " - "SCR/MCR MBS/ICR\n"; - static const char head_abr[] = - "Destination Iface VPI VCI Encaps Trf PCR " - "SCR/MCR MBS/ICR TBE NRM TRM ADTF RIF RDF CDF\n"; - - while ((opt = parse_options(&argc, &argv, opts)) != -1) - switch (opt) { - } - - diagif_fetch(); - natm_route_fetch(); - - heading_init(); - TAILQ_FOREACH(r, &natm_route_list, link) { - heading(abr ? head_abr : head); - if (numeric) - printf("%-20s", inet_ntoa(r->host)); - else if (r->host.s_addr == INADDR_ANY) - printf("%-20s", "default"); - else { - hp = gethostbyaddr((char *)&r->host, sizeof(r->host), - AF_INET); - if (hp != NULL) - printf("%-20s", hp->h_name); - else - printf("%-20s", inet_ntoa(r->host)); - } - printf("%-12s%-4u%-6u%-9s%-4s", r->aif->ifname, r->vpi, r->vci, - r->llcsnap ? "LLC/SNAP" : "AAL5", traffics[r->traffic]); - switch (r->traffic) { - - case ATMIO_TRAFFIC_UBR: - case ATMIO_TRAFFIC_CBR: - printf("%-8u", r->pcr); - break; - - case ATMIO_TRAFFIC_VBR: - printf("%-8u%-8u%-8u", r->pcr, r->scr, r->mbs); - break; - - case ATMIO_TRAFFIC_ABR: - printf("%-8u%-8u%-8u", r->pcr, r->mcr, r->icr); - if (abr) - printf("%-8u%-4u%-4u%-5u%-4u%-4u%-4u", - r->tbe, r->nrm, r->trm, r->adtf, - r->rif, r->rdf, r->cdf); - break; - } - printf("\n"); - } -} diff --git a/sbin/atm/atmconfig/private.h b/sbin/atm/atmconfig/private.h deleted file mode 100644 index 9dcf53979517..000000000000 --- a/sbin/atm/atmconfig/private.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef PATH_HELP -#define PATH_HELP "/usr/share/doc/atm:/usr/local/share/doc/atm" -#endif -#ifndef FILE_HELP -#define FILE_HELP "atmconfig.help" -#endif -#ifndef FILE_HELP_OTHERS -#define FILE_HELP_OTHERS "atmconfig_*.help" -#endif -#ifndef PATH_ILMI_SOCK -#define PATH_ILMI_SOCK "/var/run/ilmid.sock" -#endif - -/* - * Builtin commands - */ -extern const struct cmdtab diag_tab[]; -extern const struct cmdtab natm_tab[]; diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index e05cce1d7149..b58d128a956a 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -144,7 +144,6 @@ MAN= aac.4 \ edsc.4 \ ehci.4 \ em.4 \ - en.4 \ enc.4 \ epair.4 \ esp.4 \ @@ -153,7 +152,6 @@ MAN= aac.4 \ etherswitch.4 \ eventtimers.4 \ exca.4 \ - fatm.4 \ fd.4 \ fdc.4 \ fdt.4 \ @@ -181,7 +179,6 @@ MAN= aac.4 \ gpioled.4 \ gre.4 \ h_ertt.4 \ - hatm.4 \ hifn.4 \ hme.4 \ hpet.4 \ @@ -307,8 +304,6 @@ MAN= aac.4 \ my.4 \ nand.4 \ nandsim.4 \ - natm.4 \ - natmip.4 \ ncr.4 \ ncv.4 \ ${_ndis.4} \ @@ -320,7 +315,6 @@ MAN= aac.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ - ng_atm.4 \ ngatmbase.4 \ ng_atmllc.4 \ ng_bpf.4 \ @@ -397,7 +391,6 @@ MAN= aac.4 \ owc.4 \ ${_padlock.4} \ pass.4 \ - patm.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ @@ -627,11 +620,9 @@ MLINKS+=disc.4 if_disc.4 MLINKS+=ed.4 if_ed.4 MLINKS+=edsc.4 if_edsc.4 MLINKS+=em.4 if_em.4 -MLINKS+=en.4 if_en.4 MLINKS+=enc.4 if_enc.4 MLINKS+=epair.4 if_epair.4 MLINKS+=et.4 if_et.4 -MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ fd.4 stdin.4 \ fd.4 stdout.4 @@ -645,7 +636,6 @@ MLINKS+=geom.4 GEOM.4 MLINKS+=gif.4 if_gif.4 MLINKS+=gpio.4 gpiobus.4 MLINKS+=gre.4 if_gre.4 -MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=hpet.4 acpi_hpet.4 MLINKS+=${_hptrr.4} ${_rr232x.4} @@ -695,7 +685,6 @@ MLINKS+=nge.4 if_nge.4 MLINKS+=${_ntb_hw.4} ${_ntb.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=ow.4 onewire.4 -MLINKS+=patm.4 if_patm.4 MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 @@ -966,7 +955,6 @@ MAN+= \ usb_template.4 \ usfs.4 \ uslcom.4 \ - utopia.4 \ uvisor.4 \ uvscom.4 \ zyd.4 diff --git a/share/man/man4/en.4 b/share/man/man4/en.4 deleted file mode 100644 index f9281fa968f7..000000000000 --- a/share/man/man4/en.4 +++ /dev/null @@ -1,78 +0,0 @@ -.\" $FreeBSD$ -.\" -.Dd July 16, 2005 -.Dt EN 4 -.Os -.Sh NAME -.Nm en -.Nd "device driver for Midway-based ATM interfaces" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device en" -.Cd "device atm" -.Cd "device utopia" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_en_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -device driver supports Midway-based ATM interfaces including the -Efficient Networks, Inc.\& ENI-155 and Adaptec ANA-59x0. -Midway is an AAL5 SAR (Segmentation and Reassembly) chip. -.Pp -For configuring the card for IP see -.Xr natmip 4 . -.Pp -The following sysctls are recognized by the driver additionally to those -handled by -.Xr utopia 4 : -.Bl -tag -width indent -.It Va hw.atm.enX.istats -Contains an array of -.Vt uint32_t -with internal driver statistics. -.It Va hw.atm.enX.debug -This is a bit map of debugging options. -This variable is only available when the driver is compiled with debugging -support. -.El -.Pp -The driver supports the media options -.Cm sdh , -.Cm noscramb -and -.Cm unassigned -(see -.Xr utopia 4 ) . -.Sh DIAGNOSTICS -.Bd -literal -en0 rev 0 int a irq 5 on pci0:16 -en0: ATM midway v0, board IDs 6.0, Utopia (pipelined), 512KB on-board RAM -en0: maximum DMA burst length = 64 bytes -en0: 7 32KB receive buffers, 8 32KB transmit buffers allocated -.Ed -.Sh SEE ALSO -.Xr natm 4 , -.Xr natmip 4 , -.Xr utopia 4 , -.Xr ifconfig 8 , -.Xr route 8 -.Sh AUTHORS -.An Chuck Cranor -of Washington University implemented -.Nm -driver in 1996 for -.Nx . -.Sh CAVEATS -The driver extensively uses DMA on PCI. -The first -generation PCI chipsets do not work or exhibit poor performance. diff --git a/share/man/man4/fatm.4 b/share/man/man4/fatm.4 deleted file mode 100644 index c59ff338b644..000000000000 --- a/share/man/man4/fatm.4 +++ /dev/null @@ -1,115 +0,0 @@ -.\" -.\" Copyright (c) 2001-2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.\" fatm(4) man page -.\" -.Dd May 15, 2003 -.Dt FATM 4 -.Os -.Sh NAME -.Nm fatm -.Nd "device driver for Fore PCA200E ATM interfaces" -.Sh SYNOPSIS -.Cd device fatm -.Cd device utopia -.Cd device atm -.Pp -.Cd options NATM -.Sh DESCRIPTION -The -.Nm -device driver supports the FORE (now Marconi) PCA200E ATM interface cards. -The driver interfaces with the -.Xr natm 4 -framework, -.Xr netgraph 4 -and HARP. -It provides only PVC services. -Signalling, ATMARP, ILMI and other -higher layer protocols are implemented using -.Xr netgraph 4 -or HARP. -.Pp -For configuring the card for IP see -.Xr natmip 4 . -The following sysctls are recognized by the driver additionally to those -handled by -.Xr utopia 4 : -.Bl -tag -width indent -.It Va hw.atm.fatm Ns Ar N Ns Va .stats -Returns a device specific statistic list of -.Vt uint32_t -statistic counters. -.It Va hw.atm.fatm Ns Ar N Ns Va .istats -Returns a list of -.Vt uint32_t -with internal driver statistics. -.It Va hw.atm.fatm Ns Ar N Ns Va .retry_tx -If this is set packets are stuffed back into the interface's send queue when -the cards transmit queue is found to be full. -They are transmitted later. -If this is not set the packets are dropped. -It may be useful to set this -if only UBR traffic is sent. -.It Va hw.atm.fatm Ns Ar N Ns Va .debug -.Bf Em -(Only if debugging enabled.) -.Ef -These are debugging flags. -See -.Pa src/sys/dev/fatm/if_fatmvar.h -for the possible flags. -.El -.Pp -The driver supports the media options -.Cm sdh , noscramb -and -.Cm unassigned -(see -.Xr utopia 4 ) . -.Sh DIAGNOSTICS -.Bd -literal -fatm0: mem 0xd5800000-0xd59fffff irq 9 at device 9.0 on pci0 -.Ed -.Sh SEE ALSO -.Xr natm 4 , -.Xr natmip 4 , -.Xr utopia 4 -.Sh AUTHORS -.An Harti Brandt Aq Mt harti@FreeBSD.org -.Sh BUGS -These cards can CBR shape a single VCC only. -It is currently possible to -request more than one CBR connection. -In this case all the timing will be -wrong. -See -.Xr hatm 4 -for a better card. diff --git a/share/man/man4/hatm.4 b/share/man/man4/hatm.4 deleted file mode 100644 index e6e1714ea3fd..000000000000 --- a/share/man/man4/hatm.4 +++ /dev/null @@ -1,282 +0,0 @@ -.\" -.\" Copyright (c) 2001-2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.\" hatm(4) man page -.\" -.Dd May 15, 2003 -.Dt HATM 4 -.Os -.Sh NAME -.Nm hatm -.Nd "device driver for Fore/Marconi HE155 and HE622 ATM interfaces" -.Sh SYNOPSIS -.Cd device hatm -.Cd device utopia -.Cd device atm -.Pp -.Cd options NATM -.Sh DESCRIPTION -The -.Nm -device driver supports the FORE (now Marconi) HE155 and HE622 ATM interface -cards. -The driver interfaces with the -.Xr natm 4 -framework, -.Xr netgraph 4 -and the HARP ATM stack. -It provides only PVC services. -Signalling, ATMARP, ILMI and other -higher layer protocols are implemented using -.Xr netgraph 4 -or HARP. -.Pp -For configuring the card for IP see -.Xr natmip 4 . -.Pp -The following sysctls are recognized by the driver additionally to those -handled by -.Xr utopia 4 : -.Bl -tag -width indent -.It Va hw.atm.hatm.natm_traffic -This is the traffic type to be used for NATM pvc connections. -The type of -this variable is integer and it must have one of the values 0 (UBR) or 1 (CBR). -.It Va hw.atm.hatm.natm_pcr -This is the peak cell rate to be used for NATM CBR connections. -.It Va hw.atm.hatm Ns Ar N Ns Va .stats -Contains an array of -.Vt uint32_t -with device specific statistics. -.It Va hw.atm.hatm Ns Ar N Ns Va .istats -Contains an array of -.Vt uint32_t -with internal driver statistics. -.It Va hw.atm.hatm Ns Ar N Ns Va .debug -.Bf Em -(Only if debugging enabled.) -.Ef -These are the debugging flags. -See -.Pa src/sys/dev/hatm/if_hatmvar.h -for the possible flags. -.It Va hw.atm.hatm Ns Ar N Ns Va .tsr -.Bf Em -(Only if debugging enabled.) -.Ef -This is an array containing all transmission status registers. -For each of the -4096 possible VCCs there are 15 32-bit registers. -.It Va hw.atm.hatm Ns Ar N Ns Va .tpd -.Bf Em -(Only if debugging enabled.) -.Ef -This is an array containing all on card current transmission packet descriptors. -For each of the 4096 possible VCCs there are 16 32-bit registers. -.It Va hw.atm.hatm Ns Ar N Ns Va .mbox -.Bf Em -(Only if debugging enabled.) -.Ef -This is an array containing the mbox registers. -.It Va hw.atm.hatm Ns Ar N Ns Va .cm -.Bf Em -(Only if debugging enabled.) -.Ef -This is an array containing all connection memory registers. -The first 32-bit integer of this array is the ABR base address. -.It Va hw.atm.hatm Ns Ar N Ns Va .heregs -.Bf Em -(Only if debugging enabled.) -.Ef -This is an array containing all card registers including SUNI and the FLASH ROM. -.It Va hw.atm.hatm Ns Ar N Ns Va .lbmem -.Bf Em -(Only if debugging enabled.) -.Ef -Returns the contents of the local memory. -.El -.Pp -The driver supports the media options -.Cm sdh , noscramb -and -.Cm unassigned -(see -.Xr utopia 4 ) . -.Sh ENVIRONMENT -When attaching to a device the driver checks the kernel environment -(see -.Xr kenv 1 ) -to see if the default queues sizes should be overwritten or not. -The -following variables are checked and interpreted as unsigned integer -values (in either radix): -.Bl -tag -width indent -.It Va hw.hatm Ns Ar N Ns Va .rbps0_size -Size of the small receive buffer pool 0. -This pool is used for all -except raw AAL connections. -The pool size must be a power of two between -4 and 8192 inclusive. -When attaching the driver allocates this number -of mbufs. -.It Va hw.hatm Ns Ar N Ns Va .rbps0_thresh -Interrupt threshold for small receive buffer pool 0. -When the number of free -buffers in the pool falls below this threshold it generates an interrupt -so that the driver can refill the pool. -.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh -Size of the large receive buffer pool 0. -This pool is used for all -except raw AAL connections. -The pool size must be a power of two between -4 and 8192 inclusive. -When attaching the driver allocates this number -of mbufs with clusters. -.It Va hw.hatm Ns Ar N Ns Va .rbpl0_thresh -Interrupt threshold for large receive buffer pool 0. -When the number of free -buffers in the pool falls below this threshold it generates an interrupt -so that the driver can refill the pool. -.It Va hw.hatm Ns Ar N Ns Va .rbrq0_size -Size of receive buffer return queue 0. -This queue is used to return buffers -filled with received frames to the driver. -The size must be a power of 2 -between 1 and 16384 inclusive. -.It Va hw.hatm Ns Ar N Ns Va .rbrq0_thresh -Interrupt threshold for receive buffer return queue 0. -This threshold -should only be triggered in exceptional cases. -.It Va hw.hatm Ns Ar N Ns Va .rbrq0_tout -Interrupt timeout for receive buffer return queue 0. -An interrupt is generated -after this time if the queue is not empty. -The number is in internal card -ticks. -.It Va hw.hatm Ns Ar N Ns Va .rbrq0_pcnt -Packet count threshold for receive buffer return queue 0. -An interrupt -is generated if this number of packets is in the queue. -.It Va hw.hatm Ns Ar N Ns Va .rbps1_size -Size of the small receive buffer pool 1. -This pool is used for all -raw AAL connections. -The pool size must be a power of two between -4 and 8192 inclusive. -When attaching the driver allocates this number -of mbufs. -.It Va hw.hatm Ns Ar N Ns Va .rbps1_thresh -Interrupt threshold for small receive buffer pool 1. -When the number of free -buffers in the pool falls below this threshold it generates an interrupt -so that the driver can refill the pool. -.It Va hw.hatm Ns Ar N Ns Va .rbrq1_size -Size of receive buffer return queue 1. -This queue is used to return buffers -filled with received cells to the driver. -The size must be a power of 2 -between 1 and 16384 inclusive. -.It Va hw.hatm Ns Ar N Ns Va .rbrq1_thresh -Interrupt threshold for receive buffer return queue 1. -This threshold -should only be triggered in exceptional cases. -.It Va hw.hatm Ns Ar N Ns Va .rbrq1_tout -Interrupt timeout for receive buffer return queue 1. -An interrupt is generated -after this time if the queue is not empty. -The number is in internal card -ticks. -.It Va hw.hatm Ns Ar N Ns Va .rbrq1_pcnt -Packet count threshold for receive buffer return queue 0. -An interrupt -is generated if this number of cells is in the queue. -.It Va hw.hatm Ns Ar N Ns Va .irq0_size -Size of interrupt queue 0. -This must be a number between 1 and 1023 inclusive. -.It Va hw.hatm Ns Ar N Ns Va .irq0_thresh -Interrupt retrigger threshold of interrupt queue 0. -A new interrupt is trigger -if the queue fill state reaches this threshold and the interrupt was no -served. -.It Va hw.hatm Ns Ar N Ns Va .tbrq0_size -Transmit buffer return queue 0 size. -This queue is used to feed back empty -buffers of transmitted frames back to the driver. -It must be a power of 2 -between 1 and 4096 inclusive. -.It Va hw.hatm Ns Ar N Ns Va .tbrq0_thresh -Transmit buffer return queue 0 threshold. -An interrupt is generated if the -queue fill state reaches this point. -.It Va hw.hatm Ns Ar N Ns Va .tpdrq_size -Transmit descriptor ready queue size. -This queue is used by the driver -to feed transmit descriptors into the card. -The size must be a power of 2 -between 1 and 16384 inclusive. -.It Va hw.hatm Ns Ar N Ns Va .tpdmax -Maximum number of active TPDs per connection. -This controls the maximum -number of outstanding packet chunks per connection and thus the maximum -delay packets can have because of queueing on the adapter. -If set to 0, -a connection can eat up all available TPDs. -.It Va hw.hatm Ns Ar N Ns Va .mbuf_max_pages -Maximum number of memory pages allocated to small external mbufs. -This must not be zero and not larger than 65536. -.El -.Sh DIAGNOSTICS -.Bd -literal -hatm0: mem 0xd2600000-0xd26fffff irq 9 at device 15.0 on pci2 -hatm0: ForeRunnerHE 622, Rev. D, S/N 2949834, MAC=00:20:48:2d:02:ca -.Ed -.Sh SEE ALSO -.Xr natm 4 , -.Xr natmip 4 , -.Xr utopia 4 , -.Xr ifconfig 8 , -.Xr route 8 -.Sh AUTHORS -.An Harti Brandt Aq Mt harti@FreeBSD.org -.Sh CAVEATS -When putting a HE155 into a 64-bit 66MHz PCI slot the machine may hang. -This occurs very early in the POST so that even the display does not turn on. -The HE155 runs only in 33MHz slots (either 32 or 64-bit). -HE622 cards work just fine in 64-bit slots. -.Pp -The driver may not work with bounce buffer, because of -.Xr bus_dmamap_sync 9 -missing the -.Fa offset -and -.Fa len -arguments the -.Nx -function has. diff --git a/share/man/man4/natm.4 b/share/man/man4/natm.4 deleted file mode 100644 index ce9fe606d636..000000000000 --- a/share/man/man4/natm.4 +++ /dev/null @@ -1,102 +0,0 @@ -.\" $FreeBSD$ -.\" -.Dd December 29, 1997 -.Dt NATM 4 -.Os -.Sh NAME -.Nm natm -.Nd Native Mode ATM protocol layer -.Sh DESCRIPTION -The -.Bx -ATM software comes with a -.Em native mode ATM protocol layer -which provides socket level access to AAL0 and AAL5 virtual circuits. -To enable this protocol layer, add -.Dl options NATM -.Dl device atm -to your kernel configuration file and re-make the kernel (do not forget -to do -.Dq make clean ) . -.Sh NATM API -The NATM layer uses a -.Vt struct sockaddr_natm -to specify a virtual circuit: -.Bd -literal -offset indent -struct sockaddr_natm { - uint8_t snatm_len; /* length */ - uint8_t snatm_family; /* AF_NATM */ - char snatm_if[IFNAMSIZ]; /* interface name */ - uint16_t snatm_vci; /* vci */ - uint8_t snatm_vpi; /* vpi */ -}; -.Ed -.Pp -To create an AAL5 connection to a virtual circuit with VPI 0, VCI 201 -one would use the following: -.Bd -literal -offset indent - struct sockaddr_natm snatm; - int s, r; - s = socket(AF_NATM, SOCK_STREAM, PROTO_NATMAAL5); - /* note: PROTO_NATMAAL0 is AAL0 */ - if (s < 0) { perror("socket"); exit(1); } - bzero(&snatm, sizeof(snatm)); - snatm.snatm_len = sizeof(snatm); - snatm.snatm_family = AF_NATM; - sprintf(snatm.snatm_if, "en0"); - snatm.snatm_vci = 201; - snatm.snatm_vpi = 0; - r = connect(s, (struct sockaddr *)&snatm, sizeof(snatm)); - if (r < 0) { perror("connect"); exit(1); } - /* s now connected to ATM! */ -.Ed -.Pp -The -.Fn socket -call simply creates an unconnected NATM socket. -The -.Fn connect -call associates an unconnected NATM socket with a -virtual circuit and tells the driver to enable that virtual circuit -for receiving data. -After the -.Fn connect -call one can -.Fn read -or -.Fn write -to the socket to perform ATM I/O. -.Sh Internal NATM operation -Internally, the NATM protocol layer keeps a list of all active virtual -circuits on the system in -.Dv natm_pcbs . -This includes circuits currently being used for IP to prevent NATM and -IP from clashing over virtual circuit usage. -.Pp -When a virtual circuit is enabled for receiving data, the NATM -protocol layer passes the address of the protocol control block down -to the driver as a receive -.Dq handle . -When inbound data arrives, the driver passes the data back with the -appropriate receive handle. -The NATM layer uses this to avoid the -overhead of a protocol control block lookup. -This allows us to take -advantage of the fact that ATM has already demultiplexed the data for -us. -.Sh SEE ALSO -.Xr en 4 , -.Xr fatm 4 , -.Xr hatm 4 , -.Xr natmip 4 , -.Xr patm 4 -.Sh AUTHORS -.An Chuck Cranor -of Washington University implemented the NATM protocol layer -along with the EN ATM driver in 1996 for -.Nx . -.Sh CAVEATS -The NATM protocol support is subject to change as -the ATM protocols develop. -Users should not depend on details of the current implementation, but rather -the services exported. diff --git a/share/man/man4/natmip.4 b/share/man/man4/natmip.4 deleted file mode 100644 index 154e97da6681..000000000000 --- a/share/man/man4/natmip.4 +++ /dev/null @@ -1,248 +0,0 @@ -.\" -.\" Copyright (c) 2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" All rights reserved. -.\" -.\" Author: Hartmut Brandt -.\" -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd August 11, 2003 -.Dt NATMIP 4 -.Os -.Sh NAME -.Nm natmip -.Nd IP over ATM PVCs -.Sh SYNOPSIS -.Cd "device atm" -.Cd "options NATM" -.Sh DESCRIPTION -The NATM protocol stack includes support for IP over ATM. -Without any -additional signalling stacks or other modules it is possible to build -a CLIP (classical IP over ATM) network based on PVCs. -.Pp -An ATM network card -.Li ( en0 -in this example) is configured for IP by something -like: -.Pp -.Dl "ifconfig en0 128.252.200.1 netmask 0xffffff00 up" -.Pp -IP routing is done with special interface routes (routes with directly -reachable destinations) with a link layer gateway address. -The link layer address specifies the ATM interface through which the -destination can be reached, the virtual channel that connects to the -destination and the ATM characteristics of this channel. -The address part of the link layer address (see -.Xr link_addr 3 ) -consists of a fixed part (the first 5 bytes) and a part that -depends on the kind of the PVC (UBR, CBR, VBR, ABR). -Multi-byte values -are big-endian encoded: the bytes with the lower numbers contain the -higher order bits. -.Bl -tag -width "bytes 12...12" -offset indent -.It byte 0 -Is a flag byte. -Currently only flag 0x20 is used. -When set, all IP frames are LLC/SNAP encapsulated before putting them into -an AAL5 frame. -Setting this flag is recommended and allows interoperability with other -CLIP implementations. -Note that BPF works only with LLC/SNAP encapsulation. -.It byte 1 -This is the VPI of the channel. -.It bytes 2...3 -VCI of the channel. -Must not be zero. -.It byte 4 -Traffic type. -One of 0 (UBR), 1 (CBR), 2 (ABR), 3 (VBR). -.El -.Pp -The variable part for UBR connections may be either empty or three bytes: -.Bl -tag -width "bytes 12...12" -offset indent -.It bytes 5...7 -Specifies the peak cell rate for UBR. -.El -.Pp -The variable part for CBR connections must be three bytes: -.Bl -tag -width "bytes 12...12" -offset indent -.It bytes 5...7 -Specifies the peak cell rate for CBR. -.El -.Pp -The variable part for VBR connections must be 9 bytes long and specifies three -values: -.Bl -tag -width "bytes 12...12" -offset indent -.It bytes 5...7 -Specifies the peak cell rate for VBR. -.It bytes 8...10 -This is the sustainable cell rate. -.It bytes 11...13 -The maximum burst size. -.El -.Pp -The variable part for ABR connections must be 19 bytes long and specifies the -following values: -.Bl -tag -width "bytes 12...12" -offset indent -.It bytes 5...7 -Specifies the peak cell rate for ABR. -.It bytes 8...10 -The minimum cell rate. -.It bytes 11...13 -The initial cell rate. -.It bytes 14...16 -The transient buffer exposure. -.It byte 17 -The NRM value. -.It byte 18 -The TRM value. -.It bytes 19...20 -The ADTF value. -.It byte 21 -The rate increase factor (RIF). -.It byte 22 -The rate decrease factor (RDF). -.It byte 23 -The cutoff decrease factor (CDF). -.El -.Pp -To add a PVC the -.Xr route 8 -utility can be used: -.Bd -ragged -offset indent -.Nm route Cm add -.Fl iface Aq Ar "remote\ IP\ address" -.Fl link Ao Ar iface Ac : Ns Aq Ar lladdr -.Ed -.Pp -The -.Ar iface -is the ATM interface through which -.Ar "remote\ IP\ address" -can be reached and -.Ar lladdr -is the link layer address as a string of dot-separated, hexadecimal bytes. -.Pp -NATM also supports the old, original format. -This consists of 4 byte -link layer addresses (and the channels are implicit UBR): -.Bl -tag -width "bytes 12...12" -offset indent -.It byte 0 -Flags: -.Bl -tag -width "0x02" -offset indent -compact -.It 0x01 -use AAL5. -.It 0x02 -if using AAL5, use an LLC/SNAP header. -.El -.Pp -Thus, parameter 3 means AAL5 and LLC/SNAP encapsulation (this is the required -setting for interworking with other CLIP clients). -Note that BPF works only with LLC/SNAP encapsulation. -.It byte 1 -VPI for the channel -.It bytes 2...3 -VCI for the channel -.El -.Sh EXAMPLES -Suppose you have 3 hosts 128.252.200.1, 128.252.200.2 and -128.252.200.3 connected by ATM through PVCs: -.Pp -.Bl -item -offset indent -compact -.It -between 128.252.200.1 and 128.252.200.2: 0xc9 UBR -.It -between 128.252.200.1 and 128.252.200.3: 0xca VBR -.It -between 128.252.200.2 and 128.252.200.3: 0xcb CBR -.El -.Pp -The parameters for the VBR channel are: PCR 50000, SCR 10000, MBS 10. -The peak cell rate for the CBR channel is 100000. -.Pp -To enable the links use the following commands: -.Pp -on host 128.252.200.1: -.Bd -literal -offset indent -compact -ifconfig en0 128.252.200.1 netmask 0xffffff00 up -route add -iface 128.252.200.2 -link en0:3.0.0.c9.0 -route add -iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a -.Ed -.Pp -on host 128.252.200.2: -.Bd -literal -offset indent -compact -ifconfig en0 128.252.200.2 netmask 0xffffff00 up -route add -iface 128.252.200.1 -link en0:3.0.0.c9.0 -route add -iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0 -.Ed -.Pp -on host 128.252.200.3: -.Bd -literal -offset indent -compact -ifconfig en0 128.252.200.3 netmask 0xffffff00 up -route add -iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a -route add -iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0 -.Ed -.Pp -This can also be done in -.Xr rc.conf 5 : -.Pp -on host 128.252.200.1: -.Bd -literal -offset indent -compact -network_interfaces="lo0 en0" -ifconfig_en0="inet 128.252.200.1 netmask 255.255.255.0" -static_routes="host2 host3" -route_host2="-iface 128.252.200.2 -link en0:3.0.0.c9.0" -route_host3="-iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a" -.Ed -.Pp -on host 128.252.200.2: -.Bd -literal -offset indent -compact -network_interfaces="lo0 en0" -ifconfig_en0="inet 128.252.200.2 netmask 255.255.255.0" -static_routes="host1 host3" -route_host1="-iface 128.252.200.1 -link en0:3.0.0.c9.0" -route_host3="-iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0" -.Ed -.Pp -on host 128.252.200.3: -.Bd -literal -offset indent -compact -network_interfaces="lo0 en0" -ifconfig_en0="inet 128.252.200.3 netmask 255.255.255.0" -static_routes="host1 host2" -route_host1="-iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a" -route_host2="-iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0" -.Ed -.Sh SEE ALSO -.Xr en 4 , -.Xr fatm 4 , -.Xr hatm 4 , -.Xr natm 4 , -.Xr patm 4 -.Sh AUTHORS -.An Chuck Cranor -of Washington University implemented the NATM protocol layer -along with the EN ATM driver in 1996 for -.Nx . diff --git a/share/man/man4/ng_atm.4 b/share/man/man4/ng_atm.4 deleted file mode 100644 index 2ac1accba386..000000000000 --- a/share/man/man4/ng_atm.4 +++ /dev/null @@ -1,406 +0,0 @@ -.\" -.\" Copyright (c) 2001-2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.\" ng_atm(4) man page -.\" -.Dd November 2, 2012 -.Dt NG_ATM 4 -.Os -.Sh NAME -.Nm ng_atm -.Nd netgraph ATM node type -.Sh SYNOPSIS -.In sys/types.h -.In net/if_atm.h -.In netgraph.h -.In netgraph/atm/ng_atm.h -.Sh DESCRIPTION -The -.Nm atm -netgraph node type allows -.Xr natm 4 -ATM drivers to be connected to the -.Xr netgraph 4 -networking subsystem. -When the -.Nm -module is loaded a node is automatically created for each -.Xr natm 4 -ATM interface. -The nodes are named with the same name as the -interface. -Nodes are also created if a driver for an ATM -card is loaded after -.Nm -was loaded. -.Pp -The -.Nm atm -nodes are persistent. -They are removed when the interface is removed. -.Dv NGM_SHUTDOWN -messages are ignored by the node. -.Sh HOOKS -Four special hooks with fixed names and an unlimited number of hooks with user -defined names are supported. -Three of the fixed hooks are attached to -strategic points in the information flow in the -.Xr natm 4 -system and support only reading. -The fourth fixed hook behaves like the other -user hooks, but a number of management messages are sent along the hook. -The other hooks can be attached to VCIs dynamically by means of -control messages to the -.Nm atm -node and can be written and read. -.Pp -The four fixed hooks are: -.Bl -tag -width ".Va orphans" -.It Va input -This is a connection to the raw input stream from the network. -If this hook is connected, all incoming packets are delivered out to -this hook. -Note that this redirects ALL input. -Neither -.Xr natm 4 -nor the user hooks will see any input if -.Va input -is connected. -An -.Vt atm_pseudohdr -(see -.Xr natm 4 ) -is prepended to the actual data. -.It Va output -This is a connection to the raw output stream to the network device. -If this hook is connected, all outgoing packets are handed over to -the netgraph system and delivered to the hook instead of being delivered -to the ATM driver. -An -.Vt atm_pseudohdr -(see -.Xr natm 4 ) -is prepended to the actual data. -.It Va orphans -This hook receives all packets that are unrecognized, i.e., do not belong to -either a -.Xr natm 4 -socket, a -.Nm -VCI or -.Xr natm 4 -IP. -Because ATM is connection oriented and packets are received on a given VCI only -when someone initiates this VCI, packets should never be orphaned. -There is -however one exception: if you use -.Xr natm 4 -IP with LLC/SNAP encapsulation packets with do not have the IP protocol -indicated in the packet header are delivered out of this hook. -An -.Vt atm_pseudohdr -(see -.Xr natm 4 ) -is prepended to the actual data send out to the hook. -.It Va manage -This hook behaves exactly like a normal user hook (see below) except that -the node at the other hand will receive management messages. -.El -.Pp -Hooks for dynamically initiated VCIs can have whatever name is allowed by -.Xr netgraph 4 -as long as the name does not collide with one of the three predefined names. -.Pp -To initiate packet sending and receiving on a dynamic hook, one has to issue -a -.Dv NGM_ATM_CPCS_INIT -control message. -To terminate sending and receiving one must send a -.Dv NGM_ATM_CPCS_TERM -message (see -.Sx CONTROL MESSAGES ) . -The data sent and received on these hooks has no additional -headers. -.Sh CONTROL MESSAGES -This node type supports the generic messages plus the following: -.Bl -tag -width 4n -.It Dv NGM_ATM_GET_IFNAME Pq Ic getifname -Return the name of the interface as a -.Dv NUL Ns --terminated string. -This is normally the same name as that of the node. -.It Dv NGM_ATM_GET_CONFIG Pq Ic getconfig -Returns a structure defining the configuration of the interface: -.Bd -literal -struct ngm_atm_config { - uint32_t pcr; /* peak cell rate */ - uint32_t vpi_bits; /* number of active VPI bits */ - uint32_t vci_bits; /* number of active VCI bits */ - uint32_t max_vpcs; /* maximum number of VPCs */ - uint32_t max_vccs; /* maximum number of VCCs */ -}; -.Ed -.It Dv NGM_ATM_GET_VCCS Pq Ic getvccs -Returns the table of open VCCs from the driver. -This table consists of -a header and a variable sized array of entries, one for each open VCC: -.Bd -literal -struct atmio_vcctable { - uint32_t count; /* number of vccs */ - struct atmio_vcc vccs[0]; /* array of VCCs */ -}; -struct atmio_vcc { - uint16_t flags; /* flags */ - uint16_t vpi; /* VPI */ - uint16_t vci; /* VCI */ - uint16_t rmtu; /* Receive maximum CPCS size */ - uint16_t tmtu; /* Transmit maximum CPCS size */ - uint8_t aal; /* aal type */ - uint8_t traffic; /* traffic type */ - struct atmio_tparam tparam; /* traffic parameters */ -}; -struct atmio_tparam { - uint32_t pcr; /* 24bit: Peak Cell Rate */ - uint32_t scr; /* 24bit: VBR Sustainable Cell Rate */ - uint32_t mbs; /* 24bit: VBR Maximum burst size */ - uint32_t mcr; /* 24bit: ABR/VBR/UBR+MCR MCR */ - uint32_t icr; /* 24bit: ABR ICR */ - uint32_t tbe; /* 24bit: ABR TBE (1...2^24-1) */ - uint8_t nrm; /* 3bit: ABR Nrm */ - uint8_t trm; /* 3bit: ABR Trm */ - uint16_t adtf; /* 10bit: ABR ADTF */ - uint8_t rif; /* 4bit: ABR RIF */ - uint8_t rdf; /* 4bit: ABR RDF */ - uint8_t cdf; /* 3bit: ABR CDF */ -}; -.Ed -.Pp -Note that this is the driver's table, so all VCCs opened via -.Xr natm 4 -sockets and IP are also shown. -They can, however, be distinguished by -their flags. -The -.Va flags -field contains the following flags: -.Pp -.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact -.It Dv ATM_PH_AAL5 -use AAL5 instead of AAL0 -.It Dv ATM_PH_LLCSNAP -if AAL5 use LLC SNAP encapsulation -.It Dv ATM_FLAG_NG -this is a netgraph VCC -.It Dv ATM_FLAG_HARP -this is a HARP VCC -.It Dv ATM_FLAG_NORX -transmit only VCC -.It Dv ATM_FLAG_NOTX -receive only VCC -.It Dv ATMIO_FLAG_PVC -treat channel as a PVC -.El -.Pp -If the -.Dv ATM_FLAG_NG -flag is set, then -.Va traffic -and -.Va tparam -contain meaningful information. -.Pp -The -.Va aal -field -contains one of the following values: -.Pp -.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact -.It Dv ATMIO_AAL_0 -AAL 0 (raw cells) -.It Dv ATMIO_AAL_34 -AAL 3 or AAL 4 -.It Dv ATMIO_AAL_5 -AAL 5 -.It Dv ATMIO_AAL_RAW -device specific raw cells -.El -.Pp -The -.Va traffic -field -can have one of the following values (not all drivers support -all traffic types however): -.Pp -.Bl -tag -width ".Dv ATM_PH_LLCSNAP" -offset indent -compact -.It Dv ATMIO_TRAFFIC_UBR -.It Dv ATMIO_TRAFFIC_CBR -.It Dv ATMIO_TRAFFIC_ABR -.It Dv ATMIO_TRAFFIC_VBR -.El -.It Dv NGM_ATM_CPCS_INIT Pq Ic cpcsinit -Initialize a VCC for sending and receiving. -The argument is a structure: -.Bd -literal -struct ngm_atm_cpcs_init { - char name[NG_HOOKSIZ]; - uint32_t flags; /* flags. (if_atm.h) */ - uint16_t vci; /* VCI to open */ - uint16_t vpi; /* VPI to open */ - uint16_t rmtu; /* receive maximum PDU */ - uint16_t tmtu; /* transmit maximum PDU */ - uint8_t aal; /* AAL type (if_atm.h) */ - uint8_t traffic; /* traffic type (if_atm.h) */ - uint32_t pcr; /* Peak cell rate */ - uint32_t scr; /* VBR: Sustainable cell rate */ - uint32_t mbs; /* VBR: Maximum burst rate */ - uint32_t mcr; /* UBR+: Minimum cell rate */ - uint32_t icr; /* ABR: Initial cell rate */ - uint32_t tbe; /* ABR: Transmit buffer exposure */ - uint8_t nrm; /* ABR: Nrm */ - uint8_t trm; /* ABR: Trm */ - uint16_t adtf; /* ABR: ADTF */ - uint8_t rif; /* ABR: RIF */ - uint8_t rdf; /* ABR: RDF */ - uint8_t cdf; /* ABR: CDF */ -}; -.Ed -.Pp -The -.Va name -field -is the name of the hook for which sending and receiving should be enabled. -This hook must already be connected. -The -.Va vpi -and -.Va vci -fields -are the respective VPI and VCI values to use for the ATM cells. -They must be -within the range, given by the -.Va maxvpi -and -.Va maxvci -fields of the -.Vt ng_atm_config -structure. -The -.Va flags -field -contains the flags (see above) and the other fields describe the -type of traffic. -.It Dv NGM_ATM_CPCS_TERM Pq Ic cpcsterm -Stop sending and receiving on the indicated hook. -The argument is a -.Bd -literal -struct ngm_atm_cpcs_term { - char name[NG_HOOKSIZ]; -}; -.Ed -.It Dv NGM_ATM_GET_STATS Pq Ic getstats -This command returns a message, containing node statistics. -The structure of the message is: -.Bd -literal -struct ngm_atm_stats { - uint64_t in_packets; - uint64_t in_errors; - uint64_t out_packets; - uint64_t out_errors; -}; -.Ed -.El -.Sh MANAGEMENT MESSAGES -If the -.Va manage -hook is connected, certain messages are sent along the hook. -They are -received by the peer node with a cookie of -.Dv NG_ATM_COOKIE . -.Bl -tag -width 4n -.It Dv NGM_ATM_VCC_CHANGE Pq Ic vcc_change -A permanent VCC has been added, deleted or changed. -This is used by -.Xr ilmid 8 -to generate the appropriate ILMI traps. -The structure of the message is: -.Bd -literal -struct ngm_atm_vcc_change { - uint32_t node; - uint16_t vci; - uint8_t vpi; - uint8_t state; -}; -.Ed -Where -.Va state -is 0 if the PVC was deleted, and 1 if it was added or modified. -.El -.Sh FLOW CONTROL -If the hardware driver supports it, the node can emit flow control messages -along a user hook. -The format of these messages is described in -.In netgraph/ng_message.h . -The -.Nm atm -node may generate -.Dv NGM_HIGH_WATER_PASSED -and -.Dv NGM_LOW_WATER_PASSED -messages. -The first one indicates that the hardware driver has stopped output -on the channel and drops new packets, the second one reports that -output was reenabled. -Currently, the structures are not filled with -information. -.Sh SHUTDOWN -The nodes are persistent as long as the corresponding interface exists. -Upon receipt of a -.Dv NGM_SHUTDOWN -messages, all hooks are disconnected and the node is reinitialized. -All -VCCs opened via -.Xr netgraph 4 -are closed. -When the ATM interface is unloaded, -the node disappears. -If the node is compiled with -.Dv NGATM_DEBUG -there is a sysctl -.Va net.graph.atm.allow_shutdown -which, when set to a non-zero value, allows the nodes to shut down. -Note that this is intended for development only and may lead to kernel -panics if set. -.Sh SEE ALSO -.Xr natm 4 , -.Xr netgraph 4 , -.Xr ng_ether 4 , -.Xr ngctl 8 -.Sh AUTHORS -.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/share/man/man4/patm.4 b/share/man/man4/patm.4 deleted file mode 100644 index 4f7a10438f43..000000000000 --- a/share/man/man4/patm.4 +++ /dev/null @@ -1,192 +0,0 @@ -.\" -.\" Copyright (c) 2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.\" patm(4) man page -.\" -.Dd July 15, 2003 -.Dt PATM 4 -.Os -.Sh NAME -.Nm patm -.Nd "device driver for IDT77252 based ATM interfaces (ProSum and IDT)" -.Sh SYNOPSIS -.Cd device patm -.Cd device utopia -.Cd device atm -.Pp -.Cd options NATM -.Cd options LIBMBPOOL -.Sh DESCRIPTION -The -.Nm -device driver supports ATM cards based on the IDT77252 chip. -It has been tested with ProSum's ProATM-155 cards and with IDT's evaluation -boards. -The driver interfaces with the -.Xr natm 4 -framework, -.Xr netgraph 4 -and HARP. -It provides only PVC services. -Signalling, ATMARP, ILMI and other -higher layer protocols are implemented using -.Xr netgraph 4 -or HARP. -.Pp -For configuring the card for IP see -.Xr natmip 4 . -.Pp -The driver supports UBR, CBR, VBR and ABR traffic. -Supported AALs are: -AAL0 (cell payloads), AAL5 and raw AAL. -The driver supports opening of VCI/VPI 0/0 in RX, raw AAL-mode. -This VC will receive all incoming cells (even those with non-zero GFC -fields and VPI/VCI values outside the allowed range) that are not -claimed by other open connections. -This may be used for monitoring purposes. -.Pp -The following sysctls are recognized by the driver additionally to those -handled by -.Xr utopia 4 : -.Bl -tag -width indent -.It Va hw.atm.patm Ns Ar N Ns Va .istats -Returns a list of -.Vt uint32_t -statistic counters with internal driver statistics. -.It Va hw.atm.patm Ns Ar N Ns Va .eeprom -This is a read-only variable containing the contents of the on-board EEPROM -device. -.It Va hw.atm.patm Ns Ar N Ns Va .lbuf_max -This puts an upper limit on the number of large receive buffers the -driver will allocate. -This is a read-only variable that can be set via a -.Xr loader 8 -tunable. -.It Va hw.atm.patm Ns Ar N Ns Va .tx_maxmaps -This is the upper limit of transmission DMA maps the driver will allocate. -This is read-only but may be set via a -.Xr loader 8 -tunable. -.It Va hw.atm.patm Ns Ar N Ns Va .debug -.Bf Em -(Only if debugging enabled.) -.Ef -These are debugging flags. -See -.Pa src/sys/dev/patm/if_patmvar.h -for the possible flags. -This may be initialized via a -.Xr loader 8 -tunable. -.It Va hw.atm.patm Ns Ar N Ns Va .regs -.Bf Em -(Only if debugging enabled.) -.Ef -Returns the current values of the card's registers. -.It Va hw.atm.patm Ns Ar N Ns Va .tsq -Returns the transmit status queue. -.El -.Pp -When loaded, the driver initializes several variables from -.Xr loader 8 -tunables: -.Bl -tag -width indent -.It Va hw.patm Ns Ar N Ns Va .lbuf_max -This initializes the corresponding -.Xr sysctl 8 -variable and defines an upper -limit on the number of large receive buffers (mbuf clusters). -.It Va hw.patm Ns Ar N Ns Va .tx_maxmaps -This initializes the corresponding -.Xr sysctl 8 -variable and is the maximum -number of DMA maps for transmission that the driver will allocated. -.It Va hw.patm Ns Ar N Ns Va .debug -.Bf Em -(Only if debugging enabled.) -.Ef -Initializes the debugging flags. -.El -.Pp -The driver supports the media options -.Cm sdh , noscramb -and -.Cm unassigned -(see -.Xr utopia 4 ) -when the card is a 155MBit card. -Both PMC-Sierra S/UNI and IDT77155 PHY chips are supported for these cards. -For 25MBit cards the IDT77105 is supported. -.Sh DIAGNOSTICS -.Bd -literal -patm1: port 0xc000-0xc0ff mem 0xf8000000-0xf83fffff,0xf4000000-0xf4000fff irq 11 at device 8.0 on pci2 -patm1: IDT77252 155MBit interface; idt77252 Rev. G; IDT77155 PHY -patm1: 128K x 32 SRAM; 4096 connections -.Ed -.Sh SEE ALSO -.Xr natm 4 , -.Xr natmip 4 , -.Xr utopia 4 -.Sh ACKNOWLEDGEMENTS -Thanks to Christian Bucari from ProSum for lending two of these cards to enable -the development of this driver. -Thanks also for answering my questions. -.Sh AUTHORS -.An Harti Brandt Aq Mt harti@FreeBSD.org -.Sh CAVEATS -The card fails to generate an interrupt if a cell is received in AAL0 mode -that has the MSB of the PTI field cleared. -Therefore cells will be delivered on the next receive interrupt which can happen -either when the receive status queue is full, or a cell with the last bit of -the PTI set is received. -.Pp -Although the card supports AAL3/4 the driver does not. -.Pp -The rate tables used by this driver are not the tables recommended by IDT -(they are wrong anyway). -The driver's tables are slightly more aggressive than IDT's. -That means, that the actual cell rate can be slightly higher than the -specified. -This is in contrast to the IDT tables where cell rates 5% less than the -allowed one have been observed. -This can be changed by changing the program that generates these tables, -found in -.Pa /usr/src/sys/dev/patm/genrtab , -and regenerating them. -.Pp -The reported media for the 155MBit cards will always be OC3/MM, because -there is no (known to me) way to figure out the actual medium. -The medium should really be coded in the EEPROM by the manufacturer. -.Pp -The Tx cell counter in the utopia statistics is wrong, because the chip -uses idle cells for spacing and the PHY counts these cells. -While there is a configuration option for the chip to switch of these cells -and, according to the documentation, this should not influence cell spacing, -it does, so the driver lets the chip generate idle cells. diff --git a/share/man/man4/utopia.4 b/share/man/man4/utopia.4 deleted file mode 100644 index b3c0e5b9c2f0..000000000000 --- a/share/man/man4/utopia.4 +++ /dev/null @@ -1,196 +0,0 @@ -.\" Copyright (c) 2003 -.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus). -.\" 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 AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" Author: Hartmut Brandt -.\" -.\" $FreeBSD$ -.\" -.Dd November 22, 2006 -.Dt UTOPIA 4 -.Os -.Sh NAME -.Nm utopia -.Nd "driver module for ATM PHY chips" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device utopia" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -utopia_load="YES" -.Ed -.Sh DESCRIPTION -This module is used by all ATM drivers for cards that use -PMC-Sierra S/Uni and IDT77105/IDT77155 -chips to provide uniform functionality. -The module implements status monitoring -in either interrupt or polling mode, media option handling and application -access to chip registers. -.Pp -The driver implements several sysctls that are accessible under the -.Va hw.atm. Ns Ao Ar iface Ac Ns Va .\& -tree, where -.Ar iface -is the name of the ATM interface: -.Bl -tag -width indent -.It Va phy_regs -When reading this sysctl an array of 8-bit unsigned integers is returned -containing all accessible chip registers starting at register 0. -A register can be written by writing three 8-bit unsigned integers to the -sysctl: the register number, the new value and a bit mask. -This changes all bits in the register for which the corresponding bit in the -mask is one to the bit values from value. -Note that not all registers may -be writeable. -.It Va phy_loopback -allows to put the interface in one of several loopback modes. -Not all modes and all combinations of modes are supported on all chips. -The possible modes are: -.Bl -tag -width indent -.It Dv UTP_LOOP_NONE Pq No 0x00 -No loopback, normal operation. -.It Dv UTP_LOOP_TIME Pq No 0x01 -Timing source loopback. -When this is set the transmitter's clock is -derived from the receiver's clock. -.It Dv UTP_LOOP_DIAG Pq No 0x02 -Diagnostic loopback. -In this mode the receiver's input is connected to the -transmitter's output. -The receiver gets back everything that is sent. -The -transmitter operates normally. -.It Dv UTP_LOOP_LINE Pq No 0x04 -Serial line loopback. -This connects the line receiver to the line transmitter. -The chip transmits all cells back that it receives. -The receiver operates -normally. -.It Dv UTP_LOOP_PARAL Pq No 0x08 -Parallel diagnostic loopback. -This feeds back all transmitted cells into the -receiver between the parallel/serial converters. -The transmitter -operates normally. -.It Dv UTP_LOOP_TWIST Pq No 0x10 -Twisted pair diagnostic loopback. -Connects the high speed receive data to the -high speed transmit data. -All received data is sent back. -The receiver -operates normally. -.It Dv UTP_LOOP_PATH Pq No 0x20 -Diagnostic path loopback. -This connects the receiver input to the transmitter -output just between the path overhead processor and the byte mux. -The -transmitter operates normally. -.El -.It Va phy_type -This is the detected type of the phy chip. -Currently the following chips are -supported: -.Bl -tag -width indent -.It Dv UTP_TYPE_UNKNOWN Pq No 0 -The module could not determine the type of the PHY chip. -.It Dv UTP_TYPE_SUNI_LITE Pq No 1 -PMC-5346 (S/Uni-Lite) -.It Dv UTP_TYPE_SUNI_ULTRA Pq No 2 -PMC-5350 (S/Uni-Ultra) -.It Dv UTP_TYPE_SUNI_622 Pq No 3 -PMC-5355 (S/Uni-622) -.It Dv UTP_TYPE_IDT77105 Pq No 4 -IDT77105 (25.6MBit UTP interface) -.It Dv UTP_TYPE_IDT77155 Pq No 5 -IDT77155 (155MBit interface) -.El -.It Va phy_name -This is a string describing the type of the PHY chip. -.It Va phy_stats -Physical and some ATM layer statistics. -These are the statistics usually -provided by the chip. -The data is a returned in the following structure: -.Bd -literal -struct utopia_stats1 { - uint32_t version; /* version of this struct */ - uint32_t fill; - uint64_t rx_sbip; /* rx section BIP errors */ - uint64_t rx_lbip; /* rx line BIP errors */ - uint64_t rx_lfebe; /* rx line far end block errors */ - uint64_t rx_pbip; /* rx path BIP errors */ - uint64_t rx_pfebe; /* rx path far end block errors */ - uint64_t rx_cells; /* received cells */ - uint64_t rx_corr; /* correctable cell errors */ - uint64_t rx_uncorr; /* uncorrectable cell errors */ - uint64_t rx_symerr; /* symbol errors */ - uint64_t tx_cells; /* transmitted cells */ -}; -.Ed -.Pp -The current version is 1. -The statistics are updated from the chip once -a second. -On overflow the counters wrap to zero. -Note that not all counters -are meaningful for all PHY chips. -The statistics are cleared by writing an -arbitrary new value (the value is ignored). -.El -.Pp -The -.Nm -module also interfaces with the ifmedia system. -The module reports the current state of the carrier and will issue a -warning message when the carrier state changes. -While the physical media itself cannot be changed, several media options can: -.Bl -tag -width indent -.It Cm SDH -If the PHY is a Sonet/SDH chip this flag switches the interface into SDH mode. -If this option is not set (the default) the interface is in Sonet mode. -.It Cm noscramb -If the PHY is a Sonet/SDH chip disable scrambling. -This may be useful for debugging purposes. -.It Cm unassigned -Normally the interface emits idle cells when there are no other cells to -transmit. -This changes the default cell type to unassigned cells. -This -may be needed for interworking with public networks. -.El -.Sh SEE ALSO -.Xr en 4 , -.Xr fatm 4 , -.Xr hatm 4 , -.Xr patm 4 , -.Xr utopia 9 -.Sh AUTHORS -.An Harti Brandt Aq Mt harti@FreeBSD.org diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index da94e584214c..da067a579e2d 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -327,16 +327,13 @@ if_de_load="NO" # DEC DC21x4x Ethernet if_ed_load="NO" # National Semiconductor DS8390/WD83C690 # Ethernet if_em_load="NO" # Intel(R) PRO/1000 Gigabit Ethernet -if_en_load="NO" # Midway-based ATM interfaces if_ep_load="NO" # 3Com Etherlink III (3c5x9) if_et_load="NO" # Agere ET1310 10/100/Gigabit Ethernet if_ex_load="NO" # Intel EtherExpress Pro/10 Ethernet -if_fatm_load="NO" # Fore PCA200E ATM if_fe_load="NO" # Fujitsu MB86960A/MB86965A based Ethernet # adapters if_fxp_load="NO" # Intel EtherExpress PRO/100B (82557, 82558) if_gem_load="NO" # Sun GEM/Sun ERI/Apple GMAC -if_hatm_load="NO" # Fore/Marconi HE155 and HE622 if_hme_load="NO" # Sun Microelectronics STP2002-STQ Ethernet if_ie_load="NO" # Intel 82586 if_ipw_load="NO" # Intel PRO/Wireless 2100 wireless @@ -360,7 +357,6 @@ if_my_load="NO" # Myson PCI Fast Ethernet if_nfe_load="NO" # NVIDIA nForce MCP Networking Adapter if_nge_load="NO" # National Semiconductor PCI Gigabit Ethernet if_nxge_load="NO" # Neterion Xframe 10Gb Ethernet -if_patm_load="NO" # IDT77252 ATM if_pcn_load="NO" # AMD PCnet PCI if_ral_load="NO" # Ralink Technology wireless if_re_load="NO" # RealTek 8139C+/8169/8169S/8110S @@ -395,7 +391,6 @@ if_wpi_load="NO" # Intel 3945ABG Wireless LAN IEEE 802.11 if_xe_load="NO" # Xircom CreditCard PCMCIA if_xl_load="NO" # 3Com Etherlink XL (3c900, 3c905, 3c905B) sfxge_load="NO" # Solarflare 10Gb Ethernet adapter driver -utopia_load="NO" # ATM PHY driver ############################################################## diff --git a/sys/conf/NOTES b/sys/conf/NOTES index fa7c74b33909..87257b6110dc 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2212,42 +2212,7 @@ device rtwnfw options MCLSHIFT=12 # mbuf cluster shift in bits, 12 == 4KB options MSIZE=512 # mbuf size in bytes -# -# ATM related options (Cranor version) -# (note: this driver cannot be used with the HARP ATM stack) -# -# The `en' device provides support for Efficient Networks (ENI) -# ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). -# -# The `hatm' device provides support for Fore/Marconi HE155 and HE622 -# ATM PCI cards. -# -# The `fatm' device provides support for Fore PCA200E ATM PCI cards. -# -# The `patm' device provides support for IDT77252 based cards like -# ProSum's ProATM-155 and ProATM-25 and IDT's evaluation boards. -# -# atm device provides generic atm functions and is required for -# atm devices. -# NATM enables the netnatm protocol family that can be used to -# bypass TCP/IP. -# -# utopia provides the access to the ATM PHY chips and is required for en, -# hatm and fatm. -# -# the current driver supports only PVC operations (no atm-arp, no multicast). -# for more details, please read the original documents at -# http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html -# -device atm -device en -device fatm #Fore PCA200E -device hatm #Fore/Marconi HE155/622 -device patm #IDT77252 cards (ProATM and IDT) -device utopia #ATM PHY driver -options NATM #native ATM - -options LIBMBPOOL #needed by patm, iatm +options LIBMBPOOL # # Sound drivers diff --git a/sys/conf/config.mk b/sys/conf/config.mk index 9fc37ffaf545..ef4b8820d947 100644 --- a/sys/conf/config.mk +++ b/sys/conf/config.mk @@ -25,8 +25,6 @@ opt_ratelimit.h: .endif opt_mrouting.h: echo "#define MROUTING 1" > ${.TARGET} -opt_natm.h: - echo "#define NATM 1" > ${.TARGET} opt_printf.h: echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET} opt_scsi.h: @@ -38,7 +36,7 @@ opt_wlan.h: KERN_OPTS.i386=NEW_PCIB DEV_PCI KERN_OPTS.amd64=NEW_PCIB DEV_PCI KERN_OPTS.powerpc=NEW_PCIB DEV_PCI -KERN_OPTS=MROUTING NATM IEEE80211_DEBUG \ +KERN_OPTS=MROUTING IEEE80211_DEBUG \ IEEE80211_AMPDU_AGE IEEE80211_SUPPORT_MESH DEV_BPF \ ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} .if ${MK_INET_SUPPORT} != "no" diff --git a/sys/conf/files b/sys/conf/files index 161ca682880b..332d0e6364f5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1579,8 +1579,6 @@ dev/e1000/e1000_mbx.c optional em \ dev/e1000/e1000_osdep.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/et/if_et.c optional et -dev/en/if_en_pci.c optional en pci -dev/en/midway.c optional en dev/ep/if_ep.c optional ep dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_pccard.c optional ep pccard @@ -1636,7 +1634,6 @@ dev/extres/regulator/regnode_if.m optional ext_resources regulator fdt dev/extres/regulator/regulator.c optional ext_resources regulator fdt dev/extres/regulator/regulator_bus.c optional ext_resources regulator fdt dev/extres/regulator/regulator_fixed.c optional ext_resources regulator fdt -dev/fatm/if_fatm.c optional fatm pci dev/fb/fbd.c optional fbd | vt dev/fb/fb_if.m standard dev/fb/splash.c optional sc splash @@ -1688,11 +1685,6 @@ dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps dev/gpio/ofw_gpiobus.c optional fdt gpio -dev/hatm/if_hatm.c optional hatm pci -dev/hatm/if_hatm_intr.c optional hatm pci -dev/hatm/if_hatm_ioctl.c optional hatm pci -dev/hatm/if_hatm_rx.c optional hatm pci -dev/hatm/if_hatm_tx.c optional hatm pci dev/hifn/hifn7751.c optional hifn dev/hme/if_hme.c optional hme dev/hme/if_hme_pci.c optional hme pci @@ -2374,13 +2366,6 @@ dev/ow/owll_if.m optional ow dev/ow/own_if.m optional ow dev/ow/ow_temp.c optional ow_temp dev/ow/owc_gpiobus.c optional owc gpio -dev/patm/if_patm.c optional patm pci -dev/patm/if_patm_attach.c optional patm pci -dev/patm/if_patm_intr.c optional patm pci -dev/patm/if_patm_ioctl.c optional patm pci -dev/patm/if_patm_rtables.c optional patm pci -dev/patm/if_patm_rx.c optional patm pci -dev/patm/if_patm_tx.c optional patm pci dev/pbio/pbio.c optional pbio isa dev/pccard/card_if.m standard dev/pccard/pccard.c optional pccard @@ -3202,9 +3187,6 @@ dev/videomode/videomode.c optional videomode dev/videomode/edid.c optional videomode dev/videomode/pickmode.c optional videomode dev/videomode/vesagtf.c optional videomode -dev/utopia/idtphy.c optional utopia -dev/utopia/suni.c optional utopia -dev/utopia/utopia.c optional utopia dev/vge/if_vge.c optional vge dev/viapm/viapm.c optional viapm pci dev/virtio/virtio.c optional virtio @@ -3884,7 +3866,6 @@ net/flowtable.c optional flowtable inet | flowtable inet6 net/ieee8023ad_lacp.c optional lagg net/if.c standard net/if_arcsubr.c optional arcnet -net/if_atmsubr.c optional atm net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard @@ -3981,7 +3962,6 @@ net80211/ieee80211_xauth.c optional wlan wlan_xauth net80211/ieee80211_alq.c optional wlan ieee80211_alq netgraph/atm/ccatm/ng_ccatm.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" -netgraph/atm/ng_atm.c optional ngatm_atm netgraph/atm/ngatmbase.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/sscfu/ng_sscfu.c optional ngatm_sscfu \ @@ -4063,7 +4043,6 @@ netgraph/ng_vlan.c optional netgraph_vlan netinet/accf_data.c optional accept_filter_data inet netinet/accf_dns.c optional accept_filter_dns inet netinet/accf_http.c optional accept_filter_http inet -netinet/if_atm.c optional atm netinet/if_ether.c optional inet ether netinet/igmp.c optional inet netinet/in.c optional inet @@ -4188,9 +4167,6 @@ netipsec/xform_ipcomp.c optional ipsec inet | ipsec inet6 netipsec/xform_tcp.c optional ipsec inet tcp_signature | \ ipsec inet6 tcp_signature | ipsec_support inet tcp_signature | \ ipsec_support inet6 tcp_signature -netnatm/natm.c optional natm -netnatm/natm_pcb.c optional natm -netnatm/natm_proto.c optional natm netpfil/ipfw/dn_aqm_codel.c optional inet dummynet netpfil/ipfw/dn_aqm_pie.c optional inet dummynet netpfil/ipfw/dn_heap.c optional inet dummynet diff --git a/sys/conf/options b/sys/conf/options index c63826acbc03..847c7b916a40 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -553,10 +553,6 @@ DRM_DEBUG opt_drm.h TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h -# XXX Conflict: # of devices vs network protocol (Native ATM). -# This makes "atm.h" unusable. -NATM - # DPT driver debug flags DPT_MEASURE_PERFORMANCE opt_dpt.h DPT_RESET_HBA opt_dpt.h diff --git a/sys/dev/en/if_en_pci.c b/sys/dev/en/if_en_pci.c deleted file mode 100644 index d164dc49f943..000000000000 --- a/sys/dev/en/if_en_pci.c +++ /dev/null @@ -1,496 +0,0 @@ -/* $NetBSD: if_en_pci.c,v 1.1 1996/06/22 02:00:31 chuck Exp $ */ -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * i f _ e n _ p c i . c - * - * author: Chuck Cranor - * started: spring, 1996. - * - * FreeBSD PCI glue for the eni155p card. - * thanks to Matt Thomas for figuring out FreeBSD vs NetBSD vs etc.. diffs. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -MODULE_DEPEND(en, pci, 1, 1, 1); -MODULE_DEPEND(en, atm, 1, 1, 1); -MODULE_DEPEND(en, utopia, 1, 1, 1); - -/* - * local structures - */ -struct en_pci_softc { - /* bus independent stuff */ - struct en_softc esc; /* includes "device" structure */ - - /* freebsd newbus glue */ - struct resource *res; /* resource descriptor for registers */ - struct resource *irq; /* resource descriptor for interrupt */ - void *ih; /* interrupt handle */ -}; - -static void eni_get_macaddr(device_t, struct en_pci_softc *); -static void adp_get_macaddr(struct en_pci_softc *); - -/* - * address of config base memory address register in PCI config space - * (this is card specific) - */ -#define PCI_CBMA PCIR_BAR(0) - -/* - * tonga (pci bridge). ENI cards only! - */ -#define EN_TONGA 0x60 /* PCI config addr of tonga reg */ - -#define TONGA_SWAP_DMA 0x80 /* endian swap control */ -#define TONGA_SWAP_BYTE 0x40 -#define TONGA_SWAP_WORD 0x20 -#define TONGA_READ_MULT 0x00 -#define TONGA_READ_MEM 0x04 -#define TONGA_READ_IVAN 0x08 -#define TONGA_READ_KEN 0x0C - -/* - * adaptec pci bridge. ADP cards only! - */ -#define ADP_PCIREG 0x050040 /* PCI control register */ - -#define ADP_PCIREG_RESET 0x1 /* reset card */ -#define ADP_PCIREG_IENABLE 0x2 /* interrupt enable */ -#define ADP_PCIREG_SWAP_WORD 0x4 /* swap byte on slave access */ -#define ADP_PCIREG_SWAP_DMA 0x8 /* swap byte on DMA */ - -#define PCI_VENDOR_EFFICIENTNETS 0x111a /* Efficent Networks */ -#define PCI_PRODUCT_EFFICIENTNETS_ENI155PF 0x0000 /* ENI-155P ATM */ -#define PCI_PRODUCT_EFFICIENTNETS_ENI155PA 0x0002 /* ENI-155P ATM */ -#define PCI_VENDOR_ADP 0x9004 /* adaptec */ -#define PCI_PRODUCT_ADP_AIC5900 0x5900 -#define PCI_PRODUCT_ADP_AIC5905 0x5905 -#define PCI_VENDOR(x) ((x) & 0xFFFF) -#define PCI_CHIPID(x) (((x) >> 16) & 0xFFFF) - -/* - * bus specific reset function [ADP only!] - */ -static void -adp_busreset(void *v) -{ - struct en_softc *sc = (struct en_softc *)v; - uint32_t dummy; - - bus_space_write_4(sc->en_memt, sc->en_base, ADP_PCIREG, - ADP_PCIREG_RESET); - DELAY(1000); /* let it reset */ - dummy = bus_space_read_4(sc->en_memt, sc->en_base, ADP_PCIREG); - bus_space_write_4(sc->en_memt, sc->en_base, ADP_PCIREG, - (ADP_PCIREG_SWAP_DMA | ADP_PCIREG_IENABLE)); - dummy = bus_space_read_4(sc->en_memt, sc->en_base, ADP_PCIREG); - if ((dummy & (ADP_PCIREG_SWAP_WORD | ADP_PCIREG_SWAP_DMA)) != - ADP_PCIREG_SWAP_DMA) - device_printf(sc->dev, "%s: Adaptec ATM did NOT reset!\n", - __func__); -} - -/***********************************************************************/ - -/* - * autoconfig stuff - */ -static int -en_pci_probe(device_t dev) -{ - - switch (pci_get_vendor(dev)) { - - case PCI_VENDOR_EFFICIENTNETS: - switch (pci_get_device(dev)) { - - case PCI_PRODUCT_EFFICIENTNETS_ENI155PF: - case PCI_PRODUCT_EFFICIENTNETS_ENI155PA: - device_set_desc(dev, "Efficient Networks ENI-155p"); - return (BUS_PROBE_DEFAULT); - } - break; - - case PCI_VENDOR_ADP: - switch (pci_get_device(dev)) { - - case PCI_PRODUCT_ADP_AIC5900: - case PCI_PRODUCT_ADP_AIC5905: - device_set_desc(dev, "Adaptec 155 ATM"); - return (BUS_PROBE_DEFAULT); - } - break; - } - return (ENXIO); -} - -static int -en_pci_attach(device_t dev) -{ - struct en_softc *sc; - struct en_pci_softc *scp; - int rid, error = 0; - - sc = device_get_softc(dev); - scp = (struct en_pci_softc *)sc; - sc->dev = dev; - sc->ifp = if_alloc(IFT_ATM); - if (sc->ifp == NULL) { - device_printf(dev, "can not if_alloc()\n"); - error = ENOSPC; - goto fail; - } - - if_initname(sc->ifp, device_get_name(dev), - device_get_unit(dev)); - - /* - * Enable bus mastering. - */ - pci_enable_busmaster(dev); - - /* - * Map control/status registers. - */ - rid = PCI_CBMA; - scp->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (scp->res == NULL) { - device_printf(dev, "could not map memory\n"); - if_free(sc->ifp); - error = ENXIO; - goto fail; - } - - sc->en_memt = rman_get_bustag(scp->res); - sc->en_base = rman_get_bushandle(scp->res); - - /* - * Allocate our interrupt. - */ - rid = 0; - scp->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); - if (scp->irq == NULL) { - device_printf(dev, "could not map interrupt\n"); - bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res); - if_free(sc->ifp); - error = ENXIO; - goto fail; - } - - sc->ipl = 1; /* XXX (required to enable interrupt on midway) */ - - /* figure out if we are an adaptec card or not */ - sc->is_adaptec = (pci_get_vendor(dev) == PCI_VENDOR_ADP) ? 1 : 0; - - /* - * set up pci bridge - */ - if (sc->is_adaptec) { - adp_get_macaddr(scp); - sc->en_busreset = adp_busreset; - adp_busreset(sc); - } else { - eni_get_macaddr(dev, scp); - sc->en_busreset = NULL; - pci_write_config(dev, EN_TONGA, TONGA_SWAP_DMA | TONGA_READ_IVAN, 4); - } - - /* - * Common attach stuff - */ - if ((error = en_attach(sc)) != 0) { - device_printf(dev, "attach failed\n"); - bus_teardown_intr(dev, scp->irq, scp->ih); - bus_release_resource(dev, SYS_RES_IRQ, 0, scp->irq); - bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res); - if_free(sc->ifp); - goto fail; - } - - /* - * Do the interrupt SETUP last just before returning - */ - error = bus_setup_intr(dev, scp->irq, INTR_TYPE_NET, - NULL, en_intr, sc, &scp->ih); - if (error) { - en_reset(sc); - atm_ifdetach(sc->ifp); - device_printf(dev, "could not setup irq\n"); - bus_release_resource(dev, SYS_RES_IRQ, 0, scp->irq); - bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res); - en_destroy(sc); - if_free(sc->ifp); - goto fail; - } - - return (0); - - fail: - return (error); -} - -/* - * Detach the adapter - */ -static int -en_pci_detach(device_t dev) -{ - struct en_softc *sc = device_get_softc(dev); - struct en_pci_softc *scp = (struct en_pci_softc *)sc; - - /* - * Stop DMA and drop transmit queue. - */ - if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - device_printf(sc->dev, "still running\n"); - sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - } - - /* - * Close down routes etc. - */ - en_reset(sc); - atm_ifdetach(sc->ifp); - - /* - * Deallocate resources. - */ - bus_teardown_intr(dev, scp->irq, scp->ih); - bus_release_resource(dev, SYS_RES_IRQ, 0, scp->irq); - bus_release_resource(dev, SYS_RES_MEMORY, PCI_CBMA, scp->res); - - /* - * Free all the driver internal resources - */ - en_destroy(sc); - if_free(sc->ifp); - - return (0); -} - -static int -en_pci_shutdown(device_t dev) -{ - struct en_pci_softc *psc = device_get_softc(dev); - - en_reset(&psc->esc); - DELAY(10); /* is this necessary? */ - - return (0); -} - -/* - * Get the MAC address from an Adaptec board. No idea how to get - * serial number or other stuff, because I have no documentation for that - * card. - */ -static void -adp_get_macaddr(struct en_pci_softc *scp) -{ - struct en_softc * sc = (struct en_softc *)scp; - int lcv; - - for (lcv = 0; lcv < sizeof(IFP2IFATM(sc->ifp)->mib.esi); lcv++) - IFP2IFATM(sc->ifp)->mib.esi[lcv] = bus_space_read_1(sc->en_memt, - sc->en_base, MID_ADPMACOFF + lcv); -} - -/* - * Read station (MAC) address from serial EEPROM. - * derived from linux drivers/atm/eni.c by Werner Almesberger, EPFL LRC. - */ -#define EN_PROM_MAGIC 0x0c -#define EN_PROM_DATA 0x02 -#define EN_PROM_CLK 0x01 -#define EN_ESI 64 -#define EN_SERIAL 112 - -/* - * Read a byte from the given address in the EEPROM - */ -static uint8_t -eni_get_byte(device_t dev, uint32_t *data, u_int address) -{ - int j; - uint8_t tmp; - - address = (address << 1) + 1; - - /* start operation */ - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data &= ~EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data &= ~EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - /* send address with serial line */ - for ( j = 7 ; j >= 0 ; j --) { - *data = ((address >> j) & 1) ? (*data | EN_PROM_DATA) : - (*data & ~EN_PROM_DATA); - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data &= ~EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - } - /* get ack */ - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data = pci_read_config(dev, EN_TONGA, 4); - *data &= ~EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - - tmp = 0; - - for ( j = 7 ; j >= 0 ; j --) { - tmp <<= 1; - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data = pci_read_config(dev, EN_TONGA, 4); - if(*data & EN_PROM_DATA) tmp |= 1; - *data &= ~EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - } - /* get ack */ - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data = pci_read_config(dev, EN_TONGA, 4); - *data &= ~EN_PROM_CLK ; - pci_write_config(dev, EN_TONGA, *data, 4); - *data |= EN_PROM_DATA ; - pci_write_config(dev, EN_TONGA, *data, 4); - - return (tmp); -} - -/* - * Get MAC address and other stuff from the EEPROM - */ -static void -eni_get_macaddr(device_t dev, struct en_pci_softc *scp) -{ - struct en_softc * sc = (struct en_softc *)scp; - int i; - uint32_t data, t_data; - - t_data = pci_read_config(dev, EN_TONGA, 4) & 0xffffff00; - - data = EN_PROM_MAGIC | EN_PROM_DATA | EN_PROM_CLK; - pci_write_config(dev, EN_TONGA, data, 4); - - for (i = 0; i < sizeof(IFP2IFATM(sc->ifp)->mib.esi); i ++) - IFP2IFATM(sc->ifp)->mib.esi[i] = eni_get_byte(dev, &data, i + EN_ESI); - - IFP2IFATM(sc->ifp)->mib.serial = 0; - for (i = 0; i < 4; i++) { - IFP2IFATM(sc->ifp)->mib.serial <<= 8; - IFP2IFATM(sc->ifp)->mib.serial |= eni_get_byte(dev, &data, i + EN_SERIAL); - } - /* stop operation */ - data &= ~EN_PROM_DATA; - pci_write_config(dev, EN_TONGA, data, 4); - data |= EN_PROM_CLK; - pci_write_config(dev, EN_TONGA, data, 4); - data |= EN_PROM_DATA; - pci_write_config(dev, EN_TONGA, data, 4); - pci_write_config(dev, EN_TONGA, t_data, 4); -} - -/* - * Driver infrastructure - */ -static device_method_t en_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, en_pci_probe), - DEVMETHOD(device_attach, en_pci_attach), - DEVMETHOD(device_detach, en_pci_detach), - DEVMETHOD(device_shutdown, en_pci_shutdown), - - { 0, 0 } -}; - -static driver_t en_driver = { - "en", - en_methods, - sizeof(struct en_pci_softc), -}; - -static devclass_t en_devclass; - -DRIVER_MODULE(en, pci, en_driver, en_devclass, en_modevent, 0); diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c deleted file mode 100644 index bce650b00ae4..000000000000 --- a/sys/dev/en/midway.c +++ /dev/null @@ -1,3367 +0,0 @@ -/* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ -/* (sync'd to midway.c 1.68) */ - -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include -__FBSDID("$FreeBSD$"); - -/* - * - * m i d w a y . c e n i 1 5 5 d r i v e r - * - * author: Chuck Cranor - * started: spring, 1996 (written from scratch). - * - * notes from the author: - * Extra special thanks go to Werner Almesberger, EPFL LRC. Werner's - * ENI driver was especially useful in figuring out how this card works. - * I would also like to thank Werner for promptly answering email and being - * generally helpful. - */ - -#define EN_DIAG -#define EN_DDBHOOK 1 /* compile in ddb functions */ - -/* - * Note on EN_ENIDMAFIX: the byte aligner on the ENI version of the card - * appears to be broken. it works just fine if there is no load... however - * when the card is loaded the data get corrupted. to see this, one only - * has to use "telnet" over ATM. do the following command in "telnet": - * cat /usr/share/misc/termcap - * "telnet" seems to generate lots of 1023 byte mbufs (which make great - * use of the byte aligner). watch "netstat -s" for checksum errors. - * - * I further tested this by adding a function that compared the transmit - * data on the card's SRAM with the data in the mbuf chain _after_ the - * "transmit DMA complete" interrupt. using the "telnet" test I got data - * mismatches where the byte-aligned data should have been. using ddb - * and en_dumpmem() I verified that the DTQs fed into the card were - * absolutely correct. thus, we are forced to concluded that the ENI - * hardware is buggy. note that the Adaptec version of the card works - * just fine with byte DMA. - * - * bottom line: we set EN_ENIDMAFIX to 1 to avoid byte DMAs on the ENI - * card. - */ - -#if defined(DIAGNOSTIC) && !defined(EN_DIAG) -#define EN_DIAG /* link in with master DIAG option */ -#endif - -#define EN_COUNT(X) (X)++ - -#ifdef EN_DEBUG - -#undef EN_DDBHOOK -#define EN_DDBHOOK 1 - -/* - * This macro removes almost all the EN_DEBUG conditionals in the code that make - * to code a good deal less readable. - */ -#define DBG(SC, FL, PRINT) do { \ - if ((SC)->debug & DBG_##FL) { \ - device_printf((SC)->dev, "%s: "#FL": ", __func__); \ - printf PRINT; \ - printf("\n"); \ - } \ - } while (0) - -enum { - DBG_INIT = 0x0001, /* debug attach/detach */ - DBG_TX = 0x0002, /* debug transmitting */ - DBG_SERV = 0x0004, /* debug service interrupts */ - DBG_IOCTL = 0x0008, /* debug ioctls */ - DBG_VC = 0x0010, /* debug VC handling */ - DBG_INTR = 0x0020, /* debug interrupts */ - DBG_DMA = 0x0040, /* debug DMA probing */ - DBG_IPACKETS = 0x0080, /* print input packets */ - DBG_REG = 0x0100, /* print all register access */ - DBG_LOCK = 0x0200, /* debug locking */ -}; - -#else /* EN_DEBUG */ - -#define DBG(SC, FL, PRINT) do { } while (0) - -#endif /* EN_DEBUG */ - -#include "opt_inet.h" -#include "opt_natm.h" -#include "opt_ddb.h" - -#ifdef DDB -#undef EN_DDBHOOK -#define EN_DDBHOOK 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#if defined(NATM) || defined(INET) || defined(INET6) -#include -#if defined(INET) || defined(INET6) -#include -#endif -#endif - -#ifdef NATM -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * params - */ -#ifndef EN_TXHIWAT -#define EN_TXHIWAT (64 * 1024) /* max 64 KB waiting to be DMAd out */ -#endif - -SYSCTL_DECL(_hw_atm); - -/* - * dma tables - * - * The plan is indexed by the number of words to transfer. - * The maximum index is 15 for 60 words. - */ -struct en_dmatab { - uint8_t bcode; /* code */ - uint8_t divshift; /* byte divisor */ -}; - -static const struct en_dmatab en_dmaplan[] = { - { 0, 0 }, /* 0 */ { MIDDMA_WORD, 2}, /* 1 */ - { MIDDMA_2WORD, 3}, /* 2 */ { MIDDMA_WORD, 2}, /* 3 */ - { MIDDMA_4WORD, 4}, /* 4 */ { MIDDMA_WORD, 2}, /* 5 */ - { MIDDMA_2WORD, 3}, /* 6 */ { MIDDMA_WORD, 2}, /* 7 */ - { MIDDMA_8WORD, 5}, /* 8 */ { MIDDMA_WORD, 2}, /* 9 */ - { MIDDMA_2WORD, 3}, /* 10 */ { MIDDMA_WORD, 2}, /* 11 */ - { MIDDMA_4WORD, 4}, /* 12 */ { MIDDMA_WORD, 2}, /* 13 */ - { MIDDMA_2WORD, 3}, /* 14 */ { MIDDMA_WORD, 2}, /* 15 */ - { MIDDMA_16WORD,6}, /* 16 */ -}; - -/* - * prototypes - */ -#ifdef EN_DDBHOOK -int en_dump(int unit, int level); -int en_dumpmem(int,int,int); -#endif -static void en_close_finish(struct en_softc *sc, struct en_vcc *vc); - -#define EN_LOCK(SC) do { \ - DBG(SC, LOCK, ("ENLOCK %d\n", __LINE__)); \ - mtx_lock(&sc->en_mtx); \ - } while (0) -#define EN_UNLOCK(SC) do { \ - DBG(SC, LOCK, ("ENUNLOCK %d\n", __LINE__)); \ - mtx_unlock(&sc->en_mtx); \ - } while (0) -#define EN_CHECKLOCK(sc) mtx_assert(&sc->en_mtx, MA_OWNED) - -/* - * While a transmit mbuf is waiting to get transmit DMA resources we - * need to keep some information with it. We don't want to allocate - * additional memory for this so we stuff it into free fields in the - * mbuf packet header. Neither the checksum fields nor the rcvif field are used - * so use these. - */ -#define TX_AAL5 0x1 /* transmit AAL5 PDU */ -#define TX_HAS_TBD 0x2 /* TBD did fit into mbuf */ -#define TX_HAS_PAD 0x4 /* padding did fit into mbuf */ -#define TX_HAS_PDU 0x8 /* PDU trailer did fit into mbuf */ - -#define MBUF_SET_TX(M, VCI, FLAGS, DATALEN, PAD, MAP) do { \ - (M)->m_pkthdr.csum_data = (VCI) | ((FLAGS) << MID_VCI_BITS); \ - (M)->m_pkthdr.csum_flags = ((DATALEN) & 0xffff) | \ - ((PAD & 0x3f) << 16); \ - (M)->m_pkthdr.rcvif = (void *)(MAP); \ - } while (0) - -#define MBUF_GET_TX(M, VCI, FLAGS, DATALEN, PAD, MAP) do { \ - (VCI) = (M)->m_pkthdr.csum_data & ((1 << MID_VCI_BITS) - 1); \ - (FLAGS) = ((M)->m_pkthdr.csum_data >> MID_VCI_BITS) & 0xf; \ - (DATALEN) = (M)->m_pkthdr.csum_flags & 0xffff; \ - (PAD) = ((M)->m_pkthdr.csum_flags >> 16) & 0x3f; \ - (MAP) = (void *)((M)->m_pkthdr.rcvif); \ - } while (0) - - -#define EN_WRAPADD(START, STOP, CUR, VAL) do { \ - (CUR) = (CUR) + (VAL); \ - if ((CUR) >= (STOP)) \ - (CUR) = (START) + ((CUR) - (STOP)); \ - } while (0) - -#define WORD_IDX(START, X) (((X) - (START)) / sizeof(uint32_t)) - -#define SETQ_END(SC, VAL) ((SC)->is_adaptec ? \ - ((VAL) | (MID_DMA_END >> 4)) : \ - ((VAL) | (MID_DMA_END))) - -/* - * The dtq and drq members are set for each END entry in the corresponding - * card queue entry. It is used to find out, when a buffer has been - * finished DMAing and can be freed. - * - * We store sc->dtq and sc->drq data in the following format... - * the 0x80000 ensures we != 0 - */ -#define EN_DQ_MK(SLOT, LEN) (((SLOT) << 20) | (LEN) | (0x80000)) -#define EN_DQ_SLOT(X) ((X) >> 20) -#define EN_DQ_LEN(X) ((X) & 0x3ffff) - -/* - * Variables - */ -static uma_zone_t en_vcc_zone; - -/***********************************************************************/ - -/* - * en_read{x}: read a word from the card. These are the only functions - * that read from the card. - */ -static __inline uint32_t -en_readx(struct en_softc *sc, uint32_t r) -{ - uint32_t v; - -#ifdef EN_DIAG - if (r > MID_MAXOFF || (r % 4)) - panic("en_read out of range, r=0x%x", r); -#endif - v = bus_space_read_4(sc->en_memt, sc->en_base, r); - return (v); -} - -static __inline uint32_t -en_read(struct en_softc *sc, uint32_t r) -{ - uint32_t v; - -#ifdef EN_DIAG - if (r > MID_MAXOFF || (r % 4)) - panic("en_read out of range, r=0x%x", r); -#endif - v = bus_space_read_4(sc->en_memt, sc->en_base, r); - DBG(sc, REG, ("en_read(%#x) -> %08x", r, v)); - return (v); -} - -/* - * en_write: write a word to the card. This is the only function that - * writes to the card. - */ -static __inline void -en_write(struct en_softc *sc, uint32_t r, uint32_t v) -{ -#ifdef EN_DIAG - if (r > MID_MAXOFF || (r % 4)) - panic("en_write out of range, r=0x%x", r); -#endif - DBG(sc, REG, ("en_write(%#x) <- %08x", r, v)); - bus_space_write_4(sc->en_memt, sc->en_base, r, v); -} - -/* - * en_k2sz: convert KBytes to a size parameter (a log2) - */ -static __inline int -en_k2sz(int k) -{ - switch(k) { - case 1: return (0); - case 2: return (1); - case 4: return (2); - case 8: return (3); - case 16: return (4); - case 32: return (5); - case 64: return (6); - case 128: return (7); - default: - panic("en_k2sz"); - } - return (0); -} -#define en_log2(X) en_k2sz(X) - -#if 0 -/* - * en_b2sz: convert a DMA burst code to its byte size - */ -static __inline int -en_b2sz(int b) -{ - switch (b) { - case MIDDMA_WORD: return (1*4); - case MIDDMA_2WMAYBE: - case MIDDMA_2WORD: return (2*4); - case MIDDMA_4WMAYBE: - case MIDDMA_4WORD: return (4*4); - case MIDDMA_8WMAYBE: - case MIDDMA_8WORD: return (8*4); - case MIDDMA_16WMAYBE: - case MIDDMA_16WORD: return (16*4); - default: - panic("en_b2sz"); - } - return (0); -} -#endif - -/* - * en_sz2b: convert a burst size (bytes) to DMA burst code - */ -static __inline int -en_sz2b(int sz) -{ - switch (sz) { - case 1*4: return (MIDDMA_WORD); - case 2*4: return (MIDDMA_2WORD); - case 4*4: return (MIDDMA_4WORD); - case 8*4: return (MIDDMA_8WORD); - case 16*4: return (MIDDMA_16WORD); - default: - panic("en_sz2b"); - } - return(0); -} - -#ifdef EN_DEBUG -/* - * Dump a packet - */ -static void -en_dump_packet(struct en_softc *sc, struct mbuf *m) -{ - int plen = m->m_pkthdr.len; - u_int pos = 0; - u_int totlen = 0; - int len; - u_char *ptr; - - device_printf(sc->dev, "packet len=%d", plen); - while (m != NULL) { - totlen += m->m_len; - ptr = mtod(m, u_char *); - for (len = 0; len < m->m_len; len++, pos++, ptr++) { - if (pos % 16 == 8) - printf(" "); - if (pos % 16 == 0) - printf("\n"); - printf(" %02x", *ptr); - } - m = m->m_next; - } - printf("\n"); - if (totlen != plen) - printf("sum of m_len=%u\n", totlen); -} -#endif - -/*********************************************************************/ -/* - * DMA maps - */ - -/* - * Map constructor for a MAP. - * - * This is called each time when a map is allocated - * from the pool and about to be returned to the user. Here we actually - * allocate the map if there isn't one. The problem is that we may fail - * to allocate the DMA map yet have no means to signal this error. Therefor - * when allocating a map, the call must check that there is a map. An - * additional problem is, that i386 maps will be NULL, yet are ok and must - * be freed so let's use a flag to signal allocation. - * - * Caveat: we have no way to know that we are called from an interrupt context - * here. We rely on the fact, that bus_dmamap_create uses M_NOWAIT in all - * its allocations. - * - * LOCK: any, not needed - */ -static int -en_map_ctor(void *mem, int size, void *arg, int flags) -{ - struct en_softc *sc = arg; - struct en_map *map = mem; - int err; - - err = bus_dmamap_create(sc->txtag, 0, &map->map); - if (err != 0) { - device_printf(sc->dev, "cannot create DMA map %d\n", err); - return (err); - } - map->flags = ENMAP_ALLOC; - map->sc = sc; - return (0); -} - -/* - * Map destructor. - * - * Called when a map is disposed into the zone. If the map is loaded, unload - * it. - * - * LOCK: any, not needed - */ -static void -en_map_dtor(void *mem, int size, void *arg) -{ - struct en_map *map = mem; - - if (map->flags & ENMAP_LOADED) { - bus_dmamap_unload(map->sc->txtag, map->map); - map->flags &= ~ENMAP_LOADED; - } -} - -/* - * Map finializer. - * - * This is called each time a map is returned from the zone to the system. - * Get rid of the dmamap here. - * - * LOCK: any, not needed - */ -static void -en_map_fini(void *mem, int size) -{ - struct en_map *map = mem; - - bus_dmamap_destroy(map->sc->txtag, map->map); -} - -/*********************************************************************/ -/* - * Transmission - */ - -/* - * Argument structure to load a transmit DMA map - */ -struct txarg { - struct en_softc *sc; - struct mbuf *m; - u_int vci; - u_int chan; /* transmit channel */ - u_int datalen; /* length of user data */ - u_int flags; - u_int wait; /* return: out of resources */ -}; - -/* - * TX DMA map loader helper. This function is the callback when the map - * is loaded. It should fill the DMA segment descriptors into the hardware. - * - * LOCK: locked, needed - */ -static void -en_txdma_load(void *uarg, bus_dma_segment_t *segs, int nseg, bus_size_t mapsize, - int error) -{ - struct txarg *tx = uarg; - struct en_softc *sc = tx->sc; - struct en_txslot *slot = &sc->txslot[tx->chan]; - uint32_t cur; /* on-card buffer position (bytes offset) */ - uint32_t dtq; /* on-card queue position (byte offset) */ - uint32_t last_dtq; /* last DTQ we have written */ - uint32_t tmp; - u_int free; /* free queue entries on card */ - u_int needalign, cnt; - bus_size_t rest; /* remaining bytes in current segment */ - bus_addr_t addr; - bus_dma_segment_t *s; - uint32_t count, bcode; - int i; - - if (error != 0) - return; - - cur = slot->cur; - dtq = sc->dtq_us; - free = sc->dtq_free; - - last_dtq = 0; /* make gcc happy */ - - /* - * Local macro to add an entry to the transmit DMA area. If there - * are no entries left, return. Save the byte offset of the entry - * in last_dtq for later use. - */ -#define PUT_DTQ_ENTRY(ENI, BCODE, COUNT, ADDR) \ - if (free == 0) { \ - EN_COUNT(sc->stats.txdtqout); \ - tx->wait = 1; \ - return; \ - } \ - last_dtq = dtq; \ - en_write(sc, dtq + 0, (ENI || !sc->is_adaptec) ? \ - MID_MK_TXQ_ENI(COUNT, tx->chan, 0, BCODE) : \ - MID_MK_TXQ_ADP(COUNT, tx->chan, 0, BCODE)); \ - en_write(sc, dtq + 4, ADDR); \ - \ - EN_WRAPADD(MID_DTQOFF, MID_DTQEND, dtq, 8); \ - free--; - - /* - * Local macro to generate a DMA entry to DMA cnt bytes. Updates - * the current buffer byte offset accordingly. - */ -#define DO_DTQ(TYPE) do { \ - rest -= cnt; \ - EN_WRAPADD(slot->start, slot->stop, cur, cnt); \ - DBG(sc, TX, ("tx%d: "TYPE" %u bytes, %ju left, cur %#x", \ - tx->chan, cnt, (uintmax_t)rest, cur)); \ - \ - PUT_DTQ_ENTRY(1, bcode, count, addr); \ - \ - addr += cnt; \ - } while (0) - - if (!(tx->flags & TX_HAS_TBD)) { - /* - * Prepend the TBD - it did not fit into the first mbuf - */ - tmp = MID_TBD_MK1((tx->flags & TX_AAL5) ? - MID_TBD_AAL5 : MID_TBD_NOAAL5, - sc->vccs[tx->vci]->txspeed, - tx->m->m_pkthdr.len / MID_ATMDATASZ); - en_write(sc, cur, tmp); - EN_WRAPADD(slot->start, slot->stop, cur, 4); - - tmp = MID_TBD_MK2(tx->vci, 0, 0); - en_write(sc, cur, tmp); - EN_WRAPADD(slot->start, slot->stop, cur, 4); - - /* update DMA address */ - PUT_DTQ_ENTRY(0, MIDDMA_JK, WORD_IDX(slot->start, cur), 0); - } - - for (i = 0, s = segs; i < nseg; i++, s++) { - rest = s->ds_len; - addr = s->ds_addr; - - if (sc->is_adaptec) { - /* adaptec card - simple */ - - /* advance the on-card buffer pointer */ - EN_WRAPADD(slot->start, slot->stop, cur, rest); - DBG(sc, TX, ("tx%d: adp %ju bytes %#jx (cur now 0x%x)", - tx->chan, (uintmax_t)rest, (uintmax_t)addr, cur)); - - PUT_DTQ_ENTRY(0, 0, rest, addr); - - continue; - } - - /* - * do we need to do a DMA op to align to the maximum - * burst? Note, that we are alway 32-bit aligned. - */ - if (sc->alburst && - (needalign = (addr & sc->bestburstmask)) != 0) { - /* compute number of bytes, words and code */ - cnt = sc->bestburstlen - needalign; - if (cnt > rest) - cnt = rest; - count = cnt / sizeof(uint32_t); - if (sc->noalbursts) { - bcode = MIDDMA_WORD; - } else { - bcode = en_dmaplan[count].bcode; - count = cnt >> en_dmaplan[count].divshift; - } - DO_DTQ("al_dma"); - } - - /* do we need to do a max-sized burst? */ - if (rest >= sc->bestburstlen) { - count = rest >> sc->bestburstshift; - cnt = count << sc->bestburstshift; - bcode = sc->bestburstcode; - DO_DTQ("best_dma"); - } - - /* do we need to do a cleanup burst? */ - if (rest != 0) { - cnt = rest; - count = rest / sizeof(uint32_t); - if (sc->noalbursts) { - bcode = MIDDMA_WORD; - } else { - bcode = en_dmaplan[count].bcode; - count = cnt >> en_dmaplan[count].divshift; - } - DO_DTQ("clean_dma"); - } - } - - KASSERT (tx->flags & TX_HAS_PAD, ("PDU not padded")); - - if ((tx->flags & TX_AAL5) && !(tx->flags & TX_HAS_PDU)) { - /* - * Append the AAL5 PDU trailer - */ - tmp = MID_PDU_MK1(0, 0, tx->datalen); - en_write(sc, cur, tmp); - EN_WRAPADD(slot->start, slot->stop, cur, 4); - - en_write(sc, cur, 0); - EN_WRAPADD(slot->start, slot->stop, cur, 4); - - /* update DMA address */ - PUT_DTQ_ENTRY(0, MIDDMA_JK, WORD_IDX(slot->start, cur), 0); - } - - /* record the end for the interrupt routine */ - sc->dtq[MID_DTQ_A2REG(last_dtq)] = - EN_DQ_MK(tx->chan, tx->m->m_pkthdr.len); - - /* set the end flag in the last descriptor */ - en_write(sc, last_dtq + 0, SETQ_END(sc, en_read(sc, last_dtq + 0))); - -#undef PUT_DTQ_ENTRY -#undef DO_DTQ - - /* commit */ - slot->cur = cur; - sc->dtq_free = free; - sc->dtq_us = dtq; - - /* tell card */ - en_write(sc, MID_DMA_WRTX, MID_DTQ_A2REG(sc->dtq_us)); -} - -/* - * en_txdma: start transmit DMA on the given channel, if possible - * - * This is called from two places: when we got new packets from the upper - * layer or when we found that buffer space has freed up during interrupt - * processing. - * - * LOCK: locked, needed - */ -static void -en_txdma(struct en_softc *sc, struct en_txslot *slot) -{ - struct en_map *map; - struct mbuf *lastm; - struct txarg tx; - u_int pad; - int error; - - DBG(sc, TX, ("tx%td: starting ...", slot - sc->txslot)); - again: - bzero(&tx, sizeof(tx)); - tx.chan = slot - sc->txslot; - tx.sc = sc; - - /* - * get an mbuf waiting for DMA - */ - _IF_DEQUEUE(&slot->q, tx.m); - if (tx.m == NULL) { - DBG(sc, TX, ("tx%td: ...done!", slot - sc->txslot)); - return; - } - MBUF_GET_TX(tx.m, tx.vci, tx.flags, tx.datalen, pad, map); - - /* - * note: don't use the entire buffer space. if WRTX becomes equal - * to RDTX, the transmitter stops assuming the buffer is empty! --kjc - */ - if (tx.m->m_pkthdr.len >= slot->bfree) { - EN_COUNT(sc->stats.txoutspace); - DBG(sc, TX, ("tx%td: out of transmit space", slot - sc->txslot)); - goto waitres; - } - - lastm = NULL; - if (!(tx.flags & TX_HAS_PAD)) { - if (pad != 0) { - /* Append the padding buffer */ - (void)m_length(tx.m, &lastm); - lastm->m_next = sc->padbuf; - sc->padbuf->m_len = pad; - } - tx.flags |= TX_HAS_PAD; - } - - /* - * Try to load that map - */ - error = bus_dmamap_load_mbuf(sc->txtag, map->map, tx.m, - en_txdma_load, &tx, BUS_DMA_NOWAIT); - - if (lastm != NULL) - lastm->m_next = NULL; - - if (error != 0) { - device_printf(sc->dev, "loading TX map failed %d\n", - error); - goto dequeue_drop; - } - map->flags |= ENMAP_LOADED; - if (tx.wait) { - /* probably not enough space */ - bus_dmamap_unload(map->sc->txtag, map->map); - map->flags &= ~ENMAP_LOADED; - - sc->need_dtqs = 1; - DBG(sc, TX, ("tx%td: out of transmit DTQs", slot - sc->txslot)); - goto waitres; - } - - EN_COUNT(sc->stats.launch); - if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); - - sc->vccs[tx.vci]->opackets++; - sc->vccs[tx.vci]->obytes += tx.datalen; - -#ifdef ENABLE_BPF - if (bpf_peers_present(sc->ifp->if_bpf)) { - /* - * adjust the top of the mbuf to skip the TBD if present - * before passing the packet to bpf. - * Also remove padding and the PDU trailer. Assume both of - * them to be in the same mbuf. pktlen, m_len and m_data - * are not needed anymore so we can change them. - */ - if (tx.flags & TX_HAS_TBD) { - tx.m->m_data += MID_TBD_SIZE; - tx.m->m_len -= MID_TBD_SIZE; - } - tx.m->m_pkthdr.len = m_length(tx.m, &lastm); - if (tx.m->m_pkthdr.len > tx.datalen) { - lastm->m_len -= tx.m->m_pkthdr.len - tx.datalen; - tx.m->m_pkthdr.len = tx.datalen; - } - - bpf_mtap(sc->ifp->if_bpf, tx.m); - } -#endif - - /* - * do some housekeeping and get the next packet - */ - slot->bfree -= tx.m->m_pkthdr.len; - _IF_ENQUEUE(&slot->indma, tx.m); - - goto again; - - /* - * error handling. This is jumped to when we just want to drop - * the packet. Must be unlocked here. - */ - dequeue_drop: - if (map != NULL) - uma_zfree(sc->map_zone, map); - - slot->mbsize -= tx.m->m_pkthdr.len; - - m_freem(tx.m); - - goto again; - - waitres: - _IF_PREPEND(&slot->q, tx.m); -} - -/* - * Create a copy of a single mbuf. It can have either internal or - * external data, it may have a packet header. External data is really - * copied, so the new buffer is writeable. - * - * LOCK: any, not needed - */ -static struct mbuf * -copy_mbuf(struct mbuf *m) -{ - struct mbuf *new; - - MGET(new, M_WAITOK, MT_DATA); - - if (m->m_flags & M_PKTHDR) { - M_MOVE_PKTHDR(new, m); - if (m->m_len > MHLEN) - MCLGET(new, M_WAITOK); - } else { - if (m->m_len > MLEN) - MCLGET(new, M_WAITOK); - } - - bcopy(m->m_data, new->m_data, m->m_len); - new->m_len = m->m_len; - new->m_flags &= ~M_RDONLY; - - return (new); -} - -/* - * This function is called when we have an ENI adapter. It fixes the - * mbuf chain, so that all addresses and lengths are 4 byte aligned. - * The overall length is already padded to multiple of cells plus the - * TBD so this must always succeed. The routine can fail, when it - * needs to copy an mbuf (this may happen if an mbuf is readonly). - * - * We assume here, that aligning the virtual addresses to 4 bytes also - * aligns the physical addresses. - * - * LOCK: locked, needed - */ -static struct mbuf * -en_fix_mchain(struct en_softc *sc, struct mbuf *m0, u_int *pad) -{ - struct mbuf **prev = &m0; - struct mbuf *m = m0; - struct mbuf *new; - u_char *d; - int off; - - while (m != NULL) { - d = mtod(m, u_char *); - if ((off = (uintptr_t)d % sizeof(uint32_t)) != 0) { - EN_COUNT(sc->stats.mfixaddr); - if (M_WRITABLE(m)) { - bcopy(d, d - off, m->m_len); - m->m_data -= off; - } else { - if ((new = copy_mbuf(m)) == NULL) { - EN_COUNT(sc->stats.mfixfail); - m_freem(m0); - return (NULL); - } - new->m_next = m_free(m); - *prev = m = new; - } - } - - if ((off = m->m_len % sizeof(uint32_t)) != 0) { - EN_COUNT(sc->stats.mfixlen); - if (!M_WRITABLE(m)) { - if ((new = copy_mbuf(m)) == NULL) { - EN_COUNT(sc->stats.mfixfail); - m_freem(m0); - return (NULL); - } - new->m_next = m_free(m); - *prev = m = new; - } - d = mtod(m, u_char *) + m->m_len; - off = 4 - off; - while (off) { - while (m->m_next && m->m_next->m_len == 0) - m->m_next = m_free(m->m_next); - - if (m->m_next == NULL) { - *d++ = 0; - KASSERT(*pad > 0, ("no padding space")); - (*pad)--; - } else { - *d++ = *mtod(m->m_next, u_char *); - m->m_next->m_len--; - m->m_next->m_data++; - } - m->m_len++; - off--; - } - } - - prev = &m->m_next; - m = m->m_next; - } - - return (m0); -} - -/* - * en_start: start transmitting the next packet that needs to go out - * if there is one. We take off all packets from the interface's queue and - * put them into the channels queue. - * - * Here we also prepend the transmit packet descriptor and append the padding - * and (for aal5) the PDU trailer. This is different from the original driver: - * we assume, that allocating one or two additional mbufs is actually cheaper - * than all this algorithmic fiddling we would need otherwise. - * - * While the packet is on the channels wait queue we use the csum_* fields - * in the packet header to hold the original datalen, the AAL5 flag and the - * VCI. The packet length field in the header holds the needed buffer space. - * This may actually be more than the length of the current mbuf chain (when - * one or more of TBD, padding and PDU do not fit). - * - * LOCK: unlocked, needed - */ -static void -en_start(struct ifnet *ifp) -{ - struct en_softc *sc = (struct en_softc *)ifp->if_softc; - struct mbuf *m, *lastm; - struct atm_pseudohdr *ap; - u_int pad; /* 0-bytes to pad at PDU end */ - u_int datalen; /* length of user data */ - u_int vci; /* the VCI we are transmitting on */ - u_int flags; - uint32_t tbd[2]; - uint32_t pdu[2]; - struct en_vcc *vc; - struct en_map *map; - struct en_txslot *tx; - - while (1) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - return; - - flags = 0; - - ap = mtod(m, struct atm_pseudohdr *); - vci = ATM_PH_VCI(ap); - - if (ATM_PH_VPI(ap) != 0 || vci >= MID_N_VC || - (vc = sc->vccs[vci]) == NULL || - (vc->vflags & VCC_CLOSE_RX)) { - DBG(sc, TX, ("output vpi=%u, vci=%u -- drop", - ATM_PH_VPI(ap), vci)); - m_freem(m); - continue; - } - if (vc->vcc.aal == ATMIO_AAL_5) - flags |= TX_AAL5; - m_adj(m, sizeof(struct atm_pseudohdr)); - - /* - * (re-)calculate size of packet (in bytes) - */ - m->m_pkthdr.len = datalen = m_length(m, &lastm); - - /* - * computing how much padding we need on the end of the mbuf, - * then see if we can put the TBD at the front of the mbuf - * where the link header goes (well behaved protocols will - * reserve room for us). Last, check if room for PDU tail. - */ - if (flags & TX_AAL5) - m->m_pkthdr.len += MID_PDU_SIZE; - m->m_pkthdr.len = roundup(m->m_pkthdr.len, MID_ATMDATASZ); - pad = m->m_pkthdr.len - datalen; - if (flags & TX_AAL5) - pad -= MID_PDU_SIZE; - m->m_pkthdr.len += MID_TBD_SIZE; - - DBG(sc, TX, ("txvci%d: buflen=%u datalen=%u lead=%d trail=%d", - vci, m->m_pkthdr.len, datalen, (int)M_LEADINGSPACE(m), - (int)M_TRAILINGSPACE(lastm))); - - /* - * From here on we need access to sc - */ - EN_LOCK(sc); - - /* - * Allocate a map. We do this here rather then in en_txdma, - * because en_txdma is also called from the interrupt handler - * and we are going to have a locking problem then. We must - * use NOWAIT here, because the ip_output path holds various - * locks. - */ - map = uma_zalloc_arg(sc->map_zone, sc, M_NOWAIT); - if (map == NULL) { - /* drop that packet */ - EN_COUNT(sc->stats.txnomap); - EN_UNLOCK(sc); - m_freem(m); - continue; - } - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - EN_UNLOCK(sc); - uma_zfree(sc->map_zone, map); - m_freem(m); - continue; - } - - /* - * Look, whether we can prepend the TBD (8 byte) - */ - if (M_WRITABLE(m) && M_LEADINGSPACE(m) >= MID_TBD_SIZE) { - tbd[0] = htobe32(MID_TBD_MK1((flags & TX_AAL5) ? - MID_TBD_AAL5 : MID_TBD_NOAAL5, - vc->txspeed, m->m_pkthdr.len / MID_ATMDATASZ)); - tbd[1] = htobe32(MID_TBD_MK2(vci, 0, 0)); - - m->m_data -= MID_TBD_SIZE; - bcopy(tbd, m->m_data, MID_TBD_SIZE); - m->m_len += MID_TBD_SIZE; - flags |= TX_HAS_TBD; - } - - /* - * Check whether the padding fits (must be writeable - - * we pad with zero). - */ - if (M_WRITABLE(lastm) && M_TRAILINGSPACE(lastm) >= pad) { - bzero(lastm->m_data + lastm->m_len, pad); - lastm->m_len += pad; - flags |= TX_HAS_PAD; - - if ((flags & TX_AAL5) && - M_TRAILINGSPACE(lastm) > MID_PDU_SIZE) { - pdu[0] = htobe32(MID_PDU_MK1(0, 0, datalen)); - pdu[1] = 0; - bcopy(pdu, lastm->m_data + lastm->m_len, - MID_PDU_SIZE); - lastm->m_len += MID_PDU_SIZE; - flags |= TX_HAS_PDU; - } - } - - if (!sc->is_adaptec && - (m = en_fix_mchain(sc, m, &pad)) == NULL) { - EN_UNLOCK(sc); - uma_zfree(sc->map_zone, map); - continue; - } - - /* - * get assigned channel (will be zero unless txspeed is set) - */ - tx = vc->txslot; - - if (m->m_pkthdr.len > EN_TXSZ * 1024) { - DBG(sc, TX, ("tx%td: packet larger than xmit buffer " - "(%d > %d)\n", tx - sc->txslot, m->m_pkthdr.len, - EN_TXSZ * 1024)); - EN_UNLOCK(sc); - m_freem(m); - uma_zfree(sc->map_zone, map); - continue; - } - - if (tx->mbsize > EN_TXHIWAT) { - EN_COUNT(sc->stats.txmbovr); - DBG(sc, TX, ("tx%td: buffer space shortage", - tx - sc->txslot)); - EN_UNLOCK(sc); - m_freem(m); - uma_zfree(sc->map_zone, map); - continue; - } - - /* commit */ - tx->mbsize += m->m_pkthdr.len; - - DBG(sc, TX, ("tx%td: VCI=%d, speed=0x%x, buflen=%d, mbsize=%d", - tx - sc->txslot, vci, sc->vccs[vci]->txspeed, - m->m_pkthdr.len, tx->mbsize)); - - MBUF_SET_TX(m, vci, flags, datalen, pad, map); - - _IF_ENQUEUE(&tx->q, m); - - en_txdma(sc, tx); - - EN_UNLOCK(sc); - } -} - -/*********************************************************************/ -/* - * VCs - */ - -/* - * en_loadvc: load a vc tab entry from a slot - * - * LOCK: locked, needed - */ -static void -en_loadvc(struct en_softc *sc, struct en_vcc *vc) -{ - uint32_t reg = en_read(sc, MID_VC(vc->vcc.vci)); - - reg = MIDV_SETMODE(reg, MIDV_TRASH); - en_write(sc, MID_VC(vc->vcc.vci), reg); - DELAY(27); - - /* no need to set CRC */ - - /* read pointer = 0, desc. start = 0 */ - en_write(sc, MID_DST_RP(vc->vcc.vci), 0); - /* write pointer = 0 */ - en_write(sc, MID_WP_ST_CNT(vc->vcc.vci), 0); - /* set mode, size, loc */ - en_write(sc, MID_VC(vc->vcc.vci), vc->rxslot->mode); - - vc->rxslot->cur = vc->rxslot->start; - - DBG(sc, VC, ("rx%td: assigned to VCI %d", vc->rxslot - sc->rxslot, - vc->vcc.vci)); -} - -/* - * Open the given vcc. - * - * LOCK: unlocked, needed - */ -static int -en_open_vcc(struct en_softc *sc, struct atmio_openvcc *op) -{ - uint32_t oldmode, newmode; - struct en_rxslot *slot; - struct en_vcc *vc; - int error = 0; - - DBG(sc, IOCTL, ("enable vpi=%d, vci=%d, flags=%#x", - op->param.vpi, op->param.vci, op->param.flags)); - - if (op->param.vpi != 0 || op->param.vci >= MID_N_VC) - return (EINVAL); - - vc = uma_zalloc(en_vcc_zone, M_NOWAIT | M_ZERO); - if (vc == NULL) - return (ENOMEM); - - EN_LOCK(sc); - - if (sc->vccs[op->param.vci] != NULL) { - error = EBUSY; - goto done; - } - - /* find a free receive slot */ - for (slot = sc->rxslot; slot < &sc->rxslot[sc->en_nrx]; slot++) - if (slot->vcc == NULL) - break; - if (slot == &sc->rxslot[sc->en_nrx]) { - error = ENOSPC; - goto done; - } - - vc->rxslot = slot; - vc->rxhand = op->rxhand; - vc->vcc = op->param; - - oldmode = slot->mode; - newmode = (op->param.aal == ATMIO_AAL_5) ? MIDV_AAL5 : MIDV_NOAAL; - slot->mode = MIDV_SETMODE(oldmode, newmode); - slot->vcc = vc; - - KASSERT (_IF_QLEN(&slot->indma) == 0 && _IF_QLEN(&slot->q) == 0, - ("en_rxctl: left over mbufs on enable slot=%td", - vc->rxslot - sc->rxslot)); - - vc->txspeed = 0; - vc->txslot = sc->txslot; - vc->txslot->nref++; /* bump reference count */ - - en_loadvc(sc, vc); /* does debug printf for us */ - - /* don't free below */ - sc->vccs[vc->vcc.vci] = vc; - vc = NULL; - sc->vccs_open++; - - done: - if (vc != NULL) - uma_zfree(en_vcc_zone, vc); - - EN_UNLOCK(sc); - return (error); -} - -/* - * Close finished - */ -static void -en_close_finish(struct en_softc *sc, struct en_vcc *vc) -{ - - if (vc->rxslot != NULL) - vc->rxslot->vcc = NULL; - - DBG(sc, VC, ("vci: %u free (%p)", vc->vcc.vci, vc)); - - sc->vccs[vc->vcc.vci] = NULL; - uma_zfree(en_vcc_zone, vc); - sc->vccs_open--; -} - -/* - * LOCK: unlocked, needed - */ -static int -en_close_vcc(struct en_softc *sc, struct atmio_closevcc *cl) -{ - uint32_t oldmode, newmode; - struct en_vcc *vc; - int error = 0; - - DBG(sc, IOCTL, ("disable vpi=%d, vci=%d", cl->vpi, cl->vci)); - - if (cl->vpi != 0 || cl->vci >= MID_N_VC) - return (EINVAL); - - EN_LOCK(sc); - if ((vc = sc->vccs[cl->vci]) == NULL) { - error = ENOTCONN; - goto done; - } - - /* - * turn off VCI - */ - if (vc->rxslot == NULL) { - error = ENOTCONN; - goto done; - } - if (vc->vflags & VCC_DRAIN) { - error = EINVAL; - goto done; - } - - oldmode = en_read(sc, MID_VC(cl->vci)); - newmode = MIDV_SETMODE(oldmode, MIDV_TRASH) & ~MIDV_INSERVICE; - en_write(sc, MID_VC(cl->vci), (newmode | (oldmode & MIDV_INSERVICE))); - - /* halt in tracks, be careful to preserve inservice bit */ - DELAY(27); - vc->rxslot->mode = newmode; - - vc->txslot->nref--; - - /* if stuff is still going on we are going to have to drain it out */ - if (_IF_QLEN(&vc->rxslot->indma) == 0 && - _IF_QLEN(&vc->rxslot->q) == 0 && - (vc->vflags & VCC_SWSL) == 0) { - en_close_finish(sc, vc); - goto done; - } - - vc->vflags |= VCC_DRAIN; - DBG(sc, IOCTL, ("VCI %u now draining", cl->vci)); - - if (vc->vcc.flags & ATMIO_FLAG_ASYNC) - goto done; - - vc->vflags |= VCC_CLOSE_RX; - while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) && - (vc->vflags & VCC_DRAIN)) - cv_wait(&sc->cv_close, &sc->en_mtx); - - en_close_finish(sc, vc); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - - - done: - EN_UNLOCK(sc); - return (error); -} - -/*********************************************************************/ -/* - * starting/stopping the card - */ - -/* - * en_reset_ul: reset the board, throw away work in progress. - * must en_init to recover. - * - * LOCK: locked, needed - */ -static void -en_reset_ul(struct en_softc *sc) -{ - struct en_map *map; - struct mbuf *m; - struct en_rxslot *rx; - int lcv; - - device_printf(sc->dev, "reset\n"); - sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); /* reset hardware */ - - /* - * recv: dump any mbufs we are dma'ing into, if DRAINing, then a reset - * will free us! Don't release the rxslot from the channel. - */ - for (lcv = 0 ; lcv < MID_N_VC ; lcv++) { - if (sc->vccs[lcv] == NULL) - continue; - rx = sc->vccs[lcv]->rxslot; - - for (;;) { - _IF_DEQUEUE(&rx->indma, m); - if (m == NULL) - break; - map = (void *)m->m_pkthdr.rcvif; - uma_zfree(sc->map_zone, map); - m_freem(m); - } - for (;;) { - _IF_DEQUEUE(&rx->q, m); - if (m == NULL) - break; - m_freem(m); - } - sc->vccs[lcv]->vflags = 0; - } - - /* - * xmit: dump everything - */ - for (lcv = 0 ; lcv < EN_NTX ; lcv++) { - for (;;) { - _IF_DEQUEUE(&sc->txslot[lcv].indma, m); - if (m == NULL) - break; - map = (void *)m->m_pkthdr.rcvif; - uma_zfree(sc->map_zone, map); - m_freem(m); - } - for (;;) { - _IF_DEQUEUE(&sc->txslot[lcv].q, m); - if (m == NULL) - break; - map = (void *)m->m_pkthdr.rcvif; - uma_zfree(sc->map_zone, map); - m_freem(m); - } - sc->txslot[lcv].mbsize = 0; - } - - /* - * Unstop all waiters - */ - cv_broadcast(&sc->cv_close); -} - -/* - * en_reset: reset the board, throw away work in progress. - * must en_init to recover. - * - * LOCK: unlocked, needed - * - * Use en_reset_ul if you alreay have the lock - */ -void -en_reset(struct en_softc *sc) -{ - EN_LOCK(sc); - en_reset_ul(sc); - EN_UNLOCK(sc); -} - - -/* - * en_init: init board and sync the card with the data in the softc. - * - * LOCK: locked, needed - */ -static void -en_init(struct en_softc *sc) -{ - int vc, slot; - uint32_t loc; - - if ((sc->ifp->if_flags & IFF_UP) == 0) { - DBG(sc, INIT, ("going down")); - en_reset(sc); /* to be safe */ - return; - } - - DBG(sc, INIT, ("going up")); - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; /* enable */ - - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); /* reset */ - - /* zero memory */ - bus_space_set_region_4(sc->en_memt, sc->en_base, - MID_RAMOFF, 0, sc->en_obmemsz / 4); - - /* - * init obmem data structures: vc tab, dma q's, slist. - * - * note that we set drq_free/dtq_free to one less than the total number - * of DTQ/DRQs present. we do this because the card uses the condition - * (drq_chip == drq_us) to mean "list is empty"... but if you allow the - * circular list to be completely full then (drq_chip == drq_us) [i.e. - * the drq_us pointer will wrap all the way around]. by restricting - * the number of active requests to (N - 1) we prevent the list from - * becoming completely full. note that the card will sometimes give - * us an interrupt for a DTQ/DRQ we have already processes... this helps - * keep that interrupt from messing us up. - */ - bzero(&sc->drq, sizeof(sc->drq)); - sc->drq_free = MID_DRQ_N - 1; - sc->drq_chip = MID_DRQ_REG2A(en_read(sc, MID_DMA_RDRX)); - en_write(sc, MID_DMA_WRRX, MID_DRQ_A2REG(sc->drq_chip)); - sc->drq_us = sc->drq_chip; - - bzero(&sc->dtq, sizeof(sc->dtq)); - sc->dtq_free = MID_DTQ_N - 1; - sc->dtq_chip = MID_DTQ_REG2A(en_read(sc, MID_DMA_RDTX)); - en_write(sc, MID_DMA_WRTX, MID_DRQ_A2REG(sc->dtq_chip)); - sc->dtq_us = sc->dtq_chip; - - sc->hwslistp = MID_SL_REG2A(en_read(sc, MID_SERV_WRITE)); - sc->swsl_size = sc->swsl_head = sc->swsl_tail = 0; - - DBG(sc, INIT, ("drq free/chip: %d/0x%x, dtq free/chip: %d/0x%x, " - "hwslist: 0x%x", sc->drq_free, sc->drq_chip, sc->dtq_free, - sc->dtq_chip, sc->hwslistp)); - - for (slot = 0 ; slot < EN_NTX ; slot++) { - sc->txslot[slot].bfree = EN_TXSZ * 1024; - en_write(sc, MIDX_READPTR(slot), 0); - en_write(sc, MIDX_DESCSTART(slot), 0); - loc = sc->txslot[slot].cur = sc->txslot[slot].start; - loc = loc - MID_RAMOFF; - /* mask, cvt to words */ - loc = rounddown2(loc, EN_TXSZ * 1024) >> 2; - /* top 11 bits */ - loc = loc >> MIDV_LOCTOPSHFT; - en_write(sc, MIDX_PLACE(slot), MIDX_MKPLACE(en_k2sz(EN_TXSZ), - loc)); - DBG(sc, INIT, ("tx%d: place 0x%x", slot, - (u_int)en_read(sc, MIDX_PLACE(slot)))); - } - - for (vc = 0; vc < MID_N_VC; vc++) - if (sc->vccs[vc] != NULL) - en_loadvc(sc, sc->vccs[vc]); - - /* - * enable! - */ - en_write(sc, MID_INTENA, MID_INT_TX | MID_INT_DMA_OVR | MID_INT_IDENT | - MID_INT_LERR | MID_INT_DMA_ERR | MID_INT_DMA_RX | MID_INT_DMA_TX | - MID_INT_SERVICE | MID_INT_SUNI | MID_INT_STATS); - en_write(sc, MID_MAST_CSR, MID_SETIPL(sc->ipl) | MID_MCSR_ENDMA | - MID_MCSR_ENTX | MID_MCSR_ENRX); -} - -/*********************************************************************/ -/* - * Ioctls - */ -/* - * en_ioctl: handle ioctl requests - * - * NOTE: if you add an ioctl to set txspeed, you should choose a new - * TX channel/slot. Choose the one with the lowest sc->txslot[slot].nref - * value, subtract one from sc->txslot[0].nref, add one to the - * sc->txslot[slot].nref, set sc->txvc2slot[vci] = slot, and then set - * txspeed[vci]. - * - * LOCK: unlocked, needed - */ -static int -en_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) -{ - struct en_softc *sc = (struct en_softc *)ifp->if_softc; -#if defined(INET) || defined(INET6) - struct ifaddr *ifa = (struct ifaddr *)data; -#endif - struct ifreq *ifr = (struct ifreq *)data; - struct atmio_vcctable *vtab; - int error = 0; - - switch (cmd) { - - case SIOCSIFADDR: - EN_LOCK(sc); - ifp->if_flags |= IFF_UP; -#if defined(INET) || defined(INET6) - if (ifa->ifa_addr->sa_family == AF_INET - || ifa->ifa_addr->sa_family == AF_INET6) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - en_reset_ul(sc); - en_init(sc); - } - ifa->ifa_rtrequest = atm_rtrequest; /* ??? */ - EN_UNLOCK(sc); - break; - } -#endif /* INET */ - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - en_reset_ul(sc); - en_init(sc); - } - EN_UNLOCK(sc); - break; - - case SIOCSIFFLAGS: - EN_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - en_init(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - en_reset_ul(sc); - } - EN_UNLOCK(sc); - break; - - case SIOCSIFMTU: - /* - * Set the interface MTU. - */ - if (ifr->ifr_mtu > ATMMTU) { - error = EINVAL; - break; - } - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCSIFMEDIA: - case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd); - break; - - case SIOCATMOPENVCC: /* kernel internal use */ - error = en_open_vcc(sc, (struct atmio_openvcc *)data); - break; - - case SIOCATMCLOSEVCC: /* kernel internal use */ - error = en_close_vcc(sc, (struct atmio_closevcc *)data); - break; - - case SIOCATMGETVCCS: /* internal netgraph use */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - MID_N_VC, sc->vccs_open, &sc->en_mtx, 0); - if (vtab == NULL) { - error = ENOMEM; - break; - } - *(void **)data = vtab; - break; - - case SIOCATMGVCCS: /* return vcc table */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - MID_N_VC, sc->vccs_open, &sc->en_mtx, 1); - error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) + - vtab->count * sizeof(vtab->vccs[0])); - free(vtab, M_DEVBUF); - break; - - default: - error = EINVAL; - break; - } - return (error); -} - -/*********************************************************************/ -/* - * Sysctl's - */ - -/* - * Sysctl handler for internal statistics - * - * LOCK: unlocked, needed - */ -static int -en_sysctl_istats(SYSCTL_HANDLER_ARGS) -{ - struct en_softc *sc = arg1; - uint32_t *ret; - int error; - - ret = malloc(sizeof(sc->stats), M_TEMP, M_WAITOK); - - EN_LOCK(sc); - bcopy(&sc->stats, ret, sizeof(sc->stats)); - EN_UNLOCK(sc); - - error = SYSCTL_OUT(req, ret, sizeof(sc->stats)); - free(ret, M_TEMP); - - return (error); -} - -/*********************************************************************/ -/* - * Interrupts - */ - -/* - * Transmit interrupt handler - * - * check for tx complete, if detected then this means that some space - * has come free on the card. we must account for it and arrange to - * kick the channel to life (in case it is stalled waiting on the card). - * - * LOCK: locked, needed - */ -static uint32_t -en_intr_tx(struct en_softc *sc, uint32_t reg) -{ - uint32_t kick; - uint32_t mask; - uint32_t val; - int chan; - - kick = 0; /* bitmask of channels to kick */ - - for (mask = 1, chan = 0; chan < EN_NTX; chan++, mask *= 2) { - if (!(reg & MID_TXCHAN(chan))) - continue; - - kick = kick | mask; - - /* current read pointer */ - val = en_read(sc, MIDX_READPTR(chan)); - /* as offset */ - val = (val * sizeof(uint32_t)) + sc->txslot[chan].start; - if (val > sc->txslot[chan].cur) - sc->txslot[chan].bfree = val - sc->txslot[chan].cur; - else - sc->txslot[chan].bfree = (val + (EN_TXSZ * 1024)) - - sc->txslot[chan].cur; - DBG(sc, INTR, ("tx%d: transmit done. %d bytes now free in " - "buffer", chan, sc->txslot[chan].bfree)); - } - return (kick); -} - -/* - * TX DMA interrupt - * - * check for TX DMA complete, if detected then this means - * that some DTQs are now free. it also means some indma - * mbufs can be freed. if we needed DTQs, kick all channels. - * - * LOCK: locked, needed - */ -static uint32_t -en_intr_tx_dma(struct en_softc *sc) -{ - uint32_t kick = 0; - uint32_t val; - uint32_t idx; - uint32_t slot; - uint32_t dtq; - struct en_map *map; - struct mbuf *m; - - val = en_read(sc, MID_DMA_RDTX); /* chip's current location */ - idx = MID_DTQ_A2REG(sc->dtq_chip); /* where we last saw chip */ - - if (sc->need_dtqs) { - kick = MID_NTX_CH - 1; /* assume power of 2, kick all! */ - sc->need_dtqs = 0; /* recalculated in "kick" loop below */ - DBG(sc, INTR, ("cleared need DTQ condition")); - } - - while (idx != val) { - sc->dtq_free++; - if ((dtq = sc->dtq[idx]) != 0) { - /* don't forget to zero it out when done */ - sc->dtq[idx] = 0; - slot = EN_DQ_SLOT(dtq); - - _IF_DEQUEUE(&sc->txslot[slot].indma, m); - if (m == NULL) - panic("enintr: dtqsync"); - map = (void *)m->m_pkthdr.rcvif; - uma_zfree(sc->map_zone, map); - m_freem(m); - - sc->txslot[slot].mbsize -= EN_DQ_LEN(dtq); - DBG(sc, INTR, ("tx%d: free %d dma bytes, mbsize now " - "%d", slot, EN_DQ_LEN(dtq), - sc->txslot[slot].mbsize)); - } - EN_WRAPADD(0, MID_DTQ_N, idx, 1); - } - sc->dtq_chip = MID_DTQ_REG2A(val); /* sync softc */ - - return (kick); -} - -/* - * Service interrupt - * - * LOCK: locked, needed - */ -static int -en_intr_service(struct en_softc *sc) -{ - uint32_t chip; - uint32_t vci; - int need_softserv = 0; - struct en_vcc *vc; - - chip = MID_SL_REG2A(en_read(sc, MID_SERV_WRITE)); - - while (sc->hwslistp != chip) { - /* fetch and remove it from hardware service list */ - vci = en_read(sc, sc->hwslistp); - EN_WRAPADD(MID_SLOFF, MID_SLEND, sc->hwslistp, 4); - - if ((vc = sc->vccs[vci]) == NULL || - (vc->vcc.flags & ATMIO_FLAG_NORX)) { - DBG(sc, INTR, ("unexpected rx interrupt VCI %d", vci)); - en_write(sc, MID_VC(vci), MIDV_TRASH); /* rx off */ - continue; - } - - /* remove from hwsl */ - en_write(sc, MID_VC(vci), vc->rxslot->mode); - EN_COUNT(sc->stats.hwpull); - - DBG(sc, INTR, ("pulled VCI %d off hwslist", vci)); - - /* add it to the software service list (if needed) */ - if ((vc->vflags & VCC_SWSL) == 0) { - EN_COUNT(sc->stats.swadd); - need_softserv = 1; - vc->vflags |= VCC_SWSL; - sc->swslist[sc->swsl_tail] = vci; - EN_WRAPADD(0, MID_SL_N, sc->swsl_tail, 1); - sc->swsl_size++; - DBG(sc, INTR, ("added VCI %d to swslist", vci)); - } - } - return (need_softserv); -} - -/* - * Handle a receive DMA completion - */ -static void -en_rx_drain(struct en_softc *sc, u_int drq) -{ - struct en_rxslot *slot; - struct en_vcc *vc; - struct mbuf *m; - struct atm_pseudohdr ah; - - slot = &sc->rxslot[EN_DQ_SLOT(drq)]; - - m = NULL; /* assume "JK" trash DMA */ - if (EN_DQ_LEN(drq) != 0) { - _IF_DEQUEUE(&slot->indma, m); - KASSERT(m != NULL, ("drqsync: %s: lost mbuf in slot %td!", - sc->ifp->if_xname, slot - sc->rxslot)); - uma_zfree(sc->map_zone, (struct en_map *)m->m_pkthdr.rcvif); - } - if ((vc = slot->vcc) == NULL) { - /* ups */ - if (m != NULL) - m_freem(m); - return; - } - - /* do something with this mbuf */ - if (vc->vflags & VCC_DRAIN) { - /* drain? */ - if (m != NULL) - m_freem(m); - if (_IF_QLEN(&slot->indma) == 0 && _IF_QLEN(&slot->q) == 0 && - (en_read(sc, MID_VC(vc->vcc.vci)) & MIDV_INSERVICE) == 0 && - (vc->vflags & VCC_SWSL) == 0) { - vc->vflags &= ~VCC_CLOSE_RX; - if (vc->vcc.flags & ATMIO_FLAG_ASYNC) - en_close_finish(sc, vc); - else - cv_signal(&sc->cv_close); - } - return; - } - - if (m != NULL) { - ATM_PH_FLAGS(&ah) = vc->vcc.flags; - ATM_PH_VPI(&ah) = 0; - ATM_PH_SETVCI(&ah, vc->vcc.vci); - - DBG(sc, INTR, ("rx%td: rxvci%d: atm_input, mbuf %p, len %d, " - "hand %p", slot - sc->rxslot, vc->vcc.vci, m, - EN_DQ_LEN(drq), vc->rxhand)); - - m->m_pkthdr.rcvif = sc->ifp; - if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); - - vc->ipackets++; - vc->ibytes += m->m_pkthdr.len; - -#ifdef EN_DEBUG - if (sc->debug & DBG_IPACKETS) - en_dump_packet(sc, m); -#endif -#ifdef ENABLE_BPF - BPF_MTAP(sc->ifp, m); -#endif - EN_UNLOCK(sc); - atm_input(sc->ifp, &ah, m, vc->rxhand); - EN_LOCK(sc); - } -} - -/* - * check for RX DMA complete, and pass the data "upstairs" - * - * LOCK: locked, needed - */ -static int -en_intr_rx_dma(struct en_softc *sc) -{ - uint32_t val; - uint32_t idx; - uint32_t drq; - - val = en_read(sc, MID_DMA_RDRX); /* chip's current location */ - idx = MID_DRQ_A2REG(sc->drq_chip); /* where we last saw chip */ - - while (idx != val) { - sc->drq_free++; - if ((drq = sc->drq[idx]) != 0) { - /* don't forget to zero it out when done */ - sc->drq[idx] = 0; - en_rx_drain(sc, drq); - } - EN_WRAPADD(0, MID_DRQ_N, idx, 1); - } - sc->drq_chip = MID_DRQ_REG2A(val); /* sync softc */ - - if (sc->need_drqs) { - /* true if we had a DRQ shortage */ - sc->need_drqs = 0; - DBG(sc, INTR, ("cleared need DRQ condition")); - return (1); - } else - return (0); -} - -/* - * en_mget: get an mbuf chain that can hold totlen bytes and return it - * (for recv). For the actual allocation totlen is rounded up to a multiple - * of 4. We also ensure, that each mbuf has a multiple of 4 bytes. - * - * After this call the sum of all the m_len's in the chain will be totlen. - * This is called at interrupt time, so we can't wait here. - * - * LOCK: any, not needed - */ -static struct mbuf * -en_mget(struct en_softc *sc, u_int pktlen) -{ - struct mbuf *m, *tmp; - u_int totlen, pad; - - totlen = roundup(pktlen, sizeof(uint32_t)); - pad = totlen - pktlen; - - /* - * First get an mbuf with header. Keep space for a couple of - * words at the begin. - */ - /* called from interrupt context */ - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == NULL) - return (NULL); - - m->m_pkthdr.rcvif = NULL; - m->m_pkthdr.len = pktlen; - m->m_len = EN_RX1BUF; - M_ALIGN(m, EN_RX1BUF); - if (m->m_len >= totlen) { - m->m_len = totlen; - - } else { - totlen -= m->m_len; - - /* called from interrupt context */ - tmp = m_getm(m, totlen, M_NOWAIT, MT_DATA); - if (tmp == NULL) { - m_free(m); - return (NULL); - } - tmp = m->m_next; - /* m_getm could do this for us */ - while (tmp != NULL) { - tmp->m_len = min(MCLBYTES, totlen); - totlen -= tmp->m_len; - tmp = tmp->m_next; - } - } - - return (m); -} - -/* - * Argument for RX DMAMAP loader. - */ -struct rxarg { - struct en_softc *sc; - struct mbuf *m; - u_int pre_skip; /* number of bytes to skip at begin */ - u_int post_skip; /* number of bytes to skip at end */ - struct en_vcc *vc; /* vc we are receiving on */ - int wait; /* wait for DRQ entries */ -}; - -/* - * Copy the segment table to the buffer for later use. And compute the - * number of dma queue entries we need. - * - * LOCK: locked, needed - */ -static void -en_rxdma_load(void *uarg, bus_dma_segment_t *segs, int nseg, - bus_size_t mapsize, int error) -{ - struct rxarg *rx = uarg; - struct en_softc *sc = rx->sc; - struct en_rxslot *slot = rx->vc->rxslot; - u_int free; /* number of free DRQ entries */ - uint32_t cur; /* current buffer offset */ - uint32_t drq; /* DRQ entry pointer */ - uint32_t last_drq; /* where we have written last */ - u_int needalign, cnt, count, bcode; - bus_addr_t addr; - bus_size_t rest; - int i; - - if (error != 0) - return; - if (nseg > EN_MAX_DMASEG) - panic("too many DMA segments"); - - rx->wait = 0; - - free = sc->drq_free; - drq = sc->drq_us; - cur = slot->cur; - - last_drq = 0; - - /* - * Local macro to add an entry to the receive DMA area. If there - * are no entries left, return. Save the byte offset of the entry - * in last_drq for later use. - */ -#define PUT_DRQ_ENTRY(ENI, BCODE, COUNT, ADDR) \ - if (free == 0) { \ - EN_COUNT(sc->stats.rxdrqout); \ - rx->wait = 1; \ - return; \ - } \ - last_drq = drq; \ - en_write(sc, drq + 0, (ENI || !sc->is_adaptec) ? \ - MID_MK_RXQ_ENI(COUNT, rx->vc->vcc.vci, 0, BCODE) : \ - MID_MK_RXQ_ADP(COUNT, rx->vc->vcc.vci, 0, BCODE)); \ - en_write(sc, drq + 4, ADDR); \ - \ - EN_WRAPADD(MID_DRQOFF, MID_DRQEND, drq, 8); \ - free--; - - /* - * Local macro to generate a DMA entry to DMA cnt bytes. Updates - * the current buffer byte offset accordingly. - */ -#define DO_DRQ(TYPE) do { \ - rest -= cnt; \ - EN_WRAPADD(slot->start, slot->stop, cur, cnt); \ - DBG(sc, SERV, ("rx%td: "TYPE" %u bytes, %ju left, cur %#x", \ - slot - sc->rxslot, cnt, (uintmax_t)rest, cur)); \ - \ - PUT_DRQ_ENTRY(1, bcode, count, addr); \ - \ - addr += cnt; \ - } while (0) - - /* - * Skip the RBD at the beginning - */ - if (rx->pre_skip > 0) { - /* update DMA address */ - EN_WRAPADD(slot->start, slot->stop, cur, rx->pre_skip); - - PUT_DRQ_ENTRY(0, MIDDMA_JK, WORD_IDX(slot->start, cur), 0); - } - - for (i = 0; i < nseg; i++, segs++) { - addr = segs->ds_addr; - rest = segs->ds_len; - - if (sc->is_adaptec) { - /* adaptec card - simple */ - - /* advance the on-card buffer pointer */ - EN_WRAPADD(slot->start, slot->stop, cur, rest); - DBG(sc, SERV, ("rx%td: adp %ju bytes %#jx " - "(cur now 0x%x)", slot - sc->rxslot, - (uintmax_t)rest, (uintmax_t)addr, cur)); - - PUT_DRQ_ENTRY(0, 0, rest, addr); - - continue; - } - - /* - * do we need to do a DMA op to align to the maximum - * burst? Note, that we are alway 32-bit aligned. - */ - if (sc->alburst && - (needalign = (addr & sc->bestburstmask)) != 0) { - /* compute number of bytes, words and code */ - cnt = sc->bestburstlen - needalign; - if (cnt > rest) - cnt = rest; - count = cnt / sizeof(uint32_t); - if (sc->noalbursts) { - bcode = MIDDMA_WORD; - } else { - bcode = en_dmaplan[count].bcode; - count = cnt >> en_dmaplan[count].divshift; - } - DO_DRQ("al_dma"); - } - - /* do we need to do a max-sized burst? */ - if (rest >= sc->bestburstlen) { - count = rest >> sc->bestburstshift; - cnt = count << sc->bestburstshift; - bcode = sc->bestburstcode; - DO_DRQ("best_dma"); - } - - /* do we need to do a cleanup burst? */ - if (rest != 0) { - cnt = rest; - count = rest / sizeof(uint32_t); - if (sc->noalbursts) { - bcode = MIDDMA_WORD; - } else { - bcode = en_dmaplan[count].bcode; - count = cnt >> en_dmaplan[count].divshift; - } - DO_DRQ("clean_dma"); - } - } - - /* - * Skip stuff at the end - */ - if (rx->post_skip > 0) { - /* update DMA address */ - EN_WRAPADD(slot->start, slot->stop, cur, rx->post_skip); - - PUT_DRQ_ENTRY(0, MIDDMA_JK, WORD_IDX(slot->start, cur), 0); - } - - /* record the end for the interrupt routine */ - sc->drq[MID_DRQ_A2REG(last_drq)] = - EN_DQ_MK(slot - sc->rxslot, rx->m->m_pkthdr.len); - - /* set the end flag in the last descriptor */ - en_write(sc, last_drq + 0, SETQ_END(sc, en_read(sc, last_drq + 0))); - -#undef PUT_DRQ_ENTRY -#undef DO_DRQ - - /* commit */ - slot->cur = cur; - sc->drq_free = free; - sc->drq_us = drq; - - /* signal to card */ - en_write(sc, MID_DMA_WRRX, MID_DRQ_A2REG(sc->drq_us)); -} - -/* - * en_service: handle a service interrupt - * - * Q: why do we need a software service list? - * - * A: if we remove a VCI from the hardware list and we find that we are - * out of DRQs we must defer processing until some DRQs become free. - * so we must remember to look at this RX VCI/slot later, but we can't - * put it back on the hardware service list (since that isn't allowed). - * so we instead save it on the software service list. it would be nice - * if we could peek at the VCI on top of the hwservice list without removing - * it, however this leads to a race condition: if we peek at it and - * decide we are done with it new data could come in before we have a - * chance to remove it from the hwslist. by the time we get it out of - * the list the interrupt for the new data will be lost. oops! - * - * LOCK: locked, needed - */ -static void -en_service(struct en_softc *sc) -{ - struct mbuf *m, *lastm; - struct en_map *map; - struct rxarg rx; - uint32_t cur; - uint32_t dstart; /* data start (as reported by card) */ - uint32_t rbd; /* receive buffer descriptor */ - uint32_t pdu; /* AAL5 trailer */ - int mlen; - int error; - struct en_rxslot *slot; - struct en_vcc *vc; - - rx.sc = sc; - - next_vci: - if (sc->swsl_size == 0) { - DBG(sc, SERV, ("en_service done")); - return; - } - - /* - * get vcc to service - */ - rx.vc = vc = sc->vccs[sc->swslist[sc->swsl_head]]; - slot = vc->rxslot; - KASSERT (slot->vcc->rxslot == slot, ("en_service: rx slot/vci sync")); - - /* - * determine our mode and if we've got any work to do - */ - DBG(sc, SERV, ("rx%td: service vci=%d start/stop/cur=0x%x 0x%x " - "0x%x", slot - sc->rxslot, vc->vcc.vci, slot->start, - slot->stop, slot->cur)); - - same_vci: - cur = slot->cur; - - dstart = MIDV_DSTART(en_read(sc, MID_DST_RP(vc->vcc.vci))); - dstart = (dstart * sizeof(uint32_t)) + slot->start; - - /* check to see if there is any data at all */ - if (dstart == cur) { - EN_WRAPADD(0, MID_SL_N, sc->swsl_head, 1); - /* remove from swslist */ - vc->vflags &= ~VCC_SWSL; - sc->swsl_size--; - DBG(sc, SERV, ("rx%td: remove vci %d from swslist", - slot - sc->rxslot, vc->vcc.vci)); - goto next_vci; - } - - /* - * figure out how many bytes we need - * [mlen = # bytes to go in mbufs] - */ - rbd = en_read(sc, cur); - if (MID_RBD_ID(rbd) != MID_RBD_STDID) - panic("en_service: id mismatch"); - - if (rbd & MID_RBD_T) { - mlen = 0; /* we've got trash */ - rx.pre_skip = MID_RBD_SIZE; - rx.post_skip = 0; - EN_COUNT(sc->stats.ttrash); - DBG(sc, SERV, ("RX overflow lost %d cells!", MID_RBD_CNT(rbd))); - - } else if (vc->vcc.aal != ATMIO_AAL_5) { - /* 1 cell (ick!) */ - mlen = MID_CHDR_SIZE + MID_ATMDATASZ; - rx.pre_skip = MID_RBD_SIZE; - rx.post_skip = 0; - - } else { - rx.pre_skip = MID_RBD_SIZE; - - /* get PDU trailer in correct byte order */ - pdu = cur + MID_RBD_CNT(rbd) * MID_ATMDATASZ + - MID_RBD_SIZE - MID_PDU_SIZE; - if (pdu >= slot->stop) - pdu -= EN_RXSZ * 1024; - pdu = en_read(sc, pdu); - - if (MID_RBD_CNT(rbd) * MID_ATMDATASZ < - MID_PDU_LEN(pdu)) { - device_printf(sc->dev, "invalid AAL5 length\n"); - rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ; - mlen = 0; - if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); - - } else if (rbd & MID_RBD_CRCERR) { - device_printf(sc->dev, "CRC error\n"); - rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ; - mlen = 0; - if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); - - } else { - mlen = MID_PDU_LEN(pdu); - rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ - mlen; - } - } - - /* - * now allocate mbufs for mlen bytes of data, if out of mbufs, trash all - * - * notes: - * 1. it is possible that we've already allocated an mbuf for this pkt - * but ran out of DRQs, in which case we saved the allocated mbuf - * on "q". - * 2. if we save an buf in "q" we store the "cur" (pointer) in the - * buf as an identity (that we can check later). - * 3. after this block of code, if m is still NULL then we ran out of - * mbufs - */ - _IF_DEQUEUE(&slot->q, m); - if (m != NULL) { - if (m->m_pkthdr.csum_data != cur) { - /* wasn't ours */ - DBG(sc, SERV, ("rx%td: q'ed buf %p not ours", - slot - sc->rxslot, m)); - _IF_PREPEND(&slot->q, m); - m = NULL; - EN_COUNT(sc->stats.rxqnotus); - } else { - EN_COUNT(sc->stats.rxqus); - DBG(sc, SERV, ("rx%td: recovered q'ed buf %p", - slot - sc->rxslot, m)); - } - } - if (mlen == 0 && m != NULL) { - /* should not happen */ - m_freem(m); - m = NULL; - } - - if (mlen != 0 && m == NULL) { - m = en_mget(sc, mlen); - if (m == NULL) { - rx.post_skip += mlen; - mlen = 0; - EN_COUNT(sc->stats.rxmbufout); - DBG(sc, SERV, ("rx%td: out of mbufs", - slot - sc->rxslot)); - } else - rx.post_skip -= roundup(mlen, sizeof(uint32_t)) - mlen; - - DBG(sc, SERV, ("rx%td: allocate buf %p, mlen=%d", - slot - sc->rxslot, m, mlen)); - } - - DBG(sc, SERV, ("rx%td: VCI %d, rbuf %p, mlen %d, skip %u/%u", - slot - sc->rxslot, vc->vcc.vci, m, mlen, rx.pre_skip, - rx.post_skip)); - - if (m != NULL) { - /* M_NOWAIT - called from interrupt context */ - map = uma_zalloc_arg(sc->map_zone, sc, M_NOWAIT); - if (map == NULL) { - rx.post_skip += mlen; - m_freem(m); - DBG(sc, SERV, ("rx%td: out of maps", - slot - sc->rxslot)); - goto skip; - } - rx.m = m; - error = bus_dmamap_load_mbuf(sc->txtag, map->map, m, - en_rxdma_load, &rx, BUS_DMA_NOWAIT); - - if (error != 0) { - device_printf(sc->dev, "loading RX map failed " - "%d\n", error); - uma_zfree(sc->map_zone, map); - m_freem(m); - rx.post_skip += mlen; - goto skip; - - } - map->flags |= ENMAP_LOADED; - - if (rx.wait) { - /* out of DRQs - wait */ - uma_zfree(sc->map_zone, map); - - m->m_pkthdr.csum_data = cur; - _IF_ENQUEUE(&slot->q, m); - EN_COUNT(sc->stats.rxdrqout); - - sc->need_drqs = 1; /* flag condition */ - return; - - } - (void)m_length(m, &lastm); - lastm->m_len -= roundup(mlen, sizeof(uint32_t)) - mlen; - - m->m_pkthdr.rcvif = (void *)map; - _IF_ENQUEUE(&slot->indma, m); - - /* get next packet in this slot */ - goto same_vci; - } - skip: - /* - * Here we end if we should drop the packet from the receive buffer. - * The number of bytes to drop is in fill. We can do this with on - * JK entry. If we don't even have that one - wait. - */ - if (sc->drq_free == 0) { - sc->need_drqs = 1; /* flag condition */ - return; - } - rx.post_skip += rx.pre_skip; - DBG(sc, SERV, ("rx%td: skipping %u", slot - sc->rxslot, rx.post_skip)); - - /* advance buffer address */ - EN_WRAPADD(slot->start, slot->stop, cur, rx.post_skip); - - /* write DRQ entry */ - if (sc->is_adaptec) - en_write(sc, sc->drq_us, - MID_MK_RXQ_ADP(WORD_IDX(slot->start, cur), - vc->vcc.vci, MID_DMA_END, MIDDMA_JK)); - else - en_write(sc, sc->drq_us, - MID_MK_RXQ_ENI(WORD_IDX(slot->start, cur), - vc->vcc.vci, MID_DMA_END, MIDDMA_JK)); - en_write(sc, sc->drq_us + 4, 0); - EN_WRAPADD(MID_DRQOFF, MID_DRQEND, sc->drq_us, 8); - sc->drq_free--; - - /* signal to RX interrupt */ - sc->drq[MID_DRQ_A2REG(sc->drq_us)] = EN_DQ_MK(slot - sc->rxslot, 0); - slot->cur = cur; - - /* signal to card */ - en_write(sc, MID_DMA_WRRX, MID_DRQ_A2REG(sc->drq_us)); - - goto same_vci; -} - -/* - * interrupt handler - * - * LOCK: unlocked, needed - */ -void -en_intr(void *arg) -{ - struct en_softc *sc = arg; - uint32_t reg, kick, mask; - int lcv, need_softserv; - - EN_LOCK(sc); - - reg = en_read(sc, MID_INTACK); - DBG(sc, INTR, ("interrupt=0x%b", reg, MID_INTBITS)); - - if ((reg & MID_INT_ANY) == 0) { - EN_UNLOCK(sc); - return; - } - - /* - * unexpected errors that need a reset - */ - if ((reg & (MID_INT_IDENT | MID_INT_LERR | MID_INT_DMA_ERR)) != 0) { - device_printf(sc->dev, "unexpected interrupt=0x%b, " - "resetting\n", reg, MID_INTBITS); -#ifdef EN_DEBUG - panic("en: unexpected error"); -#else - en_reset_ul(sc); - en_init(sc); -#endif - EN_UNLOCK(sc); - return; - } - - if (reg & MID_INT_SUNI) - utopia_intr(&sc->utopia); - - kick = 0; - if (reg & MID_INT_TX) - kick |= en_intr_tx(sc, reg); - - if (reg & MID_INT_DMA_TX) - kick |= en_intr_tx_dma(sc); - - /* - * kick xmit channels as needed. - */ - if (kick) { - DBG(sc, INTR, ("tx kick mask = 0x%x", kick)); - for (mask = 1, lcv = 0 ; lcv < EN_NTX ; lcv++, mask = mask * 2) - if ((kick & mask) && _IF_QLEN(&sc->txslot[lcv].q) != 0) - en_txdma(sc, &sc->txslot[lcv]); - } - - need_softserv = 0; - if (reg & MID_INT_DMA_RX) - need_softserv |= en_intr_rx_dma(sc); - - if (reg & MID_INT_SERVICE) - need_softserv |= en_intr_service(sc); - - if (need_softserv) - en_service(sc); - - /* - * keep our stats - */ - if (reg & MID_INT_DMA_OVR) { - EN_COUNT(sc->stats.dmaovr); - DBG(sc, INTR, ("MID_INT_DMA_OVR")); - } - reg = en_read(sc, MID_STAT); - sc->stats.otrash += MID_OTRASH(reg); - sc->stats.vtrash += MID_VTRASH(reg); - - EN_UNLOCK(sc); -} - -/* - * Read at most n SUNI regs starting at reg into val - */ -static int -en_utopia_readregs(struct ifatm *ifatm, u_int reg, uint8_t *val, u_int *n) -{ - struct en_softc *sc = ifatm->ifp->if_softc; - u_int i; - - EN_CHECKLOCK(sc); - if (reg >= MID_NSUNI) - return (EINVAL); - if (reg + *n > MID_NSUNI) - *n = MID_NSUNI - reg; - - for (i = 0; i < *n; i++) - val[i] = en_read(sc, MID_SUNIOFF + 4 * (reg + i)); - - return (0); -} - -/* - * change the bits given by mask to them in val in register reg - */ -static int -en_utopia_writereg(struct ifatm *ifatm, u_int reg, u_int mask, u_int val) -{ - struct en_softc *sc = ifatm->ifp->if_softc; - uint32_t regval; - - EN_CHECKLOCK(sc); - if (reg >= MID_NSUNI) - return (EINVAL); - regval = en_read(sc, MID_SUNIOFF + 4 * reg); - regval = (regval & ~mask) | (val & mask); - en_write(sc, MID_SUNIOFF + 4 * reg, regval); - return (0); -} - -static const struct utopia_methods en_utopia_methods = { - en_utopia_readregs, - en_utopia_writereg -}; - -/*********************************************************************/ -/* - * Probing the DMA brokeness of the card - */ - -/* - * Physical address load helper function for DMA probe - * - * LOCK: unlocked, not needed - */ -static void -en_dmaprobe_load(void *uarg, bus_dma_segment_t *segs, int nseg, int error) -{ - if (error == 0) - *(bus_addr_t *)uarg = segs[0].ds_addr; -} - -/* - * en_dmaprobe: helper function for en_attach. - * - * see how the card handles DMA by running a few DMA tests. we need - * to figure out the largest number of bytes we can DMA in one burst - * ("bestburstlen"), and if the starting address for a burst needs to - * be aligned on any sort of boundary or not ("alburst"). - * - * Things turn out more complex than that, because on my (harti) brand - * new motherboard (2.4GHz) we can do 64byte aligned DMAs, but everything - * we more than 4 bytes fails (with an RX DMA timeout) for physical - * addresses that end with 0xc. Therefor we search not only the largest - * burst that is supported (hopefully 64) but also check what is the largerst - * unaligned supported size. If that appears to be lesser than 4 words, - * set the noalbursts flag. That will be set only if also alburst is set. - */ - -/* - * en_dmaprobe_doit: do actual testing for the DMA test. - * Cycle through all bursts sizes from 8 up to 64 and try whether it works. - * Return the largest one that works. - * - * LOCK: unlocked, not needed - */ -static int -en_dmaprobe_doit(struct en_softc *sc, uint8_t *sp, bus_addr_t psp) -{ - uint8_t *dp = sp + MIDDMA_MAXBURST; - bus_addr_t pdp = psp + MIDDMA_MAXBURST; - int lcv, retval = 4, cnt; - uint32_t reg, bcode, midvloc; - - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); /* reset card before touching RAM */ - - /* - * set up a 1k buffer at MID_BUFOFF - */ - midvloc = ((MID_BUFOFF - MID_RAMOFF) / sizeof(uint32_t)) - >> MIDV_LOCTOPSHFT; - en_write(sc, MIDX_PLACE(0), MIDX_MKPLACE(en_k2sz(1), midvloc)); - en_write(sc, MID_VC(0), (midvloc << MIDV_LOCSHIFT) - | (en_k2sz(1) << MIDV_SZSHIFT) | MIDV_TRASH); - en_write(sc, MID_DST_RP(0), 0); - en_write(sc, MID_WP_ST_CNT(0), 0); - - /* set up sample data */ - for (lcv = 0 ; lcv < MIDDMA_MAXBURST; lcv++) - sp[lcv] = lcv + 1; - - /* enable DMA (only) */ - en_write(sc, MID_MAST_CSR, MID_MCSR_ENDMA); - - sc->drq_chip = MID_DRQ_REG2A(en_read(sc, MID_DMA_RDRX)); - sc->dtq_chip = MID_DTQ_REG2A(en_read(sc, MID_DMA_RDTX)); - - /* - * try it now . . . DMA it out, then DMA it back in and compare - * - * note: in order to get the dma stuff to reverse directions it wants - * the "end" flag set! since we are not dma'ing valid data we may - * get an ident mismatch interrupt (which we will ignore). - */ - DBG(sc, DMA, ("test sp=%p/%#lx, dp=%p/%#lx", - sp, (u_long)psp, dp, (u_long)pdp)); - for (lcv = 8 ; lcv <= MIDDMA_MAXBURST ; lcv = lcv * 2) { - DBG(sc, DMA, ("test lcv=%d", lcv)); - - /* zero SRAM and dest buffer */ - bus_space_set_region_4(sc->en_memt, sc->en_base, - MID_BUFOFF, 0, 1024 / 4); - bzero(dp, MIDDMA_MAXBURST); - - bcode = en_sz2b(lcv); - - /* build lcv-byte-DMA x NBURSTS */ - if (sc->is_adaptec) - en_write(sc, sc->dtq_chip, - MID_MK_TXQ_ADP(lcv, 0, MID_DMA_END, 0)); - else - en_write(sc, sc->dtq_chip, - MID_MK_TXQ_ENI(1, 0, MID_DMA_END, bcode)); - en_write(sc, sc->dtq_chip + 4, psp); - EN_WRAPADD(MID_DTQOFF, MID_DTQEND, sc->dtq_chip, 8); - en_write(sc, MID_DMA_WRTX, MID_DTQ_A2REG(sc->dtq_chip)); - - cnt = 1000; - while ((reg = en_readx(sc, MID_DMA_RDTX)) != - MID_DTQ_A2REG(sc->dtq_chip)) { - DELAY(1); - if (--cnt == 0) { - DBG(sc, DMA, ("unexpected timeout in tx " - "DMA test\n alignment=0x%lx, burst size=%d" - ", dma addr reg=%#x, rdtx=%#x, stat=%#x\n", - (u_long)sp & 63, lcv, - en_read(sc, MID_DMA_ADDR), reg, - en_read(sc, MID_INTSTAT))); - return (retval); - } - } - - reg = en_read(sc, MID_INTACK); - if ((reg & MID_INT_DMA_TX) != MID_INT_DMA_TX) { - DBG(sc, DMA, ("unexpected status in tx DMA test: %#x\n", - reg)); - return (retval); - } - /* re-enable DMA (only) */ - en_write(sc, MID_MAST_CSR, MID_MCSR_ENDMA); - - /* "return to sender..." address is known ... */ - - /* build lcv-byte-DMA x NBURSTS */ - if (sc->is_adaptec) - en_write(sc, sc->drq_chip, - MID_MK_RXQ_ADP(lcv, 0, MID_DMA_END, 0)); - else - en_write(sc, sc->drq_chip, - MID_MK_RXQ_ENI(1, 0, MID_DMA_END, bcode)); - en_write(sc, sc->drq_chip + 4, pdp); - EN_WRAPADD(MID_DRQOFF, MID_DRQEND, sc->drq_chip, 8); - en_write(sc, MID_DMA_WRRX, MID_DRQ_A2REG(sc->drq_chip)); - cnt = 1000; - while ((reg = en_readx(sc, MID_DMA_RDRX)) != - MID_DRQ_A2REG(sc->drq_chip)) { - DELAY(1); - cnt--; - if (--cnt == 0) { - DBG(sc, DMA, ("unexpected timeout in rx " - "DMA test, rdrx=%#x\n", reg)); - return (retval); - } - } - reg = en_read(sc, MID_INTACK); - if ((reg & MID_INT_DMA_RX) != MID_INT_DMA_RX) { - DBG(sc, DMA, ("unexpected status in rx DMA " - "test: 0x%x\n", reg)); - return (retval); - } - if (bcmp(sp, dp, lcv)) { - DBG(sc, DMA, ("DMA test failed! lcv=%d, sp=%p, " - "dp=%p", lcv, sp, dp)); - return (retval); - } - - retval = lcv; - } - return (retval); /* studly 64 byte DMA present! oh baby!! */ -} - -/* - * Find the best DMA parameters - * - * LOCK: unlocked, not needed - */ -static void -en_dmaprobe(struct en_softc *sc) -{ - bus_dma_tag_t tag; - bus_dmamap_t map; - int err; - void *buffer; - int bestalgn, lcv, try, bestnoalgn; - bus_addr_t phys; - uint8_t *addr; - - sc->alburst = 0; - sc->noalbursts = 0; - - /* - * Allocate some DMA-able memory. - * We need 3 times the max burst size aligned to the max burst size. - */ - err = bus_dma_tag_create(bus_get_dma_tag(sc->dev), MIDDMA_MAXBURST, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - 3 * MIDDMA_MAXBURST, 1, 3 * MIDDMA_MAXBURST, 0, - NULL, NULL, &tag); - if (err) - panic("%s: cannot create test DMA tag %d", __func__, err); - - err = bus_dmamem_alloc(tag, &buffer, 0, &map); - if (err) - panic("%s: cannot allocate test DMA memory %d", __func__, err); - - err = bus_dmamap_load(tag, map, buffer, 3 * MIDDMA_MAXBURST, - en_dmaprobe_load, &phys, BUS_DMA_NOWAIT); - if (err) - panic("%s: cannot load test DMA map %d", __func__, err); - addr = buffer; - DBG(sc, DMA, ("phys=%#lx addr=%p", (u_long)phys, addr)); - - /* - * Now get the best burst size of the aligned case. - */ - bestalgn = bestnoalgn = en_dmaprobe_doit(sc, addr, phys); - - /* - * Now try unaligned. - */ - for (lcv = 4; lcv < MIDDMA_MAXBURST; lcv += 4) { - try = en_dmaprobe_doit(sc, addr + lcv, phys + lcv); - - if (try < bestnoalgn) - bestnoalgn = try; - } - - if (bestnoalgn < bestalgn) { - sc->alburst = 1; - if (bestnoalgn < 32) - sc->noalbursts = 1; - } - - sc->bestburstlen = bestalgn; - sc->bestburstshift = en_log2(bestalgn); - sc->bestburstmask = sc->bestburstlen - 1; /* must be power of 2 */ - sc->bestburstcode = en_sz2b(bestalgn); - - /* - * Reset the chip before freeing the buffer. It may still be trying - * to DMA. - */ - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); /* reset card before touching RAM */ - - DELAY(10000); /* may still do DMA */ - - /* - * Free the DMA stuff - */ - bus_dmamap_unload(tag, map); - bus_dmamem_free(tag, buffer, map); - bus_dma_tag_destroy(tag); -} - -/*********************************************************************/ -/* - * Attach/detach. - */ - -/* - * Attach to the card. - * - * LOCK: unlocked, not needed (but initialized) - */ -int -en_attach(struct en_softc *sc) -{ - struct ifnet *ifp = sc->ifp; - int sz; - uint32_t reg, lcv, check, ptr, sav, midvloc; - -#ifdef EN_DEBUG - sc->debug = EN_DEBUG; -#endif - - /* - * Probe card to determine memory size. - * - * The stupid ENI card always reports to PCI that it needs 4MB of - * space (2MB regs and 2MB RAM). If it has less than 2MB RAM the - * addresses wrap in the RAM address space (i.e. on a 512KB card - * addresses 0x3ffffc, 0x37fffc, and 0x2ffffc are aliases for - * 0x27fffc [note that RAM starts at offset 0x200000]). - */ - - /* reset card before touching RAM */ - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); - - for (lcv = MID_PROBEOFF; lcv <= MID_MAXOFF ; lcv += MID_PROBSIZE) { - en_write(sc, lcv, lcv); /* data[address] = address */ - for (check = MID_PROBEOFF; check < lcv ;check += MID_PROBSIZE) { - reg = en_read(sc, check); - if (reg != check) - /* found an alias! - quit */ - goto done_probe; - } - } - done_probe: - lcv -= MID_PROBSIZE; /* take one step back */ - sc->en_obmemsz = (lcv + 4) - MID_RAMOFF; - - /* - * determine the largest DMA burst supported - */ - en_dmaprobe(sc); - - /* - * "hello world" - */ - - /* reset */ - if (sc->en_busreset) - sc->en_busreset(sc); - en_write(sc, MID_RESID, 0x0); /* reset */ - - /* zero memory */ - bus_space_set_region_4(sc->en_memt, sc->en_base, - MID_RAMOFF, 0, sc->en_obmemsz / 4); - - reg = en_read(sc, MID_RESID); - - device_printf(sc->dev, "ATM midway v%d, board IDs %d.%d, %s%s%s, " - "%ldKB on-board RAM\n", MID_VER(reg), MID_MID(reg), MID_DID(reg), - (MID_IS_SABRE(reg)) ? "sabre controller, " : "", - (MID_IS_SUNI(reg)) ? "SUNI" : "Utopia", - (!MID_IS_SUNI(reg) && MID_IS_UPIPE(reg)) ? " (pipelined)" : "", - (long)sc->en_obmemsz / 1024); - - /* - * fill in common ATM interface stuff - */ - IFP2IFATM(sc->ifp)->mib.hw_version = (MID_VER(reg) << 16) | - (MID_MID(reg) << 8) | MID_DID(reg); - if (MID_DID(reg) & 0x4) - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UTP_155; - else - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_155; - - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - IFP2IFATM(sc->ifp)->mib.vpi_bits = 0; - IFP2IFATM(sc->ifp)->mib.vci_bits = MID_VCI_BITS; - IFP2IFATM(sc->ifp)->mib.max_vccs = MID_N_VC; - IFP2IFATM(sc->ifp)->mib.max_vpcs = 0; - - if (sc->is_adaptec) { - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_ADP155P; - if (sc->bestburstlen == 64 && sc->alburst == 0) - device_printf(sc->dev, - "passed 64 byte DMA test\n"); - else - device_printf(sc->dev, "FAILED DMA TEST: " - "burst=%d, alburst=%d\n", sc->bestburstlen, - sc->alburst); - } else { - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_ENI155P; - device_printf(sc->dev, "maximum DMA burst length = %d " - "bytes%s\n", sc->bestburstlen, sc->alburst ? - sc->noalbursts ? " (no large bursts)" : " (must align)" : - ""); - } - - /* - * link into network subsystem and prepare card - */ - sc->ifp->if_softc = sc; - ifp->if_flags = IFF_SIMPLEX; - ifp->if_ioctl = en_ioctl; - ifp->if_start = en_start; - - mtx_init(&sc->en_mtx, device_get_nameunit(sc->dev), - MTX_NETWORK_LOCK, MTX_DEF); - cv_init(&sc->cv_close, "VC close"); - - /* - * Make the sysctl tree - */ - sysctl_ctx_init(&sc->sysctl_ctx); - - if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO, - device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "")) == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "istats", CTLTYPE_OPAQUE | CTLFLAG_RD, sc, 0, - en_sysctl_istats, "S", "internal statistics") == NULL) - goto fail; - -#ifdef EN_DEBUG - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "debug", CTLFLAG_RW , &sc->debug, 0, "") == NULL) - goto fail; -#endif - - IFP2IFATM(sc->ifp)->phy = &sc->utopia; - utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->en_mtx, - &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - &en_utopia_methods); - utopia_init_media(&sc->utopia); - - MGET(sc->padbuf, M_WAITOK, MT_DATA); - bzero(sc->padbuf->m_data, MLEN); - - if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - EN_TXSZ * 1024, EN_MAX_DMASEG, EN_TXSZ * 1024, 0, - NULL, NULL, &sc->txtag)) - goto fail; - - sc->map_zone = uma_zcreate("en dma maps", sizeof(struct en_map), - en_map_ctor, en_map_dtor, NULL, en_map_fini, UMA_ALIGN_PTR, - UMA_ZONE_ZINIT); - if (sc->map_zone == NULL) - goto fail; - uma_zone_set_max(sc->map_zone, EN_MAX_MAPS); - - /* - * init softc - */ - sc->vccs = malloc(MID_N_VC * sizeof(sc->vccs[0]), - M_DEVBUF, M_ZERO | M_WAITOK); - - sz = sc->en_obmemsz - (MID_BUFOFF - MID_RAMOFF); - ptr = sav = MID_BUFOFF; - ptr = roundup(ptr, EN_TXSZ * 1024); /* align */ - sz = sz - (ptr - sav); - if (EN_TXSZ*1024 * EN_NTX > sz) { - device_printf(sc->dev, "EN_NTX/EN_TXSZ too big\n"); - goto fail; - } - for (lcv = 0 ;lcv < EN_NTX ;lcv++) { - sc->txslot[lcv].mbsize = 0; - sc->txslot[lcv].start = ptr; - ptr += (EN_TXSZ * 1024); - sz -= (EN_TXSZ * 1024); - sc->txslot[lcv].stop = ptr; - sc->txslot[lcv].nref = 0; - DBG(sc, INIT, ("tx%d: start 0x%x, stop 0x%x", lcv, - sc->txslot[lcv].start, sc->txslot[lcv].stop)); - } - - sav = ptr; - ptr = roundup(ptr, EN_RXSZ * 1024); /* align */ - sz = sz - (ptr - sav); - sc->en_nrx = sz / (EN_RXSZ * 1024); - if (sc->en_nrx <= 0) { - device_printf(sc->dev, "EN_NTX/EN_TXSZ/EN_RXSZ too big\n"); - goto fail; - } - - /* - * ensure that there is always one VC slot on the service list free - * so that we can tell the difference between a full and empty list. - */ - if (sc->en_nrx >= MID_N_VC) - sc->en_nrx = MID_N_VC - 1; - - for (lcv = 0 ; lcv < sc->en_nrx ; lcv++) { - sc->rxslot[lcv].vcc = NULL; - midvloc = sc->rxslot[lcv].start = ptr; - ptr += (EN_RXSZ * 1024); - sz -= (EN_RXSZ * 1024); - sc->rxslot[lcv].stop = ptr; - midvloc = midvloc - MID_RAMOFF; - /* mask, cvt to words */ - midvloc = rounddown2(midvloc, EN_RXSZ * 1024) >> 2; - /* we only want the top 11 bits */ - midvloc = midvloc >> MIDV_LOCTOPSHFT; - midvloc = (midvloc & MIDV_LOCMASK) << MIDV_LOCSHIFT; - sc->rxslot[lcv].mode = midvloc | - (en_k2sz(EN_RXSZ) << MIDV_SZSHIFT) | MIDV_TRASH; - - DBG(sc, INIT, ("rx%d: start 0x%x, stop 0x%x, mode 0x%x", lcv, - sc->rxslot[lcv].start, sc->rxslot[lcv].stop, - sc->rxslot[lcv].mode)); - } - - device_printf(sc->dev, "%d %dKB receive buffers, %d %dKB transmit " - "buffers\n", sc->en_nrx, EN_RXSZ, EN_NTX, EN_TXSZ); - device_printf(sc->dev, "end station identifier (mac address) " - "%6D\n", IFP2IFATM(sc->ifp)->mib.esi, ":"); - - /* - * Start SUNI stuff. This will call our readregs/writeregs - * functions and these assume the lock to be held so we must get it - * here. - */ - EN_LOCK(sc); - utopia_start(&sc->utopia); - utopia_reset(&sc->utopia); - EN_UNLOCK(sc); - - /* - * final commit - */ - atm_ifattach(ifp); - -#ifdef ENABLE_BPF - bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); -#endif - - return (0); - - fail: - en_destroy(sc); - return (-1); -} - -/* - * Free all internal resources. No access to bus resources here. - * No locking required here (interrupt is already disabled). - * - * LOCK: unlocked, needed (but destroyed) - */ -void -en_destroy(struct en_softc *sc) -{ - u_int i; - - if (sc->utopia.state & UTP_ST_ATTACHED) { - /* these assume the lock to be held */ - EN_LOCK(sc); - utopia_stop(&sc->utopia); - utopia_detach(&sc->utopia); - EN_UNLOCK(sc); - } - - if (sc->vccs != NULL) { - /* get rid of sticky VCCs */ - for (i = 0; i < MID_N_VC; i++) - if (sc->vccs[i] != NULL) - uma_zfree(en_vcc_zone, sc->vccs[i]); - free(sc->vccs, M_DEVBUF); - } - - if (sc->padbuf != NULL) - m_free(sc->padbuf); - - /* - * Destroy the map zone before the tag (the fini function will - * destroy the DMA maps using the tag) - */ - if (sc->map_zone != NULL) - uma_zdestroy(sc->map_zone); - - if (sc->txtag != NULL) - bus_dma_tag_destroy(sc->txtag); - - (void)sysctl_ctx_free(&sc->sysctl_ctx); - - cv_destroy(&sc->cv_close); - mtx_destroy(&sc->en_mtx); -} - -/* - * Module loaded/unloaded - */ -int -en_modevent(module_t mod __unused, int event, void *arg __unused) -{ - - switch (event) { - - case MOD_LOAD: - en_vcc_zone = uma_zcreate("EN vccs", sizeof(struct en_vcc), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (en_vcc_zone == NULL) - return (ENOMEM); - break; - - case MOD_UNLOAD: - uma_zdestroy(en_vcc_zone); - break; - } - return (0); -} - -/*********************************************************************/ -/* - * Debugging support - */ - -#ifdef EN_DDBHOOK -/* - * functions we can call from ddb - */ - -/* - * en_dump: dump the state - */ -#define END_SWSL 0x00000040 /* swsl state */ -#define END_DRQ 0x00000020 /* drq state */ -#define END_DTQ 0x00000010 /* dtq state */ -#define END_RX 0x00000008 /* rx state */ -#define END_TX 0x00000004 /* tx state */ -#define END_MREGS 0x00000002 /* registers */ -#define END_STATS 0x00000001 /* dump stats */ - -#define END_BITS "\20\7SWSL\6DRQ\5DTQ\4RX\3TX\2MREGS\1STATS" - -static void -en_dump_stats(const struct en_stats *s) -{ - printf("en_stats:\n"); - printf("\t%d/%d mfix (%d failed)\n", s->mfixaddr, s->mfixlen, - s->mfixfail); - printf("\t%d rx dma overflow interrupts\n", s->dmaovr); - printf("\t%d times out of TX space and stalled\n", s->txoutspace); - printf("\t%d times out of DTQs\n", s->txdtqout); - printf("\t%d times launched a packet\n", s->launch); - printf("\t%d times pulled the hw service list\n", s->hwpull); - printf("\t%d times pushed a vci on the sw service list\n", s->swadd); - printf("\t%d times RX pulled an mbuf from Q that wasn't ours\n", - s->rxqnotus); - printf("\t%d times RX pulled a good mbuf from Q\n", s->rxqus); - printf("\t%d times ran out of DRQs\n", s->rxdrqout); - printf("\t%d transmit packets dropped due to mbsize\n", s->txmbovr); - printf("\t%d cells trashed due to turned off rxvc\n", s->vtrash); - printf("\t%d cells trashed due to totally full buffer\n", s->otrash); - printf("\t%d cells trashed due almost full buffer\n", s->ttrash); - printf("\t%d rx mbuf allocation failures\n", s->rxmbufout); - printf("\t%d times out of tx maps\n", s->txnomap); -#ifdef NATM -#ifdef NATM_STAT - printf("\tnatmintr so_rcv: ok/drop cnt: %d/%d, ok/drop bytes: %d/%d\n", - natm_sookcnt, natm_sodropcnt, natm_sookbytes, natm_sodropbytes); -#endif -#endif -} - -static void -en_dump_mregs(struct en_softc *sc) -{ - u_int cnt; - - printf("mregs:\n"); - printf("resid = 0x%x\n", en_read(sc, MID_RESID)); - printf("interrupt status = 0x%b\n", - (int)en_read(sc, MID_INTSTAT), MID_INTBITS); - printf("interrupt enable = 0x%b\n", - (int)en_read(sc, MID_INTENA), MID_INTBITS); - printf("mcsr = 0x%b\n", (int)en_read(sc, MID_MAST_CSR), MID_MCSRBITS); - printf("serv_write = [chip=%u] [us=%u]\n", en_read(sc, MID_SERV_WRITE), - MID_SL_A2REG(sc->hwslistp)); - printf("dma addr = 0x%x\n", en_read(sc, MID_DMA_ADDR)); - printf("DRQ: chip[rd=0x%x,wr=0x%x], sc[chip=0x%x,us=0x%x]\n", - MID_DRQ_REG2A(en_read(sc, MID_DMA_RDRX)), - MID_DRQ_REG2A(en_read(sc, MID_DMA_WRRX)), sc->drq_chip, sc->drq_us); - printf("DTQ: chip[rd=0x%x,wr=0x%x], sc[chip=0x%x,us=0x%x]\n", - MID_DTQ_REG2A(en_read(sc, MID_DMA_RDTX)), - MID_DTQ_REG2A(en_read(sc, MID_DMA_WRTX)), sc->dtq_chip, sc->dtq_us); - - printf(" unusal txspeeds:"); - for (cnt = 0 ; cnt < MID_N_VC ; cnt++) - if (sc->vccs[cnt]->txspeed) - printf(" vci%d=0x%x", cnt, sc->vccs[cnt]->txspeed); - printf("\n"); - - printf(" rxvc slot mappings:"); - for (cnt = 0 ; cnt < MID_N_VC ; cnt++) - if (sc->vccs[cnt]->rxslot != NULL) - printf(" %d->%td", cnt, - sc->vccs[cnt]->rxslot - sc->rxslot); - printf("\n"); -} - -static void -en_dump_tx(struct en_softc *sc) -{ - u_int slot; - - printf("tx:\n"); - for (slot = 0 ; slot < EN_NTX; slot++) { - printf("tx%d: start/stop/cur=0x%x/0x%x/0x%x [%d] ", slot, - sc->txslot[slot].start, sc->txslot[slot].stop, - sc->txslot[slot].cur, - (sc->txslot[slot].cur - sc->txslot[slot].start) / 4); - printf("mbsize=%d, bfree=%d\n", sc->txslot[slot].mbsize, - sc->txslot[slot].bfree); - printf("txhw: base_address=0x%x, size=%u, read=%u, " - "descstart=%u\n", - (u_int)MIDX_BASE(en_read(sc, MIDX_PLACE(slot))), - MIDX_SZ(en_read(sc, MIDX_PLACE(slot))), - en_read(sc, MIDX_READPTR(slot)), - en_read(sc, MIDX_DESCSTART(slot))); - } -} - -static void -en_dump_rx(struct en_softc *sc) -{ - struct en_rxslot *slot; - - printf(" recv slots:\n"); - for (slot = sc->rxslot ; slot < &sc->rxslot[sc->en_nrx]; slot++) { - printf("rx%td: start/stop/cur=0x%x/0x%x/0x%x mode=0x%x ", - slot - sc->rxslot, slot->start, slot->stop, slot->cur, - slot->mode); - if (slot->vcc != NULL) { - printf("vci=%u\n", slot->vcc->vcc.vci); - printf("RXHW: mode=0x%x, DST_RP=0x%x, WP_ST_CNT=0x%x\n", - en_read(sc, MID_VC(slot->vcc->vcc.vci)), - en_read(sc, MID_DST_RP(slot->vcc->vcc.vci)), - en_read(sc, MID_WP_ST_CNT(slot->vcc->vcc.vci))); - } - } -} - -/* - * This is only correct for non-adaptec adapters - */ -static void -en_dump_dtqs(struct en_softc *sc) -{ - uint32_t ptr, reg; - - printf(" dtq [need_dtqs=%d,dtq_free=%d]:\n", sc->need_dtqs, - sc->dtq_free); - ptr = sc->dtq_chip; - while (ptr != sc->dtq_us) { - reg = en_read(sc, ptr); - printf("\t0x%x=[%#x cnt=%d, chan=%d, end=%d, type=%d @ 0x%x]\n", - sc->dtq[MID_DTQ_A2REG(ptr)], reg, MID_DMA_CNT(reg), - MID_DMA_TXCHAN(reg), (reg & MID_DMA_END) != 0, - MID_DMA_TYPE(reg), en_read(sc, ptr + 4)); - EN_WRAPADD(MID_DTQOFF, MID_DTQEND, ptr, 8); - } -} - -static void -en_dump_drqs(struct en_softc *sc) -{ - uint32_t ptr, reg; - - printf(" drq [need_drqs=%d,drq_free=%d]:\n", sc->need_drqs, - sc->drq_free); - ptr = sc->drq_chip; - while (ptr != sc->drq_us) { - reg = en_read(sc, ptr); - printf("\t0x%x=[cnt=%d, chan=%d, end=%d, type=%d @ 0x%x]\n", - sc->drq[MID_DRQ_A2REG(ptr)], MID_DMA_CNT(reg), - MID_DMA_RXVCI(reg), (reg & MID_DMA_END) != 0, - MID_DMA_TYPE(reg), en_read(sc, ptr + 4)); - EN_WRAPADD(MID_DRQOFF, MID_DRQEND, ptr, 8); - } -} - -/* Do not staticize - meant for calling from DDB! */ -int -en_dump(int unit, int level) -{ - struct en_softc *sc; - int lcv, cnt; - devclass_t dc; - int maxunit; - - dc = devclass_find("en"); - if (dc == NULL) { - printf("%s: can't find devclass!\n", __func__); - return (0); - } - maxunit = devclass_get_maxunit(dc); - for (lcv = 0 ; lcv < maxunit ; lcv++) { - sc = devclass_get_softc(dc, lcv); - if (sc == NULL) - continue; - if (unit != -1 && unit != lcv) - continue; - - device_printf(sc->dev, "dumping device at level 0x%b\n", - level, END_BITS); - - if (sc->dtq_us == 0) { - printf("\n"); - continue; - } - - if (level & END_STATS) - en_dump_stats(&sc->stats); - if (level & END_MREGS) - en_dump_mregs(sc); - if (level & END_TX) - en_dump_tx(sc); - if (level & END_RX) - en_dump_rx(sc); - if (level & END_DTQ) - en_dump_dtqs(sc); - if (level & END_DRQ) - en_dump_drqs(sc); - - if (level & END_SWSL) { - printf(" swslist [size=%d]: ", sc->swsl_size); - for (cnt = sc->swsl_head ; cnt != sc->swsl_tail ; - cnt = (cnt + 1) % MID_SL_N) - printf("0x%x ", sc->swslist[cnt]); - printf("\n"); - } - } - return (0); -} - -/* - * en_dumpmem: dump the memory - * - * Do not staticize - meant for calling from DDB! - */ -int -en_dumpmem(int unit, int addr, int len) -{ - struct en_softc *sc; - uint32_t reg; - devclass_t dc; - - dc = devclass_find("en"); - if (dc == NULL) { - printf("%s: can't find devclass\n", __func__); - return (0); - } - sc = devclass_get_softc(dc, unit); - if (sc == NULL) { - printf("%s: invalid unit number: %d\n", __func__, unit); - return (0); - } - - addr = addr & ~3; - if (addr < MID_RAMOFF || addr + len * 4 > MID_MAXOFF || len <= 0) { - printf("invalid addr/len number: %d, %d\n", addr, len); - return (0); - } - printf("dumping %d words starting at offset 0x%x\n", len, addr); - while (len--) { - reg = en_read(sc, addr); - printf("mem[0x%x] = 0x%x\n", addr, reg); - addr += 4; - } - return (0); -} -#endif diff --git a/sys/dev/en/midwayreg.h b/sys/dev/en/midwayreg.h deleted file mode 100644 index 5c2fe1b8fdbd..000000000000 --- a/sys/dev/en/midwayreg.h +++ /dev/null @@ -1,282 +0,0 @@ -/* $NetBSD: midwayreg.h,v 1.6 1997/03/20 21:34:47 chuck Exp $ */ - -/* - * m i d w a y r e g . h - * - * this file contains the description of the ENI ATM midway chip - * data structures. see midway.c for more details. - * - * $FreeBSD$ - */ - -#define MID_SZTOB(X) ((X) * 256 * 4) /* size to bytes */ -#define MID_BTOSZ(X) ((X) / 256 / 4) /* bytes to "size" */ - -#define MID_N_VC 1024 /* # of VCs we can use */ -#define MID_VCI_BITS 10 /* number of bits */ -#define MID_NTX_CH 8 /* 8 transmit channels (shared) */ -#define MID_ATMDATASZ 48 /* need data in 48 byte blocks */ - -/* - * card data structures, top down - * - * in order to have a portable driver, the netbsd guys will not let us - * use structs. we have a bus_space_handle_t which is the en_base address. - * everything else is an offset from that base. all card data must be - * accessed with bus_space_read_4()/bus_space_write_4(): - * - * rv = bus_space_read_4(sc->en_memt, sc->en_base, BYTE_OFFSET); - * bus_space_write_4(sc->en_memt, sc->en_base, BYTE_OFFSET, VALUE); - * - * en_card: the whole card (prom + phy + midway + obmem) - * obmem contains: vci tab + dma queues (rx & tx) + service list + bufs - */ - -/* byte offsets from en_base of various items */ -#define MID_SUNIOFF 0x020000 /* SUNI offset */ -#define MID_PHYOFF 0x030000 /* PHY offset */ -#define MID_MIDOFF 0x040000 /* midway regs offset */ -#define MID_RAMOFF 0x200000 /* RAM offset */ -#define MID_DRQOFF 0x204000 /* DRQ offset */ -#define MID_DRQEND MID_DTQOFF /* DRQ end */ -#define MID_DTQOFF 0x205000 /* DTQ offset */ -#define MID_DTQEND MID_SLOFF /* DTQ end */ -#define MID_SLOFF 0x206000 /* service list */ -#define MID_SLEND MID_BUFOFF /* service list end */ -#define MID_BUFOFF 0x207000 /* buffer area */ -#define MID_PROBEOFF 0x21fffc /* start probe here */ -#define MID_PROBSIZE 0x020000 /* 128 KB */ -#define MID_MAXOFF 0x3ffffc /* max offset */ - -/* - * prom & phy: not defined here - */ -#define MID_ADPMACOFF 0xffc0 /* mac address offset (adaptec only) */ -#define MID_NSUNI 256 /* suni registers */ - -/* - * midway regs (byte offsets from en_base) - */ -#define MID_RESID 0x40000 /* write=reset reg, read=ID reg */ - -#define MID_VER(X) (((X) & 0xf0000000) >> 28) /* midway version # */ -#define MID_MID(X) (((X) & 0x700) >> 8) /* motherboard ID */ -#define MID_IS_SABRE(X) ((X) & 0x80) /* sabre controller? */ -#define MID_IS_SUNI(X) ((X) & 0x40) /* SUNI? vs utopia */ -#define MID_IS_UPIPE(X) ((X) & 0x20) /* utopia pipeline? */ -#define MID_DID(X) ((X) & 0x1f) /* daughterboard ID */ - -#define MID_INTACK 0x40004 /* interrupt ACK */ -#define MID_INTSTAT 0x40008 /* interrupt status */ -#define MID_INTENA 0x4000c /* interrupt enable */ - -#define MID_TXCHAN(N) (1 << ((N) + 9)) /* ack/status/enable xmit channel bit*/ -#define MID_INT_TX 0x1fe00 /* mask for any xmit interrupt */ -#define MID_INT_DMA_OVR 0x00100 /* DMA overflow interrupt */ -#define MID_INT_IDENT 0x00080 /* ident match error interrupt */ -#define MID_INT_LERR 0x00040 /* LERR interrupt (sbus?) */ -#define MID_INT_DMA_ERR 0x00020 /* DMA error interrupt */ -#define MID_INT_DMA_RX 0x00010 /* DMA recv interrupt */ -#define MID_INT_DMA_TX 0x00008 /* DMA xmit interrupt */ -#define MID_INT_SERVICE 0x00004 /* service list interrupt */ -#define MID_INT_SUNI 0x00002 /* SUNI interrupt */ -#define MID_INT_STATS 0x00001 /* stats overflow interrupt */ - -#define MID_INT_ANY 0x1ffff /* any interrupt? */ - -#define MID_INTBITS "\20\21T7\20T6\17T5\16T4\15T3\14T2\13T1\12T0\11DMAOVR\10ID\7LERR\6DMAERR\5RXDMA\4TXDMA\3SERV\2SUNI\1STAT" - -#define MID_MAST_CSR 0x40010 /* master CSR */ - -#define MID_IPL(X) (((X) & 0x1c0) >> 6) /* IPL */ -#define MID_SETIPL(I) ((I) << 6) -#define MID_MCSR_TXLOCK 0x20 /* lock on xmit overflow mode */ -/* NOTE: next 5 bits: write 1 means enable, write 0 means no change */ -#define MID_MCSR_ENDMA 0x10 /* DMA enable */ -#define MID_MCSR_ENTX 0x08 /* TX enable */ -#define MID_MCSR_ENRX 0x04 /* RX enable */ -#define MID_MCSR_W1MS 0x02 /* wait 1 msec */ -#define MID_MCSR_W500US 0x01 /* wait 500 usec */ - -#define MID_MCSRBITS "\20\6LCK\5DMAON\4TXON\3RXON\2W1MS\1W500US" - -#define MID_STAT 0x40014 /* stat register, clear on read */ - -#define MID_VTRASH(X) (((X) >> 16) & 0xffff) - /* # cells trashed due to VCI's mode */ -#define MID_OTRASH(X) ((X) & 0xffff) /* # cells trashed due to overflow */ - -#define MID_SERV_WRITE 0x40018 /* 10 bit service write pointer (r/o) */ -#define MID_DMA_ADDR 0x4001c /* VA of DMA (r/o) */ - - /* DMA queue pointers (bits 0 to 8) */ -#define MID_DMA_WRRX 0x40020 /* write ptr. for DMA recv queue */ - /* (for adaptor -> host xfers) */ -#define MID_DMA_RDRX 0x40024 /* read ptr for DMA recv queue (r/o) */ - /* (i.e. current adaptor->host xfer) */ -#define MID_DMA_WRTX 0x40028 /* write ptr for DMA xmit queue */ - /* (for host -> adaptor xfers) */ -#define MID_DMA_RDTX 0x4002c /* read ptr for DMA xmit queue (r/o) */ - /* (i.e. current host->adaptor xfer) */ - -/* xmit channel regs (1 per channel, MID_NTX_CH max channels) */ - -#define MIDX_PLACE(N) (0x40040+((N)*0x10)) /* xmit place */ - -#define MIDX_MKPLACE(SZ,LOC) ( ((SZ) << 11) | (LOC) ) -#define MIDX_LOC(X) ((X) & 0x7ff) /* location in obmem */ -#define MIDX_SZ(X) ((X) >> 11) /* (size of block / 256) in int32_t's*/ -#define MIDX_BASE(X) \ - (((MIDX_LOC(X) << MIDV_LOCTOPSHFT) * sizeof(uint32_t)) + MID_RAMOFF) - -/* the following two regs are word offsets in the block */ -/* xmit read pointer (r/o) */ -#define MIDX_READPTR(N) (0x40044 + ((N) * 0x10)) -/* seg currently in DMA (r/o) */ -#define MIDX_DESCSTART(N) (0x40048 + ((N) * 0x10)) - -/* - * obmem items - */ - -/* - * vci table in obmem (offset from MID_VCTOFF) - */ -#define MID_VC(N) (MID_RAMOFF + ((N) * 0x10)) - -#define MIDV_TRASH 0x00000000 /* ignore VC */ -#define MIDV_AAL5 0x80000000 /* do AAL5 on it */ -#define MIDV_NOAAL 0x40000000 /* do per-cell stuff on it */ -#define MIDV_MASK 0xc0000000 /* mode mask */ -#define MIDV_SETMODE(VC,M) (((VC) & ~(MIDV_MASK)) | (M)) /* new mode */ -#define MIDV_PTI 0x20000000 /* save PTI cells? */ -#define MIDV_LOCTOPSHFT 8 /* shift to get top 11 bits of 19 */ -#define MIDV_LOCSHIFT 18 -#define MIDV_LOCMASK 0x7ff -#define MIDV_LOC(X) (((X) >> MIDV_LOCSHIFT) & MIDV_LOCMASK) - /* 11 most sig bits of addr */ -#define MIDV_SZSHIFT 15 -#define MIDV_SZ(X) (((X) >> MIDV_SZSHIFT) & 7) - /* size encoded the usual way */ -#define MIDV_INSERVICE 0x1 /* in service list */ - -#define MID_DST_RP(N) (MID_VC(N)|0x4) - -#define MIDV_DSTART_SHIFT 16 /* shift */ -#define MIDV_DSTART(X) (((X) >> MIDV_DSTART_SHIFT) & 0x7fff) -#define MIDV_READP_MASK 0x7fff /* valid bits, (shift = 0) */ - -#define MID_WP_ST_CNT(N) (MID_VC(N)|0x8) /* write pointer/state/count */ - -#define MIDV_WRITEP_MASK 0x7fff0000 /* mask for write ptr. */ -#define MIDV_WRITEP_SHIFT 16 -#define MIDV_ST_IDLE 0x0000 -#define MIDV_ST_TRASH 0xc000 -#define MIDV_ST_REASS 0x4000 -#define MIDV_CCOUNT 0x7ff /* cell count */ - -#define MID_CRC(N) (MID_VC(N)|0xc) /* CRC */ - -/* - * dma recv q. - */ -#define MID_DMA_END (1 << 5) /* for both tx and rx */ -#define MID_DMA_CNT(X) (((X) >> 16) & 0xffff) -#define MID_DMA_TXCHAN(X) (((X) >> 6) & 0x7) -#define MID_DMA_RXVCI(X) (((X) >> 6) & 0x3ff) -#define MID_DMA_TYPE(X) ((X) & 0xf) - -#define MID_DRQ_N 512 /* # of descriptors */ -/* convert byte offset to reg value */ -#define MID_DRQ_A2REG(N) (((N) - MID_DRQOFF) >> 3) -/* and back */ -#define MID_DRQ_REG2A(N) (((N) << 3) + MID_DRQOFF) - -/* note: format of word 1 of RXQ is different beween ENI and ADP cards */ -#define MID_MK_RXQ_ENI(CNT, VC, END, TYPE) \ - (((CNT) << 16) | ((VC) << 6) | (END) | (TYPE)) - -#define MID_MK_RXQ_ADP(CNT, VC, END, JK) \ - (((CNT) << 12) | ((VC) << 2) | ((END) >> 4) | (((JK) != 0) ? 1 : 0)) -/* - * dma xmit q. - */ -#define MID_DTQ_N 512 /* # of descriptors */ -/* convert byte offset to reg value */ -#define MID_DTQ_A2REG(N) (((N) - MID_DTQOFF) >> 3) -/* and back */ -#define MID_DTQ_REG2A(N) (((N) << 3) + MID_DTQOFF) - -/* note: format of word 1 of TXQ is different beween ENI and ADP cards */ -#define MID_MK_TXQ_ENI(CNT, CHN, END, TYPE) \ - (((CNT) << 16) | ((CHN) << 6) | (END) | (TYPE)) - -#define MID_MK_TXQ_ADP(CNT, CHN, END, JK) \ - (((CNT) << 12) | ((CHN) << 2) | ((END) >> 4) | (((JK) != 0) ? 1 : 0)) - -/* - * dma types - */ -#define MIDDMA_JK 0x3 /* just kidding */ -#define MIDDMA_BYTE 0x1 /* byte */ -#define MIDDMA_2BYTE 0x2 /* 2 bytes */ -#define MIDDMA_WORD 0x0 /* word */ -#define MIDDMA_2WORD 0x7 /* 2 words */ -#define MIDDMA_4WORD 0x4 /* 4 words */ -#define MIDDMA_8WORD 0x5 /* 8 words */ -#define MIDDMA_16WORD 0x6 /* 16 words!!! */ -#define MIDDMA_2WMAYBE 0xf /* 2 words, maybe */ -#define MIDDMA_4WMAYBE 0xc /* 4 words, maybe */ -#define MIDDMA_8WMAYBE 0xd /* 8 words, maybe */ -#define MIDDMA_16WMAYBE 0xe /* 16 words, maybe */ - -#define MIDDMA_MAYBE 0xc /* mask to detect WMAYBE dma code */ -#define MIDDMA_MAXBURST (16 * sizeof(uint32_t)) /* largest burst */ - -/* - * service list - */ -#define MID_SL_N 1024 /* max # entries on slist */ -/* convert byte offset to reg value */ -#define MID_SL_A2REG(N) (((N) - MID_SLOFF) >> 2) -/* and back */ -#define MID_SL_REG2A(N) (((N) << 2) + MID_SLOFF) - -/* - * data in the buffer area of obmem - */ -/* - * recv buffer desc. (1 uint32_t at start of buffer) - */ -#define MID_RBD_SIZE 4 /* RBD size */ -#define MID_CHDR_SIZE 4 /* on aal0, cell header size */ -#define MID_RBD_ID(X) ((X) & 0xfe000000) /* get ID */ -#define MID_RBD_STDID 0x36000000 /* standard ID */ -#define MID_RBD_CLP 0x01000000 /* CLP: cell loss priority */ -#define MID_RBD_CE 0x00010000 /* CE: congestion experienced */ -#define MID_RBD_T 0x00001000 /* T: trashed due to overflow */ -#define MID_RBD_CRCERR 0x00000800 /* CRC error */ -#define MID_RBD_CNT(X) ((X) & 0x7ff) /* cell count */ - -/* - * xmit buffer desc. (2 uint32_t's at start of buffer) - * (note we treat the PR & RATE as a single uint8_t) - */ -#define MID_TBD_SIZE 8 -#define MID_TBD_MK1(AAL,PR_RATE,CNT) \ - (MID_TBD_STDID | (AAL) | ((PR_RATE) << 19) | (CNT)) -#define MID_TBD_STDID 0xb0000000 /* standard ID */ -#define MID_TBD_AAL5 0x08000000 /* AAL 5 */ -#define MID_TBD_NOAAL5 0x00000000 /* not AAL 5 */ - -#define MID_TBD_MK2(VCI,PTI,CLP) \ - (((VCI) << 4) | ((PTI) << 1) | (CLP)) - -/* - * aal5 pdu tail, last 2 words of last cell of AAL5 frame - * (word 2 is CRC .. handled by hw) - */ -#define MID_PDU_SIZE 8 -#define MID_PDU_MK1(UU, CPI, LEN) \ - (((UU) << 24) | ((CPI) << 16) | (LEN)) -#define MID_PDU_LEN(X) ((X) & 0xffff) diff --git a/sys/dev/en/midwayvar.h b/sys/dev/en/midwayvar.h deleted file mode 100644 index 8c2a8c54e04b..000000000000 --- a/sys/dev/en/midwayvar.h +++ /dev/null @@ -1,240 +0,0 @@ -/* $NetBSD: midwayvar.h,v 1.10 1997/03/20 21:34:46 chuck Exp $ */ - -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * m i d w a y v a r . h - * - * we define the en_softc here so that bus specific modules can allocate - * it as the first item in their softc. - * - * author: Chuck Cranor - */ - -/* - * params needed to determine softc size - */ -#ifndef EN_NTX -#define EN_NTX 8 /* number of tx bufs to use */ -#endif -#ifndef EN_TXSZ -#define EN_TXSZ 32 /* trasmit buf size in KB */ -#endif -#ifndef EN_RXSZ -#define EN_RXSZ 32 /* recv buf size in KB */ -#endif - -/* largest possible NRX (depends on RAM size) */ -#define EN_MAXNRX ((2048 - (EN_NTX * EN_TXSZ)) / EN_RXSZ) - -#ifndef EN_MAX_DMASEG -#define EN_MAX_DMASEG 32 -#endif - -/* number of bytes to use in the first receive buffer. This must not be larger - * than MHLEN, should be a multiple of 64 and must be a multiple of 4. */ -#define EN_RX1BUF 128 - -/* - * Structure to hold DMA maps. These are handle via a typestable uma zone. - */ -struct en_map { - uintptr_t flags; /* map flags */ - struct en_map *rsvd2; /* see uma_zalloc(9) */ - struct en_softc *sc; /* back pointer */ - bus_dmamap_t map; /* the map */ -}; -#define ENMAP_LOADED 0x02 -#define ENMAP_ALLOC 0x01 - -#define EN_MAX_MAPS 400 - -/* - * Statistics - */ -struct en_stats { - uint32_t vtrash; /* sw copy of counter */ - uint32_t otrash; /* sw copy of counter */ - uint32_t ttrash; /* # of RBD's with T bit set */ - uint32_t mfixaddr; /* # of times we had to mfix an address */ - uint32_t mfixlen; /* # of times we had to mfix a lenght*/ - uint32_t mfixfail; /* # of times mfix failed */ - uint32_t txmbovr; /* # of times we dropped due to mbsize */ - uint32_t dmaovr; /* tx dma overflow count */ - uint32_t txoutspace; /* out of space in xmit buffer */ - uint32_t txdtqout; /* out of DTQs */ - uint32_t launch; /* total # of launches */ - uint32_t hwpull; /* # of pulls off hardware service list */ - uint32_t swadd; /* # of pushes on sw service list */ - uint32_t rxqnotus; /* # of times we pull from rx q, but fail */ - uint32_t rxqus; /* # of good pulls from rx q */ - uint32_t rxdrqout; /* # of times out of DRQs */ - uint32_t rxmbufout; /* # of time out of mbufs */ - uint32_t txnomap; /* out of DMA maps in TX */ -}; - -/* - * Each of these structures describes one of the eight transmit channels - */ -struct en_txslot { - uint32_t mbsize; /* # mbuf bytes in use (max=TXHIWAT) */ - uint32_t bfree; /* # free bytes in buffer */ - uint32_t start; /* start of buffer area (byte offset) */ - uint32_t stop; /* ends of buffer area (byte offset) */ - uint32_t cur; /* next free area (byte offset) */ - uint32_t nref; /* # of VCs using this channel */ - struct ifqueue q; /* mbufs waiting for DMA now */ - struct ifqueue indma; /* mbufs waiting for DMA now */ -}; - -/* - * Each of these structures is used for each of the receive buffers on the - * card. - */ -struct en_rxslot { - uint32_t mode; /* saved copy of mode info */ - uint32_t start; /* begin of my buffer area */ - uint32_t stop; /* end of my buffer area */ - uint32_t cur; /* where I am at in the buffer */ - struct en_vcc *vcc; /* backpointer to VCI */ - struct ifqueue q; /* mbufs waiting for dma now */ - struct ifqueue indma; /* mbufs being dma'd now */ -}; - -struct en_vcc { - struct atmio_vcc vcc; /* required by common code */ - void *rxhand; - u_int vflags; - uint32_t ipackets; - uint32_t opackets; - uint32_t ibytes; - uint32_t obytes; - - uint8_t txspeed; - struct en_txslot *txslot; /* transmit slot */ - struct en_rxslot *rxslot; /* receive slot */ -}; -#define VCC_DRAIN 0x0001 /* closed, but draining rx */ -#define VCC_SWSL 0x0002 /* on rx software service list */ -#define VCC_CLOSE_RX 0x0004 /* currently closing */ - -/* - * softc - */ -struct en_softc { - struct ifnet *ifp; - device_t dev; - - /* bus glue */ - bus_space_tag_t en_memt; /* for EN_READ/EN_WRITE */ - bus_space_handle_t en_base; /* base of en card */ - bus_size_t en_obmemsz; /* size of en card (bytes) */ - void (*en_busreset)(void *); /* bus specific reset function */ - bus_dma_tag_t txtag; /* TX DMA tag */ - - /* serv list */ - uint32_t hwslistp; /* hw pointer to service list (byte offset) */ - uint16_t swslist[MID_SL_N]; /* software svc list (see en_service()) */ - uint16_t swsl_head; /* ends of swslist (index into swslist) */ - uint16_t swsl_tail; - uint32_t swsl_size; /* # of items in swsl */ - - /* xmit dma */ - uint32_t dtq[MID_DTQ_N];/* sw copy of dma q (see EN_DQ_MK macros) */ - uint32_t dtq_free; /* # of dtq's free */ - uint32_t dtq_us; /* software copy of our pointer (byte offset) */ - uint32_t dtq_chip; /* chip's pointer (byte offset) */ - uint32_t need_dtqs; /* true if we ran out of DTQs */ - - /* recv dma */ - uint32_t drq[MID_DRQ_N];/* sw copy of dma q (see ENIDQ macros) */ - uint32_t drq_free; /* # of drq's free */ - uint32_t drq_us; /* software copy of our pointer (byte offset) */ - uint32_t drq_chip; /* chip's pointer (byte offset) */ - uint32_t need_drqs; /* true if we ran out of DRQs */ - - /* xmit buf ctrl. (per channel) */ - struct en_txslot txslot[MID_NTX_CH]; - - /* recv buf ctrl. (per recv slot) */ - struct en_rxslot rxslot[EN_MAXNRX]; - int en_nrx; /* # of active rx slots */ - - /* vccs */ - struct en_vcc **vccs; - u_int vccs_open; - struct cv cv_close; /* close CV */ - - /* stats */ - struct en_stats stats; - - /* random stuff */ - uint32_t ipl; /* sbus interrupt lvl (1 on pci?) */ - uint8_t bestburstcode; /* code of best burst we can use */ - uint8_t bestburstlen; /* length of best burst (bytes) */ - uint8_t bestburstshift; /* (x >> shift) == (x / bestburstlen) */ - uint8_t bestburstmask; /* bits to check if not multiple of burst */ - uint8_t alburst; /* align dma bursts? */ - uint8_t noalbursts; /* don't use unaligned > 4 byte bursts */ - uint8_t is_adaptec; /* adaptec version of midway? */ - struct mbuf *padbuf; /* buffer of zeros for TX padding */ - - /* mutex to protect this structure and the associated hardware */ - struct mtx en_mtx; - - /* sysctl support */ - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - - /* memory zones */ - uma_zone_t map_zone; - - /* media and phy */ - struct ifmedia media; - struct utopia utopia; - -#ifdef EN_DEBUG - /* debugging */ - u_int debug; -#endif -}; - -/* - * exported functions - */ -int en_attach(struct en_softc *); -void en_destroy(struct en_softc *); -void en_intr(void *); -void en_reset(struct en_softc *); -int en_modevent(module_t, int, void *arg); diff --git a/sys/dev/fatm/firmware.h b/sys/dev/fatm/firmware.h deleted file mode 100644 index 24c7bc8e8865..000000000000 --- a/sys/dev/fatm/firmware.h +++ /dev/null @@ -1,2393 +0,0 @@ -/*- - * (Copyright Notice) - * - * Copyright (c) 1995-2000 FORE Systems, Inc., as an unpublished work. - * - * This notice does not imply unrestricted or public access to these - * materials which are a trade secret of FORE Systems, Inc. or its - * subsidiaries or affiliates (together referred to as "FORE"), and - * which may not be reproduced, used, sold or transferred to any third - * party without FORE's prior written consent. All rights reserved. - * - * U.S. Government Restricted Rights. - * If you are licensing the Software on behalf of the U.S. Government - * ("Government"), the following provisions apply to you. If the - * software is supplied to the Department of Defense ("DoD"), it is - * classified as "Commercial Computer Software" under paragraph - * 252.227-7014 of the DoD Supplement to the Federal Acquisition - * Regulations ("DFARS") (or any successor regulations) and the - * Government is acquiring only the license rights granted herein (the - * license rights customarily provided to non-Government users). If - * the Software is supplied to any unit or agency of the Government - * other than the DoD, it is classified as "Restricted Computer - * Software" and the Government's rights in the Software are defined - * in paragraph 52.227-19 of the Federal Acquisition Regulations - * ("FAR") (or any successor regulations) or, in the cases of NASA, - * in paragraph 18.52.227-86 of the NASA Supplement to the FAR (or - * any successor regulations). - * - * FORE Systems is a registered trademark, and ForeRunner, ForeRunnerLE, - * and ForeThought are trademarks of FORE Systems, Inc. All other - * brands or product names are trademarks or registered trademarks of - * their respective holders. - * - * (End Copyright Notice) - * - * This is a binary copy of the PCA200E firmware version 4.1.12 - * - * phk got permission from Fore to put firmware images into our tree. - * - * $FreeBSD$ - */ - -static uint32_t firmware[] = { - 0x65726f66, 0x00000100, 0x00005140, 0x000056c0, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00004d40, - 0x00000400, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000001, - 0x00000000, 0x00000000, 0x00032d50, 0x00000000, - 0xff80ff01, 0x00000030, 0x7eff7e01, 0x00000070, - 0x0000ff01, 0x00000000, 0x00000000, 0x00000000, - 0x00000f01, 0x00000000, 0xa7a7e701, 0x00000020, - 0x03030b01, 0x00000000, 0x03030b01, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0xdf6fdf01, 0x00000000, 0x00007f01, 0x00000000, - 0x0000ff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x7f417f01, 0x00000000, 0x07070701, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0xfb00fb01, 0x00000000, 0xf0f0ff01, 0x00000000, - 0x0000ff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x00000f01, 0x00000000, 0x0000ff01, 0x00000000, - 0x0000ff01, 0x00000000, 0x00000f01, 0x00000000, - 0x7f017f01, 0x00000000, 0x01010101, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x8100ad01, 0x00000000, 0x0000af01, 0x00000000, - 0x00000000, 0x00000000, 0xffafff01, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x0000ff01, 0x00000000, - 0x00ffff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x0000ff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x07030701, 0x00000000, 0x7f7e7f01, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0xffffff01, 0x00000000, - 0xffffff01, 0x00000090, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0xffffff01, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x7f7fff01, 0x00000004, 0xe0e0fe01, 0x00000000, - 0xffffff01, 0x00000000, 0xffffff01, 0x00000000, - 0x0000ff01, 0x00000000, 0x00ffff01, 0x00000000, - 0x0000ff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x00000301, 0x00000000, 0xffffff01, 0x000000fc, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x9f9fff01, 0x00000004, 0xffffff01, 0x00000000, - 0xffffff01, 0x0000006a, 0xcfcede01, 0x00000000, - 0x0000ff01, 0x00000000, 0x0000ff01, 0x00000000, - 0x00000701, 0x00000000, 0xffffff01, 0x00000008, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x051f0501, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, - 0x8c803000, 0x0003dd50, 0x3287c00c, 0x5c081610, - 0x09000004, 0x66003e80, 0x8c000000, 0x5cf01e00, - 0x8c803000, 0x0000e400, 0x8c883000, 0x0000ed50, - 0x92f41000, 0x59840804, 0x34845ff8, 0x8c803000, - 0x3b001000, 0x0900833c, 0x09008cec, 0x09007ff4, - 0x09006960, 0x09007b3c, 0x90303000, 0x0000e400, - 0x3201a028, 0x5d201610, 0x8c801400, 0x00000000, - 0x8c883000, 0x00005730, 0x59840111, 0x59318010, - 0x86019000, 0x5d801604, 0x09000008, 0x08006b74, - 0x59084810, 0x0900260c, 0x09002238, 0x90a03000, - 0x50001444, 0x5990de08, 0x58248094, 0x8c811000, - 0x090020f0, 0x58a01988, 0x3a250042, 0x3125000e, - 0x3a01201a, 0x080000d4, 0x58901989, 0x3a24804e, - 0x080000c8, 0x00000000, 0x90a83000, 0x0000518c, - 0x5c901e0d, 0x82903000, 0x0000e46c, 0x5ca01e05, - 0x080000a4, 0x00000000, 0x90a83000, 0x0000518c, - 0x5c901e09, 0x82903000, 0x0000e46c, 0x5ca01e04, - 0x08000084, 0x00000000, 0x88a03000, 0x88000402, - 0x5c901e08, 0x5a052f01, 0x82903000, 0x0000e46c, - 0x1200001a, 0x90a83000, 0x0000518c, 0x5ca01e06, - 0x08000054, 0x00000000, 0x3015202a, 0x30052016, - 0x90a83000, 0x0000518c, 0x5ca01e16, 0x08000038, - 0x90a83000, 0x0000518c, 0x59a1d81f, 0x08000028, - 0x3005201a, 0x90a83000, 0x0000518c, 0x59a5d81f, - 0x08000014, 0x00000000, 0x90a83000, 0x0000518c, - 0x8ca00046, 0x92a560b0, 0x09002388, 0x09002ab4, - 0x09001ee0, 0x0b0020a4, 0x58901989, 0x3d24804e, - 0x090045f0, 0x3d04201e, 0x90a83000, 0x0000e470, - 0x8ca03000, 0xdead0014, 0x92a55000, 0x09006ac4, - 0x5c801e00, 0x8c8fe040, 0x0b004710, 0x3a04201e, - 0x90a7e040, 0x90a83000, 0x0000518c, 0x8c90007f, - 0x58a48094, 0x08000010, 0x90a83000, 0x0000518c, - 0x59a01901, 0x92a560b4, 0x8ca03000, 0x00000330, - 0x92a03000, 0x0000e404, 0x090021a8, 0x090051c4, - 0x09005530, 0x5c801e01, 0x090069d8, 0x0a000000, - 0x90803000, 0x0000e408, 0x90a41000, 0x8ce8007f, - 0x58a74094, 0x3a05230a, 0x59a50902, 0x344d21ee, - 0x90a03914, 0x00005920, 0x84051000, 0x00000000, - 0x00005948, 0x00005b2c, 0x00005958, 0x00005a28, - 0x00005968, 0x000059f0, 0x00005a08, 0x00005af8, - 0x00005a30, 0x00005a90, 0x09002a58, 0x5c981610, - 0x080001e0, 0x00000000, 0x09002d18, 0x5c981610, - 0x080001d0, 0x00000000, 0x90a03000, 0x50001444, - 0x5a052f13, 0x8c980002, 0x10000022, 0x58a50993, - 0x92f03000, 0x000056a4, 0x92a03000, 0x50001444, - 0x08000014, 0x00000000, 0x5ca01e01, 0x92a03000, - 0x000056a4, 0x90ac2004, 0x8c803000, 0x20000060, - 0x59a6581f, 0x8c903000, 0x000055d0, 0x5c881e0e, - 0x92a83000, 0x20000054, 0x92a03000, 0x20000060, - 0x598c4901, 0xb0a49000, 0x5a003091, 0x8c94a010, - 0xb2a41000, 0x15ffffec, 0x08000148, 0x00000000, - 0x0b004a18, 0x5a003090, 0x8c980002, 0x15000136, - 0x5c981e0a, 0x0800012c, 0x09004ae8, 0x90a03000, - 0x0000e408, 0x908d2004, 0x5c801e10, 0x8c903000, - 0x0000e4b0, 0x090014ec, 0x5c981e02, 0x08000104, - 0x90a03000, 0x0000e408, 0x90a52004, 0x92a03000, - 0x20000040, 0x90a03000, 0xf001e100, 0x92a03000, - 0x30000060, 0x90a03000, 0xf001e104, 0x92a03000, - 0x30000060, 0x90a03000, 0xf001e064, 0x92a03000, - 0x30000060, 0x90a03000, 0xf001e068, 0x5c981e02, - 0x92a03000, 0x30000060, 0x080000a8, 0x00000000, - 0x90a03000, 0x0000e408, 0x90a52004, 0x59a99014, - 0x8ce83000, 0x000ffff0, 0x92a83000, 0x000002fc, - 0x59af4595, 0x8ce83000, 0x000ff000, 0x59a74614, - 0x8ce83000, 0x0ff00000, 0x58a74094, 0x8ce83000, - 0x000ffff0, 0x92a03000, 0x000002f8, 0x58af4095, - 0x58a50415, 0x92a83000, 0x000002f4, 0x92a03000, - 0x000002f0, 0x0800003c, 0x90a03000, 0x0000e408, - 0x90a51000, 0x8ce83000, 0xd05ed05e, 0x3da74022, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead000d, - 0x5c801e00, 0x92a55000, 0x09006798, 0x5c981e08, - 0x90a83000, 0x0000e408, 0x90a55000, 0x303d2096, - 0x90a03000, 0x0000e40c, 0x90bd6010, 0x8cb56020, - 0x5a052016, 0x92f55000, 0x1600000e, 0x90b03000, - 0x0000e410, 0x90a03000, 0x0000e474, 0x92b83000, - 0x20000038, 0x92983000, 0x30000060, 0x90a51000, - 0x5a003094, 0x92b03000, 0x0000e408, 0x12000042, - 0x90a83000, 0x0000e478, 0x90a55000, 0x59a05014, - 0x92a55000, 0x90a83000, 0x00005160, 0x8ce801ff, - 0x59a85015, 0x58a74095, 0x58a50988, 0x92a83000, - 0x00005160, 0x92a03000, 0x20000004, 0x0a000000, - 0x90a03000, 0x0000e40c, 0x90bd6010, 0x8cb56020, - 0x5a052016, 0x92f55000, 0x1600000e, 0x90b03000, - 0x0000e410, 0x92b83000, 0x20000038, 0x92b03000, - 0x0000e408, 0x92983000, 0x30000060, 0x0a000000, - 0x98242018, 0x90a83000, 0x0000e48c, 0x59a14104, - 0x5a056014, 0x8c341000, 0x14000012, 0x5c801e01, - 0x0a000000, 0x00000000, 0x90a83000, 0x00000350, - 0x3a05603a, 0x90a03000, 0x00000368, 0x59ad4901, - 0x92a83000, 0x00000350, 0x8cb51d95, 0x90a59000, - 0x59aa1005, 0x92a15000, 0x92ac201c, 0x9085a004, - 0x0a000000, 0x00000000, 0x8c803000, 0x00000350, - 0x09005cd0, 0x90a83000, 0x00000350, 0x3a056036, - 0x90a03000, 0x00000368, 0x59ad4901, 0x92a83000, - 0x00000350, 0x8cb51d95, 0x90a59000, 0x59aa1005, - 0x92a15000, 0x92a9a01c, 0x9085a004, 0x0a000000, - 0x90a03000, 0x00005690, 0x59a05014, 0x8c800001, - 0x92a03000, 0x00005690, 0x0a000000, 0x00000000, - 0x98242018, 0x90a83000, 0x0000e48c, 0x59a14104, - 0x5a056014, 0x8c341000, 0x14000012, 0x5c801e01, - 0x0a000000, 0x00000000, 0x90a83000, 0x00000380, - 0x3a05603a, 0x90a03000, 0x00000398, 0x59ad4901, - 0x92a83000, 0x00000380, 0x8cb51d95, 0x90a59000, - 0x59aa1005, 0x92a15000, 0x92ac201c, 0x9085a004, - 0x0a000000, 0x00000000, 0x8c803000, 0x00000380, - 0x09005c00, 0x90a83000, 0x00000380, 0x3a056036, - 0x90a03000, 0x00000398, 0x59ad4901, 0x92a83000, - 0x00000380, 0x8cb51d95, 0x90a59000, 0x59aa1005, - 0x92a15000, 0x92a9a01c, 0x9085a004, 0x0a000000, - 0x90a03000, 0x00005694, 0x59a05014, 0x8c800001, - 0x92a03000, 0x00005694, 0x0a000000, 0x00000000, - 0x98242018, 0x90a83000, 0x0000e48c, 0x59a14104, - 0x5a056014, 0x8c341000, 0x14000012, 0x5c801e01, - 0x0a000000, 0x00000000, 0x90a83000, 0x000003b0, - 0x3a05603a, 0x90a03000, 0x000003c8, 0x59ad4901, - 0x92a83000, 0x000003b0, 0x8cb51d95, 0x90a59000, - 0x59aa1005, 0x92a15000, 0x92ac201c, 0x9085a004, - 0x0a000000, 0x00000000, 0x8c803000, 0x000003b0, - 0x09005b30, 0x90a83000, 0x000003b0, 0x3a056036, - 0x90a03000, 0x000003c8, 0x59ad4901, 0x92a83000, - 0x000003b0, 0x8cb51d95, 0x90a59000, 0x59aa1005, - 0x92a15000, 0x92a9a01c, 0x9085a004, 0x0a000000, - 0x90a03000, 0x00005698, 0x59a05014, 0x8c800001, - 0x92a03000, 0x00005698, 0x0a000000, 0x00000000, - 0x98242018, 0x90a83000, 0x0000e48c, 0x59a14104, - 0x5a056014, 0x8c341000, 0x14000012, 0x5c801e01, - 0x0a000000, 0x00000000, 0x90a83000, 0x0000e420, - 0x3a05603a, 0x90a03000, 0x0000e438, 0x59ad4901, - 0x92a83000, 0x0000e420, 0x8cb51d95, 0x90a59000, - 0x59aa1005, 0x92a15000, 0x92ac201c, 0x9085a004, - 0x0a000000, 0x00000000, 0x8c803000, 0x0000e420, - 0x09005a60, 0x90a83000, 0x0000e420, 0x3a056036, - 0x90a03000, 0x0000e438, 0x59ad4901, 0x92a83000, - 0x0000e420, 0x8cb51d95, 0x90a59000, 0x59aa1005, - 0x92a15000, 0x92a9a01c, 0x9085a004, 0x0a000000, - 0x90a03000, 0x0000569c, 0x59a05014, 0x8c800001, - 0x92a03000, 0x0000569c, 0x0a000000, 0x00000000, - 0x8c086040, 0xb2c7e070, 0x5cc01610, 0x8c803000, - 0x00000350, 0x598c581f, 0x090060e8, 0x8c803000, - 0x00000380, 0x598c581f, 0x090060d8, 0x8c803000, - 0x000003b0, 0x598c581f, 0x090060c8, 0x8c803000, - 0x0000e420, 0x598c581f, 0x090060b8, 0x8ca03000, - 0x00005690, 0x92a03000, 0x00000378, 0x8ca03000, - 0x00005694, 0x92a03000, 0x000003a8, 0x8ca03000, - 0x00005698, 0x92a03000, 0x000003d8, 0x8ca03000, - 0x0000569c, 0x92a03000, 0x0000e448, 0x90a62078, - 0x92a03000, 0x00000360, 0x90ae2088, 0x92a83000, - 0x00000390, 0x90b62098, 0x92b03000, 0x000003c0, - 0x90be20a8, 0x8c262040, 0x5a003094, 0x92b83000, - 0x0000e430, 0x1500001e, 0x3d05601a, 0x3d05a016, - 0x3d05e012, 0x5c801e08, 0xb0c7e070, 0x0a000000, - 0x90a92034, 0x92a83000, 0x00000364, 0x90b12044, - 0x92b03000, 0x00000394, 0x90b92054, 0x92b83000, - 0x000003c4, 0x90a03000, 0x00000360, 0x90812064, - 0x5a003094, 0x92803000, 0x0000e434, 0x1200000e, - 0x8cc8003f, 0x3eae5fb2, 0x90a03000, 0x00000390, - 0x3a05200e, 0x8cc8003f, 0x3eb65f9e, 0x90a03000, - 0x000003c0, 0x3a05200e, 0x8cc8003f, 0x3ebe5f8a, - 0x90a03000, 0x0000e430, 0x3a05200e, 0x8cc8003f, - 0x3e865f76, 0x90a03000, 0x00000360, 0x3a052026, - 0x90a03000, 0x00000390, 0x3a05201a, 0x90a83000, - 0x00000364, 0x90a03000, 0x00000394, 0x39ad1f4a, - 0x90a03000, 0x000003c0, 0x3a052026, 0x90a03000, - 0x0000e430, 0x3a05201a, 0x90a83000, 0x000003c4, - 0x90a03000, 0x0000e434, 0x39ad1f1e, 0x90a03000, - 0x00000360, 0x3d05202e, 0x90a83000, 0x00000394, - 0x8ca03000, 0x00005ce0, 0x92a03000, 0x0000e450, - 0x92a83000, 0x00000364, 0x08000018, 0x00000000, - 0x8ca03000, 0x00005c10, 0x92a03000, 0x0000e450, - 0x90a03000, 0x000003c0, 0x3d05202a, 0x90a83000, - 0x0000e434, 0x8ca03000, 0x00005e80, 0x92a03000, - 0x0000e454, 0x92a83000, 0x000003c4, 0x08000014, - 0x8ca03000, 0x00005db0, 0x92a03000, 0x0000e454, - 0x90b9203c, 0x92b83000, 0x0000035c, 0x9081204c, - 0x92803000, 0x0000038c, 0x9091205c, 0x92903000, - 0x000003bc, 0x90e83000, 0x00000360, 0x9099206c, - 0x5a00309d, 0x92983000, 0x0000e42c, 0x1200000a, - 0x3b05fe56, 0x5927d81f, 0x31b91e4e, 0x58a0d097, - 0x3d053e46, 0x90883000, 0x00000390, 0x3a04600a, - 0x3b043e36, 0x31811e32, 0x58a0d090, 0x3d053e2a, - 0x90b03000, 0x000003c0, 0x3a05a00a, 0x3b04be1a, - 0x31911e16, 0x58a0d092, 0x3d053e0e, 0x90a83000, - 0x0000e430, 0x3a05600a, 0x3b04fdfe, 0x31991dfa, - 0x58a0d093, 0x3d053df2, 0x3a07600a, 0x3cedddea, - 0x3a04600a, 0x3c8c1de2, 0x3a05a00a, 0x3cb49dda, - 0x3a05600a, 0x3cacddd2, 0x90683000, 0x00000390, - 0xb0803000, 0x00000380, 0x90183000, 0x00000360, - 0xb0a03000, 0x00000350, 0x90783000, 0x0000e430, - 0xb0403000, 0x0000e420, 0x90703000, 0x000003c0, - 0xb0203000, 0x000003b0, 0x59e8c117, 0x5960cd01, - 0x8caf5000, 0x5cb0160c, 0x92a03000, 0x00000350, - 0x92e83000, 0x00000354, 0x92b83000, 0x0000035c, - 0x92603000, 0x00000358, 0x59a34113, 0x596b4d01, - 0x8c8d1000, 0x5c90160d, 0x92803000, 0x00000380, - 0x92a03000, 0x00000384, 0x92683000, 0x00000388, - 0x92983000, 0x0000038c, 0x59a38107, 0x59738d01, - 0x8c2d1000, 0x5c30160e, 0x92203000, 0x000003b0, - 0x92a03000, 0x000003b4, 0x92703000, 0x000003b8, - 0x92383000, 0x000003bc, 0x59a3c10b, 0x597bcd01, - 0x8c4d1000, 0x5c50160f, 0x92403000, 0x0000e420, - 0x92a03000, 0x0000e424, 0x5a003083, 0x92783000, - 0x0000e428, 0x8c803000, 0x00000350, 0x5c201e00, - 0x92583000, 0x0000e42c, 0x12000062, 0x908e2070, - 0x5cd01610, 0x8cd83000, 0x00000338, 0x92803000, - 0x00000330, 0x92d83000, 0x00000334, 0x090026e4, - 0x5a023090, 0x8c200001, 0x12fffc8e, 0x90a03000, - 0x0000036c, 0x92a6200c, 0x90803000, 0x00000360, - 0x59840e03, 0x09003a4c, 0x5a003090, 0x92803000, - 0x00000368, 0x12fffc62, 0x90a03000, 0x00000390, - 0x5a003094, 0x8c803000, 0x00000390, 0x1200007e, - 0x59cc0910, 0x8ca03984, 0x00000000, 0x8ca83000, - 0x00000330, 0x92cfe060, 0x8cb57c14, 0x00000008, - 0x92b7e064, 0x90cfe060, 0x908e2080, 0x59a54014, - 0x59840910, 0x92cd1000, 0x92b52004, 0x09002654, - 0x5a023090, 0x8c212001, 0x12fffbfe, 0x90a03000, - 0x0000039c, 0x92a62010, 0x90803000, 0x00000390, - 0x59840e03, 0x090039bc, 0x5a003090, 0x92803000, - 0x00000398, 0x12fffbd2, 0x90a03000, 0x000003c0, - 0x5a003094, 0x8c803000, 0x000003c0, 0x1200007e, - 0x59cc0910, 0x8ca03984, 0x00000000, 0x8ca83000, - 0x00000330, 0x92cfe050, 0x8cb57c14, 0x00000008, - 0x92b7e054, 0x90cfe050, 0x908e2090, 0x59a54014, - 0x59840910, 0x92cd1000, 0x92b52004, 0x090025c4, - 0x5a023090, 0x8c212001, 0x12fffb6e, 0x90a03000, - 0x000003cc, 0x92a62014, 0x90803000, 0x000003c0, - 0x59840e03, 0x0900392c, 0x5a003090, 0x92803000, - 0x000003c8, 0x12fffb42, 0x90a03000, 0x0000e430, - 0x5a003094, 0x8c803000, 0x0000e430, 0x1200007e, - 0x59cc0910, 0x8ca03984, 0x00000000, 0x8ca83000, - 0x00000330, 0x92cfe040, 0x8cb57c14, 0x00000008, - 0x92b7e044, 0x90cfe040, 0x908e20a0, 0x59a54014, - 0x59840910, 0x92cd1000, 0x92b52004, 0x09002534, - 0x5a023090, 0x8c212001, 0x12fffade, 0x90a03000, - 0x0000e43c, 0x92a62018, 0x90803000, 0x0000e430, - 0x59840e03, 0x0900389c, 0x5a003090, 0x92803000, - 0x0000e438, 0x12fffab2, 0x8ca03000, 0x00000330, - 0x5c801e02, 0x92a53d84, 0xfffffffc, 0xb0c7e070, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c201610, 0x92803000, 0x0000e468, 0x59a40901, - 0x8c2c5000, 0x70814090, 0x92f03000, 0x00000308, - 0x92f03000, 0x00000304, 0x92a03000, 0x0000030c, - 0x09003830, 0x5a003090, 0x92803000, 0x0000e460, - 0x15000012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x8c803904, 0x00000000, 0x09003808, 0x5a003090, - 0x92803000, 0x00000300, 0x15000012, 0x5c801e08, - 0x0a000000, 0x00000000, 0x8cb00000, 0x5a012096, - 0x90b83000, 0x0000e460, 0x13000062, 0x5a012f00, - 0x8c880000, 0x1000001e, 0x5cb01e01, 0x5a012096, - 0x59a44017, 0x59b94017, 0x92a41000, 0x1300003e, - 0x90a83000, 0x00000300, 0x59a44017, 0x92a55d16, - 0x90a83000, 0x00000300, 0x59b94017, 0x59a44017, - 0x92a57d16, 0x00000004, 0x59b09016, 0x5a012096, - 0x59b94017, 0x14ffffcc, 0x59810e02, 0x09003774, - 0x5a003090, 0x92803000, 0x0000e464, 0x1500000e, - 0x5c801e08, 0x0a000000, 0x8cb00000, 0x3bb1003e, - 0x30012016, 0x5cb01e01, 0x5a012096, 0x92f41000, - 0x1300002a, 0x90a03000, 0x0000e464, 0x92f51d16, - 0x90a03000, 0x0000e464, 0x92f53d16, 0x00000004, - 0x59b09016, 0x3cb11fe0, 0x5c801e02, 0x0a000000, - 0x90a83000, 0x00000304, 0x90a03000, 0x00000300, - 0x8ca51d15, 0x90951000, 0x5a003092, 0x8c2c1000, - 0x5c201611, 0x12000036, 0x92f51000, 0x90a03000, - 0x00000304, 0x90a83000, 0x0000e468, 0x928c9000, - 0x59861010, 0x8cb4a008, 0x92941000, 0x92b42004, - 0x0800005c, 0x00000000, 0x90a03000, 0x00005154, - 0x3b05206a, 0x090001bc, 0x90a83000, 0x00000304, - 0x90a03000, 0x00000300, 0x8ca51d15, 0x90951000, - 0x3a04a04a, 0x92f51000, 0x90a03000, 0x00000304, - 0x90a83000, 0x0000e468, 0x92249000, 0x59b61005, - 0x8cbca008, 0x92959000, 0x92bda004, 0x59ad4901, - 0x8ca52001, 0x58a54094, 0x8c800001, 0x92a03000, - 0x00000304, 0x0a000000, 0x90a03000, 0x000056a0, - 0x59a05014, 0x8c800000, 0x92a03000, 0x000056a0, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x90883000, 0x0000e48c, 0x5c201610, 0x09002f10, - 0x90b03000, 0x0000e484, 0x90803000, 0x00000308, - 0x90a03000, 0x00000308, 0x90a83000, 0x0000e468, - 0x90b83000, 0x00000300, 0x59a05014, 0x8cb03a16, - 0x00000010, 0x59ad4901, 0x92b11000, 0x58a54094, - 0x9225dd10, 0x92a03000, 0x00000308, 0x0a000000, - 0x8cf03000, 0x00006898, 0x5c88161e, 0x8cf00000, - 0x90a83000, 0x00005158, 0x90b83000, 0x0000e464, - 0x90a03000, 0x0000e468, 0x90b03000, 0x00005154, - 0x9085dd15, 0x59a50901, 0x8cad6001, 0x58ad0095, - 0x59b58901, 0x92a83000, 0x00005158, 0x92b03000, - 0x00005154, 0x84045000, 0x0a000000, 0x00000000, - 0x8cf03000, 0x0000690c, 0x5c90161e, 0x8cf00000, - 0x90a03000, 0x000056a0, 0x90b83000, 0x0000515c, - 0x90883000, 0x0000e464, 0x90a83000, 0x0000e468, - 0x90b03000, 0x00005154, 0x59a05014, 0x92a03000, - 0x000056a0, 0x59ad4901, 0x8ca5e001, 0x58a54094, - 0x92845d17, 0x59b05016, 0x92a03000, 0x0000515c, - 0x92b03000, 0x00005154, 0x84049000, 0x0a000000, - 0x8c403000, 0x00005158, 0x8c383000, 0x00000310, - 0x8c483000, 0x20000004, 0x8c303000, 0x00000308, - 0x90883000, 0x00000310, 0x90a45000, 0x3a05216e, - 0x90a21000, 0x90b03000, 0x0000e464, 0x90a83000, - 0x0000e468, 0x90259d14, 0x59ad4901, 0x8ca52001, - 0x58a54094, 0x92a21000, 0x59a91004, 0x90b55000, - 0x90a03000, 0x00005154, 0x8c803000, 0x0000ffff, - 0x58840096, 0x92855000, 0x908c5000, 0x59a50901, - 0x92a03000, 0x00005154, 0x5c901604, 0x8c803890, - 0x00000009, 0x59840c03, 0x592d8d90, 0x09000564, - 0x90a1d000, 0x90a83000, 0x00000314, 0x59b21014, - 0x90bd2004, 0x5a056016, 0x92f51000, 0x1600000e, - 0x90b03000, 0x00000318, 0x90a03000, 0x0000e474, - 0x92b83000, 0x20000038, 0x58a94981, 0x92a83000, - 0x30000060, 0x90a51000, 0x5a003094, 0x92b1d000, - 0x1200003e, 0x90a83000, 0x0000e478, 0x90a55000, - 0x59a05014, 0x92a55000, 0x90a83000, 0x00005160, - 0x8c9801ff, 0x59a85015, 0x58a4c095, 0x92a83000, - 0x00005160, 0x58a50988, 0x92a25000, 0x90883000, - 0x0000e48c, 0x5c801604, 0x09002cb4, 0x90a03000, - 0x0000e484, 0x90803000, 0x00000308, 0x90b83000, - 0x00000300, 0x90b03000, 0x0000e468, 0x90a83000, - 0x00005154, 0x8ca03a14, 0x00000010, 0x92a11000, - 0x90a19000, 0x5a003095, 0x9225dd10, 0x59b58901, - 0x8ca52001, 0x58a58094, 0x92a19000, 0x11fffe94, - 0x0a000000, 0x00000000, 0x0a000000, 0x00000000, - 0x90a42058, 0x5a013094, 0x8cec9000, 0x5c301613, - 0x1200001a, 0x3425200e, 0x3a0520d2, 0x08000100, - 0x3a2d206a, 0x080000f8, 0x3d14e032, 0x90a03000, - 0x00005634, 0x90a83000, 0x00005648, 0x598d0011, - 0x8cad6001, 0x92883000, 0x00005634, 0x92a83000, - 0x00005648, 0x080000c8, 0x90a03000, 0x00005640, - 0x90a83000, 0x00005650, 0x598d0011, 0x8cad6001, - 0x92883000, 0x00005640, 0x92a83000, 0x00005650, - 0x0800009c, 0x00000000, 0x3d14e032, 0x90a03000, - 0x00005664, 0x90a83000, 0x00005674, 0x598d0011, - 0x8cad6001, 0x92883000, 0x00005664, 0x92a83000, - 0x00005674, 0x08000068, 0x90a03000, 0x00005668, - 0x90a83000, 0x00005680, 0x598d0011, 0x8cad6001, - 0x92883000, 0x00005668, 0x92a83000, 0x00005680, - 0x0800003c, 0x00000000, 0x3d14e022, 0x90a03000, - 0x00005624, 0x598d0011, 0x92883000, 0x00005624, - 0x0800001c, 0x00000000, 0x90a03000, 0x00005628, - 0x598d0011, 0x92883000, 0x00005628, 0x98242018, - 0x59a14104, 0x59a50908, 0x59a50c03, 0x92a12004, - 0x90a42058, 0x598a1004, 0x5a003094, 0xb0a42030, - 0x12000016, 0x3e954012, 0x598c1004, 0x59ec8115, - 0x92a9200c, 0x3ced801a, 0x59ef4116, 0x92b46004, - 0x5a05a09d, 0x8c8c6008, 0x13fffff0, 0x3b07600a, - 0x92ec6004, 0x90a03000, 0x00005154, 0x3b05200a, - 0x09fffce0, 0x90883000, 0x00000310, 0x90a45000, - 0x3d05207a, 0x90812004, 0x90903000, 0x0000515c, - 0x90883000, 0x0000e464, 0x90a83000, 0x0000515c, - 0x90b03000, 0x0000e468, 0x90b83000, 0x00005154, - 0x59a18e10, 0x58a40394, 0x92a12004, 0x92245d12, - 0x90a03000, 0x000056a0, 0x59b58901, 0x8cad6001, - 0x58ad8095, 0x8cbde001, 0x92a83000, 0x0000515c, - 0x92b83000, 0x00005154, 0x59a05014, 0x92a03000, - 0x000056a0, 0x0a000000, 0x90812004, 0x908c5000, - 0x5c901604, 0x8c803890, 0x00000009, 0x59840d83, - 0x09000240, 0x90a03000, 0x00000310, 0x90a83000, - 0x00000314, 0x59b21014, 0x90bd2004, 0x5a056016, - 0x92f51000, 0x1600000e, 0x90b03000, 0x00000318, - 0x5a023086, 0x92b83000, 0x20000038, 0x58a18981, - 0x92b03000, 0x00000310, 0x92a03000, 0x30000060, - 0x15000022, 0x90a59000, 0x3d052066, 0x90a03000, - 0x0000e474, 0x90a51000, 0x3a052056, 0x08000014, - 0x90a03000, 0x0000e474, 0x90a51000, 0x3a052042, - 0x90a83000, 0x0000e478, 0x90a55000, 0x59a05014, - 0x92a55000, 0x90a83000, 0x00005160, 0x8c3801ff, - 0x59a85015, 0x58a1c095, 0x58a50988, 0x92a83000, - 0x00005160, 0x92a03000, 0x20000004, 0x90883000, - 0x0000e48c, 0x5c801604, 0x09002964, 0x90b03000, - 0x0000e484, 0x90803000, 0x00000308, 0x90a03000, - 0x00000308, 0x90a83000, 0x0000e468, 0x90b83000, - 0x00000300, 0x59a05014, 0x8cb03a16, 0x00000010, - 0x59ad4901, 0x92b11000, 0x58a54094, 0x9225dd10, - 0x92a03000, 0x00000308, 0x0a000000, 0x65944490, - 0x0a000000, 0x66003805, 0x0a000000, 0x5c801621, - 0x0a000000, 0x5c083610, 0x5c801610, 0x5c801610, - 0x5c801610, 0x5c801610, 0x5c801610, 0x5c801610, - 0x5c801610, 0x5c801610, 0x0a000000, 0x5c003610, - 0x0a000000, 0x5c801620, 0x0a000000, 0x8c203000, - 0x001f0000, 0x592c0e10, 0x65290284, 0x5c801605, - 0x0a000000, 0x65801290, 0x0a000000, 0x8c203000, - 0xffffffff, 0x61244010, 0x5c801604, 0x0a000000, - 0x61944010, 0x5c801612, 0x0a000000, 0x61244110, - 0x5c801604, 0x0a000000, 0x00000000, 0x00000000, - 0x5c981e00, 0x92883000, 0x20000030, 0x5a042093, - 0x8ca03990, 0x00000000, 0x92a03000, 0x20000060, - 0x13000052, 0x8ce83000, 0x10000008, 0x8c883000, - 0x30000000, 0x90a75000, 0x343d2016, 0x8ca83000, - 0x10000008, 0x90a55000, 0x333d3ffc, 0xb0a45000, - 0xb2a49000, 0xb0a45000, 0x59985013, 0x8c94a010, - 0x5a042093, 0xb2a49000, 0x59941012, 0x14ffffc8, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c981e00, 0x92883000, 0x20000054, 0x5a042093, - 0x8ca03990, 0x00000000, 0x92a03000, 0x20000060, - 0x13000032, 0x8c883000, 0x30000060, 0xb0a49000, - 0x59941012, 0x8c9ce001, 0x5a042093, 0xb2a45000, - 0xb0a49000, 0x59941012, 0xb2a45000, 0x14ffffe0, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5a00b090, 0x92883000, 0x20000054, 0x5c981610, - 0x8c8c9000, 0x92803000, 0x20000060, 0x1200002a, - 0x3c142012, 0x3a0c2032, 0x08000040, 0x00000000, - 0x3d1c203a, 0x90a49000, 0x59891012, 0x92a03000, - 0x20000060, 0x90a45000, 0x59891011, 0x92a03000, - 0x20000060, 0x90a45000, 0x92a03000, 0x20000060, - 0x0a000000, 0x00000000, 0x58a3d092, 0x3a452032, - 0x34452012, 0x3a252016, 0x0800004c, 0x00000000, - 0x3a652032, 0x08000040, 0x90a49000, 0x59891012, - 0x599c0901, 0x92a03000, 0x20000060, 0x90a45000, - 0x59891011, 0x599cc901, 0x92a03000, 0x20000060, - 0x90a45000, 0x59891011, 0x599cc901, 0x92a03000, - 0x20000060, 0x3b1ce026, 0x8c803000, 0x20000060, - 0x599cc904, 0xb0a45000, 0x5a00f093, 0x8c8c6010, - 0xb2a41000, 0x11ffffec, 0x3b04e026, 0x8ca83000, - 0x20000060, 0x599cc901, 0x90a45000, 0x5a003093, - 0x8c8c6004, 0x92a55000, 0x11ffffec, 0x0a000000, - 0x8cb000ff, 0x58858090, 0x8ca80000, 0x8c883000, - 0x04c4b3ff, 0x8cb83000, 0x10000004, 0x92803000, - 0x20000004, 0x90a5d000, 0x58a58094, 0x3aa40026, - 0x59a85015, 0x3eac5ff0, 0x90a83000, 0x0000e470, - 0x8ca03000, 0xdead0006, 0x92a55000, 0x08005284, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cb800ff, 0x5ca81e00, 0x8c883000, 0x04c4b3ff, - 0x8c803000, 0x10000004, 0x80b03000, 0x00005160, - 0x90a41000, 0x58a5c094, 0x3aa5802a, 0x59a85015, - 0x3eac5ff0, 0x90a83000, 0x0000e470, 0x8ca03000, - 0xdead0007, 0x92a55000, 0x08005228, 0x00000000, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x000071a0, 0x5c80161e, 0x8cf00000, - 0x90a03000, 0x0000e474, 0x90a51000, 0x3a052042, - 0x90a83000, 0x0000e478, 0x90a55000, 0x59a05014, - 0x92a55000, 0x90a83000, 0x00005160, 0x8cb001ff, - 0x59a85015, 0x58a58095, 0x58a50988, 0x92a83000, - 0x00005160, 0x92a03000, 0x20000004, 0x84041000, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c281610, 0x59314901, 0x8c200000, 0x8c403000, - 0x00002710, 0x59398e02, 0x09fffc6c, 0x58840105, - 0x09fffc5c, 0x5ca01604, 0x5a022094, 0x8c212001, - 0x1600009e, 0x34f9a096, 0x90a1f400, 0x000071f8, - 0x84051000, 0x00000000, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x00007278, 0x00007278, - 0x00007278, 0x00007278, 0x090050d8, 0x09fffbb8, - 0x58814090, 0x3d043f44, 0x5c801e01, 0x0a000000, - 0x8c086040, 0xb2807400, 0xffffffc0, 0xb2a07400, - 0xffffffd0, 0xb2c07400, 0xffffffe0, 0xb2e07400, - 0xfffffff0, 0x90a03000, 0x0000516c, 0x3d052022, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0001, - 0x92a55000, 0x0900507c, 0x09004fe8, 0x90a03000, - 0x10000000, 0x8c8800d2, 0x58a44094, 0x8c880028, - 0x58a44394, 0x8c200000, 0x8c283000, 0x00002710, - 0x92a03000, 0x10000000, 0x09fffb2c, 0x58840e00, - 0x09fffb1c, 0x5ca01604, 0x5a016094, 0x8c212001, - 0x1600000a, 0x0900502c, 0x09fffb0c, 0x37043fdc, - 0x90a83000, 0x00005178, 0x90a03000, 0x00005174, - 0x5a003095, 0x8ca52001, 0x92a03000, 0x00005174, - 0x1200005a, 0x90a03000, 0x0000e474, 0x90a51000, - 0x3a052052, 0x90a83000, 0x0000e478, 0x90a55000, - 0x59a05014, 0x92a55000, 0x90a83000, 0x00005160, - 0x8c8801ff, 0x59a85015, 0x58a44095, 0x58a50988, - 0x92a83000, 0x00005160, 0x92a03000, 0x20000004, - 0x08000010, 0x00000000, 0x92f03000, 0x0000516c, - 0xb0807400, 0xffffffc0, 0xb0a07400, 0xffffffd0, - 0xb0c07400, 0xffffffe0, 0xb0e07400, 0xfffffff0, - 0x5c083603, 0x0a000000, 0x00000000, 0x00000000, - 0x8c086040, 0xb2807400, 0xffffffc0, 0xb2a07400, - 0xffffffd0, 0xb2c07400, 0xffffffe0, 0xb2e07400, - 0xfffffff0, 0x90a03000, 0x50001444, 0x3025200e, - 0x3085200a, 0x0900039c, 0x90a03000, 0x50001444, - 0x302d200e, 0x308d200a, 0x090003a8, 0x90a03000, - 0x50001444, 0x3035200e, 0x3095200a, 0x090003b4, - 0x90a03000, 0x50000c44, 0x3015200e, 0x301d200a, - 0x090003c0, 0x5c201e00, 0x8c283000, 0x00002710, - 0x09fff9d4, 0x58840e04, 0x09fff9c4, 0x5ca01604, - 0x5a016094, 0x8c212001, 0x1600000a, 0x09004ed4, - 0x09fff9b4, 0x37243fdc, 0xb0807400, 0xffffffc0, - 0xb0a07400, 0xffffffd0, 0xb0c07400, 0xffffffe0, - 0xb0e07400, 0xfffffff0, 0x5c083603, 0x0a000000, - 0x8c086040, 0xb2807400, 0xffffffc0, 0xb2a07400, - 0xffffffd0, 0xb2c07400, 0xffffffe0, 0xb2e07400, - 0xfffffff0, 0x90a03000, 0x00005184, 0x3d052022, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0002, - 0x92a55000, 0x09004e5c, 0x09004dc8, 0x5c201e00, - 0x8c283000, 0x00002710, 0x09000438, 0x09fff928, - 0x58840e05, 0x09fff918, 0x5ca01604, 0x5a016094, - 0x8c212001, 0x1600000a, 0x09004e28, 0x09fff908, - 0x372c3fdc, 0xb0807400, 0xffffffc0, 0xb0a07400, - 0xffffffd0, 0xb0c07400, 0xffffffe0, 0xb0e07400, - 0xfffffff0, 0x5c083603, 0x0a000000, 0x00000000, - 0x8c086040, 0xb2807400, 0xffffffc0, 0xb2a07400, - 0xffffffd0, 0xb2c07400, 0xffffffe0, 0xb2e07400, - 0xfffffff0, 0x90a03000, 0x00005168, 0x3d052022, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0003, - 0x92a55000, 0x09004dac, 0x09004d18, 0x90a03000, - 0x10000000, 0x8c8800d2, 0x58a44094, 0x58a50980, - 0x8c200000, 0x8c283000, 0x00002710, 0x92a03000, - 0x10000000, 0x09fff860, 0x58840e02, 0x09fff850, - 0x5ca01604, 0x5a016094, 0x8c212001, 0x1600000a, - 0x09004d60, 0x09fff840, 0x37143fdc, 0xb0807400, - 0xffffffc0, 0xb0a07400, 0xffffffd0, 0xb0c07400, - 0xffffffe0, 0xb0e07400, 0xfffffff0, 0x5c083603, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8c086040, 0xb2807400, 0xffffffc0, 0xb2a07400, - 0xffffffd0, 0xb2c07400, 0xffffffe0, 0xb2e07400, - 0xfffffff0, 0x90a03000, 0x00005164, 0x3d052022, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0004, - 0x92a55000, 0x09004cdc, 0x09004c48, 0xb0807400, - 0xffffffc0, 0xb0a07400, 0xffffffd0, 0xb0c07400, - 0xffffffe0, 0xb0e07400, 0xfffffff0, 0x5c083603, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x09fff744, 0x90242004, 0x902c2010, 0x5c801e00, - 0x8c403000, 0x00003201, 0x09fff73c, 0x5c801e00, - 0x8c480004, 0x09fff758, 0x8c583000, 0x00005820, - 0x9259201c, 0x9a412010, 0x8ca03000, 0x00007290, - 0x92a1604c, 0x8ca03000, 0x00007560, 0x8ca83000, - 0x00007630, 0x8cb03000, 0x000073e0, 0x8c800401, - 0x5c881e00, 0x8c900000, 0x92a1608c, 0x92a960cc, - 0x92b1610c, 0x09fff6c8, 0x5c801e00, 0x09fff700, - 0x8c800fff, 0x09fff6d0, 0x5c801e01, 0x08fff700, - 0x09fff6b4, 0x90242004, 0x902c2010, 0x5c801e00, - 0x09fff6b4, 0x5c801e00, 0x09fff6d4, 0x8ca00054, - 0x92a12014, 0x8ca03000, 0x00005800, 0x8ca83000, - 0x000073e0, 0x8cb03000, 0x000074b0, 0x8c800401, - 0x5c881e00, 0x8c900000, 0x92a1201c, 0x92a9610c, - 0x92b1614c, 0x09fff658, 0x5c801e00, 0x09fff690, - 0x8c800fff, 0x09fff660, 0x5c801e01, 0x08fff690, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0010, - 0x92a55000, 0x09004b8c, 0x5c801e01, 0x08004af4, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0011, - 0x92a55000, 0x09004b6c, 0x5c801e01, 0x08004ad4, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0012, - 0x92a55000, 0x09004b4c, 0x5c801e01, 0x08004ab4, - 0x90a83000, 0x0000e470, 0x8ca03000, 0xdead0013, - 0x92a55000, 0x09004b2c, 0x5c801e01, 0x08004a94, - 0x8cf03000, 0x00007854, 0x5c88161e, 0x8cf00000, - 0x8ca000ff, 0x58850090, 0x92803000, 0x50001c08, - 0x84045000, 0x0a000000, 0x00000000, 0x00000000, - 0x58b01988, 0x5a05a090, 0x5da01e00, 0x1200003e, - 0x31858012, 0x3a04201e, 0x08000058, 0x00000000, - 0x58e81989, 0x3a87403e, 0x08000048, 0x00000000, - 0x8ca03000, 0xca61b882, 0x8ca83000, 0x3ed27476, - 0x08000030, 0x00000000, 0x8ca03000, 0xfc8b99de, - 0x8ca83000, 0x3eca5d3b, 0x08000018, 0x00000000, - 0x8ca03000, 0x9d7ab6d8, 0x8ca83000, 0x3ec7c262, - 0x5c901e00, 0x8c983000, 0x4177d784, 0x5d801614, - 0x090068a0, 0x090062c0, 0x8ca000ff, 0x58850090, - 0x92803000, 0x50001c08, 0x0a000000, 0x00000000, - 0x8cf03000, 0x00007930, 0x5c80161e, 0x8cf00000, - 0x90a03000, 0x50001c04, 0x92f03000, 0x00005184, - 0x58a50e01, 0x92a03000, 0x50001c04, 0x84041000, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x90a03000, 0x00005184, 0x3d05200a, 0x09004974, - 0x90a83000, 0x50001c04, 0x58ad4989, 0x3055600a, - 0x58ad498a, 0x90a03000, 0x0000517c, 0x92a83000, - 0x50001c04, 0x59a05014, 0x92a03000, 0x0000517c, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c20161e, 0x90803000, 0x0000518c, 0x5988de06, - 0x090046b0, 0x5ca01610, 0x90a03000, 0x10000000, - 0x8ca800d2, 0x58a54094, 0x58ad0980, 0x92a83000, - 0x10000000, 0x90a03000, 0x0000518c, 0x59af1014, - 0x92a83000, 0x0000e474, 0x90a03000, 0x0000518c, - 0x8cad2020, 0x92a83000, 0x0000e478, 0x90a03000, - 0x0000518c, 0x8cad2030, 0x92a83000, 0x0000e470, - 0x90a03000, 0x0000518c, 0x8cad202c, 0x92a83000, - 0x0000e47c, 0x5ca01e01, 0x92a03000, 0x0000e480, - 0x90a03000, 0x0000518c, 0x8ca83000, 0x0000b800, - 0x92ad2028, 0x90a03000, 0x0000518c, 0x8ca83000, - 0x00032d50, 0x92ad2024, 0x90a03000, 0x0000518c, - 0x8ca83000, 0x0004010c, 0x92ad2034, 0x90a03000, - 0x0000518c, 0x90a83000, 0x00005190, 0x90b56010, - 0x59ad8e10, 0x92ad2038, 0x0a000000, 0x00000000, - 0x59084810, 0x8c279000, 0x90a03000, 0x00005190, - 0x8ca83000, 0xce11feed, 0x92ad2008, 0x90a83000, - 0x0000e470, 0x90a03000, 0x0000e470, 0x90a83000, - 0x0000e470, 0x90b55000, 0x59ad8901, 0x92ad1000, - 0x90a51000, 0x90a03000, 0x0000518c, 0x90ad2040, - 0x8cb0007f, 0x58a58095, 0x5a003094, 0x120000de, - 0x5a007094, 0x1200000e, 0x080000d8, 0x00000000, - 0x90803000, 0x0000518c, 0x09000c28, 0x5ca01610, - 0x92a7e040, 0x90a03000, 0x0000518c, 0x90afe040, - 0x58b54981, 0x92b52044, 0x90a03000, 0x0000518c, - 0x90ad2040, 0x58881987, 0x58a44095, 0x5a003094, - 0x12000060, 0x90a03000, 0x0000e474, 0x90ad1000, - 0x5a003095, 0x1200004c, 0x90a03000, 0x0000e478, - 0x90a83000, 0x0000e478, 0x90b55000, 0x59a85016, - 0x92ad1000, 0x90a03000, 0x00005160, 0x59a85014, - 0x8ca55000, 0x92a03000, 0x00005160, 0x8ca800ff, - 0x58a54094, 0x58ad0988, 0x92a83000, 0x20000004, - 0x90a03000, 0x0000518c, 0x5ca81e00, 0x92ad2040, - 0x90a7e040, 0x5a00b094, 0x15000008, 0x0a000000, - 0x08000010, 0x00000000, 0x08000008, 0x00000000, - 0x08000010, 0x00000000, 0x08000010, 0x00000000, - 0x08fffecc, 0x00000000, 0x0a000000, 0x00000000, - 0x59084810, 0x8ca79000, 0x90a83000, 0x50000c44, - 0x58b54980, 0x92b03000, 0x50000c44, 0x90a83000, - 0x50000c44, 0x58b54e00, 0x92b03000, 0x50000c44, - 0x90a83000, 0x50000c44, 0x58b54e02, 0x92b03000, - 0x50000c44, 0x5ca81e00, 0x92a83000, 0x50001048, - 0x5ca81e01, 0x92a83000, 0x50001044, 0x5ca81e00, - 0x92afe040, 0x90afe040, 0x5a00f015, 0x1600000e, - 0x08000080, 0x00000000, 0x90afe040, 0x5cb01615, - 0x8ca83916, 0x00000000, 0x8cb03000, 0x50001010, - 0x59ad8015, 0x8cb00000, 0x59ad8015, 0x8cb55000, - 0x5ca81e0f, 0x92ad9000, 0x90afe040, 0x5cb01615, - 0x8ca83916, 0x00000000, 0x8cb03000, 0x50001000, - 0x59ad8015, 0x8cb00000, 0x59ad8015, 0x8cb55000, - 0x5ca81e00, 0x92ad9000, 0x90b7e040, 0x59a85016, - 0x8cb55000, 0x92b7e040, 0x08ffff7c, 0x00000000, - 0x90a83000, 0x50001c04, 0x58b54982, 0x92b03000, - 0x50001c04, 0x90a83000, 0x50001444, 0x58b54e01, - 0x92b03000, 0x50001444, 0x8ca801f4, 0x92a83000, - 0x50001430, 0x90a83000, 0x50001444, 0x58b54987, - 0x92b03000, 0x50001444, 0x90a83000, 0x50001444, - 0x58b54986, 0x92b03000, 0x50001444, 0x90a83000, - 0x50001444, 0x58b54e04, 0x92b03000, 0x50001444, - 0x90a83000, 0x50001444, 0x58b54e05, 0x92b03000, - 0x50001444, 0x0a000000, 0x00000000, 0x00000000, - 0x59084810, 0x8c279000, 0x5ca01e00, 0x92a03000, - 0x10000000, 0x90a03000, 0x10000000, 0x8ca800d2, - 0x58a54094, 0x58ad0981, 0x92a83000, 0x10000000, - 0x90a03000, 0x10000000, 0x8ca800d0, 0x58a54094, - 0x92a03000, 0x10000000, 0x90a03000, 0x10000000, - 0x8ca800d2, 0x58a54094, 0x58ad0980, 0x92a83000, - 0x10000000, 0x90a03000, 0x10000000, 0x8ca800d2, - 0x58a54094, 0x8ca80028, 0x58a54394, 0x92a03000, - 0x10000000, 0x5c801e0a, 0x0b002780, 0x5ca01610, - 0x90a03000, 0x50001c04, 0x58ad0983, 0x92a83000, - 0x50001c04, 0x5984d81f, 0x0b002760, 0x5ca01610, - 0x90a03000, 0x50001c04, 0x59a8de0b, 0x58a54394, - 0x8ca83000, 0x00001838, 0x5a056094, 0x12000010, - 0x5c801e01, 0x0900448c, 0x5ca01610, 0x90a03000, - 0x50000c44, 0x5a003094, 0x12000010, 0x5c801e01, - 0x09004470, 0x5ca01610, 0x90a03000, 0x50001444, - 0x59a8de08, 0x58a54394, 0x59a8de08, 0x5a056094, - 0x12000010, 0x5c801e01, 0x09004448, 0x5ca01610, - 0x90a03000, 0x50000c44, 0x58ad0981, 0x92a83000, - 0x50000c44, 0x90a03000, 0x50000c44, 0x58ad0980, - 0x92a83000, 0x50000c44, 0x90a03000, 0x50001444, - 0x58ad0982, 0x92a83000, 0x50001444, 0x90a03000, - 0x50001444, 0x58ad0980, 0x92a83000, 0x50001444, - 0x90a03000, 0x50001444, 0x58ad0e0a, 0x92a83000, - 0x50001444, 0x90a03000, 0x50001c04, 0x58ad0985, - 0x92a83000, 0x50001c04, 0x90a03000, 0x50001c04, - 0x58ad0984, 0x92a83000, 0x50001c04, 0x90a03000, - 0x50001c04, 0x58ad0e03, 0x92a83000, 0x50001c04, - 0x8c803000, 0x00041eb0, 0x0b002640, 0x5ca01610, - 0x8ca00000, 0x92a7e040, 0x90a7e040, 0x5a00f014, - 0x1600000a, 0x080000a4, 0x90a7e040, 0x5ca81614, - 0x8ca03915, 0x00000000, 0x8ca83000, 0x90000c00, - 0x59a54014, 0x8cb00000, 0x59ad8014, 0x8ca55000, - 0x90afe040, 0x5cb01615, 0x59ad8e0a, 0x90b03000, - 0x00005188, 0x59ad4016, 0x92ad1000, 0x90a7e040, - 0x5ca81614, 0x8ca03915, 0x00000000, 0x8ca83000, - 0x90000c10, 0x59a54014, 0x8cb00000, 0x59ad8014, - 0x8ca55000, 0x90afe040, 0x5cb01615, 0x59ad8e0a, - 0x90b03000, 0x00005188, 0x59ad4016, 0x92ad1000, - 0x90afe040, 0x59a05015, 0x8cad1000, 0x92afe040, - 0x08ffff58, 0x00000000, 0x90a03000, 0x0000e480, - 0x5a007094, 0x1500006c, 0x90a03000, 0x00005188, - 0x58a8198d, 0x59a54014, 0x92a03000, 0x90001400, - 0x90a03000, 0x00005188, 0x58a8198d, 0x59a54014, - 0x92a03000, 0x90001410, 0x90a03000, 0x00005188, - 0x58a8198c, 0x59a54014, 0x92a03000, 0x90001800, - 0x90a03000, 0x00005188, 0x58a8198c, 0x59a54014, - 0x92a03000, 0x90001810, 0x08000168, 0x00000000, - 0x5ca01e00, 0x92a7e040, 0x90a7e040, 0x5a00f014, - 0x1600000a, 0x0800014c, 0x90a7e040, 0x5ca81614, - 0x8ca03915, 0x00000000, 0x8ca83000, 0x90001400, - 0x59a54014, 0x8cb00000, 0x59ad8014, 0x8ca55000, - 0x90afe040, 0x59b0de0b, 0x70ad8095, 0x58b0198d, - 0x59ad8015, 0x90b03000, 0x00005188, 0x59ad4016, - 0x92ad1000, 0x90a7e040, 0x5ca81614, 0x8ca03915, - 0x00000000, 0x8ca83000, 0x90001410, 0x59a54014, - 0x8cb00000, 0x59ad8014, 0x8ca55000, 0x90afe040, - 0x59b0de0b, 0x70ad8095, 0x58b0198d, 0x59ad8015, - 0x90b03000, 0x00005188, 0x59ad4016, 0x92ad1000, - 0x90a7e040, 0x5ca81614, 0x8ca03915, 0x00000000, - 0x8ca83000, 0x90001800, 0x59a54014, 0x8cb00000, - 0x59ad8014, 0x8ca55000, 0x90afe040, 0x5cb01615, - 0x59ad8e0a, 0x58b0198c, 0x59ad8015, 0x90b03000, - 0x00005188, 0x59ad4016, 0x92ad1000, 0x90a7e040, - 0x5ca81614, 0x8ca03915, 0x00000000, 0x8ca83000, - 0x90001810, 0x59a54014, 0x8cb00000, 0x59ad8014, - 0x8ca55000, 0x90afe040, 0x5cb01615, 0x59ad8e0a, - 0x58b0198c, 0x59ad8015, 0x90b03000, 0x00005188, - 0x59ad4016, 0x92ad1000, 0x90afe040, 0x59a05015, - 0x8cad1000, 0x92afe040, 0x08fffeb0, 0x00000000, - 0x5ca01e01, 0x92a03000, 0x50001044, 0x5ca01e00, - 0x92a7e040, 0x90a7e040, 0x5a00f014, 0x1600000e, - 0x08000080, 0x00000000, 0x90a7e040, 0x5ca81614, - 0x8ca03915, 0x00000000, 0x8ca83000, 0x50001010, - 0x59a54014, 0x8ca80000, 0x59a54014, 0x8cad1000, - 0x5ca01e0f, 0x92a55000, 0x90a7e040, 0x5ca81614, - 0x8ca03915, 0x00000000, 0x8ca83000, 0x50001000, - 0x59a54014, 0x8ca80000, 0x59a54014, 0x8cad1000, - 0x5ca01e00, 0x92a55000, 0x90afe040, 0x59a05015, - 0x8cad1000, 0x92afe040, 0x08ffff7c, 0x00000000, - 0x90a03000, 0x50000c44, 0x58ad0e01, 0x92a83000, - 0x50000c44, 0x90a03000, 0x50000c44, 0x58ad0e00, - 0x92a83000, 0x50000c44, 0x90a03000, 0x50001444, - 0x58ad0e02, 0x92a83000, 0x50001444, 0x90a03000, - 0x50001444, 0x58ad0e00, 0x92a83000, 0x50001444, - 0x90a03000, 0x50001444, 0x58ad098a, 0x92a83000, - 0x50001444, 0x90a03000, 0x50001c04, 0x58ad0e05, - 0x92a83000, 0x50001c04, 0x90a03000, 0x50001c04, - 0x58ad0e04, 0x92a83000, 0x50001c04, 0x90a03000, - 0x50001444, 0x58ad0993, 0x92a83000, 0x50001444, - 0x5c801e00, 0x0a000000, 0x0a000000, 0x00000000, - 0x5ca0161e, 0x8ca80000, 0x92a83000, 0x50001044, - 0x5ca81e1f, 0x92a83000, 0x50001048, 0x80a83000, - 0x0000e46c, 0x92a83000, 0x50001000, 0x5ca81e01, - 0x92a83000, 0x50001010, 0x80a83000, 0x0000e46c, - 0x92a83000, 0x50001004, 0x5ca81e01, 0x92a83000, - 0x50001014, 0x80a83000, 0x0000e46c, 0x92a83000, - 0x50001008, 0x5ca81e01, 0x92a83000, 0x50001018, - 0x80a83000, 0x0000e46c, 0x92a83000, 0x5000100c, - 0x5ca81e01, 0x92a83000, 0x5000101c, 0x0a000000, - 0x90bc1000, 0x908c1000, 0x90a42004, 0x90b03000, - 0x000002f4, 0x90903000, 0x000002f8, 0x90983000, - 0x000002fc, 0x90a83000, 0x000002f0, 0x8c303000, - 0x0000ff00, 0x59a50e04, 0x58b58094, 0x58a48094, - 0x59a50413, 0x58b50396, 0x58ad4096, 0x5a003095, - 0x58b98097, 0x59edcc08, 0x8c303000, 0x00ff0000, - 0x58898091, 0x598c4c10, 0x12000012, 0x5c801e0a, - 0x0a000000, 0x00000000, 0x5a003091, 0x59b58c04, - 0x12000012, 0x3a0c6076, 0x08ffffe4, 0x00000000, - 0x90a03000, 0x00000390, 0x3a053fd6, 0x90a03000, - 0x00000360, 0x3a05201a, 0x90a03000, 0x0000e490, - 0x3d052022, 0x34fda00a, 0x3d75a01a, 0x8c883000, - 0x00005ce0, 0x8cb83000, 0x00000380, 0x08000014, - 0x8cb83000, 0x00000350, 0x90883000, 0x0000e450, - 0x8c903000, 0x00005ce0, 0x8c983000, 0x00000380, - 0x08000068, 0x00000000, 0x90a03000, 0x0000e430, - 0x3a053f6e, 0x90a03000, 0x000003c0, 0x3a05201a, - 0x90a03000, 0x0000e490, 0x3d0d2022, 0x34fda00a, - 0x3d75a01a, 0x8c883000, 0x00005e80, 0x8cb83000, - 0x0000e420, 0x08000014, 0x8cb83000, 0x000003b0, - 0x90883000, 0x0000e454, 0x8c903000, 0x00005e80, - 0x8c983000, 0x0000e420, 0x90a83000, 0x0000e4a0, - 0x5a01309d, 0x59a58e07, 0x59254014, 0x120000a6, - 0x3c276012, 0x3a076016, 0x08fffef4, 0x00000000, - 0x3a2f60d2, 0x08fffee8, 0x90a42008, 0x5984581f, - 0x70ad0590, 0x3d05600a, 0x5ca81e01, 0x90a12010, - 0x8c303000, 0x0000b700, 0x5a01a094, 0x92a92054, - 0x12000032, 0x592d1004, 0x90895000, 0x3c8d401e, - 0x70940091, 0x8c811000, 0x5c981e02, 0x09ffe544, - 0x92f15000, 0x92f12024, 0x5c801e02, 0x0a000000, - 0x9289203c, 0x92912040, 0x90a5e014, 0x74a50590, - 0x92a1202c, 0x8ca83000, 0x0000b7b0, 0x90a4e014, - 0x92a92010, 0x74a50590, 0x8c941000, 0x08000084, - 0x90a12010, 0x8c303000, 0x0000b700, 0x3da19e52, - 0x9289203c, 0x92912040, 0x90a5e014, 0x5993581f, - 0x74a50592, 0x92a1202c, 0x90a4e014, 0x74a50592, - 0x8ca83000, 0x0000b780, 0x5c281e04, 0x08000040, - 0x90a12010, 0x8c303000, 0x0000b700, 0x3da19e12, - 0x92992040, 0x92b9203c, 0x90a5e014, 0x5994581f, - 0x74a50592, 0x92a1202c, 0x90a4e014, 0x74a50592, - 0x8ca83000, 0x0000b250, 0x5c281e00, 0x92a92010, - 0x92a12030, 0x9081202c, 0x8c892030, 0xb0a45000, - 0x70840092, 0x92e92058, 0x59840105, 0x8cac1000, - 0x70950092, 0x92846004, 0x5cb01612, 0x8c800002, - 0x92a45000, 0x92946008, 0x92bc600c, 0x0a000000, - 0x90a42004, 0x90b03000, 0x000002f4, 0x90b83000, - 0x000002f8, 0x90803000, 0x000002fc, 0x90a83000, - 0x000002f0, 0x59a50e04, 0x58b58094, 0x58a5c094, - 0x59a50410, 0x58b50396, 0x58ad4096, 0x3a05600e, - 0x5c801e0a, 0x0a000000, 0x90a03000, 0x0000e4a0, - 0x59b58c04, 0x59ad8e07, 0x59250015, 0x90a12010, - 0x8c283000, 0x0000b700, 0x3da14012, 0x5c801e0a, - 0x0a000000, 0x00000000, 0x90892014, 0x3b046016, - 0x5c801604, 0x8c900000, 0x5c981e08, 0x09ffe3b4, - 0x5c801604, 0x58881987, 0x09003948, 0x58a0199f, - 0x92292010, 0x5c801e02, 0x92a12044, 0x0a000000, - 0x90b42060, 0x90ac2060, 0x8c542040, 0x5c481610, - 0x8ca83995, 0x00000020, 0x58a7d095, 0x5a003094, - 0x92b03000, 0x0000e494, 0x92a83000, 0x0000e498, - 0x12000012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x90a4205c, 0x59bd0e03, 0x8cade020, 0x58a7d095, - 0x5a003094, 0x92a83000, 0x0000e48c, 0x1200000e, - 0x5c801e08, 0x0a000000, 0x90a42058, 0x58a0d094, - 0x3a052012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x90942050, 0x90ac2054, 0x90b42058, 0x909c2058, - 0x90ec2058, 0x90242070, 0x902c2078, 0x90342080, - 0x903c2088, 0x90442090, 0x5962581f, 0x70930092, - 0x8ca5e028, 0x70a58094, 0x90b42098, 0x90bc20a0, - 0x908c20a8, 0x8cac9d95, 0x59ad0015, 0x8c9d5d13, - 0x8cecdd1d, 0x8c275d84, 0x8c291d85, 0x8c315d86, - 0x8c399d87, 0x8c41dd88, 0x8cb21d96, 0x8c583000, - 0x0003cd4f, 0x8c603000, 0x00032d50, 0x8cbd9d97, - 0x59a2c10c, 0x8c8ddd91, 0x368d0012, 0x5c801e08, - 0x0a000000, 0x00000000, 0x090000b8, 0x3d44200e, - 0x5c801e08, 0x0a000000, 0x8c825000, 0x09000124, - 0x3d442012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x8c825000, 0x0900018c, 0x3d442012, 0x5c801e08, - 0x0a000000, 0x00000000, 0x8c825000, 0x09ffd6d4, - 0x3d442012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x90826058, 0x90883000, 0x0000e48c, 0x09ffdd04, - 0x3d442012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x8c829000, 0x09000afc, 0x3d442012, 0x5c801e08, - 0x0a000000, 0x00000000, 0x8c800000, 0x09ffe7b4, - 0x90a2a024, 0x5c801e02, 0x92a03000, 0x0000e490, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c201610, 0x90a12050, 0x59850e05, 0x92a03000, - 0x0000e49c, 0x090014fc, 0x5a003090, 0x92803000, - 0x0000e408, 0x1500000e, 0x5c801e08, 0x0a000000, - 0x90b03000, 0x0000e49c, 0x92811000, 0x92803000, - 0x0000e410, 0x5ca81e00, 0x59a58e05, 0x5a05a095, - 0x8ca53c10, 0xffffffe0, 0x92a03000, 0x0000e40c, - 0x1300001a, 0x59a85015, 0x92f41000, 0x5a05a095, - 0x8c842020, 0x14fffff0, 0x5c801e02, 0x0a000000, - 0x5c281610, 0x90216058, 0x59310e03, 0x8c819000, - 0x09001480, 0x5a003090, 0x92803000, 0x00000310, - 0x15000012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x92816008, 0x5ca81e00, 0x92803000, 0x00000318, - 0x5a012095, 0x8ca1bc10, 0xfffffff8, 0x92a03000, - 0x00000314, 0x1300001a, 0x59a85015, 0x92f41000, - 0x5a012095, 0x8c842008, 0x14fffff0, 0x5c801e02, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c281610, 0x90216054, 0x59310e03, 0x8c819000, - 0x09001400, 0x5a003090, 0x92803000, 0x00000320, - 0x15000012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x92816004, 0x5ca81e00, 0x92803000, 0x0000031c, - 0x5a012095, 0x8ca1bc10, 0xfffffff8, 0x92a03000, - 0x00000324, 0x1300001a, 0x59a85015, 0x92f41000, - 0x5a012095, 0x8c842008, 0x14fffff0, 0x5c801e02, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c201611, 0x8c303984, 0x00000000, 0x5c281610, - 0x8c819000, 0x0900137c, 0x5a003090, 0x9281601c, - 0x15000012, 0x5c801e08, 0x0a000000, 0x00000000, - 0x8ca9bc10, 0xfffffff8, 0x8ca16020, 0x5cb01e00, - 0x92851000, 0x5a012096, 0x92ad2004, 0x13000016, - 0x90a1601c, 0x92f51d96, 0x59b05016, 0x3cb11ff4, - 0x5c801e02, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x00008b4c, 0x5c90161e, 0x8cf00000, - 0x59840901, 0x59b81901, 0x3a85c052, 0x598c4e08, - 0x8ca80000, 0x58a05110, 0x8cb47c15, 0x40000850, - 0x5a003094, 0x8ca47c15, 0x40000860, 0x1200001a, - 0x59840901, 0x5a05e090, 0x92f59000, 0x92f51000, - 0x1200001a, 0x59840902, 0x5a05e090, 0x92f59000, - 0x92f51000, 0x15fffff0, 0x84049000, 0x0a000000, - 0x5c601614, 0x8c180030, 0x74a48583, 0x8c559000, - 0x90b03000, 0x00005620, 0x5c581613, 0x598ace08, - 0x8cb80000, 0x5c681615, 0x8cac7c17, 0x40000840, - 0x59a58014, 0x92a03000, 0x00005620, 0x92855000, - 0x98a29000, 0x5990d012, 0x8c200000, 0x5a00308c, - 0x8c347c17, 0x70000040, 0x594c8d82, 0x8c800000, - 0x5c381614, 0x592d4d82, 0x150000d2, 0x3b0260c6, - 0x5947de02, 0x8ce83000, 0x20000030, 0x8c983000, - 0x20000060, 0x8c903000, 0x20000004, 0x8c883000, - 0x10000008, 0x3d016016, 0x5952100a, 0x98a29000, - 0x592d4d82, 0x8c3d1000, 0x59a20104, 0x5a052085, - 0x8cb15000, 0x1600000a, 0x5cb01614, 0x923f5000, - 0x90a03000, 0x00005160, 0x59258004, 0x8ca800ff, - 0x5a02f084, 0x8c39dd16, 0x594a4116, 0x92b4d000, - 0x59294116, 0x8ca52001, 0x58ad4094, 0x92a03000, - 0x00005160, 0x92ac9000, 0x16000036, 0x80a45000, - 0x335d202a, 0x8c803000, 0x10000008, 0xb0a19000, - 0xb0a19000, 0xb0a19000, 0x80a41000, 0x5a02f014, - 0x5921090c, 0x11ffffe8, 0x3c593fd4, 0x3c027f6a, - 0x0a000000, 0x00000000, 0x3b0260d6, 0x8c783000, - 0x20000004, 0x8c703000, 0x10000008, 0x3d016016, - 0x5952100a, 0x98a29000, 0x592d4d82, 0x8c3d1000, - 0x591fde02, 0x59a0c104, 0x5a052085, 0x8cb15000, - 0x1600000a, 0x5cb01614, 0x92383000, 0x20000030, - 0x90a03000, 0x00005160, 0x59258004, 0x8ca800ff, - 0x5a02f084, 0x92b03000, 0x20000060, 0x594a4116, - 0x8c39dd16, 0x59294116, 0x8ca52001, 0x58ad4094, - 0x92a03000, 0x00005160, 0x92abd000, 0x1600004e, - 0x80a39000, 0x335d2042, 0x8c403000, 0x10000008, - 0x59805010, 0xb0a19000, 0x5a032090, 0xb0a19000, - 0x5921090c, 0xb0a19000, 0x15000016, 0x5c80160d, - 0x8c8ad000, 0x0bfffda4, 0x5c801e00, 0x80a21000, - 0x345d3fd0, 0x3c593fbc, 0x3c027f44, 0x5c80160d, - 0x8c8ad000, 0x08fffd7c, 0x00000000, 0x00000000, - 0x92883000, 0x20000040, 0x59ac0e08, 0x8cb80000, - 0x8cb57c17, 0x600004f0, 0xb0259000, 0x59a41011, - 0x92a03000, 0x20000040, 0xb0259000, 0x8c846020, - 0x8cad7c17, 0x600004fc, 0x92803000, 0x20000038, - 0x59811010, 0x90a55000, 0x92803000, 0x20000038, - 0x59811010, 0x90a55000, 0x0a000000, 0x00000000, - 0x8cf03000, 0x00008e0c, 0x5c90161e, 0x8cf00000, - 0x59840e08, 0x8ca80000, 0x8c843400, 0x400004c0, - 0x90a41000, 0x59a85015, 0x5a02b095, 0x92a45000, - 0x59891011, 0x16ffffec, 0x84049000, 0x0a000000, - 0x8cf03000, 0x00008e4c, 0x5c90161e, 0x8cf00000, - 0x59840e08, 0x8ca80000, 0x8c843400, 0x400004c0, - 0x90a41000, 0x59a85015, 0x5a02b095, 0x92a45000, - 0x59891011, 0x16ffffec, 0x84049000, 0x0a000000, - 0x8cf03000, 0x00008e84, 0x5c88161e, 0x8cf00000, - 0x59840e08, 0x8c843400, 0x400004c0, 0xb0a41000, - 0xb0a41000, 0x90a41000, 0x90a41000, 0x90a41000, - 0x84045000, 0x0a000000, 0x00000000, 0x00000000, - 0x8c086070, 0x92c7e0a0, 0x5c381610, 0xb0a1e020, - 0x5c781612, 0x8c680000, 0x9021e014, 0x5a03e00d, - 0x9029e044, 0x5c701611, 0x8cc03000, 0x400004c0, - 0x5c481616, 0x8c455000, 0x130004c6, 0x8c583000, - 0x00005640, 0x5962c904, 0x8c183000, 0x5000144c, - 0x90a61000, 0x8c503000, 0x0000ffff, 0x58328094, - 0x3d3140aa, 0x3d02204a, 0x8ce805d2, 0x36274016, - 0x5c801e00, 0x0bffff54, 0x080001f4, 0x00000000, - 0x9089e040, 0x5c801607, 0x86045000, 0x5a007090, - 0x8c4c1000, 0x15000016, 0x5c801e00, 0x0bffff2c, - 0x080001cc, 0x00000000, 0x9041e030, 0x92483000, - 0x20000044, 0xb0a03000, 0x600004f0, 0xb0a03000, - 0x600004f0, 0x8c4a602c, 0x5a003089, 0x8c212001, - 0x59420901, 0x90a03000, 0x600004fc, 0x90a03000, - 0x600004fc, 0x90a03000, 0x600004fc, 0x12000182, - 0x8ce83000, 0x00003fff, 0x8ca16400, 0x582f4094, - 0x080003f4, 0x00000000, 0x59a18c0e, 0x3a0d205e, - 0x310d2012, 0x3a1521ae, 0x3a1d2292, 0x080003c4, - 0x5c801e00, 0x0bfffea4, 0x3a012022, 0x5c801607, - 0x8c891000, 0x5c901e00, 0x8c980008, 0x09ffdae4, - 0x08000014, 0x00000000, 0x90a2d000, 0x59a05014, - 0x92a2d000, 0x5828199f, 0x8c400000, 0x5c201e00, - 0x08000394, 0x00000000, 0x3d012022, 0x5c801e00, - 0x0bfffe58, 0x90a2d000, 0x59a05014, 0x5828199f, - 0x8c400000, 0x0800036c, 0x58a1498e, 0x5a052086, - 0x8c212001, 0x12000026, 0x5c801607, 0x8c891000, - 0x5c901e00, 0x8c980008, 0x09ffda78, 0x5c801e00, - 0x0bfffe18, 0x080001c4, 0x5c801e00, 0x8c8fe040, - 0x0bfffd88, 0x9080d000, 0x59a40c1c, 0x9097fd14, - 0x0000003c, 0x90a9e048, 0x8ce83000, 0x00ff0000, - 0x58a74092, 0x5a052095, 0x592c0c1a, 0x15000032, - 0x58a0d092, 0x8ce8002c, 0x70af4084, 0x90a03914, - 0x000051a0, 0x59294904, 0x58328092, 0x59a50006, - 0x8cad7c05, 0xffffffd0, 0x3aa5403a, 0x90a31000, - 0x5c801607, 0x8c900000, 0x5c981e08, 0x8ca52001, - 0x5c881604, 0x8c200000, 0x5c401e00, 0x5828199f, - 0x92a31000, 0x09ffd9dc, 0x080002ac, 0x00000000, - 0x3d022042, 0x9089e03c, 0x5c801607, 0x86045000, - 0x5a007090, 0x8c4c1000, 0x1500002a, 0x5c801607, - 0x8c891000, 0x5c901e00, 0x8c980008, 0x09ffd9a4, - 0x5c201e00, 0x5828199f, 0x0800026c, 0x00000000, - 0x3a01601a, 0x5980d005, 0x8c8a5000, 0x59840c02, - 0x8c97e040, 0x09ffde3c, 0x5c801607, 0x8c891000, - 0x5c901606, 0x8c980002, 0x080000bc, 0x00000000, - 0x3a01201a, 0x5c801e00, 0x0bfffd00, 0x5c801607, - 0x8c891000, 0x08000098, 0x5c801607, 0x8c8b9000, - 0x09ffd580, 0x3d04201e, 0x5c801e00, 0x0bfffcdc, - 0x90a2d000, 0x59a05014, 0x5828199f, 0x080001f4, - 0x9089e03c, 0x5c801607, 0x86045000, 0x5a007090, - 0x8c4c1000, 0x15000026, 0x9081e018, 0x09ffd634, - 0x5c801e00, 0x0bfffca4, 0x90a2d000, 0x59a05014, - 0x5828199f, 0x080001bc, 0x90a61000, 0x5c801e00, - 0x8c8a5000, 0x8ce83000, 0x00ff0000, 0x58a74094, - 0x92a1e048, 0x09fffb8c, 0x5a003090, 0x8c4c1000, - 0x1500002a, 0x5c801607, 0x8c880000, 0x5c901e00, - 0x8c980008, 0x09ffd8ac, 0x5c201e00, 0x8c400000, - 0x5828199f, 0x08000170, 0x90a9e02c, 0x8ce83000, - 0x00003fff, 0x8ca1a400, 0x582f4094, 0x8c200001, - 0x59454901, 0x08000150, 0x3a012026, 0x5c801607, - 0x8c900000, 0x5c981e08, 0x8c891000, 0x5c201e00, - 0x8c400000, 0x5828199f, 0x09ffd858, 0x5c801e00, - 0x8c8fe070, 0x0bfffbb4, 0x9080d000, 0x59340c1a, - 0x3a01a116, 0x59a40c1c, 0x9097fd14, 0x0000006c, - 0x90a7e070, 0x8ca83000, 0x00ff0000, 0x58b54092, - 0x58a54094, 0x3db50022, 0x58a0d092, 0x90b03914, - 0x000051a0, 0x58228092, 0x59a98908, 0x59a58004, - 0x3aa54022, 0x90a31000, 0x59a05014, 0x8c200000, - 0x5c401e00, 0x5828199f, 0x92a31000, 0x080000b8, - 0x59a21016, 0x8c81d000, 0x5c88160e, 0x59318114, - 0x09ffd410, 0x3d04201e, 0x90a2d000, 0x59a05014, - 0x8c200000, 0x5c401e00, 0x5828199f, 0x08000084, - 0x9089e03c, 0x5c801607, 0x86045000, 0x5a007090, - 0x8c4c1000, 0x1500002e, 0x90a2d000, 0x9081e018, - 0x59a05014, 0x8c200000, 0x5c401e00, 0x5828199f, - 0x92a2d000, 0x09ffd4ac, 0x0800004c, 0x00000000, - 0x5980d006, 0x8c8a5000, 0x59840c02, 0x8c97e074, - 0x09ffdc20, 0x5c801607, 0x8c880001, 0x5c901604, - 0x8c980002, 0x09ffd74c, 0x5c201e00, 0x08000018, - 0x5c801e00, 0x0bfffae4, 0x90a2d000, 0x59a05014, - 0x92a2d000, 0x5968500d, 0x346bdb58, 0x9221e014, - 0x9249e028, 0x9241e024, 0x9229e044, 0x90c7e0a0, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8ca03000, 0x0000ed50, 0x5a003094, 0x9024200c, - 0x92a03000, 0x0000e4a0, 0x15000012, 0x5c801e08, - 0x0a000000, 0x00000000, 0x8c851000, 0x59890e07, - 0x09002c70, 0x5ca81e00, 0x5a012095, 0x59a10901, - 0x92f03000, 0x0000e488, 0x92a03000, 0x0000e484, - 0x1300005e, 0x90b03000, 0x0000e4a0, 0x5a012f00, - 0x8c803000, 0x0000b700, 0x58b8199f, 0x8ca59000, - 0x1000001e, 0x9285a010, 0x5ca81e01, 0x92bda044, - 0x5a012095, 0x8ca5a080, 0x13000026, 0x92852010, - 0x92bd2044, 0x92852090, 0x59a89015, 0x92bd20c4, - 0x5a012095, 0x8ca52100, 0x14ffffe4, 0x5c801e02, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x90a4205c, 0x5c501611, 0x5a05208a, 0x8c241000, - 0x5c381612, 0x90342028, 0x1200002e, 0x592d1010, - 0x90895000, 0x3b04601e, 0x59ec581f, 0x70974091, - 0x8c980002, 0x09ffd60c, 0x92f15000, 0x92f12024, - 0x9251205c, 0x3b01e1e6, 0x594d1004, 0x8c412024, - 0x90a12024, 0x3d0520de, 0x90a12014, 0x3d0520b6, - 0x5c801604, 0x8c8a9000, 0x09ffd218, 0x3a0421c6, - 0x90a92054, 0x90a1202c, 0x3ead001a, 0x90892040, - 0x5c801604, 0x86045000, 0x90a12030, 0x08000014, - 0x9089203c, 0x5c801604, 0x86045000, 0x90a1202c, - 0x5c301610, 0x92a12024, 0x3d0c2088, 0x90a03000, - 0x00005628, 0x90812018, 0x59a50007, 0x92a03000, - 0x00005628, 0x09ffd2ac, 0x708b1087, 0x8c800000, - 0x0b001328, 0x92f12024, 0x0a000000, 0x00000000, - 0x90892014, 0x5c801604, 0x8c900000, 0x5c981e08, - 0x09ffd550, 0x5c801e00, 0x708b1085, 0x8c280000, - 0x0b0012f8, 0x92f21000, 0x92f12014, 0x080000bc, - 0x90892040, 0x5c801604, 0x86045000, 0x5a007090, - 0x8c341000, 0x1200012e, 0x90a12030, 0x92a12024, - 0x90b12014, 0x90a92054, 0x59a58007, 0x5a056094, - 0x8c29d000, 0x1400000a, 0x592d4116, 0x90a12024, - 0x5a052085, 0x5939c105, 0x16000056, 0x90892024, - 0x5c801e00, 0x8c919000, 0x8c992050, 0x09000fc4, - 0x90a21000, 0x90a92014, 0x90892040, 0x5c801604, - 0x59ad0015, 0x59294114, 0x92a92014, 0x86045000, - 0x5a007090, 0x8c341000, 0x12ffff4a, 0x90a12030, - 0x5a052085, 0x92a21000, 0x11ffffb4, 0x3a01601e, - 0x5c801e00, 0x8c895000, 0x5c901606, 0x8c992050, - 0x09000f70, 0x5c301610, 0x90a25000, 0x90a92054, - 0x598d0005, 0x5a056091, 0x928a5000, 0x15000026, - 0x59ec581f, 0x70974091, 0x8c811000, 0x5c981e02, - 0x09ffd450, 0x92f25000, 0x92f12024, 0x08000028, - 0x8ca12020, 0xb0851000, 0x92352008, 0x59ac4105, - 0x8c8d5000, 0x5c901606, 0x92851000, 0x92ad2004, - 0x929d200c, 0x3c01fe2c, 0x0a000000, 0x00000000, - 0x90a03000, 0x00005628, 0x708b1087, 0x8c800000, - 0x59a50007, 0x92a03000, 0x00005628, 0x080011a4, - 0x90a03000, 0x00005628, 0x708b1087, 0x8c800000, - 0x59a50007, 0x92a03000, 0x00005628, 0x0b00118c, - 0x90892014, 0x5c801604, 0x8c900000, 0x5c981e02, - 0x09ffd3c0, 0x92f12014, 0x0a000000, 0x5c201e00, - 0x92241000, 0x598c4984, 0x59811010, 0x3e247ff4, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8c086050, 0xb2c7e070, 0x92e7e080, 0x5cd81615, - 0x8caca003, 0x58e8d215, 0x8c659000, 0x5973581f, - 0x8cb76033, 0x70b5858e, 0x90a83000, 0x00005644, - 0x90b83000, 0x00005630, 0x59a85015, 0x92a83000, - 0x00005644, 0x59b5c016, 0x92b03000, 0x00005630, - 0x90ab2004, 0x5cc81613, 0x8cd51000, 0x5c181e00, - 0x8c7f6008, 0x593fde02, 0x9297e040, 0x595f4d82, - 0x90531000, 0x594d4d82, 0x5a01e089, 0x8c8a5000, - 0x1600000a, 0x5c881607, 0x92503000, 0x20000030, - 0x92883000, 0x20000060, 0x90b03000, 0x00005160, - 0x90b83000, 0x000051b0, 0x8c283000, 0x20000030, - 0x90a83000, 0x000051b4, 0x5c401611, 0x8c683000, - 0x20000004, 0x8c2000ff, 0x8ce03000, 0xffff0000, - 0x8cc003ff, 0x8c316030, 0x5a03a00f, 0x8c529d11, - 0x595ac111, 0x8cb5a001, 0x594a4111, 0x92b03000, - 0x00005160, 0x58b10096, 0x8cbde001, 0x58af0095, - 0x8ce03000, 0x00fffffc, 0x58af4395, 0x92b03000, - 0x20000004, 0x58be0097, 0x8cad7400, 0x00010000, - 0x58b70095, 0x8cc03000, 0x00ff0000, 0x58c60095, - 0x92b83000, 0x000051b0, 0x92c7e050, 0x92b03000, - 0x000051b4, 0x11000126, 0x5a00308b, 0x5942c011, - 0x16000046, 0x5962100c, 0x90a32004, 0x90531000, - 0x90a83000, 0x00005160, 0x92515000, 0x594d0d82, - 0x8cad6001, 0x595ac109, 0x92499000, 0x58a10095, - 0x92a83000, 0x00005160, 0x5a00308b, 0x92a35000, - 0x11ffffc4, 0x59b4ce08, 0x9285b400, 0x40000840, - 0x90a03000, 0x000051b0, 0x90a83000, 0x000051b4, - 0x59e0de0e, 0x58a70394, 0x92a03000, 0x50000c4c, - 0x92adb400, 0x400000c0, 0x80a03000, 0x10000008, - 0x5a022094, 0x8cb03000, 0x10000008, 0x8ca800ff, - 0x12000012, 0x80a59000, 0x58a54094, 0x3da21ff8, - 0x3a02201e, 0x59a4ce08, 0x8cad3400, 0x700000c0, - 0x5a420b81, 0x90a55000, 0x15fffff8, 0x90e7e050, - 0x59c3581f, 0x59a6010f, 0x8ca80000, 0x59b50c02, - 0x59a4ce08, 0x5a05a015, 0x8ca53400, 0x400000c0, - 0x5894839c, 0x92951000, 0x13000016, 0x59a85015, - 0x5a05a015, 0x92f51000, 0x14fffff4, 0x599cce08, - 0x59a3ce1a, 0x92a4f400, 0x400000c0, 0xb0c7e070, - 0x90e7e080, 0x0a000000, 0x3c4c6066, 0x5962100c, - 0x90ab2004, 0x59b1c108, 0x90531000, 0x594d4d82, - 0x5a05a089, 0x8c8a5000, 0x1600000a, 0x5c881616, - 0x92515000, 0x90b03000, 0x00005160, 0x59444008, - 0x5a027088, 0x8c529d11, 0x594a4111, 0x92899000, - 0x595ac111, 0x8cb5a001, 0x58a90096, 0x92b03000, - 0x00005160, 0x92ab5000, 0x16ffffa4, 0x90b83000, - 0x000051b0, 0x59b4ce08, 0x9285b400, 0x40000840, - 0x90a83000, 0x000051b4, 0x586dc98f, 0x92683000, - 0x50000c4c, 0x92adb400, 0x400000c0, 0x80a83000, - 0x10000008, 0x5a027015, 0x8cb83000, 0x10000008, - 0x8cb000ff, 0x11000012, 0x80add000, 0x58ad8095, - 0x334d7ff8, 0x59b4ce08, 0x8cb80000, 0x8cadbc17, - 0x700000c0, 0xb0255000, 0xb0255000, 0x98855000, - 0x8ca83000, 0xb0000000, 0x8cb5bc17, 0x400000c0, - 0x5a003094, 0x92ad9000, 0x5942090a, 0x8c7bf400, - 0xffffffd4, 0x15000126, 0x3d02e00e, 0x59c3581f, - 0x367e026a, 0x3b02e076, 0x3d026016, 0x5962100c, - 0x90a32004, 0x90531000, 0x594d0d82, 0x59e7de02, - 0x59a70108, 0x5a052089, 0x8c8a5000, 0x1600000a, - 0x5c881614, 0x92503000, 0x20000030, 0x90a03000, - 0x00005160, 0x8ca800ff, 0x594a4111, 0x92883000, - 0x20000060, 0x59444008, 0x8c529d11, 0x595ac111, - 0x8ca52001, 0x58ad4094, 0x92a03000, 0x00005160, - 0x92a83000, 0x20000004, 0x3b522092, 0x59ecce08, - 0x8c203000, 0x10000008, 0x8c9000ff, 0x8c383000, - 0x00003fff, 0x8c303000, 0x50000c4c, 0x8c2f7400, - 0x700000c0, 0x80a11000, 0x58a48094, 0x3355205a, - 0x5ca01e00, 0x59850005, 0x8c8f7c14, 0x400000c0, - 0x8ca36400, 0x5869c094, 0x92699000, 0xb0a41000, - 0xb0a41000, 0x98a41000, 0x90a41000, 0x8cb03000, - 0xb0000000, 0x92b45000, 0x80a11000, 0x58a48094, - 0x5a02b014, 0x5942090b, 0x8c7bf400, 0xffffffd4, - 0x11ffffc0, 0x3c523fa0, 0x3d02fefe, 0x59c3581f, - 0x317e1ef6, 0x08000154, 0x3d02e00e, 0x59e3581f, - 0x367f0132, 0x3b02e076, 0x3d026016, 0x5962100c, - 0x90a32004, 0x90531000, 0x594d0d82, 0x59c7de02, - 0x59a60108, 0x5a052089, 0x8c8a5000, 0x1600000a, - 0x5c881614, 0x92503000, 0x20000030, 0x90a03000, - 0x00005160, 0x8ca800ff, 0x594a4111, 0x92883000, - 0x20000060, 0x59444008, 0x8c529d11, 0x595ac111, - 0x8ca52001, 0x58ad4094, 0x92a03000, 0x00005160, - 0x92a83000, 0x20000004, 0x3b5220ae, 0x593e4e08, - 0x8c703000, 0x10000008, 0x8c3000ff, 0x8ce9f400, - 0x700000c0, 0x80a39000, 0x58a18094, 0x33552086, - 0x5ca01e00, 0x5925001d, 0x8c29fc14, 0x400000c0, - 0x59185003, 0x3d1e801e, 0x5c80161b, 0x8c8e5000, - 0x92efe060, 0x0bffee74, 0x5c181e00, 0x90efe060, - 0x8ce03000, 0x00003fff, 0x8ca36400, 0x586f0094, - 0x92683000, 0x50000c4c, 0xb0a11000, 0xb0a11000, - 0x98a11000, 0x90a11000, 0x8cb03000, 0xb0000000, - 0x92b15000, 0x80a39000, 0x58a18094, 0x5a02b014, - 0x5942090b, 0x8c7bf400, 0xffffffd4, 0x11ffff94, - 0x3c523f74, 0x3d02fee2, 0x59c3581f, 0x317e1ed8, - 0x59185003, 0x3d1e8016, 0x5c80161b, 0x8c8e5000, - 0x0bffedf8, 0x5c181e00, 0x8ce03000, 0x00003fff, - 0x8ca36400, 0x58a70094, 0x58a5098e, 0x92a03000, - 0x50000c4c, 0x80a03000, 0x10000008, 0x5a022094, - 0x8cb03000, 0x10000008, 0x8ca800ff, 0x13000012, - 0x80a59000, 0x58a54094, 0x3ca21ff8, 0x80a03000, - 0x10000008, 0x5a003094, 0x8cb83000, 0x10000008, - 0x8cb000ff, 0x12000022, 0x59a64e08, 0x8cad3400, - 0x700000c0, 0x90a55000, 0x80a5d000, 0x58a58094, - 0x3d053ff4, 0x59c3581f, 0x90e7e050, 0x59a6010f, - 0x90c7e040, 0x59b50c02, 0x59b81901, 0x59b58901, - 0x59a64e08, 0x5a05e096, 0x8ca53400, 0x400000c0, - 0x58ae039c, 0x92ad1000, 0x12000016, 0x59b58901, - 0x5a05e096, 0x92f51000, 0x15fffff4, 0x59ae4e08, - 0x5a00309a, 0x59a3ce1a, 0x92a57400, 0x400000c0, - 0x1200001a, 0x59185003, 0x3d1e8012, 0x5c80161b, - 0x8c8e5000, 0x0bffed04, 0xb0c7e070, 0x90e7e080, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x90a03000, 0x000051bc, 0x598c1010, 0x5990de0e, - 0x59ad0011, 0x5a04a095, 0x90203000, 0x000051b8, - 0x16000012, 0x5c801e00, 0x0a000000, 0x00000000, - 0x59a10011, 0x8c811000, 0x92a03000, 0x000051b8, - 0x92a83000, 0x000051bc, 0x09002208, 0x5983d004, - 0x5883d210, 0x0a000000, 0x00000000, 0x00000000, - 0x5c901e00, 0x8c880000, 0x58981987, 0x8c803000, - 0x88000400, 0x8cb83000, 0x000051c0, 0x80a5d000, - 0x3a052022, 0x90a41000, 0x80ade003, 0x80b5e004, - 0x59a50c08, 0x58a54094, 0x3aa5800a, 0x59905012, - 0x8c8c6001, 0x5a04e091, 0x8c842004, 0x59ba1017, - 0x16ffffcc, 0x3a04a00e, 0x5c801e00, 0x0a000000, - 0x8c500000, 0x5c201e00, 0x09000178, 0x5c481e00, - 0x8c280000, 0x5c301e00, 0x8c400000, 0x8ca03000, - 0x000055f0, 0x92f03000, 0x000055f8, 0x5c381e00, - 0x9a451000, 0x5c801e01, 0xb2203000, 0x000055e0, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x00009f90, 0x5c98161e, 0x8cf00000, - 0x58b81987, 0x3685c00e, 0x5c801e00, 0x8404d000, - 0x8ca83990, 0x000051c0, 0x80a55000, 0x3d05200e, - 0x5c801e00, 0x8404d000, 0x80a56002, 0x8cb03910, - 0x88000400, 0x588d0091, 0x5a003092, 0x59a44e08, - 0x92a59000, 0x12000026, 0x90a59000, 0x80ad6001, - 0x59a50c08, 0x58a54094, 0x3aa44012, 0x5c801e00, - 0x8404d000, 0x00000000, 0x5c801e01, 0x8404d000, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x00009ff8, 0x5c90161e, 0x8cf00000, - 0x58b01987, 0x3685800e, 0x5c801e00, 0x84049000, - 0x8ca83990, 0x000051c0, 0x80a55000, 0x3d05200e, - 0x5c801e00, 0x84049000, 0x90a03910, 0x88000400, - 0x80ad6001, 0x59a50c08, 0x58a54094, 0x8c800001, - 0x82a45000, 0x84049000, 0x0a000000, 0x00000000, - 0x5ca01e00, 0x8cb00000, 0x5cb81e00, 0x8ca80000, - 0x5c881e00, 0x8c900000, 0xb2a03000, 0x000055e0, - 0x5c801e00, 0x8ca03000, 0x000055f0, 0x92f03000, - 0x000055f8, 0x9a851000, 0x0a000000, 0x00000000, - 0x59084810, 0x80a03000, 0x00005380, 0x5c901e01, - 0x5a003094, 0x8297e040, 0x1200001e, 0x80a03000, - 0x00005382, 0x58a05094, 0x59a50e08, 0x92a03000, - 0x880004e0, 0x8c8003e8, 0x0b0004f0, 0x80a03000, - 0x00005250, 0x5a003094, 0x8c8fe040, 0x12000022, - 0x90a03000, 0x88000448, 0x80a83000, 0x00005251, - 0x59a50c08, 0x58a54094, 0x82a45000, 0x80a03000, - 0x00005258, 0x3a052022, 0x90a03000, 0x8800044c, - 0x80a83000, 0x00005259, 0x59a50c08, 0x58a54094, - 0x82a7e041, 0x80a7e041, 0x80a83000, 0x00005290, - 0x80b7e040, 0x90b83000, 0x000055e0, 0x5a003095, - 0x59a50e08, 0x58a58394, 0x59a5c014, 0x92a03000, - 0x000055e0, 0x12000022, 0x90a03000, 0x88000468, - 0x80a83000, 0x00005291, 0x59a50c08, 0x58a54094, - 0x82a45000, 0x80a03000, 0x00005298, 0x3a052022, - 0x90a03000, 0x8800046c, 0x80a83000, 0x00005299, - 0x59a50c08, 0x58a54094, 0x82a7e042, 0x80a03000, - 0x000052a0, 0x3a052022, 0x90a03000, 0x88000470, - 0x80a83000, 0x000052a1, 0x59a50c08, 0x58a54094, - 0x82a7e041, 0x80a7e041, 0x80afe042, 0x80b03000, - 0x000052a8, 0x80bfe040, 0x90803000, 0x000055e8, - 0x59a50e10, 0x5a003096, 0x59ad4e08, 0x58a54394, - 0x58a5c394, 0x59a40014, 0x92a03000, 0x000055e8, - 0x12000022, 0x90a03000, 0x88000474, 0x80a83000, - 0x000052a9, 0x59a50c08, 0x58a54094, 0x82a45000, - 0x80a03000, 0x000052b0, 0x3a052022, 0x90a03000, - 0x88000478, 0x80a83000, 0x000052b1, 0x59a50c08, - 0x58a54094, 0x82a7e042, 0x80a03000, 0x000052b8, - 0x3a052022, 0x90a03000, 0x8800047c, 0x80a83000, - 0x000052b9, 0x59a50c08, 0x58a54094, 0x82a7e041, - 0x80a7e041, 0x80afe042, 0x80b03000, 0x00005380, - 0x80bfe040, 0x90803000, 0x000055ec, 0x59a50e10, - 0x5a003096, 0x59ad4e08, 0x58a54394, 0x58a5c394, - 0x59a40014, 0x92a03000, 0x000055ec, 0x12000022, - 0x90a03000, 0x880004e0, 0x80a83000, 0x00005381, - 0x59a50c08, 0x58a54094, 0x82a45000, 0x80a03000, - 0x00005388, 0x3a052022, 0x90a03000, 0x880004e4, - 0x80a83000, 0x00005389, 0x59a50c08, 0x58a54094, - 0x82a7e041, 0x80a7e041, 0x80a83000, 0x00005390, - 0x80b7e040, 0x90b83000, 0x000055e4, 0x5a003095, - 0x59a50e08, 0x58a58394, 0x59a5c014, 0x92a03000, - 0x000055e4, 0x12000022, 0x90a03000, 0x880004e8, - 0x80a83000, 0x00005391, 0x59a50c08, 0x58a54094, - 0x82a45000, 0x80a03000, 0x00005398, 0x3a052022, - 0x90a03000, 0x880004ec, 0x80a83000, 0x00005399, - 0x59a50c08, 0x58a54094, 0x82a7e041, 0x80a7e041, - 0x80a83000, 0x00005468, 0x80bc5000, 0x90b03000, - 0x000055f0, 0x5a003095, 0x59a50e08, 0x58a5c394, - 0x59a58014, 0x92a03000, 0x000055f0, 0x1200001e, - 0x80a03000, 0x0000546a, 0x58a50097, 0x59a50e08, - 0x92a03000, 0x88000554, 0x8c8003e8, 0x0b0001fc, - 0x80a03000, 0x00005460, 0x3a052022, 0x90a03000, - 0x88000550, 0x80a83000, 0x00005461, 0x59a50c08, - 0x58a54094, 0x82a7e041, 0x80a7e041, 0x80a83000, - 0x00005468, 0x90b03000, 0x000055f4, 0x5a003095, - 0x59a58014, 0x92a03000, 0x000055f4, 0x12000022, - 0x90a03000, 0x88000554, 0x80a83000, 0x00005469, - 0x59a50c08, 0x58a54094, 0x82a7e041, 0x80a7e041, - 0x90a83000, 0x000055f8, 0x59a54014, 0x92a03000, - 0x000055f8, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x0000a4e4, 0x5c98161e, 0x8cf00000, - 0x59084810, 0x90a41000, 0x90ac1000, 0x8c903000, - 0x0000ff00, 0x90b41000, 0x58a48094, 0x59850c08, - 0x58901987, 0x5a04a010, 0x59bd4c10, 0x59b58c18, - 0x1100008e, 0x8ca83990, 0x000051c0, 0x80a55000, - 0x3a05207e, 0x90a03910, 0x88000400, 0x80ad6001, - 0x59a50c08, 0x58a54094, 0x58901987, 0x5a04a010, - 0x58a50116, 0x58ad8097, 0x58a54394, 0x8ca800ff, - 0x588d4094, 0x82a07400, 0xfffffff0, 0x11000042, - 0x8cb83990, 0x000051c0, 0x80a5d000, 0x3a052032, - 0x80ade002, 0x8cb03910, 0x88000400, 0x58ad4091, - 0x59a54e08, 0x92a59000, 0x90a59000, 0x80b5e001, - 0x59a50c08, 0x58a58094, 0x3aa54012, 0x5c801e00, - 0x59084910, 0x8404d000, 0x5c801e01, 0x59084910, - 0x8404d000, 0x0a000000, 0x00000000, 0x00000000, - 0x5c801e00, 0x58981987, 0x59901901, 0x8c8800ff, - 0x8ca83000, 0x0000e4b0, 0x8cb83000, 0x88000400, - 0x8cb03000, 0x000051c0, 0x80a59000, 0x3d05200e, - 0x92955000, 0x08000014, 0x90a5d000, 0x59a50c08, - 0x58a44094, 0x92a55000, 0x59805010, 0x5a04e090, - 0x8cad6004, 0x59b91017, 0x8cb5a008, 0x16ffffcc, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf03000, 0x0000a590, 0x5c88161e, 0x8cf00000, - 0x5a003090, 0x59840901, 0x14000016, 0x5ca01610, - 0x5a003094, 0x59840901, 0x13fffff4, 0x84045000, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x90acd000, 0x59a44e04, 0x8c883911, 0x00000000, - 0x59ed0111, 0x8c40007f, 0x5a02201d, 0x92a83000, - 0x50001440, 0x160000c6, 0x59a40e08, 0x8c303000, - 0x20000054, 0x8c283000, 0x20000060, 0x58201987, - 0x8c8d3400, 0x60000470, 0x92919000, 0x92215000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0xb0a45000, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0x8c94a200, 0x8c40007f, 0x8cef7400, - 0xffffff80, 0x5a02201d, 0xb0a45000, 0xb0a45000, - 0xb0a45000, 0x11ffff64, 0x8c40003f, 0x36ea006e, - 0x92903000, 0x20000054, 0x58a81986, 0x92a83000, - 0x20000060, 0x59a40e08, 0x8ca53400, 0x60000470, - 0xb0251000, 0xb0251000, 0xb0251000, 0xb0251000, - 0xb0251000, 0xb0251000, 0xb0251000, 0xb0251000, - 0xb0251000, 0xb0251000, 0xb0251000, 0xb0251000, - 0xb0251000, 0x8c94a100, 0x59ef4115, 0xb0251000, - 0xb0251000, 0xb0a51000, 0x33ff604e, 0x92903000, - 0x20000054, 0x59a8581f, 0x92a83000, 0x20000060, - 0x59a40e08, 0x8ca53400, 0x60000470, 0xb0251000, - 0xb0251000, 0xb0251000, 0xb0251000, 0xb0251000, - 0x8c94a080, 0x59ef4115, 0xb0251000, 0xb0251000, - 0xb0a51000, 0x33bf603a, 0x92903000, 0x20000050, - 0x59a40e08, 0x8ca53400, 0x60000470, 0xb0251000, - 0xb0251000, 0xb0251000, 0x8c94a060, 0x59ef4918, - 0xb0251000, 0xb0251000, 0xb0a51000, 0x335f602e, - 0x59a40e08, 0x92903000, 0x20000048, 0x8ca53400, - 0x60000470, 0x8c94a030, 0x59ef490c, 0xb0251000, - 0xb0251000, 0xb0a51000, 0x331f6032, 0x59a40e08, - 0x8c203000, 0x20000040, 0x8c8d3400, 0x60000470, - 0x59ef4904, 0x92911000, 0x5a00f01d, 0x8c94a010, - 0xb0a45000, 0x11ffffec, 0x3a076032, 0x59840e08, - 0x8ca83000, 0x20000038, 0x8c843400, 0x6000047c, - 0x59ef4901, 0x92955000, 0x5a00309d, 0x8c94a004, - 0x90a41000, 0x15ffffec, 0x90a03000, 0x50001440, - 0x5c801612, 0x92a4d000, 0x0a000000, 0x00000000, - 0x8cf03000, 0x0000a85c, 0x5c90161e, 0x8cf00000, - 0x598c4e08, 0x8c8c7400, 0x40000440, 0xb0a45000, - 0xb2a41000, 0xb0a45000, 0x59841010, 0xb2a41000, - 0xb0a45000, 0xb2a42010, 0x84049000, 0x0a000000, - 0x8cf03000, 0x0000a894, 0x5c90161e, 0x8cf00000, - 0x3a046022, 0x59840e08, 0x8c843400, 0x40000440, - 0x598c4904, 0x5a003091, 0xb0a41000, 0x15fffff4, - 0x84049000, 0x0a000000, 0x00000000, 0x00000000, - 0x09bc0008, 0x033e04dd, 0x01f2026e, 0x0163019e, - 0x01140137, 0x00e200f8, 0x00bf00cf, 0x00a500b1, - 0x0092009b, 0x00820089, 0x0076007c, 0x006b0070, - 0x00630067, 0x005b005f, 0x00550058, 0x004f0052, - 0x004b004d, 0x00460048, 0x00420044, 0x003f0041, - 0x003c003d, 0x0039003a, 0x00360038, 0x00340035, - 0x00320033, 0x00300031, 0x002e002f, 0x002c002d, - 0x002b002c, 0x0029002a, 0x00280029, 0x00270027, - 0x00250026, 0x00240025, 0x00230024, 0x00220023, - 0x00210022, 0x00200021, 0x001f0020, 0x001f001f, - 0x001e001e, 0x001d001d, 0x001c001d, 0x001c001c, - 0x001b001b, 0x001a001b, 0x001a001a, 0x0019001a, - 0x00190019, 0x00180018, 0x00180018, 0x00170017, - 0x00170017, 0x00160017, 0x00160016, 0x00150016, - 0x00150015, 0x00150015, 0x00140014, 0x00140014, - 0x00140014, 0x00130013, 0x00130013, 0x00130013, - 0x00120012, 0x00120012, 0x00120012, 0x00110012, - 0x00110011, 0x00110011, 0x00110011, 0x00100011, - 0x00100010, 0x00100010, 0x00100010, 0x00100010, - 0x000f000f, 0x000f000f, 0x000f000f, 0x000f000f, - 0x000e000f, 0x000e000e, 0x000e000e, 0x000e000e, - 0x000e000e, 0x000e000e, 0x000d000d, 0x000d000d, - 0x000d000d, 0x000d000d, 0x000d000d, 0x000d000d, - 0x000c000d, 0x000c000c, 0x000c000c, 0x000c000c, - 0x000c000c, 0x000c000c, 0x000c000c, 0x000c000c, - 0x000b000b, 0x000b000b, 0x000b000b, 0x000b000b, - 0x000b000b, 0x000b000b, 0x000b000b, 0x000b000b, - 0x000a000b, 0x000a000a, 0x000a000a, 0x000a000a, - 0x000a000a, 0x000a000a, 0x000a000a, 0x000a000a, - 0x000a000a, 0x000a000a, 0x000a000a, 0x00090009, - 0x00090009, 0x00090009, 0x00090009, 0x00090009, - 0x00090009, 0x00090009, 0x00090009, 0x00080009, - 0x8c203000, 0x0000b200, 0x8c283000, 0x50000c20, - 0x5c301e00, 0x5c381e00, 0xb2200050, 0x8c283000, - 0x50000c24, 0xb2200090, 0x8c283000, 0x50000c28, - 0xb22000d0, 0x8c283000, 0x50000c2c, 0xb2200110, - 0x5c201e00, 0x5c281e00, 0x8c400050, 0x8c480090, - 0x8c5000d0, 0x8c580110, 0xb2222010, 0xb2226010, - 0xb222a010, 0xb222e010, 0x8c203000, 0x40000840, - 0x8c283000, 0x70000040, 0xb2222020, 0x8c203000, - 0x40000940, 0x8c283000, 0x70000140, 0xb2226020, - 0x8c203000, 0x40000a40, 0x8c283000, 0x70000240, - 0xb222a020, 0x8c203000, 0x40000b40, 0x8c283000, - 0x70000340, 0xb222e020, 0x5c281e00, 0x8c203000, - 0x50001000, 0xb2222030, 0x8c203000, 0x50001004, - 0xb2226030, 0x8c203000, 0x50001008, 0xb222a030, - 0x8c203000, 0x5000100c, 0xb222e030, 0x8c400150, - 0x8c203000, 0x0000aeb0, 0x8c2a2008, 0x9a222000, - 0x5c381605, 0x8c203000, 0x00000350, 0x90312010, - 0x3201a012, 0x5929c808, 0x9a21d000, 0x5939c808, - 0x8c203000, 0x00000380, 0x90312010, 0x3201a012, - 0x5929c808, 0x9a21d000, 0x5939c808, 0x8c203000, - 0x000003b0, 0x90312010, 0x3201a012, 0x5929c808, - 0x9a21d000, 0x5939c808, 0x8c203000, 0x0000e420, - 0x90312010, 0x3201a00e, 0x9221d000, 0x5939c808, - 0x5939c904, 0x8c2a2008, 0x9229d000, 0x5c201e00, - 0x5c281e00, 0x5c301e00, 0x5c381e00, 0xb2222030, - 0x8c4001d0, 0x8c203000, 0x0000b010, 0x90283000, - 0x00000320, 0x90303000, 0x00000324, 0xb2222000, - 0x5c201e00, 0x5c301e00, 0xb2222010, 0xb2222020, - 0x8c400210, 0x8c203000, 0x0000b7e0, 0xb2222000, - 0x8c200000, 0x9222203c, 0x8c400190, 0x8c203000, - 0x0000b900, 0xb2222000, 0x8c400250, 0x8c200050, - 0x92221000, 0x59420804, 0x92221000, 0x59420804, - 0x92221000, 0x59420804, 0x92221000, 0x59420804, - 0x8c200150, 0x92221000, 0x59420804, 0x8c2001d0, - 0x92221000, 0x59420804, 0x8c200210, 0x92221000, - 0x59420804, 0x8c200190, 0x92221000, 0x8c203000, - 0x0fffc000, 0x92203000, 0x000002f0, 0x8c203000, - 0x00003ff0, 0x92203000, 0x000002f4, 0x8c200000, - 0x92203000, 0x000002f8, 0x8c200006, 0x92203000, - 0x000002fc, 0x8c280200, 0x8c300020, 0x8c383000, - 0x0002ed50, 0x92380284, 0x5c201607, 0x59394004, - 0x923921f0, 0x59b58901, 0x3505bff0, 0x5c381e00, - 0x923921f0, 0x8c403000, 0x000002c0, 0x8c38000c, - 0x92403000, 0x0000032c, 0x8c300090, 0x92322008, - 0x592a0007, 0x922a1000, 0x5c401605, 0x8c3000d0, - 0x92322008, 0x592a0007, 0x922a1000, 0x5c401605, - 0x8c300110, 0x92322008, 0x92f22000, 0x92f03000, - 0x00000328, 0x0a000000, 0x00000000, 0x00000000, - 0x90203000, 0x00000328, 0x8c283000, 0x00000328, - 0x3201205e, 0x90312004, 0x32818010, 0x5c281604, - 0x90211000, 0x08ffffec, 0x90311000, 0x90383000, - 0x0000032c, 0x92315000, 0x92391000, 0x92203000, - 0x0000032c, 0x8c180250, 0x90292008, 0x8c3000d0, - 0x5918c804, 0x34298010, 0x5918c804, 0x32298008, - 0x5918c804, 0x8c300050, 0x9230d000, 0x0a000000, - 0x8c180250, 0x8c283000, 0x40000440, 0x8c303000, - 0x40000880, 0x8c383000, 0x50001440, 0x8c403000, - 0x60000440, 0x8c480fff, 0x90503000, 0x00005660, - 0x8c583000, 0x10000008, 0x8c603000, 0x50000c40, - 0x8c683000, 0x30000000, 0x8c703000, 0x30000060, - 0x8c780000, 0x5cf01e00, 0x90883000, 0x0000e470, - 0x8c803000, 0x000fffff, 0x92845000, 0x90845000, - 0x58840090, 0x59840901, 0x92845000, 0x35043ff2, - 0x9082d000, 0x3204200c, 0x90835000, 0x08fffff4, - 0x9020d000, 0xb0a11000, 0x84051000, 0x00000000, - 0x3203e02c, 0x8c780000, 0x90883000, 0x0000e478, - 0x8c780000, 0x90945000, 0x58801988, 0x8c94a001, - 0x92945000, 0x92803000, 0x20000004, 0x98c55000, - 0x5918c804, 0x9096201c, 0x92c92004, 0x90849000, - 0x35042040, 0x32ae5fae, 0x98c65000, 0x9096201c, - 0x90849000, 0x3504202c, 0x32ae5f9a, 0x98c65000, - 0x9096201c, 0x90849000, 0x35042018, 0x32ae5f86, - 0x98c65000, 0x9096201c, 0x90849000, 0x32043f74, - 0x98e61000, 0x31e75f6e, 0x8cd00000, 0x90de200c, - 0x8cc80078, 0x59e7411c, 0x31df1f5a, 0x8ce8389b, - 0x00000000, 0x92803000, 0x20000030, 0x59d6801d, - 0x92e83000, 0x20000060, 0x59ce411d, 0x90a4a004, - 0x5ca81e02, 0x98b62020, 0x92f49000, 0x59948808, - 0x92a03000, 0x20000038, 0x3695c008, 0x5c901616, - 0x90849000, 0x92ab9000, 0x59e7011b, 0x3204200c, - 0x31df000a, 0x36ee5fb0, 0x9296201c, 0x90de1000, - 0x90ce2018, 0x598e8c01, 0x8ce65d9b, 0x598c401b, - 0x928e1000, 0x8082d000, 0x31443ffe, 0x59d68908, - 0xb0835000, 0x5a06a800, 0xb0a35000, 0x59ef0808, - 0x9a871000, 0x59e74808, 0x9a975000, 0x59ef0808, - 0x9aa71000, 0x59e74808, 0x9ab75000, 0x15ffffc8, - 0x08fffea0, 0x00000000, 0x00000000, 0x00000000, - 0x98d55000, 0x90c80284, 0x5918c804, 0x8cc00078, - 0x3206be80, 0x32067e7e, 0x5cb81e00, 0x589bd09a, - 0x5897d21a, 0x59d4ce03, 0x31d60046, 0x59bdc01a, - 0x92f55000, 0x92903000, 0x20000030, 0x92d03000, - 0x20000060, 0x59aa1015, 0x92de61f4, 0x59c6011a, - 0x92d65000, 0x36ad8008, 0x90a92014, 0x98d55000, - 0x90ce61f0, 0x3206a008, 0x35067fb4, 0x8ca03000, - 0x0000b010, 0xb2a11000, 0x90a00284, 0x90b51000, - 0x8082d000, 0x34859ffa, 0x59bdc116, 0x8ce51000, - 0xb0835000, 0x59ef0810, 0xb0c35000, 0x59b58908, - 0xb2871000, 0x59e74810, 0xb2c75000, 0x3505bfe6, - 0x888d200a, 0x8c9000ff, 0x80852007, 0x588c8091, - 0x598c4e01, 0x90d521f0, 0x8c8c7400, 0x0000a8a0, - 0x5884088f, 0x888c5000, 0x92f521f0, 0x8a8d200a, - 0x352c20ee, 0x8c900050, 0x3244607c, 0x90b03000, - 0x00000328, 0x90ad1000, 0x909da004, 0x3205a012, - 0x32acc060, 0x90b59000, 0x08fffff0, 0x90b03000, - 0x0000032c, 0x3205a052, 0x92ada004, 0x90859000, - 0x90883000, 0x00000328, 0x92803000, 0x0000032c, - 0x928d9000, 0x92b03000, 0x00000328, 0x8c900250, - 0x908da008, 0x8c8000d0, 0x59948804, 0x348c0010, - 0x59948804, 0x328c0008, 0x59948804, 0x928c9000, - 0x9095a008, 0x90c03000, 0x00005670, 0x9084a018, - 0x59c60801, 0x92c03000, 0x00005670, 0x3504202c, - 0x8c803000, 0x0000bfc8, 0x92a4a018, 0x8c880050, - 0x9284a000, 0x358c802a, 0x8c803000, 0x0000bfc0, - 0x9284a000, 0x08000018, 0x908c21f0, 0x3204600c, - 0x5c801611, 0x08fffff4, 0x92a421f0, 0x5ca0161a, - 0x3505febc, 0x92a00284, 0x08fffcc8, 0x8c900210, - 0x9084a03c, 0x35043fd6, 0x8c983000, 0x0000b7f0, - 0x92a4a03c, 0x929ca000, 0x08ffffd4, 0x00000000, - 0x90883000, 0x1000000c, 0x8c900030, 0x348c85d6, - 0x98c19000, 0xb0a03000, 0x000002f0, 0x58ce4089, - 0x320665c2, 0x58850098, 0x58958098, 0x350424ee, - 0x588d4098, 0x59948417, 0x588c8391, 0x8cd83991, - 0x0000ed50, 0x9896e010, 0x371e252a, 0x84049000, - 0xb0803000, 0x00000300, 0x8c841d11, 0x90941000, - 0x3504a01c, 0x90803000, 0x000056a0, 0x59840801, - 0x92803000, 0x000056a0, 0x08000428, 0x90e6e03c, - 0x598c4801, 0x92c49000, 0x588cc091, 0x92f41000, - 0x8c9ca008, 0x90871000, 0x92883000, 0x00000304, - 0x9296e018, 0x929ee01c, 0x35042028, 0x5c80161c, - 0x090006a0, 0x90871000, 0x35042018, 0x90872028, - 0x908c1000, 0x598c4801, 0x928c1000, 0x080003b4, - 0x908f2018, 0x59840901, 0x8c8c5d90, 0x909ee01c, - 0x90945000, 0x90b46004, 0x90bee034, 0x92871000, - 0x9294d000, 0x599cc808, 0x929ee01c, 0x59a5cc02, - 0x8c903000, 0x0000ba70, 0x5c981619, 0x8cb83000, - 0xffffffff, 0x59864e04, 0x9a96e010, 0x598e4e02, - 0x08000768, 0x00000000, 0x00000000, 0x00000000, - 0x9081d000, 0x8c883000, 0xc704dd7b, 0x358c0196, - 0x90803000, 0x00005664, 0x90a6e014, 0x8c983000, - 0x0000ffff, 0x90883000, 0x00005674, 0x59840014, - 0x8c8c6001, 0x92803000, 0x00005664, 0x92883000, - 0x00005674, 0x5894c092, 0x9886e018, 0xa0a6e030, - 0x598c4110, 0x598c4908, 0x598c4c03, 0x928c2004, - 0x59a4080c, 0x8c9c5000, 0x36954028, 0x92ad1000, - 0x59948115, 0x8ca52008, 0x36958018, 0x92b51000, - 0x59948116, 0x8ca52008, 0x599cc901, 0x08ffffec, - 0x92951000, 0x320ce014, 0x8ca52008, 0x92f51000, - 0x08000008, 0x00000000, 0x90983000, 0x00000310, - 0x598c4802, 0x9094d000, 0x3504a024, 0x90a03000, - 0x0000e478, 0x8ca80001, 0x58b01988, 0x92ad1000, - 0x92b03000, 0x20000004, 0x08ffffdc, 0x598c4c01, - 0xb0a03000, 0x00000300, 0x59ad8801, 0x92851d16, - 0x58b54097, 0x92b03000, 0x00000308, 0x5a8c4b01, - 0xb0a41000, 0x59840810, 0x92903000, 0x20000040, - 0x59948810, 0xb2a39000, 0x15ffffe4, 0x90883000, - 0x00000314, 0x9084e004, 0x92f4d000, 0x599cc808, - 0x5a04e011, 0x1300000c, 0x90983000, 0x00000318, - 0x5c881e02, 0x92803000, 0x20000038, 0x928b9000, - 0x92983000, 0x00000310, 0x8c7be001, 0x3123e028, - 0x8c780000, 0x90883000, 0x0000e478, 0x58801988, - 0x90945000, 0x8c94a001, 0x92803000, 0x20000004, - 0x92945000, 0x5a066800, 0x92f6e014, 0x8c803000, - 0x0000b250, 0x9286e010, 0x15fffd8a, 0x08fffd34, - 0x8c983000, 0x0000ffff, 0x5894c092, 0x908ee014, - 0x59948c02, 0x8c803a11, 0x00000000, 0x598c4e02, - 0x59840111, 0x3394000c, 0x5984090c, 0x3194001a, - 0x90803000, 0x0000566c, 0x59840801, 0x92803000, - 0x0000566c, 0x90883000, 0x00005678, 0x5ce81e00, - 0x598c4801, 0x92883000, 0x00005678, 0x08000004, - 0x90803000, 0x00005668, 0x90a6e014, 0x59840014, - 0x92803000, 0x00005668, 0x9886e018, 0x598c4110, - 0x598c4908, 0x598c4c03, 0x928c2004, 0x598c4804, - 0x90983000, 0x00000310, 0x598c4c01, 0xb0a03000, - 0x00000300, 0x59ad8801, 0x92851d16, 0x58b54097, - 0x92b03000, 0x00000308, 0x9094d000, 0x3504a024, - 0x90a03000, 0x0000e478, 0x8ca80001, 0x58b01988, - 0x92ad1000, 0x92b03000, 0x20000004, 0x08ffffdc, - 0x5a8c4b01, 0x92903000, 0x20000040, 0x59948810, - 0xb0a41000, 0x59840810, 0xb2a39000, 0x15ffffe4, - 0x90883000, 0x00000314, 0x9084e004, 0x92f4d000, - 0x599cc808, 0x5a04e011, 0x1300000c, 0x90983000, - 0x00000318, 0x5c881e0a, 0x92983000, 0x00000310, - 0x92803000, 0x20000038, 0x928b9000, 0x8c7be001, - 0x3123e028, 0x8c780000, 0x90883000, 0x0000e478, - 0x58801988, 0x90945000, 0x8c94a001, 0x92945000, - 0x92803000, 0x20000004, 0x92f6e014, 0x8c803000, - 0x0000b6c0, 0x300e200c, 0x8c803000, 0x0000b250, - 0x9286e010, 0x31276012, 0x59ef4904, 0xb0815000, - 0x36277ff8, 0x32076010, 0x90815000, 0x59ef4901, - 0x08fffff4, 0x32067b8c, 0x08fffbd8, 0x00000000, - 0xb0803000, 0x00000300, 0x908ee018, 0x928c1d12, - 0x59948801, 0x5894c092, 0x92903000, 0x00000308, - 0x8c803000, 0x0000b6c0, 0x92f6e014, 0x9286e010, - 0x08000010, 0x00000000, 0x00000000, 0x00000000, - 0x90803000, 0x00005668, 0x59840019, 0x92803000, - 0x00005668, 0x300e207c, 0x8c883000, 0x0000b250, - 0x90803000, 0x00005680, 0x928ee010, 0x8c842001, - 0x92803000, 0x00005680, 0x08000058, 0x00000000, - 0x90803000, 0x00005614, 0x59840019, 0x92803000, - 0x00005614, 0x0800003c, 0x8ca03000, 0x0ff00000, - 0x58a50098, 0x8c803000, 0x00005608, 0x58a58114, - 0x3505200c, 0x8c803000, 0x00005610, 0x908c1000, - 0x598c4019, 0x928c1000, 0x08000008, 0x00000000, - 0xb0815000, 0x5a066801, 0xb0815000, 0x59ce4901, - 0xb0815000, 0x14ffffec, 0x08fffa98, 0x00000000, - 0x08ffffe0, 0x00000000, 0x00000000, 0x00000000, - 0x5c80161b, 0x5c881618, 0x5c901619, 0xb2a00020, - 0xb2c00030, 0xb2e00040, 0x09ffd6f8, 0xb0e00040, - 0xb0c00030, 0xb0a00020, 0x08fffa58, 0x00000000, - 0x5c80161b, 0x5c881618, 0x5c901619, 0xb2a00020, - 0xb2c00030, 0xb2e00040, 0x09ffdca8, 0xb0e00040, - 0xb0c00030, 0xb0a00020, 0x08fffa28, 0x00000000, - 0x5918c804, 0x08fff6bc, 0x00000000, 0x00000000, - 0x90a03000, 0x50001000, 0xb2a00020, 0xb2c00030, - 0xb2e00040, 0x8c803000, 0x50000c20, 0x908c1000, - 0x35047ffe, 0x9081203c, 0x80bc2007, 0x58bdc88f, - 0x808c2006, 0x88942004, 0x5c981e00, 0x88c4200a, - 0x8ca00000, 0x5ca81e00, 0x92c03000, 0x50001000, - 0x8cb42010, 0x90842000, 0x3225e00c, 0x09ffd304, - 0x08000008, 0x09ffdecc, 0x8c803000, 0x50000c20, - 0x908c1000, 0x35047ffe, 0xb0e00040, 0xb0c00030, - 0xb0a00020, 0x92a03000, 0x50001000, 0x9099203c, - 0x908ce1f4, 0x5c901e02, 0x92883000, 0x20000038, - 0x92939000, 0x9084e004, 0x8c883000, 0xf0000000, - 0x58840091, 0x32042032, 0x8c7be001, 0x3123e028, - 0x8c780000, 0x90883000, 0x0000e478, 0x58801988, - 0x90945000, 0x8c94a001, 0x92945000, 0x92803000, - 0x20000004, 0x9094e1f0, 0x90880284, 0x5a04a800, - 0x928ce1f0, 0x92980284, 0x9291203c, 0x15fffef6, - 0x8c803000, 0x0000b7e0, 0x92812000, 0x08fffee4, - 0x90903000, 0x0000e470, 0x90803000, 0x0000e408, - 0x909c9000, 0x8c180250, 0x599cc801, 0x908c1000, - 0x929c9000, 0x3204757c, 0x92503000, 0x00005660, - 0xb2c00030, 0xb2e00040, 0x09ff9fb8, 0xb0e00040, - 0xb0c00030, 0x08fff55c, 0x00000000, 0x00000000, - 0x9024201c, 0x5c181610, 0x90811000, 0x320420cc, - 0x8c600078, 0x9830e000, 0x8c400000, 0x9028e00c, - 0x5931c106, 0x312980b6, 0x8c383885, 0x00000000, - 0x92803000, 0x20000030, 0x59420007, 0x92383000, - 0x20000060, 0x59630107, 0x90492004, 0x9850e020, - 0x92f11000, 0x59210808, 0x92483000, 0x20000038, - 0x3622c008, 0x5c20160a, 0x5c581e02, 0x90811000, - 0x92583000, 0x30000060, 0x59318105, 0x3431400e, - 0x3204200a, 0x363b1fac, 0x9220e01c, 0x9028d000, - 0x9030e018, 0x593a0c01, 0x8c319d85, 0x5939c005, - 0x9238d000, 0x8c203000, 0x10000008, 0x8c483000, - 0x30000000, 0x80811000, 0x31243ffe, 0x59420904, - 0xb0625000, 0x9a619000, 0x59318808, 0x9a719000, - 0x59318808, 0x35023fe0, 0x0a000000, 0x00000000, - 0x90183000, 0x0000e474, 0x90283000, 0x0000e478, - 0x8c300001, 0x58381988, 0x9020d000, 0x3001201a, - 0x92f03000, 0x20000004, 0x92315000, 0x92383000, - 0x20000004, 0x0a000000, 0x00000000, 0x00000000, - 0xb0a6d000, 0x599cc019, 0x8c883919, 0x00000000, - 0x929ee014, 0x59864e04, 0x92b9d000, 0x59e40111, - 0x370e2132, 0x5cc81e00, 0x8ce80000, 0x36e50010, - 0x59ef0114, 0x3205208e, 0x8ce51000, 0x8ca80030, - 0x59a5011c, 0x5cb81615, 0x33e54008, 0x5cb8161c, - 0x5995ce02, 0x92b03000, 0x20000054, 0x598d4117, - 0x92b83000, 0x20000060, 0x8c803000, 0x0000bae8, - 0x59b58012, 0x84041c11, 0xb0821000, 0xb0821000, - 0xb0821000, 0xb0821000, 0xb0821000, 0xb0821000, - 0xb0821000, 0xb0821000, 0xb0821000, 0xb0821000, - 0xb0821000, 0x59e70117, 0xb0821000, 0x34073f98, - 0x35076012, 0x90b9d000, 0xb2a6e000, 0x08fff6d4, - 0x9096e01c, 0x908ee018, 0x90803000, 0x0000e48c, - 0x59948111, 0x339419ec, 0x90e6e040, 0x908ee014, - 0x8c900555, 0x90871000, 0x318c99da, 0x35042028, - 0x5c80161c, 0x09fffdec, 0x90871000, 0x35042018, - 0x90872028, 0x908c1000, 0x598c4801, 0x928c1000, - 0x08fff9b0, 0x908f2018, 0x59840901, 0x8c8c5d90, - 0x909ee01c, 0x90945000, 0x90b46004, 0x90bee038, - 0x92871000, 0x9294d000, 0x599cc808, 0x929ee01c, - 0x59a5cc02, 0x8ce75000, 0x08fffee0, 0x00000000, - 0x59ce4901, 0x8ce80000, 0x36652108, 0x5cb81e0a, - 0x8ce80000, 0x36bd0010, 0x59edc114, 0x8cbd1000, - 0x32052052, 0x8c903897, 0x00000000, 0x92b03000, - 0x20000054, 0x59b48016, 0x92b83000, 0x20000060, - 0x3125e016, 0x5a05e808, 0xb0821000, 0x59bdc904, - 0x16fffff4, 0x310de01a, 0x90821000, 0x3115e012, - 0x90821000, 0x311de00a, 0x90821000, 0x32076090, - 0x9096e01c, 0x908ee018, 0x90803000, 0x0000e48c, - 0x59948111, 0x3494000c, 0x59ef4802, 0x08fff8e4, - 0x90e6e040, 0x90871000, 0x3504202c, 0x5c80161c, - 0x09fffcf0, 0x90871000, 0x3504201c, 0x90872028, - 0x908c1000, 0x598c4801, 0x928c1000, 0x59ef4802, - 0x08fff8b0, 0x908f2018, 0x59840901, 0x8c8c5d90, - 0x909ee01c, 0x90945000, 0x90b46004, 0x90bee038, - 0x92871000, 0x9294d000, 0x599cc808, 0x929ee01c, - 0x59a5cc02, 0x5cb8161d, 0x08ffff18, 0x98915000, - 0x08fff670, 0x00000000, 0x00000000, 0x00000000, - 0x92b03000, 0x20000048, 0xb0821000, 0xb0821000, - 0xb0821000, 0x08fff64c, 0x00000000, 0x00000000, - 0x90955000, 0x8c98004a, 0x8c800054, 0x3394d506, - 0xb0c12020, 0x8ce00000, 0x59a40112, 0x92d61000, - 0x8c883914, 0x00000000, 0x59850e04, 0x92db1000, - 0x8cd80078, 0x59ec0111, 0x8ca00000, 0x59ef411b, - 0x34bec030, 0x8c90391b, 0x00000000, 0x59e7001b, - 0x92b03000, 0x20000030, 0x59bdc11b, 0x92d83000, - 0x20000060, 0x59b58012, 0x90a2d000, 0x0800004c, - 0x3205e01e, 0x92b03000, 0x20000030, 0x59dec117, - 0x92b83000, 0x20000060, 0x59e70017, 0x98812010, - 0x5a840b80, 0x90a2d000, 0x1200006c, 0x98b45000, - 0x8c8c6008, 0x59bdc803, 0x9a812010, 0x59bdcc02, - 0x3506ff90, 0x90a2d000, 0x36652028, 0x90a2d000, - 0x8cd80078, 0x35073ff4, 0x36df5f74, 0x90db1000, - 0x9ab12008, 0x92d9202c, 0x08fff438, 0x00000000, - 0xb0865000, 0x59a5090c, 0x8c52a001, 0xb0865000, - 0x59e7090c, 0xb0865000, 0x36653fe8, 0x90a2d000, - 0x08ffffb8, 0x36652014, 0x90a2d000, 0x36673ff8, - 0x32a7002e, 0x08fffff0, 0xb0865000, 0x59e7090c, - 0xb0865000, 0x8c52a001, 0x59a5090c, 0xb0865000, - 0x36653fe8, 0x90a2d000, 0x08ffffcc, 0x58d68b82, - 0x33572030, 0xb0865000, 0x8ca03000, 0x4fffffff, - 0xb0865000, 0x58a50099, 0xa0865000, 0x92f51000, - 0x8c52a001, 0x5ca01e0a, 0x92d61000, 0x08000038, - 0x59a2911c, 0x92d61000, 0x3127201a, 0x59e70904, - 0xb0865000, 0x3127200e, 0x59e70904, 0xb0865000, - 0x3117200e, 0x59e70902, 0x98865000, 0x310f200a, - 0x90865000, 0x59a50e02, 0x8c903000, 0x4fffffff, - 0x598a9e02, 0x8c803000, 0x0000bec0, 0x598c4114, - 0x58a64092, 0x59844010, 0x90992018, 0x84041000, - 0x92f51000, 0x92f51000, 0x92f51000, 0x92f51000, - 0x92f51000, 0x92f51000, 0x92f51000, 0x92f51000, - 0x92f51000, 0x92f51000, 0x8884e004, 0x59528801, - 0x92851000, 0x90831000, 0x908ce1f4, 0x58801510, - 0x92883000, 0x20000038, 0x5c901e02, 0x92851000, - 0x92939000, 0x9084e004, 0x8c883000, 0xf0000000, - 0x58840091, 0x32042032, 0x8c7be001, 0x3123e028, - 0x8c780000, 0x90883000, 0x0000e478, 0x90945000, - 0x8c94a001, 0x58801988, 0x92945000, 0x92803000, - 0x20000004, 0x9094e1f0, 0x90880284, 0x5a04a800, - 0x92980284, 0x928ce1f0, 0x15000034, 0x90903000, - 0x0000e470, 0x8c803000, 0x0000c020, 0x909c9000, - 0x8c883000, 0x00200000, 0x92f12018, 0x598c4013, - 0x92812000, 0x92892008, 0x08fff268, 0x888ca00a, - 0x8884e00a, 0x32844034, 0x8c803000, 0x0000bfc0, - 0x92912018, 0x92812000, 0x08fff248, 0x00000000, - 0x90855000, 0x3504323c, 0x8c803000, 0x0000bcf0, - 0x90912018, 0x92812000, 0x90992030, 0x888ca00a, - 0x90e4a000, 0x59e81901, 0x928cd000, 0x8c880018, - 0x8084a006, 0x598c4012, 0x98b4a010, 0x59840901, - 0x8cbde003, 0x92912018, 0x59bdcc02, 0x9a812010, - 0x9ae12028, 0x9ab12008, 0x08fffcd8, 0x00000000, - 0x90903000, 0x0000e470, 0x909c9000, 0x359d91d4, - 0x90812028, 0x09ffed6c, 0x8c803000, 0x0000b200, - 0x92812000, 0x08fff1bc, 0x00000000, 0x00000000, - 0x5c901611, 0x8c880000, 0x08000308, 0x00000000, - 0x090016a0, 0x0900000c, 0x080011e8, 0x00000000, - 0x09000580, 0x0b000154, 0x09000378, 0x080003c4, - 0x0000c080, 0x00000000, 0x00000000, 0x00000000, - 0x0000d7f0, 0x0000d810, 0x0000d830, 0x0000d850, - 0x0000d870, 0x0000d890, 0x0000d8b0, 0x0000d8d0, - 0x0000d8f0, 0x0000d910, 0x0000d930, 0x0000d7f0, - 0x5a003091, 0x8c201400, 0x00000000, 0x8ca03000, - 0x0000c0cc, 0x59210114, 0x1200000a, 0x335c2026, - 0x85f13400, 0x0000d7d8, 0x5999981f, 0x8cecd000, - 0x92ec1000, 0x8c813400, 0x0000c260, 0x0a000000, - 0x8ca13400, 0x0000c2a0, 0x5a052091, 0x8c903910, - 0x0000e6c0, 0x90bc9000, 0x5c801610, 0x15000016, - 0x8c893400, 0x0000d7f0, 0x08000034, 0x00000000, - 0x8ca13400, 0x0000c280, 0x3d8d0026, 0x8ca13400, - 0x0000c080, 0x90a93d10, 0x0000c090, 0x90b51000, - 0x59ad0015, 0x59ad4116, 0x8c8d6000, 0x8ca13400, - 0x0000d7f0, 0x5a052097, 0x928c9000, 0x5c801610, - 0x15000012, 0x8cb93400, 0x0000c2a0, 0x08000030, - 0x8ca13400, 0x0000c080, 0x90a93d10, 0x0000c090, - 0x90b51000, 0x59ad0015, 0x59ad4116, 0x8cad6000, - 0x3dbd400e, 0x8cb93400, 0x0000c280, 0x5c801617, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x00000094, 0x5c98161e, 0x8cf00000, - 0x5c881e00, 0x8ca01400, 0x00000000, 0x8ca83000, - 0x0000c1dc, 0x59a50115, 0x8cbd3400, 0x0000c080, - 0x8c900000, 0x8cb03000, 0x0000e6c0, 0x8ca53400, - 0x0000c090, 0x9085d000, 0x90ad1000, 0x59adc015, - 0x59ad4110, 0x59ac8015, 0x92ad9000, 0x90ad2004, - 0x59adc015, 0x59ad4110, 0x59ac8015, 0x92ada004, - 0x90ad2008, 0x5988d011, 0x5a02f091, 0x59adc015, - 0x59ad4110, 0x59ac8015, 0x92ada008, 0x59b31016, - 0x8ca5200c, 0x16ffffb4, 0x8404d000, 0x0a000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x8cf00000, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x8cf00000, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x8cf00000, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x5c381610, 0x0b0014b4, 0x5c281610, 0x0b0014ec, - 0x59321005, 0x0800001c, 0x9221600c, 0x5c801606, - 0x0b0016f8, 0x90817d04, 0x00000010, 0x86041000, - 0x5c801606, 0x0b0016a4, 0x90a1600c, 0x59250901, - 0x3e013fd8, 0x59821005, 0x0b0016d0, 0x5c801605, - 0x0b001688, 0x90216004, 0x3a012022, 0x90a12020, - 0x5c801605, 0x92a16004, 0x0b0016b0, 0x5c801604, - 0x09000390, 0x08ffffd8, 0x5c801607, 0x0b00172c, - 0x5c801607, 0x0800118c, 0x00000000, 0x00000000, - 0x5c801e0a, 0x090002ec, 0x5c801e01, 0x08001174, - 0x8cf01400, 0x00000084, 0x5a04a807, 0x8cef9000, - 0x5899d210, 0x8cf00000, 0x59a44e18, 0x8cb41000, - 0x59ad0c08, 0x1300004e, 0x5a042013, 0x8c9ce007, - 0x58a54394, 0x1200001c, 0x5a04e016, 0x828d9000, - 0x59948901, 0x8cb5a001, 0x15fffff0, 0x333ca02a, - 0x59ad0c10, 0x58a54394, 0x5ca81614, 0x5a04a80f, - 0x9aa59000, 0x59948908, 0x8cb5a008, 0x14fffff0, - 0x3304a018, 0x5a04a801, 0x828d9000, 0x59948901, - 0x8cb5a001, 0x15fffff0, 0x84075000, 0x0a000000, - 0x8c800090, 0x0b001324, 0x5a003090, 0x8c241000, - 0x5c801610, 0x15000016, 0x0b0013d0, 0x90841000, - 0x0a000000, 0x00000000, 0x92f42004, 0x0b00155c, - 0x92f1200c, 0x59821004, 0x0b001550, 0x5c801e00, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5c281618, 0x8c086040, 0x92cfe070, 0x9ad7e078, - 0x5981de04, 0x0b0012e4, 0x5a003090, 0x8c241000, - 0x5c801610, 0x1500001e, 0x0b001370, 0x90841000, - 0x5cc01605, 0x90cfe070, 0x98d7e078, 0x0a000000, - 0x5880198a, 0x0900044c, 0x92811000, 0x5c401610, - 0x8c480000, 0x92812008, 0x5c501610, 0x8c800000, - 0x5c581e01, 0x92492004, 0x9259200c, 0x0b00154c, - 0x59a41004, 0x92851000, 0x5cc01610, 0x8c81201c, - 0x92f12018, 0x58c8198a, 0x8cd00000, 0x92f7e044, - 0x92cd2004, 0x92f7e048, 0x0b0014a0, 0x92f7e04c, - 0x9837e048, 0x5c801e01, 0x92f12024, 0x9a312028, - 0x0b001508, 0x92812034, 0x09001118, 0x8ca12030, - 0x5a003090, 0x98651000, 0x5c801610, 0x1200000e, - 0x8c600042, 0x08000008, 0x5c601e02, 0x5870198a, - 0x8c780000, 0x8c812040, 0x92f7e060, 0xb2651000, - 0x92f7e050, 0x92f7e064, 0x0b001440, 0x5c901e06, - 0x8c3c9000, 0x923fe054, 0x9837e060, 0x9897e050, - 0x5c801e02, 0x9a312048, 0x9a912050, 0x0b00149c, - 0x92812058, 0x090010ac, 0x5a003090, 0x8ca00000, - 0x5c801610, 0x1500000a, 0x58a0198a, 0x92a1205c, - 0x92f12060, 0x8c812064, 0x0b0013f0, 0x0b0011ec, - 0x0b001408, 0x0b0011e4, 0x90a42004, 0x92a12020, - 0x0b0011f8, 0x92812044, 0x0b0011f0, 0x8c842024, - 0x92812068, 0x0b0011c4, 0x5c201610, 0x0b0011dc, - 0x8c842048, 0x92812004, 0x0b0011b0, 0x0b00140c, - 0x5c801e00, 0x5cc01605, 0x90cfe070, 0x98d7e078, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x5980de05, 0x0b001164, 0x3d042012, 0x5c801e03, - 0x0a000000, 0x00000000, 0x8ca42030, 0x5c881e01, - 0x8c945000, 0x92f41000, 0x92a42008, 0x92942010, - 0x5c801e00, 0x0a000000, 0x00000000, 0x00000000, - 0x0000c630, 0x00000000, 0x00000000, 0x00000000, - 0x59084810, 0x5a033010, 0x8c881400, 0x00000000, - 0x8ca03000, 0x0000c650, 0x598c4114, 0x11000046, - 0x59ac0e02, 0x8cb47400, 0x0000c630, 0x90bd9000, - 0x90a47c15, 0x0000c090, 0x8cad7400, 0x0000e6c0, - 0x908d5000, 0x59a58014, 0x59a50117, 0x8ca52000, - 0x92a55000, 0x86045000, 0x5c801e00, 0x0a000000, - 0x85f47400, 0x0000d7d8, 0x5991981f, 0x8c9c9000, - 0x929c1000, 0x59801901, 0x0a000000, 0x00000000, - 0x5c201610, 0x090000bc, 0x90812010, 0x09000f14, - 0x90812018, 0x3a04200a, 0x09000198, 0x90812008, - 0x3a042012, 0x90a1200c, 0x371d200a, 0x09000744, - 0x90a1201c, 0x3a05200e, 0x59871004, 0x0b0012bc, - 0x0b001098, 0x3a24006e, 0x0b001090, 0x8c842024, - 0x3a240062, 0x0b001084, 0x8c842048, 0x3d24001e, - 0x08000050, 0x00000000, 0x90a12020, 0x92a55000, - 0x09000700, 0x08000034, 0x0b001040, 0x0b00125c, - 0x0b001038, 0x59a91010, 0x08000018, 0x00000000, - 0x90855000, 0x3a811fd6, 0x90a55000, 0x8cad2020, - 0x90a55000, 0x3d053fec, 0x0b001010, 0x0b00126c, - 0x5c801e00, 0x0a000000, 0x00000000, 0x00000000, - 0x5a003090, 0x8c241000, 0x5c301e00, 0x15000016, - 0x090000f0, 0x5c801e00, 0x0a000000, 0x00000000, - 0x90a4200c, 0x8ce80083, 0x58a74094, 0x3d05201e, - 0x0b001028, 0x5ce81e09, 0x8c9f5000, 0x929c1000, - 0x59801901, 0x0a000000, 0x59871010, 0x0b0011cc, - 0x592a1004, 0x90895000, 0x3a046086, 0x90911000, - 0x3a94407e, 0x90a1200c, 0x5a052f09, 0x90812010, - 0x5c801610, 0x10000036, 0x59948111, 0x09000ec4, - 0x90a11000, 0x90a95000, 0x59a50115, 0x3a85003a, - 0x90a1200c, 0x59301901, 0x58a50985, 0x92a1200c, - 0x08000024, 0x00000000, 0x90891000, 0x90912004, - 0x0b001128, 0x59881110, 0x90812010, 0x5c901e01, - 0x09000e10, 0x90a1200c, 0x90a92008, 0x92f12004, - 0x58a50e09, 0x92a1200c, 0x92a91000, 0x59871004, - 0x0b001178, 0x5c801606, 0x0a000000, 0x00000000, - 0x08000e20, 0x00000000, 0x00000000, 0x00000000, - 0x0b000ef8, 0x0b001114, 0x0b000ef0, 0x90242004, - 0x5a003084, 0x8c280000, 0x5c801610, 0x12000022, - 0x5c801604, 0x09fffedc, 0x59901901, 0x3a84800a, - 0x59285005, 0x90212020, 0x3d013fe8, 0x0b000ebc, - 0x0b001118, 0x5c801605, 0x0a000000, 0x00000000, - 0x3d042012, 0x5c801e00, 0x0a000000, 0x00000000, - 0x90203000, 0x0000e6f0, 0x5983d010, 0x5a003084, - 0x582bd210, 0x8ca80000, 0x1200001e, 0x08000010, - 0x5ca81604, 0x90212004, 0x3a01200e, 0x90a1200c, - 0x34a15ff0, 0x3a01205e, 0x5a003095, 0x90a12004, - 0x5c801610, 0x15000016, 0x92a03000, 0x0000e6f0, - 0x0800000c, 0x00000000, 0x92a56004, 0x90a9200c, - 0x8ca16020, 0x8c903000, 0xffffffff, 0x5c981612, - 0x5a056014, 0x92992004, 0x5c801610, 0x1100000e, - 0x5d801604, 0x0900044c, 0x59841004, 0x0a000000, - 0x90a83000, 0x0000e6f4, 0x3a0560da, 0x90a56004, - 0x8c983000, 0xffffffff, 0x3aa4c0ca, 0x90a5600c, - 0x59294114, 0x8c815000, 0x09000b78, 0x3a042106, - 0x8c903000, 0xffffffff, 0x3a8480fa, 0x90203000, - 0x0000e6f0, 0x90a03000, 0x0000e6f4, 0x5a003084, - 0x8ca80000, 0x5c801610, 0x1200001a, 0x3a250016, - 0x5ca81604, 0x90212004, 0x3a01200a, 0x3d251ff4, - 0x3d012022, 0x0b000df4, 0x5991d81f, 0x8c9c9000, - 0x929c1000, 0x5c801e04, 0x09fffc48, 0x08fffed8, - 0x5a003095, 0x90a12004, 0x5c801610, 0x15000016, - 0x92a03000, 0x0000e6f0, 0x0800000c, 0x00000000, - 0x92a56004, 0xb0a11000, 0x59841004, 0x8ca83000, - 0xffffffff, 0x598dc005, 0x8cbc5000, 0x9aa11000, - 0x92b12008, 0x9289200c, 0x0a000000, 0x00000000, - 0x59841005, 0x09000abc, 0x3a04204a, 0x8c983000, - 0xffffffff, 0x3a84c03e, 0x922c200c, 0x90a03000, - 0x0000e6f4, 0x8c403000, 0xacdbadcb, 0x8c483000, - 0xffffffff, 0x5c581605, 0x9a441000, 0x92803000, - 0x0000e6f4, 0x92a42008, 0x59841010, 0x0a000000, - 0x08fffe34, 0x00000000, 0x00000000, 0x00000000, - 0x5a003090, 0x8c441000, 0x5c801610, 0x1500000e, - 0x5c801611, 0x08fffe0c, 0x3d046012, 0x09000364, - 0x5c801e00, 0x0a000000, 0x592c0910, 0x90a15000, - 0x8c983000, 0xacdbadcb, 0x3da4c01a, 0x90a43400, - 0xfffffff4, 0x8ce83000, 0xffffffff, 0x3aa7401e, - 0x0b000cd8, 0x59e9d81f, 0x8c9f5000, 0x929c1000, - 0x080001b4, 0x00000000, 0x90a1600c, 0x598bd011, - 0x5833d211, 0x59398114, 0x3c01e01a, 0x5c801605, - 0x8c899000, 0x0900027c, 0x5c801608, 0x0a000000, - 0x90a03000, 0x0000e6f4, 0x3d2d0032, 0x5c801607, - 0x090009c0, 0x3a042106, 0x8c983000, 0xffffffff, - 0x3a84c0fa, 0x90a1600c, 0x5c801608, 0x59a50007, - 0x92a1600c, 0x0a000000, 0x90a1600c, 0x8c253c05, - 0x00000010, 0x90a12004, 0x8ce83000, 0xffffffff, - 0x3aa740ca, 0x90b83000, 0x0000e6f0, 0x5a012097, - 0x8c800000, 0x5c801610, 0x1200001a, 0x3a05e016, - 0x5c801617, 0x90bde004, 0x3ab9000a, 0x3d05fff4, - 0x3d05e01a, 0x0b000c14, 0x59e9d81f, 0x8c9f5000, - 0x929c1000, 0x080000f0, 0x5a003090, 0x90a5e004, - 0x5c801610, 0x15000016, 0x92a03000, 0x0000e6f0, - 0x0800000c, 0x00000000, 0x92a42004, 0x90a1600c, - 0x90a83000, 0x0000e6f4, 0x90b5e00c, 0x5a05e095, - 0x8ca53c16, 0x00000010, 0x92a1600c, 0x5c801610, - 0x15000012, 0x92283000, 0x0000e6f4, 0x08000010, - 0x90a1600c, 0x922d3c05, 0x00000018, 0x90a1600c, - 0x34a1801a, 0x5c801605, 0x8c899000, 0x09000164, - 0x59841005, 0x0a000000, 0x90216008, 0x3a01210e, - 0x90a12004, 0x8c983000, 0xffffffff, 0x3aa4c0fe, - 0x90a1600c, 0x90a9200c, 0x8ca53c15, 0x00000010, - 0x34a180ea, 0x90b83000, 0x0000e6f0, 0x5a012097, - 0x8c800000, 0x5c801610, 0x1200001a, 0x3a05e016, - 0x5c801617, 0x90bde004, 0x3ab9000a, 0x3d05fff4, - 0x3d05e022, 0x0b000b24, 0x5999d81f, 0x8cecd000, - 0x92ec1000, 0x5c801e04, 0x09fff978, 0x08fffe04, - 0x90a1200c, 0x90a83000, 0x0000e6f4, 0x90b1600c, - 0x5a016095, 0x8ca53c16, 0x00000010, 0x92a1200c, - 0x5c801610, 0x15000016, 0x92203000, 0x0000e6f4, - 0x08000014, 0x00000000, 0x90a1600c, 0x92253c05, - 0x00000018, 0x5a003090, 0x90a12004, 0x5c801610, - 0x15000012, 0x92a03000, 0x0000e6f0, 0x08000008, - 0x92a42004, 0x8c983000, 0xffffffff, 0x5ce81613, - 0x8c812010, 0x92e92004, 0x59918107, 0x8c8a1000, - 0x0b0002d4, 0x5c801604, 0x8c899000, 0x09000054, - 0x59841004, 0x0a000000, 0x5c801606, 0x09fffb64, - 0x5a003090, 0x8c241000, 0x5c801610, 0x12000026, - 0x59918107, 0x8c8a1000, 0x0b00029c, 0x5c801608, - 0x090000a0, 0x5c801604, 0x0a000000, 0x00000000, - 0x08fffd30, 0x00000000, 0x00000000, 0x00000000, - 0x90ac200c, 0x8ca46020, 0x31a54076, 0x8cb47c10, - 0x00000010, 0x9285a008, 0x90a83000, 0x0000e6f4, - 0x8c903000, 0xacdbadcb, 0x5c981612, 0x929d9000, - 0x8c903000, 0xffffffff, 0x5c981612, 0x90a4200c, - 0x929da004, 0x5a042095, 0x59a50910, 0x59a50111, - 0x92a5a00c, 0x928c200c, 0x15000012, 0x92b03000, - 0x0000e6f4, 0x08000010, 0x90a5a00c, 0x92b53c16, - 0x00000018, 0x59841016, 0x08000008, 0x0a000000, - 0x3d04200a, 0x0a000000, 0x598c0910, 0x90a45000, - 0x8ce83000, 0xacdbadcb, 0x3da74122, 0x90a43400, - 0xfffffff4, 0x8c983000, 0xffffffff, 0x3da4c10e, - 0x90a83000, 0x0000e6f0, 0x3a056162, 0x90a03000, - 0x0000e6f4, 0x3a8d00be, 0x90a4600c, 0x8c853c11, - 0x00000010, 0x90a42004, 0x8ce83000, 0xffffffff, - 0x3aa740a2, 0x5a042095, 0x8c900000, 0x5cb81615, - 0x1200001a, 0x3a056016, 0x5c901617, 0x90bde004, - 0x3abc000a, 0x3d05fff4, 0x3d05e01a, 0x0b00091c, - 0x59e9d81f, 0x8c9f5000, 0x929c1000, 0x080000ac, - 0x90a4600c, 0x90a83000, 0x0000e6f4, 0x90b4200c, - 0x5a042095, 0x8ca53c16, 0x00000010, 0x92a4600c, - 0x5c801610, 0x15000016, 0x92883000, 0x0000e6f4, - 0x08000014, 0x00000000, 0x90a4600c, 0x928d3c11, - 0x00000018, 0x3d04a016, 0x90a5e004, 0x92a03000, - 0x0000e6f0, 0x0800000c, 0x90a5e004, 0x92a4a004, - 0x90846008, 0x3a042096, 0x90a42004, 0x8c983000, - 0xffffffff, 0x3aa4c086, 0x90b83000, 0x0000e6f0, - 0x3abc0016, 0x3a05e012, 0x90bde004, 0x3abc000a, - 0x3d05fff8, 0x3d05e01e, 0x0b000870, 0x5999d81f, - 0x8cecd000, 0x92ec1000, 0x5c801e04, 0x08fff6c4, - 0x90a4200c, 0x90a83000, 0x0000e6f4, 0x90b4600c, - 0x5a046095, 0x8ca53c16, 0x00000010, 0x92a4200c, - 0x5c801610, 0x15000016, 0x92803000, 0x0000e6f4, - 0x0a000000, 0x00000000, 0x90a4200c, 0x92853c10, - 0x00000018, 0x0a000000, 0x90a03000, 0x0000e6f0, - 0x92883000, 0x0000e6f0, 0x92a46004, 0x0a000000, - 0x70844090, 0x3d04200e, 0x5c801e00, 0x0a000000, - 0x09fff8e0, 0x5a003090, 0x8c241000, 0x5c801610, - 0x12000016, 0x90943400, 0xfffffffc, 0x5c881e00, - 0x0bfff358, 0x5c801604, 0x0a000000, 0x8cf01400, - 0x000000dc, 0x3b04a222, 0x5a046010, 0x8cef9000, - 0x59ac4012, 0x120000c6, 0x5a042115, 0x5898d211, - 0x11000102, 0x5a046013, 0x90b4d000, 0x58a0d210, - 0x8c9ce004, 0x150000b2, 0x5a052010, 0x59a50904, - 0x1200006c, 0x59a50808, 0x8c8c1000, 0x5cb81616, - 0x8cf00020, 0x5a948b80, 0x12000082, 0x59f78808, - 0x82bc5000, 0x59bdcc08, 0x8c8c6001, 0x358d1fe8, - 0x90bcd000, 0x5a013092, 0x8c9ce004, 0x5d8d841e, - 0x1400003e, 0x5cb01617, 0x90bcd000, 0x59948984, - 0x928d1000, 0x59a50804, 0x08ffffdc, 0x59948984, - 0x90b4d000, 0x599cc804, 0x928d1000, 0x5a013092, - 0x59a50804, 0x8c8d9000, 0x13ffffe4, 0x3a04a01e, - 0x59948981, 0x828d1000, 0x5a04a880, 0x8ca52001, - 0x598c4c08, 0x15ffffec, 0x5cf01e00, 0x84075000, - 0x0a000000, 0x5a052010, 0x90bcd000, 0x588c4883, - 0x59f44e03, 0x12ffff80, 0x588c4394, 0x5a046010, - 0x8ca52004, 0x5dad841e, 0x8c8c1000, 0x1100000e, - 0x5cb01617, 0x8c9ce004, 0x5cb81615, 0x08ffff38, - 0x58b8d215, 0x5a056017, 0x599dc904, 0x598c0012, - 0x58a0d211, 0x150000b6, 0x5a052011, 0x90bcd000, - 0x599cc904, 0x12000070, 0x5cb01617, 0x8cf00020, - 0x5a948b80, 0x12ffff86, 0x59b58e88, 0x8c8c7400, - 0xffffffff, 0x5a052011, 0x82b45000, 0x59f78908, - 0x15ffffe0, 0x90b4d000, 0x5a013092, 0x8c9cf400, - 0xfffffffc, 0x5d8d841e, 0x8cbd9000, 0x59a50904, - 0x14000036, 0x90b4d000, 0x59948984, 0x928d1000, - 0x08ffffd8, 0x59948984, 0x90bcd000, 0x599cc904, - 0x928d1000, 0x5a013092, 0x59a50904, 0x8c8dd000, - 0x13ffffe4, 0x3a04bf16, 0x598c4e88, 0x8ca52004, - 0x59a50981, 0x5a042094, 0x828d1000, 0x598c4e88, - 0x15fffff0, 0x08fffef4, 0x5a052011, 0x90bdd000, - 0x58ad4883, 0x90b4d000, 0x59f54e03, 0x12ffff7c, - 0x58ad4394, 0x5a056011, 0x5dad841e, 0x14000010, - 0x5cb81616, 0x12000008, 0x599cc904, 0x5cb01615, - 0x08ffff30, 0x5ce8161e, 0x08fffeb0, 0x00000000, - 0x59084810, 0x8c803000, 0x0000e700, 0x5888198a, - 0x8ce800f2, 0x6600301d, 0x3e042024, 0x5c201e00, - 0x8c283000, 0x000056b0, 0x8ca7e040, 0x5c301e00, - 0x92f7e048, 0x9a251000, 0x08000014, 0x8c87e040, - 0x8c883000, 0x0000e700, 0x09000018, 0xb087e040, - 0x92903000, 0x0000ebd0, 0x0a000000, 0x00000000, - 0x5c401610, 0x5c201611, 0x5c801604, 0x0b0001dc, - 0x5c301e00, 0x8c383000, 0x0000eb00, 0x9a321000, - 0xc0a11000, 0x5a052880, 0x592c0801, 0x59294004, - 0x120000a4, 0x08000098, 0xc0a11000, 0x5998581f, - 0x3aa4c010, 0x3a4d200c, 0x3a6d2008, 0x3d552010, - 0x59205004, 0xc0a11000, 0x3d053fe0, 0xc0a11000, - 0x3a052064, 0x90aa1000, 0x59a05015, 0x92203915, - 0x0000eb00, 0x92a21000, 0xc0a11000, 0x3a052038, - 0x5990581f, 0x3aa48030, 0x3a4d202c, 0x3a6d2028, - 0x3a552024, 0x59205004, 0xc0a11000, 0x3a052018, - 0x5998581f, 0x3aa4c010, 0x3a4d200c, 0x3a6d2008, - 0x3d553fe4, 0xc0a11000, 0x3a05200c, 0x82f11000, - 0x59205004, 0xc0a11000, 0x3a05200c, 0x90a21000, - 0x3b953f84, 0x90a21000, 0x92f03914, 0x0000eb00, - 0xc0a15000, 0x5a052880, 0x5c201e00, 0x120000cc, - 0x92283000, 0x0000eb50, 0x5c801605, 0x0b0000ec, - 0x59294801, 0x59294010, 0xc0a15000, 0x5a052880, - 0x5c201e01, 0x120000a4, 0x8c303000, 0x0000eb54, - 0x92299000, 0x5c801605, 0x0b0000c0, 0x59294801, - 0x59294010, 0xc0a15000, 0x5a052880, 0x59205004, - 0x12000078, 0x9229a004, 0x5c801605, 0x0b00009c, - 0x59294801, 0x59294010, 0xc0a15000, 0x5a052880, - 0x59205004, 0x12000054, 0x9229a008, 0x5c801605, - 0x0b000078, 0x59294801, 0x59294010, 0xc0a15000, - 0x5a052880, 0x59205004, 0x12000030, 0x9229a00c, - 0x5c801605, 0x0b000054, 0x59294801, 0x59294010, - 0xc0a15000, 0x59341006, 0x5a003094, 0x59205004, - 0x12000008, 0x3be13f6c, 0x8c983000, 0x0000eb50, - 0x92f03904, 0x0000eb50, 0x5c901613, 0x92922008, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x00000030, 0x5c88161e, 0x5cf01e00, - 0xc0a41000, 0x5ca81e00, 0x0800000c, 0xc0a41000, - 0x59a85015, 0x5a003094, 0x59805010, 0x15fffff0, - 0x5c801615, 0x84045000, 0x0a000000, 0x00000000, - 0x8ce80101, 0x6600301d, 0x0a000000, 0x00000000, - 0x8cf01400, 0x00000020, 0x5c80161e, 0x5cf01e00, - 0x8ca03000, 0x0003cd50, 0x5ca81614, 0x92a83000, - 0x0000ebe0, 0x84041000, 0x0a000000, 0x00000000, - 0x5a003090, 0x90a83000, 0x0000ebe0, 0x1500000c, - 0x5c801615, 0x0a000000, 0x59a3d015, 0x58a3d214, - 0x8ca52000, 0x5a052015, 0x8cb43c14, 0xffffffff, - 0x11000014, 0x34b50010, 0x8c903000, 0x0003dd4f, - 0x36b48020, 0x0b000284, 0x5c901e0c, 0x5c881612, - 0x928c1000, 0x8c803000, 0xffffffff, 0x0a000000, - 0x59a85016, 0x33ad800c, 0x8ca83000, 0x0003dd4f, - 0x5c801614, 0x92a83000, 0x0000ebe0, 0x0a000000, - 0x8c883000, 0x0003cd50, 0x34844014, 0x59a40901, - 0x8c903000, 0x0003dd4f, 0x36a4801c, 0x0b00022c, - 0x5c901e0c, 0x5c881612, 0x928c1000, 0x59801901, - 0x0a000000, 0x92803000, 0x0000ebe0, 0x5c801e00, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8ce800ea, 0x6600301d, 0x5a003090, 0x5c201610, - 0x12000014, 0x0b0001e4, 0x92241000, 0x59801901, - 0x0a000000, 0x5c801e00, 0x0a000000, 0x00000000, - 0x59084810, 0x8c8fe040, 0x8ce800eb, 0x6600301d, - 0x5a003090, 0x5c201610, 0x12000014, 0x0b0001ac, - 0x92241000, 0x59801901, 0x0a000000, 0x9087e040, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x59084810, 0x8c9fe040, 0x8ce800e9, 0x6600301d, - 0x5a003090, 0x5c201610, 0x12000014, 0x0b00016c, - 0x92241000, 0x59801901, 0x0a000000, 0x9087e040, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x8ce800ef, 0x6600301d, 0x5a003090, 0x5c201610, - 0x12000014, 0x0b000134, 0x92241000, 0x59801901, - 0x0a000000, 0x5c801e00, 0x0a000000, 0x00000000, - 0x59084810, 0x8c9fe040, 0x8ce800e8, 0x6600301d, - 0x5a003090, 0x5c201610, 0x12000014, 0x0b0000fc, - 0x92241000, 0x59801901, 0x0a000000, 0x9087e040, - 0x0a000000, 0x00000000, 0x00000000, 0x00000000, - 0x08fffde0, 0x00000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ebf0, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ec80, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ecf0, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ebf0, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ec80, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ecf0, 0x84045000, 0x0a000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x8c803000, 0x0000ecf0, 0x84045000, 0x0a000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x00000010, 0x5c88161e, 0x5cf01e00, - 0x5c801612, 0x84045000, 0x0a000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c88161e, 0x5cf01e00, - 0x84045000, 0x0a000000, 0x00000000, 0x00000000, - 0x08fffcf0, 0x00000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x8cf01400, 0x00000014, 0x5c88161e, 0x5cf01e00, - 0x59a81901, 0x64840295, 0x84045000, 0x0a000000, - 0x8cf01400, 0x0000000c, 0x5c80161e, 0x5cf01e00, - 0x84041000, 0x0a000000, 0x00000000, 0x00000000, - 0x5a003090, 0x8c200413, 0x14000056, 0x5c281610, - 0x64601085, 0x10000042, 0x5965110c, 0x5a00308c, - 0x14000012, 0x5989460c, 0x5c801e00, 0x08000014, - 0x5968110c, 0x5989440d, 0x8c6b2020, 0x5981460d, - 0x588c4e14, 0x5921010c, 0x59210e14, 0x588c4384, - 0x0a000000, 0x5d801e00, 0x08fffff8, 0x59281110, - 0x64601085, 0x5965110c, 0x5a00308c, 0x14000012, - 0x5989460c, 0x5c801e00, 0x08000014, 0x5968110c, - 0x5989440d, 0x8c6b2020, 0x5981460d, 0x588c4e14, - 0x5921010c, 0x59210e14, 0x588c4384, 0x588c499f, - 0x08ffffb0, 0x59244e01, 0x8c603000, 0xffe00000, - 0x5a032004, 0x1100006a, 0x59210c15, 0x592c4e0a, - 0x5829499e, 0x58294e1f, 0x59640c16, 0x582b0385, - 0x5a003091, 0x8c60041d, 0x14000026, 0x5a032004, - 0x59230104, 0x1100000e, 0x59814404, 0x0a000000, - 0x59801901, 0x58840e1f, 0x08fffff4, 0x5a032004, - 0x59230104, 0x11000012, 0x59294404, 0x59801105, - 0x08ffffdc, 0x59805e1f, 0x08ffffd4, 0x5c801e00, - 0x08ffffcc, 0x59244e01, 0x8c603000, 0xffe00000, - 0x5a032004, 0x11000042, 0x59210c15, 0x592c4e0b, - 0x5829499f, 0x59640c15, 0x582b0385, 0x5a003091, - 0x14000026, 0x8c60041e, 0x5a032004, 0x11000012, - 0x59230104, 0x59814404, 0x0a000000, 0x59801901, - 0x08fffff8, 0x5c801e00, 0x08fffff0, 0x59244e01, - 0x8c603000, 0xffdfffff, 0x5a01200c, 0x5a003104, - 0x16000052, 0x59210c15, 0x8c600380, 0x5921010c, - 0x8c6000ff, 0x5a032004, 0x1300002e, 0x59210e17, - 0x592c4e0c, 0x59294c09, 0x58214384, 0x592c0c1d, - 0x5a042f1c, 0x5b810005, 0x5a046f1f, 0x58840f9f, - 0x0a000000, 0x5a003084, 0x14000030, 0x08000018, - 0x1200002a, 0x8c603000, 0xffe00000, 0x5a032004, - 0x11000012, 0x8c803000, 0x7f800000, 0x08ffffcc, - 0x59801901, 0x08ffffcc, 0x5c801e00, 0x08ffffbc, - 0x59540c1f, 0x59528e1f, 0x59240e01, 0x8c603000, - 0xfeffffff, 0x5a01200c, 0x5a003104, 0x1600003a, - 0x59210c18, 0x8c603000, 0xfffffc80, 0x5921010c, - 0x59210e14, 0x592c0e09, 0x59294c0c, 0x58894384, - 0x59840e1d, 0x588a8391, 0x0a000000, 0x5d801e00, - 0x08fffff4, 0x12fffffa, 0x8c603000, 0xff000000, - 0x5a01200c, 0x14000016, 0x8c883000, 0x7ff00000, - 0x5c801e00, 0x08ffffd0, 0x59801901, 0x59881901, - 0x08ffffc8, 0x59548c0f, 0x59528e1f, 0x59248e11, - 0x59210c11, 0x5a046f1f, 0x1000005a, 0x8c603000, - 0x00003c00, 0x5921010c, 0x8c6007ff, 0x5a032004, - 0x1300002e, 0x588c4e1f, 0x593c4c0b, 0x59344e15, - 0x59210e14, 0x58890387, 0x5a042f0a, 0x59840c0b, - 0x5b840006, 0x588c438a, 0x0a000000, 0x11000022, - 0x8c883000, 0x7ff00000, 0x5c801e00, 0x08ffffe8, - 0x588c4390, 0x5a003011, 0x12ffffdc, 0x59801901, - 0x59881901, 0x08ffffd4, 0x5854481f, 0x08000008, - 0x58544e1f, 0x59244e01, 0x8c603000, 0xffe00000, - 0x5a032004, 0x1100000a, 0x5c88160a, 0x0a000000, - 0x589cc81f, 0x59244e01, 0x592cce01, 0x59605e15, - 0x596b0004, 0x5a03200d, 0x1600019a, 0x596b0005, - 0x5a03200d, 0x1600018e, 0x593c4e0b, 0x59640c15, - 0x59340e0b, 0x5839c38c, 0x5839c99f, 0x594cce0b, - 0x59648c15, 0x59448e0b, 0x584a438c, 0x584a499f, - 0x59210c15, 0x59294c15, 0x59544c1f, 0x59528e1f, - 0x5a016004, 0x8c680020, 0x14000034, 0x59610105, - 0x5a03600c, 0x14000010, 0x5c401609, 0x5c481e00, - 0x5963010d, 0x5942040c, 0x596b410c, 0x596a460d, - 0x594a440c, 0x5842038d, 0x08000034, 0x59614104, - 0x5a03600c, 0x14000010, 0x5c301607, 0x5c381e00, - 0x5963010d, 0x5931840c, 0x596b410c, 0x5969c60d, - 0x5939c40c, 0x5831838d, 0x5c201605, 0x5864c311, - 0x5a032f1f, 0x1200003e, 0x5b318008, 0x5b39c009, - 0x10000096, 0x59318c01, 0x5961ce1f, 0x5939cc01, - 0x5831838c, 0x59210801, 0x8c6007ff, 0x5a032004, - 0x14000074, 0x5c20160c, 0x5d301e00, 0x08000068, - 0x5b318108, 0x5b39c109, 0x12000016, 0x5a003800, - 0x5b301106, 0x5b381107, 0x5852881f, 0x64601087, - 0x12000020, 0x64601086, 0x10000066, 0x5967d10c, - 0x5939860c, 0x5c301e00, 0x8c632020, 0x0800001c, - 0x5969840c, 0x596b4c01, 0x5967d10c, 0x5939c60c, - 0x5931860c, 0x5839c38d, 0x5921010c, 0x5a003084, - 0x14000036, 0x5a01af0a, 0x5839ce1f, 0x59818c0b, - 0x5969ce15, 0x5989cc0b, 0x59210e14, 0x58890391, - 0x5b84000d, 0x5b8c400a, 0x0a000000, 0x5d801e00, - 0x08fffff8, 0x5c801e00, 0x5c88160a, 0x08ffffec, - 0x8c603000, 0xffe00000, 0x5a01200c, 0x12000046, - 0x1400005a, 0x5a01600c, 0x12000032, 0x1400004e, - 0x586c0384, 0x5a00300d, 0x12000016, 0x586c8385, - 0x5a00300d, 0x15fffe46, 0x08ffffb0, 0x586c8385, - 0x5a00300d, 0x12000032, 0x5d801612, 0x08ffff9c, - 0x5a01600c, 0x14000016, 0x11ffff92, 0x5864c311, - 0x5a00308c, 0x13ffff86, 0x59801901, 0x59881901, - 0x08ffff78, 0x588cc091, 0x5c801e00, 0x08ffff6c, - 0x581cc311, 0x5918cc1f, 0x5918ce1f, 0x59244e01, - 0x592cce01, 0x59605e15, 0x596b0004, 0x5a03200d, - 0x160000ee, 0x596b0005, 0x5a03200d, 0x160000e2, - 0x593c4e0b, 0x5939cc01, 0x59340e0a, 0x596c0c16, - 0x5839c38d, 0x5839c99e, 0x594cce0b, 0x59448e0b, - 0x596c8c15, 0x584a438d, 0x584a499f, 0x59210c15, - 0x59294c15, 0x67518089, 0x5c68160a, 0x5c601e00, - 0x67630089, 0x5c50160d, 0x596a0c01, 0x5c601e00, - 0x67630089, 0x6763400b, 0x5a003800, 0x5b52810d, - 0x5b5ac900, 0x5b52810d, 0x5b5ac900, 0x5a02ef1f, - 0x12000010, 0x5b52800a, 0x5b5ac00b, 0x59210901, - 0x8c2123ff, 0x59210105, 0x8c6007fe, 0x5a01200c, - 0x1400002e, 0x5a02af0a, 0x59828c0b, 0x596ace15, - 0x598acc0b, 0x588c4e14, 0x59210e14, 0x58890391, - 0x5b84000d, 0x5b8c4003, 0x0a000000, 0x5a003084, - 0x14000010, 0x59230801, 0x5d501e00, 0x08ffffc8, - 0x5c201e00, 0x5d501e00, 0x08ffffbc, 0x8c603000, - 0xffe00000, 0x5a01200c, 0x1200005a, 0x1400005e, - 0x5a01600c, 0x12000042, 0x14000052, 0x586c0384, - 0x5a00300d, 0x12000026, 0x586c8385, 0x5a00300d, - 0x15fffef2, 0x8c883000, 0x7ff00000, 0x5c801e00, - 0x588c4383, 0x08ffff94, 0x586c8385, 0x5a00300d, - 0x1200001a, 0x5d801e00, 0x588c4383, 0x08ffff7c, - 0x5a01600c, 0x11ffffd2, 0x59801901, 0x59881901, - 0x08ffff68, 0x00000000, 0x00000000, 0x00000000, - 0x581cc311, 0x5918cc1f, 0x5918ce1f, 0x59244e01, - 0x592cce01, 0x59605e15, 0x596b0004, 0x5a03200d, - 0x160000d6, 0x596b0005, 0x5a03200d, 0x160000ca, - 0x593c4e0b, 0x59340e0b, 0x596c0c15, 0x5839c38d, - 0x594cce0b, 0x59448e0b, 0x596c8c15, 0x584a438d, - 0x5839c99f, 0x584a499f, 0x59210c15, 0x59294c15, - 0x67624007, 0x67524006, 0x5a007800, 0x5b62c00c, - 0x5b68100d, 0x67720007, 0x5b73800a, 0x5b63c00c, - 0x5b68100d, 0x5a036f1f, 0x12000010, 0x5b63000c, - 0x5b6b400d, 0x59210901, 0x8c217c04, 0xfffffc02, - 0x8c5007fe, 0x5a01200a, 0x1400002e, 0x5a032f0a, - 0x59830c0b, 0x59534e15, 0x598b4c0b, 0x588c4e14, - 0x59210e14, 0x58890391, 0x5b84000a, 0x5b8c4003, - 0x0a000000, 0x5a003084, 0x14000010, 0x59228801, - 0x5d601e00, 0x08ffffc8, 0x5c201e00, 0x5d601e00, - 0x08ffffbc, 0x5918cc1f, 0x5918ce1f, 0x8c603000, - 0xffe00000, 0x5a01200c, 0x1200003a, 0x14000046, - 0x5a01600c, 0x1400003e, 0x12000046, 0x586c0384, - 0x5a00300d, 0x12000012, 0x586c8385, 0x5a00300d, - 0x15ffff02, 0x5d801e00, 0x588c4383, 0x08ffff94, - 0x5a01600c, 0x1400000e, 0x5a003005, 0x1500001e, - 0x59801901, 0x59881901, 0x08ffff78, 0x586c0384, - 0x5a00300d, 0x12ffffee, 0x8c883000, 0x7ff00000, - 0x588c4383, 0x5c801e00, 0x08ffff58, 0x00000000, - 0x59244e01, 0x5934ce01, 0x8c603000, 0xffe00000, - 0x5a01200c, 0x1600007e, 0x5a01a00c, 0x160000c6, - 0x58318384, 0x5a003006, 0x12000062, 0x59644d9f, - 0x583c4e1f, 0x58330310, 0x583b0307, 0x5a003800, - 0x5b31810c, 0x5b39c900, 0x5964cd9f, 0x584cce1f, - 0x58430312, 0x584b0309, 0x5a003800, 0x5b42010c, - 0x5b4a4900, 0x5a026087, 0x59801901, 0x14000022, - 0x5c801e01, 0x1100001a, 0x5a022006, 0x11000012, - 0x59801901, 0x1400000a, 0x5c801e00, 0x0a000000, - 0x5a01200c, 0x1200001e, 0x5c801e03, 0x08fffff0, - 0x5c801e01, 0x08ffffe8, 0x59801901, 0x08ffffe0, - 0x5a01a00c, 0x14ffffe6, 0x1100001e, 0x5864c311, - 0x5a00308c, 0x13ffffc6, 0x5a046f1f, 0x10ffffd6, - 0x08ffffd8, 0x5a003091, 0x14ffffd0, 0x08ffffc4, - 0x5a01a00c, 0x14ffffb6, 0x5a04ef1f, 0x12ffffb6, - 0x08ffffb8, 0x0a000000, -}; -#define FIRMWARE_SIZE 37560 diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c deleted file mode 100644 index 2a1dee685c3d..000000000000 --- a/sys/dev/fatm/if_fatm.c +++ /dev/null @@ -1,3091 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Fore PCA200E driver for NATM - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#ifdef INET -#include -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -devclass_t fatm_devclass; - -static const struct { - uint16_t vid; - uint16_t did; - const char *name; -} fatm_devs[] = { - { 0x1127, 0x300, - "FORE PCA200E" }, - { 0, 0, NULL } -}; - -static const struct rate { - uint32_t ratio; - uint32_t cell_rate; -} rate_table[] = { -#include -}; -#define RATE_TABLE_SIZE (sizeof(rate_table) / sizeof(rate_table[0])) - -SYSCTL_DECL(_hw_atm); - -MODULE_DEPEND(fatm, utopia, 1, 1, 1); - -static int fatm_utopia_readregs(struct ifatm *, u_int, uint8_t *, u_int *); -static int fatm_utopia_writereg(struct ifatm *, u_int, u_int, u_int); - -static const struct utopia_methods fatm_utopia_methods = { - fatm_utopia_readregs, - fatm_utopia_writereg -}; - -#define VC_OK(SC, VPI, VCI) \ - (rounddown2(VPI, 1 << IFP2IFATM((SC)->ifp)->mib.vpi_bits) == 0 && \ - (VCI) != 0 && rounddown2(VCI, 1 << IFP2IFATM((SC)->ifp)->mib.vci_bits) == 0) - -static int fatm_load_vc(struct fatm_softc *sc, struct card_vcc *vc); - -/* - * Probing is easy: step trough the list of known vendor and device - * ids and compare. If one is found - it's our. - */ -static int -fatm_probe(device_t dev) -{ - int i; - - for (i = 0; fatm_devs[i].name; i++) - if (pci_get_vendor(dev) == fatm_devs[i].vid && - pci_get_device(dev) == fatm_devs[i].did) { - device_set_desc(dev, fatm_devs[i].name); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -/* - * Function called at completion of a SUNI writeregs/readregs command. - * This is called from the interrupt handler while holding the softc lock. - * We use the queue entry as the randevouze point. - */ -static void -fatm_utopia_writeregs_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if(H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.suni_reg_errors++; - q->error = EIO; - } - wakeup(q); -} - -/* - * Write a SUNI register. The bits that are 1 in mask are written from val - * into register reg. We wait for the command to complete by sleeping on - * the register memory. - * - * We assume, that we already hold the softc mutex. - */ -static int -fatm_utopia_writereg(struct ifatm *ifatm, u_int reg, u_int mask, u_int val) -{ - int error; - struct cmdqueue *q; - struct fatm_softc *sc; - - sc = ifatm->ifp->if_softc; - FATM_CHECKLOCK(sc); - if (!(ifatm->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return (EIO); - - /* get queue element and fill it */ - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (!(H_GETSTAT(q->q.statp) & FATM_STAT_FREE)) { - sc->istats.cmd_queue_full++; - return (EIO); - } - NEXT_QUEUE_ENTRY(sc->cmdqueue.head, FATM_CMD_QLEN); - - q->error = 0; - q->cb = fatm_utopia_writeregs_complete; - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - WRITE4(sc, q->q.card + FATMOC_GETOC3_BUF, 0); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_OP, - FATM_MAKE_SETOC3(reg, val, mask) | FATM_OP_INTERRUPT_SEL); - BARRIER_W(sc); - - /* - * Wait for the command to complete - */ - error = msleep(q, &sc->mtx, PZERO | PCATCH, "fatm_setreg", hz); - - switch(error) { - - case EWOULDBLOCK: - error = EIO; - break; - - case ERESTART: - error = EINTR; - break; - - case 0: - error = q->error; - break; - } - - return (error); -} - -/* - * Function called at completion of a SUNI readregs command. - * This is called from the interrupt handler while holding the softc lock. - * We use reg_mem as the randevouze point. - */ -static void -fatm_utopia_readregs_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.suni_reg_errors++; - q->error = EIO; - } - wakeup(&sc->reg_mem); -} - -/* - * Read SUNI registers - * - * We use a preallocated buffer to read the registers. Therefor we need - * to protect against multiple threads trying to read registers. We do this - * with a condition variable and a flag. We wait for the command to complete by sleeping on - * the register memory. - * - * We assume, that we already hold the softc mutex. - */ -static int -fatm_utopia_readregs_internal(struct fatm_softc *sc) -{ - int error, i; - uint32_t *ptr; - struct cmdqueue *q; - - /* get the buffer */ - for (;;) { - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return (EIO); - if (!(sc->flags & FATM_REGS_INUSE)) - break; - cv_wait(&sc->cv_regs, &sc->mtx); - } - sc->flags |= FATM_REGS_INUSE; - - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (!(H_GETSTAT(q->q.statp) & FATM_STAT_FREE)) { - sc->istats.cmd_queue_full++; - return (EIO); - } - NEXT_QUEUE_ENTRY(sc->cmdqueue.head, FATM_CMD_QLEN); - - q->error = 0; - q->cb = fatm_utopia_readregs_complete; - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - bus_dmamap_sync(sc->reg_mem.dmat, sc->reg_mem.map, BUS_DMASYNC_PREREAD); - - WRITE4(sc, q->q.card + FATMOC_GETOC3_BUF, sc->reg_mem.paddr); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_OP, - FATM_OP_OC3_GET_REG | FATM_OP_INTERRUPT_SEL); - BARRIER_W(sc); - - /* - * Wait for the command to complete - */ - error = msleep(&sc->reg_mem, &sc->mtx, PZERO | PCATCH, - "fatm_getreg", hz); - - switch(error) { - - case EWOULDBLOCK: - error = EIO; - break; - - case ERESTART: - error = EINTR; - break; - - case 0: - bus_dmamap_sync(sc->reg_mem.dmat, sc->reg_mem.map, - BUS_DMASYNC_POSTREAD); - error = q->error; - break; - } - - if (error != 0) { - /* declare buffer to be free */ - sc->flags &= ~FATM_REGS_INUSE; - cv_signal(&sc->cv_regs); - return (error); - } - - /* swap if needed */ - ptr = (uint32_t *)sc->reg_mem.mem; - for (i = 0; i < FATM_NREGS; i++) - ptr[i] = le32toh(ptr[i]) & 0xff; - - return (0); -} - -/* - * Read SUNI registers for the SUNI module. - * - * We assume, that we already hold the mutex. - */ -static int -fatm_utopia_readregs(struct ifatm *ifatm, u_int reg, uint8_t *valp, u_int *np) -{ - int err; - int i; - struct fatm_softc *sc; - - if (reg >= FATM_NREGS) - return (EINVAL); - if (reg + *np > FATM_NREGS) - *np = FATM_NREGS - reg; - sc = ifatm->ifp->if_softc; - FATM_CHECKLOCK(sc); - - err = fatm_utopia_readregs_internal(sc); - if (err != 0) - return (err); - - for (i = 0; i < *np; i++) - valp[i] = ((uint32_t *)sc->reg_mem.mem)[reg + i]; - - /* declare buffer to be free */ - sc->flags &= ~FATM_REGS_INUSE; - cv_signal(&sc->cv_regs); - - return (0); -} - -/* - * Check whether the hard is beating. We remember the last heart beat and - * compare it to the current one. If it appears stuck for 10 times, we have - * a problem. - * - * Assume we hold the lock. - */ -static void -fatm_check_heartbeat(struct fatm_softc *sc) -{ - uint32_t h; - - FATM_CHECKLOCK(sc); - - h = READ4(sc, FATMO_HEARTBEAT); - DBG(sc, BEAT, ("heartbeat %08x", h)); - - if (sc->stop_cnt == 10) - return; - - if (h == sc->heartbeat) { - if (++sc->stop_cnt == 10) { - log(LOG_ERR, "i960 stopped???\n"); - WRITE4(sc, FATMO_HIMR, 1); - } - return; - } - - sc->stop_cnt = 0; - sc->heartbeat = h; -} - -/* - * Ensure that the heart is still beating. - */ -static void -fatm_watchdog(void *arg) -{ - struct fatm_softc *sc; - - sc = arg; - FATM_CHECKLOCK(sc); - fatm_check_heartbeat(sc); - callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc); -} - -/* - * Hard reset the i960 on the board. This is done by initializing registers, - * clearing interrupts and waiting for the selftest to finish. Not sure, - * whether all these barriers are actually needed. - * - * Assumes that we hold the lock. - */ -static int -fatm_reset(struct fatm_softc *sc) -{ - int w; - uint32_t val; - - FATM_CHECKLOCK(sc); - - WRITE4(sc, FATMO_APP_BASE, FATMO_COMMON_ORIGIN); - BARRIER_W(sc); - - WRITE4(sc, FATMO_UART_TO_960, XMIT_READY); - BARRIER_W(sc); - - WRITE4(sc, FATMO_UART_TO_HOST, XMIT_READY); - BARRIER_W(sc); - - WRITE4(sc, FATMO_BOOT_STATUS, COLD_START); - BARRIER_W(sc); - - WRITE1(sc, FATMO_HCR, FATM_HCR_RESET); - BARRIER_W(sc); - - DELAY(1000); - - WRITE1(sc, FATMO_HCR, 0); - BARRIER_RW(sc); - - DELAY(1000); - - for (w = 100; w; w--) { - BARRIER_R(sc); - val = READ4(sc, FATMO_BOOT_STATUS); - switch (val) { - case SELF_TEST_OK: - return (0); - case SELF_TEST_FAIL: - return (EIO); - } - DELAY(1000); - } - return (EIO); -} - -/* - * Stop the card. Must be called WITH the lock held - * Reset, free transmit and receive buffers. Wakeup everybody who may sleep. - */ -static void -fatm_stop(struct fatm_softc *sc) -{ - int i; - struct cmdqueue *q; - struct rbuf *rb; - struct txqueue *tx; - uint32_t stat; - - FATM_CHECKLOCK(sc); - - /* Stop the board */ - utopia_stop(&sc->utopia); - (void)fatm_reset(sc); - - /* stop watchdog */ - callout_stop(&sc->watchdog_timer); - - if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) { - sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); - - /* - * Collect transmit mbufs, partial receive mbufs and - * supplied mbufs - */ - for (i = 0; i < FATM_TX_QLEN; i++) { - tx = GET_QUEUE(sc->txqueue, struct txqueue, i); - if (tx->m) { - bus_dmamap_unload(sc->tx_tag, tx->map); - m_freem(tx->m); - tx->m = NULL; - } - } - - /* Collect supplied mbufs */ - while ((rb = LIST_FIRST(&sc->rbuf_used)) != NULL) { - LIST_REMOVE(rb, link); - bus_dmamap_unload(sc->rbuf_tag, rb->map); - m_free(rb->m); - rb->m = NULL; - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - } - - /* Unwait any waiters */ - wakeup(&sc->sadi_mem); - - /* wakeup all threads waiting for STAT or REG buffers */ - cv_broadcast(&sc->cv_stat); - cv_broadcast(&sc->cv_regs); - - sc->flags &= ~(FATM_STAT_INUSE | FATM_REGS_INUSE); - - /* wakeup all threads waiting on commands */ - for (i = 0; i < FATM_CMD_QLEN; i++) { - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, i); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if ((stat = H_GETSTAT(q->q.statp)) != FATM_STAT_FREE) { - H_SETSTAT(q->q.statp, stat | FATM_STAT_ERROR); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - wakeup(q); - } - } - utopia_reset_media(&sc->utopia); - } - sc->small_cnt = sc->large_cnt = 0; - - /* Reset vcc info */ - if (sc->vccs != NULL) { - sc->open_vccs = 0; - for (i = 0; i < FORE_MAX_VCC + 1; i++) { - if (sc->vccs[i] != NULL) { - if ((sc->vccs[i]->vflags & (FATM_VCC_OPEN | - FATM_VCC_TRY_OPEN)) == 0) { - uma_zfree(sc->vcc_zone, sc->vccs[i]); - sc->vccs[i] = NULL; - } else { - sc->vccs[i]->vflags = 0; - sc->open_vccs++; - } - } - } - } - -} - -/* - * Load the firmware into the board and save the entry point. - */ -static uint32_t -firmware_load(struct fatm_softc *sc) -{ - struct firmware *fw = (struct firmware *)firmware; - - DBG(sc, INIT, ("loading - entry=%x", fw->entry)); - bus_space_write_region_4(sc->memt, sc->memh, fw->offset, firmware, - sizeof(firmware) / sizeof(firmware[0])); - BARRIER_RW(sc); - - return (fw->entry); -} - -/* - * Read a character from the virtual UART. The availability of a character - * is signaled by a non-null value of the 32 bit register. The eating of - * the character by us is signalled to the card by setting that register - * to zero. - */ -static int -rx_getc(struct fatm_softc *sc) -{ - int w = 50; - int c; - - while (w--) { - c = READ4(sc, FATMO_UART_TO_HOST); - BARRIER_RW(sc); - if (c != 0) { - WRITE4(sc, FATMO_UART_TO_HOST, 0); - DBGC(sc, UART, ("%c", c & 0xff)); - return (c & 0xff); - } - DELAY(1000); - } - return (-1); -} - -/* - * Eat up characters from the board and stuff them in the bit-bucket. - */ -static void -rx_flush(struct fatm_softc *sc) -{ - int w = 10000; - - while (w-- && rx_getc(sc) >= 0) - ; -} - -/* - * Write a character to the card. The UART is available if the register - * is zero. - */ -static int -tx_putc(struct fatm_softc *sc, u_char c) -{ - int w = 10; - int c1; - - while (w--) { - c1 = READ4(sc, FATMO_UART_TO_960); - BARRIER_RW(sc); - if (c1 == 0) { - WRITE4(sc, FATMO_UART_TO_960, c | CHAR_AVAIL); - DBGC(sc, UART, ("%c", c & 0xff)); - return (0); - } - DELAY(1000); - } - return (-1); -} - -/* - * Start the firmware. This is doing by issuing a 'go' command with - * the hex entry address of the firmware. Then we wait for the self-test to - * succeed. - */ -static int -fatm_start_firmware(struct fatm_softc *sc, uint32_t start) -{ - static char hex[] = "0123456789abcdef"; - u_int w, val; - - DBG(sc, INIT, ("starting")); - rx_flush(sc); - tx_putc(sc, '\r'); - DELAY(1000); - - rx_flush(sc); - - tx_putc(sc, 'g'); - (void)rx_getc(sc); - tx_putc(sc, 'o'); - (void)rx_getc(sc); - tx_putc(sc, ' '); - (void)rx_getc(sc); - - tx_putc(sc, hex[(start >> 12) & 0xf]); - (void)rx_getc(sc); - tx_putc(sc, hex[(start >> 8) & 0xf]); - (void)rx_getc(sc); - tx_putc(sc, hex[(start >> 4) & 0xf]); - (void)rx_getc(sc); - tx_putc(sc, hex[(start >> 0) & 0xf]); - (void)rx_getc(sc); - - tx_putc(sc, '\r'); - rx_flush(sc); - - for (w = 100; w; w--) { - BARRIER_R(sc); - val = READ4(sc, FATMO_BOOT_STATUS); - switch (val) { - case CP_RUNNING: - return (0); - case SELF_TEST_FAIL: - return (EIO); - } - DELAY(1000); - } - return (EIO); -} - -/* - * Initialize one card and host queue. - */ -static void -init_card_queue(struct fatm_softc *sc, struct fqueue *queue, int qlen, - size_t qel_size, size_t desc_size, cardoff_t off, - u_char **statpp, uint32_t *cardstat, u_char *descp, uint32_t carddesc) -{ - struct fqelem *el = queue->chunk; - - while (qlen--) { - el->card = off; - off += 8; /* size of card entry */ - - el->statp = (uint32_t *)(*statpp); - (*statpp) += sizeof(uint32_t); - H_SETSTAT(el->statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, el->statp); - - WRITE4(sc, el->card + FATMOS_STATP, (*cardstat)); - (*cardstat) += sizeof(uint32_t); - - el->ioblk = descp; - descp += desc_size; - el->card_ioblk = carddesc; - carddesc += desc_size; - - el = (struct fqelem *)((u_char *)el + qel_size); - } - queue->tail = queue->head = 0; -} - -/* - * Issue the initialize operation to the card, wait for completion and - * initialize the on-board and host queue structures with offsets and - * addresses. - */ -static int -fatm_init_cmd(struct fatm_softc *sc) -{ - int w, c; - u_char *statp; - uint32_t card_stat; - u_int cnt; - struct fqelem *el; - cardoff_t off; - - DBG(sc, INIT, ("command")); - WRITE4(sc, FATMO_ISTAT, 0); - WRITE4(sc, FATMO_IMASK, 1); - WRITE4(sc, FATMO_HLOGGER, 0); - - WRITE4(sc, FATMO_INIT + FATMOI_RECEIVE_TRESHOLD, 0); - WRITE4(sc, FATMO_INIT + FATMOI_NUM_CONNECT, FORE_MAX_VCC); - WRITE4(sc, FATMO_INIT + FATMOI_CQUEUE_LEN, FATM_CMD_QLEN); - WRITE4(sc, FATMO_INIT + FATMOI_TQUEUE_LEN, FATM_TX_QLEN); - WRITE4(sc, FATMO_INIT + FATMOI_RQUEUE_LEN, FATM_RX_QLEN); - WRITE4(sc, FATMO_INIT + FATMOI_RPD_EXTENSION, RPD_EXTENSIONS); - WRITE4(sc, FATMO_INIT + FATMOI_TPD_EXTENSION, TPD_EXTENSIONS); - - /* - * initialize buffer descriptors - */ - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B1 + FATMOB_QUEUE_LENGTH, - SMALL_SUPPLY_QLEN); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B1 + FATMOB_BUFFER_SIZE, - SMALL_BUFFER_LEN); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B1 + FATMOB_POOL_SIZE, - SMALL_POOL_SIZE); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B1 + FATMOB_SUPPLY_BLKSIZE, - SMALL_SUPPLY_BLKSIZE); - - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B1 + FATMOB_QUEUE_LENGTH, - LARGE_SUPPLY_QLEN); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B1 + FATMOB_BUFFER_SIZE, - LARGE_BUFFER_LEN); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B1 + FATMOB_POOL_SIZE, - LARGE_POOL_SIZE); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B1 + FATMOB_SUPPLY_BLKSIZE, - LARGE_SUPPLY_BLKSIZE); - - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B2 + FATMOB_QUEUE_LENGTH, 0); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B2 + FATMOB_BUFFER_SIZE, 0); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B2 + FATMOB_POOL_SIZE, 0); - WRITE4(sc, FATMO_INIT + FATMOI_SMALL_B2 + FATMOB_SUPPLY_BLKSIZE, 0); - - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B2 + FATMOB_QUEUE_LENGTH, 0); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B2 + FATMOB_BUFFER_SIZE, 0); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B2 + FATMOB_POOL_SIZE, 0); - WRITE4(sc, FATMO_INIT + FATMOI_LARGE_B2 + FATMOB_SUPPLY_BLKSIZE, 0); - - /* - * Start the command - */ - BARRIER_W(sc); - WRITE4(sc, FATMO_INIT + FATMOI_STATUS, FATM_STAT_PENDING); - BARRIER_W(sc); - WRITE4(sc, FATMO_INIT + FATMOI_OP, FATM_OP_INITIALIZE); - BARRIER_W(sc); - - /* - * Busy wait for completion - */ - w = 100; - while (w--) { - c = READ4(sc, FATMO_INIT + FATMOI_STATUS); - BARRIER_R(sc); - if (c & FATM_STAT_COMPLETE) - break; - DELAY(1000); - } - - if (c & FATM_STAT_ERROR) - return (EIO); - - /* - * Initialize the queues - */ - statp = sc->stat_mem.mem; - card_stat = sc->stat_mem.paddr; - - /* - * Command queue. This is special in that it's on the card. - */ - el = sc->cmdqueue.chunk; - off = READ4(sc, FATMO_COMMAND_QUEUE); - DBG(sc, INIT, ("cmd queue=%x", off)); - for (cnt = 0; cnt < FATM_CMD_QLEN; cnt++) { - el = &((struct cmdqueue *)sc->cmdqueue.chunk + cnt)->q; - - el->card = off; - off += 32; /* size of card structure */ - - el->statp = (uint32_t *)statp; - statp += sizeof(uint32_t); - H_SETSTAT(el->statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, el->statp); - - WRITE4(sc, el->card + FATMOC_STATP, card_stat); - card_stat += sizeof(uint32_t); - } - sc->cmdqueue.tail = sc->cmdqueue.head = 0; - - /* - * Now the other queues. These are in memory - */ - init_card_queue(sc, &sc->txqueue, FATM_TX_QLEN, - sizeof(struct txqueue), TPD_SIZE, - READ4(sc, FATMO_TRANSMIT_QUEUE), - &statp, &card_stat, sc->txq_mem.mem, sc->txq_mem.paddr); - - init_card_queue(sc, &sc->rxqueue, FATM_RX_QLEN, - sizeof(struct rxqueue), RPD_SIZE, - READ4(sc, FATMO_RECEIVE_QUEUE), - &statp, &card_stat, sc->rxq_mem.mem, sc->rxq_mem.paddr); - - init_card_queue(sc, &sc->s1queue, SMALL_SUPPLY_QLEN, - sizeof(struct supqueue), BSUP_BLK2SIZE(SMALL_SUPPLY_BLKSIZE), - READ4(sc, FATMO_SMALL_B1_QUEUE), - &statp, &card_stat, sc->s1q_mem.mem, sc->s1q_mem.paddr); - - init_card_queue(sc, &sc->l1queue, LARGE_SUPPLY_QLEN, - sizeof(struct supqueue), BSUP_BLK2SIZE(LARGE_SUPPLY_BLKSIZE), - READ4(sc, FATMO_LARGE_B1_QUEUE), - &statp, &card_stat, sc->l1q_mem.mem, sc->l1q_mem.paddr); - - sc->txcnt = 0; - - return (0); -} - -/* - * Read PROM. Called only from attach code. Here we spin because the interrupt - * handler is not yet set up. - */ -static int -fatm_getprom(struct fatm_softc *sc) -{ - int i; - struct prom *prom; - struct cmdqueue *q; - - DBG(sc, INIT, ("reading prom")); - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.head); - NEXT_QUEUE_ENTRY(sc->cmdqueue.head, FATM_CMD_QLEN); - - q->error = 0; - q->cb = NULL; - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - bus_dmamap_sync(sc->prom_mem.dmat, sc->prom_mem.map, - BUS_DMASYNC_PREREAD); - - WRITE4(sc, q->q.card + FATMOC_GPROM_BUF, sc->prom_mem.paddr); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_OP, FATM_OP_GET_PROM_DATA); - BARRIER_W(sc); - - for (i = 0; i < 1000; i++) { - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & - (FATM_STAT_COMPLETE | FATM_STAT_ERROR)) - break; - DELAY(1000); - } - if (i == 1000) { - if_printf(sc->ifp, "getprom timeout\n"); - return (EIO); - } - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - if_printf(sc->ifp, "getprom error\n"); - return (EIO); - } - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - NEXT_QUEUE_ENTRY(sc->cmdqueue.tail, FATM_CMD_QLEN); - - bus_dmamap_sync(sc->prom_mem.dmat, sc->prom_mem.map, - BUS_DMASYNC_POSTREAD); - - -#ifdef notdef - { - u_int i; - - printf("PROM: "); - u_char *ptr = (u_char *)sc->prom_mem.mem; - for (i = 0; i < sizeof(struct prom); i++) - printf("%02x ", *ptr++); - printf("\n"); - } -#endif - - prom = (struct prom *)sc->prom_mem.mem; - - bcopy(prom->mac + 2, IFP2IFATM(sc->ifp)->mib.esi, 6); - IFP2IFATM(sc->ifp)->mib.serial = le32toh(prom->serial); - IFP2IFATM(sc->ifp)->mib.hw_version = le32toh(prom->version); - IFP2IFATM(sc->ifp)->mib.sw_version = READ4(sc, FATMO_FIRMWARE_RELEASE); - - if_printf(sc->ifp, "ESI=%02x:%02x:%02x:%02x:%02x:%02x " - "serial=%u hw=0x%x sw=0x%x\n", IFP2IFATM(sc->ifp)->mib.esi[0], - IFP2IFATM(sc->ifp)->mib.esi[1], IFP2IFATM(sc->ifp)->mib.esi[2], IFP2IFATM(sc->ifp)->mib.esi[3], - IFP2IFATM(sc->ifp)->mib.esi[4], IFP2IFATM(sc->ifp)->mib.esi[5], IFP2IFATM(sc->ifp)->mib.serial, - IFP2IFATM(sc->ifp)->mib.hw_version, IFP2IFATM(sc->ifp)->mib.sw_version); - - return (0); -} - -/* - * This is the callback function for bus_dmamap_load. We assume, that we - * have a 32-bit bus and so have always one segment. - */ -static void -dmaload_helper(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - bus_addr_t *ptr = (bus_addr_t *)arg; - - if (error != 0) { - printf("%s: error=%d\n", __func__, error); - return; - } - KASSERT(nsegs == 1, ("too many DMA segments")); - KASSERT(segs[0].ds_addr <= 0xffffffff, ("DMA address too large %lx", - (u_long)segs[0].ds_addr)); - - *ptr = segs[0].ds_addr; -} - -/* - * Allocate a chunk of DMA-able memory and map it. - */ -static int -alloc_dma_memory(struct fatm_softc *sc, const char *nm, struct fatm_mem *mem) -{ - int error; - - mem->mem = NULL; - - if (bus_dma_tag_create(sc->parent_dmat, mem->align, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, mem->size, 1, BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &mem->dmat)) { - if_printf(sc->ifp, "could not allocate %s DMA tag\n", - nm); - return (ENOMEM); - } - - error = bus_dmamem_alloc(mem->dmat, &mem->mem, 0, &mem->map); - if (error) { - if_printf(sc->ifp, "could not allocate %s DMA memory: " - "%d\n", nm, error); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - return (error); - } - - error = bus_dmamap_load(mem->dmat, mem->map, mem->mem, mem->size, - dmaload_helper, &mem->paddr, BUS_DMA_NOWAIT); - if (error) { - if_printf(sc->ifp, "could not load %s DMA memory: " - "%d\n", nm, error); - bus_dmamem_free(mem->dmat, mem->mem, mem->map); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - return (error); - } - - DBG(sc, DMA, ("DMA %s V/P/S/Z %p/%lx/%x/%x", nm, mem->mem, - (u_long)mem->paddr, mem->size, mem->align)); - - return (0); -} - -#ifdef TEST_DMA_SYNC -static int -alloc_dma_memoryX(struct fatm_softc *sc, const char *nm, struct fatm_mem *mem) -{ - int error; - - mem->mem = NULL; - - if (bus_dma_tag_create(NULL, mem->align, 0, - BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, - NULL, NULL, mem->size, 1, mem->size, - BUS_DMA_ALLOCNOW, NULL, NULL, &mem->dmat)) { - if_printf(sc->ifp, "could not allocate %s DMA tag\n", - nm); - return (ENOMEM); - } - - mem->mem = contigmalloc(mem->size, M_DEVBUF, M_WAITOK, - BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR_32BIT, mem->align, 0); - - error = bus_dmamap_create(mem->dmat, 0, &mem->map); - if (error) { - if_printf(sc->ifp, "could not allocate %s DMA map: " - "%d\n", nm, error); - contigfree(mem->mem, mem->size, M_DEVBUF); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - return (error); - } - - error = bus_dmamap_load(mem->dmat, mem->map, mem->mem, mem->size, - dmaload_helper, &mem->paddr, BUS_DMA_NOWAIT); - if (error) { - if_printf(sc->ifp, "could not load %s DMA memory: " - "%d\n", nm, error); - bus_dmamap_destroy(mem->dmat, mem->map); - contigfree(mem->mem, mem->size, M_DEVBUF); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - return (error); - } - - DBG(sc, DMA, ("DMAX %s V/P/S/Z %p/%lx/%x/%x", nm, mem->mem, - (u_long)mem->paddr, mem->size, mem->align)); - - printf("DMAX: %s V/P/S/Z %p/%lx/%x/%x", nm, mem->mem, - (u_long)mem->paddr, mem->size, mem->align); - - return (0); -} -#endif /* TEST_DMA_SYNC */ - -/* - * Destroy all resources of an dma-able memory chunk - */ -static void -destroy_dma_memory(struct fatm_mem *mem) -{ - if (mem->mem != NULL) { - bus_dmamap_unload(mem->dmat, mem->map); - bus_dmamem_free(mem->dmat, mem->mem, mem->map); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - } -} -#ifdef TEST_DMA_SYNC -static void -destroy_dma_memoryX(struct fatm_mem *mem) -{ - if (mem->mem != NULL) { - bus_dmamap_unload(mem->dmat, mem->map); - bus_dmamap_destroy(mem->dmat, mem->map); - contigfree(mem->mem, mem->size, M_DEVBUF); - bus_dma_tag_destroy(mem->dmat); - mem->mem = NULL; - } -} -#endif /* TEST_DMA_SYNC */ - -/* - * Try to supply buffers to the card if there are free entries in the queues - */ -static void -fatm_supply_small_buffers(struct fatm_softc *sc) -{ - int nblocks, nbufs; - struct supqueue *q; - struct rbd *bd; - int i, j, error, cnt; - struct mbuf *m; - struct rbuf *rb; - bus_addr_t phys; - - nbufs = max(4 * sc->open_vccs, 32); - nbufs = min(nbufs, SMALL_POOL_SIZE); - nbufs -= sc->small_cnt; - - nblocks = howmany(nbufs, SMALL_SUPPLY_BLKSIZE); - for (cnt = 0; cnt < nblocks; cnt++) { - q = GET_QUEUE(sc->s1queue, struct supqueue, sc->s1queue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) != FATM_STAT_FREE) - break; - - bd = (struct rbd *)q->q.ioblk; - - for (i = 0; i < SMALL_SUPPLY_BLKSIZE; i++) { - if ((rb = LIST_FIRST(&sc->rbuf_free)) == NULL) { - if_printf(sc->ifp, "out of rbufs\n"); - break; - } - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == NULL) { - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - break; - } - M_ALIGN(m, SMALL_BUFFER_LEN); - error = bus_dmamap_load(sc->rbuf_tag, rb->map, - m->m_data, SMALL_BUFFER_LEN, dmaload_helper, - &phys, BUS_DMA_NOWAIT); - if (error) { - if_printf(sc->ifp, - "dmamap_load mbuf failed %d", error); - m_freem(m); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - break; - } - bus_dmamap_sync(sc->rbuf_tag, rb->map, - BUS_DMASYNC_PREREAD); - - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_used, rb, link); - - rb->m = m; - bd[i].handle = rb - sc->rbufs; - H_SETDESC(bd[i].buffer, phys); - } - - if (i < SMALL_SUPPLY_BLKSIZE) { - for (j = 0; j < i; j++) { - rb = sc->rbufs + bd[j].handle; - bus_dmamap_unload(sc->rbuf_tag, rb->map); - m_free(rb->m); - rb->m = NULL; - - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - } - break; - } - H_SYNCQ_PREWRITE(&sc->s1q_mem, bd, - sizeof(struct rbd) * SMALL_SUPPLY_BLKSIZE); - - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - WRITE4(sc, q->q.card, q->q.card_ioblk); - BARRIER_W(sc); - - sc->small_cnt += SMALL_SUPPLY_BLKSIZE; - - NEXT_QUEUE_ENTRY(sc->s1queue.head, SMALL_SUPPLY_QLEN); - } -} - -/* - * Try to supply buffers to the card if there are free entries in the queues - * We assume that all buffers are within the address space accessible by the - * card (32-bit), so we don't need bounce buffers. - */ -static void -fatm_supply_large_buffers(struct fatm_softc *sc) -{ - int nbufs, nblocks, cnt; - struct supqueue *q; - struct rbd *bd; - int i, j, error; - struct mbuf *m; - struct rbuf *rb; - bus_addr_t phys; - - nbufs = max(4 * sc->open_vccs, 32); - nbufs = min(nbufs, LARGE_POOL_SIZE); - nbufs -= sc->large_cnt; - - nblocks = howmany(nbufs, LARGE_SUPPLY_BLKSIZE); - - for (cnt = 0; cnt < nblocks; cnt++) { - q = GET_QUEUE(sc->l1queue, struct supqueue, sc->l1queue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) != FATM_STAT_FREE) - break; - - bd = (struct rbd *)q->q.ioblk; - - for (i = 0; i < LARGE_SUPPLY_BLKSIZE; i++) { - if ((rb = LIST_FIRST(&sc->rbuf_free)) == NULL) { - if_printf(sc->ifp, "out of rbufs\n"); - break; - } - if ((m = m_getcl(M_NOWAIT, MT_DATA, - M_PKTHDR)) == NULL) { - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - break; - } - /* No MEXT_ALIGN */ - m->m_data += MCLBYTES - LARGE_BUFFER_LEN; - error = bus_dmamap_load(sc->rbuf_tag, rb->map, - m->m_data, LARGE_BUFFER_LEN, dmaload_helper, - &phys, BUS_DMA_NOWAIT); - if (error) { - if_printf(sc->ifp, - "dmamap_load mbuf failed %d", error); - m_freem(m); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - break; - } - - bus_dmamap_sync(sc->rbuf_tag, rb->map, - BUS_DMASYNC_PREREAD); - - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_used, rb, link); - - rb->m = m; - bd[i].handle = rb - sc->rbufs; - H_SETDESC(bd[i].buffer, phys); - } - - if (i < LARGE_SUPPLY_BLKSIZE) { - for (j = 0; j < i; j++) { - rb = sc->rbufs + bd[j].handle; - bus_dmamap_unload(sc->rbuf_tag, rb->map); - m_free(rb->m); - rb->m = NULL; - - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - } - break; - } - H_SYNCQ_PREWRITE(&sc->l1q_mem, bd, - sizeof(struct rbd) * LARGE_SUPPLY_BLKSIZE); - - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - WRITE4(sc, q->q.card, q->q.card_ioblk); - BARRIER_W(sc); - - sc->large_cnt += LARGE_SUPPLY_BLKSIZE; - - NEXT_QUEUE_ENTRY(sc->l1queue.head, LARGE_SUPPLY_QLEN); - } -} - - -/* - * Actually start the card. The lock must be held here. - * Reset, load the firmware, start it, initializes queues, read the PROM - * and supply receive buffers to the card. - */ -static void -fatm_init_locked(struct fatm_softc *sc) -{ - struct rxqueue *q; - int i, c, error; - uint32_t start; - - DBG(sc, INIT, ("initialize")); - if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) - fatm_stop(sc); - - /* - * Hard reset the board - */ - if (fatm_reset(sc)) - return; - - start = firmware_load(sc); - if (fatm_start_firmware(sc, start) || fatm_init_cmd(sc) || - fatm_getprom(sc)) { - fatm_reset(sc); - return; - } - - /* - * Handle media - */ - c = READ4(sc, FATMO_MEDIA_TYPE); - switch (c) { - - case FORE_MT_TAXI_100: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_TAXI_100; - IFP2IFATM(sc->ifp)->mib.pcr = 227273; - break; - - case FORE_MT_TAXI_140: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_TAXI_140; - IFP2IFATM(sc->ifp)->mib.pcr = 318181; - break; - - case FORE_MT_UTP_SONET: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UTP_155; - IFP2IFATM(sc->ifp)->mib.pcr = 353207; - break; - - case FORE_MT_MM_OC3_ST: - case FORE_MT_MM_OC3_SC: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_155; - IFP2IFATM(sc->ifp)->mib.pcr = 353207; - break; - - case FORE_MT_SM_OC3_ST: - case FORE_MT_SM_OC3_SC: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_SM_155; - IFP2IFATM(sc->ifp)->mib.pcr = 353207; - break; - - default: - log(LOG_ERR, "fatm: unknown media type %d\n", c); - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UNKNOWN; - IFP2IFATM(sc->ifp)->mib.pcr = 353207; - break; - } - sc->ifp->if_baudrate = 53 * 8 * IFP2IFATM(sc->ifp)->mib.pcr; - utopia_init_media(&sc->utopia); - - /* - * Initialize the RBDs - */ - for (i = 0; i < FATM_RX_QLEN; i++) { - q = GET_QUEUE(sc->rxqueue, struct rxqueue, i); - WRITE4(sc, q->q.card + 0, q->q.card_ioblk); - } - BARRIER_W(sc); - - /* - * Supply buffers to the card - */ - fatm_supply_small_buffers(sc); - fatm_supply_large_buffers(sc); - - /* - * Now set flags, that we are ready - */ - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; - - /* - * Start the watchdog timer - */ - callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc); - - /* start SUNI */ - utopia_start(&sc->utopia); - - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); - - /* start all channels */ - for (i = 0; i < FORE_MAX_VCC + 1; i++) - if (sc->vccs[i] != NULL) { - sc->vccs[i]->vflags |= FATM_VCC_REOPEN; - error = fatm_load_vc(sc, sc->vccs[i]); - if (error != 0) { - if_printf(sc->ifp, "reopening %u " - "failed: %d\n", i, error); - sc->vccs[i]->vflags &= ~FATM_VCC_REOPEN; - } - } - - DBG(sc, INIT, ("done")); -} - -/* - * This is the exported as initialisation function. - */ -static void -fatm_init(void *p) -{ - struct fatm_softc *sc = p; - - FATM_LOCK(sc); - fatm_init_locked(sc); - FATM_UNLOCK(sc); -} - -/************************************************************/ -/* - * The INTERRUPT handling - */ -/* - * Check the command queue. If a command was completed, call the completion - * function for that command. - */ -static void -fatm_intr_drain_cmd(struct fatm_softc *sc) -{ - struct cmdqueue *q; - int stat; - - /* - * Drain command queue - */ - for (;;) { - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.tail); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - stat = H_GETSTAT(q->q.statp); - - if (stat != FATM_STAT_COMPLETE && - stat != (FATM_STAT_COMPLETE | FATM_STAT_ERROR) && - stat != FATM_STAT_ERROR) - break; - - (*q->cb)(sc, q); - - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - NEXT_QUEUE_ENTRY(sc->cmdqueue.tail, FATM_CMD_QLEN); - } -} - -/* - * Drain the small buffer supply queue. - */ -static void -fatm_intr_drain_small_buffers(struct fatm_softc *sc) -{ - struct supqueue *q; - int stat; - - for (;;) { - q = GET_QUEUE(sc->s1queue, struct supqueue, sc->s1queue.tail); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - stat = H_GETSTAT(q->q.statp); - - if ((stat & FATM_STAT_COMPLETE) == 0) - break; - if (stat & FATM_STAT_ERROR) - log(LOG_ERR, "%s: status %x\n", __func__, stat); - - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - NEXT_QUEUE_ENTRY(sc->s1queue.tail, SMALL_SUPPLY_QLEN); - } -} - -/* - * Drain the large buffer supply queue. - */ -static void -fatm_intr_drain_large_buffers(struct fatm_softc *sc) -{ - struct supqueue *q; - int stat; - - for (;;) { - q = GET_QUEUE(sc->l1queue, struct supqueue, sc->l1queue.tail); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - stat = H_GETSTAT(q->q.statp); - - if ((stat & FATM_STAT_COMPLETE) == 0) - break; - if (stat & FATM_STAT_ERROR) - log(LOG_ERR, "%s status %x\n", __func__, stat); - - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - NEXT_QUEUE_ENTRY(sc->l1queue.tail, LARGE_SUPPLY_QLEN); - } -} - -/* - * Check the receive queue. Send any received PDU up the protocol stack - * (except when there was an error or the VCI appears to be closed. In this - * case discard the PDU). - */ -static void -fatm_intr_drain_rx(struct fatm_softc *sc) -{ - struct rxqueue *q; - int stat, mlen; - u_int i; - uint32_t h; - struct mbuf *last, *m0; - struct rpd *rpd; - struct rbuf *rb; - u_int vci, vpi, pt; - struct atm_pseudohdr aph; - struct ifnet *ifp; - struct card_vcc *vc; - - for (;;) { - q = GET_QUEUE(sc->rxqueue, struct rxqueue, sc->rxqueue.tail); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - stat = H_GETSTAT(q->q.statp); - - if ((stat & FATM_STAT_COMPLETE) == 0) - break; - - rpd = (struct rpd *)q->q.ioblk; - H_SYNCQ_POSTREAD(&sc->rxq_mem, rpd, RPD_SIZE); - - rpd->nseg = le32toh(rpd->nseg); - mlen = 0; - m0 = last = NULL; - for (i = 0; i < rpd->nseg; i++) { - rb = sc->rbufs + rpd->segment[i].handle; - if (m0 == NULL) { - m0 = last = rb->m; - } else { - last->m_next = rb->m; - last = rb->m; - } - last->m_next = NULL; - if (last->m_flags & M_EXT) - sc->large_cnt--; - else - sc->small_cnt--; - bus_dmamap_sync(sc->rbuf_tag, rb->map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->rbuf_tag, rb->map); - rb->m = NULL; - - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - - last->m_len = le32toh(rpd->segment[i].length); - mlen += last->m_len; - } - - m0->m_pkthdr.len = mlen; - m0->m_pkthdr.rcvif = sc->ifp; - - h = le32toh(rpd->atm_header); - vpi = (h >> 20) & 0xff; - vci = (h >> 4 ) & 0xffff; - pt = (h >> 1 ) & 0x7; - - /* - * Locate the VCC this packet belongs to - */ - if (!VC_OK(sc, vpi, vci)) - vc = NULL; - else if ((vc = sc->vccs[vci]) == NULL || - !(sc->vccs[vci]->vflags & FATM_VCC_OPEN)) { - sc->istats.rx_closed++; - vc = NULL; - } - - DBG(sc, RCV, ("RCV: vc=%u.%u pt=%u mlen=%d %s", vpi, vci, - pt, mlen, vc == NULL ? "dropped" : "")); - - if (vc == NULL) { - m_freem(m0); - } else { -#ifdef ENABLE_BPF - if (!(vc->param.flags & ATMIO_FLAG_NG) && - vc->param.aal == ATMIO_AAL_5 && - (vc->param.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(sc->ifp, m0); -#endif - - ATM_PH_FLAGS(&aph) = vc->param.flags; - ATM_PH_VPI(&aph) = vpi; - ATM_PH_SETVCI(&aph, vci); - - ifp = sc->ifp; - if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - - vc->ipackets++; - vc->ibytes += m0->m_pkthdr.len; - - atm_input(ifp, &aph, m0, vc->rxhand); - } - - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - WRITE4(sc, q->q.card, q->q.card_ioblk); - BARRIER_W(sc); - - NEXT_QUEUE_ENTRY(sc->rxqueue.tail, FATM_RX_QLEN); - } -} - -/* - * Check the transmit queue. Free the mbuf chains that we were transmitting. - */ -static void -fatm_intr_drain_tx(struct fatm_softc *sc) -{ - struct txqueue *q; - int stat; - - /* - * Drain tx queue - */ - for (;;) { - q = GET_QUEUE(sc->txqueue, struct txqueue, sc->txqueue.tail); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - stat = H_GETSTAT(q->q.statp); - - if (stat != FATM_STAT_COMPLETE && - stat != (FATM_STAT_COMPLETE | FATM_STAT_ERROR) && - stat != FATM_STAT_ERROR) - break; - - H_SETSTAT(q->q.statp, FATM_STAT_FREE); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - bus_dmamap_sync(sc->tx_tag, q->map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->tx_tag, q->map); - - m_freem(q->m); - q->m = NULL; - sc->txcnt--; - - NEXT_QUEUE_ENTRY(sc->txqueue.tail, FATM_TX_QLEN); - } -} - -/* - * Interrupt handler - */ -static void -fatm_intr(void *p) -{ - struct fatm_softc *sc = (struct fatm_softc *)p; - - FATM_LOCK(sc); - if (!READ4(sc, FATMO_PSR)) { - FATM_UNLOCK(sc); - return; - } - WRITE4(sc, FATMO_HCR, FATM_HCR_CLRIRQ); - - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - FATM_UNLOCK(sc); - return; - } - fatm_intr_drain_cmd(sc); - fatm_intr_drain_rx(sc); - fatm_intr_drain_tx(sc); - fatm_intr_drain_small_buffers(sc); - fatm_intr_drain_large_buffers(sc); - fatm_supply_small_buffers(sc); - fatm_supply_large_buffers(sc); - - FATM_UNLOCK(sc); - - if (sc->retry_tx && _IF_QLEN(&sc->ifp->if_snd)) - (*sc->ifp->if_start)(sc->ifp); -} - -/* - * Get device statistics. This must be called with the softc locked. - * We use a preallocated buffer, so we need to protect this buffer. - * We do this by using a condition variable and a flag. If the flag is set - * the buffer is in use by one thread (one thread is executing a GETSTAT - * card command). In this case all other threads that are trying to get - * statistics block on that condition variable. When the thread finishes - * using the buffer it resets the flag and signals the condition variable. This - * will wakeup the next thread that is waiting for the buffer. If the interface - * is stopped the stopping function will broadcast the cv. All threads will - * find that the interface has been stopped and return. - * - * Acquiring of the buffer is done by the fatm_getstat() function. The freeing - * must be done by the caller when he has finished using the buffer. - */ -static void -fatm_getstat_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.get_stat_errors++; - q->error = EIO; - } - wakeup(&sc->sadi_mem); -} -static int -fatm_getstat(struct fatm_softc *sc) -{ - int error; - struct cmdqueue *q; - - /* - * Wait until either the interface is stopped or we can get the - * statistics buffer - */ - for (;;) { - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return (EIO); - if (!(sc->flags & FATM_STAT_INUSE)) - break; - cv_wait(&sc->cv_stat, &sc->mtx); - } - sc->flags |= FATM_STAT_INUSE; - - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (!(H_GETSTAT(q->q.statp) & FATM_STAT_FREE)) { - sc->istats.cmd_queue_full++; - return (EIO); - } - NEXT_QUEUE_ENTRY(sc->cmdqueue.head, FATM_CMD_QLEN); - - q->error = 0; - q->cb = fatm_getstat_complete; - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - bus_dmamap_sync(sc->sadi_mem.dmat, sc->sadi_mem.map, - BUS_DMASYNC_PREREAD); - - WRITE4(sc, q->q.card + FATMOC_GSTAT_BUF, - sc->sadi_mem.paddr); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_OP, - FATM_OP_REQUEST_STATS | FATM_OP_INTERRUPT_SEL); - BARRIER_W(sc); - - /* - * Wait for the command to complete - */ - error = msleep(&sc->sadi_mem, &sc->mtx, PZERO | PCATCH, - "fatm_stat", hz); - - switch (error) { - - case EWOULDBLOCK: - error = EIO; - break; - - case ERESTART: - error = EINTR; - break; - - case 0: - bus_dmamap_sync(sc->sadi_mem.dmat, sc->sadi_mem.map, - BUS_DMASYNC_POSTREAD); - error = q->error; - break; - } - - /* - * Swap statistics - */ - if (q->error == 0) { - u_int i; - uint32_t *p = (uint32_t *)sc->sadi_mem.mem; - - for (i = 0; i < sizeof(struct fatm_stats) / sizeof(uint32_t); - i++, p++) - *p = be32toh(*p); - } - - return (error); -} - -/* - * Create a copy of a single mbuf. It can have either internal or - * external data, it may have a packet header. External data is really - * copied, so the new buffer is writeable. - */ -static struct mbuf * -copy_mbuf(struct mbuf *m) -{ - struct mbuf *new; - - MGET(new, M_NOWAIT, MT_DATA); - if (new == NULL) - return (NULL); - - if (m->m_flags & M_PKTHDR) { - M_MOVE_PKTHDR(new, m); - if (m->m_len > MHLEN) - MCLGET(new, M_WAITOK); - } else { - if (m->m_len > MLEN) - MCLGET(new, M_WAITOK); - } - - bcopy(m->m_data, new->m_data, m->m_len); - new->m_len = m->m_len; - new->m_flags &= ~M_RDONLY; - - return (new); -} - -/* - * All segments must have a four byte aligned buffer address and a four - * byte aligned length. Step through an mbuf chain and check these conditions. - * If the buffer address is not aligned and this is a normal mbuf, move - * the data down. Else make a copy of the mbuf with aligned data. - * If the buffer length is not aligned steel data from the next mbuf. - * We don't need to check whether this has more than one external reference, - * because steeling data doesn't change the external cluster. - * If the last mbuf is not aligned, fill with zeroes. - * - * Return packet length (well we should have this in the packet header), - * but be careful not to count the zero fill at the end. - * - * If fixing fails free the chain and zero the pointer. - * - * We assume, that aligning the virtual address also aligns the mapped bus - * address. - */ -static u_int -fatm_fix_chain(struct fatm_softc *sc, struct mbuf **mp) -{ - struct mbuf *m = *mp, *prev = NULL, *next, *new; - u_int mlen = 0, fill = 0; - int first, off; - u_char *d, *cp; - - do { - next = m->m_next; - - if ((uintptr_t)mtod(m, void *) % 4 != 0 || - (m->m_len % 4 != 0 && next)) { - /* - * Needs fixing - */ - first = (m == *mp); - - d = mtod(m, u_char *); - if ((off = (uintptr_t)(void *)d % 4) != 0) { - if (M_WRITABLE(m)) { - sc->istats.fix_addr_copy++; - bcopy(d, d - off, m->m_len); - m->m_data = (caddr_t)(d - off); - } else { - if ((new = copy_mbuf(m)) == NULL) { - sc->istats.fix_addr_noext++; - goto fail; - } - sc->istats.fix_addr_ext++; - if (prev) - prev->m_next = new; - new->m_next = next; - m_free(m); - m = new; - } - } - - if ((off = m->m_len % 4) != 0) { - if (!M_WRITABLE(m)) { - if ((new = copy_mbuf(m)) == NULL) { - sc->istats.fix_len_noext++; - goto fail; - } - sc->istats.fix_len_copy++; - if (prev) - prev->m_next = new; - new->m_next = next; - m_free(m); - m = new; - } else - sc->istats.fix_len++; - d = mtod(m, u_char *) + m->m_len; - off = 4 - off; - while (off) { - if (next == NULL) { - *d++ = 0; - fill++; - } else if (next->m_len == 0) { - sc->istats.fix_empty++; - next = m_free(next); - continue; - } else { - cp = mtod(next, u_char *); - *d++ = *cp++; - next->m_len--; - next->m_data = (caddr_t)cp; - } - off--; - m->m_len++; - } - } - - if (first) - *mp = m; - } - - mlen += m->m_len; - prev = m; - } while ((m = next) != NULL); - - return (mlen - fill); - - fail: - m_freem(*mp); - *mp = NULL; - return (0); -} - -/* - * The helper function is used to load the computed physical addresses - * into the transmit descriptor. - */ -static void -fatm_tpd_load(void *varg, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsize, int error) -{ - struct tpd *tpd = varg; - - if (error) - return; - - KASSERT(nsegs <= TPD_EXTENSIONS + TXD_FIXED, ("too many segments")); - - tpd->spec = 0; - while (nsegs--) { - H_SETDESC(tpd->segment[tpd->spec].buffer, segs->ds_addr); - H_SETDESC(tpd->segment[tpd->spec].length, segs->ds_len); - tpd->spec++; - segs++; - } -} - -/* - * Start output. - * - * Note, that we update the internal statistics without the lock here. - */ -static int -fatm_tx(struct fatm_softc *sc, struct mbuf *m, struct card_vcc *vc, u_int mlen) -{ - struct txqueue *q; - u_int nblks; - int error, aal, nsegs; - struct tpd *tpd; - - /* - * Get a queue element. - * If there isn't one - try to drain the transmit queue - * We used to sleep here if that doesn't help, but we - * should not sleep here, because we are called with locks. - */ - q = GET_QUEUE(sc->txqueue, struct txqueue, sc->txqueue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) != FATM_STAT_FREE) { - fatm_intr_drain_tx(sc); - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) != FATM_STAT_FREE) { - if (sc->retry_tx) { - sc->istats.tx_retry++; - IF_PREPEND(&sc->ifp->if_snd, m); - return (1); - } - sc->istats.tx_queue_full++; - m_freem(m); - return (0); - } - sc->istats.tx_queue_almost_full++; - } - - tpd = q->q.ioblk; - - m->m_data += sizeof(struct atm_pseudohdr); - m->m_len -= sizeof(struct atm_pseudohdr); - -#ifdef ENABLE_BPF - if (!(vc->param.flags & ATMIO_FLAG_NG) && - vc->param.aal == ATMIO_AAL_5 && - (vc->param.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(sc->ifp, m); -#endif - - /* map the mbuf */ - error = bus_dmamap_load_mbuf(sc->tx_tag, q->map, m, - fatm_tpd_load, tpd, BUS_DMA_NOWAIT); - if(error) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - if_printf(sc->ifp, "mbuf loaded error=%d\n", error); - m_freem(m); - return (0); - } - nsegs = tpd->spec; - - bus_dmamap_sync(sc->tx_tag, q->map, BUS_DMASYNC_PREWRITE); - - /* - * OK. Now go and do it. - */ - aal = (vc->param.aal == ATMIO_AAL_5) ? 5 : 0; - - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - q->m = m; - - /* - * If the transmit queue is almost full, schedule a - * transmit interrupt so that transmit descriptors can - * be recycled. - */ - H_SETDESC(tpd->spec, TDX_MKSPEC((sc->txcnt >= - (4 * FATM_TX_QLEN) / 5), aal, nsegs, mlen)); - H_SETDESC(tpd->atm_header, TDX_MKHDR(vc->param.vpi, - vc->param.vci, 0, 0)); - - if (vc->param.traffic == ATMIO_TRAFFIC_UBR) - H_SETDESC(tpd->stream, 0); - else { - u_int i; - - for (i = 0; i < RATE_TABLE_SIZE; i++) - if (rate_table[i].cell_rate < vc->param.tparam.pcr) - break; - if (i > 0) - i--; - H_SETDESC(tpd->stream, rate_table[i].ratio); - } - H_SYNCQ_PREWRITE(&sc->txq_mem, tpd, TPD_SIZE); - - nblks = TDX_SEGS2BLKS(nsegs); - - DBG(sc, XMIT, ("XMIT: mlen=%d spec=0x%x nsegs=%d blocks=%d", - mlen, le32toh(tpd->spec), nsegs, nblks)); - - WRITE4(sc, q->q.card + 0, q->q.card_ioblk | nblks); - BARRIER_W(sc); - - sc->txcnt++; - if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); - vc->obytes += m->m_pkthdr.len; - vc->opackets++; - - NEXT_QUEUE_ENTRY(sc->txqueue.head, FATM_TX_QLEN); - - return (0); -} - -static void -fatm_start(struct ifnet *ifp) -{ - struct atm_pseudohdr aph; - struct fatm_softc *sc; - struct mbuf *m; - u_int mlen, vpi, vci; - struct card_vcc *vc; - - sc = ifp->if_softc; - - while (1) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - - /* - * Loop through the mbuf chain and compute the total length - * of the packet. Check that all data pointer are - * 4 byte aligned. If they are not, call fatm_mfix to - * fix that problem. This comes more or less from the - * en driver. - */ - mlen = fatm_fix_chain(sc, &m); - if (m == NULL) - continue; - - if (m->m_len < sizeof(struct atm_pseudohdr) && - (m = m_pullup(m, sizeof(struct atm_pseudohdr))) == NULL) - continue; - - aph = *mtod(m, struct atm_pseudohdr *); - mlen -= sizeof(struct atm_pseudohdr); - - if (mlen == 0) { - m_freem(m); - continue; - } - if (mlen > FATM_MAXPDU) { - sc->istats.tx_pdu2big++; - m_freem(m); - continue; - } - - vci = ATM_PH_VCI(&aph); - vpi = ATM_PH_VPI(&aph); - - /* - * From here on we need the softc - */ - FATM_LOCK(sc); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - FATM_UNLOCK(sc); - m_freem(m); - break; - } - if (!VC_OK(sc, vpi, vci) || (vc = sc->vccs[vci]) == NULL || - !(vc->vflags & FATM_VCC_OPEN)) { - FATM_UNLOCK(sc); - m_freem(m); - continue; - } - if (fatm_tx(sc, m, vc, mlen)) { - FATM_UNLOCK(sc); - break; - } - FATM_UNLOCK(sc); - } -} - -/* - * VCC management - * - * This may seem complicated. The reason for this is, that we need an - * asynchronuous open/close for the NATM VCCs because our ioctl handler - * is called with the radix node head of the routing table locked. Therefor - * we cannot sleep there and wait for the open/close to succeed. For this - * reason we just initiate the operation from the ioctl. - */ - -/* - * Command the card to open/close a VC. - * Return the queue entry for waiting if we are successful. - */ -static struct cmdqueue * -fatm_start_vcc(struct fatm_softc *sc, u_int vpi, u_int vci, uint32_t cmd, - u_int mtu, void (*func)(struct fatm_softc *, struct cmdqueue *)) -{ - struct cmdqueue *q; - - q = GET_QUEUE(sc->cmdqueue, struct cmdqueue, sc->cmdqueue.head); - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (!(H_GETSTAT(q->q.statp) & FATM_STAT_FREE)) { - sc->istats.cmd_queue_full++; - return (NULL); - } - NEXT_QUEUE_ENTRY(sc->cmdqueue.head, FATM_CMD_QLEN); - - q->error = 0; - q->cb = func; - H_SETSTAT(q->q.statp, FATM_STAT_PENDING); - H_SYNCSTAT_PREWRITE(sc, q->q.statp); - - WRITE4(sc, q->q.card + FATMOC_ACTIN_VPVC, MKVPVC(vpi, vci)); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_ACTIN_MTU, mtu); - BARRIER_W(sc); - WRITE4(sc, q->q.card + FATMOC_OP, cmd); - BARRIER_W(sc); - - return (q); -} - -/* - * The VC has been opened/closed and somebody has been waiting for this. - * Wake him up. - */ -static void -fatm_cmd_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.get_stat_errors++; - q->error = EIO; - } - wakeup(q); -} - -/* - * Open complete - */ -static void -fatm_open_finish(struct fatm_softc *sc, struct card_vcc *vc) -{ - vc->vflags &= ~FATM_VCC_TRY_OPEN; - vc->vflags |= FATM_VCC_OPEN; - - if (vc->vflags & FATM_VCC_REOPEN) { - vc->vflags &= ~FATM_VCC_REOPEN; - return; - } - - /* inform management if this is not an NG - * VCC or it's an NG PVC. */ - if (!(vc->param.flags & ATMIO_FLAG_NG) || - (vc->param.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), 0, vc->param.vci, 1); -} - -/* - * The VC that we have tried to open asynchronuosly has been opened. - */ -static void -fatm_open_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - u_int vci; - struct card_vcc *vc; - - vci = GETVCI(READ4(sc, q->q.card + FATMOC_ACTIN_VPVC)); - vc = sc->vccs[vci]; - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.get_stat_errors++; - sc->vccs[vci] = NULL; - uma_zfree(sc->vcc_zone, vc); - if_printf(sc->ifp, "opening VCI %u failed\n", vci); - return; - } - fatm_open_finish(sc, vc); -} - -/* - * Wait on the queue entry until the VCC is opened/closed. - */ -static int -fatm_waitvcc(struct fatm_softc *sc, struct cmdqueue *q) -{ - int error; - - /* - * Wait for the command to complete - */ - error = msleep(q, &sc->mtx, PZERO | PCATCH, "fatm_vci", hz); - - if (error != 0) - return (error); - return (q->error); -} - -/* - * Start to open a VCC. This just initiates the operation. - */ -static int -fatm_open_vcc(struct fatm_softc *sc, struct atmio_openvcc *op) -{ - int error; - struct card_vcc *vc; - - /* - * Check parameters - */ - if ((op->param.flags & ATMIO_FLAG_NOTX) && - (op->param.flags & ATMIO_FLAG_NORX)) - return (EINVAL); - - if (!VC_OK(sc, op->param.vpi, op->param.vci)) - return (EINVAL); - if (op->param.aal != ATMIO_AAL_0 && op->param.aal != ATMIO_AAL_5) - return (EINVAL); - - vc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO); - if (vc == NULL) - return (ENOMEM); - - error = 0; - - FATM_LOCK(sc); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - if (sc->vccs[op->param.vci] != NULL) { - error = EBUSY; - goto done; - } - vc->param = op->param; - vc->rxhand = op->rxhand; - - switch (op->param.traffic) { - - case ATMIO_TRAFFIC_UBR: - break; - - case ATMIO_TRAFFIC_CBR: - if (op->param.tparam.pcr == 0 || - op->param.tparam.pcr > IFP2IFATM(sc->ifp)->mib.pcr) { - error = EINVAL; - goto done; - } - break; - - default: - error = EINVAL; - goto done; - } - vc->ibytes = vc->obytes = 0; - vc->ipackets = vc->opackets = 0; - - vc->vflags = FATM_VCC_TRY_OPEN; - sc->vccs[op->param.vci] = vc; - sc->open_vccs++; - - error = fatm_load_vc(sc, vc); - if (error != 0) { - sc->vccs[op->param.vci] = NULL; - sc->open_vccs--; - goto done; - } - - /* don't free below */ - vc = NULL; - - done: - FATM_UNLOCK(sc); - if (vc != NULL) - uma_zfree(sc->vcc_zone, vc); - return (error); -} - -/* - * Try to initialize the given VC - */ -static int -fatm_load_vc(struct fatm_softc *sc, struct card_vcc *vc) -{ - uint32_t cmd; - struct cmdqueue *q; - int error; - - /* Command and buffer strategy */ - cmd = FATM_OP_ACTIVATE_VCIN | FATM_OP_INTERRUPT_SEL | (0 << 16); - if (vc->param.aal == ATMIO_AAL_0) - cmd |= (0 << 8); - else - cmd |= (5 << 8); - - q = fatm_start_vcc(sc, vc->param.vpi, vc->param.vci, cmd, 1, - (vc->param.flags & ATMIO_FLAG_ASYNC) ? - fatm_open_complete : fatm_cmd_complete); - if (q == NULL) - return (EIO); - - if (!(vc->param.flags & ATMIO_FLAG_ASYNC)) { - error = fatm_waitvcc(sc, q); - if (error != 0) - return (error); - fatm_open_finish(sc, vc); - } - return (0); -} - -/* - * Finish close - */ -static void -fatm_close_finish(struct fatm_softc *sc, struct card_vcc *vc) -{ - /* inform management of this is not an NG - * VCC or it's an NG PVC. */ - if (!(vc->param.flags & ATMIO_FLAG_NG) || - (vc->param.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), 0, vc->param.vci, 0); - - sc->vccs[vc->param.vci] = NULL; - sc->open_vccs--; - - uma_zfree(sc->vcc_zone, vc); -} - -/* - * The VC has been closed. - */ -static void -fatm_close_complete(struct fatm_softc *sc, struct cmdqueue *q) -{ - u_int vci; - struct card_vcc *vc; - - vci = GETVCI(READ4(sc, q->q.card + FATMOC_ACTIN_VPVC)); - vc = sc->vccs[vci]; - H_SYNCSTAT_POSTREAD(sc, q->q.statp); - if (H_GETSTAT(q->q.statp) & FATM_STAT_ERROR) { - sc->istats.get_stat_errors++; - /* keep the VCC in that state */ - if_printf(sc->ifp, "closing VCI %u failed\n", vci); - return; - } - - fatm_close_finish(sc, vc); -} - -/* - * Initiate closing a VCC - */ -static int -fatm_close_vcc(struct fatm_softc *sc, struct atmio_closevcc *cl) -{ - int error; - struct cmdqueue *q; - struct card_vcc *vc; - - if (!VC_OK(sc, cl->vpi, cl->vci)) - return (EINVAL); - - error = 0; - - FATM_LOCK(sc); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - vc = sc->vccs[cl->vci]; - if (vc == NULL || !(vc->vflags & (FATM_VCC_OPEN | FATM_VCC_TRY_OPEN))) { - error = ENOENT; - goto done; - } - - q = fatm_start_vcc(sc, cl->vpi, cl->vci, - FATM_OP_DEACTIVATE_VCIN | FATM_OP_INTERRUPT_SEL, 1, - (vc->param.flags & ATMIO_FLAG_ASYNC) ? - fatm_close_complete : fatm_cmd_complete); - if (q == NULL) { - error = EIO; - goto done; - } - - vc->vflags &= ~(FATM_VCC_OPEN | FATM_VCC_TRY_OPEN); - vc->vflags |= FATM_VCC_TRY_CLOSE; - - if (!(vc->param.flags & ATMIO_FLAG_ASYNC)) { - error = fatm_waitvcc(sc, q); - if (error != 0) - goto done; - - fatm_close_finish(sc, vc); - } - - done: - FATM_UNLOCK(sc); - return (error); -} - -/* - * IOCTL handler - */ -static int -fatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t arg) -{ - int error; - struct fatm_softc *sc = ifp->if_softc; - struct ifaddr *ifa = (struct ifaddr *)arg; - struct ifreq *ifr = (struct ifreq *)arg; - struct atmio_closevcc *cl = (struct atmio_closevcc *)arg; - struct atmio_openvcc *op = (struct atmio_openvcc *)arg; - struct atmio_vcctable *vtab; - - error = 0; - switch (cmd) { - - case SIOCATMOPENVCC: /* kernel internal use */ - error = fatm_open_vcc(sc, op); - break; - - case SIOCATMCLOSEVCC: /* kernel internal use */ - error = fatm_close_vcc(sc, cl); - break; - - case SIOCSIFADDR: - FATM_LOCK(sc); - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - fatm_init_locked(sc); - switch (ifa->ifa_addr->sa_family) { -#ifdef INET - case AF_INET: - case AF_INET6: - ifa->ifa_rtrequest = atm_rtrequest; - break; -#endif - default: - break; - } - FATM_UNLOCK(sc); - break; - - case SIOCSIFFLAGS: - FATM_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - fatm_init_locked(sc); - } - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - fatm_stop(sc); - } - } - FATM_UNLOCK(sc); - break; - - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd); - else - error = EINVAL; - break; - - case SIOCATMGVCCS: - /* return vcc table */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - FORE_MAX_VCC + 1, sc->open_vccs, &sc->mtx, 1); - error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) + - vtab->count * sizeof(vtab->vccs[0])); - free(vtab, M_DEVBUF); - break; - - case SIOCATMGETVCCS: /* internal netgraph use */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - FORE_MAX_VCC + 1, sc->open_vccs, &sc->mtx, 0); - if (vtab == NULL) { - error = ENOMEM; - break; - } - *(void **)arg = vtab; - break; - - default: - DBG(sc, IOCTL, ("+++ cmd=%08lx arg=%p", cmd, arg)); - error = EINVAL; - break; - } - - return (error); -} - -/* - * Detach from the interface and free all resources allocated during - * initialisation and later. - */ -static int -fatm_detach(device_t dev) -{ - u_int i; - struct rbuf *rb; - struct fatm_softc *sc; - struct txqueue *tx; - - sc = device_get_softc(dev); - - if (device_is_alive(dev)) { - FATM_LOCK(sc); - fatm_stop(sc); - utopia_detach(&sc->utopia); - FATM_UNLOCK(sc); - atm_ifdetach(sc->ifp); /* XXX race */ - } - callout_drain(&sc->watchdog_timer); - - if (sc->ih != NULL) - bus_teardown_intr(dev, sc->irqres, sc->ih); - - while ((rb = LIST_FIRST(&sc->rbuf_used)) != NULL) { - if_printf(sc->ifp, "rbuf %p still in use!\n", rb); - bus_dmamap_unload(sc->rbuf_tag, rb->map); - m_freem(rb->m); - LIST_REMOVE(rb, link); - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - } - - if (sc->txqueue.chunk != NULL) { - for (i = 0; i < FATM_TX_QLEN; i++) { - tx = GET_QUEUE(sc->txqueue, struct txqueue, i); - bus_dmamap_destroy(sc->tx_tag, tx->map); - } - } - - while ((rb = LIST_FIRST(&sc->rbuf_free)) != NULL) { - bus_dmamap_destroy(sc->rbuf_tag, rb->map); - LIST_REMOVE(rb, link); - } - - if (sc->rbufs != NULL) - free(sc->rbufs, M_DEVBUF); - if (sc->vccs != NULL) { - for (i = 0; i < FORE_MAX_VCC + 1; i++) - if (sc->vccs[i] != NULL) { - uma_zfree(sc->vcc_zone, sc->vccs[i]); - sc->vccs[i] = NULL; - } - free(sc->vccs, M_DEVBUF); - } - if (sc->vcc_zone != NULL) - uma_zdestroy(sc->vcc_zone); - - if (sc->l1queue.chunk != NULL) - free(sc->l1queue.chunk, M_DEVBUF); - if (sc->s1queue.chunk != NULL) - free(sc->s1queue.chunk, M_DEVBUF); - if (sc->rxqueue.chunk != NULL) - free(sc->rxqueue.chunk, M_DEVBUF); - if (sc->txqueue.chunk != NULL) - free(sc->txqueue.chunk, M_DEVBUF); - if (sc->cmdqueue.chunk != NULL) - free(sc->cmdqueue.chunk, M_DEVBUF); - - destroy_dma_memory(&sc->reg_mem); - destroy_dma_memory(&sc->sadi_mem); - destroy_dma_memory(&sc->prom_mem); -#ifdef TEST_DMA_SYNC - destroy_dma_memoryX(&sc->s1q_mem); - destroy_dma_memoryX(&sc->l1q_mem); - destroy_dma_memoryX(&sc->rxq_mem); - destroy_dma_memoryX(&sc->txq_mem); - destroy_dma_memoryX(&sc->stat_mem); -#endif - - if (sc->tx_tag != NULL) - if (bus_dma_tag_destroy(sc->tx_tag)) - printf("tx DMA tag busy!\n"); - - if (sc->rbuf_tag != NULL) - if (bus_dma_tag_destroy(sc->rbuf_tag)) - printf("rbuf DMA tag busy!\n"); - - if (sc->parent_dmat != NULL) - if (bus_dma_tag_destroy(sc->parent_dmat)) - printf("parent DMA tag busy!\n"); - - if (sc->irqres != NULL) - bus_release_resource(dev, SYS_RES_IRQ, sc->irqid, sc->irqres); - - if (sc->memres != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, - sc->memid, sc->memres); - - (void)sysctl_ctx_free(&sc->sysctl_ctx); - - cv_destroy(&sc->cv_stat); - cv_destroy(&sc->cv_regs); - - mtx_destroy(&sc->mtx); - - if_free(sc->ifp); - - return (0); -} - -/* - * Sysctl handler - */ -static int -fatm_sysctl_istats(SYSCTL_HANDLER_ARGS) -{ - struct fatm_softc *sc = arg1; - u_long *ret; - int error; - - ret = malloc(sizeof(sc->istats), M_TEMP, M_WAITOK); - - FATM_LOCK(sc); - bcopy(&sc->istats, ret, sizeof(sc->istats)); - FATM_UNLOCK(sc); - - error = SYSCTL_OUT(req, ret, sizeof(sc->istats)); - free(ret, M_TEMP); - - return (error); -} - -/* - * Sysctl handler for card statistics - * This is disable because it destroys the PHY statistics. - */ -static int -fatm_sysctl_stats(SYSCTL_HANDLER_ARGS) -{ - struct fatm_softc *sc = arg1; - int error; - const struct fatm_stats *s; - u_long *ret; - u_int i; - - ret = malloc(sizeof(u_long) * FATM_NSTATS, M_TEMP, M_WAITOK); - - FATM_LOCK(sc); - - if ((error = fatm_getstat(sc)) == 0) { - s = sc->sadi_mem.mem; - i = 0; - ret[i++] = s->phy_4b5b.crc_header_errors; - ret[i++] = s->phy_4b5b.framing_errors; - ret[i++] = s->phy_oc3.section_bip8_errors; - ret[i++] = s->phy_oc3.path_bip8_errors; - ret[i++] = s->phy_oc3.line_bip24_errors; - ret[i++] = s->phy_oc3.line_febe_errors; - ret[i++] = s->phy_oc3.path_febe_errors; - ret[i++] = s->phy_oc3.corr_hcs_errors; - ret[i++] = s->phy_oc3.ucorr_hcs_errors; - ret[i++] = s->atm.cells_transmitted; - ret[i++] = s->atm.cells_received; - ret[i++] = s->atm.vpi_bad_range; - ret[i++] = s->atm.vpi_no_conn; - ret[i++] = s->atm.vci_bad_range; - ret[i++] = s->atm.vci_no_conn; - ret[i++] = s->aal0.cells_transmitted; - ret[i++] = s->aal0.cells_received; - ret[i++] = s->aal0.cells_dropped; - ret[i++] = s->aal4.cells_transmitted; - ret[i++] = s->aal4.cells_received; - ret[i++] = s->aal4.cells_crc_errors; - ret[i++] = s->aal4.cels_protocol_errors; - ret[i++] = s->aal4.cells_dropped; - ret[i++] = s->aal4.cspdus_transmitted; - ret[i++] = s->aal4.cspdus_received; - ret[i++] = s->aal4.cspdus_protocol_errors; - ret[i++] = s->aal4.cspdus_dropped; - ret[i++] = s->aal5.cells_transmitted; - ret[i++] = s->aal5.cells_received; - ret[i++] = s->aal5.congestion_experienced; - ret[i++] = s->aal5.cells_dropped; - ret[i++] = s->aal5.cspdus_transmitted; - ret[i++] = s->aal5.cspdus_received; - ret[i++] = s->aal5.cspdus_crc_errors; - ret[i++] = s->aal5.cspdus_protocol_errors; - ret[i++] = s->aal5.cspdus_dropped; - ret[i++] = s->aux.small_b1_failed; - ret[i++] = s->aux.large_b1_failed; - ret[i++] = s->aux.small_b2_failed; - ret[i++] = s->aux.large_b2_failed; - ret[i++] = s->aux.rpd_alloc_failed; - ret[i++] = s->aux.receive_carrier; - } - /* declare the buffer free */ - sc->flags &= ~FATM_STAT_INUSE; - cv_signal(&sc->cv_stat); - - FATM_UNLOCK(sc); - - if (error == 0) - error = SYSCTL_OUT(req, ret, sizeof(u_long) * FATM_NSTATS); - free(ret, M_TEMP); - - return (error); -} - -#define MAXDMASEGS 32 /* maximum number of receive descriptors */ - -/* - * Attach to the device. - * - * We assume, that there is a global lock (Giant in this case) that protects - * multiple threads from entering this function. This makes sense, doesn't it? - */ -static int -fatm_attach(device_t dev) -{ - struct ifnet *ifp; - struct fatm_softc *sc; - int unit; - uint16_t cfg; - int error = 0; - struct rbuf *rb; - u_int i; - struct txqueue *tx; - - sc = device_get_softc(dev); - unit = device_get_unit(dev); - - ifp = sc->ifp = if_alloc(IFT_ATM); - if (ifp == NULL) { - error = ENOSPC; - goto fail; - } - - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_PCA200E; - IFP2IFATM(sc->ifp)->mib.serial = 0; - IFP2IFATM(sc->ifp)->mib.hw_version = 0; - IFP2IFATM(sc->ifp)->mib.sw_version = 0; - IFP2IFATM(sc->ifp)->mib.vpi_bits = 0; - IFP2IFATM(sc->ifp)->mib.vci_bits = FORE_VCIBITS; - IFP2IFATM(sc->ifp)->mib.max_vpcs = 0; - IFP2IFATM(sc->ifp)->mib.max_vccs = FORE_MAX_VCC; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UNKNOWN; - IFP2IFATM(sc->ifp)->phy = &sc->utopia; - - LIST_INIT(&sc->rbuf_free); - LIST_INIT(&sc->rbuf_used); - - /* - * Initialize mutex and condition variables. - */ - mtx_init(&sc->mtx, device_get_nameunit(dev), - MTX_NETWORK_LOCK, MTX_DEF); - - cv_init(&sc->cv_stat, "fatm_stat"); - cv_init(&sc->cv_regs, "fatm_regs"); - - sysctl_ctx_init(&sc->sysctl_ctx); - callout_init_mtx(&sc->watchdog_timer, &sc->mtx, 0); - - /* - * Make the sysctl tree - */ - if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO, - device_get_nameunit(dev), CTLFLAG_RD, 0, "")) == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "istats", CTLTYPE_ULONG | CTLFLAG_RD, sc, 0, - fatm_sysctl_istats, "LU", "internal statistics") == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "stats", CTLTYPE_ULONG | CTLFLAG_RD, sc, 0, - fatm_sysctl_stats, "LU", "card statistics") == NULL) - goto fail; - - if (SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "retry_tx", CTLFLAG_RW, &sc->retry_tx, 0, - "retry flag") == NULL) - goto fail; - -#ifdef FATM_DEBUG - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, 0, "debug flags") - == NULL) - goto fail; - sc->debug = FATM_DEBUG; -#endif - - /* - * Network subsystem stuff - */ - ifp->if_softc = sc; - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_flags = IFF_SIMPLEX; - ifp->if_ioctl = fatm_ioctl; - ifp->if_start = fatm_start; - ifp->if_init = fatm_init; - ifp->if_linkmib = &IFP2IFATM(sc->ifp)->mib; - ifp->if_linkmiblen = sizeof(IFP2IFATM(sc->ifp)->mib); - - /* - * Enable busmaster - */ - pci_enable_busmaster(dev); - - /* - * Map memory - */ - sc->memid = 0x10; - sc->memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->memid, - RF_ACTIVE); - if (sc->memres == NULL) { - if_printf(ifp, "could not map memory\n"); - error = ENXIO; - goto fail; - } - sc->memh = rman_get_bushandle(sc->memres); - sc->memt = rman_get_bustag(sc->memres); - - /* - * Convert endianness of slave access - */ - cfg = pci_read_config(dev, FATM_PCIR_MCTL, 1); - cfg |= FATM_PCIM_SWAB; - pci_write_config(dev, FATM_PCIR_MCTL, cfg, 1); - - /* - * Allocate interrupt (activate at the end) - */ - sc->irqid = 0; - sc->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, - RF_SHAREABLE | RF_ACTIVE); - if (sc->irqres == NULL) { - if_printf(ifp, "could not allocate irq\n"); - error = ENXIO; - goto fail; - } - - /* - * Allocate the parent DMA tag. This is used simply to hold overall - * restrictions for the controller (and PCI bus) and is never used - * to do anything. - */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, MAXDMASEGS, - BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, - &sc->parent_dmat)) { - if_printf(ifp, "could not allocate parent DMA tag\n"); - error = ENOMEM; - goto fail; - } - - /* - * Allocate the receive buffer DMA tag. This tag must map a maximum of - * a mbuf cluster. - */ - if (bus_dma_tag_create(sc->parent_dmat, 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, - NULL, NULL, &sc->rbuf_tag)) { - if_printf(ifp, "could not allocate rbuf DMA tag\n"); - error = ENOMEM; - goto fail; - } - - /* - * Allocate the transmission DMA tag. Must add 1, because - * rounded up PDU will be 65536 bytes long. - */ - if (bus_dma_tag_create(sc->parent_dmat, 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, - FATM_MAXPDU + 1, TPD_EXTENSIONS + TXD_FIXED, MCLBYTES, 0, - NULL, NULL, &sc->tx_tag)) { - if_printf(ifp, "could not allocate tx DMA tag\n"); - error = ENOMEM; - goto fail; - } - - /* - * Allocate DMAable memory. - */ - sc->stat_mem.size = sizeof(uint32_t) * (FATM_CMD_QLEN + FATM_TX_QLEN - + FATM_RX_QLEN + SMALL_SUPPLY_QLEN + LARGE_SUPPLY_QLEN); - sc->stat_mem.align = 4; - - sc->txq_mem.size = FATM_TX_QLEN * TPD_SIZE; - sc->txq_mem.align = 32; - - sc->rxq_mem.size = FATM_RX_QLEN * RPD_SIZE; - sc->rxq_mem.align = 32; - - sc->s1q_mem.size = SMALL_SUPPLY_QLEN * - BSUP_BLK2SIZE(SMALL_SUPPLY_BLKSIZE); - sc->s1q_mem.align = 32; - - sc->l1q_mem.size = LARGE_SUPPLY_QLEN * - BSUP_BLK2SIZE(LARGE_SUPPLY_BLKSIZE); - sc->l1q_mem.align = 32; - -#ifdef TEST_DMA_SYNC - if ((error = alloc_dma_memoryX(sc, "STATUS", &sc->stat_mem)) != 0 || - (error = alloc_dma_memoryX(sc, "TXQ", &sc->txq_mem)) != 0 || - (error = alloc_dma_memoryX(sc, "RXQ", &sc->rxq_mem)) != 0 || - (error = alloc_dma_memoryX(sc, "S1Q", &sc->s1q_mem)) != 0 || - (error = alloc_dma_memoryX(sc, "L1Q", &sc->l1q_mem)) != 0) - goto fail; -#else - if ((error = alloc_dma_memory(sc, "STATUS", &sc->stat_mem)) != 0 || - (error = alloc_dma_memory(sc, "TXQ", &sc->txq_mem)) != 0 || - (error = alloc_dma_memory(sc, "RXQ", &sc->rxq_mem)) != 0 || - (error = alloc_dma_memory(sc, "S1Q", &sc->s1q_mem)) != 0 || - (error = alloc_dma_memory(sc, "L1Q", &sc->l1q_mem)) != 0) - goto fail; -#endif - - sc->prom_mem.size = sizeof(struct prom); - sc->prom_mem.align = 32; - if ((error = alloc_dma_memory(sc, "PROM", &sc->prom_mem)) != 0) - goto fail; - - sc->sadi_mem.size = sizeof(struct fatm_stats); - sc->sadi_mem.align = 32; - if ((error = alloc_dma_memory(sc, "STATISTICS", &sc->sadi_mem)) != 0) - goto fail; - - sc->reg_mem.size = sizeof(uint32_t) * FATM_NREGS; - sc->reg_mem.align = 32; - if ((error = alloc_dma_memory(sc, "REGISTERS", &sc->reg_mem)) != 0) - goto fail; - - /* - * Allocate queues - */ - sc->cmdqueue.chunk = malloc(FATM_CMD_QLEN * sizeof(struct cmdqueue), - M_DEVBUF, M_ZERO | M_WAITOK); - sc->txqueue.chunk = malloc(FATM_TX_QLEN * sizeof(struct txqueue), - M_DEVBUF, M_ZERO | M_WAITOK); - sc->rxqueue.chunk = malloc(FATM_RX_QLEN * sizeof(struct rxqueue), - M_DEVBUF, M_ZERO | M_WAITOK); - sc->s1queue.chunk = malloc(SMALL_SUPPLY_QLEN * sizeof(struct supqueue), - M_DEVBUF, M_ZERO | M_WAITOK); - sc->l1queue.chunk = malloc(LARGE_SUPPLY_QLEN * sizeof(struct supqueue), - M_DEVBUF, M_ZERO | M_WAITOK); - - sc->vccs = malloc((FORE_MAX_VCC + 1) * sizeof(sc->vccs[0]), - M_DEVBUF, M_ZERO | M_WAITOK); - sc->vcc_zone = uma_zcreate("FATM vccs", sizeof(struct card_vcc), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - if (sc->vcc_zone == NULL) { - error = ENOMEM; - goto fail; - } - - /* - * Allocate memory for the receive buffer headers. The total number - * of headers should probably also include the maximum number of - * buffers on the receive queue. - */ - sc->rbuf_total = SMALL_POOL_SIZE + LARGE_POOL_SIZE; - sc->rbufs = malloc(sc->rbuf_total * sizeof(struct rbuf), - M_DEVBUF, M_ZERO | M_WAITOK); - - /* - * Put all rbuf headers on the free list and create DMA maps. - */ - for (rb = sc->rbufs, i = 0; i < sc->rbuf_total; i++, rb++) { - if ((error = bus_dmamap_create(sc->rbuf_tag, 0, &rb->map))) { - if_printf(sc->ifp, "creating rx map: %d\n", - error); - goto fail; - } - LIST_INSERT_HEAD(&sc->rbuf_free, rb, link); - } - - /* - * Create dma maps for transmission. In case of an error, free the - * allocated DMA maps, because on some architectures maps are NULL - * and we cannot distinguish between a failure and a NULL map in - * the detach routine. - */ - for (i = 0; i < FATM_TX_QLEN; i++) { - tx = GET_QUEUE(sc->txqueue, struct txqueue, i); - if ((error = bus_dmamap_create(sc->tx_tag, 0, &tx->map))) { - if_printf(sc->ifp, "creating tx map: %d\n", - error); - while (i > 0) { - tx = GET_QUEUE(sc->txqueue, struct txqueue, - i - 1); - bus_dmamap_destroy(sc->tx_tag, tx->map); - i--; - } - goto fail; - } - } - - utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->mtx, - &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - &fatm_utopia_methods); - sc->utopia.flags |= UTP_FL_NORESET | UTP_FL_POLL_CARRIER; - - /* - * Attach the interface - */ - atm_ifattach(ifp); - ifp->if_snd.ifq_maxlen = 512; - -#ifdef ENABLE_BPF - bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); -#endif - - error = bus_setup_intr(dev, sc->irqres, INTR_TYPE_NET | INTR_MPSAFE, - NULL, fatm_intr, sc, &sc->ih); - if (error) { - if_printf(ifp, "couldn't setup irq\n"); - goto fail; - } - - fail: - if (error) - fatm_detach(dev); - - return (error); -} - -#if defined(FATM_DEBUG) && 0 -static void -dump_s1_queue(struct fatm_softc *sc) -{ - int i; - struct supqueue *q; - - for(i = 0; i < SMALL_SUPPLY_QLEN; i++) { - q = GET_QUEUE(sc->s1queue, struct supqueue, i); - printf("%2d: card=%x(%x,%x) stat=%x\n", i, - q->q.card, - READ4(sc, q->q.card), - READ4(sc, q->q.card + 4), - *q->q.statp); - } -} -#endif - -/* - * Driver infrastructure. - */ -static device_method_t fatm_methods[] = { - DEVMETHOD(device_probe, fatm_probe), - DEVMETHOD(device_attach, fatm_attach), - DEVMETHOD(device_detach, fatm_detach), - { 0, 0 } -}; -static driver_t fatm_driver = { - "fatm", - fatm_methods, - sizeof(struct fatm_softc), -}; - -DRIVER_MODULE(fatm, pci, fatm_driver, fatm_devclass, 0, 0); diff --git a/sys/dev/fatm/if_fatm_rate.h b/sys/dev/fatm/if_fatm_rate.h deleted file mode 100644 index 5cfd38a9c28c..000000000000 --- a/sys/dev/fatm/if_fatm_rate.h +++ /dev/null @@ -1,294 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Fore PCA200E driver for NATM - * - * This has been generated with: - * - * awk 0; i--) printf "{ 0x%08x, %u },\n", \ - * (i * 65536) + (period - i), i * linerate/period; }' - * - * $FreeBSD$ - */ -{ 0x00000000, 353053 }, -{ 0x00fe0001, 351668 }, -{ 0x00fd0002, 350283 }, -{ 0x00fc0003, 348899 }, -{ 0x00fb0004, 347514 }, -{ 0x00fa0005, 346130 }, -{ 0x00f90006, 344745 }, -{ 0x00f80007, 343361 }, -{ 0x00f70008, 341976 }, -{ 0x00f60009, 340592 }, -{ 0x00f5000a, 339207 }, -{ 0x00f4000b, 337823 }, -{ 0x00f3000c, 336438 }, -{ 0x00f2000d, 335054 }, -{ 0x00f1000e, 333669 }, -{ 0x00f0000f, 332285 }, -{ 0x00ef0010, 330900 }, -{ 0x00ee0011, 329516 }, -{ 0x00ed0012, 328131 }, -{ 0x00ec0013, 326747 }, -{ 0x00eb0014, 325362 }, -{ 0x00ea0015, 323978 }, -{ 0x00e90016, 322593 }, -{ 0x00e80017, 321209 }, -{ 0x00e70018, 319824 }, -{ 0x00e60019, 318439 }, -{ 0x00e5001a, 317055 }, -{ 0x00e4001b, 315670 }, -{ 0x00e3001c, 314286 }, -{ 0x00e2001d, 312901 }, -{ 0x00e1001e, 311517 }, -{ 0x00e0001f, 310132 }, -{ 0x00df0020, 308748 }, -{ 0x00de0021, 307363 }, -{ 0x00dd0022, 305979 }, -{ 0x00dc0023, 304594 }, -{ 0x00db0024, 303210 }, -{ 0x00da0025, 301825 }, -{ 0x00d90026, 300441 }, -{ 0x00d80027, 299056 }, -{ 0x00d70028, 297672 }, -{ 0x00d60029, 296287 }, -{ 0x00d5002a, 294903 }, -{ 0x00d4002b, 293518 }, -{ 0x00d3002c, 292134 }, -{ 0x00d2002d, 290749 }, -{ 0x00d1002e, 289365 }, -{ 0x00d0002f, 287980 }, -{ 0x00cf0030, 286595 }, -{ 0x00ce0031, 285211 }, -{ 0x00cd0032, 283826 }, -{ 0x00cc0033, 282442 }, -{ 0x00cb0034, 281057 }, -{ 0x00ca0035, 279673 }, -{ 0x00c90036, 278288 }, -{ 0x00c80037, 276904 }, -{ 0x00c70038, 275519 }, -{ 0x00c60039, 274135 }, -{ 0x00c5003a, 272750 }, -{ 0x00c4003b, 271366 }, -{ 0x00c3003c, 269981 }, -{ 0x00c2003d, 268597 }, -{ 0x00c1003e, 267212 }, -{ 0x00c0003f, 265828 }, -{ 0x00bf0040, 264443 }, -{ 0x00be0041, 263059 }, -{ 0x00bd0042, 261674 }, -{ 0x00bc0043, 260290 }, -{ 0x00bb0044, 258905 }, -{ 0x00ba0045, 257521 }, -{ 0x00b90046, 256136 }, -{ 0x00b80047, 254751 }, -{ 0x00b70048, 253367 }, -{ 0x00b60049, 251982 }, -{ 0x00b5004a, 250598 }, -{ 0x00b4004b, 249213 }, -{ 0x00b3004c, 247829 }, -{ 0x00b2004d, 246444 }, -{ 0x00b1004e, 245060 }, -{ 0x00b0004f, 243675 }, -{ 0x00af0050, 242291 }, -{ 0x00ae0051, 240906 }, -{ 0x00ad0052, 239522 }, -{ 0x00ac0053, 238137 }, -{ 0x00ab0054, 236753 }, -{ 0x00aa0055, 235368 }, -{ 0x00a90056, 233984 }, -{ 0x00a80057, 232599 }, -{ 0x00a70058, 231215 }, -{ 0x00a60059, 229830 }, -{ 0x00a5005a, 228446 }, -{ 0x00a4005b, 227061 }, -{ 0x00a3005c, 225677 }, -{ 0x00a2005d, 224292 }, -{ 0x00a1005e, 222907 }, -{ 0x00a0005f, 221523 }, -{ 0x009f0060, 220138 }, -{ 0x009e0061, 218754 }, -{ 0x009d0062, 217369 }, -{ 0x009c0063, 215985 }, -{ 0x009b0064, 214600 }, -{ 0x009a0065, 213216 }, -{ 0x00990066, 211831 }, -{ 0x00980067, 210447 }, -{ 0x00970068, 209062 }, -{ 0x00960069, 207678 }, -{ 0x0095006a, 206293 }, -{ 0x0094006b, 204909 }, -{ 0x0093006c, 203524 }, -{ 0x0092006d, 202140 }, -{ 0x0091006e, 200755 }, -{ 0x0090006f, 199371 }, -{ 0x008f0070, 197986 }, -{ 0x008e0071, 196602 }, -{ 0x008d0072, 195217 }, -{ 0x008c0073, 193833 }, -{ 0x008b0074, 192448 }, -{ 0x008a0075, 191063 }, -{ 0x00890076, 189679 }, -{ 0x00880077, 188294 }, -{ 0x00870078, 186910 }, -{ 0x00860079, 185525 }, -{ 0x0085007a, 184141 }, -{ 0x0084007b, 182756 }, -{ 0x0083007c, 181372 }, -{ 0x0082007d, 179987 }, -{ 0x0081007e, 178603 }, -{ 0x0080007f, 177218 }, -{ 0x007f0080, 175834 }, -{ 0x007e0081, 174449 }, -{ 0x007d0082, 173065 }, -{ 0x007c0083, 171680 }, -{ 0x007b0084, 170296 }, -{ 0x007a0085, 168911 }, -{ 0x00790086, 167527 }, -{ 0x00780087, 166142 }, -{ 0x00770088, 164758 }, -{ 0x00760089, 163373 }, -{ 0x0075008a, 161989 }, -{ 0x0074008b, 160604 }, -{ 0x0073008c, 159219 }, -{ 0x0072008d, 157835 }, -{ 0x0071008e, 156450 }, -{ 0x0070008f, 155066 }, -{ 0x006f0090, 153681 }, -{ 0x006e0091, 152297 }, -{ 0x006d0092, 150912 }, -{ 0x006c0093, 149528 }, -{ 0x006b0094, 148143 }, -{ 0x006a0095, 146759 }, -{ 0x00690096, 145374 }, -{ 0x00680097, 143990 }, -{ 0x00670098, 142605 }, -{ 0x00660099, 141221 }, -{ 0x0065009a, 139836 }, -{ 0x0064009b, 138452 }, -{ 0x0063009c, 137067 }, -{ 0x0062009d, 135683 }, -{ 0x0061009e, 134298 }, -{ 0x0060009f, 132914 }, -{ 0x005f00a0, 131529 }, -{ 0x005e00a1, 130145 }, -{ 0x005d00a2, 128760 }, -{ 0x005c00a3, 127375 }, -{ 0x005b00a4, 125991 }, -{ 0x005a00a5, 124606 }, -{ 0x005900a6, 123222 }, -{ 0x005800a7, 121837 }, -{ 0x005700a8, 120453 }, -{ 0x005600a9, 119068 }, -{ 0x005500aa, 117684 }, -{ 0x005400ab, 116299 }, -{ 0x005300ac, 114915 }, -{ 0x005200ad, 113530 }, -{ 0x005100ae, 112146 }, -{ 0x005000af, 110761 }, -{ 0x004f00b0, 109377 }, -{ 0x004e00b1, 107992 }, -{ 0x004d00b2, 106608 }, -{ 0x004c00b3, 105223 }, -{ 0x004b00b4, 103839 }, -{ 0x004a00b5, 102454 }, -{ 0x004900b6, 101070 }, -{ 0x004800b7, 99685 }, -{ 0x004700b8, 98301 }, -{ 0x004600b9, 96916 }, -{ 0x004500ba, 95531 }, -{ 0x004400bb, 94147 }, -{ 0x004300bc, 92762 }, -{ 0x004200bd, 91378 }, -{ 0x004100be, 89993 }, -{ 0x004000bf, 88609 }, -{ 0x003f00c0, 87224 }, -{ 0x003e00c1, 85840 }, -{ 0x003d00c2, 84455 }, -{ 0x003c00c3, 83071 }, -{ 0x003b00c4, 81686 }, -{ 0x003a00c5, 80302 }, -{ 0x003900c6, 78917 }, -{ 0x003800c7, 77533 }, -{ 0x003700c8, 76148 }, -{ 0x003600c9, 74764 }, -{ 0x003500ca, 73379 }, -{ 0x003400cb, 71995 }, -{ 0x003300cc, 70610 }, -{ 0x003200cd, 69226 }, -{ 0x003100ce, 67841 }, -{ 0x003000cf, 66457 }, -{ 0x002f00d0, 65072 }, -{ 0x002e00d1, 63687 }, -{ 0x002d00d2, 62303 }, -{ 0x002c00d3, 60918 }, -{ 0x002b00d4, 59534 }, -{ 0x002a00d5, 58149 }, -{ 0x002900d6, 56765 }, -{ 0x002800d7, 55380 }, -{ 0x002700d8, 53996 }, -{ 0x002600d9, 52611 }, -{ 0x002500da, 51227 }, -{ 0x002400db, 49842 }, -{ 0x002300dc, 48458 }, -{ 0x002200dd, 47073 }, -{ 0x002100de, 45689 }, -{ 0x002000df, 44304 }, -{ 0x001f00e0, 42920 }, -{ 0x001e00e1, 41535 }, -{ 0x001d00e2, 40151 }, -{ 0x001c00e3, 38766 }, -{ 0x001b00e4, 37382 }, -{ 0x001a00e5, 35997 }, -{ 0x001900e6, 34613 }, -{ 0x001800e7, 33228 }, -{ 0x001700e8, 31843 }, -{ 0x001600e9, 30459 }, -{ 0x001500ea, 29074 }, -{ 0x001400eb, 27690 }, -{ 0x001300ec, 26305 }, -{ 0x001200ed, 24921 }, -{ 0x001100ee, 23536 }, -{ 0x001000ef, 22152 }, -{ 0x000f00f0, 20767 }, -{ 0x000e00f1, 19383 }, -{ 0x000d00f2, 17998 }, -{ 0x000c00f3, 16614 }, -{ 0x000b00f4, 15229 }, -{ 0x000a00f5, 13845 }, -{ 0x000900f6, 12460 }, -{ 0x000800f7, 11076 }, -{ 0x000700f8, 9691 }, -{ 0x000600f9, 8307 }, -{ 0x000500fa, 6922 }, -{ 0x000400fb, 5538 }, -{ 0x000300fc, 4153 }, -{ 0x000200fd, 2769 }, -{ 0x000100fe, 1384 }, diff --git a/sys/dev/fatm/if_fatmreg.h b/sys/dev/fatm/if_fatmreg.h deleted file mode 100644 index d6eb0074bf2a..000000000000 --- a/sys/dev/fatm/if_fatmreg.h +++ /dev/null @@ -1,499 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Fore PCA200E hardware definitions. - */ - -/* - * Fore implements some additional PCI registers. One of them is the - * master control register. One of the bits allow to automatically byte - * swap accesses to the on-board RAM. - */ -#define FATM_PCIR_MCTL 0x41 -#define FATM_PCIM_SWAB 0x100 - -/* - * Operations codes for commands. - */ -enum { - FATM_OP_INITIALIZE = 0x01, /* Initialize the card */ - FATM_OP_ACTIVATE_VCIN = 0x02, /* Start reassembly on a channel */ - FATM_OP_ACTIVATE_VCOUT = 0x03, /* (not used) */ - FATM_OP_DEACTIVATE_VCIN = 0x04, /* Stop reassembly on a channel */ - FATM_OP_DEACTIVATE_VCOUT= 0x05, /* (not used) */ - FATM_OP_REQUEST_STATS = 0x06, /* Get statistics */ - FATM_OP_OC3_SET_REG = 0x07, /* Set OC3 chip register */ - FATM_OP_OC3_GET_REG = 0x08, /* Get OC3 chip registers */ - FATM_OP_ZERO_STATS = 0x09, /* Zero out statistics */ - FATM_OP_GET_PROM_DATA = 0x0a, /* Return expansion ROM data */ - FATM_OP_SETVPI_BITS = 0x0b, /* (not used, not implemented) */ - - FATM_OP_INTERRUPT_SEL = 0x80, /* Request interrupt on completion */ -}; - -/* - * Status word definitions. Before initiating an operation the host sets the - * status word to PENDING. The card sets it to COMPLETE upon completion of - * the transmit/receive or command. An unused queue entry contains FREE. - * The ERROR can be ored into the COMPLETE. Note, that there are circumstances - * when ERROR is set without COMPLETE being set (when you try to activate - * a bad VCI like, for example, VCI 0). - */ -enum { - FATM_STAT_PENDING = 0x01, - FATM_STAT_COMPLETE = 0x02, - FATM_STAT_FREE = 0x04, - FATM_STAT_ERROR = 0x08, -}; - -/* - * On board queue offsets. There are two fundamentally different queue types: - * the command queue and all other queues. The command queue has 32 byte - * entries on the card which contain the operation code, parameters and the - * DMA pointer to the status word. All other queues have 8 byte entries, which - * contain a DMA pointer to the i/o block, that contains the parameters, and - * a DMA pointer to the status word. - */ -#define FATMOC_OP 0 /* cmd queue: offset to op code */ -#define FATMOC_PARAM 4 /* cmd queue: offset to parameters */ -#define FATMOC_STATP 16 /* cmd queue: offset to status ptr */ -#define FATMOC_END 32 /* cmd queue: element size */ - -#define FATMOC_ACTIN_VPVC (FATMOC_PARAM + 0) -#define FATMOC_ACTIN_MTU (FATMOC_PARAM + 4) -#define FATMOC_DEACTIN_VPVC (FATMOC_PARAM + 0) -#define FATMOC_GETOC3_BUF (FATMOC_PARAM + 0) -#define FATMOC_GSTAT_BUF (FATMOC_PARAM + 0) -#define FATMOC_GPROM_BUF (FATMOC_PARAM + 0) - -#define FATMOS_IOBLK 0 /* other queues: offset to ioblk ptr */ -#define FATMOS_STATP 4 /* other queues: offset to status ptr */ - -#define FATM_MAKE_SETOC3(REG,VAL,MASK) \ - (FATM_OP_OC3_SET_REG | (((REG) & 0xff) << 8) | \ - (((VAL) & 0xff) << 16) | (((MASK) & 0xff) << 24)) -#define FATM_NREGS 128 - - -/* - * On board memory layout. - * - * The card contains up to 2MByte memory that is mapped at virtual offset 0. - * It is followed by three registers. The memory contains two areas at - * fixed addresses: the mon960 area that is used for communication with - * the card's operating system and the common block that is used by the - * firmware to communicate with the driver. - */ -#define FATM_RAM_SIZE (256 * 1024) /* normal RAM size */ - -#define FATMO_RAM (0x0) /* virtual RAM start */ -#define FATMO_MON960 (0x400) /* mon960 communication area */ -#define FATMO_COMMON_ORIGIN (0x4d40) /* firmware comm. area */ - -#define FATMO_HCR (0x100000) /* host control registers */ -#define FATMO_HIMR (0x100004) /* host interrupt mask */ -#define FATMO_PSR (0x100008) /* PCI control register */ - -#define FATMO_END (0x200000) /* end of mapped area */ - -/* - * The mon960 area contains two cells that are used as a virtual serial - * interface, a status word, the base for loading the application (i.e. - * firmware) and a version number. - */ -#define FATMO_UART_TO_960 (FATMO_MON960 + 0) -#define FATMO_UART_TO_HOST (FATMO_MON960 + 4) -#define FATMO_BOOT_STATUS (FATMO_MON960 + 8) -#define FATMO_APP_BASE (FATMO_MON960 + 12) -#define FATMO_VERSION (FATMO_MON960 + 16) - - -/* - * The host control register allows to hold the i960 or send it interrupts. - * The bits have different meaning on read and write. - */ -#define FATM_HCR_RESET 0x01 /* (W) reset the card */ -#define FATM_HCR_LOCK_HOLD 0x02 /* (W) hold the i960 */ -#define FATM_HCR_I960FAIL 0x04 /* (R) internal self-test failed */ -#define FATM_HCR_INTR2 0x04 /* (W) assert i960 interrupt 2 */ -#define FATM_HCR_HOLDA 0x08 /* (R) hold ack from i960 */ -#define FATM_HCR_INTR1 0x08 /* (W) assert i960 interrupt 1 */ -#define FATM_HCR_OFIFO 0x10 /* (R) DMA request FIFO full */ -#define FATM_HCR_CLRIRQ 0x10 /* (W) clear interrupt request */ -#define FATM_HCR_ESP_HOLD 0x20 /* (R) SAR chip holds i960 */ -#define FATM_HCR_IFIFO 0x40 /* (R) input FIFO full */ -#define FATM_HCR_TESTMODE 0x80 /* (R) board is in test mode */ - -/* - * The mon960 area contains a virtual UART and a status word. - * The UART uses a simple protocol: a zero means, that there is no - * character available from the i960 or that one can write the next - * character to the i960. This character has to be ored with 0x1000000 - * to signal to the i960 that there is a new character. - * The cold_start values must be written to the status word, the others - * denote certain stages of initializing. - */ -#define XMIT_READY 0 -#define CHAR_AVAIL 0x1000000 - -#define COLD_START 0xc01dc01d -#define SELF_TEST_OK 0x02201958 -#define SELF_TEST_FAIL 0xadbadbad -#define CP_RUNNING 0xce11feed -#define MON906_TOO_BIG 0x10aded00 - -/* - * The firmware communication area contains a big structure most of which - * is used only during initialisation. - */ -/* - * These are the offsets to the onboard queues that are valid after the - * initialisation command has completed. - */ -#define FATMO_COMMAND_QUEUE (FATMO_COMMON_ORIGIN + 0) -#define FATMO_TRANSMIT_QUEUE (FATMO_COMMON_ORIGIN + 4) -#define FATMO_RECEIVE_QUEUE (FATMO_COMMON_ORIGIN + 8) -#define FATMO_SMALL_B1_QUEUE (FATMO_COMMON_ORIGIN + 12) -#define FATMO_LARGE_B1_QUEUE (FATMO_COMMON_ORIGIN + 16) -#define FATMO_SMALL_B2_QUEUE (FATMO_COMMON_ORIGIN + 20) -#define FATMO_LARGE_B2_QUEUE (FATMO_COMMON_ORIGIN + 24) - -/* - * If the interrupt mask is set to 1, interrupts to the host are queued, but - * inhbited. The istat variable is set, when this card has posted an interrupt. - */ -#define FATMO_IMASK (FATMO_COMMON_ORIGIN + 28) -#define FATMO_ISTAT (FATMO_COMMON_ORIGIN + 32) - -/* - * This is the offset and the size of the queue area. Could be used to - * dynamically compute queue sizes. - */ -#define FATMO_HEAP_BASE (FATMO_COMMON_ORIGIN + 36) -#define FATMO_HEAP_SIZE (FATMO_COMMON_ORIGIN + 40) - -#define FATMO_HLOGGER (FATMO_COMMON_ORIGIN + 44) - -/* - * The heartbeat variable is incremented in each loop of the normal processing. - * If it is stuck this means, that the card had a fatal error. In this case - * it may set the word to a number of values of the form 0xdeadXXXX where - * XXXX is an error code. - */ -#define FATMO_HEARTBEAT (FATMO_COMMON_ORIGIN + 48) - -#define FATMO_FIRMWARE_RELEASE (FATMO_COMMON_ORIGIN + 52) -#define FATMO_MON960_RELEASE (FATMO_COMMON_ORIGIN + 56) -#define FATMO_TQ_PLEN (FATMO_COMMON_ORIGIN + 60) - -/* - * At this offset the init command block is located. The init command cannot - * use the normal queue mechanism because it is used to initialize the - * queues. For this reason it is located at this fixed offset. - */ -#define FATMO_INIT (FATMO_COMMON_ORIGIN + 64) - -/* - * physical media type - */ -#define FATMO_MEDIA_TYPE (FATMO_COMMON_ORIGIN + 176) -#define FATMO_OC3_REVISION (FATMO_COMMON_ORIGIN + 180) - -/* - * End of the common block - */ -#define FATMO_COMMON_END (FATMO_COMMON_ORIGIN + 184) - -/* - * The INITIALIZE command block. This is embedded into the above common - * block. The offsets are from the beginning of the command block. - */ -#define FATMOI_OP 0 /* operation code */ -#define FATMOI_STATUS 4 /* status word */ -#define FATMOI_RECEIVE_TRESHOLD 8 /* when to start interrupting */ -#define FATMOI_NUM_CONNECT 12 /* max number of VCIs */ -#define FATMOI_CQUEUE_LEN 16 /* length of command queue */ -#define FATMOI_TQUEUE_LEN 20 /* length of transmit queue */ -#define FATMOI_RQUEUE_LEN 24 /* length of receive queue */ -#define FATMOI_RPD_EXTENSION 28 /* additional 32 byte blocks */ -#define FATMOI_TPD_EXTENSION 32 /* additional 32 byte blocks */ -#define FATMOI_CONLESS_VPVC 36 /* (not used) */ -#define FATMOI_SMALL_B1 48 /* small buffer 1 pool */ -#define FATMOI_LARGE_B1 64 /* small buffer 2 pool */ -#define FATMOI_SMALL_B2 80 /* large buffer 1 pool */ -#define FATMOI_LARGE_B2 96 /* large buffer 2 pool */ -#define FATMOI_END 112 /* size of init block */ - -/* - * Each of the four buffer schemes is initialized with a block that - * contains four words: - */ -#define FATMOB_QUEUE_LENGTH 0 /* supply queue length */ -#define FATMOB_BUFFER_SIZE 4 /* size of each buffer */ -#define FATMOB_POOL_SIZE 8 /* size of on-board pool */ -#define FATMOB_SUPPLY_BLKSIZE 12 /* number of buffers/supply */ - -/* - * The fore firmware is a binary file, that starts with a header. The - * header contains the offset to where the file must be loaded and the - * entry for execution. The header must also be loaded onto the card! - */ -struct firmware { - uint32_t id; /* "FORE" */ - uint32_t version; /* firmware version */ - uint32_t offset; /* load offset */ - uint32_t entry; /* entry point */ -}; -#define FATM_FWID 0x65726f66 /* "FORE" */ -#define FATM_FWVERSION 0x100 /* supported version */ - -/* - * PDUs to be transmitted are described by Transmit PDU Descriptors. - * These descriptors are held in host memory, but referenced from the ioblk - * member of the queue structure on the card. The card DMAs the descriptor - * and than gather-DMAs the PDU transmitting it on-the-fly. Tpds are variable - * length in blocks of 32 byte (8 words). The minimum length is one block, - * maximum 15. The number of blocks beyond 1 is configured during the - * initialisation command (tpd_extension). - * Each gather-DMA segment is described by a segment descriptor. The buffer - * address and the length must be a multiple of four. - * Tpd must also be 4 byte aligned. - * Because of the minimum length of 32 byte, the first blocks contains already - * 2 segement descriptors. Each extension block holds four descriptors. - */ -#define TXD_FIXED 2 -#define SEGS_PER_BLOCK 4 /* segment descriptors per extension block */ -struct txseg { - uint32_t buffer; /* DMA buffer address */ - uint32_t length; /* and length */ -}; -struct tpd { - uint32_t atm_header; /* header for the transmitted cells */ - uint32_t spec; /* PDU description */ - uint32_t stream; /* traffic shaping word */ - uint32_t pad[1]; - struct txseg segment[TXD_FIXED]; -}; - -#define TDX_MKSPEC(INTR,AAL,NSEG,LEN) \ - (((INTR) << 28) | ((AAL) << 24) | ((NSEG) << 16) | (LEN)) -#define TDX_MKSTR(DATA,IDLE) \ - (((DATA) << 16) | (IDLE)) -#define TDX_MKHDR(VPI,VCI,PT,CLP) \ - (((VPI) << 20) | ((VCI) << 4) | ((PT) << 1) | (CLP)) -#define TDX_SEGS2BLKS(SEGS) \ - (1 + ((SEGS)-TXD_FIXED+SEGS_PER_BLOCK-1)/SEGS_PER_BLOCK) - -/* - * We want probably support scatter transmission, so we use the maximum - * transmit descriptor extension that is possible. Because the size of the - * Tpd is encoded in 32-byte blocks in a 4-bit field, the maximum extension - * is 14 such blocks. The value for the init command is the number of - * additional descriptor entries NOT the number of 32 byte blocks. - */ -#define TPD_EXTENSION_BLOCKS 14 -#define TPD_EXTENSIONS (TPD_EXTENSION_BLOCKS * 4) -#define TPD_SIZE ((size_t)((TPD_EXTENSION_BLOCKS+1) * 32)) - -/* - * Received PDUs are handed from the card to the host by means of Receive - * PDU descriptors. Each segment describes on part of the PDU. The buffer - * handle is a 32 bit value that is supplied by the host and passed - * transparently back to the host by the card. It is used to locate the buffer. - * The length field is the number of actual bytes in that buffer. - */ -#define RXD_FIXED 3 -struct rxseg { - uint32_t handle; /* buffer handle */ - uint32_t length; /* number of bytes */ -}; -struct rpd { - uint32_t atm_header; - uint32_t nseg; - struct rxseg segment[RXD_FIXED]; -}; - -/* - * PDUs received are stored in buffers supplied to the card. We use only - * buffer scheme 1: small buffers are normal mbuf's which can hold three - * cells in their default size (256 byte) and mbuf clusters which can - * hold 42 cells (2 kbyte). - * The number of receive segments can be computed from these sizes: - */ -#define FATM_MAXPDU 65535 -#define MAXPDU_CELLS ((FATM_MAXPDU+47)/48) - -#define SMALL_BUFFER_CELLS (MHLEN/48) -#define LARGE_BUFFER_CELLS (MCLBYTES/48) - -#define SMALL_BUFFER_LEN (SMALL_BUFFER_CELLS * 48) -#define LARGE_BUFFER_LEN (LARGE_BUFFER_CELLS * 48) - -/* - * The card first alloctes a small buffer and the switches to large - * buffers. So the number of large buffers needed to store the maximum - * PDU is: - */ -#define MAX_LARGE_BUFFERS ((MAXPDU_CELLS - SMALL_BUFFER_CELLS \ - + LARGE_BUFFER_CELLS - 1) \ - / LARGE_BUFFER_CELLS) \ - -/* - * From this we get the number of extension blocks for the Rpds as: - */ -#define RPD_EXTENSION_BLOCKS ((MAX_LARGE_BUFFERS + 1 - RXD_FIXED \ - + SEGS_PER_BLOCK - 1) \ - / SEGS_PER_BLOCK) -#define RPD_EXTENSIONS (RPD_EXTENSION_BLOCKS * 4) -#define RPD_SIZE ((size_t)((RPD_EXTENSION_BLOCKS+1) * 32)) - -/* - * Buffers are supplied to the card prior receiving by the supply queues. - * We use two queues: scheme 1 small buffers and scheme 1 large buffers. - * The queues and on-card pools are initialized by the initialize command. - * Buffers are supplied in chunks. Each chunk can contain from 4 to 124 - * buffers in multiples of four. The chunk sizes are configured by the - * initialize command. Each buffer in a chunk is described by a Receive - * Buffer Descriptor that is held in host memory and given as the ioblk - * to the card. - */ -#define BSUP_BLK2SIZE(CHUNK) (8 * (CHUNK)) - -struct rbd { - uint32_t handle; - uint32_t buffer; /* DMA address for card */ -}; - -/* - * The PCA200E has an expansion ROM that contains version information and - * the FORE-assigned MAC address. It can be read via the get_prom_data - * operation. - */ -struct prom { - uint32_t version; - uint32_t serial; - uint8_t mac[8]; -}; - -/* - * The media type member of the firmware communication block contains a - * code that describes the physical medium and physical protocol. - */ -#define FORE_MT_TAXI_100 0x04 -#define FORE_MT_TAXI_140 0x05 -#define FORE_MT_UTP_SONET 0x06 -#define FORE_MT_MM_OC3_ST 0x16 -#define FORE_MT_MM_OC3_SC 0x26 -#define FORE_MT_SM_OC3_ST 0x36 -#define FORE_MT_SM_OC3_SC 0x46 - -/* - * Assorted constants - */ -#define FORE_MAX_VCC 1024 /* max. number of VCIs supported */ -#define FORE_VCIBITS 10 - -#define FATM_STATE_TIMEOUT 500 /* msec */ - -/* - * Statistics as delivered by the FORE cards - */ -struct fatm_stats { - struct { - uint32_t crc_header_errors; - uint32_t framing_errors; - uint32_t pad[2]; - } phy_4b5b; - - struct { - uint32_t section_bip8_errors; - uint32_t path_bip8_errors; - uint32_t line_bip24_errors; - uint32_t line_febe_errors; - uint32_t path_febe_errors; - uint32_t corr_hcs_errors; - uint32_t ucorr_hcs_errors; - uint32_t pad[1]; - } phy_oc3; - - struct { - uint32_t cells_transmitted; - uint32_t cells_received; - uint32_t vpi_bad_range; - uint32_t vpi_no_conn; - uint32_t vci_bad_range; - uint32_t vci_no_conn; - uint32_t pad[2]; - } atm; - - struct { - uint32_t cells_transmitted; - uint32_t cells_received; - uint32_t cells_dropped; - uint32_t pad[1]; - } aal0; - - struct { - uint32_t cells_transmitted; - uint32_t cells_received; - uint32_t cells_crc_errors; - uint32_t cels_protocol_errors; - uint32_t cells_dropped; - uint32_t cspdus_transmitted; - uint32_t cspdus_received; - uint32_t cspdus_protocol_errors; - uint32_t cspdus_dropped; - uint32_t pad[3]; - } aal4; - - struct { - uint32_t cells_transmitted; - uint32_t cells_received; - uint32_t congestion_experienced; - uint32_t cells_dropped; - uint32_t cspdus_transmitted; - uint32_t cspdus_received; - uint32_t cspdus_crc_errors; - uint32_t cspdus_protocol_errors; - uint32_t cspdus_dropped; - uint32_t pad[3]; - } aal5; - - struct { - uint32_t small_b1_failed; - uint32_t large_b1_failed; - uint32_t small_b2_failed; - uint32_t large_b2_failed; - uint32_t rpd_alloc_failed; - uint32_t receive_carrier; - uint32_t pad[2]; - } aux; -}; -#define FATM_NSTATS 42 diff --git a/sys/dev/fatm/if_fatmvar.h b/sys/dev/fatm/if_fatmvar.h deleted file mode 100644 index ba064fe2300e..000000000000 --- a/sys/dev/fatm/if_fatmvar.h +++ /dev/null @@ -1,395 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Fore PCA200E driver definitions. - */ -/* - * Debug statistics of the PCA200 driver - */ -struct istats { - uint32_t cmd_queue_full; - uint32_t get_stat_errors; - uint32_t clr_stat_errors; - uint32_t get_prom_errors; - uint32_t suni_reg_errors; - uint32_t tx_queue_full; - uint32_t tx_queue_almost_full; - uint32_t tx_pdu2big; - uint32_t tx_too_many_segs; - uint32_t tx_retry; - uint32_t fix_empty; - uint32_t fix_addr_copy; - uint32_t fix_addr_noext; - uint32_t fix_addr_ext; - uint32_t fix_len_noext; - uint32_t fix_len_copy; - uint32_t fix_len; - uint32_t rx_badvc; - uint32_t rx_closed; -}; - -/* - * Addresses on the on-board RAM are expressed as offsets to the - * start of that RAM. - */ -typedef uint32_t cardoff_t; - -/* - * The card uses a number of queues for communication with the host. - * Parts of the queue are located on the card (pointers to the status - * word and the ioblk and the command blocks), the rest in host memory. - * Each of these queues forms a ring, where the head and tail pointers are - * managed * either by the card or the host. For the receive queue the - * head is managed by the card (and not used altogether by the host) and the - * tail by the host - for all other queues its the other way around. - * The host resident parts of the queue entries contain pointers to - * the host resident status and the host resident ioblk (the latter not for - * the command queue) as well as DMA addresses for supply to the card. - */ -struct fqelem { - cardoff_t card; /* corresponding element on card */ - bus_addr_t card_ioblk; /* ioblk address to supply to card */ - volatile uint32_t *statp; /* host status pointer */ - void *ioblk; /* host ioblk (not for commands) */ -}; - -struct fqueue { - struct fqelem *chunk; /* pointer to the element array */ - int head; /* queue head */ - int tail; /* queue tail */ -}; - -/* - * Queue manipulation macros - */ -#define NEXT_QUEUE_ENTRY(HEAD,LEN) ((HEAD) = ((HEAD) + 1) % LEN) -#define GET_QUEUE(Q,TYPE,IDX) (&((TYPE *)(Q).chunk)[(IDX)]) - -/* - * Now define structures for the different queues. Each of these structures - * must start with a struct fqelem. - */ -struct txqueue { /* transmit queue element */ - struct fqelem q; - struct mbuf *m; /* the chain we are transmitting */ - bus_dmamap_t map; /* map for the packet */ -}; - -struct rxqueue { /* receive queue element */ - struct fqelem q; -}; - -struct supqueue { /* supply queue element */ - struct fqelem q; -}; - -struct cmdqueue; -struct fatm_softc; - -typedef void (*completion_cb)(struct fatm_softc *, struct cmdqueue *); - -struct cmdqueue { /* command queue element */ - struct fqelem q; - completion_cb cb; /* call on command completion */ - int error; /* set if error occurred */ -}; - -/* - * Card-DMA-able memory is managed by means of the bus_dma* functions. - * To allocate a chunk of memory with a specific size and alignment one - * has to: - * 1. create a DMA tag - * 2. allocate the memory - * 3. load the memory into a map. - * This finally gives the physical address that can be given to the card. - * The card can DMA the entire 32-bit space without boundaries. We assume, - * that all the allocations can be mapped in one contiguous segment. This - * may be wrong in the future if we have more than 32 bit addresses. - * Allocation is done at attach time and managed by the following structure. - * - * This could be done easier with the NetBSD bus_dma* functions. They appear - * to be more useful and consistent. - */ -struct fatm_mem { - u_int size; /* size */ - u_int align; /* alignment */ - bus_dma_tag_t dmat; /* DMA tag */ - void *mem; /* memory block */ - bus_addr_t paddr; /* pysical address */ - bus_dmamap_t map; /* map */ -}; - -/* - * Each of these structures describes one receive buffer while the buffer - * is on the card or in the receive return queue. These structures are - * allocated at initialisation time together with the DMA maps. The handle that - * is given to the card is the index into the array of these structures. - */ -struct rbuf { - struct mbuf *m; /* the mbuf while we are on the card */ - bus_dmamap_t map; /* the map */ - LIST_ENTRY(rbuf) link; /* the free list link */ -}; -LIST_HEAD(rbuf_list, rbuf); - -/* - * The driver maintains a list of all open VCCs. Because we - * use only VPI=0 and a maximum VCI of 1024, the list is rather an array - * than a list. We also store the atm pseudoheader flags here and the - * rxhand (aka. protocol block). - */ -struct card_vcc { - struct atmio_vcc param; /* traffic parameters */ - void *rxhand; - u_int vflags; - uint32_t ipackets; - uint32_t opackets; - uint32_t ibytes; - uint32_t obytes; -}; - -#define FATM_VCC_OPEN 0x00010000 /* is open */ -#define FATM_VCC_TRY_OPEN 0x00020000 /* is currently opening */ -#define FATM_VCC_TRY_CLOSE 0x00040000 /* is currently closing */ -#define FATM_VCC_BUSY 0x00070000 /* one of the above */ -#define FATM_VCC_REOPEN 0x00080000 /* reopening during init */ - -/* - * Finally the softc structure - */ -struct fatm_softc { - struct ifnet *ifp; /* common part */ - struct mtx mtx; /* lock this structure */ - struct ifmedia media; /* media */ - struct callout watchdog_timer; - - int init_state; /* initialisation step */ - int memid; /* resource id for card memory */ - struct resource *memres; /* resource for card memory */ - bus_space_handle_t memh; /* handle for card memory */ - bus_space_tag_t memt; /* tag for card memory */ - int irqid; /* resource id for interrupt */ - struct resource *irqres; /* resource for interrupt */ - void *ih; /* interrupt handler */ - - bus_dma_tag_t parent_dmat; /* parent DMA tag */ - struct fatm_mem stat_mem; /* memory for status blocks */ - struct fatm_mem txq_mem; /* TX descriptor queue */ - struct fatm_mem rxq_mem; /* RX descriptor queue */ - struct fatm_mem s1q_mem; /* Small buffer 1 queue */ - struct fatm_mem l1q_mem; /* Large buffer 1 queue */ - struct fatm_mem prom_mem; /* PROM memory */ - - struct fqueue txqueue; /* transmission queue */ - struct fqueue rxqueue; /* receive queue */ - struct fqueue s1queue; /* SMALL S1 queue */ - struct fqueue l1queue; /* LARGE S1 queue */ - struct fqueue cmdqueue; /* command queue */ - - /* fields for access to the SUNI registers */ - struct fatm_mem reg_mem; /* DMAable memory for readregs */ - struct cv cv_regs; /* to serialize access to reg_mem */ - - /* fields for access to statistics */ - struct fatm_mem sadi_mem; /* sadistics memory */ - struct cv cv_stat; /* to serialize access to sadi_mem */ - - u_int flags; -#define FATM_STAT_INUSE 0x0001 -#define FATM_REGS_INUSE 0x0002 - u_int txcnt; /* number of used transmit desc */ - int retry_tx; /* keep mbufs in queue if full */ - - struct card_vcc **vccs; /* table of vccs */ - int open_vccs; /* number of vccs in use */ - int small_cnt; /* number of buffers owned by card */ - int large_cnt; /* number of buffers owned by card */ - uma_zone_t vcc_zone; /* allocator for VCCs */ - - /* receiving */ - struct rbuf *rbufs; /* rbuf array */ - struct rbuf_list rbuf_free; /* free rbufs list */ - struct rbuf_list rbuf_used; /* used rbufs list */ - u_int rbuf_total; /* total number of buffs */ - bus_dma_tag_t rbuf_tag; /* tag for rbuf mapping */ - - /* transmission */ - bus_dma_tag_t tx_tag; /* transmission tag */ - - uint32_t heartbeat; /* last heartbeat */ - u_int stop_cnt; /* how many times checked */ - - struct istats istats; /* internal statistics */ - - /* SUNI state */ - struct utopia utopia; - - /* sysctl support */ - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - -#ifdef FATM_DEBUG - /* debugging */ - u_int debug; -#endif -}; - -#ifndef FATM_DEBUG -#define FATM_LOCK(SC) mtx_lock(&(SC)->mtx) -#define FATM_UNLOCK(SC) mtx_unlock(&(SC)->mtx) -#else -#define FATM_LOCK(SC) do { \ - DBG(SC, LOCK, ("locking in line %d", __LINE__)); \ - mtx_lock(&(SC)->mtx); \ - } while (0) -#define FATM_UNLOCK(SC) do { \ - DBG(SC, LOCK, ("unlocking in line %d", __LINE__)); \ - mtx_unlock(&(SC)->mtx); \ - } while (0) -#endif -#define FATM_CHECKLOCK(SC) mtx_assert(&sc->mtx, MA_OWNED) - -/* - * Macros to access host memory fields that are also access by the card. - * These fields need to little-endian always. - */ -#define H_GETSTAT(STATP) (le32toh(*(STATP))) -#define H_SETSTAT(STATP, S) do { *(STATP) = htole32(S); } while (0) -#define H_SETDESC(DESC, D) do { (DESC) = htole32(D); } while (0) - -#ifdef notyet -#define H_SYNCSTAT_POSTREAD(SC, P) \ - bus_dmamap_sync_size((SC)->stat_mem.dmat, \ - (SC)->stat_mem.map, \ - (volatile char *)(P) - (volatile char *)(SC)->stat_mem.mem, \ - sizeof(volatile uint32_t), BUS_DMASYNC_POSTREAD) - -#define H_SYNCSTAT_PREWRITE(SC, P) \ - bus_dmamap_sync_size((SC)->stat_mem.dmat, \ - (SC)->stat_mem.map, \ - (volatile char *)(P) - (volatile char *)(SC)->stat_mem.mem, \ - sizeof(volatile uint32_t), BUS_DMASYNC_PREWRITE) - -#define H_SYNCQ_PREWRITE(M, P, SZ) \ - bus_dmamap_sync_size((M)->dmat, (M)->map, \ - (volatile char *)(P) - (volatile char *)(M)->mem, (SZ), \ - BUS_DMASYNC_PREWRITE) - -#define H_SYNCQ_POSTREAD(M, P, SZ) \ - bus_dmamap_sync_size((M)->dmat, (M)->map, \ - (volatile char *)(P) - (volatile char *)(M)->mem, (SZ), \ - BUS_DMASYNC_POSTREAD) -#else -#define H_SYNCSTAT_POSTREAD(SC, P) do { } while (0) -#define H_SYNCSTAT_PREWRITE(SC, P) do { } while (0) -#define H_SYNCQ_PREWRITE(M, P, SZ) do { } while (0) -#define H_SYNCQ_POSTREAD(M, P, SZ) do { } while (0) -#endif - -/* - * Macros to manipulate VPVCs - */ -#define MKVPVC(VPI,VCI) (((VPI) << 16) | (VCI)) -#define GETVPI(VPVC) (((VPVC) >> 16) & 0xff) -#define GETVCI(VPVC) ((VPVC) & 0xffff) - -/* - * These macros encapsulate the bus_space functions for better readabiliy. - */ -#define WRITE4(SC, OFF, VAL) bus_space_write_4(SC->memt, SC->memh, OFF, VAL) -#define WRITE1(SC, OFF, VAL) bus_space_write_1(SC->memt, SC->memh, OFF, VAL) - -#define READ4(SC, OFF) bus_space_read_4(SC->memt, SC->memh, OFF) -#define READ1(SC, OFF) bus_space_read_1(SC->memt, SC->memh, OFF) - -#define BARRIER_R(SC) \ - bus_space_barrier(SC->memt, SC->memh, 0, FATMO_END, \ - BUS_SPACE_BARRIER_READ) -#define BARRIER_W(SC) \ - bus_space_barrier(SC->memt, SC->memh, 0, FATMO_END, \ - BUS_SPACE_BARRIER_WRITE) -#define BARRIER_RW(SC) \ - bus_space_barrier(SC->memt, SC->memh, 0, FATMO_END, \ - BUS_SPACE_BARRIER_WRITE|BUS_SPACE_BARRIER_READ) - -#ifdef FATM_DEBUG -#define DBG(SC, FL, PRINT) do { \ - if ((SC)->debug & DBG_##FL) { \ - if_printf(&(SC)->ifatm.ifnet, "%s: ", __func__); \ - printf PRINT; \ - printf("\n"); \ - } \ - } while (0) -#define DBGC(SC, FL, PRINT) do { \ - if ((SC)->debug & DBG_##FL) \ - printf PRINT; \ - } while (0) - -enum { - DBG_RCV = 0x0001, - DBG_XMIT = 0x0002, - DBG_VCC = 0x0004, - DBG_IOCTL = 0x0008, - DBG_ATTACH = 0x0010, - DBG_INIT = 0x0020, - DBG_DMA = 0x0040, - DBG_BEAT = 0x0080, - DBG_UART = 0x0100, - DBG_LOCK = 0x0200, - - DBG_ALL = 0xffff -}; - -#else -#define DBG(SC, FL, PRINT) -#define DBGC(SC, FL, PRINT) -#endif - -/* - * Configuration. - * - * This section contains tunable parameters and dependend defines. - */ -#define FATM_CMD_QLEN 16 /* command queue length */ -#ifndef TEST_DMA_SYNC -#define FATM_TX_QLEN 128 /* transmit queue length */ -#define FATM_RX_QLEN 64 /* receive queue length */ -#else -#define FATM_TX_QLEN 8 /* transmit queue length */ -#define FATM_RX_QLEN 8 /* receive queue length */ -#endif - -#define SMALL_SUPPLY_QLEN 16 -#define SMALL_POOL_SIZE 256 -#define SMALL_SUPPLY_BLKSIZE 8 - -#define LARGE_SUPPLY_QLEN 16 -#define LARGE_POOL_SIZE 128 -#define LARGE_SUPPLY_BLKSIZE 8 diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c deleted file mode 100644 index e87b79f7ba96..000000000000 --- a/sys/dev/hatm/if_hatm.c +++ /dev/null @@ -1,2419 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * ForeHE driver. - * - * This file contains the module and driver infrastructure stuff as well - * as a couple of utility functions and the entire initialisation. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static const struct { - uint16_t vid; - uint16_t did; - const char *name; -} hatm_devs[] = { - { 0x1127, 0x400, - "FORE HE" }, - { 0, 0, NULL } -}; - -SYSCTL_DECL(_hw_atm); - -MODULE_DEPEND(hatm, utopia, 1, 1, 1); -MODULE_DEPEND(hatm, pci, 1, 1, 1); -MODULE_DEPEND(hatm, atm, 1, 1, 1); - -#define EEPROM_DELAY 400 /* microseconds */ - -/* Read from EEPROM 0000 0011b */ -static const uint32_t readtab[] = { - HE_REGM_HOST_PROM_SEL | HE_REGM_HOST_PROM_CLOCK, - 0, - HE_REGM_HOST_PROM_CLOCK, - 0, /* 0 */ - HE_REGM_HOST_PROM_CLOCK, - 0, /* 0 */ - HE_REGM_HOST_PROM_CLOCK, - 0, /* 0 */ - HE_REGM_HOST_PROM_CLOCK, - 0, /* 0 */ - HE_REGM_HOST_PROM_CLOCK, - 0, /* 0 */ - HE_REGM_HOST_PROM_CLOCK, - HE_REGM_HOST_PROM_DATA_IN, /* 0 */ - HE_REGM_HOST_PROM_CLOCK | HE_REGM_HOST_PROM_DATA_IN, - HE_REGM_HOST_PROM_DATA_IN, /* 1 */ - HE_REGM_HOST_PROM_CLOCK | HE_REGM_HOST_PROM_DATA_IN, - HE_REGM_HOST_PROM_DATA_IN, /* 1 */ -}; -static const uint32_t clocktab[] = { - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0, HE_REGM_HOST_PROM_CLOCK, - 0 -}; - -/* - * Convert cell rate to ATM Forum format - */ -u_int -hatm_cps2atmf(uint32_t pcr) -{ - u_int e; - - if (pcr == 0) - return (0); - pcr <<= 9; - e = 0; - while (pcr > (1024 - 1)) { - e++; - pcr >>= 1; - } - return ((1 << 14) | (e << 9) | (pcr & 0x1ff)); -} -u_int -hatm_atmf2cps(uint32_t fcr) -{ - fcr &= 0x7fff; - - return ((1 << ((fcr >> 9) & 0x1f)) * (512 + (fcr & 0x1ff)) / 512 - * (fcr >> 14)); -} - -/************************************************************ - * - * Initialisation - */ -/* - * Probe for a HE controller - */ -static int -hatm_probe(device_t dev) -{ - int i; - - for (i = 0; hatm_devs[i].name; i++) - if (pci_get_vendor(dev) == hatm_devs[i].vid && - pci_get_device(dev) == hatm_devs[i].did) { - device_set_desc(dev, hatm_devs[i].name); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -/* - * Allocate and map DMA-able memory. We support only contiguous mappings. - */ -static void -dmaload_helper(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - if (error) - return; - KASSERT(nsegs == 1, ("too many segments for DMA: %d", nsegs)); - KASSERT(segs[0].ds_addr <= 0xffffffffUL, - ("phys addr too large %lx", (u_long)segs[0].ds_addr)); - - *(bus_addr_t *)arg = segs[0].ds_addr; -} -static int -hatm_alloc_dmamem(struct hatm_softc *sc, const char *what, struct dmamem *mem) -{ - int error; - - mem->base = NULL; - - /* - * Alignement does not work in the bus_dmamem_alloc function below - * on FreeBSD. malloc seems to align objects at least to the object - * size so increase the size to the alignment if the size is lesser - * than the alignemnt. - * XXX on sparc64 this is (probably) not needed. - */ - if (mem->size < mem->align) - mem->size = mem->align; - - error = bus_dma_tag_create(sc->parent_tag, mem->align, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, mem->size, 1, - BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, - NULL, NULL, &mem->tag); - if (error) { - if_printf(sc->ifp, "DMA tag create (%s)\n", what); - return (error); - } - - error = bus_dmamem_alloc(mem->tag, &mem->base, 0, &mem->map); - if (error) { - if_printf(sc->ifp, "DMA mem alloc (%s): %d\n", - what, error); - bus_dma_tag_destroy(mem->tag); - mem->base = NULL; - return (error); - } - - error = bus_dmamap_load(mem->tag, mem->map, mem->base, mem->size, - dmaload_helper, &mem->paddr, BUS_DMA_NOWAIT); - if (error) { - if_printf(sc->ifp, "DMA map load (%s): %d\n", - what, error); - bus_dmamem_free(mem->tag, mem->base, mem->map); - bus_dma_tag_destroy(mem->tag); - mem->base = NULL; - return (error); - } - - DBG(sc, DMA, ("%s S/A/V/P 0x%x 0x%x %p 0x%lx", what, mem->size, - mem->align, mem->base, (u_long)mem->paddr)); - - return (0); -} - -/* - * Destroy all the resources of an DMA-able memory region. - */ -static void -hatm_destroy_dmamem(struct dmamem *mem) -{ - if (mem->base != NULL) { - bus_dmamap_unload(mem->tag, mem->map); - bus_dmamem_free(mem->tag, mem->base, mem->map); - (void)bus_dma_tag_destroy(mem->tag); - mem->base = NULL; - } -} - -/* - * Initialize/destroy DMA maps for the large pool 0 - */ -static void -hatm_destroy_rmaps(struct hatm_softc *sc) -{ - u_int b; - - DBG(sc, ATTACH, ("destroying rmaps and lbuf pointers...")); - if (sc->rmaps != NULL) { - for (b = 0; b < sc->lbufs_size; b++) - bus_dmamap_destroy(sc->mbuf_tag, sc->rmaps[b]); - free(sc->rmaps, M_DEVBUF); - } - if (sc->lbufs != NULL) - free(sc->lbufs, M_DEVBUF); -} - -static void -hatm_init_rmaps(struct hatm_softc *sc) -{ - u_int b; - int err; - - DBG(sc, ATTACH, ("allocating rmaps and lbuf pointers...")); - sc->lbufs = malloc(sizeof(sc->lbufs[0]) * sc->lbufs_size, - M_DEVBUF, M_ZERO | M_WAITOK); - - /* allocate and create the DMA maps for the large pool */ - sc->rmaps = malloc(sizeof(sc->rmaps[0]) * sc->lbufs_size, - M_DEVBUF, M_WAITOK); - for (b = 0; b < sc->lbufs_size; b++) { - err = bus_dmamap_create(sc->mbuf_tag, 0, &sc->rmaps[b]); - if (err != 0) - panic("bus_dmamap_create: %d\n", err); - } -} - -/* - * Initialize and destroy small mbuf page pointers and pages - */ -static void -hatm_destroy_smbufs(struct hatm_softc *sc) -{ - u_int i, b; - struct mbuf_page *pg; - struct mbuf_chunk_hdr *h; - - if (sc->mbuf_pages != NULL) { - for (i = 0; i < sc->mbuf_npages; i++) { - pg = sc->mbuf_pages[i]; - for (b = 0; b < pg->hdr.nchunks; b++) { - h = (struct mbuf_chunk_hdr *) ((char *)pg + - b * pg->hdr.chunksize + pg->hdr.hdroff); - if (h->flags & MBUF_CARD) - if_printf(sc->ifp, - "%s -- mbuf page=%u card buf %u\n", - __func__, i, b); - if (h->flags & MBUF_USED) - if_printf(sc->ifp, - "%s -- mbuf page=%u used buf %u\n", - __func__, i, b); - } - bus_dmamap_unload(sc->mbuf_tag, pg->hdr.map); - bus_dmamap_destroy(sc->mbuf_tag, pg->hdr.map); - free(pg, M_DEVBUF); - } - free(sc->mbuf_pages, M_DEVBUF); - } -} - -static void -hatm_init_smbufs(struct hatm_softc *sc) -{ - sc->mbuf_pages = malloc(sizeof(sc->mbuf_pages[0]) * - sc->mbuf_max_pages, M_DEVBUF, M_WAITOK); - sc->mbuf_npages = 0; -} - -/* - * Initialize/destroy TPDs. This is called from attach/detach. - */ -static void -hatm_destroy_tpds(struct hatm_softc *sc) -{ - struct tpd *t; - - if (sc->tpds.base == NULL) - return; - - DBG(sc, ATTACH, ("releasing TPDs ...")); - if (sc->tpd_nfree != sc->tpd_total) - if_printf(sc->ifp, "%u tpds still in use from %u\n", - sc->tpd_total - sc->tpd_nfree, sc->tpd_total); - while ((t = SLIST_FIRST(&sc->tpd_free)) != NULL) { - SLIST_REMOVE_HEAD(&sc->tpd_free, link); - bus_dmamap_destroy(sc->tx_tag, t->map); - } - hatm_destroy_dmamem(&sc->tpds); - free(sc->tpd_used, M_DEVBUF); - DBG(sc, ATTACH, ("... done")); -} -static int -hatm_init_tpds(struct hatm_softc *sc) -{ - int error; - u_int i; - struct tpd *t; - - DBG(sc, ATTACH, ("allocating %u TPDs and maps ...", sc->tpd_total)); - error = hatm_alloc_dmamem(sc, "TPD memory", &sc->tpds); - if (error != 0) { - DBG(sc, ATTACH, ("... dmamem error=%d", error)); - return (error); - } - - /* put all the TPDs on the free list and allocate DMA maps */ - for (i = 0; i < sc->tpd_total; i++) { - t = TPD_ADDR(sc, i); - t->no = i; - t->mbuf = NULL; - error = bus_dmamap_create(sc->tx_tag, 0, &t->map); - if (error != 0) { - DBG(sc, ATTACH, ("... dmamap error=%d", error)); - while ((t = SLIST_FIRST(&sc->tpd_free)) != NULL) { - SLIST_REMOVE_HEAD(&sc->tpd_free, link); - bus_dmamap_destroy(sc->tx_tag, t->map); - } - hatm_destroy_dmamem(&sc->tpds); - return (error); - } - - SLIST_INSERT_HEAD(&sc->tpd_free, t, link); - } - - /* allocate and zero bitmap */ - sc->tpd_used = malloc(sizeof(uint8_t) * (sc->tpd_total + 7) / 8, - M_DEVBUF, M_ZERO | M_WAITOK); - sc->tpd_nfree = sc->tpd_total; - - DBG(sc, ATTACH, ("... done")); - - return (0); -} - -/* - * Free all the TPDs that where given to the card. - * An mbuf chain may be attached to a TPD - free it also and - * unload its associated DMA map. - */ -static void -hatm_stop_tpds(struct hatm_softc *sc) -{ - u_int i; - struct tpd *t; - - DBG(sc, ATTACH, ("free TPDs ...")); - for (i = 0; i < sc->tpd_total; i++) { - if (TPD_TST_USED(sc, i)) { - t = TPD_ADDR(sc, i); - if (t->mbuf) { - m_freem(t->mbuf); - t->mbuf = NULL; - bus_dmamap_unload(sc->tx_tag, t->map); - } - TPD_CLR_USED(sc, i); - SLIST_INSERT_HEAD(&sc->tpd_free, t, link); - sc->tpd_nfree++; - } - } -} - -/* - * This frees ALL resources of this interface and leaves the structure - * in an indeterminate state. This is called just before detaching or - * on a failed attach. No lock should be held. - */ -static void -hatm_destroy(struct hatm_softc *sc) -{ - u_int cid; - - bus_teardown_intr(sc->dev, sc->irqres, sc->ih); - - hatm_destroy_rmaps(sc); - hatm_destroy_smbufs(sc); - hatm_destroy_tpds(sc); - - if (sc->vcc_zone != NULL) { - for (cid = 0; cid < HE_MAX_VCCS; cid++) - if (sc->vccs[cid] != NULL) - uma_zfree(sc->vcc_zone, sc->vccs[cid]); - uma_zdestroy(sc->vcc_zone); - } - - /* - * Release all memory allocated to the various queues and - * Status pages. These have there own flag which shows whether - * they are really allocated. - */ - hatm_destroy_dmamem(&sc->irq_0.mem); - hatm_destroy_dmamem(&sc->rbp_s0.mem); - hatm_destroy_dmamem(&sc->rbp_l0.mem); - hatm_destroy_dmamem(&sc->rbp_s1.mem); - hatm_destroy_dmamem(&sc->rbrq_0.mem); - hatm_destroy_dmamem(&sc->rbrq_1.mem); - hatm_destroy_dmamem(&sc->tbrq.mem); - hatm_destroy_dmamem(&sc->tpdrq.mem); - hatm_destroy_dmamem(&sc->hsp_mem); - - if (sc->irqres != NULL) - bus_release_resource(sc->dev, SYS_RES_IRQ, - sc->irqid, sc->irqres); - - if (sc->tx_tag != NULL) - if (bus_dma_tag_destroy(sc->tx_tag)) - if_printf(sc->ifp, "mbuf DMA tag busy\n"); - - if (sc->mbuf_tag != NULL) - if (bus_dma_tag_destroy(sc->mbuf_tag)) - if_printf(sc->ifp, "mbuf DMA tag busy\n"); - - if (sc->parent_tag != NULL) - if (bus_dma_tag_destroy(sc->parent_tag)) - if_printf(sc->ifp, "parent DMA tag busy\n"); - - if (sc->memres != NULL) - bus_release_resource(sc->dev, SYS_RES_MEMORY, - sc->memid, sc->memres); - - sysctl_ctx_free(&sc->sysctl_ctx); - - cv_destroy(&sc->cv_rcclose); - cv_destroy(&sc->vcc_cv); - mtx_destroy(&sc->mtx); - - if (sc->ifp != NULL) - if_free(sc->ifp); -} - -/* - * 4.4 Card reset - */ -static int -hatm_reset(struct hatm_softc *sc) -{ - u_int v, count; - - WRITE4(sc, HE_REGO_RESET_CNTL, 0x00); - BARRIER_W(sc); - WRITE4(sc, HE_REGO_RESET_CNTL, 0xff); - BARRIER_RW(sc); - count = 0; - while (((v = READ4(sc, HE_REGO_RESET_CNTL)) & HE_REGM_RESET_STATE) == 0) { - BARRIER_R(sc); - if (++count == 100) { - if_printf(sc->ifp, "reset failed\n"); - return (ENXIO); - } - DELAY(1000); - } - return (0); -} - -/* - * 4.5 Set Bus Width - */ -static void -hatm_init_bus_width(struct hatm_softc *sc) -{ - uint32_t v, v1; - - v = READ4(sc, HE_REGO_HOST_CNTL); - BARRIER_R(sc); - if (v & HE_REGM_HOST_BUS64) { - sc->pci64 = 1; - v1 = pci_read_config(sc->dev, HE_PCIR_GEN_CNTL_0, 4); - v1 |= HE_PCIM_CTL0_64BIT; - pci_write_config(sc->dev, HE_PCIR_GEN_CNTL_0, v1, 4); - - v |= HE_REGM_HOST_DESC_RD64 - | HE_REGM_HOST_DATA_RD64 - | HE_REGM_HOST_DATA_WR64; - WRITE4(sc, HE_REGO_HOST_CNTL, v); - BARRIER_W(sc); - } else { - sc->pci64 = 0; - v = pci_read_config(sc->dev, HE_PCIR_GEN_CNTL_0, 4); - v &= ~HE_PCIM_CTL0_64BIT; - pci_write_config(sc->dev, HE_PCIR_GEN_CNTL_0, v, 4); - } -} - -/* - * 4.6 Set Host Endianness - */ -static void -hatm_init_endianess(struct hatm_softc *sc) -{ - uint32_t v; - - v = READ4(sc, HE_REGO_LB_SWAP); - BARRIER_R(sc); -#if BYTE_ORDER == BIG_ENDIAN - v |= HE_REGM_LBSWAP_INTR_SWAP | - HE_REGM_LBSWAP_DESC_WR_SWAP | - HE_REGM_LBSWAP_BIG_ENDIAN; - v &= ~(HE_REGM_LBSWAP_DATA_WR_SWAP | - HE_REGM_LBSWAP_DESC_RD_SWAP | - HE_REGM_LBSWAP_DATA_RD_SWAP); -#else - v &= ~(HE_REGM_LBSWAP_DATA_WR_SWAP | - HE_REGM_LBSWAP_DESC_RD_SWAP | - HE_REGM_LBSWAP_DATA_RD_SWAP | - HE_REGM_LBSWAP_INTR_SWAP | - HE_REGM_LBSWAP_DESC_WR_SWAP | - HE_REGM_LBSWAP_BIG_ENDIAN); -#endif - - if (sc->he622) - v |= HE_REGM_LBSWAP_XFER_SIZE; - - WRITE4(sc, HE_REGO_LB_SWAP, v); - BARRIER_W(sc); -} - -/* - * 4.7 Read EEPROM - */ -static uint8_t -hatm_read_prom_byte(struct hatm_softc *sc, u_int addr) -{ - uint32_t val, tmp_read, byte_read; - u_int i, j; - int n; - - val = READ4(sc, HE_REGO_HOST_CNTL); - val &= HE_REGM_HOST_PROM_BITS; - BARRIER_R(sc); - - val |= HE_REGM_HOST_PROM_WREN; - WRITE4(sc, HE_REGO_HOST_CNTL, val); - BARRIER_W(sc); - - /* send READ */ - for (i = 0; i < nitems(readtab); i++) { - WRITE4(sc, HE_REGO_HOST_CNTL, val | readtab[i]); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - } - - /* send ADDRESS */ - for (n = 7, j = 0; n >= 0; n--) { - WRITE4(sc, HE_REGO_HOST_CNTL, val | clocktab[j++] | - (((addr >> n) & 1 ) << HE_REGS_HOST_PROM_DATA_IN)); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - WRITE4(sc, HE_REGO_HOST_CNTL, val | clocktab[j++] | - (((addr >> n) & 1 ) << HE_REGS_HOST_PROM_DATA_IN)); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - } - - val &= ~HE_REGM_HOST_PROM_WREN; - WRITE4(sc, HE_REGO_HOST_CNTL, val); - BARRIER_W(sc); - - /* read DATA */ - byte_read = 0; - for (n = 7, j = 0; n >= 0; n--) { - WRITE4(sc, HE_REGO_HOST_CNTL, val | clocktab[j++]); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - tmp_read = READ4(sc, HE_REGO_HOST_CNTL); - byte_read |= (uint8_t)(((tmp_read & HE_REGM_HOST_PROM_DATA_OUT) - >> HE_REGS_HOST_PROM_DATA_OUT) << n); - WRITE4(sc, HE_REGO_HOST_CNTL, val | clocktab[j++]); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - } - WRITE4(sc, HE_REGO_HOST_CNTL, val | clocktab[j++]); - BARRIER_W(sc); - DELAY(EEPROM_DELAY); - - return (byte_read); -} - -static void -hatm_init_read_eeprom(struct hatm_softc *sc) -{ - u_int n, count; - u_char byte; - uint32_t v; - - for (n = count = 0; count < HE_EEPROM_PROD_ID_LEN; count++) { - byte = hatm_read_prom_byte(sc, HE_EEPROM_PROD_ID + count); - if (n > 0 || byte != ' ') - sc->prod_id[n++] = byte; - } - while (n > 0 && sc->prod_id[n-1] == ' ') - n--; - sc->prod_id[n] = '\0'; - - for (n = count = 0; count < HE_EEPROM_REV_LEN; count++) { - byte = hatm_read_prom_byte(sc, HE_EEPROM_REV + count); - if (n > 0 || byte != ' ') - sc->rev[n++] = byte; - } - while (n > 0 && sc->rev[n-1] == ' ') - n--; - sc->rev[n] = '\0'; - IFP2IFATM(sc->ifp)->mib.hw_version = sc->rev[0]; - - IFP2IFATM(sc->ifp)->mib.serial = hatm_read_prom_byte(sc, HE_EEPROM_M_SN + 0) << 0; - IFP2IFATM(sc->ifp)->mib.serial |= hatm_read_prom_byte(sc, HE_EEPROM_M_SN + 1) << 8; - IFP2IFATM(sc->ifp)->mib.serial |= hatm_read_prom_byte(sc, HE_EEPROM_M_SN + 2) << 16; - IFP2IFATM(sc->ifp)->mib.serial |= hatm_read_prom_byte(sc, HE_EEPROM_M_SN + 3) << 24; - - v = hatm_read_prom_byte(sc, HE_EEPROM_MEDIA + 0) << 0; - v |= hatm_read_prom_byte(sc, HE_EEPROM_MEDIA + 1) << 8; - v |= hatm_read_prom_byte(sc, HE_EEPROM_MEDIA + 2) << 16; - v |= hatm_read_prom_byte(sc, HE_EEPROM_MEDIA + 3) << 24; - - switch (v) { - case HE_MEDIA_UTP155: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UTP_155; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - break; - - case HE_MEDIA_MMF155: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_155; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - break; - - case HE_MEDIA_MMF622: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_622; - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_HE622; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_622M; - sc->he622 = 1; - break; - - case HE_MEDIA_SMF155: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_SM_155; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - break; - - case HE_MEDIA_SMF622: - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_SM_622; - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_HE622; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_622M; - sc->he622 = 1; - break; - } - - IFP2IFATM(sc->ifp)->mib.esi[0] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 0); - IFP2IFATM(sc->ifp)->mib.esi[1] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 1); - IFP2IFATM(sc->ifp)->mib.esi[2] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 2); - IFP2IFATM(sc->ifp)->mib.esi[3] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 3); - IFP2IFATM(sc->ifp)->mib.esi[4] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 4); - IFP2IFATM(sc->ifp)->mib.esi[5] = hatm_read_prom_byte(sc, HE_EEPROM_MAC + 5); -} - -/* - * Clear unused interrupt queue - */ -static void -hatm_clear_irq(struct hatm_softc *sc, u_int group) -{ - WRITE4(sc, HE_REGO_IRQ_BASE(group), 0); - WRITE4(sc, HE_REGO_IRQ_HEAD(group), 0); - WRITE4(sc, HE_REGO_IRQ_CNTL(group), 0); - WRITE4(sc, HE_REGO_IRQ_DATA(group), 0); -} - -/* - * 4.10 Initialize interrupt queues - */ -static void -hatm_init_irq(struct hatm_softc *sc, struct heirq *q, u_int group) -{ - u_int i; - - if (q->size == 0) { - hatm_clear_irq(sc, group); - return; - } - - q->group = group; - q->sc = sc; - q->irq = q->mem.base; - q->head = 0; - q->tailp = q->irq + (q->size - 1); - *q->tailp = 0; - - for (i = 0; i < q->size; i++) - q->irq[i] = HE_REGM_ITYPE_INVALID; - - WRITE4(sc, HE_REGO_IRQ_BASE(group), q->mem.paddr); - WRITE4(sc, HE_REGO_IRQ_HEAD(group), - ((q->size - 1) << HE_REGS_IRQ_HEAD_SIZE) | - (q->thresh << HE_REGS_IRQ_HEAD_THRESH)); - WRITE4(sc, HE_REGO_IRQ_CNTL(group), q->line); - WRITE4(sc, HE_REGO_IRQ_DATA(group), 0); -} - -/* - * 5.1.3 Initialize connection memory - */ -static void -hatm_init_cm(struct hatm_softc *sc) -{ - u_int rsra, mlbm, rabr, numbuffs; - u_int tsra, tabr, mtpd; - u_int n; - - for (n = 0; n < HE_CONFIG_TXMEM; n++) - WRITE_TCM4(sc, n, 0); - for (n = 0; n < HE_CONFIG_RXMEM; n++) - WRITE_RCM4(sc, n, 0); - - numbuffs = sc->r0_numbuffs + sc->r1_numbuffs + sc->tx_numbuffs; - - rsra = 0; - mlbm = ((rsra + IFP2IFATM(sc->ifp)->mib.max_vccs * 8) + 0x7ff) & ~0x7ff; - rabr = ((mlbm + numbuffs * 2) + 0x7ff) & ~0x7ff; - sc->rsrb = roundup2(rabr + 2048, 2 * IFP2IFATM(sc->ifp)->mib.max_vccs); - - tsra = 0; - sc->tsrb = tsra + IFP2IFATM(sc->ifp)->mib.max_vccs * 8; - sc->tsrc = sc->tsrb + IFP2IFATM(sc->ifp)->mib.max_vccs * 4; - sc->tsrd = sc->tsrc + IFP2IFATM(sc->ifp)->mib.max_vccs * 2; - tabr = sc->tsrd + IFP2IFATM(sc->ifp)->mib.max_vccs * 1; - mtpd = roundup2(tabr + 1024, 16 * IFP2IFATM(sc->ifp)->mib.max_vccs); - - DBG(sc, ATTACH, ("rsra=%x mlbm=%x rabr=%x rsrb=%x", - rsra, mlbm, rabr, sc->rsrb)); - DBG(sc, ATTACH, ("tsra=%x tsrb=%x tsrc=%x tsrd=%x tabr=%x mtpd=%x", - tsra, sc->tsrb, sc->tsrc, sc->tsrd, tabr, mtpd)); - - WRITE4(sc, HE_REGO_TSRB_BA, sc->tsrb); - WRITE4(sc, HE_REGO_TSRC_BA, sc->tsrc); - WRITE4(sc, HE_REGO_TSRD_BA, sc->tsrd); - WRITE4(sc, HE_REGO_TMABR_BA, tabr); - WRITE4(sc, HE_REGO_TPD_BA, mtpd); - - WRITE4(sc, HE_REGO_RCMRSRB_BA, sc->rsrb); - WRITE4(sc, HE_REGO_RCMLBM_BA, mlbm); - WRITE4(sc, HE_REGO_RCMABR_BA, rabr); - - BARRIER_W(sc); -} - -/* - * 5.1.4 Initialize Local buffer Pools - */ -static void -hatm_init_rx_buffer_pool(struct hatm_softc *sc, - u_int num, /* bank */ - u_int start, /* start row */ - u_int numbuffs /* number of entries */ -) -{ - u_int row_size; /* bytes per row */ - uint32_t row_addr; /* start address of this row */ - u_int lbuf_size; /* bytes per lbuf */ - u_int lbufs_per_row; /* number of lbufs per memory row */ - uint32_t lbufd_index; /* index of lbuf descriptor */ - uint32_t lbufd_addr; /* address of lbuf descriptor */ - u_int lbuf_row_cnt; /* current lbuf in current row */ - uint32_t lbuf_addr; /* address of current buffer */ - u_int i; - - row_size = sc->bytes_per_row; - row_addr = start * row_size; - lbuf_size = sc->cells_per_lbuf * 48; - lbufs_per_row = sc->cells_per_row / sc->cells_per_lbuf; - - /* descriptor index */ - lbufd_index = num; - - /* 2 words per entry */ - lbufd_addr = READ4(sc, HE_REGO_RCMLBM_BA) + lbufd_index * 2; - - /* write head of queue */ - WRITE4(sc, HE_REGO_RLBF_H(num), lbufd_index); - - lbuf_row_cnt = 0; - for (i = 0; i < numbuffs; i++) { - lbuf_addr = (row_addr + lbuf_row_cnt * lbuf_size) / 32; - - WRITE_RCM4(sc, lbufd_addr, lbuf_addr); - - lbufd_index += 2; - WRITE_RCM4(sc, lbufd_addr + 1, lbufd_index); - - if (++lbuf_row_cnt == lbufs_per_row) { - lbuf_row_cnt = 0; - row_addr += row_size; - } - - lbufd_addr += 2 * 2; - } - - WRITE4(sc, HE_REGO_RLBF_T(num), lbufd_index - 2); - WRITE4(sc, HE_REGO_RLBF_C(num), numbuffs); - - BARRIER_W(sc); -} - -static void -hatm_init_tx_buffer_pool(struct hatm_softc *sc, - u_int start, /* start row */ - u_int numbuffs /* number of entries */ -) -{ - u_int row_size; /* bytes per row */ - uint32_t row_addr; /* start address of this row */ - u_int lbuf_size; /* bytes per lbuf */ - u_int lbufs_per_row; /* number of lbufs per memory row */ - uint32_t lbufd_index; /* index of lbuf descriptor */ - uint32_t lbufd_addr; /* address of lbuf descriptor */ - u_int lbuf_row_cnt; /* current lbuf in current row */ - uint32_t lbuf_addr; /* address of current buffer */ - u_int i; - - row_size = sc->bytes_per_row; - row_addr = start * row_size; - lbuf_size = sc->cells_per_lbuf * 48; - lbufs_per_row = sc->cells_per_row / sc->cells_per_lbuf; - - /* descriptor index */ - lbufd_index = sc->r0_numbuffs + sc->r1_numbuffs; - - /* 2 words per entry */ - lbufd_addr = READ4(sc, HE_REGO_RCMLBM_BA) + lbufd_index * 2; - - /* write head of queue */ - WRITE4(sc, HE_REGO_TLBF_H, lbufd_index); - - lbuf_row_cnt = 0; - for (i = 0; i < numbuffs; i++) { - lbuf_addr = (row_addr + lbuf_row_cnt * lbuf_size) / 32; - - WRITE_RCM4(sc, lbufd_addr, lbuf_addr); - lbufd_index++; - WRITE_RCM4(sc, lbufd_addr + 1, lbufd_index); - - if (++lbuf_row_cnt == lbufs_per_row) { - lbuf_row_cnt = 0; - row_addr += row_size; - } - - lbufd_addr += 2; - } - - WRITE4(sc, HE_REGO_TLBF_T, lbufd_index - 1); - BARRIER_W(sc); -} - -/* - * 5.1.5 Initialize Intermediate Receive Queues - */ -static void -hatm_init_imed_queues(struct hatm_softc *sc) -{ - u_int n; - - if (sc->he622) { - for (n = 0; n < 8; n++) { - WRITE4(sc, HE_REGO_INMQ_S(n), 0x10*n+0x000f); - WRITE4(sc, HE_REGO_INMQ_L(n), 0x10*n+0x200f); - } - } else { - for (n = 0; n < 8; n++) { - WRITE4(sc, HE_REGO_INMQ_S(n), n); - WRITE4(sc, HE_REGO_INMQ_L(n), n+0x8); - } - } -} - -/* - * 5.1.7 Init CS block - */ -static void -hatm_init_cs_block(struct hatm_softc *sc) -{ - u_int n, i; - u_int clkfreg, cellrate, decr, tmp; - static const uint32_t erthr[2][5][3] = HE_REGT_CS_ERTHR; - static const uint32_t erctl[2][3] = HE_REGT_CS_ERCTL; - static const uint32_t erstat[2][2] = HE_REGT_CS_ERSTAT; - static const uint32_t rtfwr[2] = HE_REGT_CS_RTFWR; - static const uint32_t rtatr[2] = HE_REGT_CS_RTATR; - static const uint32_t bwalloc[2][6] = HE_REGT_CS_BWALLOC; - static const uint32_t orcf[2][2] = HE_REGT_CS_ORCF; - - /* Clear Rate Controller Start Times and Occupied Flags */ - for (n = 0; n < 32; n++) - WRITE_MBOX4(sc, HE_REGO_CS_STTIM(n), 0); - - clkfreg = sc->he622 ? HE_622_CLOCK : HE_155_CLOCK; - cellrate = sc->he622 ? ATM_RATE_622M : ATM_RATE_155M; - decr = cellrate / 32; - - for (n = 0; n < 16; n++) { - tmp = clkfreg / cellrate; - WRITE_MBOX4(sc, HE_REGO_CS_TGRLD(n), tmp - 1); - cellrate -= decr; - } - - i = (sc->cells_per_lbuf == 2) ? 0 - :(sc->cells_per_lbuf == 4) ? 1 - : 2; - - /* table 5.2 */ - WRITE_MBOX4(sc, HE_REGO_CS_ERTHR0, erthr[sc->he622][0][i]); - WRITE_MBOX4(sc, HE_REGO_CS_ERTHR1, erthr[sc->he622][1][i]); - WRITE_MBOX4(sc, HE_REGO_CS_ERTHR2, erthr[sc->he622][2][i]); - WRITE_MBOX4(sc, HE_REGO_CS_ERTHR3, erthr[sc->he622][3][i]); - WRITE_MBOX4(sc, HE_REGO_CS_ERTHR4, erthr[sc->he622][4][i]); - - WRITE_MBOX4(sc, HE_REGO_CS_ERCTL0, erctl[sc->he622][0]); - WRITE_MBOX4(sc, HE_REGO_CS_ERCTL1, erctl[sc->he622][1]); - WRITE_MBOX4(sc, HE_REGO_CS_ERCTL2, erctl[sc->he622][2]); - - WRITE_MBOX4(sc, HE_REGO_CS_ERSTAT0, erstat[sc->he622][0]); - WRITE_MBOX4(sc, HE_REGO_CS_ERSTAT1, erstat[sc->he622][1]); - - WRITE_MBOX4(sc, HE_REGO_CS_RTFWR, rtfwr[sc->he622]); - WRITE_MBOX4(sc, HE_REGO_CS_RTATR, rtatr[sc->he622]); - - WRITE_MBOX4(sc, HE_REGO_CS_TFBSET, bwalloc[sc->he622][0]); - WRITE_MBOX4(sc, HE_REGO_CS_WCRMAX, bwalloc[sc->he622][1]); - WRITE_MBOX4(sc, HE_REGO_CS_WCRMIN, bwalloc[sc->he622][2]); - WRITE_MBOX4(sc, HE_REGO_CS_WCRINC, bwalloc[sc->he622][3]); - WRITE_MBOX4(sc, HE_REGO_CS_WCRDEC, bwalloc[sc->he622][4]); - WRITE_MBOX4(sc, HE_REGO_CS_WCRCEIL, bwalloc[sc->he622][5]); - - WRITE_MBOX4(sc, HE_REGO_CS_OTPPER, orcf[sc->he622][0]); - WRITE_MBOX4(sc, HE_REGO_CS_OTWPER, orcf[sc->he622][1]); - - WRITE_MBOX4(sc, HE_REGO_CS_OTTLIM, 8); - - for (n = 0; n < 8; n++) - WRITE_MBOX4(sc, HE_REGO_CS_HGRRT(n), 0); -} - -/* - * 5.1.8 CS Block Connection Memory Initialisation - */ -static void -hatm_init_cs_block_cm(struct hatm_softc *sc) -{ - u_int n, i; - u_int expt, mant, etrm, wcr, ttnrm, tnrm; - uint32_t rate; - uint32_t clkfreq, cellrate, decr; - uint32_t *rg, rtg, val = 0; - uint64_t drate; - u_int buf, buf_limit; - uint32_t base = READ4(sc, HE_REGO_RCMABR_BA); - - for (n = 0; n < HE_REGL_CM_GQTBL; n++) - WRITE_RCM4(sc, base + HE_REGO_CM_GQTBL + n, 0); - for (n = 0; n < HE_REGL_CM_RGTBL; n++) - WRITE_RCM4(sc, base + HE_REGO_CM_RGTBL + n, 0); - - tnrm = 0; - for (n = 0; n < HE_REGL_CM_TNRMTBL * 4; n++) { - expt = (n >> 5) & 0x1f; - mant = ((n & 0x18) << 4) | 0x7f; - wcr = (1 << expt) * (mant + 512) / 512; - etrm = n & 0x7; - ttnrm = wcr / 10 / (1 << etrm); - if (ttnrm > 255) - ttnrm = 255; - else if(ttnrm < 2) - ttnrm = 2; - tnrm = (tnrm << 8) | (ttnrm & 0xff); - if (n % 4 == 0) - WRITE_RCM4(sc, base + HE_REGO_CM_TNRMTBL + (n/4), tnrm); - } - - clkfreq = sc->he622 ? HE_622_CLOCK : HE_155_CLOCK; - buf_limit = 4; - - cellrate = sc->he622 ? ATM_RATE_622M : ATM_RATE_155M; - decr = cellrate / 32; - - /* compute GRID top row in 1000 * cps */ - for (n = 0; n < 16; n++) { - u_int interval = clkfreq / cellrate; - sc->rate_grid[0][n] = (u_int64_t)clkfreq * 1000 / interval; - cellrate -= decr; - } - - /* compute the other rows according to 2.4 */ - for (i = 1; i < 16; i++) - for (n = 0; n < 16; n++) - sc->rate_grid[i][n] = sc->rate_grid[i-1][n] / - ((i < 14) ? 2 : 4); - - /* first entry is line rate */ - n = hatm_cps2atmf(sc->he622 ? ATM_RATE_622M : ATM_RATE_155M); - expt = (n >> 9) & 0x1f; - mant = n & 0x1f0; - sc->rate_grid[0][0] = (u_int64_t)(1<he622 ? ATM_RATE_622M : ATM_RATE_155M; - rg = &sc->rate_grid[15][15]; - - for (rate = 0; rate < 2 * HE_REGL_CM_RTGTBL; rate++) { - /* unpack the ATMF rate */ - expt = rate >> 5; - mant = (rate & 0x1f) << 4; - - /* get the cell rate - minimum is 10 per second */ - drate = (uint64_t)(1 << expt) * 1000 * (mant + 512) / 512; - if (drate < 10 * 1000) - drate = 10 * 1000; - - /* now look up the grid index */ - while (drate >= *rg && rg-- > &sc->rate_grid[0][0]) - ; - rg++; - rtg = rg - &sc->rate_grid[0][0]; - - /* now compute the buffer limit */ - buf = drate * sc->tx_numbuffs / (cellrate * 2) / 1000; - if (buf == 0) - buf = 1; - else if (buf > buf_limit) - buf = buf_limit; - - /* make value */ - val = (val << 16) | (rtg << 8) | buf; - - /* write */ - if (rate % 2 == 1) - WRITE_RCM4(sc, base + HE_REGO_CM_RTGTBL + rate/2, val); - } -} - -/* - * Clear an unused receive group buffer pool - */ -static void -hatm_clear_rpool(struct hatm_softc *sc, u_int group, u_int large) -{ - WRITE4(sc, HE_REGO_RBP_S(large, group), 0); - WRITE4(sc, HE_REGO_RBP_T(large, group), 0); - WRITE4(sc, HE_REGO_RBP_QI(large, group), 1); - WRITE4(sc, HE_REGO_RBP_BL(large, group), 0); -} - -/* - * Initialize a receive group buffer pool - */ -static void -hatm_init_rpool(struct hatm_softc *sc, struct herbp *q, u_int group, - u_int large) -{ - if (q->size == 0) { - hatm_clear_rpool(sc, group, large); - return; - } - - bzero(q->mem.base, q->mem.size); - q->rbp = q->mem.base; - q->head = q->tail = 0; - - DBG(sc, ATTACH, ("RBP%u%c=0x%lx", group, "SL"[large], - (u_long)q->mem.paddr)); - - WRITE4(sc, HE_REGO_RBP_S(large, group), q->mem.paddr); - WRITE4(sc, HE_REGO_RBP_T(large, group), 0); - WRITE4(sc, HE_REGO_RBP_QI(large, group), - ((q->size - 1) << HE_REGS_RBP_SIZE) | - HE_REGM_RBP_INTR_ENB | - (q->thresh << HE_REGS_RBP_THRESH)); - WRITE4(sc, HE_REGO_RBP_BL(large, group), (q->bsize >> 2) & ~1); -} - -/* - * Clear an unused receive buffer return queue - */ -static void -hatm_clear_rbrq(struct hatm_softc *sc, u_int group) -{ - WRITE4(sc, HE_REGO_RBRQ_ST(group), 0); - WRITE4(sc, HE_REGO_RBRQ_H(group), 0); - WRITE4(sc, HE_REGO_RBRQ_Q(group), (1 << HE_REGS_RBRQ_THRESH)); - WRITE4(sc, HE_REGO_RBRQ_I(group), 0); -} - -/* - * Initialize receive buffer return queue - */ -static void -hatm_init_rbrq(struct hatm_softc *sc, struct herbrq *rq, u_int group) -{ - if (rq->size == 0) { - hatm_clear_rbrq(sc, group); - return; - } - - rq->rbrq = rq->mem.base; - rq->head = 0; - - DBG(sc, ATTACH, ("RBRQ%u=0x%lx", group, (u_long)rq->mem.paddr)); - - WRITE4(sc, HE_REGO_RBRQ_ST(group), rq->mem.paddr); - WRITE4(sc, HE_REGO_RBRQ_H(group), 0); - WRITE4(sc, HE_REGO_RBRQ_Q(group), - (rq->thresh << HE_REGS_RBRQ_THRESH) | - ((rq->size - 1) << HE_REGS_RBRQ_SIZE)); - WRITE4(sc, HE_REGO_RBRQ_I(group), - (rq->tout << HE_REGS_RBRQ_TIME) | - (rq->pcnt << HE_REGS_RBRQ_COUNT)); -} - -/* - * Clear an unused transmit buffer return queue N - */ -static void -hatm_clear_tbrq(struct hatm_softc *sc, u_int group) -{ - WRITE4(sc, HE_REGO_TBRQ_B_T(group), 0); - WRITE4(sc, HE_REGO_TBRQ_H(group), 0); - WRITE4(sc, HE_REGO_TBRQ_S(group), 0); - WRITE4(sc, HE_REGO_TBRQ_THRESH(group), 1); -} - -/* - * Initialize transmit buffer return queue N - */ -static void -hatm_init_tbrq(struct hatm_softc *sc, struct hetbrq *tq, u_int group) -{ - if (tq->size == 0) { - hatm_clear_tbrq(sc, group); - return; - } - - tq->tbrq = tq->mem.base; - tq->head = 0; - - DBG(sc, ATTACH, ("TBRQ%u=0x%lx", group, (u_long)tq->mem.paddr)); - - WRITE4(sc, HE_REGO_TBRQ_B_T(group), tq->mem.paddr); - WRITE4(sc, HE_REGO_TBRQ_H(group), 0); - WRITE4(sc, HE_REGO_TBRQ_S(group), tq->size - 1); - WRITE4(sc, HE_REGO_TBRQ_THRESH(group), tq->thresh); -} - -/* - * Initialize TPDRQ - */ -static void -hatm_init_tpdrq(struct hatm_softc *sc) -{ - struct hetpdrq *tq; - - tq = &sc->tpdrq; - tq->tpdrq = tq->mem.base; - tq->tail = tq->head = 0; - - DBG(sc, ATTACH, ("TPDRQ=0x%lx", (u_long)tq->mem.paddr)); - - WRITE4(sc, HE_REGO_TPDRQ_H, tq->mem.paddr); - WRITE4(sc, HE_REGO_TPDRQ_T, 0); - WRITE4(sc, HE_REGO_TPDRQ_S, tq->size - 1); -} - -/* - * Function can be called by the infrastructure to start the card. - */ -static void -hatm_init(void *p) -{ - struct hatm_softc *sc = p; - - mtx_lock(&sc->mtx); - hatm_stop(sc); - hatm_initialize(sc); - mtx_unlock(&sc->mtx); -} - -enum { - CTL_ISTATS, -}; - -/* - * Sysctl handler - */ -static int -hatm_sysctl(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - uint32_t *ret; - int error; - size_t len; - - switch (arg2) { - - case CTL_ISTATS: - len = sizeof(sc->istats); - break; - - default: - panic("bad control code"); - } - - ret = malloc(len, M_TEMP, M_WAITOK); - mtx_lock(&sc->mtx); - - switch (arg2) { - - case CTL_ISTATS: - sc->istats.mcc += READ4(sc, HE_REGO_MCC); - sc->istats.oec += READ4(sc, HE_REGO_OEC); - sc->istats.dcc += READ4(sc, HE_REGO_DCC); - sc->istats.cec += READ4(sc, HE_REGO_CEC); - bcopy(&sc->istats, ret, sizeof(sc->istats)); - break; - } - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, ret, len); - free(ret, M_TEMP); - - return (error); -} - -static int -kenv_getuint(struct hatm_softc *sc, const char *var, - u_int *ptr, u_int def, int rw) -{ - char full[IFNAMSIZ + 3 + 20]; - char *val, *end; - u_int u; - - *ptr = def; - - if (rw != 0) { - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var, - CTLFLAG_RW, ptr, 0, "") == NULL) - return (ENOMEM); - } else { - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, var, - CTLFLAG_RD, ptr, 0, "") == NULL) - return (ENOMEM); - } - - snprintf(full, sizeof(full), "hw.%s.%s", - device_get_nameunit(sc->dev), var); - - if ((val = kern_getenv(full)) == NULL) - return (0); - u = strtoul(val, &end, 0); - if (end == val || *end != '\0') { - freeenv(val); - return (EINVAL); - } - freeenv(val); - if (bootverbose) - if_printf(sc->ifp, "%s=%u\n", full, u); - *ptr = u; - return (0); -} - -/* - * Set configurable parameters. Many of these are configurable via - * kenv. - */ -static int -hatm_configure(struct hatm_softc *sc) -{ - /* Receive buffer pool 0 small */ - kenv_getuint(sc, "rbps0_size", &sc->rbp_s0.size, - HE_CONFIG_RBPS0_SIZE, 0); - kenv_getuint(sc, "rbps0_thresh", &sc->rbp_s0.thresh, - HE_CONFIG_RBPS0_THRESH, 0); - sc->rbp_s0.bsize = MBUF0_SIZE; - - /* Receive buffer pool 0 large */ - kenv_getuint(sc, "rbpl0_size", &sc->rbp_l0.size, - HE_CONFIG_RBPL0_SIZE, 0); - kenv_getuint(sc, "rbpl0_thresh", &sc->rbp_l0.thresh, - HE_CONFIG_RBPL0_THRESH, 0); - sc->rbp_l0.bsize = MCLBYTES - MBUFL_OFFSET; - - /* Receive buffer return queue 0 */ - kenv_getuint(sc, "rbrq0_size", &sc->rbrq_0.size, - HE_CONFIG_RBRQ0_SIZE, 0); - kenv_getuint(sc, "rbrq0_thresh", &sc->rbrq_0.thresh, - HE_CONFIG_RBRQ0_THRESH, 0); - kenv_getuint(sc, "rbrq0_tout", &sc->rbrq_0.tout, - HE_CONFIG_RBRQ0_TOUT, 0); - kenv_getuint(sc, "rbrq0_pcnt", &sc->rbrq_0.pcnt, - HE_CONFIG_RBRQ0_PCNT, 0); - - /* Receive buffer pool 1 small */ - kenv_getuint(sc, "rbps1_size", &sc->rbp_s1.size, - HE_CONFIG_RBPS1_SIZE, 0); - kenv_getuint(sc, "rbps1_thresh", &sc->rbp_s1.thresh, - HE_CONFIG_RBPS1_THRESH, 0); - sc->rbp_s1.bsize = MBUF1_SIZE; - - /* Receive buffer return queue 1 */ - kenv_getuint(sc, "rbrq1_size", &sc->rbrq_1.size, - HE_CONFIG_RBRQ1_SIZE, 0); - kenv_getuint(sc, "rbrq1_thresh", &sc->rbrq_1.thresh, - HE_CONFIG_RBRQ1_THRESH, 0); - kenv_getuint(sc, "rbrq1_tout", &sc->rbrq_1.tout, - HE_CONFIG_RBRQ1_TOUT, 0); - kenv_getuint(sc, "rbrq1_pcnt", &sc->rbrq_1.pcnt, - HE_CONFIG_RBRQ1_PCNT, 0); - - /* Interrupt queue 0 */ - kenv_getuint(sc, "irq0_size", &sc->irq_0.size, - HE_CONFIG_IRQ0_SIZE, 0); - kenv_getuint(sc, "irq0_thresh", &sc->irq_0.thresh, - HE_CONFIG_IRQ0_THRESH, 0); - sc->irq_0.line = HE_CONFIG_IRQ0_LINE; - - /* Transmit buffer return queue 0 */ - kenv_getuint(sc, "tbrq0_size", &sc->tbrq.size, - HE_CONFIG_TBRQ_SIZE, 0); - kenv_getuint(sc, "tbrq0_thresh", &sc->tbrq.thresh, - HE_CONFIG_TBRQ_THRESH, 0); - - /* Transmit buffer ready queue */ - kenv_getuint(sc, "tpdrq_size", &sc->tpdrq.size, - HE_CONFIG_TPDRQ_SIZE, 0); - /* Max TPDs per VCC */ - kenv_getuint(sc, "tpdmax", &sc->max_tpd, - HE_CONFIG_TPD_MAXCC, 0); - - /* external mbuf pages */ - kenv_getuint(sc, "max_mbuf_pages", &sc->mbuf_max_pages, - HE_CONFIG_MAX_MBUF_PAGES, 0); - - /* mpsafe */ - kenv_getuint(sc, "mpsafe", &sc->mpsafe, 0, 0); - if (sc->mpsafe != 0) - sc->mpsafe = INTR_MPSAFE; - - return (0); -} - -#ifdef HATM_DEBUG - -/* - * Get TSRs from connection memory - */ -static int -hatm_sysctl_tsr(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i, j; - uint32_t *val; - - val = malloc(sizeof(uint32_t) * HE_MAX_VCCS * 15, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < HE_MAX_VCCS; i++) - for (j = 0; j <= 14; j++) - val[15 * i + j] = READ_TSR(sc, i, j); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, sizeof(uint32_t) * HE_MAX_VCCS * 15); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} - -/* - * Get TPDs from connection memory - */ -static int -hatm_sysctl_tpd(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i, j; - uint32_t *val; - - val = malloc(sizeof(uint32_t) * HE_MAX_VCCS * 16, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < HE_MAX_VCCS; i++) - for (j = 0; j < 16; j++) - val[16 * i + j] = READ_TCM4(sc, 16 * i + j); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, sizeof(uint32_t) * HE_MAX_VCCS * 16); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} - -/* - * Get mbox registers - */ -static int -hatm_sysctl_mbox(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i; - uint32_t *val; - - val = malloc(sizeof(uint32_t) * HE_REGO_CS_END, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < HE_REGO_CS_END; i++) - val[i] = READ_MBOX4(sc, i); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, sizeof(uint32_t) * HE_REGO_CS_END); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} - -/* - * Get connection memory - */ -static int -hatm_sysctl_cm(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i; - uint32_t *val; - - val = malloc(sizeof(uint32_t) * (HE_CONFIG_RXMEM + 1), M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - val[0] = READ4(sc, HE_REGO_RCMABR_BA); - for (i = 0; i < HE_CONFIG_RXMEM; i++) - val[i + 1] = READ_RCM4(sc, i); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, sizeof(uint32_t) * (HE_CONFIG_RXMEM + 1)); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} - -/* - * Get local buffer memory - */ -static int -hatm_sysctl_lbmem(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i; - uint32_t *val; - u_int bytes = (1 << 21); - - val = malloc(bytes, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < bytes / 4; i++) - val[i] = READ_LB4(sc, i); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, bytes); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} - -/* - * Get all card registers - */ -static int -hatm_sysctl_heregs(SYSCTL_HANDLER_ARGS) -{ - struct hatm_softc *sc = arg1; - int error, i; - uint32_t *val; - - val = malloc(HE_REGO_END, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < HE_REGO_END; i += 4) - val[i / 4] = READ4(sc, i); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, val, HE_REGO_END); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - return (EPERM); -} -#endif - -/* - * Suni register access - */ -/* - * read at most n SUNI registers starting at reg into val - */ -static int -hatm_utopia_readregs(struct ifatm *ifatm, u_int reg, uint8_t *val, u_int *n) -{ - u_int i; - struct hatm_softc *sc = ifatm->ifp->if_softc; - - if (reg >= (HE_REGO_SUNI_END - HE_REGO_SUNI) / 4) - return (EINVAL); - if (reg + *n > (HE_REGO_SUNI_END - HE_REGO_SUNI) / 4) - *n = reg - (HE_REGO_SUNI_END - HE_REGO_SUNI) / 4; - - mtx_assert(&sc->mtx, MA_OWNED); - for (i = 0; i < *n; i++) - val[i] = READ4(sc, HE_REGO_SUNI + 4 * (reg + i)); - - return (0); -} - -/* - * change the bits given by mask to them in val in register reg - */ -static int -hatm_utopia_writereg(struct ifatm *ifatm, u_int reg, u_int mask, u_int val) -{ - uint32_t regval; - struct hatm_softc *sc = ifatm->ifp->if_softc; - - if (reg >= (HE_REGO_SUNI_END - HE_REGO_SUNI) / 4) - return (EINVAL); - - mtx_assert(&sc->mtx, MA_OWNED); - regval = READ4(sc, HE_REGO_SUNI + 4 * reg); - regval = (regval & ~mask) | (val & mask); - WRITE4(sc, HE_REGO_SUNI + 4 * reg, regval); - - return (0); -} - -static struct utopia_methods hatm_utopia_methods = { - hatm_utopia_readregs, - hatm_utopia_writereg, -}; - -/* - * Detach - if it is running, stop. Destroy. - */ -static int -hatm_detach(device_t dev) -{ - struct hatm_softc *sc = device_get_softc(dev); - - mtx_lock(&sc->mtx); - hatm_stop(sc); - if (sc->utopia.state & UTP_ST_ATTACHED) { - utopia_stop(&sc->utopia); - utopia_detach(&sc->utopia); - } - mtx_unlock(&sc->mtx); - - atm_ifdetach(sc->ifp); - - hatm_destroy(sc); - - return (0); -} - -/* - * Attach to the device. Assume that no locking is needed here. - * All resource we allocate here are freed by calling hatm_destroy. - */ -static int -hatm_attach(device_t dev) -{ - struct hatm_softc *sc; - int error; - uint32_t v; - struct ifnet *ifp; - - sc = device_get_softc(dev); - - ifp = sc->ifp = if_alloc(IFT_ATM); - if (ifp == NULL) { - device_printf(dev, "could not if_alloc()\n"); - return (ENOSPC); - } - - sc->dev = dev; - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_HE155; - IFP2IFATM(sc->ifp)->mib.serial = 0; - IFP2IFATM(sc->ifp)->mib.hw_version = 0; - IFP2IFATM(sc->ifp)->mib.sw_version = 0; - IFP2IFATM(sc->ifp)->mib.vpi_bits = HE_CONFIG_VPI_BITS; - IFP2IFATM(sc->ifp)->mib.vci_bits = HE_CONFIG_VCI_BITS; - IFP2IFATM(sc->ifp)->mib.max_vpcs = 0; - IFP2IFATM(sc->ifp)->mib.max_vccs = HE_MAX_VCCS; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UNKNOWN; - sc->he622 = 0; - IFP2IFATM(sc->ifp)->phy = &sc->utopia; - - SLIST_INIT(&sc->tpd_free); - - mtx_init(&sc->mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); - cv_init(&sc->vcc_cv, "HEVCCcv"); - cv_init(&sc->cv_rcclose, "RCClose"); - - sysctl_ctx_init(&sc->sysctl_ctx); - - /* - * 4.2 BIOS Configuration - */ - v = pci_read_config(dev, PCIR_COMMAND, 2); - v |= PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN; - pci_write_config(dev, PCIR_COMMAND, v, 2); - - /* - * 4.3 PCI Bus Controller-Specific Initialisation - */ - v = pci_read_config(dev, HE_PCIR_GEN_CNTL_0, 4); - v |= HE_PCIM_CTL0_MRL | HE_PCIM_CTL0_MRM | HE_PCIM_CTL0_IGNORE_TIMEOUT; -#if BYTE_ORDER == BIG_ENDIAN && 0 - v |= HE_PCIM_CTL0_BIGENDIAN; -#endif - pci_write_config(dev, HE_PCIR_GEN_CNTL_0, v, 4); - - /* - * Map memory - */ - sc->memid = PCIR_BAR(0); - sc->memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->memid, - RF_ACTIVE); - if (sc->memres == NULL) { - device_printf(dev, "could not map memory\n"); - error = ENXIO; - goto failed; - } - sc->memh = rman_get_bushandle(sc->memres); - sc->memt = rman_get_bustag(sc->memres); - - /* - * ALlocate a DMA tag for subsequent allocations - */ - if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, - BUS_SPACE_MAXSIZE_32BIT, 1, - BUS_SPACE_MAXSIZE_32BIT, 0, - NULL, NULL, &sc->parent_tag)) { - device_printf(dev, "could not allocate DMA tag\n"); - error = ENOMEM; - goto failed; - } - - if (bus_dma_tag_create(sc->parent_tag, 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, - MBUF_ALLOC_SIZE, 1, - MBUF_ALLOC_SIZE, 0, - NULL, NULL, &sc->mbuf_tag)) { - device_printf(dev, "could not allocate mbuf DMA tag\n"); - error = ENOMEM; - goto failed; - } - - /* - * Allocate a DMA tag for packets to send. Here we have a problem with - * the specification of the maximum number of segments. Theoretically - * this would be the size of the transmit ring - 1 multiplied by 3, - * but this would not work. So make the maximum number of TPDs - * occupied by one packet a configuration parameter. - */ - if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - HE_MAX_PDU, 3 * HE_CONFIG_MAX_TPD_PER_PACKET, HE_MAX_PDU, 0, - NULL, NULL, &sc->tx_tag)) { - device_printf(dev, "could not allocate TX tag\n"); - error = ENOMEM; - goto failed; - } - - /* - * Setup the interrupt - */ - sc->irqid = 0; - sc->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, - RF_SHAREABLE | RF_ACTIVE); - if (sc->irqres == 0) { - device_printf(dev, "could not allocate irq\n"); - error = ENXIO; - goto failed; - } - - ifp->if_softc = sc; - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - - /* - * Make the sysctl tree - */ - error = ENOMEM; - if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO, - device_get_nameunit(dev), CTLFLAG_RD, 0, "")) == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "istats", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, CTL_ISTATS, - hatm_sysctl, "LU", "internal statistics") == NULL) - goto failed; - -#ifdef HATM_DEBUG - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "tsr", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_tsr, "S", "transmission status registers") == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "tpd", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_tpd, "S", "transmission packet descriptors") == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "mbox", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_mbox, "S", "mbox registers") == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "cm", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_cm, "S", "connection memory") == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "heregs", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_heregs, "S", "card registers") == NULL) - goto failed; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "lbmem", CTLFLAG_RD | CTLTYPE_OPAQUE, sc, 0, - hatm_sysctl_lbmem, "S", "local memory") == NULL) - goto failed; - - kenv_getuint(sc, "debug", &sc->debug, HATM_DEBUG, 1); -#endif - - /* - * Configure - */ - if ((error = hatm_configure(sc)) != 0) - goto failed; - - /* - * Compute memory parameters - */ - if (sc->rbp_s0.size != 0) { - sc->rbp_s0.mask = (sc->rbp_s0.size - 1) << 3; - sc->rbp_s0.mem.size = sc->rbp_s0.size * 8; - sc->rbp_s0.mem.align = sc->rbp_s0.mem.size; - } - if (sc->rbp_l0.size != 0) { - sc->rbp_l0.mask = (sc->rbp_l0.size - 1) << 3; - sc->rbp_l0.mem.size = sc->rbp_l0.size * 8; - sc->rbp_l0.mem.align = sc->rbp_l0.mem.size; - } - if (sc->rbp_s1.size != 0) { - sc->rbp_s1.mask = (sc->rbp_s1.size - 1) << 3; - sc->rbp_s1.mem.size = sc->rbp_s1.size * 8; - sc->rbp_s1.mem.align = sc->rbp_s1.mem.size; - } - if (sc->rbrq_0.size != 0) { - sc->rbrq_0.mem.size = sc->rbrq_0.size * 8; - sc->rbrq_0.mem.align = sc->rbrq_0.mem.size; - } - if (sc->rbrq_1.size != 0) { - sc->rbrq_1.mem.size = sc->rbrq_1.size * 8; - sc->rbrq_1.mem.align = sc->rbrq_1.mem.size; - } - - sc->irq_0.mem.size = sc->irq_0.size * sizeof(uint32_t); - sc->irq_0.mem.align = 4 * 1024; - - sc->tbrq.mem.size = sc->tbrq.size * 4; - sc->tbrq.mem.align = 2 * sc->tbrq.mem.size; /* ZZZ */ - - sc->tpdrq.mem.size = sc->tpdrq.size * 8; - sc->tpdrq.mem.align = sc->tpdrq.mem.size; - - sc->hsp_mem.size = sizeof(struct he_hsp); - sc->hsp_mem.align = 1024; - - sc->lbufs_size = sc->rbp_l0.size + sc->rbrq_0.size; - sc->tpd_total = sc->tbrq.size + sc->tpdrq.size; - sc->tpds.align = 64; - sc->tpds.size = sc->tpd_total * HE_TPD_SIZE; - - hatm_init_rmaps(sc); - hatm_init_smbufs(sc); - if ((error = hatm_init_tpds(sc)) != 0) - goto failed; - - /* - * Allocate memory - */ - if ((error = hatm_alloc_dmamem(sc, "IRQ", &sc->irq_0.mem)) != 0 || - (error = hatm_alloc_dmamem(sc, "TBRQ0", &sc->tbrq.mem)) != 0 || - (error = hatm_alloc_dmamem(sc, "TPDRQ", &sc->tpdrq.mem)) != 0 || - (error = hatm_alloc_dmamem(sc, "HSP", &sc->hsp_mem)) != 0) - goto failed; - - if (sc->rbp_s0.mem.size != 0 && - (error = hatm_alloc_dmamem(sc, "RBPS0", &sc->rbp_s0.mem))) - goto failed; - if (sc->rbp_l0.mem.size != 0 && - (error = hatm_alloc_dmamem(sc, "RBPL0", &sc->rbp_l0.mem))) - goto failed; - if (sc->rbp_s1.mem.size != 0 && - (error = hatm_alloc_dmamem(sc, "RBPS1", &sc->rbp_s1.mem))) - goto failed; - - if (sc->rbrq_0.mem.size != 0 && - (error = hatm_alloc_dmamem(sc, "RBRQ0", &sc->rbrq_0.mem))) - goto failed; - if (sc->rbrq_1.mem.size != 0 && - (error = hatm_alloc_dmamem(sc, "RBRQ1", &sc->rbrq_1.mem))) - goto failed; - - if ((sc->vcc_zone = uma_zcreate("HE vccs", sizeof(struct hevcc), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0)) == NULL) { - device_printf(dev, "cannot allocate zone for vccs\n"); - goto failed; - } - - /* - * 4.4 Reset the card. - */ - if ((error = hatm_reset(sc)) != 0) - goto failed; - - /* - * Read the prom. - */ - hatm_init_bus_width(sc); - hatm_init_read_eeprom(sc); - hatm_init_endianess(sc); - - /* - * Initialize interface - */ - ifp->if_flags = IFF_SIMPLEX; - ifp->if_ioctl = hatm_ioctl; - ifp->if_start = hatm_start; - ifp->if_init = hatm_init; - - utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->mtx, - &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - &hatm_utopia_methods); - utopia_init_media(&sc->utopia); - - /* these two SUNI routines need the lock */ - mtx_lock(&sc->mtx); - /* poll while we are not running */ - sc->utopia.flags |= UTP_FL_POLL_CARRIER; - utopia_start(&sc->utopia); - utopia_reset(&sc->utopia); - mtx_unlock(&sc->mtx); - - atm_ifattach(ifp); - -#ifdef ENABLE_BPF - bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); -#endif - - error = bus_setup_intr(dev, sc->irqres, sc->mpsafe | INTR_TYPE_NET, - NULL, hatm_intr, &sc->irq_0, &sc->ih); - if (error != 0) { - device_printf(dev, "could not setup interrupt\n"); - hatm_detach(dev); - return (error); - } - - return (0); - - failed: - hatm_destroy(sc); - return (error); -} - -/* - * Start the interface. Assume a state as from attach(). - */ -void -hatm_initialize(struct hatm_softc *sc) -{ - uint32_t v; - u_int cid; - static const u_int layout[2][7] = HE_CONFIG_MEM_LAYOUT; - - if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) - return; - - hatm_init_bus_width(sc); - hatm_init_endianess(sc); - - if_printf(sc->ifp, "%s, Rev. %s, S/N %u, " - "MAC=%02x:%02x:%02x:%02x:%02x:%02x (%ubit PCI)\n", - sc->prod_id, sc->rev, IFP2IFATM(sc->ifp)->mib.serial, - IFP2IFATM(sc->ifp)->mib.esi[0], IFP2IFATM(sc->ifp)->mib.esi[1], IFP2IFATM(sc->ifp)->mib.esi[2], - IFP2IFATM(sc->ifp)->mib.esi[3], IFP2IFATM(sc->ifp)->mib.esi[4], IFP2IFATM(sc->ifp)->mib.esi[5], - sc->pci64 ? 64 : 32); - - /* - * 4.8 SDRAM Controller Initialisation - * 4.9 Initialize RNUM value - */ - if (sc->he622) - WRITE4(sc, HE_REGO_SDRAM_CNTL, HE_REGM_SDRAM_64BIT); - else - WRITE4(sc, HE_REGO_SDRAM_CNTL, 0); - BARRIER_W(sc); - - v = READ4(sc, HE_REGO_LB_SWAP); - BARRIER_R(sc); - v |= 0xf << HE_REGS_LBSWAP_RNUM; - WRITE4(sc, HE_REGO_LB_SWAP, v); - BARRIER_W(sc); - - hatm_init_irq(sc, &sc->irq_0, 0); - hatm_clear_irq(sc, 1); - hatm_clear_irq(sc, 2); - hatm_clear_irq(sc, 3); - - WRITE4(sc, HE_REGO_GRP_1_0_MAP, 0); - WRITE4(sc, HE_REGO_GRP_3_2_MAP, 0); - WRITE4(sc, HE_REGO_GRP_5_4_MAP, 0); - WRITE4(sc, HE_REGO_GRP_7_6_MAP, 0); - BARRIER_W(sc); - - /* - * 4.11 Enable PCI Bus Controller State Machine - */ - v = READ4(sc, HE_REGO_HOST_CNTL); - BARRIER_R(sc); - v |= HE_REGM_HOST_OUTFF_ENB | HE_REGM_HOST_CMDFF_ENB | - HE_REGM_HOST_QUICK_RD | HE_REGM_HOST_QUICK_WR; - WRITE4(sc, HE_REGO_HOST_CNTL, v); - BARRIER_W(sc); - - /* - * 5.1.1 Generic configuration state - */ - sc->cells_per_row = layout[sc->he622][0]; - sc->bytes_per_row = layout[sc->he622][1]; - sc->r0_numrows = layout[sc->he622][2]; - sc->tx_numrows = layout[sc->he622][3]; - sc->r1_numrows = layout[sc->he622][4]; - sc->r0_startrow = layout[sc->he622][5]; - sc->tx_startrow = sc->r0_startrow + sc->r0_numrows; - sc->r1_startrow = sc->tx_startrow + sc->tx_numrows; - sc->cells_per_lbuf = layout[sc->he622][6]; - - sc->r0_numbuffs = sc->r0_numrows * (sc->cells_per_row / - sc->cells_per_lbuf); - sc->r1_numbuffs = sc->r1_numrows * (sc->cells_per_row / - sc->cells_per_lbuf); - sc->tx_numbuffs = sc->tx_numrows * (sc->cells_per_row / - sc->cells_per_lbuf); - - if (sc->r0_numbuffs > 2560) - sc->r0_numbuffs = 2560; - if (sc->r1_numbuffs > 2560) - sc->r1_numbuffs = 2560; - if (sc->tx_numbuffs > 5120) - sc->tx_numbuffs = 5120; - - DBG(sc, ATTACH, ("cells_per_row=%u bytes_per_row=%u r0_numrows=%u " - "tx_numrows=%u r1_numrows=%u r0_startrow=%u tx_startrow=%u " - "r1_startrow=%u cells_per_lbuf=%u\nr0_numbuffs=%u r1_numbuffs=%u " - "tx_numbuffs=%u\n", sc->cells_per_row, sc->bytes_per_row, - sc->r0_numrows, sc->tx_numrows, sc->r1_numrows, sc->r0_startrow, - sc->tx_startrow, sc->r1_startrow, sc->cells_per_lbuf, - sc->r0_numbuffs, sc->r1_numbuffs, sc->tx_numbuffs)); - - /* - * 5.1.2 Configure Hardware dependend registers - */ - if (sc->he622) { - WRITE4(sc, HE_REGO_LBARB, - (0x2 << HE_REGS_LBARB_SLICE) | - (0xf << HE_REGS_LBARB_RNUM) | - (0x3 << HE_REGS_LBARB_THPRI) | - (0x3 << HE_REGS_LBARB_RHPRI) | - (0x2 << HE_REGS_LBARB_TLPRI) | - (0x1 << HE_REGS_LBARB_RLPRI) | - (0x28 << HE_REGS_LBARB_BUS_MULT) | - (0x50 << HE_REGS_LBARB_NET_PREF)); - BARRIER_W(sc); - WRITE4(sc, HE_REGO_SDRAMCON, - /* HW bug: don't use banking */ - /* HE_REGM_SDRAMCON_BANK | */ - HE_REGM_SDRAMCON_WIDE | - (0x384 << HE_REGS_SDRAMCON_REF)); - BARRIER_W(sc); - WRITE4(sc, HE_REGO_RCMCONFIG, - (0x1 << HE_REGS_RCMCONFIG_BANK_WAIT) | - (0x1 << HE_REGS_RCMCONFIG_RW_WAIT) | - (0x0 << HE_REGS_RCMCONFIG_TYPE)); - WRITE4(sc, HE_REGO_TCMCONFIG, - (0x2 << HE_REGS_TCMCONFIG_BANK_WAIT) | - (0x1 << HE_REGS_TCMCONFIG_RW_WAIT) | - (0x0 << HE_REGS_TCMCONFIG_TYPE)); - } else { - WRITE4(sc, HE_REGO_LBARB, - (0x2 << HE_REGS_LBARB_SLICE) | - (0xf << HE_REGS_LBARB_RNUM) | - (0x3 << HE_REGS_LBARB_THPRI) | - (0x3 << HE_REGS_LBARB_RHPRI) | - (0x2 << HE_REGS_LBARB_TLPRI) | - (0x1 << HE_REGS_LBARB_RLPRI) | - (0x46 << HE_REGS_LBARB_BUS_MULT) | - (0x8C << HE_REGS_LBARB_NET_PREF)); - BARRIER_W(sc); - WRITE4(sc, HE_REGO_SDRAMCON, - /* HW bug: don't use banking */ - /* HE_REGM_SDRAMCON_BANK | */ - (0x150 << HE_REGS_SDRAMCON_REF)); - BARRIER_W(sc); - WRITE4(sc, HE_REGO_RCMCONFIG, - (0x0 << HE_REGS_RCMCONFIG_BANK_WAIT) | - (0x1 << HE_REGS_RCMCONFIG_RW_WAIT) | - (0x0 << HE_REGS_RCMCONFIG_TYPE)); - WRITE4(sc, HE_REGO_TCMCONFIG, - (0x1 << HE_REGS_TCMCONFIG_BANK_WAIT) | - (0x1 << HE_REGS_TCMCONFIG_RW_WAIT) | - (0x0 << HE_REGS_TCMCONFIG_TYPE)); - } - WRITE4(sc, HE_REGO_LBCONFIG, (sc->cells_per_lbuf * 48)); - - WRITE4(sc, HE_REGO_RLBC_H, 0); - WRITE4(sc, HE_REGO_RLBC_T, 0); - WRITE4(sc, HE_REGO_RLBC_H2, 0); - - WRITE4(sc, HE_REGO_RXTHRSH, 512); - WRITE4(sc, HE_REGO_LITHRSH, 256); - - WRITE4(sc, HE_REGO_RLBF0_C, sc->r0_numbuffs); - WRITE4(sc, HE_REGO_RLBF1_C, sc->r1_numbuffs); - - if (sc->he622) { - WRITE4(sc, HE_REGO_RCCONFIG, - (8 << HE_REGS_RCCONFIG_UTDELAY) | - (IFP2IFATM(sc->ifp)->mib.vpi_bits << HE_REGS_RCCONFIG_VP) | - (IFP2IFATM(sc->ifp)->mib.vci_bits << HE_REGS_RCCONFIG_VC)); - WRITE4(sc, HE_REGO_TXCONFIG, - (32 << HE_REGS_TXCONFIG_THRESH) | - (IFP2IFATM(sc->ifp)->mib.vci_bits << HE_REGS_TXCONFIG_VCI_MASK) | - (sc->tx_numbuffs << HE_REGS_TXCONFIG_LBFREE)); - } else { - WRITE4(sc, HE_REGO_RCCONFIG, - (0 << HE_REGS_RCCONFIG_UTDELAY) | - HE_REGM_RCCONFIG_UT_MODE | - (IFP2IFATM(sc->ifp)->mib.vpi_bits << HE_REGS_RCCONFIG_VP) | - (IFP2IFATM(sc->ifp)->mib.vci_bits << HE_REGS_RCCONFIG_VC)); - WRITE4(sc, HE_REGO_TXCONFIG, - (32 << HE_REGS_TXCONFIG_THRESH) | - HE_REGM_TXCONFIG_UTMODE | - (IFP2IFATM(sc->ifp)->mib.vci_bits << HE_REGS_TXCONFIG_VCI_MASK) | - (sc->tx_numbuffs << HE_REGS_TXCONFIG_LBFREE)); - } - - WRITE4(sc, HE_REGO_TXAAL5_PROTO, 0); - - if (sc->rbp_s1.size != 0) { - WRITE4(sc, HE_REGO_RHCONFIG, - HE_REGM_RHCONFIG_PHYENB | - ((sc->he622 ? 0x41 : 0x31) << HE_REGS_RHCONFIG_PTMR_PRE) | - (1 << HE_REGS_RHCONFIG_OAM_GID)); - } else { - WRITE4(sc, HE_REGO_RHCONFIG, - HE_REGM_RHCONFIG_PHYENB | - ((sc->he622 ? 0x41 : 0x31) << HE_REGS_RHCONFIG_PTMR_PRE) | - (0 << HE_REGS_RHCONFIG_OAM_GID)); - } - BARRIER_W(sc); - - hatm_init_cm(sc); - - hatm_init_rx_buffer_pool(sc, 0, sc->r0_startrow, sc->r0_numbuffs); - hatm_init_rx_buffer_pool(sc, 1, sc->r1_startrow, sc->r1_numbuffs); - hatm_init_tx_buffer_pool(sc, sc->tx_startrow, sc->tx_numbuffs); - - hatm_init_imed_queues(sc); - - /* - * 5.1.6 Application tunable Parameters - */ - WRITE4(sc, HE_REGO_MCC, 0); - WRITE4(sc, HE_REGO_OEC, 0); - WRITE4(sc, HE_REGO_DCC, 0); - WRITE4(sc, HE_REGO_CEC, 0); - - hatm_init_cs_block(sc); - hatm_init_cs_block_cm(sc); - - hatm_init_rpool(sc, &sc->rbp_s0, 0, 0); - hatm_init_rpool(sc, &sc->rbp_l0, 0, 1); - hatm_init_rpool(sc, &sc->rbp_s1, 1, 0); - hatm_clear_rpool(sc, 1, 1); - hatm_clear_rpool(sc, 2, 0); - hatm_clear_rpool(sc, 2, 1); - hatm_clear_rpool(sc, 3, 0); - hatm_clear_rpool(sc, 3, 1); - hatm_clear_rpool(sc, 4, 0); - hatm_clear_rpool(sc, 4, 1); - hatm_clear_rpool(sc, 5, 0); - hatm_clear_rpool(sc, 5, 1); - hatm_clear_rpool(sc, 6, 0); - hatm_clear_rpool(sc, 6, 1); - hatm_clear_rpool(sc, 7, 0); - hatm_clear_rpool(sc, 7, 1); - hatm_init_rbrq(sc, &sc->rbrq_0, 0); - hatm_init_rbrq(sc, &sc->rbrq_1, 1); - hatm_clear_rbrq(sc, 2); - hatm_clear_rbrq(sc, 3); - hatm_clear_rbrq(sc, 4); - hatm_clear_rbrq(sc, 5); - hatm_clear_rbrq(sc, 6); - hatm_clear_rbrq(sc, 7); - - sc->lbufs_next = 0; - bzero(sc->lbufs, sizeof(sc->lbufs[0]) * sc->lbufs_size); - - hatm_init_tbrq(sc, &sc->tbrq, 0); - hatm_clear_tbrq(sc, 1); - hatm_clear_tbrq(sc, 2); - hatm_clear_tbrq(sc, 3); - hatm_clear_tbrq(sc, 4); - hatm_clear_tbrq(sc, 5); - hatm_clear_tbrq(sc, 6); - hatm_clear_tbrq(sc, 7); - - hatm_init_tpdrq(sc); - - WRITE4(sc, HE_REGO_UBUFF_BA, (sc->he622 ? 0x104780 : 0x800)); - - /* - * Initialize HSP - */ - bzero(sc->hsp_mem.base, sc->hsp_mem.size); - sc->hsp = sc->hsp_mem.base; - WRITE4(sc, HE_REGO_HSP_BA, sc->hsp_mem.paddr); - - /* - * 5.1.12 Enable transmit and receive - * Enable bus master and interrupts - */ - v = READ_MBOX4(sc, HE_REGO_CS_ERCTL0); - v |= 0x18000000; - WRITE_MBOX4(sc, HE_REGO_CS_ERCTL0, v); - - v = READ4(sc, HE_REGO_RCCONFIG); - v |= HE_REGM_RCCONFIG_RXENB; - WRITE4(sc, HE_REGO_RCCONFIG, v); - - v = pci_read_config(sc->dev, HE_PCIR_GEN_CNTL_0, 4); - v |= HE_PCIM_CTL0_INIT_ENB | HE_PCIM_CTL0_INT_PROC_ENB; - pci_write_config(sc->dev, HE_PCIR_GEN_CNTL_0, v, 4); - - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; - sc->ifp->if_baudrate = 53 * 8 * IFP2IFATM(sc->ifp)->mib.pcr; - - sc->utopia.flags &= ~UTP_FL_POLL_CARRIER; - - /* reopen vccs */ - for (cid = 0; cid < HE_MAX_VCCS; cid++) - if (sc->vccs[cid] != NULL) - hatm_load_vc(sc, cid, 1); - - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); -} - -/* - * This functions stops the card and frees all resources allocated after - * the attach. Must have the global lock. - */ -void -hatm_stop(struct hatm_softc *sc) -{ - uint32_t v; - u_int i, p, cid; - struct mbuf_chunk_hdr *ch; - struct mbuf_page *pg; - - mtx_assert(&sc->mtx, MA_OWNED); - - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); - - sc->utopia.flags |= UTP_FL_POLL_CARRIER; - - /* - * Stop and reset the hardware so that everything remains - * stable. - */ - v = READ_MBOX4(sc, HE_REGO_CS_ERCTL0); - v &= ~0x18000000; - WRITE_MBOX4(sc, HE_REGO_CS_ERCTL0, v); - - v = READ4(sc, HE_REGO_RCCONFIG); - v &= ~HE_REGM_RCCONFIG_RXENB; - WRITE4(sc, HE_REGO_RCCONFIG, v); - - WRITE4(sc, HE_REGO_RHCONFIG, (0x2 << HE_REGS_RHCONFIG_PTMR_PRE)); - BARRIER_W(sc); - - v = READ4(sc, HE_REGO_HOST_CNTL); - BARRIER_R(sc); - v &= ~(HE_REGM_HOST_OUTFF_ENB | HE_REGM_HOST_CMDFF_ENB); - WRITE4(sc, HE_REGO_HOST_CNTL, v); - BARRIER_W(sc); - - /* - * Disable bust master and interrupts - */ - v = pci_read_config(sc->dev, HE_PCIR_GEN_CNTL_0, 4); - v &= ~(HE_PCIM_CTL0_INIT_ENB | HE_PCIM_CTL0_INT_PROC_ENB); - pci_write_config(sc->dev, HE_PCIR_GEN_CNTL_0, v, 4); - - (void)hatm_reset(sc); - - /* - * Card resets the SUNI when resetted, so re-initialize it - */ - utopia_reset(&sc->utopia); - - /* - * Give any waiters on closing a VCC a chance. They will stop - * to wait if they see that IFF_DRV_RUNNING disappeared. - */ - cv_broadcast(&sc->vcc_cv); - cv_broadcast(&sc->cv_rcclose); - - /* - * Now free all resources. - */ - - /* - * Free the large mbufs that are given to the card. - */ - for (i = 0 ; i < sc->lbufs_size; i++) { - if (sc->lbufs[i] != NULL) { - bus_dmamap_unload(sc->mbuf_tag, sc->rmaps[i]); - m_freem(sc->lbufs[i]); - sc->lbufs[i] = NULL; - } - } - - /* - * Free small buffers - */ - for (p = 0; p < sc->mbuf_npages; p++) { - pg = sc->mbuf_pages[p]; - for (i = 0; i < pg->hdr.nchunks; i++) { - ch = (struct mbuf_chunk_hdr *) ((char *)pg + - i * pg->hdr.chunksize + pg->hdr.hdroff); - if (ch->flags & MBUF_CARD) { - ch->flags &= ~MBUF_CARD; - ch->flags |= MBUF_USED; - hatm_ext_free(&sc->mbuf_list[pg->hdr.pool], - (struct mbufx_free *)((u_char *)ch - - pg->hdr.hdroff)); - } - } - } - - hatm_stop_tpds(sc); - - /* - * Free all partial reassembled PDUs on any VCC. - */ - for (cid = 0; cid < HE_MAX_VCCS; cid++) { - if (sc->vccs[cid] != NULL) { - if (sc->vccs[cid]->chain != NULL) { - m_freem(sc->vccs[cid]->chain); - sc->vccs[cid]->chain = NULL; - sc->vccs[cid]->last = NULL; - } - if (!(sc->vccs[cid]->vflags & (HE_VCC_RX_OPEN | - HE_VCC_TX_OPEN))) { - hatm_tx_vcc_closed(sc, cid); - uma_zfree(sc->vcc_zone, sc->vccs[cid]); - sc->vccs[cid] = NULL; - sc->open_vccs--; - } else { - sc->vccs[cid]->vflags = 0; - sc->vccs[cid]->ntpds = 0; - } - } - } - - if (sc->rbp_s0.size != 0) - bzero(sc->rbp_s0.mem.base, sc->rbp_s0.mem.size); - if (sc->rbp_l0.size != 0) - bzero(sc->rbp_l0.mem.base, sc->rbp_l0.mem.size); - if (sc->rbp_s1.size != 0) - bzero(sc->rbp_s1.mem.base, sc->rbp_s1.mem.size); - if (sc->rbrq_0.size != 0) - bzero(sc->rbrq_0.mem.base, sc->rbrq_0.mem.size); - if (sc->rbrq_1.size != 0) - bzero(sc->rbrq_1.mem.base, sc->rbrq_1.mem.size); - - bzero(sc->tbrq.mem.base, sc->tbrq.mem.size); - bzero(sc->tpdrq.mem.base, sc->tpdrq.mem.size); - bzero(sc->hsp_mem.base, sc->hsp_mem.size); -} - -/************************************************************ - * - * Driver infrastructure - */ -devclass_t hatm_devclass; - -static device_method_t hatm_methods[] = { - DEVMETHOD(device_probe, hatm_probe), - DEVMETHOD(device_attach, hatm_attach), - DEVMETHOD(device_detach, hatm_detach), - {0,0} -}; -static driver_t hatm_driver = { - "hatm", - hatm_methods, - sizeof(struct hatm_softc), -}; -DRIVER_MODULE(hatm, pci, hatm_driver, hatm_devclass, NULL, 0); diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c deleted file mode 100644 index ee5e67b90244..000000000000 --- a/sys/dev/hatm/if_hatm_intr.c +++ /dev/null @@ -1,731 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * ForeHE driver. - * - * Interrupt handler. - */ - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -CTASSERT(sizeof(struct mbuf_page) == MBUF_ALLOC_SIZE); -CTASSERT(sizeof(struct mbuf0_chunk) == MBUF0_CHUNK); -CTASSERT(sizeof(struct mbuf1_chunk) == MBUF1_CHUNK); -CTASSERT(sizeof(((struct mbuf0_chunk *)NULL)->storage) >= MBUF0_SIZE); -CTASSERT(sizeof(((struct mbuf1_chunk *)NULL)->storage) >= MBUF1_SIZE); -CTASSERT(sizeof(struct tpd) <= HE_TPD_SIZE); - -CTASSERT(MBUF0_PER_PAGE <= 256); -CTASSERT(MBUF1_PER_PAGE <= 256); - -static void hatm_mbuf_page_alloc(struct hatm_softc *sc, u_int group); - -/* - * Free an external mbuf to a list. We use atomic functions so that - * we don't need a mutex for the list. - * - * Note that in general this algorithm is not safe when multiple readers - * and writers are present. To cite from a mail from David Schultz - * : - * - * It looks like this is subject to the ABA problem. For instance, - * suppose X, Y, and Z are the top things on the freelist and a - * thread attempts to make an allocation. You set buf to X and load - * buf->link (Y) into a register. Then the thread get preempted, and - * another thread allocates both X and Y, then frees X. When the - * original thread gets the CPU again, X is still on top of the - * freelist, so the atomic operation succeeds. However, the atomic - * op places Y on top of the freelist, even though Y is no longer - * free. - * - * We are, however sure that we have only one thread that ever allocates - * buffers because the only place we're call from is the interrupt handler. - * Under these circumstances the code looks safe. - */ -void -hatm_ext_free(struct mbufx_free **list, struct mbufx_free *buf) -{ - for (;;) { - buf->link = *list; - if (atomic_cmpset_ptr((uintptr_t *)list, (uintptr_t)buf->link, - (uintptr_t)buf)) - break; - } -} - -static __inline struct mbufx_free * -hatm_ext_alloc(struct hatm_softc *sc, u_int g) -{ - struct mbufx_free *buf; - - for (;;) { - if ((buf = sc->mbuf_list[g]) == NULL) - break; - if (atomic_cmpset_ptr((uintptr_t *)&sc->mbuf_list[g], - (uintptr_t)buf, (uintptr_t)buf->link)) - break; - } - if (buf == NULL) { - hatm_mbuf_page_alloc(sc, g); - for (;;) { - if ((buf = sc->mbuf_list[g]) == NULL) - break; - if (atomic_cmpset_ptr((uintptr_t *)&sc->mbuf_list[g], - (uintptr_t)buf, (uintptr_t)buf->link)) - break; - } - } - return (buf); -} - -/* - * Either the queue treshold was crossed or a TPD with the INTR bit set - * was transmitted. - */ -static void -he_intr_tbrq(struct hatm_softc *sc, struct hetbrq *q, u_int group) -{ - uint32_t *tailp = &sc->hsp->group[group].tbrq_tail; - u_int no; - - while (q->head != (*tailp >> 2)) { - no = (q->tbrq[q->head].addr & HE_REGM_TBRQ_ADDR) >> - HE_REGS_TPD_ADDR; - hatm_tx_complete(sc, TPD_ADDR(sc, no), - (q->tbrq[q->head].addr & HE_REGM_TBRQ_FLAGS)); - - if (++q->head == q->size) - q->head = 0; - } - WRITE4(sc, HE_REGO_TBRQ_H(group), q->head << 2); -} - -/* - * DMA loader function for external mbuf page. - */ -static void -hatm_extbuf_helper(void *arg, bus_dma_segment_t *segs, int nsegs, - int error) -{ - if (error) { - printf("%s: mapping error %d\n", __func__, error); - return; - } - KASSERT(nsegs == 1, - ("too many segments for DMA: %d", nsegs)); - KASSERT(segs[0].ds_addr <= 0xffffffffLU, - ("phys addr too large %lx", (u_long)segs[0].ds_addr)); - - *(uint32_t *)arg = segs[0].ds_addr; -} - -/* - * Allocate a page of external mbuf storage for the small pools. - * Create a DMA map and load it. Put all the chunks onto the right - * free list. - */ -static void -hatm_mbuf_page_alloc(struct hatm_softc *sc, u_int group) -{ - struct mbuf_page *pg; - int err; - u_int i; - - if (sc->mbuf_npages == sc->mbuf_max_pages) - return; - if ((pg = malloc(MBUF_ALLOC_SIZE, M_DEVBUF, M_NOWAIT)) == NULL) - return; - - err = bus_dmamap_create(sc->mbuf_tag, 0, &pg->hdr.map); - if (err != 0) { - if_printf(sc->ifp, "%s -- bus_dmamap_create: %d\n", - __func__, err); - free(pg, M_DEVBUF); - return; - } - err = bus_dmamap_load(sc->mbuf_tag, pg->hdr.map, pg, MBUF_ALLOC_SIZE, - hatm_extbuf_helper, &pg->hdr.phys, BUS_DMA_NOWAIT); - if (err != 0) { - if_printf(sc->ifp, "%s -- mbuf mapping failed %d\n", - __func__, err); - bus_dmamap_destroy(sc->mbuf_tag, pg->hdr.map); - free(pg, M_DEVBUF); - return; - } - - sc->mbuf_pages[sc->mbuf_npages] = pg; - - if (group == 0) { - struct mbuf0_chunk *c; - - pg->hdr.pool = 0; - pg->hdr.nchunks = MBUF0_PER_PAGE; - pg->hdr.chunksize = MBUF0_CHUNK; - pg->hdr.hdroff = sizeof(c->storage); - c = (struct mbuf0_chunk *)pg; - for (i = 0; i < MBUF0_PER_PAGE; i++, c++) { - c->hdr.pageno = sc->mbuf_npages; - c->hdr.chunkno = i; - c->hdr.flags = 0; - hatm_ext_free(&sc->mbuf_list[0], - (struct mbufx_free *)c); - } - } else { - struct mbuf1_chunk *c; - - pg->hdr.pool = 1; - pg->hdr.nchunks = MBUF1_PER_PAGE; - pg->hdr.chunksize = MBUF1_CHUNK; - pg->hdr.hdroff = sizeof(c->storage); - c = (struct mbuf1_chunk *)pg; - for (i = 0; i < MBUF1_PER_PAGE; i++, c++) { - c->hdr.pageno = sc->mbuf_npages; - c->hdr.chunkno = i; - c->hdr.flags = 0; - hatm_ext_free(&sc->mbuf_list[1], - (struct mbufx_free *)c); - } - } - sc->mbuf_npages++; -} - -/* - * Free an mbuf and put it onto the free list. - */ -static void -hatm_mbuf0_free(struct mbuf *m, void *buf, void *args) -{ - struct hatm_softc *sc = args; - struct mbuf0_chunk *c = buf; - - KASSERT((c->hdr.flags & (MBUF_USED | MBUF_CARD)) == MBUF_USED, - ("freeing unused mbuf %x", c->hdr.flags)); - c->hdr.flags &= ~MBUF_USED; - hatm_ext_free(&sc->mbuf_list[0], (struct mbufx_free *)c); -} -static void -hatm_mbuf1_free(struct mbuf *m, void *buf, void *args) -{ - struct hatm_softc *sc = args; - struct mbuf1_chunk *c = buf; - - KASSERT((c->hdr.flags & (MBUF_USED | MBUF_CARD)) == MBUF_USED, - ("freeing unused mbuf %x", c->hdr.flags)); - c->hdr.flags &= ~MBUF_USED; - hatm_ext_free(&sc->mbuf_list[1], (struct mbufx_free *)c); -} - -static void -hatm_mbuf_helper(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - uint32_t *ptr = (uint32_t *)arg; - - if (nsegs == 0) { - printf("%s: error=%d\n", __func__, error); - return; - } - KASSERT(nsegs == 1, ("too many segments for mbuf: %d", nsegs)); - KASSERT(segs[0].ds_addr <= 0xffffffffLU, - ("phys addr too large %lx", (u_long)segs[0].ds_addr)); - - *ptr = segs[0].ds_addr; -} - -/* - * Receive buffer pool interrupt. This means the number of entries in the - * queue has dropped below the threshold. Try to supply new buffers. - */ -static void -he_intr_rbp(struct hatm_softc *sc, struct herbp *rbp, u_int large, - u_int group) -{ - u_int ntail; - struct mbuf *m; - int error; - struct mbufx_free *cf; - struct mbuf_page *pg; - struct mbuf0_chunk *buf0; - struct mbuf1_chunk *buf1; - - DBG(sc, INTR, ("%s buffer supply threshold crossed for group %u", - large ? "large" : "small", group)); - - rbp->head = (READ4(sc, HE_REGO_RBP_S(large, group)) >> HE_REGS_RBP_HEAD) - & (rbp->size - 1); - - for (;;) { - if ((ntail = rbp->tail + 1) == rbp->size) - ntail = 0; - if (ntail == rbp->head) - break; - m = NULL; - - if (large) { - /* allocate the MBUF */ - if ((m = m_getcl(M_NOWAIT, MT_DATA, - M_PKTHDR)) == NULL) { - if_printf(sc->ifp, - "no mbuf clusters\n"); - break; - } - m->m_data += MBUFL_OFFSET; - - if (sc->lbufs[sc->lbufs_next] != NULL) - panic("hatm: lbufs full %u", sc->lbufs_next); - sc->lbufs[sc->lbufs_next] = m; - - if ((error = bus_dmamap_load(sc->mbuf_tag, - sc->rmaps[sc->lbufs_next], - m->m_data, rbp->bsize, hatm_mbuf_helper, - &rbp->rbp[rbp->tail].phys, BUS_DMA_NOWAIT)) != 0) - panic("hatm: mbuf mapping failed %d", error); - - bus_dmamap_sync(sc->mbuf_tag, - sc->rmaps[sc->lbufs_next], - BUS_DMASYNC_PREREAD); - - rbp->rbp[rbp->tail].handle = - MBUF_MAKE_LHANDLE(sc->lbufs_next); - - if (++sc->lbufs_next == sc->lbufs_size) - sc->lbufs_next = 0; - - } else if (group == 0) { - /* - * Allocate small buffer in group 0 - */ - if ((cf = hatm_ext_alloc(sc, 0)) == NULL) - break; - buf0 = (struct mbuf0_chunk *)cf; - pg = sc->mbuf_pages[buf0->hdr.pageno]; - buf0->hdr.flags |= MBUF_CARD; - rbp->rbp[rbp->tail].phys = pg->hdr.phys + - buf0->hdr.chunkno * MBUF0_CHUNK + MBUF0_OFFSET; - rbp->rbp[rbp->tail].handle = - MBUF_MAKE_HANDLE(buf0->hdr.pageno, - buf0->hdr.chunkno); - - bus_dmamap_sync(sc->mbuf_tag, pg->hdr.map, - BUS_DMASYNC_PREREAD); - - } else if (group == 1) { - /* - * Allocate small buffer in group 1 - */ - if ((cf = hatm_ext_alloc(sc, 1)) == NULL) - break; - buf1 = (struct mbuf1_chunk *)cf; - pg = sc->mbuf_pages[buf1->hdr.pageno]; - buf1->hdr.flags |= MBUF_CARD; - rbp->rbp[rbp->tail].phys = pg->hdr.phys + - buf1->hdr.chunkno * MBUF1_CHUNK + MBUF1_OFFSET; - rbp->rbp[rbp->tail].handle = - MBUF_MAKE_HANDLE(buf1->hdr.pageno, - buf1->hdr.chunkno); - - bus_dmamap_sync(sc->mbuf_tag, pg->hdr.map, - BUS_DMASYNC_PREREAD); - - } else - /* ups */ - break; - - DBG(sc, DMA, ("MBUF loaded: handle=%x m=%p phys=%x", - rbp->rbp[rbp->tail].handle, m, rbp->rbp[rbp->tail].phys)); - - rbp->tail = ntail; - } - WRITE4(sc, HE_REGO_RBP_T(large, group), - (rbp->tail << HE_REGS_RBP_TAIL)); -} - -/* - * Extract the buffer and hand it to the receive routine - */ -static struct mbuf * -hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle) -{ - u_int pageno; - u_int chunkno; - struct mbuf *m; - - if (handle & MBUF_LARGE_FLAG) { - /* large buffer - sync and unload */ - MBUF_PARSE_LHANDLE(handle, handle); - DBG(sc, RX, ("RX large handle=%x", handle)); - - bus_dmamap_sync(sc->mbuf_tag, sc->rmaps[handle], - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->mbuf_tag, sc->rmaps[handle]); - - m = sc->lbufs[handle]; - sc->lbufs[handle] = NULL; - - return (m); - } - - MBUF_PARSE_HANDLE(handle, pageno, chunkno); - - DBG(sc, RX, ("RX group=%u handle=%x page=%u chunk=%u", group, handle, - pageno, chunkno)); - - MGETHDR(m, M_NOWAIT, MT_DATA); - - if (group == 0) { - struct mbuf0_chunk *c0; - - c0 = (struct mbuf0_chunk *)sc->mbuf_pages[pageno] + chunkno; - KASSERT(c0->hdr.pageno == pageno, ("pageno = %u/%u", - c0->hdr.pageno, pageno)); - KASSERT(c0->hdr.chunkno == chunkno, ("chunkno = %u/%u", - c0->hdr.chunkno, chunkno)); - KASSERT(c0->hdr.flags & MBUF_CARD, ("mbuf not on card %u/%u", - pageno, chunkno)); - KASSERT(!(c0->hdr.flags & MBUF_USED), ("used mbuf %u/%u", - pageno, chunkno)); - - c0->hdr.flags |= MBUF_USED; - c0->hdr.flags &= ~MBUF_CARD; - - if (m != NULL) { - m->m_ext.ext_cnt = &c0->hdr.ref_cnt; - MEXTADD(m, (void *)c0, MBUF0_SIZE, - hatm_mbuf0_free, c0, sc, M_PKTHDR, EXT_EXTREF); - m->m_data += MBUF0_OFFSET; - } else - (void)hatm_mbuf0_free(NULL, c0, sc); - - } else { - struct mbuf1_chunk *c1; - - c1 = (struct mbuf1_chunk *)sc->mbuf_pages[pageno] + chunkno; - KASSERT(c1->hdr.pageno == pageno, ("pageno = %u/%u", - c1->hdr.pageno, pageno)); - KASSERT(c1->hdr.chunkno == chunkno, ("chunkno = %u/%u", - c1->hdr.chunkno, chunkno)); - KASSERT(c1->hdr.flags & MBUF_CARD, ("mbuf not on card %u/%u", - pageno, chunkno)); - KASSERT(!(c1->hdr.flags & MBUF_USED), ("used mbuf %u/%u", - pageno, chunkno)); - - c1->hdr.flags |= MBUF_USED; - c1->hdr.flags &= ~MBUF_CARD; - - if (m != NULL) { - m->m_ext.ext_cnt = &c1->hdr.ref_cnt; - MEXTADD(m, (void *)c1, MBUF1_SIZE, - hatm_mbuf1_free, c1, sc, M_PKTHDR, EXT_EXTREF); - m->m_data += MBUF1_OFFSET; - } else - (void)hatm_mbuf1_free(NULL, c1, sc); - } - - return (m); -} - -/* - * Interrupt because of receive buffer returned. - */ -static void -he_intr_rbrq(struct hatm_softc *sc, struct herbrq *rq, u_int group) -{ - struct he_rbrqen *e; - uint32_t flags, tail; - u_int cid, len; - struct mbuf *m; - - for (;;) { - tail = sc->hsp->group[group].rbrq_tail >> 3; - - if (rq->head == tail) - break; - - e = &rq->rbrq[rq->head]; - - flags = e->addr & HE_REGM_RBRQ_FLAGS; - if (!(flags & HE_REGM_RBRQ_HBUF_ERROR)) - m = hatm_rx_buffer(sc, group, e->addr); - else - m = NULL; - - cid = (e->len & HE_REGM_RBRQ_CID) >> HE_REGS_RBRQ_CID; - len = 4 * (e->len & HE_REGM_RBRQ_LEN); - - hatm_rx(sc, cid, flags, m, len); - - if (++rq->head == rq->size) - rq->head = 0; - } - WRITE4(sc, HE_REGO_RBRQ_H(group), rq->head << 3); -} - -void -hatm_intr(void *p) -{ - struct heirq *q = p; - struct hatm_softc *sc = q->sc; - u_int status; - u_int tail; - - /* if we have a stray interrupt with a non-initialized card, - * we cannot even lock before looking at the flag */ - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - - mtx_lock(&sc->mtx); - (void)READ4(sc, HE_REGO_INT_FIFO); - - tail = *q->tailp; - if (q->head == tail) { - /* workaround for tail pointer not updated bug (8.1.1) */ - DBG(sc, INTR, ("hatm: intr tailq not updated bug triggered")); - - /* read the tail pointer from the card */ - tail = READ4(sc, HE_REGO_IRQ_BASE(q->group)) & - HE_REGM_IRQ_BASE_TAIL; - BARRIER_R(sc); - - sc->istats.bug_no_irq_upd++; - } - - /* clear the interrupt */ - WRITE4(sc, HE_REGO_INT_FIFO, HE_REGM_INT_FIFO_CLRA); - BARRIER_W(sc); - - while (q->head != tail) { - status = q->irq[q->head]; - q->irq[q->head] = HE_REGM_ITYPE_INVALID; - if (++q->head == (q->size - 1)) - q->head = 0; - - switch (status & HE_REGM_ITYPE) { - - case HE_REGM_ITYPE_TBRQ: - DBG(sc, INTR, ("TBRQ treshold %u", status & HE_REGM_IGROUP)); - sc->istats.itype_tbrq++; - he_intr_tbrq(sc, &sc->tbrq, status & HE_REGM_IGROUP); - break; - - case HE_REGM_ITYPE_TPD: - DBG(sc, INTR, ("TPD ready %u", status & HE_REGM_IGROUP)); - sc->istats.itype_tpd++; - he_intr_tbrq(sc, &sc->tbrq, status & HE_REGM_IGROUP); - break; - - case HE_REGM_ITYPE_RBPS: - sc->istats.itype_rbps++; - switch (status & HE_REGM_IGROUP) { - - case 0: - he_intr_rbp(sc, &sc->rbp_s0, 0, 0); - break; - - case 1: - he_intr_rbp(sc, &sc->rbp_s1, 0, 1); - break; - - default: - if_printf(sc->ifp, "bad INTR RBPS%u\n", - status & HE_REGM_IGROUP); - break; - } - break; - - case HE_REGM_ITYPE_RBPL: - sc->istats.itype_rbpl++; - switch (status & HE_REGM_IGROUP) { - - case 0: - he_intr_rbp(sc, &sc->rbp_l0, 1, 0); - break; - - default: - if_printf(sc->ifp, "bad INTR RBPL%u\n", - status & HE_REGM_IGROUP); - break; - } - break; - - case HE_REGM_ITYPE_RBRQ: - DBG(sc, INTR, ("INTERRUPT RBRQ %u", status & HE_REGM_IGROUP)); - sc->istats.itype_rbrq++; - switch (status & HE_REGM_IGROUP) { - - case 0: - he_intr_rbrq(sc, &sc->rbrq_0, 0); - break; - - case 1: - if (sc->rbrq_1.size > 0) { - he_intr_rbrq(sc, &sc->rbrq_1, 1); - break; - } - /* FALLTHRU */ - - default: - if_printf(sc->ifp, "bad INTR RBRQ%u\n", - status & HE_REGM_IGROUP); - break; - } - break; - - case HE_REGM_ITYPE_RBRQT: - DBG(sc, INTR, ("INTERRUPT RBRQT %u", status & HE_REGM_IGROUP)); - sc->istats.itype_rbrqt++; - switch (status & HE_REGM_IGROUP) { - - case 0: - he_intr_rbrq(sc, &sc->rbrq_0, 0); - break; - - case 1: - if (sc->rbrq_1.size > 0) { - he_intr_rbrq(sc, &sc->rbrq_1, 1); - break; - } - /* FALLTHRU */ - - default: - if_printf(sc->ifp, "bad INTR RBRQT%u\n", - status & HE_REGM_IGROUP); - break; - } - break; - - case HE_REGM_ITYPE_PHYS: - sc->istats.itype_phys++; - utopia_intr(&sc->utopia); - break; - -#if HE_REGM_ITYPE_UNKNOWN != HE_REGM_ITYPE_INVALID - case HE_REGM_ITYPE_UNKNOWN: - sc->istats.itype_unknown++; - if_printf(sc->ifp, "bad interrupt\n"); - break; -#endif - - case HE_REGM_ITYPE_ERR: - sc->istats.itype_err++; - switch (status) { - - case HE_REGM_ITYPE_PERR: - if_printf(sc->ifp, "parity error\n"); - break; - - case HE_REGM_ITYPE_ABORT: - if_printf(sc->ifp, "abort interrupt " - "addr=0x%08x\n", - READ4(sc, HE_REGO_ABORT_ADDR)); - break; - - default: - if_printf(sc->ifp, - "bad interrupt type %08x\n", status); - break; - } - break; - - case HE_REGM_ITYPE_INVALID: - /* this is the documented fix for the ISW bug 8.1.1 - * Note, that the documented fix is partly wrong: - * the ISWs should be intialized to 0xf8 not 0xff */ - sc->istats.bug_bad_isw++; - DBG(sc, INTR, ("hatm: invalid ISW bug triggered")); - he_intr_tbrq(sc, &sc->tbrq, 0); - he_intr_rbp(sc, &sc->rbp_s0, 0, 0); - he_intr_rbp(sc, &sc->rbp_l0, 1, 0); - he_intr_rbp(sc, &sc->rbp_s1, 0, 1); - he_intr_rbrq(sc, &sc->rbrq_0, 0); - he_intr_rbrq(sc, &sc->rbrq_1, 1); - utopia_intr(&sc->utopia); - break; - - default: - if_printf(sc->ifp, "bad interrupt type %08x\n", - status); - break; - } - } - - /* write back head to clear queue */ - WRITE4(sc, HE_REGO_IRQ_HEAD(0), - ((q->size - 1) << HE_REGS_IRQ_HEAD_SIZE) | - (q->thresh << HE_REGS_IRQ_HEAD_THRESH) | - (q->head << HE_REGS_IRQ_HEAD_HEAD)); - BARRIER_W(sc); - - /* workaround the back-to-back irq access problem (8.1.2) */ - (void)READ4(sc, HE_REGO_INT_FIFO); - BARRIER_R(sc); - - mtx_unlock(&sc->mtx); -} diff --git a/sys/dev/hatm/if_hatm_ioctl.c b/sys/dev/hatm/if_hatm_ioctl.c deleted file mode 100644 index 154a2d60943f..000000000000 --- a/sys/dev/hatm/if_hatm_ioctl.c +++ /dev/null @@ -1,385 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * ForeHE driver. - * - * Ioctl handler. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -static u_int hatm_natm_traffic = ATMIO_TRAFFIC_UBR; -static u_int hatm_natm_pcr = 0; - -static int hatm_sysctl_natm_traffic(SYSCTL_HANDLER_ARGS); - -SYSCTL_DECL(_hw_atm); - -SYSCTL_PROC(_hw_atm, OID_AUTO, natm_traffic, CTLTYPE_UINT | CTLFLAG_RW, - &hatm_natm_traffic, sizeof(hatm_natm_traffic), hatm_sysctl_natm_traffic, - "IU", "traffic type for NATM connections"); -SYSCTL_UINT(_hw_atm, OID_AUTO, natm_pcr, CTLFLAG_RW, - &hatm_natm_pcr, 0, "PCR for NATM connections"); - -/* - * Try to open the given VCC. - */ -static int -hatm_open_vcc(struct hatm_softc *sc, struct atmio_openvcc *arg) -{ - u_int cid; - struct hevcc *vcc; - int error = 0; - - DBG(sc, VCC, ("Open VCC: %u.%u flags=%#x", arg->param.vpi, - arg->param.vci, arg->param.flags)); - - if ((arg->param.vpi & ~HE_VPI_MASK) || - (arg->param.vci & ~HE_VCI_MASK) || - (arg->param.vci == 0)) - return (EINVAL); - cid = HE_CID(arg->param.vpi, arg->param.vci); - - if ((arg->param.flags & ATMIO_FLAG_NOTX) && - (arg->param.flags & ATMIO_FLAG_NORX)) - return (EINVAL); - - vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO); - if (vcc == NULL) - return (ENOMEM); - - mtx_lock(&sc->mtx); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - if (sc->vccs[cid] != NULL) { - error = EBUSY; - goto done; - } - vcc->param = arg->param; - vcc->rxhand = arg->rxhand; - switch (vcc->param.aal) { - - case ATMIO_AAL_0: - case ATMIO_AAL_5: - case ATMIO_AAL_RAW: - break; - - default: - error = EINVAL; - goto done; - } - switch (vcc->param.traffic) { - - case ATMIO_TRAFFIC_UBR: - case ATMIO_TRAFFIC_CBR: - case ATMIO_TRAFFIC_ABR: - break; - - default: - error = EINVAL; - goto done; - } - vcc->ntpds = 0; - vcc->chain = vcc->last = NULL; - vcc->ibytes = vcc->ipackets = 0; - vcc->obytes = vcc->opackets = 0; - - if (!(vcc->param.flags & ATMIO_FLAG_NOTX) && - (error = hatm_tx_vcc_can_open(sc, cid, vcc)) != 0) - goto done; - - /* ok - go ahead */ - sc->vccs[cid] = vcc; - hatm_load_vc(sc, cid, 0); - - /* don't free below */ - vcc = NULL; - sc->open_vccs++; - - done: - mtx_unlock(&sc->mtx); - if (vcc != NULL) - uma_zfree(sc->vcc_zone, vcc); - return (error); -} - -void -hatm_load_vc(struct hatm_softc *sc, u_int cid, int reopen) -{ - struct hevcc *vcc = sc->vccs[cid]; - - if (!(vcc->param.flags & ATMIO_FLAG_NOTX)) - hatm_tx_vcc_open(sc, cid); - if (!(vcc->param.flags & ATMIO_FLAG_NORX)) - hatm_rx_vcc_open(sc, cid); - - if (reopen) - return; - - /* inform management about non-NG and NG-PVCs */ - if (!(vcc->param.flags & ATMIO_FLAG_NG) || - (vcc->param.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), vcc->param.vpi, - vcc->param.vci, 1); -} - -/* - * VCC has been finally closed. - */ -void -hatm_vcc_closed(struct hatm_softc *sc, u_int cid) -{ - struct hevcc *vcc = sc->vccs[cid]; - - /* inform management about non-NG and NG-PVCs */ - if (!(vcc->param.flags & ATMIO_FLAG_NG) || - (vcc->param.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), HE_VPI(cid), HE_VCI(cid), 0); - - sc->open_vccs--; - uma_zfree(sc->vcc_zone, vcc); - sc->vccs[cid] = NULL; -} - -/* - * Try to close the given VCC - */ -static int -hatm_close_vcc(struct hatm_softc *sc, struct atmio_closevcc *arg) -{ - u_int cid; - struct hevcc *vcc; - int error = 0; - - DBG(sc, VCC, ("Close VCC: %u.%u", arg->vpi, arg->vci)); - - if((arg->vpi & ~HE_VPI_MASK) || - (arg->vci & ~HE_VCI_MASK) || - (arg->vci == 0)) - return (EINVAL); - cid = HE_CID(arg->vpi, arg->vci); - - mtx_lock(&sc->mtx); - vcc = sc->vccs[cid]; - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - - if (vcc == NULL || !(vcc->vflags & HE_VCC_OPEN)) { - error = ENOENT; - goto done; - } - - if (vcc->vflags & HE_VCC_TX_OPEN) - hatm_tx_vcc_close(sc, cid); - if (vcc->vflags & HE_VCC_RX_OPEN) - hatm_rx_vcc_close(sc, cid); - - if (vcc->param.flags & ATMIO_FLAG_ASYNC) - goto done; - - while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) && - (vcc->vflags & (HE_VCC_TX_CLOSING | HE_VCC_RX_CLOSING))) - cv_wait(&sc->vcc_cv, &sc->mtx); - - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - error = EIO; - goto done; - } - - if (!(vcc->vflags & ATMIO_FLAG_NOTX)) - hatm_tx_vcc_closed(sc, cid); - - hatm_vcc_closed(sc, cid); - - done: - mtx_unlock(&sc->mtx); - return (error); -} - -/* - * IOCTL handler - */ -int -hatm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) -{ - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; - struct hatm_softc *sc = ifp->if_softc; - struct atmio_vcctable *vtab; - int error = 0; - - switch (cmd) { - - case SIOCSIFADDR: - mtx_lock(&sc->mtx); - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - hatm_initialize(sc); - switch (ifa->ifa_addr->sa_family) { - -#ifdef INET - case AF_INET: - case AF_INET6: - ifa->ifa_rtrequest = atm_rtrequest; - break; -#endif - default: - break; - } - mtx_unlock(&sc->mtx); - break; - - case SIOCSIFFLAGS: - mtx_lock(&sc->mtx); - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - hatm_initialize(sc); - } - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - hatm_stop(sc); - } - } - mtx_unlock(&sc->mtx); - break; - - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd); - break; - - case SIOCSIFMTU: - /* - * Set the interface MTU. - */ - if (ifr->ifr_mtu > ATMMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCATMGVCCS: - /* return vcc table */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - HE_MAX_VCCS, sc->open_vccs, &sc->mtx, 1); - error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) + - vtab->count * sizeof(vtab->vccs[0])); - free(vtab, M_DEVBUF); - break; - - case SIOCATMGETVCCS: /* netgraph internal use */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - HE_MAX_VCCS, sc->open_vccs, &sc->mtx, 0); - if (vtab == NULL) { - error = ENOMEM; - break; - } - *(void **)data = vtab; - break; - - case SIOCATMOPENVCC: /* kernel internal use */ - error = hatm_open_vcc(sc, (struct atmio_openvcc *)data); - break; - - case SIOCATMCLOSEVCC: /* kernel internal use */ - error = hatm_close_vcc(sc, (struct atmio_closevcc *)data); - break; - - default: - DBG(sc, IOCTL, ("cmd=%08lx arg=%p", cmd, data)); - error = EINVAL; - break; - } - - return (error); -} - -static int -hatm_sysctl_natm_traffic(SYSCTL_HANDLER_ARGS) -{ - int error; - int tmp; - - tmp = hatm_natm_traffic; - error = sysctl_handle_int(oidp, &tmp, 0, req); - if (error != 0 || req->newptr == NULL) - return (error); - - if (tmp != ATMIO_TRAFFIC_UBR && tmp != ATMIO_TRAFFIC_CBR) - return (EINVAL); - - hatm_natm_traffic = tmp; - return (0); -} diff --git a/sys/dev/hatm/if_hatm_rx.c b/sys/dev/hatm/if_hatm_rx.c deleted file mode 100644 index c12ec6e9e709..000000000000 --- a/sys/dev/hatm/if_hatm_rx.c +++ /dev/null @@ -1,331 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * ForeHE driver. - * - * Receive. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -void -hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m0, - u_int len) -{ - struct hevcc *vcc; - struct atm_pseudohdr aph; - struct mbuf *m, *m1; - u_int vpi, vci; - u_char *ptr; - - DBG(sc, RX, ("cid=%#x flags=%#x len=%u mbuf=%p", cid, flags, len, m0)); - - vcc = sc->vccs[cid]; - if (vcc == NULL) - goto drop; - - if (flags & HE_REGM_RBRQ_CON_CLOSED) { - if (vcc->vflags & HE_VCC_RX_CLOSING) { - vcc->vflags &= ~HE_VCC_RX_CLOSING; - if (vcc->param.flags & ATMIO_FLAG_ASYNC) { - if (!(vcc->vflags & HE_VCC_OPEN)) - hatm_vcc_closed(sc, cid); - } else - cv_signal(&sc->vcc_cv); - } - goto drop; - } - - if (!(vcc->vflags & HE_VCC_RX_OPEN)) - goto drop; - - if (flags & HE_REGM_RBRQ_HBUF_ERROR) { - sc->istats.hbuf_error++; - if (vcc->chain != NULL) { - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - } - goto drop; - } - if (m0 == NULL) { - sc->istats.no_rcv_mbuf++; - return; - } - - if ((m0->m_len = len) == 0) { - sc->istats.empty_hbuf++; - m_free(m0); - - } else if (vcc->chain == NULL) { - sc->istats.rx_seg++; - vcc->chain = vcc->last = m0; - vcc->last->m_next = NULL; - vcc->chain->m_pkthdr.len = m0->m_len; - vcc->chain->m_pkthdr.rcvif = sc->ifp; - - } else { - sc->istats.rx_seg++; - vcc->last->m_next = m0; - vcc->last = m0; - vcc->last->m_next = NULL; - vcc->chain->m_pkthdr.len += m0->m_len; - } - - if (!(flags & HE_REGM_RBRQ_END_PDU)) - return; - - if (flags & HE_REGM_RBRQ_CRC_ERROR) { - if (vcc->chain) - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - sc->istats.crc_error++; - if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); - return; - } - if (flags & HE_REGM_RBRQ_LEN_ERROR) { - if (vcc->chain) - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - sc->istats.len_error++; - if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); - return; - } - -#ifdef HATM_DEBUG - if (sc->debug & DBG_DUMP) { - struct mbuf *tmp; - - for (tmp = vcc->chain; tmp != NULL; tmp = tmp->m_next) { - printf("mbuf %p: len=%u\n", tmp, tmp->m_len); - for (ptr = mtod(tmp, u_char *); - ptr < mtod(tmp, u_char *) + tmp->m_len; ptr++) - printf("%02x ", *ptr); - printf("\n"); - } - } -#endif - - if (vcc->param.aal == ATMIO_AAL_5) { - /* - * Need to remove padding and the trailer. The trailer - * may be split across buffers according to 2.10.1.2 - * Assume that mbufs sizes are even (buffer sizes and cell - * payload sizes are) and that there are no empty mbufs. - */ - m = vcc->last; - if (m->m_len == 2) { - /* Ah, oh, only part of CRC */ - if (m == vcc->chain) { - /* ups */ - sc->istats.short_aal5++; - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - return; - } - for (m1 = vcc->chain; m1->m_next != m; m1 = m1->m_next) - ; - ptr = (u_char *)m1->m_data + m1->m_len - 4; - - } else if (m->m_len == 4) { - /* Ah, oh, only CRC */ - if (m == vcc->chain) { - /* ups */ - sc->istats.short_aal5++; - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - return; - } - for (m1 = vcc->chain; m1->m_next != m; m1 = m1->m_next) - ; - ptr = (u_char *)m1->m_data + m1->m_len - 2; - - } else if (m->m_len >= 6) { - ptr = (u_char *)m->m_data + m->m_len - 6; - } else - panic("hatm_rx: bad mbuf len %d", m->m_len); - - len = (ptr[0] << 8) + ptr[1]; - if (len > (u_int)vcc->chain->m_pkthdr.len - 4) { - sc->istats.badlen_aal5++; - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - return; - } - m_adj(vcc->chain, -(vcc->chain->m_pkthdr.len - len)); - } - m = vcc->chain; - vcc->chain = vcc->last = NULL; - -#ifdef ENABLE_BPF - if (!(vcc->param.flags & ATMIO_FLAG_NG) && - (vcc->param.aal == ATMIO_AAL_5) && - (vcc->param.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(sc->ifp, m); -#endif - - vpi = HE_VPI(cid); - vci = HE_VCI(cid); - - ATM_PH_FLAGS(&aph) = vcc->param.flags & 0xff; - ATM_PH_VPI(&aph) = vpi; - ATM_PH_SETVCI(&aph, vci); - - if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); - /* this is in if_atmsubr.c */ - /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, len); */ - - vcc->ibytes += len; - vcc->ipackets++; - -#if 0 - { - struct mbuf *tmp; - - for (tmp = m; tmp != NULL; tmp = tmp->m_next) { - printf("mbuf %p: len=%u\n", tmp, tmp->m_len); - for (ptr = mtod(tmp, u_char *); - ptr < mtod(tmp, u_char *) + tmp->m_len; ptr++) - printf("%02x ", *ptr); - printf("\n"); - } - } -#endif - - atm_input(sc->ifp, &aph, m, vcc->rxhand); - - return; - - drop: - if (m0 != NULL) - m_free(m0); -} - -void -hatm_rx_vcc_open(struct hatm_softc *sc, u_int cid) -{ - struct hevcc *vcc = sc->vccs[cid]; - uint32_t rsr0, rsr1, rsr4; - - rsr0 = rsr1 = rsr4 = 0; - - if (vcc->param.traffic == ATMIO_TRAFFIC_ABR) { - rsr1 |= HE_REGM_RSR1_AQI; - rsr4 |= HE_REGM_RSR4_AQI; - } - - if (vcc->param.aal == ATMIO_AAL_5) { - rsr0 |= HE_REGM_RSR0_STARTPDU | HE_REGM_RSR0_AAL_5; - } else if (vcc->param.aal == ATMIO_AAL_0) { - rsr0 |= HE_REGM_RSR0_AAL_0; - } else { - if (sc->rbp_s1.size != 0) { - rsr1 |= (1 << HE_REGS_RSR1_GROUP); - rsr4 |= (1 << HE_REGS_RSR4_GROUP); - } - rsr0 |= HE_REGM_RSR0_AAL_RAW | HE_REGM_RSR0_PTI7 | - HE_REGM_RSR0_RM | HE_REGM_RSR0_F5OAM; - } - rsr0 |= HE_REGM_RSR0_OPEN; - - WRITE_RSR(sc, cid, 0, 0xf, rsr0); - WRITE_RSR(sc, cid, 1, 0xf, rsr1); - WRITE_RSR(sc, cid, 4, 0xf, rsr4); - - vcc->vflags |= HE_VCC_RX_OPEN; -} - -/* - * Close the RX side of a VCC. - */ -void -hatm_rx_vcc_close(struct hatm_softc *sc, u_int cid) -{ - struct hevcc *vcc = sc->vccs[cid]; - uint32_t v; - - vcc->vflags |= HE_VCC_RX_CLOSING; - WRITE_RSR(sc, cid, 0, 0xf, 0); - - v = READ4(sc, HE_REGO_RCCSTAT); - while ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) && - (READ4(sc, HE_REGO_RCCSTAT) & HE_REGM_RCCSTAT_PROG)) - cv_timedwait(&sc->cv_rcclose, &sc->mtx, 1); - - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - - WRITE_MBOX4(sc, HE_REGO_RCON_CLOSE, cid); - - vcc->vflags |= HE_VCC_RX_CLOSING; - vcc->vflags &= ~HE_VCC_RX_OPEN; -} diff --git a/sys/dev/hatm/if_hatm_tx.c b/sys/dev/hatm/if_hatm_tx.c deleted file mode 100644 index 8d64908a718a..000000000000 --- a/sys/dev/hatm/if_hatm_tx.c +++ /dev/null @@ -1,827 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * ForeHE driver. - * - * Transmission. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - - -/* - * These macros are used to trace the flow of transmit mbufs and to - * detect transmit mbuf leaks in the driver. - */ -#ifdef HATM_DEBUG -#define hatm_free_txmbuf(SC) \ - do { \ - if (--sc->txmbuf < 0) \ - DBG(sc, TX, ("txmbuf below 0!")); \ - else if (sc->txmbuf == 0) \ - DBG(sc, TX, ("txmbuf now 0")); \ - } while (0) -#define hatm_get_txmbuf(SC) \ - do { \ - if (++sc->txmbuf > 20000) \ - DBG(sc, TX, ("txmbuf %u", sc->txmbuf)); \ - else if (sc->txmbuf == 1) \ - DBG(sc, TX, ("txmbuf leaves 0")); \ - } while (0) -#else -#define hatm_free_txmbuf(SC) do { } while (0) -#define hatm_get_txmbuf(SC) do { } while (0) -#endif - -/* - * Allocate a new TPD, zero the TPD part. Cannot return NULL if - * flag is 0. The TPD is removed from the free list and its used - * bit is set. - */ -static struct tpd * -hatm_alloc_tpd(struct hatm_softc *sc, u_int flags) -{ - struct tpd *t; - - /* if we allocate a transmit TPD check for the reserve */ - if (flags & M_NOWAIT) { - if (sc->tpd_nfree <= HE_CONFIG_TPD_RESERVE) - return (NULL); - } else { - if (sc->tpd_nfree == 0) - return (NULL); - } - - /* make it being used */ - t = SLIST_FIRST(&sc->tpd_free); - KASSERT(t != NULL, ("tpd botch")); - SLIST_REMOVE_HEAD(&sc->tpd_free, link); - TPD_SET_USED(sc, t->no); - sc->tpd_nfree--; - - /* initialize */ - t->mbuf = NULL; - t->cid = 0; - bzero(&t->tpd, sizeof(t->tpd)); - t->tpd.addr = t->no << HE_REGS_TPD_ADDR; - - return (t); -} - -/* - * Free a TPD. If the mbuf pointer in that TPD is not zero, it is assumed, that - * the DMA map of this TPD was used to load this mbuf. The map is unloaded - * and the mbuf is freed. The TPD is put back onto the free list and - * its used bit is cleared. - */ -static void -hatm_free_tpd(struct hatm_softc *sc, struct tpd *tpd) -{ - if (tpd->mbuf != NULL) { - bus_dmamap_unload(sc->tx_tag, tpd->map); - hatm_free_txmbuf(sc); - m_freem(tpd->mbuf); - tpd->mbuf = NULL; - } - - /* insert TPD into free list */ - SLIST_INSERT_HEAD(&sc->tpd_free, tpd, link); - TPD_CLR_USED(sc, tpd->no); - sc->tpd_nfree++; -} - -/* - * Queue a number of TPD. If there is not enough space none of the TPDs - * is queued and an error code is returned. - */ -static int -hatm_queue_tpds(struct hatm_softc *sc, u_int count, struct tpd **list, - u_int cid) -{ - u_int space; - u_int i; - - if (count >= sc->tpdrq.size) { - sc->istats.tdprq_full++; - return (EBUSY); - } - - if (sc->tpdrq.tail < sc->tpdrq.head) - space = sc->tpdrq.head - sc->tpdrq.tail; - else - space = sc->tpdrq.head - sc->tpdrq.tail + sc->tpdrq.size; - - if (space <= count) { - sc->tpdrq.head = - (READ4(sc, HE_REGO_TPDRQ_H) >> HE_REGS_TPDRQ_H_H) & - (sc->tpdrq.size - 1); - - if (sc->tpdrq.tail < sc->tpdrq.head) - space = sc->tpdrq.head - sc->tpdrq.tail; - else - space = sc->tpdrq.head - sc->tpdrq.tail + - sc->tpdrq.size; - - if (space <= count) { - if_printf(sc->ifp, "TPDRQ full\n"); - sc->istats.tdprq_full++; - return (EBUSY); - } - } - - /* we are going to write to the TPD queue space */ - bus_dmamap_sync(sc->tpdrq.mem.tag, sc->tpdrq.mem.map, - BUS_DMASYNC_PREWRITE); - - /* put the entries into the TPD space */ - for (i = 0; i < count; i++) { - /* we are going to 'write' the TPD to the device */ - bus_dmamap_sync(sc->tpds.tag, sc->tpds.map, - BUS_DMASYNC_PREWRITE); - - sc->tpdrq.tpdrq[sc->tpdrq.tail].tpd = - sc->tpds.paddr + HE_TPD_SIZE * list[i]->no; - sc->tpdrq.tpdrq[sc->tpdrq.tail].cid = cid; - - if (++sc->tpdrq.tail == sc->tpdrq.size) - sc->tpdrq.tail = 0; - } - - /* update tail pointer */ - WRITE4(sc, HE_REGO_TPDRQ_T, (sc->tpdrq.tail << HE_REGS_TPDRQ_T_T)); - - return (0); -} - -/* - * Helper struct for communication with the DMA load helper. - */ -struct load_txbuf_arg { - struct hatm_softc *sc; - struct tpd *first; - struct mbuf *mbuf; - struct hevcc *vcc; - int error; - u_int pti; - u_int vpi, vci; -}; - -/* - * Loader callback for the mbuf. This function allocates the TPDs and - * fills them. It puts the dmamap and and the mbuf pointer into the last - * TPD and then tries to queue all the TPDs. If anything fails, all TPDs - * allocated by this function are freed and the error flag is set in the - * argument structure. The first TPD must then be freed by the caller. - */ -static void -hatm_load_txbuf(void *uarg, bus_dma_segment_t *segs, int nseg, - bus_size_t mapsize, int error) -{ - struct load_txbuf_arg *arg = uarg; - u_int tpds_needed, i, n, tpd_cnt; - int need_intr; - struct tpd *tpd; - struct tpd *tpd_list[HE_CONFIG_MAX_TPD_PER_PACKET]; - - if (error != 0) { - DBG(arg->sc, DMA, ("%s -- error=%d plen=%d\n", - __func__, error, arg->mbuf->m_pkthdr.len)); - return; - } - - /* ensure, we have enough TPDs (remember, we already have one) */ - tpds_needed = (nseg + 2) / 3; - if (HE_CONFIG_TPD_RESERVE + tpds_needed - 1 > arg->sc->tpd_nfree) { - if_printf(arg->sc->ifp, "%s -- out of TPDs (need %d, " - "have %u)\n", __func__, tpds_needed - 1, - arg->sc->tpd_nfree + 1); - arg->error = 1; - return; - } - - /* - * Check for the maximum number of TPDs on the connection. - */ - need_intr = 0; - if (arg->sc->max_tpd > 0) { - if (arg->vcc->ntpds + tpds_needed > arg->sc->max_tpd) { - arg->sc->istats.flow_closed++; - arg->vcc->vflags |= HE_VCC_FLOW_CTRL; - ATMEV_SEND_FLOW_CONTROL(IFP2IFATM(arg->sc->ifp), - arg->vpi, arg->vci, 1); - arg->error = 1; - return; - } - if (arg->vcc->ntpds + tpds_needed > - (9 * arg->sc->max_tpd) / 10) - need_intr = 1; - } - - tpd = arg->first; - tpd_cnt = 0; - tpd_list[tpd_cnt++] = tpd; - for (i = n = 0; i < nseg; i++, n++) { - if (n == 3) { - if ((tpd = hatm_alloc_tpd(arg->sc, M_NOWAIT)) == NULL) - /* may not fail (see check above) */ - panic("%s: out of TPDs", __func__); - tpd->cid = arg->first->cid; - tpd->tpd.addr |= arg->pti; - tpd_list[tpd_cnt++] = tpd; - n = 0; - } - KASSERT(segs[i].ds_addr <= 0xffffffffLU, - ("phys addr too large %lx", (u_long)segs[i].ds_addr)); - - DBG(arg->sc, DMA, ("DMA loaded: %lx/%lu", - (u_long)segs[i].ds_addr, (u_long)segs[i].ds_len)); - - tpd->tpd.bufs[n].addr = segs[i].ds_addr; - tpd->tpd.bufs[n].len = segs[i].ds_len; - - DBG(arg->sc, TX, ("seg[%u]=tpd[%u,%u]=%x/%u", i, - tpd_cnt, n, tpd->tpd.bufs[n].addr, tpd->tpd.bufs[n].len)); - - if (i == nseg - 1) - tpd->tpd.bufs[n].len |= HE_REGM_TPD_LST; - } - - /* - * Swap the MAP in the first and the last TPD and set the mbuf - * pointer into the last TPD. We use the map in the last TPD, because - * the map must stay valid until the last TPD is processed by the card. - */ - if (tpd_cnt > 1) { - bus_dmamap_t tmp; - - tmp = arg->first->map; - arg->first->map = tpd_list[tpd_cnt - 1]->map; - tpd_list[tpd_cnt - 1]->map = tmp; - } - tpd_list[tpd_cnt - 1]->mbuf = arg->mbuf; - - if (need_intr) - tpd_list[tpd_cnt - 1]->tpd.addr |= HE_REGM_TPD_INTR; - - /* queue the TPDs */ - if (hatm_queue_tpds(arg->sc, tpd_cnt, tpd_list, arg->first->cid)) { - /* free all, except the first TPD */ - for (i = 1; i < tpd_cnt; i++) - hatm_free_tpd(arg->sc, tpd_list[i]); - arg->error = 1; - return; - } - arg->vcc->ntpds += tpd_cnt; -} - - -/* - * Start output on the interface - */ -void -hatm_start(struct ifnet *ifp) -{ - struct hatm_softc *sc = ifp->if_softc; - struct mbuf *m; - struct atm_pseudohdr *aph; - u_int cid; - struct tpd *tpd; - struct load_txbuf_arg arg; - u_int len; - int error; - - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - mtx_lock(&sc->mtx); - arg.sc = sc; - - while (1) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - - hatm_get_txmbuf(sc); - - if (m->m_len < sizeof(*aph)) - if ((m = m_pullup(m, sizeof(*aph))) == NULL) { - hatm_free_txmbuf(sc); - continue; - } - - aph = mtod(m, struct atm_pseudohdr *); - arg.vci = ATM_PH_VCI(aph); - arg.vpi = ATM_PH_VPI(aph); - m_adj(m, sizeof(*aph)); - - if ((len = m->m_pkthdr.len) == 0) { - hatm_free_txmbuf(sc); - m_freem(m); - continue; - } - - if ((arg.vpi & ~HE_VPI_MASK) || (arg.vci & ~HE_VCI_MASK) || - (arg.vci == 0)) { - hatm_free_txmbuf(sc); - m_freem(m); - continue; - } - cid = HE_CID(arg.vpi, arg.vci); - arg.vcc = sc->vccs[cid]; - - if (arg.vcc == NULL || !(arg.vcc->vflags & HE_VCC_OPEN)) { - hatm_free_txmbuf(sc); - m_freem(m); - continue; - } - if (arg.vcc->vflags & HE_VCC_FLOW_CTRL) { - hatm_free_txmbuf(sc); - m_freem(m); - sc->istats.flow_drop++; - continue; - } - - arg.pti = 0; - if (arg.vcc->param.aal == ATMIO_AAL_RAW) { - if (len < 52) { - /* too short */ - hatm_free_txmbuf(sc); - m_freem(m); - continue; - } - - /* - * Get the header and ignore except - * payload type and CLP. - */ - if (m->m_len < 4 && (m = m_pullup(m, 4)) == NULL) { - hatm_free_txmbuf(sc); - continue; - } - arg.pti = mtod(m, u_char *)[3] & 0xf; - arg.pti = ((arg.pti & 0xe) << 2) | ((arg.pti & 1) << 1); - m_adj(m, 4); - len -= 4; - - if (len % 48 != 0) { - m_adj(m, -((int)(len % 48))); - len -= len % 48; - } - } - -#ifdef ENABLE_BPF - if (!(arg.vcc->param.flags & ATMIO_FLAG_NG) && - (arg.vcc->param.aal == ATMIO_AAL_5) && - (arg.vcc->param.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(ifp, m); -#endif - - /* Now load a DMA map with the packet. Allocate the first - * TPD to get a map. Additional TPDs may be allocated by the - * callback. */ - if ((tpd = hatm_alloc_tpd(sc, M_NOWAIT)) == NULL) { - hatm_free_txmbuf(sc); - m_freem(m); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - tpd->cid = cid; - tpd->tpd.addr |= arg.pti; - arg.first = tpd; - arg.error = 0; - arg.mbuf = m; - - error = bus_dmamap_load_mbuf(sc->tx_tag, tpd->map, m, - hatm_load_txbuf, &arg, BUS_DMA_NOWAIT); - - if (error == EFBIG) { - /* try to defragment the packet */ - sc->istats.defrag++; - m = m_defrag(m, M_NOWAIT); - if (m == NULL) { - tpd->mbuf = NULL; - hatm_free_txmbuf(sc); - hatm_free_tpd(sc, tpd); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - arg.mbuf = m; - error = bus_dmamap_load_mbuf(sc->tx_tag, tpd->map, m, - hatm_load_txbuf, &arg, BUS_DMA_NOWAIT); - } - - if (error != 0) { - if_printf(sc->ifp, "mbuf loaded error=%d\n", - error); - hatm_free_tpd(sc, tpd); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - if (arg.error) { - hatm_free_tpd(sc, tpd); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - arg.vcc->opackets++; - arg.vcc->obytes += len; - if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); - } - mtx_unlock(&sc->mtx); -} - -void -hatm_tx_complete(struct hatm_softc *sc, struct tpd *tpd, uint32_t flags) -{ - struct hevcc *vcc = sc->vccs[tpd->cid]; - - DBG(sc, TX, ("tx_complete cid=%#x flags=%#x", tpd->cid, flags)); - - if (vcc == NULL) - return; - if ((flags & HE_REGM_TBRQ_EOS) && (vcc->vflags & HE_VCC_TX_CLOSING)) { - vcc->vflags &= ~HE_VCC_TX_CLOSING; - if (vcc->param.flags & ATMIO_FLAG_ASYNC) { - hatm_tx_vcc_closed(sc, tpd->cid); - if (!(vcc->vflags & HE_VCC_OPEN)) { - hatm_vcc_closed(sc, tpd->cid); - vcc = NULL; - } - } else - cv_signal(&sc->vcc_cv); - } - hatm_free_tpd(sc, tpd); - - if (vcc == NULL) - return; - - vcc->ntpds--; - - if ((vcc->vflags & HE_VCC_FLOW_CTRL) && - vcc->ntpds <= HE_CONFIG_TPD_FLOW_ENB) { - vcc->vflags &= ~HE_VCC_FLOW_CTRL; - ATMEV_SEND_FLOW_CONTROL(IFP2IFATM(sc->ifp), - HE_VPI(tpd->cid), HE_VCI(tpd->cid), 0); - } -} - -/* - * Convert CPS to Rate for a rate group - */ -static u_int -cps_to_rate(struct hatm_softc *sc, uint32_t cps) -{ - u_int clk = sc->he622 ? HE_622_CLOCK : HE_155_CLOCK; - u_int period, rate; - - /* how many double ticks between two cells */ - period = (clk + 2 * cps - 1) / (2 * cps); - rate = hatm_cps2atmf(period); - if (hatm_atmf2cps(rate) < period) - rate++; - - return (rate); -} - -/* - * Check whether the VCC is really closed on the hardware and available for - * open. Check that we have enough resources. If this function returns ok, - * a later actual open must succeed. Assume, that we are locked between this - * function and the next one, so that nothing does change. For CBR this - * assigns the rate group and set the rate group's parameter. - */ -int -hatm_tx_vcc_can_open(struct hatm_softc *sc, u_int cid, struct hevcc *vcc) -{ - uint32_t v, line_rate; - u_int rc, idx, free_idx; - struct atmio_tparam *t = &vcc->param.tparam; - - /* verify that connection is closed */ -#if 0 - v = READ_TSR(sc, cid, 4); - if(!(v & HE_REGM_TSR4_SESS_END)) { - if_printf(sc->ifp, "cid=%#x not closed (TSR4)\n", cid); - return (EBUSY); - } -#endif - v = READ_TSR(sc, cid, 0); - if((v & HE_REGM_TSR0_CONN_STATE) != 0) { - if_printf(sc->ifp, "cid=%#x not closed (TSR0=%#x)\n", - cid, v); - return (EBUSY); - } - - /* check traffic parameters */ - line_rate = sc->he622 ? ATM_RATE_622M : ATM_RATE_155M; - switch (vcc->param.traffic) { - - case ATMIO_TRAFFIC_UBR: - if (t->pcr == 0 || t->pcr > line_rate) - t->pcr = line_rate; - if (t->mcr != 0 || t->icr != 0 || t->tbe != 0 || t->nrm != 0 || - t->trm != 0 || t->adtf != 0 || t->rif != 0 || t->rdf != 0 || - t->cdf != 0) - return (EINVAL); - break; - - case ATMIO_TRAFFIC_CBR: - /* - * Compute rate group index - */ - if (t->pcr < 10) - t->pcr = 10; - if (sc->cbr_bw + t->pcr > line_rate) - return (EINVAL); - if (t->mcr != 0 || t->icr != 0 || t->tbe != 0 || t->nrm != 0 || - t->trm != 0 || t->adtf != 0 || t->rif != 0 || t->rdf != 0 || - t->cdf != 0) - return (EINVAL); - - rc = cps_to_rate(sc, t->pcr); - free_idx = HE_REGN_CS_STPER; - for (idx = 0; idx < HE_REGN_CS_STPER; idx++) { - if (sc->rate_ctrl[idx].refcnt == 0) { - if (free_idx == HE_REGN_CS_STPER) - free_idx = idx; - } else { - if (sc->rate_ctrl[idx].rate == rc) - break; - } - } - if (idx == HE_REGN_CS_STPER) { - if ((idx = free_idx) == HE_REGN_CS_STPER) - return (EBUSY); - sc->rate_ctrl[idx].rate = rc; - } - vcc->rc = idx; - - /* commit */ - sc->rate_ctrl[idx].refcnt++; - sc->cbr_bw += t->pcr; - break; - - case ATMIO_TRAFFIC_ABR: - if (t->pcr > line_rate) - t->pcr = line_rate; - if (t->mcr > line_rate) - t->mcr = line_rate; - if (t->icr > line_rate) - t->icr = line_rate; - if (t->tbe == 0 || t->tbe >= 1 << 24 || t->nrm > 7 || - t->trm > 7 || t->adtf >= 1 << 10 || t->rif > 15 || - t->rdf > 15 || t->cdf > 7) - return (EINVAL); - break; - - default: - return (EINVAL); - } - return (0); -} - -#define NRM_CODE2VAL(CODE) (2 * (1 << (CODE))) - -/* - * Actually open the transmit VCC - */ -void -hatm_tx_vcc_open(struct hatm_softc *sc, u_int cid) -{ - struct hevcc *vcc = sc->vccs[cid]; - uint32_t tsr0, tsr4, atmf, crm; - const struct atmio_tparam *t = &vcc->param.tparam; - - if (vcc->param.aal == ATMIO_AAL_5) { - tsr0 = HE_REGM_TSR0_AAL_5 << HE_REGS_TSR0_AAL; - tsr4 = HE_REGM_TSR4_AAL_5 << HE_REGS_TSR4_AAL; - } else { - tsr0 = HE_REGM_TSR0_AAL_0 << HE_REGS_TSR0_AAL; - tsr4 = HE_REGM_TSR4_AAL_0 << HE_REGS_TSR4_AAL; - } - tsr4 |= 1; - - switch (vcc->param.traffic) { - - case ATMIO_TRAFFIC_UBR: - atmf = hatm_cps2atmf(t->pcr); - - tsr0 |= HE_REGM_TSR0_TRAFFIC_UBR << HE_REGS_TSR0_TRAFFIC; - tsr0 |= HE_REGM_TSR0_USE_WMIN | HE_REGM_TSR0_UPDATE_GER; - - WRITE_TSR(sc, cid, 0, 0xf, tsr0); - WRITE_TSR(sc, cid, 4, 0xf, tsr4); - WRITE_TSR(sc, cid, 1, 0xf, (atmf << HE_REGS_TSR1_PCR)); - WRITE_TSR(sc, cid, 2, 0xf, (atmf << HE_REGS_TSR2_ACR)); - WRITE_TSR(sc, cid, 9, 0xf, HE_REGM_TSR9_INIT); - WRITE_TSR(sc, cid, 3, 0xf, 0); - WRITE_TSR(sc, cid, 5, 0xf, 0); - WRITE_TSR(sc, cid, 6, 0xf, 0); - WRITE_TSR(sc, cid, 7, 0xf, 0); - WRITE_TSR(sc, cid, 8, 0xf, 0); - WRITE_TSR(sc, cid, 10, 0xf, 0); - WRITE_TSR(sc, cid, 11, 0xf, 0); - WRITE_TSR(sc, cid, 12, 0xf, 0); - WRITE_TSR(sc, cid, 13, 0xf, 0); - WRITE_TSR(sc, cid, 14, 0xf, 0); - break; - - case ATMIO_TRAFFIC_CBR: - atmf = hatm_cps2atmf(t->pcr); - - if (sc->rate_ctrl[vcc->rc].refcnt == 1) - WRITE_MBOX4(sc, HE_REGO_CS_STPER(vcc->rc), - sc->rate_ctrl[vcc->rc].rate); - - tsr0 |= HE_REGM_TSR0_TRAFFIC_CBR << HE_REGS_TSR0_TRAFFIC; - tsr0 |= vcc->rc; - - WRITE_TSR(sc, cid, 1, 0xf, (atmf << HE_REGS_TSR1_PCR)); - WRITE_TSR(sc, cid, 2, 0xf, (atmf << HE_REGS_TSR2_ACR)); - WRITE_TSR(sc, cid, 3, 0xf, 0); - WRITE_TSR(sc, cid, 5, 0xf, 0); - WRITE_TSR(sc, cid, 6, 0xf, 0); - WRITE_TSR(sc, cid, 7, 0xf, 0); - WRITE_TSR(sc, cid, 8, 0xf, 0); - WRITE_TSR(sc, cid, 10, 0xf, 0); - WRITE_TSR(sc, cid, 11, 0xf, 0); - WRITE_TSR(sc, cid, 12, 0xf, 0); - WRITE_TSR(sc, cid, 13, 0xf, 0); - WRITE_TSR(sc, cid, 14, 0xf, 0); - WRITE_TSR(sc, cid, 4, 0xf, tsr4); - WRITE_TSR(sc, cid, 9, 0xf, HE_REGM_TSR9_INIT); - WRITE_TSR(sc, cid, 0, 0xf, tsr0); - - break; - - case ATMIO_TRAFFIC_ABR: - if ((crm = t->tbe / NRM_CODE2VAL(t->nrm)) > 0xffff) - crm = 0xffff; - - tsr0 |= HE_REGM_TSR0_TRAFFIC_ABR << HE_REGS_TSR0_TRAFFIC; - tsr0 |= HE_REGM_TSR0_USE_WMIN | HE_REGM_TSR0_UPDATE_GER; - - WRITE_TSR(sc, cid, 0, 0xf, tsr0); - WRITE_TSR(sc, cid, 4, 0xf, tsr4); - - WRITE_TSR(sc, cid, 1, 0xf, - ((hatm_cps2atmf(t->pcr) << HE_REGS_TSR1_PCR) | - (hatm_cps2atmf(t->mcr) << HE_REGS_TSR1_MCR))); - WRITE_TSR(sc, cid, 2, 0xf, - (hatm_cps2atmf(t->icr) << HE_REGS_TSR2_ACR)); - WRITE_TSR(sc, cid, 3, 0xf, - ((NRM_CODE2VAL(t->nrm) - 1) << HE_REGS_TSR3_NRM) | - (crm << HE_REGS_TSR3_CRM)); - - WRITE_TSR(sc, cid, 5, 0xf, 0); - WRITE_TSR(sc, cid, 6, 0xf, 0); - WRITE_TSR(sc, cid, 7, 0xf, 0); - WRITE_TSR(sc, cid, 8, 0xf, 0); - WRITE_TSR(sc, cid, 10, 0xf, 0); - WRITE_TSR(sc, cid, 12, 0xf, 0); - WRITE_TSR(sc, cid, 14, 0xf, 0); - WRITE_TSR(sc, cid, 9, 0xf, HE_REGM_TSR9_INIT); - - WRITE_TSR(sc, cid, 11, 0xf, - (hatm_cps2atmf(t->icr) << HE_REGS_TSR11_ICR) | - (t->trm << HE_REGS_TSR11_TRM) | - (t->nrm << HE_REGS_TSR11_NRM) | - (t->adtf << HE_REGS_TSR11_ADTF)); - - WRITE_TSR(sc, cid, 13, 0xf, - (t->rdf << HE_REGS_TSR13_RDF) | - (t->rif << HE_REGS_TSR13_RIF) | - (t->cdf << HE_REGS_TSR13_CDF) | - (crm << HE_REGS_TSR13_CRM)); - - break; - - default: - return; - } - - vcc->vflags |= HE_VCC_TX_OPEN; -} - -/* - * Close the TX side of a VCC. Set the CLOSING flag. - */ -void -hatm_tx_vcc_close(struct hatm_softc *sc, u_int cid) -{ - struct hevcc *vcc = sc->vccs[cid]; - struct tpd *tpd_list[1]; - u_int i, pcr = 0; - - WRITE_TSR(sc, cid, 4, 0x8, HE_REGM_TSR4_FLUSH); - - switch (vcc->param.traffic) { - - case ATMIO_TRAFFIC_CBR: - WRITE_TSR(sc, cid, 14, 0x8, HE_REGM_TSR14_CBR_DELETE); - break; - - case ATMIO_TRAFFIC_ABR: - WRITE_TSR(sc, cid, 14, 0x4, HE_REGM_TSR14_ABR_CLOSE); - pcr = vcc->param.tparam.pcr; - /* FALL THROUGH */ - - case ATMIO_TRAFFIC_UBR: - WRITE_TSR(sc, cid, 1, 0xf, - hatm_cps2atmf(HE_CONFIG_FLUSH_RATE) << HE_REGS_TSR1_MCR | - hatm_cps2atmf(pcr) << HE_REGS_TSR1_PCR); - break; - } - - tpd_list[0] = hatm_alloc_tpd(sc, 0); - tpd_list[0]->tpd.addr |= HE_REGM_TPD_EOS | HE_REGM_TPD_INTR; - tpd_list[0]->cid = cid; - - vcc->vflags |= HE_VCC_TX_CLOSING; - vcc->vflags &= ~HE_VCC_TX_OPEN; - - i = 0; - while (hatm_queue_tpds(sc, 1, tpd_list, cid) != 0) { - if (++i == 1000) - panic("TPDRQ permanently full"); - DELAY(1000); - } -} - -void -hatm_tx_vcc_closed(struct hatm_softc *sc, u_int cid) -{ - if (sc->vccs[cid]->param.traffic == ATMIO_TRAFFIC_CBR) { - sc->cbr_bw -= sc->vccs[cid]->param.tparam.pcr; - sc->rate_ctrl[sc->vccs[cid]->rc].refcnt--; - } -} diff --git a/sys/dev/hatm/if_hatmconf.h b/sys/dev/hatm/if_hatmconf.h deleted file mode 100644 index 5402697410d7..000000000000 --- a/sys/dev/hatm/if_hatmconf.h +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Default configuration - */ - -/* configuration */ -#define HE_CONFIG_VPI_BITS 2 -#define HE_CONFIG_VCI_BITS 10 - -/* interrupt group 0 only */ -/* the size must be 1 <= size <= 1023 */ -#define HE_CONFIG_IRQ0_SIZE 256 -#define HE_CONFIG_IRQ0_THRESH 224 /* retrigger interrupt */ -#define HE_CONFIG_IRQ0_LINE HE_REGM_IRQ_A /* routing */ - -/* don't change these */ -#define HE_CONFIG_TXMEM (128 * 1024) /* words */ -#define HE_CONFIG_RXMEM (64 * 1024) /* words */ -#define HE_CONFIG_LCMEM (512 * 1024) /* words */ - -/* group 0 - all AALs except AAL.raw */ -/* receive group 0 buffer pools (mbufs and mbufs+cluster) */ -/* the size must be a power of 2: 4 <= size <= 8192 */ -#define HE_CONFIG_RBPS0_SIZE 2048 /* entries per queue */ -#define HE_CONFIG_RBPS0_THRESH 256 /* interrupt threshold */ -#define HE_CONFIG_RBPL0_SIZE 512 /* entries per queue */ -#define HE_CONFIG_RBPL0_THRESH 32 /* interrupt threshold */ - -/* receive group 0 buffer return queue */ -/* the size must be a power of 2: 1 <= size <= 16384 */ -#define HE_CONFIG_RBRQ0_SIZE 512 /* entries in queue */ -#define HE_CONFIG_RBRQ0_THRESH 256 /* interrupt threshold */ -#define HE_CONFIG_RBRQ0_TOUT 10 /* interrupt timeout */ -#define HE_CONFIG_RBRQ0_PCNT 5 /* packet count threshold */ - -/* group 1 - raw cells */ -/* receive group 1 small buffer pool */ -/* the size must be a power of 2: 4 <= size <= 8192 */ -#define HE_CONFIG_RBPS1_SIZE 1024 /* entries in queue */ -#define HE_CONFIG_RBPS1_THRESH 512 /* interrupt threshold */ - -/* receive group 1 buffer return queue */ -/* the size must be a power of 2: 1 <= size <= 16384 */ -#define HE_CONFIG_RBRQ1_SIZE 512 /* entries in queue */ -#define HE_CONFIG_RBRQ1_THRESH 256 /* interrupt threshold */ -#define HE_CONFIG_RBRQ1_TOUT 100 /* interrupt timeout */ -#define HE_CONFIG_RBRQ1_PCNT 25 /* packet count threshold */ - -/* there is only one TPD queue */ -/* the size must be a power of 2: 1 <= size <= 4096 */ -#define HE_CONFIG_TPDRQ_SIZE 2048 /* entries in queue */ - -/* transmit group 0 */ -/* the size must be a power of 2: 1 <= size <= 16384 */ -#define HE_CONFIG_TBRQ_SIZE 512 /* entries in queue */ -#define HE_CONFIG_TBRQ_THRESH 400 /* interrupt threshold */ - -/* Maximum number of TPDs to allocate to a single VCC. This - * number should depend on the cell rate and the maximum allowed cell delay */ -#define HE_CONFIG_TPD_MAXCC 2048 - -/* Maximum number of external mbuf pages */ -#define HE_CONFIG_MAX_MBUF_PAGES 256 - -/* Maximum number of TPDs used for one packet */ -#define HE_CONFIG_MAX_TPD_PER_PACKET \ - ((((HE_MAX_PDU + MCLBYTES - 1) / MCLBYTES + 2) / 3) + 2) - -/* Number of TPDs to reserve for close operations */ -#define HE_CONFIG_TPD_RESERVE 32 - -/* Number of TPDs per VCC when to re-enable flow control */ -#define HE_CONFIG_TPD_FLOW_ENB 80 - -/* MCR for flushing CBR and ABR connections at close */ -#define HE_CONFIG_FLUSH_RATE 200000 diff --git a/sys/dev/hatm/if_hatmreg.h b/sys/dev/hatm/if_hatmreg.h deleted file mode 100644 index 401499870d01..000000000000 --- a/sys/dev/hatm/if_hatmreg.h +++ /dev/null @@ -1,641 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Fore HE driver for NATM - */ - -/* check configuration */ -#if HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS > 12 -#error "hatm: too many bits configured for VPI/VCI" -#endif - -#define HE_MAX_VCCS (1 << (HE_CONFIG_VPI_BITS + HE_CONFIG_VCI_BITS)) - -#define HE_VPI_MASK ((1 << (HE_CONFIG_VPI_BITS))-1) -#define HE_VCI_MASK ((1 << (HE_CONFIG_VCI_BITS))-1) - -#define HE_VPI(CID) (((CID) >> HE_CONFIG_VCI_BITS) & HE_VPI_MASK) -#define HE_VCI(CID) ((CID) & HE_VCI_MASK) - -#define HE_CID(VPI,VCI) ((((VPI) & HE_VPI_MASK) << HE_CONFIG_VCI_BITS) | \ - ((VCI) & HE_VCI_MASK)) - - -/* GEN_CNTL_0 register */ -#define HE_PCIR_GEN_CNTL_0 0x40 -#define HE_PCIM_CTL0_64BIT (1 << 0) -#define HE_PCIM_CTL0_IGNORE_TIMEOUT (1 << 1) -#define HE_PCIM_CTL0_INIT_ENB (1 << 2) -#define HE_PCIM_CTL0_MRM (1 << 4) -#define HE_PCIM_CTL0_MRL (1 << 5) -#define HE_PCIM_CTL0_BIGENDIAN (1 << 16) -#define HE_PCIM_CTL0_INT_PROC_ENB (1 << 25) - -/* - * Memory registers - */ -#define HE_REGO_FLASH 0x00000 -#define HE_REGO_RESET_CNTL 0x80000 -#define HE_REGM_RESET_STATE (1 << 6) -#define HE_REGO_HOST_CNTL 0x80004 -#define HE_REGM_HOST_BUS64 (1 << 27) -#define HE_REGM_HOST_DESC_RD64 (1 << 26) -#define HE_REGM_HOST_DATA_RD64 (1 << 25) -#define HE_REGM_HOST_DATA_WR64 (1 << 24) -#define HE_REGM_HOST_PROM_SEL (1 << 12) -#define HE_REGM_HOST_PROM_WREN (1 << 11) -#define HE_REGM_HOST_PROM_DATA_OUT (1 << 10) -#define HE_REGS_HOST_PROM_DATA_OUT 10 -#define HE_REGM_HOST_PROM_DATA_IN (1 << 9) -#define HE_REGS_HOST_PROM_DATA_IN 9 -#define HE_REGM_HOST_PROM_CLOCK (1 << 8) -#define HE_REGM_HOST_PROM_BITS (0x00001f00) -#define HE_REGM_HOST_QUICK_RD (1 << 7) -#define HE_REGM_HOST_QUICK_WR (1 << 6) -#define HE_REGM_HOST_OUTFF_ENB (1 << 5) -#define HE_REGM_HOST_CMDFF_ENB (1 << 4) -#define HE_REGO_LB_SWAP 0x80008 -#define HE_REGM_LBSWAP_RNUM (0xf << 27) -#define HE_REGS_LBSWAP_RNUM 27 -#define HE_REGM_LBSWAP_DATA_WR_SWAP (1 << 20) -#define HE_REGM_LBSWAP_DESC_RD_SWAP (1 << 19) -#define HE_REGM_LBSWAP_DATA_RD_SWAP (1 << 18) -#define HE_REGM_LBSWAP_INTR_SWAP (1 << 17) -#define HE_REGM_LBSWAP_DESC_WR_SWAP (1 << 16) -#define HE_REGM_LBSWAP_BIG_ENDIAN (1 << 14) -#define HE_REGM_LBSWAP_XFER_SIZE (1 << 7) - -#define HE_REGO_LB_MEM_ADDR 0x8000C -#define HE_REGO_LB_MEM_DATA 0x80010 -#define HE_REGO_LB_MEM_ACCESS 0x80014 -#define HE_REGM_LB_MEM_HNDSHK (1 << 30) -#define HE_REGM_LB_MEM_READ 0x3 -#define HE_REGM_LB_MEM_WRITE 0x7 - -#define HE_REGO_SDRAM_CNTL 0x80018 -#define HE_REGM_SDRAM_64BIT (1 << 3) -#define HE_REGO_INT_FIFO 0x8001C -#define HE_REGM_INT_FIFO_CLRA (1 << 8) -#define HE_REGM_INT_FIFO_CLRB (1 << 9) -#define HE_REGM_INT_FIFO_CLRC (1 << 10) -#define HE_REGM_INT_FIFO_CLRD (1 << 11) -#define HE_REGO_ABORT_ADDR 0x80020 - -#define HE_REGO_IRQ0_BASE 0x80080 -#define HE_REGO_IRQ_BASE(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x00) -#define HE_REGM_IRQ_BASE_TAIL 0x3ff -#define HE_REGO_IRQ_HEAD(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x04) -#define HE_REGS_IRQ_HEAD_SIZE 22 -#define HE_REGS_IRQ_HEAD_THRESH 12 -#define HE_REGS_IRQ_HEAD_HEAD 2 -#define HE_REGO_IRQ_CNTL(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x08) -#define HE_REGM_IRQ_A (0 << 2) -#define HE_REGM_IRQ_B (1 << 2) -#define HE_REGM_IRQ_C (2 << 2) -#define HE_REGM_IRQ_D (3 << 2) -#define HE_REGO_IRQ_DATA(Q) (HE_REGO_IRQ0_BASE + (Q) * 0x10 + 0x0C) - -#define HE_REGO_GRP_1_0_MAP 0x800C0 -#define HE_REGO_GRP_3_2_MAP 0x800C4 -#define HE_REGO_GRP_5_4_MAP 0x800C8 -#define HE_REGO_GRP_7_6_MAP 0x800CC - -/* - * Receive buffer pools - */ -#define HE_REGO_G0_RBPS_S 0x80400 -#define HE_REGO_G0_RBPS_T 0x80404 -#define HE_REGO_G0_RBPS_QI 0x80408 -#define HE_REGO_G0_RBPS_BL 0x8040C - -#define HE_REGO_RBP_S(K,G) (HE_REGO_G0_RBPS_S + (K) * 0x10 + (G) * 0x20) -#define HE_REGO_RBP_T(K,G) (HE_REGO_G0_RBPS_T + (K) * 0x10 + (G) * 0x20) -#define HE_REGO_RBP_QI(K,G) (HE_REGO_G0_RBPS_QI + (K) * 0x10 + (G) * 0x20) -#define HE_REGO_RBP_BL(K,G) (HE_REGO_G0_RBPS_BL + (K) * 0x10 + (G) * 0x20) - -#define HE_REGS_RBP_HEAD 3 -#define HE_REGS_RBP_TAIL 3 -#define HE_REGS_RBP_SIZE 14 -#define HE_REGM_RBP_INTR_ENB (1 << 13) -#define HE_REGS_RBP_THRESH 0 - -/* - * Receive buffer return queues - */ -#define HE_REGO_G0_RBRQ_ST 0x80500 -#define HE_REGO_G0_RBRQ_H 0x80504 -#define HE_REGO_G0_RBRQ_Q 0x80508 -#define HE_REGO_G0_RBRQ_I 0x8050C - -#define HE_REGO_RBRQ_ST(G) (HE_REGO_G0_RBRQ_ST + (G) * 0x10) -#define HE_REGO_RBRQ_H(G) (HE_REGO_G0_RBRQ_H + (G) * 0x10) -#define HE_REGO_RBRQ_Q(G) (HE_REGO_G0_RBRQ_Q + (G) * 0x10) -#define HE_REGO_RBRQ_I(G) (HE_REGO_G0_RBRQ_I + (G) * 0x10) - -#define HE_REGS_RBRQ_HEAD 3 -#define HE_REGS_RBRQ_THRESH 13 -#define HE_REGS_RBRQ_SIZE 0 -#define HE_REGS_RBRQ_TIME 8 -#define HE_REGS_RBRQ_COUNT 0 - -/* - * Intermediate queues - */ -#define HE_REGO_G0_INMQ_S 0x80580 -#define HE_REGO_G0_INMQ_L 0x80584 -#define HE_REGO_INMQ_S(G) (HE_REGO_G0_INMQ_S + (G) * 8) -#define HE_REGO_INMQ_L(G) (HE_REGO_G0_INMQ_L + (G) * 8) - -#define HE_REGO_RHCONFIG 0x805C0 -#define HE_REGM_RHCONFIG_PHYENB (1 << 10) -#define HE_REGS_RHCONFIG_OAM_GID 7 -#define HE_REGS_RHCONFIG_PTMR_PRE 0 - -/* - * Transmit buffer return queues - */ -#define HE_REGO_TBRQ0_B_T 0x80600 -#define HE_REGO_TBRQ0_H 0x80604 -#define HE_REGO_TBRQ0_S 0x80608 -#define HE_REGO_TBRQ0_THRESH 0x8060C - -#define HE_REGO_TBRQ_B_T(G) (HE_REGO_TBRQ0_B_T + (G) * 0x10) -#define HE_REGO_TBRQ_H(G) (HE_REGO_TBRQ0_H + (G) * 0x10) -#define HE_REGO_TBRQ_S(G) (HE_REGO_TBRQ0_S + (G) * 0x10) -#define HE_REGO_TBRQ_THRESH(G) (HE_REGO_TBRQ0_THRESH + (G) * 0x10) - -#define HE_REGS_TBRQ_HEAD 2 - -/* - * Transmit packet descriptor ready queue - */ -#define HE_REGO_TPDRQ_H 0x80680 -#define HE_REGS_TPDRQ_H_H 3 -/* #define HE_REGM_TPDRQ_H_H ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */ -#define HE_REGO_TPDRQ_T 0x80684 -#define HE_REGS_TPDRQ_T_T 3 -/* #define HE_REGM_TPDRQ_T_T ((HE_CONFIG_TPDRQ_SIZE - 1) << 3) */ -#define HE_REGO_TPDRQ_S 0x80688 - -#define HE_REGO_UBUFF_BA 0x8068C - -#define HE_REGO_RLBF0_H 0x806C0 -#define HE_REGO_RLBF0_T 0x806C4 -#define HE_REGO_RLBF1_H 0x806C8 -#define HE_REGO_RLBF1_T 0x806CC -#define HE_REGO_RLBF_H(N) (HE_REGO_RLBF0_H + (N) * 8) -#define HE_REGO_RLBF_T(N) (HE_REGO_RLBF0_T + (N) * 8) - -#define HE_REGO_RLBC_H 0x806D0 -#define HE_REGO_RLBC_T 0x806D4 -#define HE_REGO_RLBC_H2 0x806D8 -#define HE_REGO_TLBF_H 0x806E0 -#define HE_REGO_TLBF_T 0x806E4 - -#define HE_REGO_RLBF0_C 0x806E8 -#define HE_REGO_RLBF1_C 0x806EC -#define HE_REGO_RLBF_C(N) (HE_REGO_RLBF0_C + (N) * 4) - -#define HE_REGO_RXTHRSH 0x806F0 -#define HE_REGO_LITHRSH 0x806F4 - -#define HE_REGO_LBARB 0x80700 -#define HE_REGS_LBARB_SLICE 28 -#define HE_REGS_LBARB_RNUM 23 -#define HE_REGS_LBARB_THPRI 21 -#define HE_REGS_LBARB_RHPRI 19 -#define HE_REGS_LBARB_TLPRI 17 -#define HE_REGS_LBARB_RLPRI 15 -#define HE_REGS_LBARB_BUS_MULT 8 -#define HE_REGS_LBARB_NET_PREF 0 - -#define HE_REGO_SDRAMCON 0x80704 -#define HE_REGM_SDRAMCON_BANK (1 << 14) -#define HE_REGM_SDRAMCON_WIDE (1 << 13) -#define HE_REGM_SDRAMCON_TWRWAIT (1 << 12) -#define HE_REGM_SDRAMCON_TRPWAIT (1 << 11) -#define HE_REGM_SDRAMCON_TRASWAIT (1 << 10) -#define HE_REGS_SDRAMCON_REF 0 - -#define HE_REGO_RCCSTAT 0x8070C -#define HE_REGM_RCCSTAT_PROG (1 << 0) - -#define HE_REGO_TCMCONFIG 0x80740 -#define HE_REGS_TCMCONFIG_BANK_WAIT 6 -#define HE_REGS_TCMCONFIG_RW_WAIT 2 -#define HE_REGS_TCMCONFIG_TYPE 0 - -#define HE_REGO_TSRB_BA 0x80744 -#define HE_REGO_TSRC_BA 0x80748 -#define HE_REGO_TMABR_BA 0x8074C -#define HE_REGO_TPD_BA 0x80750 -#define HE_REGO_TSRD_BA 0x80758 - -#define HE_REGO_TXCONFIG 0x80760 -#define HE_REGS_TXCONFIG_THRESH 22 -#define HE_REGM_TXCONFIG_UTMODE (1 << 21) -#define HE_REGS_TXCONFIG_VCI_MASK 17 -#define HE_REGS_TXCONFIG_LBFREE 0 - -#define HE_REGO_TXAAL5_PROTO 0x80764 - -#define HE_REGO_RCMCONFIG 0x80780 -#define HE_REGS_RCMCONFIG_BANK_WAIT 6 -#define HE_REGS_RCMCONFIG_RW_WAIT 2 -#define HE_REGS_RCMCONFIG_TYPE 0 - -#define HE_REGO_RCMRSRB_BA 0x80784 -#define HE_REGO_RCMLBM_BA 0x80788 -#define HE_REGO_RCMABR_BA 0x8078C - -#define HE_REGO_RCCONFIG 0x807C0 -#define HE_REGS_RCCONFIG_UTDELAY 11 -#define HE_REGM_RCCONFIG_WRAP_MODE (1 << 10) -#define HE_REGM_RCCONFIG_UT_MODE (1 << 9) -#define HE_REGM_RCCONFIG_RXENB (1 << 8) -#define HE_REGS_RCCONFIG_VP 4 -#define HE_REGS_RCCONFIG_VC 0 - -#define HE_REGO_MCC 0x807C4 -#define HE_REGO_OEC 0x807C8 -#define HE_REGO_DCC 0x807CC -#define HE_REGO_CEC 0x807D0 - -#define HE_REGO_HSP_BA 0x807F0 - -#define HE_REGO_LBCONFIG 0x807F4 - -#define HE_REGO_CON_DAT 0x807F8 -#define HE_REGO_CON_CTL 0x807FC -#define HE_REGM_CON_MBOX (2U << 30) -#define HE_REGM_CON_TCM (1 << 30) -#define HE_REGM_CON_RCM (0 << 30) -#define HE_REGM_CON_WE (1 << 29) -#define HE_REGM_CON_STATUS (1 << 28) -#define HE_REGM_CON_DIS3 (1 << 22) -#define HE_REGM_CON_DIS2 (1 << 21) -#define HE_REGM_CON_DIS1 (1 << 20) -#define HE_REGM_CON_DIS0 (1 << 19) -#define HE_REGS_CON_DIS 19 -#define HE_REGS_CON_ADDR 0 - -#define HE_REGO_SUNI 0x80800 -#define HE_REGO_SUNI_END 0x80C00 - -#define HE_REGO_END 0x100000 - -/* - * MBOX registers - */ -#define HE_REGO_CS_STPER0 0x000 -#define HE_REGO_CS_STPER(G) (HE_REGO_CS_STPER0 + (G)) -#define HE_REGN_CS_STPER 32 -#define HE_REGO_CS_STTIM0 0x020 -#define HE_REGO_CS_STTIM(G) (HE_REGO_CS_STTIM0 + (G)) -#define HE_REGO_CS_TGRLD0 0x040 -#define HE_REGO_CS_TGRLD(G) (HE_REGO_CS_TGRLD0 + (G)) -#define HE_REGO_CS_ERTHR0 0x50 -#define HE_REGO_CS_ERTHR1 0x51 -#define HE_REGO_CS_ERTHR2 0x52 -#define HE_REGO_CS_ERTHR3 0x53 -#define HE_REGO_CS_ERTHR4 0x54 -#define HE_REGO_CS_ERCTL0 0x55 -#define HE_REGO_CS_ERCTL1 0x56 -#define HE_REGO_CS_ERCTL2 0x57 -#define HE_REGO_CS_ERSTAT0 0x58 -#define HE_REGO_CS_ERSTAT1 0x59 -#define HE_REGO_CS_RTCCT 0x60 -#define HE_REGO_CS_RTFWC 0x61 -#define HE_REGO_CS_RTFWR 0x62 -#define HE_REGO_CS_RTFTC 0x63 -#define HE_REGO_CS_RTATR 0x64 -#define HE_REGO_CS_TFBSET 0x70 -#define HE_REGO_CS_TFBADD 0x71 -#define HE_REGO_CS_TFBSUB 0x72 -#define HE_REGO_CS_WCRMAX 0x73 -#define HE_REGO_CS_WCRMIN 0x74 -#define HE_REGO_CS_WCRINC 0x75 -#define HE_REGO_CS_WCRDEC 0x76 -#define HE_REGO_CS_WCRCEIL 0x77 -#define HE_REGO_CS_BWDCNT 0x78 -#define HE_REGO_CS_OTPPER 0x80 -#define HE_REGO_CS_OTWPER 0x81 -#define HE_REGO_CS_OTTLIM 0x82 -#define HE_REGO_CS_OTTCNT 0x83 -#define HE_REGO_CS_HGRRT0 0x90 -#define HE_REGO_CS_HGRRT(G) (HE_REGO_CS_HGRRT0 + (G)) -#define HE_REGO_CS_ORPTRS 0xA0 -#define HE_REGO_RCON_CLOSE 0x100 -#define HE_REGO_CS_END 0x101 - -#define HE_REGT_CS_ERTHR { \ - { /* 155 */ \ - { 0x000800ea, 0x000400ea, 0x000200ea }, /* ERTHR0 */ \ - { 0x000C3388, 0x00063388, 0x00033388 }, /* ERTHR1 */ \ - { 0x00101018, 0x00081018, 0x00041018 }, /* ERTHR2 */ \ - { 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \ - { 0x0028051a, 0x0014051a, 0x000a051a }, /* ERTHR4 */ \ - }, { /* 622 */ \ - { 0x000800fa, 0x000400fa, 0x000200fa }, /* ERTHR0 */ \ - { 0x000c33cb, 0x000633cb, 0x000333cb }, /* ERTHR1 */ \ - { 0x0010101b, 0x0008101b, 0x0004101b }, /* ERTHR2 */ \ - { 0x00181dac, 0x000c1dac, 0x00061dac }, /* ERTHR3 */ \ - { 0x00280600, 0x00140600, 0x000a0600 }, /* ERTHR4 */ \ - } \ -} - -#define HE_REGT_CS_ERCTL { \ - { 0x0235e4b1, 0x4701, 0x64b1 }, /* 155 */ \ - { 0x023de8b3, 0x1801, 0x68b3 } /* 622 */ \ -} - -#define HE_REGT_CS_ERSTAT { \ - { 0x1280, 0x64b1 }, /* 155 */ \ - { 0x1280, 0x68b3 }, /* 622 */ \ -} - -#define HE_REGT_CS_RTFWR { \ - 0xf424, /* 155 */ \ - 0x14585 /* 622 */ \ -} - -#define HE_REGT_CS_RTATR { \ - 0x4680, /* 155 */ \ - 0x4680 /* 622 */ \ -} - -#define HE_REGT_CS_BWALLOC { \ - { 0x000563b7, 0x64b1, 0x5ab1, 0xe4b1, 0xdab1, 0x64b1 }, /* 155 */\ - { 0x00159ece, 0x68b3, 0x5eb3, 0xe8b3, 0xdeb3, 0x68b3 }, /* 622 */\ -} - -#define HE_REGT_CS_ORCF { \ - { 0x6, 0x1e }, /* 155 */ \ - { 0x5, 0x14 } /* 622 */ \ -} - -/* - * TSRs - NR is relative to the starting number of the block - */ -#define HE_REGO_TSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR)) -#define HE_REGO_TSRB(BASE,CID,NR) ((BASE) + ((CID) << 2) + (NR)) -#define HE_REGO_TSRC(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR)) -#define HE_REGO_TSRD(BASE,CID) ((BASE) + (CID)) - -#define HE_REGM_TSR0_CONN_STATE (7 << 28) -#define HE_REGS_TSR0_CONN_STATE 28 -#define HE_REGM_TSR0_USE_WMIN (1 << 23) -#define HE_REGM_TSR0_GROUP (7 << 18) -#define HE_REGS_TSR0_GROUP 18 -#define HE_REGM_TSR0_TRAFFIC (3 << 16) -#define HE_REGS_TSR0_TRAFFIC 16 -#define HE_REGM_TSR0_TRAFFIC_CBR 0 -#define HE_REGM_TSR0_TRAFFIC_UBR 1 -#define HE_REGM_TSR0_TRAFFIC_ABR 2 -#define HE_REGM_TSR0_PROT (1 << 15) -#define HE_REGM_TSR0_AAL (3 << 12) -#define HE_REGS_TSR0_AAL 12 -#define HE_REGM_TSR0_AAL_5 0 -#define HE_REGM_TSR0_AAL_0 1 -#define HE_REGM_TSR0_AAL_0T 2 -#define HE_REGM_TSR0_HALT_ER (1 << 11) -#define HE_REGM_TSR0_MARK_CI (1 << 10) -#define HE_REGM_TSR0_MARK_ER (1 << 9) -#define HE_REGM_TSR0_UPDATE_GER (1 << 8) -#define HE_REGM_TSR0_RC 0xff - -#define HE_REGM_TSR1_PCR (0x7fff << 16) -#define HE_REGS_TSR1_PCR 16 -#define HE_REGM_TSR1_MCR (0x7fff << 0) -#define HE_REGS_TSR1_MCR 0 - -#define HE_REGM_TSR2_ACR (0x7fff << 16) -#define HE_REGS_TSR2_ACR 16 - -#define HE_REGM_TSR3_NRM (0xff << 24) -#define HE_REGS_TSR3_NRM 24 -#define HE_REGM_TSR3_CRM (0xff << 0) -#define HE_REGS_TSR3_CRM 0 - -#define HE_REGM_TSR4_FLUSH (1U << 31) -#define HE_REGM_TSR4_SESS_END (1 << 30) -#define HE_REGM_TSR4_OAM_CRC10 (1 << 28) -#define HE_REGM_TSR4_NULL_CRC10 (1 << 27) -#define HE_REGM_TSR4_PROT (1 << 26) -#define HE_REGM_TSR4_AAL (3 << 24) -#define HE_REGS_TSR4_AAL 24 -#define HE_REGM_TSR4_AAL_5 0 -#define HE_REGM_TSR4_AAL_0 1 -#define HE_REGM_TSR4_AAL_0T 2 - -#define HE_REGM_TSR9_INIT 0x00100000 - -#define HE_REGM_TSR11_ICR (0x7fff << 16) -#define HE_REGS_TSR11_ICR 16 -#define HE_REGM_TSR11_TRM (0x7 << 13) -#define HE_REGS_TSR11_TRM 13 -#define HE_REGM_TSR11_NRM (0x7 << 10) -#define HE_REGS_TSR11_NRM 10 -#define HE_REGM_TSR11_ADTF 0x3ff -#define HE_REGS_TSR11_ADTF 0 - -#define HE_REGM_TSR13_RDF (0xf << 23) -#define HE_REGS_TSR13_RDF 23 -#define HE_REGM_TSR13_RIF (0xf << 19) -#define HE_REGS_TSR13_RIF 19 -#define HE_REGM_TSR13_CDF (0x7 << 16) -#define HE_REGS_TSR13_CDF 16 -#define HE_REGM_TSR13_CRM 0xffff -#define HE_REGS_TSR13_CRM 0 - -#define HE_REGM_TSR14_CBR_DELETE (1U << 31) -#define HE_REGM_TSR14_ABR_CLOSE (1 << 16) - -/* - * RSRs - */ -#define HE_REGO_RSRA(BASE,CID,NR) ((BASE) + ((CID) << 3) + (NR)) -#define HE_REGO_RSRB(BASE,CID,NR) ((BASE) + ((CID) << 1) + (NR)) - -#define HE_REGM_RSR0_PTI7 (1 << 15) -#define HE_REGM_RSR0_RM (1 << 14) -#define HE_REGM_RSR0_F5OAM (1 << 13) -#define HE_REGM_RSR0_STARTPDU (1 << 10) -#define HE_REGM_RSR0_OPEN (1 << 6) -#define HE_REGM_RSR0_PPD (1 << 5) -#define HE_REGM_RSR0_EPD (1 << 4) -#define HE_REGM_RSR0_TCPCS (1 << 3) -#define HE_REGM_RSR0_AAL 0x7 -#define HE_REGM_RSR0_AAL_5 0x0 -#define HE_REGM_RSR0_AAL_0 0x1 -#define HE_REGM_RSR0_AAL_0T 0x2 -#define HE_REGM_RSR0_AAL_RAW 0x3 -#define HE_REGM_RSR0_AAL_RAWCRC10 0x4 - -#define HE_REGM_RSR1_AQI (1 << 20) -#define HE_REGM_RSR1_RBPL_ONLY (1 << 19) -#define HE_REGM_RSR1_GROUP (7 << 16) -#define HE_REGS_RSR1_GROUP 16 - -#define HE_REGM_RSR4_AQI (1 << 30) -#define HE_REGM_RSR4_GROUP (7 << 27) -#define HE_REGS_RSR4_GROUP 27 -#define HE_REGM_RSR4_RBPL_ONLY (1 << 26) - -/* - * Relative to RCMABR_BA - */ -#define HE_REGO_CM_GQTBL 0x000 -#define HE_REGL_CM_GQTBL 0x100 -#define HE_REGO_CM_RGTBL 0x100 -#define HE_REGL_CM_RGTBL 0x100 -#define HE_REGO_CM_TNRMTBL 0x200 -#define HE_REGL_CM_TNRMTBL 0x100 -#define HE_REGO_CM_ORCF 0x300 -#define HE_REGL_CM_ORCF 0x100 -#define HE_REGO_CM_RTGTBL 0x400 -#define HE_REGL_CM_RTGTBL 0x200 -#define HE_REGO_CM_IRCF 0x600 -#define HE_REGL_CM_IRCF 0x200 - -/* - * Interrupt Status - */ -#define HE_REGM_ITYPE 0xf8 -#define HE_REGM_IGROUP 0x07 -#define HE_REGM_ITYPE_TBRQ (0x0 << 3) -#define HE_REGM_ITYPE_TPD (0x1 << 3) -#define HE_REGM_ITYPE_RBPS (0x2 << 3) -#define HE_REGM_ITYPE_RBPL (0x3 << 3) -#define HE_REGM_ITYPE_RBRQ (0x4 << 3) -#define HE_REGM_ITYPE_RBRQT (0x5 << 3) -#define HE_REGM_ITYPE_PHYS (0x6 << 3) -#define HE_REGM_ITYPE_UNKNOWN 0xf8 -#define HE_REGM_ITYPE_ERR 0x80 -#define HE_REGM_ITYPE_PERR 0x81 -#define HE_REGM_ITYPE_ABORT 0x82 -#define HE_REGM_ITYPE_INVALID 0xf8 - -/* - * Serial EEPROM - */ -#define HE_EEPROM_PROD_ID 0x08 -#define HE_EEPROM_PROD_ID_LEN 30 -#define HE_EEPROM_REV 0x26 -#define HE_EEPROM_REV_LEN 4 -#define HE_EEPROM_M_SN 0x3A -#define HE_EEPROM_MEDIA 0x3E -#define HE_EEPROM_MAC 0x42 - -#define HE_MEDIA_UTP155 0x06 -#define HE_MEDIA_MMF155 0x26 -#define HE_MEDIA_MMF622 0x27 -#define HE_MEDIA_SMF155 0x46 -#define HE_MEDIA_SMF622 0x47 - -#define HE_622_CLOCK 66667000 -#define HE_155_CLOCK 50000000 - -/* - * Statistics - */ -struct fatm_statshe { -}; - -/* - * Queue entries - */ -/* Receive Buffer Pool Queue entry */ -struct he_rbpen { - uint32_t phys; /* physical address */ - uint32_t handle; /* handle or virtual address */ -}; -/* Receive Buffer Return Queue entry */ -struct he_rbrqen { - uint32_t addr; /* handle and flags */ - uint32_t len; /* length and CID */ -}; -#define HE_REGM_RBRQ_ADDR 0xFFFFFFC0 -#define HE_REGS_RBRQ_ADDR 6 -#define HE_REGM_RBRQ_FLAGS 0x0000003F -#define HE_REGM_RBRQ_HBUF_ERROR (1 << 0) -#define HE_REGM_RBRQ_CON_CLOSED (1 << 1) -#define HE_REGM_RBRQ_AAL5_PROT (1 << 2) -#define HE_REGM_RBRQ_END_PDU (1 << 3) -#define HE_REGM_RBRQ_LEN_ERROR (1 << 4) -#define HE_REGM_RBRQ_CRC_ERROR (1 << 5) -#define HE_REGM_RBRQ_CID (0x1fff << 16) -#define HE_REGS_RBRQ_CID 16 -#define HE_REGM_RBRQ_LEN 0xffff - -/* Transmit Packet Descriptor Ready Queue entry */ -struct he_tpdrqen { - uint32_t tpd; /* physical address */ - uint32_t cid; /* connection id */ -}; -/* Transmit buffer return queue */ -struct he_tbrqen { - uint32_t addr; /* handle and flags */ -}; -#define HE_REGM_TBRQ_ADDR 0xffffffc0 -#define HE_REGM_TBRQ_FLAGS 0x0000000a -#define HE_REGM_TBRQ_EOS 0x00000008 -#define HE_REGM_TBRQ_MULT 0x00000002 - -struct he_tpd { - uint32_t addr; /* handle or virtual address and flags */ - uint32_t res; /* reserved */ - struct { - uint32_t addr; /* buffer address */ - uint32_t len; /* buffer length and flags */ - } bufs[3]; -}; -#define HE_REGM_TPD_ADDR 0xffffffC0 -#define HE_REGS_TPD_ADDR 6 -#define HE_REGM_TPD_INTR 0x0001 -#define HE_REGM_TPD_CLP 0x0002 -#define HE_REGM_TPD_EOS 0x0004 -#define HE_REGM_TPD_PTI 0x0038 -#define HE_REGS_TPD_PTI 3 -#define HE_REGM_TPD_LST 0x80000000 - -/* - * The HOST STATUS PAGE - */ -struct he_hsp { - struct { - uint32_t tbrq_tail; - uint32_t res1[15]; - uint32_t rbrq_tail; - uint32_t res2[15]; - } group[8]; -}; - -#define HE_MAX_PDU (65535) diff --git a/sys/dev/hatm/if_hatmvar.h b/sys/dev/hatm/if_hatmvar.h deleted file mode 100644 index d19fd0eabd74..000000000000 --- a/sys/dev/hatm/if_hatmvar.h +++ /dev/null @@ -1,640 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Fore HE driver for NATM - */ - -/* - * Debug statistics of the HE driver - */ -struct istats { - uint32_t tdprq_full; - uint32_t hbuf_error; - uint32_t crc_error; - uint32_t len_error; - uint32_t flow_closed; - uint32_t flow_drop; - uint32_t tpd_no_mem; - uint32_t rx_seg; - uint32_t empty_hbuf; - uint32_t short_aal5; - uint32_t badlen_aal5; - uint32_t bug_bad_isw; - uint32_t bug_no_irq_upd; - uint32_t itype_tbrq; - uint32_t itype_tpd; - uint32_t itype_rbps; - uint32_t itype_rbpl; - uint32_t itype_rbrq; - uint32_t itype_rbrqt; - uint32_t itype_unknown; - uint32_t itype_phys; - uint32_t itype_err; - uint32_t defrag; - uint32_t mcc; - uint32_t oec; - uint32_t dcc; - uint32_t cec; - uint32_t no_rcv_mbuf; -}; - -/* Card memory layout parameters */ -#define HE_CONFIG_MEM_LAYOUT { \ - { /* 155 */ \ - 20, /* cells_per_row */ \ - 1024, /* bytes_per_row */ \ - 512, /* r0_numrows */ \ - 1018, /* tx_numrows */ \ - 512, /* r1_numrows */ \ - 6, /* r0_startrow */ \ - 2 /* cells_per_lbuf */ \ - }, { /* 622 */ \ - 40, /* cells_per_row */ \ - 2048, /* bytes_per_row */ \ - 256, /* r0_numrows */ \ - 512, /* tx_numrows */ \ - 256, /* r1_numrows */ \ - 0, /* r0_startrow */ \ - 4 /* cells_per_lbuf */ \ - } \ -} - -/*********************************************************************/ -struct hatm_softc; - -/* - * A chunk of DMA-able memory - */ -struct dmamem { - u_int size; /* in bytes */ - u_int align; /* alignement */ - bus_dma_tag_t tag; /* DMA tag */ - void *base; /* the memory */ - bus_addr_t paddr; /* physical address */ - bus_dmamap_t map; /* the MAP */ -}; - -/* - * RBP (Receive Buffer Pool) queue entry and queue. - */ -struct herbp { - u_int size; /* RBP number of entries (power of two) */ - u_int thresh; /* interrupt treshold */ - uint32_t bsize; /* buffer size in bytes */ - u_int offset; /* free space at start for small bufs */ - uint32_t mask; /* mask for index */ - struct dmamem mem; /* the queue area */ - struct he_rbpen *rbp; - uint32_t head, tail; /* head and tail */ -}; - -/* - * RBRQ (Receive Buffer Return Queue) entry and queue. - */ -struct herbrq { - u_int size; /* number of entries */ - u_int thresh; /* interrupt threshold */ - u_int tout; /* timeout value */ - u_int pcnt; /* packet count threshold */ - struct dmamem mem; /* memory */ - struct he_rbrqen *rbrq; - uint32_t head; /* driver end */ -}; - -/* - * TPDRQ (Transmit Packet Descriptor Ready Queue) entry and queue - */ -struct hetpdrq { - u_int size; /* number of entries */ - struct dmamem mem; /* memory */ - struct he_tpdrqen *tpdrq; - u_int head; /* head (copy of adapter) */ - u_int tail; /* written back to adapter */ -}; - -/* - * TBRQ (Transmit Buffer Return Queue) entry and queue - */ -struct hetbrq { - u_int size; /* number of entries */ - u_int thresh; /* interrupt threshold */ - struct dmamem mem; /* memory */ - struct he_tbrqen *tbrq; - u_int head; /* adapter end */ -}; - -/*==================================================================*/ - -/* - * TPDs are 32 byte and must be aligned on 64 byte boundaries. That means, - * that half of the space is free. We use this space to plug in a link for - * the list of free TPDs. Note, that the m_act member of the mbufs contain - * a pointer to the dmamap. - * - * The maximum number of TDPs is the size of the common transmit packet - * descriptor ready queue plus the sizes of the transmit buffer return queues - * (currently only queue 0). We allocate and map these TPD when initializing - * the card. We also allocate on DMA map for each TPD. Only the map in the - * last TPD of a packets is used when a packet is transmitted. - * This is signalled by having the mbuf member of this TPD non-zero and - * pointing to the mbuf. - */ -#define HE_TPD_SIZE 64 -struct tpd { - struct he_tpd tpd; /* at beginning */ - SLIST_ENTRY(tpd) link; /* free cid list link */ - struct mbuf *mbuf; /* the buf chain */ - bus_dmamap_t map; /* map */ - uint32_t cid; /* CID */ - uint16_t no; /* number of this tpd */ -}; -SLIST_HEAD(tpd_list, tpd); - -#define TPD_SET_USED(SC, I) do { \ - (SC)->tpd_used[(I) / 8] |= (1 << ((I) % 8)); \ - } while (0) - -#define TPD_CLR_USED(SC, I) do { \ - (SC)->tpd_used[(I) / 8] &= ~(1 << ((I) % 8)); \ - } while (0) - -#define TPD_TST_USED(SC, I) ((SC)->tpd_used[(I) / 8] & (1 << ((I) % 8))) - -#define TPD_ADDR(SC, I) ((struct tpd *)((char *)sc->tpds.base + \ - (I) * HE_TPD_SIZE)) - -/*==================================================================*/ - -/* - * External MBUFs. The card needs a lot of mbufs in the pools for high - * performance. The problem with using mbufs directly is that we would need - * a dmamap for each of the mbufs. This can exhaust iommu space on the sparc - * and it eats also a lot of processing time. So we use external mbufs - * for the small buffers and clusters for the large buffers. - * For receive group 0 we use 5 ATM cells, for group 1 one (52 byte) ATM - * cell. The mbuf storage is allocated pagewise and one dmamap is used per - * page. - * - * The handle we give to the card for the small buffers is a word combined - * of the page number and the number of the chunk in the page. This restricts - * the number of chunks per page to 256 (8 bit) and the number of pages to - * 65536 (16 bits). - * - * A chunk may be in one of three states: free, on the card and floating around - * in the system. If it is free, it is on one of the two free lists and - * start with a struct mbufx_free. Each page has a bitmap that tracks where - * its chunks are. - * - * For large buffers we use mbuf clusters. Here we have two problems: we need - * to track the buffers on the card (in the case we want to stop it) and - * we need to map the 64bit mbuf address to a 26bit handle for 64-bit machines. - * The card uses the buffers in the order we give it to the card. Therefor - * we can use a private array holding pointers to the mbufs as a circular - * queue for both tasks. This is done with the lbufs member of softc. The - * handle for these buffer is the lbufs index ored with a flag. - */ - -/* data space in each external mbuf */ -#define MBUF0_SIZE (5 * 48) /* 240 */ -#define MBUF1_SIZE (52) /* 1 raw cell */ - -/* size of the buffer. Must fit data, offset and header */ -#define MBUF0_CHUNK 256 /* 16 free bytes */ -#define MBUF1_CHUNK 96 /* 44 free bytes */ - -/* start of actual data in buffer */ -#define MBUF0_OFFSET 0 -#define MBUF1_OFFSET 16 - -#define MBUFL_OFFSET 16 /* two pointers for HARP */ - -#if PAGE_SIZE > 8192 -#define MBUF_ALLOC_SIZE (8192) -#else -#define MBUF_ALLOC_SIZE (PAGE_SIZE) -#endif - -/* each allocated page has one of these structures at its very end. */ -struct mbuf_page_hdr { - uint16_t nchunks; /* chunks on this page */ - bus_dmamap_t map; /* the DMA MAP */ - uint32_t phys; /* physical base address */ - uint32_t hdroff; /* chunk header offset */ - uint32_t chunksize; /* chunk size */ - u_int pool; /* pool number */ -}; -struct mbuf_page { - char storage[MBUF_ALLOC_SIZE - sizeof(struct mbuf_page_hdr)]; - struct mbuf_page_hdr hdr; -}; - -/* numbers per page */ -#define MBUF0_PER_PAGE ((MBUF_ALLOC_SIZE - sizeof(struct mbuf_page_hdr)) / \ - MBUF0_CHUNK) -#define MBUF1_PER_PAGE ((MBUF_ALLOC_SIZE - sizeof(struct mbuf_page_hdr)) / \ - MBUF1_CHUNK) - -/* - * Convert to/from handles - */ -/* small buffers */ -#define MBUF_MAKE_HANDLE(PAGENO, CHUNKNO) \ - ((((PAGENO) << 10) | (CHUNKNO)) << HE_REGS_RBRQ_ADDR) -#define MBUF_MAKE_LHANDLE(INDEX) \ - (MBUF_LARGE_FLAG | ((INDEX) << HE_REGS_RBRQ_ADDR)) - -/* large buffers */ -#define MBUF_PARSE_HANDLE(HANDLE, PAGENO, CHUNKNO) do { \ - (CHUNKNO) = ((HANDLE) >> HE_REGS_RBRQ_ADDR) & 0x3ff; \ - (PAGENO) = (((HANDLE) >> 10) >> HE_REGS_RBRQ_ADDR) & 0x3fff; \ - } while (0) -#define MBUF_PARSE_LHANDLE(HANDLE, INDEX) do { \ - (INDEX) = ((HANDLE) >> HE_REGS_RBRQ_ADDR) & 0xffffff; \ - } while (0) - -#define MBUF_LARGE_FLAG 0x80000000 - -/* chunks have the following structure at the end (8 byte) */ -struct mbuf_chunk_hdr { - uint16_t pageno; - uint8_t chunkno; - uint8_t flags; - u_int ref_cnt; -}; -#define MBUF_CARD 0x01 /* buffer is on card */ -#define MBUF_USED 0x02 /* buffer is somewhere in the system */ - -#define MBUFX_STORAGE_SIZE(X) (MBUF##X##_CHUNK \ - - sizeof(struct mbuf_chunk_hdr)) - -struct mbuf0_chunk { - char storage[MBUFX_STORAGE_SIZE(0)]; - struct mbuf_chunk_hdr hdr; -}; - -struct mbuf1_chunk { - char storage[MBUFX_STORAGE_SIZE(1)]; - struct mbuf_chunk_hdr hdr; -}; - -struct mbufx_free { - struct mbufx_free *link; -}; - -/*==================================================================*/ - -/* - * Interrupt queue - */ -struct heirq { - u_int size; /* number of entries */ - u_int thresh; /* re-interrupt threshold */ - u_int line; /* interrupt line to use */ - struct dmamem mem; /* interrupt queues */ - uint32_t * irq; /* interrupt queue */ - uint32_t head; /* head index */ - uint32_t * tailp; /* pointer to tail */ - struct hatm_softc *sc; /* back pointer */ - u_int group; /* interrupt group */ -}; - -/* - * This structure describes all information for a VCC open on the card. - * The array of these structures is indexed by the compressed connection ID - * (CID). This structure must begin with the atmio_vcc. - */ -struct hevcc { - struct atmio_vcc param; /* traffic parameters */ - void * rxhand; /* NATM protocol block */ - u_int vflags; /* private flags */ - uint32_t ipackets; - uint32_t opackets; - uint32_t ibytes; - uint32_t obytes; - - u_int rc; /* rate control group for CBR */ - struct mbuf * chain; /* partial received PDU */ - struct mbuf * last; /* last mbuf in chain */ - u_int ntpds; /* number of active TPDs */ -}; -#define HE_VCC_OPEN 0x000f0000 -#define HE_VCC_RX_OPEN 0x00010000 -#define HE_VCC_RX_CLOSING 0x00020000 -#define HE_VCC_TX_OPEN 0x00040000 -#define HE_VCC_TX_CLOSING 0x00080000 -#define HE_VCC_FLOW_CTRL 0x00100000 - -/* - * CBR rate groups - */ -struct herg { - u_int refcnt; /* how many connections reference this group */ - u_int rate; /* the value */ -}; - -/* - * Softc - */ -struct hatm_softc { - struct ifnet *ifp; - struct mtx mtx; /* lock */ - struct ifmedia media; /* media */ - device_t dev; /* device */ - int memid; /* resoure id for memory */ - struct resource * memres; /* memory resource */ - bus_space_handle_t memh; /* handle */ - bus_space_tag_t memt; /* ... and tag */ - bus_dma_tag_t parent_tag; /* global restriction */ - struct cv vcc_cv; /* condition variable */ - int irqid; /* resource id */ - struct resource * irqres; /* resource */ - void * ih; /* interrupt handle */ - struct utopia utopia; /* utopia state */ - - /* rest has to be reset by stop */ - int he622; /* this is a HE622 */ - int pci64; /* 64bit bus */ - char prod_id[HE_EEPROM_PROD_ID_LEN + 1]; - char rev[HE_EEPROM_REV_LEN + 1]; - struct heirq irq_0; /* interrupt queues 0 */ - - /* generic network controller state */ - u_int cells_per_row; - u_int bytes_per_row; - u_int r0_numrows; - u_int tx_numrows; - u_int r1_numrows; - u_int r0_startrow; - u_int tx_startrow; - u_int r1_startrow; - u_int cells_per_lbuf; - u_int r0_numbuffs; - u_int r1_numbuffs; - u_int tx_numbuffs; - - /* HSP */ - struct he_hsp *hsp; - struct dmamem hsp_mem; - - /*** TX ***/ - struct hetbrq tbrq; /* TBRQ 0 */ - struct hetpdrq tpdrq; /* TPDRQ */ - struct tpd_list tpd_free; /* Free TPDs */ - u_int tpd_nfree; /* number of free TPDs */ - u_int tpd_total; /* total TPDs */ - uint8_t *tpd_used; /* bitmap of used TPDs */ - struct dmamem tpds; /* TPD memory */ - bus_dma_tag_t tx_tag; /* DMA tag for all tx mbufs */ - - /*** RX ***/ - /* receive/transmit groups */ - struct herbp rbp_s0; /* RBPS0 */ - struct herbp rbp_l0; /* RBPL0 */ - struct herbp rbp_s1; /* RBPS1 */ - struct herbrq rbrq_0; /* RBRQ0 */ - struct herbrq rbrq_1; /* RBRQ1 */ - - /* list of external mbuf storage */ - bus_dma_tag_t mbuf_tag; - struct mbuf_page **mbuf_pages; - u_int mbuf_npages; - u_int mbuf_max_pages; - struct mbufx_free *mbuf_list[2]; - - /* mbuf cluster tracking and mapping for group 0 */ - struct mbuf **lbufs; /* mbufs */ - bus_dmamap_t *rmaps; /* DMA maps */ - u_int lbufs_size; - u_int lbufs_next; - - /* VCCs */ - struct hevcc *vccs[HE_MAX_VCCS]; - u_int cbr_bw; /* BW allocated to CBR */ - u_int max_tpd; /* per VCC */ - u_int open_vccs; - uma_zone_t vcc_zone; - - /* rate groups */ - struct herg rate_ctrl[HE_REGN_CS_STPER]; - - /* memory offsets */ - u_int tsrb, tsrc, tsrd; - u_int rsrb; - - struct cv cv_rcclose; /* condition variable */ - uint32_t rate_grid[16][16]; /* our copy */ - - /* sysctl support */ - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - - /* internal statistics */ - struct istats istats; - - u_int mpsafe; - -#ifdef HATM_DEBUG - /* debugging */ - u_int debug; - - /* transmit mbuf count */ - int txmbuf; -#endif -}; - -#define READ4(SC,OFF) bus_space_read_4(SC->memt, SC->memh, (OFF)) -#define READ2(SC,OFF) bus_space_read_2(SC->memt, SC->memh, (OFF)) -#define READ1(SC,OFF) bus_space_read_1(SC->memt, SC->memh, (OFF)) - -#define WRITE4(SC,OFF,VAL) bus_space_write_4(SC->memt, SC->memh, (OFF), (VAL)) -#define WRITE2(SC,OFF,VAL) bus_space_write_2(SC->memt, SC->memh, (OFF), (VAL)) -#define WRITE1(SC,OFF,VAL) bus_space_write_1(SC->memt, SC->memh, (OFF), (VAL)) - -#define BARRIER_R(SC) bus_space_barrier(SC->memt, SC->memh, 0, HE_REGO_END, \ - BUS_SPACE_BARRIER_READ) -#define BARRIER_W(SC) bus_space_barrier(SC->memt, SC->memh, 0, HE_REGO_END, \ - BUS_SPACE_BARRIER_WRITE) -#define BARRIER_RW(SC) bus_space_barrier(SC->memt, SC->memh, 0, HE_REGO_END, \ - BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE) - -#define READ_SUNI(SC,OFF) READ4(SC, HE_REGO_SUNI + 4 * (OFF)) -#define WRITE_SUNI(SC,OFF,VAL) WRITE4(SC, HE_REGO_SUNI + 4 * (OFF), (VAL)) - -#define READ_LB4(SC,OFF) \ - ({ \ - WRITE4(SC, HE_REGO_LB_MEM_ADDR, (OFF)); \ - WRITE4(SC, HE_REGO_LB_MEM_ACCESS, \ - (HE_REGM_LB_MEM_HNDSHK | HE_REGM_LB_MEM_READ)); \ - while((READ4(SC, HE_REGO_LB_MEM_ACCESS) & HE_REGM_LB_MEM_HNDSHK))\ - ; \ - READ4(SC, HE_REGO_LB_MEM_DATA); \ - }) -#define WRITE_LB4(SC,OFF,VAL) \ - do { \ - WRITE4(SC, HE_REGO_LB_MEM_ADDR, (OFF)); \ - WRITE4(SC, HE_REGO_LB_MEM_DATA, (VAL)); \ - WRITE4(SC, HE_REGO_LB_MEM_ACCESS, \ - (HE_REGM_LB_MEM_HNDSHK | HE_REGM_LB_MEM_WRITE)); \ - while((READ4(SC, HE_REGO_LB_MEM_ACCESS) & HE_REGM_LB_MEM_HNDSHK))\ - ; \ - } while(0) - -#define WRITE_MEM4(SC,OFF,VAL,SPACE) \ - do { \ - WRITE4(SC, HE_REGO_CON_DAT, (VAL)); \ - WRITE4(SC, HE_REGO_CON_CTL, \ - (SPACE | HE_REGM_CON_WE | HE_REGM_CON_STATUS | (OFF))); \ - while((READ4(SC, HE_REGO_CON_CTL) & HE_REGM_CON_STATUS) != 0) \ - ; \ - } while(0) - -#define READ_MEM4(SC,OFF,SPACE) \ - ({ \ - WRITE4(SC, HE_REGO_CON_CTL, \ - (SPACE | HE_REGM_CON_STATUS | (OFF))); \ - while((READ4(SC, HE_REGO_CON_CTL) & HE_REGM_CON_STATUS) != 0) \ - ; \ - READ4(SC, HE_REGO_CON_DAT); \ - }) - -#define WRITE_TCM4(SC,OFF,VAL) WRITE_MEM4(SC,(OFF),(VAL),HE_REGM_CON_TCM) -#define WRITE_RCM4(SC,OFF,VAL) WRITE_MEM4(SC,(OFF),(VAL),HE_REGM_CON_RCM) -#define WRITE_MBOX4(SC,OFF,VAL) WRITE_MEM4(SC,(OFF),(VAL),HE_REGM_CON_MBOX) - -#define READ_TCM4(SC,OFF) READ_MEM4(SC,(OFF),HE_REGM_CON_TCM) -#define READ_RCM4(SC,OFF) READ_MEM4(SC,(OFF),HE_REGM_CON_RCM) -#define READ_MBOX4(SC,OFF) READ_MEM4(SC,(OFF),HE_REGM_CON_MBOX) - -#define WRITE_TCM(SC,OFF,BYTES,VAL) \ - WRITE_MEM4(SC,(OFF) | ((~(BYTES) & 0xf) << HE_REGS_CON_DIS), \ - (VAL), HE_REGM_CON_TCM) -#define WRITE_RCM(SC,OFF,BYTES,VAL) \ - WRITE_MEM4(SC,(OFF) | ((~(BYTES) & 0xf) << HE_REGS_CON_DIS), \ - (VAL), HE_REGM_CON_RCM) - -#define READ_TSR(SC,CID,NR) \ - ({ \ - uint32_t _v; \ - if((NR) <= 7) { \ - _v = READ_TCM4(SC, HE_REGO_TSRA(0,CID,NR)); \ - } else if((NR) <= 11) { \ - _v = READ_TCM4(SC, HE_REGO_TSRB((SC)->tsrb,CID,(NR-8)));\ - } else if((NR) <= 13) { \ - _v = READ_TCM4(SC, HE_REGO_TSRC((SC)->tsrc,CID,(NR-12)));\ - } else { \ - _v = READ_TCM4(SC, HE_REGO_TSRD((SC)->tsrd,CID)); \ - } \ - _v; \ - }) - -#define WRITE_TSR(SC,CID,NR,BEN,VAL) \ - do { \ - if((NR) <= 7) { \ - WRITE_TCM(SC, HE_REGO_TSRA(0,CID,NR),BEN,VAL); \ - } else if((NR) <= 11) { \ - WRITE_TCM(SC, HE_REGO_TSRB((SC)->tsrb,CID,(NR-8)),BEN,VAL);\ - } else if((NR) <= 13) { \ - WRITE_TCM(SC, HE_REGO_TSRC((SC)->tsrc,CID,(NR-12)),BEN,VAL);\ - } else { \ - WRITE_TCM(SC, HE_REGO_TSRD((SC)->tsrd,CID),BEN,VAL); \ - } \ - } while(0) - -#define READ_RSR(SC,CID,NR) \ - ({ \ - uint32_t _v; \ - if((NR) <= 7) { \ - _v = READ_RCM4(SC, HE_REGO_RSRA(0,CID,NR)); \ - } else { \ - _v = READ_RCM4(SC, HE_REGO_RSRB((SC)->rsrb,CID,(NR-8)));\ - } \ - _v; \ - }) - -#define WRITE_RSR(SC,CID,NR,BEN,VAL) \ - do { \ - if((NR) <= 7) { \ - WRITE_RCM(SC, HE_REGO_RSRA(0,CID,NR),BEN,VAL); \ - } else { \ - WRITE_RCM(SC, HE_REGO_RSRB((SC)->rsrb,CID,(NR-8)),BEN,VAL);\ - } \ - } while(0) - -#ifdef HATM_DEBUG -#define DBG(SC, FL, PRINT) do { \ - if((SC)->debug & DBG_##FL) { \ - if_printf((SC)->ifp, "%s: ", __func__); \ - printf PRINT; \ - printf("\n"); \ - } \ - } while (0) - -enum { - DBG_DUMMY = 0x0001, /* default value for -DHATM_DEBUG */ - DBG_RX = 0x0002, - DBG_TX = 0x0004, - DBG_VCC = 0x0008, - DBG_IOCTL = 0x0010, - DBG_ATTACH = 0x0020, - DBG_INTR = 0x0040, - DBG_DMA = 0x0080, - DBG_DMAH = 0x0100, - DBG_DUMP = 0x0200, - - DBG_ALL = 0x03ff -}; - -#else -#define DBG(SC, FL, PRINT) -#endif - -u_int hatm_cps2atmf(uint32_t); -u_int hatm_atmf2cps(uint32_t); - -void hatm_intr(void *); -int hatm_ioctl(struct ifnet *, u_long, caddr_t); -void hatm_initialize(struct hatm_softc *); -void hatm_stop(struct hatm_softc *sc); -void hatm_start(struct ifnet *); - -void hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m, - u_int len); -void hatm_tx_complete(struct hatm_softc *sc, struct tpd *tpd, uint32_t); - -int hatm_tx_vcc_can_open(struct hatm_softc *sc, u_int cid, struct hevcc *); -void hatm_tx_vcc_open(struct hatm_softc *sc, u_int cid); -void hatm_rx_vcc_open(struct hatm_softc *sc, u_int cid); -void hatm_tx_vcc_close(struct hatm_softc *sc, u_int cid); -void hatm_rx_vcc_close(struct hatm_softc *sc, u_int cid); -void hatm_tx_vcc_closed(struct hatm_softc *sc, u_int cid); -void hatm_vcc_closed(struct hatm_softc *sc, u_int cid); -void hatm_load_vc(struct hatm_softc *sc, u_int cid, int reopen); - -void hatm_ext_free(struct mbufx_free **, struct mbufx_free *); diff --git a/sys/dev/patm/genrtab/Makefile b/sys/dev/patm/genrtab/Makefile deleted file mode 100644 index 907b29db230e..000000000000 --- a/sys/dev/patm/genrtab/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ -# -# This program is used to generate the if_patm_rtables.c file -# for the idt77252 driver. It is not installed. -# -PROG= genrtab -INTERNALPROG= -WARNS?= 5 -MAN= -LIBADD= m - -.include diff --git a/sys/dev/patm/genrtab/genrtab.c b/sys/dev/patm/genrtab/genrtab.c deleted file mode 100644 index 8d696cfa8ef6..000000000000 --- a/sys/dev/patm/genrtab/genrtab.c +++ /dev/null @@ -1,458 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * This program is used to generate the different rate tables for the IDT77252 - * driver. The generated tables are slightly different from those in the - * IDT manual. - */ -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -/* verbosity flag */ -static int verbose; - -/* number of table entries */ -static const u_int tsize = 256; - -/* number of rate difference tables to create */ -static const u_int ndtables = 16; - -/* cell rate offset for log 0 */ -static const double offset = 10.0; - -/* - * Make an internal form of the interval and be sure to round down. - */ -static u_int -d2interval(double d) -{ - fp_rnd_t r; - u_int s, id; - - r = fpsetround(FP_RZ); - id = (u_int)rint(32 * d); - fpsetround(r); - - s = 0; - while (id >= 32 * 32) { - s++; - id >>= 1; - } - return ((s << 10) | (id)); -} - -/* - * Convert an internal interval back to a real one. - */ -static double -interval2d(u_int id) -{ - return ((1 << ((id >> 10) & 0xf)) * ((id & 0x3ff) / 32.0)); -} - -/* - * Convert double to ATM-Forum format. Make sure to round up. - */ -static u_int -cps2atmf(double cps) -{ - fp_rnd_t r; - u_int s, id; - - if (cps < 1.0) - return (0); - - s = 0; - while (cps >= 2.0) { - s++; - cps /= 2; - } - r = fpsetround(FP_RP); - id = (u_int)rint(512 * cps); - fpsetround(r); - - return ((1 << 14) | (s << 9) | (id & 0x1ff)); -} - -/* - * Convert ATM forum format to double - */ -static double -atmf2cps(u_int atmf) -{ - return (((atmf >> 14) & 1) * (1 << ((atmf >> 9) & 0x1f)) * - ((512 + (atmf & 0x1ff)) / 512.0)); -} - -/* - * A cell rate to the logarithmic one - */ -static double -cps2log(u_int alink, double lg) -{ - if (lg <= offset) - return (0); - if (lg >= alink) - return (tsize - 1); - - return ((tsize - 1) * (1 - log(alink / lg) / log(alink / offset))); -} - -/* - * Convert log to cell rate - */ -static double -log2cps(u_int alink, u_int lg) -{ - return (alink / pow(alink / offset, - (double)(tsize - lg - 1) / (tsize - 1))); -} - -/* - * Convert a double to an internal scaled double - */ -static u_int -d2ifp(double fp) -{ - fp_rnd_t r; - u_int s, ifp; - - fp *= (1 << 16); - - r = fpsetround(FP_RN); - ifp = (u_int)rint(fp); - fpsetround(r); - - s = 0; - while (ifp >= 1024) { - s++; - ifp >>= 1; - } - return ((s << 10) | (ifp)); -} - -/* - * Convert internal scaled float to double - */ -static double -ifp2d(u_int p) -{ - return ((p & 0x3ff) * (1 << ((p >> 10) & 0xf)) / 65536.0); -} - -/* - * Generate log to rate conversion table - */ -static void -gen_log2rate(u_int alink) -{ - u_int i, iinterval, atmf, n, nrm; - double rate, interval, xinterval, cps, xcps; - - for (i = 0; i < 256; i++) { - /* get the desired rate */ - rate = alink / pow(alink / offset, - (double)(tsize - i - 1) / (tsize - 1)); - - /* convert this to an interval */ - interval = alink / rate; - - /* make the internal form of this interval, be sure to - * round down */ - iinterval = d2interval(interval); - - /* now convert back */ - xinterval = interval2d(iinterval); - - /* make a cps from this interval */ - cps = alink / xinterval; - - /* convert this to its ATM forum format */ - atmf = cps2atmf(cps); - - /* and back */ - xcps = atmf2cps(atmf); - - /* decide on NRM */ - if (xcps < 40.0) { - nrm = 0; - n = 3; - } else if (xcps < 80.0) { - nrm = 1; - n = 4; - } else if (xcps < 160.0) { - nrm = 2; - n = 8; - } else if (xcps < 320.0) { - nrm = 3; - n = 16; - } else { - nrm = 4; - n = 32; - } - - /* print */ - if (verbose) - printf(" 0x%08x, /* %03u: cps=%f nrm=%u int=%f */\n", - (atmf << 17) | (nrm << 14) | iinterval, i, - xcps, n, xinterval); - else - printf("0x%08x,\n", (atmf << 17) | (nrm << 14) | - iinterval); - } -} - -/* - * Generate rate to log conversion table - */ -static void -gen_rate2log(u_int alink) -{ - u_int i, atmf, val, ilcr; - double cps, lcr; - fp_rnd_t r; - - val = 0; - for (i = 0; i < 512; i++) { - /* make ATM Forum CPS from index */ - atmf = (((i & 0x1f0) >> 4) << 9) | - ((i & 0xf) << 5) | (1 << 14); - - /* make cps */ - cps = atmf2cps(atmf); - - /* convert to log */ - lcr = cps2log(alink, cps); - - r = fpsetround(FP_RN); - ilcr = (u_int)rint(lcr); - fpsetround(r); - - /* put together */ - val |= ilcr << (8 * (i % 4)); - - /* print */ - if (i % 4 == 3) { - if (verbose) - printf(" 0x%08x,\t", val); - else - printf("0x%08x,\n", val); - val = 0; - } else if (verbose) - printf("\t\t"); - if (verbose) - printf("/* %03u: %f -> %f */\n", i, - cps, log2cps(alink, ilcr)); - } -} - -/* - * Generate one entry into the global table - */ -static void -gen_glob_entry(u_int alink, u_int fill, u_int ci, u_int ni) -{ - if (verbose) - printf(" 0x%08x, /* %2u/32 %8.6f, %6u, ci=%u, ni=%u */\n", - cps2atmf(alink * fill / 32.0) | (ci << 17) | (ni << 16), - fill, fill / 32.0, alink * fill / 32, ci, ni); - else - printf("0x%08x,\n", - cps2atmf(alink * fill / 32.0) | (ci << 17) | (ni << 16)); -} - -/* - * Generate global parameter table - */ -static void -gen_glob(u_int alink) -{ - u_int i; - - gen_glob_entry(alink, 32, 0, 0); - gen_glob_entry(alink, 16, 0, 0); - gen_glob_entry(alink, 8, 0, 1); - gen_glob_entry(alink, 4, 0, 1); - gen_glob_entry(alink, 2, 1, 1); - gen_glob_entry(alink, 1, 1, 1); - gen_glob_entry(alink, 0, 1, 1); - gen_glob_entry(alink, 0, 1, 1); - - for (i = 0; i < tsize/2 - 8; i++) { - if (i % 16 == 0) - printf(" "); - printf(" 0,"); - if (i % 16 == 15) - printf("\n"); - } - printf("\n"); -} - -/* - * Generate additive rate increase tables - */ -static void -gen_air(u_int alink) -{ - u_int t, i; - double diff; /* cell rate to increase by */ - double cps; - double add; - u_int val, a; - - for (t = 0; t < ndtables; t++) { - diff = (double)alink / (1 << t); - printf("/* AIR %u: diff=%f */\n", t, diff); - val = 0; - for (i = 0; i < tsize; i++) { - cps = log2cps(alink, i); - cps += diff; - if (cps > alink) - cps = alink; - - add = cps2log(alink, cps) - i; - - a = d2ifp(add); - - if (i % 2) { - val |= a << 16; - if (verbose) - printf(" 0x%08x,\t", val); - else - printf("0x%08x,\n", val); - } else { - val = a; - if (verbose) - printf("\t\t"); - } - if (verbose) - printf("/* %3u: %f */\n", i, ifp2d(add)); - } - } -} - -/* - * Generate rate decrease table - */ -static void -gen_rdf(u_int alink) -{ - double d; - u_int t, i, f, val, diff; - - for (t = 0; t < ndtables; t++) { - /* compute the log index difference */ - if (t == 0) { - d = tsize - 1; - } else { - f = 1 << t; - d = (tsize - 1) / log(alink / offset); - d *= log((double)f / (f - 1)); - } - printf(" /* RDF %u: 1/%u: %f */\n", t, 1 << t, d); - val = 0; - for (i = 0; i < tsize; i++) { - if (i < d) - diff = d2ifp(i); - else - diff = d2ifp(d); - if (i % 2) { - val |= diff << 16; - if (verbose) - printf(" 0x%08x,\t", val); - else - printf("0x%08x,\n", val); - } else { - val = diff; - if (verbose) - printf("\t\t"); - } - if (verbose) - printf("/* %3u: %f */\n", i, ifp2d(diff)); - } - } -} - -/* - * Create all the tables for a given link cell rate and link bit rate. - * The link bit rate is only used to name the table. - */ -static void -gen_tables(u_int alink, u_int mbps) -{ - printf("\n"); - printf("/*\n"); - printf(" * Tables for %ucps and %uMbps\n", alink, mbps); - printf(" */\n"); - printf("const uint32_t patm_rtables%u[128 * (4 + 2 * %u)] = {\n", - mbps, ndtables); - - gen_log2rate(alink); - gen_rate2log(alink); - gen_glob(alink); - gen_air(alink); - gen_rdf(alink); - - printf("};\n"); -} - -int -main(int argc, char *argv[]) -{ - int opt; - - while ((opt = getopt(argc, argv, "v")) != -1) - switch (opt) { - - case 'v': - verbose = 1; - break; - } - - printf("/*\n"); - printf(" * This file was generated by `%s'\n", argv[0]); - printf(" */\n"); - printf("\n"); - printf("#include \n"); - printf("__FBSDID(\"$FreeBSD$\");\n"); - printf("\n"); - printf("#include \n"); - printf("\n"); - printf("const u_int patm_rtables_size = 128 * (4 + 2 * %u);\n", - ndtables); - printf("const u_int patm_rtables_ntab = %u;\n", ndtables); - gen_tables(352768, 155); - gen_tables( 59259, 25); - return (0); -} diff --git a/sys/dev/patm/idt77252reg.h b/sys/dev/patm/idt77252reg.h deleted file mode 100644 index 13013a2f1056..000000000000 --- a/sys/dev/patm/idt77252reg.h +++ /dev/null @@ -1,476 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Register definitions for the IDT77252 chip. - */ - -#define PCI_VENDOR_IDT 0x111D -#define PCI_DEVICE_IDT77252 3 -#define PCI_DEVICE_IDT77v252 4 -#define PCI_DEVICE_IDT77v222 5 - -#define IDT_PCI_REG_MEMBASE 0x14 - -#define IDT_NOR_D0 0x00 /* R/W Data register 0 */ -#define IDT_NOR_D1 0x04 /* R/W Data register 1 */ -#define IDT_NOR_D2 0x08 /* R/W Data register 2 */ -#define IDT_NOR_D3 0x0C /* R/W Data register 3 */ -#define IDT_NOR_CMD 0x10 /* R/W Command */ -#define IDT_NOR_CFG 0x14 /* R/W Configuration */ -#define IDT_NOR_STAT 0x18 /* R/W Status */ -#define IDT_NOR_RSQB 0x1C /* R/W Receive status queue base */ -#define IDT_NOR_RSQT 0x20 /* R Receive status queue tail */ -#define IDT_NOR_RSQH 0x24 /* R/W Receive status queue tail */ -#define IDT_NOR_CDC 0x28 /* R/W Cell drop counter */ -#define IDT_NOR_VPEC 0x2C /* R/W VPI/VCI Lookup error counter */ -#define IDT_NOR_ICC 0x30 /* R/W Invalid cell counter */ -#define IDT_NOR_RAWCT 0x34 /* R Raw cell tail */ -#define IDT_NOR_TMR 0x38 /* R Timer */ -#define IDT_NOR_TSTB 0x3C /* R/W Transmit schedule table base */ -#define IDT_NOR_TSQB 0x40 /* R/W Transmit Status queue base */ -#define IDT_NOR_TSQT 0x44 /* R/W Transmit Status queue tail */ -#define IDT_NOR_TSQH 0x48 /* R/W Transmit Status queue head */ -#define IDT_NOR_GP 0x4C /* R/W General purpose */ -#define IDT_NOR_VPM 0x50 /* R/W VPI/VCI mask */ -#define IDT_NOR_RXFD 0x54 /* R/W Receive FIFO descriptor */ -#define IDT_NOR_RXFT 0x58 /* R/W Receive FIFO tail */ -#define IDT_NOR_RXFH 0x5C /* R/W Receive FIFO head */ -#define IDT_NOR_RAWHND 0x60 /* R/W Raw cell handle */ -#define IDT_NOR_RXSTAT 0x64 /* R Receive connection state */ -#define IDT_NOR_ABRSTD 0x68 /* R/W ABR & VBR Schedule table descriptor */ -#define IDT_NOR_ABRRQ 0x6C /* R/W ABR Ready queue pointer */ -#define IDT_NOR_VBRRQ 0x70 /* R/W VBR Ready queue pointer */ -#define IDT_NOR_RTBL 0x74 /* R/W Rate table descriptor */ -#define IDT_NOR_MXDFCT 0x78 /* R/W Maximum deficit counter */ -#define IDT_NOR_TXSTAT 0x7C /* R/W Transmit connection state */ -#define IDT_NOR_TCMDQ 0x80 /* W Transmit command queue */ -#define IDT_NOR_IRCP 0x84 /* R/W Inactive receive connection pointer */ -#define IDT_NOR_FBQP0 0x88 /* R/W Free buffer queue 0 pointer */ -#define IDT_NOR_FBQP1 0x8C /* R/W Free buffer queue 1 pointer */ -#define IDT_NOR_FBQP2 0x90 /* R/W Free buffer queue 2 pointer */ -#define IDT_NOR_FBQP3 0x94 /* R/W Free buffer queue 3 pointer */ -#define IDT_NOR_FBQS0 0x98 /* R/W Free buffer queue 0 size */ -#define IDT_NOR_FBQS1 0x9C /* R/W Free buffer queue 1 size */ -#define IDT_NOR_FBQS2 0xA0 /* R/W Free buffer queue 2 size */ -#define IDT_NOR_FBQS3 0xA4 /* R/W Free buffer queue 3 size */ -#define IDT_NOR_FBQWP0 0xA8 /* R/W Free buffer queue 0 write pointer */ -#define IDT_NOR_FBQWP1 0xAC /* R/W Free buffer queue 1 write pointer */ -#define IDT_NOR_FBQWP2 0xB0 /* R/W Free buffer queue 2 write pointer */ -#define IDT_NOR_FBQWP3 0xB4 /* R/W Free buffer queue 3 write pointer */ -#define IDT_NOR_NOW 0xB8 /* R Current transmit schedule table addr */ -#define IDT_NOR_DNOW 0xBC /* R Dynamic Now register */ -#define IDT_NOR_END 0xC0 - -/* - * Command (IDT_NOR_CMD) - */ -#define IDT_CMD_NOP 0x00000000 /* No operation */ -#define IDT_CMD_OPCL 0x20000000 /* Open/Close connection */ -#define IDT_CMD_WSRAM 0x40000000 /* Write SRAM */ -#define IDT_CMD_RSRAM 0x50000000 /* Read SRAM */ -#define IDT_CMD_WFBQ 0x60000000 /* Write free buffer queue */ -#define IDT_CMD_RUTIL 0x80000000 /* Read utility bus */ -#define IDT_CMD_WUTIL 0x90000000 /* Write utility bus */ - -#define IDT_MKCMD_OPEN(VC) (IDT_CMD_OPCL | (1 << 19) | ((V) << 4)) -#define IDT_MKCMD_CLOSE(VC) (IDT_CMD_OPCL | (0 << 19) | ((V) << 4)) -#define IDT_MKCMD_WSRAM(A, S) (IDT_CMD_WSRAM | ((A) << 2) | (S)) -#define IDT_MKCMD_RSRAM(A) (IDT_CMD_RSRAM | ((A) << 2)) -#define IDT_MKCMD_WFBQ(Q) (IDT_CMD_WFBQ | (Q)) -#define IDT_MKCMD_RUTIL(S0, S1, A) \ - (IDT_CMD_RUTIL | ((S1) << 9) | ((S0) << 8) | (A)) -#define IDT_MKCMD_WUTIL(S0, S1, A) \ - (IDT_CMD_WUTIL | ((S1) << 9) | ((S0) << 8) | (A)) - -/* - * Configuration register (CFG) - */ -#define IDT_CFG_SWRST 0x80000000 /* software reset */ -#define IDT_CFG_LOOP 0x40000000 /* internal loopback enable */ -#define IDT_CFG_RXPTH 0x20000000 /* receive path enable */ -#define IDT_CFG_IDLECLP 0x10000000 /* set CLP in null cells */ -#define IDT_CFG_TXFIFO9 0x00000000 /* Tx FIFO 9 cells */ -#define IDT_CFG_TXFIFO1 0x04000000 /* Tx FIFO 1 cells */ -#define IDT_CFG_TXFIFO2 0x08000000 /* Tx FIFO 2 cells */ -#define IDT_CFG_TXFIFO4 0x0C000000 /* Tx FIFO 4 cells */ -#define IDT_CFG_NOIDLE 0x02000000 /* don't send idle cells */ -#define IDT_CFG_RXQ128 0x00000000 /* Rx Status Queue 128 entries */ -#define IDT_CFG_RXQ256 0x00400000 /* Rx Status Queue 256 entries */ -#define IDT_CFG_RXQ512 0x00800000 /* Rx Status Queue 512 entries */ -#define IDT_CFG_ICAPT 0x00200000 /* Invalid cell accept */ -#define IDT_CFG_IGGFC 0x00100000 /* Ignore GFC field */ -#define IDT_CFG_VP0 0x00000000 /* 0 VPI bits */ -#define IDT_CFG_VP1 0x00040000 /* 1 VPI bit */ -#define IDT_CFG_VP2 0x00080000 /* 2 VPI bits */ -#define IDT_CFG_VP8 0x000C0000 /* 8 VPI bits */ -#define IDT_CFG_CTS1K 0x00000000 /* Rx Connection table 1024 entries */ -#define IDT_CFG_CTS4K 0x00010000 /* Rx Connection table 4096 entries */ -#define IDT_CFG_CTS16K 0x00020000 /* Rx Connection table 16384 entries */ -#define IDT_CFG_CTS512 0x00030000 /* Rx Connection table 512 entries */ -#define IDT_CFG_VPECA 0x00008000 /* VPI/VCI error cell accept */ -#define IDT_CFG_RXINONE 0x00000000 /* No interrupt on receive */ -#define IDT_CFG_RXIIMM 0x00001000 /* immediate interrupt */ -#define IDT_CFG_RXI28 0x00002000 /* every 0x2800 clocks */ -#define IDT_CFG_RXI4F 0x00003000 /* every 0x4F00 clocks */ -#define IDT_CFG_RXI74 0x00004000 /* every 0x7400 clocks */ -#define IDT_CFG_RAWIE 0x00000800 /* raw cell queue interrupt enable */ -#define IDT_CFG_RQFIE 0x00000400 /* Rx status queue almost full IE */ -#define IDT_CFG_CACHE 0x00000100 /* begin DMA on cache line */ -#define IDT_CFG_TIMOIE 0x00000080 /* timer roll over interrupt enable */ -#define IDT_CFG_FBIE 0x00000040 /* free buffer queue interrupt enable */ -#define IDT_CFG_TXENB 0x00000020 /* Tx enable */ -#define IDT_CFG_TXINT 0x00000010 /* Tx status interrupt enable */ -#define IDT_CFG_TXUIE 0x00000008 /* Tx underrun interrupt enable */ -#define IDT_CFG_UMODE 0x00000004 /* utopia byte mode */ -#define IDT_CFG_TXSFI 0x00000002 /* Tx status full interrupt enable */ -#define IDT_CFG_PHYIE 0x00000001 /* PHY interrupt enable */ - -/* - * Status register (STAT) - */ -#define IDT_STAT_FRAC3(S) (((S) >> 28) & 0xf) /* FBQ3 valid */ -#define IDT_STAT_FRAC2(S) (((S) >> 24) & 0xf) /* FBQ2 valid */ -#define IDT_STAT_FRAC1(S) (((S) >> 20) & 0xf) /* FBQ1 valid */ -#define IDT_STAT_FRAC0(S) (((S) >> 16) & 0xf) /* FBQ0 valid */ -#define IDT_STAT_TSIF 0x00008000 /* Tx status indicator flag */ -#define IDT_STAT_TXICP 0x00004000 /* Tx incomplete PDU */ -#define IDT_STAT_TSQF 0x00001000 /* Tx status queue full */ -#define IDT_STAT_TMROF 0x00000800 /* Timer overflow */ -#define IDT_STAT_PHYI 0x00000400 /* PHY interrupt */ -#define IDT_STAT_CMDBZ 0x00000200 /* command busy */ -#define IDT_STAT_FBQ3A 0x00000100 /* FBQ 3 attention flag */ -#define IDT_STAT_FBQ2A 0x00000080 /* FBQ 2 attention flag */ -#define IDT_STAT_RSQF 0x00000040 /* Rx status queue full */ -#define IDT_STAT_EPDU 0x00000020 /* end of CS-PDU */ -#define IDT_STAT_RAWCF 0x00000010 /* raw cell flag */ -#define IDT_STAT_FBQ1A 0x00000008 /* FBQ 1 attention flag */ -#define IDT_STAT_FBQ0A 0x00000004 /* FBQ 0 attention flag */ -#define IDT_STAT_RSQAF 0x00000002 /* Rx status queue almost full */ - -/* - * Cell drop count (CDC) - */ -#define IDT_CDC_RMID 0x00400000 /* RM cell ID error */ -#define IDT_CDC_CTE 0x00200000 /* Rx connection table error */ -#define IDT_CDC_NFB 0x00100000 /* No free buffers */ -#define IDT_CDC_OAMCRC 0x00080000 /* bad OAM CRC */ -#define IDT_CDC_RMCRC 0x00040000 /* bad RM CRC */ -#define IDT_CDC_RMFIFO 0x00020000 /* RM FIFO full */ -#define IDT_CDC_RXFIFO 0x00010000 /* Rx FIFO full */ -#define IDT_CDC(S) ((S) & 0xffff) /* cell drop counter */ - -/* - * VPI/VCI lookup error count (VPEC) - */ -#define IDT_VPEC(S) ((S) & 0xffff) - -/* - * Invalid cell count (ICC) - */ -#define IDT_ICC(S) ((S) & 0xffff) - -/* - * General purpose register - */ -#define IDT_GP_TXNCC(S) (((S) >> 24) & 0xff) /* Tx negative cell count */ -#define IDT_GP_EEDI 0x00010000 /* EEPROM data in */ -#define IDT_GP_BIGE 0x00008000 /* big endian enable */ -#define IDT_GP_RM 0x00000000 /* process RM cells */ -#define IDT_GP_RM_TEE 0x00002000 /* process RM cells and put in RawQ */ -#define IDT_GP_RM_RAW 0x00006000 /* put RM cells in RawQ */ -#define IDT_GP_DLOOP 0x00001000 /* double loopback */ -#define IDT_GP_PCIPAR 0x00000010 /* force PCI parity error */ -#define IDT_GP_PCIPERR 0x00000020 /* force PERR */ -#define IDT_GP_PCISERR 0x00000040 /* force SERR */ -#define IDT_GP_PHY_RST 0x00000008 /* PHY reset */ -#define IDT_GP_EESCLK 0x00000004 /* EEPROM clock */ -#define IDT_GP_EECS 0x00000002 /* EEPROM chip select */ -#define IDT_GP_EEDO 0x00000001 /* EEPROM data out */ - -/* - * Receive FIFO descriptor register (RXFD) - */ -#define IDT_RXFD(A, S) (((S) << 24) | ((A) << 2)) -#define IDT_RXFDS(V) (((V) >> 24) & 0xf) -#define IDT_RXFDA(V) (((V) & 0x1ffffc) >> 2) - -/* - * ABR & VBR schedule table descriptor register - */ -#define IDT_ABRSTD(A, S) (((S) << 24) | ((A) << 2)) -#define IDT_ABRSTDS(V) (((V) >> 24) & 0x7) -#define IDT_ABRSTDA(V) (((V) & 0x1ffffc) >> 2) - -/* - * ABR/VBR ready queue register - */ -#define IDT_ABRRQH(V) (((V) >> 16) & 0x3fff) -#define IDT_ABRRQT(V) (((V) >> 0) & 0x3fff) -#define IDT_VBRRQH(V) (((V) >> 16) & 0x3fff) -#define IDT_VBRRQT(V) (((V) >> 0) & 0x3fff) - -/* - * Maximum deficit limit register - */ -#define IDT_MDFCT_LCI 0x00020000 /* local congestion indicator enable */ -#define IDT_MDFCT_LNI 0x00010000 /* local no incread enable */ - -/* - * Transmit command queue register - */ -#define IDT_TCMDQ_NOP() ((0x0 << 24)) /* no operation */ -#define IDT_TCMDQ_START(C) ((0x1 << 24) | (C)) /* start connection */ -#define IDT_TCMDQ_ULACR(C, L) ((0x2 << 24) | (C) | ((L) << 16)) - /* update LACR */ -#define IDT_TCMDQ_SLACR(C, L) ((0x3 << 24) | (C) | ((L) << 16)) - /* start and update LACR */ -#define IDT_TCMDQ_UIER(C, L) ((0x4 << 24) | (C) | ((L) << 16)) - /* update Int ER */ -#define IDT_TCMDQ_HALT(C) ((0x5 << 24) | (C)) /* halt connection */ - -/* - * Free buffer queue size registers - */ -#define IDT_FBQS(T, N, C, S) (((T) << 28) | ((N) << 24) | ((C) << 20) | (S)) - -/* - * Receive status queue - */ -struct idt_rsqe { - uint32_t cid; /* VPI/VCI */ - uint32_t handle; /* buffer handle */ - uint32_t crc; /* AAL-5 CRC */ - uint32_t stat; /* div. flags */ -}; -#define IDT_RSQE_SIZE 16 /* bytes */ -#define IDT_RSQE_VPI(CID) (((CID) >> 16) & 0xff) -#define IDT_RSQE_VCI(CID) ((CID) & 0xffff) -#define IDT_RSQE_TYPE(S) (((S) >> 30) & 0x3) -#define IDT_RSQE_DATA 0x2 -#define IDT_RSQE_IDLE 0x3 -#define IDT_RSQE_VALID 0x80000000 -#define IDT_RSQE_POOL(S) (((S) >> 16) & 0x3) -#define IDT_RSQE_BUF 0x8000 -#define IDT_RSQE_NZGFC 0x4000 -#define IDT_RSQE_EPDU 0x2000 -#define IDT_RSQE_CBUF 0x1000 -#define IDT_RSQE_EFCIE 0x0800 -#define IDT_RSQE_CLP 0x0400 -#define IDT_RSQE_CRC 0x0200 -#define IDT_RSQE_CNT(S) ((S) & 0x1ff) - -#define IDT_RSQH(R) (((R) & 0x1ffc) >> 2) -#define IDT_RSQT(R) (((R) & 0x1ffc) >> 2) - -/* - * Transmit status queue - */ -#define IDT_TSQ_SIZE 1024 /* no. of entries */ -#define IDT_TSQE_SIZE 8 /* bytes */ -#define IDT_TSQE_SHIFT 3 -struct idt_tsqe { - uint32_t stat; - uint32_t stamp; -}; -#define IDT_TSQE_EMPTY 0x80000000 -#define IDT_TSQE_TYPE(E) (((E) >> 29) & 0x3) -#define IDT_TSQE_TIMER 0x0 -#define IDT_TSQE_TSR 0x1 -#define IDT_TSQE_IDLE 0x2 -#define IDT_TSQE_TBD 0x3 -#define IDT_TSQE_TAG(E) (((E) >> 24) & 0x1f) -#define IDT_TSQE_HALTED 0x10 -#define IDT_TSQE_STAMP(E) ((E) & 0xffffff) -#define IDT_TSQE_TAG_SPACE 32 - -/* - * Raw cell handle - */ -struct idt_rawhnd { - uint32_t tail; - uint32_t handle; -}; -#define IDT_RAWHND_SIZE 8 - -/* - * TST - */ -#define IDT_TST_NULL (0 << 29) /* transmit NULL cell */ -#define IDT_TST_CBR (1 << 29) /* transmit CBR cell */ -#define IDT_TST_VBR (2 << 29) /* transmit [AVU]BR cell */ -#define IDT_TST_BR (3 << 29) /* branch */ -#define IDT_TST_MASK 0x7ffff - -/* - * Free buffer queue - */ -#define IDT_FBQ_SIZE 512 /* entries */ - -/* - * Receive connection table - */ -#define IDT_RCT_FBP2 0x00400000 /* use FBQ 2 */ -#define IDT_RCT_OPEN 0x00080000 /* connection open */ -#define IDT_RCT_AAL0 0x00000000 /* AAL 0 */ -#define IDT_RCT_AAL34 0x00010000 /* AAL 3/4 */ -#define IDT_RCT_AAL5 0x00020000 /* AAL 5 */ -#define IDT_RCT_AALRAW 0x00030000 /* raw cells */ -#define IDT_RCT_AALOAM 0x00040000 /* OAM cells */ -#define IDT_RCT_RCI 0x00008000 /* raw cell interrupt enable */ -#define IDT_RCT_IACT_CNT_MASK 0x1c000000 -#define IDT_RCT_IACT_CNT_SHIFT 26 -#define IDT_RCT_ENTRY_SIZE 4 /* words */ - -/* - * Transmit connection table - */ -#define IDT_TCT_CBR 0x00000000 -#define IDT_TCT_VBR 0x40000000 -#define IDT_TCT_ABR 0x80000000 -#define IDT_TCT_UBR 0x00000000 -#define IDT_TCT_UBR_FLG 0x80000000 /* word8 flag */ -#define IDT_TCT_HALT 0x80000000 /* connection halted */ -#define IDT_TCT_IDLE 0x40000000 /* connection idle */ -#define IDT_TCT_TSIF 0x00004000 -#define IDT_TCT_MAXIDLE 0x7f000000 -#define IDT_TCT_MBS_SHIFT 16 -#define IDT_TCT_CRM_SHIFT 29 -#define IDT_TCT_NAGE_SHIFT 21 -#define IDT_TCT_LMCR_SHIFT 24 -#define IDT_TCT_CDF_SHIFT 20 -#define IDT_TCT_RDF_SHIFT 14 -#define IDT_TCT_AIR_SHIFT 8 -#define IDT_TCT_ACRI_SHIFT 16 - -/* - * Segmentation channel queue - */ -#define IDT_SCQ_SIZE 64 /* number of entries */ -struct idt_tbd { - uint32_t flags; - uint32_t addr; - uint32_t aal5; - uint32_t hdr; -}; -#define IDT_TBD_SIZE 16 /* bytes */ -#define IDT_TBD_SHIFT 4 -#define IDT_TBD_TSR 0x80000000 /* TSR entry */ -#define IDT_TBD_EPDU 0x40000000 /* end of AAL PDU */ -#define IDT_TBD_TSIF 0x20000000 /* generate status */ -#define IDT_TBD_AAL0 0x00000000 /* AAL0 */ -#define IDT_TBD_AAL34 0x04000000 /* AAL3/4 */ -#define IDT_TBD_AAL5 0x08000000 /* AAL5 */ -#define IDT_TBD_AALOAM 0x10000000 /* OAM cells */ -#define IDT_TBD_GTSI 0x02000000 /* generate transmit status entry */ -#define IDT_TBD_TAG_SHIFT 20 -#define IDT_TBD_HDR(VPI, VCI, PTI, CLP) \ - (((VPI) << 20) | ((VCI) << 4) | ((PTI) << 1) | (CLP)) -#define IDT_TBD_VPI(H) (((H) >> 20) & 0xff) -#define IDT_TBD_VCI(H) (((H) >> 4) & 0xffff) - -/* - * Segmentation channel descriptor - */ -#define IDT_SCD_SIZE 12 /* words */ - -/* - * Memory map for the different RAM sizes - * - * 16k 32k 128k 512k - * - * TxCT 0x00000/4k 0x00000/8x 0x00000/32k 0x00000/128k - * RxCT 0x01000/2k 0x02000/4k 0x08000/16k 0x20000/64k - * FBQ0 0x01800/1k 0x03000/1k 0x0c000/1k 0x30000/1k - * FBQ1 0x01c00/1k 0x03400/1k 0x0c400/1k 0x30400/1k - * FBQ2 0x02000/1k 0x03800/1k 0x0c800/1k 0x30800/1k - * FBQ3 - - - - - * RT 0x02400/4.5k 0x03c00/4.5k 0x0cc00/4.5k 0x30c00/4.5k - * SCD 0x03600/597 0x04e00/1621 0x0de00/9358 0x31e00/43036 - * TST 0x06000/2x2k 0x0c000/2x4k 0x37000/2x8k 0xef000/2x16k - * ABR ST 0x07000/2x1k 0x0e000/2x2k 0x3b000/2x8k 0xf7000/2x16k - * RxFIFO 0x07800/2k 0x0f000/4k 0x3f000/4k 0xff000/4k - * End 0x08000 0x10000 0x40000 0x100000 - */ -struct idt_mmap { - u_int sram; /* K SRAM */ - u_int max_conn; /* connections */ - u_int vcbits; /* VPI + VCI bits */ - u_int rxtab; /* CFG word for CNTBL field */ - u_int rct; /* RCT base */ - u_int rtables; /* rate table address */ - u_int scd_base; /* SCD area base address */ - u_int scd_num; /* number of SCDs */ - u_int tst1base; /* base address of TST 1 */ - u_int tst_size; /* TST size in words */ - u_int abrstd_addr; /* schedule table address */ - u_int abrstd_size; /* schedule table size */ - u_int abrstd_code; /* schedule table size */ - u_int rxfifo_addr; /* address */ - u_int rxfifo_size; /* in words */ - u_int rxfifo_code; /* size */ -}; -#define IDT_MMAP { \ - { /* 16k x 32, 512 connections */ \ - 16, 512, 9, IDT_CFG_CTS512, /* RAM, connections, VC bits */ \ - 0x01000, /* RCT base */ \ - 0x02400, /* rate table address */ \ - 0x03600, 597, /* SCD base and num */ \ - 0x06000, 2048, /* TST/words, base */ \ - 0x07000, 2048, 0x1, /* ABR schedule table */ \ - 0x07800, 2048, 0x2 /* RxFIFO size in words */ \ - }, \ - { /* 32k x 32, 1024 connections */ \ - 32, 1024, 10, IDT_CFG_CTS1K, /* RAM, connections, VC bits */ \ - 0x02000, /* RCT base */ \ - 0x03c00, /* rate table address */ \ - 0x04e00, 1621, /* SCD base and num */ \ - 0x0c000, 4096, /* TST/words, base */ \ - 0x0e000, 4096, 0x2, /* ABR schedule table */ \ - 0x0f000, 4096, 0x3 /* RxFIFO size in words */ \ - }, \ - { /* 128k x 32, 4096 connections */ \ - 128, 4096, 12, IDT_CFG_CTS4K, /* RAM, connections, VC bits */ \ - 0x08000, /* RCT base */ \ - 0x0cc00, /* rate table address */ \ - 0x0de00, 9358, /* SCD base and num */ \ - 0x37000, 8192, /* TST/words, base */ \ - 0x3b000, 16384, 0x4, /* ABR schedule table */ \ - 0x3f000, 4096, 0x3 /* RxFIFO size in words */ \ - }, \ - { /* 512k x 32, 512 connections */ \ - 512, 16384, 14, IDT_CFG_CTS16K, /* RAM, connections, VC bits */\ - 0x20000, /* RCT base */ \ - 0x30c00, /* rate table address */ \ - 0x31e00, 43036, /* SCD base and num */ \ - 0xef000, 16384, /* TST/words, base */ \ - 0xf7000, 16384, 0x5, /* ABR schedule table */ \ - 0xff000, 4096, 0x3 /* RxFIFO size in words */ \ - }, \ -} diff --git a/sys/dev/patm/if_patm.c b/sys/dev/patm/if_patm.c deleted file mode 100644 index a09eeea151ff..000000000000 --- a/sys/dev/patm/if_patm.c +++ /dev/null @@ -1,512 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -static void patm_tst_init(struct patm_softc *sc); -static void patm_scd_init(struct patm_softc *sc); - -/* - * Start the card. This assumes the mutex to be held - */ -void -patm_initialize(struct patm_softc *sc) -{ - uint32_t cfg; - u_int i; - - patm_debug(sc, ATTACH, "configuring..."); - - /* clear SRAM */ - for (i = 0; i < sc->mmap->sram * 1024; i += 4) - patm_sram_write4(sc, i, 0, 0, 0, 0); - patm_scd_init(sc); - - /* configuration register. Setting NOIDLE makes the timing wrong! */ - cfg = IDT_CFG_TXFIFO9 | IDT_CFG_RXQ512 | PATM_CFG_VPI | - /* IDT_CFG_NOIDLE | */ sc->mmap->rxtab; - if (!(sc->flags & PATM_UNASS)) - cfg |= IDT_CFG_IDLECLP; - patm_nor_write(sc, IDT_NOR_CFG, cfg); - - /* clean all the status queues and the Raw handle */ - memset(sc->tsq, 0, sc->sq_size); - - /* initialize RSQ */ - patm_debug(sc, ATTACH, "RSQ %llx", (unsigned long long)sc->rsq_phy); - patm_nor_write(sc, IDT_NOR_RSQB, sc->rsq_phy); - patm_nor_write(sc, IDT_NOR_RSQT, sc->rsq_phy); - patm_nor_write(sc, IDT_NOR_RSQH, 0); - sc->rsq_last = PATM_RSQ_SIZE - 1; - - /* initialize TSTB */ - patm_nor_write(sc, IDT_NOR_TSTB, sc->mmap->tst1base << 2); - patm_tst_init(sc); - - /* initialize TSQ */ - for (i = 0; i < IDT_TSQ_SIZE; i++) - sc->tsq[i].stamp = htole32(IDT_TSQE_EMPTY); - patm_nor_write(sc, IDT_NOR_TSQB, sc->tsq_phy); - patm_nor_write(sc, IDT_NOR_TSQH, 0); - patm_nor_write(sc, IDT_NOR_TSQT, 0); - sc->tsq_next = sc->tsq; - - /* GP */ -#if BYTE_ORDER == BIG_ENDIAN && 0 - patm_nor_write(sc, IDT_NOR_GP, IDT_GP_BIGE); -#else - patm_nor_write(sc, IDT_NOR_GP, 0); -#endif - - /* VPM */ - patm_nor_write(sc, IDT_NOR_VPM, 0); - - /* RxFIFO */ - patm_nor_write(sc, IDT_NOR_RXFD, - IDT_RXFD(sc->mmap->rxfifo_addr, sc->mmap->rxfifo_code)); - patm_nor_write(sc, IDT_NOR_RXFT, 0); - patm_nor_write(sc, IDT_NOR_RXFH, 0); - - /* RAWHND */ - patm_debug(sc, ATTACH, "RWH %llx", - (unsigned long long)sc->rawhnd_phy); - patm_nor_write(sc, IDT_NOR_RAWHND, sc->rawhnd_phy); - - /* ABRSTD */ - patm_nor_write(sc, IDT_NOR_ABRSTD, - IDT_ABRSTD(sc->mmap->abrstd_addr, sc->mmap->abrstd_code)); - for (i = 0; i < sc->mmap->abrstd_size; i++) - patm_sram_write(sc, sc->mmap->abrstd_addr + i, 0); - patm_nor_write(sc, IDT_NOR_ABRRQ, 0); - patm_nor_write(sc, IDT_NOR_VBRRQ, 0); - - /* rate tables */ - if (sc->flags & PATM_25M) { - for (i = 0; i < patm_rtables_size; i++) - patm_sram_write(sc, sc->mmap->rtables + i, - patm_rtables25[i]); - } else { - for (i = 0; i < patm_rtables_size; i++) - patm_sram_write(sc, sc->mmap->rtables + i, - patm_rtables155[i]); - } - patm_nor_write(sc, IDT_NOR_RTBL, sc->mmap->rtables << 2); - - /* Maximum deficit */ - patm_nor_write(sc, IDT_NOR_MXDFCT, 32 | IDT_MDFCT_LCI | IDT_MDFCT_LNI); - - /* Free buffer queues */ - patm_nor_write(sc, IDT_NOR_FBQP0, 0); - patm_nor_write(sc, IDT_NOR_FBQP1, 0); - patm_nor_write(sc, IDT_NOR_FBQP2, 0); - patm_nor_write(sc, IDT_NOR_FBQP3, 0); - - patm_nor_write(sc, IDT_NOR_FBQWP0, 0); - patm_nor_write(sc, IDT_NOR_FBQWP1, 0); - patm_nor_write(sc, IDT_NOR_FBQWP2, 0); - patm_nor_write(sc, IDT_NOR_FBQWP3, 0); - - patm_nor_write(sc, IDT_NOR_FBQS0, - (SMBUF_THRESHOLD << 28) | - (SMBUF_NI_THRESH << 24) | - (SMBUF_CI_THRESH << 20) | - SMBUF_CELLS); - patm_nor_write(sc, IDT_NOR_FBQS1, - (LMBUF_THRESHOLD << 28) | - (LMBUF_NI_THRESH << 24) | - (LMBUF_CI_THRESH << 20) | - LMBUF_CELLS); - patm_nor_write(sc, IDT_NOR_FBQS2, - (VMBUF_THRESHOLD << 28) | VMBUF_CELLS); - patm_nor_write(sc, IDT_NOR_FBQS3, 0); - - /* make SCD0 for UBR0 */ - if ((sc->scd0 = patm_scd_alloc(sc)) == NULL) { - patm_printf(sc, "cannot create UBR0 SCD\n"); - patm_reset(sc); - return; - } - sc->scd0->q.ifq_maxlen = PATM_DLFT_MAXQ; - - patm_scd_setup(sc, sc->scd0); - patm_tct_setup(sc, sc->scd0, NULL); - - patm_debug(sc, ATTACH, "go..."); - - sc->utopia.flags &= ~UTP_FL_POLL_CARRIER; - sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; - - /* enable interrupts, Tx and Rx paths */ - cfg |= IDT_CFG_RXPTH | IDT_CFG_RXIIMM | IDT_CFG_RAWIE | IDT_CFG_RQFIE | - IDT_CFG_TIMOIE | IDT_CFG_FBIE | IDT_CFG_TXENB | IDT_CFG_TXINT | - IDT_CFG_TXUIE | IDT_CFG_TXSFI | IDT_CFG_PHYIE; - patm_nor_write(sc, IDT_NOR_CFG, cfg); - - for (i = 0; i < sc->mmap->max_conn; i++) - if (sc->vccs[i] != NULL) - patm_load_vc(sc, sc->vccs[i], 1); - - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); -} - -/* - * External callable start function - */ -void -patm_init(void *p) -{ - struct patm_softc *sc = p; - - mtx_lock(&sc->mtx); - patm_stop(sc); - patm_initialize(sc); - mtx_unlock(&sc->mtx); -} - -/* - * Stop the interface - */ -void -patm_stop(struct patm_softc *sc) -{ - u_int i; - struct mbuf *m; - struct patm_txmap *map; - struct patm_scd *scd; - - sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - sc->utopia.flags |= UTP_FL_POLL_CARRIER; - - patm_reset(sc); - - mtx_lock(&sc->tst_lock); - i = sc->tst_state; - sc->tst_state = 0; - callout_stop(&sc->tst_callout); - mtx_unlock(&sc->tst_lock); - - if (i != 0) { - /* this means we are just entering or leaving the timeout. - * wait a little bit. Doing this correctly would be more - * involved */ - DELAY(1000); - } - - /* - * Give any waiters on closing a VCC a chance. They will stop - * to wait if they see that IFF_DRV_RUNNING disappeared. - */ - cv_broadcast(&sc->vcc_cv); - - /* free large buffers */ - patm_debug(sc, ATTACH, "freeing large buffers..."); - for (i = 0; i < sc->lbuf_max; i++) - if (sc->lbufs[i].m != NULL) - patm_lbuf_free(sc, &sc->lbufs[i]); - - /* free small buffers that are on the card */ - patm_debug(sc, ATTACH, "freeing small buffers..."); - mbp_card_free(sc->sbuf_pool); - - /* free aal0 buffers that are on the card */ - patm_debug(sc, ATTACH, "freeing aal0 buffers..."); - mbp_card_free(sc->vbuf_pool); - - /* freeing partial receive chains and reset vcc state */ - for (i = 0; i < sc->mmap->max_conn; i++) { - if (sc->vccs[i] != NULL) { - if (sc->vccs[i]->chain != NULL) { - m_freem(sc->vccs[i]->chain); - sc->vccs[i]->chain = NULL; - sc->vccs[i]->last = NULL; - } - - if (sc->vccs[i]->vflags & (PATM_VCC_RX_CLOSING | - PATM_VCC_TX_CLOSING)) { - uma_zfree(sc->vcc_zone, sc->vccs[i]); - sc->vccs[i] = NULL; - } else { - /* keep */ - sc->vccs[i]->vflags &= ~PATM_VCC_OPEN; - sc->vccs[i]->cps = 0; - sc->vccs[i]->scd = NULL; - } - } - } - - /* stop all active SCDs */ - while ((scd = LIST_FIRST(&sc->scd_list)) != NULL) { - /* free queue packets */ - for (;;) { - _IF_DEQUEUE(&scd->q, m); - if (m == NULL) - break; - m_freem(m); - } - - /* free transmitting packets */ - for (i = 0; i < IDT_TSQE_TAG_SPACE; i++) { - if ((m = scd->on_card[i]) != NULL) { - scd->on_card[i] = 0; - map = m->m_pkthdr.PH_loc.ptr; - - bus_dmamap_unload(sc->tx_tag, map->map); - SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); - m_freem(m); - } - } - patm_scd_free(sc, scd); - } - sc->scd0 = NULL; - - sc->flags &= ~PATM_CLR; - - /* reset raw cell queue */ - sc->rawh = NULL; - - ATMEV_SEND_IFSTATE_CHANGED(IFP2IFATM(sc->ifp), - sc->utopia.carrier == UTP_CARR_OK); -} - -/* - * Stop the card and reset it - */ -void -patm_reset(struct patm_softc *sc) -{ - - patm_debug(sc, ATTACH, "resetting..."); - - patm_nor_write(sc, IDT_NOR_CFG, IDT_CFG_SWRST); - DELAY(200); - patm_nor_write(sc, IDT_NOR_CFG, 0); - DELAY(200); - - patm_nor_write(sc, IDT_NOR_RSQH, 0); - patm_nor_write(sc, IDT_NOR_TSQH, 0); - - patm_nor_write(sc, IDT_NOR_GP, IDT_GP_PHY_RST); - DELAY(50); - patm_nor_write(sc, IDT_NOR_GP, IDT_GP_EEDO | IDT_GP_EECS); - DELAY(50); -} - -/* - * Initialize the soft TST to contain only ABR scheduling and - * write it to SRAM - */ -static void -patm_tst_init(struct patm_softc *sc) -{ - u_int i; - u_int base, idle; - - base = sc->mmap->tst1base; - idle = sc->mmap->tst1base + sc->mmap->tst_size; - - /* soft */ - for (i = 0; i < sc->mmap->tst_size - 1; i++) - sc->tst_soft[i] = IDT_TST_VBR; - - sc->tst_state = 0; - sc->tst_jump[0] = base + sc->mmap->tst_size - 1; - sc->tst_jump[1] = idle + sc->mmap->tst_size - 1; - sc->tst_base[0] = base; - sc->tst_base[1] = idle; - - /* TST1 */ - for (i = 0; i < sc->mmap->tst_size - 1; i++) - patm_sram_write(sc, base + i, IDT_TST_VBR); - patm_sram_write(sc, sc->tst_jump[0], IDT_TST_BR | (base << 2)); - - /* TST2 */ - for (i = 0; i < sc->mmap->tst_size - 1; i++) - patm_sram_write(sc, idle + i, IDT_TST_VBR); - patm_sram_write(sc, sc->tst_jump[1], IDT_TST_BR | (idle << 2)); - - sc->tst_free = sc->mmap->tst_size - 1; - sc->tst_reserve = sc->tst_free * PATM_TST_RESERVE / 100; - sc->bwrem = IFP2IFATM(sc->ifp)->mib.pcr; -} - -/* - * Initialize the SCDs. This is done by building a list of all free - * SCDs in SRAM. The first word of each potential SCD is used as a - * link to the next free SCD. The list is rooted in softc. - */ -static void -patm_scd_init(struct patm_softc *sc) -{ - u_int s; /* SRAM address of current SCD */ - - sc->scd_free = 0; - for (s = sc->mmap->scd_base; s + 12 <= sc->mmap->tst1base; s += 12) { - patm_sram_write(sc, s, sc->scd_free); - sc->scd_free = s; - } -} - -/* - * allocate an SCQ - */ -struct patm_scd * -patm_scd_alloc(struct patm_softc *sc) -{ - u_int sram, next; /* SRAM address of this and next SCD */ - int error; - void *p; - struct patm_scd *scd; - bus_dmamap_t map; - bus_addr_t phy; - - /* get an SCD from the free list */ - if ((sram = sc->scd_free) == 0) - return (NULL); - next = patm_sram_read(sc, sram); - - /* allocate memory for the queue and our host stuff */ - error = bus_dmamem_alloc(sc->scd_tag, &p, BUS_DMA_NOWAIT, &map); - if (error != 0) - return (NULL); - phy = 0x3ff; - error = bus_dmamap_load(sc->scd_tag, map, p, sizeof(scd->scq), - patm_load_callback, &phy, BUS_DMA_NOWAIT); - if (error != 0) { - bus_dmamem_free(sc->scd_tag, p, map); - return (NULL); - } - KASSERT((phy & 0x1ff) == 0, ("SCD not aligned %lx", (u_long)phy)); - - scd = p; - bzero(scd, sizeof(*scd)); - - scd->sram = sram; - scd->phy = phy; - scd->map = map; - scd->space = IDT_SCQ_SIZE; - scd->last_tag = IDT_TSQE_TAG_SPACE - 1; - scd->q.ifq_maxlen = PATM_TX_IFQLEN; - - /* remove the scd from the free list */ - sc->scd_free = next; - LIST_INSERT_HEAD(&sc->scd_list, scd, link); - - return (scd); -} - -/* - * Free an SCD - */ -void -patm_scd_free(struct patm_softc *sc, struct patm_scd *scd) -{ - - LIST_REMOVE(scd, link); - - /* clear SCD and insert link word */ - patm_sram_write4(sc, scd->sram, sc->scd_free, 0, 0, 0); - patm_sram_write4(sc, scd->sram, 0, 0, 0, 0); - patm_sram_write4(sc, scd->sram, 0, 0, 0, 0); - - /* put on free list */ - sc->scd_free = scd->sram; - - /* free memory */ - bus_dmamap_unload(sc->scd_tag, scd->map); - bus_dmamem_free(sc->scd_tag, scd, scd->map); -} - -/* - * DMA loading helper function. This function handles the loading of - * all one segment DMA maps. The argument is a pointer to a bus_addr_t - * which must contain the desired alignment of the address as a bitmap. - */ -void -patm_load_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error) -{ - bus_addr_t *phy = arg; - - if (error) - return; - - KASSERT(nsegs == 1, - ("too many segments for DMA: %d", nsegs)); - KASSERT(segs[0].ds_addr <= 0xffffffffUL, - ("phys addr too large %lx", (u_long)segs[0].ds_addr)); - KASSERT((segs[0].ds_addr & *phy) == 0, - ("bad alignment %lx:%lx", (u_long)segs[0].ds_addr, (u_long)*phy)); - - *phy = segs[0].ds_addr; -} diff --git a/sys/dev/patm/if_patm_attach.c b/sys/dev/patm/if_patm_attach.c deleted file mode 100644 index 8d936bbeb374..000000000000 --- a/sys/dev/patm/if_patm_attach.c +++ /dev/null @@ -1,1076 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -MODULE_DEPEND(patm, utopia, 1, 1, 1); -MODULE_DEPEND(patm, pci, 1, 1, 1); -MODULE_DEPEND(patm, atm, 1, 1, 1); -MODULE_DEPEND(patm, libmbpool, 1, 1, 1); - -devclass_t patm_devclass; - -static int patm_probe(device_t dev); -static int patm_attach(device_t dev); -static int patm_detach(device_t dev); -static device_method_t patm_methods[] = { - DEVMETHOD(device_probe, patm_probe), - DEVMETHOD(device_attach, patm_attach), - DEVMETHOD(device_detach, patm_detach), - {0,0} -}; -static driver_t patm_driver = { - "patm", - patm_methods, - sizeof(struct patm_softc), -}; -DRIVER_MODULE(patm, pci, patm_driver, patm_devclass, NULL, 0); - -static const struct { - u_int devid; - const char *desc; -} devs[] = { - { PCI_DEVICE_IDT77252, "NICStAR (77222/77252) ATM adapter" }, - { PCI_DEVICE_IDT77v252, "NICStAR (77v252) ATM adapter" }, - { PCI_DEVICE_IDT77v222, "NICStAR (77v222) ATM adapter" }, - { 0, NULL } -}; - -SYSCTL_DECL(_hw_atm); - -static int patm_phy_readregs(struct ifatm *, u_int, uint8_t *, u_int *); -static int patm_phy_writereg(struct ifatm *, u_int, u_int, u_int); -static const struct utopia_methods patm_utopia_methods = { - patm_phy_readregs, - patm_phy_writereg -}; - -static void patm_destroy(struct patm_softc *sc); - -static int patm_sysctl_istats(SYSCTL_HANDLER_ARGS); -static int patm_sysctl_eeprom(SYSCTL_HANDLER_ARGS); - -static void patm_read_eeprom(struct patm_softc *sc); -static int patm_sq_init(struct patm_softc *sc); -static int patm_rbuf_init(struct patm_softc *sc); -static int patm_txmap_init(struct patm_softc *sc); - -static void patm_env_getuint(struct patm_softc *, u_int *, const char *); - -#ifdef PATM_DEBUG -static int patm_sysctl_regs(SYSCTL_HANDLER_ARGS); -static int patm_sysctl_tsq(SYSCTL_HANDLER_ARGS); -int patm_dump_vc(u_int unit, u_int vc) __unused; -int patm_dump_regs(u_int unit) __unused; -int patm_dump_sram(u_int unit, u_int from, u_int words) __unused; -#endif - -/* - * Probe for a IDT77252 controller - */ -static int -patm_probe(device_t dev) -{ - u_int i; - - if (pci_get_vendor(dev) == PCI_VENDOR_IDT) { - for (i = 0; devs[i].desc != NULL; i++) - if (pci_get_device(dev) == devs[i].devid) { - device_set_desc(dev, devs[i].desc); - return (BUS_PROBE_DEFAULT); - } - } - return (ENXIO); -} - -/* - * Attach - */ -static int -patm_attach(device_t dev) -{ - struct patm_softc *sc; - int error; - struct ifnet *ifp; - int rid; - u_int a; - - static const struct idt_mmap idt_mmap[4] = IDT_MMAP; - - sc = device_get_softc(dev); - - sc->dev = dev; -#ifdef IATM_DEBUG - sc->debug = IATM_DEBUG; -#endif - ifp = sc->ifp = if_alloc(IFT_ATM); - if (ifp == NULL) { - return (ENOSPC); - } - - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_IDTABR25; - IFP2IFATM(sc->ifp)->mib.serial = 0; - IFP2IFATM(sc->ifp)->mib.hw_version = 0; - IFP2IFATM(sc->ifp)->mib.sw_version = 0; - IFP2IFATM(sc->ifp)->mib.vpi_bits = PATM_VPI_BITS; - IFP2IFATM(sc->ifp)->mib.vci_bits = 0; /* set below */ - IFP2IFATM(sc->ifp)->mib.max_vpcs = 0; - IFP2IFATM(sc->ifp)->mib.max_vccs = 0; /* set below */ - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UNKNOWN; - IFP2IFATM(sc->ifp)->phy = &sc->utopia; - - ifp->if_softc = sc; - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_flags = IFF_SIMPLEX; - ifp->if_init = patm_init; - ifp->if_ioctl = patm_ioctl; - ifp->if_start = patm_start; - - /* do this early so we can destroy unconditionally */ - mtx_init(&sc->mtx, device_get_nameunit(dev), - MTX_NETWORK_LOCK, MTX_DEF); - mtx_init(&sc->tst_lock, "tst lock", NULL, MTX_DEF); - cv_init(&sc->vcc_cv, "vcc_close"); - - callout_init(&sc->tst_callout, 1); - - sysctl_ctx_init(&sc->sysctl_ctx); - - /* - * Get revision - */ - sc->revision = pci_read_config(dev, PCIR_REVID, 4) & 0xf; - - /* - * Enable PCI bus master and memory - */ - pci_enable_busmaster(dev); - - rid = IDT_PCI_REG_MEMBASE; - sc->memres = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->memres == NULL) { - patm_printf(sc, "could not map memory\n"); - error = ENXIO; - goto fail; - } - sc->memh = rman_get_bushandle(sc->memres); - sc->memt = rman_get_bustag(sc->memres); - - /* - * Allocate the interrupt (enable it later) - */ - sc->irqid = 0; - sc->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqid, - RF_SHAREABLE | RF_ACTIVE); - if (sc->irqres == 0) { - patm_printf(sc, "could not allocate irq\n"); - error = ENXIO; - goto fail; - } - - /* - * Construct the sysctl tree - */ - error = ENOMEM; - if ((sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw_atm), OID_AUTO, - device_get_nameunit(dev), CTLFLAG_RD, 0, "")) == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "istats", CTLTYPE_OPAQUE | CTLFLAG_RD, sc, 0, - patm_sysctl_istats, "S", "internal statistics") == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "eeprom", CTLTYPE_OPAQUE | CTLFLAG_RD, sc, 0, - patm_sysctl_eeprom, "S", "EEPROM contents") == NULL) - goto fail; - - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "lbuf_max", CTLFLAG_RD, &sc->lbuf_max, - 0, "maximum number of large receive buffers") == NULL) - goto fail; - patm_env_getuint(sc, &sc->lbuf_max, "lbuf_max"); - - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "max_txmaps", CTLFLAG_RW, &sc->tx_maxmaps, - 0, "maximum number of TX DMA maps") == NULL) - goto fail; - patm_env_getuint(sc, &sc->tx_maxmaps, "tx_maxmaps"); - -#ifdef PATM_DEBUG - if (SYSCTL_ADD_UINT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "debug", CTLFLAG_RW, &sc->debug, - 0, "debug flags") == NULL) - goto fail; - sc->debug = PATM_DEBUG; - patm_env_getuint(sc, &sc->debug, "debug"); - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "regs", CTLTYPE_OPAQUE | CTLFLAG_RD, sc, 0, - patm_sysctl_regs, "S", "registers") == NULL) - goto fail; - - if (SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - OID_AUTO, "tsq", CTLTYPE_OPAQUE | CTLFLAG_RD, sc, 0, - patm_sysctl_tsq, "S", "TSQ") == NULL) - goto fail; -#endif - - patm_reset(sc); - - /* - * Detect and attach the phy. - */ - patm_debug(sc, ATTACH, "attaching utopia"); - IFP2IFATM(sc->ifp)->phy = &sc->utopia; - utopia_attach(&sc->utopia, IFP2IFATM(sc->ifp), &sc->media, &sc->mtx, - &sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree), - &patm_utopia_methods); - - /* - * Start the PHY because we need the autodetection - */ - patm_debug(sc, ATTACH, "starting utopia"); - mtx_lock(&sc->mtx); - utopia_start(&sc->utopia); - utopia_reset(&sc->utopia); - mtx_unlock(&sc->mtx); - - /* Read EEPROM */ - patm_read_eeprom(sc); - - /* analyze it */ - if (strncmp(sc->eeprom + PATM_PROATM_NAME_OFFSET, PATM_PROATM_NAME, - strlen(PATM_PROATM_NAME)) == 0) { - if (sc->utopia.chip->type == UTP_TYPE_IDT77105) { - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_PROATM25; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_25_6M; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UTP_25; - sc->flags |= PATM_25M; - patm_printf(sc, "ProATM 25 interface; "); - - } else { - /* cannot really know which media */ - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_PROATM155; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_155; - patm_printf(sc, "ProATM 155 interface; "); - } - - bcopy(sc->eeprom + PATM_PROATM_MAC_OFFSET, IFP2IFATM(sc->ifp)->mib.esi, - sizeof(IFP2IFATM(sc->ifp)->mib.esi)); - - } else { - if (sc->utopia.chip->type == UTP_TYPE_IDT77105) { - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_IDTABR25; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_25_6M; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_UTP_25; - sc->flags |= PATM_25M; - patm_printf(sc, "IDT77252 25MBit interface; "); - - } else { - /* cannot really know which media */ - IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_IDTABR155; - IFP2IFATM(sc->ifp)->mib.pcr = ATM_RATE_155M; - IFP2IFATM(sc->ifp)->mib.media = IFM_ATM_MM_155; - patm_printf(sc, "IDT77252 155MBit interface; "); - } - - bcopy(sc->eeprom + PATM_IDT_MAC_OFFSET, IFP2IFATM(sc->ifp)->mib.esi, - sizeof(IFP2IFATM(sc->ifp)->mib.esi)); - } - printf("idt77252 Rev. %c; %s PHY\n", 'A' + sc->revision, - sc->utopia.chip->name); - - utopia_reset_media(&sc->utopia); - utopia_init_media(&sc->utopia); - - /* - * Determine RAM size - */ - for (a = 0; a < 0x20000; a++) - patm_sram_write(sc, a, 0); - patm_sram_write(sc, 0, 0xdeadbeef); - if (patm_sram_read(sc, 0x4004) == 0xdeadbeef) - sc->mmap = &idt_mmap[0]; - else if (patm_sram_read(sc, 0x8000) == 0xdeadbeef) - sc->mmap = &idt_mmap[1]; - else if (patm_sram_read(sc, 0x20000) == 0xdeadbeef) - sc->mmap = &idt_mmap[2]; - else - sc->mmap = &idt_mmap[3]; - - IFP2IFATM(sc->ifp)->mib.vci_bits = sc->mmap->vcbits - IFP2IFATM(sc->ifp)->mib.vpi_bits; - IFP2IFATM(sc->ifp)->mib.max_vccs = sc->mmap->max_conn; - patm_sram_write(sc, 0, 0); - patm_printf(sc, "%uK x 32 SRAM; %u connections\n", sc->mmap->sram, - sc->mmap->max_conn); - - /* initialize status queues */ - error = patm_sq_init(sc); - if (error != 0) - goto fail; - - /* get TST */ - sc->tst_soft = malloc(sizeof(uint32_t) * sc->mmap->tst_size, - M_DEVBUF, M_WAITOK); - - /* allocate all the receive buffer stuff */ - error = patm_rbuf_init(sc); - if (error != 0) - goto fail; - - /* - * Allocate SCD tag - * - * Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with - * bus_dmamem_alloc() - */ - error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, sizeof(struct patm_scd), 1, - sizeof(struct patm_scd), 0, NULL, NULL, &sc->scd_tag); - if (error) { - patm_printf(sc, "SCD DMA tag create %d\n", error); - goto fail; - } - LIST_INIT(&sc->scd_list); - - /* allocate VCC zone and pointers */ - if ((sc->vcc_zone = uma_zcreate("PATM vccs", sizeof(struct patm_vcc), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0)) == NULL) { - patm_printf(sc, "cannot allocate zone for vccs\n"); - goto fail; - } - sc->vccs = malloc(sizeof(sc->vccs[0]) * sc->mmap->max_conn, - M_DEVBUF, M_WAITOK | M_ZERO); - - /* allocate transmission resources */ - error = patm_txmap_init(sc); - if (error != 0) - goto fail; - - /* poll while we are not running */ - sc->utopia.flags |= UTP_FL_POLL_CARRIER; - - patm_debug(sc, ATTACH, "attaching interface"); - atm_ifattach(ifp); - -#ifdef ENABLE_BPF - bpfattach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc)); -#endif - - patm_debug(sc, ATTACH, "attaching interrupt handler"); - error = bus_setup_intr(dev, sc->irqres, INTR_TYPE_NET | INTR_MPSAFE, - NULL, patm_intr, sc, &sc->ih); - if (error != 0) { - patm_printf(sc, "could not setup interrupt\n"); - atm_ifdetach(sc->ifp); - if_free(sc->ifp); - goto fail; - } - - return (0); - - fail: - patm_destroy(sc); - return (error); -} - -/* - * Detach - */ -static int -patm_detach(device_t dev) -{ - struct patm_softc *sc; - - sc = device_get_softc(dev); - - mtx_lock(&sc->mtx); - patm_stop(sc); - if (sc->utopia.state & UTP_ST_ATTACHED) { - patm_debug(sc, ATTACH, "detaching utopia"); - utopia_stop(&sc->utopia); - utopia_detach(&sc->utopia); - } - mtx_unlock(&sc->mtx); - - atm_ifdetach(sc->ifp); - - patm_destroy(sc); - - return (0); -} - -/* - * Destroy everything. Assume we are stopped. - */ -static void -patm_destroy(struct patm_softc *sc) -{ - u_int i; - struct patm_txmap *map; - - if (sc->ih != NULL) - bus_teardown_intr(sc->dev, sc->irqres, sc->ih); - - if (sc->tx_mapzone != NULL) { - /* all maps must be free */ - while ((map = SLIST_FIRST(&sc->tx_maps_free)) != NULL) { - bus_dmamap_destroy(sc->tx_tag, map->map); - SLIST_REMOVE_HEAD(&sc->tx_maps_free, link); - uma_zfree(sc->tx_mapzone, map); - } - uma_zdestroy(sc->tx_mapzone); - } - - if (sc->scd_tag != NULL) - bus_dma_tag_destroy(sc->scd_tag); - - if (sc->tx_tag != NULL) - bus_dma_tag_destroy(sc->scd_tag); - - if (sc->vccs != NULL) { - for (i = 0; i < sc->mmap->max_conn; i++) - if (sc->vccs[i] != NULL) - uma_zfree(sc->vcc_zone, sc->vccs[i]); - free(sc->vccs, M_DEVBUF); - } - if (sc->vcc_zone != NULL) - uma_zdestroy(sc->vcc_zone); - - if (sc->lbufs != NULL) { - for (i = 0; i < sc->lbuf_max; i++) - bus_dmamap_destroy(sc->lbuf_tag, sc->lbufs[i].map); - free(sc->lbufs, M_DEVBUF); - } - - if (sc->lbuf_tag != NULL) - bus_dma_tag_destroy(sc->lbuf_tag); - - if (sc->sbuf_pool != NULL) - mbp_destroy(sc->sbuf_pool); - if (sc->vbuf_pool != NULL) - mbp_destroy(sc->vbuf_pool); - - if (sc->sbuf_tag != NULL) - bus_dma_tag_destroy(sc->sbuf_tag); - - if (sc->tst_soft != NULL) - free(sc->tst_soft, M_DEVBUF); - - /* - * Free all status queue memory resources - */ - if (sc->tsq != NULL) { - bus_dmamap_unload(sc->sq_tag, sc->sq_map); - bus_dmamem_free(sc->sq_tag, sc->tsq, sc->sq_map); - bus_dma_tag_destroy(sc->sq_tag); - } - - if (sc->irqres != NULL) - bus_release_resource(sc->dev, SYS_RES_IRQ, - sc->irqid, sc->irqres); - if (sc->memres != NULL) - bus_release_resource(sc->dev, SYS_RES_MEMORY, - IDT_PCI_REG_MEMBASE, sc->memres); - - /* this was initialize unconditionally */ - sysctl_ctx_free(&sc->sysctl_ctx); - cv_destroy(&sc->vcc_cv); - mtx_destroy(&sc->tst_lock); - mtx_destroy(&sc->mtx); - - if (sc->ifp != NULL) - if_free(sc->ifp); -} - -/* - * Try to find a variable in the environment and parse it as an unsigned - * integer. - */ -static void -patm_env_getuint(struct patm_softc *sc, u_int *var, const char *name) -{ - char full[IFNAMSIZ + 3 + 20]; - char *val, *end; - u_long u; - - snprintf(full, sizeof(full), "hw.%s.%s", - device_get_nameunit(sc->dev), name); - - if ((val = kern_getenv(full)) != NULL) { - u = strtoul(val, &end, 0); - if (end > val && *end == '\0') { - if (bootverbose) - patm_printf(sc, "%s=%lu\n", full, u); - *var = u; - } - freeenv(val); - } -} - -/* - * Sysctl handler for internal statistics - * - * LOCK: unlocked, needed - */ -static int -patm_sysctl_istats(SYSCTL_HANDLER_ARGS) -{ - struct patm_softc *sc = arg1; - uint32_t *ret; - int error; - - ret = malloc(sizeof(sc->stats), M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - bcopy(&sc->stats, ret, sizeof(sc->stats)); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, ret, sizeof(sc->stats)); - free(ret, M_TEMP); - - return (error); -} - -/* - * Sysctl handler for EEPROM - * - * LOCK: unlocked, needed - */ -static int -patm_sysctl_eeprom(SYSCTL_HANDLER_ARGS) -{ - struct patm_softc *sc = arg1; - void *ret; - int error; - - ret = malloc(sizeof(sc->eeprom), M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - bcopy(sc->eeprom, ret, sizeof(sc->eeprom)); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, ret, sizeof(sc->eeprom)); - free(ret, M_TEMP); - - return (error); -} - -/* - * Read the EEPROM. We assume that this is a XIRCOM 25020 - */ -static void -patm_read_eeprom(struct patm_softc *sc) -{ - u_int gp; - uint8_t byte; - int i, addr; - - static const uint32_t tab[] = { - /* CS transition to reset the chip */ - IDT_GP_EECS | IDT_GP_EESCLK, 0, - /* read command 0x03 */ - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, IDT_GP_EEDO, - IDT_GP_EESCLK | IDT_GP_EEDO, IDT_GP_EEDO, - IDT_GP_EESCLK | IDT_GP_EEDO, 0, - /* address 0x00 */ - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - IDT_GP_EESCLK, 0, - }; - - /* go to a known state (chip enabled) */ - gp = patm_nor_read(sc, IDT_NOR_GP); - gp &= ~(IDT_GP_EESCLK | IDT_GP_EECS | IDT_GP_EEDO); - - for (i = 0; i < nitems(tab); i++) { - patm_nor_write(sc, IDT_NOR_GP, gp | tab[i]); - DELAY(40); - } - - /* read out the prom */ - for (addr = 0; addr < 256; addr++) { - byte = 0; - for (i = 0; i < 8; i++) { - byte <<= 1; - if (patm_nor_read(sc, IDT_NOR_GP) & IDT_GP_EEDI) - byte |= 1; - /* rising CLK */ - patm_nor_write(sc, IDT_NOR_GP, gp | IDT_GP_EESCLK); - DELAY(40); - /* falling clock */ - patm_nor_write(sc, IDT_NOR_GP, gp); - DELAY(40); - } - sc->eeprom[addr] = byte; - } -} - -/* - * PHY access read - */ -static int -patm_phy_readregs(struct ifatm *ifatm, u_int reg, uint8_t *val, u_int *n) -{ - struct patm_softc *sc = ifatm->ifp->if_softc; - u_int cnt = *n; - - if (reg >= 0x100) - return (EINVAL); - - patm_cmd_wait(sc); - while (reg < 0x100 && cnt > 0) { - patm_nor_write(sc, IDT_NOR_CMD, IDT_MKCMD_RUTIL(1, 0, reg)); - patm_cmd_wait(sc); - *val = patm_nor_read(sc, IDT_NOR_D0); - patm_debug(sc, PHY, "phy(%02x)=%02x", reg, *val); - val++; - reg++; - cnt--; - } - *n = *n - cnt; - return (0); -} - -/* - * Write PHY reg - */ -static int -patm_phy_writereg(struct ifatm *ifatm, u_int reg, u_int mask, u_int val) -{ - struct patm_softc *sc = ifatm->ifp->if_softc; - u_int old, new; - - if (reg >= 0x100) - return (EINVAL); - - patm_cmd_wait(sc); - patm_nor_write(sc, IDT_NOR_CMD, IDT_MKCMD_RUTIL(1, 0, reg)); - patm_cmd_wait(sc); - - old = patm_nor_read(sc, IDT_NOR_D0); - new = (old & ~mask) | (val & mask); - patm_debug(sc, PHY, "phy(%02x) %02x -> %02x", reg, old, new); - - patm_nor_write(sc, IDT_NOR_D0, new); - patm_nor_write(sc, IDT_NOR_CMD, IDT_MKCMD_WUTIL(1, 0, reg)); - patm_cmd_wait(sc); - - return (0); -} - -/* - * Allocate a large chunk of DMA able memory for the transmit - * and receive status queues. We align this to a page boundary - * to ensure the alignment. - */ -static int -patm_sq_init(struct patm_softc *sc) -{ - int error; - void *p; - - /* compute size of the two queues */ - sc->sq_size = IDT_TSQ_SIZE * IDT_TSQE_SIZE + - PATM_RSQ_SIZE * IDT_RSQE_SIZE + - IDT_RAWHND_SIZE; - - patm_debug(sc, ATTACH, - "allocating status queues (%zu) ...", sc->sq_size); - - /* - * allocate tag - * Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with - * bus_dmamem_alloc() - */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), - PATM_SQ_ALIGNMENT, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, sc->sq_size, 1, sc->sq_size, - 0, NULL, NULL, &sc->sq_tag); - if (error) { - patm_printf(sc, "memory DMA tag create %d\n", error); - return (error); - } - - /* allocate memory */ - error = bus_dmamem_alloc(sc->sq_tag, &p, 0, &sc->sq_map); - if (error) { - patm_printf(sc, "memory DMA alloc %d\n", error); - bus_dma_tag_destroy(sc->sq_tag); - return (error); - } - - /* map it */ - sc->tsq_phy = 0x1fff; - error = bus_dmamap_load(sc->sq_tag, sc->sq_map, p, - sc->sq_size, patm_load_callback, &sc->tsq_phy, BUS_DMA_NOWAIT); - if (error) { - patm_printf(sc, "memory DMA map load %d\n", error); - bus_dmamem_free(sc->sq_tag, p, sc->sq_map); - bus_dma_tag_destroy(sc->sq_tag); - return (error); - } - - /* set queue start */ - sc->tsq = p; - sc->rsq = (void *)((char *)p + IDT_TSQ_SIZE * IDT_TSQE_SIZE); - sc->rsq_phy = sc->tsq_phy + IDT_TSQ_SIZE * IDT_TSQE_SIZE; - sc->rawhnd = (void *)((char *)sc->rsq + PATM_RSQ_SIZE * IDT_RSQE_SIZE); - sc->rawhnd_phy = sc->rsq_phy + PATM_RSQ_SIZE * IDT_RSQE_SIZE; - - return (0); -} - -/* - * Initialize all receive buffer stuff - */ -static int -patm_rbuf_init(struct patm_softc *sc) -{ - u_int i; - int error; - - patm_debug(sc, ATTACH, "allocating Rx buffer resources ..."); - /* - * Create a tag for small buffers. We allocate these page wise. - * Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with - * bus_dmamem_alloc() - */ - if ((error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), PAGE_SIZE, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - SMBUF_PAGE_SIZE, 1, SMBUF_PAGE_SIZE, 0, - NULL, NULL, &sc->sbuf_tag)) != 0) { - patm_printf(sc, "sbuf DMA tag create %d\n", error); - return (error); - } - - error = mbp_create(&sc->sbuf_pool, "patm sbufs", sc->sbuf_tag, - SMBUF_MAX_PAGES, SMBUF_PAGE_SIZE, SMBUF_CHUNK_SIZE); - if (error != 0) { - patm_printf(sc, "smbuf pool create %d\n", error); - return (error); - } - - error = mbp_create(&sc->vbuf_pool, "patm vbufs", sc->sbuf_tag, - VMBUF_MAX_PAGES, SMBUF_PAGE_SIZE, VMBUF_CHUNK_SIZE); - if (error != 0) { - patm_printf(sc, "vmbuf pool create %d\n", error); - return (error); - } - - /* - * Create a tag for large buffers. - * Don't use BUS_DMA_ALLOCNOW, because it makes no sense with multiple - * maps using one tag. Rather use BUS_DMA_NOWAIT when loading the map - * to prevent EINPROGRESS. - */ - if ((error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 4, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - MCLBYTES, 1, MCLBYTES, 0, - NULL, NULL, &sc->lbuf_tag)) != 0) { - patm_printf(sc, "lbuf DMA tag create %d\n", error); - return (error); - } - - if (sc->lbuf_max < IDT_FBQ_SIZE) - sc->lbuf_max = LMBUF_MAX; - sc->lbufs = malloc(sizeof(sc->lbufs[0]) * sc->lbuf_max, - M_DEVBUF, M_ZERO | M_WAITOK); - - SLIST_INIT(&sc->lbuf_free_list); - for (i = 0; i < sc->lbuf_max; i++) { - struct lmbuf *b = &sc->lbufs[i]; - - error = bus_dmamap_create(sc->lbuf_tag, 0, &b->map); - if (error) { - /* must deallocate here, because a test for NULL - * does not work on most archs */ - while (i-- > 0) - bus_dmamap_destroy(sc->lbuf_tag, - sc->lbufs[i].map); - free(sc->lbufs, M_DEVBUF); - sc->lbufs = NULL; - return (error); - } - b->handle = i; - SLIST_INSERT_HEAD(&sc->lbuf_free_list, b, link); - } - - return (0); -} - -/* - * Allocate everything needed for the transmission maps. - */ -static int -patm_txmap_init(struct patm_softc *sc) -{ - int error; - struct patm_txmap *map; - - /* get transmission tag */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, 65536, IDT_SCQ_SIZE - 1, 65536, - 0, NULL, NULL, &sc->tx_tag); - if (error) { - patm_printf(sc, "cannot allocate TX tag %d\n", error); - return (error); - } - - if ((sc->tx_mapzone = uma_zcreate("PATM tx maps", - sizeof(struct patm_txmap), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0)) == NULL) - return (ENOMEM); - - if (sc->tx_maxmaps < PATM_CFG_TXMAPS_MAX) - sc->tx_maxmaps = PATM_CFG_TXMAPS_MAX; - sc->tx_nmaps = PATM_CFG_TXMAPS_INIT; - - for (sc->tx_nmaps = 0; sc->tx_nmaps < PATM_CFG_TXMAPS_INIT; - sc->tx_nmaps++) { - map = uma_zalloc(sc->tx_mapzone, M_WAITOK); - error = bus_dmamap_create(sc->tx_tag, 0, &map->map); - if (error) { - uma_zfree(sc->tx_mapzone, map); - return (ENOMEM); - } - SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); - } - - return (0); -} - -#ifdef PATM_DEBUG - -/* - * Sysctl handler for REGS - * - * LOCK: unlocked, needed - */ -static int -patm_sysctl_regs(SYSCTL_HANDLER_ARGS) -{ - struct patm_softc *sc = arg1; - uint32_t *ret; - int error, i; - - ret = malloc(IDT_NOR_END, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - for (i = 0; i < IDT_NOR_END; i += 4) - ret[i / 4] = patm_nor_read(sc, i); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, ret, IDT_NOR_END); - free(ret, M_TEMP); - - return (error); -} - -/* - * Sysctl handler for TSQ - * - * LOCK: unlocked, needed - */ -static int -patm_sysctl_tsq(SYSCTL_HANDLER_ARGS) -{ - struct patm_softc *sc = arg1; - void *ret; - int error; - - ret = malloc(IDT_TSQ_SIZE * IDT_TSQE_SIZE, M_TEMP, M_WAITOK); - - mtx_lock(&sc->mtx); - memcpy(ret, sc->tsq, IDT_TSQ_SIZE * IDT_TSQE_SIZE); - mtx_unlock(&sc->mtx); - - error = SYSCTL_OUT(req, ret, IDT_TSQ_SIZE * IDT_TSQE_SIZE); - free(ret, M_TEMP); - - return (error); -} - -/* - * debugging - */ -static struct patm_softc * -patm_dump_unit(u_int unit) -{ - devclass_t dc; - struct patm_softc *sc; - - dc = devclass_find("patm"); - if (dc == NULL) { - printf("%s: can't find devclass\n", __func__); - return (NULL); - } - sc = devclass_get_softc(dc, unit); - if (sc == NULL) { - printf("%s: invalid unit number: %d\n", __func__, unit); - return (NULL); - } - return (sc); -} - -int -patm_dump_vc(u_int unit, u_int vc) -{ - struct patm_softc *sc; - uint32_t tct[8]; - uint32_t rct[4]; - uint32_t scd[12]; - u_int i; - - if ((sc = patm_dump_unit(unit)) == NULL) - return (0); - - for (i = 0; i < 8; i++) - tct[i] = patm_sram_read(sc, vc * 8 + i); - for (i = 0; i < 4; i++) - rct[i] = patm_sram_read(sc, sc->mmap->rct + vc * 4 + i); - for (i = 0; i < 12; i++) - scd[i] = patm_sram_read(sc, (tct[0] & 0x7ffff) + i); - - printf("TCT%3u: %08x %08x %08x %08x %08x %08x %08x %08x\n", vc, - tct[0], tct[1], tct[2], tct[3], tct[4], tct[5], tct[6], tct[7]); - printf("RCT%3u: %08x %08x %08x %08x\n", vc, - rct[0], rct[1], rct[2], rct[3]); - printf("SCD%3u: %08x %08x %08x %08x %08x %08x %08x %08x\n", vc, - scd[0], scd[1], scd[2], scd[3], scd[4], scd[5], scd[6], scd[7]); - printf(" %08x %08x %08x %08x\n", - scd[8], scd[9], scd[10], scd[11]); - - return (0); -} - -int -patm_dump_regs(u_int unit) -{ - struct patm_softc *sc; - u_int i; - - if ((sc = patm_dump_unit(unit)) == NULL) - return (0); - - for (i = 0; i <= IDT_NOR_DNOW; i += 4) - printf("%x: %08x\n", i, patm_nor_read(sc, i)); - - return (0); -} - -int -patm_dump_sram(u_int unit, u_int from, u_int words) -{ - struct patm_softc *sc; - u_int i; - - if ((sc = patm_dump_unit(unit)) == NULL) - return (0); - - for (i = 0; i < words; i++) { - if (i % 8 == 0) - printf("%05x:", from + i); - printf(" %08x", patm_sram_read(sc, from + i)); - if (i % 8 == 7) - printf("\n"); - } - if (i % 8 != 0) - printf("\n"); - return (0); -} -#endif diff --git a/sys/dev/patm/if_patm_intr.c b/sys/dev/patm/if_patm_intr.c deleted file mode 100644 index 864fff5bfd55..000000000000 --- a/sys/dev/patm/if_patm_intr.c +++ /dev/null @@ -1,554 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -static void patm_feed_sbufs(struct patm_softc *sc); -static void patm_feed_lbufs(struct patm_softc *sc); -static void patm_feed_vbufs(struct patm_softc *sc); -static void patm_intr_tsif(struct patm_softc *sc); -static void patm_intr_raw(struct patm_softc *sc); - -#ifdef PATM_DEBUG -static int patm_mbuf_cnt(u_int unit) __unused; -#endif - -/* - * Write free buf Q - */ -static __inline void -patm_fbq_write(struct patm_softc *sc, u_int queue, uint32_t h0, - uint32_t p0, uint32_t h1, uint32_t p1) -{ - patm_debug(sc, FREEQ, "supplying(%u,%#x,%#x,%#x,%#x)", - queue, h0, p0, h1, p1); - patm_nor_write(sc, IDT_NOR_D0, h0); - patm_nor_write(sc, IDT_NOR_D1, p0); - patm_nor_write(sc, IDT_NOR_D2, h1); - patm_nor_write(sc, IDT_NOR_D3, p1); - patm_cmd_exec(sc, IDT_CMD_WFBQ | queue); -} - -/* - * Interrupt - */ -void -patm_intr(void *p) -{ - struct patm_softc *sc = p; - uint32_t stat, cfg; - u_int cnt; - const uint32_t ints = IDT_STAT_TSIF | IDT_STAT_TXICP | IDT_STAT_TSQF | - IDT_STAT_TMROF | IDT_STAT_PHYI | IDT_STAT_RSQF | IDT_STAT_EPDU | - IDT_STAT_RAWCF | IDT_STAT_RSQAF; - const uint32_t fbqa = IDT_STAT_FBQ3A | IDT_STAT_FBQ2A | - IDT_STAT_FBQ1A | IDT_STAT_FBQ0A; - - mtx_lock(&sc->mtx); - - stat = patm_nor_read(sc, IDT_NOR_STAT); - patm_nor_write(sc, IDT_NOR_STAT, stat & (ints | fbqa)); - - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - /* if we are stopped ack all interrupts and handle PHYI */ - if (stat & IDT_STAT_PHYI) { - patm_debug(sc, INTR, "PHYI (stopped)"); - utopia_intr(&sc->utopia); - } - mtx_unlock(&sc->mtx); - return; - } - - patm_debug(sc, INTR, "stat=%08x", stat); - - /* - * If the buffer queues are empty try to fill them. If this fails - * disable the interrupt. Otherwise enable the interrupt. - */ - if (stat & fbqa) { - cfg = patm_nor_read(sc, IDT_NOR_CFG); - if (stat & IDT_STAT_FBQ0A) - patm_feed_sbufs(sc); - if (stat & IDT_STAT_FBQ1A) - patm_feed_lbufs(sc); - if (stat & IDT_STAT_FBQ2A) { - /* - * Workaround for missing interrupt on AAL0. Check the - * receive status queue if the FBQ2 is not full. - */ - patm_intr_rsq(sc); - patm_feed_vbufs(sc); - } - if ((patm_nor_read(sc, IDT_NOR_STAT) & fbqa) && - (cfg & IDT_CFG_FBIE)) { - /* failed */ - patm_nor_write(sc, IDT_NOR_CFG, cfg & ~IDT_CFG_FBIE); - patm_printf(sc, "out of buffers -- intr disabled\n"); - } else if (!(cfg & IDT_CFG_FBIE)) { - patm_printf(sc, "bufQ intr re-enabled\n"); - patm_nor_write(sc, IDT_NOR_CFG, cfg | IDT_CFG_FBIE); - } - patm_nor_write(sc, IDT_NOR_STAT, fbqa); - } - - cnt = 0; - while ((stat & ints) != 0) { - if (++cnt == 200) { - patm_printf(sc, "%s: excessive interrupts\n", __func__); - patm_stop(sc); - break; - } - if (stat & IDT_STAT_TSIF) { - patm_debug(sc, INTR, "TSIF"); - patm_intr_tsif(sc); - } - if (stat & IDT_STAT_TXICP) { - patm_printf(sc, "incomplete PDU transmitted\n"); - } - if (stat & IDT_STAT_TSQF) { - patm_printf(sc, "TSQF\n"); - patm_intr_tsif(sc); - } - if (stat & IDT_STAT_TMROF) { - patm_debug(sc, INTR, "TMROF"); - patm_intr_tsif(sc); - } - if (stat & IDT_STAT_PHYI) { - patm_debug(sc, INTR, "PHYI"); - utopia_intr(&sc->utopia); - } - if (stat & IDT_STAT_RSQF) { - patm_printf(sc, "RSQF\n"); - patm_intr_rsq(sc); - } - if (stat & IDT_STAT_EPDU) { - patm_debug(sc, INTR, "EPDU"); - patm_intr_rsq(sc); - } - if (stat & IDT_STAT_RAWCF) { - patm_debug(sc, INTR, "RAWCF"); - patm_intr_raw(sc); - } - if (stat & IDT_STAT_RSQAF) { - patm_debug(sc, INTR, "RSQAF"); - patm_intr_rsq(sc); - } else if (IDT_STAT_FRAC2(stat) != 0xf) { - /* - * Workaround for missing interrupt on AAL0. Check the - * receive status queue if the FBQ2 is not full. - */ - patm_intr_rsq(sc); - } - - stat = patm_nor_read(sc, IDT_NOR_STAT); - patm_nor_write(sc, IDT_NOR_STAT, ints & stat); - patm_debug(sc, INTR, "stat=%08x", stat); - } - - mtx_unlock(&sc->mtx); - - patm_debug(sc, INTR, "... exit"); -} - -/* - * Compute the amount of buffers to feed into a given free buffer queue - * - * Feeding buffers is actually not so easy as it seems. We cannot use the - * fraction fields in the status registers, because they round down, i.e. - * if we have 34 buffers in the queue, it will show 1. If we now feed - * 512 - 1 * 32 buffers, we lose two buffers. The only reliable way to know - * how many buffers are in the queue are the FBQP registers. - */ -static u_int -patm_feed_cnt(struct patm_softc *sc, u_int q) -{ - u_int w, r, reg; - u_int feed; - int free; - - /* get the FBQ read and write pointers */ - reg = patm_nor_read(sc, IDT_NOR_FBQP0 + 4 * q); - r = (reg & 0x7ff) >> 1; - w = ((reg >> 16) & 0x7ff) >> 1; - /* compute amount of free buffers */ - if ((free = w - r) < 0) - free += 0x400; - KASSERT(free <= 512, ("bad FBQP 0x%x", reg)); - feed = 512 - free; - - /* can only feed pairs of buffers */ - feed &= ~1; - - if (feed > 0) - feed -= 2; - - patm_debug(sc, FREEQ, "feeding %u buffers into queue %u", feed, q); - - return (feed); -} - -/* - * Feed small buffers into buffer queue 0 - * - */ -static void -patm_feed_sbufs(struct patm_softc *sc) -{ - u_int feed; - bus_addr_t p0, p1; - void *v0; - uint32_t h0, h1; - - feed = patm_feed_cnt(sc, 0); - - while (feed > 0) { - if ((v0 = mbp_alloc(sc->sbuf_pool, &p0, &h0)) == NULL) - break; - if (mbp_alloc(sc->sbuf_pool, &p1, &h1) == NULL) { - mbp_free(sc->sbuf_pool, v0); - break; - } - patm_fbq_write(sc, 0, - h0 | MBUF_SHANDLE, (p0 + SMBUF_OFFSET), - h1 | MBUF_SHANDLE, (p1 + SMBUF_OFFSET)); - - feed -= 2; - } -} - -/* - * Feed small buffers into buffer queue 0 - */ -static void -patm_feed_vbufs(struct patm_softc *sc) -{ - u_int feed; - bus_addr_t p0, p1; - void *v0; - uint32_t h0, h1; - - feed = patm_feed_cnt(sc, 2); - - while (feed > 0) { - if ((v0 = mbp_alloc(sc->vbuf_pool, &p0, &h0)) == NULL) - break; - if (mbp_alloc(sc->vbuf_pool, &p1, &h1) == NULL) { - mbp_free(sc->vbuf_pool, v0); - break; - } - patm_fbq_write(sc, 2, - h0 | MBUF_VHANDLE, (p0 + VMBUF_OFFSET), - h1 | MBUF_VHANDLE, (p1 + VMBUF_OFFSET)); - - feed -= 2; - } -} - -/* - * Allocate a large buffer - */ -static struct lmbuf * -patm_lmbuf_alloc(struct patm_softc *sc) -{ - int error; - struct mbuf *m; - struct lmbuf *b; - - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) - return (NULL); - m->m_data += LMBUF_OFFSET; - - if ((b = SLIST_FIRST(&sc->lbuf_free_list)) == NULL) { - m_freem(m); - return (NULL); - } - - b->phy = 0; /* alignment */ - error = bus_dmamap_load(sc->lbuf_tag, b->map, m->m_data, LMBUF_SIZE, - patm_load_callback, &b->phy, BUS_DMA_NOWAIT); - if (error) { - patm_printf(sc, "%s -- bus_dmamap_load: %d\n", __func__, error); - m_free(m); - return (NULL); - } - - SLIST_REMOVE_HEAD(&sc->lbuf_free_list, link); - b->m = m; - - return (b); -} - -/* - * Feed large buffers into buffer queue 1 - */ -static void -patm_feed_lbufs(struct patm_softc *sc) -{ - u_int feed; - struct lmbuf *b0, *b1; - - feed = patm_feed_cnt(sc, 1); - - while (feed > 0) { - if ((b0 = patm_lmbuf_alloc(sc)) == NULL) - break; - if ((b1 = patm_lmbuf_alloc(sc)) == NULL) { - patm_lbuf_free(sc, b0); - break; - } - patm_fbq_write(sc, 1, - LMBUF_HANDLE | b0->handle, b0->phy, - LMBUF_HANDLE | b1->handle, b1->phy); - - feed -= 2; - } -} - -/* - * Handle transmit status interrupt - */ -static void -patm_intr_tsif(struct patm_softc *sc) -{ - struct idt_tsqe *tsqe = sc->tsq_next; - struct idt_tsqe *prev = NULL; - uint32_t stamp; - - stamp = le32toh(tsqe->stamp); - if (stamp & IDT_TSQE_EMPTY) - return; - - do { - switch (IDT_TSQE_TYPE(stamp)) { - - case IDT_TSQE_TBD: - patm_tx(sc, stamp, le32toh(tsqe->stat)); - break; - - case IDT_TSQE_IDLE: - patm_tx_idle(sc, le32toh(tsqe->stat)); - break; - } - - /* recycle */ - tsqe->stat = 0; - tsqe->stamp = htole32(IDT_TSQE_EMPTY); - - /* save pointer to this entry and advance */ - prev = tsqe; - if (++tsqe == &sc->tsq[IDT_TSQ_SIZE]) - tsqe = &sc->tsq[0]; - - stamp = le32toh(tsqe->stamp); - } while (!(stamp & IDT_TSQE_EMPTY)); - - sc->tsq_next = tsqe; - patm_nor_write(sc, IDT_NOR_TSQH, ((prev - sc->tsq) << IDT_TSQE_SHIFT)); -} - -/* - * Handle receive interrupt - */ -void -patm_intr_rsq(struct patm_softc *sc) -{ - struct idt_rsqe *rsqe; - u_int stat; - - if (sc->rsq_last + 1 == PATM_RSQ_SIZE) - rsqe = &sc->rsq[0]; - else - rsqe = &sc->rsq[sc->rsq_last + 1]; - stat = le32toh(rsqe->stat); - if (!(stat & IDT_RSQE_VALID)) - return; - - while (stat & IDT_RSQE_VALID) { - patm_rx(sc, rsqe); - - /* recycle RSQE */ - rsqe->cid = 0; - rsqe->handle = 0; - rsqe->crc = 0; - rsqe->stat = 0; - - /* save pointer to this entry and advance */ - if (++sc->rsq_last == PATM_RSQ_SIZE) - sc->rsq_last = 0; - if (++rsqe == &sc->rsq[PATM_RSQ_SIZE]) - rsqe = sc->rsq; - - stat = le32toh(rsqe->stat); - } - - patm_nor_write(sc, IDT_NOR_RSQH, sc->rsq_phy | (sc->rsq_last << 2)); - - patm_feed_sbufs(sc); - patm_feed_lbufs(sc); - patm_feed_vbufs(sc); -} - -/* - * Handle raw cell receive. - * - * Note that the description on page 3-8 is wrong. The RAWHND contains not - * the same value as RAWCT. RAWCT points to the next address the chip is - * going to write to whike RAWHND points to the last cell's address the chip - * has written to. - */ -static void -patm_intr_raw(struct patm_softc *sc) -{ - uint32_t tail; - uint32_t h, *cell; - -#ifdef notyet - bus_dma_sync_size(sc->sq_tag, sc->sq_map, IDT_TSQ_SIZE * IDT_TSQE_SIZE + - PATM_RSQ_SIZE * IDT_RSQE_SIZE, sizeof(*sc->rawhnd), - BUS_DMASYNC_POSTREAD); -#endif - /* first turn */ - if (sc->rawh == NULL) { - sc->rawh = &sc->lbufs[le32toh(sc->rawhnd->handle) & MBUF_HMASK]; - } - tail = le32toh(sc->rawhnd->tail); - if (tail == sc->rawh->phy) - /* not really a raw interrupt */ - return; - - while (tail + 64 != sc->rawh->phy + sc->rawi * 64) { -#ifdef notyet - bus_dmamap_sync_size(sc->lbuf_tag, sc->rawh->map, - sc->rawi * 64, 64, BUS_DMASYNC_POSTREAD); -#endif - cell = (uint32_t *)(mtod(sc->rawh->m, u_char *) + - sc->rawi * 64); - if (sc->rawi == (LMBUF_SIZE / 64) - 1) { - /* chain */ - h = le32toh(cell[1]); - patm_lbuf_free(sc, sc->rawh); - sc->rawh = &sc->lbufs[h & MBUF_HMASK]; - sc->rawi = 0; - continue; - } - - patm_rx_raw(sc, (u_char *)cell); - sc->rawi++; - } -} - -/* - * Free a large mbuf. This is called by us. - */ -void -patm_lbuf_free(struct patm_softc *sc, struct lmbuf *b) -{ - - bus_dmamap_unload(sc->lbuf_tag, b->map); - if (b->m != NULL) { - m_free(b->m); - b->m = NULL; - } - SLIST_INSERT_HEAD(&sc->lbuf_free_list, b, link); -} - -#ifdef PATM_DEBUG -static int -patm_mbuf_cnt(u_int unit) -{ - devclass_t dc; - struct patm_softc *sc; - u_int used, card, free; - - dc = devclass_find("patm"); - if (dc == NULL) { - printf("%s: can't find devclass\n", __func__); - return (0); - } - sc = devclass_get_softc(dc, unit); - if (sc == NULL) { - printf("%s: invalid unit number: %d\n", __func__, unit); - return (0); - } - - mbp_count(sc->sbuf_pool, &used, &card, &free); - printf("sbufs: %u on card, %u used, %u free\n", card, used, free); - - mbp_count(sc->vbuf_pool, &used, &card, &free); - printf("aal0 bufs: %u on card, %u used, %u free\n", card, used, free); - - return (0); -} -#endif diff --git a/sys/dev/patm/if_patm_ioctl.c b/sys/dev/patm/if_patm_ioctl.c deleted file mode 100644 index c12bd760593e..000000000000 --- a/sys/dev/patm/if_patm_ioctl.c +++ /dev/null @@ -1,412 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -/* - * Open the VCC with the given parameters - */ -static int -patm_open_vcc(struct patm_softc *sc, struct atmio_openvcc *arg) -{ - u_int cid; - struct patm_vcc *vcc; - int error = 0; - - patm_debug(sc, VCC, "Open VCC: %u.%u flags=%#x", arg->param.vpi, - arg->param.vci, arg->param.flags); - - if (!LEGAL_VPI(sc, arg->param.vpi) || !LEGAL_VCI(sc, arg->param.vci)) - return (EINVAL); - if (arg->param.vci == 0 && (arg->param.vpi != 0 || - !(arg->param.flags & ATMIO_FLAG_NOTX) || - arg->param.aal != ATMIO_AAL_RAW)) - return (EINVAL); - cid = PATM_CID(sc, arg->param.vpi, arg->param.vci); - - if ((arg->param.flags & ATMIO_FLAG_NOTX) && - (arg->param.flags & ATMIO_FLAG_NORX)) - return (EINVAL); - - if ((arg->param.traffic == ATMIO_TRAFFIC_ABR) && - (arg->param.flags & (ATMIO_FLAG_NOTX | ATMIO_FLAG_NORX))) - return (EINVAL); - - /* allocate vcc */ - vcc = uma_zalloc(sc->vcc_zone, M_NOWAIT | M_ZERO); - if (vcc == NULL) - return (ENOMEM); - - mtx_lock(&sc->mtx); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - /* stopped while we have analyzed the arguments */ - error = EIO; - goto done; - } - if (sc->vccs[cid] != NULL) { - /* ups, already open */ - error = EBUSY; - goto done; - } - - /* check some parameters */ - vcc->cid = cid; - vcc->vcc = arg->param; - vcc->vflags = 0; - vcc->rxhand = arg->rxhand; - switch (vcc->vcc.aal) { - - case ATMIO_AAL_0: - case ATMIO_AAL_34: - case ATMIO_AAL_5: - break; - - case ATMIO_AAL_RAW: - if (arg->param.vci == 0 && - !(arg->param.flags & ATMIO_FLAG_NOTX)) { - error = EINVAL; - goto done; - } - break; - - default: - error = EINVAL; - goto done; - } - switch (vcc->vcc.traffic) { - - case ATMIO_TRAFFIC_VBR: - case ATMIO_TRAFFIC_UBR: - case ATMIO_TRAFFIC_CBR: - case ATMIO_TRAFFIC_ABR: - break; - - default: - error = EINVAL; - goto done; - } - - /* initialize */ - vcc->chain = NULL; - vcc->last = NULL; - vcc->ibytes = vcc->ipackets = 0; - vcc->obytes = vcc->opackets = 0; - - /* ask the TX and RX sides */ - patm_debug(sc, VCC, "Open VCC: asking Rx/Tx"); - if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX) && - (error = patm_tx_vcc_can_open(sc, vcc)) != 0) - goto done; - if (!(vcc->vcc.flags & ATMIO_FLAG_NORX) && - (error = patm_rx_vcc_can_open(sc, vcc)) != 0) - goto done; - - /* ok - go ahead */ - sc->vccs[cid] = vcc; - patm_load_vc(sc, vcc, 0); - - /* don't free below */ - vcc = NULL; - sc->vccs_open++; - - /* done */ - done: - mtx_unlock(&sc->mtx); - if (vcc != NULL) - uma_zfree(sc->vcc_zone, vcc); - return (error); -} - -void -patm_load_vc(struct patm_softc *sc, struct patm_vcc *vcc, int reload) -{ - - patm_debug(sc, VCC, "Open VCC: opening"); - if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX)) - patm_tx_vcc_open(sc, vcc); - if (!(vcc->vcc.flags & ATMIO_FLAG_NORX)) - patm_rx_vcc_open(sc, vcc); - - if (!reload) { - /* inform management about non-NG and NG-PVCs */ - if (!(vcc->vcc.flags & ATMIO_FLAG_NG) || - (vcc->vcc.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), vcc->vcc.vpi, - vcc->vcc.vci, 1); - } - - patm_debug(sc, VCC, "Open VCC: now open"); -} - -/* - * Try to close the given VCC - */ -static int -patm_close_vcc(struct patm_softc *sc, struct atmio_closevcc *arg) -{ - u_int cid; - struct patm_vcc *vcc; - int error = 0; - - patm_debug(sc, VCC, "Close VCC: %u.%u", arg->vpi, arg->vci); - - if (!LEGAL_VPI(sc, arg->vpi) || !LEGAL_VCI(sc, arg->vci)) - return (EINVAL); - cid = PATM_CID(sc, arg->vpi, arg->vci); - - mtx_lock(&sc->mtx); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - /* stopped while we have analyzed the arguments */ - error = EIO; - goto done; - } - - vcc = sc->vccs[cid]; - if (vcc == NULL || !(vcc->vflags & PATM_VCC_OPEN)) { - error = ENOENT; - goto done; - } - - if (vcc->vflags & PATM_VCC_TX_OPEN) - patm_tx_vcc_close(sc, vcc); - if (vcc->vflags & PATM_VCC_RX_OPEN) - patm_rx_vcc_close(sc, vcc); - - if (vcc->vcc.flags & ATMIO_FLAG_ASYNC) - goto done; - - while (vcc->vflags & (PATM_VCC_TX_CLOSING | PATM_VCC_RX_CLOSING)) { - cv_wait(&sc->vcc_cv, &sc->mtx); - if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) { - /* ups, has been stopped */ - error = EIO; - goto done; - } - } - - if (!(vcc->vcc.flags & ATMIO_FLAG_NOTX)) - patm_tx_vcc_closed(sc, vcc); - if (!(vcc->vcc.flags & ATMIO_FLAG_NORX)) - patm_rx_vcc_closed(sc, vcc); - - patm_vcc_closed(sc, vcc); - - done: - mtx_unlock(&sc->mtx); - - return (error); -} - -/* - * VCC has been finally closed. - */ -void -patm_vcc_closed(struct patm_softc *sc, struct patm_vcc *vcc) -{ - - /* inform management about non-NG and NG-PVCs */ - if (!(vcc->vcc.flags & ATMIO_FLAG_NG) || - (vcc->vcc.flags & ATMIO_FLAG_PVC)) - ATMEV_SEND_VCC_CHANGED(IFP2IFATM(sc->ifp), vcc->vcc.vpi, - vcc->vcc.vci, 0); - - sc->vccs_open--; - sc->vccs[vcc->cid] = NULL; - uma_zfree(sc->vcc_zone, vcc); -} - -int -patm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) -{ - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; - struct patm_softc *sc = ifp->if_softc; - int error = 0; - uint32_t cfg; - struct atmio_vcctable *vtab; - - switch (cmd) { - - case SIOCSIFADDR: - mtx_lock(&sc->mtx); - ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - patm_initialize(sc); - switch (ifa->ifa_addr->sa_family) { - -#ifdef INET - case AF_INET: - case AF_INET6: - ifa->ifa_rtrequest = atm_rtrequest; - break; -#endif - default: - break; - } - mtx_unlock(&sc->mtx); - break; - - case SIOCSIFFLAGS: - mtx_lock(&sc->mtx); - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - patm_initialize(sc); - } - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - patm_stop(sc); - } - } - mtx_unlock(&sc->mtx); - break; - - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->media, cmd); - - /* - * We need to toggle unassigned/idle cells ourself because - * the 77252 generates null cells for spacing. When switching - * null cells of it gets the timing wrong. - */ - mtx_lock(&sc->mtx); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (sc->utopia.state & UTP_ST_UNASS) { - if (!(sc->flags & PATM_UNASS)) { - cfg = patm_nor_read(sc, IDT_NOR_CFG); - cfg &= ~IDT_CFG_IDLECLP; - patm_nor_write(sc, IDT_NOR_CFG, cfg); - sc->flags |= PATM_UNASS; - } - } else { - if (sc->flags & PATM_UNASS) { - cfg = patm_nor_read(sc, IDT_NOR_CFG); - cfg |= IDT_CFG_IDLECLP; - patm_nor_write(sc, IDT_NOR_CFG, cfg); - sc->flags &= ~PATM_UNASS; - } - } - } else { - if (sc->utopia.state & UTP_ST_UNASS) - sc->flags |= PATM_UNASS; - else - sc->flags &= ~PATM_UNASS; - } - mtx_unlock(&sc->mtx); - break; - - case SIOCSIFMTU: - /* - * Set the interface MTU. - */ - if (ifr->ifr_mtu > ATMMTU) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCATMOPENVCC: /* kernel internal use */ - error = patm_open_vcc(sc, (struct atmio_openvcc *)data); - break; - - case SIOCATMCLOSEVCC: /* kernel internal use */ - error = patm_close_vcc(sc, (struct atmio_closevcc *)data); - break; - - case SIOCATMGVCCS: /* external use */ - /* return vcc table */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - sc->mmap->max_conn, sc->vccs_open, &sc->mtx, 1); - error = copyout(vtab, ifr->ifr_data, sizeof(*vtab) + - vtab->count * sizeof(vtab->vccs[0])); - free(vtab, M_DEVBUF); - break; - - case SIOCATMGETVCCS: /* netgraph internal use */ - vtab = atm_getvccs((struct atmio_vcc **)sc->vccs, - sc->mmap->max_conn, sc->vccs_open, &sc->mtx, 0); - if (vtab == NULL) { - error = ENOMEM; - break; - } - *(void **)data = vtab; - break; - - default: - patm_debug(sc, IOCTL, "unknown cmd=%08lx arg=%p", cmd, data); - error = EINVAL; - break; - } - - return (error); -} diff --git a/sys/dev/patm/if_patm_rtables.c b/sys/dev/patm/if_patm_rtables.c deleted file mode 100644 index f945276690b4..000000000000 --- a/sys/dev/patm/if_patm_rtables.c +++ /dev/null @@ -1,9079 +0,0 @@ -/* - * This file was generated by `genrtables/genrtab' - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -const u_int patm_rtables_size = 128 * (4 + 2 * 16); -const u_int patm_rtables_ntab = 16; - -/* - * Tables for 352768cps and 155Mbps - */ -const uint32_t patm_rtables155[128 * (4 + 2 * 16)] = { -0x8d022e27, -0x8d362e11, -0x8d702bf7, -0x8daa2bce, -0x8de62ba7, -0x8e262b81, -0x8e682b5d, -0x8eac2b3b, -0x8ef42b19, -0x8f402af9, -0x8f8c2adb, -0x8fde2abd, -0x901a2aa1, -0x90462a86, -0x90722a6c, -0x90a22a53, -0x90d42a3b, -0x91082a24, -0x913e2a0e, -0x917627f2, -0x91b227c9, -0x91ee27a2, -0x922e277d, -0x92702759, -0x92b62736, -0x92fe2715, -0x934626f6, -0x939626d7, -0x93e626ba, -0x941e269e, -0x944a2683, -0x94782669, -0x94a82650, -0x94dc2638, -0x95106621, -0x9546660b, -0x957e63ed, -0x95b863c5, -0x95f4639e, -0x96366378, -0x96786355, -0x96be6332, -0x97066311, -0x975062f2, -0x97a062d3, -0x97f262b6, -0x9824629a, -0x98506280, -0x987e6266, -0x98ae624d, -0x98e26235, -0x9914a21f, -0x994ca209, -0x99849fe8, -0x99be9fc0, -0x99fe9f99, -0x9a3e9f74, -0x9a809f51, -0x9ac69f2e, -0x9b0e9f0e, -0x9b5a9eee, -0x9ba89ed0, -0x9bfc9eb3, -0x9c2a9e97, -0x9c569e7c, -0x9c849e63, -0x9cb49e4a, -0x9ce69e33, -0x9d1cde1c, -0x9d54de06, -0x9d8cdbe3, -0x9dc6dbbb, -0x9e04db95, -0x9e44db70, -0x9e88db4c, -0x9ed0db2a, -0x9f16db0a, -0x9f64daea, -0x9fb4dacc, -0xa002dab0, -0xa02eda94, -0xa05cda79, -0xa08ada60, -0xa0bcda47, -0xa0ecda30, -0xa1231a19, -0xa1591a04, -0xa19317de, -0xa1cf17b6, -0xa20d1790, -0xa24f176b, -0xa2911748, -0xa2d91726, -0xa3211706, -0xa36d16e7, -0xa3bd16c9, -0xa40916ac, -0xa4331691, -0xa4611676, -0xa491165d, -0xa4c31644, -0xa4f5162d, -0xa5291617, -0xa5611601, -0xa59b13d9, -0xa5d513b2, -0xa615138c, -0xa6571367, -0xa6991344, -0xa6e11322, -0xa72b1302, -0xa77712e3, -0xa7c912c5, -0xa80f12a9, -0xa83b128d, -0xa8671273, -0xa895125a, -0xa8c71242, -0xa8fb122a, -0xa9311214, -0xa9670ffe, -0xa9a10fd5, -0xa9dd0fad, -0xaa1d0f87, -0xaa5d0f63, -0xaaa10f40, -0xaae90f1f, -0xab350efe, -0xab7f0ee0, -0xabd10ec2, -0xac150ea5, -0xac3f0e8a, -0xac6d0e70, -0xac9b0e57, -0xaccd0e3f, -0xad010e28, -0xad370e11, -0xad6d0bf9, -0xada70bd0, -0xade30ba9, -0xae230b83, -0xae650b5f, -0xaeab0b3c, -0xaef10b1b, -0xaf3b0afb, -0xaf890adc, -0xafdd0abe, -0xb0190aa2, -0xb0450a87, -0xb0730a6d, -0xb0a10a54, -0xb0d30a3c, -0xb1070a25, -0xb13d0a0f, -0xb17507f4, -0xb1af07cb, -0xb1ed07a4, -0xb22d077e, -0xb26f075a, -0xb2b30738, -0xb2f90717, -0xb34506f7, -0xb39506d8, -0xb3e506bb, -0xb41d069f, -0xb4490684, -0xb477066a, -0xb4a70651, -0xb4d90639, -0xb50f0622, -0xb545060c, -0xb57b03ef, -0xb5b703c6, -0xb5f5039f, -0xb633037a, -0xb6770356, -0xb6bb0334, -0xb7030313, -0xb74f02f3, -0xb79d02d5, -0xb7ed02b8, -0xb823029c, -0xb84f0281, -0xb87d0267, -0xb8ad024e, -0xb8e10236, -0xb9130220, -0xb949020a, -0xb98301f5, -0xb9bd01e1, -0xb9fd01cd, -0xba3b01bb, -0xba7f01a9, -0xbac30198, -0xbb0f0187, -0xbb5b0177, -0xbba90168, -0xbbf9015a, -0xbc29014c, -0xbc53013f, -0xbc830132, -0xbcb50125, -0xbce5011a, -0xbd1d010e, -0xbd550103, -0xbd8b00f9, -0xbdc700ef, -0xbe0700e5, -0xbe4500dc, -0xbe8900d3, -0xbecb00cb, -0xbf1d00c2, -0xbf6100bb, -0xbfb500b3, -0xc00300ac, -0xc02f00a5, -0xc05f009e, -0xc08b0098, -0xc0bb0092, -0xc0ed008c, -0xc1270086, -0xc1590081, -0xc191007c, -0xc1cd0077, -0xc20d0072, -0xc255006d, -0xc2910069, -0xc2d50065, -0xc32f0060, -0xc36b005d, -0xc3bf0059, -0xc40f0055, -0xc4350052, -0xc46d004e, -0xc499004b, -0xc4cb0048, -0xc5010045, -0xc5270043, -0xc5630040, -0xc5a7003d, -0xc5d9003b, -0xc6290038, -0xc6630036, -0xc6a10034, -0xc6e50032, -0xc72f0030, -0xc77f002e, -0xc7d7002c, -0xc81b002a, -0xc8510028, -0xc86d0027, -0xc8a90025, -0xc8cb0024, -0xc9130022, -0xc93b0021, -0xc9630020, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x03020100, -0x07060504, -0x0b0a0908, -0x100e0d0b, -0x14131211, -0x18171615, -0x1c1b1a19, -0x211f1e1c, -0x25242322, -0x29282726, -0x2c2c2b2a, -0x31302f2d, -0x36353433, -0x3a393837, -0x3d3d3c3b, -0x4241403e, -0x47464544, -0x4b4a4948, -0x4e4d4d4c, -0x5352504f, -0x58575654, -0x5c5b5a59, -0x5f5e5d5d, -0x64636160, -0x69686665, -0x6d6c6b6a, -0x706f6e6d, -0x75747271, -0x7a787776, -0x7d7d7c7b, -0x81807f7e, -0x86848382, -0x8a898887, -0x8e8d8c8b, -0x9291908f, -0x97959492, -0x9b9a9998, -0x9f9e9d9c, -0xa3a2a1a0, -0xa8a6a5a3, -0xacabaaa9, -0xb0afaead, -0xb3b3b2b1, -0xb8b7b6b4, -0xbdbcbbba, -0xc1c0bfbe, -0xc4c4c3c2, -0xc9c8c7c5, -0xcecdcccb, -0xd2d1d0cf, -0xd5d4d4d3, -0xdad9d7d6, -0xdfdedddb, -0xe3e2e1e0, -0xe6e5e4e4, -0xebeae8e7, -0xf0efeeec, -0xf4f3f2f1, -0xf7f6f5f5, -0xfcfbf9f8, -0xfffffefd, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0x000064b1, -0x000062b1, -0x000160b1, -0x00015eb1, -0x00035cb1, -0x00035ab1, -0x00030000, -0x00030000, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* AIR 0: diff=352768.000000 */ -0x3bf83bfc, -0x3bf03bf4, -0x3be83bec, -0x3be03be4, -0x3bd83bdc, -0x3bd03bd4, -0x3bc83bcc, -0x3bc03bc4, -0x3bb83bbc, -0x3bb03bb4, -0x3ba83bac, -0x3ba03ba4, -0x3b983b9c, -0x3b903b94, -0x3b883b8c, -0x3b803b84, -0x3b783b7c, -0x3b703b74, -0x3b683b6c, -0x3b603b64, -0x3b583b5c, -0x3b503b54, -0x3b483b4c, -0x3b403b44, -0x3b383b3c, -0x3b303b34, -0x3b283b2c, -0x3b203b24, -0x3b183b1c, -0x3b103b14, -0x3b083b0c, -0x3b003b04, -0x3af83afc, -0x3af03af4, -0x3ae83aec, -0x3ae03ae4, -0x3ad83adc, -0x3ad03ad4, -0x3ac83acc, -0x3ac03ac4, -0x3ab83abc, -0x3ab03ab4, -0x3aa83aac, -0x3aa03aa4, -0x3a983a9c, -0x3a903a94, -0x3a883a8c, -0x3a803a84, -0x3a783a7c, -0x3a703a74, -0x3a683a6c, -0x3a603a64, -0x3a583a5c, -0x3a503a54, -0x3a483a4c, -0x3a403a44, -0x3a383a3c, -0x3a303a34, -0x3a283a2c, -0x3a203a24, -0x3a183a1c, -0x3a103a14, -0x3a083a0c, -0x3a003a04, -0x37f037f8, -0x37e037e8, -0x37d037d8, -0x37c037c8, -0x37b037b8, -0x37a037a8, -0x37903798, -0x37803788, -0x37703778, -0x37603768, -0x37503758, -0x37403748, -0x37303738, -0x37203728, -0x37103718, -0x37003708, -0x36f036f8, -0x36e036e8, -0x36d036d8, -0x36c036c8, -0x36b036b8, -0x36a036a8, -0x36903698, -0x36803688, -0x36703678, -0x36603668, -0x36503658, -0x36403648, -0x36303638, -0x36203628, -0x36103618, -0x36003608, -0x33e033f0, -0x33c033d0, -0x33a033b0, -0x33803390, -0x33603370, -0x33403350, -0x33203330, -0x33003310, -0x32e032f0, -0x32c032d0, -0x32a032b0, -0x32803290, -0x32603270, -0x32403250, -0x32203230, -0x32003210, -0x2fc02fe0, -0x2f802fa0, -0x2f402f60, -0x2f002f20, -0x2ec02ee0, -0x2e802ea0, -0x2e402e60, -0x2e002e20, -0x2b802bc0, -0x2b002b40, -0x2a802ac0, -0x2a002a40, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 1: diff=176384.000000 */ -0x3bb43bb8, -0x3bac3bb0, -0x3ba43ba8, -0x3b9c3ba0, -0x3b943b98, -0x3b8c3b90, -0x3b843b88, -0x3b7c3b80, -0x3b743b78, -0x3b6c3b70, -0x3b643b68, -0x3b5c3b60, -0x3b543b58, -0x3b4c3b50, -0x3b443b48, -0x3b3c3b40, -0x3b343b38, -0x3b2c3b30, -0x3b243b28, -0x3b1c3b20, -0x3b143b18, -0x3b0c3b10, -0x3b043b08, -0x3afc3b00, -0x3af43af8, -0x3aec3af0, -0x3ae43ae8, -0x3adc3ae0, -0x3ad43ad8, -0x3acc3ad0, -0x3ac43ac8, -0x3abc3ac0, -0x3ab43ab8, -0x3aac3ab0, -0x3aa43aa8, -0x3a9c3aa0, -0x3a943a98, -0x3a8c3a90, -0x3a843a88, -0x3a7c3a80, -0x3a743a78, -0x3a6c3a70, -0x3a643a68, -0x3a5c3a60, -0x3a543a58, -0x3a4c3a50, -0x3a443a48, -0x3a3c3a40, -0x3a343a38, -0x3a2c3a30, -0x3a243a28, -0x3a1c3a20, -0x3a143a18, -0x3a0c3a10, -0x3a043a08, -0x37fa3a00, -0x37ea37f2, -0x37da37e2, -0x37ca37d2, -0x37ba37c2, -0x37aa37b2, -0x379a37a2, -0x378a3792, -0x377a3782, -0x376b3773, -0x375b3763, -0x374b3753, -0x373b3743, -0x372b3733, -0x371c3724, -0x370c3714, -0x36fc3704, -0x36ed36f5, -0x36dd36e5, -0x36cd36d5, -0x36be36c6, -0x36ae36b6, -0x369f36a7, -0x368f3697, -0x36803688, -0x36703678, -0x36613669, -0x3652365a, -0x3643364a, -0x3634363b, -0x3624362c, -0x3615361d, -0x3607360e, -0x33f033ff, -0x33d233e1, -0x33b533c4, -0x339833a6, -0x337b338a, -0x335e336d, -0x33423350, -0x33263334, -0x330a3318, -0x32ef32fc, -0x32d332e1, -0x32b932c6, -0x329e32ab, -0x32843291, -0x326a3277, -0x3251325e, -0x32383245, -0x3220322c, -0x32083214, -0x2fe22ff9, -0x2fb52fcb, -0x2f882f9e, -0x2f5d2f72, -0x2f332f48, -0x2f0a2f1e, -0x2ee22ef5, -0x2ebb2ece, -0x2e962ea8, -0x2e722e84, -0x2e4f2e60, -0x2e2e2e3e, -0x2e002e1e, -0x2b802bc0, -0x2b002b40, -0x2a802ac0, -0x2a002a40, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 2: diff=88192.000000 */ -0x3b703b74, -0x3b683b6c, -0x3b603b64, -0x3b583b5c, -0x3b503b54, -0x3b483b4c, -0x3b403b44, -0x3b383b3c, -0x3b303b34, -0x3b283b2c, -0x3b203b24, -0x3b183b1c, -0x3b103b14, -0x3b083b0c, -0x3b003b04, -0x3af83afc, -0x3af13af4, -0x3ae93aed, -0x3ae13ae5, -0x3ad93add, -0x3ad13ad5, -0x3ac93acd, -0x3ac13ac5, -0x3ab93abd, -0x3ab13ab5, -0x3aa93aad, -0x3aa13aa5, -0x3a993a9d, -0x3a913a95, -0x3a893a8d, -0x3a813a85, -0x3a793a7d, -0x3a713a75, -0x3a693a6d, -0x3a613a65, -0x3a593a5d, -0x3a513a55, -0x3a493a4d, -0x3a413a45, -0x3a393a3d, -0x3a313a35, -0x3a293a2d, -0x3a213a25, -0x3a193a1d, -0x3a113a15, -0x3a093a0d, -0x3a013a05, -0x37f337fa, -0x37e337eb, -0x37d337db, -0x37c337cb, -0x37b337bb, -0x37a337ab, -0x3793379b, -0x3783378b, -0x3774377b, -0x3764376c, -0x3754375c, -0x3744374c, -0x3734373c, -0x3725372c, -0x3715371d, -0x3705370d, -0x36f536fd, -0x36e636ee, -0x36d636de, -0x36c736ce, -0x36b736bf, -0x36a736af, -0x369836a0, -0x36893690, -0x36793681, -0x366a3671, -0x365a3662, -0x364b3653, -0x363c3644, -0x362d3634, -0x361e3625, -0x360f3616, -0x36003607, -0x33e333f2, -0x33c533d4, -0x33a833b7, -0x338b339a, -0x336e337d, -0x33523360, -0x33363344, -0x331a3328, -0x32fe330c, -0x32e332f0, -0x32c832d5, -0x32ad32ba, -0x329332a0, -0x32793286, -0x325f326c, -0x32463253, -0x322e323a, -0x32163222, -0x2ffc320a, -0x2fce2fe5, -0x2fa12fb7, -0x2f752f8b, -0x2f4a2f5f, -0x2f202f35, -0x2ef82f0c, -0x2ed12ee4, -0x2eab2ebd, -0x2e862e98, -0x2e622e74, -0x2e402e51, -0x2e202e30, -0x2e002e10, -0x2bc42be2, -0x2b8a2ba7, -0x2b532b6e, -0x2b1f2b39, -0x2aed2b05, -0x2abd2ad4, -0x2a902aa6, -0x2a652a7a, -0x2a3c2a50, -0x2a162a29, -0x27e52a04, -0x27a127c2, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 3: diff=44096.000000 */ -0x3b2d3b31, -0x3b253b29, -0x3b1d3b21, -0x3b153b19, -0x3b0d3b11, -0x3b053b09, -0x3afd3b01, -0x3af53af9, -0x3aed3af1, -0x3ae53ae9, -0x3add3ae1, -0x3ad53ad9, -0x3acd3ad1, -0x3ac53ac9, -0x3abd3ac1, -0x3ab53ab9, -0x3aad3ab1, -0x3aa53aa9, -0x3a9d3aa1, -0x3a953a99, -0x3a8d3a91, -0x3a853a89, -0x3a7d3a81, -0x3a753a79, -0x3a6d3a71, -0x3a653a69, -0x3a5d3a61, -0x3a553a59, -0x3a4d3a51, -0x3a453a49, -0x3a3d3a41, -0x3a353a39, -0x3a2d3a31, -0x3a253a29, -0x3a1d3a21, -0x3a153a19, -0x3a0d3a11, -0x3a053a09, -0x37fb3a01, -0x37ec37f3, -0x37dc37e4, -0x37cc37d4, -0x37bc37c4, -0x37ac37b4, -0x379c37a4, -0x378c3794, -0x377c3784, -0x376d3774, -0x375d3765, -0x374d3755, -0x373d3745, -0x372d3735, -0x371e3726, -0x370e3716, -0x36fe3706, -0x36ef36f6, -0x36df36e7, -0x36cf36d7, -0x36c036c7, -0x36b036b8, -0x36a136a8, -0x36913699, -0x36823689, -0x3672367a, -0x3663366b, -0x3654365b, -0x3645364c, -0x3635363d, -0x3626362e, -0x3617361f, -0x36083610, -0x33f33601, -0x33d633e5, -0x33b933c7, -0x339b33aa, -0x337f338d, -0x33623370, -0x33453354, -0x33293337, -0x330d331b, -0x32f23300, -0x32d732e4, -0x32bc32c9, -0x32a132af, -0x32873294, -0x326d327a, -0x32543261, -0x323b3248, -0x3223322f, -0x320b3217, -0x2fe82fff, -0x2fba2fd1, -0x2f8d2fa4, -0x2f622f78, -0x2f382f4d, -0x2f0e2f23, -0x2ee62efa, -0x2ec02ed3, -0x2e9a2ead, -0x2e762e88, -0x2e532e65, -0x2e322e42, -0x2e112e21, -0x2be62e02, -0x2baa2bc8, -0x2b722b8e, -0x2b3c2b56, -0x2b082b22, -0x2ad72aef, -0x2aa92ac0, -0x2a7d2a92, -0x2a532a67, -0x2a2b2a3f, -0x2a062a18, -0x27c627e9, -0x278427a5, -0x27462764, -0x270b2728, -0x26d426ef, -0x26a126ba, -0x26712688, -0x2644265a, -0x261a262e, -0x23e62606, -0x239c23c0, -0x2358237a, -0x22002300, -0x00001e00, -/* AIR 4: diff=22048.000000 */ -0x3ae93aed, -0x3ae13ae5, -0x3ad93add, -0x3ad13ad5, -0x3ac93acd, -0x3ac13ac5, -0x3ab93abd, -0x3ab13ab5, -0x3aaa3aae, -0x3aa23aa6, -0x3a9a3a9e, -0x3a923a96, -0x3a8a3a8e, -0x3a823a86, -0x3a7a3a7e, -0x3a723a76, -0x3a6a3a6e, -0x3a623a66, -0x3a5a3a5e, -0x3a523a56, -0x3a4a3a4e, -0x3a423a46, -0x3a3a3a3e, -0x3a323a36, -0x3a2a3a2e, -0x3a223a26, -0x3a1a3a1e, -0x3a123a16, -0x3a0a3a0e, -0x3a023a06, -0x37f437fc, -0x37e537ec, -0x37d537dd, -0x37c537cd, -0x37b537bd, -0x37a537ad, -0x3795379d, -0x3785378d, -0x3775377d, -0x3766376d, -0x3756375e, -0x3746374e, -0x3736373e, -0x3726372e, -0x3717371f, -0x3707370f, -0x36f736ff, -0x36e836ef, -0x36d836e0, -0x36c836d0, -0x36b936c1, -0x36a936b1, -0x369a36a2, -0x368a3692, -0x367b3683, -0x366c3673, -0x365c3664, -0x364d3655, -0x363e3645, -0x362f3636, -0x36203627, -0x36113618, -0x36023609, -0x33e633f5, -0x33c933d8, -0x33ac33ba, -0x338f339d, -0x33723380, -0x33553364, -0x33393347, -0x331d332b, -0x3301330f, -0x32e632f4, -0x32cb32d8, -0x32b032bd, -0x329632a3, -0x327c3289, -0x3262326f, -0x32493256, -0x3231323d, -0x32183224, -0x3201320c, -0x2fd42feb, -0x2fa62fbd, -0x2f7a2f90, -0x2f4f2f64, -0x2f252f3a, -0x2efd2f11, -0x2ed52ee9, -0x2eaf2ec2, -0x2e8a2e9c, -0x2e672e78, -0x2e442e55, -0x2e232e34, -0x2e042e13, -0x2bcb2be9, -0x2b912bae, -0x2b5a2b75, -0x2b252b3f, -0x2af22b0b, -0x2ac22ada, -0x2a952aab, -0x2a6a2a7f, -0x2a412a55, -0x2a1b2a2e, -0x27ed2a08, -0x27a827ca, -0x27682788, -0x272b2749, -0x26f3270f, -0x26bd26d7, -0x268b26a4, -0x265d2674, -0x26312646, -0x2608261c, -0x23c523ea, -0x237e23a1, -0x233c235c, -0x22fe231c, -0x22c522e1, -0x229022aa, -0x225f2277, -0x22312247, -0x2206221b, -0x1fbf1fe5, -0x1f761f99, -0x1f321f53, -0x00001e00, -/* AIR 5: diff=11024.000000 */ -0x3aa63aaa, -0x3a9e3aa2, -0x3a963a9a, -0x3a8e3a92, -0x3a863a8a, -0x3a7e3a82, -0x3a763a7a, -0x3a6e3a72, -0x3a663a6a, -0x3a5e3a62, -0x3a563a5a, -0x3a4e3a52, -0x3a463a4a, -0x3a3e3a42, -0x3a363a3a, -0x3a2e3a32, -0x3a263a2a, -0x3a1e3a22, -0x3a163a1a, -0x3a0e3a12, -0x3a063a0a, -0x37fd3a02, -0x37ed37f5, -0x37de37e5, -0x37ce37d6, -0x37be37c6, -0x37ae37b6, -0x379e37a6, -0x378e3796, -0x377e3786, -0x376e3776, -0x375f3767, -0x374f3757, -0x373f3747, -0x372f3737, -0x37203727, -0x37103718, -0x37003708, -0x36f036f8, -0x36e136e9, -0x36d136d9, -0x36c236c9, -0x36b236ba, -0x36a236aa, -0x3693369b, -0x3684368b, -0x3674367c, -0x3665366d, -0x3656365d, -0x3646364e, -0x3637363f, -0x36283630, -0x36193621, -0x360a3612, -0x33f73603, -0x33d933e8, -0x33bc33cb, -0x339f33ad, -0x33823390, -0x33653374, -0x33493357, -0x332d333b, -0x3311331f, -0x32f53303, -0x32da32e8, -0x32bf32cc, -0x32a432b2, -0x328a3297, -0x3271327d, -0x32573264, -0x323e324b, -0x32263232, -0x320e321a, -0x2fed3202, -0x2fbf2fd6, -0x2f932fa9, -0x2f672f7d, -0x2f3d2f52, -0x2f132f28, -0x2eeb2eff, -0x2ec42ed8, -0x2e9f2eb1, -0x2e7a2e8c, -0x2e572e69, -0x2e362e46, -0x2e152e25, -0x2bed2e06, -0x2bb12bcf, -0x2b782b95, -0x2b422b5d, -0x2b0e2b28, -0x2add2af5, -0x2aae2ac5, -0x2a822a98, -0x2a582a6c, -0x2a302a44, -0x2a0a2a1d, -0x27ce27f1, -0x278c27ac, -0x274d276c, -0x2712272f, -0x26db26f6, -0x26a726c0, -0x2676268e, -0x2649265f, -0x261f2633, -0x23ef260b, -0x23a523c9, -0x23602382, -0x23202340, -0x22e52302, -0x22ad22c8, -0x227a2293, -0x224a2262, -0x221e2234, -0x1fea2209, -0x1f9e1fc3, -0x1f571f7a, -0x1f161f36, -0x1ed91ef7, -0x1ea11ebd, -0x1e6e1e87, -0x1e3e1e55, -0x1e111e27, -0x1bd11bf9, -0x1b851bab, -0x1b3f1b62, -0x00001b1f, -/* AIR 6: diff=5512.000000 */ -0x3a633a67, -0x3a5b3a5f, -0x3a533a57, -0x3a4b3a4f, -0x3a433a47, -0x3a3b3a3f, -0x3a333a37, -0x3a2b3a2f, -0x3a233a27, -0x3a1b3a1f, -0x3a133a17, -0x3a0b3a0f, -0x3a033a07, -0x37f637fe, -0x37e637ee, -0x37d737de, -0x37c737cf, -0x37b737bf, -0x37a737af, -0x3797379f, -0x3787378f, -0x3777377f, -0x3767376f, -0x37583760, -0x37483750, -0x37383740, -0x37283730, -0x37193720, -0x37093711, -0x36f93701, -0x36ea36f1, -0x36da36e2, -0x36ca36d2, -0x36bb36c2, -0x36ab36b3, -0x369c36a3, -0x368c3694, -0x367d3684, -0x366d3675, -0x365e3666, -0x364f3656, -0x36403647, -0x36313638, -0x36213629, -0x3612361a, -0x3604360b, -0x33ea33f9, -0x33cc33db, -0x33af33be, -0x339233a1, -0x33753384, -0x33593367, -0x333c334b, -0x3320332e, -0x33053312, -0x32e932f7, -0x32ce32dc, -0x32b332c1, -0x329932a6, -0x327f328c, -0x32653272, -0x324c3259, -0x32333240, -0x321b3227, -0x3203320f, -0x2fd92ff0, -0x2fac2fc2, -0x2f7f2f95, -0x2f542f6a, -0x2f2a2f3f, -0x2f012f16, -0x2eda2eee, -0x2eb42ec7, -0x2e8f2ea1, -0x2e6b2e7d, -0x2e482e59, -0x2e272e38, -0x2e072e17, -0x2bd22bf1, -0x2b982bb5, -0x2b602b7c, -0x2b2b2b45, -0x2af82b11, -0x2ac82ae0, -0x2a9a2ab1, -0x2a6f2a84, -0x2a462a5a, -0x2a1f2a32, -0x27f52a0d, -0x27b027d2, -0x27702790, -0x27322751, -0x26f92715, -0x26c326de, -0x269126aa, -0x26622679, -0x2636264c, -0x260d2621, -0x23ce23f3, -0x238623a9, -0x23432364, -0x23052324, -0x22cc22e8, -0x229622b1, -0x2264227d, -0x2236224d, -0x220b2220, -0x1fc81fef, -0x1f7e1fa2, -0x1f3a1f5b, -0x1efb1f1a, -0x1ec01edd, -0x1e8a1ea5, -0x1e581e71, -0x1e2a1e40, -0x1bfe1e14, -0x1baf1bd6, -0x1b661b8a, -0x1b221b44, -0x1ae41b03, -0x1aaa1ac7, -0x1a751a8f, -0x1a441a5c, -0x1a171a2d, -0x17db1a02, -0x178e17b3, -0x17461769, -0x00001725, -/* AIR 7: diff=2756.000000 */ -0x3a1f3a23, -0x3a173a1b, -0x3a0f3a13, -0x3a073a0b, -0x37ff3a03, -0x37ef37f7, -0x37df37e7, -0x37d037d7, -0x37c037c8, -0x37b037b8, -0x37a037a8, -0x37903798, -0x37803788, -0x37703778, -0x37613768, -0x37513759, -0x37413749, -0x37313739, -0x37213729, -0x3712371a, -0x3702370a, -0x36f236fa, -0x36e336ea, -0x36d336db, -0x36c336cb, -0x36b436bc, -0x36a436ac, -0x3695369d, -0x3685368d, -0x3676367e, -0x3667366e, -0x3657365f, -0x36483650, -0x36393641, -0x362a3631, -0x361b3622, -0x360c3613, -0x33fb3604, -0x33dd33ec, -0x33c033ce, -0x33a233b1, -0x33853394, -0x33693377, -0x334c335a, -0x3330333e, -0x33143322, -0x32f93306, -0x32dd32eb, -0x32c232d0, -0x32a832b5, -0x328d329a, -0x32743280, -0x325a3267, -0x3241324e, -0x32293235, -0x3211321d, -0x2ff33205, -0x2fc52fdc, -0x2f982fae, -0x2f6c2f82, -0x2f422f57, -0x2f182f2d, -0x2ef02f04, -0x2ec92edc, -0x2ea32eb6, -0x2e7f2e91, -0x2e5b2e6d, -0x2e3a2e4a, -0x2e192e29, -0x2bf42e09, -0x2bb82bd6, -0x2b7f2b9b, -0x2b482b63, -0x2b142b2e, -0x2ae32afb, -0x2ab42acb, -0x2a872a9d, -0x2a5d2a71, -0x2a352a48, -0x2a0f2a21, -0x27d727fa, -0x279327b4, -0x27542773, -0x27192736, -0x26e126fd, -0x26ad26c7, -0x267c2694, -0x264e2665, -0x26242639, -0x23f8260f, -0x23ad23d2, -0x2368238a, -0x23282347, -0x22ec2309, -0x22b422cf, -0x22802299, -0x22502267, -0x22232239, -0x1ff4220e, -0x1fa71fcc, -0x1f5f1f82, -0x1f1d1f3e, -0x1ee01efe, -0x1ea81ec4, -0x1e741e8d, -0x1e431e5b, -0x1e161e2c, -0x1bdb1e01, -0x1b8e1bb4, -0x1b481b6a, -0x1b061b26, -0x1aca1ae8, -0x1a931aae, -0x1a5f1a78, -0x1a301a47, -0x1a041a1a, -0x17b817e0, -0x176e1792, -0x1729174b, -0x16ea1709, -0x16af16cc, -0x16791694, -0x16481660, -0x161a1630, -0x13e01604, -0x139213b8, -0x134a136d, -0x00001328, -/* AIR 8: diff=1378.000000 */ -0x37b937c1, -0x37a937b1, -0x379937a1, -0x37893791, -0x37793781, -0x37693771, -0x375a3761, -0x374a3752, -0x373a3742, -0x372a3732, -0x371a3722, -0x370b3713, -0x36fb3703, -0x36eb36f3, -0x36dc36e4, -0x36cc36d4, -0x36bd36c4, -0x36ad36b5, -0x369e36a5, -0x368e3696, -0x367f3686, -0x366f3677, -0x36603668, -0x36513658, -0x36413649, -0x3632363a, -0x3623362b, -0x3614361c, -0x3605360d, -0x33ed33fc, -0x33d033df, -0x33b333c1, -0x339633a4, -0x33793387, -0x335c336a, -0x3340334e, -0x33243332, -0x33083316, -0x32ec32fa, -0x32d132df, -0x32b732c4, -0x329c32a9, -0x3282328f, -0x32683275, -0x324f325c, -0x32363243, -0x321e322a, -0x32063212, -0x2fdf2ff6, -0x2fb12fc8, -0x2f852f9b, -0x2f592f6f, -0x2f2f2f44, -0x2f062f1b, -0x2edf2ef2, -0x2eb82ecb, -0x2e932ea5, -0x2e6f2e81, -0x2e4c2e5e, -0x2e2b2e3c, -0x2e0b2e1b, -0x2bda2bf8, -0x2b9f2bbc, -0x2b672b82, -0x2b312b4c, -0x2afe2b17, -0x2ace2ae6, -0x2aa02ab6, -0x2a742a8a, -0x2a4b2a5f, -0x2a242a37, -0x27fe2a11, -0x27b927db, -0x27772797, -0x273a2758, -0x2700271c, -0x26ca26e4, -0x269726b0, -0x2667267f, -0x263b2651, -0x26122626, -0x23d623fc, -0x238e23b2, -0x234b236c, -0x230d232b, -0x22d222ef, -0x229c22b7, -0x226a2283, -0x223c2252, -0x22102226, -0x1fd11ff8, -0x1f871fab, -0x1f421f64, -0x1f021f21, -0x1ec71ee4, -0x1e901eab, -0x1e5e1e77, -0x1e2f1e46, -0x1e041e19, -0x1bb81bdf, -0x1b6e1b93, -0x1b2a1b4c, -0x1aeb1b0a, -0x1ab11ace, -0x1a7b1a96, -0x1a4a1a62, -0x1a1c1a33, -0x17e41a07, -0x179617bd, -0x174f1772, -0x170c172d, -0x16cf16ed, -0x169716b2, -0x1663167c, -0x1633164a, -0x1607161c, -0x13bd13e4, -0x13711396, -0x132c134e, -0x12ec130c, -0x12b212ce, -0x127b1296, -0x12491262, -0x121b1232, -0x0fe21206, -0x0f940fba, -0x0f4c0f6f, -0x00000f2a, -/* AIR 9: diff=689.000000 */ -0x3733373b, -0x3723372b, -0x3714371b, -0x3704370c, -0x36f436fc, -0x36e536ec, -0x36d536dd, -0x36c536cd, -0x36b636be, -0x36a636ae, -0x3697369e, -0x3687368f, -0x36783680, -0x36693670, -0x36593661, -0x364a3652, -0x363b3642, -0x362c3633, -0x361d3624, -0x360e3615, -0x33fe3606, -0x33e033ef, -0x33c333d2, -0x33a633b4, -0x33893397, -0x336c337a, -0x3350335e, -0x33333342, -0x33173325, -0x32fc330a, -0x32e032ee, -0x32c532d3, -0x32ab32b8, -0x3291329e, -0x32773284, -0x325d326a, -0x32443251, -0x322c3238, -0x32143220, -0x2ff83208, -0x2fca2fe1, -0x2f9d2fb4, -0x2f712f87, -0x2f472f5c, -0x2f1d2f32, -0x2ef52f09, -0x2ecd2ee1, -0x2ea82eba, -0x2e832e95, -0x2e602e71, -0x2e3e2e4e, -0x2e1d2e2d, -0x2bfc2e0d, -0x2bbf2bdd, -0x2b862ba2, -0x2b4f2b6a, -0x2b1a2b34, -0x2ae92b01, -0x2ab92ad1, -0x2a8c2aa2, -0x2a622a77, -0x2a392a4d, -0x2a132a26, -0x27df2a01, -0x279b27bd, -0x275c277b, -0x2720273d, -0x26e82703, -0x26b326cd, -0x2682269a, -0x2654266a, -0x2629263e, -0x26002614, -0x23b623db, -0x23702393, -0x232f234f, -0x22f32310, -0x22ba22d6, -0x228622a0, -0x2255226d, -0x2228223e, -0x1ffd2213, -0x1fb01fd6, -0x1f681f8b, -0x1f251f46, -0x1ee71f06, -0x1eae1eca, -0x1e7a1e93, -0x1e491e61, -0x1e1c1e32, -0x1be41e06, -0x1b971bbd, -0x1b501b73, -0x1b0e1b2e, -0x1ad11aef, -0x1a991ab4, -0x1a651a7f, -0x1a351a4d, -0x1a091a1f, -0x17c117e9, -0x1776179b, -0x17311753, -0x16f11710, -0x16b616d3, -0x167f169a, -0x164d1666, -0x161f1636, -0x13e91609, -0x139b13c1, -0x13521376, -0x130f1330, -0x12d212f0, -0x129912b5, -0x1265127e, -0x1235124c, -0x1208121e, -0x0fbf0fe7, -0x0f730f98, -0x0f2e0f50, -0x0eee0f0d, -0x0eb30ed0, -0x0e7c0e97, -0x0e4a0e63, -0x0e1c0e33, -0x0be30e06, -0x0b950bbb, -0x0b4d0b70, -0x00000b2b, -/* AIR 10: diff=344.500000 */ -0x36af36b7, -0x369f36a7, -0x36903698, -0x36803688, -0x36713679, -0x36623669, -0x3652365a, -0x3643364b, -0x3634363c, -0x3625362d, -0x3616361e, -0x3607360f, -0x33f13600, -0x33d433e2, -0x33b633c5, -0x339933a8, -0x337c338b, -0x3360336e, -0x33433351, -0x33273335, -0x330b3319, -0x32f032fd, -0x32d532e2, -0x32ba32c7, -0x329f32ac, -0x32853292, -0x326b3278, -0x3252325f, -0x32393246, -0x3221322d, -0x32093215, -0x2fe42ffb, -0x2fb62fcd, -0x2f8a2fa0, -0x2f5e2f74, -0x2f342f49, -0x2f0b2f1f, -0x2ee32ef7, -0x2ebd2ed0, -0x2e972eaa, -0x2e732e85, -0x2e512e62, -0x2e2f2e40, -0x2e0f2e1f, -0x2be12bff, -0x2ba62bc3, -0x2b6d2b89, -0x2b372b52, -0x2b042b1e, -0x2ad32aeb, -0x2aa52abc, -0x2a792a8f, -0x2a502a64, -0x2a282a3c, -0x2a032a15, -0x27c127e3, -0x277f279f, -0x2741275f, -0x27072723, -0x26d026eb, -0x269d26b6, -0x266d2685, -0x26402656, -0x2616262b, -0x23df2603, -0x239723ba, -0x23532374, -0x23142333, -0x22d922f6, -0x22a322bd, -0x22702289, -0x22412258, -0x2215222b, -0x1fda2201, -0x1f8f1fb4, -0x1f4a1f6c, -0x1f091f29, -0x1ece1eeb, -0x1e971eb2, -0x1e641e7d, -0x1e341e4c, -0x1e091e1e, -0x1bc11be9, -0x1b771b9b, -0x1b321b54, -0x1af31b12, -0x1ab81ad5, -0x1a821a9c, -0x1a501a68, -0x1a211a38, -0x17ee1a0c, -0x179f17c6, -0x1757177a, -0x17141735, -0x16d616f5, -0x169d16b9, -0x16691683, -0x16391650, -0x160c1622, -0x13c613ee, -0x137a139f, -0x13341356, -0x12f41313, -0x12b812d5, -0x1282129c, -0x124f1268, -0x12211237, -0x0fec120b, -0x0f9d0fc4, -0x0f540f78, -0x0f110f32, -0x0ed30ef1, -0x0e9a0eb6, -0x0e660e7f, -0x0e350e4d, -0x0e090e1f, -0x0bc00be8, -0x0b740b99, -0x0b2f0b51, -0x0aef0b0e, -0x0ab30ad0, -0x0a7d0a98, -0x0a4b0a63, -0x0a1c0a33, -0x07e40a07, -0x079607bc, -0x074d0771, -0x0000072b, -/* AIR 11: diff=172.250000 */ -0x362d3635, -0x361e3626, -0x360f3617, -0x36013608, -0x33e433f3, -0x33c733d5, -0x33a933b8, -0x338c339b, -0x3370337e, -0x33533361, -0x33373345, -0x331b3329, -0x32ff330d, -0x32e432f1, -0x32c932d6, -0x32ae32bb, -0x329432a1, -0x327a3287, -0x3260326d, -0x32473254, -0x322f323b, -0x32163222, -0x2ffe320b, -0x2fd02fe7, -0x2fa32fb9, -0x2f772f8c, -0x2f4c2f61, -0x2f222f37, -0x2ef92f0e, -0x2ed22ee6, -0x2eac2ebf, -0x2e872e9a, -0x2e642e75, -0x2e422e53, -0x2e212e31, -0x2e012e11, -0x2bc62be4, -0x2b8d2ba9, -0x2b552b71, -0x2b212b3b, -0x2aee2b07, -0x2abf2ad6, -0x2a912aa8, -0x2a672a7c, -0x2a3e2a52, -0x2a182a2a, -0x27e72a05, -0x27a327c5, -0x27632783, -0x27272744, -0x26ee270a, -0x26b926d3, -0x268726a0, -0x26592670, -0x262e2643, -0x26052619, -0x23bf23e4, -0x2378239b, -0x23372357, -0x22fa2318, -0x22c122dd, -0x228c22a6, -0x225b2273, -0x222d2244, -0x22032218, -0x1fb91fdf, -0x1f701f94, -0x1f2d1f4e, -0x1eef1f0d, -0x1eb51ed1, -0x1e801e9a, -0x1e4e1e67, -0x1e211e37, -0x1bee1e0b, -0x1ba01bc6, -0x1b581b7b, -0x1b151b36, -0x1ad81af6, -0x1a9f1abb, -0x1a6b1a85, -0x1a3b1a52, -0x1a0e1a24, -0x17cb17f3, -0x177f17a4, -0x1739175b, -0x16f81718, -0x16bd16da, -0x168616a1, -0x1653166c, -0x1624163b, -0x13f3160e, -0x13a413cb, -0x135b137e, -0x13171338, -0x12d912f7, -0x12a012bc, -0x126b1285, -0x123a1252, -0x120d1223, -0x0fc80ff1, -0x0f7c0fa1, -0x0f360f58, -0x0ef50f15, -0x0eba0ed7, -0x0e830e9e, -0x0e500e69, -0x0e210e38, -0x0bed0e0b, -0x0b9e0bc5, -0x0b550b79, -0x0b120b33, -0x0ad40af2, -0x0a9b0ab7, -0x0a660a80, -0x0a360a4e, -0x0a090a1f, -0x07c107e9, -0x0775079a, -0x072f0751, -0x06ef070f, -0x06b406d1, -0x067d0698, -0x064b0664, -0x061d0633, -0x03e50607, -0x039603bd, -0x034e0371, -0x0000032c, -/* AIR 12: diff=86.125000 */ -0x33633371, -0x33473355, -0x332a3338, -0x330f331c, -0x32f33301, -0x32d832e5, -0x32bd32ca, -0x32a232b0, -0x32883295, -0x326e327b, -0x32553262, -0x323c3249, -0x32243230, -0x320c3218, -0x2fea3200, -0x2fbc2fd3, -0x2f8f2fa5, -0x2f642f79, -0x2f392f4e, -0x2f102f24, -0x2ee82efc, -0x2ec12ed4, -0x2e9c2eae, -0x2e782e89, -0x2e552e66, -0x2e332e44, -0x2e132e23, -0x2be82e03, -0x2bad2bca, -0x2b742b90, -0x2b3e2b59, -0x2b0a2b24, -0x2ad92af1, -0x2aaa2ac1, -0x2a7e2a94, -0x2a542a69, -0x2a2d2a40, -0x2a072a1a, -0x27c927ec, -0x278627a7, -0x27482767, -0x270d272a, -0x26d626f1, -0x26a326bc, -0x2673268a, -0x2645265c, -0x261b2630, -0x23e82607, -0x239f23c3, -0x235b237c, -0x231b233a, -0x22e022fd, -0x22a922c4, -0x2276228f, -0x2246225e, -0x221a2230, -0x1fe42206, -0x1f981fbd, -0x1f521f74, -0x1f111f31, -0x1ed51ef2, -0x1e9d1eb8, -0x1e691e83, -0x1e3a1e51, -0x1e0e1e23, -0x1bcb1bf3, -0x1b801ba4, -0x1b3a1b5c, -0x1afa1b19, -0x1abf1adc, -0x1a881aa3, -0x1a551a6e, -0x1a271a3e, -0x17f81a11, -0x17a917cf, -0x175f1783, -0x171c173d, -0x16dd16fc, -0x16a416c0, -0x166f1689, -0x163e1656, -0x16111627, -0x13cf13f8, -0x138313a8, -0x133c135f, -0x12fb131b, -0x12bf12dd, -0x128812a3, -0x1255126e, -0x1226123d, -0x0ff61210, -0x0fa60fcd, -0x0f5d0f81, -0x0f190f3a, -0x0eda0ef9, -0x0ea10ebd, -0x0e6c0e86, -0x0e3b0e53, -0x0e0e0e24, -0x0bca0bf2, -0x0b7d0ba3, -0x0b370b59, -0x0af60b16, -0x0aba0ad7, -0x0a830a9e, -0x0a500a69, -0x0a220a39, -0x07ee0a0c, -0x079f07c6, -0x07560779, -0x07120733, -0x06d406f3, -0x069b06b7, -0x06670680, -0x0636064e, -0x060a061f, -0x03c103ea, -0x0376039b, -0x03300352, -0x02ef030f, -0x02b402d1, -0x027e0298, -0x024b0264, -0x021d0234, -0x01f20207, -0x01cb01de, -0x01a701b9, -0x00000196, -/* AIR 13: diff=43.062500 */ -0x327d328a, -0x32633270, -0x324a3257, -0x3231323e, -0x32193225, -0x3202320d, -0x2fd52fec, -0x2fa82fbf, -0x2f7c2f92, -0x2f512f66, -0x2f272f3c, -0x2efe2f12, -0x2ed72eea, -0x2eb12ec3, -0x2e8c2e9e, -0x2e682e7a, -0x2e462e57, -0x2e252e35, -0x2e052e15, -0x2bce2bec, -0x2b932bb0, -0x2b5c2b77, -0x2b272b41, -0x2af42b0d, -0x2ac42adc, -0x2a972aad, -0x2a6c2a81, -0x2a432a57, -0x2a1c2a2f, -0x27f02a0a, -0x27ab27cd, -0x276a278a, -0x272e274c, -0x26f52711, -0x26bf26da, -0x268d26a6, -0x265e2675, -0x26332648, -0x260a261e, -0x23c823ed, -0x238023a3, -0x233e235f, -0x2301231f, -0x22c722e3, -0x229222ac, -0x22612279, -0x22332249, -0x2208221d, -0x1fc21fe8, -0x1f781f9c, -0x1f351f56, -0x1ef61f15, -0x1ebc1ed8, -0x1e861ea0, -0x1e541e6c, -0x1e261e3d, -0x1bf81e10, -0x1ba91bcf, -0x1b601b84, -0x1b1d1b3e, -0x1adf1afe, -0x1aa61ac2, -0x1a711a8b, -0x1a401a58, -0x1a131a29, -0x17d417fd, -0x178817ad, -0x17411764, -0x17001720, -0x16c416e1, -0x168c16a7, -0x16591672, -0x162a1641, -0x13fd1614, -0x13ad13d4, -0x13631387, -0x131f1340, -0x12e012ff, -0x12a612c3, -0x1271128b, -0x12401258, -0x12121229, -0x0fd20ffb, -0x0f850fab, -0x0f3e0f61, -0x0efd0f1d, -0x0ec00ede, -0x0e890ea4, -0x0e560e6f, -0x0e270e3e, -0x0bf70e11, -0x0ba70bce, -0x0b5d0b82, -0x0b1a0b3b, -0x0adb0afa, -0x0aa10abe, -0x0a6c0a86, -0x0a3b0a53, -0x0a0e0a24, -0x07ca07f3, -0x077e07a3, -0x0737075a, -0x06f60716, -0x06bb06d8, -0x0684069f, -0x0651066a, -0x06220639, -0x03ef060c, -0x039f03c6, -0x0356037a, -0x03130334, -0x02d502f3, -0x029c02b8, -0x02670281, -0x0237024e, -0x020a0220, -0x01e101f5, -0x01bb01cd, -0x019801a9, -0x01780188, -0x015a0169, -0x013f014c, -0x01260132, -0x010f011a, -0x00f90104, -0x00e600ef, -0x00d300dc, -0x000000cb, -/* AIR 14: diff=21.531250 */ -0x2f692f7e, -0x2f3e2f53, -0x2f152f29, -0x2eed2f01, -0x2ec62ed9, -0x2ea02eb3, -0x2e7c2e8e, -0x2e592e6a, -0x2e372e48, -0x2e172e27, -0x2bef2e07, -0x2bb42bd1, -0x2b7b2b97, -0x2b442b5f, -0x2b102b2a, -0x2adf2af7, -0x2ab02ac7, -0x2a832a99, -0x2a592a6e, -0x2a312a45, -0x2a0c2a1e, -0x27d127f4, -0x278e27af, -0x274f276e, -0x27142731, -0x26dd26f8, -0x26a926c2, -0x26782690, -0x264b2661, -0x26202635, -0x23f2260c, -0x23a823cc, -0x23632385, -0x23232342, -0x22e72304, -0x22af22cb, -0x227c2295, -0x224c2263, -0x22202235, -0x1fed220b, -0x1fa11fc6, -0x1f5a1f7d, -0x1f181f38, -0x1edc1ef9, -0x1ea31ebf, -0x1e6f1e89, -0x1e3f1e57, -0x1e131e29, -0x1bd41bfc, -0x1b881bad, -0x1b421b64, -0x1b011b21, -0x1ac51ae3, -0x1a8e1aa9, -0x1a5b1a74, -0x1a2c1a43, -0x1a011a16, -0x17b217d9, -0x1768178c, -0x17241745, -0x16e51703, -0x16ab16c7, -0x1675168f, -0x1644165c, -0x1616162d, -0x13d91601, -0x138c13b2, -0x13441367, -0x13031323, -0x12c612e4, -0x128e12aa, -0x125b1274, -0x122b1243, -0x12001215, -0x0faf0fd7, -0x0f650f89, -0x0f210f42, -0x0ee20f00, -0x0ea70ec4, -0x0e720e8c, -0x0e410e59, -0x0e130e29, -0x0bd30bfc, -0x0b860bac, -0x0b3f0b62, -0x0afd0b1e, -0x0ac10adf, -0x0a8a0aa5, -0x0a560a6f, -0x0a270a3e, -0x07f80a11, -0x07a807cf, -0x075e0782, -0x071a073b, -0x06dc06fa, -0x06a206be, -0x066d0687, -0x063c0654, -0x060f0625, -0x03cb03f4, -0x037e03a4, -0x0338035a, -0x02f70317, -0x02bb02d8, -0x0284029f, -0x0251026a, -0x02220239, -0x01f7020c, -0x01d001e3, -0x01ab01bd, -0x0189019a, -0x016a017a, -0x014e015c, -0x01340140, -0x011b0127, -0x01050110, -0x00f000fa, -0x00dd00e7, -0x00cc00d5, -0x00bc00c4, -0x00ad00b4, -0x009f00a6, -0x00930099, -0x0087008d, -0x007d0082, -0x00730078, -0x006a006e, -0x00000065, -/* AIR 15: diff=10.765625 */ -0x2e292e39, -0x2e092e18, -0x2bd52bf3, -0x2b9a2bb7, -0x2b622b7e, -0x2b2d2b47, -0x2afa2b13, -0x2aca2ae2, -0x2a9c2ab3, -0x2a712a86, -0x2a472a5c, -0x2a212a34, -0x27f82a0e, -0x27b327d5, -0x27722792, -0x27352753, -0x26fb2718, -0x26c526e0, -0x269326ac, -0x2664267b, -0x2638264d, -0x260e2623, -0x23d023f6, -0x238923ac, -0x23462367, -0x23082326, -0x22ce22ea, -0x229822b3, -0x2266227f, -0x2238224f, -0x220d2222, -0x1fcb1ff2, -0x1f811fa5, -0x1f3c1f5e, -0x1efd1f1c, -0x1ec21edf, -0x1e8c1ea7, -0x1e5a1e72, -0x1e2b1e42, -0x1e001e15, -0x1bb21bd9, -0x1b691b8d, -0x1b251b46, -0x1ae61b05, -0x1aad1ac9, -0x1a771a91, -0x1a461a5e, -0x1a191a2f, -0x17de1a03, -0x179017b6, -0x1749176c, -0x17071728, -0x16cb16e8, -0x169316ae, -0x165f1678, -0x162f1647, -0x16031619, -0x13b613de, -0x136c1390, -0x13271349, -0x12e71306, -0x12ad12ca, -0x12771291, -0x1245125e, -0x1218122e, -0x0fdc1202, -0x0f8e0fb4, -0x0f460f69, -0x0f040f25, -0x0ec70ee5, -0x0e8f0eab, -0x0e5c0e75, -0x0e2c0e43, -0x0e000e16, -0x0bb00bd8, -0x0b660b8a, -0x0b210b43, -0x0ae20b01, -0x0aa80ac5, -0x0a720a8d, -0x0a410a59, -0x0a140a2a, -0x07d407fd, -0x078707ac, -0x073f0762, -0x06fe071e, -0x06c206df, -0x068a06a5, -0x06570670, -0x0627063f, -0x03f90611, -0x03a803d0, -0x035f0383, -0x031b033c, -0x02dc02fb, -0x02a202bf, -0x026d0287, -0x023c0254, -0x020f0225, -0x01e501fa, -0x01bf01d2, -0x019c01ad, -0x017b018b, -0x015e016c, -0x01420150, -0x01290135, -0x0111011d, -0x00fc0106, -0x00e800f2, -0x00d600df, -0x00c500cd, -0x00b500bd, -0x00a700ae, -0x009a00a0, -0x008e0094, -0x00820088, -0x0078007d, -0x006f0073, -0x0066006a, -0x005e0062, -0x0057005a, -0x00500053, -0x0049004d, -0x00440046, -0x003e0041, -0x0039003c, -0x00350037, -0x00000033, - /* RDF 0: 1/1: 255.000000 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x2a402a00, -0x2ac02a80, -0x2b402b00, -0x2bc02b80, -0x2e202e00, -0x2e602e40, -0x2ea02e80, -0x2ee02ec0, -0x2f202f00, -0x2f602f40, -0x2fa02f80, -0x2fe02fc0, -0x32103200, -0x32303220, -0x32503240, -0x32703260, -0x32903280, -0x32b032a0, -0x32d032c0, -0x32f032e0, -0x33103300, -0x33303320, -0x33503340, -0x33703360, -0x33903380, -0x33b033a0, -0x33d033c0, -0x33f033e0, -0x36083600, -0x36183610, -0x36283620, -0x36383630, -0x36483640, -0x36583650, -0x36683660, -0x36783670, -0x36883680, -0x36983690, -0x36a836a0, -0x36b836b0, -0x36c836c0, -0x36d836d0, -0x36e836e0, -0x36f836f0, -0x37083700, -0x37183710, -0x37283720, -0x37383730, -0x37483740, -0x37583750, -0x37683760, -0x37783770, -0x37883780, -0x37983790, -0x37a837a0, -0x37b837b0, -0x37c837c0, -0x37d837d0, -0x37e837e0, -0x37f837f0, -0x3a043a00, -0x3a0c3a08, -0x3a143a10, -0x3a1c3a18, -0x3a243a20, -0x3a2c3a28, -0x3a343a30, -0x3a3c3a38, -0x3a443a40, -0x3a4c3a48, -0x3a543a50, -0x3a5c3a58, -0x3a643a60, -0x3a6c3a68, -0x3a743a70, -0x3a7c3a78, -0x3a843a80, -0x3a8c3a88, -0x3a943a90, -0x3a9c3a98, -0x3aa43aa0, -0x3aac3aa8, -0x3ab43ab0, -0x3abc3ab8, -0x3ac43ac0, -0x3acc3ac8, -0x3ad43ad0, -0x3adc3ad8, -0x3ae43ae0, -0x3aec3ae8, -0x3af43af0, -0x3afc3af8, -0x3b043b00, -0x3b0c3b08, -0x3b143b10, -0x3b1c3b18, -0x3b243b20, -0x3b2c3b28, -0x3b343b30, -0x3b3c3b38, -0x3b443b40, -0x3b4c3b48, -0x3b543b50, -0x3b5c3b58, -0x3b643b60, -0x3b6c3b68, -0x3b743b70, -0x3b7c3b78, -0x3b843b80, -0x3b8c3b88, -0x3b943b90, -0x3b9c3b98, -0x3ba43ba0, -0x3bac3ba8, -0x3bb43bb0, -0x3bbc3bb8, -0x3bc43bc0, -0x3bcc3bc8, -0x3bd43bd0, -0x3bdc3bd8, -0x3be43be0, -0x3bec3be8, -0x3bf43bf0, -0x3bfc3bf8, - /* RDF 1: 1/2: 16.880227 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x2a402a00, -0x2ac02a80, -0x2b402b00, -0x2bc02b80, -0x2e1c2e00, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, -0x2e1c2e1c, - /* RDF 2: 1/4: 7.005927 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, -0x27802780, - /* RDF 3: 1/8: 3.251893 */ -0x1e000000, -0x23002200, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, -0x23402340, - /* RDF 4: 1/16: 1.571708 */ -0x1e000000, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, -0x1f241f24, - /* RDF 5: 1/32: 0.773177 */ -0x1b170000, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, -0x1b171b17, - /* RDF 6: 1/64: 0.383520 */ -0x17110000, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, -0x17111711, - /* RDF 7: 1/128: 0.191005 */ -0x130e0000, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, -0x130e130e, - /* RDF 8: 1/256: 0.095315 */ -0x0f0c0000, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, -0x0f0c0f0c, - /* RDF 9: 1/512: 0.047611 */ -0x0b0c0000, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, -0x0b0c0b0c, - /* RDF 10: 1/1024: 0.023794 */ -0x070b0000, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, -0x070b070b, - /* RDF 11: 1/2048: 0.011894 */ -0x030b0000, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, -0x030b030b, - /* RDF 12: 1/4096: 0.005946 */ -0x01860000, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, -0x01860186, - /* RDF 13: 1/8192: 0.002973 */ -0x00c30000, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, -0x00c300c3, - /* RDF 14: 1/16384: 0.001486 */ -0x00610000, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, -0x00610061, - /* RDF 15: 1/32768: 0.000743 */ -0x00310000, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -0x00310031, -}; - -/* - * Tables for 59259cps and 25Mbps - */ -const uint32_t patm_rtables25[128 * (4 + 2 * 16)] = { -0x8d0222e4, -0x8d3022cb, -0x8d5e22b3, -0x8d8c229c, -0x8dbc2286, -0x8df02270, -0x8e26225b, -0x8e5c2247, -0x8e922234, -0x8ecc2221, -0x8f0c220e, -0x8f481ffa, -0x8f881fd8, -0x8fca1fb7, -0x90081f97, -0x902c1f78, -0x90521f5a, -0x90781f3e, -0x90a01f22, -0x90c81f07, -0x90f21eed, -0x911e1ed4, -0x914c1ebc, -0x917c1ea4, -0x91aa1e8e, -0x91de1e78, -0x92141e62, -0x92481e4e, -0x92801e3a, -0x92ba1e27, -0x92f41e15, -0x93321e03, -0x93701be4, -0x93b41bc2, -0x93f81ba2, -0x94201b83, -0x94441b65, -0x946a1b48, -0x94921b2b, -0x94ba1b10, -0x94e41af6, -0x950e5add, -0x953c5ac4, -0x956c5aac, -0x959c5a95, -0x95cc5a7f, -0x96005a6a, -0x96365a55, -0x966c5a41, -0x96a45a2e, -0x96e05a1b, -0x971c5a09, -0x975c57ef, -0x979c57ce, -0x97e057ad, -0x9814578d, -0x9838576f, -0x985c5752, -0x98845735, -0x98ac571a, -0x98d656ff, -0x990096e5, -0x992e96cc, -0x995c96b4, -0x998a969d, -0x99ba9687, -0x99ee9671, -0x9a22965c, -0x9a589648, -0x9a929634, -0x9acc9621, -0x9b08960f, -0x9b4693fb, -0x9b8693d9, -0x9bc893b8, -0x9c089398, -0x9c2c9379, -0x9c50935c, -0x9c76933f, -0x9c9e9323, -0x9cc69308, -0x9cf292ee, -0x9d1cd2d5, -0x9d4ad2bd, -0x9d7ad2a5, -0x9daad28e, -0x9ddad279, -0x9e10d263, -0x9e46d24f, -0x9e7ed23b, -0x9eb6d228, -0x9ef4d215, -0x9f32d203, -0x9f6ecfe5, -0x9fb2cfc3, -0x9ff6cfa3, -0xa01ecf84, -0xa042cf66, -0xa068cf49, -0xa090cf2d, -0xa0b8cf11, -0xa0e2cef7, -0xa10d0ede, -0xa13b0ec5, -0xa16b0ead, -0xa19b0e96, -0xa1cb0e80, -0xa1fd0e6b, -0xa2330e56, -0xa26b0e42, -0xa2a50e2e, -0xa2dd0e1c, -0xa31b0e0a, -0xa3590bf1, -0xa39b0bcf, -0xa3df0bae, -0xa4130b8f, -0xa4370b70, -0xa45d0b53, -0xa4830b36, -0xa4ab0b1b, -0xa4d50b00, -0xa4ff0ae6, -0xa52d0acd, -0xa55b0ab5, -0xa5890a9e, -0xa5b90a88, -0xa5ed0a72, -0xa6210a5d, -0xa6570a49, -0xa6910a35, -0xa6cb0a22, -0xa7050a10, -0xa74307fd, -0xa78307db, -0xa7c707b9, -0xa807079a, -0xa82b077b, -0xa84f075d, -0xa8750740, -0xa89d0724, -0xa8c70709, -0xa8f106ef, -0xa91b06d6, -0xa94906be, -0xa97906a6, -0xa9a9068f, -0xa9db0679, -0xaa0f0664, -0xaa430650, -0xaa7b063c, -0xaab50629, -0xaaf10616, -0xab2f0604, -0xab6f03e6, -0xabaf03c5, -0xabf503a4, -0xac1f0385, -0xac430367, -0xac69034a, -0xac8f032e, -0xacb90312, -0xace102f8, -0xad0b02df, -0xad3902c6, -0xad6902ae, -0xad990297, -0xadc90281, -0xadfd026b, -0xae310257, -0xae670243, -0xaea3022f, -0xaedd021c, -0xaf1b020a, -0xaf5701f9, -0xaf9901e8, -0xafdb01d8, -0xb01101c8, -0xb03701b8, -0xb05b01aa, -0xb083019b, -0xb0a9018e, -0xb0d50180, -0xb0ff0173, -0xb12b0167, -0xb159015b, -0xb189014f, -0xb1b90144, -0xb1ed0139, -0xb21f012f, -0xb2590124, -0xb28d011b, -0xb2cb0111, -0xb3050108, -0xb34500ff, -0xb38100f7, -0xb3c900ee, -0xb40900e6, -0xb42900df, -0xb45100d7, -0xb47500d0, -0xb49d00c9, -0xb4c700c2, -0xb4ef00bc, -0xb51f00b5, -0xb54d00af, -0xb57d00a9, -0xb5a700a4, -0xb5df009e, -0xb60f0099, -0xb6430094, -0xb67b008f, -0xb6b7008a, -0xb6f90085, -0xb72f0081, -0xb76b007d, -0xb7b90078, -0xb7fd0074, -0xb8250070, -0xb841006d, -0xb86b0069, -0xb8970065, -0xb8bb0062, -0xb8e1005f, -0xb90b005c, -0xb9450058, -0xb9750055, -0xb9950053, -0xb9cb0050, -0xba05004d, -0xba43004a, -0xba710048, -0xba9f0046, -0xbaeb0043, -0xbb210041, -0xbb5b003f, -0xbb99003d, -0xbbdb003b, -0xbc110039, -0xbc370037, -0xbc610035, -0xbc8b0033, -0xbcbb0031, -0xbcd50030, -0xbd0b002e, -0xbd45002c, -0xbd65002b, -0xbd85002a, -0xbdcb0028, -0xbdf10027, -0xbe430025, -0xbe710024, -0xbe9f0023, -0xbed10022, -0xbf050021, -0xbf3d0020, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x04030100, -0x09080705, -0x0d0c0b0a, -0x1311100e, -0x18171614, -0x1d1c1b1a, -0x21201f1e, -0x27262422, -0x2d2b2a29, -0x32302f2e, -0x36353433, -0x3c3a3836, -0x41403e3d, -0x46454442, -0x4a494847, -0x504e4d4b, -0x55545351, -0x5a595857, -0x5e5d5c5b, -0x6463615f, -0x6a696766, -0x6f6d6c6b, -0x73727170, -0x79777574, -0x7e7d7c7a, -0x8382817f, -0x87868584, -0x8d8b8a88, -0x9391908e, -0x97969594, -0x9b9a9998, -0xa1a09e9c, -0xa7a6a4a3, -0xacaaa9a8, -0xb0afaead, -0xb6b4b2b1, -0xbbbab9b7, -0xc0bfbebc, -0xc4c3c2c1, -0xcac8c7c5, -0xd0cecdcb, -0xd4d3d2d1, -0xd8d7d6d5, -0xdedddbd9, -0xe4e3e1e0, -0xe9e8e6e5, -0xedecebea, -0xf3f1efee, -0xf8f7f6f4, -0xfdfcfbfa, -0xfffffffe, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0x00005f9e, -0x00005d9e, -0x00015b9e, -0x0001599e, -0x0003579e, -0x0003559e, -0x00030000, -0x00030000, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* AIR 0: diff=59259.000000 */ -0x3bf83bfc, -0x3bf03bf4, -0x3be83bec, -0x3be03be4, -0x3bd83bdc, -0x3bd03bd4, -0x3bc83bcc, -0x3bc03bc4, -0x3bb83bbc, -0x3bb03bb4, -0x3ba83bac, -0x3ba03ba4, -0x3b983b9c, -0x3b903b94, -0x3b883b8c, -0x3b803b84, -0x3b783b7c, -0x3b703b74, -0x3b683b6c, -0x3b603b64, -0x3b583b5c, -0x3b503b54, -0x3b483b4c, -0x3b403b44, -0x3b383b3c, -0x3b303b34, -0x3b283b2c, -0x3b203b24, -0x3b183b1c, -0x3b103b14, -0x3b083b0c, -0x3b003b04, -0x3af83afc, -0x3af03af4, -0x3ae83aec, -0x3ae03ae4, -0x3ad83adc, -0x3ad03ad4, -0x3ac83acc, -0x3ac03ac4, -0x3ab83abc, -0x3ab03ab4, -0x3aa83aac, -0x3aa03aa4, -0x3a983a9c, -0x3a903a94, -0x3a883a8c, -0x3a803a84, -0x3a783a7c, -0x3a703a74, -0x3a683a6c, -0x3a603a64, -0x3a583a5c, -0x3a503a54, -0x3a483a4c, -0x3a403a44, -0x3a383a3c, -0x3a303a34, -0x3a283a2c, -0x3a203a24, -0x3a183a1c, -0x3a103a14, -0x3a083a0c, -0x3a003a04, -0x37f037f8, -0x37e037e8, -0x37d037d8, -0x37c037c8, -0x37b037b8, -0x37a037a8, -0x37903798, -0x37803788, -0x37703778, -0x37603768, -0x37503758, -0x37403748, -0x37303738, -0x37203728, -0x37103718, -0x37003708, -0x36f036f8, -0x36e036e8, -0x36d036d8, -0x36c036c8, -0x36b036b8, -0x36a036a8, -0x36903698, -0x36803688, -0x36703678, -0x36603668, -0x36503658, -0x36403648, -0x36303638, -0x36203628, -0x36103618, -0x36003608, -0x33e033f0, -0x33c033d0, -0x33a033b0, -0x33803390, -0x33603370, -0x33403350, -0x33203330, -0x33003310, -0x32e032f0, -0x32c032d0, -0x32a032b0, -0x32803290, -0x32603270, -0x32403250, -0x32203230, -0x32003210, -0x2fc02fe0, -0x2f802fa0, -0x2f402f60, -0x2f002f20, -0x2ec02ee0, -0x2e802ea0, -0x2e402e60, -0x2e002e20, -0x2b802bc0, -0x2b002b40, -0x2a802ac0, -0x2a002a40, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 1: diff=29629.500000 */ -0x3ba63baa, -0x3b9e3ba2, -0x3b963b9a, -0x3b8e3b92, -0x3b863b8a, -0x3b7e3b82, -0x3b763b7a, -0x3b6e3b72, -0x3b663b6a, -0x3b5e3b62, -0x3b563b5a, -0x3b4e3b52, -0x3b463b4a, -0x3b3e3b42, -0x3b363b3a, -0x3b2e3b32, -0x3b263b2a, -0x3b1e3b22, -0x3b163b1a, -0x3b0e3b12, -0x3b063b0a, -0x3afe3b02, -0x3af63afa, -0x3aee3af2, -0x3ae63aea, -0x3ade3ae2, -0x3ad63ada, -0x3ace3ad2, -0x3ac63aca, -0x3abe3ac2, -0x3ab63aba, -0x3aae3ab2, -0x3aa63aaa, -0x3a9f3aa2, -0x3a973a9b, -0x3a8f3a93, -0x3a873a8b, -0x3a7f3a83, -0x3a773a7b, -0x3a6f3a73, -0x3a673a6b, -0x3a5f3a63, -0x3a573a5b, -0x3a4f3a53, -0x3a473a4b, -0x3a3f3a43, -0x3a373a3b, -0x3a2f3a33, -0x3a273a2b, -0x3a1f3a23, -0x3a173a1b, -0x3a0f3a13, -0x3a083a0b, -0x3a003a04, -0x37f037f8, -0x37e037e8, -0x37d037d8, -0x37c137c9, -0x37b137b9, -0x37a137a9, -0x37923799, -0x3782378a, -0x3772377a, -0x3763376a, -0x3753375b, -0x3744374b, -0x3734373c, -0x3724372c, -0x3715371d, -0x3706370d, -0x36f636fe, -0x36e736ef, -0x36d836df, -0x36c836d0, -0x36b936c1, -0x36aa36b2, -0x369b36a2, -0x368c3693, -0x367d3684, -0x366e3675, -0x365f3666, -0x36503658, -0x36423649, -0x3633363a, -0x3625362c, -0x3616361d, -0x3608360f, -0x33f43601, -0x33d833e6, -0x33bc33ca, -0x33a033ae, -0x33853392, -0x33693377, -0x334e335c, -0x33343341, -0x331a3327, -0x3300330d, -0x32e632f3, -0x32cd32d9, -0x32b432c0, -0x329c32a8, -0x3283328f, -0x326c3278, -0x32553260, -0x323e3249, -0x32273233, -0x3212321c, -0x2ff93207, -0x2fcf2fe4, -0x2fa62fba, -0x2f7e2f92, -0x2f572f6b, -0x2f322f44, -0x2f0d2f1f, -0x2ee92efb, -0x2ec72ed8, -0x2ea52eb6, -0x2e802e95, -0x2e402e60, -0x2e002e20, -0x2b802bc0, -0x2b002b40, -0x2a802ac0, -0x2a002a40, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 2: diff=14814.750000 */ -0x3b553b59, -0x3b4d3b51, -0x3b453b49, -0x3b3d3b41, -0x3b353b39, -0x3b2d3b31, -0x3b253b29, -0x3b1d3b21, -0x3b153b19, -0x3b0d3b11, -0x3b053b09, -0x3afd3b01, -0x3af53af9, -0x3aed3af1, -0x3ae53ae9, -0x3add3ae1, -0x3ad53ad9, -0x3acd3ad1, -0x3ac53ac9, -0x3abd3ac1, -0x3ab53ab9, -0x3aad3ab1, -0x3aa53aa9, -0x3a9d3aa1, -0x3a953a99, -0x3a8d3a91, -0x3a853a89, -0x3a7d3a81, -0x3a753a79, -0x3a6d3a71, -0x3a653a69, -0x3a5d3a61, -0x3a553a59, -0x3a4e3a51, -0x3a463a4a, -0x3a3e3a42, -0x3a363a3a, -0x3a2e3a32, -0x3a263a2a, -0x3a1e3a22, -0x3a163a1a, -0x3a0e3a12, -0x3a063a0a, -0x37fd3a02, -0x37ed37f5, -0x37dd37e5, -0x37ce37d6, -0x37be37c6, -0x37ae37b6, -0x379f37a6, -0x378f3797, -0x377f3787, -0x37703777, -0x37603768, -0x37503758, -0x37413749, -0x37313739, -0x3722372a, -0x3712371a, -0x3703370b, -0x36f436fb, -0x36e436ec, -0x36d536dd, -0x36c636cd, -0x36b636be, -0x36a736af, -0x369836a0, -0x36893691, -0x367a3682, -0x366b3673, -0x365d3664, -0x364e3655, -0x363f3646, -0x36313638, -0x36223629, -0x3614361b, -0x3605360d, -0x33ef33fd, -0x33d333e1, -0x33b733c5, -0x339b33a9, -0x3380338d, -0x33653372, -0x334a3357, -0x332f333d, -0x33153322, -0x32fb3308, -0x32e232ee, -0x32c932d5, -0x32b032bc, -0x329732a4, -0x327f328b, -0x32683273, -0x3251325c, -0x323a3245, -0x3224322f, -0x320e3219, -0x2ff13203, -0x2fc82fdc, -0x2f9f2fb3, -0x2f772f8b, -0x2f512f64, -0x2f2b2f3e, -0x2f072f19, -0x2ee32ef5, -0x2ec12ed2, -0x2ea02eb0, -0x2e802e90, -0x2e602e70, -0x2e422e51, -0x2e262e34, -0x2e0a2e18, -0x2bde2bf9, -0x2bab2bc5, -0x2b7a2b92, -0x2b4a2b62, -0x2b1d2b34, -0x2af22b07, -0x2ac82add, -0x2aa12ab5, -0x2a7b2a8e, -0x2a572a69, -0x2a352a46, -0x2a002a25, -0x27002780, -0x26002680, -0x22002300, -0x00001e00, -/* AIR 3: diff=7407.375000 */ -0x3b043b07, -0x3afc3b00, -0x3af43af8, -0x3aec3af0, -0x3ae43ae8, -0x3adc3ae0, -0x3ad43ad8, -0x3acc3ad0, -0x3ac43ac8, -0x3abc3ac0, -0x3ab43ab8, -0x3aac3ab0, -0x3aa43aa8, -0x3a9c3aa0, -0x3a943a98, -0x3a8c3a90, -0x3a843a88, -0x3a7c3a80, -0x3a743a78, -0x3a6c3a70, -0x3a643a68, -0x3a5c3a60, -0x3a543a58, -0x3a4c3a50, -0x3a443a48, -0x3a3c3a40, -0x3a343a38, -0x3a2c3a30, -0x3a243a28, -0x3a1d3a20, -0x3a153a19, -0x3a0d3a11, -0x3a053a09, -0x37fa3a01, -0x37ea37f2, -0x37db37e3, -0x37cb37d3, -0x37bb37c3, -0x37ac37b3, -0x379c37a4, -0x378c3794, -0x377c3784, -0x376d3775, -0x375d3765, -0x374e3755, -0x373e3746, -0x372f3736, -0x371f3727, -0x37103717, -0x37003708, -0x36f136f9, -0x36e236e9, -0x36d236da, -0x36c336cb, -0x36b436bb, -0x36a536ac, -0x3696369d, -0x3687368e, -0x3678367f, -0x36693670, -0x365a3661, -0x364b3653, -0x363d3644, -0x362e3635, -0x36203627, -0x36113618, -0x3603360a, -0x33ea33f8, -0x33ce33dc, -0x33b233c0, -0x339633a4, -0x337b3389, -0x3360336e, -0x33453353, -0x332b3338, -0x3311331e, -0x32f73304, -0x32dd32ea, -0x32c432d1, -0x32ac32b8, -0x3293329f, -0x327b3287, -0x3264326f, -0x324d3258, -0x32363241, -0x3220322b, -0x320a3215, -0x2fea2fff, -0x2fc12fd5, -0x2f982fac, -0x2f712f84, -0x2f4a2f5d, -0x2f252f37, -0x2f012f13, -0x2edd2eef, -0x2ebb2ecc, -0x2e9a2eaa, -0x2e7a2e8a, -0x2e5b2e6b, -0x2e3d2e4c, -0x2e212e2f, -0x2e052e13, -0x2bd52bf0, -0x2ba22bbc, -0x2b712b8a, -0x2b422b5a, -0x2b162b2c, -0x2aeb2b00, -0x2ac22ad6, -0x2a9a2aae, -0x2a752a87, -0x2a512a63, -0x2a302a40, -0x2a0f2a1f, -0x27e22a00, -0x27a827c5, -0x2771278c, -0x273d2757, -0x270c2724, -0x26dd26f4, -0x26b126c7, -0x2687269c, -0x26602673, -0x263b264d, -0x26182629, -0x23ee2607, -0x22002300, -0x00001e00, -/* AIR 4: diff=3703.687500 */ -0x3ab23ab6, -0x3aaa3aae, -0x3aa23aa6, -0x3a9a3a9e, -0x3a923a96, -0x3a8a3a8e, -0x3a823a86, -0x3a7a3a7e, -0x3a733a77, -0x3a6b3a6f, -0x3a633a67, -0x3a5b3a5f, -0x3a533a57, -0x3a4b3a4f, -0x3a433a47, -0x3a3b3a3f, -0x3a333a37, -0x3a2b3a2f, -0x3a233a27, -0x3a1b3a1f, -0x3a133a17, -0x3a0b3a0f, -0x3a033a07, -0x37f837ff, -0x37e837f0, -0x37d837e0, -0x37c837d0, -0x37b937c0, -0x37a937b1, -0x379937a1, -0x37893791, -0x377a3782, -0x376a3772, -0x375b3762, -0x374b3753, -0x373b3743, -0x372c3734, -0x371c3724, -0x370d3715, -0x36fe3705, -0x36ee36f6, -0x36df36e7, -0x36d036d7, -0x36c036c8, -0x36b136b9, -0x36a236aa, -0x3693369b, -0x3684368c, -0x3675367d, -0x3666366e, -0x3657365f, -0x36493650, -0x363a3641, -0x362c3633, -0x361d3624, -0x360f3616, -0x36003608, -0x33e533f3, -0x33c933d7, -0x33ad33bb, -0x3392339f, -0x33763384, -0x335b3369, -0x3341334e, -0x33263333, -0x330c3319, -0x32f232ff, -0x32d932e6, -0x32c032cc, -0x32a732b4, -0x328f329b, -0x32773283, -0x3260326b, -0x32493254, -0x3232323d, -0x321c3227, -0x32063211, -0x2fe32ff8, -0x2fba2fce, -0x2f912fa5, -0x2f6a2f7d, -0x2f442f57, -0x2f1e2f31, -0x2efa2f0c, -0x2ed72ee9, -0x2eb52ec6, -0x2e942ea5, -0x2e752e84, -0x2e562e65, -0x2e382e47, -0x2e1c2e2a, -0x2e002e0e, -0x2bcc2be7, -0x2b9a2bb3, -0x2b692b81, -0x2b3b2b52, -0x2b0e2b24, -0x2ae32af8, -0x2abb2acf, -0x2a942aa7, -0x2a6f2a81, -0x2a4b2a5d, -0x2a2a2a3a, -0x2a0a2a1a, -0x27d827f6, -0x279e27bb, -0x27682783, -0x2734274e, -0x2703271c, -0x26d526ec, -0x26a926bf, -0x26802695, -0x2659266c, -0x26342647, -0x26122623, -0x23e22601, -0x23a523c3, -0x236b2387, -0x2334234f, -0x2301231a, -0x22d022e8, -0x22a322b9, -0x2278228d, -0x22502264, -0x222b223d, -0x22072219, -0x1fcd1fed, -0x00001e00, -/* AIR 5: diff=1851.843750 */ -0x3a613a65, -0x3a593a5d, -0x3a513a55, -0x3a493a4d, -0x3a413a45, -0x3a393a3d, -0x3a323a36, -0x3a2a3a2e, -0x3a223a26, -0x3a1a3a1e, -0x3a123a16, -0x3a0a3a0e, -0x3a023a06, -0x37f537fd, -0x37e537ed, -0x37d537dd, -0x37c637cd, -0x37b637be, -0x37a637ae, -0x3796379e, -0x3787378f, -0x3777377f, -0x3767376f, -0x37583760, -0x37483750, -0x37393741, -0x37293731, -0x371a3721, -0x370a3712, -0x36fb3703, -0x36ec36f3, -0x36dc36e4, -0x36cd36d5, -0x36be36c5, -0x36af36b6, -0x369f36a7, -0x36903698, -0x36813689, -0x3672367a, -0x3664366b, -0x3655365c, -0x3646364d, -0x3638363f, -0x36293630, -0x361b3622, -0x360c3613, -0x33fc3605, -0x33e033ee, -0x33c433d2, -0x33a833b6, -0x338d339b, -0x3372337f, -0x33573364, -0x333c3349, -0x3322332f, -0x33083315, -0x32ee32fb, -0x32d532e1, -0x32bc32c8, -0x32a332af, -0x328b3297, -0x3273327f, -0x325c3267, -0x32453250, -0x322e3239, -0x32183223, -0x3203320d, -0x2fdc2ff1, -0x2fb22fc7, -0x2f8a2f9e, -0x2f632f77, -0x2f3d2f50, -0x2f182f2b, -0x2ef42f06, -0x2ed12ee3, -0x2eb02ec0, -0x2e8f2e9f, -0x2e6f2e7f, -0x2e512e60, -0x2e332e42, -0x2e172e25, -0x2bf82e09, -0x2bc32bdd, -0x2b912baa, -0x2b612b79, -0x2b332b4a, -0x2b062b1c, -0x2adc2af1, -0x2ab42ac8, -0x2a8d2aa0, -0x2a682a7b, -0x2a462a57, -0x2a242a35, -0x2a052a14, -0x27ce27eb, -0x279527b1, -0x275f2779, -0x272c2745, -0x26fb2713, -0x26cd26e4, -0x26a226b8, -0x2679268d, -0x26532666, -0x262e2640, -0x260c261d, -0x23d823f7, -0x239b23b9, -0x2361237d, -0x232b2346, -0x22f82311, -0x22c822e0, -0x229b22b2, -0x22712286, -0x224a225d, -0x22242237, -0x22012213, -0x1fc21fe2, -0x1f841fa3, -0x1f4b1f67, -0x1f141f2f, -0x1ee21efb, -0x1eb21eca, -0x1e861e9c, -0x1e5c1e71, -0x1e351e48, -0x1e101e22, -0x1bdd1bfe, -0x00001bbc, -/* AIR 6: diff=925.921875 */ -0x3a103a14, -0x3a093a0d, -0x3a013a05, -0x37f237fa, -0x37e237ea, -0x37d337da, -0x37c337cb, -0x37b337bb, -0x37a337ab, -0x3794379c, -0x3784378c, -0x3774377c, -0x3765376d, -0x3755375d, -0x3746374d, -0x3736373e, -0x3727372e, -0x3717371f, -0x3708370f, -0x36f83700, -0x36e936f1, -0x36da36e1, -0x36ca36d2, -0x36bb36c3, -0x36ac36b4, -0x369d36a4, -0x368e3695, -0x367f3686, -0x36703677, -0x36613668, -0x3652365a, -0x3644364b, -0x3635363c, -0x3626362e, -0x3618361f, -0x360a3611, -0x33f83603, -0x33db33e9, -0x33bf33cd, -0x33a433b1, -0x33883396, -0x336d337b, -0x3352335f, -0x33373345, -0x331d332a, -0x33033310, -0x32ea32f6, -0x32d032dd, -0x32b732c4, -0x329f32ab, -0x32873293, -0x326f327b, -0x32583263, -0x3241324c, -0x322a3236, -0x3214321f, -0x2ffe320a, -0x2fd42fe9, -0x2fab2fc0, -0x2f832f97, -0x2f5d2f70, -0x2f372f49, -0x2f122f24, -0x2eee2f00, -0x2ecb2edd, -0x2eaa2eba, -0x2e892e99, -0x2e6a2e79, -0x2e4c2e5b, -0x2e2e2e3d, -0x2e122e20, -0x2bef2e05, -0x2bbb2bd4, -0x2b892ba1, -0x2b592b70, -0x2b2b2b42, -0x2aff2b15, -0x2ad52aea, -0x2aad2ac1, -0x2a872a9a, -0x2a622a74, -0x2a402a51, -0x2a1f2a2f, -0x27ff2a0f, -0x27c427e1, -0x278b27a7, -0x27562770, -0x2723273c, -0x26f3270b, -0x26c626dc, -0x269b26b0, -0x26722686, -0x264c265f, -0x2628263a, -0x26062617, -0x23cd23ec, -0x239023ae, -0x23572373, -0x2322233c, -0x22f02308, -0x22c022d8, -0x229422aa, -0x226a227f, -0x22432256, -0x221e2230, -0x1ff8220d, -0x1fb71fd7, -0x1f7a1f98, -0x1f411f5d, -0x1f0b1f26, -0x1ed91ef2, -0x1eaa1ec1, -0x1e7e1e94, -0x1e551e69, -0x1e2e1e41, -0x1e0a1e1c, -0x1bd11bf3, -0x1b921bb1, -0x1b561b74, -0x1b1f1b3a, -0x1aeb1b04, -0x1aba1ad2, -0x1a8d1aa3, -0x1a621a77, -0x1a3a1a4e, -0x1a151a27, -0x17e51a03, -0x000017c4, -/* AIR 7: diff=462.960938 */ -0x37813789, -0x37723779, -0x3762376a, -0x3752375a, -0x3743374b, -0x3733373b, -0x3724372c, -0x3714371c, -0x3705370d, -0x36f636fd, -0x36e636ee, -0x36d736df, -0x36c836cf, -0x36b836c0, -0x36a936b1, -0x369a36a2, -0x368b3693, -0x367c3684, -0x366d3675, -0x365f3666, -0x36503657, -0x36413648, -0x3632363a, -0x3624362b, -0x3616361d, -0x3607360e, -0x33f33600, -0x33d633e5, -0x33bb33c8, -0x339f33ad, -0x33833391, -0x33683376, -0x334d335b, -0x33333340, -0x33193326, -0x32ff330c, -0x32e532f2, -0x32cc32d8, -0x32b332bf, -0x329b32a7, -0x3283328f, -0x326b3277, -0x3254325f, -0x323d3248, -0x32273232, -0x3211321c, -0x2ff73206, -0x2fcd2fe2, -0x2fa42fb9, -0x2f7d2f90, -0x2f562f69, -0x2f302f43, -0x2f0c2f1e, -0x2ee82efa, -0x2ec62ed7, -0x2ea42eb5, -0x2e842e94, -0x2e652e74, -0x2e462e55, -0x2e292e38, -0x2e0d2e1b, -0x2be62e00, -0x2bb22bcb, -0x2b802b99, -0x2b512b68, -0x2b232b3a, -0x2af82b0d, -0x2ace2ae2, -0x2aa62aba, -0x2a802a93, -0x2a5c2a6e, -0x2a3a2a4b, -0x2a192a29, -0x27f52a09, -0x27ba27d7, -0x2782279d, -0x274d2767, -0x271b2733, -0x26eb2703, -0x26be26d4, -0x269426a9, -0x266c267f, -0x26462658, -0x26222634, -0x26002611, -0x23c223e1, -0x238623a4, -0x234e236a, -0x23192333, -0x22e72300, -0x22b922d0, -0x228d22a2, -0x22632278, -0x223c2250, -0x2218222a, -0x1fec2207, -0x1fac1fcc, -0x1f701f8d, -0x1f371f53, -0x1f031f1d, -0x1ed11ee9, -0x1ea21eb9, -0x1e771e8c, -0x1e4e1e62, -0x1e281e3b, -0x1e041e16, -0x1bc61be7, -0x1b871ba6, -0x1b4c1b69, -0x1b161b31, -0x1ae21afb, -0x1ab21aca, -0x1a851a9b, -0x1a5b1a70, -0x1a341a47, -0x1a0f1a21, -0x17d917fb, -0x179917b8, -0x175c177a, -0x17241740, -0x16ef1709, -0x16be16d6, -0x169016a7, -0x1665167a, -0x163d1651, -0x1617162a, -0x13e91605, -0x000013c8, -/* AIR 8: diff=231.480469 */ -0x36e436eb, -0x36d436dc, -0x36c536cd, -0x36b636bd, -0x36a736ae, -0x3698369f, -0x36893690, -0x367a3681, -0x366b3672, -0x365c3663, -0x364d3655, -0x363f3646, -0x36303637, -0x36213629, -0x3613361a, -0x3605360c, -0x33ee33fc, -0x33d233e0, -0x33b633c4, -0x339a33a8, -0x337f338c, -0x33643371, -0x33493356, -0x332e333c, -0x33143321, -0x32fa3307, -0x32e132ed, -0x32c832d4, -0x32af32bb, -0x329632a3, -0x327e328a, -0x32673273, -0x3250325b, -0x32393244, -0x3223322e, -0x320d3218, -0x2ff03202, -0x2fc62fdb, -0x2f9d2fb2, -0x2f762f8a, -0x2f4f2f62, -0x2f2a2f3c, -0x2f052f17, -0x2ee22ef4, -0x2ec02ed1, -0x2e9e2eaf, -0x2e7e2e8e, -0x2e5f2e6f, -0x2e412e50, -0x2e242e33, -0x2e092e16, -0x2bdc2bf7, -0x2ba92bc2, -0x2b782b90, -0x2b492b60, -0x2b1b2b32, -0x2af02b06, -0x2ac72adb, -0x2a9f2ab3, -0x2a7a2a8c, -0x2a562a68, -0x2a342a45, -0x2a142a24, -0x27ea2a04, -0x27b027cd, -0x27782794, -0x2744275e, -0x2712272b, -0x26e326fa, -0x26b726cd, -0x268d26a1, -0x26652678, -0x263f2652, -0x261c262e, -0x23f6260b, -0x23b723d6, -0x237c2399, -0x23452360, -0x2310232a, -0x22df22f7, -0x22b122c7, -0x2285229b, -0x225c2270, -0x22362249, -0x22122224, -0x1fe12201, -0x1fa11fc1, -0x1f661f83, -0x1f2e1f49, -0x1efa1f13, -0x1ec91ee1, -0x1e9b1eb1, -0x1e701e85, -0x1e471e5b, -0x1e221e34, -0x1bfd1e10, -0x1bbb1bdb, -0x1b7d1b9b, -0x1b431b5f, -0x1b0c1b27, -0x1ada1af3, -0x1aaa1ac1, -0x1a7e1a93, -0x1a541a68, -0x1a2d1a40, -0x1a091a1b, -0x17ce17ef, -0x178e17ad, -0x17521770, -0x171b1736, -0x16e71700, -0x16b616ce, -0x1689169f, -0x165e1673, -0x1636164a, -0x16111623, -0x13dd13ff, -0x139c13bc, -0x1360137d, -0x13271343, -0x12f2130c, -0x12c012d9, -0x129212a9, -0x1267127c, -0x123e1252, -0x1219122b, -0x0feb1207, -0x00000fc9, -/* AIR 9: diff=115.740234 */ -0x364b3652, -0x363c3643, -0x362d3635, -0x361f3626, -0x36113618, -0x36023609, -0x33e933f7, -0x33cd33db, -0x33b133bf, -0x339533a3, -0x337a3388, -0x335f336c, -0x33443352, -0x332a3337, -0x3310331d, -0x32f63303, -0x32dc32e9, -0x32c332d0, -0x32ab32b7, -0x3292329e, -0x327a3286, -0x3263326e, -0x324c3257, -0x32353240, -0x321f322a, -0x32093214, -0x2fe82ffe, -0x2fbf2fd4, -0x2f972fab, -0x2f6f2f83, -0x2f492f5c, -0x2f232f36, -0x2eff2f11, -0x2edc2eed, -0x2eba2ecb, -0x2e992ea9, -0x2e792e89, -0x2e5a2e69, -0x2e3c2e4b, -0x2e202e2e, -0x2e042e12, -0x2bd32bee, -0x2ba02bba, -0x2b6f2b88, -0x2b412b58, -0x2b142b2a, -0x2ae92afe, -0x2ac02ad4, -0x2a992aac, -0x2a742a86, -0x2a502a62, -0x2a2e2a3f, -0x2a0e2a1e, -0x27e027fe, -0x27a627c3, -0x276f278a, -0x273b2755, -0x270a2722, -0x26db26f2, -0x26af26c5, -0x2686269a, -0x265e2672, -0x2639264b, -0x26162627, -0x23eb2605, -0x23ad23cb, -0x2372238f, -0x233b2356, -0x23072321, -0x22d722ef, -0x22a922c0, -0x227e2293, -0x22562269, -0x22302242, -0x220c221d, -0x1fd51ff6, -0x1f971fb6, -0x1f5c1f79, -0x1f251f40, -0x1ef11f0a, -0x1ec01ed8, -0x1e931ea9, -0x1e681e7d, -0x1e411e54, -0x1e1b1e2e, -0x1bf11e0a, -0x1bb01bd0, -0x1b721b91, -0x1b391b55, -0x1b031b1e, -0x1ad11aea, -0x1aa21ab9, -0x1a761a8c, -0x1a4d1a61, -0x1a271a39, -0x1a031a14, -0x17c217e3, -0x178317a2, -0x17491765, -0x1711172d, -0x16de16f7, -0x16ae16c6, -0x16811697, -0x1657166c, -0x16301643, -0x160b161d, -0x13d213f3, -0x139113b1, -0x13551373, -0x131d1339, -0x12e91303, -0x12b812d0, -0x128a12a1, -0x12601275, -0x1238124b, -0x12121225, -0x0fdf1201, -0x0f9e0fbe, -0x0f610f7f, -0x0f280f44, -0x0ef30f0d, -0x0ec10eda, -0x0e930eaa, -0x0e680e7d, -0x0e3f0e53, -0x0e190e2c, -0x0bec0e07, -0x00000bcb, -/* AIR 10: diff=57.870117 */ -0x33753383, -0x335a3368, -0x3340334d, -0x33253332, -0x330b3318, -0x32f132fe, -0x32d832e5, -0x32bf32cb, -0x32a632b3, -0x328e329a, -0x32763282, -0x325f326a, -0x32483253, -0x3231323c, -0x321b3226, -0x32053210, -0x2fe12ff6, -0x2fb82fcc, -0x2f902fa4, -0x2f682f7c, -0x2f422f55, -0x2f1d2f2f, -0x2ef92f0b, -0x2ed62ee7, -0x2eb42ec5, -0x2e932ea3, -0x2e732e83, -0x2e552e64, -0x2e372e46, -0x2e1b2e29, -0x2bff2e0d, -0x2bca2be4, -0x2b982bb1, -0x2b672b7f, -0x2b392b50, -0x2b0c2b22, -0x2ae22af7, -0x2ab92acd, -0x2a922aa5, -0x2a6d2a80, -0x2a4a2a5b, -0x2a292a39, -0x2a092a18, -0x27d627f3, -0x279c27b9, -0x27662781, -0x2732274c, -0x2702271a, -0x26d326ea, -0x26a826bd, -0x267f2693, -0x2658266b, -0x26332645, -0x26102621, -0x23e02600, -0x23a223c1, -0x23692385, -0x2332234d, -0x22ff2318, -0x22cf22e6, -0x22a122b8, -0x2277228c, -0x224f2262, -0x2229223c, -0x22062217, -0x1fca1feb, -0x1f8c1fab, -0x1f521f6f, -0x1f1b1f36, -0x1ee81f02, -0x1eb81ed0, -0x1e8b1ea2, -0x1e611e76, -0x1e3a1e4d, -0x1e151e27, -0x1be61e04, -0x1ba51bc5, -0x1b681b86, -0x1b2f1b4b, -0x1afa1b15, -0x1ac91ae1, -0x1a9a1ab1, -0x1a6f1a84, -0x1a461a5a, -0x1a201a33, -0x17fa1a0e, -0x17b717d8, -0x17791797, -0x173f175b, -0x17081723, -0x16d516ee, -0x16a616bd, -0x1679168f, -0x16501664, -0x1629163c, -0x16051617, -0x13c613e8, -0x138713a6, -0x134b1369, -0x1314132f, -0x12e012fa, -0x12b012c8, -0x12831299, -0x1258126d, -0x12311244, -0x120c121e, -0x0fd40ff6, -0x0f930fb3, -0x0f570f75, -0x0f1f0f3a, -0x0eea0f04, -0x0eb90ed1, -0x0e8b0ea2, -0x0e600e75, -0x0e380e4c, -0x0e130e25, -0x0be00e01, -0x0b9f0bbf, -0x0b620b80, -0x0b290b45, -0x0af40b0e, -0x0ac20ada, -0x0a930aaa, -0x0a680a7d, -0x0a3f0a53, -0x0a1a0a2c, -0x07ed0a08, -0x000007cb, -/* AIR 11: diff=28.935059 */ -0x3272327e, -0x325b3266, -0x3244324f, -0x322d3239, -0x32173222, -0x3202320c, -0x2fda2fef, -0x2fb12fc5, -0x2f892f9d, -0x2f622f75, -0x2f3c2f4f, -0x2f172f29, -0x2ef32f05, -0x2ed02ee1, -0x2eae2ebf, -0x2e8e2e9e, -0x2e6e2e7e, -0x2e502e5f, -0x2e322e41, -0x2e162e24, -0x2bf62e08, -0x2bc12bdb, -0x2b8f2ba8, -0x2b5f2b77, -0x2b312b48, -0x2b052b1b, -0x2ada2aef, -0x2ab22ac6, -0x2a8c2a9f, -0x2a672a79, -0x2a442a55, -0x2a232a33, -0x2a032a13, -0x27cb27e9, -0x279327af, -0x275d2777, -0x272a2743, -0x26f92711, -0x26cc26e2, -0x26a026b6, -0x2678268c, -0x26512664, -0x262d263f, -0x260b261b, -0x23d523f5, -0x239823b6, -0x235f237b, -0x23292344, -0x22f6230f, -0x22c722de, -0x229a22b0, -0x22702284, -0x2248225c, -0x22232235, -0x22002211, -0x1fbf1fdf, -0x1f821fa0, -0x1f481f65, -0x1f121f2d, -0x1ee01ef9, -0x1eb01ec8, -0x1e841e9a, -0x1e5a1e6f, -0x1e331e47, -0x1e0f1e21, -0x1bda1bfc, -0x1b9a1bb9, -0x1b5e1b7c, -0x1b261b42, -0x1af21b0b, -0x1ac01ad9, -0x1a931aa9, -0x1a681a7d, -0x1a3f1a53, -0x1a1a1a2c, -0x17ee1a08, -0x17ac17cc, -0x176f178d, -0x17351751, -0x16ff171a, -0x16cd16e6, -0x169e16b5, -0x16721688, -0x1649165d, -0x16231635, -0x13fe1610, -0x13bb13dc, -0x137c139b, -0x1342135e, -0x130b1326, -0x12d812f1, -0x12a812bf, -0x127b1291, -0x12511266, -0x122a123e, -0x12061218, -0x0fc80fea, -0x0f880fa8, -0x0f4d0f6a, -0x0f150f31, -0x0ee10efb, -0x0eb10ec9, -0x0e840e9a, -0x0e590e6e, -0x0e320e45, -0x0e0d0e1f, -0x0bd50bf7, -0x0b940bb4, -0x0b580b75, -0x0b1f0b3b, -0x0aeb0b05, -0x0aba0ad2, -0x0a8c0aa2, -0x0a610a76, -0x0a390a4c, -0x0a130a26, -0x07e10a01, -0x07a007c0, -0x07630781, -0x07290745, -0x06f4070e, -0x06c206db, -0x069406ab, -0x0668067e, -0x06400654, -0x061a062c, -0x03ed0608, -0x000003cc, -/* AIR 12: diff=14.467529 */ -0x2f352f48, -0x2f102f23, -0x2eed2efe, -0x2eca2edb, -0x2ea92eb9, -0x2e882e98, -0x2e692e78, -0x2e4a2e59, -0x2e2d2e3c, -0x2e112e1f, -0x2bed2e03, -0x2bb92bd2, -0x2b872b9f, -0x2b572b6f, -0x2b292b40, -0x2afd2b13, -0x2ad32ae8, -0x2aab2abf, -0x2a852a98, -0x2a612a73, -0x2a3e2a4f, -0x2a1d2a2e, -0x27fd2a0e, -0x27c127df, -0x278927a5, -0x2754276e, -0x2721273a, -0x26f12709, -0x26c426da, -0x269926ae, -0x26712685, -0x264b265e, -0x26272638, -0x26052616, -0x23ca23ea, -0x238e23ac, -0x23552371, -0x2320233a, -0x22ee2306, -0x22bf22d6, -0x229222a8, -0x2269227d, -0x22412255, -0x221d222f, -0x1ff5220b, -0x1fb41fd4, -0x1f781f96, -0x1f3f1f5b, -0x1f091f24, -0x1ed71ef0, -0x1ea91ec0, -0x1e7d1e92, -0x1e531e68, -0x1e2d1e40, -0x1e091e1b, -0x1bcf1bf0, -0x1b8f1bae, -0x1b541b71, -0x1b1d1b38, -0x1ae91b02, -0x1ab81ad0, -0x1a8b1aa1, -0x1a601a75, -0x1a391a4c, -0x1a141a26, -0x17e21a02, -0x17a117c1, -0x17641782, -0x172b1747, -0x16f61710, -0x16c516dd, -0x169616ad, -0x166b1680, -0x16421656, -0x161c162f, -0x13f2160a, -0x13b013d0, -0x13721390, -0x13381354, -0x1302131c, -0x12cf12e8, -0x12a012b7, -0x12741289, -0x124a125f, -0x12241237, -0x12001212, -0x0fbd0fde, -0x0f7e0f9d, -0x0f430f60, -0x0f0c0f27, -0x0ed90ef2, -0x0ea90ec0, -0x0e7c0e92, -0x0e520e67, -0x0e2b0e3e, -0x0e060e18, -0x0bc90beb, -0x0b890ba9, -0x0b4e0b6b, -0x0b160b31, -0x0ae20afc, -0x0ab10ac9, -0x0a840a9a, -0x0a5a0a6f, -0x0a320a46, -0x0a0d0a1f, -0x07d507f7, -0x079507b4, -0x07580776, -0x0720073c, -0x06eb0705, -0x06ba06d2, -0x068c06a3, -0x06610676, -0x0639064d, -0x06140626, -0x03e10602, -0x03a003c0, -0x03630381, -0x032a0346, -0x02f5030f, -0x02c302db, -0x029402ab, -0x0269027e, -0x02400254, -0x021a022d, -0x01f70208, -0x000001e6, -/* AIR 13: diff=7.233765 */ -0x2be32bfe, -0x2bb02bc9, -0x2b7e2b97, -0x2b4f2b66, -0x2b212b38, -0x2af62b0b, -0x2acc2ae1, -0x2aa52ab8, -0x2a7f2a91, -0x2a5b2a6d, -0x2a382a49, -0x2a182a28, -0x27f22a08, -0x27b727d4, -0x2780279b, -0x274b2765, -0x27192731, -0x26e92701, -0x26bc26d3, -0x269226a7, -0x266a267e, -0x26442657, -0x26212632, -0x23ff2610, -0x23c023df, -0x238423a1, -0x234c2367, -0x23172331, -0x22e522fe, -0x22b722ce, -0x228b22a0, -0x22622276, -0x223b224e, -0x22172228, -0x1fea2205, -0x1faa1fc9, -0x1f6e1f8b, -0x1f351f51, -0x1f001f1a, -0x1ecf1ee7, -0x1ea11eb7, -0x1e751e8b, -0x1e4d1e61, -0x1e261e39, -0x1e031e14, -0x1bc31be4, -0x1b851ba4, -0x1b4a1b67, -0x1b131b2e, -0x1ae01af9, -0x1ab01ac8, -0x1a831a99, -0x1a591a6e, -0x1a321a45, -0x1a0d1a1f, -0x17d717f8, -0x179617b6, -0x175a1778, -0x1722173e, -0x16ed1707, -0x16bc16d4, -0x168e16a5, -0x16641679, -0x163b164f, -0x16161628, -0x13e61604, -0x13a513c5, -0x13671386, -0x132e134a, -0x12f91313, -0x12c712df, -0x129812af, -0x126c1282, -0x12441258, -0x121d1230, -0x0ff4120b, -0x0fb20fd2, -0x0f730f92, -0x0f390f56, -0x0f030f1e, -0x0ed00ee9, -0x0ea10eb8, -0x0e750e8a, -0x0e4b0e60, -0x0e250e38, -0x0e000e12, -0x0bbe0bdf, -0x0b7f0b9e, -0x0b440b61, -0x0b0d0b28, -0x0ad90af3, -0x0aa90ac1, -0x0a7d0a93, -0x0a530a67, -0x0a2b0a3f, -0x0a070a19, -0x07ca07eb, -0x078a07a9, -0x074e076c, -0x07170732, -0x06e206fc, -0x06b206ca, -0x0684069b, -0x065a066f, -0x06320646, -0x060d061f, -0x03d603f8, -0x039503b5, -0x03590376, -0x0320033c, -0x02ec0306, -0x02ba02d3, -0x028c02a3, -0x02610277, -0x0239024d, -0x02140226, -0x01f10202, -0x01d001e0, -0x01b201c1, -0x019501a3, -0x017a0187, -0x0161016e, -0x014a0156, -0x0134013f, -0x0120012a, -0x010d0116, -0x00fb0104, -0x000000f3, -/* AIR 14: diff=3.616882 */ -0x2a332a43, -0x2a122a22, -0x27e82a03, -0x27ae27ca, -0x27762792, -0x2742275c, -0x27102729, -0x26e126f8, -0x26b526cb, -0x268b26a0, -0x26632677, -0x263e2650, -0x261b262c, -0x23f4260a, -0x23b523d4, -0x237a2397, -0x2342235e, -0x230e2328, -0x22dd22f5, -0x22af22c6, -0x22842299, -0x225b226f, -0x22342247, -0x22112222, -0x1fde1fff, -0x1f9f1fbe, -0x1f641f81, -0x1f2c1f47, -0x1ef81f11, -0x1ec71edf, -0x1e991eaf, -0x1e6e1e83, -0x1e461e5a, -0x1e201e33, -0x1bfa1e0e, -0x1bb81bd9, -0x1b7a1b99, -0x1b401b5d, -0x1b0a1b25, -0x1ad81af1, -0x1aa81ac0, -0x1a7c1a92, -0x1a521a67, -0x1a2c1a3f, -0x1a071a19, -0x17cb17ec, -0x178c17ab, -0x1750176d, -0x17191734, -0x16e516fe, -0x16b416cc, -0x1687169d, -0x165c1671, -0x16351648, -0x16101622, -0x13db13fd, -0x139a13ba, -0x135d137b, -0x13251340, -0x12f0130a, -0x12be12d7, -0x129012a7, -0x1265127a, -0x123d1251, -0x1217122a, -0x0fe81205, -0x0fa70fc7, -0x0f690f87, -0x0f300f4c, -0x0efa0f14, -0x0ec80ee0, -0x0e990eb0, -0x0e6d0e83, -0x0e440e58, -0x0e1e0e31, -0x0bf50e0c, -0x0bb30bd3, -0x0b740b93, -0x0b3a0b57, -0x0b040b1e, -0x0ad10aea, -0x0aa10ab9, -0x0a750a8b, -0x0a4c0a60, -0x0a250a38, -0x0a010a13, -0x07be07e0, -0x077f079e, -0x07440761, -0x070d0728, -0x06da06f3, -0x06aa06c1, -0x067d0693, -0x06530668, -0x062c063f, -0x06070619, -0x03ca03ec, -0x038a03aa, -0x034f036c, -0x03170332, -0x02e302fc, -0x02b202ca, -0x0285029b, -0x025a026f, -0x02330246, -0x020e0220, -0x01eb01fc, -0x01cb01db, -0x01ac01bb, -0x0190019e, -0x01760183, -0x015d0169, -0x01460152, -0x0131013b, -0x011d0127, -0x010a0113, -0x00f80101, -0x00e800f0, -0x00d900e0, -0x00ca00d2, -0x00bd00c4, -0x00b100b7, -0x00a500ab, -0x009a00a0, -0x00900095, -0x0087008b, -0x007e0082, -0x00000079, -/* AIR 15: diff=1.808441 */ -0x265d2670, -0x2638264a, -0x26152626, -0x23e82604, -0x23aa23c9, -0x2370238d, -0x23392354, -0x2305231f, -0x22d522ed, -0x22a722be, -0x227c2291, -0x22542268, -0x222e2241, -0x220b221c, -0x1fd31ff4, -0x1f941fb3, -0x1f5a1f76, -0x1f231f3e, -0x1eef1f08, -0x1ebf1ed6, -0x1e911ea8, -0x1e671e7c, -0x1e3f1e53, -0x1e1a1e2c, -0x1bee1e08, -0x1bad1bcd, -0x1b701b8e, -0x1b371b53, -0x1b011b1c, -0x1acf1ae8, -0x1aa01ab7, -0x1a741a8a, -0x1a4b1a60, -0x1a251a38, -0x1a011a13, -0x17c017e1, -0x178117a0, -0x17461763, -0x170f172a, -0x16dc16f5, -0x16ac16c4, -0x167f1695, -0x1655166a, -0x162e1641, -0x1609161b, -0x13cf13f1, -0x138f13ae, -0x13531371, -0x131b1337, -0x12e71301, -0x12b612ce, -0x1289129f, -0x125e1273, -0x1236124a, -0x12111223, -0x0fdd0fff, -0x0f9c0fbc, -0x0f5f0f7d, -0x0f260f42, -0x0ef10f0b, -0x0ebf0ed8, -0x0e910ea8, -0x0e660e7b, -0x0e3d0e51, -0x0e180e2a, -0x0be90e06, -0x0ba70bc8, -0x0b6a0b88, -0x0b300b4d, -0x0afb0b15, -0x0ac80ae1, -0x0a990ab1, -0x0a6e0a83, -0x0a450a59, -0x0a1e0a31, -0x07f60a0c, -0x07b307d4, -0x07750793, -0x073b0757, -0x0704071f, -0x06d106ea, -0x06a206b9, -0x0675068b, -0x064c0660, -0x06250638, -0x06010613, -0x03bf03e0, -0x0380039f, -0x03450362, -0x030e0329, -0x02da02f4, -0x02aa02c2, -0x027d0293, -0x02530268, -0x022c023f, -0x02070219, -0x01e501f6, -0x01c501d5, -0x01a701b6, -0x018c0199, -0x0171017e, -0x01590165, -0x0142014e, -0x012d0138, -0x01190123, -0x01070110, -0x00f600fe, -0x00e500ed, -0x00d600de, -0x00c800cf, -0x00bb00c1, -0x00af00b5, -0x00a300a9, -0x0098009e, -0x008e0093, -0x0085008a, -0x007c0081, -0x00740078, -0x006c0070, -0x00650069, -0x005f0062, -0x0058005b, -0x00530055, -0x004d0050, -0x0048004b, -0x00430046, -0x003f0041, -0x0000003d, - /* RDF 0: 1/1: 255.000000 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x2a402a00, -0x2ac02a80, -0x2b402b00, -0x2bc02b80, -0x2e202e00, -0x2e602e40, -0x2ea02e80, -0x2ee02ec0, -0x2f202f00, -0x2f602f40, -0x2fa02f80, -0x2fe02fc0, -0x32103200, -0x32303220, -0x32503240, -0x32703260, -0x32903280, -0x32b032a0, -0x32d032c0, -0x32f032e0, -0x33103300, -0x33303320, -0x33503340, -0x33703360, -0x33903380, -0x33b033a0, -0x33d033c0, -0x33f033e0, -0x36083600, -0x36183610, -0x36283620, -0x36383630, -0x36483640, -0x36583650, -0x36683660, -0x36783670, -0x36883680, -0x36983690, -0x36a836a0, -0x36b836b0, -0x36c836c0, -0x36d836d0, -0x36e836e0, -0x36f836f0, -0x37083700, -0x37183710, -0x37283720, -0x37383730, -0x37483740, -0x37583750, -0x37683760, -0x37783770, -0x37883780, -0x37983790, -0x37a837a0, -0x37b837b0, -0x37c837c0, -0x37d837d0, -0x37e837e0, -0x37f837f0, -0x3a043a00, -0x3a0c3a08, -0x3a143a10, -0x3a1c3a18, -0x3a243a20, -0x3a2c3a28, -0x3a343a30, -0x3a3c3a38, -0x3a443a40, -0x3a4c3a48, -0x3a543a50, -0x3a5c3a58, -0x3a643a60, -0x3a6c3a68, -0x3a743a70, -0x3a7c3a78, -0x3a843a80, -0x3a8c3a88, -0x3a943a90, -0x3a9c3a98, -0x3aa43aa0, -0x3aac3aa8, -0x3ab43ab0, -0x3abc3ab8, -0x3ac43ac0, -0x3acc3ac8, -0x3ad43ad0, -0x3adc3ad8, -0x3ae43ae0, -0x3aec3ae8, -0x3af43af0, -0x3afc3af8, -0x3b043b00, -0x3b0c3b08, -0x3b143b10, -0x3b1c3b18, -0x3b243b20, -0x3b2c3b28, -0x3b343b30, -0x3b3c3b38, -0x3b443b40, -0x3b4c3b48, -0x3b543b50, -0x3b5c3b58, -0x3b643b60, -0x3b6c3b68, -0x3b743b70, -0x3b7c3b78, -0x3b843b80, -0x3b8c3b88, -0x3b943b90, -0x3b9c3b98, -0x3ba43ba0, -0x3bac3ba8, -0x3bb43bb0, -0x3bbc3bb8, -0x3bc43bc0, -0x3bcc3bc8, -0x3bd43bd0, -0x3bdc3bd8, -0x3be43be0, -0x3bec3be8, -0x3bf43bf0, -0x3bfc3bf8, - /* RDF 1: 1/2: 20.346580 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x2a402a00, -0x2ac02a80, -0x2b402b00, -0x2bc02b80, -0x2e202e00, -0x2e602e40, -0x2e8b2e80, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, -0x2e8b2e8b, - /* RDF 2: 1/4: 8.444594 */ -0x1e000000, -0x23002200, -0x26802600, -0x27802700, -0x2a1c2a00, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, -0x2a1c2a1c, - /* RDF 3: 1/8: 3.919669 */ -0x1e000000, -0x23002200, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, -0x23eb23eb, - /* RDF 4: 1/16: 1.894458 */ -0x1e000000, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, -0x1fc91fc9, - /* RDF 5: 1/32: 0.931948 */ -0x1bba0000, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, -0x1bba1bba, - /* RDF 6: 1/64: 0.462276 */ -0x17b20000, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, -0x17b217b2, - /* RDF 7: 1/128: 0.230228 */ -0x13af0000, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, -0x13af13af, - /* RDF 8: 1/256: 0.114888 */ -0x0fad0000, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, -0x0fad0fad, - /* RDF 9: 1/512: 0.057388 */ -0x0bac0000, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, -0x0bac0bac, - /* RDF 10: 1/1024: 0.028680 */ -0x07ac0000, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, -0x07ac07ac, - /* RDF 11: 1/2048: 0.014336 */ -0x03ac0000, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, -0x03ac03ac, - /* RDF 12: 1/4096: 0.007167 */ -0x01d60000, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, -0x01d601d6, - /* RDF 13: 1/8192: 0.003583 */ -0x00eb0000, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, -0x00eb00eb, - /* RDF 14: 1/16384: 0.001792 */ -0x00750000, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, -0x00750075, - /* RDF 15: 1/32768: 0.000896 */ -0x003b0000, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -0x003b003b, -}; diff --git a/sys/dev/patm/if_patm_rx.c b/sys/dev/patm/if_patm_rx.c deleted file mode 100644 index c4822983c6a4..000000000000 --- a/sys/dev/patm/if_patm_rx.c +++ /dev/null @@ -1,526 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -static void *patm_rcv_handle(struct patm_softc *sc, u_int handle); -static void patm_rcv_free(struct patm_softc *, void *, u_int handle); -static struct mbuf *patm_rcv_mbuf(struct patm_softc *, void *, u_int, int); - -static __inline void -rct_write(struct patm_softc *sc, u_int cid, u_int w, u_int val) -{ - patm_sram_write(sc, sc->mmap->rct + cid * IDT_RCT_ENTRY_SIZE + w, val); -} -static __inline u_int -rct_read(struct patm_softc *sc, u_int cid, u_int w) -{ - return (patm_sram_read(sc, sc->mmap->rct + - cid * IDT_RCT_ENTRY_SIZE + w)); -} - -/* check if we can open this one */ -int -patm_rx_vcc_can_open(struct patm_softc *sc, struct patm_vcc *vcc) -{ - return (0); -} - -/* - * open the VCC - */ -void -patm_rx_vcc_open(struct patm_softc *sc, struct patm_vcc *vcc) -{ - uint32_t w1 = IDT_RCT_OPEN; - - patm_debug(sc, VCC, "%u.%u RX opening", vcc->vcc.vpi, vcc->vcc.vci); - - switch (vcc->vcc.aal) { - case ATMIO_AAL_0: - w1 |= IDT_RCT_AAL0 | IDT_RCT_FBP2 | IDT_RCT_RCI; - break; - case ATMIO_AAL_34: - w1 |= IDT_RCT_AAL34; - break; - case ATMIO_AAL_5: - w1 |= IDT_RCT_AAL5; - break; - case ATMIO_AAL_RAW: - w1 |= IDT_RCT_AALRAW | IDT_RCT_RCI; - break; - } - - if (vcc->cid != 0) - patm_sram_write4(sc, sc->mmap->rct + vcc->cid * - IDT_RCT_ENTRY_SIZE, w1, 0, 0, 0xffffffff); - else { - /* switch the interface into promiscuous mode */ - patm_nor_write(sc, IDT_NOR_CFG, patm_nor_read(sc, IDT_NOR_CFG) | - IDT_CFG_ICAPT | IDT_CFG_VPECA); - } - - vcc->vflags |= PATM_VCC_RX_OPEN; -} - -/* close the given vcc for transmission */ -void -patm_rx_vcc_close(struct patm_softc *sc, struct patm_vcc *vcc) -{ - u_int w1; - - patm_debug(sc, VCC, "%u.%u RX closing", vcc->vcc.vpi, vcc->vcc.vci); - - if (vcc->cid == 0) { - /* switch off promiscuous mode */ - patm_nor_write(sc, IDT_NOR_CFG, patm_nor_read(sc, IDT_NOR_CFG) & - ~(IDT_CFG_ICAPT | IDT_CFG_VPECA)); - vcc->vflags &= ~PATM_VCC_RX_OPEN; - return; - } - - /* close the connection but keep state */ - w1 = rct_read(sc, vcc->cid, 0); - w1 &= ~IDT_RCT_OPEN; - rct_write(sc, vcc->cid, 0, w1); - - /* minimum idle count */ - w1 = (w1 & ~IDT_RCT_IACT_CNT_MASK) | (1 << IDT_RCT_IACT_CNT_SHIFT); - rct_write(sc, vcc->cid, 0, w1); - - /* initialize scan */ - patm_nor_write(sc, IDT_NOR_IRCP, vcc->cid); - - vcc->vflags &= ~PATM_VCC_RX_OPEN; - vcc->vflags |= PATM_VCC_RX_CLOSING; - - /* - * check the RSQ - * This is a hack. The problem is, that although an entry is written - * to the RSQ, no interrupt is generated. Also we must wait 1 cell - * time for the SAR to process the scan of our connection. - */ - DELAY(1); - patm_intr_rsq(sc); -} - -/* transmission side finally closed */ -void -patm_rx_vcc_closed(struct patm_softc *sc, struct patm_vcc *vcc) -{ - patm_debug(sc, VCC, "%u.%u RX finally closed", - vcc->vcc.vpi, vcc->vcc.vci); -} - -/* - * Handle the given receive status queue entry - */ -void -patm_rx(struct patm_softc *sc, struct idt_rsqe *rsqe) -{ - struct mbuf *m; - void *buf; - u_int stat, cid, w, cells, len, h; - struct patm_vcc *vcc; - struct atm_pseudohdr aph; - u_char *trail; - - cid = le32toh(rsqe->cid); - stat = le32toh(rsqe->stat); - h = le32toh(rsqe->handle); - - cid = PATM_CID(sc, IDT_RSQE_VPI(cid), IDT_RSQE_VCI(cid)); - vcc = sc->vccs[cid]; - - if (IDT_RSQE_TYPE(stat) == IDT_RSQE_IDLE) { - /* connection has gone idle */ - if (stat & IDT_RSQE_BUF) - patm_rcv_free(sc, patm_rcv_handle(sc, h), h); - - w = rct_read(sc, cid, 0); - if (w != 0 && !(w & IDT_RCT_OPEN)) - rct_write(sc, cid, 0, 0); - if (vcc != NULL && (vcc->vflags & PATM_VCC_RX_CLOSING)) { - patm_debug(sc, VCC, "%u.%u RX closed", vcc->vcc.vpi, - vcc->vcc.vci); - vcc->vflags &= ~PATM_VCC_RX_CLOSING; - if (vcc->vcc.flags & ATMIO_FLAG_ASYNC) { - patm_rx_vcc_closed(sc, vcc); - if (!(vcc->vflags & PATM_VCC_OPEN)) - patm_vcc_closed(sc, vcc); - } else - cv_signal(&sc->vcc_cv); - } - return; - } - - buf = patm_rcv_handle(sc, h); - - if (vcc == NULL || (vcc->vflags & PATM_VCC_RX_OPEN) == 0) { - patm_rcv_free(sc, buf, h); - return; - } - - cells = IDT_RSQE_CNT(stat); - KASSERT(cells > 0, ("zero cell count")); - - if (vcc->vcc.aal == ATMIO_AAL_0) { - /* deliver this packet as it is */ - if ((m = patm_rcv_mbuf(sc, buf, h, 1)) == NULL) - return; - - m->m_len = cells * 48; - m->m_pkthdr.len = m->m_len; - m->m_pkthdr.rcvif = sc->ifp; - - } else if (vcc->vcc.aal == ATMIO_AAL_34) { - /* XXX AAL3/4 */ - patm_rcv_free(sc, buf, h); - return; - - } else if (vcc->vcc.aal == ATMIO_AAL_5) { - if (stat & IDT_RSQE_CRC) { - if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); - if (vcc->chain != NULL) { - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - } - return; - } - - /* append to current chain */ - if (vcc->chain == NULL) { - if ((m = patm_rcv_mbuf(sc, buf, h, 1)) == NULL) - return; - m->m_len = cells * 48; - m->m_pkthdr.len = m->m_len; - m->m_pkthdr.rcvif = sc->ifp; - vcc->chain = vcc->last = m; - } else { - if ((m = patm_rcv_mbuf(sc, buf, h, 0)) == NULL) - return; - m->m_len = cells * 48; - vcc->last->m_next = m; - vcc->last = m; - vcc->chain->m_pkthdr.len += m->m_len; - } - - if (!(stat & IDT_RSQE_EPDU)) - return; - - trail = mtod(m, u_char *) + m->m_len - 6; - len = (trail[0] << 8) + trail[1]; - - if ((u_int)vcc->chain->m_pkthdr.len < len + 8) { - patm_printf(sc, "%s: bad aal5 lengths %u %u\n", - __func__, (u_int)m->m_pkthdr.len, len); - m_freem(vcc->chain); - vcc->chain = vcc->last = NULL; - return; - } - m->m_len -= vcc->chain->m_pkthdr.len - len; - KASSERT(m->m_len >= 0, ("bad last mbuf")); - - m = vcc->chain; - vcc->chain = vcc->last = NULL; - m->m_pkthdr.len = len; - } else - panic("bad aal"); - -#if 0 - { - u_int i; - - for (i = 0; i < m->m_len; i++) { - printf("%02x ", mtod(m, u_char *)[i]); - } - printf("\n"); - } -#endif - - if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); - /* this is in if_atmsubr.c */ - /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); */ - - vcc->ibytes += m->m_pkthdr.len; - vcc->ipackets++; - - ATM_PH_FLAGS(&aph) = vcc->vcc.flags & 0xff; - ATM_PH_VPI(&aph) = IDT_RSQE_VPI(cid); - ATM_PH_SETVCI(&aph, IDT_RSQE_VCI(cid)); - -#ifdef ENABLE_BPF - if (!(vcc->vcc.flags & ATMIO_FLAG_NG) && - (vcc->vcc.aal == ATMIO_AAL_5) && - (vcc->vcc.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(sc->ifp, m); -#endif - - atm_input(sc->ifp, &aph, m, vcc->rxhand); -} - -/* - * Get the buffer for a receive handle. This is either an mbuf for - * a large handle or a pool buffer for the others. - */ -static void * -patm_rcv_handle(struct patm_softc *sc, u_int handle) -{ - void *buf; - u_int c; - - if ((handle & ~MBUF_HMASK) == LMBUF_HANDLE) { - struct lmbuf *b; - - c = handle & MBUF_HMASK; - b = &sc->lbufs[c]; - - buf = b->m; - b->m = NULL; - - bus_dmamap_sync(sc->lbuf_tag, b->map, BUS_DMASYNC_POSTREAD); - patm_lbuf_free(sc, b); - - } else if ((handle & ~MBUF_HMASK) == MBUF_VHANDLE) { - mbp_sync(sc->vbuf_pool, handle, - 0, VMBUF_SIZE, BUS_DMASYNC_POSTREAD); - buf = mbp_get(sc->vbuf_pool, handle); - - } else { - mbp_sync(sc->sbuf_pool, handle, - 0, SMBUF_SIZE, BUS_DMASYNC_POSTREAD); - buf = mbp_get(sc->sbuf_pool, handle); - } - - return (buf); -} - -/* - * Free a buffer. - */ -static void -patm_rcv_free(struct patm_softc *sc, void *p, u_int handle) -{ - if ((handle & ~MBUF_HMASK) == LMBUF_HANDLE) - m_free((struct mbuf *)p); - - else if ((handle & ~MBUF_HMASK) == MBUF_VHANDLE) - mbp_free(sc->vbuf_pool, p); - - else - mbp_free(sc->sbuf_pool, p); -} - -/* - * Make an mbuf around the buffer - */ -static struct mbuf * -patm_rcv_mbuf(struct patm_softc *sc, void *buf, u_int h, int hdr) -{ - struct mbuf *m; - - if ((h & ~MBUF_HMASK) == MBUF_LHANDLE) - return ((struct mbuf *)buf); - - if (hdr) - MGETHDR(m, M_NOWAIT, MT_DATA); - else - MGET(m, M_NOWAIT, MT_DATA); - if (m == NULL) { - patm_rcv_free(sc, buf, h); - return (NULL); - } - - if ((h & ~MBUF_HMASK) == MBUF_VHANDLE) { - MEXTADD(m, (caddr_t)buf, VMBUF_SIZE, mbp_ext_free, - buf, sc->vbuf_pool, M_PKTHDR, EXT_NET_DRV); - m->m_data += VMBUF_OFFSET; - } else { - MEXTADD(m, (caddr_t)buf, SMBUF_SIZE, mbp_ext_free, - buf, sc->sbuf_pool, M_PKTHDR, EXT_NET_DRV); - m->m_data += SMBUF_OFFSET; - } - - if (!(m->m_flags & M_EXT)) { - patm_rcv_free(sc, buf, h); - m_free(m); - return (NULL); - } - return (m); -} - -/* - * Process the raw cell at the given address. - */ -void -patm_rx_raw(struct patm_softc *sc, u_char *cell) -{ - u_int vpi, vci, cid; - struct patm_vcc *vcc; - struct mbuf *m; - u_char *dst; - struct timespec ts; - struct atm_pseudohdr aph; - uint64_t cts; - - sc->stats.raw_cells++; - - /* - * For some non-appearant reason the cell header - * is in the wrong endian. - */ - *(uint32_t *)cell = bswap32(*(uint32_t *)cell); - - vpi = ((cell[0] & 0xf) << 4) | ((cell[1] & 0xf0) >> 4); - vci = ((cell[1] & 0xf) << 12) | (cell[2] << 4) | ((cell[3] & 0xf0) >> 4); - cid = PATM_CID(sc, vpi, vci); - - vcc = sc->vccs[cid]; - if (vcc == NULL || !(vcc->vflags & PATM_VCC_RX_OPEN) || - vcc->vcc.aal != ATMIO_AAL_RAW) { - vcc = sc->vccs[0]; - if (vcc == NULL || !(vcc->vflags & PATM_VCC_RX_OPEN)) { - sc->stats.raw_no_vcc++; - return; - } - } - - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == NULL) { - sc->stats.raw_no_buf++; - return; - } - m->m_pkthdr.rcvif = sc->ifp; - - switch (vcc->vflags & PATM_RAW_FORMAT) { - - default: - case PATM_RAW_CELL: - m->m_len = m->m_pkthdr.len = 53; - M_ALIGN(m, 53); - dst = mtod(m, u_char *); - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = 0; /* HEC */ - bcopy(cell + 12, dst, 48); - break; - - case PATM_RAW_NOHEC: - m->m_len = m->m_pkthdr.len = 52; - M_ALIGN(m, 52); - dst = mtod(m, u_char *); - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - bcopy(cell + 12, dst, 48); - break; - - case PATM_RAW_CS: - m->m_len = m->m_pkthdr.len = 64; - M_ALIGN(m, 64); - dst = mtod(m, u_char *); - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = *cell++; - *dst++ = 0; /* HEC */ - *dst++ = 0; /* flags */ - *dst++ = 0; /* reserved */ - *dst++ = 0; /* reserved */ - nanotime(&ts); - cts = ts.tv_sec * 1000000000ULL + ts.tv_nsec; - bcopy(dst, &cts, 8); - bcopy(cell + 12, dst + 8, 48); - break; - } - - if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); - /* this is in if_atmsubr.c */ - /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); */ - - vcc->ibytes += m->m_pkthdr.len; - vcc->ipackets++; - - ATM_PH_FLAGS(&aph) = vcc->vcc.flags & 0xff; - ATM_PH_VPI(&aph) = vcc->vcc.vpi; - ATM_PH_SETVCI(&aph, vcc->vcc.vci); - - atm_input(sc->ifp, &aph, m, vcc->rxhand); -} diff --git a/sys/dev/patm/if_patm_tx.c b/sys/dev/patm/if_patm_tx.c deleted file mode 100644 index 33ee8f183a2b..000000000000 --- a/sys/dev/patm/if_patm_tx.c +++ /dev/null @@ -1,1277 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The TST allocation algorithm is from the IDT driver which is: - * - * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. - * All rights reserved. - * - * Copyright (c) 1996, 1997, 1998, 1999 Mark Tinguely - * All rights reserved. - * - * Author: Hartmut Brandt - * - * Driver for IDT77252 based cards like ProSum's. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#ifdef ENABLE_BPF -#include -#endif -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -static struct mbuf *patm_tx_pad(struct patm_softc *sc, struct mbuf *m0); -static void patm_launch(struct patm_softc *sc, struct patm_scd *scd); - -static struct patm_txmap *patm_txmap_get(struct patm_softc *); -static void patm_load_txbuf(void *, bus_dma_segment_t *, int, - bus_size_t, int); - -static void patm_tst_alloc(struct patm_softc *sc, struct patm_vcc *vcc); -static void patm_tst_free(struct patm_softc *sc, struct patm_vcc *vcc); -static void patm_tst_timer(void *p); -static void patm_tst_update(struct patm_softc *); - -static void patm_tct_start(struct patm_softc *sc, struct patm_vcc *); - -static const char *dump_scd(struct patm_softc *sc, struct patm_scd *scd) - __unused; -static void patm_tct_print(struct patm_softc *sc, u_int cid) __unused; - -/* - * Structure for communication with the loader function for transmission - */ -struct txarg { - struct patm_softc *sc; - struct patm_scd *scd; /* scheduling channel */ - struct patm_vcc *vcc; /* the VCC of this PDU */ - struct mbuf *mbuf; - u_int hdr; /* cell header */ -}; - -static __inline u_int -cbr2slots(struct patm_softc *sc, struct patm_vcc *vcc) -{ - /* compute the number of slots we need, make sure to get at least - * the specified PCR */ - return ((u_int)howmany((uint64_t)(sc->mmap->tst_size - 1) * - vcc->vcc.tparam.pcr, IFP2IFATM(sc->ifp)->mib.pcr)); -} - -static __inline u_int -slots2cr(struct patm_softc *sc, u_int slots) -{ - return ((slots * IFP2IFATM(sc->ifp)->mib.pcr + sc->mmap->tst_size - 2) / - (sc->mmap->tst_size - 1)); -} - -/* check if we can open this one */ -int -patm_tx_vcc_can_open(struct patm_softc *sc, struct patm_vcc *vcc) -{ - - /* check resources */ - switch (vcc->vcc.traffic) { - - case ATMIO_TRAFFIC_CBR: - { - u_int slots = cbr2slots(sc, vcc); - - if (slots > sc->tst_free + sc->tst_reserve) - return (EINVAL); - break; - } - - case ATMIO_TRAFFIC_VBR: - if (vcc->vcc.tparam.scr > sc->bwrem) - return (EINVAL); - if (vcc->vcc.tparam.pcr > IFP2IFATM(sc->ifp)->mib.pcr) - return (EINVAL); - if (vcc->vcc.tparam.scr > vcc->vcc.tparam.pcr || - vcc->vcc.tparam.mbs == 0) - return (EINVAL); - break; - - case ATMIO_TRAFFIC_ABR: - if (vcc->vcc.tparam.tbe == 0 || - vcc->vcc.tparam.nrm == 0) - /* needed to compute CRM */ - return (EINVAL); - if (vcc->vcc.tparam.pcr > IFP2IFATM(sc->ifp)->mib.pcr || - vcc->vcc.tparam.icr > vcc->vcc.tparam.pcr || - vcc->vcc.tparam.mcr > vcc->vcc.tparam.icr) - return (EINVAL); - if (vcc->vcc.tparam.mcr > sc->bwrem || - vcc->vcc.tparam.icr > sc->bwrem) - return (EINVAL); - break; - } - - return (0); -} - -#define NEXT_TAG(T) do { \ - (T) = ((T) + 1) % IDT_TSQE_TAG_SPACE; \ - } while (0) - -/* - * open it - */ -void -patm_tx_vcc_open(struct patm_softc *sc, struct patm_vcc *vcc) -{ - struct patm_scd *scd; - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_UBR) { - /* we use UBR0 */ - vcc->scd = sc->scd0; - vcc->vflags |= PATM_VCC_TX_OPEN; - return; - } - - /* get an SCD */ - scd = patm_scd_alloc(sc); - if (scd == NULL) { - /* should not happen */ - patm_printf(sc, "out of SCDs\n"); - return; - } - vcc->scd = scd; - patm_scd_setup(sc, scd); - patm_tct_setup(sc, scd, vcc); - - if (vcc->vcc.traffic != ATMIO_TRAFFIC_CBR) - patm_tct_start(sc, vcc); - - vcc->vflags |= PATM_VCC_TX_OPEN; -} - -/* - * close the given vcc for transmission - */ -void -patm_tx_vcc_close(struct patm_softc *sc, struct patm_vcc *vcc) -{ - struct patm_scd *scd; - struct mbuf *m; - - vcc->vflags |= PATM_VCC_TX_CLOSING; - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_UBR) { - /* let the queue PDUs go out */ - vcc->scd = NULL; - vcc->vflags &= ~(PATM_VCC_TX_OPEN | PATM_VCC_TX_CLOSING); - return; - } - scd = vcc->scd; - - /* empty the waitq */ - for (;;) { - _IF_DEQUEUE(&scd->q, m); - if (m == NULL) - break; - m_freem(m); - } - - if (scd->num_on_card == 0) { - /* we are idle */ - vcc->vflags &= ~PATM_VCC_TX_OPEN; - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_CBR) - patm_tst_free(sc, vcc); - - patm_sram_write4(sc, scd->sram + 0, 0, 0, 0, 0); - patm_sram_write4(sc, scd->sram + 4, 0, 0, 0, 0); - patm_scd_free(sc, scd); - - vcc->scd = NULL; - vcc->vflags &= ~PATM_VCC_TX_CLOSING; - - return; - } - - /* speed up transmission */ - patm_nor_write(sc, IDT_NOR_TCMDQ, IDT_TCMDQ_UIER(vcc->cid, 0xff)); - patm_nor_write(sc, IDT_NOR_TCMDQ, IDT_TCMDQ_ULACR(vcc->cid, 0xff)); - - /* wait for the interrupt to drop the number to 0 */ - patm_debug(sc, VCC, "%u buffers still on card", scd->num_on_card); -} - -/* transmission side finally closed */ -void -patm_tx_vcc_closed(struct patm_softc *sc, struct patm_vcc *vcc) -{ - - patm_debug(sc, VCC, "%u.%u TX closed", vcc->vcc.vpi, vcc->vcc.vci); - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_VBR) - sc->bwrem += vcc->vcc.tparam.scr; -} - -/* - * Pull off packets from the interface queue and try to transmit them. - * If the transmission fails because of a full transmit channel, we drop - * packets for CBR and queue them for other channels up to limit. - * This limit should depend on the CDVT for VBR and ABR, but it doesn't. - */ -void -patm_start(struct ifnet *ifp) -{ - struct patm_softc *sc = ifp->if_softc; - struct mbuf *m; - struct atm_pseudohdr *aph; - u_int vpi, vci, cid; - struct patm_vcc *vcc; - - mtx_lock(&sc->mtx); - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - mtx_unlock(&sc->mtx); - return; - } - - while (1) { - /* get a new mbuf */ - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - - /* split of pseudo header */ - if (m->m_len < sizeof(*aph) && - (m = m_pullup(m, sizeof(*aph))) == NULL) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - - aph = mtod(m, struct atm_pseudohdr *); - vci = ATM_PH_VCI(aph); - vpi = ATM_PH_VPI(aph); - m_adj(m, sizeof(*aph)); - - /* reject empty packets */ - if (m->m_pkthdr.len == 0) { - m_freem(m); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - - /* check whether this is a legal vcc */ - if (!LEGAL_VPI(sc, vpi) || !LEGAL_VCI(sc, vci) || vci == 0) { - m_freem(m); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - cid = PATM_CID(sc, vpi, vci); - vcc = sc->vccs[cid]; - if (vcc == NULL) { - m_freem(m); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - - /* must be multiple of 48 if not AAL5 */ - if (vcc->vcc.aal == ATMIO_AAL_0 || - vcc->vcc.aal == ATMIO_AAL_34) { - /* XXX AAL3/4 format? */ - if (m->m_pkthdr.len % 48 != 0 && - (m = patm_tx_pad(sc, m)) == NULL) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - } else if (vcc->vcc.aal == ATMIO_AAL_RAW) { - switch (vcc->vflags & PATM_RAW_FORMAT) { - - default: - case PATM_RAW_CELL: - if (m->m_pkthdr.len != 53) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - m_freem(m); - continue; - } - break; - - case PATM_RAW_NOHEC: - if (m->m_pkthdr.len != 52) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - m_freem(m); - continue; - } - break; - - case PATM_RAW_CS: - if (m->m_pkthdr.len != 64) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - m_freem(m); - continue; - } - break; - } - } - - /* save data */ - m->m_pkthdr.PH_loc.ptr = vcc; - - /* try to put it on the channels queue */ - if (_IF_QFULL(&vcc->scd->q)) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - sc->stats.tx_qfull++; - m_freem(m); - continue; - } - _IF_ENQUEUE(&vcc->scd->q, m); - -#ifdef ENABLE_BPF - if (!(vcc->vcc.flags & ATMIO_FLAG_NG) && - (vcc->vcc.aal == ATMIO_AAL_5) && - (vcc->vcc.flags & ATM_PH_LLCSNAP)) - BPF_MTAP(ifp, m); -#endif - - /* kick the channel to life */ - patm_launch(sc, vcc->scd); - - } - mtx_unlock(&sc->mtx); -} - -/* - * Pad non-AAL5 packet to a multiple of 48-byte. - * We assume AAL0 only. We have still to decide on the format of AAL3/4. - */ -static struct mbuf * -patm_tx_pad(struct patm_softc *sc, struct mbuf *m0) -{ - struct mbuf *last, *m; - u_int plen, pad, space; - - plen = m_length(m0, &last); - if (plen != m0->m_pkthdr.len) { - patm_printf(sc, "%s: mbuf length mismatch %d %u\n", __func__, - m0->m_pkthdr.len, plen); - m0->m_pkthdr.len = plen; - if (plen == 0) { - m_freem(m0); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - return (NULL); - } - if (plen % 48 == 0) - return (m0); - } - pad = 48 - plen % 48; - m0->m_pkthdr.len += pad; - if (M_WRITABLE(last)) { - if (M_TRAILINGSPACE(last) >= pad) { - bzero(last->m_data + last->m_len, pad); - last->m_len += pad; - return (m0); - } - space = M_LEADINGSPACE(last); - if (space + M_TRAILINGSPACE(last) >= pad) { - bcopy(last->m_data, last->m_data + space, last->m_len); - last->m_data -= space; - bzero(last->m_data + last->m_len, pad); - last->m_len += pad; - return (m0); - } - } - MGET(m, M_NOWAIT, MT_DATA); - if (m == NULL) { - m_freem(m0); - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - return (NULL); - } - bzero(mtod(m, u_char *), pad); - m->m_len = pad; - last->m_next = m; - - return (m0); -} - -/* - * Try to put as many packets from the channels queue onto the channel - */ -static void -patm_launch(struct patm_softc *sc, struct patm_scd *scd) -{ - struct txarg a; - struct mbuf *m, *tmp; - u_int segs; - struct patm_txmap *map; - int error; - - a.sc = sc; - a.scd = scd; - - /* limit the number of outstanding packets to the tag space */ - while (scd->num_on_card < IDT_TSQE_TAG_SPACE) { - /* get the next packet */ - _IF_DEQUEUE(&scd->q, m); - if (m == NULL) - break; - - a.vcc = m->m_pkthdr.PH_loc.ptr; - - /* we must know the number of segments beforehand - count - * this may actually give a wrong number of segments for - * AAL_RAW where we still need to remove the cell header */ - segs = 0; - for (tmp = m; tmp != NULL; tmp = tmp->m_next) - if (tmp->m_len != 0) - segs++; - - /* check whether there is space in the queue */ - if (segs >= scd->space) { - /* put back */ - _IF_PREPEND(&scd->q, m); - sc->stats.tx_out_of_tbds++; - break; - } - - /* get a DMA map */ - if ((map = patm_txmap_get(sc)) == NULL) { - _IF_PREPEND(&scd->q, m); - sc->stats.tx_out_of_maps++; - break; - } - - /* load the map */ - m->m_pkthdr.PH_loc.ptr = map; - a.mbuf = m; - - /* handle AAL_RAW */ - if (a.vcc->vcc.aal == ATMIO_AAL_RAW) { - u_char hdr[4]; - - m_copydata(m, 0, 4, hdr); - a.hdr = (hdr[0] << 24) | (hdr[1] << 16) | - (hdr[2] << 8) | hdr[3]; - - switch (a.vcc->vflags & PATM_RAW_FORMAT) { - - default: - case PATM_RAW_CELL: - m_adj(m, 5); - break; - - case PATM_RAW_NOHEC: - m_adj(m, 4); - break; - - case PATM_RAW_CS: - m_adj(m, 16); - break; - } - } else - a.hdr = IDT_TBD_HDR(a.vcc->vcc.vpi, a.vcc->vcc.vci, - 0, 0); - - error = bus_dmamap_load_mbuf(sc->tx_tag, map->map, m, - patm_load_txbuf, &a, BUS_DMA_NOWAIT); - if (error == EFBIG) { - if ((m = m_defrag(m, M_NOWAIT)) == NULL) { - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - continue; - } - error = bus_dmamap_load_mbuf(sc->tx_tag, map->map, m, - patm_load_txbuf, &a, BUS_DMA_NOWAIT); - } - if (error != 0) { - sc->stats.tx_load_err++; - if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); - SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); - m_freem(m); - continue; - } - - if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); - } -} - -/* - * Load the DMA segments into the scheduling channel - */ -static void -patm_load_txbuf(void *uarg, bus_dma_segment_t *segs, int nseg, - bus_size_t mapsize, int error) -{ - struct txarg *a= uarg; - struct patm_scd *scd = a->scd; - u_int w1, w3, cnt; - struct idt_tbd *tbd = NULL; - u_int rest = mapsize; - - if (error != 0) - return; - - cnt = 0; - while (nseg > 0) { - if (segs->ds_len == 0) { - /* transmit buffer length must be > 0 */ - nseg--; - segs++; - continue; - } - /* rest after this buffer */ - rest -= segs->ds_len; - - /* put together status word */ - w1 = 0; - if (rest < 48 /* && a->vcc->vcc.aal != ATMIO_AAL_5 */) - /* last cell is in this buffer */ - w1 |= IDT_TBD_EPDU; - - if (a->vcc->vcc.aal == ATMIO_AAL_5) - w1 |= IDT_TBD_AAL5; - else if (a->vcc->vcc.aal == ATMIO_AAL_34) - w1 |= IDT_TBD_AAL34; - else - w1 |= IDT_TBD_AAL0; - - w1 |= segs->ds_len; - - /* AAL5 PDU length (unpadded) */ - if (a->vcc->vcc.aal == ATMIO_AAL_5) - w3 = mapsize; - else - w3 = 0; - - if (rest == 0) - w1 |= IDT_TBD_TSIF | IDT_TBD_GTSI | - (scd->tag << IDT_TBD_TAG_SHIFT); - - tbd = &scd->scq[scd->tail]; - - tbd->flags = htole32(w1); - tbd->addr = htole32(segs->ds_addr); - tbd->aal5 = htole32(w3); - tbd->hdr = htole32(a->hdr); - - patm_debug(a->sc, TX, "TBD(%u): %08x %08x %08x %08x", - scd->tail, w1, segs->ds_addr, w3, a->hdr); - - /* got to next entry */ - if (++scd->tail == IDT_SCQ_SIZE) - scd->tail = 0; - cnt++; - nseg--; - segs++; - } - scd->space -= cnt; - scd->num_on_card++; - - KASSERT(rest == 0, ("bad mbuf")); - KASSERT(cnt > 0, ("no segs")); - KASSERT(scd->space > 0, ("scq full")); - - KASSERT(scd->on_card[scd->tag] == NULL, - ("scd on_card wedged %u%s", scd->tag, dump_scd(a->sc, scd))); - scd->on_card[scd->tag] = a->mbuf; - a->mbuf->m_pkthdr.csum_data = cnt; - - NEXT_TAG(scd->tag); - - patm_debug(a->sc, TX, "SCD tail %u (%lx:%lx)", scd->tail, - (u_long)scd->phy, (u_long)scd->phy + (scd->tail << IDT_TBD_SHIFT)); - patm_sram_write(a->sc, scd->sram, - scd->phy + (scd->tail << IDT_TBD_SHIFT)); - - if (patm_sram_read(a->sc, a->vcc->cid * 8 + 3) & IDT_TCT_IDLE) { - /* - * if the connection is idle start it. We cannot rely - * on a flag set by patm_tx_idle() here, because sometimes - * the card seems to place an idle TSI into the TSQ but - * forgets to raise an interrupt. - */ - patm_nor_write(a->sc, IDT_NOR_TCMDQ, - IDT_TCMDQ_START(a->vcc->cid)); - } -} - -/* - * packet transmitted - */ -void -patm_tx(struct patm_softc *sc, u_int stamp, u_int status) -{ - u_int cid, tag, last; - struct mbuf *m; - struct patm_vcc *vcc; - struct patm_scd *scd; - struct patm_txmap *map; - - /* get the connection */ - cid = PATM_CID(sc, IDT_TBD_VPI(status), IDT_TBD_VCI(status)); - if ((vcc = sc->vccs[cid]) == NULL) { - /* closed UBR connection */ - return; - } - scd = vcc->scd; - - tag = IDT_TSQE_TAG(stamp); - - last = scd->last_tag; - if (tag == last) { - patm_printf(sc, "same tag %u\n", tag); - return; - } - - /* Errata 12 requests us to free all entries up to the one - * with the given tag. */ - do { - /* next tag to try */ - NEXT_TAG(last); - - m = scd->on_card[last]; - KASSERT(m != NULL, ("%stag=%u", dump_scd(sc, scd), tag)); - scd->on_card[last] = NULL; - patm_debug(sc, TX, "ok tag=%x", last); - - map = m->m_pkthdr.PH_loc.ptr; - scd->space += m->m_pkthdr.csum_data; - - bus_dmamap_sync(sc->tx_tag, map->map, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->tx_tag, map->map); - m_freem(m); - SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); - scd->num_on_card--; - - if (vcc->vflags & PATM_VCC_TX_CLOSING) { - if (scd->num_on_card == 0) { - /* done with this VCC */ - if (vcc->vcc.traffic == ATMIO_TRAFFIC_CBR) - patm_tst_free(sc, vcc); - - patm_sram_write4(sc, scd->sram + 0, 0, 0, 0, 0); - patm_sram_write4(sc, scd->sram + 4, 0, 0, 0, 0); - patm_scd_free(sc, scd); - - vcc->scd = NULL; - vcc->vflags &= ~PATM_VCC_TX_CLOSING; - - if (vcc->vcc.flags & ATMIO_FLAG_ASYNC) { - patm_tx_vcc_closed(sc, vcc); - if (!(vcc->vflags & PATM_VCC_OPEN)) - patm_vcc_closed(sc, vcc); - } else - cv_signal(&sc->vcc_cv); - return; - } - patm_debug(sc, VCC, "%u buffers still on card", - scd->num_on_card); - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_ABR) { - /* insist on speeding up transmission for ABR */ - patm_nor_write(sc, IDT_NOR_TCMDQ, - IDT_TCMDQ_UIER(vcc->cid, 0xff)); - patm_nor_write(sc, IDT_NOR_TCMDQ, - IDT_TCMDQ_ULACR(vcc->cid, 0xff)); - } - } - - } while (last != tag); - scd->last_tag = tag; - - if (vcc->vcc.traffic == ATMIO_TRAFFIC_ABR) { - u_int acri, cps; - - acri = (patm_sram_read(sc, 8 * cid + 2) >> IDT_TCT_ACRI_SHIFT) - & 0x3fff; - cps = IFP2IFATM(sc->ifp)->mib.pcr * 32 / - ((1 << (acri >> 10)) * (acri & 0x3ff)); - - if (cps != vcc->cps) { - patm_debug(sc, VCC, "ACRI=%04x CPS=%u", acri, cps); - ATMEV_SEND_ACR_CHANGED(IFP2IFATM(sc->ifp), vcc->vcc.vpi, - vcc->vcc.vci, cps); - vcc->cps = cps; - } - } - - patm_launch(sc, scd); -} - -/* - * VBR/ABR connection went idle - * Either restart it or set the idle flag. - */ -void -patm_tx_idle(struct patm_softc *sc, u_int cid) -{ - struct patm_vcc *vcc; - - patm_debug(sc, VCC, "idle %u", cid); - - if ((vcc = sc->vccs[cid]) != NULL && - (vcc->vflags & (PATM_VCC_TX_OPEN | PATM_VCC_TX_CLOSING)) != 0 && - vcc->scd != NULL && (vcc->scd->num_on_card != 0 || - _IF_QLEN(&vcc->scd->q) != 0)) { - /* - * If there is any packet outstanding in the SCD re-activate - * the channel and kick it. - */ - patm_nor_write(sc, IDT_NOR_TCMDQ, - IDT_TCMDQ_START(vcc->cid)); - - patm_launch(sc, vcc->scd); - } -} - -/* - * Convert a (24bit) rate to the atm-forum form - * Our rate is never larger than 19 bit. - */ -static u_int -cps2atmf(u_int cps) -{ - u_int e; - - if (cps == 0) - return (0); - cps <<= 9; - e = 0; - while (cps > (1024 - 1)) { - e++; - cps >>= 1; - } - return ((1 << 14) | (e << 9) | (cps & 0x1ff)); -} - -/* - * Do a binary search on the log2rate table to convert the rate - * to its log form. This assumes that the ATM-Forum form is monotonically - * increasing with the plain cell rate. - */ -static u_int -rate2log(struct patm_softc *sc, u_int rate) -{ - const uint32_t *tbl; - u_int lower, upper, mid, done, val, afr; - - afr = cps2atmf(rate); - - if (sc->flags & PATM_25M) - tbl = patm_rtables25; - else - tbl = patm_rtables155; - - lower = 0; - upper = 255; - done = 0; - while (!done) { - mid = (lower + upper) / 2; - val = tbl[mid] >> 17; - if (val == afr || upper == lower) - break; - if (afr > val) - lower = mid + 1; - else - upper = mid - 1; - } - if (val > afr && mid > 0) - mid--; - return (mid); -} - -/* - * Return the table index for an increase table. The increase table - * must be selected not by the RIF itself, but by PCR/2^RIF. Each table - * represents an additive increase of a cell rate that can be computed - * from the first table entry (the value in this entry will not be clamped - * by the link rate). - */ -static u_int -get_air_table(struct patm_softc *sc, u_int rif, u_int pcr) -{ - const uint32_t *tbl; - u_int increase, base, lair0, ret, t, cps; - -#define GET_ENTRY(TAB, IDX) (0xffff & ((IDX & 1) ? \ - (tbl[512 + (IDX / 2) + 128 * (TAB)] >> 16) : \ - (tbl[512 + (IDX / 2) + 128 * (TAB)]))) - -#define MANT_BITS 10 -#define FRAC_BITS 16 - -#define DIFF_TO_FP(D) (((D) & ((1 << MANT_BITS) - 1)) << ((D) >> MANT_BITS)) -#define AFR_TO_INT(A) ((1 << (((A) >> 9) & 0x1f)) * \ - (512 + ((A) & 0x1ff)) / 512 * ((A) >> 14)) - - if (sc->flags & PATM_25M) - tbl = patm_rtables25; - else - tbl = patm_rtables155; - if (rif >= patm_rtables_ntab) - rif = patm_rtables_ntab - 1; - increase = pcr >> rif; - - ret = 0; - for (t = 0; t < patm_rtables_ntab; t++) { - /* get base rate of this table */ - base = GET_ENTRY(t, 0); - /* convert this to fixed point */ - lair0 = DIFF_TO_FP(base) >> FRAC_BITS; - - /* get the CPS from the log2rate table */ - cps = AFR_TO_INT(tbl[lair0] >> 17) - 10; - - if (increase >= cps) - break; - - ret = t; - } - return (ret + 4); -} - -/* - * Setup the TCT - */ -void -patm_tct_setup(struct patm_softc *sc, struct patm_scd *scd, - struct patm_vcc *vcc) -{ - uint32_t tct[8]; - u_int sram; - u_int mbs, token; - u_int tmp, crm, rdf, cdf, air, mcr; - - bzero(tct, sizeof(tct)); - if (vcc == NULL) { - /* special case for UBR0 */ - sram = 0; - tct[0] = IDT_TCT_UBR | scd->sram; - tct[7] = IDT_TCT_UBR_FLG; - - } else { - sram = vcc->cid * 8; - switch (vcc->vcc.traffic) { - - case ATMIO_TRAFFIC_CBR: - patm_tst_alloc(sc, vcc); - tct[0] = IDT_TCT_CBR | scd->sram; - /* must account for what was really allocated */ - break; - - case ATMIO_TRAFFIC_VBR: - /* compute parameters for the TCT */ - scd->init_er = rate2log(sc, vcc->vcc.tparam.pcr); - scd->lacr = rate2log(sc, vcc->vcc.tparam.scr); - - /* get the 16-bit fraction of SCR/PCR - * both a 24 bit. Do it the simple way. */ - token = (uint64_t)(vcc->vcc.tparam.scr << 16) / - vcc->vcc.tparam.pcr; - - patm_debug(sc, VCC, "VBR: init_er=%u lacr=%u " - "token=0x%04x\n", scd->init_er, scd->lacr, token); - - tct[0] = IDT_TCT_VBR | scd->sram; - tct[2] = IDT_TCT_TSIF; - tct[3] = IDT_TCT_IDLE | IDT_TCT_HALT; - tct[4] = IDT_TCT_MAXIDLE; - tct[5] = 0x01000000; - if ((mbs = vcc->vcc.tparam.mbs) > 0xff) - mbs = 0xff; - tct[6] = (mbs << 16) | token; - sc->bwrem -= vcc->vcc.tparam.scr; - break; - - case ATMIO_TRAFFIC_ABR: - scd->init_er = rate2log(sc, vcc->vcc.tparam.pcr); - scd->lacr = rate2log(sc, vcc->vcc.tparam.icr); - mcr = rate2log(sc, vcc->vcc.tparam.mcr); - - /* compute CRM */ - tmp = vcc->vcc.tparam.tbe / vcc->vcc.tparam.nrm; - if (tmp * vcc->vcc.tparam.nrm < vcc->vcc.tparam.tbe) - tmp++; - for (crm = 1; tmp > (1 << crm); crm++) - ; - if (crm > 0x7) - crm = 7; - - air = get_air_table(sc, vcc->vcc.tparam.rif, - vcc->vcc.tparam.pcr); - - if ((rdf = vcc->vcc.tparam.rdf) >= patm_rtables_ntab) - rdf = patm_rtables_ntab - 1; - rdf += patm_rtables_ntab + 4; - - if ((cdf = vcc->vcc.tparam.cdf) >= patm_rtables_ntab) - cdf = patm_rtables_ntab - 1; - cdf += patm_rtables_ntab + 4; - - patm_debug(sc, VCC, "ABR: init_er=%u lacr=%u mcr=%u " - "crm=%u air=%u rdf=%u cdf=%u\n", scd->init_er, - scd->lacr, mcr, crm, air, rdf, cdf); - - tct[0] = IDT_TCT_ABR | scd->sram; - tct[1] = crm << IDT_TCT_CRM_SHIFT; - tct[3] = IDT_TCT_HALT | IDT_TCT_IDLE | - (4 << IDT_TCT_NAGE_SHIFT); - tct[4] = mcr << IDT_TCT_LMCR_SHIFT; - tct[5] = (cdf << IDT_TCT_CDF_SHIFT) | - (rdf << IDT_TCT_RDF_SHIFT) | - (air << IDT_TCT_AIR_SHIFT); - - sc->bwrem -= vcc->vcc.tparam.mcr; - break; - } - } - - patm_sram_write4(sc, sram + 0, tct[0], tct[1], tct[2], tct[3]); - patm_sram_write4(sc, sram + 4, tct[4], tct[5], tct[6], tct[7]); - - patm_debug(sc, VCC, "TCT[%u]: %08x %08x %08x %08x %08x %08x %08x %08x", - sram / 8, patm_sram_read(sc, sram + 0), - patm_sram_read(sc, sram + 1), patm_sram_read(sc, sram + 2), - patm_sram_read(sc, sram + 3), patm_sram_read(sc, sram + 4), - patm_sram_read(sc, sram + 5), patm_sram_read(sc, sram + 6), - patm_sram_read(sc, sram + 7)); -} - -/* - * Start a channel - */ -static void -patm_tct_start(struct patm_softc *sc, struct patm_vcc *vcc) -{ - - patm_nor_write(sc, IDT_NOR_TCMDQ, IDT_TCMDQ_UIER(vcc->cid, - vcc->scd->init_er)); - patm_nor_write(sc, IDT_NOR_TCMDQ, IDT_TCMDQ_SLACR(vcc->cid, - vcc->scd->lacr)); -} - -static void -patm_tct_print(struct patm_softc *sc, u_int cid) -{ -#ifdef PATM_DEBUG - u_int sram = cid * 8; -#endif - - patm_debug(sc, VCC, "TCT[%u]: %08x %08x %08x %08x %08x %08x %08x %08x", - sram / 8, patm_sram_read(sc, sram + 0), - patm_sram_read(sc, sram + 1), patm_sram_read(sc, sram + 2), - patm_sram_read(sc, sram + 3), patm_sram_read(sc, sram + 4), - patm_sram_read(sc, sram + 5), patm_sram_read(sc, sram + 6), - patm_sram_read(sc, sram + 7)); -} - -/* - * Setup the SCD - */ -void -patm_scd_setup(struct patm_softc *sc, struct patm_scd *scd) -{ - patm_sram_write4(sc, scd->sram + 0, - scd->phy, 0, 0xffffffff, 0); - patm_sram_write4(sc, scd->sram + 4, - 0, 0, 0, 0); - - patm_debug(sc, VCC, "SCD(%x): %08x %08x %08x %08x %08x %08x %08x %08x", - scd->sram, - patm_sram_read(sc, scd->sram + 0), - patm_sram_read(sc, scd->sram + 1), - patm_sram_read(sc, scd->sram + 2), - patm_sram_read(sc, scd->sram + 3), - patm_sram_read(sc, scd->sram + 4), - patm_sram_read(sc, scd->sram + 5), - patm_sram_read(sc, scd->sram + 6), - patm_sram_read(sc, scd->sram + 7)); -} - -/* - * Grow the TX map table if possible - */ -static void -patm_txmaps_grow(struct patm_softc *sc) -{ - u_int i; - struct patm_txmap *map; - int err; - - if (sc->tx_nmaps >= sc->tx_maxmaps) - return; - - for (i = sc->tx_nmaps; i < sc->tx_nmaps + PATM_CFG_TXMAPS_STEP; i++) { - map = uma_zalloc(sc->tx_mapzone, M_NOWAIT); - err = bus_dmamap_create(sc->tx_tag, 0, &map->map); - if (err) { - uma_zfree(sc->tx_mapzone, map); - break; - } - SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); - } - - sc->tx_nmaps = i; -} - -/* - * Allocate a transmission map - */ -static struct patm_txmap * -patm_txmap_get(struct patm_softc *sc) -{ - struct patm_txmap *map; - - if ((map = SLIST_FIRST(&sc->tx_maps_free)) == NULL) { - patm_txmaps_grow(sc); - if ((map = SLIST_FIRST(&sc->tx_maps_free)) == NULL) - return (NULL); - } - SLIST_REMOVE_HEAD(&sc->tx_maps_free, link); - return (map); -} - -/* - * Look whether we are in the process of updating the TST on the chip. - * If we are set the flag that we need another update. - * If we are not start the update. - */ -static __inline void -patm_tst_start(struct patm_softc *sc) -{ - - if (!(sc->tst_state & TST_PENDING)) { - sc->tst_state |= TST_PENDING; - if (!(sc->tst_state & TST_WAIT)) { - /* timer not running */ - patm_tst_update(sc); - } - } -} - -/* - * Allocate TST entries to a CBR connection - */ -static void -patm_tst_alloc(struct patm_softc *sc, struct patm_vcc *vcc) -{ - u_int slots; - u_int qptr, pptr; - u_int qmax, pmax; - u_int pspc, last; - - mtx_lock(&sc->tst_lock); - - /* compute the number of slots we need, make sure to get at least - * the specified PCR */ - slots = cbr2slots(sc, vcc); - vcc->scd->slots = slots; - sc->bwrem -= slots2cr(sc, slots); - - patm_debug(sc, TST, "tst_alloc: cbr=%u link=%u tst=%u slots=%u", - vcc->vcc.tparam.pcr, IFP2IFATM(sc->ifp)->mib.pcr, sc->mmap->tst_size, slots); - - qmax = sc->mmap->tst_size - 1; - pmax = qmax << 8; - - pspc = pmax / slots; - - pptr = pspc >> 1; /* starting point */ - qptr = pptr >> 8; - - last = qptr; - - while (slots > 0) { - if (qptr >= qmax) - qptr -= qmax; - if (sc->tst_soft[qptr] != IDT_TST_VBR) { - /* used - try next */ - qptr++; - continue; - } - patm_debug(sc, TST, "slot[%u] = %u.%u diff=%d", qptr, - vcc->vcc.vpi, vcc->vcc.vci, (int)qptr - (int)last); - last = qptr; - - sc->tst_soft[qptr] = IDT_TST_CBR | vcc->cid | TST_BOTH; - sc->tst_free--; - - if ((pptr += pspc) >= pmax) - pptr -= pmax; - qptr = pptr >> 8; - - slots--; - } - patm_tst_start(sc); - mtx_unlock(&sc->tst_lock); -} - -/* - * Free a CBR connection's TST entries - */ -static void -patm_tst_free(struct patm_softc *sc, struct patm_vcc *vcc) -{ - u_int i; - - mtx_lock(&sc->tst_lock); - for (i = 0; i < sc->mmap->tst_size - 1; i++) { - if ((sc->tst_soft[i] & IDT_TST_MASK) == vcc->cid) { - sc->tst_soft[i] = IDT_TST_VBR | TST_BOTH; - sc->tst_free++; - } - } - sc->bwrem += slots2cr(sc, vcc->scd->slots); - patm_tst_start(sc); - mtx_unlock(&sc->tst_lock); -} - -/* - * Write the soft TST into the idle incore TST and start the wait timer. - * We assume that we hold the tst lock. - */ -static void -patm_tst_update(struct patm_softc *sc) -{ - u_int flag; /* flag to clear from soft TST */ - u_int idle; /* the idle TST */ - u_int act; /* the active TST */ - u_int i; - - if (sc->tst_state & TST_ACT1) { - act = 1; - idle = 0; - flag = TST_CH0; - } else { - act = 0; - idle = 1; - flag = TST_CH1; - } - /* update the idle one */ - for (i = 0; i < sc->mmap->tst_size - 1; i++) - if (sc->tst_soft[i] & flag) { - patm_sram_write(sc, sc->tst_base[idle] + i, - sc->tst_soft[i] & ~TST_BOTH); - sc->tst_soft[i] &= ~flag; - } - /* the used one jump to the idle one */ - patm_sram_write(sc, sc->tst_jump[act], - IDT_TST_BR | (sc->tst_base[idle] << 2)); - - /* wait for the chip to jump */ - sc->tst_state &= ~TST_PENDING; - sc->tst_state |= TST_WAIT; - - callout_reset(&sc->tst_callout, 1, patm_tst_timer, sc); -} - -/* - * Timer for TST updates - */ -static void -patm_tst_timer(void *p) -{ - struct patm_softc *sc = p; - u_int act; /* active TST */ - u_int now; /* current place in TST */ - - mtx_lock(&sc->tst_lock); - - if (sc->tst_state & TST_WAIT) { - /* ignore the PENDING state while we are waiting for - * the chip to switch tables. Once the switch is done, - * we will again lock at PENDING */ - act = (sc->tst_state & TST_ACT1) ? 1 : 0; - now = patm_nor_read(sc, IDT_NOR_NOW) >> 2; - if (now >= sc->tst_base[act] && now <= sc->tst_jump[act]) { - /* not yet */ - callout_reset(&sc->tst_callout, 1, patm_tst_timer, sc); - goto done; - } - sc->tst_state &= ~TST_WAIT; - /* change back jump */ - patm_sram_write(sc, sc->tst_jump[act], - IDT_TST_BR | (sc->tst_base[act] << 2)); - - /* switch */ - sc->tst_state ^= TST_ACT1; - } - - if (sc->tst_state & TST_PENDING) - /* we got another update request while the timer was running. */ - patm_tst_update(sc); - - done: - mtx_unlock(&sc->tst_lock); -} - -static const char * -dump_scd(struct patm_softc *sc, struct patm_scd *scd) -{ - u_int i; - - for (i = 0; i < IDT_TSQE_TAG_SPACE; i++) - printf("on_card[%u] = %p\n", i, scd->on_card[i]); - printf("space=%u tag=%u num_on_card=%u last_tag=%u\n", - scd->space, scd->tag, scd->num_on_card, scd->last_tag); - - return (""); -} diff --git a/sys/dev/patm/if_patmvar.h b/sys/dev/patm/if_patmvar.h deleted file mode 100644 index c87787a6afcf..000000000000 --- a/sys/dev/patm/if_patmvar.h +++ /dev/null @@ -1,520 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Driver for IDT77252 (ABR) based cards like ProSum's. - */ - -/* legal values are 0, 1, 2 and 8 */ -#define PATM_VPI_BITS 2 -#define PATM_CFG_VPI IDT_CFG_VP2 - -/* receive status queue size */ -#define PATM_RSQ_SIZE 512 -#define PATM_CFQ_RSQ_SIZE IDT_CFG_RXQ512 - -/* alignment for SQ memory */ -#define PATM_SQ_ALIGNMENT 8192 - -#define PATM_PROATM_NAME_OFFSET 060 -#define PATM_PROATM_NAME "PROATM" -#define PATM_PROATM_MAC_OFFSET 044 -#define PATM_IDT_MAC_OFFSET 0154 - -/* maximum number of packets on UBR queue */ -#define PATM_DLFT_MAXQ 1000 - -/* maximum number of packets on other queues. This should depend on the - * traffic contract. */ -#define PATM_TX_IFQLEN 100 - -/* - * Maximum number of DMA maps we allocate. This is the minimum that can be - * set larger via a sysctl. - * Starting number of DMA maps. - * Step for growing. - */ -#define PATM_CFG_TXMAPS_MAX 1024 -#define PATM_CFG_TXMAPS_INIT 128 -#define PATM_CFG_TXMAPS_STEP 128 - -/* percents of TST slots to keep for non-CBR traffic */ -#define PATM_TST_RESERVE 2 - -/* - * Structure to hold TX DMA maps - */ -struct patm_txmap { - SLIST_ENTRY(patm_txmap) link; - bus_dmamap_t map; -}; - -/* - * Receive buffers. - * - * We manage our own external mbufs for small receive buffers for two reasons: - * the card may consume a rather large number of buffers. Mapping each buffer - * would consume a lot of iospace on sparc64. Also the card allows us to set - * a 32-bit handle for identification of the buffers. On a 64-bit system this - * requires us to use a mapping between buffers and handles. - * - * For large buffers we use mbuf clusters directly. We track these by using - * an array of pointers (lbufs) to special structs and a free list of these - * structs. - * - * For AAL0 cell we use FBQ2 and make the 1 cell long. - */ -/* - * Define the small buffer chunk so that we have at least 16 byte free - * at the end of the chunk and that there is an integral number of chunks - * in a page. - */ -#define SMBUF_PAGE_SIZE 16384 /* 16k pages */ -#define SMBUF_MAX_PAGES 64 /* maximum number of pages */ -#define SMBUF_CHUNK_SIZE 256 /* 256 bytes per chunk */ -#define SMBUF_CELLS 5 -#define SMBUF_SIZE (SMBUF_CELLS * 48) -#define SMBUF_THRESHOLD 9 /* 9/16 of queue size */ -#define SMBUF_NI_THRESH 3 -#define SMBUF_CI_THRESH 1 - -#define VMBUF_PAGE_SIZE 16384 /* 16k pages */ -#define VMBUF_MAX_PAGES 16 /* maximum number of pages */ -#define VMBUF_CHUNK_SIZE 64 /* 64 bytes per chunk */ -#define VMBUF_CELLS 1 -#define VMBUF_SIZE (VMBUF_CELLS * 48) -#define VMBUF_THRESHOLD 15 /* 15/16 of size */ - -#define SMBUF_OFFSET (SMBUF_CHUNK_SIZE - 8 - SMBUF_SIZE) -#define VMBUF_OFFSET 0 - -#define MBUF_SHANDLE 0x00000000 -#define MBUF_LHANDLE 0x80000000 -#define MBUF_VHANDLE 0x40000000 -#define MBUF_HMASK 0x3fffffff - -/* - * Large buffers - * - * The problem with these is the maximum count. When the card assembles - * a AAL5 pdu it moves a buffer from the FBQ to the VC. This frees space - * in the FBQ, put the buffer may pend on the card for an unlimited amount - * of time (we don't idle connections). This means that the upper limit - * on buffers on the card may be (no-of-open-vcs + FBQ_SIZE). Because - * this is far too much, make this a tuneable. We could also make - * this dynamic by allocating pages of several lbufs at once during run time. - */ -#define LMBUF_MAX (IDT_FBQ_SIZE * 2) -#define LMBUF_CELLS (MCLBYTES / 48) /* 42 cells = 2048 byte */ -#define LMBUF_SIZE (LMBUF_CELLS * 48) -#define LMBUF_THRESHOLD 9 /* 9/16 of queue size */ -#define LMBUF_OFFSET (MCLBYTES - LMBUF_SIZE) -#define LMBUF_NI_THRESH 3 -#define LMBUF_CI_THRESH 1 - -#define LMBUF_HANDLE 0x80000000 - -struct lmbuf { - SLIST_ENTRY(lmbuf) link; /* free list link */ - bus_dmamap_t map; /* DMA map */ - u_int handle; /* this is the handle index */ - struct mbuf *m; /* the current mbuf */ - bus_addr_t phy; /* phy addr */ -}; - -#define PATM_CID(SC, VPI, VCI) \ - (((VPI) << IFP2IFATM((SC)->ifp)->mib.vci_bits) | (VCI)) - -/* - * Internal driver statistics - */ -struct patm_stats { - uint32_t raw_cells; - uint32_t raw_no_vcc; - uint32_t raw_no_buf; - uint32_t tx_qfull; - uint32_t tx_out_of_tbds; - uint32_t tx_out_of_maps; - uint32_t tx_load_err; -}; - -/* - * These are allocated as DMA able memory - */ -struct patm_scd { - struct idt_tbd scq[IDT_SCQ_SIZE]; - LIST_ENTRY(patm_scd) link; /* all active SCDs */ - uint32_t sram; /* SRAM address */ - bus_addr_t phy; /* physical address */ - bus_dmamap_t map; /* DMA map */ - u_int tail; /* next free entry for host */ - int space; /* number of free entries (minus one) */ - u_int slots; /* CBR slots allocated */ - uint8_t tag; /* next tag for TSI */ - uint8_t last_tag; /* last tag checked in interrupt */ - uint8_t num_on_card; /* number of PDUs on tx queue */ - uint8_t lacr; /* LogACR value */ - uint8_t init_er; /* LogER value */ - struct ifqueue q; /* queue of packets */ - struct mbuf *on_card[IDT_TSQE_TAG_SPACE]; -}; - -/* - * Per-VCC data - */ -struct patm_vcc { - struct atmio_vcc vcc; /* caller's parameters */ - void *rxhand; /* NATM handle */ - u_int vflags; /* open and other flags */ - uint32_t ipackets; /* packets received */ - uint32_t opackets; /* packets sent */ - uint64_t ibytes; /* bytes received */ - uint64_t obytes; /* bytes sent */ - - struct mbuf *chain; /* currently received chain */ - struct mbuf *last; /* end of chain */ - u_int cid; /* index */ - u_int cps; /* last ABR cps */ - struct patm_scd *scd; -}; -#define PATM_VCC_TX_OPEN 0x0001 -#define PATM_VCC_RX_OPEN 0x0002 -#define PATM_VCC_TX_CLOSING 0x0004 -#define PATM_VCC_RX_CLOSING 0x0008 -#define PATM_VCC_OPEN 0x000f /* all the above */ - -#define PATM_RAW_CELL 0x0000 /* 53 byte cells */ -#define PATM_RAW_NOHEC 0x0100 /* 52 byte cells */ -#define PATM_RAW_CS 0x0200 /* 64 byte cell stream */ -#define PATM_RAW_FORMAT 0x0300 /* format mask */ - -/* - * Per adapter data - */ -struct patm_softc { - struct ifnet *ifp; /* common ATM stuff */ - struct mtx mtx; /* lock */ - struct ifmedia media; /* media */ - device_t dev; /* device */ - struct resource * memres; /* memory resource */ - bus_space_handle_t memh; /* handle */ - bus_space_tag_t memt; /* ... and tag */ - int irqid; /* resource id */ - struct resource * irqres; /* resource */ - void * ih; /* interrupt handle */ - struct utopia utopia; /* phy state */ - const struct idt_mmap *mmap; /* SRAM memory map */ - u_int flags; /* see below */ - u_int revision; /* chip revision */ - - /* DMAable status queue memory */ - size_t sq_size; /* size of memory area */ - bus_dma_tag_t sq_tag; /* DMA tag */ - bus_dmamap_t sq_map; /* map */ - - bus_addr_t tsq_phy; /* phys addr. */ - struct idt_tsqe *tsq; /* transmit status queue */ - struct idt_tsqe *tsq_next; /* last processed entry */ - struct idt_rsqe *rsq; /* receive status queue */ - bus_addr_t rsq_phy; /* phys addr. */ - u_int rsq_last; /* last processed entry */ - struct idt_rawhnd *rawhnd; /* raw cell handle */ - bus_addr_t rawhnd_phy; /* phys addr. */ - - /* TST */ - u_int tst_state; /* active TST and others */ - u_int tst_jump[2]; /* address of the jumps */ - u_int tst_base[2]; /* base address of TST */ - u_int *tst_soft; /* soft TST */ - struct mtx tst_lock; - struct callout tst_callout; - u_int tst_free; /* free slots */ - u_int tst_reserve; /* non-CBR reserve */ - u_int bwrem; /* remaining bandwidth */ - - /* sysctl support */ - struct sysctl_ctx_list sysctl_ctx; - struct sysctl_oid *sysctl_tree; - - /* EEPROM contents */ - uint8_t eeprom[256]; - - /* large buffer mapping */ - bus_dma_tag_t lbuf_tag; /* DMA tag */ - u_int lbuf_max; /* maximum number */ - struct lmbuf *lbufs; /* array for indexing */ - SLIST_HEAD(,lmbuf) lbuf_free_list; /* free list */ - - /* small buffer handling */ - bus_dma_tag_t sbuf_tag; /* DMA tag */ - struct mbpool *sbuf_pool; /* pool */ - struct mbpool *vbuf_pool; /* pool */ - - /* raw cell queue */ - struct lmbuf *rawh; /* current header buf */ - u_int rawi; /* cell index into buffer */ - - /* statistics */ - struct patm_stats stats; /* statistics */ - - /* Vccs */ - struct patm_vcc **vccs; /* channel pointer array */ - u_int vccs_open; /* number of open channels */ - uma_zone_t vcc_zone; - struct cv vcc_cv; - - /* SCDs */ - uint32_t scd_free; /* SRAM of first free SCD */ - bus_dma_tag_t scd_tag; - struct patm_scd *scd0; - LIST_HEAD(, patm_scd) scd_list; /* list of all active SCDs */ - - /* Tx */ - bus_dma_tag_t tx_tag; /* for transmission */ - SLIST_HEAD(, patm_txmap) tx_maps_free; /* free maps */ - u_int tx_nmaps; /* allocated maps */ - u_int tx_maxmaps; /* maximum number */ - struct uma_zone *tx_mapzone; /* zone for maps */ - -#ifdef PATM_DEBUG - /* debugging */ - u_int debug; -#endif -}; - -/* flags */ -#define PATM_25M 0x0001 /* 25MBit card */ -#define PATM_SBUFW 0x0002 /* warned */ -#define PATM_VBUFW 0x0004 /* warned */ -#define PATM_UNASS 0x0010 /* unassigned cells */ - -#define PATM_CLR 0x0007 /* clear on stop */ - -/* tst - uses unused fields */ -#define TST_BOTH 0x03000000 -#define TST_CH0 0x01000000 -#define TST_CH1 0x02000000 -/* tst_state */ -#define TST_ACT1 0x0001 /* active TST */ -#define TST_PENDING 0x0002 /* need update */ -#define TST_WAIT 0x0004 /* wait fo jump */ - -#define patm_printf(SC, ...) if_printf((SC)->ifp, __VA_ARGS__); - -#ifdef PATM_DEBUG -/* - * Debugging - */ -enum { - DBG_ATTACH = 0x0001, /* attaching the card */ - DBG_INTR = 0x0002, /* interrupts */ - DBG_REG = 0x0004, /* register access */ - DBG_SRAM = 0x0008, /* SRAM access */ - DBG_PHY = 0x0010, /* PHY access */ - DBG_IOCTL = 0x0020, /* ioctl */ - DBG_FREEQ = 0x0040, /* free bufq supply */ - DBG_VCC = 0x0080, /* open/close */ - DBG_TX = 0x0100, /* transmission */ - DBG_TST = 0x0200, /* TST */ - - DBG_ALL = 0xffff -}; - -#define patm_debug(SC, FLAG, ...) do { \ - if((SC)->debug & DBG_##FLAG) { \ - if_printf((SC)->ifp, "%s: ", __func__); \ - printf(__VA_ARGS__); \ - printf("\n"); \ - } \ - } while (0) -#else - -#define patm_debug(SC, FLAG, ...) do { } while (0) - -#endif - -/* start output */ -void patm_start(struct ifnet *); - -/* ioctl handler */ -int patm_ioctl(struct ifnet *, u_long, caddr_t); - -/* start the interface */ -void patm_init(void *); - -/* start the interface with the lock held */ -void patm_initialize(struct patm_softc *); - -/* stop the interface */ -void patm_stop(struct patm_softc *); - -/* software reset of interface */ -void patm_reset(struct patm_softc *); - -/* interrupt handler */ -void patm_intr(void *); - -/* check RSQ */ -void patm_intr_rsq(struct patm_softc *sc); - -/* enable the vcc */ -void patm_load_vc(struct patm_softc *sc, struct patm_vcc *vcc, int reload); - -/* close the given vcc for transmission */ -void patm_tx_vcc_close(struct patm_softc *, struct patm_vcc *); - -/* close the given vcc for receive */ -void patm_rx_vcc_close(struct patm_softc *, struct patm_vcc *); - -/* transmission side finally closed */ -void patm_tx_vcc_closed(struct patm_softc *, struct patm_vcc *); - -/* receive side finally closed */ -void patm_rx_vcc_closed(struct patm_softc *, struct patm_vcc *); - -/* vcc closed */ -void patm_vcc_closed(struct patm_softc *, struct patm_vcc *); - -/* check if we can open this one */ -int patm_tx_vcc_can_open(struct patm_softc *, struct patm_vcc *); - -/* check if we can open this one */ -int patm_rx_vcc_can_open(struct patm_softc *, struct patm_vcc *); - -/* open it */ -void patm_tx_vcc_open(struct patm_softc *, struct patm_vcc *); - -/* open it */ -void patm_rx_vcc_open(struct patm_softc *, struct patm_vcc *); - -/* receive packet */ -void patm_rx(struct patm_softc *, struct idt_rsqe *); - -/* packet transmitted */ -void patm_tx(struct patm_softc *, u_int, u_int); - -/* VBR connection went idle */ -void patm_tx_idle(struct patm_softc *, u_int); - -/* allocate an SCQ */ -struct patm_scd *patm_scd_alloc(struct patm_softc *); - -/* free an SCD */ -void patm_scd_free(struct patm_softc *sc, struct patm_scd *scd); - -/* setup SCD in SRAM */ -void patm_scd_setup(struct patm_softc *sc, struct patm_scd *scd); - -/* setup TCT entry in SRAM */ -void patm_tct_setup(struct patm_softc *, struct patm_scd *, struct patm_vcc *); - -/* free a large buffer */ -void patm_lbuf_free(struct patm_softc *sc, struct lmbuf *b); - -/* Process the raw cell at the given address */ -void patm_rx_raw(struct patm_softc *sc, u_char *cell); - -/* load a one segment DMA map */ -void patm_load_callback(void *, bus_dma_segment_t *, int, int); - -/* network operation register access */ -static __inline uint32_t -patm_nor_read(struct patm_softc *sc, u_int reg) -{ - uint32_t val; - - val = bus_space_read_4(sc->memt, sc->memh, reg); - patm_debug(sc, REG, "reg(0x%x)=%04x", reg, val); - return (val); -} -static __inline void -patm_nor_write(struct patm_softc *sc, u_int reg, uint32_t val) -{ - - patm_debug(sc, REG, "reg(0x%x)=%04x", reg, val); - bus_space_write_4(sc->memt, sc->memh, reg, val); -} - -/* Execute command */ -static __inline void -patm_cmd_wait(struct patm_softc *sc) -{ - while (patm_nor_read(sc, IDT_NOR_STAT) & IDT_STAT_CMDBZ) - ; -} -static __inline void -patm_cmd_exec(struct patm_softc *sc, uint32_t cmd) -{ - patm_cmd_wait(sc); - patm_nor_write(sc, IDT_NOR_CMD, cmd); -} - -/* Read/write SRAM at the given word address. */ -static __inline uint32_t -patm_sram_read(struct patm_softc *sc, u_int addr) -{ - uint32_t val; - - patm_cmd_exec(sc, IDT_MKCMD_RSRAM(addr)); - patm_cmd_wait(sc); - val = patm_nor_read(sc, IDT_NOR_D0); - patm_debug(sc, SRAM, "read %04x=%08x", addr, val); - return (val); -} -static __inline void -patm_sram_write(struct patm_softc *sc, u_int addr, uint32_t val) -{ - patm_debug(sc, SRAM, "write %04x=%08x", addr, val); - patm_cmd_wait(sc); - patm_nor_write(sc, IDT_NOR_D0, val); - patm_cmd_exec(sc, IDT_MKCMD_WSRAM(addr, 0)); -} -static __inline void -patm_sram_write4(struct patm_softc *sc, u_int addr, uint32_t v0, uint32_t v1, - uint32_t v2, uint32_t v3) -{ - patm_debug(sc, SRAM, "write %04x=%08x,%08x,%08x,%08x", - addr, v0, v1, v2, v3); - patm_cmd_wait(sc); - patm_nor_write(sc, IDT_NOR_D0, v0); - patm_nor_write(sc, IDT_NOR_D1, v1); - patm_nor_write(sc, IDT_NOR_D2, v2); - patm_nor_write(sc, IDT_NOR_D3, v3); - patm_cmd_exec(sc, IDT_MKCMD_WSRAM(addr, 3)); -} - -#define LEGAL_VPI(SC, VPI) \ - (((VPI) & ~((1 << IFP2IFATM((SC)->ifp)->mib.vpi_bits) - 1)) == 0) -#define LEGAL_VCI(SC, VCI) \ - (((VCI) & ~((1 << IFP2IFATM((SC)->ifp)->mib.vci_bits) - 1)) == 0) - -extern const uint32_t patm_rtables155[]; -extern const uint32_t patm_rtables25[]; -extern const u_int patm_rtables_size; -extern const u_int patm_rtables_ntab; diff --git a/sys/dev/utopia/idtphy.c b/sys/dev/utopia/idtphy.c deleted file mode 100644 index 5aaa576abb23..000000000000 --- a/sys/dev/utopia/idtphy.c +++ /dev/null @@ -1,494 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -/* - * Reset IDT77105. There is really no way to reset this thing by acessing - * the registers. Load the registers with default values. - */ -static int -idt77105_reset(struct utopia *utp) -{ - int err = 0; - u_int n; - uint8_t val[2]; - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_MCR, 0xff, - IDTPHY_REGM_MCR_DRIC | IDTPHY_REGM_MCR_EI); - n = 1; - err |= UTP_READREGS(utp, IDTPHY_REGO_ISTAT, val, &n); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_DIAG, 0xff, 0); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_LHEC, 0xff, 0); - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_CNTS, 0xff, IDTPHY_REGM_CNTS_SEC); - n = 2; - err |= UTP_READREGS(utp, IDTPHY_REGO_CNT, val, &n); - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_CNTS, 0xff, IDTPHY_REGM_CNTS_TX); - n = 2; - err |= UTP_READREGS(utp, IDTPHY_REGO_CNT, val, &n); - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_CNTS, 0xff, IDTPHY_REGM_CNTS_RX); - n = 2; - err |= UTP_READREGS(utp, IDTPHY_REGO_CNT, val, &n); - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_CNTS, 0xff, IDTPHY_REGM_CNTS_HECE); - n = 2; - err |= UTP_READREGS(utp, IDTPHY_REGO_CNT, val, &n); - - err |= UTP_WRITEREG(utp, IDTPHY_REGO_MCR, IDTPHY_REGM_MCR_DREC, - IDTPHY_REGM_MCR_DREC); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_DIAG, IDTPHY_REGM_DIAG_RFLUSH, - IDTPHY_REGM_DIAG_RFLUSH); - - /* loopback */ - err |= utopia_set_loopback(utp, utp->loopback); - - /* update carrier state */ - err |= utopia_update_carrier(utp); - - return (err ? EIO : 0); -} - -static int -idt77105_inval(struct utopia *utp, int what __unused) -{ - - return (EINVAL); -} - -static int -idt77105_update_carrier(struct utopia *utp) -{ - int err; - uint8_t reg; - u_int n = 1; - - if ((err = UTP_READREGS(utp, IDTPHY_REGO_ISTAT, ®, &n)) != 0) { - utp->carrier = UTP_CARR_UNKNOWN; - return (err); - } - utopia_check_carrier(utp, reg & IDTPHY_REGM_ISTAT_GOOD); - return (0); -} - -static int -idt77105_set_loopback(struct utopia *utp, u_int mode) -{ - int err; - - switch (mode) { - case UTP_LOOP_NONE: - err = UTP_WRITEREG(utp, IDTPHY_REGO_DIAG, - IDTPHY_REGM_DIAG_LOOP, IDTPHY_REGM_DIAG_LOOP_NONE); - break; - - case UTP_LOOP_DIAG: - err = UTP_WRITEREG(utp, IDTPHY_REGO_DIAG, - IDTPHY_REGM_DIAG_LOOP, IDTPHY_REGM_DIAG_LOOP_PHY); - break; - - case UTP_LOOP_LINE: - err = UTP_WRITEREG(utp, IDTPHY_REGO_DIAG, - IDTPHY_REGM_DIAG_LOOP, IDTPHY_REGM_DIAG_LOOP_LINE); - break; - - default: - return (EINVAL); - } - if (err) - return (err); - utp->loopback = mode; - return (0); -} - -/* - * Handle interrupt on IDT77105 chip - */ -static void -idt77105_intr(struct utopia *utp) -{ - uint8_t reg; - u_int n = 1; - int err; - - /* Interrupt status and ack the interrupt */ - if ((err = UTP_READREGS(utp, IDTPHY_REGO_ISTAT, ®, &n)) != 0) { - printf("IDT77105 read error %d\n", err); - return; - } - /* check for signal condition */ - utopia_check_carrier(utp, reg & IDTPHY_REGM_ISTAT_GOOD); -} - -static void -idt77105_update_stats(struct utopia *utp) -{ - int err = 0; - uint8_t regs[2]; - u_int n; - -#ifdef DIAGNOSTIC -#define UDIAG(F,A,B) printf(F, A, B) -#else -#define UDIAG(F,A,B) do { } while (0) -#endif - -#define UPD(FIELD, CODE, N, MASK) \ - err = UTP_WRITEREG(utp, IDTPHY_REGO_CNTS, 0xff, CODE); \ - if (err != 0) { \ - UDIAG("%s: cannot write CNTS: %d\n", __func__, err); \ - return; \ - } \ - n = N; \ - err = UTP_READREGS(utp, IDTPHY_REGO_CNT, regs, &n); \ - if (err != 0) { \ - UDIAG("%s: cannot read CNT: %d\n", __func__, err); \ - return; \ - } \ - if (n != N) { \ - UDIAG("%s: got only %u registers\n", __func__, n); \ - return; \ - } \ - if (N == 1) \ - utp->stats.FIELD += (regs[0] & MASK); \ - else \ - utp->stats.FIELD += (regs[0] | (regs[1] << 8)) & MASK; - - UPD(rx_symerr, IDTPHY_REGM_CNTS_SEC, 1, 0xff); - UPD(tx_cells, IDTPHY_REGM_CNTS_TX, 2, 0xffff); - UPD(rx_cells, IDTPHY_REGM_CNTS_RX, 2, 0xffff); - UPD(rx_uncorr, IDTPHY_REGM_CNTS_HECE, 1, 0x1f); - -#undef UDIAG -#undef UPD -} - -struct utopia_chip utopia_chip_idt77105 = { - UTP_TYPE_IDT77105, - "IDT77105", - 7, - idt77105_reset, - idt77105_inval, - idt77105_inval, - idt77105_inval, - idt77105_update_carrier, - idt77105_set_loopback, - idt77105_intr, - idt77105_update_stats, -}; - -/* - * Update the carrier status - */ -static int -idt77155_update_carrier(struct utopia *utp) -{ - int err; - uint8_t reg; - u_int n = 1; - - if ((err = UTP_READREGS(utp, IDTPHY_REGO_RSOS, ®, &n)) != 0) { - utp->carrier = UTP_CARR_UNKNOWN; - return (err); - } - utopia_check_carrier(utp, !(reg & IDTPHY_REGM_RSOS_LOS)); - return (0); -} - -/* - * Handle interrupt on IDT77155 chip - */ -static void -idt77155_intr(struct utopia *utp) -{ - uint8_t reg; - u_int n = 1; - int err; - - if ((err = UTP_READREGS(utp, IDTPHY_REGO_RSOS, ®, &n)) != 0) { - printf("IDT77105 read error %d\n", err); - return; - } - utopia_check_carrier(utp, !(reg & IDTPHY_REGM_RSOS_LOS)); -} - -/* - * set SONET/SDH mode - */ -static int -idt77155_set_sdh(struct utopia *utp, int sdh) -{ - int err; - - if (sdh) - err = UTP_WRITEREG(utp, IDTPHY_REGO_PTRM, - IDTPHY_REGM_PTRM_SS, IDTPHY_REGM_PTRM_SDH); - else - err = UTP_WRITEREG(utp, IDTPHY_REGO_PTRM, - IDTPHY_REGM_PTRM_SS, IDTPHY_REGM_PTRM_SONET); - if (err != 0) - return (err); - - utp->state &= ~UTP_ST_SDH; - if (sdh) - utp->state |= UTP_ST_SDH; - - return (0); -} - -/* - * set idle/unassigned cells - */ -static int -idt77155_set_unass(struct utopia *utp, int unass) -{ - int err; - - if (unass) - err = UTP_WRITEREG(utp, IDTPHY_REGO_TCHP, 0xff, 0); - else - err = UTP_WRITEREG(utp, IDTPHY_REGO_TCHP, 0xff, 1); - if (err != 0) - return (err); - - utp->state &= ~UTP_ST_UNASS; - if (unass) - utp->state |= UTP_ST_UNASS; - - return (0); -} - -/* - * enable/disable scrambling - */ -static int -idt77155_set_noscramb(struct utopia *utp, int noscramb) -{ - int err; - - if (noscramb) { - err = UTP_WRITEREG(utp, IDTPHY_REGO_TCC, - IDTPHY_REGM_TCC_DSCR, IDTPHY_REGM_TCC_DSCR); - if (err) - return (err); - err = UTP_WRITEREG(utp, IDTPHY_REGO_RCC, - IDTPHY_REGM_RCC_DSCR, IDTPHY_REGM_RCC_DSCR); - if (err) - return (err); - utp->state |= UTP_ST_NOSCRAMB; - } else { - err = UTP_WRITEREG(utp, IDTPHY_REGO_TCC, - IDTPHY_REGM_TCC_DSCR, 0); - if (err) - return (err); - err = UTP_WRITEREG(utp, IDTPHY_REGO_RCC, - IDTPHY_REGM_RCC_DSCR, 0); - if (err) - return (err); - utp->state &= ~UTP_ST_NOSCRAMB; - } - return (0); -} - -/* - * Set loopback mode for the 77155 - */ -static int -idt77155_set_loopback(struct utopia *utp, u_int mode) -{ - int err; - uint32_t val; - u_int nmode; - - val = 0; - nmode = mode; - if (mode & UTP_LOOP_TIME) { - nmode &= ~UTP_LOOP_TIME; - val |= IDTPHY_REGM_MCTL_TLOOP; - } - if (mode & UTP_LOOP_DIAG) { - nmode &= ~UTP_LOOP_DIAG; - val |= IDTPHY_REGM_MCTL_DLOOP; - } - if (mode & UTP_LOOP_LINE) { - nmode &= ~UTP_LOOP_LINE; - val |= IDTPHY_REGM_MCTL_LLOOP; - } - if (nmode != 0) - return (EINVAL); - - err = UTP_WRITEREG(utp, IDTPHY_REGO_MCTL, IDTPHY_REGM_MCTL_TLOOP | - IDTPHY_REGM_MCTL_DLOOP | IDTPHY_REGM_MCTL_LLOOP, val); - if (err) - return (err); - utp->loopback = mode; - - return (0); -} - -/* - * Set the chip to reflect the current state in utopia. - * Assume, that the chip has been reset. - */ -static int -idt77155_set_chip(struct utopia *utp) -{ - int err = 0; - - /* set sonet/sdh */ - err |= idt77155_set_sdh(utp, utp->state & UTP_ST_SDH); - - /* unassigned or idle cells */ - err |= idt77155_set_unass(utp, utp->state & UTP_ST_UNASS); - - /* loopback */ - err |= idt77155_set_loopback(utp, utp->loopback); - - /* update carrier state */ - err |= idt77155_update_carrier(utp); - - /* enable interrupts on LOS */ - err |= UTP_WRITEREG(utp, IDTPHY_REGO_INT, - IDTPHY_REGM_INT_RXSOHI, IDTPHY_REGM_INT_RXSOHI); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_RSOC, - IDTPHY_REGM_RSOC_LOSI, IDTPHY_REGM_RSOC_LOSI); - - return (err ? EIO : 0); -} - -/* - * Reset the chip to reflect the current state of utopia. - */ -static int -idt77155_reset(struct utopia *utp) -{ - int err = 0; - - if (!(utp->flags & UTP_FL_NORESET)) { - err |= UTP_WRITEREG(utp, IDTPHY_REGO_MRID, - IDTPHY_REGM_MRID_RESET, IDTPHY_REGM_MRID_RESET); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_MRID, - IDTPHY_REGM_MRID_RESET, 0); - } - - err |= idt77155_set_chip(utp); - - return (err ? EIO : 0); -} - -/* - * Update statistics from a IDT77155 - * This appears to be the same as for the Suni/Lite and Ultra. IDT however - * makes no assessment about the transfer time. Assume 7us. - */ -static void -idt77155_update_stats(struct utopia *utp) -{ - int err; - - /* write to the master if we can */ - if (!(utp->flags & UTP_FL_NORESET)) { - err = UTP_WRITEREG(utp, IDTPHY_REGO_MRID, 0, 0); - } else { - err = UTP_WRITEREG(utp, IDTPHY_REGO_BIPC, 0, 0); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_B2EC, 0, 0); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_B3EC, 0, 0); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_CEC, 0, 0); - err |= UTP_WRITEREG(utp, IDTPHY_REGO_TXCNT, 0, 0); - - } - if (err) { -#ifdef DIAGNOSTIC - printf("%s: register write error %s: %d\n", __func__, - utp->chip->name, err); -#endif - return; - } - - DELAY(8); - - utp->stats.rx_sbip += utopia_update(utp, - IDTPHY_REGO_BIPC, 2, 0xffff); - utp->stats.rx_lbip += utopia_update(utp, - IDTPHY_REGO_B2EC, 3, 0xfffff); - utp->stats.rx_lfebe += utopia_update(utp, - IDTPHY_REGO_FEBEC, 3, 0xfffff); - utp->stats.rx_pbip += utopia_update(utp, - IDTPHY_REGO_B3EC, 2, 0xffff); - utp->stats.rx_pfebe += utopia_update(utp, - IDTPHY_REGO_PFEBEC, 2, 0xffff); - utp->stats.rx_corr += utopia_update(utp, - IDTPHY_REGO_CEC, 1, 0xff); - utp->stats.rx_uncorr += utopia_update(utp, - IDTPHY_REGO_UEC, 1, 0xff); - utp->stats.rx_cells += utopia_update(utp, - IDTPHY_REGO_RCCNT, 3, 0x7ffff); - utp->stats.tx_cells += utopia_update(utp, - IDTPHY_REGO_TXCNT, 3, 0x7ffff); -} - -const struct utopia_chip utopia_chip_idt77155 = { - UTP_TYPE_IDT77155, - "IDT77155", - 0x80, - idt77155_reset, - idt77155_set_sdh, - idt77155_set_unass, - idt77155_set_noscramb, - idt77155_update_carrier, - idt77155_set_loopback, - idt77155_intr, - idt77155_update_stats, -}; diff --git a/sys/dev/utopia/idtphy.h b/sys/dev/utopia/idtphy.h deleted file mode 100644 index 1451d0561fa3..000000000000 --- a/sys/dev/utopia/idtphy.h +++ /dev/null @@ -1,761 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Register definitions for the following chips: - * IDT 77105 - * IDT 77155 - */ -#ifndef _DEV_UTOPIA_IDTPHY_H -#define _DEV_UTOPIA_IDTPHY_H - -#define IDTPHY_REGO_MCR 0x00 -#define IDTPHY_REGN_MCR "Master Control Register" -#define IDTPHY_REGX_MCR "\020\010UPLO\7DREC\6ECEI\5TDPC\4DRIC\3HALTTX\2BYTEM\1EI" -#define IDTPHY_REGM_MCR_UPL0 0x80 -#define IDTPHY_REGM_MCR_DREC 0x40 -#define IDTPHY_REGM_MCR_ECEI 0x20 -#define IDTPHY_REGM_MCR_TDPC 0x10 -#define IDTPHY_REGM_MCR_DRIC 0x08 -#define IDTPHY_REGM_MCR_HALTTX 0x04 -#define IDTPHY_REGM_MCR_BYTEM 0x02 -#define IDTPHY_REGM_MCR_EI 0x01 - -#define IDTPHY_REGO_ISTAT 0x01 -#define IDTPHY_REGN_ISTAT "Interrupt Status" -#define IDTPHY_REGX_ISTAT "\020\7GOOD\6HECE\5SCRE\4TPE\3RSCC\2RSE\1RFO" -#define IDTPHY_REGM_ISTAT_GOOD 0x40 /* good signal bit */ -#define IDTPHY_REGM_ISTAT_HECE 0x20 /* HEC error */ -#define IDTPHY_REGM_ISTAT_SCRE 0x10 /* short cell received error */ -#define IDTPHY_REGM_ISTAT_TPE 0x08 /* transmit parity error */ -#define IDTPHY_REGM_ISTAT_RSCC 0x04 /* receive signal condition change */ -#define IDTPHY_REGM_ISTAT_RSE 0x02 /* receive symbol error */ -#define IDTPHY_REGM_ISTAT_RFO 0x01 /* read FIFO overrun */ - -#define IDTPHY_REGO_DIAG 0x02 -#define IDTPHY_REGN_DIAG "Diagnostic Control" -#define IDTPHY_REGX_DIAG "\020\010FTD\7ROS\6MULTI\5RFLUSH\4ITPE\3IHECE\11\3\0NORM\11\3\2PLOOP\11\3\3LLOOP" -#define IDTPHY_REGM_DIAG_FTD 0x80 /* Force TxClav Deassert */ -#define IDTPHY_REGM_DIAG_ROS 0x40 /* RxClav Operation Select */ -#define IDTPHY_REGM_DIAG_MULTI 0x20 /* Multi-phy operation */ -#define IDTPHY_REGM_DIAG_RFLUSH 0x10 /* clear receive Fifo */ -#define IDTPHY_REGM_DIAG_ITPE 0x08 /* insert transmit payload error */ -#define IDTPHY_REGM_DIAG_IHECE 0x04 /* insert transmit HEC error */ -#define IDTPHY_REGM_DIAG_LOOP 0x03 /* loopback mode */ -#define IDTPHY_REGM_DIAG_LOOP_NONE 0x00 /* normal */ -#define IDTPHY_REGM_DIAG_LOOP_PHY 0x02 /* PHY loopback */ -#define IDTPHY_REGM_DIAG_LOOP_LINE 0x03 /* Line loopback */ - -#define IDTPHY_REGO_LHEC 0x03 -#define IDTPHY_REGN_LHEC "LED Driver and HEC Status/Control" -#define IDTPHY_REGX_LHEC "\020\7DRHEC\6DTHEC\11\x18\0CYC1\11\x18\1CYC2\11\x18\2CYC4\11\x18\3CYC8\3FIFOE\2TXLED\1RXLED" -#define IDTPHY_REGM_LHEC_DRHEC 0x40 /* disable receive HEC */ -#define IDTPHY_REGM_LHEC_DTHEC 0x20 /* disable transmit HEC */ -#define IDTPHY_REGM_LHEC_RXREF 0x18 /* RxRef pulse width */ -#define IDTPHY_REGM_LHEC_RXREF1 0x00 /* 1 pulse */ -#define IDTPHY_REGM_LHEC_RXREF2 0x08 /* 2 pulse */ -#define IDTPHY_REGM_LHEC_RXREF4 0x10 /* 4 pulse */ -#define IDTPHY_REGM_LHEC_RXREF8 0x18 /* 8 pulse */ -#define IDTPHY_REGM_LHEC_FIFOE 0x04 /* Fifo empty */ -#define IDTPHY_REGM_LHEC_TXLED 0x02 /* Tx LED status */ -#define IDTPHY_REGM_LHEC_RXLED 0x01 /* Rx LED status */ - -#define IDTPHY_REGO_CNT 0x04 /* +0x05 */ -#define IDTPHY_REGN_CNT "Counter" - -#define IDTPHY_REGO_CNTS 0x06 -#define IDTPHY_REGN_CNTS "Counter select" -#define IDTPHY_REGX_CNTS "\020\4SEC\3TX\2RX\1HECE" -#define IDTPHY_REGM_CNTS_SEC 0x08 /* symbol error counter */ -#define IDTPHY_REGM_CNTS_TX 0x04 /* Tx cells */ -#define IDTPHY_REGM_CNTS_RX 0x02 /* Rx cells */ -#define IDTPHY_REGM_CNTS_HECE 0x01 /* HEC errors */ - -#define IDTPHY_PRINT_77105 \ - { /* 00 */ \ - UTP_REGT_BITS, IDTPHY_REGO_MCR, \ - IDTPHY_REGN_MCR, IDTPHY_REGX_MCR }, \ - { /* 01 */ \ - UTP_REGT_BITS, IDTPHY_REGO_ISTAT, \ - IDTPHY_REGN_ISTAT, IDTPHY_REGX_ISTAT }, \ - { /* 02 */ \ - UTP_REGT_BITS, IDTPHY_REGO_DIAG, \ - IDTPHY_REGN_DIAG, IDTPHY_REGX_DIAG }, \ - { /* 03 */ \ - UTP_REGT_BITS, IDTPHY_REGO_LHEC, \ - IDTPHY_REGN_LHEC, IDTPHY_REGX_LHEC }, \ - { /* 04, 05 */ \ - UTP_REGT_INT16, IDTPHY_REGO_CNT, \ - IDTPHY_REGN_CNT, NULL }, \ - { /* 06 */ \ - UTP_REGT_BITS, IDTPHY_REGO_CNTS, \ - IDTPHY_REGN_CNTS, IDTPHY_REGX_CNTS } - -#define IDTPHY_REGO_MRID 0x00 -#define IDTPHY_REGN_MRID "Master Reset & ID" -#define IDTPHY_REGM_MRID_RESET 0x80 /* software reset */ -#define IDTPHY_REGM_MRID_TYPE 0x70 /* type */ -#define IDTPHY_REGM_MRID_155 0x30 /* idt77155 type */ -#define IDTPHY_REGM_MRID_ID 0x0f /* revision */ -#define IDTPHY_REGX_MRID \ - "\020\010mstReset\12\x70\12type\12\xf\12id" - -#define IDTPHY_REGO_CONF 0x01 -#define IDTPHY_REGN_CONF "Configuration" -#define IDTPHY_REGM_CONF_AFEBE 0x40 /* autoFEBE */ -#define IDTPHY_REGM_CONF_ALRDI 0x20 /* autoLRDI */ -#define IDTPHY_REGM_CONF_APRDI 0x10 /* autoPRDI */ -#define IDTPHY_REGM_CONF_TCAIN 0x08 /* TCAInv */ -#define IDTPHY_REGM_CONF_RCAIN 0x04 /* RCAInv */ -#define IDTPHY_REGM_CONF_RXDIN 0x02 /* RXDInv */ -#define IDTPHY_REGM_CONF_RESV 0x81 -#define IDTPHY_REGX_CONF \ - "\020\07autoFEBE\6autoLRDI\5autoPRDI\4TCAInv\3RCAInv\2RXDInv" - -#define IDTPHY_REGO_INT 0x02 -#define IDTPHY_REGN_INT "Interrupt" -#define IDTPHY_REGM_INT_TXOOLI 0x80 /* txOOLInt */ -#define IDTPHY_REGM_INT_RXLOCI 0x40 /* rxLOCInt */ -#define IDTPHY_REGM_INT_RXOOLI 0x20 /* rxOOLInt */ -#define IDTPHY_REGM_INT_TXCDI 0x10 /* txCDi */ -#define IDTPHY_REGM_INT_RXCDI 0x08 /* rxCDi */ -#define IDTPHY_REGM_INT_RXPOHI 0x04 /* rxPOHi */ -#define IDTPHY_REGM_INT_RXLOHI 0x02 /* rxLOHi */ -#define IDTPHY_REGM_INT_RXSOHI 0x01 /* rxSOHi */ -#define IDTPHY_REGX_INT \ - "\020\10txOOLInt\7rxLOCInt\6rxOOLInt\5txCDi\4rxCDi\3rxPOHi" \ - "\2rxLOHi\1rxSOHi" - -#define IDTPHY_REGO_MCM 0x04 -#define IDTPHY_REGN_MCM "Master Clock Monitor" -#define IDTPHY_REGM_MCM_RRCLK 0x08 /* rrclkReg */ -#define IDTPHY_REGM_MCM_TRCLK 0x04 /* trclkReg */ -#define IDTPHY_REGM_MCM_RCLK 0x02 /* rclkReg */ -#define IDTPHY_REGM_MCM_TCLK 0x01 /* tclkReg */ -#define IDTPHY_REGM_MCM_RESV 0xf0 -#define IDTPHY_REGX_MCM \ - "\020\4rrclkReg\3trclkReg\2rclkReg\1tclkReg" - -#define IDTPHY_REGO_MCTL 0x05 -#define IDTPHY_REGN_MCTL "Master Control" -#define IDTPHY_REGM_MCTL_LOCI 0x80 /* rxLOCIEn */ -#define IDTPHY_REGM_MCTL_LOC 0x40 /* LOC */ -#define IDTPHY_REGM_MCTL_FIXP 0x20 /* txFixptr */ -#define IDTPHY_REGM_MCTL_LLOOP 0x04 /* txLLoop */ -#define IDTPHY_REGM_MCTL_DLOOP 0x02 /* rxDLoop */ -#define IDTPHY_REGM_MCTL_TLOOP 0x01 /* rxLoopT */ -#define IDTPHY_REGM_MCTL_RESV 0x18 -#define IDTPHY_REGX_MCTL \ - "\020\10rxLOCIEn\7LOC\6txFixptr\3txLLoop\2rxDLoop\1rxLoopT" - -#define IDTPHY_REGO_TXC 0x06 -#define IDTPHY_REGN_TXC "Transmit Clock Synthesis C/S" -#define IDTPHY_REGM_TXC_TXOOL 0x08 /* txOOL */ -#define IDTPHY_REGM_TXC_TXOOLI 0x02 /* txOOLIEn */ -#define IDTPHY_REGM_TXC_TXREF 0x01 /* txrefSel */ -#define IDTPHY_REGM_TXC_RESV 0xf4 -#define IDTPHY_REGX_TXC \ - "\020\4txOOL\2txOOLIEn\1txrefSel" - -#define IDTPHY_REGO_RXC 0x07 -#define IDTPHY_REGN_RXC "Receive Clock/Data Recovery C/S" -#define IDTPHY_REGM_RXC_RXOOL 0x08 /* rxOOL */ -#define IDTPHY_REGM_RXC_RXOOLI 0x02 /* rxOOLIEn */ -#define IDTPHY_REGM_RXC_RXREF 0x01 /* rxrefSel */ -#define IDTPHY_REGM_RXC_RESV 0xf4 -#define IDTPHY_REGX_RXC \ - "\020\4rxOOL\2rxOOLIEn\1rxrefSel" - -#define IDTPHY_REGO_RSOC 0x10 -#define IDTPHY_REGN_RSOC "Receive Overhead Control" -#define IDTPHY_REGM_RSOC_DSCR 0x40 /* scrDis */ -#define IDTPHY_REGM_RSOC_FOOF 0x20 /* frcOOF */ -#define IDTPHY_REGM_RSOC_B1IE 0x08 /* B1ErrIEn */ -#define IDTPHY_REGM_RSOC_LOSI 0x04 /* LOSIEn */ -#define IDTPHY_REGM_RSOC_LOFI 0x02 /* LOFIEn */ -#define IDTPHY_REGM_RSOC_OOFI 0x01 /* OOFIEn */ -#define IDTPHY_REGM_RSOC_RESV 0x90 -#define IDTPHY_REGX_RSOC \ - "\020\7scrDis\6frcOOF\4B1ErrIEn\3LOSIEn\2LOFIEn\1OOFIEn" - -#define IDTPHY_REGO_RSOS 0x11 -#define IDTPHY_REGN_RSOS "Receive Overhead Status" -#define IDTPHY_REGM_RSOS_C1INT 0x80 /* C1Int */ -#define IDTPHY_REGM_RSOS_B1INT 0x40 /* B1ErrInt */ -#define IDTPHY_REGM_RSOS_LOSI 0x20 /* LOSInt */ -#define IDTPHY_REGM_RSOS_LOFI 0x10 /* LOFInt */ -#define IDTPHY_REGM_RSOS_OOFI 0x08 /* OOFInt */ -#define IDTPHY_REGM_RSOS_LOS 0x04 /* LOS */ -#define IDTPHY_REGM_RSOS_LOF 0x02 /* LOF */ -#define IDTPHY_REGM_RSOS_OOF 0x01 /* OOF */ -#define IDTPHY_REGX_RSOS \ - "\020\10C1Int\7B1ErrInt\6LOSInt\5LOFInt\4OOFint\3LOS\2LOF\1OOF" - -#define IDTPHY_REGO_BIPC 0x12 /* + 0x13 LE */ -#define IDTPHY_REGN_BIPC "Receive Section BIP Errors" - -#define IDTPHY_REGO_TSOC 0x14 -#define IDTPHY_REGN_TSOC "Transmit Overhead Control" -#define IDTPHY_REGM_TSOC_DSCR 0x40 /* scrDis */ -#define IDTPHY_REGM_TSOC_LAISI 0x01 /* LAISIns */ -#define IDTPHY_REGM_TSOC_RESV 0xbe -#define IDTPHY_REGX_TSOC \ - "\020\7scrDis\1LAISIns" - -#define IDTPHY_REGO_TSOC2 0x15 -#define IDTPHY_REGN_TSOC2 "Transmit Overhead Control 2" -#define IDTPHY_REGM_TSOC2_LOSI 0x04 /* LOSIns */ -#define IDTPHY_REGM_TSOC2_B1INV 0x02 /* B1Inv */ -#define IDTPHY_REGM_TSOC2_IFE 0x01 /* frErrIns */ -#define IDTPHY_REGM_TSOC2_RESV 0xf8 -#define IDTPHY_REGX_TSOC2 \ - "\020\3LOSIns\2B1Inv\1frErrIns" - -#define IDTPHY_REGO_RLOS 0x18 -#define IDTPHY_REGN_RLOS "Receive Line Overhead Status" -#define IDTPHY_REGM_RLOS_B2W 0x80 /* B2Word */ -#define IDTPHY_REGM_RLOS_LAIS 0x02 /* LAIS */ -#define IDTPHY_REGM_RLOS_LRDI 0x01 /* LRDI */ -#define IDTPHY_REGM_RLOS_RESV 0x7c -#define IDTPHY_REGX_RLOS \ - "\020\10B2Word\2LAIS\1LRDI" - -#define IDTPHY_REGO_RLOI 0x19 -#define IDTPHY_REGN_RLOI "Receive Line Overhead Interrupt" -#define IDTPHY_REGM_RLOI_LFEBEE 0x80 /* LFEBEIEn */ -#define IDTPHY_REGM_RLOI_B2EE 0x40 /* B2ErrIEn */ -#define IDTPHY_REGM_RLOI_LAISE 0x20 /* LAISIEn */ -#define IDTPHY_REGM_RLOI_LRDIE 0x10 /* LRDIIEn */ -#define IDTPHY_REGM_RLOI_LFEBEI 0x08 /* LFEBEInt */ -#define IDTPHY_REGM_RLOI_B2EI 0x04 /* B2ErrInt */ -#define IDTPHY_REGM_RLOI_LAISI 0x02 /* LAISInt */ -#define IDTPHY_REGM_RLOI_LRDII 0x01 /* LRDIInt */ -#define IDTPHY_REGX_RLOI \ - "\020\10LFEBEIEn\7B2ErrIEn\6LAISIEn\5LRDIIEn\4LFEBEInt\3B2ErrInt" \ - "\2LAISInt\1LRDIInt" - -#define IDTPHY_REGO_B2EC 0x1a /* + 0x1b, 0x1c, 20bit LE */ -#define IDTPHY_REGN_B2EC "B2 Errors" - -#define IDTPHY_REGO_FEBEC 0x1d /* + 0x1e, 0x1f, 20bit LE */ -#define IDTPHY_REGN_FEBEC "Line FEBE Errors" - -#define IDTPHY_REGO_TLOS 0x20 -#define IDTPHY_REGN_TLOS "Transmit Line Overhead Status" -#define IDTPHY_REGM_TLOS_LRDI 0x01 /* LRDI */ -#define IDTPHY_REGM_TLOS_RESV 0xfe -#define IDTPHY_REGX_TLOS \ - "\020\1LRDI" - -#define IDTPHY_REGO_TLOC 0x21 -#define IDTPHY_REGN_TLOC "Transmit Line Overhead Control" -#define IDTPHY_REGM_TLOC_B2INV 0x01 /* B2Inv */ -#define IDTPHY_REGM_TLOC_RESV 0xfe -#define IDTPHY_REGX_TLOC \ - "\020\1B2Inv" - -#define IDTPHY_REGO_TK1 0x24 -#define IDTPHY_REGN_TK1 "Transmit K1" - -#define IDTPHY_REGO_TK2 0x25 -#define IDTPHY_REGN_TK2 "Transmit K2" - -#define IDTPHY_REGO_RK1 0x26 -#define IDTPHY_REGN_RK1 "Receive K1" - -#define IDTPHY_REGO_RK2 0x27 -#define IDTPHY_REGN_RK2 "Receive K2" - -#define IDTPHY_REGO_RPOS 0x30 -#define IDTPHY_REGN_RPOS "Receive Path Overhead Status" -#define IDTPHY_REGM_RPOS_LOP 0x20 /* LOP */ -#define IDTPHY_REGM_RPOS_PAIS 0x08 /* PAIS */ -#define IDTPHY_REGM_RPOS_PRDI 0x04 /* PRDI */ -#define IDTPHY_REGM_RPOS_RESV 0xd3 -#define IDTPHY_REGX_RPOS \ - "\020\6LOP\4PAIS\3PRDI" - -#define IDTPHY_REGO_RPOI 0x31 -#define IDTPHY_REGN_RPOI "Receive Path Overhead Interrupt" -#define IDTPHY_REGM_RPOI_C2I 0x80 /* C2Int */ -#define IDTPHY_REGM_RPOI_LOPI 0x20 /* LOPInt */ -#define IDTPHY_REGM_RPOI_PAISI 0x08 /* PAISInt */ -#define IDTPHY_REGM_RPOI_PRDII 0x04 /* PRDIInt */ -#define IDTPHY_REGM_RPOI_B3EI 0x02 /* B3ErrInt */ -#define IDTPHY_REGM_RPOI_PFEBEI 0x01 /* PFEBEInt */ -#define IDTPHY_REGM_RPOI_RESV 0x50 -#define IDTPHY_REGX_RPOI \ - "\020\10C2Int\6LOPInt\4PAISInt\3PRDIInt\2B3ErrInt\1PFEBEInt" - -#define IDTPHY_REGO_RPIE 0x33 -#define IDTPHY_REGN_RPIE "Receive Path Interrupt Enable" -#define IDTPHY_REGM_RPIE_C2E 0x80 /* C2IEn */ -#define IDTPHY_REGM_RPIE_LOPE 0x20 /* LOPIEn */ -#define IDTPHY_REGM_RPIE_PAISE 0x08 /* PAISIEn */ -#define IDTPHY_REGM_RPIE_PRDIE 0x04 /* PRDIIEn */ -#define IDTPHY_REGM_RPIE_B3EE 0x02 /* B3ErrIEn */ -#define IDTPHY_REGM_RPIE_PFEBEE 0x01 /* PFEBEIEn */ -#define IDTPHY_REGM_RPIE_RESV 0x50 -#define IDTPHY_REGX_RPIE \ - "\020\10CSIEn\6LOPIEn\4PAISIEn\3PRDIIEn\2B3ErrIEn\1PFEBEIEn" - -#define IDTPHY_REGO_RC2 0x37 -#define IDTPHY_REGN_RC2 "Receive C2" - -#define IDTPHY_REGO_B3EC 0x38 /* + 0x39, LE, 16bit */ -#define IDTPHY_REGN_B3EC "B3 Errors" - -#define IDTPHY_REGO_PFEBEC 0x3a /* + 0x3b, LE, 16bit */ -#define IDTPHY_REGN_PFEBEC "Path FEBE Errors" - -#define IDTPHY_REGO_RPEC 0x3d -#define IDTPHY_REGN_RPEC "Receive Path BIP Error Control" -#define IDTPHY_REGM_RPEC_B3C 0x20 /* blkBIP */ -#define IDTPHY_REGM_RPEC_RESV 0xdf -#define IDTPHY_REGX_RPEC \ - "\020\6blkBIP" - -#define IDTPHY_REGO_TPOC 0x40 -#define IDTPHY_REGN_TPOC "Transmit Path Control" -#define IDTPHY_REGM_TPOC_B3INV 0x02 /* B3Inv */ -#define IDTPHY_REGM_TPOC_PAISI 0x01 /* PAISIns */ -#define IDTPHY_REGM_TPOC_RESC 0xfc -#define IDTPHY_REGX_TPOC \ - "\020\2B3Inv\1PAISIns" - -#define IDTPHY_REGO_TPTC 0x41 -#define IDTPHY_REGN_TPTC "Transmit Pointer Control" -#define IDTPHY_REGM_TPTC_FPTR 0x40 /* frcPtr */ -#define IDTPHY_REGM_TPTC_STUFF 0x20 /* stuffCtl */ -#define IDTPHY_REGM_TPTC_PTR 0x10 /* Ptr */ -#define IDTPHY_REGM_TPTC_NDF 0x08 /* NDF */ -#define IDTPHY_REGM_TPTC_DECP 0x04 /* decPtr */ -#define IDTPHY_REGM_TPTC_INCP 0x02 /* incPtr */ -#define IDTPHY_REGM_TPTC_RESV 0x81 -#define IDTPHY_REGX_TPTC \ - "\020\7frcPtr\6stuffCtl\5Ptr\4NDF\3decPtr\2incPtr" - -#define IDTPHY_REGO_PTRL 0x45 -#define IDTPHY_REGN_PTRL "Transmit Pointer LSB" -#define IDTPHY_REGX_PTRL \ - "\020\12\xff\20arbPtr" - -#define IDTPHY_REGO_PTRM 0x46 -#define IDTPHY_REGN_PTRM "Transmit Pointer MSB" -#define IDTPHY_REGM_PTRM_NDF 0xf0 /* NDFVal */ -#define IDTPHY_REGS_PTRM_NDF 4 -#define IDTPHY_REGM_PTRM_SS 0x0c /* ssBit */ -#define IDTPHY_REGM_PTRM_SONET 0x00 -#define IDTPHY_REGM_PTRM_SDH 0x08 -#define IDTPHY_REGM_PTRM_PTR 0x03 -#define IDTPHY_REGX_PTRM \ - "\020\12\xf0\20NDFVal\12\xc\20ssBit\12\x3\20arbPtr" - -#define IDTPHY_REGO_TC2 0x48 -#define IDTPHY_REGN_TC2 "Transmit C2" - -#define IDTPHY_REGO_TPOC2 0x49 -#define IDTPHY_REGN_TPOC2 "Transmit Path Control 2" -#define IDTPHY_REGM_TPOC2_FEBE 0xf0 /* PFEBEIns */ -#define IDTPHY_REGS_TPOC2_FEBE 4 -#define IDTPHY_REGM_TPOC2_PRDII 0x08 /* PRDIIns */ -#define IDTPHY_REGM_TPOC2_G1 0x07 /* G1Ins */ -#define IDTPHY_REGX_TPOC2 \ - "\020\12\xf0\20PFEBEIns\4PRDIIns\12\x7\20G1Ins" - -#define IDTPHY_REGO_RCC 0x50 -#define IDTPHY_REGN_RCC "Receive Cell Control" -#define IDTPHY_REGM_RCC_OCD 0x80 /* OCD */ -#define IDTPHY_REGM_RCC_PARTY 0x40 /* parity */ -#define IDTPHY_REGM_RCC_PASS 0x20 /* pass */ -#define IDTPHY_REGM_RCC_DCOR 0x10 /* corDis */ -#define IDTPHY_REGM_RCC_DHEC 0x08 /* HECdis */ -#define IDTPHY_REGM_RCC_ADD 0x04 /* csetAdd */ -#define IDTPHY_REGM_RCC_DSCR 0x02 /* scrDis */ -#define IDTPHY_REGM_RCC_RFIFO 0x01 /* rxFIFOrst */ -#define IDTPHY_REGX_RCC \ - "\020\10OCD\7parity\6pass\5corDis\4HECdis\3csetAdd" \ - "\2scrDis\1rxFIFOrst" - -#define IDTPHY_REGO_RCI 0x51 -#define IDTPHY_REGN_RCI "Receive Cell Interrupt" -#define IDTPHY_REGM_RCI_OCDE 0x80 /* OCDIEn */ -#define IDTPHY_REGM_RCI_HECE 0x40 /* HECIEn */ -#define IDTPHY_REGM_RCI_OVFE 0x20 /* ovfIEn */ -#define IDTPHY_REGM_RCI_OCDI 0x10 /* OCDInt */ -#define IDTPHY_REGM_RCI_CORI 0x08 /* corInt */ -#define IDTPHY_REGM_RCI_UCORI 0x04 /* uncorInt */ -#define IDTPHY_REGM_RCI_OVFI 0x02 /* ovfInt */ -#define IDTPHY_REGM_RCI_RESV 0x01 -#define IDTPHY_REGX_RCI \ - "\020\10OCDIEn\7HECIEn\6ovfIEn\5OCDInt\4corInt\3uncorInt\2ovfInt" - -#define IDTPHY_REGO_CMH 0x52 -#define IDTPHY_REGN_CMH "Receive Cell Match Header" -#define IDTPHY_REGM_CMH_GFC 0xf0 /* GFC */ -#define IDTPHY_REGS_CMH_GFC 4 -#define IDTPHY_REGM_CMH_PTI 0x0e /* PTI */ -#define IDTPHY_REGS_CMH_PTI 1 -#define IDTPHY_REGM_CMH_CLP 0x01 /* CLP */ -#define IDTPHY_REGX_CMH \ - "\020\12\xf0\20GFC\12\xe\20PTI\12\x1\20CLP" - -#define IDTPHY_REGO_CMHM 0x53 -#define IDTPHY_REGN_CMHM "Receive Cell Match Header Mask" -#define IDTPHY_REGM_CMHM_GFC 0xf0 /* mskGFC */ -#define IDTPHY_REGS_CMHM_GFC 4 -#define IDTPHY_REGM_CMHM_PTI 0x0e /* mskPTI */ -#define IDTPHY_REGS_CMHM_PTI 1 -#define IDTPHY_REGM_CMHM_CLP 0x01 /* mskCLP */ -#define IDTPHY_REGX_CMHM \ - "\020\12\xf0\20mskGFC\12\xe\20mskPTI\12\x1\20mskCLP" - -#define IDTPHY_REGO_CEC 0x54 -#define IDTPHY_REGN_CEC "Correctable Errors" - -#define IDTPHY_REGO_UEC 0x55 -#define IDTPHY_REGN_UEC "Uncorrectable Errors" - -#define IDTPHY_REGO_RCCNT 0x56 /* +0x57, 0x58, LE, 19bit */ -#define IDTPHY_REGN_RCCNT "Receive Cells" - -#define IDTPHY_REGO_RCCF 0x59 -#define IDTPHY_REGN_RCCF "Receive Cell Configuration" -#define IDTPHY_REGM_RCCF_GFCE 0xf0 /* GFCen */ -#define IDTPHY_REGS_RCCF_GFCE 4 -#define IDTPHY_REGM_RCCF_FIXS 0x08 /* FixSen */ -#define IDTPHY_REGM_RCCF_RCAL 0x04 /* RCAlevel */ -#define IDTPHY_REGM_RCCF_HECF 0x03 /* HECftr */ -#define IDTPHY_REGX_RCCF \ - "\020\12\xf0\20GFCen\4FixSen\3RCAlevel\12\x3\20HECftr" - -#define IDTPHY_REGO_RXID 0x5a -#define IDTPHY_REGN_RXID "Receive ID Address" -#define IDTPHY_REGM_RXID_ID 0x03 /* IDAddr */ -#define IDTPHY_REGM_RXID_RESV 0xfc -#define IDTPHY_REGX_RXID \ - "\020\12\x3\20IDAddr" - -#define IDTPHY_REGO_TCC 0x60 -#define IDTPHY_REGN_TCC "Transmit Cell Control" -#define IDTPHY_REGM_TCC_FIFOE 0x80 /* fovrIEn */ -#define IDTPHY_REGM_TCC_SOCI 0x40 /* socInt */ -#define IDTPHY_REGM_TCC_FIFOI 0x20 /* fovrInt */ -#define IDTPHY_REGM_TCC_HECINV 0x10 /* HECInv */ -#define IDTPHY_REGM_TCC_HECDIS 0x08 /* HECDis */ -#define IDTPHY_REGM_TCC_ADD 0x04 /* csetAdd */ -#define IDTPHY_REGM_TCC_DSCR 0x02 /* scrDis */ -#define IDTPHY_REGM_TCC_FIFOR 0x01 /* txFIFOrst */ -#define IDTPHY_REGX_TCC \ - "\020\10fovrIEn\7socInt\6fovrInt\5HECInv\4HECDis\3csetAdd" \ - "\2scrDis\1txFIFOrst" - -#define IDTPHY_REGO_TCHP 0x61 -#define IDTPHY_REGN_TCHP "Transmit Idle Cell Header" -#define IDTPHY_REGM_TCHP_GFC 0xf0 /* GFCtx */ -#define IDTPHY_REGS_TCHP_GFC 4 -#define IDTPHY_REGM_TCHP_PTI 0x0e /* PTItx */ -#define IDTPHY_REGS_TCHP_PTI 1 -#define IDTPHY_REGM_TCHP_CLP 0x01 /* CLPtx */ -#define IDTPHY_REGX_TCHP \ - "\020\12\xf0\20GFCtx\12\xe\20PTItx\12\x1\20CLPtx" - -#define IDTPHY_REGO_TPLD 0x62 -#define IDTPHY_REGN_TPLD "Transmit Idle Cell Payload" - -#define IDTPHY_REGO_TCC2 0x63 -#define IDTPHY_REGN_TCC2 "Transmit Cell Configuration 2" -#define IDTPHY_REGM_TCC2_PARITY 0x80 /* parity */ -#define IDTPHY_REGM_TCC2_PARE 0x40 /* parIEn */ -#define IDTPHY_REGM_TCC2_PARI 0x10 /* parInt */ -#define IDTPHY_REGM_TCC2_FIFO 0x0c /* FIFOdpth */ -#define IDTPHY_REGS_TCC2_FIFO 2 -#define IDTPHY_REGM_TCC2_TCAL 0x02 /* TCAlevel */ -#define IDTPHY_REGM_TCC2_RESV 0x01 -#define IDTPHY_REGX_TCC2 \ - "\020\10parity\7parIEn\5parInt\12\xc\20FIFOdpth\2TCAlevel" - -#define IDTPHY_REGO_TXCNT 0x64 /* +65,66 LE 19bit */ -#define IDTPHY_REGN_TXCNT "Transmit Cells" - -#define IDTPHY_REGO_TCC3 0x67 -#define IDTPHY_REGN_TCC3 "Transmit Cell Configuration 3" -#define IDTPHY_REGM_TCC3_GFCE 0xf0 /* txGFCen */ -#define IDTPHY_REGS_TCC3_GFCE 4 -#define IDTPHY_REGM_TCC3_FIXE 0x08 /* txFixSen */ -#define IDTPHY_REGM_TCC3_H4ID 0x04 /* H4InsDis */ -#define IDTPHY_REGM_TCC3_FIXB 0x03 /* fixByte */ -#define IDTPHY_REGM_TCC3_FIX00 0x00 /* 0x00 */ -#define IDTPHY_REGM_TCC3_FIX55 0x01 /* 0x55 */ -#define IDTPHY_REGM_TCC3_FIXAA 0x02 /* 0xAA */ -#define IDTPHY_REGM_TCC3_FIXFF 0x03 /* 0xFF */ -#define IDTPHY_REGX_TCC3 \ - "\020\12\xf0\20txGFCen\4txFixSen\3H4InsDis" \ - "\11\x3\x0FIX00\11\x3\x1FIX55\11\x3\x2FIXAA\11\x3\x3FIXFF" - -#define IDTPHY_REGO_TXID 0x68 -#define IDTPHY_REGN_TXID "Transmit ID Address" -#define IDTPHY_REGM_TXID_ID 0x03 /* txIDAddr */ -#define IDTPHY_REGM_TXID_RESV 0xfc -#define IDTPHY_REGX_TXID \ - "\020\12\x3\20txIDAddr" - -#define IDTPHY_REGO_RBER 0x70 -#define IDTPHY_REGN_RBER "Receive BER S/C" -#define IDTPHY_REGM_RBER_FAILE 0x08 /* FailIEn */ -#define IDTPHY_REGM_RBER_WARNE 0x04 /* WarnIEn */ -#define IDTPHY_REGM_RBER_FAIL 0x02 /* BERfail */ -#define IDTPHY_REGM_RBER_WARN 0x01 /* BERwarn */ -#define IDTPHY_REGM_RBER_RESV 0xf0 -#define IDTPHY_REGX_RBER \ - "\020\4FailIEn\3WarnIEn\2BERfail\1BERwarn" - -#define IDTPHY_REGO_BFTH 0x71 -#define IDTPHY_REGN_BFTH "Receive BER Fail Threshold" - -#define IDTPHY_REGO_BFWIN 0x72 -#define IDTPHY_REGN_BFWIN "Receive BER Fail Window" - -#define IDTPHY_REGO_BFDEN 0x73 /* +74, 16bit LE */ -#define IDTPHY_REGN_BFDEN "Receive BER Fail Denominator" - -#define IDTPHY_REGO_BWTH 0x75 -#define IDTPHY_REGN_BWTH "Receive BER Warn Threshold" - -#define IDTPHY_REGO_BWWIN 0x76 -#define IDTPHY_REGN_BWWIN "Receive BER Warn Window" - -#define IDTPHY_REGO_BWDEN 0x77 /* +78, 16bit LE */ -#define IDTPHY_REGN_BWDEN "Receive BER Warn Denomiator" - -#define IDTPHY_REGO_OPEC 0x7f -#define IDTPHY_REGN_OPEC "Output PECL Control" -#define IDTPHY_REGM_OPEC_TXC 0x04 /* pcctl_tc */ -#define IDTPHY_REGM_OPEC_TXD 0x02 /* pcctl_td */ -#define IDTPHY_REGM_OPEC_RXDO 0x01 /* pcctl_r */ -#define IDTPHY_REGM_OPEC_RESV 0xf8 -#define IDTPHY_REGX_OPEC \ - "\020\3pctl_tc\2pcctl_td\1pcctl_r" - -#define IDTPHY_PRINT_77155 \ - { /* 00 */ \ - UTP_REGT_BITS, IDTPHY_REGO_MRID, \ - IDTPHY_REGN_MRID, IDTPHY_REGX_MRID }, \ - { /* 01 */ \ - UTP_REGT_BITS, IDTPHY_REGO_CONF, \ - IDTPHY_REGN_CONF, IDTPHY_REGX_CONF }, \ - { /* 02 */ \ - UTP_REGT_BITS, IDTPHY_REGO_INT, \ - IDTPHY_REGN_INT, IDTPHY_REGX_INT }, \ - /* 03 unused */ \ - { /* 04 */ \ - UTP_REGT_BITS, IDTPHY_REGO_MCM, \ - IDTPHY_REGN_MCM, IDTPHY_REGX_MCM }, \ - { /* 05 */ \ - UTP_REGT_BITS, IDTPHY_REGO_MCTL, \ - IDTPHY_REGN_MCTL, IDTPHY_REGX_MCTL }, \ - { /* 06 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TXC, \ - IDTPHY_REGN_TXC, IDTPHY_REGX_TXC }, \ - { /* 07 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RXC, \ - IDTPHY_REGN_RXC, IDTPHY_REGX_RXC }, \ - /* 08-0f unused */ \ - { /* 10 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RSOC, \ - IDTPHY_REGN_RSOC, IDTPHY_REGX_RSOC }, \ - { /* 11 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RSOS, \ - IDTPHY_REGN_RSOS, IDTPHY_REGX_RSOS }, \ - { /* 12, 13 */ \ - UTP_REGT_INT16, IDTPHY_REGO_BIPC, \ - IDTPHY_REGN_BIPC, NULL }, \ - { /* 14 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TSOC, \ - IDTPHY_REGN_TSOC, IDTPHY_REGX_TSOC }, \ - { /* 15 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TSOC2, \ - IDTPHY_REGN_TSOC2, IDTPHY_REGX_TSOC2 }, \ - /* 16, 17 unused */ \ - { /* 18 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RLOS, \ - IDTPHY_REGN_RLOS, IDTPHY_REGX_RLOS }, \ - { /* 19 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RLOI, \ - IDTPHY_REGN_RLOI, IDTPHY_REGX_RLOI }, \ - { /* 1a-1c */ \ - UTP_REGT_INT20, IDTPHY_REGO_B2EC, \ - IDTPHY_REGN_B2EC, NULL }, \ - { /* 1d-1f */ \ - UTP_REGT_INT20, IDTPHY_REGO_FEBEC, \ - IDTPHY_REGN_FEBEC, NULL }, \ - { /* 20 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TLOS, \ - IDTPHY_REGN_TLOS, IDTPHY_REGX_TLOS }, \ - { /* 21 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TLOC, \ - IDTPHY_REGN_TLOC, IDTPHY_REGX_TLOC }, \ - /* 22, 23 unused */ \ - { /* 24 */ \ - UTP_REGT_INT8, IDTPHY_REGO_TK1, \ - IDTPHY_REGN_TK1, NULL }, \ - { /* 25 */ \ - UTP_REGT_INT8, IDTPHY_REGO_TK2, \ - IDTPHY_REGN_TK2, NULL }, \ - { /* 26 */ \ - UTP_REGT_INT8, IDTPHY_REGO_RK1, \ - IDTPHY_REGN_RK1, NULL }, \ - { /* 27 */ \ - UTP_REGT_INT8, IDTPHY_REGO_RK2, \ - IDTPHY_REGN_RK2, NULL }, \ - /* 28-2f unused */ \ - { /* 30 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RPOS, \ - IDTPHY_REGN_RPOS, IDTPHY_REGX_RPOS }, \ - { /* 31 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RPOI, \ - IDTPHY_REGN_RPOI, IDTPHY_REGX_RPOI }, \ - /* 32 unused */ \ - { /* 33 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RPIE, \ - IDTPHY_REGN_RPIE, IDTPHY_REGX_RPIE }, \ - /* 34-36 unused */ \ - { /* 37 */ \ - UTP_REGT_INT8, IDTPHY_REGO_RC2, \ - IDTPHY_REGN_RC2, NULL }, \ - { /* 38-39 */ \ - UTP_REGT_INT16, IDTPHY_REGO_B3EC, \ - IDTPHY_REGN_B3EC, NULL }, \ - { /* 3a-3b */ \ - UTP_REGT_INT16, IDTPHY_REGO_PFEBEC, \ - IDTPHY_REGN_PFEBEC, NULL }, \ - /* 3c unused */ \ - { /* 3d */ \ - UTP_REGT_BITS, IDTPHY_REGO_RPEC, \ - IDTPHY_REGN_RPEC, IDTPHY_REGX_RPEC }, \ - /* 3e, 3f unused */ \ - { /* 40 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TPOC, \ - IDTPHY_REGN_TPOC, IDTPHY_REGX_TPOC }, \ - { /* 41 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TPTC, \ - IDTPHY_REGN_TPTC, IDTPHY_REGX_TPTC }, \ - /* 42-44 unused */ \ - { /* 45 */ \ - UTP_REGT_BITS, IDTPHY_REGO_PTRL, \ - IDTPHY_REGN_PTRL, IDTPHY_REGX_PTRL }, \ - { /* 46 */ \ - UTP_REGT_BITS, IDTPHY_REGO_PTRM, \ - IDTPHY_REGN_PTRM, IDTPHY_REGX_PTRM }, \ - /* 47 unused */ \ - { /* 48 */ \ - UTP_REGT_INT8, IDTPHY_REGO_TC2, \ - IDTPHY_REGN_TC2, NULL }, \ - { /* 49 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TPOC2, \ - IDTPHY_REGN_TPOC2, IDTPHY_REGX_TPOC2 }, \ - /* 4a-4f unused */ \ - { /* 50 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RCC, \ - IDTPHY_REGN_RCC, IDTPHY_REGX_RCC }, \ - { /* 51 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RCI, \ - IDTPHY_REGN_RCI, IDTPHY_REGX_RCI }, \ - { /* 52 */ \ - UTP_REGT_BITS, IDTPHY_REGO_CMH, \ - IDTPHY_REGN_CMH, IDTPHY_REGX_CMH }, \ - { /* 53 */ \ - UTP_REGT_BITS, IDTPHY_REGO_CMHM, \ - IDTPHY_REGN_CMHM, IDTPHY_REGX_CMHM }, \ - { /* 54 */ \ - UTP_REGT_INT8, IDTPHY_REGO_CEC, \ - IDTPHY_REGN_CEC, NULL }, \ - { /* 55 */ \ - UTP_REGT_INT8, IDTPHY_REGO_UEC, \ - IDTPHY_REGN_UEC, NULL }, \ - { /* 56-58 */ \ - UTP_REGT_INT19, IDTPHY_REGO_RCCNT, \ - IDTPHY_REGN_RCCNT, NULL }, \ - { /* 59 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RCCF, \ - IDTPHY_REGN_RCCF, IDTPHY_REGX_RCCF }, \ - { /* 5a */ \ - UTP_REGT_BITS, IDTPHY_REGO_RXID, \ - IDTPHY_REGN_RXID, IDTPHY_REGX_RXID }, \ - /* 5b-5f unused */ \ - { /* 60 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TCC, \ - IDTPHY_REGN_TCC, IDTPHY_REGX_TCC }, \ - { /* 61 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TCHP, \ - IDTPHY_REGN_TCHP, IDTPHY_REGX_TCHP }, \ - { /* 62 */ \ - UTP_REGT_INT8, IDTPHY_REGO_TPLD, \ - IDTPHY_REGN_TPLD, NULL }, \ - { /* 63 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TCC2, \ - IDTPHY_REGN_TCC2, IDTPHY_REGX_TCC2 }, \ - { /* 64-66 */ \ - UTP_REGT_INT19, IDTPHY_REGO_TXCNT, \ - IDTPHY_REGN_TXCNT, NULL }, \ - { /* 67 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TCC3, \ - IDTPHY_REGN_TCC3, IDTPHY_REGX_TCC3 }, \ - { /* 68 */ \ - UTP_REGT_BITS, IDTPHY_REGO_TXID, \ - IDTPHY_REGN_TXID, IDTPHY_REGX_TXID }, \ - /* 69-6f unused */ \ - { /* 70 */ \ - UTP_REGT_BITS, IDTPHY_REGO_RBER, \ - IDTPHY_REGN_RBER, IDTPHY_REGX_RBER }, \ - { /* 71 */ \ - UTP_REGT_INT8, IDTPHY_REGO_BFTH, \ - IDTPHY_REGN_BFTH, NULL }, \ - { /* 72 */ \ - UTP_REGT_INT8, IDTPHY_REGO_BFWIN, \ - IDTPHY_REGN_BFWIN, NULL }, \ - { /* 73,74 */ \ - UTP_REGT_INT16, IDTPHY_REGO_BFDEN, \ - IDTPHY_REGN_BFDEN, NULL }, \ - { /* 75 */ \ - UTP_REGT_INT8, IDTPHY_REGO_BWTH, \ - IDTPHY_REGN_BWTH, NULL }, \ - { /* 76 */ \ - UTP_REGT_INT8, IDTPHY_REGO_BWWIN, \ - IDTPHY_REGN_BWWIN, NULL }, \ - { /* 77,78 */ \ - UTP_REGT_INT16, IDTPHY_REGO_BWDEN, \ - IDTPHY_REGN_BWDEN, NULL }, \ - /* 79-7e unused */ \ - { /* 7f */ \ - UTP_REGT_BITS, IDTPHY_REGO_OPEC, \ - IDTPHY_REGN_OPEC, IDTPHY_REGX_OPEC } - - -#endif /* _DEV_UTOPIA_IDTPHY_H */ diff --git a/sys/dev/utopia/suni.c b/sys/dev/utopia/suni.c deleted file mode 100644 index ffc49e8e84da..000000000000 --- a/sys/dev/utopia/suni.c +++ /dev/null @@ -1,545 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -/* - * set SONET/SDH mode - */ -static int -suni_set_sdh(struct utopia *utp, int sdh) -{ - int err; - - if (sdh) - err = UTP_WRITEREG(utp, SUNI_REGO_TPOPAPTR + 1, - SUNI_REGM_TPOPAPTR_S, - SUNI_REGM_SDH << SUNI_REGS_TPOPAPTR_S); - else - err = UTP_WRITEREG(utp, SUNI_REGO_TPOPAPTR + 1, - SUNI_REGM_TPOPAPTR_S, - SUNI_REGM_SONET << SUNI_REGS_TPOPAPTR_S); - if (err != 0) - return (err); - - utp->state &= ~UTP_ST_SDH; - if (sdh) - utp->state |= UTP_ST_SDH; - - return (0); -} - -/* - * set idle/unassigned cells - */ -static int -suni_set_unass(struct utopia *utp, int unass) -{ - int err; - - if (unass) - err = UTP_WRITEREG(utp, SUNI_REGO_TACPIDLEH, - 0xff, (0 << SUNI_REGS_TACPIDLEH_CLP)); - else - err = UTP_WRITEREG(utp, SUNI_REGO_TACPIDLEH, - 0xff, (1 << SUNI_REGS_TACPIDLEH_CLP)); - if (err != 0) - return (err); - - utp->state &= ~UTP_ST_UNASS; - if (unass) - utp->state |= UTP_ST_UNASS; - - return (0); -} - -/* - * enable/disable scrambling - */ -static int -suni_set_noscramb(struct utopia *utp, int noscramb) -{ - int err; - - if (noscramb) { - err = UTP_WRITEREG(utp, SUNI_REGO_TACPCTRL, - SUNI_REGM_TACPCTRL_DSCR, SUNI_REGM_TACPCTRL_DSCR); - if (err) - return (err); - err = UTP_WRITEREG(utp, SUNI_REGO_RACPCTRL, - SUNI_REGM_RACPCTRL_DDSCR, SUNI_REGM_RACPCTRL_DDSCR); - if (err) - return (err); - utp->state |= UTP_ST_NOSCRAMB; - } else { - err = UTP_WRITEREG(utp, SUNI_REGO_TACPCTRL, - SUNI_REGM_TACPCTRL_DSCR, 0); - if (err) - return (err); - err = UTP_WRITEREG(utp, SUNI_REGO_RACPCTRL, - SUNI_REGM_RACPCTRL_DDSCR, 0); - if (err) - return (err); - utp->state &= ~UTP_ST_NOSCRAMB; - } - return (0); -} - -/* - * Get current carrier state - */ -static int -suni_update_carrier(struct utopia *utp) -{ - int err; - uint8_t reg; - u_int n = 1; - - if ((err = UTP_READREGS(utp, SUNI_REGO_RSOPSIS, ®, &n)) != 0) { - utp->carrier = UTP_CARR_UNKNOWN; - return (err); - } - utopia_check_carrier(utp, !(reg & SUNI_REGM_RSOPSIS_LOSV)); - return (0); -} - -/* - * Set the SUNI chip to reflect the current state in utopia. - * Assume, that the chip has been reset. - */ -static int -suni_set_chip(struct utopia *utp) -{ - int err = 0; - - /* set sonet/sdh */ - err |= utopia_set_sdh(utp, utp->state & UTP_ST_SDH); - - /* unassigned or idle cells */ - err |= utopia_set_unass(utp, utp->state & UTP_ST_UNASS); - err |= UTP_WRITEREG(utp, SUNI_REGO_TACPIDLEP, 0xff, 0x6a); - - /* set scrambling */ - err |= utopia_set_noscramb(utp, utp->state & UTP_ST_NOSCRAMB); - - /* loopback */ - err |= utopia_set_loopback(utp, utp->loopback); - - /* update carrier state */ - err |= utopia_update_carrier(utp); - - /* enable interrupts on LOS */ - err |= UTP_WRITEREG(utp, SUNI_REGO_RSOPCIE, - SUNI_REGM_RSOPCIE_LOSE, SUNI_REGM_RSOPCIE_LOSE); - - return (err ? EIO : 0); -} - -/* - * Reset the SUNI chip to reflect the current state of utopia. - */ -static int -suni_reset_default(struct utopia *utp) -{ - int err = 0; - - if (!(utp->flags & UTP_FL_NORESET)) { - err |= UTP_WRITEREG(utp, SUNI_REGO_MRESET, - SUNI_REGM_MRESET_RESET, SUNI_REGM_MRESET_RESET); - err |= UTP_WRITEREG(utp, SUNI_REGO_MRESET, - SUNI_REGM_MRESET_RESET, 0); - } - - /* disable test mode */ - err |= UTP_WRITEREG(utp, SUNI_REGO_MTEST, 0xff, 0x00); - - err |= suni_set_chip(utp); - - return (err ? EIO : 0); -} - -/* - * Set loopback mode for the Lite - */ -static int -suni_set_loopback_lite(struct utopia *utp, u_int mode) -{ - int err; - uint32_t val; - u_int nmode; - - val = 0; - nmode = mode; - if (mode & UTP_LOOP_TIME) { - nmode &= ~UTP_LOOP_TIME; - val |= SUNI_REGM_MCTRL_LOOPT; - } - if (mode & UTP_LOOP_DIAG) { - nmode &= ~UTP_LOOP_DIAG; - val |= SUNI_REGM_MCTRL_DLE; - } - if (mode & UTP_LOOP_LINE) { - nmode &= ~UTP_LOOP_LINE; - if (val & SUNI_REGM_MCTRL_DLE) - return (EINVAL); - val |= SUNI_REGM_MCTRL_LLE; - } - if (nmode != 0) - return (EINVAL); - - err = UTP_WRITEREG(utp, SUNI_REGO_MCTRL, - SUNI_REGM_MCTRL_LLE | SUNI_REGM_MCTRL_DLE | SUNI_REGM_MCTRL_LOOPT, - val); - if (err) - return (err); - utp->loopback = mode; - - return (0); -} - -/* - * Update statistics from a SUNI/LITE or SUNI/ULTRA - */ -static void -suni_lite_update_stats(struct utopia *utp) -{ - int err; - - /* write to the master if we can */ - if (!(utp->flags & UTP_FL_NORESET)) { - err = UTP_WRITEREG(utp, SUNI_REGO_MRESET, 0, 0); - } else { - err = UTP_WRITEREG(utp, SUNI_REGO_RSOP_BIP8, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RLOPBIP8_24, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RPOPBIP8, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RACPCHCS, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_TACPCNT, 0, 0); - - } - if (err) { -#ifdef DIAGNOSTIC - printf("%s: register write error %s: %d\n", __func__, - utp->chip->name, err); -#endif - return; - } - - DELAY(8); - - utp->stats.rx_sbip += utopia_update(utp, - SUNI_REGO_RSOP_BIP8, 2, 0xffff); - utp->stats.rx_lbip += utopia_update(utp, - SUNI_REGO_RLOPBIP8_24, 3, 0xfffff); - utp->stats.rx_lfebe += utopia_update(utp, - SUNI_REGO_RLOPFEBE, 3, 0xfffff); - utp->stats.rx_pbip += utopia_update(utp, - SUNI_REGO_RPOPBIP8, 2, 0xffff); - utp->stats.rx_pfebe += utopia_update(utp, - SUNI_REGO_RPOPFEBE, 2, 0xffff); - utp->stats.rx_corr += utopia_update(utp, - SUNI_REGO_RACPCHCS, 1, 0xff); - utp->stats.rx_uncorr += utopia_update(utp, - SUNI_REGO_RACPUHCS, 1, 0xff); - utp->stats.rx_cells += utopia_update(utp, - SUNI_REGO_RACPCNT, 3, 0x7ffff); - utp->stats.tx_cells += utopia_update(utp, - SUNI_REGO_TACPCNT, 3, 0x7ffff); -} - -/* - * Handle interrupt on SUNI chip - */ -static void -suni_intr_default(struct utopia *utp) -{ - uint8_t regs[SUNI_REGO_MTEST]; - u_int n = SUNI_REGO_MTEST; - int err; - - /* Read all registers. This acks the interrupts */ - if ((err = UTP_READREGS(utp, SUNI_REGO_MRESET, regs, &n)) != 0) { - printf("SUNI read error %d\n", err); - return; - } - if (n <= SUNI_REGO_RSOPSIS) { - printf("%s: could not read RSOPSIS", __func__); - return; - } - /* check for LOSI (loss of signal) */ - if ((regs[SUNI_REGO_MISTATUS] & SUNI_REGM_MISTATUS_RSOPI) && - (regs[SUNI_REGO_RSOPSIS] & SUNI_REGM_RSOPSIS_LOSI)) - utopia_check_carrier(utp, !(regs[SUNI_REGO_RSOPSIS] - & SUNI_REGM_RSOPSIS_LOSV)); -} - -const struct utopia_chip utopia_chip_lite = { - UTP_TYPE_SUNI_LITE, - "Suni/Lite (PMC-5346)", - 256, - suni_reset_default, - suni_set_sdh, - suni_set_unass, - suni_set_noscramb, - suni_update_carrier, - suni_set_loopback_lite, - suni_intr_default, - suni_lite_update_stats, -}; - -/* - * Set loopback mode for the Ultra - */ -static int -suni_set_loopback_ultra(struct utopia *utp, u_int mode) -{ - int err; - uint32_t val; - u_int nmode; - - val = 0; - nmode = mode; - if (mode & UTP_LOOP_TIME) { - nmode &= ~UTP_LOOP_TIME; - val |= SUNI_REGM_MCTRL_LOOPT; - } - if (mode & UTP_LOOP_DIAG) { - nmode &= ~UTP_LOOP_DIAG; - if (val & SUNI_REGM_MCTRL_LOOPT) - return (EINVAL); - val |= SUNI_REGM_MCTRL_SDLE; - } - if (mode & UTP_LOOP_LINE) { - nmode &= ~UTP_LOOP_LINE; - if (val & (SUNI_REGM_MCTRL_LOOPT | SUNI_REGM_MCTRL_SDLE)) - return (EINVAL); - val |= SUNI_REGM_MCTRL_LLE; - } - if (mode & UTP_LOOP_PARAL) { - nmode &= ~UTP_LOOP_PARAL; - val |= SUNI_REGM_MCTRL_PDLE; - } - if (mode & UTP_LOOP_TWIST) { - nmode &= ~UTP_LOOP_TWIST; - val |= SUNI_REGM_MCTRL_TPLE; - } - if (nmode != 0) - return (EINVAL); - - err = UTP_WRITEREG(utp, SUNI_REGO_MCTRL, - SUNI_REGM_MCTRL_LLE | SUNI_REGM_MCTRL_SDLE | SUNI_REGM_MCTRL_LOOPT | - SUNI_REGM_MCTRL_PDLE | SUNI_REGM_MCTRL_TPLE, val); - if (err) - return (err); - utp->loopback = mode; - - return (0); -} - -const struct utopia_chip utopia_chip_ultra = { - UTP_TYPE_SUNI_ULTRA, - "Suni/Ultra (PMC-5350)", - 256, - suni_reset_default, - suni_set_sdh, - suni_set_unass, - suni_set_noscramb, - suni_update_carrier, - suni_set_loopback_ultra, - suni_intr_default, - suni_lite_update_stats, -}; - -/* - * Set loopback mode for the 622 - */ -static int -suni_set_loopback_622(struct utopia *utp, u_int mode) -{ - int err; - uint32_t val; - uint8_t config; - int smode; - u_int nmode; - u_int n = 1; - - val = 0; - nmode = mode; - if (mode & UTP_LOOP_PATH) { - nmode &= ~UTP_LOOP_PATH; - val |= SUNI_REGM_MCTRLM_DPLE; - } - - err = UTP_READREGS(utp, SUNI_REGO_MCONFIG, &config, &n); - if (err != 0) - return (err); - smode = ((config & SUNI_REGM_MCONFIG_TMODE_622) == - SUNI_REGM_MCONFIG_TMODE_STS1_BIT && - (config & SUNI_REGM_MCONFIG_RMODE_622) == - SUNI_REGM_MCONFIG_RMODE_STS1_BIT); - - if (mode & UTP_LOOP_TIME) { - if (!smode) - return (EINVAL); - nmode &= ~UTP_LOOP_TIME; - val |= SUNI_REGM_MCTRLM_LOOPT; - } - if (mode & UTP_LOOP_DIAG) { - nmode &= ~UTP_LOOP_DIAG; - if (val & SUNI_REGM_MCTRLM_LOOPT) - return (EINVAL); - val |= SUNI_REGM_MCTRLM_DLE; - } - if (mode & UTP_LOOP_LINE) { - nmode &= ~UTP_LOOP_LINE; - if (val & (SUNI_REGM_MCTRLM_LOOPT | SUNI_REGM_MCTRLM_DLE)) - return (EINVAL); - val |= SUNI_REGM_MCTRLM_LLE; - } - if (nmode != 0) - return (EINVAL); - - err = UTP_WRITEREG(utp, SUNI_REGO_MCTRLM, - SUNI_REGM_MCTRLM_LLE | SUNI_REGM_MCTRLM_DLE | - SUNI_REGM_MCTRLM_DPLE | SUNI_REGM_MCTRL_LOOPT, val); - if (err) - return (err); - utp->loopback = mode; - - return (0); -} - -/* - * Reset the SUNI chip to reflect the current state of utopia. - */ -static int -suni_reset_622(struct utopia *utp) -{ - int err = 0; - - if (!(utp->flags & UTP_FL_NORESET)) { - err |= UTP_WRITEREG(utp, SUNI_REGO_MRESET, - SUNI_REGM_MRESET_RESET, SUNI_REGM_MRESET_RESET); - err |= UTP_WRITEREG(utp, SUNI_REGO_MRESET, - SUNI_REGM_MRESET_RESET, 0); - } - - /* disable test mode */ - err |= UTP_WRITEREG(utp, SUNI_REGO_MTEST, 0xff, - SUNI_REGM_MTEST_DS27_53_622); - - err |= suni_set_chip(utp); - - return (err ? EIO : 0); -} - -/* - * Update statistics from a SUNI/622 - */ -static void -suni_622_update_stats(struct utopia *utp) -{ - int err; - - /* write to the master if we can */ - if (!(utp->flags & UTP_FL_NORESET)) { - err = UTP_WRITEREG(utp, SUNI_REGO_MRESET, 0, 0); - } else { - err = UTP_WRITEREG(utp, SUNI_REGO_RSOP_BIP8, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RLOPBIP8_24, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RPOPBIP8, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_RACPCHCS, 0, 0); - err |= UTP_WRITEREG(utp, SUNI_REGO_TACPCNT, 0, 0); - } - if (err) { -#ifdef DIAGNOSTIC - printf("%s: register write error %s: %d\n", __func__, - utp->chip->name, err); -#endif - return; - } - - DELAY(8); - - utp->stats.rx_sbip += utopia_update(utp, - SUNI_REGO_RSOP_BIP8, 2, 0xffff); - utp->stats.rx_lbip += utopia_update(utp, - SUNI_REGO_RLOPBIP8_24, 3, 0xfffff); - utp->stats.rx_lfebe += utopia_update(utp, - SUNI_REGO_RLOPFEBE, 3, 0xfffff); - utp->stats.rx_pbip += utopia_update(utp, - SUNI_REGO_RPOPBIP8, 2, 0xffff); - utp->stats.rx_pfebe += utopia_update(utp, - SUNI_REGO_RPOPFEBE, 2, 0xffff); - utp->stats.rx_corr += utopia_update(utp, - SUNI_REGO_RACPCHCS_622, 2, 0xfff); - utp->stats.rx_uncorr += utopia_update(utp, - SUNI_REGO_RACPUHCS_622, 2, 0xfff); - utp->stats.rx_cells += utopia_update(utp, - SUNI_REGO_RACPCNT_622, 3, 0x1fffff); - utp->stats.tx_cells += utopia_update(utp, - SUNI_REGO_TACPCNT, 3, 0x1fffff); -} - -const struct utopia_chip utopia_chip_622 = { - UTP_TYPE_SUNI_622, - "Suni/622 (PMC-5355)", - 256, - suni_reset_622, - suni_set_sdh, - suni_set_unass, - suni_set_noscramb, - suni_update_carrier, - suni_set_loopback_622, - suni_intr_default, - suni_622_update_stats, -}; diff --git a/sys/dev/utopia/suni.h b/sys/dev/utopia/suni.h deleted file mode 100644 index fd1be7e13e39..000000000000 --- a/sys/dev/utopia/suni.h +++ /dev/null @@ -1,1515 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Register definitions for the following chips: - * PMC-Sierra PMC-5346 (S/UNI-LITE) - * PMC-Sierra PMC-5350 (S/UNI-ULTRA) - * PMC-Sierra PMC-5355 (S/UNI-622) - * - * All definitions ending with _ULTRA are for the ULTRA chip only, all - * definitions ending with _LITE are for the LITE chip only. Some registers - * are only in the ULTRA and the definitions are not suffixed. All other - * definitions are for all chips. - */ -#ifndef _DEV_UTOPIA_SUNI_H -#define _DEV_UTOPIA_SUNI_H - -/* lite, ultra, 622 */ -#define SUNI_REGN_MRESET "Master Reset and Identity/Load Meters" -#define SUNI_REGO_MRESET 0x00 -#define SUNI_REGM_MRESET_RESET 0x80 -#define SUNI_REGM_MRESET_TYPE 0x70 -#define SUNI_REGM_MRESET_TYPE_622 0x10 -#define SUNI_REGM_MRESET_TYPE_LITE 0x30 -#define SUNI_REGM_MRESET_TYPE_ULTRA 0x70 -#define SUNI_REGM_MRESET_TIP_ULTRA 0x08 -#define SUNI_REGM_MRESET_ID_ULTRA 0x07 -#define SUNI_REGM_MRESET_ID_LITE 0x0f -#define SUNI_REGM_MRESET_ID_622 0x0f -#define SUNI_REGX_MRESET_ULTRA "\020\10RESET\12\x70\12TYPE\4TIP\12\7\12ID" -#define SUNI_REGX_MRESET_LITE "\020\10RESET\12\x70\12TYPE\12\xf\12ID" -#define SUNI_REGX_MRESET_622 "\020\10RESET\12\x70\12TYPE\12\xf\12ID" - -/* lite, ultra */ -#define SUNI_REGN_MCONFIG "Master Configuration" -#define SUNI_REGO_MCONFIG 0x01 -#define SUNI_REGM_MCONFIG_AUTOFEBE 0x40 -#define SUNI_REGM_MCONFIG_AUTOLRDI 0x20 -#define SUNI_REGM_MCONFIG_AUTOPRDI 0x10 -#define SUNI_REGM_MCONFIG_TCAINV 0x08 -#define SUNI_REGM_MCONFIG_RCAINV 0x04 -#define SUNI_REGM_MCONFIG_RXDINV_LITE 0x02 -#define SUNI_REGM_MCONFIG_TFP_IN_ULTRA 0x01 -#define SUNI_REGM_MCONFIG_RESERVED 0x00 -#define SUNI_REGX_MCONFIG_LITE "\020\7AUTOFEBE\6AUTOLRDI\5AUTOPRDI\4TCAINV\3RCAINV\2RXDINV" -#define SUNI_REGX_MCONFIG_ULTRA "\020\7AUTOFEBE\6AUTOLRDI\5AUTOPRDI\4TCAINV\3RCAINV\1TFPI_IN" - -/* 622 */ -#define SUNI_REGM_MCONFIG_TPTBEN_622 0x80 -#define SUNI_REGM_MCONFIG_TSTBEN_622 0x40 -#define SUNI_REGM_MCONFIG_SDH_C1_622 0x20 -#define SUNI_REGM_MCONFIG_FIXPTR_622 0x10 -#define SUNI_REGM_MCONFIG_TMODE_622 0x0C -#define SUNI_REGM_MCONFIG_TMODE_STS1_BYTE 0x00 -#define SUNI_REGM_MCONFIG_TMODE_STS3c 0x04 -#define SUNI_REGM_MCONFIG_TMODE_STS1_BIT 0x08 -#define SUNI_REGM_MCONFIG_TMODE_STS12c 0x0C -#define SUNI_REGM_MCONFIG_RMODE_622 0x03 -#define SUNI_REGM_MCONFIG_RMODE_STS1_BYTE 0x00 -#define SUNI_REGM_MCONFIG_RMODE_STS3c 0x01 -#define SUNI_REGM_MCONFIG_RMODE_STS1_BIT 0x02 -#define SUNI_REGM_MCONFIG_RMODE_STS12c 0x03 -#define SUNI_REGX_MCONFIG_622 "\020\10TPTBEN\7TSTBEN\6SDH_C1\5FIXPTR\11\x0C\0x00XSTS1BYTE\11\0x0C\0x04XSTS3c\11\0x0C\0x08XSTS1BIT\11\0x0C\0x0CXSTS12c\11\0x03\0x00RSTS1BYTE\11\0x03\0x01RSTS3c\11\0x03\0x02RSTS1BIT\11\0x03\0x03RSTS12c" - -/* lite, ultra, 622 */ -#define SUNI_REGN_MISTATUS "Master Interrupt Status" -#define SUNI_REGO_MISTATUS 0x02 -#define SUNI_REGM_MISTATUS_CSUI_ULTRA 0x80 -#define SUNI_REGM_MISTATUS_TROOLI_LITE 0x80 -#define SUNI_REGM_MISTATUS_SUNII_622 0x80 -#define SUNI_REGM_MISTATUS_LCDI 0x40 -#define SUNI_REGM_MISTATUS_STBI_622 0x40 -#define SUNI_REGM_MISTATUS_CRUI_ULTRA 0x20 -#define SUNI_REGM_MISTATUS_RDOOLI_LITE 0x20 -#define SUNI_REGM_MISTATUS_RESERVED_622 0x20 -#define SUNI_REGM_MISTATUS_TACPI 0x10 -#define SUNI_REGM_MISTATUS_RACPI 0x08 -#define SUNI_REGM_MISTATUS_RPOPI 0x04 -#define SUNI_REGM_MISTATUS_RLOPI 0x02 -#define SUNI_REGM_MISTATUS_RSOPI 0x01 -#define SUNI_REGX_MISTATUS_LITE "\020\10TROOLI\7LCDI\6RDOOLI\5TACPI\4RACPI\3RPOPI\2RLOPI\1RSOPI" -#define SUNI_REGX_MISTATUS_ULTRA "\020\10CSUI\7LCDI\6CRUI\5TACPI\4RACPI\3RPOPI\2RLOPI\1RSOPI" -#define SUNI_REGX_MISTATUS_622 "\020\10S/UNII\7STBI\5TACPI\4RACPI\3RPOPI\2RLOPI\1RSOPI" - -/* ultra */ -#define SUNI_REGN_MMCTRL "Master Mode Control" -#define SUNI_REGO_MMCTRL 0x03 -#define SUNI_REGM_MMCTRL_51 0x02 -#define SUNI_REGM_MMCTRL_155 0x03 -#define SUNI_REGX_MMCTRL "\020\11\3\00251MBIT\11\3\003155MBIT" - -/* 622 */ -#define SUNI_REGN_PISO "PISO Interrupt" -#define SUNI_REGO_PISO 0x03 -#define SUNI_REGM_PISO_PAEE 0x02 -#define SUNI_REGM_PISO_PAEI 0x01 -#define SUNI_REGX_PISO "\020\2PAEE\1PAEI" - -/* ultra/lite */ -#define SUNI_REGN_MCLKM "Master Clock Monitor" -#define SUNI_REGO_MCLKM 0x04 -#define SUNI_REGM_MCLKM_RFCLKA 0x10 /* ultra */ -#define SUNI_REGM_MCLKM_TFCLKA 0x08 /* ultra */ -#define SUNI_REGM_MCLKM_RRCLKA 0x08 /* lite */ -#define SUNI_REGM_MCLKM_REFCLKA 0x04 /* ultra */ -#define SUNI_REGM_MCLKM_TRCLKA 0x04 /* lite */ -#define SUNI_REGM_MCLKM_RCLKA 0x02 -#define SUNI_REGM_MCLKM_TCLKA 0x01 -#define SUNI_REGX_MCLKM_LITE "\020\4RRCLKA\3TRCLKA\2RCLKA\1TCLKA" -#define SUNI_REGX_MCLKM_ULTRA "\020\5RFCLKA\4TFCLKA\3REFCLKA\2RCLKA\1TCLKA" - -/* 622 */ -#define SUNI_REGN_MCTRLM "Master Control/Monitor" -#define SUNI_REGO_MCTRLM 0x04 -#define SUNI_REGM_MCTRLM_TCAINV 0x80 -#define SUNI_REGM_MCTRLM_RCAINV 0x40 -#define SUNI_REGM_MCTRLM_LLE 0x20 -#define SUNI_REGM_MCTRLM_DLE 0x10 -#define SUNI_REGM_MCTRLM_LOOPT 0x08 -#define SUNI_REGM_MCTRLM_DPLE 0x04 -#define SUNI_REGM_MCTRLM_PICLKA 0x02 -#define SUNI_REGM_MCTRLM_TCLKA 0x01 -#define SUNI_REGX_MCTRLM "\020\10TCAINV\7RCAINV\6LLE\5DLE\4LOOPT\3DPLE\2PICLKA\1TCLKA" - -/* ultra/lite */ -#define SUNI_REGN_MCTRL "Master Control" -#define SUNI_REGO_MCTRL 0x05 -#define SUNI_REGM_MCTRL_LCDE 0x80 -#define SUNI_REGM_MCTRL_LCDV 0x40 -#define SUNI_REGM_MCTRL_FIXPTR 0x20 -#define SUNI_REGM_MCTRL_TPLE 0x10 /* ultra */ -#define SUNI_REGM_MCTRL_PDLE 0x08 /* ultra */ -#define SUNI_REGM_MCTRL_LLE 0x04 -#define SUNI_REGM_MCTRL_SDLE 0x02 /* ultra */ -#define SUNI_REGM_MCTRL_DLE 0x02 /* lite */ -#define SUNI_REGM_MCTRL_LOOPT 0x01 -#define SUNI_REGX_MCTRL_ULTRA "\020\10LCDE\7LCDV\6FIXPTR\5TPLE\4PDLE\3LLE\2SDLE\1LOOPT" -#define SUNI_REGX_MCTRL_LITE "\020\10LCDE\7LCDV\6FIXPTR\3LLE\2DLE\1LOOPT" - -/* 622 */ -#define SUNI_REGN_MALARM "Master Auto Alarm" -#define SUNI_REGO_MALARM 0x05 -#define SUNI_REGM_MALARM_AUTOFEBE 0x04 -#define SUNI_REGM_MALARM_AUTOLRDI 0x02 -#define SUNI_REGM_MALARM_AUTOPRDI 0x01 -#define SUNI_REGX_MALARM "\020\4AUTOFEBE\2AUTOLRDI\1AUTOPRDI" - -/* ultra/lite */ -#define SUNI_REGN_CLKSYN "Clock Synthesis Control and Status" -#define SUNI_REGO_CLKSYN 0x06 -#define SUNI_REGM_CLKSYN_TROOLI 0x20 /* ultra */ -#define SUNI_REGM_CLKSYN_TROOLV 0x08 -#define SUNI_REGM_CLKSYN_TROOLE 0x02 -#define SUNI_REGM_CLKSYN_TREFSEL 0x01 /* lite */ -#define SUNI_REGM_CLKSYN_RESERVED 0x00 -#define SUNI_REGX_CLKSYN_ULTRA "\020\6TROOLI\4TROOLV\2TROOLE" -#define SUNI_REGX_CLKSYN_LITE "\020\4TROOLV\2TROOLE\1TREFSEL" - -/* 622 */ -#define SUNI_REGN_POUT "Parallel Output Port" -#define SUNI_REGO_POUT 0x06 -#define SUNI_REGM_POUT_POP 0x3f -#define SUNI_REGX_POUT "\020\12\x3f\12POP" - -/* ultra/lite */ -#define SUNI_REGN_CLKREC "Clock Recovery Control and Status" -#define SUNI_REGO_CLKREC_LITE 0x07 -#define SUNI_REGO_CLKREC_ULTRA 0x08 -#define SUNI_REGM_CLKREC_RROOLI 0x40 /* ultra */ -#define SUNI_REGM_CLKREC_RDOOLI 0x20 /* ultra */ -#define SUNI_REGM_CLKREC_RROOLV 0x10 -#define SUNI_REGM_CLKREC_RDOOLV 0x08 -#define SUNI_REGM_CLKREC_RROOLE 0x04 /* ultra */ -#define SUNI_REGM_CLKREC_RDOOLE 0x02 -#define SUNI_REGM_CLKREC_RREFSEL 0x01 /* lite */ -#define SUNI_REGM_CLKREC_RESERVED 0x00 -#define SUNI_REGX_CLKREC_ULTRA "\020\7RROOLI\6RDOOLI\5RROOLV\4RDOOLV\3RROOLE\2RDOOLE" -#define SUNI_REGX_CLKREC_LITE "\020\5RROOLV\4RDOOLV\2RDOOLE\1RREFSEL" - -/* 622 */ -#define SUNI_REGN_PIN "Parallel Input Port" -#define SUNI_REGO_PIN 0x07 - -/* 622 */ -#define SUNI_REGN_PINV "Parallel Input Port Value" -#define SUNI_REGO_PINV 0x08 -#define SUNI_REGM_PINV_PIPV 0x0f -#define SUNI_REGX_PINV "\020\12\0x0f\12PIPIV" - -/* ultra */ -#define SUNI_REGN_CLKRECCFG "Clock Recovery Configuration" -#define SUNI_REGO_CLKRECCFG 0x09 -#define SUNI_REGM_CLKRECCFG_RESERVED 0x07 -#define SUNI_REGX_CLKRECCFG "\020" - -/* 622 */ -#define SUNI_REGN_PINE "Parallel Input Port Enable" -#define SUNI_REGO_PINE 0x09 - -/* ultra */ -#define SUNI_REGN_LTXCFG1 "Line Transmitter Configuration 1" -#define SUNI_REGO_LTXCFG1 0x0A -#define SUNI_REGM_LTXCFG1_VREFSEL 0x80 -#define SUNI_REGM_LTXCFG1_OEN 0x20 -#define SUNI_REGM_LTXCFG1_OTQ 0x10 -#define SUNI_REGM_LTXCFG1_RESERVED 0x0C -#define SUNI_REGX_LTXCFG1 "\020\10VREFSEL\6OEN\5OTQ" - -/* 622 */ -#define SUNI_REGN_XC1 "Transmit C1" -#define SUNI_REGO_XC1 0x0A - -/* ultra */ -#define SUNI_REGN_LTXCFG2 "Line Transmitter Configuration 2" -#define SUNI_REGO_LTXCFG2 0x0B -#define SUNI_REGM_LTXCFG2_RESERVED 0xFF -#define SUNI_REGX_LTXCFG2 "\020" - -/* 622 */ -#define SUNI_REGN_APSCS "APS Control/Status" -#define SUNI_REGO_APSCS 0x0B -#define SUNI_REGM_APSCS_PSBFE 0x80 -#define SUNI_REGM_APSCS_COAPSE 0x40 -#define SUNI_REGM_APSCS_Z1E 0x20 -#define SUNI_REGM_APSCS_Zi1 0x10 -#define SUNI_REGM_APSCS_PSBFI 0x08 -#define SUNI_REGM_APSCS_COAPSI 0x04 -#define SUNI_REGM_APSCS_RESERVED 0x02 -#define SUNI_REGM_APSCS_PSBFV 0x01 -#define SUNI_REGX_APSCS "\020\10PSBFE\7COAPSE\6Z1E\5Z1I\4PSBFI\3COAPSI\1PSBFV" - -/* ultra */ -#define SUNI_REGN_LRXCFG "Line Receiver Configuration" -#define SUNI_REGO_LRXCFG 0x0C -#define SUNI_REGM_LRXCFG_RESERVED 0x01 -#define SUNI_REGX_LRXCFG "\020" - -/* 622 */ -#define SUNI_REGN_RK1 "Receive K1" -#define SUNI_REGO_RK1 0x0C - -/* 622 */ -#define SUNI_REGN_RK2 "Receive K2" -#define SUNI_REGO_RK2 0x0D - -/* 622 */ -#define SUNI_REGN_RZ1 "Receive Z1" -#define SUNI_REGO_RZ1 0x0E - -/* 622 */ -#define SUNI_REGN_XZ1 "Transmit Z1" -#define SUNI_REGO_XZ1 0x0F - -/* lite, ultra, 622 */ -#define SUNI_REGN_RSOPCIE "RSOP Control/Interrupt Enable" -#define SUNI_REGO_RSOPCIE 0x10 -#define SUNI_REGO_RSOPCIE_BIPWORD_622 0x80 -#define SUNI_REGM_RSOPCIE_DDS 0x40 -#define SUNI_REGM_RSOPCIE_FOOF 0x20 -#define SUNI_REGM_RSOPCIE_RESV 0x10 -#define SUNI_REGM_RSOPCIE_ALGO2_622 0x10 -#define SUNI_REGM_RSOPCIE_BIPEE 0x08 -#define SUNI_REGM_RSOPCIE_LOSE 0x04 -#define SUNI_REGM_RSOPCIE_LOFE 0x02 -#define SUNI_REGM_RSOPCIE_OOFE 0x01 -#define SUNI_REGX_RSOPCIE "\020\7DDS\6FOOF\4BIPEE\3LOSE\2LOFE\1OOFE" -#define SUNI_REGX_RSOPCIE_622 "\020\10BIPWORD\7DDS\6FOOF\5ALGO2\4BIPEE\3LOSE\2LOFE\1OOFE" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RSOPSIS "RSOP Status/Interrupt Status" -#define SUNI_REGO_RSOPSIS 0x11 -#define SUNI_REGM_RSOPSIS_BIPEI 0x40 -#define SUNI_REGM_RSOPSIS_LOSI 0x20 -#define SUNI_REGM_RSOPSIS_LOFI 0x10 -#define SUNI_REGM_RSOPSIS_OOFI 0x08 -#define SUNI_REGM_RSOPSIS_LOSV 0x04 -#define SUNI_REGM_RSOPSIS_LOFV 0x02 -#define SUNI_REGM_RSOPSIS_OOFV 0x01 -#define SUNI_REGX_RSOPSIS "\020\7BIPEI\6LOSI\5LOFI\4OOFI\3LOSV\2LOFV\1OOFV" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RSOP_BIP8 "RSOP Section BIP-8" -#define SUNI_REGO_RSOP_BIP8 0x12 /* +0x13 */ - -/* lite, ultra, 622 */ -#define SUNI_REGN_TSOPCTRL "TSOP Control" -#define SUNI_REGO_TSOPCTRL 0x14 -#define SUNI_REGM_TSOPCTRL_DS 0x40 -#define SUNI_REGM_TSOPCTRL_LAIS 0x01 -#define SUNI_REGM_TSOPCTRL_RESERVED 0x00 -#define SUNI_REGX_TSOPCTRL "\020\7DS\1LAIS" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TSOPDIAG "TSOP Diagnostics" -#define SUNI_REGO_TSOPDIAG 0x15 -#define SUNI_REGM_TSOPDIAG_DLOS 0x04 -#define SUNI_REGM_TSOPDIAG_DBIP8 0x02 -#define SUNI_REGM_TSOPDIAG_DFP 0x01 -#define SUNI_REGX_TSOPDIAG "\020\3DLOS\2DBIP8\1DFP" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RLOPCTRL "RLOP Control/Status" -#define SUNI_REGO_RLOPCTRL 0x18 -#define SUNI_REGO_RLOPCTRL_BIPWORD 0x80 -#define SUNI_REGO_RLOPCTRL_ALLONES_622 0x40 -#define SUNI_REGO_RLOPCTRL_AISDET_622 0x20 -#define SUNI_REGO_RLOPCTRL_LRDIDET_622 0x10 -#define SUNI_REGO_RLOPCTRL_BIPWORDO_622 0x08 -#define SUNI_REGO_RLOPCTRL_LAISV 0x02 -#define SUNI_REGO_RLOPCTRL_RDIV 0x01 -#define SUNI_REGO_RLOPCTRL_RESERVED 0x00 -#define SUNI_REGX_RLOPCTRL "\020\10BIPWORD\2LAISV\1RDIV" -#define SUNI_REGX_RLOPCTRL_622 "\020\10BIPWORD\7ALLONES\6AISDET\5LRDIDET\4BIPWORDO\2LAISV\1RDIV" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RLOPINTR "RLOP Interrupt Enable/Interrupt Status" -#define SUNI_REGO_RLOPINTR 0x19 -#define SUNI_REGO_RLOPINTR_FEBEE 0x80 -#define SUNI_REGO_RLOPINTR_BIPEE 0x40 -#define SUNI_REGO_RLOPINTR_LAISE 0x20 -#define SUNI_REGO_RLOPINTR_RDIE 0x10 -#define SUNI_REGO_RLOPINTR_FEBEI 0x08 -#define SUNI_REGO_RLOPINTR_BIPEI 0x04 -#define SUNI_REGO_RLOPINTR_LAISI 0x02 -#define SUNI_REGO_RLOPINTR_RDII 0x01 -#define SUNI_REGX_RLOPINTR "\020\10FEBEE\7BIPEE\6LAISE\5DRIE\4FEBEI\3BIPEI\2LAISI\1RDII" - -/* lite, ultra */ -#define SUNI_REGN_RLOPBIP8_24 "RLOP Line BIP-8/24" -#define SUNI_REGO_RLOPBIP8_24 0x1A /* +1B,1C */ -#define SUNI_REGM_RLOPBIP8_24 0x0F - -/* 622 */ -#define SUNI_REGN_RLOPBIP8_24_96 "RLOP Line BIP-8/24/96" -#define SUNI_REGO_RLOPBIP8_24_96 0x1A /* +1B,1C */ -#define SUNI_REGM_RLOPBIP8_24_96 0x0F - -/* lite, ultra, 622 */ -#define SUNI_REGN_RLOPFEBE "RLOP Line FEBE" -#define SUNI_REGO_RLOPFEBE 0x1D /* +1E,1F */ -#define SUNI_REGM_RLOPFEBE 0x0F - -/* lite, ultra, 622 */ -#define SUNI_REGN_TLOPCTRL "TLOP Control" -#define SUNI_REGO_TLOPCTRL 0x20 -#define SUNI_REGM_TLOPCTRL_APSREG_622 0x20 -#define SUNI_REGM_TLOPCTRL_RDI 0x01 -#define SUNI_REGM_TLOPCTRL_RESERVED 0x00 -#define SUNI_REGX_TLOPCTRL "\020\1RDI" -#define SUNI_REGX_TLOPCTRL_622 "\020\6APSREG\1LRDI" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TLOPDIAG "TLOP Diagnostics" -#define SUNI_REGO_TLOPDIAG 0x21 -#define SUNI_REGM_TLOPDIAG_DBIP 0x01 -#define SUNI_REGX_TLOPDIAG "\020\1DBIP" - -/* 622 */ -#define SUNI_REGN_TLOP_XK1 "TLOP Transmit K1" -#define SUNI_REGO_TLOP_XK1 0x22 - -/* 622 */ -#define SUNI_REGN_TLOP_XK2 "TLOP Transmit K2" -#define SUNI_REGO_TLOP_XK2 0x23 - -/* 622 */ -#define SUNI_REGN_SSTBCTRL "SSTB Control" -#define SUNI_REGO_SSTBCTRL 0x28 -#define SUNI_REGM_SSTBCTRL_RRAMACC 0x40 -#define SUNI_REGM_SSTBCTRL_RTIUIE 0x20 -#define SUNI_REGM_SSTBCTRL_RTIMIE 0x10 -#define SUNI_REGM_SSTBCTRL_PER5 0x08 -#define SUNI_REGM_SSTBCTRL_TNULL 0x04 -#define SUNI_REGM_SSTBCTRL_NOSYNC 0x02 -#define SUNI_REGM_SSTBCTRL_LEN16 0x01 -#define SUNI_REGX_SSTBCTRL "\020\7RRAMACC\6RTIUIE\5RTIMIE\4PER5\3TNULL\2NOSYNC\1LEN16" - -/* 622 */ -#define SUNI_REGN_SSTBSTIS "SSTB Section Trace Identifier Status" -#define SUNI_REGO_SSTBSTIS 0x29 -#define SUNI_REGM_SSTBSTIS_BUSY 0x80 -#define SUNI_REGM_SSTBSTIS_RTIUI 0x08 -#define SUNI_REGM_SSTBSTIS_RTIUV 0x04 -#define SUNI_REGM_SSTBSTIS_RTIMI 0x02 -#define SUNI_REGM_SSTBSTIS_RTIMV 0x01 -#define SUNI_REGX_SSTBSTIS "\020\10BUSY\4RTIUI\3RTIUV\2RTIMI\1RTIMV" - -/* 622 */ -#define SUNI_REGN_SSTBIAR "SSTB Indirect Address Register" -#define SUNI_REGO_SSTBIAR 0x2A -#define SUNI_REGM_SSTBIAR_RWB 0x80 -#define SUNI_REGM_SSTBIAR_A 0x7F -#define SUNI_REGX_SSTBIAR "\020\10RWB\12\x7f\20" - -/* 622 */ -#define SUNI_REGN_SSTBIDR "SSTB Indirect Data Register" -#define SUNI_REGO_SSTBIDR 0x2B - -#if 0 /* see chip errata */ -/* 622 */ -#define SUNI_REGN_SSTBECSM "SSTB Expected Clock Synchronization Message" -#define SUNI_REGO_SSTBECSM 0x2C -#endif - -/* 622 */ -#define SUNI_REGN_SSTBCSMS "SSTB Clock Synchronisation Message Status" -#define SUNI_REGO_SSTBCSMS 0x2D -#define SUNI_REGM_SSTBCSMS_RCSMUIE 0x80 -#define SUNI_REGM_SSTBCSMS_RCSMMIE 0x40 -#define SUNI_REGM_SSTBCSMS_RCSMUI 0x08 -#define SUNI_REGM_SSTBCSMS_RCSMUV 0x04 -#define SUNI_REGM_SSTBCSMS_RCSMMI 0x02 -#define SUNI_REGM_SSTBCSMS_RCSMMV 0x01 -#define SUNI_REGX_SSTBCSMS "\020\10RCSMUIE\7RCSMMIE\4RCSMUI\3RCSMUV\2RCSMMI\1RCSMMV" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPCTRL "RPOP Status/Control" -#define SUNI_REGO_RPOPCTRL 0x30 -#define SUNI_REGM_RPOPCTRL_LOP 0x20 -#define SUNI_REGM_RPOPCTRL_PAIS 0x08 -#define SUNI_REGM_RPOPCTRL_PRDI 0x04 -#define SUNI_REGM_RPOPCTRL_NEWPTRI_622 0x02 -#define SUNI_REGM_RPOPCTRL_NEWPTRE_622 0x01 -#define SUNI_REGM_RPOPCTRL_RESERVED 0x00 -#define SUNI_REGX_RPOPCTRL "\020\6LOP\4PAIS\3PRDI" -#define SUNI_REGX_RPOPCTRL_622 "\020\6LOP\4PAIS\3PRDI\2NEWPTRI\1NEWPTRE" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPISTAT "RPOP Interrupt Status" -#define SUNI_REGO_RPOPISTAT 0x31 -#define SUNI_REGM_RPOPISTAT_PSLI 0x80 -#define SUNI_REGM_RPOPISTAT_LOPI 0x20 -#define SUNI_REGM_RPOPISTAT_PAISI 0x08 -#define SUNI_REGM_RPOPISTAT_PRDII 0x04 -#define SUNI_REGM_RPOPISTAT_BIPEI 0x02 -#define SUNI_REGM_RPOPISTAT_FEBEI 0x01 -#define SUNI_REGX_RPOPISTAT "\02010PSLI\6LOPI\4PAISI\3PRDII\2BIPEI\1FEBEI" - -/* 622 */ -#define SUNI_REGN_RPOPPIS "RPOP Pointer Interrupt Status" -#define SUNI_REGO_RPOPPIS 0x32 -#define SUNI_REGM_RPOPPIS_ILLJREQI 0x80 -#define SUNI_REGM_RPOPPIS_DISCOPAI 0x20 -#define SUNI_REGM_RPOPPIS_INVNDFI 0x10 -#define SUNI_REGM_RPOPPIS_ILLPTRI 0x08 -#define SUNI_REGM_RPOPPIS_NSEI 0x04 -#define SUNI_REGM_RPOPPIS_PSEI 0x02 -#define SUNI_REGM_RPOPPIS_NDFI 0x01 -#define SUNI_REGX_RPOPPIS "\020\10ILLJREQI\6DISCOPAI\5INVNDFI\4ILLPTRI\3NSEI\2PSEI\1NDFI" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPIEN "RPOP Interrupt Enable" -#define SUNI_REGO_RPOPIEN 0x33 -#define SUNI_REGM_RPOPIEN_PSLE 0x80 -#define SUNI_REGM_RPOPIEN_LOPE 0x20 -#define SUNI_REGM_RPOPIEN_PAISE 0x08 -#define SUNI_REGM_RPOPIEN_PRDIE 0x04 -#define SUNI_REGM_RPOPIEN_BIPEE 0x02 -#define SUNI_REGM_RPOPIEN_FEBEE 0x01 -#define SUNI_REGM_RPOPIEN_RESERVED 0x00 -#define SUNI_REGX_RPOPIEN "\02010PSLE\6LOPE\4PAISE\3PRDIE\2BIPEE\1FEBEE" - -/* 622 */ -#define SUNI_REGN_RPOPPIE "RPOP Pointer Interrupt Enable" -#define SUNI_REGO_RPOPPIE 0x34 -#define SUNI_REGM_RPOPPIE_ILLJREQE 0x80 -#define SUNI_REGM_RPOPPIE_DISCOPAE 0x20 -#define SUNI_REGM_RPOPPIE_INVNDFE 0x10 -#define SUNI_REGM_RPOPPIE_ILLPTRE 0x08 -#define SUNI_REGM_RPOPPIE_NSEE 0x04 -#define SUNI_REGM_RPOPPIE_PSEE 0x02 -#define SUNI_REGM_RPOPPIE_NDFE 0x01 -#define SUNI_REGX_RPOPPIE "\020\10ILLJREQE\6DISCOPAE\5INVNDFE\4ILLPTRE\3NSEE\2PSEE\1NDFE" - -/* 622 */ -#define SUNI_REGN_RPOPPTR "RPOP Pointer" -#define SUNI_REGO_RPOPPTR 0x35 /* +36 */ -#define SUNI_REGM_RPOPPTR_RDI10 0x20 -#define SUNI_REGM_RPOPPTR_S 0x0c -#define SUNI_REGS_RPOPPTR_S 2 -#define SUNI_REGM_RPOPPTR 0x03 -#define SUNI_REGS_RPOPPTR 0 -#define SUNI_REGX_RPOPPTR "\020\6RDI10\12\xc\20S" - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPPSL "RPOP Path Signal Label" -#define SUNI_REGO_RPOPPSL 0x37 - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPBIP8 "RPOP Path BIP-8" -#define SUNI_REGO_RPOPBIP8 0x38 /* +39 */ - -/* lite, ultra, 622 */ -#define SUNI_REGN_RPOPFEBE "RPOP Path FEBE" -#define SUNI_REGO_RPOPFEBE 0x3A /* +3B */ - -/* 622 */ -#define SUNI_REGN_RPOPRDI "RPOP RDI" -#define SUNI_REGO_RPOPRDI 0x3C -#define SUNI_REGM_RPOPRDI_BLKFEBE 0x10 -#define SUNI_REGM_RPOPRDI_ARDIE 0x02 -#define SUNI_REGM_RPOPRDI_ARDIV 0x01 -#define SUNI_REGM_RPOPRDI_RESERVED 0x00 -#define SUNI_REGX_RPOPRDI "\020\5BLKFEBE\2ARDIE\1ARDIV" - -/* lite, ultra */ -#define SUNI_REGN_RPOPBIP8CFG "RPOP Path BIP-8 Configuration" -#define SUNI_REGO_RPOPBIP8CFG 0x3D -#define SUNI_REGM_RPOPBIP8CFG_BLKBIP 0x20 -#define SUNI_REGM_RPOPBIP8CFG_RESERVED 0x00 -#define SUNI_REGX_RPOPBIP8CFG "\020\6BLKBIP" - -/* 622 */ -#define SUNI_REGN_RPOPRING "RPOP Ring Control" -#define SUNI_REGO_RPOPRING 0x3D -#define SUNI_REGM_RPOPRING_SOS 0x80 -#define SUNI_REGM_RPOPRING_ENSS 0x40 -#define SUNI_REGM_RPOPRING_BLKBIP 0x20 -#define SUNI_REGM_RPOPRING_DISFS 0x10 -#define SUNI_REGM_RPOPRING_BLKBIPO 0x08 -#define SUNI_REGM_RPOPRING_RESERVED 0x00 -#define SUNI_REGX_RPOPRING "\020\10SOS\7ENSS\6BLKBIP\5DISFS\4BLKBIPO" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TPOPCTRL "TPOP Control/Diagnostic" -#define SUNI_REGO_TPOPCTRL 0x40 -#define SUNI_REGM_TPOPCTRL_EXCFS 0x80 /* 622 */ -#define SUNI_REGM_TPOPCTRL_DB3 0x02 -#define SUNI_REGM_TPOPCTRL_PAIS 0x01 -#define SUNI_REGM_TPOPCTRL_RESERVED 0x00 -#define SUNI_REGX_TPOPCTRL "\020\2DB3\1PAIS" -#define SUNI_REGX_TPOPCTRL_622 "\020\4EXCFS\2DB3\1PAIS" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TPOPPTRC "TPOP Pointer Control" -#define SUNI_REGO_TPOPPTRC 0x41 -#define SUNI_REGM_TPOPPTRC_FTPTR 0x40 -#define SUNI_REGM_TPOPPTRC_SOS 0x20 -#define SUNI_REGM_TPOPPTRC_PLD 0x10 -#define SUNI_REGM_TPOPPTRC_NDF 0x08 -#define SUNI_REGM_TPOPPTRC_NSE 0x04 -#define SUNI_REGM_TPOPPTRC_PSE 0x02 -#define SUNI_REGM_TPOPPTRC_RESERVED 0x00 -#define SUNI_REGX_TPOPPTRC "\020\7FTPTR\6SOS\5PLD\4NDF\3NSE\2PSE" - -/* 622 */ -#define SUNI_REGN_TPOPCP "TPOP Current Pointer" -#define SUNI_REGO_TPOPCP 0x43 /* +44 */ -#define SUNI_REGM_TPOPCP 0x03 -#define SUNI_REGS_TPOPCP 0 -#define SUNI_REGX_TPOPCP "\020" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TPOPAPTR "TPOP Arbitrary Pointer" -#define SUNI_REGO_TPOPAPTR 0x45 /* +46 */ -#define SUNI_REGM_TPOPAPTR_NDF 0xF0 -#define SUNI_REGS_TPOPAPTR_NDF 4 -#define SUNI_REGM_TPOPAPTR_S 0x0C -#define SUNI_REGS_TPOPAPTR_S 2 -#define SUNI_REGM_TPOPAPTR 0x03 -#define SUNI_REGS_TPOPAPTR 0 -#define SUNI_REGX_TPOPAPTR "\020\12\x0C\12S\12\xF0\12NDF" - -#define SUNI_REGM_SONET 0 -#define SUNI_REGM_SDH 2 - -/* 622 */ -#define SUNI_REGN_TPOPPT "TPOP Path Trace" -#define SUNI_REGO_TPOPPT 0x47 - -/* lite, ultra, 622 */ -#define SUNI_REGN_TPOPPSL "TPOP Path Signal Label" -#define SUNI_REGO_TPOPPSL 0x48 - -/* lite, ultra, 622 */ -#define SUNI_REGN_TPOPSTATUS "TPOP Path Status" -#define SUNI_REGO_TPOPSTATUS 0x49 -#define SUNI_REGM_TPOPSTATUS_FEBE 0xF0 -#define SUNI_REGS_TPOPSTATUS_FEBE 4 -#define SUNI_REGM_TPOPSTATUS_PRDI 0x08 -#define SUNI_REGM_TPOPSTATUS_G1 0x07 -#define SUNI_REGS_TPOPSTATUS_G1 0 -#define SUNI_REGX_TPOPSTATUS "\020\12\xF0\12FEBE\4PRDI\12\x7\12G" - -/* 622 */ -#define SUNI_REGN_TPOPPUC "TPOP Path User Channel" -#define SUNI_REGO_TPOPPUC 0x4A - -/* 622 */ -#define SUNI_REGN_TPOPPG1 "TPOP Path Grow #1" -#define SUNI_REGO_TPOPPG1 0x4B - -/* 622 */ -#define SUNI_REGN_TPOPPG2 "TPOP Path Grow #2" -#define SUNI_REGO_TPOPPG2 0x4C - -/* 622 */ -#define SUNI_REGN_TPOPPG3 "TPOP Path Grow #3" -#define SUNI_REGO_TPOPPG3 0x4D - -/* lite, ultra, 622 */ -#define SUNI_REGN_RACPCTRL "RACP Control/Status" -#define SUNI_REGO_RACPCTRL 0x50 -#define SUNI_REGM_RACPCTRL_OOCDV 0x80 -#define SUNI_REGM_RACPCTRL_FSEN 0x80 -#define SUNI_REGM_RACPCTRL_RXPTYP 0x40 -#define SUNI_REGM_RACPCTRL_PASS 0x20 -#define SUNI_REGM_RACPCTRL_DISCOR 0x10 -#define SUNI_REGM_RACPCTRL_HCSPASS 0x08 -#define SUNI_REGM_RACPCTRL_HCSADD 0x04 -#define SUNI_REGM_RACPCTRL_DDSCR 0x02 -#define SUNI_REGM_RACPCTRL_FIFORST 0x01 -#define SUNI_REGX_RACPCTRL "\020\10OOCDV\7RXPTYP\6PASS\5DISCO\4HCSPASS\3HCSADD\2DDSCR\1FIFORST" -#define SUNI_REGX_RACPCTRL_622 "\020\10FSEN\7RXPTYP\6PASS\5DISCO\4HCSPASS\3HCSADD\2DDSCR\1FIFORST" - -/* lite, ultra */ -#define SUNI_REGN_RACPINTR "RACP Interrupt Enable/Status" -#define SUNI_REGO_RACPINTR 0x51 -#define SUNI_REGM_RACPINTR_OOCDE 0x80 -#define SUNI_REGM_RACPINTR_HCSE 0x40 -#define SUNI_REGM_RACPINTR_FIFOE 0x20 -#define SUNI_REGM_RACPINTR_OOCDI 0x10 -#define SUNI_REGM_RACPINTR_CHCSI 0x08 -#define SUNI_REGM_RACPINTR_UHCSI 0x04 -#define SUNI_REGM_RACPINTR_FOVRI 0x02 -#define SUNI_REGX_RACPINTR "\020\10OOCDE\7HCSE\6FIFOE\5OOCDI\4CHCSI\3UHCSI\2FOVRI" - -/* 622 */ -#define SUNI_REGN_RACPIS "RACP Interrupt Status" -#define SUNI_REGO_RACPIS 0x51 -#define SUNI_REGM_RACPIS_OCDV 0x80 -#define SUNI_REGM_RACPIS_LCDV 0x40 -#define SUNI_REGM_RACPIS_OCDI 0x20 -#define SUNI_REGM_RACPIS_LCDI 0x10 -#define SUNI_REGM_RACPIS_CHCSI 0x08 -#define SUNI_REGM_RACPIS_UHCSI 0x04 -#define SUNI_REGM_RACPIS_FOVRI 0x02 -#define SUNI_REGM_RACPIS_FUDRI 0x01 -#define SUNI_REGX_RACPIS "\020\10OCDV\7LCDV\6OCDI\5LCDI\4CHCSI\3UHCSI\2FOVRI\1FUDRI" - -/* lite, ultra */ -#define SUNI_REGN_RACPPATTERN "RACP Match Header Pattern" -#define SUNI_REGO_RACPPATTERN 0x52 -#define SUNI_REGM_RACPPATTERN_GFC 0xF0 -#define SUNI_REGS_RACPPATTERN_GFC 4 -#define SUNI_REGM_RACPPATTERN_PTI 0x0E -#define SUNI_REGS_RACPPATTERN_PTI 1 -#define SUNI_REGM_RACPPATTERN_CLP 0x01 -#define SUNI_REGS_RACPPATTERN_CLP 0 -#define SUNI_REGX_RACPPATTERN "\020\12\xF0\12GFC\12\x0E\12PTI\1CLP" - -/* 622 */ -#define SUNI_REGN_RACPIEC "RACP Interrupt Enable/Control" -#define SUNI_REGO_RACPIEC 0x52 -#define SUNI_REGM_RACPIEC_OCDE 0x80 -#define SUNI_REGM_RACPIEC_LCDE 0x40 -#define SUNI_REGM_RACPIEC_HCSE 0x20 -#define SUNI_REGM_RACPIEC_FIFOE 0x10 -#define SUNI_REGM_RACPIEC_LCDDROP 0x08 -#define SUNI_REGM_RACPIEC_RCALEVEL0 0x04 -#define SUNI_REGM_RACPIEC_HCSFTR 0x03 -#define SUNI_REGX_RACPIEC "\020\10OCDE\7LCDE\6HCSE\5FIFOE\4LCDDROP\3RCALEVEL0\12\0x3\12HCSFTR" - -/* lite, ultra */ -#define SUNI_REGN_RACPMASK "RACP Match Header Mask" -#define SUNI_REGO_RACPMASK 0x53 -#define SUNI_REGM_RACPMASK_MGFC 0xF0 -#define SUNI_REGS_RACPMASK_MGFC 4 -#define SUNI_REGM_RACPMASK_MPTI 0x0E -#define SUNI_REGS_RACPMASK_MPTI 1 -#define SUNI_REGM_RACPMASK_MCLP 0x01 -#define SUNI_REGS_RACPMASK_MCLP 0 -#define SUNI_REGX_RACPMASK "\020\12\xF0\12MGFC\12\x0E\12MPTI\1MCLP" - -/* 622 */ -#define SUNI_REGO_RACPPATTERN_622 0x53 - -/* lite, ultra */ -#define SUNI_REGN_RACPCHCS "RACP Correctable HCS Error Count" -#define SUNI_REGO_RACPCHCS 0x54 - -/* 622 */ -#define SUNI_REGO_RACPMASK_622 0x54 - -/* lite, ultra */ -#define SUNI_REGN_RACPUHCS "RACP Uncorrectable HCS Error Count" -#define SUNI_REGO_RACPUHCS 0x55 - -/* 622 */ -#define SUNI_REGO_RACPCHCS_622 0x55 /* +56 */ -#define SUNI_REGM_RACPCHCS_622 0x0f - -/* lite, ultra */ -#define SUNI_REGN_RACPCNT "RACP Receive Cell Counter" -#define SUNI_REGO_RACPCNT 0x56 /* +57,58 */ -#define SUNI_REGM_RACPCNT 0x07 - -/* 622 */ -#define SUNI_REGO_RACPUHCS_622 0x57 /* +58 */ -#define SUNI_REGM_RACPUHCS_622 0x0f - -/* 622 */ -#define SUNI_REGO_RACPCNT_622 0x59 /* +5A,5B */ -#define SUNI_REGM_RACPCNT_622 0x1F - -/* lite, ultra */ -#define SUNI_REGN_RACPCFG "RACP Configuration" -#define SUNI_REGO_RACPCFG 0x59 -#define SUNI_REGM_RACPCFG_RGFCE 0xF0 -#define SUNI_REGS_RACPCFG_RGFCE 4 -#define SUNI_REGM_RACPCFG_FSEN 0x08 -#define SUNI_REGM_RACPCFG_LEVEL0 0x04 -#define SUNI_REGM_RACPCFG_HCSFTR 0x03 -#define SUNI_REGS_RACPCFG_HCSFTR 0 -#define SUNI_REGX_RACPCFG "\020\12\xF0\20RGFCE\4FSEN\3RCALEVEL0\12\x03\12HCSFTR" - -/* 622 */ -#define SUNI_REGN_RACPGFC "RACP GFC Control/Misc. Control" -#define SUNI_REGO_RACPGFC 0x5C -#define SUNI_REGM_RACPGFC_CDDIS 0x80 -#define SUNI_REGM_RACPGFC_RXBYTEPRTY 0x40 -#define SUNI_REGM_RACPGFC_RGFCE 0x0f -#define SUNI_REGX_RACPGFC "\020\10CDDIS\7RXBYTEPRTY\12\xf\20" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TACPCTRL "TACP Control/Status" -#define SUNI_REGO_TACPCTRL 0x60 -#define SUNI_REGM_TACPCTRL_FIFOE 0x80 -#define SUNI_REGM_TACPCTRL_TSOCI 0x40 -#define SUNI_REGM_TACPCTRL_FOVRI 0x20 -#define SUNI_REGM_TACPCTRL_DHCS 0x10 -#define SUNI_REGM_TACPCTRL_HCSB 0x08 /* ultra, 622 */ -#define SUNI_REGM_TACPCTRL_HCSADD 0x04 -#define SUNI_REGM_TACPCTRL_DSCR 0x02 -#define SUNI_REGM_TACPCTRL_FIFORST 0x01 -#define SUNI_REGX_TACPCTRL_LITE "\020\10FIFOE\7TSOCI\6FOVRI\5DHCS\3HCSADD\2DSCR\1FIFORST" -#define SUNI_REGX_TACPCTRL_ULTRA "\020\10FIFOE\7TSOCI\6FOVRI\5DHCS\4HCSB\3HCSADD\2DSCR\1FIFORST" -#define SUNI_REGX_TACPCTRL_622 "\020\10FIFOE\7TSOCI\6FOVRI\5DHCS\4HCSB\3HCSADD\2DSCR\1FIFORST" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TACPIDLEH "TACP Idle/Unassigned Cell Header Pattern" -#define SUNI_REGO_TACPIDLEH 0x61 -#define SUNI_REGM_TACPIDLEH_GFC 0xF0 -#define SUNI_REGS_TACPIDLEH_GFC 4 -#define SUNI_REGM_TACPIDLEH_PTI 0x0E -#define SUNI_REGS_TACPIDLEH_PTI 1 -#define SUNI_REGM_TACPIDLEH_CLP 0x01 -#define SUNI_REGS_TACPIDLEH_CLP 0 -#define SUNI_REGX_TACPIDLEH "\020\12\xF0\20GFC\12\x0E\20PTI\12\x01\20CLP" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TACPIDLEP "TACP Idle/Unassigned Cell Payload Octet Pattern" -#define SUNI_REGO_TACPIDLEP 0x62 - -/* lite, ultra, 622 */ -#define SUNI_REGN_TACPFIFOC "TACP FIFO Control" -#define SUNI_REGO_TACPFIFOC 0x63 -#define SUNI_REGM_TACPFIFOC_TXPTYP 0x80 -#define SUNI_REGM_TACPFIFOC_TXPRTYE 0x40 -#define SUNI_REGM_TACPFIFOC_TXPRTYI 0x10 -#define SUNI_REGM_TACPFIFOC_TXPRTYI_622 0x30 -#define SUNI_REGS_TACPFIFOC_TXPRTYI_622 4 -#define SUNI_REGM_TACPFIFOC_FIFODP 0x0C -#define SUNI_REGS_TACPFIFOC_FIFODP 2 -#define SUNI_REGM_TACPFIFOC_TCALEVEL0 0x02 -#define SUNI_REGM_TACPFIFOC_HCSCTLEB 0x01 -#define SUNI_REGM_TACPFIFOC_RESERVED 0x00 -#define SUNI_REGX_TACPFIFOC "\020\10TXPTYP\7TXPRTYE\5TXPRTYI\12\x0C\20FIFODP\2TCALEVEL0" -#define SUNI_REGX_TACPFIFOC_622 "\020\10TXPTYP\7TXPRTYE\12\x30\12TXPRTYI\12\x0C\20FIFODP\2TCALEVEL0\1HCSCTLEB" - -/* lite, ultra, 622 */ -#define SUNI_REGN_TACPCNT "TACP Transmit Cell Counter" -#define SUNI_REGO_TACPCNT 0x64 /* +65,66 */ -#define SUNI_REGM_TACPCNT 0x07 -#define SUNI_REGM_TACPCNT_622 0x1F - -/* lite, ultra */ -#define SUNI_REGN_TACPCFG "TACP Configuration" -#define SUNI_REGO_TACPCFG 0x67 -#define SUNI_REGM_TACPCFG_TGFCE 0xF0 -#define SUNI_REGS_TACPCFG_TGFCE 4 -#define SUNI_REGM_TACPCFG_FSEN 0x08 -#define SUNI_REGM_TACPCFG_H4INSB 0x04 -#define SUNI_REGM_TACPCFG_FIXBYTE 0x03 -#define SUNI_REGS_TACPCFG_FIXBYTE 0 -#define SUNI_REGX_TACPCFG "\020\12\xF0\20TGFCE\4FSEN\3H4INSB\12\x03\20FIXBYTE" - -/* 622 */ -#define SUNI_REGN_TACPGFC "TACP Fixed Stuff/GFC" -#define SUNI_REGO_TACPGFC 0x67 -#define SUNI_REGO_TACPGFC_TGFCE 0xf0 -#define SUNI_REGS_TACPGFC_TGFCE 4 -#define SUNI_REGO_TACPGFC_FSEN 0x08 -#define SUNI_REGO_TACPGFC_TXBYTEPRTY 0x04 -#define SUNI_REGO_TACPGFC_FIXBYTE 0x03 -#define SUNI_REGS_TACPGFC_FIXBYTE 0 -#define SUNI_REGX_TACPGFC "\020\12\xf0\20TGFCE\4FSEN\3TXBYTEPRTY\12\x3\20FIXBYTE" - -/* 622 */ -#define SUNI_REGN_SPTBCTRL "SPTB Control" -#define SUNI_REGO_SPTBCTRL 0x68 -#define SUNI_REGO_SPTBCTRL_RRAMACC 0x40 -#define SUNI_REGO_SPTBCTRL_RTIUIE 0x20 -#define SUNI_REGO_SPTBCTRL_RTIMIE 0x10 -#define SUNI_REGO_SPTBCTRL_PER5 0x08 -#define SUNI_REGO_SPTBCTRL_TNULL 0x04 -#define SUNI_REGO_SPTBCTRL_NOSYNC 0x02 -#define SUNI_REGO_SPTBCTRL_LEN16 0x01 -#define SUNI_REGX_SPTBCTRL "\020\7RRAMACC\6RTIUIE\5RTIMIE\4PER5\3TNULL\2NOSYNC\1LEN16" - -/* 622 */ -#define SUNI_REGN_SPTBPTIS "SPTB Path Trace Identifier Status" -#define SUNI_REGO_SPTBPTIS 0x69 -#define SUNI_REGM_SPTBPTIS_BUSY 0x80 -#define SUNI_REGM_SPTBPTIS_RTIUI 0x08 -#define SUNI_REGM_SPTBPTIS_RTIUV 0x04 -#define SUNI_REGM_SPTBPTIS_RTIMI 0x02 -#define SUNI_REGM_SPTBPTIS_RTIMV 0x01 -#define SUNI_REGX_SPTBPTIS "\020\10BUSY\4RTIUI\3RTIUV\2RTIMI\1RTIMV" - -/* 622 */ -#define SUNI_REGN_SPTBIAR "SPTB Indirect Address Register" -#define SUNI_REGO_SPTBIAR 0x6A -#define SUNI_REGM_SPTBIAR_RWB 0x80 -#define SUNI_REGM_SPTBIAR_A 0x7f -#define SUNI_REGX_SPTBIAR "\020\10RWB\12\x7f\20A" - -/* 622 */ -#define SUNI_REGN_SPTBIDR "SPTB Indirect Data Register" -#define SUNI_REGO_SPTBIDR 0x6B - -/* 622 */ -#define SUNI_REGN_SPTBEPSL "SPTB Expected Path Signal Label" -#define SUNI_REGO_SPTBEPSL 0x6C - -/* 622 */ -#define SUNI_REGN_SPTBPSLS "SPTB Path Signal Label Status" -#define SUNI_REGO_SPTBPSLS 0x6D -#define SUNI_REGM_SPTBPSLS_RPSLUIE 0x80 -#define SUNI_REGM_SPTBPSLS_RPSLMIE 0x40 -#define SUNI_REGM_SPTBPSLS_RPSLUI 0x08 -#define SUNI_REGM_SPTBPSLS_RPSLUV 0x04 -#define SUNI_REGM_SPTBPSLS_RPSLMI 0x02 -#define SUNI_REGM_SPTBPSLS_RPSLMV 0x01 -#define SUNI_REGX_SPTBPSLS "\020\10RPSLUIE\7RPSLMIE\4RPSLUI\3RPSLUV\2RPSLMI\1RPSLMV" - -/* ultra */ -#define SUNI_REGN_POPCCTRL "POPC Control" -#define SUNI_REGO_POPCCTRL 0x68 -#define SUNI_REGM_POPCCTRL_PDAT 0xC0 -#define SUNI_REGS_POPCCTRL_PDAT 6 -#define SUNI_REGM_POPCCTRL_TOGGLE 0x30 -#define SUNI_REGS_POPCCTRL_TOGGLE 4 -#define SUNI_REGM_POPCCTRL_TRAFFIC 0x02 -#define SUNI_REGM_POPCCTRL_ALARM 0x01 -#define SUNI_REGX_POPCCTRL "\020\12\xC0\20PDAT\12\x30\20TOGGLE\2TRAFFIC\1ALARM" - -/* ultra */ -#define SUNI_REGN_POPCSTROBE0 "POPC Strobe Rate 0" -#define SUNI_REGO_POPCSTROBE0 0x69 - -/* ultra */ -#define SUNI_REGN_POPCSTROBE1 "POPC Strobe Rate 1" -#define SUNI_REGO_POPCSTROBE1 0x6A - -/* 622 */ -#define SUNI_REGN_BERMCTRL "BERM Control" -#define SUNI_REGO_BERMCTRL 0x70 -#define SUNI_REGM_BERMCTRL_BERTEN 0x80 -#define SUNI_REGM_BERMCTRL_BERIE 0x01 -#define SUNI_REGX_BERMCTRL "\020\10BERTEN\1BERIE" - -/* 622 */ -#define SUNI_REGN_BERMINT "BERM Interrupt" -#define SUNI_REGO_BERMINT 0x71 -#define SUNI_REGM_BERMINT_TST 0xf0 -#define SUNI_REGS_BERMINT_TST 4 -#define SUNI_REGM_BERMINT_BERI 0x01 -#define SUNI_REGX_BERMINT "\020\12\xf0\20BERM_TST\1BERI" - -/* 622 */ -#define SUNI_REGN_BERMLAP "BERM Line BIP Accumulation Period" -#define SUNI_REGO_BERMLAP 0x72 /* +73 */ - -/* 622 */ -#define SUNI_REGN_BERMLT "BERM Line BIP Threshold" -#define SUNI_REGO_BERMLT 0x74 /* +75 */ - -/* lite, ultra, 622 */ -#define SUNI_REGN_MTEST "Master Test" -#define SUNI_REGO_MTEST 0x80 -#define SUNI_REGM_MTEST_DS27_53_622 0x80 -#define SUNI_REGM_MTEST_BYPASS_ULTRA 0x40 -#define SUNI_REGM_MTEST_PMCATST_ULTRA 0x20 -#define SUNI_REGM_MTEST_PMCTST 0x10 -#define SUNI_REGM_MTEST_DBCTRL 0x08 -#define SUNI_REGM_MTEST_IOTST 0x04 -#define SUNI_REGM_MTEST_HIZDATA 0x02 -#define SUNI_REGM_MTEST_HIZIO 0x01 -#define SUNI_REGX_MTEST_LITE "\020\5PMCTST\4DBCTRL\3IOTST\2HIZDATA\1HIZIO" -#define SUNI_REGX_MTEST_ULTRA "\020\7BYPASS\6PMCATST\5PMCTST\4DBCTRL\3IOTST\2HIZDATA\1HIZIO" -#define SUNI_REGX_MTEST_622 "\020\10DS27_53\5PMCTST\4DBCTRL\3IOTST\2HIZDATA\1HIZIO" - -/* - * Printing support - */ -#define SUNI_PRINT_LITE \ - { /* 00 */ \ - UTP_REGT_BITS, SUNI_REGO_MRESET, \ - SUNI_REGN_MRESET, SUNI_REGX_MRESET_LITE }, \ - { /* 01 */ \ - UTP_REGT_BITS, SUNI_REGO_MCONFIG, \ - SUNI_REGN_MCONFIG, SUNI_REGX_MCONFIG_LITE }, \ - { /* 02 */ \ - UTP_REGT_BITS, SUNI_REGO_MISTATUS, \ - SUNI_REGN_MISTATUS, SUNI_REGX_MISTATUS_LITE }, \ - /* 03 unused */ \ - { /* 04 */ \ - UTP_REGT_BITS, SUNI_REGO_MCLKM, \ - SUNI_REGN_MCLKM, SUNI_REGX_MCLKM_LITE }, \ - { /* 05 */ \ - UTP_REGT_BITS, SUNI_REGO_MCTRL, \ - SUNI_REGN_MCTRL, SUNI_REGX_MCTRL_LITE }, \ - { /* 06 */ \ - UTP_REGT_BITS, SUNI_REGO_CLKSYN, \ - SUNI_REGN_CLKSYN, SUNI_REGX_CLKSYN_LITE }, \ - { /* 07 */ \ - UTP_REGT_BITS, SUNI_REGO_CLKREC_LITE, \ - SUNI_REGN_CLKREC, SUNI_REGX_CLKREC_LITE }, \ - /* 08-0F unused */ \ - { /* 10 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPCIE, \ - SUNI_REGN_RSOPCIE, SUNI_REGX_RSOPCIE }, \ - { /* 11 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPSIS, \ - SUNI_REGN_RSOPSIS, SUNI_REGX_RSOPSIS }, \ - { /* 12, 13 */ \ - UTP_REGT_INT16, SUNI_REGO_RSOP_BIP8, \ - SUNI_REGN_RSOP_BIP8, NULL }, \ - { /* 14 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPCTRL, \ - SUNI_REGN_TSOPCTRL, SUNI_REGX_TSOPCTRL }, \ - { /* 15 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPDIAG, \ - SUNI_REGN_TSOPDIAG, SUNI_REGX_TSOPDIAG }, \ - /* 16-17 unused */ \ - { /* 18 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPCTRL, \ - SUNI_REGN_RLOPCTRL, SUNI_REGX_RLOPCTRL }, \ - { /* 19 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPINTR, \ - SUNI_REGN_RLOPINTR, SUNI_REGX_RLOPINTR }, \ - { /* 1A, 1B, 1C */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPBIP8_24, \ - SUNI_REGN_RLOPBIP8_24, NULL }, \ - { /* 1D, 1E, 1F */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPFEBE, \ - SUNI_REGN_RLOPFEBE, NULL }, \ - { /* 20 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPCTRL, \ - SUNI_REGN_TLOPCTRL, SUNI_REGX_TLOPCTRL }, \ - { /* 21 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPDIAG, \ - SUNI_REGN_TLOPDIAG, SUNI_REGX_TLOPDIAG }, \ - /* 22-2F unused */ \ - { /* 30 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPCTRL, \ - SUNI_REGN_RPOPCTRL, SUNI_REGX_RPOPCTRL }, \ - { /* 31 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPISTAT, \ - SUNI_REGN_RPOPISTAT, SUNI_REGX_RPOPISTAT }, \ - /* 32 unused */ \ - { /* 33 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPIEN, \ - SUNI_REGN_RPOPIEN, SUNI_REGX_RPOPIEN }, \ - /* 34-36 unused */ \ - { /* 37 */ \ - UTP_REGT_INT8, SUNI_REGO_RPOPPSL, \ - SUNI_REGN_RPOPPSL, NULL }, \ - { /* 38, 39 */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPBIP8, \ - SUNI_REGN_RPOPBIP8, NULL }, \ - { /* 3A, 3B */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPFEBE, \ - SUNI_REGN_RPOPFEBE, NULL }, \ - /* 3C unused */ \ - { /* 3D */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPBIP8CFG, \ - SUNI_REGN_RPOPBIP8CFG, SUNI_REGX_RPOPBIP8CFG }, \ - /* 3E-3F unused */ \ - { /* 40 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPCTRL, \ - SUNI_REGN_TPOPCTRL, SUNI_REGX_TPOPCTRL }, \ - { /* 41 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPPTRC, \ - SUNI_REGN_TPOPPTRC, SUNI_REGX_TPOPPTRC }, \ - /* 42-44 unused */ \ - { /* 45, 46 */ \ - UTP_REGT_INT10BITS, SUNI_REGO_TPOPAPTR, \ - SUNI_REGN_TPOPAPTR, SUNI_REGX_TPOPAPTR }, \ - /* 47 unused */ \ - { /* 48 */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPSL, \ - SUNI_REGN_TPOPPSL, NULL }, \ - { /* 49 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPSTATUS, \ - SUNI_REGN_TPOPSTATUS, SUNI_REGX_TPOPSTATUS }, \ - /* 4A-4F unused */ \ - { /* 50 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPCTRL, \ - SUNI_REGN_RACPCTRL, SUNI_REGX_RACPCTRL }, \ - { /* 51 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPINTR, \ - SUNI_REGN_RACPINTR, SUNI_REGX_RACPINTR }, \ - { /* 52 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPPATTERN, \ - SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN }, \ - { /* 53 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPMASK, \ - SUNI_REGN_RACPMASK, SUNI_REGX_RACPMASK }, \ - { /* 54 */ \ - UTP_REGT_INT8, SUNI_REGO_RACPCHCS, \ - SUNI_REGN_RACPCHCS, NULL }, \ - { /* 55 */ \ - UTP_REGT_INT8, SUNI_REGO_RACPUHCS, \ - SUNI_REGN_RACPUHCS, NULL }, \ - { /* 56, 57, 58 */ \ - UTP_REGT_INT19, SUNI_REGO_RACPCNT, \ - SUNI_REGN_RACPCNT, NULL }, \ - { /* 59 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPCFG, \ - SUNI_REGN_RACPCFG, SUNI_REGX_RACPCFG }, \ - /* 5A-5F unused */ \ - { /* 60 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPCTRL, \ - SUNI_REGN_TACPCTRL, SUNI_REGX_TACPCTRL_LITE }, \ - { /* 61 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPIDLEH, \ - SUNI_REGN_TACPIDLEH, SUNI_REGX_TACPIDLEH }, \ - { /* 62 */ \ - UTP_REGT_INT8, SUNI_REGO_TACPIDLEP, \ - SUNI_REGN_TACPIDLEP, NULL }, \ - { /* 63 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPFIFOC, \ - SUNI_REGN_TACPFIFOC, SUNI_REGX_TACPFIFOC }, \ - { /* 64, 65, 66 */ \ - UTP_REGT_INT19, SUNI_REGO_TACPCNT, \ - SUNI_REGN_TACPCNT, NULL }, \ - { /* 67 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPGFC, \ - SUNI_REGN_TACPGFC, SUNI_REGX_TACPGFC }, \ - /* 68-7f unused */ \ - { /* 80 */ \ - UTP_REGT_BITS, SUNI_REGO_MTEST, \ - SUNI_REGN_MTEST, SUNI_REGX_MTEST_LITE } - -#define SUNI_PRINT_ULTRA \ - { /* 00 */ \ - UTP_REGT_BITS, SUNI_REGO_MRESET, \ - SUNI_REGN_MRESET, SUNI_REGX_MRESET_ULTRA }, \ - { /* 01 */ \ - UTP_REGT_BITS, SUNI_REGO_MCONFIG, \ - SUNI_REGN_MCONFIG, SUNI_REGX_MCONFIG_ULTRA }, \ - { /* 02 */ \ - UTP_REGT_BITS, SUNI_REGO_MISTATUS, \ - SUNI_REGN_MISTATUS, SUNI_REGX_MISTATUS_ULTRA }, \ - { /* 03 */ \ - UTP_REGT_BITS, SUNI_REGO_MMCTRL, \ - SUNI_REGN_MMCTRL, SUNI_REGX_MMCTRL }, \ - { /* 04 */ \ - UTP_REGT_BITS, SUNI_REGO_MCLKM, \ - SUNI_REGN_MCLKM, SUNI_REGX_MCLKM_ULTRA }, \ - { /* 05 */ \ - UTP_REGT_BITS, SUNI_REGO_MCTRL, \ - SUNI_REGN_MCTRL, SUNI_REGX_MCTRL_ULTRA }, \ - { /* 06 */ \ - UTP_REGT_BITS, SUNI_REGO_CLKSYN, \ - SUNI_REGN_CLKSYN, SUNI_REGX_CLKSYN_ULTRA }, \ - /* 07 unused */ \ - { /* 08 */ \ - UTP_REGT_BITS, SUNI_REGO_CLKREC_ULTRA, \ - SUNI_REGN_CLKREC, SUNI_REGX_CLKREC_ULTRA }, \ - { /* 09 */ \ - UTP_REGT_BITS, SUNI_REGO_CLKRECCFG, \ - SUNI_REGN_CLKRECCFG, SUNI_REGX_CLKRECCFG }, \ - { /* 0A */ \ - UTP_REGT_BITS, SUNI_REGO_LTXCFG1, \ - SUNI_REGN_LTXCFG1, SUNI_REGX_LTXCFG1 }, \ - { /* 0B */ \ - UTP_REGT_BITS, SUNI_REGO_LTXCFG2, \ - SUNI_REGN_LTXCFG2, SUNI_REGX_LTXCFG2 }, \ - { /* 0C */ \ - UTP_REGT_BITS, SUNI_REGO_LRXCFG, \ - SUNI_REGN_LRXCFG, SUNI_REGX_LRXCFG }, \ - /* 0D-0F unused */ \ - { /* 10 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPCIE, \ - SUNI_REGN_RSOPCIE, SUNI_REGX_RSOPCIE }, \ - { /* 11 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPSIS, \ - SUNI_REGN_RSOPSIS, SUNI_REGX_RSOPSIS }, \ - { /* 12, 13 */ \ - UTP_REGT_INT16, SUNI_REGO_RSOP_BIP8, \ - SUNI_REGN_RSOP_BIP8, NULL }, \ - { /* 14 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPCTRL, \ - SUNI_REGN_TSOPCTRL, SUNI_REGX_TSOPCTRL }, \ - { /* 15 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPDIAG, \ - SUNI_REGN_TSOPDIAG, SUNI_REGX_TSOPDIAG }, \ - /* 16-17 unused */ \ - { /* 18 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPCTRL, \ - SUNI_REGN_RLOPCTRL, SUNI_REGX_RLOPCTRL }, \ - { /* 19 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPINTR, \ - SUNI_REGN_RLOPINTR, SUNI_REGX_RLOPINTR }, \ - { /* 1A, 1B, 1C */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPBIP8_24, \ - SUNI_REGN_RLOPBIP8_24, NULL }, \ - { /* 1D, 1E, 1F */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPFEBE, \ - SUNI_REGN_RLOPFEBE, NULL }, \ - { /* 20 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPCTRL, \ - SUNI_REGN_TLOPCTRL, SUNI_REGX_TLOPCTRL }, \ - { /* 21 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPDIAG, \ - SUNI_REGN_TLOPDIAG, SUNI_REGX_TLOPDIAG }, \ - /* 22-2F unused */ \ - { /* 30 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPCTRL, \ - SUNI_REGN_RPOPCTRL, SUNI_REGX_RPOPCTRL }, \ - { /* 31 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPISTAT, \ - SUNI_REGN_RPOPISTAT, SUNI_REGX_RPOPISTAT }, \ - /* 32 unused */ \ - { /* 33 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPIEN, \ - SUNI_REGN_RPOPIEN, SUNI_REGX_RPOPIEN }, \ - /* 34-36 unused */ \ - { /* 37 */ \ - UTP_REGT_INT8, SUNI_REGO_RPOPPSL, \ - SUNI_REGN_RPOPPSL, NULL }, \ - { /* 38, 39 */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPBIP8, \ - SUNI_REGN_RPOPBIP8, NULL }, \ - { /* 3A, 3B */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPFEBE, \ - SUNI_REGN_RPOPFEBE, NULL }, \ - /* 3C unused */ \ - { /* 3D */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPBIP8CFG, \ - SUNI_REGN_RPOPBIP8CFG, SUNI_REGX_RPOPBIP8CFG }, \ - /* 3E-3F unused */ \ - { /* 40 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPCTRL, \ - SUNI_REGN_TPOPCTRL, SUNI_REGX_TPOPCTRL }, \ - { /* 41 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPPTRC, \ - SUNI_REGN_TPOPPTRC, SUNI_REGX_TPOPPTRC }, \ - /* 42-44 unused */ \ - { /* 45, 46 */ \ - UTP_REGT_INT10BITS, SUNI_REGO_TPOPAPTR, \ - SUNI_REGN_TPOPAPTR, SUNI_REGX_TPOPAPTR }, \ - /* 47 unused */ \ - { /* 48 */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPSL, \ - SUNI_REGN_TPOPPSL, NULL }, \ - { /* 49 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPSTATUS, \ - SUNI_REGN_TPOPSTATUS, SUNI_REGX_TPOPSTATUS }, \ - /* 4A-4F unused */ \ - { /* 50 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPCTRL, \ - SUNI_REGN_RACPCTRL, SUNI_REGX_RACPCTRL }, \ - { /* 51 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPINTR, \ - SUNI_REGN_RACPINTR, SUNI_REGX_RACPINTR }, \ - { /* 52 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPPATTERN, \ - SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN }, \ - { /* 53 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPMASK, \ - SUNI_REGN_RACPMASK, SUNI_REGX_RACPMASK }, \ - { /* 54 */ \ - UTP_REGT_INT8, SUNI_REGO_RACPCHCS, \ - SUNI_REGN_RACPCHCS, NULL }, \ - { /* 55 */ \ - UTP_REGT_INT8, SUNI_REGO_RACPUHCS, \ - SUNI_REGN_RACPUHCS, NULL }, \ - { /* 56, 57, 58 */ \ - UTP_REGT_INT19, SUNI_REGO_RACPCNT, \ - SUNI_REGN_RACPCNT, NULL }, \ - { /* 59 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPCFG, \ - SUNI_REGN_RACPCFG, SUNI_REGX_RACPCFG }, \ - /* 5A-5F unused */ \ - { /* 60 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPCTRL, \ - SUNI_REGN_TACPCTRL, SUNI_REGX_TACPCTRL_ULTRA }, \ - { /* 61 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPIDLEH, \ - SUNI_REGN_TACPIDLEH, SUNI_REGX_TACPIDLEH }, \ - { /* 62 */ \ - UTP_REGT_INT8, SUNI_REGO_TACPIDLEP, \ - SUNI_REGN_TACPIDLEP, NULL }, \ - { /* 63 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPFIFOC, \ - SUNI_REGN_TACPFIFOC, SUNI_REGX_TACPFIFOC }, \ - { /* 64, 65, 66 */ \ - UTP_REGT_INT19, SUNI_REGO_TACPCNT, \ - SUNI_REGN_TACPCNT, NULL }, \ - { /* 67 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPGFC, \ - SUNI_REGN_TACPGFC, SUNI_REGX_TACPGFC }, \ - { /* 68 */ \ - UTP_REGT_BITS, SUNI_REGO_POPCCTRL, \ - SUNI_REGN_POPCCTRL, SUNI_REGX_POPCCTRL }, \ - { /* 69 */ \ - UTP_REGT_INT8, SUNI_REGO_POPCSTROBE0, \ - SUNI_REGN_POPCSTROBE0, NULL }, \ - { /* 6A */ \ - UTP_REGT_INT8, SUNI_REGO_POPCSTROBE1, \ - SUNI_REGN_POPCSTROBE1, NULL }, \ - /* 6B-7f unused */ \ - { /* 80 */ \ - UTP_REGT_BITS, SUNI_REGO_MTEST, \ - SUNI_REGN_MTEST, SUNI_REGX_MTEST_ULTRA } - -#define SUNI_PRINT_622 \ - { /* 00 */ \ - UTP_REGT_BITS, SUNI_REGO_MRESET, \ - SUNI_REGN_MRESET, SUNI_REGX_MRESET_622 }, \ - { /* 01 */ \ - UTP_REGT_BITS, SUNI_REGO_MCONFIG, \ - SUNI_REGN_MCONFIG, SUNI_REGX_MCONFIG_622 }, \ - { /* 02 */ \ - UTP_REGT_BITS, SUNI_REGO_MISTATUS, \ - SUNI_REGN_MISTATUS, SUNI_REGX_MISTATUS_622 }, \ - { /* 03 */ \ - UTP_REGT_BITS, SUNI_REGO_PISO, \ - SUNI_REGN_PISO, SUNI_REGX_PISO }, \ - { /* 04 */ \ - UTP_REGT_BITS, SUNI_REGO_MCTRLM, \ - SUNI_REGN_MCTRLM, SUNI_REGX_MCTRLM }, \ - { /* 05 */ \ - UTP_REGT_BITS, SUNI_REGO_MALARM, \ - SUNI_REGN_MALARM, SUNI_REGX_MALARM }, \ - { /* 06 */ \ - UTP_REGT_BITS, SUNI_REGO_POUT, \ - SUNI_REGN_POUT, SUNI_REGX_POUT }, \ - { /* 07 */ \ - UTP_REGT_INT8, SUNI_REGO_PIN, \ - SUNI_REGN_PIN, NULL }, \ - { /* 08 */ \ - UTP_REGT_BITS, SUNI_REGO_PINV, \ - SUNI_REGN_PINV, SUNI_REGX_PINV }, \ - { /* 09 */ \ - UTP_REGT_INT8, SUNI_REGO_PINE, \ - SUNI_REGN_PINE, NULL }, \ - { /* 0A */ \ - UTP_REGT_INT8, SUNI_REGO_XC1, \ - SUNI_REGN_XC1, NULL }, \ - { /* 0B */ \ - UTP_REGT_BITS, SUNI_REGO_APSCS, \ - SUNI_REGN_APSCS, SUNI_REGX_APSCS }, \ - { /* 0C */ \ - UTP_REGT_INT8, SUNI_REGO_RK1, \ - SUNI_REGN_RK1, NULL }, \ - { /* 0D */ \ - UTP_REGT_INT8, SUNI_REGO_RK2, \ - SUNI_REGN_RK2, NULL }, \ - { /* 0E */ \ - UTP_REGT_INT8, SUNI_REGO_RZ1, \ - SUNI_REGN_RZ1, NULL }, \ - { /* 0F */ \ - UTP_REGT_INT8, SUNI_REGO_XZ1, \ - SUNI_REGN_XZ1, NULL }, \ - { /* 10 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPCIE, \ - SUNI_REGN_RSOPCIE, SUNI_REGX_RSOPCIE_622 }, \ - { /* 11 */ \ - UTP_REGT_BITS, SUNI_REGO_RSOPSIS, \ - SUNI_REGN_RSOPSIS, SUNI_REGX_RSOPSIS }, \ - { /* 12, 13 */ \ - UTP_REGT_INT16, SUNI_REGO_RSOP_BIP8, \ - SUNI_REGN_RSOP_BIP8, NULL }, \ - { /* 14 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPCTRL, \ - SUNI_REGN_TSOPCTRL, SUNI_REGX_TSOPCTRL }, \ - { /* 15 */ \ - UTP_REGT_BITS, SUNI_REGO_TSOPDIAG, \ - SUNI_REGN_TSOPDIAG, SUNI_REGX_TSOPDIAG }, \ - /* 16-17 unused */ \ - { /* 18 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPCTRL, \ - SUNI_REGN_RLOPCTRL, SUNI_REGX_RLOPCTRL_622 }, \ - { /* 19 */ \ - UTP_REGT_BITS, SUNI_REGO_RLOPINTR, \ - SUNI_REGN_RLOPINTR, SUNI_REGX_RLOPINTR }, \ - { /* 1A, 1B, 1C */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPBIP8_24_96, \ - SUNI_REGN_RLOPBIP8_24_96, NULL }, \ - { /* 1D, 1E, 1F */ \ - UTP_REGT_INT20, SUNI_REGO_RLOPFEBE, \ - SUNI_REGN_RLOPFEBE, NULL }, \ - { /* 20 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPCTRL, \ - SUNI_REGN_TLOPCTRL, SUNI_REGX_TLOPCTRL_622 }, \ - { /* 21 */ \ - UTP_REGT_BITS, SUNI_REGO_TLOPDIAG, \ - SUNI_REGN_TLOPDIAG, SUNI_REGX_TLOPDIAG }, \ - { /* 22 */ \ - UTP_REGT_INT8, SUNI_REGO_TLOP_XK1, \ - SUNI_REGN_TLOP_XK1, NULL }, \ - { /* 23 */ \ - UTP_REGT_INT8, SUNI_REGO_TLOP_XK2, \ - SUNI_REGN_TLOP_XK2, NULL }, \ - /* 24-27 unused */ \ - { /* 28 */ \ - UTP_REGT_BITS, SUNI_REGO_SSTBCTRL, \ - SUNI_REGN_SSTBCTRL, SUNI_REGX_SSTBCTRL }, \ - { /* 29 */ \ - UTP_REGT_BITS, SUNI_REGO_SSTBSTIS, \ - SUNI_REGN_SSTBSTIS, SUNI_REGX_SSTBSTIS }, \ - { /* 2A */ \ - UTP_REGT_BITS, SUNI_REGO_SSTBIAR, \ - SUNI_REGN_SSTBIAR, SUNI_REGX_SSTBIAR }, \ - { /* 2B */ \ - UTP_REGT_INT8, SUNI_REGO_SSTBIDR, \ - SUNI_REGN_SSTBIDR, NULL }, \ - /* 2C unused (see chip errata) */ \ - { /* 2D */ \ - UTP_REGT_BITS, SUNI_REGO_SSTBCSMS, \ - SUNI_REGN_SSTBCSMS, SUNI_REGX_SSTBCSMS }, \ - /* 2E-2F unused */ \ - { /* 30 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPCTRL, \ - SUNI_REGN_RPOPCTRL, SUNI_REGX_RPOPCTRL_622 }, \ - { /* 31 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPISTAT, \ - SUNI_REGN_RPOPISTAT, SUNI_REGX_RPOPISTAT }, \ - { /* 32 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPPIS, \ - SUNI_REGN_RPOPPIS, SUNI_REGX_RPOPPIS }, \ - { /* 33 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPIEN, \ - SUNI_REGN_RPOPIEN, SUNI_REGX_RPOPIEN }, \ - { /* 34 */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPPIE, \ - SUNI_REGN_RPOPPIE, SUNI_REGX_RPOPPIE }, \ - { /* 35, 36 */ \ - UTP_REGT_INT10BITS, SUNI_REGO_RPOPPTR, \ - SUNI_REGN_RPOPPTR, SUNI_REGX_RPOPPTR }, \ - { /* 37 */ \ - UTP_REGT_INT8, SUNI_REGO_RPOPPSL, \ - SUNI_REGN_RPOPPSL, NULL }, \ - { /* 38, 39 */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPBIP8, \ - SUNI_REGN_RPOPBIP8, NULL }, \ - { /* 3A, 3B */ \ - UTP_REGT_INT16, SUNI_REGO_RPOPFEBE, \ - SUNI_REGN_RPOPFEBE, NULL }, \ - { /* 3C */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPRDI, \ - SUNI_REGN_RPOPRDI, SUNI_REGX_RPOPRDI }, \ - { /* 3D */ \ - UTP_REGT_BITS, SUNI_REGO_RPOPRING, \ - SUNI_REGN_RPOPRING, SUNI_REGX_RPOPRING }, \ - /* 3E-3F unused */ \ - { /* 40 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPCTRL, \ - SUNI_REGN_TPOPCTRL, SUNI_REGX_TPOPCTRL_622 }, \ - { /* 41 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPPTRC, \ - SUNI_REGN_TPOPPTRC, SUNI_REGX_TPOPPTRC }, \ - /* 42 unused */ \ - { /* 43, 44 */ \ - UTP_REGT_INT10BITS, SUNI_REGO_TPOPCP, \ - SUNI_REGN_TPOPCP, SUNI_REGX_TPOPCP }, \ - { /* 45, 46 */ \ - UTP_REGT_INT10BITS, SUNI_REGO_TPOPAPTR, \ - SUNI_REGN_TPOPAPTR, SUNI_REGX_TPOPAPTR }, \ - { /* 47 */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPT, \ - SUNI_REGN_TPOPPT, NULL }, \ - { /* 48 */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPSL, \ - SUNI_REGN_TPOPPSL, NULL }, \ - { /* 49 */ \ - UTP_REGT_BITS, SUNI_REGO_TPOPSTATUS, \ - SUNI_REGN_TPOPSTATUS, SUNI_REGX_TPOPSTATUS }, \ - { /* 4A */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPUC, \ - SUNI_REGN_TPOPPUC, NULL }, \ - { /* 4B */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPG1, \ - SUNI_REGN_TPOPPG1, NULL }, \ - { /* 4C */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPG2, \ - SUNI_REGN_TPOPPG2, NULL }, \ - { /* 4D */ \ - UTP_REGT_INT8, SUNI_REGO_TPOPPG3, \ - SUNI_REGN_TPOPPG3, NULL }, \ - /* 4E-4F unused */ \ - { /* 50 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPCTRL, \ - SUNI_REGN_RACPCTRL, SUNI_REGX_RACPCTRL_622 }, \ - { /* 51 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPIS, \ - SUNI_REGN_RACPIS, SUNI_REGX_RACPIS }, \ - { /* 52 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPIEC, \ - SUNI_REGN_RACPIEC, SUNI_REGX_RACPIEC }, \ - { /* 53 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPPATTERN_622, \ - SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN }, \ - { /* 54 */ \ - UTP_REGT_BITS, SUNI_REGO_RACPMASK_622, \ - SUNI_REGN_RACPMASK, SUNI_REGX_RACPMASK }, \ - { /* 55, 56 */ \ - UTP_REGT_INT12, SUNI_REGO_RACPCHCS_622, \ - SUNI_REGN_RACPCHCS, NULL }, \ - { /* 57, 58 */ \ - UTP_REGT_INT12, SUNI_REGO_RACPUHCS_622, \ - SUNI_REGN_RACPUHCS, NULL }, \ - { /* 59, 5A, 5B */ \ - UTP_REGT_INT21, SUNI_REGO_RACPCNT_622, \ - SUNI_REGN_RACPCNT, NULL }, \ - { /* 5C */ \ - UTP_REGT_BITS, SUNI_REGO_RACPGFC, \ - SUNI_REGN_RACPGFC, SUNI_REGX_RACPGFC }, \ - /* 5D-5F unused */ \ - { /* 60 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPCTRL, \ - SUNI_REGN_TACPCTRL, SUNI_REGX_TACPCTRL_622 }, \ - { /* 61 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPIDLEH, \ - SUNI_REGN_TACPIDLEH, SUNI_REGX_TACPIDLEH }, \ - { /* 62 */ \ - UTP_REGT_INT8, SUNI_REGO_TACPIDLEP, \ - SUNI_REGN_TACPIDLEP, NULL }, \ - { /* 63 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPFIFOC, \ - SUNI_REGN_TACPFIFOC, SUNI_REGX_TACPFIFOC_622 }, \ - { /* 64, 65, 66 */ \ - UTP_REGT_INT21, SUNI_REGO_TACPCNT, \ - SUNI_REGN_TACPCNT, NULL }, \ - { /* 67 */ \ - UTP_REGT_BITS, SUNI_REGO_TACPGFC, \ - SUNI_REGN_TACPGFC, SUNI_REGX_TACPGFC }, \ - { /* 68 */ \ - UTP_REGT_BITS, SUNI_REGO_SPTBCTRL, \ - SUNI_REGN_SPTBCTRL, SUNI_REGX_SPTBCTRL }, \ - { /* 69 */ \ - UTP_REGT_BITS, SUNI_REGO_SPTBPTIS, \ - SUNI_REGN_SPTBPTIS, SUNI_REGX_SPTBPTIS }, \ - { /* 6A */ \ - UTP_REGT_BITS, SUNI_REGO_SPTBIAR, \ - SUNI_REGN_SPTBIAR, SUNI_REGX_SPTBIAR }, \ - { /* 6B */ \ - UTP_REGT_INT8, SUNI_REGO_SPTBIDR, \ - SUNI_REGN_SPTBIDR, NULL }, \ - { /* 6C */ \ - UTP_REGT_INT8, SUNI_REGO_SPTBEPSL, \ - SUNI_REGN_SPTBEPSL, NULL }, \ - { /* 6D */ \ - UTP_REGT_BITS, SUNI_REGO_SPTBPSLS, \ - SUNI_REGN_SPTBPSLS, SUNI_REGX_SPTBPSLS }, \ - /* 6E-6F unused */ \ - { /* 70 */ \ - UTP_REGT_BITS, SUNI_REGO_BERMCTRL, \ - SUNI_REGN_BERMCTRL, SUNI_REGX_BERMCTRL }, \ - { /* 71 */ \ - UTP_REGT_BITS, SUNI_REGO_BERMINT, \ - SUNI_REGN_BERMINT, SUNI_REGX_BERMINT }, \ - { /* 72, 73 */ \ - UTP_REGT_INT16, SUNI_REGO_BERMLAP, \ - SUNI_REGN_BERMLAP, NULL }, \ - { /* 74, 75 */ \ - UTP_REGT_INT16, SUNI_REGO_BERMLT, \ - SUNI_REGN_BERMLT, NULL }, \ - /* 76-7f unused */ \ - { /* 80 */ \ - UTP_REGT_BITS, SUNI_REGO_MTEST, \ - SUNI_REGN_MTEST, SUNI_REGX_MTEST_622 } - -#endif /* _DEV_UTOPIA_SUNI_H */ diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c deleted file mode 100644 index a4e7331fffc0..000000000000 --- a/sys/dev/utopia/utopia.c +++ /dev/null @@ -1,675 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -/* known chips */ -extern const struct utopia_chip utopia_chip_idt77155; -extern const struct utopia_chip utopia_chip_idt77105; -extern const struct utopia_chip utopia_chip_lite; -extern const struct utopia_chip utopia_chip_ultra; -extern const struct utopia_chip utopia_chip_622; - -/* - * Global list of all registered interfaces - */ -static struct mtx utopia_list_mtx; -static LIST_HEAD(, utopia) utopia_list = LIST_HEAD_INITIALIZER(utopia_list); - -#define UTP_RLOCK_LIST() mtx_lock(&utopia_list_mtx) -#define UTP_RUNLOCK_LIST() mtx_unlock(&utopia_list_mtx) -#define UTP_WLOCK_LIST() mtx_lock(&utopia_list_mtx) -#define UTP_WUNLOCK_LIST() mtx_unlock(&utopia_list_mtx) - -#define UTP_LOCK(UTP) mtx_lock((UTP)->lock) -#define UTP_UNLOCK(UTP) mtx_unlock((UTP)->lock) -#define UTP_LOCK_ASSERT(UTP) mtx_assert((UTP)->lock, MA_OWNED) - -static struct proc *utopia_kproc; - -static void utopia_dump(struct utopia *) __unused; - -/* - * Read a multi-register value. - */ -uint32_t -utopia_update(struct utopia *utp, u_int reg, u_int nreg, uint32_t mask) -{ - int err; - u_int n; - uint8_t regs[4]; - uint32_t val; - - n = nreg; - if ((err = UTP_READREGS(utp, reg, regs, &n)) != 0) { -#ifdef DIAGNOSTIC - printf("%s: register read error %s(%u,%u): %d\n", __func__, - utp->chip->name, reg, nreg, err); -#endif - return (0); - } - if (n < nreg) { -#ifdef DIAGNOSTIC - printf("%s: got only %u regs %s(%u,%u): %d\n", __func__, n, - utp->chip->name, reg, nreg, err); -#endif - return (0); - } - val = 0; - for (n = nreg; n > 0; n--) { - val <<= 8; - val |= regs[n - 1]; - } - return (val & mask); -} - -/* - * Debugging - dump all registers. - */ -static void -utopia_dump(struct utopia *utp) -{ - uint8_t regs[256]; - u_int n = 256, i; - int err; - - if ((err = UTP_READREGS(utp, 0, regs, &n)) != 0) { - printf("UTOPIA reg read error %d\n", err); - return; - } - for (i = 0; i < n; i++) { - if (i % 16 == 0) - printf("%02x:", i); - if (i % 16 == 8) - printf(" "); - printf(" %02x", regs[i]); - if (i % 16 == 15) - printf("\n"); - } - if (i % 16 != 0) - printf("\n"); -} - -/* - * Update the carrier status - */ -void -utopia_check_carrier(struct utopia *utp, u_int carr_ok) -{ - int old; - - old = utp->carrier; - if (carr_ok) { - /* carrier */ - utp->carrier = UTP_CARR_OK; - if (old != UTP_CARR_OK) { - if_printf(utp->ifatm->ifp, "carrier detected\n"); - ATMEV_SEND_IFSTATE_CHANGED(utp->ifatm, 1); - } - } else { - /* no carrier */ - utp->carrier = UTP_CARR_LOST; - if (old == UTP_CARR_OK) { - if_printf(utp->ifatm->ifp, "carrier lost\n"); - ATMEV_SEND_IFSTATE_CHANGED(utp->ifatm, 0); - } - } -} - -static int -unknown_inval(struct utopia *utp, int what __unused) -{ - - return (EINVAL); -} - -static int -unknown_reset(struct utopia *utp __unused) -{ - return (EIO); -} - -static int -unknown_update_carrier(struct utopia *utp) -{ - utp->carrier = UTP_CARR_UNKNOWN; - return (0); -} - -static int -unknown_set_loopback(struct utopia *utp __unused, u_int mode __unused) -{ - return (EINVAL); -} - -static void -unknown_intr(struct utopia *utp __unused) -{ -} - -static void -unknown_update_stats(struct utopia *utp __unused) -{ -} - -static const struct utopia_chip utopia_chip_unknown = { - UTP_TYPE_UNKNOWN, - "unknown", - 0, - unknown_reset, - unknown_inval, - unknown_inval, - unknown_inval, - unknown_update_carrier, - unknown_set_loopback, - unknown_intr, - unknown_update_stats, -}; - -/* - * Callbacks for the ifmedia infrastructure. - */ -static int -utopia_media_change(struct ifnet *ifp) -{ - struct ifatm *ifatm = IFP2IFATM(ifp); - struct utopia *utp = ifatm->phy; - int error = 0; - - UTP_LOCK(utp); - if (utp->chip->type != UTP_TYPE_UNKNOWN && utp->state & UTP_ST_ACTIVE) { - if (utp->media->ifm_media & IFM_ATM_SDH) { - if (!(utp->state & UTP_ST_SDH)) - error = utopia_set_sdh(utp, 1); - } else { - if (utp->state & UTP_ST_SDH) - error = utopia_set_sdh(utp, 0); - } - if (utp->media->ifm_media & IFM_ATM_UNASSIGNED) { - if (!(utp->state & UTP_ST_UNASS)) - error = utopia_set_unass(utp, 1); - } else { - if (utp->state & UTP_ST_UNASS) - error = utopia_set_unass(utp, 0); - } - if (utp->media->ifm_media & IFM_ATM_NOSCRAMB) { - if (!(utp->state & UTP_ST_NOSCRAMB)) - error = utopia_set_noscramb(utp, 1); - } else { - if (utp->state & UTP_ST_NOSCRAMB) - error = utopia_set_noscramb(utp, 0); - } - } else - error = EIO; - UTP_UNLOCK(utp); - return (error); -} - -/* - * Look at the carrier status. - */ -static void -utopia_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - struct utopia *utp = IFP2IFATM(ifp)->phy; - - UTP_LOCK(utp); - if (utp->chip->type != UTP_TYPE_UNKNOWN && utp->state & UTP_ST_ACTIVE) { - ifmr->ifm_active = IFM_ATM | utp->ifatm->mib.media; - - switch (utp->carrier) { - - case UTP_CARR_OK: - ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE; - break; - - case UTP_CARR_LOST: - ifmr->ifm_status = IFM_AVALID; - break; - - default: - ifmr->ifm_status = 0; - break; - } - if (utp->state & UTP_ST_SDH) { - ifmr->ifm_active |= IFM_ATM_SDH; - ifmr->ifm_current |= IFM_ATM_SDH; - } - if (utp->state & UTP_ST_UNASS) { - ifmr->ifm_active |= IFM_ATM_UNASSIGNED; - ifmr->ifm_current |= IFM_ATM_UNASSIGNED; - } - if (utp->state & UTP_ST_NOSCRAMB) { - ifmr->ifm_active |= IFM_ATM_NOSCRAMB; - ifmr->ifm_current |= IFM_ATM_NOSCRAMB; - } - } else { - ifmr->ifm_active = 0; - ifmr->ifm_status = 0; - } - UTP_UNLOCK(utp); -} - -/* - * Initialize media from the mib - */ -void -utopia_init_media(struct utopia *utp) -{ - - ifmedia_removeall(utp->media); - ifmedia_add(utp->media, IFM_ATM | utp->ifatm->mib.media, 0, NULL); - ifmedia_set(utp->media, IFM_ATM | utp->ifatm->mib.media); -} - -/* - * Reset all media - */ -void -utopia_reset_media(struct utopia *utp) -{ - - ifmedia_removeall(utp->media); -} - -/* - * This is called by the driver as soon as the SUNI registers are accessible. - * This may be either in the attach routine or the init routine of the driver. - */ -int -utopia_start(struct utopia *utp) -{ - uint8_t reg; - int err; - u_int n = 1; - - /* - * Try to find out what chip we have - */ - if ((err = UTP_READREGS(utp, SUNI_REGO_MRESET, ®, &n)) != 0) - return (err); - - switch (reg & SUNI_REGM_MRESET_TYPE) { - - case SUNI_REGM_MRESET_TYPE_622: - utp->chip = &utopia_chip_622; - break; - - case SUNI_REGM_MRESET_TYPE_LITE: - /* this may be either a SUNI LITE or a IDT77155 * - * Read register 0x70. The SUNI doesn't have it */ - n = 1; - if ((err = UTP_READREGS(utp, IDTPHY_REGO_RBER, ®, &n)) != 0) - return (err); - if ((reg & ~IDTPHY_REGM_RBER_RESV) == - (IDTPHY_REGM_RBER_FAIL | IDTPHY_REGM_RBER_WARN)) - utp->chip = &utopia_chip_idt77155; - else - utp->chip = &utopia_chip_lite; - break; - - case SUNI_REGM_MRESET_TYPE_ULTRA: - utp->chip = &utopia_chip_ultra; - break; - - default: - if (reg == (IDTPHY_REGM_MCR_DRIC | IDTPHY_REGM_MCR_EI)) - utp->chip = &utopia_chip_idt77105; - else { - if_printf(utp->ifatm->ifp, - "unknown ATM-PHY chip %#x\n", reg); - utp->chip = &utopia_chip_unknown; - } - break; - } - utp->state |= UTP_ST_ACTIVE; - return (0); -} - -/* - * Stop the chip - */ -void -utopia_stop(struct utopia *utp) -{ - utp->state &= ~UTP_ST_ACTIVE; -} - -/* - * Handle the sysctls - */ -static int -utopia_sysctl_regs(SYSCTL_HANDLER_ARGS) -{ - struct utopia *utp = (struct utopia *)arg1; - int error; - u_int n; - uint8_t *val; - uint8_t new[3]; - - if ((n = utp->chip->nregs) == 0) - return (EIO); - val = malloc(sizeof(uint8_t) * n, M_TEMP, M_WAITOK); - - UTP_LOCK(utp); - error = UTP_READREGS(utp, 0, val, &n); - UTP_UNLOCK(utp); - - if (error) { - free(val, M_TEMP); - return (error); - } - - error = SYSCTL_OUT(req, val, sizeof(uint8_t) * n); - free(val, M_TEMP); - if (error != 0 || req->newptr == NULL) - return (error); - - error = SYSCTL_IN(req, new, sizeof(new)); - if (error) - return (error); - - UTP_LOCK(utp); - error = UTP_WRITEREG(utp, new[0], new[1], new[2]); - UTP_UNLOCK(utp); - - return (error); -} - -static int -utopia_sysctl_stats(SYSCTL_HANDLER_ARGS) -{ - struct utopia *utp = (struct utopia *)arg1; - void *val; - int error; - - val = malloc(sizeof(utp->stats), M_TEMP, M_WAITOK); - - UTP_LOCK(utp); - bcopy(&utp->stats, val, sizeof(utp->stats)); - if (req->newptr != NULL) - bzero((char *)&utp->stats + sizeof(utp->stats.version), - sizeof(utp->stats) - sizeof(utp->stats.version)); - UTP_UNLOCK(utp); - - error = SYSCTL_OUT(req, val, sizeof(utp->stats)); - if (error && req->newptr != NULL) - bcopy(val, &utp->stats, sizeof(utp->stats)); - free(val, M_TEMP); - - /* ignore actual new value */ - - return (error); -} - -/* - * Handle the loopback sysctl - */ -static int -utopia_sysctl_loopback(SYSCTL_HANDLER_ARGS) -{ - struct utopia *utp = (struct utopia *)arg1; - int error; - u_int loopback; - - error = SYSCTL_OUT(req, &utp->loopback, sizeof(u_int)); - if (error != 0 || req->newptr == NULL) - return (error); - - error = SYSCTL_IN(req, &loopback, sizeof(u_int)); - if (error) - return (error); - - UTP_LOCK(utp); - error = utopia_set_loopback(utp, loopback); - UTP_UNLOCK(utp); - - return (error); -} - -/* - * Handle the type sysctl - */ -static int -utopia_sysctl_type(SYSCTL_HANDLER_ARGS) -{ - struct utopia *utp = (struct utopia *)arg1; - - return (SYSCTL_OUT(req, &utp->chip->type, sizeof(utp->chip->type))); -} - -/* - * Handle the name sysctl - */ -static int -utopia_sysctl_name(SYSCTL_HANDLER_ARGS) -{ - struct utopia *utp = (struct utopia *)arg1; - - return (SYSCTL_OUT(req, utp->chip->name, strlen(utp->chip->name) + 1)); -} - -/* - * Initialize the state. This is called from the drivers attach - * function. The mutex must be already initialized. - */ -int -utopia_attach(struct utopia *utp, struct ifatm *ifatm, struct ifmedia *media, - struct mtx *lock, struct sysctl_ctx_list *ctx, - struct sysctl_oid_list *children, const struct utopia_methods *m) -{ - - bzero(utp, sizeof(*utp)); - utp->ifatm = ifatm; - utp->methods = m; - utp->media = media; - utp->lock = lock; - utp->chip = &utopia_chip_unknown; - utp->stats.version = 1; - - ifmedia_init(media, - IFM_ATM_SDH | IFM_ATM_UNASSIGNED | IFM_ATM_NOSCRAMB, - utopia_media_change, utopia_media_status); - - if (SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "phy_regs", - CTLFLAG_RW | CTLTYPE_OPAQUE, utp, 0, utopia_sysctl_regs, "S", - "phy registers") == NULL) - return (-1); - - if (SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "phy_loopback", - CTLFLAG_RW | CTLTYPE_UINT, utp, 0, utopia_sysctl_loopback, "IU", - "phy loopback mode") == NULL) - return (-1); - - if (SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "phy_type", - CTLFLAG_RD | CTLTYPE_UINT, utp, 0, utopia_sysctl_type, "IU", - "phy type") == NULL) - return (-1); - - if (SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "phy_name", - CTLFLAG_RD | CTLTYPE_STRING, utp, 0, utopia_sysctl_name, "A", - "phy name") == NULL) - return (-1); - - if (SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "phy_stats", - CTLFLAG_RW | CTLTYPE_OPAQUE, utp, 0, utopia_sysctl_stats, "S", - "phy statistics") == NULL) - return (-1); - - if (SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "phy_state", - CTLFLAG_RD, &utp->state, 0, "phy state") == NULL) - return (-1); - - if (SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "phy_carrier", - CTLFLAG_RD, &utp->carrier, 0, "phy carrier") == NULL) - return (-1); - - UTP_WLOCK_LIST(); - LIST_INSERT_HEAD(&utopia_list, utp, link); - UTP_WUNLOCK_LIST(); - - utp->state |= UTP_ST_ATTACHED; - return (0); -} - -/* - * Detach. We set a flag here, wakeup the daemon and let him do it. - * Here we need the lock for synchronisation with the daemon. - */ -void -utopia_detach(struct utopia *utp) -{ - - UTP_LOCK_ASSERT(utp); - if (utp->state & UTP_ST_ATTACHED) { - utp->state |= UTP_ST_DETACH; - while (utp->state & UTP_ST_DETACH) { - wakeup(&utopia_list); - msleep(utp, utp->lock, PZERO, "utopia_detach", hz); - } - } -} - -/* - * The carrier state kernel proc for those adapters that do not interrupt. - * - * We assume, that utopia_attach can safely add a new utopia while we are going - * through the list without disturbing us (we lock the list while getting - * the address of the first element, adding is always done at the head). - * Removing is entirely handled here. - */ -static void -utopia_daemon(void *arg __unused) -{ - struct utopia *utp, *next; - - UTP_RLOCK_LIST(); - while (utopia_kproc != NULL) { - utp = LIST_FIRST(&utopia_list); - UTP_RUNLOCK_LIST(); - - while (utp != NULL) { - mtx_lock(&Giant); /* XXX depend on MPSAFE */ - UTP_LOCK(utp); - next = LIST_NEXT(utp, link); - if (utp->state & UTP_ST_DETACH) { - LIST_REMOVE(utp, link); - utp->state &= ~UTP_ST_DETACH; - wakeup_one(utp); - } else if (utp->state & UTP_ST_ACTIVE) { - if (utp->flags & UTP_FL_POLL_CARRIER) - utopia_update_carrier(utp); - utopia_update_stats(utp); - } - UTP_UNLOCK(utp); - mtx_unlock(&Giant); /* XXX depend on MPSAFE */ - utp = next; - } - - UTP_RLOCK_LIST(); - msleep(&utopia_list, &utopia_list_mtx, PZERO, "*idle*", hz); - } - wakeup_one(&utopia_list); - UTP_RUNLOCK_LIST(); - kproc_exit(0); -} - -/* - * Module initialisation - */ -static int -utopia_mod_init(module_t mod, int what, void *arg) -{ - int err; - struct proc *kp; - - switch (what) { - - case MOD_LOAD: - mtx_init(&utopia_list_mtx, "utopia list mutex", NULL, MTX_DEF); - err = kproc_create(utopia_daemon, NULL, &utopia_kproc, - RFHIGHPID, 0, "utopia"); - if (err != 0) { - printf("cannot created utopia thread %d\n", err); - return (err); - } - break; - - case MOD_UNLOAD: - UTP_WLOCK_LIST(); - if ((kp = utopia_kproc) != NULL) { - utopia_kproc = NULL; - wakeup_one(&utopia_list); - PROC_LOCK(kp); - UTP_WUNLOCK_LIST(); - msleep(kp, &kp->p_mtx, PWAIT, "utopia_destroy", 0); - PROC_UNLOCK(kp); - } else - UTP_WUNLOCK_LIST(); - mtx_destroy(&utopia_list_mtx); - break; - default: - return (EOPNOTSUPP); - } - return (0); -} - -static moduledata_t utopia_mod = { - "utopia", - utopia_mod_init, - 0 -}; - -DECLARE_MODULE(utopia, utopia_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); -MODULE_VERSION(utopia, 1); diff --git a/sys/dev/utopia/utopia.h b/sys/dev/utopia/utopia.h deleted file mode 100644 index 6e42e99b2e51..000000000000 --- a/sys/dev/utopia/utopia.h +++ /dev/null @@ -1,203 +0,0 @@ -/*- - * Copyright (c) 2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - */ -#ifndef _DEV_UTOPIA_UTOPIA_H -#define _DEV_UTOPIA_UTOPIA_H - -/* Structure for user-level register formatting */ -struct utopia_print { - uint8_t type; /* register type */ - uint8_t reg; /* register number */ - const char *name; /* register name */ - const char *fmt; /* format for printing */ -}; - -/* - * Types of registers - */ -#define UTP_REGT_BITS 0x0 /* use printb to print */ -#define UTP_REGT_INT8 0x1 /* 8 bit hex number */ -#define UTP_REGT_INT10BITS 0x2 /* 10 bit hex number + 6 bit printb */ -#define UTP_REGT_INT12 0x3 /* 12 bit LE hex */ -#define UTP_REGT_INT16 0x4 /* 16 bit LE hex */ -#define UTP_REGT_INT19 0x5 /* 19 bit LE hex */ -#define UTP_REGT_INT20 0x6 /* 20 bit LE hex */ -#define UTP_REGT_INT21 0x7 /* 21 bit LE hex */ -#define UTP_REGT_INT18 0x8 /* 18 bit LE hex */ - -/* number of additional registers per type */ -#define UTP_REG_ADD 0, 0, 1, 1, 1, 2, 2, 2, 2 - -/* flags field */ -#define UTP_FL_NORESET 0x0001 /* cannot write MRESET register */ -#define UTP_FL_POLL_CARRIER 0x0002 /* need to poll for carrier */ - -/* state field */ -#define UTP_ST_ACTIVE 0x0001 /* registers accessible */ -#define UTP_ST_SDH 0x0002 /* SDH or SONET */ -#define UTP_ST_UNASS 0x0004 /* produce unassigned cells */ -#define UTP_ST_NOSCRAMB 0x0008 /* no scrambling */ -#define UTP_ST_DETACH 0x0010 /* detaching */ -#define UTP_ST_ATTACHED 0x0020 /* successful attached */ - -/* carrier field */ -#define UTP_CARR_UNKNOWN 0 -#define UTP_CARR_OK 1 -#define UTP_CARR_LOST 2 - -/* loopback field */ -#define UTP_LOOP_NONE 0x0000 -#define UTP_LOOP_TIME 0x0001 /* timing source loopback */ -#define UTP_LOOP_DIAG 0x0002 /* diagnostic loopback */ -#define UTP_LOOP_LINE 0x0004 /* serial line loopback */ -#define UTP_LOOP_PARAL 0x0008 /* parallel diagnostic loopback */ -#define UTP_LOOP_TWIST 0x0010 /* twisted pair diagnostic loopback */ -#define UTP_LOOP_PATH 0x0020 /* diagnostic path loopback */ - -/* type */ -#define UTP_TYPE_UNKNOWN 0 -#define UTP_TYPE_SUNI_LITE 1 -#define UTP_TYPE_SUNI_ULTRA 2 -#define UTP_TYPE_SUNI_622 3 -#define UTP_TYPE_IDT77105 4 -#define UTP_TYPE_IDT77155 5 -#define UTP_TYPE_CX28250 6 - -/* - * Statistics. These structures are versioned. - */ -struct utopia_stats1 { - uint32_t version; /* version of this statistics struct */ - uint32_t fill; - - uint64_t rx_sbip; /* rx section BIP errors */ - uint64_t rx_lbip; /* rx line BIP errors */ - uint64_t rx_lfebe; /* rx line far end block errors */ - uint64_t rx_pbip; /* rx path BIP errors */ - uint64_t rx_pfebe; /* rx path far end block errors */ - uint64_t rx_cells; /* received cells */ - uint64_t rx_corr; /* correctable cell errors */ - uint64_t rx_uncorr; /* uncorrectable cell errors */ - uint64_t rx_symerr; /* symbol errors */ - - uint64_t tx_cells; /* transmitted cells */ -}; - -#ifdef _KERNEL - -#include - -/* - * These must be implemented by the card driver - */ -struct utopia_methods { - /* read at most n PHY registers starting at reg into val */ - int (*readregs)(struct ifatm *, u_int reg, uint8_t *val, u_int *n); - - /* change the bits given by mask to them in val in register reg */ - int (*writereg)(struct ifatm *, u_int reg, u_int mask, u_int val); -}; - -/* - * Public state - */ -struct utopia { - struct ifatm *ifatm; /* driver data */ - struct ifmedia *media; /* driver supplied */ - struct mtx *lock; /* driver supplied */ - const struct utopia_methods *methods; - LIST_ENTRY(utopia) link; /* list of these structures */ - u_int flags; /* flags set by the driver */ - u_int state; /* current state */ - u_int carrier; /* carrier state */ - u_int loopback; /* loopback mode */ - const struct utopia_chip *chip; /* chip operations */ - struct utopia_stats1 stats; /* statistics */ -}; - -struct utopia_chip { - /* type and name of the chip */ - u_int type; - const char *const name; - - /* number of registers */ - u_int nregs; - - /* reset chip to known state */ - int (*reset)(struct utopia *); - - /* set SONET/SDH mode */ - int (*set_sdh)(struct utopia *, int sdh); - - /* set idle/unassigned cells */ - int (*set_unass)(struct utopia *, int unass); - - /* enable/disable scrambling */ - int (*set_noscramb)(struct utopia *, int noscramb); - - /* update carrier status */ - int (*update_carrier)(struct utopia *); - - /* set loopback mode */ - int (*set_loopback)(struct utopia *, u_int mode); - - /* handle interrupt */ - void (*intr)(struct utopia *); - - /* update statistics */ - void (*update_stats)(struct utopia *); -}; - -/* - * These are implemented in the common utopia code - */ -int utopia_attach(struct utopia *, struct ifatm *, struct ifmedia *, - struct mtx *, struct sysctl_ctx_list *, struct sysctl_oid_list *, - const struct utopia_methods *); -void utopia_detach(struct utopia *); - -int utopia_start(struct utopia *); -void utopia_stop(struct utopia *); - -void utopia_init_media(struct utopia *); -void utopia_reset_media(struct utopia *); - -#define utopia_reset(S) ((S)->chip->reset((S))) -#define utopia_set_sdh(S, SDH) ((S)->chip->set_sdh((S), (SDH))) -#define utopia_set_unass(S, U) ((S)->chip->set_unass((S), (U))) -#define utopia_set_noscramb(S, N) ((S)->chip->set_noscramb((S), (N))) -#define utopia_update_carrier(S) ((S)->chip->update_carrier((S))) -#define utopia_update_stats(S) ((S)->chip->update_stats((S))) -#define utopia_set_loopback(S, L) ((S)->chip->set_loopback((S), (L))) -#define utopia_intr(S) ((S)->chip->intr((S))) - -#endif /* _KERNEL */ - -#endif /* _DEV_UTOPIA_UTOPIA_H */ diff --git a/sys/dev/utopia/utopia_priv.h b/sys/dev/utopia/utopia_priv.h deleted file mode 100644 index cbb242cb9991..000000000000 --- a/sys/dev/utopia/utopia_priv.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2005 - * Hartmut Brandt. - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - * - * $FreeBSD$ - * - * Private include file for the interface between chip files and - * the utopia main stuff. - */ - -#ifndef _DEV_UTOPIA_UTOPIA_PRIV_H -#define _DEV_UTOPIA_UTOPIA_PRIV_H - -#define UTP_READREGS(UTOPIA, REG, VALP, NP) \ - (UTOPIA)->methods->readregs((UTOPIA)->ifatm, REG, VALP, NP) -#define UTP_WRITEREG(UTOPIA, REG, MASK, VAL) \ - (UTOPIA)->methods->writereg((UTOPIA)->ifatm, REG, MASK, VAL) - -uint32_t utopia_update(struct utopia *, u_int, u_int, uint32_t); -void utopia_check_carrier(struct utopia *, u_int); - -#endif /* _DEV_UTOPIA_UTOPIA_PRIV_H */ diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 4174dd648f2d..73c35f6bac80 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -107,7 +107,6 @@ SUBDIR= \ ${_efirt} \ ${_elink} \ ${_em} \ - en \ ${_ep} \ ${_epic} \ esp \ @@ -116,7 +115,6 @@ SUBDIR= \ ${_ex} \ ${_exca} \ ext2fs \ - ${_fatm} \ fdc \ fdescfs \ ${_fe} \ @@ -130,7 +128,6 @@ SUBDIR= \ ${_glxiic} \ ${_glxsb} \ gpio \ - hatm \ hifn \ hme \ ${_hpt27xx} \ @@ -289,7 +286,6 @@ SUBDIR= \ ow \ ${_padlock} \ ${_padlock_rng} \ - patm \ ${_pccard} \ ${_pcfclock} \ pcn \ @@ -380,7 +376,6 @@ SUBDIR= \ uinput \ unionfs \ usb \ - utopia \ ${_vesa} \ ${_virtio} \ vge \ @@ -500,7 +495,6 @@ _pfsync= pfsync .if ${MK_SOURCELESS_UCODE} != "no" _bce= bce -_fatm= fatm _fxp= fxp _ispfw= ispfw _sf= sf diff --git a/sys/modules/en/Makefile b/sys/modules/en/Makefile deleted file mode 100644 index 459bf64112fc..000000000000 --- a/sys/modules/en/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/en - -KMOD= if_en -SRCS= if_en_pci.c midway.c device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_natm.h opt_ddb.h -CFLAGS+= -DENABLE_BPF -# CFLAGS+= -DINVARIANT_SUPPORT -DINVARIANTS -DEN_DEBUG=0 - -.include diff --git a/sys/modules/fatm/Makefile b/sys/modules/fatm/Makefile deleted file mode 100644 index c228fb8e49e8..000000000000 --- a/sys/modules/fatm/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ -# -# Author: Harti Brandt -# -.PATH: ${SRCTOP}/sys/dev/fatm - -KMOD= if_fatm -SRCS= if_fatm.c device_if.h bus_if.h pci_if.h opt_inet.h opt_natm.h - -# CFLAGS+= -DFATM_DEBUG=0 -DINVARIANT_SUPPORT -DINVARIANTS - -.include diff --git a/sys/modules/hatm/Makefile b/sys/modules/hatm/Makefile deleted file mode 100644 index 5027babd1944..000000000000 --- a/sys/modules/hatm/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ -# -# Author: Harti Brandt -# -.PATH: ${SRCTOP}/sys/dev/hatm - -KMOD= if_hatm -SRCS= if_hatm.c if_hatm_intr.c if_hatm_ioctl.c if_hatm_tx.c if_hatm_rx.c \ - device_if.h bus_if.h pci_if.h opt_inet.h opt_natm.h - -CFLAGS+= -DENABLE_BPF -# CFLAGS+= -DHATM_DEBUG -DINVARIANT_SUPPORT -DINVARIANTS - -.include diff --git a/sys/modules/netgraph/atm/Makefile b/sys/modules/netgraph/atm/Makefile index 8bbe33db1ae2..086819d5b54b 100644 --- a/sys/modules/netgraph/atm/Makefile +++ b/sys/modules/netgraph/atm/Makefile @@ -1,7 +1,6 @@ # $FreeBSD$ SUBDIR= \ - atm \ atmbase \ ccatm \ sscfu \ diff --git a/sys/modules/netgraph/atm/atm/Makefile b/sys/modules/netgraph/atm/atm/Makefile deleted file mode 100644 index 2cd6d9decc27..000000000000 --- a/sys/modules/netgraph/atm/atm/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -# -# Author: Harti Brandt -# -.PATH: ${SRCTOP}/sys/netgraph/atm - -KMOD= ng_atm -SRCS= ng_atm.c -# CFLAGS+= -DNGATM_DEBUG - -.include diff --git a/sys/modules/patm/Makefile b/sys/modules/patm/Makefile deleted file mode 100644 index 4f59aa765fc8..000000000000 --- a/sys/modules/patm/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ -# -# Author: Harti Brandt -# -.PATH: ${SRCTOP}/sys/dev/patm - -KMOD= if_patm -SRCS= if_patm.c if_patm_attach.c if_patm_ioctl.c if_patm_intr.c \ - if_patm_tx.c if_patm_rx.c if_patm_rtables.c \ - device_if.h bus_if.h pci_if.h opt_inet.h opt_natm.h - -CFLAGS+= -DENABLE_BPF -# CFLAGS+= -DPATM_DEBUG=0x0 -DINVARIANT_SUPPORT -DINVARIANTS -DDIAGNOSTIC - -.include diff --git a/sys/modules/utopia/Makefile b/sys/modules/utopia/Makefile deleted file mode 100644 index f9993705dc8e..000000000000 --- a/sys/modules/utopia/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/utopia - -KMOD= utopia -SRCS= utopia.c suni.c idtphy.c bus_if.h device_if.h - -.include diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h deleted file mode 100644 index a0900eee1c1a..000000000000 --- a/sys/net/if_atm.h +++ /dev/null @@ -1,337 +0,0 @@ -/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */ -/* $FreeBSD$ */ - -/*- - * - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * net/if_atm.h - */ - -/* - * Classification of ATM cards. - */ -#define ATM_DEVICE_UNKNOWN 0 -#define ATM_DEVICE_PCA200E 1 /* Fore/Marconi PCA200-E */ -#define ATM_DEVICE_HE155 2 /* Fore/Marconi HE155 */ -#define ATM_DEVICE_HE622 3 /* Fore/Marconi HE622 */ -#define ATM_DEVICE_ENI155P 4 /* Efficient networks 155p */ -#define ATM_DEVICE_ADP155P 5 /* Adaptec 155p */ -#define ATM_DEVICE_FORELE25 6 /* ForeRunnerLE 25 */ -#define ATM_DEVICE_FORELE155 7 /* ForeRunnerLE 155 */ -#define ATM_DEVICE_NICSTAR25 8 /* other 77211 25.6MBit */ -#define ATM_DEVICE_NICSTAR155 9 /* other 77211 155MBit */ -#define ATM_DEVICE_IDTABR25 10 /* 77252 based card 25MBit */ -#define ATM_DEVICE_IDTABR155 11 /* 77252 based card 155MBit */ -#define ATM_DEVICE_PROATM25 12 /* 77252 based ProSum card 25MBit */ -#define ATM_DEVICE_PROATM155 13 /* 77252 based ProSum card 155MBit */ -#define ATM_DEVICE_VIRTUAL 14 /* virtual ATM device (netgraph) */ - -/* map to strings and vendors */ -#define ATM_DEVICE_NAMES \ - { "Unknown", "Unknown" }, \ - { "PCA200-E", "Fore/Marconi" }, \ - { "HE155", "Fore/Marconi" }, \ - { "HE622", "Fore/Marconi" }, \ - { "ENI155p", "Efficient Networks" }, \ - { "ADP155p", "Adaptec" }, \ - { "ForeRunnerLE25", "Fore/Marconi" }, \ - { "ForeRunnerLE155", "Fore/Marconi" }, \ - { "IDT77211/25", "IDT" }, \ - { "IDT77211/155", "IDT" }, \ - { "IDT77252/25", "IDT" }, \ - { "IDT77252/155", "IDT" }, \ - { "ProATM/25", "ProSum" }, \ - { "ProATM/155", "ProSum" }, \ - { "Virtual", "NetGraph" }, - -/* - * This is the common link layer MIB for all ATM interfaces. Much of the - * information here is needed for ILMI. This will be augmented by statistics - * at some point. - */ -struct ifatm_mib { - /* configuration data */ - uint8_t device; /* type of card */ - u_char esi[6]; /* end system identifier (MAC) */ - uint32_t serial; /* card serial number */ - uint32_t hw_version; /* card version */ - uint32_t sw_version; /* firmware version (if any) */ - uint32_t pcr; /* supported peak cell rate */ - uint32_t media; /* physical media */ - uint8_t vpi_bits; /* number of used bits in VPI field */ - uint8_t vci_bits; /* number of used bits in VCI field */ - uint16_t max_vpcs; /* maximum number of VPCs */ - uint32_t max_vccs; /* maximum number of VCCs */ -}; - -/* - * Traffic parameters for ATM connections. This contains all parameters - * to accommodate UBR, UBR+MCR, CBR, VBR and ABR connections. - * - * Keep in sync with ng_atm.h - */ -struct atmio_tparam { - uint32_t pcr; /* 24bit: Peak Cell Rate */ - uint32_t scr; /* 24bit: VBR Sustainable Cell Rate */ - uint32_t mbs; /* 24bit: VBR Maximum burst size */ - uint32_t mcr; /* 24bit: ABR/VBR/UBR+MCR MCR */ - uint32_t icr; /* 24bit: ABR ICR */ - uint32_t tbe; /* 24bit: ABR TBE (1...2^24-1) */ - uint8_t nrm; /* 3bit: ABR Nrm */ - uint8_t trm; /* 3bit: ABR Trm */ - uint16_t adtf; /* 10bit: ABR ADTF */ - uint8_t rif; /* 4bit: ABR RIF */ - uint8_t rdf; /* 4bit: ABR RDF */ - uint8_t cdf; /* 3bit: ABR CDF */ -}; - -/* - * VCC parameters - * - * Keep in sync with ng_atm.h - */ -struct atmio_vcc { - uint16_t flags; /* VCC flags */ - uint16_t vpi; - uint16_t vci; - uint16_t rmtu; /* maximum receive PDU */ - uint16_t tmtu; /* maximum transmit PDU */ - uint8_t aal; /* aal type */ - uint8_t traffic; /* traffic type */ - struct atmio_tparam tparam; /* traffic parameters */ -}; - -/* VCC flags */ -#define ATMIO_FLAG_LLCSNAP 0x0002 /* same as ATM_PH_LLCSNAP */ -#define ATMIO_FLAG_NG 0x0010 /* owned by netgraph */ -#define ATMIO_FLAG_HARP 0x0020 /* owned by HARP */ -#define ATMIO_FLAG_NORX 0x0100 /* not receiving on this VCC */ -#define ATMIO_FLAG_NOTX 0x0200 /* not transmitting on this VCC */ -#define ATMIO_FLAG_PVC 0x0400 /* this is a PVC */ -#define ATMIO_FLAG_ASYNC 0x0800 /* async open/close */ -#define ATMIO_FLAGS "\020\2LLCSNAP\5NG\6HARP\11NORX\12NOTX\13PVC\14ASYNC" - -#define ATMIO_AAL_0 0 /* pure cells */ -#define ATMIO_AAL_34 4 /* AAL3 and 4 */ -#define ATMIO_AAL_5 5 /* AAL5 */ -#define ATMIO_AAL_RAW 10 /* whatever the card does */ - -#define ATMIO_TRAFFIC_UBR 0 -#define ATMIO_TRAFFIC_CBR 1 -#define ATMIO_TRAFFIC_ABR 2 -#define ATMIO_TRAFFIC_VBR 3 - -/* - * VCC table - * - * Keep in sync with ng_atm.h - */ -struct atmio_vcctable { - uint32_t count; /* number of vccs */ - struct atmio_vcc vccs[0]; /* array of VCCs */ -}; - -/* - * Peak cell rates for various physical media. Note, that there are - * different opinions on what the correct values are. - */ -#define ATM_RATE_25_6M 59259 -#define ATM_RATE_155M 353208 -#define ATM_RATE_622M 1412830 -#define ATM_RATE_2_4G 5651320 - -#ifdef _KERNEL -/* - * Common fields for all ATM interfaces. Each driver's softc must start with - * this structure. - */ -struct ifatm { - struct ifnet *ifp; - struct ifatm_mib mib; /* exported data */ - void *phy; /* usually SUNI */ - void *ngpriv; /* netgraph link */ -}; -#define IFP2IFATM(ifp) ((struct ifatm *)(ifp)->if_l2com) -#endif - -/* - * Keep structures in sync with ng_atm.h - * - * These are used by netgraph/harp to call the driver - * NATM uses the atm_pseudoioctl instead. - */ -struct atmio_openvcc { - void *rxhand; /* handle argument */ - struct atmio_vcc param; /* parameters */ -}; - -struct atmio_closevcc { - uint16_t vpi; - uint16_t vci; -}; - -#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) -#define RTALLOC1(A,B) rtalloc1((A),(B)) -#elif defined(__FreeBSD__) -#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) -#endif - -/* - * pseudo header for packet transmission - */ -struct atm_pseudohdr { - uint8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ -}; - -#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) -#define ATM_PH_VPI(X) ((X)->atm_ph[1]) -#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) -#define ATM_PH_SETVCI(X,V) { \ - (X)->atm_ph[2] = ((V) >> 8) & 0xff; \ - (X)->atm_ph[3] = ((V) & 0xff); \ -} - -/* use AAL5? (0 == aal0) */ -#define ATM_PH_AAL5 0x01 -/* use the LLC SNAP encoding (iff aal5) */ -#define ATM_PH_LLCSNAP ATMIO_FLAG_LLCSNAP - -#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ -#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ - -#define ATMMTU 9180 /* ATM MTU size for IP */ - /* XXX: could be 9188 with LLC/SNAP according - to comer */ - -#define SIOCATMGETVCCS _IOW('a', 125, struct atmio_vcctable) -#define SIOCATMOPENVCC _IOR('a', 126, struct atmio_openvcc) -#define SIOCATMCLOSEVCC _IOR('a', 127, struct atmio_closevcc) - -#define SIOCATMGVCCS _IOWR('i', 230, struct ifreq) - -/* - * XXX forget all the garbage in if_llc.h and do it the easy way - */ -#define ATMLLC_HDR "\252\252\3\0\0\0" -struct atmllc { - uint8_t llchdr[6]; /* aa.aa.03.00.00.00 */ - uint8_t type[2]; /* "ethernet" type */ -}; - -/* ATM_LLC macros: note type code in host byte order */ -#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) -#define ATM_LLC_SETTYPE(X, V) do { \ - (X)->type[0] = ((V) >> 8) & 0xff; \ - (X)->type[1] = ((V) & 0xff); \ - } while (0) - -/* - * Events that are emitted by the driver. Currently the only consumer - * of this is the netgraph node. - */ -#define ATMEV_FLOW_CONTROL 0x0001 /* channel busy state changed */ -#define ATMEV_IFSTATE_CHANGED 0x0002 /* up/down or carrier */ -#define ATMEV_VCC_CHANGED 0x0003 /* PVC deleted/create */ -#define ATMEV_ACR_CHANGED 0x0004 /* ABR ACR has changed */ - -struct atmev_flow_control { - uint16_t vpi; /* channel that is changed */ - uint16_t vci; - u_int busy : 1; /* != 0 -> ATM layer busy */ -}; - -struct atmev_ifstate_changed { - u_int running : 1; /* interface is running now */ - u_int carrier : 1; /* carrier detected (or not) */ -}; - -struct atmev_vcc_changed { - uint16_t vpi; /* channel that is changed */ - uint16_t vci; - u_int up : 1; /* 1 - created, 0 - deleted */ -}; - -struct atmev_acr_changed { - uint16_t vpi; /* channel that is changed */ - uint16_t vci; - uint32_t acr; /* new ACR */ -}; - -#ifdef _KERNEL -void atm_ifattach(struct ifnet *); -void atm_ifdetach(struct ifnet *); -void atm_input(struct ifnet *, struct atm_pseudohdr *, - struct mbuf *, void *); -int atm_output(struct ifnet *, struct mbuf *, const struct sockaddr *, - struct route *); -struct atmio_vcctable *atm_getvccs(struct atmio_vcc **, u_int, u_int, - struct mtx *, int); - -void atm_event(struct ifnet *, u_int, void *); - -#define ATMEV_SEND_FLOW_CONTROL(ATMIF, VPI, VCI, BUSY) \ - do { \ - struct atmev_flow_control _arg; \ - _arg.vpi = (VPI); \ - _arg.vci = (VCI); \ - _arg.busy = (BUSY); \ - atm_event((ATMIF)->ifp, ATMEV_FLOW_CONTROL, &_arg); \ - } while (0) - -#define ATMEV_SEND_VCC_CHANGED(ATMIF, VPI, VCI, UP) \ - do { \ - struct atmev_vcc_changed _arg; \ - _arg.vpi = (VPI); \ - _arg.vci = (VCI); \ - _arg.up = (UP); \ - atm_event((ATMIF)->ifp, ATMEV_VCC_CHANGED, &_arg); \ - } while (0) - -#define ATMEV_SEND_IFSTATE_CHANGED(ATMIF, CARRIER) \ - do { \ - struct atmev_ifstate_changed _arg; \ - _arg.running = (((ATMIF)->ifp->if_drv_flags & \ - IFF_DRV_RUNNING) != 0); \ - _arg.carrier = ((CARRIER) != 0); \ - atm_event((ATMIF)->ifp, ATMEV_IFSTATE_CHANGED, &_arg); \ - } while (0) - -#define ATMEV_SEND_ACR_CHANGED(ATMIF, VPI, VCI, ACR) \ - do { \ - struct atmev_acr_changed _arg; \ - _arg.vpi = (VPI); \ - _arg.vci = (VCI); \ - _arg.acr= (ACR); \ - atm_event((ATMIF)->ifp, ATMEV_ACR_CHANGED, &_arg); \ - } while (0) -#endif diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c deleted file mode 100644 index 2d38b8ada7e9..000000000000 --- a/sys/net/if_atmsubr.c +++ /dev/null @@ -1,504 +0,0 @@ -/* $NetBSD: if_atmsubr.c,v 1.10 1997/03/11 23:19:51 chuck Exp $ */ - -/*- - * - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * if_atmsubr.c - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" -#include "opt_inet6.h" -#include "opt_natm.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include /* XXX: for ETHERTYPE_* */ -#if defined(INET) || defined(INET6) -#include -#endif -#ifdef NATM -#include -#endif - -#include - -/* - * Netgraph interface functions. - * These need not be protected by a lock, because ng_atm nodes are persitent. - * The ng_atm module can be unloaded only if all ATM interfaces have been - * unloaded, so nobody should be in the code paths accessing these function - * pointers. - */ -void (*ng_atm_attach_p)(struct ifnet *); -void (*ng_atm_detach_p)(struct ifnet *); -int (*ng_atm_output_p)(struct ifnet *, struct mbuf **); -void (*ng_atm_input_p)(struct ifnet *, struct mbuf **, - struct atm_pseudohdr *, void *); -void (*ng_atm_input_orphan_p)(struct ifnet *, struct mbuf *, - struct atm_pseudohdr *, void *); -void (*ng_atm_event_p)(struct ifnet *, uint32_t, void *); - -/* - * Harp pseudo interface hooks - */ -void (*atm_harp_input_p)(struct ifnet *ifp, struct mbuf **m, - struct atm_pseudohdr *ah, void *rxhand); -void (*atm_harp_attach_p)(struct ifnet *); -void (*atm_harp_detach_p)(struct ifnet *); -void (*atm_harp_event_p)(struct ifnet *, uint32_t, void *); - -SYSCTL_NODE(_hw, OID_AUTO, atm, CTLFLAG_RW, 0, "ATM hardware"); - -static MALLOC_DEFINE(M_IFATM, "ifatm", "atm interface internals"); - -#ifndef ETHERTYPE_IPV6 -#define ETHERTYPE_IPV6 0x86dd -#endif - -#define senderr(e) do { error = (e); goto bad; } while (0) - -/* - * atm_output: ATM output routine - * inputs: - * "ifp" = ATM interface to output to - * "m0" = the packet to output - * "dst" = the sockaddr to send to (either IP addr, or raw VPI/VCI) - * "ro" = the route to use - * returns: error code [0 == ok] - * - * note: special semantic: if (dst == NULL) then we assume "m" already - * has an atm_pseudohdr on it and just send it directly. - * [for native mode ATM output] if dst is null, then - * ro->ro_rt must also be NULL. - */ -int -atm_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, - struct route *ro) -{ - u_int16_t etype = 0; /* if using LLC/SNAP */ - int error = 0, sz; - struct atm_pseudohdr atmdst, *ad; - struct mbuf *m = m0; - struct atmllc *atmllc; - const struct atmllc *llc_hdr = NULL; - u_int32_t atm_flags; - -#ifdef MAC - error = mac_ifnet_check_transmit(ifp, m); - if (error) - senderr(error); -#endif - - if (!((ifp->if_flags & IFF_UP) && - (ifp->if_drv_flags & IFF_DRV_RUNNING))) - senderr(ENETDOWN); - - /* - * check for non-native ATM traffic (dst != NULL) - */ - if (dst) { - switch (dst->sa_family) { - -#if defined(INET) || defined(INET6) - case AF_INET: - case AF_INET6: - { - if (dst->sa_family == AF_INET6) - etype = ETHERTYPE_IPV6; - else - etype = ETHERTYPE_IP; - if (!atmresolve(ro->ro_rt, m, dst, &atmdst)) { - m = NULL; - /* XXX: atmresolve already free'd it */ - senderr(EHOSTUNREACH); - /* XXX: put ATMARP stuff here */ - /* XXX: watch who frees m on failure */ - } - } - break; -#endif /* INET || INET6 */ - - case AF_UNSPEC: - /* - * XXX: bpfwrite. assuming dst contains 12 bytes - * (atm pseudo header (4) + LLC/SNAP (8)) - */ - bcopy(dst->sa_data, &atmdst, sizeof(atmdst)); - llc_hdr = (const struct atmllc *)(dst->sa_data + - sizeof(atmdst)); - break; - - default: - printf("%s: can't handle af%d\n", ifp->if_xname, - dst->sa_family); - senderr(EAFNOSUPPORT); - } - - /* - * must add atm_pseudohdr to data - */ - sz = sizeof(atmdst); - atm_flags = ATM_PH_FLAGS(&atmdst); - if (atm_flags & ATM_PH_LLCSNAP) - sz += 8; /* sizeof snap == 8 */ - M_PREPEND(m, sz, M_NOWAIT); - if (m == NULL) - senderr(ENOBUFS); - ad = mtod(m, struct atm_pseudohdr *); - *ad = atmdst; - if (atm_flags & ATM_PH_LLCSNAP) { - atmllc = (struct atmllc *)(ad + 1); - if (llc_hdr == NULL) { - bcopy(ATMLLC_HDR, atmllc->llchdr, - sizeof(atmllc->llchdr)); - /* note: in host order */ - ATM_LLC_SETTYPE(atmllc, etype); - } - else - bcopy(llc_hdr, atmllc, sizeof(struct atmllc)); - } - } - - if (ng_atm_output_p != NULL) { - if ((error = (*ng_atm_output_p)(ifp, &m)) != 0) { - if (m != NULL) - m_freem(m); - return (error); - } - if (m == NULL) - return (0); - } - - /* - * Queue message on interface, and start output if interface - * not yet active. - */ - if (!IF_HANDOFF_ADJ(&ifp->if_snd, m, ifp, - -(int)sizeof(struct atm_pseudohdr))) - return (ENOBUFS); - return (error); - -bad: - if (m) - m_freem(m); - return (error); -} - -/* - * Process a received ATM packet; - * the packet is in the mbuf chain m. - */ -void -atm_input(struct ifnet *ifp, struct atm_pseudohdr *ah, struct mbuf *m, - void *rxhand) -{ - int isr; - u_int16_t etype = ETHERTYPE_IP; /* default */ - - if ((ifp->if_flags & IFF_UP) == 0) { - m_freem(m); - return; - } -#ifdef MAC - mac_ifnet_create_mbuf(ifp, m); -#endif - if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); - - if (ng_atm_input_p != NULL) { - (*ng_atm_input_p)(ifp, &m, ah, rxhand); - if (m == NULL) - return; - } - - /* not eaten by ng_atm. Maybe it's a pseudo-harp PDU? */ - if (atm_harp_input_p != NULL) { - (*atm_harp_input_p)(ifp, &m, ah, rxhand); - if (m == NULL) - return; - } - - if (rxhand) { -#ifdef NATM - struct natmpcb *npcb; - - /* - * XXXRW: this use of 'rxhand' is not a very good idea, and - * was subject to races even before SMPng due to the release - * of spl here. - */ - NATM_LOCK(); - npcb = rxhand; - npcb->npcb_inq++; /* count # in queue */ - isr = NETISR_NATM; - m->m_pkthdr.rcvif = rxhand; /* XXX: overload */ - NATM_UNLOCK(); -#else - printf("atm_input: NATM detected but not " - "configured in kernel\n"); - goto dropit; -#endif - } else { - /* - * handle LLC/SNAP header, if present - */ - if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) { - struct atmllc *alc; - - if (m->m_len < sizeof(*alc) && - (m = m_pullup(m, sizeof(*alc))) == NULL) - return; /* failed */ - alc = mtod(m, struct atmllc *); - if (bcmp(alc, ATMLLC_HDR, 6)) { - printf("%s: recv'd invalid LLC/SNAP frame " - "[vp=%d,vc=%d]\n", ifp->if_xname, - ATM_PH_VPI(ah), ATM_PH_VCI(ah)); - m_freem(m); - return; - } - etype = ATM_LLC_TYPE(alc); - m_adj(m, sizeof(*alc)); - } - - switch (etype) { - -#ifdef INET - case ETHERTYPE_IP: - isr = NETISR_IP; - break; -#endif - -#ifdef INET6 - case ETHERTYPE_IPV6: - isr = NETISR_IPV6; - break; -#endif - default: -#ifndef NATM - dropit: -#endif - if (ng_atm_input_orphan_p != NULL) - (*ng_atm_input_orphan_p)(ifp, m, ah, rxhand); - else - m_freem(m); - return; - } - } - M_SETFIB(m, ifp->if_fib); - netisr_dispatch(isr, m); -} - -/* - * Perform common duties while attaching to interface list. - */ -void -atm_ifattach(struct ifnet *ifp) -{ - struct ifaddr *ifa; - struct sockaddr_dl *sdl; - struct ifatm *ifatm = ifp->if_l2com; - - ifp->if_addrlen = 0; - ifp->if_hdrlen = 0; - if_attach(ifp); - ifp->if_mtu = ATMMTU; - ifp->if_output = atm_output; -#if 0 - ifp->if_input = atm_input; -#endif - ifp->if_snd.ifq_maxlen = 50; /* dummy */ - - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) - if (ifa->ifa_addr->sa_family == AF_LINK) { - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sdl->sdl_type = IFT_ATM; - sdl->sdl_alen = ifp->if_addrlen; -#ifdef notyet /* if using ATMARP, store hardware address using the next line */ - bcopy(ifp->hw_addr, LLADDR(sdl), ifp->if_addrlen); -#endif - break; - } - - ifp->if_linkmib = &ifatm->mib; - ifp->if_linkmiblen = sizeof(ifatm->mib); - - if(ng_atm_attach_p) - (*ng_atm_attach_p)(ifp); - if (atm_harp_attach_p) - (*atm_harp_attach_p)(ifp); -} - -/* - * Common stuff for detaching an ATM interface - */ -void -atm_ifdetach(struct ifnet *ifp) -{ - if (atm_harp_detach_p) - (*atm_harp_detach_p)(ifp); - if(ng_atm_detach_p) - (*ng_atm_detach_p)(ifp); - if_detach(ifp); -} - -/* - * Support routine for the SIOCATMGVCCS ioctl(). - * - * This routine assumes, that the private VCC structures used by the driver - * begin with a struct atmio_vcc. - * - * Return a table of VCCs in a freshly allocated memory area. - * Here we have a problem: we first count, how many vccs we need - * to return. The we allocate the memory and finally fill it in. - * Because we cannot lock while calling malloc, the number of active - * vccs may change while we're in malloc. So we allocate a couple of - * vccs more and if space anyway is not enough re-iterate. - * - * We could use an sx lock for the vcc tables. - */ -struct atmio_vcctable * -atm_getvccs(struct atmio_vcc **table, u_int size, u_int start, - struct mtx *lock, int waitok) -{ - u_int cid, alloc; - size_t len; - struct atmio_vcctable *vccs; - struct atmio_vcc *v; - - alloc = start + 10; - vccs = NULL; - - for (;;) { - len = sizeof(*vccs) + alloc * sizeof(vccs->vccs[0]); - vccs = reallocf(vccs, len, M_TEMP, - waitok ? M_WAITOK : M_NOWAIT); - if (vccs == NULL) - return (NULL); - bzero(vccs, len); - - vccs->count = 0; - v = vccs->vccs; - - mtx_lock(lock); - for (cid = 0; cid < size; cid++) - if (table[cid] != NULL) { - if (++vccs->count == alloc) - /* too many - try again */ - break; - *v++ = *table[cid]; - } - mtx_unlock(lock); - - if (cid == size) - break; - - alloc *= 2; - } - return (vccs); -} - -/* - * Driver or channel state has changed. Inform whoever is interested - * in these events. - */ -void -atm_event(struct ifnet *ifp, u_int event, void *arg) -{ - if (ng_atm_event_p != NULL) - (*ng_atm_event_p)(ifp, event, arg); - if (atm_harp_event_p != NULL) - (*atm_harp_event_p)(ifp, event, arg); -} - -static void * -atm_alloc(u_char type, struct ifnet *ifp) -{ - struct ifatm *ifatm; - - ifatm = malloc(sizeof(struct ifatm), M_IFATM, M_WAITOK | M_ZERO); - ifatm->ifp = ifp; - - return (ifatm); -} - -static void -atm_free(void *com, u_char type) -{ - - free(com, M_IFATM); -} - -static int -atm_modevent(module_t mod, int type, void *data) -{ - switch (type) { - case MOD_LOAD: - if_register_com_alloc(IFT_ATM, atm_alloc, atm_free); - break; - case MOD_UNLOAD: - if_deregister_com_alloc(IFT_ATM); - break; - default: - return (EOPNOTSUPP); - } - - return (0); -} - -static moduledata_t atm_mod = { - "atm", - atm_modevent, - 0 -}; - -DECLARE_MODULE(atm, atm_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); -MODULE_VERSION(atm, 1); diff --git a/sys/net/netisr.h b/sys/net/netisr.h index 63764a74f2eb..b0e8e5abcb35 100644 --- a/sys/net/netisr.h +++ b/sys/net/netisr.h @@ -55,7 +55,6 @@ #define NETISR_ARP 4 /* same as AF_LINK */ #define NETISR_ETHER 5 /* ethernet input */ #define NETISR_IPV6 6 -#define NETISR_NATM 7 #define NETISR_EPAIR 8 /* if_epair(4) */ #define NETISR_IP_DIRECT 9 /* direct-dispatch IPv4 */ #define NETISR_IPV6_DIRECT 10 /* direct-dispatch IPv6 */ diff --git a/sys/netgraph/atm/ng_atm.c b/sys/netgraph/atm/ng_atm.c deleted file mode 100644 index e06cb1d02036..000000000000 --- a/sys/netgraph/atm/ng_atm.c +++ /dev/null @@ -1,1448 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Hartmut Brandt - */ - -/* - * Netgraph module to connect NATM interfaces to netgraph. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* - * Hooks in the NATM code - */ -extern void (*ng_atm_attach_p)(struct ifnet *); -extern void (*ng_atm_detach_p)(struct ifnet *); -extern int (*ng_atm_output_p)(struct ifnet *, struct mbuf **); -extern void (*ng_atm_input_p)(struct ifnet *, struct mbuf **, - struct atm_pseudohdr *, void *); -extern void (*ng_atm_input_orphan_p)(struct ifnet *, struct mbuf *, - struct atm_pseudohdr *, void *); -extern void (*ng_atm_event_p)(struct ifnet *, uint32_t, void *); - -/* - * Sysctl stuff. - */ -static SYSCTL_NODE(_net_graph, OID_AUTO, atm, CTLFLAG_RW, 0, - "atm related stuff"); - -#ifdef NGATM_DEBUG -static int allow_shutdown; - -SYSCTL_INT(_net_graph_atm, OID_AUTO, allow_shutdown, CTLFLAG_RW, - &allow_shutdown, 0, "allow ng_atm nodes to shutdown"); -#endif - -/* - * Hook private data - */ -struct ngvcc { - uint16_t vpi; /* VPI of this hook */ - uint16_t vci; /* VCI of this hook, 0 if none */ - uint32_t flags; /* private flags */ - hook_p hook; /* the connected hook */ - - LIST_ENTRY(ngvcc) link; -}; -#define VCC_OPEN 0x0001 /* open */ - -/* - * Node private data - */ -struct priv { - struct ifnet *ifp; /* the ATM interface */ - hook_p input; /* raw input hook */ - hook_p orphans; /* packets to nowhere */ - hook_p output; /* catch output packets */ - hook_p manage; /* has also entry in vccs */ - uint64_t in_packets; - uint64_t in_errors; - uint64_t out_packets; - uint64_t out_errors; - - LIST_HEAD(, ngvcc) vccs; -}; - -/* - * Parse ifstate state - */ -static const struct ng_parse_struct_field ng_atm_if_change_info[] = - NGM_ATM_IF_CHANGE_INFO; -static const struct ng_parse_type ng_atm_if_change_type = { - &ng_parse_struct_type, - &ng_atm_if_change_info -}; - -/* - * Parse vcc state change - */ -static const struct ng_parse_struct_field ng_atm_vcc_change_info[] = - NGM_ATM_VCC_CHANGE_INFO; -static const struct ng_parse_type ng_atm_vcc_change_type = { - &ng_parse_struct_type, - &ng_atm_vcc_change_info -}; - -/* - * Parse acr change - */ -static const struct ng_parse_struct_field ng_atm_acr_change_info[] = - NGM_ATM_ACR_CHANGE_INFO; -static const struct ng_parse_type ng_atm_acr_change_type = { - &ng_parse_struct_type, - &ng_atm_acr_change_info -}; - -/* - * Parse the configuration structure ng_atm_config - */ -static const struct ng_parse_struct_field ng_atm_config_type_info[] = - NGM_ATM_CONFIG_INFO; - -static const struct ng_parse_type ng_atm_config_type = { - &ng_parse_struct_type, - &ng_atm_config_type_info -}; - -/* - * Parse a single vcc structure and a variable array of these ng_atm_vccs - */ -static const struct ng_parse_struct_field ng_atm_tparam_type_info[] = - NGM_ATM_TPARAM_INFO; -static const struct ng_parse_type ng_atm_tparam_type = { - &ng_parse_struct_type, - &ng_atm_tparam_type_info -}; -static const struct ng_parse_struct_field ng_atm_vcc_type_info[] = - NGM_ATM_VCC_INFO; -static const struct ng_parse_type ng_atm_vcc_type = { - &ng_parse_struct_type, - &ng_atm_vcc_type_info -}; - - -static int -ng_atm_vccarray_getlen(const struct ng_parse_type *type, - const u_char *start, const u_char *buf) -{ - const struct atmio_vcctable *vp; - - vp = (const struct atmio_vcctable *) - (buf - offsetof(struct atmio_vcctable, vccs)); - - return (vp->count); -} -static const struct ng_parse_array_info ng_atm_vccarray_info = - NGM_ATM_VCCARRAY_INFO; -static const struct ng_parse_type ng_atm_vccarray_type = { - &ng_parse_array_type, - &ng_atm_vccarray_info -}; - - -static const struct ng_parse_struct_field ng_atm_vcctable_type_info[] = - NGM_ATM_VCCTABLE_INFO; - -static const struct ng_parse_type ng_atm_vcctable_type = { - &ng_parse_struct_type, - &ng_atm_vcctable_type_info -}; - -/* - * Parse CPCS INIT structure ng_atm_cpcs_init - */ -static const struct ng_parse_struct_field ng_atm_cpcs_init_type_info[] = - NGM_ATM_CPCS_INIT_INFO; - -static const struct ng_parse_type ng_atm_cpcs_init_type = { - &ng_parse_struct_type, - &ng_atm_cpcs_init_type_info -}; - -/* - * Parse CPCS TERM structure ng_atm_cpcs_term - */ -static const struct ng_parse_struct_field ng_atm_cpcs_term_type_info[] = - NGM_ATM_CPCS_TERM_INFO; - -static const struct ng_parse_type ng_atm_cpcs_term_type = { - &ng_parse_struct_type, - &ng_atm_cpcs_term_type_info -}; - -/* - * Parse statistic struct - */ -static const struct ng_parse_struct_field ng_atm_stats_type_info[] = - NGM_ATM_STATS_INFO; - -static const struct ng_parse_type ng_atm_stats_type = { - &ng_parse_struct_type, - &ng_atm_stats_type_info -}; - -static const struct ng_cmdlist ng_atm_cmdlist[] = { - { - NGM_ATM_COOKIE, - NGM_ATM_GET_IFNAME, - "getifname", - NULL, - &ng_parse_string_type - }, - { - NGM_ATM_COOKIE, - NGM_ATM_GET_CONFIG, - "getconfig", - NULL, - &ng_atm_config_type - }, - { - NGM_ATM_COOKIE, - NGM_ATM_GET_VCCS, - "getvccs", - NULL, - &ng_atm_vcctable_type - }, - { - NGM_ATM_COOKIE, - NGM_ATM_CPCS_INIT, - "cpcsinit", - &ng_atm_cpcs_init_type, - NULL - }, - { - NGM_ATM_COOKIE, - NGM_ATM_CPCS_TERM, - "cpcsterm", - &ng_atm_cpcs_term_type, - NULL - }, - { - NGM_ATM_COOKIE, - NGM_ATM_GET_VCC, - "getvcc", - &ng_parse_hookbuf_type, - &ng_atm_vcc_type - }, - { - NGM_ATM_COOKIE, - NGM_ATM_GET_VCCID, - "getvccid", - &ng_atm_vcc_type, - &ng_atm_vcc_type - }, - { - NGM_ATM_COOKIE, - NGM_ATM_GET_STATS, - "getstats", - NULL, - &ng_atm_stats_type - }, - - /* events */ - { - NGM_ATM_COOKIE, - NGM_ATM_IF_CHANGE, - "if_change", - &ng_atm_if_change_type, - &ng_atm_if_change_type, - }, - { - NGM_ATM_COOKIE, - NGM_ATM_VCC_CHANGE, - "vcc_change", - &ng_atm_vcc_change_type, - &ng_atm_vcc_change_type, - }, - { - NGM_ATM_COOKIE, - NGM_ATM_ACR_CHANGE, - "acr_change", - &ng_atm_acr_change_type, - &ng_atm_acr_change_type, - }, - { 0 } -}; - -static int ng_atm_mod_event(module_t, int, void *); - -static ng_constructor_t ng_atm_constructor; -static ng_shutdown_t ng_atm_shutdown; -static ng_rcvmsg_t ng_atm_rcvmsg; -static ng_newhook_t ng_atm_newhook; -static ng_connect_t ng_atm_connect; -static ng_disconnect_t ng_atm_disconnect; -static ng_rcvdata_t ng_atm_rcvdata; -static ng_rcvdata_t ng_atm_rcvdrop; - -static struct ng_type ng_atm_typestruct = { - .version = NG_ABI_VERSION, - .name = NG_ATM_NODE_TYPE, - .mod_event = ng_atm_mod_event, - .constructor = ng_atm_constructor, - .rcvmsg = ng_atm_rcvmsg, - .shutdown = ng_atm_shutdown, - .newhook = ng_atm_newhook, - .connect = ng_atm_connect, - .rcvdata = ng_atm_rcvdata, - .disconnect = ng_atm_disconnect, - .cmdlist = ng_atm_cmdlist, -}; -NETGRAPH_INIT(atm, &ng_atm_typestruct); - -static const struct { - u_int media; - const char *name; -} atmmedia[] = IFM_SUBTYPE_ATM_DESCRIPTIONS; - - -#define IFP2NG(IFP) ((node_p)((struct ifatm *)(IFP)->if_softc)->ngpriv) -#define IFP2NG_SET(IFP, val) (((struct ifatm *)(IFP)->if_softc)->ngpriv = (val)) - -#define IFFLAGS "\020\001UP\002BROADCAST\003DEBUG\004LOOPBACK" \ - "\005POINTOPOINT\006SMART\007RUNNING\010NOARP" \ - "\011PROMISC\012ALLMULTI\013OACTIVE\014SIMPLEX" \ - "\015LINK0\016LINK1\017LINK2\020MULTICAST" - - -/************************************************************/ -/* - * INPUT - */ -/* - * A packet is received from an interface. - * If we have an input hook, prepend the pseudoheader to the data and - * deliver it out to that hook. If not, look whether it is destined for - * use. If so locate the appropriate hook, deliver the packet without the - * header and we are done. If it is not for us, leave it alone. - */ -static void -ng_atm_input(struct ifnet *ifp, struct mbuf **mp, - struct atm_pseudohdr *ah, void *rxhand) -{ - node_p node = IFP2NG(ifp); - struct priv *priv; - const struct ngvcc *vcc; - int error; - - if (node == NULL) - return; - priv = NG_NODE_PRIVATE(node); - if (priv->input != NULL) { - /* - * Prepend the atm_pseudoheader. - */ - M_PREPEND(*mp, sizeof(*ah), M_NOWAIT); - if (*mp == NULL) - return; - memcpy(mtod(*mp, struct atm_pseudohdr *), ah, sizeof(*ah)); - NG_SEND_DATA_ONLY(error, priv->input, *mp); - if (error == 0) { - priv->in_packets++; - *mp = NULL; - } else { -#ifdef NGATM_DEBUG - printf("%s: error=%d\n", __func__, error); -#endif - priv->in_errors++; - } - return; - } - if ((ATM_PH_FLAGS(ah) & ATMIO_FLAG_NG) == 0) - return; - - vcc = (struct ngvcc *)rxhand; - - NG_SEND_DATA_ONLY(error, vcc->hook, *mp); - if (error == 0) { - priv->in_packets++; - *mp = NULL; - } else { -#ifdef NGATM_DEBUG - printf("%s: error=%d\n", __func__, error); -#endif - priv->in_errors++; - } -} - -/* - * ATM packet is about to be output. The atm_pseudohdr is already prepended. - * If the hook is set, reroute the packet to the hook. - */ -static int -ng_atm_output(struct ifnet *ifp, struct mbuf **mp) -{ - const node_p node = IFP2NG(ifp); - const struct priv *priv; - int error = 0; - - if (node == NULL) - return (0); - priv = NG_NODE_PRIVATE(node); - if (priv->output) { - NG_SEND_DATA_ONLY(error, priv->output, *mp); - *mp = NULL; - } - - return (error); -} - -/* - * Well, this doesn't make much sense for ATM. - */ -static void -ng_atm_input_orphans(struct ifnet *ifp, struct mbuf *m, - struct atm_pseudohdr *ah, void *rxhand) -{ - node_p node = IFP2NG(ifp); - struct priv *priv; - int error; - - if (node == NULL) { - m_freem(m); - return; - } - priv = NG_NODE_PRIVATE(node); - if (priv->orphans == NULL) { - m_freem(m); - return; - } - /* - * Prepend the atm_pseudoheader. - */ - M_PREPEND(m, sizeof(*ah), M_NOWAIT); - if (m == NULL) - return; - memcpy(mtod(m, struct atm_pseudohdr *), ah, sizeof(*ah)); - NG_SEND_DATA_ONLY(error, priv->orphans, m); - if (error == 0) - priv->in_packets++; - else { - priv->in_errors++; -#ifdef NGATM_DEBUG - printf("%s: error=%d\n", __func__, error); -#endif - } -} - -/************************************************************/ -/* - * OUTPUT - */ -static int -ng_atm_rcvdata(hook_p hook, item_p item) -{ - node_p node = NG_HOOK_NODE(hook); - struct priv *priv = NG_NODE_PRIVATE(node); - const struct ngvcc *vcc = NG_HOOK_PRIVATE(hook); - struct mbuf *m; - struct atm_pseudohdr *aph; - int error; - - if (vcc->vci == 0) { - NG_FREE_ITEM(item); - return (ENOTCONN); - } - - NGI_GET_M(item, m); - NG_FREE_ITEM(item); - - /* - * Prepend pseudo-hdr. Drivers don't care about the flags. - */ - M_PREPEND(m, sizeof(*aph), M_NOWAIT); - if (m == NULL) { - NG_FREE_M(m); - return (ENOMEM); - } - aph = mtod(m, struct atm_pseudohdr *); - ATM_PH_VPI(aph) = vcc->vpi; - ATM_PH_SETVCI(aph, vcc->vci); - ATM_PH_FLAGS(aph) = 0; - - if ((error = atm_output(priv->ifp, m, NULL, NULL)) == 0) - priv->out_packets++; - else - priv->out_errors++; - return (error); -} - -static int -ng_atm_rcvdrop(hook_p hook, item_p item) -{ - NG_FREE_ITEM(item); - return (0); -} - - -/************************************************************ - * - * Event from driver. - */ -static void -ng_atm_event_func(node_p node, hook_p hook, void *arg, int event) -{ - const struct priv *priv = NG_NODE_PRIVATE(node); - struct ngvcc *vcc; - struct ng_mesg *mesg; - int error; - - switch (event) { - - case ATMEV_FLOW_CONTROL: - { - struct atmev_flow_control *ev = arg; - struct ngm_queue_state *qstate; - - /* find the connection */ - LIST_FOREACH(vcc, &priv->vccs, link) - if (vcc->vci == ev->vci && vcc->vpi == ev->vpi) - break; - if (vcc == NULL) - break; - - /* convert into a flow control message */ - NG_MKMESSAGE(mesg, NGM_FLOW_COOKIE, - ev->busy ? NGM_HIGH_WATER_PASSED : NGM_LOW_WATER_PASSED, - sizeof(struct ngm_queue_state), M_NOWAIT); - if (mesg == NULL) - break; - qstate = (struct ngm_queue_state *)mesg->data; - - /* XXX have to figure out how to get that info */ - - NG_SEND_MSG_HOOK(error, node, mesg, vcc->hook, 0); - break; - } - - case ATMEV_VCC_CHANGED: - { - struct atmev_vcc_changed *ev = arg; - struct ngm_atm_vcc_change *chg; - - if (priv->manage == NULL) - break; - NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_VCC_CHANGE, - sizeof(struct ngm_atm_vcc_change), M_NOWAIT); - if (mesg == NULL) - break; - chg = (struct ngm_atm_vcc_change *)mesg->data; - chg->vci = ev->vci; - chg->vpi = ev->vpi; - chg->state = (ev->up != 0); - chg->node = NG_NODE_ID(node); - NG_SEND_MSG_HOOK(error, node, mesg, priv->manage, 0); - break; - } - - case ATMEV_IFSTATE_CHANGED: - { - struct atmev_ifstate_changed *ev = arg; - struct ngm_atm_if_change *chg; - - if (priv->manage == NULL) - break; - NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_IF_CHANGE, - sizeof(struct ngm_atm_if_change), M_NOWAIT); - if (mesg == NULL) - break; - chg = (struct ngm_atm_if_change *)mesg->data; - chg->carrier = (ev->carrier != 0); - chg->running = (ev->running != 0); - chg->node = NG_NODE_ID(node); - NG_SEND_MSG_HOOK(error, node, mesg, priv->manage, 0); - break; - } - - case ATMEV_ACR_CHANGED: - { - struct atmev_acr_changed *ev = arg; - struct ngm_atm_acr_change *acr; - - /* find the connection */ - LIST_FOREACH(vcc, &priv->vccs, link) - if (vcc->vci == ev->vci && vcc->vpi == ev->vpi) - break; - if (vcc == NULL) - break; - - /* convert into a flow control message */ - NG_MKMESSAGE(mesg, NGM_ATM_COOKIE, NGM_ATM_ACR_CHANGE, - sizeof(struct ngm_atm_acr_change), M_NOWAIT); - if (mesg == NULL) - break; - acr = (struct ngm_atm_acr_change *)mesg->data; - acr->node = NG_NODE_ID(node); - acr->vci = ev->vci; - acr->vpi = ev->vpi; - acr->acr = ev->acr; - - NG_SEND_MSG_HOOK(error, node, mesg, vcc->hook, 0); - break; - } - } -} - -/* - * Use send_fn to get the right lock - */ -static void -ng_atm_event(struct ifnet *ifp, uint32_t event, void *arg) -{ - const node_p node = IFP2NG(ifp); - - if (node != NULL) - /* may happen during attach/detach */ - (void)ng_send_fn(node, NULL, ng_atm_event_func, arg, event); -} - -/************************************************************ - * - * CPCS - */ -/* - * Open a channel for the user - */ -static int -ng_atm_cpcs_init(node_p node, const struct ngm_atm_cpcs_init *arg) -{ - struct priv *priv = NG_NODE_PRIVATE(node); - const struct ifatm_mib *mib; - struct ngvcc *vcc; - struct atmio_openvcc data; - int err; - - if(priv->ifp->if_ioctl == NULL) - return (ENXIO); - - mib = (const struct ifatm_mib *)(priv->ifp->if_linkmib); - - LIST_FOREACH(vcc, &priv->vccs, link) - if (strcmp(arg->name, NG_HOOK_NAME(vcc->hook)) == 0) - break; - if (vcc == NULL) - return (ENOTCONN); - if (vcc->flags & VCC_OPEN) - return (EISCONN); - - /* - * Check user arguments and construct ioctl argument - */ - memset(&data, 0, sizeof(data)); - - data.rxhand = vcc; - - switch (data.param.aal = arg->aal) { - - case ATMIO_AAL_34: - case ATMIO_AAL_5: - case ATMIO_AAL_0: - case ATMIO_AAL_RAW: - break; - - default: - return (EINVAL); - } - - if (arg->vpi > 0xff) - return (EINVAL); - data.param.vpi = arg->vpi; - - /* allow 0.0 as catch all receive channel */ - if (arg->vci == 0 && (arg->vpi != 0 || !(arg->flags & ATMIO_FLAG_NOTX))) - return (EINVAL); - data.param.vci = arg->vci; - - data.param.tparam.pcr = arg->pcr; - - if (arg->mcr > arg->pcr) - return (EINVAL); - data.param.tparam.mcr = arg->mcr; - - if (!(arg->flags & ATMIO_FLAG_NOTX)) { - if (arg->tmtu == 0) - data.param.tmtu = priv->ifp->if_mtu; - else { - data.param.tmtu = arg->tmtu; - } - } - if (!(arg->flags & ATMIO_FLAG_NORX)) { - if (arg->rmtu == 0) - data.param.rmtu = priv->ifp->if_mtu; - else { - data.param.rmtu = arg->rmtu; - } - } - - switch (data.param.traffic = arg->traffic) { - - case ATMIO_TRAFFIC_UBR: - case ATMIO_TRAFFIC_CBR: - break; - - case ATMIO_TRAFFIC_VBR: - if (arg->scr > arg->pcr) - return (EINVAL); - data.param.tparam.scr = arg->scr; - - if (arg->mbs > (1 << 24)) - return (EINVAL); - data.param.tparam.mbs = arg->mbs; - break; - - case ATMIO_TRAFFIC_ABR: - if (arg->icr > arg->pcr || arg->icr < arg->mcr) - return (EINVAL); - data.param.tparam.icr = arg->icr; - - if (arg->tbe == 0 || arg->tbe > (1 << 24)) - return (EINVAL); - data.param.tparam.tbe = arg->tbe; - - if (arg->nrm > 0x7) - return (EINVAL); - data.param.tparam.nrm = arg->nrm; - - if (arg->trm > 0x7) - return (EINVAL); - data.param.tparam.trm = arg->trm; - - if (arg->adtf > 0x3ff) - return (EINVAL); - data.param.tparam.adtf = arg->adtf; - - if (arg->rif > 0xf) - return (EINVAL); - data.param.tparam.rif = arg->rif; - - if (arg->rdf > 0xf) - return (EINVAL); - data.param.tparam.rdf = arg->rdf; - - if (arg->cdf > 0x7) - return (EINVAL); - data.param.tparam.cdf = arg->cdf; - - break; - - default: - return (EINVAL); - } - - if ((arg->flags & ATMIO_FLAG_NORX) && (arg->flags & ATMIO_FLAG_NOTX)) - return (EINVAL); - - data.param.flags = arg->flags & ~(ATM_PH_AAL5 | ATM_PH_LLCSNAP); - data.param.flags |= ATMIO_FLAG_NG; - - err = (*priv->ifp->if_ioctl)(priv->ifp, SIOCATMOPENVCC, (caddr_t)&data); - - if (err == 0) { - vcc->vci = data.param.vci; - vcc->vpi = data.param.vpi; - vcc->flags = VCC_OPEN; - } - - return (err); -} - -/* - * Issue the close command to the driver - */ -static int -cpcs_term(const struct priv *priv, u_int vpi, u_int vci) -{ - struct atmio_closevcc data; - - if (priv->ifp->if_ioctl == NULL) - return ENXIO; - - data.vpi = vpi; - data.vci = vci; - - return ((*priv->ifp->if_ioctl)(priv->ifp, - SIOCATMCLOSEVCC, (caddr_t)&data)); -} - - -/* - * Close a channel by request of the user - */ -static int -ng_atm_cpcs_term(node_p node, const struct ngm_atm_cpcs_term *arg) -{ - struct priv *priv = NG_NODE_PRIVATE(node); - struct ngvcc *vcc; - int error; - - LIST_FOREACH(vcc, &priv->vccs, link) - if(strcmp(arg->name, NG_HOOK_NAME(vcc->hook)) == 0) - break; - if (vcc == NULL) - return (ENOTCONN); - if (!(vcc->flags & VCC_OPEN)) - return (ENOTCONN); - - error = cpcs_term(priv, vcc->vpi, vcc->vci); - - vcc->vci = 0; - vcc->vpi = 0; - vcc->flags = 0; - - return (error); -} - -/************************************************************/ -/* - * CONTROL MESSAGES - */ - -/* - * Produce a textual description of the current status - */ -static int -text_status(node_p node, char *arg, u_int len) -{ - const struct priv *priv = NG_NODE_PRIVATE(node); - const struct ifatm_mib *mib; - struct sbuf sbuf; - u_int i; - - static const struct { - const char *name; - const char *vendor; - } devices[] = { - ATM_DEVICE_NAMES - }; - - mib = (const struct ifatm_mib *)(priv->ifp->if_linkmib); - - sbuf_new(&sbuf, arg, len, SBUF_FIXEDLEN); - sbuf_printf(&sbuf, "interface: %s\n", priv->ifp->if_xname); - - if (mib->device >= nitems(devices)) - sbuf_printf(&sbuf, "device=unknown\nvendor=unknown\n"); - else - sbuf_printf(&sbuf, "device=%s\nvendor=%s\n", - devices[mib->device].name, devices[mib->device].vendor); - - for (i = 0; atmmedia[i].name; i++) - if(mib->media == atmmedia[i].media) { - sbuf_printf(&sbuf, "media=%s\n", atmmedia[i].name); - break; - } - if(atmmedia[i].name == NULL) - sbuf_printf(&sbuf, "media=unknown\n"); - - sbuf_printf(&sbuf, "serial=%u esi=%6D hardware=%u software=%u\n", - mib->serial, mib->esi, ":", mib->hw_version, mib->sw_version); - sbuf_printf(&sbuf, "pcr=%u vpi_bits=%u vci_bits=%u max_vpcs=%u " - "max_vccs=%u\n", mib->pcr, mib->vpi_bits, mib->vci_bits, - mib->max_vpcs, mib->max_vccs); - sbuf_printf(&sbuf, "ifflags=%b\n", priv->ifp->if_flags, IFFLAGS); - - sbuf_finish(&sbuf); - - return (sbuf_len(&sbuf)); -} - -/* - * Get control message - */ -static int -ng_atm_rcvmsg(node_p node, item_p item, hook_p lasthook) -{ - const struct priv *priv = NG_NODE_PRIVATE(node); - struct ng_mesg *resp = NULL; - struct ng_mesg *msg; - struct ifatm_mib *mib = (struct ifatm_mib *)(priv->ifp->if_linkmib); - int error = 0; - - NGI_GET_MSG(item, msg); - - switch (msg->header.typecookie) { - - case NGM_GENERIC_COOKIE: - switch (msg->header.cmd) { - - case NGM_TEXT_STATUS: - NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT); - if(resp == NULL) { - error = ENOMEM; - break; - } - - resp->header.arglen = text_status(node, - (char *)resp->data, resp->header.arglen) + 1; - break; - - default: - error = EINVAL; - break; - } - break; - - case NGM_ATM_COOKIE: - switch (msg->header.cmd) { - - case NGM_ATM_GET_IFNAME: - NG_MKRESPONSE(resp, msg, IFNAMSIZ, M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - break; - } - strlcpy(resp->data, priv->ifp->if_xname, IFNAMSIZ); - break; - - case NGM_ATM_GET_CONFIG: - { - struct ngm_atm_config *config; - - NG_MKRESPONSE(resp, msg, sizeof(*config), M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - break; - } - config = (struct ngm_atm_config *)resp->data; - config->pcr = mib->pcr; - config->vpi_bits = mib->vpi_bits; - config->vci_bits = mib->vci_bits; - config->max_vpcs = mib->max_vpcs; - config->max_vccs = mib->max_vccs; - break; - } - - case NGM_ATM_GET_VCCS: - { - struct atmio_vcctable *vccs; - size_t len; - - if (priv->ifp->if_ioctl == NULL) { - error = ENXIO; - break; - } - error = (*priv->ifp->if_ioctl)(priv->ifp, - SIOCATMGETVCCS, (caddr_t)&vccs); - if (error) - break; - - len = sizeof(*vccs) + - vccs->count * sizeof(vccs->vccs[0]); - NG_MKRESPONSE(resp, msg, len, M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - free(vccs, M_DEVBUF); - break; - } - - (void)memcpy(resp->data, vccs, len); - free(vccs, M_DEVBUF); - - break; - } - - case NGM_ATM_GET_VCC: - { - char hook[NG_HOOKSIZ]; - struct atmio_vcctable *vccs; - struct ngvcc *vcc; - u_int i; - - if (priv->ifp->if_ioctl == NULL) { - error = ENXIO; - break; - } - if (msg->header.arglen != NG_HOOKSIZ) { - error = EINVAL; - break; - } - strncpy(hook, msg->data, NG_HOOKSIZ); - hook[NG_HOOKSIZ - 1] = '\0'; - LIST_FOREACH(vcc, &priv->vccs, link) - if (strcmp(NG_HOOK_NAME(vcc->hook), hook) == 0) - break; - if (vcc == NULL) { - error = ENOTCONN; - break; - } - error = (*priv->ifp->if_ioctl)(priv->ifp, - SIOCATMGETVCCS, (caddr_t)&vccs); - if (error) - break; - - for (i = 0; i < vccs->count; i++) - if (vccs->vccs[i].vpi == vcc->vpi && - vccs->vccs[i].vci == vcc->vci) - break; - if (i == vccs->count) { - error = ENOTCONN; - free(vccs, M_DEVBUF); - break; - } - - NG_MKRESPONSE(resp, msg, sizeof(vccs->vccs[0]), - M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - free(vccs, M_DEVBUF); - break; - } - - *(struct atmio_vcc *)resp->data = vccs->vccs[i]; - free(vccs, M_DEVBUF); - break; - } - - case NGM_ATM_GET_VCCID: - { - struct atmio_vcc *arg; - struct atmio_vcctable *vccs; - u_int i; - - if (priv->ifp->if_ioctl == NULL) { - error = ENXIO; - break; - } - if (msg->header.arglen != sizeof(*arg)) { - error = EINVAL; - break; - } - arg = (struct atmio_vcc *)msg->data; - - error = (*priv->ifp->if_ioctl)(priv->ifp, - SIOCATMGETVCCS, (caddr_t)&vccs); - if (error) - break; - - for (i = 0; i < vccs->count; i++) - if (vccs->vccs[i].vpi == arg->vpi && - vccs->vccs[i].vci == arg->vci) - break; - if (i == vccs->count) { - error = ENOTCONN; - free(vccs, M_DEVBUF); - break; - } - - NG_MKRESPONSE(resp, msg, sizeof(vccs->vccs[0]), - M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - free(vccs, M_DEVBUF); - break; - } - - *(struct atmio_vcc *)resp->data = vccs->vccs[i]; - free(vccs, M_DEVBUF); - break; - } - - case NGM_ATM_CPCS_INIT: - if (msg->header.arglen != - sizeof(struct ngm_atm_cpcs_init)) { - error = EINVAL; - break; - } - error = ng_atm_cpcs_init(node, - (struct ngm_atm_cpcs_init *)msg->data); - break; - - case NGM_ATM_CPCS_TERM: - if (msg->header.arglen != - sizeof(struct ngm_atm_cpcs_term)) { - error = EINVAL; - break; - } - error = ng_atm_cpcs_term(node, - (struct ngm_atm_cpcs_term *)msg->data); - break; - - case NGM_ATM_GET_STATS: - { - struct ngm_atm_stats *p; - - if (msg->header.arglen != 0) { - error = EINVAL; - break; - } - NG_MKRESPONSE(resp, msg, sizeof(*p), M_NOWAIT); - if (resp == NULL) { - error = ENOMEM; - break; - } - p = (struct ngm_atm_stats *)resp->data; - p->in_packets = priv->in_packets; - p->out_packets = priv->out_packets; - p->in_errors = priv->in_errors; - p->out_errors = priv->out_errors; - - break; - } - - default: - error = EINVAL; - break; - } - break; - - default: - error = EINVAL; - break; - } - - NG_RESPOND_MSG(error, node, item, resp); - NG_FREE_MSG(msg); - return (error); -} - -/************************************************************/ -/* - * HOOK MANAGEMENT - */ - -/* - * A new hook is create that will be connected to the node. - * Check, whether the name is one of the predefined ones. - * If not, create a new entry into the vcc list. - */ -static int -ng_atm_newhook(node_p node, hook_p hook, const char *name) -{ - struct priv *priv = NG_NODE_PRIVATE(node); - struct ngvcc *vcc; - - if (strcmp(name, "input") == 0) { - priv->input = hook; - NG_HOOK_SET_RCVDATA(hook, ng_atm_rcvdrop); - return (0); - } - if (strcmp(name, "output") == 0) { - priv->output = hook; - NG_HOOK_SET_RCVDATA(hook, ng_atm_rcvdrop); - return (0); - } - if (strcmp(name, "orphans") == 0) { - priv->orphans = hook; - NG_HOOK_SET_RCVDATA(hook, ng_atm_rcvdrop); - return (0); - } - - /* - * Allocate a new entry - */ - vcc = malloc(sizeof(*vcc), M_NETGRAPH, M_NOWAIT | M_ZERO); - if (vcc == NULL) - return (ENOMEM); - - vcc->hook = hook; - NG_HOOK_SET_PRIVATE(hook, vcc); - - LIST_INSERT_HEAD(&priv->vccs, vcc, link); - - if (strcmp(name, "manage") == 0) - priv->manage = hook; - - return (0); -} - -/* - * Connect. Set the peer to queuing. - */ -static int -ng_atm_connect(hook_p hook) -{ - if (NG_HOOK_PRIVATE(hook) != NULL) - NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); - - return (0); -} - -/* - * Disconnect a HOOK - */ -static int -ng_atm_disconnect(hook_p hook) -{ - struct priv *priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - struct ngvcc *vcc = NG_HOOK_PRIVATE(hook); - - if (vcc == NULL) { - if (hook == priv->output) { - priv->output = NULL; - return (0); - } - if (hook == priv->input) { - priv->input = NULL; - return (0); - } - if (hook == priv->orphans) { - priv->orphans = NULL; - return (0); - } - log(LOG_ERR, "ng_atm: bad hook '%s'", NG_HOOK_NAME(hook)); - return (0); - } - - /* don't terminate if we are detaching from the interface */ - if ((vcc->flags & VCC_OPEN) && priv->ifp != NULL) - (void)cpcs_term(priv, vcc->vpi, vcc->vci); - - NG_HOOK_SET_PRIVATE(hook, NULL); - - LIST_REMOVE(vcc, link); - free(vcc, M_NETGRAPH); - - if (hook == priv->manage) - priv->manage = NULL; - - return (0); -} - -/************************************************************/ -/* - * NODE MANAGEMENT - */ - -/* - * ATM interface attached - create a node and name it like the interface. - */ -static void -ng_atm_attach(struct ifnet *ifp) -{ - node_p node; - struct priv *priv; - - KASSERT(IFP2NG(ifp) == 0, ("%s: node alreay exists?", __func__)); - - if (ng_make_node_common(&ng_atm_typestruct, &node) != 0) { - log(LOG_ERR, "%s: can't create node for %s\n", - __func__, ifp->if_xname); - return; - } - - priv = malloc(sizeof(*priv), M_NETGRAPH, M_NOWAIT | M_ZERO); - if (priv == NULL) { - log(LOG_ERR, "%s: can't allocate memory for %s\n", - __func__, ifp->if_xname); - NG_NODE_UNREF(node); - return; - } - NG_NODE_SET_PRIVATE(node, priv); - priv->ifp = ifp; - LIST_INIT(&priv->vccs); - IFP2NG_SET(ifp, node); - - if (ng_name_node(node, ifp->if_xname) != 0) { - log(LOG_WARNING, "%s: can't name node %s\n", - __func__, ifp->if_xname); - } -} - -/* - * ATM interface detached - destroy node. - */ -static void -ng_atm_detach(struct ifnet *ifp) -{ - const node_p node = IFP2NG(ifp); - struct priv *priv; - - if(node == NULL) - return; - - NG_NODE_REALLY_DIE(node); - - priv = NG_NODE_PRIVATE(node); - IFP2NG_SET(priv->ifp, NULL); - priv->ifp = NULL; - - ng_rmnode_self(node); -} - -/* - * Shutdown the node. This is called from the shutdown message processing. - */ -static int -ng_atm_shutdown(node_p node) -{ - struct priv *priv = NG_NODE_PRIVATE(node); - - if (node->nd_flags & NGF_REALLY_DIE) { - /* - * We are called from unloading the ATM driver. Really, - * really need to shutdown this node. The ifp was - * already handled in the detach routine. - */ - NG_NODE_SET_PRIVATE(node, NULL); - free(priv, M_NETGRAPH); - - NG_NODE_UNREF(node); - return (0); - } - -#ifdef NGATM_DEBUG - if (!allow_shutdown) - NG_NODE_REVIVE(node); /* we persist */ - else { - IFP2NG_SET(priv->ifp, NULL); - NG_NODE_SET_PRIVATE(node, NULL); - free(priv, M_NETGRAPH); - NG_NODE_UNREF(node); - } -#else - /* - * We are persistent - reinitialize. - */ - NG_NODE_REVIVE(node); -#endif - return (0); -} - -/* - * Nodes are constructed only via interface attaches. - */ -static int -ng_atm_constructor(node_p nodep) -{ - return (EINVAL); -} - -/************************************************************/ -/* - * INITIALISATION - */ -/* - * Loading and unloading of node type - * - * The assignments to the globals for the hooks should be ok without - * a special hook. The use pattern is generally: check that the pointer - * is not NULL, call the function. In the attach case this is no problem. - * In the detach case we can detach only when no ATM node exists. That - * means that there is no ATM interface anymore. So we are sure that - * we are not in the code path in if_atmsubr.c. To prevent someone - * from adding an interface after we have started to unload the node, we - * take the iflist lock so an if_attach will be blocked until we are done. - * XXX: perhaps the function pointers should be 'volatile' for this to work - * properly. - */ -static int -ng_atm_mod_event(module_t mod, int event, void *data) -{ - VNET_ITERATOR_DECL(vnet_iter); - struct ifnet *ifp; - int error = 0; - - switch (event) { - - case MOD_LOAD: - /* - * Register function hooks - */ - if (ng_atm_attach_p != NULL) { - error = EEXIST; - break; - } - IFNET_RLOCK(); - - ng_atm_attach_p = ng_atm_attach; - ng_atm_detach_p = ng_atm_detach; - ng_atm_output_p = ng_atm_output; - ng_atm_input_p = ng_atm_input; - ng_atm_input_orphan_p = ng_atm_input_orphans; - ng_atm_event_p = ng_atm_event; - - /* Create nodes for existing ATM interfaces */ - VNET_LIST_RLOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET_QUIET(vnet_iter); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ATM) - ng_atm_attach(ifp); - } - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK(); - IFNET_RUNLOCK(); - break; - - case MOD_UNLOAD: - IFNET_RLOCK(); - - ng_atm_attach_p = NULL; - ng_atm_detach_p = NULL; - ng_atm_output_p = NULL; - ng_atm_input_p = NULL; - ng_atm_input_orphan_p = NULL; - ng_atm_event_p = NULL; - - VNET_LIST_RLOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET_QUIET(vnet_iter); - TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - if (ifp->if_type == IFT_ATM) - ng_atm_detach(ifp); - } - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK(); - IFNET_RUNLOCK(); - break; - - default: - error = EOPNOTSUPP; - break; - } - return (error); -} diff --git a/sys/netgraph/atm/ng_atm.h b/sys/netgraph/atm/ng_atm.h deleted file mode 100644 index 6b42d721c4cd..000000000000 --- a/sys/netgraph/atm/ng_atm.h +++ /dev/null @@ -1,248 +0,0 @@ -/*- - * Copyright (c) 2001-2003 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Harti Brandt - */ - -/* - * Netgraph module to connect NATM interfaces to netgraph. - * - * $FreeBSD$ - */ -#ifndef _NETGRAPH_ATM_NG_ATM_H_ -#define _NETGRAPH_ATM_NG_ATM_H_ - -#define NG_ATM_NODE_TYPE "atm" -#define NGM_ATM_COOKIE 960802260 - -/* Netgraph control messages */ -enum { - NGM_ATM_GET_IFNAME = 1, /* get the interface name */ - NGM_ATM_GET_CONFIG, /* get configuration */ - NGM_ATM_GET_VCCS, /* get a list of all active vccs */ - NGM_ATM_CPCS_INIT, /* start the channel */ - NGM_ATM_CPCS_TERM, /* stop the channel */ - NGM_ATM_GET_VCC, /* get VCC config */ - NGM_ATM_GET_VCCID, /* get VCC by VCI/VPI */ - NGM_ATM_GET_STATS, /* get global statistics */ - - /* messages from the node */ - NGM_ATM_CARRIER_CHANGE = 1000, /* UNUSED: carrier changed */ - NGM_ATM_VCC_CHANGE, /* permanent VCC changed */ - NGM_ATM_ACR_CHANGE, /* ABR ACR has changed */ - NGM_ATM_IF_CHANGE, /* interface state change */ -}; - -/* - * Hardware interface configuration - */ -struct ngm_atm_config { - uint32_t pcr; /* peak cell rate */ - uint32_t vpi_bits; /* number of active VPI bits */ - uint32_t vci_bits; /* number of active VCI bits */ - uint32_t max_vpcs; /* maximum number of VPCs */ - uint32_t max_vccs; /* maximum number of VCCs */ -}; -#define NGM_ATM_CONFIG_INFO \ - { \ - { "pcr", &ng_parse_uint32_type }, \ - { "vpi_bits", &ng_parse_uint32_type }, \ - { "vci_bits", &ng_parse_uint32_type }, \ - { "max_vpcs", &ng_parse_uint32_type }, \ - { "max_vccs", &ng_parse_uint32_type }, \ - { NULL } \ - } - -/* - * Information about an open VCC - * See net/if_atm.h. Keep in sync. - */ -#define NGM_ATM_TPARAM_INFO \ - { \ - { "pcr", &ng_parse_uint32_type }, \ - { "scr", &ng_parse_uint32_type }, \ - { "mbs", &ng_parse_uint32_type }, \ - { "mcr", &ng_parse_uint32_type }, \ - { "icr", &ng_parse_uint32_type }, \ - { "tbe", &ng_parse_uint32_type }, \ - { "nrm", &ng_parse_uint8_type }, \ - { "trm", &ng_parse_uint8_type }, \ - { "adtf", &ng_parse_uint16_type }, \ - { "rif", &ng_parse_uint8_type }, \ - { "rdf", &ng_parse_uint8_type }, \ - { "cdf", &ng_parse_uint8_type }, \ - { NULL } \ - } - -#define NGM_ATM_VCC_INFO \ - { \ - { "flags", &ng_parse_hint16_type }, \ - { "vpi", &ng_parse_uint16_type }, \ - { "vci", &ng_parse_uint16_type }, \ - { "rmtu", &ng_parse_uint16_type }, \ - { "tmtu", &ng_parse_uint16_type }, \ - { "aal", &ng_parse_uint8_type }, \ - { "traffic", &ng_parse_uint8_type }, \ - { "tparam", &ng_atm_tparam_type }, \ - { NULL } \ - } - -#define NGM_ATM_VCCARRAY_INFO \ - { \ - &ng_atm_vcc_type, \ - ng_atm_vccarray_getlen, \ - NULL \ - } - -#define NGM_ATM_VCCTABLE_INFO \ - { \ - { "count", &ng_parse_uint32_type }, \ - { "vccs", &ng_atm_vccarray_type }, \ - { NULL } \ - } - -/* - * Structure to open a VCC. - */ -struct ngm_atm_cpcs_init { - char name[NG_HOOKSIZ]; - uint32_t flags; /* flags. (if_atm.h) */ - uint16_t vci; /* VCI to open */ - uint16_t vpi; /* VPI to open */ - uint16_t rmtu; /* Receive maximum CPCS size */ - uint16_t tmtu; /* Transmit maximum CPCS size */ - uint8_t aal; /* AAL type (if_atm.h) */ - uint8_t traffic; /* traffic type (if_atm.h) */ - uint32_t pcr; /* Peak cell rate */ - uint32_t scr; /* VBR: Sustainable cell rate */ - uint32_t mbs; /* VBR: Maximum burst rate */ - uint32_t mcr; /* UBR+: Minimum cell rate */ - uint32_t icr; /* ABR: Initial cell rate */ - uint32_t tbe; /* ABR: Transmit buffer exposure */ - uint8_t nrm; /* ABR: Nrm */ - uint8_t trm; /* ABR: Trm */ - uint16_t adtf; /* ABR: ADTF */ - uint8_t rif; /* ABR: RIF */ - uint8_t rdf; /* ABR: RDF */ - uint8_t cdf; /* ABR: CDF */ -}; - -#define NGM_ATM_CPCS_INIT_INFO \ - { \ - { "name", &ng_parse_hookbuf_type }, \ - { "flags", &ng_parse_hint32_type }, \ - { "vci", &ng_parse_uint16_type }, \ - { "vpi", &ng_parse_uint16_type }, \ - { "rmtu", &ng_parse_uint16_type }, \ - { "tmtu", &ng_parse_uint16_type }, \ - { "aal", &ng_parse_uint8_type }, \ - { "traffic", &ng_parse_uint8_type }, \ - { "pcr", &ng_parse_uint32_type }, \ - { "scr", &ng_parse_uint32_type }, \ - { "mbs", &ng_parse_uint32_type }, \ - { "mcr", &ng_parse_uint32_type }, \ - { "icr", &ng_parse_uint32_type }, \ - { "tbe", &ng_parse_uint32_type }, \ - { "nrm", &ng_parse_uint8_type }, \ - { "trm", &ng_parse_uint8_type }, \ - { "adtf", &ng_parse_uint16_type }, \ - { "rif", &ng_parse_uint8_type }, \ - { "rdf", &ng_parse_uint8_type }, \ - { "cdf", &ng_parse_uint8_type }, \ - { NULL } \ - } - -/* - * Structure to close a VCI without disconnecting the hook - */ -struct ngm_atm_cpcs_term { - char name[NG_HOOKSIZ]; -}; -#define NGM_ATM_CPCS_TERM_INFO \ - { \ - { "name", &ng_parse_hookbuf_type }, \ - { NULL } \ - } - -struct ngm_atm_stats { - uint64_t in_packets; - uint64_t in_errors; - uint64_t out_packets; - uint64_t out_errors; -}; -#define NGM_ATM_STATS_INFO \ - { \ - { "in_packets", &ng_parse_uint64_type }, \ - { "in_errors", &ng_parse_uint64_type }, \ - { "out_packets", &ng_parse_uint64_type }, \ - { "out_errors", &ng_parse_uint64_type }, \ - { NULL } \ - } - -struct ngm_atm_if_change { - uint32_t node; - uint8_t carrier; - uint8_t running; -}; -#define NGM_ATM_IF_CHANGE_INFO \ - { \ - { "node", &ng_parse_hint32_type }, \ - { "carrier", &ng_parse_uint8_type }, \ - { "running", &ng_parse_uint8_type }, \ - { NULL } \ - } - -struct ngm_atm_vcc_change { - uint32_t node; - uint16_t vci; - uint8_t vpi; - uint8_t state; -}; -#define NGM_ATM_VCC_CHANGE_INFO \ - { \ - { "node", &ng_parse_hint32_type }, \ - { "vci", &ng_parse_uint16_type }, \ - { "vpi", &ng_parse_uint8_type }, \ - { "state", &ng_parse_uint8_type }, \ - { NULL } \ - } - -struct ngm_atm_acr_change { - uint32_t node; - uint16_t vci; - uint8_t vpi; - uint32_t acr; -}; -#define NGM_ATM_ACR_CHANGE_INFO \ - { \ - { "node", &ng_parse_hint32_type }, \ - { "vci", &ng_parse_uint16_type }, \ - { "vpi", &ng_parse_uint8_type }, \ - { "acr", &ng_parse_uint32_type }, \ - { NULL } \ - } - -#endif /* _NETGRAPH_ATM_NG_ATM_H */ diff --git a/sys/netgraph/ng_atmllc.c b/sys/netgraph/ng_atmllc.c index f35707b90b6d..9cfd43cdd0a9 100644 --- a/sys/netgraph/ng_atmllc.c +++ b/sys/netgraph/ng_atmllc.c @@ -40,7 +40,6 @@ #include #include /* for M_HASFCS and ETHER_HDR_LEN */ -#include /* for struct atmllc */ #define NG_ATMLLC_HEADER "\252\252\3\0\200\302" #define NG_ATMLLC_HEADER_LEN (sizeof(struct atmllc)) @@ -55,6 +54,18 @@ struct ng_atmllc_priv { hook_p fddi; }; +struct atmllc { + uint8_t llchdr[6]; /* aa.aa.03.00.00.00 */ + uint8_t type[2]; /* "ethernet" type */ +}; + +/* ATM_LLC macros: note type code in host byte order */ +#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) +#define ATM_LLC_SETTYPE(X, V) do { \ + (X)->type[0] = ((V) >> 8) & 0xff; \ + (X)->type[1] = ((V) & 0xff); \ + } while (0) + /* Netgraph methods. */ static ng_constructor_t ng_atmllc_constructor; static ng_shutdown_t ng_atmllc_shutdown; diff --git a/sys/netinet/if_atm.c b/sys/netinet/if_atm.c deleted file mode 100644 index e2b71a8b501c..000000000000 --- a/sys/netinet/if_atm.c +++ /dev/null @@ -1,372 +0,0 @@ -/* $NetBSD: if_atm.c,v 1.6 1996/10/13 02:03:01 christos Exp $ */ - -/*- - * - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include -__FBSDID("$FreeBSD$"); - -/* - * IP <=> ATM address resolution. - */ -#include "opt_inet.h" -#include "opt_inet6.h" -#include "opt_natm.h" - -#if defined(INET) || defined(INET6) - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#ifdef NATM -#include -#endif - -#define SDL(s) ((struct sockaddr_dl *)s) - -#define GET3BYTE(V, A, L) do { \ - (V) = ((A)[0] << 16) | ((A)[1] << 8) | (A)[2]; \ - (A) += 3; \ - (L) -= 3; \ - } while (0) - -#define GET2BYTE(V, A, L) do { \ - (V) = ((A)[0] << 8) | (A)[1]; \ - (A) += 2; \ - (L) -= 2; \ - } while (0) - -#define GET1BYTE(V, A, L) do { \ - (V) = *(A)++; \ - (L)--; \ - } while (0) - - -/* - * atm_rtrequest: handle ATM rt request (in support of generic code) - * inputs: "req" = request code - * "rt" = route entry - * "info" = rt_addrinfo - */ -void -atm_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) -{ - struct sockaddr *gate = rt->rt_gateway; - struct atmio_openvcc op; - struct atmio_closevcc cl; - u_char *addr; - u_int alen; -#ifdef NATM - struct sockaddr_in *sin; - struct natmpcb *npcb = NULL; -#endif - static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; - - if (rt->rt_flags & RTF_GATEWAY) /* link level requests only */ - return; - - switch (req) { - - case RTM_RESOLVE: /* resolve: only happens when cloning */ - printf("atm_rtrequest: RTM_RESOLVE request detected?\n"); - break; - - case RTM_ADD: - /* - * route added by a command (e.g. ifconfig, route, arp...). - * - * first check to see if this is not a host route, in which - * case we are being called via "ifconfig" to set the address. - */ - if ((rt->rt_flags & RTF_HOST) == 0) { - rt_setgate(rt,rt_key(rt),(struct sockaddr *)&null_sdl); - gate = rt->rt_gateway; - SDL(gate)->sdl_type = rt->rt_ifp->if_type; - SDL(gate)->sdl_index = rt->rt_ifp->if_index; - break; - } - - if (gate->sa_family != AF_LINK || - gate->sa_len < sizeof(null_sdl)) { - log(LOG_DEBUG, "atm_rtrequest: bad gateway value"); - break; - } - - KASSERT(rt->rt_ifp->if_ioctl != NULL, - ("atm_rtrequest: null ioctl")); - - /* - * Parse and verify the link level address as - * an open request - */ -#ifdef NATM - NATM_LOCK(); -#endif - bzero(&op, sizeof(op)); - addr = LLADDR(SDL(gate)); - alen = SDL(gate)->sdl_alen; - if (alen < 4) { - printf("%s: bad link-level address\n", __func__); - goto failed; - } - - if (alen == 4) { - /* old type address */ - GET1BYTE(op.param.flags, addr, alen); - GET1BYTE(op.param.vpi, addr, alen); - GET2BYTE(op.param.vci, addr, alen); - op.param.traffic = ATMIO_TRAFFIC_UBR; - op.param.aal = (op.param.flags & ATM_PH_AAL5) ? - ATMIO_AAL_5 : ATMIO_AAL_0; - } else { - /* new address */ - op.param.aal = ATMIO_AAL_5; - - GET1BYTE(op.param.flags, addr, alen); - op.param.flags &= ATM_PH_LLCSNAP; - - GET1BYTE(op.param.vpi, addr, alen); - GET2BYTE(op.param.vci, addr, alen); - - GET1BYTE(op.param.traffic, addr, alen); - - switch (op.param.traffic) { - - case ATMIO_TRAFFIC_UBR: - if (alen >= 3) - GET3BYTE(op.param.tparam.pcr, - addr, alen); - break; - - case ATMIO_TRAFFIC_CBR: - if (alen < 3) - goto bad_param; - GET3BYTE(op.param.tparam.pcr, addr, alen); - break; - - case ATMIO_TRAFFIC_VBR: - if (alen < 3 * 3) - goto bad_param; - GET3BYTE(op.param.tparam.pcr, addr, alen); - GET3BYTE(op.param.tparam.scr, addr, alen); - GET3BYTE(op.param.tparam.mbs, addr, alen); - break; - - case ATMIO_TRAFFIC_ABR: - if (alen < 4 * 3 + 2 + 1 * 2 + 3) - goto bad_param; - GET3BYTE(op.param.tparam.pcr, addr, alen); - GET3BYTE(op.param.tparam.mcr, addr, alen); - GET3BYTE(op.param.tparam.icr, addr, alen); - GET3BYTE(op.param.tparam.tbe, addr, alen); - GET1BYTE(op.param.tparam.nrm, addr, alen); - GET1BYTE(op.param.tparam.trm, addr, alen); - GET2BYTE(op.param.tparam.adtf, addr, alen); - GET1BYTE(op.param.tparam.rif, addr, alen); - GET1BYTE(op.param.tparam.rdf, addr, alen); - GET1BYTE(op.param.tparam.cdf, addr, alen); - break; - - default: - bad_param: - printf("%s: bad traffic params\n", __func__); - goto failed; - } - } - op.param.rmtu = op.param.tmtu = rt->rt_ifp->if_mtu; -#ifdef NATM - /* - * let native ATM know we are using this VCI/VPI - * (i.e. reserve it) - */ - sin = (struct sockaddr_in *) rt_key(rt); - if (sin->sin_family != AF_INET) - goto failed; - npcb = npcb_add(NULL, rt->rt_ifp, op.param.vci, op.param.vpi); - if (npcb == NULL) - goto failed; - npcb->npcb_flags |= NPCB_IP; - npcb->ipaddr.s_addr = sin->sin_addr.s_addr; - /* XXX: move npcb to llinfo when ATM ARP is ready */ -#ifdef __notyet_restored__ - rt->rt_llinfo = (caddr_t) npcb; -#endif - rt->rt_flags |= RTF_LLINFO; -#endif - /* - * let the lower level know this circuit is active - */ - op.rxhand = NULL; - op.param.flags |= ATMIO_FLAG_ASYNC; - if (rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMOPENVCC, - (caddr_t)&op) != 0) { - printf("atm: couldn't add VC\n"); - goto failed; - } - - SDL(gate)->sdl_type = rt->rt_ifp->if_type; - SDL(gate)->sdl_index = rt->rt_ifp->if_index; - -#ifdef NATM - NATM_UNLOCK(); -#endif - break; - -failed: -#ifdef NATM - if (npcb) { - npcb_free(npcb, NPCB_DESTROY); -#ifdef __notyet_restored__ - rt->rt_llinfo = NULL; -#endif - rt->rt_flags &= ~RTF_LLINFO; - } - NATM_UNLOCK(); -#endif - /* mark as invalid. We cannot RTM_DELETE the route from - * here, because the recursive call to rtrequest1 does - * not really work. */ - rt->rt_flags |= RTF_REJECT; - break; - - case RTM_DELETE: -#ifdef NATM - /* - * tell native ATM we are done with this VC - */ - if (rt->rt_flags & RTF_LLINFO) { - NATM_LOCK(); -#ifdef __notyet_restored__ - npcb_free((struct natmpcb *)rt->rt_llinfo, - NPCB_DESTROY); - rt->rt_llinfo = NULL; -#endif - rt->rt_flags &= ~RTF_LLINFO; - NATM_UNLOCK(); - } -#endif - /* - * tell the lower layer to disable this circuit - */ - bzero(&op, sizeof(op)); - addr = LLADDR(SDL(gate)); - addr++; - cl.vpi = *addr++; - cl.vci = *addr++ << 8; - cl.vci |= *addr++; - (void)rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMCLOSEVCC, - (caddr_t)&cl); - break; - } -} - -/* - * atmresolve: - * inputs: - * [1] "rt" = the link level route to use (or null if need to look one up) - * [2] "m" = mbuf containing the data to be sent - * [3] "dst" = sockaddr_in (IP) address of dest. - * output: - * [4] "desten" = ATM pseudo header which we will fill in VPI/VCI info - * return: - * 0 == resolve FAILED; note that "m" gets m_freem'd in this case - * 1 == resolve OK; desten contains result - * - * XXX: will need more work if we wish to support ATMARP in the kernel, - * but this is enough for PVCs entered via the "route" command. - */ -int -atmresolve(struct rtentry *rt, struct mbuf *m, const struct sockaddr *dst, - struct atm_pseudohdr *desten) -{ - struct sockaddr_dl *sdl; - - if (m->m_flags & (M_BCAST | M_MCAST)) { - log(LOG_INFO, - "atmresolve: BCAST/MCAST packet detected/dumped\n"); - goto bad; - } - - if (rt == NULL) { - /* link level on table 0 XXX MRT */ - rt = RTALLOC1(__DECONST(struct sockaddr *, dst), 0); - if (rt == NULL) - goto bad; /* failed */ - RT_REMREF(rt); /* don't keep LL references */ - if ((rt->rt_flags & RTF_GATEWAY) != 0 || - rt->rt_gateway->sa_family != AF_LINK) { - RT_UNLOCK(rt); - goto bad; - } - RT_UNLOCK(rt); - } - - /* - * note that rt_gateway is a sockaddr_dl which contains the - * atm_pseudohdr data structure for this route. we currently - * don't need any rt_llinfo info (but will if we want to support - * ATM ARP [c.f. if_ether.c]). - */ - sdl = SDL(rt->rt_gateway); - - /* - * Check the address family and length is valid, the address - * is resolved; otherwise, try to resolve. - */ - if (sdl->sdl_family == AF_LINK && sdl->sdl_alen >= sizeof(*desten)) { - bcopy(LLADDR(sdl), desten, sizeof(*desten)); - return (1); /* ok, go for it! */ - } - - /* - * we got an entry, but it doesn't have valid link address - * info in it (it is prob. the interface route, which has - * sdl_alen == 0). dump packet. (fall through to "bad"). - */ -bad: - m_freem(m); - return (0); -} -#endif /* INET */ diff --git a/sys/netinet/if_atm.h b/sys/netinet/if_atm.h deleted file mode 100644 index 04ad218d82c3..000000000000 --- a/sys/netinet/if_atm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: if_atm.h,v 1.2 1996/07/03 17:17:17 chuck Exp $ */ - -/*- - * - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * if_atm.h - */ - -struct atm_pseudohdr; -struct mbuf; -struct rtentry; -struct sockaddr; - -void atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *); -int atmresolve(struct rtentry *, struct mbuf *, const struct sockaddr *, - struct atm_pseudohdr *); diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c deleted file mode 100644 index 56b8539941a6..000000000000 --- a/sys/netnatm/natm.c +++ /dev/null @@ -1,490 +0,0 @@ -/*- - * Copyright (c) 2005-2006 Robert N. M. Watson - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: natm.c,v 1.5 1996/11/09 03:26:26 chuck Exp $ - */ - -/* - * natm.c: Native mode ATM access (both aal0 and aal5). - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include - -static const u_long natm5_sendspace = 16*1024; -static const u_long natm5_recvspace = 16*1024; - -static const u_long natm0_sendspace = 16*1024; -static const u_long natm0_recvspace = 16*1024; - -/* - * netnatm global subsystem lock, protects all global data structures in - * netnatm. - */ -struct mtx natm_mtx; - -/* - * User socket requests. - */ -static int natm_usr_attach(struct socket *, int, struct thread *); -static void natm_usr_detach(struct socket *); -static int natm_usr_connect(struct socket *, struct sockaddr *, - struct thread *); -static int natm_usr_disconnect(struct socket *); -static int natm_usr_shutdown(struct socket *); -static int natm_usr_send(struct socket *, int, struct mbuf *, - struct sockaddr *, struct mbuf *, struct thread *); -static int natm_usr_peeraddr(struct socket *, struct sockaddr **); -static int natm_usr_control(struct socket *, u_long, caddr_t, - struct ifnet *, struct thread *); -static void natm_usr_abort(struct socket *); -static int natm_usr_bind(struct socket *, struct sockaddr *, - struct thread *); -static int natm_usr_sockaddr(struct socket *, struct sockaddr **); - -static int -natm_usr_attach(struct socket *so, int proto, struct thread *p) -{ - struct natmpcb *npcb; - int error = 0; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb == NULL, ("natm_usr_attach: so_pcb != NULL")); - - if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { - if (proto == PROTO_NATMAAL5) - error = soreserve(so, natm5_sendspace, - natm5_recvspace); - else - error = soreserve(so, natm0_sendspace, - natm0_recvspace); - if (error) - return (error); - } - so->so_pcb = npcb = npcb_alloc(M_WAITOK); - npcb->npcb_socket = so; - return (error); -} - -static void -natm_usr_detach(struct socket *so) -{ - struct natmpcb *npcb; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_detach: npcb == NULL")); - - NATM_LOCK(); - npcb_free(npcb, NPCB_DESTROY); /* drain */ - so->so_pcb = NULL; - NATM_UNLOCK(); -} - -static int -natm_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *p) -{ - struct natmpcb *npcb; - struct sockaddr_natm *snatm; - struct atmio_openvcc op; - struct ifnet *ifp; - int error = 0; - int proto = so->so_proto->pr_protocol; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_connect: npcb == NULL")); - - /* - * Validate nam and npcb. - */ - NATM_LOCK(); - snatm = (struct sockaddr_natm *)nam; - if (snatm->snatm_len != sizeof(*snatm) || - (npcb->npcb_flags & NPCB_FREE) == 0) { - NATM_UNLOCK(); - return (EINVAL); - } - if (snatm->snatm_family != AF_NATM) { - NATM_UNLOCK(); - return (EAFNOSUPPORT); - } - - snatm->snatm_if[IFNAMSIZ - 1] = '\0'; /* XXX ensure null termination - since ifunit() uses strcmp */ - - /* - * Convert interface string to ifp, validate. - */ - ifp = ifunit(snatm->snatm_if); - if (ifp == NULL || (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - NATM_UNLOCK(); - return (ENXIO); - } - if (ifp->if_output != atm_output) { - NATM_UNLOCK(); - return (EAFNOSUPPORT); - } - - /* - * Register us with the NATM PCB layer. - */ - if (npcb_add(npcb, ifp, snatm->snatm_vci, snatm->snatm_vpi) != npcb) { - NATM_UNLOCK(); - return (EADDRINUSE); - } - - /* - * Open the channel. - * - * XXXRW: Eventually desirable to hold mutex over ioctl? - */ - bzero(&op, sizeof(op)); - op.rxhand = npcb; - op.param.flags = ATMIO_FLAG_PVC; - op.param.vpi = npcb->npcb_vpi; - op.param.vci = npcb->npcb_vci; - op.param.rmtu = op.param.tmtu = ifp->if_mtu; - op.param.aal = (proto == PROTO_NATMAAL5) ? ATMIO_AAL_5 : ATMIO_AAL_0; - op.param.traffic = ATMIO_TRAFFIC_UBR; - NATM_UNLOCK(); - - if (ifp->if_ioctl == NULL || - ifp->if_ioctl(ifp, SIOCATMOPENVCC, (caddr_t)&op) != 0) - return (EIO); - soisconnected(so); - return (error); -} - -static int -natm_usr_disconnect(struct socket *so) -{ - struct natmpcb *npcb; - struct atmio_closevcc cl; - struct ifnet *ifp; - int error = 0; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_disconnect: npcb == NULL")); - - NATM_LOCK(); - if ((npcb->npcb_flags & NPCB_CONNECTED) == 0) { - NATM_UNLOCK(); - printf("natm: disconnected check\n"); - return (EIO); - } - ifp = npcb->npcb_ifp; - - /* - * Disable rx. - * - * XXXRW: Eventually desirable to hold mutex over ioctl? - */ - cl.vpi = npcb->npcb_vpi; - cl.vci = npcb->npcb_vci; - NATM_UNLOCK(); - if (ifp->if_ioctl != NULL) - ifp->if_ioctl(ifp, SIOCATMCLOSEVCC, (caddr_t)&cl); - soisdisconnected(so); - return (error); -} - -static int -natm_usr_shutdown(struct socket *so) -{ - - socantsendmore(so); - return (0); -} - -static int -natm_usr_send(struct socket *so, int flags, struct mbuf *m, - struct sockaddr *nam, struct mbuf *control, struct thread *p) -{ - struct natmpcb *npcb; - struct atm_pseudohdr *aph; - int error = 0; - int proto = so->so_proto->pr_protocol; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_send: npcb == NULL")); - - NATM_LOCK(); - if (control && control->m_len) { - NATM_UNLOCK(); - m_freem(control); - m_freem(m); - return (EINVAL); - } - - /* - * Send the data. We must put an atm_pseudohdr on first. - */ - M_PREPEND(m, sizeof(*aph), M_NOWAIT); - if (m == NULL) { - NATM_UNLOCK(); - m_freem(control); - return (ENOBUFS); - } - aph = mtod(m, struct atm_pseudohdr *); - ATM_PH_VPI(aph) = npcb->npcb_vpi; - ATM_PH_SETVCI(aph, npcb->npcb_vci); - ATM_PH_FLAGS(aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0; - error = atm_output(npcb->npcb_ifp, m, NULL, NULL); - NATM_UNLOCK(); - return (error); -} - -static int -natm_usr_peeraddr(struct socket *so, struct sockaddr **nam) -{ - struct natmpcb *npcb; - struct sockaddr_natm *snatm, ssnatm; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_peeraddr: npcb == NULL")); - - NATM_LOCK(); - snatm = &ssnatm; - bzero(snatm, sizeof(*snatm)); - snatm->snatm_len = sizeof(*snatm); - snatm->snatm_family = AF_NATM; - strlcpy(snatm->snatm_if, npcb->npcb_ifp->if_xname, - sizeof(snatm->snatm_if)); - snatm->snatm_vci = npcb->npcb_vci; - snatm->snatm_vpi = npcb->npcb_vpi; - NATM_UNLOCK(); - *nam = sodupsockaddr((struct sockaddr *)snatm, M_WAITOK); - return (0); -} - -static int -natm_usr_control(struct socket *so, u_long cmd, caddr_t arg, - struct ifnet *ifp, struct thread *p) -{ - struct natmpcb *npcb; - - npcb = (struct natmpcb *)so->so_pcb; - KASSERT(npcb != NULL, ("natm_usr_control: npcb == NULL")); - - switch (cmd) { - case SIOCSIFADDR: - case SIOCSIFBRDADDR: - case SIOCSIFDSTADDR: - case SIOCSIFNETMASK: - /* - * Although we should pass any non-ATM ioctl requests - * down to driver, we filter some legacy INET requests. - * Drivers trust SIOCSIFADDR et al to come from an already - * privileged layer, and do not perform any credentials - * checks or input validation. - */ - return (EINVAL); - } - - if (ifp == NULL || ifp->if_ioctl == NULL) - return (EOPNOTSUPP); - return ((*ifp->if_ioctl)(ifp, cmd, arg)); -} - -static void -natm_usr_abort(struct socket *so) -{ - -} - -static void -natm_usr_close(struct socket *so) -{ - -} - -static int -natm_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *p) -{ - - return (EOPNOTSUPP); -} - -static int -natm_usr_sockaddr(struct socket *so, struct sockaddr **nam) -{ - - return (EOPNOTSUPP); -} - -/* xxx - should be const */ -struct pr_usrreqs natm_usrreqs = { - .pru_abort = natm_usr_abort, - .pru_attach = natm_usr_attach, - .pru_bind = natm_usr_bind, - .pru_connect = natm_usr_connect, - .pru_control = natm_usr_control, - .pru_detach = natm_usr_detach, - .pru_disconnect = natm_usr_disconnect, - .pru_peeraddr = natm_usr_peeraddr, - .pru_send = natm_usr_send, - .pru_shutdown = natm_usr_shutdown, - .pru_sockaddr = natm_usr_sockaddr, - .pru_close = natm_usr_close, -}; - -/* - * natmintr: interrupt - * - * Note: we expect a socket pointer in rcvif rather than an interface - * pointer. We can get the interface pointer from the so's PCB if we really - * need it. - */ -void -natmintr(struct mbuf *m) -{ - struct socket *so; - struct natmpcb *npcb; - -#ifdef DIAGNOSTIC - M_ASSERTPKTHDR(m); -#endif - - NATM_LOCK(); - npcb = (struct natmpcb *)m->m_pkthdr.rcvif; /* XXX: overloaded */ - so = npcb->npcb_socket; - - npcb->npcb_inq--; - - if (npcb->npcb_flags & NPCB_DRAIN) { - if (npcb->npcb_inq == 0) - free(npcb, M_PCB); /* done! */ - NATM_UNLOCK(); - m_freem(m); - return; - } - - if (npcb->npcb_flags & NPCB_FREE) { - NATM_UNLOCK(); - m_freem(m); /* drop */ - return; - } - -#ifdef NEED_TO_RESTORE_IFP - m->m_pkthdr.rcvif = npcb->npcb_ifp; -#else -#ifdef DIAGNOSTIC - m->m_pkthdr.rcvif = NULL; /* null it out to be safe */ -#endif -#endif - - if (sbspace(&so->so_rcv) > m->m_pkthdr.len) { -#ifdef NATM_STAT - natm_sookcnt++; - natm_sookbytes += m->m_pkthdr.len; -#endif - sbappendrecord(&so->so_rcv, m); - sorwakeup(so); - NATM_UNLOCK(); - } else { -#ifdef NATM_STAT - natm_sodropcnt++; - natm_sodropbytes += m->m_pkthdr.len; -#endif - NATM_UNLOCK(); - m_freem(m); - } -} - -/* - * natm0_sysctl: not used, but here in case we want to add something - * later... - */ -int -natm0_sysctl(SYSCTL_HANDLER_ARGS) -{ - - /* All sysctl names at this level are terminal. */ - return (ENOENT); -} - -/* - * natm5_sysctl: not used, but here in case we want to add something - * later... - */ -int -natm5_sysctl(SYSCTL_HANDLER_ARGS) -{ - - /* All sysctl names at this level are terminal. */ - return (ENOENT); -} diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h deleted file mode 100644 index 5603b9e77d57..000000000000 --- a/sys/netnatm/natm.h +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: natm.h,v 1.1 1996/07/04 03:20:12 chuck Exp $ - * $FreeBSD$ - */ - -/* - * natm.h: native mode atm - */ - -/* - * supported protocols - */ -#define PROTO_NATMAAL0 1 -#define PROTO_NATMAAL5 2 - -/* - * sockaddr_natm - */ - -struct sockaddr_natm { - unsigned char snatm_len; /* length */ - sa_family_t snatm_family; /* AF_NATM */ - char snatm_if[IFNAMSIZ]; /* interface name */ - u_int16_t snatm_vci; /* vci */ - u_int8_t snatm_vpi; /* vpi */ -}; - -#ifdef _KERNEL - -/* - * natm protocol control block - */ -struct natmpcb { - LIST_ENTRY(natmpcb) pcblist; /* list pointers */ - u_int npcb_inq; /* # of our pkts in proto q */ - struct socket *npcb_socket; /* backpointer to socket */ - struct ifnet *npcb_ifp; /* pointer to hardware */ - struct in_addr ipaddr; /* remote IP address, if APCB_IP */ - u_int16_t npcb_vci; /* VCI */ - u_int8_t npcb_vpi; /* VPI */ - u_int8_t npcb_flags; /* flags */ -}; - -/* flags */ -#define NPCB_FREE 0x01 /* free (not on any list) */ -#define NPCB_CONNECTED 0x02 /* connected */ -#define NPCB_IP 0x04 /* used by IP */ -#define NPCB_DRAIN 0x08 /* destroy as soon as inq == 0 */ - -/* flag arg to npcb_free */ -#define NPCB_REMOVE 0 /* remove from global list */ -#define NPCB_DESTROY 1 /* destroy and be free */ - -LIST_HEAD(npcblist, natmpcb); - -/* global data structures */ - -extern struct mtx natm_mtx; /* global netnatm lock */ -extern struct npcblist natm_pcbs; /* global list of pcbs */ -#define NATM_STAT -#ifdef NATM_STAT -extern u_int natm_sodropcnt; -extern u_int natm_sodropbytes; /* account of droppage */ -extern u_int natm_sookcnt; -extern u_int natm_sookbytes; /* account of ok */ -#endif - -/* locking macros */ -#define NATM_LOCK_INIT() mtx_init(&natm_mtx, "natm_mtx", NULL, MTX_DEF) -#define NATM_LOCK() mtx_lock(&natm_mtx) -#define NATM_UNLOCK() mtx_unlock(&natm_mtx) -#define NATM_LOCK_ASSERT() mtx_assert(&natm_mtx, MA_OWNED) - -/* external functions */ - -/* natm_pcb.c */ -struct natmpcb *npcb_alloc(int); -void npcb_free(struct natmpcb *, int); -struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, uint16_t, uint8_t); - -/* natm.c */ -extern struct pr_usrreqs natm_usrreqs; - -#ifdef SYSCTL_HANDLER_ARGS -int natm0_sysctl(SYSCTL_HANDLER_ARGS); -int natm5_sysctl(SYSCTL_HANDLER_ARGS); -#endif - -void natmintr(struct mbuf *); - -#endif diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c deleted file mode 100644 index 602d438ea51e..000000000000 --- a/sys/netnatm/natm_pcb.c +++ /dev/null @@ -1,167 +0,0 @@ -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: natm_pcb.c,v 1.4 1996/11/09 03:26:27 chuck Exp $ - */ - -/* - * atm_pcb.c: manage atm protocol control blocks and keep IP and NATM - * from trying to use each other's VCs. - */ - -#include "opt_ddb.h" - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include /* XXX: db_show_natm() */ - -#include - -#include - -#include - -struct npcblist natm_pcbs; - -/* - * npcb_alloc: allocate a npcb [in the free state] - */ -struct natmpcb * -npcb_alloc(int wait) - -{ - struct natmpcb *npcb; - - npcb = malloc(sizeof(*npcb), M_PCB, wait | M_ZERO); - if (npcb != NULL) - npcb->npcb_flags = NPCB_FREE; - return (npcb); -} - - -/* - * npcb_free: free a npcb - */ -void -npcb_free(struct natmpcb *npcb, int op) -{ - - NATM_LOCK_ASSERT(); - - if ((npcb->npcb_flags & NPCB_FREE) == 0) { - LIST_REMOVE(npcb, pcblist); - npcb->npcb_flags = NPCB_FREE; - } - if (op == NPCB_DESTROY) { - if (npcb->npcb_inq) { - npcb->npcb_flags = NPCB_DRAIN; /* flag for distruct. */ - } else { - free(npcb, M_PCB); /* kill it! */ - } - } -} - - -/* - * npcb_add: add or remove npcb from main list - * returns npcb if ok - */ -struct natmpcb * -npcb_add(struct natmpcb *npcb, struct ifnet *ifp, u_int16_t vci, u_int8_t vpi) -{ - struct natmpcb *cpcb = NULL; /* current pcb */ - - NATM_LOCK_ASSERT(); - - /* - * lookup required - */ - LIST_FOREACH(cpcb, &natm_pcbs, pcblist) - if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && - vpi == cpcb->npcb_vpi) - break; - - /* - * add & something already there? - */ - if (cpcb) { - cpcb = NULL; - goto done; /* fail */ - } - - /* - * need to allocate a pcb? - */ - if (npcb == NULL) { - /* could be called from lower half */ - cpcb = npcb_alloc(M_NOWAIT); - if (cpcb == NULL) - goto done; /* fail */ - } else { - cpcb = npcb; - } - - cpcb->npcb_ifp = ifp; - cpcb->ipaddr.s_addr = 0; - cpcb->npcb_vci = vci; - cpcb->npcb_vpi = vpi; - cpcb->npcb_flags = NPCB_CONNECTED; - - LIST_INSERT_HEAD(&natm_pcbs, cpcb, pcblist); - -done: - return (cpcb); -} - -#ifdef DDB -DB_SHOW_COMMAND(natm, db_show_natm) -{ - struct natmpcb *cpcb; - - db_printf("npcb dump:\n"); - LIST_FOREACH(cpcb, &natm_pcbs, pcblist) { - db_printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, " - "flags=0x%x, inq=%d\n", cpcb->npcb_ifp->if_xname, - cpcb->npcb_vci, cpcb->npcb_vpi, cpcb->ipaddr.s_addr, - cpcb->npcb_socket, cpcb->npcb_flags, cpcb->npcb_inq); - } -} -#endif diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c deleted file mode 100644 index aa7fa2cd8511..000000000000 --- a/sys/netnatm/natm_proto.c +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 1996 Charles D. Cranor and Washington University. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Charles D. Cranor and - * Washington University. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: natm_proto.c,v 1.3 1996/09/18 00:56:41 chuck Exp $ - */ - -/* - * protocol layer for access to native mode ATM - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - -static void natm_init(void); - -static struct domain natmdomain; - -static struct protosw natmsw[] = { -{ - .pr_type = SOCK_STREAM, - .pr_domain = &natmdomain, - .pr_protocol = PROTO_NATMAAL5, - .pr_flags = PR_CONNREQUIRED, - .pr_usrreqs = &natm_usrreqs -}, -{ - .pr_type = SOCK_DGRAM, - .pr_domain = &natmdomain, - .pr_protocol = PROTO_NATMAAL5, - .pr_flags = PR_CONNREQUIRED|PR_ATOMIC, - .pr_usrreqs = &natm_usrreqs -}, -{ - .pr_type = SOCK_STREAM, - .pr_domain = &natmdomain, - .pr_protocol = PROTO_NATMAAL0, - .pr_flags = PR_CONNREQUIRED, - .pr_usrreqs = &natm_usrreqs -}, -}; - -static struct domain natmdomain = { - .dom_family = AF_NATM, - .dom_name = "natm", - .dom_init = natm_init, - .dom_protosw = natmsw, - .dom_protoswNPROTOSW = &natmsw[nitems(natmsw)], -}; - -static struct netisr_handler natm_nh = { - .nh_name = "natm", - .nh_handler = natmintr, - .nh_proto = NETISR_NATM, - .nh_qlimit = 1000, - .nh_policy = NETISR_POLICY_SOURCE, -}; - -#ifdef NATM_STAT -u_int natm_sodropcnt; /* # mbufs dropped due to full sb */ -u_int natm_sodropbytes; /* # of bytes dropped */ -u_int natm_sookcnt; /* # mbufs ok */ -u_int natm_sookbytes; /* # of bytes ok */ -#endif - -static void -natm_init(void) -{ - LIST_INIT(&natm_pcbs); - NATM_LOCK_INIT(); - netisr_register(&natm_nh); -} - -DOMAIN_SET(natm); diff --git a/sys/sys/param.h b/sys/sys/param.h index 12a1f9fab20a..db976774c7c0 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200029 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200030 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/usr.sbin/bsnmpd/modules/Makefile b/usr.sbin/bsnmpd/modules/Makefile index 60c253b71875..6640bb62d112 100644 --- a/usr.sbin/bsnmpd/modules/Makefile +++ b/usr.sbin/bsnmpd/modules/Makefile @@ -4,11 +4,7 @@ .PATH: ${SRCTOP}/contrib/bsnmp/snmpd -.if ${MK_ATM} != "no" -_snmp_atm= snmp_atm -.endif - -SUBDIR= ${_snmp_atm} \ +SUBDIR= \ snmp_bridge \ snmp_hostres \ snmp_lm75 \ diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt deleted file mode 100644 index f2887418e212..000000000000 --- a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt +++ /dev/null @@ -1,101 +0,0 @@ --- --- Copyright (c) 2004 --- Hartmut Brandt. --- All rights reserved. --- --- Author: Hartmut Brandt --- --- 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND --- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE --- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE --- ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE --- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL --- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS --- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) --- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT --- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY --- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF --- SUCH DAMAGE. --- --- $FreeBSD$ --- --- Private Begemot MIB for ATM interfaces on FreeBSD --- -BEGEMOT-ATM-FREEBSD-MIB DEFINITIONS ::= BEGIN - -IMPORTS - MODULE-IDENTITY, OBJECT-TYPE - FROM SNMPv2-SMI - NgNodeIdOrZero - FROM BEGEMOT-NETGRAPH-MIB - begemotAtmSysGroup, begemotAtmIfEntry - FROM BEGEMOT-ATM-MIB; - -begemotAtmFreeBSDGroup MODULE-IDENTITY - LAST-UPDATED "200408060000Z" - ORGANIZATION "German Aerospace Centre" - CONTACT-INFO - " Hartmut Brandt - - Postal: German Aerospace Centre (DLR) - Institute of Communications and Navigation - 82234 Wessling - Germany - - Fax: +49 8153 28 2844 - - E-mail: harti@freebsd.org" - DESCRIPTION - "The FreeBSD specific Begemot MIB for ATM interfaces." - REVISION "200408060000Z" - DESCRIPTION - "Initial revision." - ::= { begemotAtmSysGroup 1 } - --- Netgraph -begemotAtmNgGroup OBJECT IDENTIFIER ::= { begemotAtmFreeBSDGroup 1 } - --- --- Interfaces table --- -begemotAtmNgIfTable OBJECT-TYPE - SYNTAX SEQUENCE OF BegemotAtmNgIfEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION - "This table contains an entry for each hardware ATM - interface. The table is indexed by the interface index." - ::= { begemotAtmNgGroup 1 } - -begemotAtmNgIfEntry OBJECT-TYPE - SYNTAX BegemotAtmNgIfEntry - MAX-ACCESS not-accessible - STATUS current - DESCRIPTION - "This is a table entry describing one ATM hardware interface." - AUGMENTS { begemotAtmIfEntry } - ::= { begemotAtmNgIfTable 1 } - -BegemotAtmNgIfEntry ::= SEQUENCE { - begemotAtmNgIfNodeId NgNodeIdOrZero -} - -begemotAtmNgIfNodeId OBJECT-TYPE - SYNTAX NgNodeIdOrZero - MAX-ACCESS read-only - STATUS current - DESCRIPTION - "The netgraph node id of the interface. If there is no - node corresponding to the interface, this is 0." - ::= { begemotAtmNgIfEntry 1 } - -END diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile deleted file mode 100644 index 82bd325dcaa3..000000000000 --- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ -# -# Author: Harti Brandt - -CONTRIB= ${SRCTOP}/contrib/ngatm -.PATH: ${CONTRIB}/snmp_atm - -MOD= atm -SRCS= snmp_atm.c atm_sys.c -XSYM= begemotAtm -MAN= snmp_atm.3 - -BMIBS= BEGEMOT-ATM.txt BEGEMOT-ATM-FREEBSD-MIB.txt -DEFS= ${MOD}_tree.def atm_freebsd.def -INCS= snmp_${MOD}.h - -EXTRAMIBDEFS= atm_freebsd.def - -CFLAGS+= -I${CONTRIB}/snmp_atm - -.include diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend deleted file mode 100644 index 0d3689874fa8..000000000000 --- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - gnu/lib/libgcc \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libbsnmp/libbsnmp \ - lib/libc \ - lib/libcompiler_rt \ - usr.sbin/bsnmpd/modules \ - usr.sbin/bsnmpd/modules/snmp_mibII \ - usr.sbin/bsnmpd/modules/snmp_netgraph \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def b/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def deleted file mode 100644 index 6cc61d012184..000000000000 --- a/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (c) 2004 -# Hartmut Brandt. -# All rights reserved. -# -# Author: Hartmut Brandt -# -# 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# -# SNMP module for ATM hardware interfaces. -# -# $Begemot: libunimsg/snmp_atm/atm_tree.def,v 1.2 2004/08/05 07:14:22 brandt Exp $ -# -(1 internet - (4 private - (1 enterprises - (12325 fokus - (1 begemot - (101 begemotAtm - (1 begemotAtmObjects - (4 begemotAtmSysGroup - (1 begemotAtmFreeBSDGroup - (1 begemotAtmNgGroup - (1 begemotAtmNgIfTable - (1 begemotAtmNgIfEntry : INTEGER op_atmif_ng - (1 begemotAtmIfNodeId UNSIGNED32 GET) - )) - ) - ) - ) - ) - )) - ) - ) -)) diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c b/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c deleted file mode 100644 index c0699f7c2b3d..000000000000 --- a/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2001-2002 - * Fraunhofer Institute for Open Communication Systems (FhG Fokus). - * All rights reserved. - * Copyright (c) 2003-2004 - * Hartmut Brandt. - * All rights reserved. - * - * Author: Hartmut Brandt - * - * 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * - * SNMP module for ATM hardware interfaces - FreeBSD/Ng specific part. - */ - -#include "atm.h" -#include "atm_tree.h" -#include "atm_oid.h" - -#include -#include -#include - -#include - -#include -#include -#include - -static const struct hwinfo { - const char *device; - const char *vendor; -} hwinfo[] = { - ATM_DEVICE_NAMES -}; - -struct atmif_sys { - ng_ID_t atm_node; - void *regc; /* cookie registration */ -}; - -/* - * Find the interface for a given node - */ -struct atmif * -atm_node2if(u_int node) -{ - struct atmif_priv *aif; - - if (node != 0) - TAILQ_FOREACH(aif, &atmif_list, link) - if (aif->sys->atm_node == node) - return (&aif->pub); - return (NULL); -} - -u_int -atm_if2node(struct atmif *pub) -{ - struct atmif_priv *aif = (struct atmif_priv *)pub; - - return (aif->sys->atm_node); -} - -/* - * Destroy system dependend stuff. - */ -void -atmif_sys_destroy(struct atmif_priv *aif) -{ - - ng_unregister_cookie(aif->sys->regc); - free(aif->sys); - free(aif->pub.mib); -} - -/* - * Handle a message from the ATM node - */ -static void -handle_atm_message(const struct ng_mesg *mesg, const char *path __unused, - ng_ID_t node, void *uarg) -{ - struct atmif_priv *aif = uarg; - enum atmif_carrier_state ost; - - switch (mesg->header.cmd) { - - case NGM_ATM_IF_CHANGE: - { - const struct ngm_atm_if_change *arg; - - ost = aif->pub.carrier; - if (mesg->header.arglen != sizeof(*arg)) { - syslog(LOG_ERR, "ATM_IF_CHANGE: wrong size"); - atmif_check_carrier(aif); - return; - } - arg = (const struct ngm_atm_if_change *) - (const void *)mesg->data; - - if (arg->carrier) - aif->pub.carrier = ATMIF_CARRIER_ON; - else - aif->pub.carrier = ATMIF_CARRIER_OFF; - - if (ost != aif->pub.carrier) - atmif_send_notification(aif, ATMIF_NOTIFY_CARRIER, - (uintptr_t)ost); - return; - } - - case NGM_ATM_VCC_CHANGE: - { - const struct ngm_atm_vcc_change *arg; - - if (mesg->header.arglen != sizeof(*arg)) { - syslog(LOG_ERR, "ATM_VCC_CHANGE: wrong size"); - return; - } - arg = (const struct ngm_atm_vcc_change *) - (const void *)mesg->data; - atmif_send_notification(aif, ATMIF_NOTIFY_VCC, - (uintptr_t)(((arg->vpi & 0xff) << 24) | - ((arg->vci & 0xffff) << 8) | (arg->state & 1))); - return; - } - } - syslog(LOG_WARNING, "spurious message %u from node [%x]", - mesg->header.cmd, node); -} - -/* - * Attach to an ATM interface - */ -int -atmif_sys_attach_if(struct atmif_priv *aif) -{ - struct ng_mesg *resp, *resp1; - struct namelist *list; - u_int i; - - if ((aif->sys = malloc(sizeof(*aif->sys))) == NULL) { - syslog(LOG_CRIT, "out of memory"); - return (-1); - } - memset(aif->sys, 0, sizeof(*aif->sys)); - - if ((aif->pub.mib = malloc(sizeof(*aif->pub.mib))) == NULL) { - free(aif->sys); - syslog(LOG_CRIT, "out of memory"); - return (-1); - } - - atmif_sys_fill_mib(aif); - - /* - * Get ATM node Id. Must do it the hard way by scanning all nodes - * because the name may be wrong. - */ - if ((resp = ng_dialog_id(snmp_node, NGM_GENERIC_COOKIE, NGM_LISTNODES, - NULL, 0)) == NULL) { - syslog(LOG_ERR, "cannot fetch node list: %m"); - free(aif->sys); - return (-1); - } - list = (struct namelist *)(void *)resp->data; - - for (i = 0; i < list->numnames; i++) { - if (strcmp(list->nodeinfo[i].type, NG_ATM_NODE_TYPE) != 0) - continue; - if ((resp1 = ng_dialog_id(list->nodeinfo[i].id, - NGM_ATM_COOKIE, NGM_ATM_GET_IFNAME, NULL, 0)) == NULL) - continue; - if (strcmp(resp1->data, aif->pub.ifp->name) == 0) { - free(resp1); - break; - } - free(resp1); - } - if (i == list->numnames) - aif->sys->atm_node = 0; - else - aif->sys->atm_node = list->nodeinfo[i].id; - - free(resp); - - if ((aif->sys->regc = ng_register_cookie(module, NGM_ATM_COOKIE, - aif->sys->atm_node, handle_atm_message, aif)) == NULL) { - syslog(LOG_ERR, "cannot register cookie: %m"); - free(aif->sys); - return (-1); - } - return (0); -} - -/* - * Table of all ATM interfaces - Ng part - */ -int -op_atmif_ng(struct snmp_context *ctx __unused, struct snmp_value *value, - u_int sub, u_int vindex __unused, enum snmp_op op) -{ - struct atmif_priv *aif; - int err; - - if ((err = atmif_get_aif(value, sub, op, &aif)) != SNMP_ERR_NOERROR) - return (err); - - if (op == SNMP_OP_SET) { - switch (value->var.subs[sub - 1]) { - - default: - return (SNMP_ERR_NOT_WRITEABLE); - } - } - - switch (value->var.subs[sub - 1]) { - - case LEAF_begemotAtmIfNodeId: - value->v.uint32 = aif->sys->atm_node; - return (SNMP_ERR_NOERROR); - } - abort(); -} - -/* - * Get vendor string - */ -int -atm_sys_get_hw_vendor(struct atmif_priv *aif, struct snmp_value *value) -{ - - if (aif->pub.mib->device >= sizeof(hwinfo) / sizeof(hwinfo[0])) - return (string_get(value, "unknown", -1)); - return (string_get(value, hwinfo[aif->pub.mib->device].vendor, -1)); -} - -/* - * Get device string - */ -int -atm_sys_get_hw_device(struct atmif_priv *aif, struct snmp_value *value) -{ - - if (aif->pub.mib->device >= sizeof(hwinfo) / sizeof(hwinfo[0])) - return (string_get(value, "unknown", -1)); - return (string_get(value, hwinfo[aif->pub.mib->device].device, -1)); -} - -/* - * Extract the ATM MIB from the interface's private MIB - */ -void -atmif_sys_fill_mib(struct atmif_priv *aif) -{ - struct ifatm_mib *mib; - - if (aif->pub.ifp->specmiblen != sizeof(struct ifatm_mib)) { - syslog(LOG_ERR, "atmif MIB has wrong size %zu", - aif->pub.ifp->specmiblen); - memset(aif->pub.mib, 0, sizeof(*aif->pub.mib)); - aif->pub.mib->version = 0; - return; - } - mib = (struct ifatm_mib *)aif->pub.ifp->specmib; - - aif->pub.mib->device = mib->device; - aif->pub.mib->serial = mib->serial; - aif->pub.mib->hw_version = mib->hw_version; - aif->pub.mib->sw_version = mib->sw_version; - aif->pub.mib->media = mib->media; - - memcpy(aif->pub.mib->esi, mib->esi, 6); - aif->pub.mib->pcr = mib->pcr; - aif->pub.mib->vpi_bits = mib->vpi_bits; - aif->pub.mib->vci_bits = mib->vci_bits; - aif->pub.mib->max_vpcs = mib->max_vpcs; - aif->pub.mib->max_vccs = mib->max_vccs; -} diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile index 540eb45f4522..29e6f294056c 100644 --- a/usr.sbin/ppp/Makefile +++ b/usr.sbin/ppp/Makefile @@ -13,7 +13,6 @@ SRCS= acf.c arp.c async.c auth.c bundle.c cbcp.c ccp.c chap.c chat.c \ WARNS?= 3 .if defined(RELEASE_CRUNCH) CFLAGS+=-DRELEASE_CRUNCH -PPP_NO_ATM= PPP_NO_DES= PPP_NO_KLDLOAD= PPP_NO_NAT= @@ -25,9 +24,6 @@ CONFS= ppp.conf CONFSDIR= ${CONFDIR}/ppp CONFSMODE= 600 -.if ${MK_ATM} == "no" -PPP_NO_ATM= -.endif .if ${MK_NETGRAPH} == "no" PPP_NO_NETGRAPH= .endif @@ -68,12 +64,6 @@ SRCS+= nat_cmd.c LIBADD+= alias .endif -.if defined(PPP_NO_ATM) -CFLAGS+=-DNOATM -.else -SRCS+= atm.c -.endif - .if defined(PPP_NO_SUID) CFLAGS+=-DNOSUID .else diff --git a/usr.sbin/ppp/atm.c b/usr.sbin/ppp/atm.c deleted file mode 100644 index 6e0ce754c6f7..000000000000 --- a/usr.sbin/ppp/atm.c +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * Copyright (c) 2000 Jakob Stoklund Olesen - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "layer.h" -#include "defs.h" -#include "mbuf.h" -#include "log.h" -#include "timer.h" -#include "lqr.h" -#include "hdlc.h" -#include "throughput.h" -#include "fsm.h" -#include "lcp.h" -#include "ccp.h" -#include "link.h" -#include "async.h" -#include "descriptor.h" -#include "physical.h" -#include "main.h" -#include "atm.h" - -/* String identifying PPPoA */ -#define PPPOA "PPPoA" -#define PPPOA_LEN (sizeof(PPPOA) - 1) - -struct atmdevice { - struct device dev; /* What struct physical knows about */ -}; - -#define device2atm(d) ((d)->type == ATM_DEVICE ? (struct atmdevice *)d : NULL) - -unsigned -atm_DeviceSize(void) -{ - return sizeof(struct atmdevice); -} - -static ssize_t -atm_Sendto(struct physical *p, const void *v, size_t n) -{ - ssize_t ret = write(p->fd, v, n); - if (ret < 0) { - log_Printf(LogDEBUG, "atm_Sendto(%ld): %s\n", (long)n, strerror(errno)); - return ret; - } - return ret; -} - -static ssize_t -atm_Recvfrom(struct physical *p, void *v, size_t n) -{ - ssize_t ret = read(p->fd, (char*)v, n); - if (ret < 0) { - log_Printf(LogDEBUG, "atm_Recvfrom(%ld): %s\n", (long)n, strerror(errno)); - return ret; - } - return ret; -} - -static void -atm_Free(struct physical *p) -{ - struct atmdevice *dev = device2atm(p->handler); - - free(dev); -} - -static void -atm_device2iov(struct device *d, struct iovec *iov, int *niov, - int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) -{ - int sz = physical_MaxDeviceSize(); - - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { - log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); - AbortProgram(EX_OSERR); - } - iov[*niov].iov_len = sz; - (*niov)++; -} - -static const struct device baseatmdevice = { - ATM_DEVICE, - "atm", - 0, - { CD_NOTREQUIRED, 0 }, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - atm_Free, - atm_Recvfrom, - atm_Sendto, - atm_device2iov, - NULL, - NULL, - NULL -}; - -struct device * -atm_iov2device(int type, struct physical *p, struct iovec *iov, int *niov, - int maxiov __unused, int *auxfd __unused, int *nauxfd __unused) -{ - if (type == ATM_DEVICE) { - struct atmdevice *dev = (struct atmdevice *)iov[(*niov)++].iov_base; - - dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ - if (dev == NULL) { - log_Printf(LogALERT, "Failed to allocate memory: %d\n", - (int)(sizeof *dev)); - AbortProgram(EX_OSERR); - } - - /* Refresh function pointers etc */ - memcpy(&dev->dev, &baseatmdevice, sizeof dev->dev); - - physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNCNOACF); - return &dev->dev; - } - - return NULL; -} - -static struct atmdevice * -atm_CreateDevice(struct physical *p, const char *iface, unsigned vpi, - unsigned vci) -{ - struct atmdevice *dev; - struct sockaddr_natm sock; - - if ((dev = calloc(1, sizeof *dev)) == NULL) { - log_Printf(LogWARN, "%s: Cannot allocate an atm device: %s\n", - p->link.name, strerror(errno)); - return NULL; - } - - sock.snatm_len = sizeof sock; - sock.snatm_family = AF_NATM; - strncpy(sock.snatm_if, iface, IFNAMSIZ); - sock.snatm_vpi = vpi; - sock.snatm_vci = vci; - - log_Printf(LogPHASE, "%s: Connecting to %s:%u.%u\n", p->link.name, - iface, vpi, vci); - - p->fd = socket(PF_NATM, SOCK_DGRAM, PROTO_NATMAAL5); - if (p->fd >= 0) { - log_Printf(LogDEBUG, "%s: Opened atm socket %s\n", p->link.name, - p->name.full); - if (connect(p->fd, (struct sockaddr *)&sock, sizeof sock) == 0) - return dev; - else - log_Printf(LogWARN, "%s: connect: %s\n", p->name.full, strerror(errno)); - } else - log_Printf(LogWARN, "%s: socket: %s\n", p->name.full, strerror(errno)); - - close(p->fd); - p->fd = -1; - free(dev); - - return NULL; -} - -struct device * -atm_Create(struct physical *p) -{ - struct atmdevice *dev; - - dev = NULL; - if (p->fd < 0 && !strncasecmp(p->name.full, PPPOA, PPPOA_LEN) - && p->name.full[PPPOA_LEN] == ':') { - char iface[25]; - unsigned vci, vpi; - - if (sscanf(p->name.full + PPPOA_LEN + 1, "%25[A-Za-z0-9]:%u.%u", iface, - &vpi, &vci) != 3) { - log_Printf(LogWARN, "Malformed ATM device name \'%s\', " - "PPPoA:if:vpi.vci expected\n", p->name.full); - return NULL; - } - - dev = atm_CreateDevice(p, iface, vpi, vci); - } - - if (dev) { - memcpy(&dev->dev, &baseatmdevice, sizeof dev->dev); - physical_SetupStack(p, dev->dev.name, PHYSICAL_FORCE_SYNCNOACF); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &dev->dev; - } - - return NULL; -} diff --git a/usr.sbin/ppp/atm.h b/usr.sbin/ppp/atm.h deleted file mode 100644 index ccfad8d9fea7..000000000000 --- a/usr.sbin/ppp/atm.h +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2000 Jakob Stoklund Olesen - * 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 AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -struct physical; -struct device; - -extern struct device *atm_Create(struct physical *); -extern struct device *atm_iov2device(int, struct physical *, - struct iovec *, int *, int, int *, int *); -extern unsigned atm_DeviceSize(void); diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c index e2892aebcc0f..eb74b33a1550 100644 --- a/usr.sbin/ppp/physical.c +++ b/usr.sbin/ppp/physical.c @@ -102,9 +102,6 @@ #include "ether.h" #include "netgraph.h" #endif -#ifndef NOATM -#include "atm.h" -#endif #include "tcpmss.h" static int physical_DescriptorWrite(struct fdescriptor *, struct bundle *, @@ -132,10 +129,6 @@ struct { #ifdef EXPERIMENTAL_NETGRAPH { ng_Create, ng_iov2device, ng_DeviceSize }, #endif -#endif -#ifndef NOATM - /* Ditto for ATM devices */ - { atm_Create, atm_iov2device, atm_DeviceSize }, #endif { tcp_Create, tcp_iov2device, tcp_DeviceSize }, { udp_Create, udp_iov2device, udp_DeviceSize },