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 (long a ago)
Approved by:	re (hrs)
This commit is contained in:
Pyun YongHyeon 2007-06-22 03:54:53 +00:00
parent 00a304487f
commit 485aebfc80

View File

@ -418,6 +418,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;