Use bus_dmamap_load instead of bus_dmamap_load_rawdiff -r1.6 -r1.7 src/sys/dev/ic/arn5008.c
(matt)
--- src/sys/dev/ic/arn5008.c 2014/02/23 15:29:11 1.6
+++ src/sys/dev/ic/arn5008.c 2015/05/24 17:08:50 1.7
@@ -1,40 +1,40 @@ | @@ -1,40 +1,40 @@ | |||
1 | /* $NetBSD: arn5008.c,v 1.6 2014/02/23 15:29:11 christos Exp $ */ | 1 | /* $NetBSD: arn5008.c,v 1.7 2015/05/24 17:08:50 matt Exp $ */ | |
2 | /* $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $ */ | 2 | /* $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> | 5 | * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> | |
6 | * Copyright (c) 2008-2009 Atheros Communications Inc. | 6 | * Copyright (c) 2008-2009 Atheros Communications Inc. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and/or distribute this software for any | 8 | * Permission to use, copy, modify, and/or 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 | |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
19 | */ | 19 | */ | |
20 | 20 | |||
21 | /* | 21 | /* | |
22 | * Driver for Atheros 802.11a/g/n chipsets. | 22 | * Driver for Atheros 802.11a/g/n chipsets. | |
23 | * Routines common to AR5008, AR9001 and AR9002 families. | 23 | * Routines common to AR5008, AR9001 and AR9002 families. | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.6 2014/02/23 15:29:11 christos Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.7 2015/05/24 17:08:50 matt Exp $"); | |
28 | 28 | |||
29 | #include <sys/param.h> | 29 | #include <sys/param.h> | |
30 | #include <sys/sockio.h> | 30 | #include <sys/sockio.h> | |
31 | #include <sys/mbuf.h> | 31 | #include <sys/mbuf.h> | |
32 | #include <sys/kernel.h> | 32 | #include <sys/kernel.h> | |
33 | #include <sys/socket.h> | 33 | #include <sys/socket.h> | |
34 | #include <sys/systm.h> | 34 | #include <sys/systm.h> | |
35 | #include <sys/malloc.h> | 35 | #include <sys/malloc.h> | |
36 | #include <sys/queue.h> | 36 | #include <sys/queue.h> | |
37 | #include <sys/conf.h> | 37 | #include <sys/conf.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | 39 | |||
40 | #include <sys/bus.h> | 40 | #include <sys/bus.h> | |
@@ -508,28 +508,28 @@ ar5008_tx_alloc(struct athn_softc *sc) | @@ -508,28 +508,28 @@ ar5008_tx_alloc(struct athn_softc *sc) | |||
508 | goto fail; | 508 | goto fail; | |
509 | 509 | |||
510 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_seg, 1, | 510 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_seg, 1, | |
511 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | 511 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | |
512 | &nsegs, BUS_DMA_NOWAIT); | 512 | &nsegs, BUS_DMA_NOWAIT); | |
513 | if (error != 0) | 513 | if (error != 0) | |
514 | goto fail; | 514 | goto fail; | |
515 | 515 | |||
516 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_seg, 1, size, | 516 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_seg, 1, size, | |
517 | (void **)&sc->sc_descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | 517 | (void **)&sc->sc_descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | |
518 | if (error != 0) | 518 | if (error != 0) | |
519 | goto fail; | 519 | goto fail; | |
520 | 520 | |||
521 | error = bus_dmamap_load_raw(sc->sc_dmat, sc->sc_map, &sc->sc_seg, 1, size, | 521 | error = bus_dmamap_load(sc->sc_dmat, sc->sc_map, sc->sc_descs, | |
522 | BUS_DMA_NOWAIT); | 522 | size, NULL, BUS_DMA_NOWAIT); | |
523 | if (error != 0) | 523 | if (error != 0) | |
524 | goto fail; | 524 | goto fail; | |
525 | 525 | |||
526 | SIMPLEQ_INIT(&sc->sc_txbufs); | 526 | SIMPLEQ_INIT(&sc->sc_txbufs); | |
527 | for (i = 0; i < ATHN_NTXBUFS; i++) { | 527 | for (i = 0; i < ATHN_NTXBUFS; i++) { | |
528 | bf = &sc->sc_txpool[i]; | 528 | bf = &sc->sc_txpool[i]; | |
529 | 529 | |||
530 | error = bus_dmamap_create(sc->sc_dmat, ATHN_TXBUFSZ, | 530 | error = bus_dmamap_create(sc->sc_dmat, ATHN_TXBUFSZ, | |
531 | AR5008_MAX_SCATTER, ATHN_TXBUFSZ, 0, BUS_DMA_NOWAIT, | 531 | AR5008_MAX_SCATTER, ATHN_TXBUFSZ, 0, BUS_DMA_NOWAIT, | |
532 | &bf->bf_map); | 532 | &bf->bf_map); | |
533 | if (error != 0) { | 533 | if (error != 0) { | |
534 | aprint_error_dev(sc->sc_dev, | 534 | aprint_error_dev(sc->sc_dev, | |
535 | "could not create Tx buf DMA map\n"); | 535 | "could not create Tx buf DMA map\n"); | |
@@ -596,28 +596,28 @@ ar5008_rx_alloc(struct athn_softc *sc) | @@ -596,28 +596,28 @@ ar5008_rx_alloc(struct athn_softc *sc) | |||
596 | goto fail; | 596 | goto fail; | |
597 | 597 | |||
598 | error = bus_dmamem_alloc(sc->sc_dmat, size, 0, 0, &rxq->seg, 1, | 598 | error = bus_dmamem_alloc(sc->sc_dmat, size, 0, 0, &rxq->seg, 1, | |
599 | // &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | 599 | // &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | |
600 | &nsegs, BUS_DMA_NOWAIT); | 600 | &nsegs, BUS_DMA_NOWAIT); | |
601 | if (error != 0) | 601 | if (error != 0) | |
602 | goto fail; | 602 | goto fail; | |
603 | 603 | |||
604 | error = bus_dmamem_map(sc->sc_dmat, &rxq->seg, 1, size, | 604 | error = bus_dmamem_map(sc->sc_dmat, &rxq->seg, 1, size, | |
605 | (void **)&rxq->descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | 605 | (void **)&rxq->descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | |
606 | if (error != 0) | 606 | if (error != 0) | |
607 | goto fail; | 607 | goto fail; | |
608 | 608 | |||
609 | error = bus_dmamap_load_raw(sc->sc_dmat, rxq->map, &rxq->seg, 1, | 609 | error = bus_dmamap_load(sc->sc_dmat, rxq->map, &rxq->descs, | |
610 | size, BUS_DMA_NOWAIT); | 610 | size, NULL, BUS_DMA_NOWAIT); | |
611 | if (error != 0) | 611 | if (error != 0) | |
612 | goto fail; | 612 | goto fail; | |
613 | 613 | |||
614 | for (i = 0; i < ATHN_NRXBUFS; i++) { | 614 | for (i = 0; i < ATHN_NRXBUFS; i++) { | |
615 | bf = &rxq->bf[i]; | 615 | bf = &rxq->bf[i]; | |
616 | ds = &((struct ar_rx_desc *)rxq->descs)[i]; | 616 | ds = &((struct ar_rx_desc *)rxq->descs)[i]; | |
617 | 617 | |||
618 | error = bus_dmamap_create(sc->sc_dmat, ATHN_RXBUFSZ, 1, | 618 | error = bus_dmamap_create(sc->sc_dmat, ATHN_RXBUFSZ, 1, | |
619 | ATHN_RXBUFSZ, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, | 619 | ATHN_RXBUFSZ, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, | |
620 | &bf->bf_map); | 620 | &bf->bf_map); | |
621 | if (error != 0) { | 621 | if (error != 0) { | |
622 | aprint_error_dev(sc->sc_dev, | 622 | aprint_error_dev(sc->sc_dev, | |
623 | " could not create Rx buf DMA map\n"); | 623 | " could not create Rx buf DMA map\n"); |
--- src/sys/dev/ic/arn9003.c 2014/02/23 15:29:12 1.6
+++ src/sys/dev/ic/arn9003.c 2015/05/24 17:08:50 1.7
@@ -1,40 +1,40 @@ | @@ -1,40 +1,40 @@ | |||
1 | /* $NetBSD: arn9003.c,v 1.6 2014/02/23 15:29:12 christos Exp $ */ | 1 | /* $NetBSD: arn9003.c,v 1.7 2015/05/24 17:08:50 matt Exp $ */ | |
2 | /* $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $ */ | 2 | /* $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | 5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | |
6 | * Copyright (c) 2010 Atheros Communications Inc. | 6 | * Copyright (c) 2010 Atheros Communications Inc. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and/or distribute this software for any | 8 | * Permission to use, copy, modify, and/or 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 | |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
19 | */ | 19 | */ | |
20 | 20 | |||
21 | /* | 21 | /* | |
22 | * Driver for Atheros 802.11a/g/n chipsets. | 22 | * Driver for Atheros 802.11a/g/n chipsets. | |
23 | * Routines for AR9003 family. | 23 | * Routines for AR9003 family. | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include <sys/cdefs.h> | 26 | #include <sys/cdefs.h> | |
27 | __KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.6 2014/02/23 15:29:12 christos Exp $"); | 27 | __KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.7 2015/05/24 17:08:50 matt Exp $"); | |
28 | 28 | |||
29 | #include <sys/param.h> | 29 | #include <sys/param.h> | |
30 | #include <sys/sockio.h> | 30 | #include <sys/sockio.h> | |
31 | #include <sys/mbuf.h> | 31 | #include <sys/mbuf.h> | |
32 | #include <sys/kernel.h> | 32 | #include <sys/kernel.h> | |
33 | #include <sys/socket.h> | 33 | #include <sys/socket.h> | |
34 | #include <sys/systm.h> | 34 | #include <sys/systm.h> | |
35 | #include <sys/malloc.h> | 35 | #include <sys/malloc.h> | |
36 | #include <sys/queue.h> | 36 | #include <sys/queue.h> | |
37 | #include <sys/callout.h> | 37 | #include <sys/callout.h> | |
38 | #include <sys/conf.h> | 38 | #include <sys/conf.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | 40 | |||
@@ -645,54 +645,54 @@ ar9003_tx_alloc(struct athn_softc *sc) | @@ -645,54 +645,54 @@ ar9003_tx_alloc(struct athn_softc *sc) | |||
645 | goto fail; | 645 | goto fail; | |
646 | 646 | |||
647 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_txsseg, 1, | 647 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_txsseg, 1, | |
648 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | 648 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | |
649 | &nsegs, BUS_DMA_NOWAIT); | 649 | &nsegs, BUS_DMA_NOWAIT); | |
650 | if (error != 0) | 650 | if (error != 0) | |
651 | goto fail; | 651 | goto fail; | |
652 | 652 | |||
653 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_txsseg, 1, size, | 653 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_txsseg, 1, size, | |
654 | (void **)&sc->sc_txsring, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | 654 | (void **)&sc->sc_txsring, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | |
655 | if (error != 0) | 655 | if (error != 0) | |
656 | goto fail; | 656 | goto fail; | |
657 | 657 | |||
658 | error = bus_dmamap_load_raw(sc->sc_dmat, sc->sc_txsmap, &sc->sc_txsseg, | 658 | error = bus_dmamap_load(sc->sc_dmat, sc->sc_txsmap, sc->sc_txsring, | |
659 | 1, size, BUS_DMA_NOWAIT | BUS_DMA_READ); | 659 | size, NULL, BUS_DMA_NOWAIT | BUS_DMA_READ); | |
660 | if (error != 0) | 660 | if (error != 0) | |
661 | goto fail; | 661 | goto fail; | |
662 | 662 | |||
663 | /* | 663 | /* | |
664 | * Allocate a pool of Tx descriptors shared between all Tx queues. | 664 | * Allocate a pool of Tx descriptors shared between all Tx queues. | |
665 | */ | 665 | */ | |
666 | size = ATHN_NTXBUFS * sizeof(struct ar_tx_desc); | 666 | size = ATHN_NTXBUFS * sizeof(struct ar_tx_desc); | |
667 | 667 | |||
668 | error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, | 668 | error = bus_dmamap_create(sc->sc_dmat, size, 1, size, 0, | |
669 | BUS_DMA_NOWAIT, &sc->sc_map); | 669 | BUS_DMA_NOWAIT, &sc->sc_map); | |
670 | if (error != 0) | 670 | if (error != 0) | |
671 | goto fail; | 671 | goto fail; | |
672 | 672 | |||
673 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_seg, 1, | 673 | error = bus_dmamem_alloc(sc->sc_dmat, size, 4, 0, &sc->sc_seg, 1, | |
674 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | 674 | // XXX &nsegs, BUS_DMA_NOWAIT | BUS_DMA_ZERO); | |
675 | &nsegs, BUS_DMA_NOWAIT); | 675 | &nsegs, BUS_DMA_NOWAIT); | |
676 | if (error != 0) | 676 | if (error != 0) | |
677 | goto fail; | 677 | goto fail; | |
678 | 678 | |||
679 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_seg, 1, size, | 679 | error = bus_dmamem_map(sc->sc_dmat, &sc->sc_seg, 1, size, | |
680 | (void **)&sc->sc_descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | 680 | (void **)&sc->sc_descs, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); | |
681 | if (error != 0) | 681 | if (error != 0) | |
682 | goto fail; | 682 | goto fail; | |
683 | 683 | |||
684 | error = bus_dmamap_load_raw(sc->sc_dmat, sc->sc_map, &sc->sc_seg, 1, size, | 684 | error = bus_dmamap_load(sc->sc_dmat, sc->sc_map, sc->sc_descs, size, | |
685 | BUS_DMA_NOWAIT | BUS_DMA_WRITE); | 685 | NULL, BUS_DMA_NOWAIT | BUS_DMA_WRITE); | |
686 | if (error != 0) | 686 | if (error != 0) | |
687 | goto fail; | 687 | goto fail; | |
688 | 688 | |||
689 | SIMPLEQ_INIT(&sc->sc_txbufs); | 689 | SIMPLEQ_INIT(&sc->sc_txbufs); | |
690 | for (i = 0; i < ATHN_NTXBUFS; i++) { | 690 | for (i = 0; i < ATHN_NTXBUFS; i++) { | |
691 | bf = &sc->sc_txpool[i]; | 691 | bf = &sc->sc_txpool[i]; | |
692 | 692 | |||
693 | error = bus_dmamap_create(sc->sc_dmat, ATHN_TXBUFSZ, | 693 | error = bus_dmamap_create(sc->sc_dmat, ATHN_TXBUFSZ, | |
694 | AR9003_MAX_SCATTER, ATHN_TXBUFSZ, 0, BUS_DMA_NOWAIT, | 694 | AR9003_MAX_SCATTER, ATHN_TXBUFSZ, 0, BUS_DMA_NOWAIT, | |
695 | &bf->bf_map); | 695 | &bf->bf_map); | |
696 | if (error != 0) { | 696 | if (error != 0) { | |
697 | aprint_error_dev(sc->sc_dev, | 697 | aprint_error_dev(sc->sc_dev, | |
698 | "could not create Tx buf DMA map\n"); | 698 | "could not create Tx buf DMA map\n"); |