summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-01-15 19:26:17 +0000
committerscottl <scottl@FreeBSD.org>2005-01-15 19:26:17 +0000
commit92bae70f8cbfbfad50b70e4c36914c9baf5682cb (patch)
tree50e5c75e1fccf2675de91432d93cd3b094c58121 /sys
parent072c5193867a33c12c0ce1a85cc9afe2b0dfa8b6 (diff)
downloadFreeBSD-src-92bae70f8cbfbfad50b70e4c36914c9baf5682cb.zip
FreeBSD-src-92bae70f8cbfbfad50b70e4c36914c9baf5682cb.tar.gz
Add bus_dmamap_load_mbuf_sg() to ia64
Diffstat (limited to 'sys')
-rw-r--r--sys/ia64/ia64/busdma_machdep.c45
-rw-r--r--sys/ia64/include/bus.h2
2 files changed, 41 insertions, 6 deletions
diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c
index 32d7947..5cd539d 100644
--- a/sys/ia64/ia64/busdma_machdep.c
+++ b/sys/ia64/ia64/busdma_machdep.c
@@ -498,10 +498,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
struct thread *td,
int flags,
bus_addr_t *lastaddrp,
+ bus_dma_segment_t *segs;
int *segp,
int first)
{
- bus_dma_segment_t *segs;
bus_size_t sgsize;
bus_addr_t curaddr, lastaddr, baddr, bmask;
vm_offset_t vaddr;
@@ -510,8 +510,6 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
int seg;
pmap_t pmap;
- segs = dmat->segments;
-
if (map == NULL)
map = &nobounce_dmamap;
@@ -652,7 +650,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
}
error = _bus_dmamap_load_buffer(dmat, map, buf, buflen, NULL, flags,
- &lastaddr, &nsegs, 1);
+ &lastaddr, dmat->segments, &nsegs, 1);
if (error == EINPROGRESS)
return (error);
@@ -691,7 +689,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
error = _bus_dmamap_load_buffer(dmat, map,
m->m_data, m->m_len,
NULL, flags, &lastaddr,
- &nsegs, first);
+ dmat->segments, &nsegs, first);
first = 0;
}
}
@@ -709,6 +707,40 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
return (error);
}
+int
+bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct mbuf *m0, bus_dma_segment_t *segs,
+ int *nsegs, int flags)
+{
+ int nsegs, error;
+
+ M_ASSERTPKTHDR(m0);
+
+ flags |= BUS_DMA_NOWAIT;
+ nsegs = 0;
+ error = 0;
+ if (m0->m_pkthdr.len <= dmat->maxsize) {
+ int first = 1;
+ bus_addr_t lastaddr = 0;
+ struct mbuf *m;
+
+ for (m = m0; m != NULL && error == 0; m = m->m_next) {
+ if (m->m_len > 0) {
+ error = _bus_dmamap_load_buffer(dmat, map,
+ m->m_data, m->m_len,
+ NULL, flags, &lastaddr,
+ segs, nsegs, first);
+ first = 0;
+ }
+ }
+ ++*nsegs;
+ } else {
+ error = EINVAL;
+ }
+
+ return (error);
+}
+
/*
* Like _bus_dmamap_load(), but for uios.
*/
@@ -748,7 +780,8 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map,
if (minlen > 0) {
error = _bus_dmamap_load_buffer(dmat, map, addr,
- minlen, td, flags, &lastaddr, &nsegs, first);
+ minlen, td, flags, &lastaddr, dmat->segments,
+ &nsegs, first);
first = 0;
resid -= minlen;
diff --git a/sys/ia64/include/bus.h b/sys/ia64/include/bus.h
index eceedd6..0f0f40c 100644
--- a/sys/ia64/include/bus.h
+++ b/sys/ia64/include/bus.h
@@ -1010,6 +1010,8 @@ typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int,
int bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,
struct mbuf *mbuf, bus_dmamap_callback2_t *callback, void *callback_arg,
int flags);
+int bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
+ struct mbuf *mbuf, bus_dma_segment_t *segs, int *nsegs, int flags);
/*
* Like bus_dmamap_load but for uios. Note the use of the
OpenPOWER on IntegriCloud