bus_dma.9 (239906) | bus_dma.9 (253434) |
---|---|
1.\" Copyright (c) 2002, 2003 Hiten M. Pandya. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions, and the following disclaimer, --- 43 unchanged lines hidden (view full) --- 52.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58.\" POSSIBILITY OF SUCH DAMAGE. 59.\" | 1.\" Copyright (c) 2002, 2003 Hiten M. Pandya. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions, and the following disclaimer, --- 43 unchanged lines hidden (view full) --- 52.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 53.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 54.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 55.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 56.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 57.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 58.\" POSSIBILITY OF SUCH DAMAGE. 59.\" |
60.\" $FreeBSD: head/share/man/man9/bus_dma.9 239906 2012-08-30 14:44:30Z jhb $ | 60.\" $FreeBSD: head/share/man/man9/bus_dma.9 253434 2013-07-17 19:41:16Z jimharris $ |
61.\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ 62.\" | 61.\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ 62.\" |
63.Dd May 12, 2009 | 63.Dd July 17, 2013 |
64.Dt BUS_DMA 9 65.Os 66.Sh NAME 67.Nm bus_dma , 68.Nm bus_dma_tag_create , 69.Nm bus_dma_tag_destroy , 70.Nm bus_dmamap_create , 71.Nm bus_dmamap_destroy , 72.Nm bus_dmamap_load , | 64.Dt BUS_DMA 9 65.Os 66.Sh NAME 67.Nm bus_dma , 68.Nm bus_dma_tag_create , 69.Nm bus_dma_tag_destroy , 70.Nm bus_dmamap_create , 71.Nm bus_dmamap_destroy , 72.Nm bus_dmamap_load , |
73.Nm bus_dmamap_load_bio , 74.Nm bus_dmamap_load_ccb , |
|
73.Nm bus_dmamap_load_mbuf , 74.Nm bus_dmamap_load_mbuf_sg , 75.Nm bus_dmamap_load_uio , 76.Nm bus_dmamap_unload , 77.Nm bus_dmamap_sync , 78.Nm bus_dmamem_alloc , 79.Nm bus_dmamem_free 80.Nd Bus and Machine Independent DMA Mapping Interface --- 11 unchanged lines hidden (view full) --- 92.Fn bus_dmamap_create "bus_dma_tag_t dmat" "int flags" "bus_dmamap_t *mapp" 93.Ft int 94.Fn bus_dmamap_destroy "bus_dma_tag_t dmat" "bus_dmamap_t map" 95.Ft int 96.Fn bus_dmamap_load "bus_dma_tag_t dmat" "bus_dmamap_t map" "void *buf" \ 97"bus_size_t buflen" "bus_dmamap_callback_t *callback" "void *callback_arg" \ 98"int flags" 99.Ft int | 75.Nm bus_dmamap_load_mbuf , 76.Nm bus_dmamap_load_mbuf_sg , 77.Nm bus_dmamap_load_uio , 78.Nm bus_dmamap_unload , 79.Nm bus_dmamap_sync , 80.Nm bus_dmamem_alloc , 81.Nm bus_dmamem_free 82.Nd Bus and Machine Independent DMA Mapping Interface --- 11 unchanged lines hidden (view full) --- 94.Fn bus_dmamap_create "bus_dma_tag_t dmat" "int flags" "bus_dmamap_t *mapp" 95.Ft int 96.Fn bus_dmamap_destroy "bus_dma_tag_t dmat" "bus_dmamap_t map" 97.Ft int 98.Fn bus_dmamap_load "bus_dma_tag_t dmat" "bus_dmamap_t map" "void *buf" \ 99"bus_size_t buflen" "bus_dmamap_callback_t *callback" "void *callback_arg" \ 100"int flags" 101.Ft int |
102.Fn bus_dmamap_load_bio "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 103"struct bio *bio" "bus_dmamap_callback_t *callback" "void *callback_arg" \ 104"int flags" 105.Ft int 106.Fn bus_dmamap_load_ccb "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 107"union ccb *ccb" "bus_dmamap_callback_t *callback" "void *callback_arg" \ 108"int flags" 109.Ft int |
|
100.Fn bus_dmamap_load_mbuf "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 101"struct mbuf *mbuf" "bus_dmamap_callback2_t *callback" "void *callback_arg" \ 102"int flags" 103.Ft int 104.Fn bus_dmamap_load_mbuf_sg "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 105"struct mbuf *mbuf" "bus_dma_segment_t *segs" "int *nsegs" "int flags" 106.Ft int 107.Fn bus_dmamap_load_uio "bus_dma_tag_t dmat" "bus_dmamap_t map" \ --- 86 unchanged lines hidden (view full) --- 194it should never be assumed that it will be 195.Dv NULL 196in all cases. 197.It Vt bus_dmamap_callback_t 198Client specified callback for receiving mapping information resulting from 199the load of a 200.Vt bus_dmamap_t 201via | 110.Fn bus_dmamap_load_mbuf "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 111"struct mbuf *mbuf" "bus_dmamap_callback2_t *callback" "void *callback_arg" \ 112"int flags" 113.Ft int 114.Fn bus_dmamap_load_mbuf_sg "bus_dma_tag_t dmat" "bus_dmamap_t map" \ 115"struct mbuf *mbuf" "bus_dma_segment_t *segs" "int *nsegs" "int flags" 116.Ft int 117.Fn bus_dmamap_load_uio "bus_dma_tag_t dmat" "bus_dmamap_t map" \ --- 86 unchanged lines hidden (view full) --- 204it should never be assumed that it will be 205.Dv NULL 206in all cases. 207.It Vt bus_dmamap_callback_t 208Client specified callback for receiving mapping information resulting from 209the load of a 210.Vt bus_dmamap_t 211via |
202.Fn bus_dmamap_load . | 212.Fn bus_dmamap_load , 213.Fn bus_dmamap_load_bio 214or 215.Fn bus_dmamap_load_ccb . |
203Callbacks are of the format: 204.Bl -tag -width indent 205.It Ft void 206.Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \ 207"int nseg" "int error" 208.El 209.Pp 210The --- 408 unchanged lines hidden (view full) --- 619callback argument contains an array of 620.Vt bus_dma_segment_t 621elements describing the mapping. 622This array is only valid during the scope of the callback function. 623.It Er EFBIG 624A mapping could not be achieved within the segment constraints provided 625in the tag even though the requested allocation size was less than maxsize. 626.El | 216Callbacks are of the format: 217.Bl -tag -width indent 218.It Ft void 219.Fn "client_callback" "void *callback_arg" "bus_dma_segment_t *segs" \ 220"int nseg" "int error" 221.El 222.Pp 223The --- 408 unchanged lines hidden (view full) --- 632callback argument contains an array of 633.Vt bus_dma_segment_t 634elements describing the mapping. 635This array is only valid during the scope of the callback function. 636.It Er EFBIG 637A mapping could not be achieved within the segment constraints provided 638in the tag even though the requested allocation size was less than maxsize. 639.El |
640.It Fn bus_dmamap_load_bio "dmat" "map" "bio" "callback" "callback_arg" "flags" 641This is a variation of 642.Fn bus_dmamap_load 643which maps buffers pointed to by 644.Fa bio 645for DMA transfers. 646.Fa bio 647may point to either a mapped or unmapped buffer. 648.It Fn bus_dmamap_load_ccb "dmat" "map" "ccb" "callback" "callback_arg" "flags" 649This is a variation of 650.Fn bus_dmamap_load 651which maps data pointed to by 652.Fa ccb 653for DMA transfers. 654The data for 655.Fa ccb 656may be any of the following types: 657.Bl -tag -width ".Er CAM_DATA_SG_PADDR" 658.It CAM_DATA_VADDR 659The data is a single KVA buffer. 660.It CAM_DATA_PADDR 661The data is a single bus address range. 662.It CAM_DATA_SG 663The data is a scatter/gather list of KVA buffers. 664.It CAM_DATA_SG_PADDR 665The data is a scatter/gather list of bus address ranges. 666.It CAM_DATA_BIO 667The data is contained in a 668.Vt struct bio 669attached to the CCB. 670.El 671.Pp 672.Fn bus_dmamap_load_ccb 673supports the following CCB XPT function codes: 674.Pp 675.Bl -item -offset indent -compact 676.It 677XPT_ATA_IO 678.It 679XPT_CONT_TARGET_IO 680.It 681XPT_SCSI_IO 682.El |
|
627.It Fn bus_dmamap_load_mbuf "dmat" "map" "mbuf" "callback2" "callback_arg" \ 628"flags" 629This is a variation of 630.Fn bus_dmamap_load 631which maps mbuf chains 632for DMA transfers. 633A 634.Vt bus_size_t --- 258 unchanged lines hidden (view full) --- 893functions must always be called with the same lock held that is specified in the 894tag. 895These functions include: 896.Pp 897.Bl -item -offset indent -compact 898.It 899.Fn bus_dmamap_load 900.It | 683.It Fn bus_dmamap_load_mbuf "dmat" "map" "mbuf" "callback2" "callback_arg" \ 684"flags" 685This is a variation of 686.Fn bus_dmamap_load 687which maps mbuf chains 688for DMA transfers. 689A 690.Vt bus_size_t --- 258 unchanged lines hidden (view full) --- 949functions must always be called with the same lock held that is specified in the 950tag. 951These functions include: 952.Pp 953.Bl -item -offset indent -compact 954.It 955.Fn bus_dmamap_load 956.It |
901.Fn bus_dmamap_load_uio | 957.Fn bus_dmamap_load_bio |
902.It | 958.It |
959.Fn bus_dmamap_load_ccb 960.It |
|
903.Fn bus_dmamap_load_mbuf 904.It 905.Fn bus_dmamap_load_mbuf_sg 906.It | 961.Fn bus_dmamap_load_mbuf 962.It 963.Fn bus_dmamap_load_mbuf_sg 964.It |
965.Fn bus_dmamap_load_uio 966.It |
|
907.Fn bus_dmamap_unload 908.It 909.Fn bus_dmamap_sync 910.El 911.Pp 912There is one exception to this rule. 913It is common practice to call some of these functions during driver start-up 914without any locks held. --- 92 unchanged lines hidden --- | 967.Fn bus_dmamap_unload 968.It 969.Fn bus_dmamap_sync 970.El 971.Pp 972There is one exception to this rule. 973It is common practice to call some of these functions during driver start-up 974without any locks held. --- 92 unchanged lines hidden --- |