diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/conf/files.i386 | 2 | ||||
| -rw-r--r-- | sys/dev/arl/if_arl.c | 1307 | ||||
| -rw-r--r-- | sys/dev/arl/if_arl_isa.c | 344 | ||||
| -rw-r--r-- | sys/dev/arl/if_arlreg.h | 344 | ||||
| -rw-r--r-- | sys/i386/conf/NOTES | 5 | ||||
| -rw-r--r-- | sys/modules/Makefile | 2 | ||||
| -rw-r--r-- | sys/modules/arl/Makefile | 16 |
7 files changed, 0 insertions, 2020 deletions
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index e1349a5f33c8..3a1be06d94ef 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -153,8 +153,6 @@ dev/arcmsr/arcmsr.c optional arcmsr pci dev/ar/if_ar.c optional ar dev/ar/if_ar_isa.c optional ar isa dev/ar/if_ar_pci.c optional ar pci -dev/arl/if_arl.c optional arl -dev/arl/if_arl_isa.c optional arl isa dev/asmc/asmc.c optional asmc isa dev/atkbdc/atkbd.c optional atkbd atkbdc dev/atkbdc/atkbd_atkbdc.c optional atkbd atkbdc diff --git a/sys/dev/arl/if_arl.c b/sys/dev/arl/if_arl.c deleted file mode 100644 index 6ebf3bf572a3..000000000000 --- a/sys/dev/arl/if_arl.c +++ /dev/null @@ -1,1307 +0,0 @@ -/*- - * Copyright (c) 1999-2001, Ivan Sharov, Vitaly Belekhov. - * Copyright (c) 2004 Stanislav Svirid. - * 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 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. - * - * $RISS: if_arl/dev/arl/if_arl.c,v 1.7 2004/03/16 04:43:27 count Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" - -#ifdef INET -#define ARLCACHE -#endif - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/sockio.h> -#include <sys/priv.h> -#include <sys/proc.h> -#include <sys/conf.h> - -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_media.h> -#include <net/if_types.h> -#include <net/ethernet.h> - -#include <net80211/ieee80211_var.h> - -#ifdef INET -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/in_var.h> -#include <netinet/ip.h> -#endif - -#include <net/bpf.h> - - -#include <dev/arl/if_arlreg.h> - -/*#define DEBUG */ -#ifdef DEBUG -#define D(x) {device_printf(sc->arl_dev, "%s", ""); printf x; } -#else -#define D(x) -#endif - -/* - * channel attention - */ -#define ARL_CHANNEL(sc) \ - { \ - D(("channel ctrl %x reg %x\n", sc->arl_control, ar->controlRegister)); \ - ar->controlRegister = (sc->arl_control ^= ARL_CHANNEL_ATTENTION); \ - } - -/* - * Check registration - */ -#define ARL_CHECKREG(sc) (ar->registrationMode && ar->registrationStatus == 0) - -#define GET_ARL_PARAM(name) (arcfg.name = ar->name) -#define SET_ARL_PARAM(name) (ar->name = arcfg.name) - -#define BROADCASTADDR (sc->arl_ifp->if_broadcastaddr) -#define _ARL_CURPROC (curthread) - -static void arl_hwreset (struct arl_softc *); -static void arl_reset (struct arl_softc *); -static int arl_ioctl (struct ifnet *, u_long, caddr_t); -static void arl_init (void *); -static void arl_init_locked (struct arl_softc *); -static void arl_start (struct ifnet *); -static void arl_start_locked(struct ifnet *); - -static void arl_watchdog (void *); -static void arl_waitreg (void *); - -static void arl_enable (struct arl_softc *); -static void arl_config (struct arl_softc *); -static int arl_command (struct arl_softc *); -static void arl_put (struct arl_softc *); - -static void arl_read (struct arl_softc *, caddr_t, int); -static void arl_recv (struct arl_softc *); -static struct mbuf* arl_get (caddr_t, int, int, struct ifnet *); - -#ifdef ARLCACHE -static void arl_cache_store (struct arl_softc *, struct ether_header *, - u_int8_t, u_int8_t, int); -#endif - -static int arl_media_change (struct ifnet *); -static void arl_media_status (struct ifnet *, struct ifmediareq *); -static void arl_read_config (struct arl_softc *); - -devclass_t arl_devclass; - -u_int8_t rate2media[4] = { - IFM_IEEE80211_DS354k, - IFM_IEEE80211_DS512k, - IFM_IEEE80211_DS1, - IFM_IEEE80211_DS2 -}; - -/* - * Copy config values to local cache - */ -static void -arl_read_config(sc) - struct arl_softc *sc; -{ - bzero(&arcfg, sizeof(arcfg)); - - bcopy(ar->lanCardNodeId, arcfg.lanCardNodeId, - sizeof(ar->lanCardNodeId)); - bcopy(ar->specifiedRouter, arcfg.specifiedRouter, - sizeof(ar->specifiedRouter)); - GET_ARL_PARAM(hardwareType); - GET_ARL_PARAM(majorHardwareVersion); - GET_ARL_PARAM(minorHardwareVersion); - GET_ARL_PARAM(radioModule); - GET_ARL_PARAM(channelSet); - if (!arcfg.channelSet) - arcfg.channelSet = ar->defaultChannelSet; - GET_ARL_PARAM(channelNumber); - GET_ARL_PARAM(spreadingCode); - GET_ARL_PARAM(priority); - GET_ARL_PARAM(receiveMode); - arcfg.registrationMode = 1; /* set default TMA mode */ - arcfg.txRetry = 0; - - bcopy(ar->name, arcfg.name, ARLAN_NAME_SIZE); - bcopy(ar->systemId, arcfg.sid, 4 * sizeof(arcfg.sid[0])); -} - -/* - * Attach device - */ -int -arl_attach(dev) - device_t dev; -{ - struct arl_softc* sc = device_get_softc(dev); - struct ifnet *ifp; - int configured = 0, error; - - D(("attach\n")); - - ifp = sc->arl_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) - return (ENOSPC); - - mtx_init(&sc->arl_lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->arl_timer, &sc->arl_lock, 0); - ARL_LOCK(sc); - configured = ar->configuredStatusFlag; - - if (!configured && bootverbose) - device_printf(dev, "card is not configured\n"); - else - arl_read_config(sc); - - arl_reset(sc); - - /* Read config for default values if card was not configured */ - if (!configured) - arl_read_config(sc); - ARL_UNLOCK(sc); - - /* Initialize ifnet structure. */ - 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_start = arl_start; - ifp->if_ioctl = arl_ioctl; - ifp->if_init = arl_init; - IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); - ifp->if_baudrate = 2000000; - - ifmedia_init(&sc->arl_ifmedia, 0, arl_media_change, arl_media_status); -#define ADD(s, o) ifmedia_add(&sc->arl_ifmedia, \ - IFM_MAKEWORD(IFM_IEEE80211, (s), (o), 0), 0, NULL) - ADD(IFM_IEEE80211_DS354k, 0); - ADD(IFM_IEEE80211_DS354k, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS512k, 0); - ADD(IFM_IEEE80211_DS512k, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS1, 0); - ADD(IFM_IEEE80211_DS1, IFM_IEEE80211_ADHOC); - ADD(IFM_IEEE80211_DS2, 0); - ADD(IFM_IEEE80211_DS2, IFM_IEEE80211_ADHOC); - ifmedia_set(&sc->arl_ifmedia, IFM_MAKEWORD(IFM_IEEE80211, - rate2media[arcfg.spreadingCode - 1], 0, 0)); -#undef ADD - - /* - * Attach the interface - */ - ether_ifattach(ifp, ar->lanCardNodeId); - - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, arl_intr, sc, &sc->irq_handle); - if (error) { - ether_ifdetach(ifp); - mtx_destroy(&sc->arl_lock); - if_free(sc->arl_ifp); - arl_release_resources(dev); - return (error); - } - - return (0); -} - -/* - * Hardware reset - * reset all setting to default (setted ARLANDGS) - */ -static void -arl_hwreset(sc) - struct arl_softc *sc; -{ - D(("hw reset\n")); - - ARL_LOCK_ASSERT(sc); - ar->controlRegister = 1; - DELAY(ARDELAY1); - - if (arl_wait_reset(sc, 0x24, ARDELAY1)) - arl_stop(sc); - - ar->controlRegister = (sc->arl_control = 1); - DELAY(ARDELAY1); -} - - -/* - * wait arlan command - */ -static int -arl_command(sc) - struct arl_softc *sc; -{ - int i; /* long stuppid delay ??? */ - - D(("commandByte %x\n", ar->commandByte)); - - for (i = 100000; ar->commandByte && i; i--) - ; - - if (i == 0) - ar->commandByte = 0; - - return (i == 0); -} - -/* - * Enable for recieveng - */ -static void -arl_enable(sc) - struct arl_softc *sc; -{ - D(("enable\n")); - sc->arl_control = (ARL_INTERRUPT_ENABLE | ARL_CLEAR_INTERRUPT); - ar->controlRegister = sc->arl_control; - arl_command(sc); - - ar->rxStatusVector = 0; - ar->commandByte = 0x83; - ar->commandParameter[0] = 1; - ARL_CHANNEL(sc); - arl_command(sc); -} - -/* - * reset and set user parameters - */ -static void -arl_reset(sc) - struct arl_softc *sc; -{ - D(("reset\n")); - ARL_LOCK_ASSERT(sc); - arl_hwreset(sc); - - ar->resetFlag1 = 1; - bzero((ar), 0x1FF0); /* fill memory board with 0 */ - ar->resetFlag1 = 0; - - sc->arl_control = 0; - -/* if (arl_wait_reset(sc, 0x168, ARDELAY1)) - return; - */ -#if 1 - { - int cnt = 0x168; - int delay = ARDELAY1; - - ar->resetFlag = 0xFF; /* wish reset */ - ar->controlRegister = 0; /* unreeze - do it */ - - while (ar->resetFlag && cnt--) - DELAY(delay); - - if (cnt == 0) { - if_printf(sc->arl_ifp, "reset timeout\n"); - return; - } - - D(("reset wait %d\n", 0x168 - cnt)); - } -#endif - - if (ar->diagnosticInfo != 0xff) { - if_printf(sc->arl_ifp, "reset error\n"); - return; - } - arl_config(sc); -} - -/* - * configure radio parameters - */ -static void -arl_config(sc) - struct arl_softc *sc; -{ - int i; - - D(("config\n")); - - SET_ARL_PARAM(spreadingCode); - SET_ARL_PARAM(channelNumber); - SET_ARL_PARAM(channelSet); - SET_ARL_PARAM(registrationMode); - SET_ARL_PARAM(priority); - SET_ARL_PARAM(receiveMode); - - bcopy(arcfg.sid, ar->systemId, 4 * sizeof(ar->systemId[0])); - bcopy(arcfg.specifiedRouter, ar->specifiedRouter, ETHER_ADDR_LEN); - bcopy(arcfg.lanCardNodeId, ar->lanCardNodeId, ETHER_ADDR_LEN); - - bzero(ar->name, ARLAN_NAME_SIZE); /* clear name */ - strncpy(ar->name, arcfg.name, ARLAN_NAME_SIZE); - - ar->diagnosticInfo = 0; - ar->commandByte = 1; - ARL_CHANNEL(sc); - DELAY(ARDELAY1); - - if (arl_command(sc)) { - D(("config failed\n")); - return; - } - - for (i = 0x168; ar->diagnosticInfo == 0 && i; i--) - DELAY(ARDELAY1); - - if (i == 0) { - D(("config timeout\n")); - return; - } - - if (ar->diagnosticInfo != 0xff) { - D(("config error\n")); - return; - } - - D(("config lanCardNodeId %6D\n", ar->lanCardNodeId, ":")); - D(("config channel set %d, frequency %d, spread %d, mode %d\n", - ar->channelSet, - ar->channelNumber, - ar->spreadingCode, - ar->registrationMode)); - /* clear quality stat */ - bzero(sc->arl_sigcache, MAXARLCACHE * sizeof(struct arl_sigcache)); -} - -/* - * Socket Ioctl's. - */ -static int -arl_ioctl(ifp, cmd, data) - register struct ifnet *ifp; - u_long cmd; - caddr_t data; -{ - struct arl_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ieee80211req *ireq = (struct ieee80211req *)data; - d_thread_t *td = _ARL_CURPROC; - struct arl_req arlan_io; - int error = 0; - struct arl_sigcache *arl_cache; - struct arl_stats *arl_stats; - u_int8_t tmpstr[IEEE80211_NWID_LEN*2]; - u_int8_t tmpname[ARLAN_NAME_SIZE]; - u_int8_t *tmpptr; - u_int32_t newsid; - - D(("ioctl %lx\n", cmd)); - - switch (cmd) { - case SIOCSIFADDR: - case SIOCGIFADDR: - case SIOCSIFMTU: - error = ether_ioctl(ifp, cmd, data); - break; - - case SIOCSIFFLAGS: - ARL_LOCK(sc); - if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) - arl_init_locked(sc); - } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - arl_stop(sc); - } - ARL_UNLOCK(sc); - break; - case SIOCSIFMEDIA: - case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->arl_ifmedia, cmd); - break; - - case SIOCG80211: - switch (ireq->i_type) { - case IEEE80211_IOC_SSID: - if (ireq->i_val != -1) { - error = EINVAL; - break; - } - bzero(tmpstr, IEEE80211_NWID_LEN); - ARL_LOCK(sc); - snprintf(tmpstr, IEEE80211_NWID_LEN - 1, "0x%08x", - *(int *)arcfg.sid); - ARL_UNLOCK(sc); - ireq->i_len = IEEE80211_NWID_LEN; - error = copyout(tmpstr, ireq->i_data, - IEEE80211_NWID_LEN); - break; - case IEEE80211_IOC_STATIONNAME: - ireq->i_len = sizeof(arcfg.name); - ARL_LOCK(sc); - tmpptr = arcfg.name; - bzero(tmpstr, IEEE80211_NWID_LEN); - bcopy(tmpptr, tmpstr, ireq->i_len); - ARL_UNLOCK(sc); - error = copyout(tmpstr, ireq->i_data, - IEEE80211_NWID_LEN); - break; - case IEEE80211_IOC_CHANNEL: - ARL_LOCK(sc); - ireq->i_val = arcfg.channelNumber; - ARL_UNLOCK(sc); - break; - case IEEE80211_IOC_POWERSAVE: - ARL_LOCK(sc); - ireq->i_val = (arcfg.registrationMode == 2 ? - IEEE80211_POWERSAVE_PSP : - IEEE80211_POWERSAVE_OFF); - ARL_UNLOCK(sc); - break; - default: - error = EINVAL; - break; - } - break; - - case SIOCS80211: - if ((error = priv_check(td, PRIV_NET80211_MANAGE))) - break; - switch (ireq->i_type) { - case IEEE80211_IOC_SSID: - if (ireq->i_len > 4) { - error = EINVAL; - break; - } - bzero(&newsid, sizeof(newsid)); - error = copyin(ireq->i_data, - (u_char *)(&newsid) + 4 - ireq->i_len, - ireq->i_len); - - if (error) - break; - - newsid = htonl(newsid); - if (newsid < 0 || newsid % 2) { - error = EINVAL; - break; - } - - ARL_LOCK(sc); - bcopy(&newsid, arcfg.sid, sizeof(arcfg.sid)); - break; - case IEEE80211_IOC_STATIONNAME: - if (ireq->i_len > ARLAN_NAME_SIZE) { - error = EINVAL; - break; - } - error = copyin(ireq->i_data, tmpname, ireq->i_len); - if (error) - break; - ARL_LOCK(sc); - bzero(arcfg.name, ARLAN_NAME_SIZE); - bcopy(tmpname, arcfg.name, ireq->i_len); - break; - case IEEE80211_IOC_CHANNEL: - if (ireq->i_val < 0 || ireq->i_val > 5) { - error = EINVAL; - break; - } - ARL_LOCK(sc); - arcfg.channelNumber = ireq->i_val; - break; - case IEEE80211_IOC_POWERSAVE: - switch (ireq->i_val) { - case IEEE80211_POWERSAVE_OFF: - ARL_LOCK(sc); - if (arcfg.registrationMode == 2) - arcfg.registrationMode = 1; - break; - case IEEE80211_POWERSAVE_ON: - case IEEE80211_POWERSAVE_PSP: - ARL_LOCK(sc); - arcfg.registrationMode = 2; - break; - default: - error = EINVAL; - break; - } - break; - default: - error = EINVAL; - break; - } - - if (!error) { - /* - * XXX: Somewhat gross: we require that if the - * clauses in the switch statement above - * didn't encounter an error they leave the - * softc locked. - */ - arl_config(sc); - ARL_UNLOCK(sc); - } - - break; - -#define GET_PARAM(name) (arlan_io.cfg.name = arcfg.name) - -#define GET_COPY_PARAM(name) \ - { \ - bzero(arlan_io.cfg.name, sizeof(arlan_io.cfg.name)); \ - bcopy(arcfg.name, arlan_io.cfg.name, sizeof(arlan_io.cfg.name)); \ - } - case SIOCGARLALL: - bzero(&arlan_io, sizeof(arlan_io)); - ARL_LOCK(sc); - if (!priv_check(td, PRIV_DRIVER)) { - bcopy(ar->systemId, arlan_io.cfg.sid, 4); - } - - GET_COPY_PARAM(name); - GET_COPY_PARAM(lanCardNodeId); - GET_COPY_PARAM(specifiedRouter); - GET_PARAM(channelNumber); - GET_PARAM(channelSet); - GET_PARAM(spreadingCode); - GET_PARAM(registrationMode); - GET_PARAM(hardwareType); - GET_PARAM(majorHardwareVersion); - GET_PARAM(minorHardwareVersion); - GET_PARAM(radioModule); - GET_PARAM(priority); - GET_PARAM(receiveMode); - GET_PARAM(txRetry); - ARL_UNLOCK(sc); - - error = copyout(&arlan_io, ifr->ifr_data, sizeof(arlan_io)); - break; - -#define SET_PARAM(name) \ - do { \ - if (arlan_io.what_set & ARLAN_SET_##name) \ - arcfg.name = arlan_io.cfg.name; \ - } while (0) -#define SET_COPY_PARAM(name) \ - do { \ - if (arlan_io.what_set & ARLAN_SET_##name) { \ - bzero(arcfg.name, sizeof(arcfg.name)); \ - bcopy(arlan_io.cfg.name, arcfg.name, sizeof(arcfg.name)); \ - } \ - } while (0) - - case SIOCSARLALL: - if (priv_check(td, PRIV_DRIVER)) - break; - - error = copyin(ifr->ifr_data, &arlan_io, sizeof(arlan_io)); - if (error) - break; - - D(("need set 0x%04x\n", arlan_io.what_set)); - - if (arlan_io.what_set) { - ARL_LOCK(sc); - SET_COPY_PARAM(name); - SET_COPY_PARAM(sid); - SET_COPY_PARAM(specifiedRouter); - SET_COPY_PARAM(lanCardNodeId); - SET_PARAM(channelSet); - SET_PARAM(channelNumber); - SET_PARAM(spreadingCode); - SET_PARAM(registrationMode); - SET_PARAM(priority); - SET_PARAM(receiveMode); - SET_PARAM(txRetry); - - arl_config(sc); - ARL_UNLOCK(sc); - } -#undef SET_COPY_PARAM -#undef SET_PARAM -#undef GET_COPY_PARAM -#undef GET_PARAM - break; -#ifdef ARLCACHE - case SIOCGARLQLT: - arl_cache = malloc(sizeof(sc->arl_sigcache), M_DEVBUF, - M_WAITOK); - ARL_LOCK(sc); - while (ar->interruptInProgress) ; /* wait */ - bcopy(&(sc->arl_sigcache), arl_cache, sizeof(sc->arl_sigcache)); - ARL_UNLOCK(sc); - error = copyout(arl_cache, ifr->ifr_data, - sizeof(sc->arl_sigcache)); - free(arl_cache, M_DEVBUF); - break; -#endif - case SIOCGARLSTB: - arl_stats = malloc(sizeof(struct arl_stats), M_DEVBUF, - M_WAITOK); - ARL_LOCK(sc); - while (ar->lancpuLock) ; - ar->hostcpuLock = 1; - bcopy(&(ar->stat), arl_stats, sizeof(struct arl_stats)); - ar->hostcpuLock = 0; - ARL_UNLOCK(sc); - error = copyout(arl_stats, ifr->ifr_data, - sizeof(struct arl_stats)); - free(arl_stats, M_DEVBUF); - break; - - default: - error = EINVAL; - } - - return (error); -} - -/* - * Wait registration - */ -static void -arl_waitreg(void *arg) -{ - struct arl_softc *sc = arg; - - D(("wait reg\n")); - - ARL_LOCK_ASSERT(sc); - if (sc->arl_ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (ARL_CHECKREG(sc)) { - /* wait registration */ - D(("wait registration\n")); - callout_reset(&sc->arl_timer, hz * 2, arl_waitreg, sc); - } else { - /* registration restored */ - D(("registration restored\n")); - arl_init_locked(sc); - } - } -} - -/* - * Handle transmit timeouts. - */ -static void -arl_watchdog(void *arg) -{ - struct arl_softc *sc = arg; - - ARL_LOCK_ASSERT(sc); - if (!(sc->arl_ifp->if_drv_flags & IFF_DRV_RUNNING)) - return; - - D(("device timeout\n")); - - if (ARL_CHECKREG(sc)) { - /* Lost registratoin */ - D(("timeout lost registration\n")); - callout_reset(&sc->arl_timer, hz * 2, arl_waitreg, sc); - } -} - -/* - * Initialize - */ -static void -arl_init(xsc) - void *xsc; -{ - struct arl_softc *sc = xsc; - - ARL_LOCK(sc); - arl_init_locked(sc); - ARL_UNLOCK(sc); -} - -static void -arl_init_locked(struct arl_softc *sc) -{ - struct ifnet *ifp = sc->arl_ifp; - - D(("init\n")); - - if (ARL_CHECKREG(sc)) - arl_reset(sc); - - arl_enable(sc); - - /* set flags */ - - ifp->if_drv_flags |= IFF_DRV_RUNNING; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - arl_start_locked(ifp); - - D(("init done\n")); -} - -/* - * Put buffer into arlan buffer and start transmit - */ -static void -arl_put(sc) - struct arl_softc *sc; -{ - struct arl_tx_param txp; - int i; - - if (ARL_CHECKREG(sc)) - sc->arl_ifp->if_oerrors++; - - /* copy dst adr */ - for(i = 0; i < 6; i++) - txp.dest[i] = sc->arl_tx[i]; - txp.clear = 0; - txp.retries = arcfg.txRetry; /* use default value */ - txp.routing = 1; - txp.scrambled = 0; - txp.offset = (intptr_t)ar->txBuffer - (intptr_t)(ar); - txp.length = sc->tx_len - ARLAN_HEADER_SIZE; - -#ifdef SEND_ARLAN_HEADER - if (ar->registrationMode != 1) - txp.length = sc->tx_len; -#endif - - /* copy from internal buffer to adapter memory */ -#ifdef SEND_ARLAN_HEADER - if (ar->registrationMode) -#endif - bcopy(sc->arl_tx + ARLAN_HEADER_SIZE, - ar->txBuffer, - sc->tx_len - ARLAN_HEADER_SIZE); -#ifdef SEND_ARLAN_MODE - else - bcopy(sc->arl_tx, ar->txBuffer, sc->tx_len); -#endif - - /* copy command parametr */ - bcopy(&txp, ar->commandParameter, 14); - ar->commandByte = 0x85; /* send command */ - ARL_CHANNEL(sc); - if (arl_command(sc)) - sc->arl_ifp->if_oerrors++; -} - -/* - * start output - */ -static void -arl_start(ifp) - struct ifnet *ifp; -{ - struct arl_softc *sc; - - sc = ifp->if_softc; - ARL_LOCK(sc); - arl_start_locked(ifp); - ARL_UNLOCK(sc); -} - -static void -arl_start_locked(ifp) - struct ifnet *ifp; -{ - struct arl_softc *sc; - struct mbuf *m; - struct mbuf *m0 = NULL; - - sc = ifp->if_softc; - - D(("start\n")); - - /* Don't do anything if output is active */ - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) - return; - - /* Dequeue the next datagram */ - IF_DEQUEUE(&ifp->if_snd, m0); - - /* If there's nothing to send, return. */ - if (m0 != NULL) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - - /* Copy the datagram to the buffer. */ - sc->tx_len = 0; - for(m = m0; m != NULL; m = m->m_next) { - if (m->m_len == 0) - continue; - bcopy(mtod(m, caddr_t), - sc->arl_tx + sc->tx_len, m->m_len); - sc->tx_len += m->m_len; - } - - /* if packet size is less than minimum ethernet frame size, - * pad it with zeroes to that size */ - if (sc->tx_len < ETHER_MIN_LEN) { - bzero(sc->arl_tx + sc->tx_len, ETHER_MIN_LEN - sc->tx_len); - sc->tx_len = ETHER_MIN_LEN; - } - - /* Give the packet to the bpf, if any */ - BPF_MTAP(ifp, m0); - - m_freem(m0); - - /* Now transmit the datagram */ - arl_put(sc); - - /* wait 1 sec */ - callout_reset(&sc->arl_timer, hz * 1, arl_watchdog, sc); - } -} - -/* - * stop interface - */ -void -arl_stop(sc) - struct arl_softc *sc; -{ - struct ifnet *ifp; - - ifp = sc->arl_ifp; - - callout_stop(&sc->arl_timer); /* disable timer */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING|IFF_DRV_OACTIVE); - /* arl_hwreset(unit); */ - sc->rx_len = 0; - sc->tx_len = 0; - /* disable interrupt */ - ar->controlRegister = 0; -} - -/* - * Pull read data off a interface. - * Len is length of data, with local net header stripped. - */ -static struct mbuf* -arl_get(buf, totlen, off0, ifp) - caddr_t buf; - int totlen; - int off0; - struct ifnet * ifp; -{ - struct mbuf *top, **mp, *m; - int off = off0, len; - caddr_t cp = buf; - char *epkt; - - cp = buf; - epkt = cp + totlen; - - if (off) { - cp += off + 2 * sizeof(u_short); - totlen -= 2 * sizeof(u_short); - } - - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); - m->m_pkthdr.rcvif = ifp; - m->m_pkthdr.len = totlen; - m->m_len = MHLEN; - top = 0; - mp = ⊤ - while (totlen > 0) { - if (top) { - MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { - m_freem(top); - return (0); - } - m->m_len = MLEN; - } - len = min(totlen, epkt - cp); - if (len >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if (m->m_flags & M_EXT) - m->m_len = len = min(len, MCLBYTES); - else - len = m->m_len; - } else { - /* - * * Place initial small packet/header at end of mbuf. - * */ - if (len < m->m_len) { - if (top == 0 && len + max_linkhdr <= m->m_len) - m->m_data += max_linkhdr; - m->m_len = len; - } else - len = m->m_len; - } - bcopy(cp, mtod(m, caddr_t), (unsigned)len); - cp += len; - *mp = m; - mp = &m->m_next; - totlen -= len; - if (cp == epkt) - cp = buf; - } - - return (top); -} - -/* ------------------------------------------------------------------ - * * Pass a packet up to the higher levels. - * */ -static void -arl_read(sc, buf, len) - struct arl_softc *sc; - caddr_t buf; - int len; -{ - register struct ether_header *eh; - struct ifnet *ifp = sc->arl_ifp; - struct mbuf *m; - - eh = (struct ether_header *)buf; - /* - * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to bpf. - */ - if (bpf_peers_present(ifp->if_bpf)) { - /* - * Note that the interface cannot be in promiscuous mode if - * there are no bpf listeners. And if el are in promiscuous - * mode, el have to check if this packet is really ours. - * - * This test does not support multicasts. - */ - if ((ifp->if_flags & IFF_PROMISC) - && bcmp(eh->ether_dhost, IF_LLADDR(sc->arl_ifp), - sizeof(eh->ether_dhost)) != 0 - && bcmp(eh->ether_dhost, BROADCASTADDR, - sizeof(eh->ether_dhost)) != 0) - return; - } - /* - * Pull packet off interface. - */ - m = arl_get(buf, len, 0, ifp); - if (m == 0) - return; - -#ifdef ARLCACHE - arl_cache_store(sc, eh, ar->rxQuality & 0x0f, - (ar->rxQuality & 0xf0) >> 4, ARLCACHE_RX); -#endif - - ARL_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - ARL_LOCK(sc); -} - -/* - * get packet from adapter - */ -static void -arl_recv(sc) - struct arl_softc *sc; -{ - sc->rx_len = ar->rxLength; - - if (sc->rx_len) { -#ifdef SEND_ARLAN_HEADER - if (ar->registrationMode == 1) { -#endif - bcopy(ar->ultimateDestAddress, sc->arl_rx, 6); - bcopy(ar->rxSrc, (char*)sc->arl_rx + 6, 6); - bcopy((char *)(ar) + ar->rxOffset, - (char *)sc->arl_rx + 12, - sc->rx_len); - sc->rx_len += ARLAN_HEADER_SIZE; -#ifdef SEND_ARLAN_HEADER - } else { - bcopy((char *)(ar) + ar->rxOffset, - (char *)sc->arl_rx, sc->rx_len); - } -#endif - } -} - -/* - * Ethernet interface interrupt processor - */ -void -arl_intr(arg) - void *arg; -{ - register struct arl_softc *sc = (struct arl_softc *) arg; - struct ifnet *ifp = sc->arl_ifp; - - ARL_LOCK(sc); - /* enable interrupt */ - ar->controlRegister = (sc->arl_control & ~ARL_CLEAR_INTERRUPT); - ar->controlRegister = (sc->arl_control | ARL_CLEAR_INTERRUPT); - - if (ar->txStatusVector) { - if (ar->txStatusVector != 1) - sc->arl_ifp->if_collisions++; - callout_stop(&sc->arl_timer); /* disable timer */ - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - arl_start_locked(ifp); - ar->txStatusVector = 0; -#ifdef ARLCACHE - arl_cache_store(sc, - (struct ether_header *)(sc->arl_tx), - ar->txAckQuality & 0x0f, - (ar->txAckQuality & 0xf0) >> 4, ARLCACHE_TX); -#endif - } - - if (ar->rxStatusVector) { - if (ar->rxStatusVector == 1) { /* it is data frame */ - arl_recv(sc); - arl_read(sc, sc->arl_rx, sc->rx_len); - ifp->if_opackets++; - } - ar->rxStatusVector = 0; - - ar->commandByte = 0x83; - ar->commandParameter[0] = 1; - ARL_CHANNEL(sc); - if (arl_command(sc)) - ifp->if_ierrors++; - } - ARL_UNLOCK(sc); - - return; -} - -/* - * waiting for resetFlag dropped - */ -int -arl_wait_reset(sc, cnt, delay) - struct arl_softc *sc; - int cnt; - int delay; -{ - D(("wait_reset cnt=%d delay=%d\n", cnt, delay)); - - ar->resetFlag = 1; /* wish reset */ - ar->controlRegister = 0; /* unreeze - do it */ - - while (ar->resetFlag && cnt--) - DELAY(delay); - - D(("reset done. %d cycles left\n", cnt)); - - if (cnt == 0) - if_printf(sc->arl_ifp, "reset failed\n"); - - return (cnt == 0); -} - -/* - * Allocate an irq resource with the given resource id - */ -int -arl_alloc_irq(dev, rid, flags) - device_t dev; - int rid; - int flags; -{ - struct arl_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_any( - dev, SYS_RES_IRQ, &rid, (RF_ACTIVE | flags)); - if (res) { - sc->irq_rid = rid; - sc->irq_res = res; - return (0); - } else - return (ENOENT); -} - -/* - * Allocate an memory resource with the given resource id - */ -int -arl_alloc_memory(dev, rid, size) - device_t dev; - int rid; - int size; -{ - struct arl_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); - if (res) { - sc->mem_rid = rid; - sc->mem_res = res; - return (0); - } else - return (ENOENT); -} - -/* - * Release all resources - */ -void -arl_release_resources(dev) - device_t dev; -{ - struct arl_softc *sc = device_get_softc(dev); - - if (sc->mem_res) { - bus_release_resource(dev, SYS_RES_MEMORY, - sc->mem_rid, sc->mem_res); - sc->mem_res = 0; - } - if (sc->irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq_res); - sc->irq_res = 0; - } -} - -#ifdef ARLCACHE -static void -arl_cache_store(sc, eh, level, quality, dir) - struct arl_softc *sc; - struct ether_header *eh; - u_int8_t level; - u_int8_t quality; - int dir; -{ - int i; - static int cache_slot = 0; - static int wrapindex = 0; - u_int8_t zero[6] = {0, 0, 0, 0, 0, 0}; - u_char *mac; - - if ((ntohs(eh->ether_type) != ETHERTYPE_IP)) { - return; - } - - mac = (dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost); - - for (i = 0; i < MAXARLCACHE; i++) { - if (!bcmp(zero, sc->arl_sigcache[i].macsrc, 6) || - !bcmp(mac, sc->arl_sigcache[i].macsrc, 6)) - break; - } - - if (i < MAXARLCACHE) - cache_slot = i; - else { - if (wrapindex == MAXARLCACHE) - wrapindex = 0; - cache_slot = wrapindex++; - } - - bcopy(dir == ARLCACHE_RX ? eh->ether_shost : eh->ether_dhost, - sc->arl_sigcache[cache_slot].macsrc, 6); - - sc->arl_sigcache[cache_slot].level[dir] = level; - sc->arl_sigcache[cache_slot].quality[dir] = quality; -} -#endif - -static int -arl_media_change(ifp) - struct ifnet *ifp; -{ - struct arl_softc *sc = ifp->if_softc; - int otype = arcfg.registrationMode; - int orate = arcfg.spreadingCode; - int nrate, i; - - ARL_LOCK(sc); - nrate = IFM_SUBTYPE(sc->arl_ifmedia.ifm_cur->ifm_media); - - for(i = 1; i <= 4; i++) { - if (rate2media[i - 1] == nrate) - break; - } - - if (i == 5) { - ARL_UNLOCK(sc); - return (EINVAL); - } - - arcfg.spreadingCode = i; - - /* XXX Need fix for PSP mode */ - if ((sc->arl_ifmedia.ifm_cur->ifm_media & IFM_IEEE80211_ADHOC) != 0) - arcfg.registrationMode = 0; - else - arcfg.registrationMode = 1; - - if (otype != arcfg.registrationMode || - orate != arcfg.spreadingCode) - arl_config(sc); - ARL_UNLOCK(sc); - - return (0); -} - -static void -arl_media_status(ifp, imr) - struct ifnet *ifp; - struct ifmediareq *imr; -{ - struct arl_softc *sc = ifp->if_softc; - - imr->ifm_active = IFM_IEEE80211; - - ARL_LOCK(sc); - if (arcfg.registrationMode == 0) - imr->ifm_active |= IFM_IEEE80211_ADHOC; - - imr->ifm_active |= IFM_MAKEWORD(IFM_IEEE80211, - rate2media[arcfg.spreadingCode - 1], 0, 0); - imr->ifm_status = IFM_AVALID; - if (!ARL_CHECKREG(sc)) - imr->ifm_status |= IFM_ACTIVE; - ARL_UNLOCK(sc); -} diff --git a/sys/dev/arl/if_arl_isa.c b/sys/dev/arl/if_arl_isa.c deleted file mode 100644 index 91b6e416188a..000000000000 --- a/sys/dev/arl/if_arl_isa.c +++ /dev/null @@ -1,344 +0,0 @@ -/*- - * Copyright (c) 1999-2001, Ivan Sharov, Vitaly Belekhov. - * Copyright (c) 2004 Stanislav Svirid. - * 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 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. - * - * $RISS: if_arl/dev/arl/if_arl_isa.c,v 1.7 2004/03/16 05:30:38 count Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" - -#ifdef INET -#define ARLCACHE -#endif - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/socket.h> -#include <sys/kernel.h> -#include <sys/malloc.h> - -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_mib.h> -#include <net/if_media.h> - -#include <isa/isavar.h> -#include <isa/pnpvar.h> -#include <isa/isa_common.h> - -#include <machine/md_var.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_param.h> - -#include <dev/arl/if_arlreg.h> - -static void arl_isa_identify(driver_t *, device_t); -static int arl_isa_probe (device_t); -static int arl_isa_attach (device_t); -static int arl_isa_detach (device_t); -static char* arl_make_desc (u_int8_t, u_int8_t); - -#define ARL_MAX_ATYPE_LEN 10 -static struct arl_type { - u_int8_t type; - char* desc; -} -arl_type_list[] = { - { 0, "450" }, - { 1, "650" }, - { 0xb, "670" }, - { 0xc, "670E" }, - { 0xd, "650E" }, - { 0xe, "440LT" }, - { 0x2e, "655" }, - { 0x6b, "IC2200" }, - { 0, 0 } -}; - -#define ARL_MAX_RTYPE_LEN 10 -struct radio_type { - u_int8_t type; - char* desc; -} radio_type_list [] = { - { 1, "092/094" }, - { 2, "020" }, - { 3, "092A" }, - { 4, "020B" }, - { 5, "095" }, - { 6, "024" }, - { 7, "025B" }, - { 8, "024B" }, - { 9, "024C" }, - {10, "025C" }, - {11, "024-1A" }, - {12, "025-1A" }, -}; - - -static char* -arl_make_desc(hw_type, radio_mod) - u_int8_t hw_type; - u_int8_t radio_mod; -{ - static char desc[80]; - char atype[ARL_MAX_ATYPE_LEN], rtype[ARL_MAX_RTYPE_LEN]; - int i; - - *atype = *rtype = 0; - - /* arl type */ - for(i = 0; arl_type_list[i].desc; i++) { - if (arl_type_list[i].type == hw_type) - break; - } - - if (arl_type_list[i].desc) - strncpy(atype, arl_type_list[i].desc, ARL_MAX_ATYPE_LEN); - else - snprintf(atype, ARL_MAX_ATYPE_LEN, "(0x%x)", hw_type); - - /* radio type */ - for(i = 0; radio_type_list[i].desc; i++) - if (radio_type_list[i].type == radio_mod) - break; - - if (radio_type_list[i].desc) - strncpy(rtype, radio_type_list[i].desc, ARL_MAX_RTYPE_LEN); - else - snprintf(rtype, ARL_MAX_RTYPE_LEN, "(0x%x)", radio_mod); - - snprintf(desc, 80, "ArLan type %s, radio module %s", atype, rtype); - - return desc; -} - -#define ARL_ADDR2VEC(addr) (1 << ((addr - ARL_BASE_START) / ARL_BASE_STEP)) - -static void -arl_isa_identify (driver_t *driver, device_t parent) -{ - device_t child; - struct arl_softc *sc; - int chunk, found, i; - u_int16_t free_mem = 0xFFFF; - - if (bootverbose) - printf("arl: in identify\n"); - - /* Try avoid already added devices */ - for (i = 0; (child = device_find_child(parent, "arl", i)) != NULL; i++) { - chunk = bus_get_resource_start(child, SYS_RES_MEMORY, 0); - if (bootverbose) - device_printf(child, "found at iomem = 0x%0x\n", chunk); - if (chunk >= ARL_BASE_START && chunk <= ARL_BASE_END) - free_mem ^= ARL_ADDR2VEC(chunk); - } - - if (bootverbose) - printf("arl: free mem vector = 0x%x\n", free_mem); - - for (chunk = ARL_BASE_START; chunk <= ARL_BASE_END; chunk += ARL_BASE_STEP) { - /* If device 'arl' with this chunk was found early - skip it */ - if ( !(free_mem & ARL_ADDR2VEC(chunk)) ) - continue; - - found = 0; - child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "arl", -1); - device_set_driver(child, driver); - sc = device_get_softc(child); - bzero(sc, sizeof(*sc)); - - bus_set_resource(child, SYS_RES_MEMORY, sc->mem_rid, chunk, - ARL_BASE_STEP); - - if (arl_alloc_memory(child, sc->mem_rid, ARL_BASE_STEP) == 0) { - ar = (struct arl_private *) rman_get_virtual(sc->mem_res); - if (!bcmp(ar->textRegion, ARLAN_SIGN, sizeof(ARLAN_SIGN) - 1)) - found++; - } - - if (bootverbose) - device_printf(child, "%sfound at 0x%x\n", - !found ? "not " : "", chunk); - - arl_release_resources(child); - if (!found) { - bus_delete_resource(child, SYS_RES_MEMORY, sc->mem_rid); - device_delete_child(parent, child); - } - - } -} - -static int -arl_isa_probe (device_t dev) -{ - struct arl_softc *sc = device_get_softc(dev); - int error; - u_char *ptr; - u_int8_t irq; - - if (isa_get_vendorid(dev)) - return (ENXIO); - - sc->arl_dev = dev; - if (bootverbose) - device_printf(dev, "in probe\n"); - - error = arl_alloc_memory(dev, 0, ARL_BASE_STEP); - if (error) { - if (bootverbose) - device_printf(dev, "Error allocating memory (%d)\n", error); - return (error); - } - - ar = (struct arl_private *) rman_get_virtual(sc->mem_res); - if (bcmp(ar->textRegion, ARLAN_SIGN, sizeof(ARLAN_SIGN) - 1)) { - if (bootverbose) - device_printf(dev, "not found\n"); - error = ENOENT; - goto bad; - } - - irq = ar->irqLevel; - if (irq == 2) - irq = 9; - - error = bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); - if (error) - goto bad; - - error = arl_alloc_irq(dev, 0, 0); - if (error) { - if (bootverbose) - device_printf(dev, "Can't allocate IRQ %d\n", irq); - goto bad; - } - - ar->controlRegister = 1; /* freeze board */ - - /* Memory test */ - for (ptr = (u_char *) ar; - ptr < ((u_char *) ar + ARL_BASE_STEP - 1); ptr++) { - u_char c; - - c = *ptr; *ptr = ~(*ptr); - if (*ptr != (u_char)~c) { - device_printf(dev, "board memory failed at [%lx]\n", - rman_get_start(sc->mem_res) + (ptr - (u_char *)ar)); - break; /* skip memory test */ - } - } - - bzero((void *) ar, ARL_BASE_STEP - 1); /* clear board ram */ - - if (arl_wait_reset(sc, 100, ARDELAY)) { - error = ENXIO; - goto bad; - } - - if (ar->diagnosticInfo == 0xFF) { - device_set_desc_copy(dev, arl_make_desc(ar->hardwareType, - ar->radioModule)); - error = 0; - } else { - if (bootverbose) - device_printf(dev, "board self-test failed (0x%x)!\n", - ar->diagnosticInfo); - error = ENXIO; - } - -bad: - arl_release_resources(dev); - - return (error); -} - -static int -arl_isa_attach (device_t dev) -{ - struct arl_softc *sc = device_get_softc(dev); - - sc->arl_dev = dev; - if (bootverbose) - device_printf(dev, "in attach\n"); - - arl_alloc_memory(dev, sc->mem_rid, ARL_BASE_STEP); - arl_alloc_irq(dev, sc->irq_rid, 0); - - return arl_attach(dev); -} - -static int -arl_isa_detach(device_t dev) -{ - struct arl_softc *sc = device_get_softc(dev); - - ARL_LOCK(sc); - arl_stop(sc); - ARL_UNLOCK(sc); - callout_drain(&sc->arl_timer); - ether_ifdetach(sc->arl_ifp); - ifmedia_removeall(&sc->arl_ifmedia); - bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); - if_free(sc->arl_ifp); - arl_release_resources(dev); - mtx_destroy(&sc->arl_lock); - - return (0); -} - -static device_method_t arl_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, arl_isa_identify), - DEVMETHOD(device_probe, arl_isa_probe), - DEVMETHOD(device_attach, arl_isa_attach), - DEVMETHOD(device_detach, arl_isa_detach), - - { 0, 0 } -}; - -static driver_t arl_isa_driver = { - "arl", - arl_isa_methods, - sizeof(struct arl_softc) -}; - -extern devclass_t arl_devclass; - -DRIVER_MODULE(arl, isa, arl_isa_driver, arl_devclass, 0, 0); -MODULE_DEPEND(arl, isa, 1, 1, 1); -MODULE_DEPEND(arl, ether, 1, 1, 1); diff --git a/sys/dev/arl/if_arlreg.h b/sys/dev/arl/if_arlreg.h deleted file mode 100644 index 34f05a92b8d1..000000000000 --- a/sys/dev/arl/if_arlreg.h +++ /dev/null @@ -1,344 +0,0 @@ -/*- - * Copyright (c) 1999-2001, Ivan Sharov, Vitaly Belekhov. - * Copyright (c) 2004 Stanislav Svirid. - * 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 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. - * - * $RISS: if_arl/dev/arl/if_arlreg.h,v 1.4 2004/03/16 04:43:27 count Exp $ - * $FreeBSD$ - */ - -#ifndef _IF_ARLREG_H -#define _IF_ARLREG_H - -#define ARL_BASE_START 0xC0000 -#define ARL_BASE_END 0xDE000 -#define ARL_BASE_STEP 0x2000 - -#define ARLAN_NAME_SIZE 16 -#define ARLAN_NAME "ArLan655-SCT" - -/* - * Statistics - */ -struct arl_stats { - u_int32_t numDatagramsTransmitted; - u_int32_t numReTransmissions; - u_int32_t numFramesDiscarded; - u_int32_t numDatagramsReceived; - u_int32_t numDuplicateReceivedFrames; - u_int32_t numDatagramsDiscarded; - u_int16_t maxNumReTransmitDatagram; - u_int16_t maxNumReTransmitFrames; - u_int16_t maxNumConsecutiveDuplicateFrames; - u_int32_t numBytesTransmitted; - u_int32_t numBytesReceived; - u_int32_t numCRCErrors; - u_int32_t numLengthErrors; - u_int32_t numAbortErrors; - u_int32_t numTXUnderruns; - u_int32_t numRXOverruns; - u_int32_t numHoldOffs; - u_int32_t numFramesTransmitted; - u_int32_t numFramesReceived; - u_int32_t numReceiveFramesLost; - u_int32_t numRXBufferOverflows; - u_int32_t numFramesDiscardedAddrMismatch; - u_int32_t numFramesDiscardedSIDMismatch; - u_int32_t numPollsTransmistted; - u_int32_t numPollAcknowledges; - u_int32_t numStatusVectorTimeouts; - u_int32_t numNACKReceived; -} __attribute__((packed)); - -/* - * Arlan private structure in memomory - */ -struct arl_private { - /* Header Signature */ - char textRegion[48]; - u_int8_t resetFlag; - u_int8_t diagnosticInfo; - u_int16_t diagnosticOffset; - u_int8_t _1[12]; - u_int8_t lanCardNodeId[6]; - u_int8_t broadcastAddress[6]; - u_int8_t hardwareType; - u_int8_t majorHardwareVersion; - u_int8_t minorHardwareVersion; - u_int8_t radioModule; - u_int8_t defaultChannelSet; - u_int8_t _2[47]; - - /* Control/Status Block - 0x0080 */ - u_int8_t interruptInProgress; - u_int8_t cntrlRegImage; - u_int8_t _3[14]; - u_int8_t commandByte; - u_int8_t commandParameter[15]; - - /* Receive Status - 0x00a0 */ - u_int8_t rxStatusVector; - u_int8_t rxFrmType; - u_int16_t rxOffset; - u_int16_t rxLength; - u_int8_t rxSrc[6]; - u_int8_t rxBroadcastFlag; - u_int8_t rxQuality; - u_int8_t scrambled; - u_int8_t _4[1]; - - /* Transmit Status - 0x00b0 */ - u_int8_t txStatusVector; - u_int8_t txAckQuality; - u_int8_t numRetries; - u_int8_t _5[14]; - u_int8_t registeredRouter[6]; - u_int8_t backboneRouter[6]; - u_int8_t registrationStatus; - u_int8_t configuredStatusFlag; - u_int8_t _6[1]; - u_int8_t ultimateDestAddress[6]; - u_int8_t immedDestAddress[6]; - u_int8_t immedSrcAddress[6]; - u_int16_t rxSequenceNumber; - u_int8_t assignedLocaltalkAddress; - u_int8_t _7[27]; - - /* System Parameter Block */ - - /* - Driver Parameters (Novell Specific) */ - - u_int16_t txTimeout; - u_int16_t transportTime; - u_int8_t _8[4]; - - /* - Configuration Parameters */ - u_int8_t irqLevel; - u_int8_t spreadingCode; - u_int8_t channelSet; - u_int8_t channelNumber; - u_int16_t radioNodeId; - u_int8_t _9[2]; - u_int8_t scramblingDisable; - u_int8_t radioType; - u_int16_t routerId; - u_int8_t _10[9]; - u_int8_t txAttenuation; - u_int8_t systemId[4]; /* on an odd address for a long !!! */ - u_int16_t globalChecksum; - u_int8_t _11[4]; - u_int16_t maxDatagramSize; - u_int16_t maxFrameSize; - u_int8_t maxRetries; - u_int8_t receiveMode; - u_int8_t priority; - u_int8_t rootOrRepeater; - u_int8_t specifiedRouter[6]; - u_int16_t fastPollPeriod; - u_int8_t pollDecay; - u_int8_t fastPollDelay[2]; - u_int8_t arlThreshold; - u_int8_t arlDecay; - u_int8_t _12[1]; - u_int16_t specRouterTimeout; - u_int8_t _13[5]; - - /* Scrambled Area */ - u_int8_t SID[4]; - u_int8_t encryptionKey[12]; - u_int8_t _14[2]; - u_int8_t waitTime[2]; - u_int8_t lParameter[2]; - u_int8_t _15[3]; - u_int16_t headerSize; - u_int16_t sectionChecksum; - - u_int8_t registrationMode; - u_int8_t registrationFill; - u_int16_t pollPeriod; - u_int16_t refreshPeriod; - u_int8_t name[ARLAN_NAME_SIZE]; - u_int8_t NID[6]; - u_int8_t localTalkAddress; - u_int8_t codeFormat; - u_int8_t SSCode[64]; - - u_int8_t _16[0x140]; - - /* Statistics Block - 0x0300 */ - u_int8_t hostcpuLock; - u_int8_t lancpuLock; - u_int8_t resetTime[18]; - - struct arl_stats stat; - - u_int8_t _17[0x86]; - - u_int8_t txBuffer[0x800]; - u_int8_t rxBuffer[0x800]; - - u_int8_t _18[0x0bfd]; - u_int8_t resetFlag1; - u_int8_t _19; - u_int8_t controlRegister; -}; - -/* - * Transmit parametrs - */ -struct arl_tx_param { - u_int16_t offset; - u_int16_t length; - u_int8_t dest[6]; - u_int8_t clear; - u_int8_t retries; - u_int8_t routing; - u_int8_t scrambled; -}; - -#define ARL_HARDWARE_RESET 0x01 -#define ARL_CHANNEL_ATTENTION 0x02 -#define ARL_INTERRUPT_ENABLE 0x04 -#define ARL_CLEAR_INTERRUPT 0x08 - -/* additions for sys/sockio.h ( socket ioctl parameters for arlan card ) */ - -#define SIOCGARLQLT _IOWR('i', 70, struct ifreq) /* get QUALITY */ -#define SIOCGARLALL _IOWR('i', 71, struct ifreq) /* get ALL */ -#define SIOCSARLALL _IOWR('i', 72, struct ifreq) /* set paramter (who_set) */ -#define SIOCGARLSTB _IOWR('i', 73, struct ifreq) /* get statistic block */ - -/* - * Arlan request struct via ioctl - */ -struct arl_cfg_param { - u_char name[ARLAN_NAME_SIZE]; - u_int8_t sid[4]; - u_int8_t channelSet; - u_int8_t channelNumber; - u_int8_t spreadingCode; - u_int8_t registrationMode; - u_int8_t lanCardNodeId[6]; - u_int8_t specifiedRouter[6]; - u_int8_t hardwareType; - u_int8_t majorHardwareVersion; - u_int8_t minorHardwareVersion; - u_int8_t radioModule; - u_int8_t priority; - u_int8_t receiveMode; - u_int8_t txRetry; -}; - -struct arl_req { - u_int32_t what_set; - struct arl_cfg_param cfg; -}; - -#ifdef ARLCACHE -#define MAXARLCACHE 16 -#define ARLCACHE_RX 0 -#define ARLCACHE_TX 1 - -struct arl_sigcache { - u_int8_t macsrc[6]; /* unique MAC address for entry */ - u_int8_t level[2]; - u_int8_t quality[2]; -}; -#endif - -#define ARLAN_SET_name 0x0001 -#define ARLAN_SET_sid 0x0002 -#define ARLAN_SET_channelSet 0x0004 -#define ARLAN_SET_channelNumber 0x0008 -#define ARLAN_SET_spreadingCode 0x0010 -#define ARLAN_SET_registrationMode 0x0020 -#define ARLAN_SET_lanCardNodeId 0x0040 -#define ARLAN_SET_specifiedRouter 0x0080 -#define ARLAN_SET_priority 0x0100 -#define ARLAN_SET_receiveMode 0x0200 -#define ARLAN_SET_txRetry 0x0400 - -#ifdef _KERNEL -struct arl_softc { - struct ifnet *arl_ifp; - device_t arl_dev; - - struct arl_private * arl_mem; /* arlan data */ - - struct arl_cfg_param arl_cfg; /* arlan vars in our mem */ - u_char arl_control; - - int mem_rid; /* resource id for mem */ - struct resource* mem_res; /* resource for mem */ - int irq_rid; /* resource id for irq */ - struct resource* irq_res; /* resource for irq */ - void* irq_handle; /* handle for irq handler */ - - u_char arl_tx[2048]; - int tx_len; - u_char arl_rx[2048]; - int rx_len; - -#ifdef ARLCACHE - struct arl_sigcache arl_sigcache[MAXARLCACHE]; -#endif - struct ifmedia arl_ifmedia; - struct callout arl_timer; - struct mtx arl_lock; -}; - -#define ARL_LOCK(sc) mtx_lock(&(sc)->arl_lock) -#define ARL_UNLOCK(sc) mtx_unlock(&(sc)->arl_lock) -#define ARL_LOCK_ASSERT(sc) mtx_assert(&(sc)->arl_lock, MA_OWNED) -#endif - -#define ARLAN_SIGN "TELESYSTEM" -#define ARLAN_HEADER_SIZE 0x0C - -#define ar sc->arl_mem -#define arcfg sc->arl_cfg - -#define ARDELAY 10000 -#define ARDELAY1 50000 - -#define WAIT_RESET(cnt, delay) \ - do { \ - int i; \ - for (i = cnt; i && ar->resetFlag; i--) { \ - DELAY(delay); \ - } \ - } while (0) - -#ifdef _KERNEL -void arl_release_resources (device_t); -int arl_alloc_memory (device_t, int, int); -int arl_alloc_irq (device_t, int, int); -int arl_attach (device_t); -int arl_wait_reset (struct arl_softc *, int, int); -void arl_stop (struct arl_softc *); - -driver_intr_t arl_intr; -#endif - -#endif /* _IF_ARLREG_H */ diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index b8c038d2d25c..06eff62cce49 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -563,7 +563,6 @@ hint.mse.0.irq="5" # ar: Arnet SYNC/570i hdlc sync 2/4 port V.35/X.21 serial driver # (requires sppp) -# arl: Aironet Arlan 655 wireless adapters. # ath: Atheros a/b/g WiFi adapters (requires ath_hal and wlan) # ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor # with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if @@ -605,10 +604,6 @@ hint.ar.0.at="isa" hint.ar.0.port="0x300" hint.ar.0.irq="10" hint.ar.0.maddr="0xd0000" -device arl -hint.arl.0.at="isa" -hint.arl.0.irq="9" -hint.arl.0.maddr="0xd0000" device ce device cp device cs diff --git a/sys/modules/Makefile b/sys/modules/Makefile index cb360ad31948..2d5439d50018 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -23,7 +23,6 @@ SUBDIR= ${_3dfx} \ ${_ar} \ ${_arcmsr} \ ${_arcnet} \ - ${_arl} \ ${_asmc} \ ${_asr} \ ata \ @@ -452,7 +451,6 @@ _aac= aac _acpi= acpi _ahb= ahb _arcmsr= arcmsr -_arl= arl _asmc= asmc _asr= asr _bios= bios diff --git a/sys/modules/arl/Makefile b/sys/modules/arl/Makefile deleted file mode 100644 index 011a66e214b3..000000000000 --- a/sys/modules/arl/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $RISS: if_arl/modules/if_arl/Makefile,v 1.3 2003/01/13 08:05:29 frol Exp $ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/arl - -KMOD= if_arl -SRCS= if_arl.c if_arl_isa.c -SRCS+= opt_inet.h device_if.h bus_if.h isa_if.h -CFLAGS+= -I${.CURDIR}/../.. - -.if !defined(KERNBUILDDIR) -opt_inet.h: - echo "#define INET 1" > opt_inet.h -.endif - -.include <bsd.kmod.mk> |
