diff options
author | scottl <scottl@FreeBSD.org> | 2008-02-12 16:24:30 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2008-02-12 16:24:30 +0000 |
commit | db8258708bf8a571518d133c84f7d5e0bbea8368 (patch) | |
tree | f8c7bedfa0ddc2b0964999befbe86256947ea937 /sys/amd64 | |
parent | 266bdb9965ed5920c58213cfd9527588f65f47a9 (diff) | |
download | FreeBSD-src-db8258708bf8a571518d133c84f7d5e0bbea8368.zip FreeBSD-src-db8258708bf8a571518d133c84f7d5e0bbea8368.tar.gz |
If busdma is being used to realign dynamic buffers and the alignment is set to
PAGE_SIZE or less, the bounce page counting logic was flawed and wouldn't
reserve any pages. Adjust to be correct. Review of other architectures is
forthcoming.
Submitted by: Joseph Golio
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/busdma_machdep.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index 321c49e..c9475d5 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -598,14 +598,14 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat, * Count the number of bounce pages * needed in order to complete this transfer */ - vaddr = trunc_page((vm_offset_t)buf); + vaddr = (vm_offset_t)buf; vendaddr = (vm_offset_t)buf + buflen; while (vaddr < vendaddr) { paddr = pmap_kextract(vaddr); if (run_filter(dmat, paddr) != 0) map->pagesneeded++; - vaddr += PAGE_SIZE; + vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)); } CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); } |