Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pcmcia Add shutdown hook to turn off card.



details:   https://anonhg.NetBSD.org/src/rev/81b97fe1d582
branches:  trunk
changeset: 474674:81b97fe1d582
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Wed Jul 14 23:07:29 1999 +0000

description:
Add shutdown hook to turn off card.
Fix BPF tap code.

diffstat:

 sys/dev/pcmcia/if_wi.c    |  34 ++++++++++++++--------------------
 sys/dev/pcmcia/if_wivar.h |   5 +++--
 2 files changed, 17 insertions(+), 22 deletions(-)

diffs (139 lines):

diff -r cec7ae4b87a8 -r 81b97fe1d582 sys/dev/pcmcia/if_wi.c
--- a/sys/dev/pcmcia/if_wi.c    Wed Jul 14 23:03:09 1999 +0000
+++ b/sys/dev/pcmcia/if_wi.c    Wed Jul 14 23:07:29 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wi.c,v 1.1 1999/07/14 22:24:08 sommerfeld Exp $     */
+/*     $NetBSD: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -31,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- *     $Id: if_wi.c,v 1.1 1999/07/14 22:24:08 sommerfeld Exp $
+ *     $Id: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $
  */
 
 /*
@@ -98,7 +98,7 @@
 #include <netinet/if_inarp.h>
 #endif
 
-#if NBPF > 0
+#if NBPFILTER > 0
 #include <net/bpf.h>
 #include <net/bpfdesc.h>
 #endif
@@ -115,7 +115,7 @@
 
 #if !defined(lint)
 static const char rcsid[] =
-       "$Id: if_wi.c,v 1.1 1999/07/14 22:24:08 sommerfeld Exp $";
+       "$Id: if_wi.c,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $";
 #endif
 
 #ifdef foo
@@ -151,6 +151,7 @@
 static void wi_inquire         __P((void *));
 static void wi_setdef          __P((struct wi_softc *, struct wi_req *));
 static int wi_mgmt_xmit                __P((struct wi_softc *, caddr_t, int));
+static void wi_shutdown                __P((void *));
 
 static int wi_enable __P((struct wi_softc *));
 static int wi_disable __P((struct wi_softc *));
@@ -322,15 +323,12 @@
        if_attach(ifp);
        ether_ifattach(ifp, mac.wi_mac_addr);
 
-#if NBPF > 0
+#if NBPFILTER > 0
        bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
            sizeof(struct ether_header));
 #endif
 
-#if 0
-       /* XXX should use NetBSD shutdown hooks here */
-       at_shutdown(wi_shutdown, sc, SHUTDOWN_POST_SYNC);
-#endif
+       sc->sc_sdhook = shutdownhook_establish(wi_shutdown, sc);
 }
 
 static void wi_rxeof(sc)
@@ -425,12 +423,12 @@
 
        ifp->if_ipackets++;
 
-#if NBPF > 0
+#if NBPFILTER > 0
        /* Handle BPF listeners. */
        if (ifp->if_bpf) {
-               bpf_mtap(ifp, m);
+               bpf_mtap(ifp->if_bpf, m);
                if (ifp->if_flags & IFF_PROMISC &&
-                   (bcmp(eh->ether_dhost, sc->sc_ethercom.ec_enaddr,
+                   (bcmp(eh->ether_dhost, sc->sc_macaddr,
                    ETHER_ADDR_LEN) && (eh->ether_dhost[0] & 1) == 0)) {
                        m_freem(m);
                        return;
@@ -1233,13 +1231,13 @@
                    m0->m_pkthdr.len + 2);
        }
 
-#if NBPF > 0
+#if NBPFILTER > 0
        /*
         * If there's a BPF listner, bounce a copy of
         * this frame to him.
         */
        if (ifp->if_bpf)
-               bpf_mtap(ifp, m0);
+               bpf_mtap(ifp->if_bpf, m0);
 #endif
 
        m_freem(m0);
@@ -1330,16 +1328,12 @@
        return;
 }
 
-#if 0
-static void wi_shutdown(howto, arg)
-       int                     howto;
+static void wi_shutdown(arg)
        void                    *arg;
 {
        struct wi_softc         *sc;
 
        sc = arg;
-       wi_stop(sc);
-
+       wi_disable(sc);
        return;
 }
-#endif
diff -r cec7ae4b87a8 -r 81b97fe1d582 sys/dev/pcmcia/if_wivar.h
--- a/sys/dev/pcmcia/if_wivar.h Wed Jul 14 23:03:09 1999 +0000
+++ b/sys/dev/pcmcia/if_wivar.h Wed Jul 14 23:07:29 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wivar.h,v 1.1 1999/07/14 22:24:11 sommerfeld Exp $  */
+/*     $NetBSD: if_wivar.h,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $  */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -31,7 +31,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- *     $Id: if_wivar.h,v 1.1 1999/07/14 22:24:11 sommerfeld Exp $
+ *     $Id: if_wivar.h,v 1.2 1999/07/14 23:07:29 sommerfeld Exp $
  */
 
 
@@ -75,6 +75,7 @@
        bus_space_tag_t         wi_btag;
        bus_space_handle_t      wi_bhandle;
 
+       void *sc_sdhook;        /* saved shutdown hook for card */
        void *sc_ih;
        u_int8_t                sc_macaddr[6];
        



Home | Main Index | Thread Index | Old Index