1 /**************************************************************************
3 * Copyright (c) 2007,2009 Kip Macy kmacy@freebsd.org
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
12 * 2. The name of Kip Macy nor the names of other
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
30 ***************************************************************************/
34 #include <machine/bus.h>
36 #define M_DDP 0x200000 /* direct data placement mbuf */
37 #define EXT_PHYS 10 /* physical/bus address */
39 #define m_cur_offset m_ext.ext_size /* override to provide ddp offset */
40 #define m_seq m_pkthdr.csum_data /* stored sequence */
41 #define m_ddp_gl m_ext.ext_buf /* ddp list */
42 #define m_ddp_flags m_pkthdr.csum_flags /* ddp flags */
43 #define m_ulp_mode m_pkthdr.tso_segsz /* upper level protocol */
46 busdma_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map,
47 struct mbuf *m, bus_dma_segment_t *seg)
49 #if defined(__i386__) || defined(__amd64__)
50 seg->ds_addr = pmap_kextract(mtod(m, vm_offset_t));
51 seg->ds_len = m->m_len;
55 bus_dmamap_load_mbuf_sg(tag, map, m, seg, &nsegstmp, 0);
59 int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map,
60 struct mbuf **m, bus_dma_segment_t *segs, int *nsegs);
61 void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map,
62 struct mbuf *m, bus_dma_segment_t *segs, int *nsegs);
64 busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count)
67 segs->ds_addr = pmap_kextract((vm_offset_t)vsegs->ds_addr);
68 segs->ds_len = vsegs->ds_len;
76 m_freem_list(struct mbuf *m)