diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 4af393890edd..ed74d3da9c3e 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -50,7 +50,6 @@ MAN= aac.4 \ ciss.4 \ cm.4 \ cmx.4 \ - cnw.4 \ coda.4 \ ${_coretemp.4} \ cpufreq.4 \ @@ -442,7 +441,6 @@ MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 -MLINKS+=cnw.4 if_cnw.4 MLINKS+=crypto.4 cryptodev.4 MLINKS+=cue.4 if_cue.4 MLINKS+=dc.4 if_dc.4 diff --git a/share/man/man4/cnw.4 b/share/man/man4/cnw.4 deleted file mode 100644 index 91f5a124c5b4..000000000000 --- a/share/man/man4/cnw.4 +++ /dev/null @@ -1,125 +0,0 @@ -.\" $NetBSD: cnw.4,v 1.12 2001/09/12 18:19:17 wiz Exp $ -.\" -.\" Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that this notice is retained, -.\" the conditions in the following notices are met, and terms applying -.\" to contributors in the following notices also apply to Berkeley -.\" Software Design, Inc. -.\" -.\" 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 -.\" Berkeley Software Design, Inc. -.\" 4. Neither the name of the Berkeley Software Design, Inc. nor the names -.\" of its contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``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 BERKELEY SOFTWARE DESIGN, INC. 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. -.\" -.\" PAO2 Id: cnw.4,v 1.1.1.1 1997/12/11 14:46:23 itojun Exp -.\" -.\" $FreeBSD$ -.\" -.Dd September 5, 2004 -.Dt CNW 4 -.Os -.Sh NAME -.Nm cnw -.Nd Netwave AirSurfer wireless network driver -.Sh SYNOPSIS -.Cd "device cnw" -.Sh DESCRIPTION -The -.Nm -interface provides access to a theoretical 1Mb/s wireless Ethernet network -based on the Netwave AirSurfer Wireless LAN (formerly known as the Xircom -Netwave Wireless LAN). -.Pp -Note that the driver does not support newer devices -such as the Netwave AirSurfer -.Dq Plus , -or the BayStack 650/660. -.Pp -Netwave devices are not compatible with IEEE 802.11 wireless networks. -Also note that there are Netwave devices with different wireless frequency, -depending on the radio band plan in each country. -.Pp -The card uses 36K of I/O memory mapped to the card. -.\"The card uses 32K of I/O memory mapped to the card along with either 16 I/O ports -.\"or 4K of additional I/O memory for access to command registers. -.\"The driver currently only supports the use of the additional 4K of I/O memory. -You may need to increase memory space available to the PC Card controller. -See -.Xr pccard 4 -for details. -.Pp -In use, the cards appear to achieve up to a 420Kb/s transfer rate, though -a transfer rate between 250Kb/s and 350Kb/s is typical. -.Pp -The card operates in the 2.4GHz frequency range and is subject to interference -from microwaves, IEEE 802.11 wireless network devices, as well as earth. -For example, it seems that IEEE 802.11 channel 14 conflicts with Netwave -(US frequency). -They interfere with each other if they are both operated -in the same geographic region, causing weird packet loss. -You may be able to avoid the interference with IEEE 802.11 devices, -by changing the IEEE 802.11 channel. -.Sh HARDWARE -Cards supported by the -.Nm -driver include: -.Pp -.Bl -bullet -compact -.It -Xircom CreditCard Netwave -.It -NetWave AirSurfer -.El -.Sh DIAGNOSTICS -.Bl -diag -.It "cnw0: can't map memory" -Indicates that the driver was not able to allocate enough PC Card bus -address space into which to map the device. -See -.Xr pccard 4 -and increase memory available to the PC Card controller. -.El -.Sh SEE ALSO -.Xr arp 4 , -.Xr inet 4 , -.Xr intro 4 , -.Xr pccard 4 -.Sh HISTORY -The -.Nm -driver was ported from -.Nx -by -.An Hiroyuki Aizu Aq aizu@jaist.ac.jp . -It first appeared in -.Nx 1.4 . -The first -.Fx -release to include it was -.Fx 5.0 . -This manual page was adopted from -.Nx -by -.An Christian Brueffer Aq brueffer@FreeBSD.org . diff --git a/sys/conf/NOTES b/sys/conf/NOTES index a3c336545fd8..cd2295bee0c9 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1737,7 +1737,6 @@ device miibus # the embedded gigE NICs on Dell PowerEdge 2550 servers. # cm: Arcnet SMC COM90c26 / SMC COM90c56 # (and SMC COM90c66 in '56 compatibility mode) adapters. -# cnw: Xircom CNW/Netware Airsurfer PC Card adapter # dc: Support for PCI fast ethernet adapters based on the DEC/Intel 21143 # and various workalikes including: # the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics @@ -1864,7 +1863,6 @@ hint.sn.0.at="isa" hint.sn.0.port="0x300" hint.sn.0.irq="10" device an -device cnw device wi device xe diff --git a/sys/conf/files b/sys/conf/files index 77bd32e6bc03..b9f90dd66c09 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -509,7 +509,6 @@ dev/ciss/ciss.c optional ciss dev/cm/smc90cx6.c optional cm dev/cmx/cmx.c optional cmx dev/cmx/cmx_pccard.c optional cmx pccard -dev/cnw/if_cnw.c optional cnw pccard dev/cpufreq/ichss.c optional cpufreq dev/cs/if_cs.c optional cs dev/cs/if_cs_isa.c optional cs isa diff --git a/sys/dev/cnw/if_cnw.c b/sys/dev/cnw/if_cnw.c deleted file mode 100644 index b27afdfb13d4..000000000000 --- a/sys/dev/cnw/if_cnw.c +++ /dev/null @@ -1,1289 +0,0 @@ -/* $NetBSD: if_cnw.c,v 1.15 2000/10/16 10:26:41 itojun Exp $ */ - - -#include -__FBSDID("$FreeBSD$"); -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Michael Eriksson. - * - * 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 the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1996, 1997 Berkeley Software Design, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that this notice is retained, - * the conditions in the following notices are met, and terms applying - * to contributors in the following notices also apply to Berkeley - * Software Design, Inc. - * - * 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 - * Berkeley Software Design, Inc. - * 4. Neither the name of the Berkeley Software Design, Inc. nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``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 BERKELEY SOFTWARE DESIGN, INC. 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. - * - * Paul Borman, December 1996 - * - * This driver is derived from a generic frame work which is - * Copyright(c) 1994,1995,1996 - * Yoichi Shinoda, Yoshitaka Tokugawa, WIDE Project, Wildboar Project - * and Foretune. All rights reserved. - * - * A linux driver was used as the "hardware reference manual" (i.e., - * to determine registers and a general outline of how the card works) - * That driver is publically available and copyright - * - * John Markus Bjørndalen - * Department of Computer Science - * University of Tromsø - * Norway - * johnm@staff.cs.uit.no, http://www.cs.uit.no/~johnm/ - */ - -/* - * This is a driver for the Xircom CreditCard Netwave (also known as - * the Netwave Airsurfer) wireless LAN PCMCIA adapter. - * - * When this driver was developed, the Linux Netwave driver was used - * as a hardware manual. That driver is Copyright (c) 1997 University - * of Tromsø, Norway. It is part of the Linix pcmcia-cs package that - * can be found at - * http://hyper.stanford.edu/HyperNews/get/pcmcia/home.html. The most - * recent version of the pcmcia-cs package when this driver was - * written was 3.0.6. - * - * Unfortunately, a lot of explicit numeric constants were used in the - * Linux driver. I have tried to use symbolic names whenever possible, - * but since I don't have any real hardware documentation, there's - * still one or two "magic numbers" :-(. - * - * Driver limitations: This driver doesn't do multicasting or receiver - * promiscuity, because of missing hardware documentation. I couldn't - * get receiver promiscuity to work, and I haven't even tried - * multicast. Volunteers are welcome, of course :-). - */ - -#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 "card_if.h" - -#include -#include - -/* - * Let these be patchable variables, initialized from macros that can - * be set in the kernel config file. Someone with lots of spare time - * could probably write a nice Netwave configuration program to do - * this a little bit more elegantly :-). - */ -#ifndef CNW_DOMAIN -#define CNW_DOMAIN 0x100 -#endif -int cnw_domain = (int)CNW_DOMAIN; /* Domain */ - -#ifndef CNW_SCRAMBLEKEY -#define CNW_SCRAMBLEKEY 0 -#endif -int cnw_skey = CNW_SCRAMBLEKEY; /* Scramble key */ - -/* - * The card appears to work much better when we only allow one packet - * "in the air" at a time. This is done by not allowing another packet - * on the card, even if there is room. Turning this off will allow the - * driver to stuff packets on the card as soon as a transmit buffer is - * available. This does increase the number of collisions, though. - * We can que a second packet if there are transmit buffers available, - * but we do not actually send the packet until the last packet has - * been written. - */ -#define ONE_AT_A_TIME - -/* - * Netwave cards choke if we try to use io memory address >= 0x400. - * Even though, CIS tuple does not talk about this. - * Use memory mapped access. - */ -#ifndef MEMORY_MAPPED -#define MEMORY_MAPPED -#endif - -struct cnw_softc { - struct ifnet *sc_ifp; - struct ifmedia ifmedia; - device_t dev; - struct cnwstats sc_stats; - int sc_domain; /* Netwave domain */ - int sc_skey; /* Netwave scramble key */ - - struct resource * mem_res; - struct resource * irq; - - bus_addr_t sc_memoff; /* ...offset */ - bus_space_tag_t sc_memt; /* ...bus_space tag */ - bus_space_handle_t sc_memh; /* ...bus_space handle */ - - void * cnw_intrhand; - int cnw_gone; - - struct timeval sc_txlast; /* When the last xmit was made */ - int sc_active; /* Currently xmitting a packet */ - struct mtx sc_lock; - struct callout sc_timer; - int sc_tx_timeout; -}; - -#define CNW_LOCK(sc) mtx_lock(&(sc)->sc_lock) -#define CNW_UNLOCK(sc) mtx_unlock(&(sc)->sc_lock) -#define CNW_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_lock, MA_OWNED) - -static void cnw_freebsd_init (void *); -static void cnw_freebsd_init_locked(struct cnw_softc *); -static void cnw_stop (struct cnw_softc *); - -static int cnw_pccard_probe (device_t); -static int cnw_pccard_attach (device_t); -static int cnw_pccard_detach (device_t); -static void cnw_shutdown (device_t); -static int cnw_alloc (device_t); -static void cnw_free (device_t); - -static device_method_t cnw_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, cnw_pccard_probe), - DEVMETHOD(device_attach, cnw_pccard_attach), - DEVMETHOD(device_detach, cnw_pccard_detach), - DEVMETHOD(device_shutdown, cnw_shutdown), - - { 0, 0 } -}; - -static driver_t cnw_pccard_driver = { - "cnw", - cnw_pccard_methods, - sizeof(struct cnw_softc) -}; - -static devclass_t cnw_pccard_devclass; - -DRIVER_MODULE(cnw, pccard, cnw_pccard_driver, cnw_pccard_devclass, 0, 0); -MODULE_DEPEND(cnw, ether, 1, 1, 1); - -void cnw_reset(struct cnw_softc *); -void cnw_init(struct cnw_softc *); -void cnw_start(struct ifnet *); -void cnw_start_locked(struct ifnet *); -void cnw_transmit(struct cnw_softc *, struct mbuf *); -struct mbuf *cnw_read(struct cnw_softc *); -void cnw_recv(struct cnw_softc *); -void cnw_intr(void *arg); -int cnw_ioctl(struct ifnet *, u_long, caddr_t); -void cnw_watchdog(void *); -static int cnw_setdomain(struct cnw_softc *, int); -static int cnw_setkey(struct cnw_softc *, int); - -/* ---------------------------------------------------------------- */ - -/* Help routines */ -static int wait_WOC(struct cnw_softc *, int); -static int read16(struct cnw_softc *, int); -static int cnw_cmd(struct cnw_softc *, int, int, int, int); - -/* - * Wait until the WOC (Write Operation Complete) bit in the - * ASR (Adapter Status Register) is asserted. - */ -static int -wait_WOC(sc, line) - struct cnw_softc *sc; - int line; -{ - int i, asr; - - for (i = 0; i < 5000; i++) { -#ifndef MEMORY_MAPPED - asr = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CNW_REG_ASR); -#else - asr = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_ASR); -#endif - if (asr & CNW_ASR_WOC) - return (0); - DELAY(100); - } - if (line > 0) - device_printf(sc->dev, "wedged at line %d\n", line); - return (1); -} -#define WAIT_WOC(sc) wait_WOC(sc, __LINE__) - - -/* - * Read a 16 bit value from the card. - */ -static int -read16(sc, offset) - struct cnw_softc *sc; - int offset; -{ - int hi, lo; - int offs = sc->sc_memoff + offset; - - /* This could presumably be done more efficient with - * bus_space_read_2(), but I don't know anything about the - * byte sex guarantees... Besides, this is pretty cheap as - * well :-) - */ - lo = bus_space_read_1(sc->sc_memt, sc->sc_memh, offs); - hi = bus_space_read_1(sc->sc_memt, sc->sc_memh, offs + 1); - return ((hi << 8) | lo); -} - - -/* - * Send a command to the card by writing it to the command buffer. - */ -int -cnw_cmd(sc, cmd, count, arg1, arg2) - struct cnw_softc *sc; - int cmd, count, arg1, arg2; -{ - int ptr = sc->sc_memoff + CNW_EREG_CB; - - if (wait_WOC(sc, 0)) { - device_printf(sc->dev, "wedged when issuing cmd 0x%x\n", cmd); - /* - * We'll continue anyway, as that's probably the best - * thing we can do; at least the user knows there's a - * problem, and can reset the interface with ifconfig - * down/up. - */ - } - - bus_space_write_1(sc->sc_memt, sc->sc_memh, ptr, cmd); - if (count > 0) { - bus_space_write_1(sc->sc_memt, sc->sc_memh, ptr + 1, arg1); - if (count > 1) - bus_space_write_1(sc->sc_memt, sc->sc_memh, - ptr + 2, arg2); - } - bus_space_write_1(sc->sc_memt, sc->sc_memh, - ptr + count + 1, CNW_CMD_EOC); - return (0); -} -#define CNW_CMD0(sc, cmd) \ - do { cnw_cmd(sc, cmd, 0, 0, 0); } while (0) -#define CNW_CMD1(sc, cmd, arg1) \ - do { cnw_cmd(sc, cmd, 1, arg1 , 0); } while (0) -#define CNW_CMD2(sc, cmd, arg1, arg2) \ - do { cnw_cmd(sc, cmd, 2, arg1, arg2); } while (0) - -/* ---------------------------------------------------------------- */ - -/* - * Reset the hardware. - */ -void -cnw_reset(sc) - struct cnw_softc *sc; -{ -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "resetting\n"); -#endif - wait_WOC(sc, 0); -#ifndef MEMORY_MAPPED - bus_space_write_1(sc->sc_iot, sc->sc_ioh, CNW_REG_PMR, CNW_PMR_RESET); -#else - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_PMR, CNW_PMR_RESET); -#endif - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_ASCC, CNW_ASR_WOC); -#ifndef MEMORY_MAPPED - bus_space_write_1(sc->sc_iot, sc->sc_ioh, CNW_REG_PMR, 0); -#else - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_PMR, 0); -#endif -} - - -/* - * Initialize the card. - */ -void -cnw_init(sc) - struct cnw_softc *sc; -{ - struct ifnet *ifp = sc->sc_ifp; - const u_int8_t rxmode = - CNW_RXCONF_RXENA | CNW_RXCONF_BCAST | CNW_RXCONF_AMP; - - /* Reset the card */ - cnw_reset(sc); - - /* Issue a NOP to check the card */ - CNW_CMD0(sc, CNW_CMD_NOP); - - /* Set up receive configuration */ - CNW_CMD1(sc, CNW_CMD_SRC, - rxmode | ((ifp->if_flags & IFF_PROMISC) ? CNW_RXCONF_PRO : 0)); - - /* Set up transmit configuration */ - CNW_CMD1(sc, CNW_CMD_STC, CNW_TXCONF_TXENA); - - /* Set domain */ - CNW_CMD2(sc, CNW_CMD_SMD, sc->sc_domain, sc->sc_domain >> 8); - - /* Set scramble key */ - CNW_CMD2(sc, CNW_CMD_SSK, sc->sc_skey, sc->sc_skey >> 8); - - /* Enable interrupts */ - WAIT_WOC(sc); -#ifndef MEMORY_MAPPED - bus_space_write_1(sc->sc_iot, sc->sc_ioh, - CNW_REG_IMR, CNW_IMR_IENA | CNW_IMR_RFU1); -#else - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_IMR, - CNW_IMR_IENA | CNW_IMR_RFU1); -#endif - - /* Enable receiver */ - CNW_CMD0(sc, CNW_CMD_ER); - - /* "Set the IENA bit in COR" */ - WAIT_WOC(sc); -#ifndef MEMORY_MAPPED - bus_space_write_1(sc->sc_iot, sc->sc_ioh, CNW_REG_COR, - CNW_COR_IENA | CNW_COR_LVLREQ); -#else - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_COR, - CNW_COR_IENA | CNW_COR_LVLREQ); -#endif -} - - - -/* - * Start outputting on the interface. - */ -void -cnw_start(ifp) - struct ifnet *ifp; -{ - struct cnw_softc *sc = ifp->if_softc; - - CNW_LOCK(sc); - cnw_start_locked(ifp); - CNW_UNLOCK(sc); -} - -void -cnw_start_locked(ifp) - struct ifnet *ifp; -{ - struct cnw_softc *sc = ifp->if_softc; - struct mbuf *m0; - int lif; - int asr; -#ifdef ONE_AT_A_TIME - struct timeval now; -#endif - -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "cnw_start\n"); - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) - if_printf(ifp, "cnw_start reentered\n"); -#endif - - if (sc->cnw_gone) - return; - - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - - for (;;) { -#ifdef ONE_AT_A_TIME - microtime(&now); - now.tv_sec -= sc->sc_txlast.tv_sec; - now.tv_usec -= sc->sc_txlast.tv_usec; - if (now.tv_usec < 0) { - now.tv_usec += 1000000; - now.tv_sec--; - } - - /* - * Don't ship this packet out until the last - * packet has left the building. - * If we have not tried to send a packet for 1/5 - * a second then we assume we lost an interrupt, - * lets go on and send the next packet anyhow. - * - * I suppose we could check to see if it is okay - * to put additional packets on the card (beyond - * the one already waiting to be sent) but I don't - * think we would get any improvement in speed as - * we should have ample time to put the next packet - * on while this one is going out. - */ - if (sc->sc_active && now.tv_sec == 0 && now.tv_usec < 200000) - break; -#endif - - /* Make sure the link integrity field is on */ - WAIT_WOC(sc); - lif = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_LIF); - if (lif == 0) { -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "link integrity %d\n", lif); -#endif - break; - } - - /* Is there any buffer space available on the card? */ - WAIT_WOC(sc); -#ifndef MEMORY_MAPPED - asr = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CNW_REG_ASR); -#else - asr = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_ASR); -#endif - if (!(asr & CNW_ASR_TXBA)) { -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "no buffer space\n"); -#endif - break; - } - - sc->sc_stats.nws_tx++; - - IF_DEQUEUE(&ifp->if_snd, m0); - if (m0 == 0) - break; - - BPF_MTAP(ifp, m0); - - cnw_transmit(sc, m0); - ++ifp->if_opackets; - sc->sc_tx_timeout = 3; - - microtime(&sc->sc_txlast); - sc->sc_active = 1; - } - - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -} - -/* - * Transmit a packet. - */ -void -cnw_transmit(sc, m) - struct cnw_softc *sc; - struct mbuf *m; -{ - int buffer, bufsize, bufoffset, bufptr, bufspace, len, mbytes, n; - u_int8_t *mptr; - - /* Get buffer info from card */ - buffer = read16(sc, CNW_EREG_TDP); - bufsize = read16(sc, CNW_EREG_TDP + 2); - bufoffset = read16(sc, CNW_EREG_TDP + 4); -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "cnw_transmit b=0x%x s=%d o=0x%x\n", - buffer, bufsize, bufoffset); -#endif - - /* Copy data from mbuf chain to card buffers */ - bufptr = sc->sc_memoff + buffer + bufoffset; - bufspace = bufsize; - len = 0; - while (m) { - mptr = mtod(m, u_int8_t *); - mbytes = m->m_len; - len += mbytes; - while (mbytes > 0) { - if (bufspace == 0) { - buffer = read16(sc, buffer); - bufptr = sc->sc_memoff + buffer + bufoffset; - bufspace = bufsize; -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, " next buffer @0x%x\n", - buffer); -#endif - } - n = mbytes <= bufspace ? mbytes : bufspace; - bus_space_write_region_1(sc->sc_memt, sc->sc_memh, - bufptr, mptr, n); - bufptr += n; - bufspace -= n; - mptr += n; - mbytes -= n; - } - m = m_free(m); - } - - /* Issue transmit command */ - CNW_CMD2(sc, CNW_CMD_TL, len, len >> 8); -} - - -/* - * Pull a packet from the card into an mbuf chain. - */ -struct mbuf * -cnw_read(sc) - struct cnw_softc *sc; -{ - struct mbuf *m, *top, **mp; - int totbytes, buffer, bufbytes, bufptr, mbytes, n; - u_int8_t *mptr; - - WAIT_WOC(sc); - totbytes = read16(sc, CNW_EREG_RDP); -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "recv %d bytes\n", totbytes); -#endif - buffer = CNW_EREG_RDP + 2; - bufbytes = 0; - bufptr = 0; /* XXX make gcc happy */ - - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); - m->m_pkthdr.rcvif = sc->sc_ifp; - m->m_pkthdr.len = totbytes; - mbytes = MHLEN; - top = 0; - mp = ⊤ - - while (totbytes > 0) { - if (top) { - MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { - m_freem(top); - return (0); - } - mbytes = MLEN; - } - if (totbytes >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_free(m); - m_freem(top); - return (0); - } - mbytes = MCLBYTES; - } - if (!top) { - int pad = ALIGN(sizeof(struct ether_header)) - - sizeof(struct ether_header); - m->m_data += pad; - mbytes -= pad; - } - mptr = mtod(m, u_int8_t *); - mbytes = m->m_len = min(totbytes, mbytes); - totbytes -= mbytes; - while (mbytes > 0) { - if (bufbytes == 0) { - buffer = read16(sc, buffer); - bufbytes = read16(sc, buffer + 2); - bufptr = sc->sc_memoff + buffer + - read16(sc, buffer + 4); -#ifdef CNW_DEBUG - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, " %d bytes @0x%x+0x%x\n", - bufbytes, - buffer, bufptr - buffer - - sc->sc_memoff); -#endif - } - n = mbytes <= bufbytes ? mbytes : bufbytes; - bus_space_read_region_1(sc->sc_memt, sc->sc_memh, - bufptr, mptr, n); - bufbytes -= n; - bufptr += n; - mbytes -= n; - mptr += n; - } - *mp = m; - mp = &m->m_next; - } - - return (top); -} - - -/* - * Handle received packets. - */ -void -cnw_recv(sc) - struct cnw_softc *sc; -{ - int rser; - struct ifnet *ifp = sc->sc_ifp; - struct mbuf *m; - - CNW_ASSERT_LOCKED(sc); - for (;;) { - WAIT_WOC(sc); - rser = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_RSER); - if (!(rser & CNW_RSER_RXAVAIL)) - return; - - /* Pull packet off card */ - m = cnw_read(sc); - - /* Acknowledge packet */ - CNW_CMD0(sc, CNW_CMD_SRP); - - /* Did we manage to get the packet from the interface? */ - if (m == 0) { - ++ifp->if_ierrors; - return; - } - ++ifp->if_ipackets; - - /* Pass the packet up. */ - CNW_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - CNW_LOCK(sc); - } -} - - -/* - * Interrupt handler. - */ -void -cnw_intr(arg) - void *arg; -{ - struct cnw_softc *sc = arg; - struct ifnet *ifp = sc->sc_ifp; - int ret, status, rser, tser; - - - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - return; - CNW_LOCK(sc); - sc->sc_tx_timeout = 0; /* stop watchdog timer */ - - ret = 0; - for (;;) { - WAIT_WOC(sc); -#ifndef MEMORY_MAPPED - status = bus_space_read_1(sc->sc_iot, sc->sc_ioh, - CNW_REG_CCSR); -#else - status = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_CCSR); -#endif - - if (!(status & 0x02)) { - if (ret == 0) - device_printf(sc->dev, "spurious interrupt\n"); - CNW_UNLOCK(sc); - return; - } - ret = 1; - -#ifndef MEMORY_MAPPED - status = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CNW_REG_ASR); -#else - status = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_IOM_OFF + CNW_REG_ASR); -#endif - - /* Anything to receive? */ - if (status & CNW_ASR_RXRDY) { - sc->sc_stats.nws_rx++; - cnw_recv(sc); - } - - /* Receive error */ - if (status & CNW_ASR_RXERR) { - /* - * I get a *lot* of spurious receive errors - * (many per second), even when the interface - * is quiescent, so we don't increment - * if_ierrors here. - */ - rser = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_RSER); - - /* RX statistics */ - sc->sc_stats.nws_rxerr++; - if (rser & CNW_RSER_RXBIG) - sc->sc_stats.nws_rxframe++; - if (rser & CNW_RSER_RXCRC) - sc->sc_stats.nws_rxcrcerror++; - if (rser & CNW_RSER_RXOVERRUN) - sc->sc_stats.nws_rxoverrun++; - if (rser & CNW_RSER_RXOVERFLOW) - sc->sc_stats.nws_rxoverflow++; - if (rser & CNW_RSER_RXERR) - sc->sc_stats.nws_rxerrors++; - if (rser & CNW_RSER_RXAVAIL) - sc->sc_stats.nws_rxavail++; - - /* Clear error bits in RSER */ - WAIT_WOC(sc); - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_RSERW, - CNW_RSER_RXERR | - (rser & (CNW_RSER_RXCRC | CNW_RSER_RXBIG))); - /* Clear RXERR in ASR */ - WAIT_WOC(sc); - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_ASCC, CNW_ASR_RXERR); - } - - /* Transmit done */ - if (status & CNW_ASR_TXDN) { - tser = bus_space_read_1(sc->sc_memt, sc->sc_memh, - CNW_EREG_TSER); - - /* TX statistics */ - if (tser & CNW_TSER_TXERR) - sc->sc_stats.nws_txerrors++; - if (tser & CNW_TSER_TXNOAP) - sc->sc_stats.nws_txlostcd++; - if (tser & CNW_TSER_TXGU) - sc->sc_stats.nws_txabort++; - - if (tser & CNW_TSER_TXOK) { - sc->sc_stats.nws_txokay++; - sc->sc_stats.nws_txretries[status & 0xf]++; - WAIT_WOC(sc); - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_TSERW, - CNW_TSER_TXOK | CNW_TSER_RTRY); - } - - if (tser & CNW_TSER_ERROR) { - ++ifp->if_oerrors; - WAIT_WOC(sc); - bus_space_write_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_TSERW, - (tser & CNW_TSER_ERROR) | - CNW_TSER_RTRY); - } - - sc->sc_active = 0; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - /* Continue to send packets from the queue */ - cnw_start_locked(ifp); - } - - } - CNW_UNLOCK(sc); -} - - -/* - * Handle device ioctls. - */ -int -cnw_ioctl(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; -{ - struct cnw_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - int error = 0; - struct thread *td = curthread; /* XXX */ - - - if (sc->cnw_gone) { - return(ENODEV); - } - - switch (cmd) { - - case SIOCSIFADDR: - error = ether_ioctl(ifp, cmd, data); - break; - - case SIOCSIFFLAGS: - CNW_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - cnw_freebsd_init_locked(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - cnw_stop(sc); - } else { - cnw_freebsd_init_locked(sc); - } - } - CNW_UNLOCK(sc); - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - /* XXX */ - error = 0; - break; - - case SIOCGCNWDOMAIN: - CNW_LOCK(sc); - ((struct ifreq *)data)->ifr_domain = sc->sc_domain; - CNW_UNLOCK(sc); - break; - - case SIOCSCNWDOMAIN: - error = priv_check(td, PRIV_DRIVER); - if (error) - break; - CNW_LOCK(sc); - error = cnw_setdomain(sc, ifr->ifr_domain); - CNW_UNLOCK(sc); - break; - - case SIOCSCNWKEY: - error = priv_check(td, PRIV_DRIVER); - if (error) - break; - CNW_LOCK(sc); - error = cnw_setkey(sc, (int)ifr->ifr_key); - CNW_UNLOCK(sc); - break; - - case SIOCGCNWSTATUS: - error = priv_check(td, PRIV_DRIVER); - if (error) - break; - CNW_LOCK(sc); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - CNW_UNLOCK(sc); - break; - } - bus_space_read_region_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_CB, - ((struct cnwstatus *)data)->data, - sizeof(((struct cnwstatus *)data)->data)); - CNW_UNLOCK(sc); - break; - - case SIOCGCNWSTATS: - CNW_LOCK(sc); - bcopy((void *)&sc->sc_stats, - (void *)&(((struct cnwistats *)data)->stats), - sizeof(struct cnwstats)); - CNW_UNLOCK(sc); - break; - - default: - error = EINVAL; - break; - } - - return (error); -} - - -/* - * Device timeout/watchdog routine. Entered if the device neglects to - * generate an interrupt after a transmit has been started on it. - */ -void -cnw_watchdog(void *arg) -{ - struct cnw_softc *sc = arg; - - CNW_ASSERT_LOCKED(sc); - if (sc->sc_tx_timeout && --sc->sc_tx_timeout == 0) { - device_printf(sc->dev, "device timeout; card reset\n"); - ++sc->sc_ifp->if_oerrors; - cnw_freebsd_init_locked(sc); - } - callout_reset(&sc->sc_timer, hz, cnw_watchdog, sc); -} - -int -cnw_setdomain(sc, domain) - struct cnw_softc *sc; - int domain; -{ - - if (domain & ~0x1ff) - return EINVAL; - - CNW_CMD2(sc, CNW_CMD_SMD, domain, domain >> 8); - - sc->sc_domain = domain; - return 0; -} - -int -cnw_setkey(sc, key) - struct cnw_softc *sc; - int key; -{ - - if (key & ~0xffff) - return EINVAL; - - CNW_CMD2(sc, CNW_CMD_SSK, key, key >> 8); - - sc->sc_skey = key; - return 0; -} - -static void -cnw_freebsd_init(xsc) - void *xsc; -{ - struct cnw_softc *sc = xsc; - - CNW_LOCK(sc); - cnw_freebsd_init_locked(sc); - CNW_UNLOCK(sc); -} - -static void -cnw_freebsd_init_locked(struct cnw_softc *sc) -{ - struct ifnet *ifp = sc->sc_ifp; - - if (sc->cnw_gone) - return; - - cnw_init(sc); - -#if 0 - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - cnw_stop(sc); -#endif - - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - callout_reset(&sc->sc_timer, hz, cnw_watchdog, sc); - -/* sc->cnw_stat_ch = timeout(cnw_inquire, sc, hz * 60); */ - - cnw_start_locked(ifp); - - return; -} - -static void -cnw_stop(sc) - struct cnw_softc *sc; -{ - struct ifnet *ifp; - - if (sc->cnw_gone) - return; - - sc->sc_tx_timeout = 0; - callout_stop(&sc->sc_timer); - cnw_reset(sc); - - ifp = sc->sc_ifp; - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - - return; -} - -static int -cnw_pccard_probe(dev) - device_t dev; -{ - struct cnw_softc *sc; - int error; - - sc = device_get_softc(dev); - sc->cnw_gone = 0; - - error = cnw_alloc(dev); - if (error) - return (error); - - device_set_desc(dev, "Netwave AirSurfer Wireless LAN"); - cnw_free(dev); - - return (0); -} - -static int -cnw_pccard_detach(dev) - device_t dev; -{ - struct cnw_softc *sc; - struct ifnet *ifp; - - sc = device_get_softc(dev); - ifp = sc->sc_ifp; - - if (sc->cnw_gone) { - device_printf(dev, "already unloaded\n"); - return(ENODEV); - } - - CNW_LOCK(sc); - cnw_stop(sc); - CNW_UNLOCK(sc); - - callout_drain(&sc->sc_timer); - ether_ifdetach(ifp); - bus_teardown_intr(dev, sc->irq, sc->cnw_intrhand); - cnw_free(dev); - if_free(ifp); - mtx_destroy(&sc->sc_lock); - sc->cnw_gone = 1; - - return(0); -} - -static int -cnw_pccard_attach(device_t dev) -{ - struct cnw_softc *sc; - struct ifnet *ifp; - int i, error; - u_char eaddr[6]; - - sc = device_get_softc(dev); - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(dev, "if_alloc() failed\n"); - return (ENOSPC); - } - - - error = cnw_alloc(dev); - if (error) { - device_printf(dev, "cnw_alloc() failed! (%d)\n", error); - if_free(ifp); - return (error); - } - - mtx_init(&sc->sc_lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->sc_timer, &sc->sc_lock, 0); - - /* Set initial values */ - sc->sc_domain = cnw_domain; - sc->sc_skey = cnw_skey; - - /* Reset the NIC. */ - cnw_reset(sc); - - /* Get MAC address */ - for (i=0; i< ETHER_ADDR_LEN; i++) { - eaddr[i] = bus_space_read_1(sc->sc_memt, sc->sc_memh, - sc->sc_memoff + CNW_EREG_PA + i); - } - - 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 = cnw_ioctl; - ifp->if_start = cnw_start; - ifp->if_init = cnw_freebsd_init; - ifp->if_baudrate = 1 * 1000* 1000; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - - CNW_LOCK(sc); - cnw_freebsd_init_locked(sc); - cnw_stop(sc); - CNW_UNLOCK(sc); - - /* - * Call MI attach routine. - */ - ether_ifattach(ifp, eaddr); -/* callout_handle_init(&sc->cnw_stat_ch); */ - - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, - cnw_intr, sc, &sc->cnw_intrhand); - - if (error) { - device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); - mtx_destroy(&sc->sc_lock); - cnw_free(dev); - if_free(ifp); - return (error); - } - return(0); -} - -static void -cnw_shutdown(dev) - device_t dev; -{ - struct cnw_softc *sc; - - sc = device_get_softc(dev); - CNW_LOCK(sc); - cnw_stop(sc); - CNW_UNLOCK(sc); - - return; -} - -static int -cnw_alloc(dev) - device_t dev; -{ - struct cnw_softc *sc = device_get_softc(dev); - int rid; - int error; - - rid = 0; - sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (!sc->mem_res) { - device_printf(dev, "Cannot allocate attribute memory\n"); - return (ENOMEM); - } - sc->sc_memt = rman_get_bustag(sc->mem_res); - sc->sc_memh = rman_get_bushandle(sc->mem_res); - - - error = CARD_SET_MEMORY_OFFSET(device_get_parent(dev), - dev, rid, CNW_MEM_ADDR, NULL); - if (error) { - device_printf(dev, - "CARD_SET_MEMORY_OFFSET returned 0x%0x", error); - return(error); - } - - error = CARD_SET_RES_FLAGS(device_get_parent(dev), dev, - SYS_RES_MEMORY, rid, PCCARD_A_MEM_8BIT); - if (error) { - device_printf(dev, - "CARD_SET_RES_FLAGS returned 0x%0x\n", error); - return (error); - } - - rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (!sc->irq) { - device_printf(dev, "No irq?!\n"); - return (ENXIO); - } - - sc->dev = dev; - sc->sc_memoff = 0; - - return (0); -} - -static void -cnw_free(dev) - device_t dev; -{ - struct cnw_softc *sc = device_get_softc(dev); - - if (sc->mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); - sc->mem_res = 0; - } - if (sc->irq != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); - sc->irq = 0; - } - - return; -} diff --git a/sys/dev/cnw/if_cnwioctl.h b/sys/dev/cnw/if_cnwioctl.h deleted file mode 100644 index cc1b54890a99..000000000000 --- a/sys/dev/cnw/if_cnwioctl.h +++ /dev/null @@ -1,114 +0,0 @@ -/* $NetBSD: if_cnwioctl.h,v 1.2 1999/11/29 12:54:00 itojun Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1996, 1997 Berkeley Software Design, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that this notice is retained, - * the conditions in the following notices are met, and terms applying - * to contributors in the following notices also apply to Berkeley - * Software Design, Inc. - * - * 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 - * Berkeley Software Design, Inc. - * 4. Neither the name of the Berkeley Software Design, Inc. nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``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 BERKELEY SOFTWARE DESIGN, INC. 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. - * - * PAO2 Id: if_cnwioctl.h,v 1.1.8.1 1998/12/05 22:47:11 itojun Exp - * - * Paul Borman, December 1996 - * - * This driver is derived from a generic frame work which is - * Copyright(c) 1994,1995,1996 - * Yoichi Shinoda, Yoshitaka Tokugawa, WIDE Project, Wildboar Project - * and Foretune. All rights reserved. - * - * A linux driver was used as the "hardware reference manual" (i.e., - * to determine registers and a general outline of how the card works) - * That driver is publically available and copyright - * - * John Markus BjNxrndalen - * Department of Computer Science - * University of TromsNx - * Norway - * johnm@staff.cs.uit.no, http://www.cs.uit.no/~johnm/ - */ - -struct cnwstatus { - struct ifreq ifr; - u_char data[0x100]; -}; - -struct cnwstats { - u_quad_t nws_rx; - u_quad_t nws_rxerr; - u_quad_t nws_rxoverflow; - u_quad_t nws_rxoverrun; - u_quad_t nws_rxcrcerror; - u_quad_t nws_rxframe; - u_quad_t nws_rxerrors; - u_quad_t nws_rxavail; - u_quad_t nws_rxone; - u_quad_t nws_tx; - u_quad_t nws_txokay; - u_quad_t nws_txabort; - u_quad_t nws_txlostcd; - u_quad_t nws_txerrors; - u_quad_t nws_txretries[16]; -}; - -struct cnwistats { - struct ifreq ifr; - struct cnwstats stats; -}; - -struct cnwtrail { - u_char what; - u_char status; - u_short length; - struct timeval when; - struct timeval done; -}; - -struct cnwitrail { - struct ifreq ifr; - int head; - struct cnwtrail trail[128]; -}; - -#if !defined(__FreeBSD__) -#define ifr_domain ifr_ifru.ifru_flags /* domain */ -#define ifr_key ifr_ifru.ifru_flags /* scramble key */ -#else -#define ifr_domain ifr_flags /* domain */ -#define ifr_key ifr_flags /* scramble key */ -#endif - -#define SIOCSCNWDOMAIN _IOW('i', 254, struct ifreq) /* set domain */ -#define SIOCGCNWDOMAIN _IOWR('i', 253, struct ifreq) /* get domain */ -#define SIOCSCNWKEY _IOWR('i', 252, struct ifreq) /* set scramble key */ -#define SIOCGCNWSTATUS _IOWR('i', 251, struct cnwstatus)/* get raw status */ -#define SIOCGCNWSTATS _IOWR('i', 250, struct cnwistats)/* get stats */ -#define SIOCGCNWTRAIL _IOWR('i', 249, struct cnwitrail)/* get trail */ diff --git a/sys/dev/cnw/if_cnwreg.h b/sys/dev/cnw/if_cnwreg.h deleted file mode 100644 index 8b62d203d22c..000000000000 --- a/sys/dev/cnw/if_cnwreg.h +++ /dev/null @@ -1,147 +0,0 @@ -/* $NetBSD: if_cnwreg.h,v 1.3 2000/07/05 18:42:19 itojun Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Michael Eriksson. - * - * 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 the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - - -/* I/O area */ -#define CNW_IO_SIZE 0x10 -/* I/O area can be accessed via mapped memory too */ -#define CNW_IOM_ADDR 0x28000 -#define CNW_IOM_SIZE CNW_IO_SIZE -#define CNW_IOM_OFF (CNW_IOM_ADDR - CNW_MEM_ADDR) - -/* I/O registers */ -#define CNW_REG_COR 0x0 -# define CNW_COR_IENA 0x01 /* Interrupt enable */ -# define CNW_COR_LVLREQ 0x40 /* Keep high */ -#define CNW_REG_CCSR 0x2 -#define CNW_REG_ASR 0x4 -# define CNW_ASR_TXBA 0x01 /* Trasmit buffer available */ -# define CNW_ASR_WOC 0x08 /* Write Operation Complete */ -# define CNW_ASR_TXDN 0x20 /* Transmit done */ -# define CNW_ASR_RXERR 0x40 /* Receive error */ -# define CNW_ASR_RXRDY 0x80 /* Packet received */ -#define CNW_REG_IOLOW 0x6 -#define CNW_REG_IOHI 0x7 -#define CNW_REG_IOCONTROL 0x8 -#define CNW_REG_IMR 0xa -# define CNW_IMR_IENA 0x02 /* Interrupt enable */ -# define CNW_IMR_RFU1 0x10 /* RFU intr mask, keep high */ -#define CNW_REG_PMR 0xc -# define CNW_PMR_RESET 0x80 -#define CNW_REG_DATA 0xf - - -/* Mapped memory */ -#define CNW_MEM_ADDR 0x20000 -#define CNW_MEM_SIZE 0x8000 - -/* Extended I/O registers (memory mapped) */ -#define CNW_EREG_CB 0x100 -#define CNW_EREG_ASCC 0x114 -#define CNW_EREG_RSER 0x120 -# define CNW_RSER_RXBIG 0x02 -# define CNW_RSER_RXCRC 0x04 -# define CNW_RSER_RXOVERRUN 0x08 -# define CNW_RSER_RXOVERFLOW 0x10 -# define CNW_RSER_RXERR 0x40 -# define CNW_RSER_RXAVAIL 0x80 -#define CNW_EREG_RSERW 0x124 -#define CNW_EREG_TSER 0x130 -# define CNW_TSER_RTRY 0x0f -# define CNW_TSER_TXERR 0x10 -# define CNW_TSER_TXOK 0x20 -# define CNW_TSER_TXNOAP 0x40 -# define CNW_TSER_TXGU 0x80 -# define CNW_TSER_ERROR (CNW_TSER_TXERR | CNW_TSER_TXNOAP | \ - CNW_TSER_TXGU) -#define CNW_EREG_TSERW 0x134 -#define CNW_EREG_TDP 0x140 -#define CNW_EREG_LIF 0x14e -#define CNW_EREG_RDP 0x150 -#define CNW_EREG_SPCQ 0x154 -#define CNW_EREG_SPU 0x155 -#define CNW_EREG_ISPLQ 0x156 -#define CNW_EREG_HHC 0x158 -#define CNW_EREG_PA 0x160 -#define CNW_EREG_ARW 0x166 -#define CNW_EREG_MHS 0x16b -#define CNW_EREG_NI 0x16e -#define CNW_EREG_CRBP 0x17a -#define CNW_EREG_EC 0x180 -#define CNW_EREG_STAT_RXERR 0x184 -#define CNW_EREG_STAT_FRAME 0x186 -#define CNW_EREG_STAT_IBEAT 0x188 -#define CNW_EREG_STAT_RXBUF 0x18e -#define CNW_EREG_STAT_RXMULTI 0x190 -#define CNW_EREG_STAT_TXRETRY 0x192 -#define CNW_EREG_STAT_TXABORT 0x194 -#define CNW_EREG_STAT_OBEAT 0x198 -#define CNW_EREG_STAT_TXOK 0x19a -#define CNW_EREG_STAT_TXSENT 0x19c - -/* - * Commands used in the extended command buffer - * CNW_EREG_CB (0x100-0x10f) - */ -#define CNW_CMD_NOP 0x00 -#define CNW_CMD_SRC 0x01 -# define CNW_RXCONF_RXENA 0x80 /* Receive Enable */ -# define CNW_RXCONF_MAC 0x20 /* MAC host receive mode */ -# define CNW_RXCONF_PRO 0x10 /* Promiscuous */ -# define CNW_RXCONF_AMP 0x08 /* Accept Multicast Packets */ -# define CNW_RXCONF_BCAST 0x04 /* Accept Broadcast Packets */ -#define CNW_CMD_STC 0x02 -# define CNW_TXCONF_TXENA 0x80 /* Transmit Enable */ -# define CNW_TXCONF_MAC 0x20 /* Host sends MAC mode */ -# define CNW_TXCONF_EUD 0x10 /* Enable Uni-Data packets */ -# define CNW_TXCONF_KEY 0x02 /* Scramble data packets */ -# define CNW_TXCONF_LOOP 0x01 /* Loopback mode */ -#define CNW_CMD_AMA 0x03 -#define CNW_CMD_DMA 0x04 -#define CNW_CMD_SAMA 0x05 -#define CNW_CMD_ER 0x06 -#define CNW_CMD_DR 0x07 -#define CNW_CMD_TL 0x08 -#define CNW_CMD_SRP 0x09 -#define CNW_CMD_SSK 0x0a -#define CNW_CMD_SMD 0x0b -#define CNW_CMD_SAPD 0x0c -#define CNW_CMD_SSS 0x11 -#define CNW_CMD_EOC 0x00 /* End-of-command marker */ - diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 692d111c8280..dc5153a7eb34 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -53,7 +53,6 @@ SUBDIR= ${_3dfx} \ ${_ciss} \ ${_cm} \ ${_cmx} \ - ${_cnw} \ coda \ coda5 \ ${_coff} \ @@ -455,7 +454,6 @@ _bios= bios _ciss= ciss _cm= cm _cmx= cmx -_cnw= cnw _coretemp= coretemp _ctau= ctau _cx= cx diff --git a/sys/modules/cnw/Makefile b/sys/modules/cnw/Makefile deleted file mode 100644 index 63fa74652982..000000000000 --- a/sys/modules/cnw/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/cnw -KMOD = if_cnw -SRCS = if_cnw.c -SRCS += device_if.h bus_if.h card_if.h - -.include