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
This commit is contained in:
Pyun YongHyeon 2007-05-29 06:30:26 +00:00
parent 95f0e983b6
commit 590f73f72e
6 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;