Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys cleanup haeders.



details:   https://anonhg.NetBSD.org/src/rev/215865a11197
branches:  trunk
changeset: 487552:215865a11197
user:      onoe <onoe%NetBSD.org@localhost>
date:      Fri Jun 09 05:31:15 2000 +0000

description:
cleanup haeders.
add opt_awi.h to define AWI_DEBUG, AWI_WEP_ARC4.
show the firmware version at attach.
create a framework to support WEP (encryption code is not included for now).
a new wiconfig compatible ioctl interface replaced the awictl interface.
fix memory leak in selecting AP
fix bugs in ESSID selection
changes from FreeBSD-current by Warner Losh:
  revision 1.2
  date: 2000/04/17 22:58:15;  author: imp;  state: Exp;  lines: +16 -1
  Provide mem* for compat with NetBSD to fix LINT
fixes from FreeBSD-current by Guido van Rooij:
  revision 1.4
  date: 2000/05/29 19:58:10;  author: guido;  state: Exp;  lines: +5 -2
  Fix a panic resulting from an obvious null pointer deref.
  Apparently some other panics still exist in this driver, but with
  this fix, it was at least possible to run the Nokia card at SANE 2000.

diffstat:

 sys/dev/ic/Makefile            |    4 +-
 sys/dev/ic/awi.c               |  348 +++++------------------
 sys/dev/ic/awi_wep.c           |  450 +++++++++++++++++++++++++++++++
 sys/dev/ic/awi_wicfg.c         |  584 +++++++++++++++++++++++++++++++++++++++++
 sys/dev/ic/awictl.h            |   71 ----
 sys/dev/ic/awivar.h            |   49 +++-
 sys/dev/pcmcia/files.pcmcia    |    5 +-
 sys/dev/pcmcia/if_awi_pcmcia.c |   21 +-
 sys/net/if_ieee80211.h         |    7 +-
 9 files changed, 1183 insertions(+), 356 deletions(-)

diffs (truncated from 1991 to 300 lines):

diff -r 1d43421d1ca7 -r 215865a11197 sys/dev/ic/Makefile
--- a/sys/dev/ic/Makefile       Fri Jun 09 05:30:51 2000 +0000
+++ b/sys/dev/ic/Makefile       Fri Jun 09 05:31:15 2000 +0000
@@ -1,10 +1,10 @@
-#      $NetBSD: Makefile,v 1.11 2000/05/07 00:29:03 wiz Exp $
+#      $NetBSD: Makefile,v 1.12 2000/06/09 05:31:15 onoe Exp $
 
 INCSDIR= /usr/include/dev/ic
 
 INCS=  ad1848reg.h ahareg.h ahavar.h aic6360reg.h aic6360var.h \
        aic77xxreg.h aic77xxvar.h aic7xxxvar.h am7930reg.h am7990reg.h \
-       am7990var.h awictl.h bhareg.h bhavar.h bt431reg.h bt459reg.h \
+       am7990var.h bhareg.h bhavar.h bt431reg.h bt459reg.h \
        bt463reg.h bt485reg.h bt8xx.h cacreg.h cacvar.h cd1190reg.h \
        cd1400reg.h comreg.h comvar.h cs4231reg.h cyreg.h \
        cyvar.h dc21040reg.h dp8390reg.h dp8390var.h dptreg.h dptvar.h ds.h \
diff -r 1d43421d1ca7 -r 215865a11197 sys/dev/ic/awi.c
--- a/sys/dev/ic/awi.c  Fri Jun 09 05:30:51 2000 +0000
+++ b/sys/dev/ic/awi.c  Fri Jun 09 05:31:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awi.c,v 1.17 2000/05/29 17:37:12 jhawk Exp $   */
+/*     $NetBSD: awi.c,v 1.18 2000/06/09 05:31:15 onoe Exp $    */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -48,23 +48,14 @@
  * and to support adhoc mode by Atsushi Onoe <onoe%netbsd.org@localhost>
  */
 
-#ifdef __NetBSD__
+#include "opt_awi.h"
 #include "opt_inet.h"
-#include "opt_ns.h"
-#include "bpfilter.h"
-#include "rnd.h"
-#endif
-#ifdef __FreeBSD__
-#if __FreeBSD__ >= 3
-#include "opt_inet.h"
-#endif
-#if __FreeBSD__ >= 4
+#if defined(__FreeBSD__) && __FreeBSD__ >= 4
 #include "bpf.h"
 #define        NBPFILTER       NBPF
 #else
 #include "bpfilter.h"
 #endif
-#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,22 +64,14 @@
 #include <sys/malloc.h>
 #include <sys/proc.h>
 #include <sys/socket.h>
-#ifdef __FreeBSD__
 #include <sys/sockio.h>
-#else
-#include <sys/ioctl.h>
-#endif
 #include <sys/errno.h>
 #include <sys/syslog.h>
-#include <sys/select.h>
 #if defined(__FreeBSD__) && __FreeBSD__ >= 4
 #include <sys/bus.h>
 #else
 #include <sys/device.h>
 #endif
-#if NRND > 0
-#include <sys/rnd.h>
-#endif
 
 #include <net/if.h>
 #include <net/if_dl.h>
@@ -113,11 +96,6 @@
 #endif
 #endif
 
-#ifdef NS
-#include <netns/ns.h>
-#include <netns/ns_if.h>
-#endif
-
 #if NBPFILTER > 0
 #include <net/bpf.h>
 #include <net/bpfdesc.h>
@@ -137,14 +115,12 @@
 #include <dev/ic/am79c930var.h>
 #include <dev/ic/awireg.h>
 #include <dev/ic/awivar.h>
-#include <dev/ic/awictl.h>
 #endif
 #ifdef __FreeBSD__
 #include <dev/awi/am79c930reg.h>
 #include <dev/awi/am79c930var.h>
 #include <dev/awi/awireg.h>
 #include <dev/awi/awivar.h>
-#include <dev/awi/awictl.h>
 #endif
 
 static int awi_ioctl __P((struct ifnet *ifp, u_long cmd, caddr_t data));
@@ -154,10 +130,6 @@
 static int awi_media_change __P((struct ifnet *ifp));
 static void awi_media_status __P((struct ifnet *ifp, struct ifmediareq *imr));
 #endif
-static int awi_drvget __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-static int awi_drvset __P((struct ifnet *ifp, u_long cmd, caddr_t data));
-static int awi_init __P((struct awi_softc *sc));
-static void awi_stop __P((struct awi_softc *sc));
 static void awi_watchdog __P((struct ifnet *ifp));
 static void awi_start __P((struct ifnet *ifp));
 static void awi_txint __P((struct awi_softc *sc));
@@ -165,12 +137,11 @@
 static struct mbuf * awi_fix_rxhdr __P((struct awi_softc *sc, struct mbuf *m0));
 static void awi_input __P((struct awi_softc *sc, struct mbuf *m, u_int32_t rxts, u_int8_t rssi));
 static void awi_rxint __P((struct awi_softc *sc));
-struct mbuf * awi_devget __P((struct awi_softc *sc, u_int32_t off, u_int16_t len));
+static struct mbuf * awi_devget __P((struct awi_softc *sc, u_int32_t off, u_int16_t len));
 static int awi_init_hw __P((struct awi_softc *sc));
 static int awi_init_mibs __P((struct awi_softc *sc));
 static int awi_init_txrx __P((struct awi_softc *sc));
 static void awi_stop_txrx __P((struct awi_softc *sc));
-static int awi_init_region __P((struct awi_softc *sc));
 static int awi_start_scan __P((struct awi_softc *sc));
 static int awi_next_scan __P((struct awi_softc *sc));
 static void awi_stop_scan __P((struct awi_softc *sc));
@@ -227,10 +198,6 @@
 #endif
 
 #ifdef __FreeBSD__
-#if __FreeBSD__ < 4
-#define        memset(p, v, n)         bzero(p, n)             /*XXX*/
-#endif
-
 #if __FreeBSD__ >= 4
 devclass_t awi_devclass;
 #endif
@@ -254,17 +221,16 @@
        struct awi_softc *sc;
 {
        struct ifnet *ifp = sc->sc_ifp;
+       int s;
+       int error;
 #ifdef IFM_IEEE80211
        int i;
        u_int8_t *phy_rates;
        int mword;
        struct ifmediareq imr;
 #endif
-       int s;
-       int error;
 
        s = splnet();
-
        /*
         * Even if we can sleep in initialization state,
         * all other processes (e.g. ifconfig) have to wait for
@@ -307,10 +273,13 @@
            ETHER_ADDR_LEN);
 #endif
 
-       printf("%s: IEEE802.11 (%s %dMbps) address %s\n",
+       awi_read_bytes(sc, AWI_BANNER, sc->sc_banner, AWI_BANNER_LEN);
+       printf("%s: IEEE802.11 %s %dMbps (firmware %s)\n",
            sc->sc_dev.dv_xname,
            sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH ? "FH" : "DS",
-           sc->sc_tx_rate / 10, ether_sprintf(sc->sc_mib_addr.aMAC_Address));
+           sc->sc_tx_rate / 10, sc->sc_banner);
+       printf("%s: address %s\n",
+           sc->sc_dev.dv_xname,  ether_sprintf(sc->sc_mib_addr.aMAC_Address));
        if_attach(ifp);
 #ifdef __FreeBSD__
        ether_ifattach(ifp);
@@ -369,6 +338,8 @@
                wakeup(sc);
                (void)tsleep(sc, PWAIT, "awidet", 1);
        }
+       if (sc->sc_wep_ctx != NULL)
+               free(sc->sc_wep_ctx, M_DEVBUF);
 #if NBPFILTER > 0
        bpfdetach(ifp);
 #endif
@@ -410,27 +381,36 @@
 
        return error;
 }
-#endif /* __NetBSD__ */
 
 void
-awi_reset(sc)
+awi_power(sc, why)
        struct awi_softc *sc;
+       int why;
 {
        int s;
+       int ocansleep;
 
        if (!sc->sc_enabled)
                return;
+
        s = splnet();
-       sc->sc_invalid = 1;
-       awi_stop(sc);
-       if (sc->sc_disable)
-               (*sc->sc_disable)(sc);
-       sc->sc_enabled = 0;
-       DELAY(1000);
-       sc->sc_invalid = 0;
-       (void)awi_init(sc);
+       ocansleep = sc->sc_cansleep;
+       sc->sc_cansleep = 0;
+#ifdef needtobefixed   /*ONOE*/
+       if (why == PWR_RESUME) {
+               sc->sc_enabled = 0;
+               awi_init(sc);
+               (void)awi_intr(sc);
+       } else {
+               awi_stop(sc);
+               if (sc->sc_disable)
+                       (*sc->sc_disable)(sc);
+       }
+#endif
+       sc->sc_cansleep = ocansleep;
        splx(s);
 }
+#endif /* __NetBSD__ */
 
 static int
 awi_ioctl(ifp, cmd, data)
@@ -486,6 +466,9 @@
                    ether_addmulti(ifr, &sc->sc_ec) :
                    ether_delmulti(ifr, &sc->sc_ec);
 #endif
+               /*
+                * Do not rescan BSS.  Rather, just reset multicast filter.
+                */
                if (error == ENETRESET) {
                        if (sc->sc_enabled)
                                error = awi_init(sc);
@@ -534,14 +517,8 @@
                error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
                break;
 #endif
-       case SIOCGDRVSPEC:
-               error = awi_drvget(ifp, cmd, data);
-               break;
-       case SIOCSDRVSPEC:
-               error = awi_drvset(ifp, cmd, data);
-               break;
        default:
-               error = EINVAL;
+               error = awi_wicfg(ifp, cmd, data);
                break;
        }
        awi_unlock(sc);
@@ -685,187 +662,6 @@
 }
 #endif /* IFM_IEEE80211 */
 
-/*
- * XXX
- * The following stuff is partially duplicated with SIOC[GS]IFMEDIA and
- * SIOC[GS]80211NWID, which should be integrated as well as other common
- * stuff among 802.11 wireless LAN drivers.
- */
-
-static int
-awi_drvget(ifp, cmd, data)
-       struct ifnet *ifp;
-       u_long cmd;
-       caddr_t data;
-{
-       struct awi_softc *sc = ifp->if_softc;
-       struct ifdrv *ifd = (struct ifdrv *)data;
-       u_int8_t buf[AWICTL_BUFSIZE];
-       u_int8_t *essid;
-       int error = 0;
-
-       switch (ifd->ifd_cmd) {
-       case AWICTL_REGION:
-               if (ifd->ifd_len < 1)
-                       return ENOSPC;
-               ifd->ifd_len = 1;
-               buf[0] = sc->sc_mib_phy.aCurrent_Reg_Domain;
-               break;
-       case AWICTL_CHANSET:
-               if (ifd->ifd_len < 3)
-                       return ENOSPC;
-               ifd->ifd_len = 3;
-               buf[0] = sc->sc_bss.chanset;
-               buf[1] = sc->sc_scan_min;
-               buf[2] = sc->sc_scan_max;
-               break;
-       case AWICTL_RAWBPF:
-               if (ifd->ifd_len < 1)
-                       return ENOSPC;
-               ifd->ifd_len = 1;
-               buf[0] = sc->sc_rawbpf;
-               break;
-       case AWICTL_DESSID:



Home | Main Index | Thread Index | Old Index