From owner-svn-src-stable-7@FreeBSD.ORG Wed Dec 9 08:16:12 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8302C106566B; Wed, 9 Dec 2009 08:16:12 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5783F8FC0C; Wed, 9 Dec 2009 08:16:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB98GC9b016411; Wed, 9 Dec 2009 08:16:12 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB98GCuI016408; Wed, 9 Dec 2009 08:16:12 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200912090816.nB98GCuI016408@svn.freebsd.org> From: Scott Long Date: Wed, 9 Dec 2009 08:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200289 - in stable/7/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Dec 2009 08:16:12 -0000 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); }