Tue May 26 23:57:34 2009 UTC ()
Wrap some long lines.  No functional change intended.


(dyoung)
diff -r1.142 -r1.143 src/sys/dev/ic/atw.c

cvs diff -r1.142 -r1.143 src/sys/dev/ic/atw.c (expand / switch to unified diff)

--- src/sys/dev/ic/atw.c 2008/12/16 22:35:30 1.142
+++ src/sys/dev/ic/atw.c 2009/05/26 23:57:34 1.143
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atw.c,v 1.142 2008/12/16 22:35:30 christos Exp $ */ 1/* $NetBSD: atw.c,v 1.143 2009/05/26 23:57:34 dyoung Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by David Young, by Jason R. Thorpe, and by Charles M. Hannum. 8 * by David Young, by Jason R. Thorpe, and by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Device driver for the ADMtek ADM8211 802.11 MAC/BBP. 33 * Device driver for the ADMtek ADM8211 802.11 MAC/BBP.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.142 2008/12/16 22:35:30 christos Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.143 2009/05/26 23:57:34 dyoung Exp $");
38 38
39#include "bpfilter.h" 39#include "bpfilter.h"
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/callout.h> 43#include <sys/callout.h>
44#include <sys/mbuf.h> 44#include <sys/mbuf.h>
45#include <sys/malloc.h> 45#include <sys/malloc.h>
46#include <sys/kernel.h> 46#include <sys/kernel.h>
47#include <sys/socket.h> 47#include <sys/socket.h>
48#include <sys/ioctl.h> 48#include <sys/ioctl.h>
49#include <sys/errno.h> 49#include <sys/errno.h>
50#include <sys/device.h> 50#include <sys/device.h>
@@ -564,77 +564,82 @@ atw_attach(struct atw_softc *sc) @@ -564,77 +564,82 @@ atw_attach(struct atw_softc *sc)
564 SIMPLEQ_INIT(&sc->sc_txdirtyq); 564 SIMPLEQ_INIT(&sc->sc_txdirtyq);
565 565
566#ifdef ATW_DEBUG 566#ifdef ATW_DEBUG
567 atw_print_regs(sc, "atw_attach"); 567 atw_print_regs(sc, "atw_attach");
568#endif /* ATW_DEBUG */ 568#endif /* ATW_DEBUG */
569 569
570 /* 570 /*
571 * Allocate the control data structures, and create and load the 571 * Allocate the control data structures, and create and load the
572 * DMA map for it. 572 * DMA map for it.
573 */ 573 */
574 if ((error = bus_dmamem_alloc(sc->sc_dmat, 574 if ((error = bus_dmamem_alloc(sc->sc_dmat,
575 sizeof(struct atw_control_data), PAGE_SIZE, 0, &sc->sc_cdseg, 575 sizeof(struct atw_control_data), PAGE_SIZE, 0, &sc->sc_cdseg,
576 1, &sc->sc_cdnseg, 0)) != 0) { 576 1, &sc->sc_cdnseg, 0)) != 0) {
577 aprint_error_dev(sc->sc_dev, "unable to allocate control data, error = %d\n", 577 aprint_error_dev(sc->sc_dev,
 578 "unable to allocate control data, error = %d\n",
578 error); 579 error);
579 goto fail_0; 580 goto fail_0;
580 } 581 }
581 582
582 if ((error = bus_dmamem_map(sc->sc_dmat, &sc->sc_cdseg, sc->sc_cdnseg, 583 if ((error = bus_dmamem_map(sc->sc_dmat, &sc->sc_cdseg, sc->sc_cdnseg,
583 sizeof(struct atw_control_data), (void **)&sc->sc_control_data, 584 sizeof(struct atw_control_data), (void **)&sc->sc_control_data,
584 BUS_DMA_COHERENT)) != 0) { 585 BUS_DMA_COHERENT)) != 0) {
585 aprint_error_dev(sc->sc_dev, "unable to map control data, error = %d\n", 586 aprint_error_dev(sc->sc_dev,
 587 "unable to map control data, error = %d\n",
586 error); 588 error);
587 goto fail_1; 589 goto fail_1;
588 } 590 }
589 591
590 if ((error = bus_dmamap_create(sc->sc_dmat, 592 if ((error = bus_dmamap_create(sc->sc_dmat,
591 sizeof(struct atw_control_data), 1, 593 sizeof(struct atw_control_data), 1,
592 sizeof(struct atw_control_data), 0, 0, &sc->sc_cddmamap)) != 0) { 594 sizeof(struct atw_control_data), 0, 0, &sc->sc_cddmamap)) != 0) {
593 aprint_error_dev(sc->sc_dev, "unable to create control data DMA map, " 595 aprint_error_dev(sc->sc_dev,
594 "error = %d\n", error); 596 "unable to create control data DMA map, error = %d\n",
 597 error);
595 goto fail_2; 598 goto fail_2;
596 } 599 }
597 600
598 if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap, 601 if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_cddmamap,
599 sc->sc_control_data, sizeof(struct atw_control_data), NULL, 602 sc->sc_control_data, sizeof(struct atw_control_data), NULL,
600 0)) != 0) { 603 0)) != 0) {
601 aprint_error_dev(sc->sc_dev, "unable to load control data DMA map, error = %d\n", 604 aprint_error_dev(sc->sc_dev,
602 error); 605 "unable to load control data DMA map, error = %d\n", error);
603 goto fail_3; 606 goto fail_3;
604 } 607 }
605 608
606 /* 609 /*
607 * Create the transmit buffer DMA maps. 610 * Create the transmit buffer DMA maps.
608 */ 611 */
609 sc->sc_ntxsegs = ATW_NTXSEGS; 612 sc->sc_ntxsegs = ATW_NTXSEGS;
610 for (i = 0; i < ATW_TXQUEUELEN; i++) { 613 for (i = 0; i < ATW_TXQUEUELEN; i++) {
611 if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 614 if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
612 sc->sc_ntxsegs, MCLBYTES, 0, 0, 615 sc->sc_ntxsegs, MCLBYTES, 0, 0,
613 &sc->sc_txsoft[i].txs_dmamap)) != 0) { 616 &sc->sc_txsoft[i].txs_dmamap)) != 0) {
614 aprint_error_dev(sc->sc_dev, "unable to create tx DMA map %d, " 617 aprint_error_dev(sc->sc_dev,
615 "error = %d\n", i, error); 618 "unable to create tx DMA map %d, error = %d\n", i,
 619 error);
616 goto fail_4; 620 goto fail_4;
617 } 621 }
618 } 622 }
619 623
620 /* 624 /*
621 * Create the receive buffer DMA maps. 625 * Create the receive buffer DMA maps.
622 */ 626 */
623 for (i = 0; i < ATW_NRXDESC; i++) { 627 for (i = 0; i < ATW_NRXDESC; i++) {
624 if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, 628 if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
625 MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) { 629 MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
626 aprint_error_dev(sc->sc_dev, "unable to create rx DMA map %d, " 630 aprint_error_dev(sc->sc_dev,
627 "error = %d\n", i, error); 631 "unable to create rx DMA map %d, error = %d\n", i,
 632 error);
628 goto fail_5; 633 goto fail_5;
629 } 634 }
630 } 635 }
631 for (i = 0; i < ATW_NRXDESC; i++) { 636 for (i = 0; i < ATW_NRXDESC; i++) {
632 sc->sc_rxsoft[i].rxs_mbuf = NULL; 637 sc->sc_rxsoft[i].rxs_mbuf = NULL;
633 } 638 }
634 639
635 switch (sc->sc_rev) { 640 switch (sc->sc_rev) {
636 case ATW_REVISION_AB: 641 case ATW_REVISION_AB:
637 case ATW_REVISION_AF: 642 case ATW_REVISION_AF:
638 sc->sc_sramlen = ATW_SRAM_A_SIZE; 643 sc->sc_sramlen = ATW_SRAM_A_SIZE;
639 break; 644 break;
640 case ATW_REVISION_BA: 645 case ATW_REVISION_BA: