diff options
author | yongari <yongari@FreeBSD.org> | 2007-05-29 06:30:26 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2007-05-29 06:30:26 +0000 |
commit | f53195d29a8fff7695e0e7ba6e882a43ec827056 (patch) | |
tree | 334f9ee040f34f0db530b0d463e04521ea658fb8 /sys | |
parent | cfa8629c4850a5bd7d8ca034dd43c16a6e542ab2 (diff) | |
download | FreeBSD-src-f53195d29a8fff7695e0e7ba6e882a43ec827056.zip FreeBSD-src-f53195d29a8fff7695e0e7ba6e882a43ec827056.tar.gz |
Honor maxsegsz of less than a page size in a DMA tag. Previously it
used to return PAGE_SIZE without respect to restrictions of a DMA tag.
This affected all of the busdma load functions that use
_bus_dmamap_loader_buffer() as their back-end.
Reviewed by: scottl
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/busdma_machdep.c | 2 | ||||
-rw-r--r-- | sys/arm/arm/busdma_machdep.c | 2 | ||||
-rw-r--r-- | sys/i386/i386/busdma_machdep.c | 2 | ||||
-rw-r--r-- | sys/ia64/ia64/busdma_machdep.c | 2 | ||||
-rw-r--r-- | sys/sparc64/sparc64/bus_machdep.c | 2 | ||||
-rw-r--r-- | sys/sun4v/sun4v/bus_machdep.c | 2 |
6 files changed, 12 insertions, 0 deletions
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index a2b19d6..59495bf 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -649,6 +649,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->maxsegsz) + sgsize = dmat->maxsegsz; if (buflen < sgsize) sgsize = buflen; diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c index f8d2725..b3ee458 100644 --- a/sys/arm/arm/busdma_machdep.c +++ b/sys/arm/arm/busdma_machdep.c @@ -799,6 +799,8 @@ bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t *segs, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->maxsegsz) + sgsize = dmat->maxsegsz; if (buflen < sgsize) sgsize = buflen; diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c index 813e9ca..5d7c9cd 100644 --- a/sys/i386/i386/busdma_machdep.c +++ b/sys/i386/i386/busdma_machdep.c @@ -674,6 +674,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->maxsegsz) + sgsize = dmat->maxsegsz; if (buflen < sgsize) sgsize = buflen; diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c index 34cc252..5ef2e53 100644 --- a/sys/ia64/ia64/busdma_machdep.c +++ b/sys/ia64/ia64/busdma_machdep.c @@ -578,6 +578,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->maxsegsz) + sgsize = dmat->maxsegsz; if (buflen < sgsize) sgsize = buflen; diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c index 165e350..0d1e926 100644 --- a/sys/sparc64/sparc64/bus_machdep.c +++ b/sys/sparc64/sparc64/bus_machdep.c @@ -372,6 +372,8 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t dmat, void *buf, bus_size_t buflen, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->dt_maxsegsz) + sgsize = dmat->dt_maxsegsz; if (buflen < sgsize) sgsize = buflen; diff --git a/sys/sun4v/sun4v/bus_machdep.c b/sys/sun4v/sun4v/bus_machdep.c index 06a7f35..0c76fee 100644 --- a/sys/sun4v/sun4v/bus_machdep.c +++ b/sys/sun4v/sun4v/bus_machdep.c @@ -381,6 +381,8 @@ _nexus_dmamap_load_buffer(bus_dma_tag_t dmat, void *buf, bus_size_t buflen, * Compute the segment size, and adjust counts. */ sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); + if (sgsize > dmat->dt_maxsegsz) + sgsize = dmat->dt_maxsegsz; if (buflen < sgsize) sgsize = buflen; |