Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Dec 2009 08:16:12 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r200289 - in stable/7/sys: amd64/amd64 i386/i386
Message-ID:  <200912090816.nB98GCuI016408@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Wed Dec  9 08:16:12 2009
New Revision: 200289
URL: http://svn.freebsd.org/changeset/base/200289

Log:
  MFC: fix alignment calculation for situations where alignment needs to be
  exactly on page boundary or less.

Modified:
  stable/7/sys/amd64/amd64/busdma_machdep.c
  stable/7/sys/i386/i386/busdma_machdep.c

Modified: stable/7/sys/amd64/amd64/busdma_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/busdma_machdep.c	Wed Dec  9 08:09:25 2009	(r200288)
+++ stable/7/sys/amd64/amd64/busdma_machdep.c	Wed Dec  9 08:16:12 2009	(r200289)
@@ -597,7 +597,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 		 * 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) {
@@ -607,7 +607,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 				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);
 	}

Modified: stable/7/sys/i386/i386/busdma_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/busdma_machdep.c	Wed Dec  9 08:09:25 2009	(r200288)
+++ stable/7/sys/i386/i386/busdma_machdep.c	Wed Dec  9 08:16:12 2009	(r200289)
@@ -584,7 +584,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
 		 * 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) {
@@ -596,7 +596,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
 			    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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912090816.nB98GCuI016408>