Deleted Added
full compact
if_iwi.c (146500) if_iwi.c (147256)
1/* $FreeBSD: head/sys/dev/iwi/if_iwi.c 146500 2005-05-22 18:55:32Z damien $ */
1/* $FreeBSD: head/sys/dev/iwi/if_iwi.c 147256 2005-06-10 16:49:24Z brooks $ */
2
3/*-
4 * Copyright (c) 2004, 2005
5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 13 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
2
3/*-
4 * Copyright (c) 2004, 2005
5 * Damien Bergamini <damien.bergamini@free.fr>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

--- 13 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/iwi/if_iwi.c 146500 2005-05-22 18:55:32Z damien $");
31__FBSDID("$FreeBSD: head/sys/dev/iwi/if_iwi.c 147256 2005-06-10 16:49:24Z brooks $");
32
33/*-
34 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
36 */
37
38#include <sys/param.h>
39#include <sys/sysctl.h>

--- 184 unchanged lines hidden (view full) ---

224
225/* Base Address Register */
226#define IWI_PCI_BAR0 0x10
227
228static int
229iwi_attach(device_t dev)
230{
231 struct iwi_softc *sc = device_get_softc(dev);
32
33/*-
34 * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
35 * http://www.intel.com/network/connectivity/products/wireless/prowireless_mobile.htm
36 */
37
38#include <sys/param.h>
39#include <sys/sysctl.h>

--- 184 unchanged lines hidden (view full) ---

224
225/* Base Address Register */
226#define IWI_PCI_BAR0 0x10
227
228static int
229iwi_attach(device_t dev)
230{
231 struct iwi_softc *sc = device_get_softc(dev);
232 struct ifnet *ifp = &sc->sc_arp.ac_if;
232 struct ifnet *ifp;
233 struct ieee80211com *ic = &sc->sc_ic;
234 uint16_t val;
235 int error, i;
236
237 sc->sc_dev = dev;
238
239 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
240 MTX_DEF | MTX_RECURSE);

--- 46 unchanged lines hidden (view full) ---

287 goto fail;
288 }
289
290 if (iwi_alloc_rx_ring(sc, &sc->rxq, IWI_RX_RING_COUNT) != 0) {
291 device_printf(dev, "could not allocate Rx ring\n");
292 goto fail;
293 }
294
233 struct ieee80211com *ic = &sc->sc_ic;
234 uint16_t val;
235 int error, i;
236
237 sc->sc_dev = dev;
238
239 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
240 MTX_DEF | MTX_RECURSE);

--- 46 unchanged lines hidden (view full) ---

287 goto fail;
288 }
289
290 if (iwi_alloc_rx_ring(sc, &sc->rxq, IWI_RX_RING_COUNT) != 0) {
291 device_printf(dev, "could not allocate Rx ring\n");
292 goto fail;
293 }
294
295 ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
296 if (ifp == NULL) {
297 device_printf(dev, "can not if_alloc()\n");
298 goto fail;
299 return (ENOSPC);
300 }
295 ifp->if_softc = sc;
296 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
297 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
298 ifp->if_init = iwi_init;
299 ifp->if_ioctl = iwi_ioctl;
300 ifp->if_start = iwi_start;
301 ifp->if_watchdog = iwi_watchdog;
302 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);

--- 127 unchanged lines hidden (view full) ---

430 struct iwi_softc *sc = device_get_softc(dev);
431 struct ieee80211com *ic = &sc->sc_ic;
432 struct ifnet *ifp = ic->ic_ifp;
433
434 iwi_stop(sc);
435
436 iwi_free_firmware(sc);
437
301 ifp->if_softc = sc;
302 if_initname(ifp, device_get_name(dev), device_get_unit(dev));
303 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
304 ifp->if_init = iwi_init;
305 ifp->if_ioctl = iwi_ioctl;
306 ifp->if_start = iwi_start;
307 ifp->if_watchdog = iwi_watchdog;
308 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);

--- 127 unchanged lines hidden (view full) ---

436 struct iwi_softc *sc = device_get_softc(dev);
437 struct ieee80211com *ic = &sc->sc_ic;
438 struct ifnet *ifp = ic->ic_ifp;
439
440 iwi_stop(sc);
441
442 iwi_free_firmware(sc);
443
438 bpfdetach(ifp);
444 if (ifp != NULL)
445 bpfdetach(ifp);
439 ieee80211_ifdetach(ic);
446 ieee80211_ifdetach(ic);
447 if (ifp != NULL)
448 if_free(ifp);
440
441 iwi_free_cmd_ring(sc, &sc->cmdq);
442 iwi_free_tx_ring(sc, &sc->txq);
443 iwi_free_rx_ring(sc, &sc->rxq);
444
445 if (sc->irq != NULL) {
446 bus_teardown_intr(dev, sc->irq, sc->sc_ih);
447 bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);

--- 1894 unchanged lines hidden ---
449
450 iwi_free_cmd_ring(sc, &sc->cmdq);
451 iwi_free_tx_ring(sc, &sc->txq);
452 iwi_free_rx_ring(sc, &sc->rxq);
453
454 if (sc->irq != NULL) {
455 bus_teardown_intr(dev, sc->irq, sc->sc_ih);
456 bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);

--- 1894 unchanged lines hidden ---