Wed Apr 15 05:40:48 2015 UTC ()
Register iwm(4) with pmf(9).

Patch from Pierre Pronchery.


(nonaka)
diff -r1.29 -r1.30 src/sys/dev/pci/if_iwm.c

cvs diff -r1.29 -r1.30 src/sys/dev/pci/if_iwm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_iwm.c 2015/03/26 14:42:56 1.29
+++ src/sys/dev/pci/if_iwm.c 2015/04/15 05:40:48 1.30
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_iwm.c,v 1.29 2015/03/26 14:42:56 nonaka Exp $ */ 1/* $NetBSD: if_iwm.c,v 1.30 2015/04/15 05:40:48 nonaka Exp $ */
2/* OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp */ 2/* OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp */
3 3
4/* 4/*
5 * Copyright (c) 2014 genua mbh <info@genua.de> 5 * Copyright (c) 2014 genua mbh <info@genua.de>
6 * Copyright (c) 2014 Fixup Software Ltd. 6 * Copyright (c) 2014 Fixup Software Ltd.
7 * 7 *
8 * Permission to use, copy, modify, and distribute this software for any 8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above 9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies. 10 * copyright notice and this permission notice appear in all copies.
11 * 11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -95,27 +95,27 @@ @@ -95,27 +95,27 @@
95 * purpose with or without fee is hereby granted, provided that the above 95 * purpose with or without fee is hereby granted, provided that the above
96 * copyright notice and this permission notice appear in all copies. 96 * copyright notice and this permission notice appear in all copies.
97 * 97 *
98 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
99 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 99 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
100 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 100 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
101 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 101 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
102 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 102 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
103 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 103 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
104 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 104 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
105 */ 105 */
106 106
107#include <sys/cdefs.h> 107#include <sys/cdefs.h>
108__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.29 2015/03/26 14:42:56 nonaka Exp $"); 108__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.30 2015/04/15 05:40:48 nonaka Exp $");
109 109
110#include <sys/param.h> 110#include <sys/param.h>
111#include <sys/conf.h> 111#include <sys/conf.h>
112#include <sys/kernel.h> 112#include <sys/kernel.h>
113#include <sys/kmem.h> 113#include <sys/kmem.h>
114#include <sys/mbuf.h> 114#include <sys/mbuf.h>
115#include <sys/mutex.h> 115#include <sys/mutex.h>
116#include <sys/proc.h> 116#include <sys/proc.h>
117#include <sys/socket.h> 117#include <sys/socket.h>
118#include <sys/sockio.h> 118#include <sys/sockio.h>
119#include <sys/systm.h> 119#include <sys/systm.h>
120 120
121#include <sys/cpu.h> 121#include <sys/cpu.h>
@@ -6606,26 +6606,31 @@ iwm_attach_hook(device_t dev) @@ -6606,26 +6606,31 @@ iwm_attach_hook(device_t dev)
6606 ic->ic_node_alloc = iwm_node_alloc; 6606 ic->ic_node_alloc = iwm_node_alloc;
6607 6607
6608 /* Override 802.11 state transition machine. */ 6608 /* Override 802.11 state transition machine. */
6609 sc->sc_newstate = ic->ic_newstate; 6609 sc->sc_newstate = ic->ic_newstate;
6610 ic->ic_newstate = iwm_newstate; 6610 ic->ic_newstate = iwm_newstate;
6611 ieee80211_media_init(ic, iwm_media_change, ieee80211_media_status); 6611 ieee80211_media_init(ic, iwm_media_change, ieee80211_media_status);
6612 ieee80211_announce(ic); 6612 ieee80211_announce(ic);
6613 6613
6614 iwm_radiotap_attach(sc); 6614 iwm_radiotap_attach(sc);
6615 callout_init(&sc->sc_calib_to, 0); 6615 callout_init(&sc->sc_calib_to, 0);
6616 callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc); 6616 callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc);
6617 6617
6618 //task_set(&sc->init_task, iwm_init_task, sc); 6618 //task_set(&sc->init_task, iwm_init_task, sc);
 6619
 6620 if (pmf_device_register(dev, NULL, NULL))
 6621 pmf_class_network_register(dev, ifp);
 6622 else
 6623 aprint_error_dev(dev, "couldn't establish power handler\n");
6619} 6624}
6620 6625
6621static void 6626static void
6622iwm_attach(device_t parent, device_t self, void *aux) 6627iwm_attach(device_t parent, device_t self, void *aux)
6623{ 6628{
6624 struct iwm_softc *sc = device_private(self); 6629 struct iwm_softc *sc = device_private(self);
6625 struct pci_attach_args *pa = aux; 6630 struct pci_attach_args *pa = aux;
6626 pci_intr_handle_t ih; 6631 pci_intr_handle_t ih;
6627 pcireg_t reg, memtype; 6632 pcireg_t reg, memtype;
6628 const char *intrstr; 6633 const char *intrstr;
6629 int error; 6634 int error;
6630 int txq_i; 6635 int txq_i;
6631 6636