summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-07-04 21:24:35 +0000
committerjhb <jhb@FreeBSD.org>2008-07-04 21:24:35 +0000
commit641b82a4470718ae1b0c1826ab0470e4c6117a9f (patch)
treeb64f14739a962818bf20d5af59b49ec5223a97b6
parentab5a1a3be383b4ffe9b6cdd9d2652c8c195a0e29 (diff)
downloadFreeBSD-src-641b82a4470718ae1b0c1826ab0470e4c6117a9f.zip
FreeBSD-src-641b82a4470718ae1b0c1826ab0470e4c6117a9f.tar.gz
Remove the sbsh(4) driver. No one responded to requests for testing the
MPSAFE patches on current@ and stable@. This driver also has a fundamental issue in that it sleeps when sending commands to the card including in the if_init/if_start routines (which can be called from interrupt context). As such, the driver shouldn't be working reliably even on 4.x.
-rw-r--r--ObsoleteFiles.inc3
-rw-r--r--share/man/man4/Makefile2
-rw-r--r--share/man/man4/sbsh.482
-rw-r--r--sys/conf/NOTES2
-rw-r--r--sys/conf/files1
-rw-r--r--sys/dev/sbsh/if_sbsh.c1094
-rw-r--r--sys/dev/sbsh/if_sbshreg.h194
-rw-r--r--sys/modules/Makefile1
-rw-r--r--sys/modules/sbsh/Makefile8
9 files changed, 3 insertions, 1384 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index e80853e..9fe8b33 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -14,6 +14,9 @@
# The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
#
+# 20080704: sbsh(4) removed
+OLD_FILES+=usr/share/man/man4/if_sbsh.4.gz
+OLD_FILES+=usr/share/man/man4/sbsh.4.gz
# 20080704: sbni(4) removed
.if ${TARGET_ARCH} == "i386"
OLD_FILES+=usr/share/man/man4/i386/if_sbni.4.gz
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index ed74d3d..d3035df 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -292,7 +292,6 @@ MAN= aac.4 \
safe.4 \
sbp.4 \
sbp_targ.4 \
- sbsh.4 \
scc.4 \
sched_4bsd.4 \
sched_ule.4 \
@@ -505,7 +504,6 @@ MLINKS+=re.4 if_re.4
MLINKS+=rl.4 if_rl.4
MLINKS+=rue.4 if_rue.4
MLINKS+=rum.4 if_rum.4
-MLINKS+=sbsh.4 if_sbsh.4
MLINKS+=scsi.4 CAM.4 \
scsi.4 cam.4 \
scsi.4 scbus.4 \
diff --git a/share/man/man4/sbsh.4 b/share/man/man4/sbsh.4
deleted file mode 100644
index e49c929..0000000
--- a/share/man/man4/sbsh.4
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" Written by Denis I. Timofeev, 2003.
-.\"
-.\" 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 April 11, 2003
-.Dt SBSH 4
-.Os
-.Sh NAME
-.Nm sbsh
-.Nd "Granch SBNI16 SHDSL modem device driver"
-.Sh SYNOPSIS
-.Cd "device sbsh"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for an internal PCI modem SBNI16-SHDSL.
-A device is introduced to the OS as a common Ethernet-like network
-card which must be configured with
-.Xr ifconfig 8
-(all standard network interface parameters could be set).
-Modem-specific
-parameters (master/slave mode, line rate, etc.) must be set with the
-.Nm sb16config
-utility before interface activation.
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "sbsh%d: couldn't map memory"
-.It "sbsh%d: couldn't map interrupt"
-.It "sbsh%d: couldn't set up irq"
-A fatal initialization error has occurred.
-.It "sbsh%d: unable to load firmware"
-A fatal error has occurred while
-.Nm sb16config
-was running.
-.It "sbsh%d: firmware wasn't loaded"
-.Dq Nm ifconfig Ar ... Cm up
-has failed because device has not been configured with
-.Nm sb16config .
-.It "sbsh%d: transmit timeout"
-.It "sbsh%d: interrupt posted but not delivered"
-Probably, a hardware error or incompatibility.
-.It "sbsh%d: unable to get mbuf"
-.It "sbsh%d: unable to get mbuf cluster"
-The driver failed to allocate a memory buffer.
-.El
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ifconfig 8
-.Pp
-.Pa ports/sysutils/sb16config
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 4.9 .
-.Sh AUTHORS
-The
-.Nm
-driver was written by
-.An Denis I. Timofeev Aq timofeev@granch.ru .
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index cd2295b..3f61a67 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1799,7 +1799,6 @@ device miibus
# card which is 32-bit.
# sis: Support for NICs based on the Silicon Integrated Systems SiS 900,
# SiS 7016 and NS DP83815 PCI fast ethernet controller chips.
-# sbsh: Support for Granch SBNI16 SHDSL modem PCI adapters
# sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs.
# This includes the SK-9841 and SK-9842 single port cards (single mode
# and multimode fiber) and the SK-9843 and SK-9844 dual port cards
@@ -1885,7 +1884,6 @@ device nge # NatSemi DP83820 gigabit Ethernet
device rl # RealTek 8129/8139
device pcn # AMD Am79C97x PCI 10/100 NICs
device sf # Adaptec AIC-6915 (``Starfire'')
-device sbsh # Granch SBNI16 SHDSL modem
device sis # Silicon Integrated Systems SiS 900/SiS 7016
device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet
device ste # Sundance ST201 (D-Link DFE-550TX)
diff --git a/sys/conf/files b/sys/conf/files
index b9f90dd..2151c05 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1083,7 +1083,6 @@ dev/rp/rp.c optional rp
dev/rp/rp_isa.c optional rp isa
dev/rp/rp_pci.c optional rp pci
dev/safe/safe.c optional safe
-dev/sbsh/if_sbsh.c optional sbsh
dev/scc/scc_if.m optional scc
dev/scc/scc_bfe_ebus.c optional scc ebus
dev/scc/scc_bfe_quicc.c optional scc quicc
diff --git a/sys/dev/sbsh/if_sbsh.c b/sys/dev/sbsh/if_sbsh.c
deleted file mode 100644
index a5b5684..0000000
--- a/sys/dev/sbsh/if_sbsh.c
+++ /dev/null
@@ -1,1094 +0,0 @@
-/*-
- * Granch SBNI16 G.SHDSL Modem driver
- * Written by Denis I. Timofeev, 2002-2003.
- *
- * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sockio.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/priv.h>
-#include <sys/proc.h>
-#include <sys/socket.h>
-#include <sys/random.h>
-#include <machine/stdarg.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/ethernet.h>
-#include <net/if_media.h>
-#include <net/if_types.h>
-
-#include <net/bpf.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/bus.h>
-#include <sys/rman.h>
-
-#include <dev/pci/pcireg.h>
-#include <dev/pci/pcivar.h>
-
-#include <dev/sbsh/if_sbshreg.h>
-
-/* -------------------------------------------------------------------------- */
-
-struct sbni16_hw_regs {
- u_int8_t CR, CRB, SR, IMR, CTDR, LTDR, CRDR, LRDR;
-};
-
-struct hw_descr {
- u_int32_t address;
- u_int32_t length;
-};
-
-struct cx28975_cmdarea {
- u_int8_t intr_host;
- u_int8_t intr_8051;
- u_int8_t map_version;
-
- u_int8_t in_dest;
- u_int8_t in_opcode;
- u_int8_t in_zero;
- u_int8_t in_length;
- u_int8_t in_csum;
- u_int8_t in_data[75];
- u_int8_t in_datasum;
-
- u_int8_t out_dest;
- u_int8_t out_opcode;
- u_int8_t out_ack;
- u_int8_t out_length;
- u_int8_t out_csum;
- u_int8_t out_data[75];
- u_int8_t out_datasum;
-};
-
-#define XQLEN 8
-#define RQLEN 8
-
-struct sbsh_softc {
- struct ifnet *ifp;
- struct mtx lock;
-
- struct resource *mem_res;
- struct resource *irq_res;
- void *intr_hand;
-
- void *mem_base; /* mapped memory address */
-
- volatile struct sbni16_hw_regs *regs;
- volatile struct hw_descr *tbd;
- volatile struct hw_descr *rbd;
- volatile struct cx28975_cmdarea *cmdp;
-
- /* SBNI16 controller statistics */
- struct sbni16_stats {
- u_int32_t sent_pkts, rcvd_pkts;
- u_int32_t crc_errs, ufl_errs, ofl_errs, attempts, last_time;
- } in_stats;
-
- /* transmit and reception queues */
- struct mbuf *xq[XQLEN], *rq[RQLEN];
- unsigned head_xq, tail_xq, head_rq, tail_rq;
-
- /* the descriptors mapped onto the first buffers in xq and rq */
- unsigned head_tdesc, head_rdesc;
- u_int8_t state;
- int loading_firmware;
-};
-
-#define SBSH_LOCK(sc) mtx_lock(&(sc)->lock)
-#define SBSH_UNLOCK(sc) mtx_unlock(&(sc)->lock)
-#define SBSH_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED)
-
-struct cx28975_cfg {
- u_int8_t *firmw_image;
- u_int32_t firmw_len;
- u_int32_t lrate: 10;
- u_int32_t master: 1;
- u_int32_t mod: 2;
- u_int32_t crc16: 1;
- u_int32_t fill_7e: 1;
- u_int32_t inv: 1;
- u_int32_t rburst: 1;
- u_int32_t wburst: 1;
- u_int32_t : 14;
-};
-
-/* SHDSL transceiver statistics */
-struct dsl_stats {
- u_int8_t status_1, status_3;
- u_int8_t attenuat, nmr, tpbo, rpbo;
- u_int16_t losw, segd, crc, sega, losd;
-};
-
-enum State { NOT_LOADED, DOWN, ACTIVATION, ACTIVE };
-
-#define SIOCLOADFIRMW _IOWR('i', 67, struct ifreq)
-#define SIOCGETSTATS _IOWR('i', 68, struct ifreq)
-#define SIOCCLRSTATS _IOWR('i', 69, struct ifreq)
-
-static int sbsh_probe(device_t);
-static int sbsh_attach(device_t);
-static int sbsh_detach(device_t);
-static int sbsh_ioctl(struct ifnet *, u_long, caddr_t);
-static void sbsh_shutdown(device_t);
-static int sbsh_suspend(device_t);
-static int sbsh_resume(device_t);
-
-static void sbsh_start(struct ifnet *);
-static void sbsh_start_locked(struct ifnet *);
-static void sbsh_init(void *);
-static void sbsh_init_locked(struct sbsh_softc *);
-static void sbsh_stop(struct sbsh_softc *);
-static void init_card(struct sbsh_softc *);
-static void sbsh_intr(void *);
-static void resume_tx(struct sbsh_softc *);
-static void start_xmit_frames(struct sbsh_softc *);
-static void encap_frame(struct sbsh_softc *, struct mbuf *);
-static struct mbuf * repack(struct sbsh_softc *, struct mbuf *);
-static void free_sent_buffers(struct sbsh_softc *);
-static void alloc_rx_buffers(struct sbsh_softc *);
-static void indicate_frames(struct sbsh_softc *);
-static void drop_queues(struct sbsh_softc *);
-static void activate(struct sbsh_softc *);
-static void deactivate(struct sbsh_softc *);
-static void cx28975_interrupt(struct sbsh_softc *);
-static int start_cx28975(struct sbsh_softc *, struct cx28975_cfg);
-static int download_firmware(struct sbsh_softc *, u_int8_t *, u_int32_t);
-static int issue_cx28975_cmd(struct sbsh_softc *, u_int8_t,
- u_int8_t *, u_int8_t);
-
-static device_method_t sbsh_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, sbsh_probe),
- DEVMETHOD(device_attach, sbsh_attach),
- DEVMETHOD(device_detach, sbsh_detach),
- DEVMETHOD(device_shutdown, sbsh_shutdown),
- DEVMETHOD(device_suspend, sbsh_suspend),
- DEVMETHOD(device_resume, sbsh_resume),
-
- { 0, 0 }
-};
-
-static driver_t sbsh_driver = {
- "sbsh",
- sbsh_methods,
- sizeof(struct sbsh_softc)
-};
-
-static devclass_t sbsh_devclass;
-
-DRIVER_MODULE(sbsh, pci, sbsh_driver, sbsh_devclass, 0, 0);
-MODULE_DEPEND(sbsh, pci, 1, 1, 1);
-
-static int
-sbsh_probe(device_t dev)
-{
- if (pci_get_vendor(dev) != SBNI16_VENDOR
- || pci_get_device(dev) != SBNI16_DEVICE
- || pci_get_subdevice(dev) != SBNI16_SUBDEV)
- return (ENXIO);
-
- device_set_desc(dev, "Granch SBNI16 G.SHDSL Modem");
- return (BUS_PROBE_DEFAULT);
-}
-
-static int
-sbsh_attach(device_t dev)
-{
- struct sbsh_softc *sc;
- struct ifnet *ifp;
- int error = 0, rid;
- u_char eaddr[6];
-
- sc = device_get_softc(dev);
-
- rid = PCIR_BAR(1);
- sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
- 0ul, ~0ul, 4096, RF_ACTIVE);
-
- if (sc->mem_res == NULL) {
- device_printf(dev, "couldn't map memory\n");
- error = ENXIO;
- goto fail;
- }
-
- rid = 0;
- sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
- RF_SHAREABLE | RF_ACTIVE);
-
- if (sc->irq_res == NULL) {
- device_printf(dev, "couldn't map interrupt\n");
- error = ENXIO;
- goto fail;
- }
-
- sc->mem_base = rman_get_virtual(sc->mem_res);
- init_card(sc);
-
- /* generate ethernet MAC address */
- *(u_int32_t *)eaddr = htonl(0x00ff0192);
- read_random(eaddr + 4, 2);
-
- ifp = sc->ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(dev, "can not if_alloc()\n");
- goto fail;
- }
- ifp->if_softc = sc;
- if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_mtu = ETHERMTU;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_ioctl = sbsh_ioctl;
- ifp->if_start = sbsh_start;
- ifp->if_init = sbsh_init;
- ifp->if_baudrate = 4600000;
- IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
-
- mtx_init(&sc->lock, device_get_nameunit(dev), MTX_NETWORK_LOCK,
- MTX_DEF);
- ether_ifattach(ifp, eaddr);
-
- error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, sbsh_intr, sc, &sc->intr_hand);
- if (error) {
- ether_ifdetach(ifp);
- mtx_destroy(&sc->lock);
- device_printf(dev, "couldn't set up irq\n");
- goto fail;
- }
-
-fail:
- if (sc->ifp)
- if_free(sc->ifp);
- if (sc->irq_res)
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);
- if (sc->mem_res)
- bus_release_resource(dev, SYS_RES_MEMORY,
- PCIR_BAR(1), sc->mem_res);
- return (error);
-}
-
-static int
-sbsh_detach(device_t dev)
-{
- struct sbsh_softc *sc;
- struct ifnet *ifp;
-
- sc = device_get_softc(dev);
- ifp = sc->ifp;
-
- SBSH_LOCK(sc);
- sbsh_stop(sc);
- SBSH_UNLOCK(sc);
- ether_ifdetach(ifp);
-
- bus_teardown_intr(dev, sc->irq_res, sc->intr_hand);
- bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);
- bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), sc->mem_res);
-
- if_free(ifp);
- mtx_destroy(&sc->lock);
-
- return (0);
-}
-
-static void
-sbsh_start(struct ifnet *ifp)
-{
- struct sbsh_softc *sc = ifp->if_softc;
-
- SBSH_LOCK(sc);
- sbsh_start_locked(ifp);
- SBSH_UNLOCK(sc);
-}
-
-static void
-sbsh_start_locked(struct ifnet *ifp)
-{
- struct sbsh_softc *sc = ifp->if_softc;
-
- if (sc->state != ACTIVE)
- return;
-
- start_xmit_frames(ifp->if_softc);
-}
-
-static void
-sbsh_init(void *xsc)
-{
- struct sbsh_softc *sc = xsc;
-
- SBSH_LOCK(sc);
- sbsh_init_locked(sc);
- SBSH_UNLOCK(sc);
-}
-
-static void
-sbsh_init_locked(struct sbsh_softc *sc)
-{
- struct ifnet *ifp = sc->ifp;
- u_int8_t t;
-
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) || sc->state == NOT_LOADED)
- return;
-
- bzero(&sc->in_stats, sizeof(struct sbni16_stats));
- sc->head_xq = sc->tail_xq = sc->head_rq = sc->tail_rq = 0;
- sc->head_tdesc = sc->head_rdesc = 0;
-
- sc->regs->IMR = EXT;
- t = 2;
- issue_cx28975_cmd(sc, _DSL_CLEAR_ERROR_CTRS, &t, 1);
- if (issue_cx28975_cmd(sc, _DSL_ACTIVATION, &t, 1) == 0) {
- sc->state = ACTIVATION;
-
- ifp->if_drv_flags |= IFF_DRV_RUNNING;
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- }
-}
-
-
-static void
-sbsh_stop(struct sbsh_softc *sc)
-{
- u_int8_t t;
-
- SBSH_ASSERT_LOCKED(sc);
- sc->regs->IMR = EXT;
-
- t = 0;
- issue_cx28975_cmd(sc, _DSL_ACTIVATION, &t, 1);
- if (sc->state == ACTIVE) {
- t = 1;
- issue_cx28975_cmd(sc, _DSL_FORCE_DEACTIVATE, &t, 1);
- /* FIX! activation manager state */
-
- /* Is it really must be done here? It calls from intr handler */
- deactivate(sc);
- }
-
- sc->regs->IMR = 0;
- sc->state = DOWN;
- sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
-}
-
-
-static void
-init_card(struct sbsh_softc *sc)
-{
- sc->state = NOT_LOADED;
- sc->tbd = (struct hw_descr *) sc->mem_base;
- sc->rbd = (struct hw_descr *) ((u_int8_t *)sc->mem_base + 0x400);
- sc->regs = (struct sbni16_hw_regs *) ((u_int8_t *)sc->mem_base + 0x800);
- sc->cmdp = (struct cx28975_cmdarea *) ((u_int8_t *)sc->mem_base + 0xc00);
-
- sc->regs->CR = 0;
- sc->regs->SR = 0xff;
- sc->regs->IMR = 0;
-}
-
-
-static int
-sbsh_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-{
- struct sbsh_softc *sc = ifp->if_softc;
- struct ifreq *ifr = (struct ifreq *) data;
- struct cx28975_cfg cfg;
- struct sbni16_stats stats;
- struct dsl_stats ds;
-
- int error = 0;
- u_int8_t t;
-
- switch(cmd) {
- case SIOCLOADFIRMW:
- if ((error = priv_check(curthread, PRIV_DRIVER)) != 0)
- break;
- error = copyin(ifr->ifr_data, &cfg, sizeof(cfg));
- if (error)
- break;
- SBSH_LOCK(sc);
- if (ifp->if_flags & IFF_UP || sc->loading_firmware) {
- error = EBUSY;
- SBSH_UNLOCK(sc);
- break;
- }
- sc->loading_firmware = 1;
- if (start_cx28975(sc, cfg) == 0) {
- static char *modstr[] = {
- "TCPAM32", "TCPAM16", "TCPAM8", "TCPAM4" };
- if_printf(sc->ifp, "%s, rate %d, %s\n",
- cfg.master ? "master" : "slave",
- cfg.lrate << 3, modstr[cfg.mod]);
- } else {
- if_printf(sc->ifp,
- "unable to load firmware\n");
- error = EIO;
- }
- sc->loading_firmware = 0;
- SBSH_UNLOCK(sc);
- break;
-
- case SIOCGETSTATS :
- if ((error = priv_check(curthread, PRIV_DRIVER)) != 0)
- break;
-
- SBSH_LOCK(sc);
- t = 0;
- if (issue_cx28975_cmd(sc, _DSL_FAR_END_ATTEN, &t, 1))
- error = EIO;
- ds.attenuat = sc->cmdp->out_data[0];
-
- if (issue_cx28975_cmd(sc, _DSL_NOISE_MARGIN, &t, 1))
- error = EIO;
- ds.nmr = sc->cmdp->out_data[0];
-
- if (issue_cx28975_cmd(sc, _DSL_POWER_BACK_OFF_RESULT, &t, 1))
- error = EIO;
- ds.tpbo = sc->cmdp->out_data[0];
- ds.rpbo = sc->cmdp->out_data[1];
-
- if (!issue_cx28975_cmd(sc, _DSL_HDSL_PERF_ERR_CTRS, &t, 1)) {
- int i;
- for (i = 0; i < 10; ++i)
- ((u_int8_t *) &ds.losw)[i] =
- sc->cmdp->out_data[i];
- } else
- error = EIO;
-
- ds.status_1 = ((volatile u_int8_t *)sc->cmdp)[0x3c0];
- ds.status_3 = ((volatile u_int8_t *)sc->cmdp)[0x3c2];
- bcopy(&sc->in_stats, &stats, sizeof(struct sbni16_stats));
- SBSH_UNLOCK(sc);
-
- error = copyout(&stats, ifr->ifr_data,
- sizeof(struct sbni16_stats));
- if (error)
- break;
- error = copyout(&ds, ifr->ifr_data +
- sizeof(struct sbni16_stats), sizeof(struct dsl_stats));
- break;
-
- case SIOCCLRSTATS :
- if (!(error = priv_check(curthread, PRIV_DRIVER))) {
- SBSH_LOCK(sc);
- bzero(&sc->in_stats, sizeof(struct sbni16_stats));
- t = 2;
- if (issue_cx28975_cmd(sc, _DSL_CLEAR_ERROR_CTRS, &t, 1))
- error = EIO;
- SBSH_UNLOCK(sc);
- }
- break;
-
- case SIOCSIFFLAGS:
- SBSH_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
- if (sc->state == NOT_LOADED) {
- if_printf(ifp, "firmware wasn't loaded\n");
- error = EBUSY;
- } else
- sbsh_init_locked(sc);
- }
- } else {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
- sbsh_stop(sc);
- }
- SBSH_UNLOCK(sc);
- break;
-
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- error = 0;
- break;
-
- default:
- error = ether_ioctl(ifp, cmd, data);
- break;
- }
-
- return (error);
-}
-
-
-static void
-sbsh_shutdown(device_t dev)
-{
- struct sbsh_softc *sc = device_get_softc(dev);
-
- SBSH_LOCK(sc);
- sbsh_stop(sc);
- SBSH_UNLOCK(sc);
-}
-
-static int
-sbsh_suspend(device_t dev)
-{
- struct sbsh_softc *sc = device_get_softc(dev);
-
- SBSH_LOCK(sc);
- sbsh_stop(sc);
- SBSH_UNLOCK(sc);
-
- return (0);
-}
-
-static int
-sbsh_resume(device_t dev)
-{
- struct sbsh_softc *sc = device_get_softc(dev);
- struct ifnet *ifp;
-
- SBSH_LOCK(sc);
- ifp = sc->ifp;
- if (ifp->if_flags & IFF_UP)
- sbsh_init_locked(sc);
- SBSH_UNLOCK(sc);
-
- return (0);
-}
-
-/* -------------------------------------------------------------------------- */
-
-static void
-sbsh_intr(void *arg)
-{
- struct sbsh_softc *sc = (struct sbsh_softc *)arg;
- u_int8_t status;
-
- SBSH_LOCK(sc);
- status = sc->regs->SR;
- if (status == 0) {
- SBSH_UNLOCK(sc);
- return;
- }
-
- if (status & EXT) {
- cx28975_interrupt(sc);
- sc->regs->SR = EXT;
- }
-
- if (status & UFL) {
- resume_tx(sc);
- sc->regs->SR = UFL;
- ++sc->in_stats.ufl_errs;
- ++sc->ifp->if_oerrors;
- }
-
- if (status & RXS) {
- sc->regs->SR = RXS;
- indicate_frames(sc);
- alloc_rx_buffers(sc);
- }
-
- if (status & TXS) {
- sc->regs->SR = TXS;
- free_sent_buffers(sc);
- }
-
- if (status & CRC) {
- ++sc->in_stats.crc_errs;
- ++sc->ifp->if_ierrors;
- sc->regs->SR = CRC;
- }
-
- if (status & OFL) {
- ++sc->in_stats.ofl_errs;
- ++sc->ifp->if_ierrors;
- sc->regs->SR = OFL;
- }
- SBSH_UNLOCK(sc);
-}
-
-/*
- * Look for a first descriptor of a next packet, and write it's number
- * into CTDR. Then enable the transmitter.
- */
-static void
-resume_tx(struct sbsh_softc *sc)
-{
- u_int32_t cur_tbd = sc->regs->CTDR;
-
- while (cur_tbd != sc->regs->LTDR
- && (sc->tbd[cur_tbd++].length & LAST_FRAG) == 0)
- ;
- sc->regs->CTDR = cur_tbd;
- sc->regs->CR |= TXEN;
-}
-
-static void
-start_xmit_frames(struct sbsh_softc *sc)
-{
- struct ifnet *ifp = sc->ifp;
- struct mbuf *m;
-
- /*
- * Check if we have any free descriptor(s) and free space in
- * our transmit queue.
- */
- while (sc->tail_xq != ((sc->head_xq - 1) & (XQLEN - 1))
- && sc->regs->LTDR != ((sc->head_tdesc - 1) & 0x7f)) {
-
- IF_DEQUEUE(&ifp->if_snd, m);
- if (!m)
- break;
- if (m->m_pkthdr.len) {
- BPF_MTAP(ifp, m);
- encap_frame(sc, m);
- } else
- m_freem(m);
- }
-
- if (sc->regs->CTDR != sc->regs->LTDR)
- ifp->if_drv_flags |= IFF_DRV_OACTIVE;
- else
- ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-}
-
-
-/*
- * MUST be called at splimp
- */
-static void
-encap_frame(struct sbsh_softc *sc, struct mbuf *m_head)
-{
- struct mbuf *m;
- u_int32_t cur_tbd;
- int done;
-
-look_for_nonzero:
- for (m = m_head; !m->m_len; m = m->m_next)
- ;
-
- cur_tbd = sc->regs->LTDR & 0x7f;
- done = 0;
- do {
- if (m->m_len < 5 || cur_tbd == ((sc->head_tdesc - 1) & 0x7f)) {
- if ((m_head = repack(sc, m_head)) != NULL)
- goto look_for_nonzero;
- else
- return;
- }
-
- sc->tbd[cur_tbd].address = vtophys(mtod(m, vm_offset_t));
- sc->tbd[cur_tbd].length = m->m_len;
-
- do {
- m = m->m_next;
- } while (m && !m->m_len);
-
- if (!m) { /* last fragment has been reached */
- sc->tbd[cur_tbd].length |= LAST_FRAG;
- done = 1;
- }
-
- ++cur_tbd;
- cur_tbd &= 0x7f;
- } while (!done);
-
- sc->xq[sc->tail_xq++] = m_head;
- sc->tail_xq &= (XQLEN - 1);
-
- sc->regs->LTDR = cur_tbd;
- ++sc->in_stats.sent_pkts;
- ++sc->ifp->if_opackets;
-}
-
-static struct mbuf *
-repack(struct sbsh_softc *sc, struct mbuf *m)
-{
- struct mbuf *m_new;
-
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (!m_new) {
- if_printf (sc->ifp,
- "unable to get mbuf.\n");
- return (NULL);
- }
-
- if (m->m_pkthdr.len > MHLEN) {
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- m_freem(m_new);
- if_printf (sc->ifp,
- "unable to get mbuf cluster.\n");
- return (NULL);
- }
- }
-
- m_copydata(m, 0, m->m_pkthdr.len, mtod(m_new, caddr_t));
- m_new->m_pkthdr.len = m_new->m_len = m->m_pkthdr.len;
- m_freem(m);
- return (m_new);
-}
-
-static void
-free_sent_buffers(struct sbsh_softc *sc)
-{
- u_int32_t cur_tbd;
-
- cur_tbd = sc->regs->CTDR;
-
- while (sc->head_tdesc != cur_tbd) {
- /*
- * Be careful! one element in xq may correspond to
- * multiple descriptors.
- */
- if (sc->tbd[sc->head_tdesc].length & LAST_FRAG) {
- m_freem(sc->xq[sc->head_xq++]);
- sc->head_xq &= (XQLEN - 1);
- }
-
- sc->tbd[sc->head_tdesc].length = 0;
- sc->head_tdesc = (sc->head_tdesc + 1) & 0x7f;
- }
-
- start_xmit_frames(sc);
-}
-
-/*
- * DON'T use free_sent_buffers to drop the queue!
- */
-static void
-alloc_rx_buffers(struct sbsh_softc *sc)
-{
- unsigned cur_rbd = sc->regs->LRDR & 0x7f;
- struct mbuf *m;
-
- while (sc->tail_rq != ((sc->head_rq - 1) & (RQLEN - 1))) {
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (!m) {
- if_printf (sc->ifp,
- "unable to get mbuf.\n");
- return;
- }
-
- if (SBNI16_MAX_FRAME > MHLEN) {
- MCLGET(m, M_DONTWAIT);
- if (!(m->m_flags & M_EXT)) {
- m_freem(m);
- if_printf (sc->ifp,
- "unable to get mbuf cluster.\n");
- return;
- }
- m->m_pkthdr.len = m->m_len = MCLBYTES;
- }
-
- m_adj(m, 2); /* align ip on longword boundaries */
-
- sc->rq[sc->tail_rq++] = m;
- sc->tail_rq &= (RQLEN - 1);
-
- sc->rbd[cur_rbd].address = vtophys(mtod(m, vm_offset_t));
- sc->rbd[cur_rbd].length = 0;
- sc->regs->LRDR = cur_rbd = (cur_rbd + 1) & 0x7f;
- }
-}
-
-static void
-indicate_frames(struct sbsh_softc *sc)
-{
- unsigned cur_rbd = sc->regs->CRDR & 0x7f;
-
- while (sc->head_rdesc != cur_rbd) {
- struct mbuf *m = sc->rq[sc->head_rq++];
- sc->head_rq &= (RQLEN - 1);
-
- m->m_pkthdr.len = m->m_len =
- sc->rbd[sc->head_rdesc].length & 0x7ff;
- m->m_pkthdr.rcvif = sc->ifp;
-
- ++sc->in_stats.rcvd_pkts;
- ++sc->ifp->if_ipackets;
-
- sc->head_rdesc = (sc->head_rdesc + 1) & 0x7f;
- SBSH_UNLOCK(sc);
- (*sc->ifp->if_input)(sc->ifp, m);
- SBSH_LOCK(sc);
- }
-}
-
-static void
-drop_queues(struct sbsh_softc *sc)
-{
- while (sc->head_rq != sc->tail_rq) {
- m_freem(sc->rq[sc->head_rq++]);
- sc->head_rq &= (RQLEN - 1);
- }
-
- while (sc->head_xq != sc->tail_xq) {
- m_freem(sc->xq[sc->head_xq++]);
- sc->head_xq &= (XQLEN - 1);
- }
-}
-
-/* -------------------------------------------------------------------------- */
-
-static void
-activate(struct sbsh_softc *sc)
-{
- struct timeval tv;
-
- sc->regs->SR = 0xff; /* clear it! */
- sc->regs->CTDR = sc->regs->LTDR = sc->regs->CRDR = sc->regs->LRDR = 0;
-
- sc->head_tdesc = sc->head_rdesc = 0;
- alloc_rx_buffers(sc);
-
- sc->regs->CRB &= ~RXDE;
- sc->regs->IMR = EXT | RXS | TXS | CRC | OFL | UFL;
- sc->regs->CR |= TXEN | RXEN;
-
- sc->state = ACTIVE;
- ++sc->in_stats.attempts;
- microtime(&tv);
- sc->in_stats.last_time = tv.tv_sec;
- start_xmit_frames(sc);
-}
-
-static void
-deactivate(struct sbsh_softc *sc)
-{
- sc->regs->CR &= ~(RXEN | TXEN);
- sc->regs->CRB |= RXDE;
- sc->regs->IMR = EXT;
- sc->regs->CTDR = sc->regs->LTDR;
- sc->regs->CRDR = sc->regs->LRDR;
- sc->state = ACTIVATION;
-
- drop_queues(sc);
-}
-
-/* -------------------------------------------------------------------------- */
-
-static void
-cx28975_interrupt(struct sbsh_softc *sc)
-{
- volatile struct cx28975_cmdarea *p = sc->cmdp;
- u_int8_t t;
-
- if (p->intr_host != 0xfe)
- return;
-
- if (p->out_ack & 0x80) {
- if (*((volatile u_int8_t *)p + 0x3c7) & 2) {
- if (sc->state != ACTIVE
- && (*((volatile u_int8_t *)p + 0x3c0) & 0xc0) == 0x40) {
- activate(sc);
- if_printf(sc->ifp, "connected to peer\n");
- } else if (sc->state == ACTIVE
- && (*((volatile u_int8_t *)p + 0x3c0) & 0xc0) != 0x40) {
- deactivate(sc);
- if_printf(sc->ifp, "carrier lost\n");
- }
- }
-
- p->intr_host = 0;
- t = p->intr_host;
- p->out_ack = 0;
- } else {
- wakeup(sc);
-
- p->intr_host = 0;
- t = p->intr_host;
- }
-}
-
-/* -------------------------------------------------------------------------- */
-
-static int
-start_cx28975(struct sbsh_softc *sc, struct cx28975_cfg cfg)
-{
- static char thresh[] = { +8, -4, -16, -40 };
-
- volatile struct cx28975_cmdarea *p = sc->cmdp;
- u_int8_t t, parm[12];
-
- p->intr_host = 0;
- t = p->intr_host;
-
- /* reset chip set */
- sc->regs->IMR = EXT;
- sc->regs->CR = 0;
- sc->regs->SR = 0xff;
- DELAY(2);
- sc->regs->CR = XRST;
- if (cfg.crc16)
- sc->regs->CR |= CMOD;
- if (cfg.fill_7e)
- sc->regs->CR |= FMOD;
- if (cfg.inv)
- sc->regs->CR |= PMOD;
-
- sc->regs->CRB |= RODD | RXDE;
- if (cfg.rburst)
- sc->regs->CRB |= RDBE;
- if (cfg.wburst)
- sc->regs->CRB |= WTBE;
-
- mtx_sleep(sc, &sc->lock, PWAIT, "sbsh", 0);
- if ((p->out_ack & 0x1f) != _ACK_BOOT_WAKE_UP)
- return (-1);
-
- if (download_firmware(sc, cfg.firmw_image, cfg.firmw_len))
- return (-1);
-
- mtx_sleep(sc, &sc->lock, PWAIT, "sbsh", 0);
- if ((p->out_ack & 0x1f) != _ACK_OPER_WAKE_UP)
- return (-1);
-
- t = cfg.master ? 1 : 9;
- if (issue_cx28975_cmd(sc, _DSL_SYSTEM_ENABLE, &t, 1))
- return (-1);
-
- t = 0x63;
- if (issue_cx28975_cmd(sc, _DSL_SYSTEM_CONFIG, &t, 1))
- return (-1);
-
- *(u_int16_t *)parm = cfg.lrate >> 3;
- parm[2] = parm[3] = parm[0];
- parm[5] = cfg.lrate & 7;
- parm[4] = parm[7] = 1;
- parm[6] = 0;
- if (issue_cx28975_cmd(sc, _DSL_MULTI_RATE_CONFIG, parm, 8))
- return (-1);
-
- parm[0] = 0x02 | (cfg.mod << 4);
- parm[1] = 0;
- if (issue_cx28975_cmd(sc, _DSL_TRAINING_MODE, parm, 2))
- return (-1);
-
- bzero(parm, 12);
- parm[0] = 0x04; /* pre-activation: G.hs */
- parm[4] = 0x04; /* no remote configuration */
- parm[7] = 0x01; /* annex A (default) */
- parm[8] = 0xff; /* i-bit mask (all bits) */
- if (issue_cx28975_cmd(sc, _DSL_PREACTIVATION_CFG, parm, 12))
- return (-1);
-
- parm[0] = 0x03; /* dying gasp time - 3 frames */
- parm[1] = thresh[cfg.mod];
- parm[2] = 0xff; /* attenuation */
- parm[3] = 0x04; /* line probe NMR (+2 dB) */
- parm[4] = 0x00; /* reserved */
- parm[5] = 0x00;
- if (issue_cx28975_cmd(sc, _DSL_THRESHOLDS, parm, 6))
- return (-1);
-
- t = cfg.master ? 0x23 : 0x21;
- if (issue_cx28975_cmd(sc, _DSL_FR_PCM_CONFIG, &t, 1))
- return (-1);
-
- t = 0x02;
- if (issue_cx28975_cmd(sc, _DSL_INTR_HOST_MASK, &t, 1))
- return (-1);
-
- sc->state = DOWN;
- return (0);
-}
-
-static int
-download_firmware(struct sbsh_softc *sc, u_int8_t *img, u_int32_t img_len)
-{
- u_int32_t t;
- int i;
- u_int8_t cksum = 0;
-
- for (i = 0; i < img_len; ++i)
- cksum += img[i];
-
- t = img_len;
- if (issue_cx28975_cmd(sc, _DSL_DOWNLOAD_START, (u_int8_t *) &t, 4))
- return (-1);
-
- for (i = 0; img_len >= 75; i += 75, img_len -= 75) {
- if (issue_cx28975_cmd(sc, _DSL_DOWNLOAD_DATA, img + i, 75))
- return (-1);
- }
-
- if (img_len
- && issue_cx28975_cmd(sc, _DSL_DOWNLOAD_DATA, img + i, img_len))
- return (-1);
-
- t = (cksum ^ 0xff) + 1;
- if (issue_cx28975_cmd(sc, _DSL_DOWNLOAD_END, (u_int8_t *) &t, 1))
- return (-1);
-
- return (0);
-}
-
-static int
-issue_cx28975_cmd(struct sbsh_softc *sc, u_int8_t cmd,
- u_int8_t *data, u_int8_t size)
-{
- volatile struct cx28975_cmdarea *p = sc->cmdp;
- volatile u_int8_t *databuf = p->in_data;
- int i;
-
- u_int8_t cksum = 0;
-
- p->in_dest = 0xf0;
- p->in_opcode = cmd;
- p->in_zero = 0;
- p->in_length = --size;
- p->in_csum = 0xf0 ^ cmd ^ size ^ 0xaa;
-
- for (i = 0; i <= size; ++i) {
- cksum ^= *data;
- *databuf++ = *data++; /* only 1 byte per cycle! */
- }
-
- p->in_datasum = cksum ^ 0xaa;
- p->out_ack = _ACK_NOT_COMPLETE;
- p->intr_8051 = 0xfe;
-
- /*
- * XXX: Sleeping here probably breaks lots of things. This should
- * probably be doing a spin loop with a DELAY or some such.
- */
- if (mtx_sleep(sc, &sc->lock, PWAIT, "sbsh", hz << 3))
- return (-1);
-
- while (p->out_ack == _ACK_NOT_COMPLETE)
- ; /* FIXME ! */
-
- if ((p->out_ack & 0x1f) == _ACK_PASS) {
- p->out_ack = 0;
- return (0);
- } else {
- p->out_ack = 0;
- return (-1);
- }
-}
diff --git a/sys/dev/sbsh/if_sbshreg.h b/sys/dev/sbsh/if_sbshreg.h
deleted file mode 100644
index 94cb0aa..0000000
--- a/sys/dev/sbsh/if_sbshreg.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * Granch SBNI16 G.SHDSL Modem driver definitions
- * Written by Denis I. Timofeev, 2002-2003.
- *
- * 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$
- */
-
-/* SBNI16 controller chip definitions */
-
-/* CR bits */
-#define TXEN 0x01 /* transmitter enable */
-#define RXEN 0x02 /* receiver enable */
-#define NCRC 0x04 /* ignore received CRC */
-#define DLBK 0x08 /* digital loopback */
-#define CMOD 0x10 /* 0 - use CRC-32, 1 - CRC-16 */
-#define FMOD 0x20 /* interframe fill: 0 - all ones, 1 - 0xfe */
-#define PMOD 0x40 /* data polarity: 0 - normal, 1 - invert */
-#define XRST 0x80 /* reset the transceiver */
-
-/* CRB bits */
-#define RDBE 0x01 /* read burst enable */
-#define WTBE 0x02 /* write burst enable */
-#define RODD 0x04 /* receive 2-byte alignment */
-#define RXDE 0x08 /* receive data enable */
-
-/* SR and IMR bits */
-#define TXS 0x01 /* transmit success */
-#define RXS 0x02 /* receive success */
-/* SR only */
-#define CRC 0x04 /* CRC error */
-#define OFL 0x08 /* fifo overflow error */
-#define UFL 0x10 /* fifo underflow error */
-#define EXT 0x20 /* interrupt from sk70725 */
-/* IMR only */
-#define TSI 0x80 /* generate test interrupt */
-
-#define LAST_FRAG 0x00008000
-
-#define SBNI16_MAX_FRAME (1536 + 16)
-
-/* We don't have official vendor id yet... */
-#define SBNI16_VENDOR 0x55
-#define SBNI16_DEVICE 0x9d
-#define SBNI16_SUBDEV 3
-
-/* transceiver chip set definitions */
-enum CX28975_API_commands {
- _DSL_RESET_SYSTEM = 0x00,
- _DSL_SYSTEM_ENABLE = 0x01,
- _DSL_AFE_CONFIG = 0x02,
- _DSL_TRAINING_MODE = 0x03,
- _DSL_CLOCK_CONFIG = 0x04,
- _DSL_PCM_MF_LEN = 0x05,
- _DSL_SYSTEM_CONFIG = 0x06,
- _DSL_LOOPBACK = 0x09,
- _DSL_ACTIVATION = 0x0b,
- _DSL_FORCE_DEACTIVATE = 0x0c,
- _DSL_TEST_MODE = 0x0d,
- _DSL_DATA_RATE = 0x0e,
- _DSL_PREACTIVATION_CFG = 0x0f,
- _DSL_FR_PCM_CONFIG = 0x10,
- _DSL_FR_HDSL_CONFIG = 0x11,
- _DSL_PCM_CLK_CONF = 0x12,
- _AFE_TX_GAIN = 0x13,
- _DSL_PREACT_USER_INFO = 0x14,
- _DSL_PREACT_RATE_LIST = 0x15,
- _DSL_TX_ISO_PULSE = 0x16,
- _BP_ERLE_TEST_MODE = 0x18,
- _DSL_MULTI_PAIR_CONFIG = 0x19,
- _DSL_NB_MULTI_RATE_CONFIG = 0x1a,
- _DSL_MULTI_RATE_CONFIG = 0x1b,
- _ATM_PHY_MODE = 0x1c,
- _ATM_PHY_UTOPIA_CONFIG = 0x1d,
- _ATM_PHY_IF_MODE = 0x1e,
- _ATM_PHY_INJECT_HEC_ERROR = 0x1f,
- _ATM_PHY_CONFIG = 0x20,
- _DSL_TNB_BER_STATE = 0x21,
- _DSL_RNB_BER_STATE = 0x22,
- _DSL_TP_BER_STATE = 0x23,
- _DSL_RP_BER_STATE = 0x24,
- _DSL_PRBS_CONFIGURE = 0x25,
- _DSL_CONST_FILL = 0x26,
- _DSL_DBANK = 0x27,
- _DSL_NB_CONFIG = 0x28,
- _DSL_TNB_FRM_OFST = 0x29,
- _DSL_RNB_FRM_OFST = 0x2a,
- _DSL_TP_FRM_OFST = 0x2e,
- _DSL_RP_FRM_OFST = 0x2f,
- _DSL_TP_MAPPER_VALUE = 0x30,
- _DSL_TP_MAPPER_WRITE = 0x31,
- _DSL_RP_MAPPER_VALUE = 0x32,
- _DSL_RP_MAPPER_WRITE = 0x33,
- _DSL_TH_MAPPER_VALUE = 0x34,
- _DSL_TH_MAPPER_WRITE = 0x35,
- _DSL_RH_MAPPER_VALUE = 0x36,
- _DSL_RH_MAPPER_WRITE = 0x37,
- _DSL_TNB_MAPPER_VALUE = 0x38,
- _DSL_TNB_MAPPER_WRITE = 0x39,
- _DSL_RNB_MAPPER_VALUE = 0x3a,
- _DSL_RNB_MAPPER_WRITE = 0x3b,
- _DSL_CLEAR_ERROR_CTRS = 0x40,
- _DSL_INJECT_CRC_ERROR = 0x41,
- _DSL_THRESHOLDS = 0x43,
- _DSL_FR_SET_STATE_MACHINE = 0x4a,
- _DSL_FR_TNB_RESET = 0x4b,
- _DSL_FR_RNB_RESET = 0x4c,
- _EOC_RESET = 0x4d,
- _DSL_FR_TX_RESET = 0x4e,
- _DSL_FR_RX_RESET = 0x4f,
- _DSL_INTR_HOST_MASK = 0x50,
- _DSL_INTR_API_SUBMASK = 0x51,
- _DSL_DOWNLOAD_START = 0x53,
- _DSL_DOWNLOAD_DATA = 0x54,
- _DSL_DOWNLOAD_END = 0x55,
- _DSL_DPLL_CLOCK_GEN = 0x58,
- _DSL_NB_DPLL_CLOCK_GEN = 0x59,
- _DSL_WRITE_REG = 0x75,
- _DSL_WRITE_AFE = 0x76
-};
-
-enum CX28975_status_commands {
- _DSL_READ_CONTROL = 0x80,
- _DSL_FAR_END_ATTEN = 0x82,
- _DSL_NOISE_MARGIN = 0x83,
- _DSL_STATUS = 0x85,
- _DSL_PREACT_GET_FE_CAPS = 0x88,
- _DSL_PREACT_GET_OPT_DATA_RATE = 0x89,
- _DSL_VERSIONS = 0x8a,
- _DSL_TP_BER_RESULTS = 0x8c,
- _DSL_RP_BER_RESULTS = 0x8d,
- _DSL_STAGE_NUMBER = 0x8f,
- _DSL_AFE_SETTING = 0x90,
- _DSL_TNB_BER_RESULTS = 0x91,
- _DSL_RNB_BER_RESULTS = 0x92,
- _BP_ERLE_RESULTS = 0x93,
- _DSL_POWER_BACK_OFF_RESULT = 0x94,
- _DSL_OPER_ERR_CTRS = 0x9c,
- _DSL_TIME = 0x9d,
- _DSL_HDSL_PERF_ERR_CTRS = 0x9e,
- _DSL_READ_REG = 0xa0,
- _DSL_READ_AFE = 0xa1,
- _DSL_SYSTEM_PERF_ERR_CTRS = 0xa2,
- _DSL_TP_MAPPER_READ = 0xa3,
- _DSL_RP_MAPPER_READ = 0xa4,
- _DSL_TH_MAPPER_READ = 0xa5,
- _DSL_RH_MAPPER_READ = 0xa6,
- _DSL_TNB_MAPPER_READ = 0xa7,
- _DSL_RNB_MAPPER_READ = 0xa8,
- _EOC_RX_GET_STATS = 0xae,
- _EOC_TX_SEND_COMMAND = 0xb0,
- _EOC_RX_GET_MSG = 0xb1,
- _EOC_TX_GET_MSG_STATUS = 0xb2,
- _EOC_TX_DELETE_MSG = 0xb3,
- _ATM_PHY_OPER_ERR_CTRS = 0xb8,
- _ATM_PHY_PERF_ERR_CTRS = 0xb9,
- _ATM_PHY_CELL_CTRS = 0xba
-};
-
-enum CX28975_acknoledge_status_codes {
- _ACK_NOT_COMPLETE = 0x00,
- _ACK_PASS = 0x01,
- _ACK_BUSY = 0x02,
- _ACK_NOT_APPLICABLE = 0x03,
- _ACK_INVALID_DEST = 0x04,
- _ACK_INVALID_OPCODE = 0x05,
- _ACK_INVALID_LENGTH = 0x06,
- _ACK_INVALID_DATA = 0x07,
- _ACK_INVALID_CHKSUM = 0x08,
- _ACK_NO_RESULT = 0x09,
- _ACK_NOT_AVAILABLE = 0x0a,
- _ACK_BOOT_WAKE_UP = 0x0d,
- _ACK_OPER_WAKE_UP = 0x0e
-};
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 8023d10..9ffd1d1 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -236,7 +236,6 @@ SUBDIR= ${_3dfx} \
rum \
${_s3} \
${_safe} \
- sbsh \
scc \
scd \
${_scsi_low} \
diff --git a/sys/modules/sbsh/Makefile b/sys/modules/sbsh/Makefile
deleted file mode 100644
index 7456956..0000000
--- a/sys/modules/sbsh/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${.CURDIR}/../../dev/sbsh
-
-KMOD= if_sbsh
-SRCS= if_sbsh.c bus_if.h device_if.h pci_if.h
-
-.include <bsd.kmod.mk>
OpenPOWER on IntegriCloud