From owner-svn-src-head@FreeBSD.ORG Tue Sep 7 05:39:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B82EA10656AA; Tue, 7 Sep 2010 05:39:24 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D3108FC19; Tue, 7 Sep 2010 05:39:24 +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 o875dOQU082903; Tue, 7 Sep 2010 05:39:24 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o875dO6A082901; Tue, 7 Sep 2010 05:39:24 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009070539.o875dO6A082901@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 7 Sep 2010 05:39:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212283 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 05:39:24 -0000 Author: jchandra Date: Tue Sep 7 05:39:24 2010 New Revision: 212283 URL: http://svn.freebsd.org/changeset/base/212283 Log: On boards with >512MB memory, the result of vtophys cannot be converted to KSEG1 address - use pmap_mapdev/pmap_unmapdev instead. Remove unused variable maxphys. Modified: head/sys/mips/mips/busdma_machdep.c Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Tue Sep 7 02:51:11 2010 (r212282) +++ head/sys/mips/mips/busdma_machdep.c Tue Sep 7 05:39:24 2010 (r212283) @@ -425,7 +425,6 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) #endif if (dmat != NULL) { - if (dmat->map_count != 0) return (EBUSY); @@ -602,20 +601,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * and handles multi-seg allocations. Nobody is doing * multi-seg allocations yet though. */ - vm_paddr_t maxphys; - if((uint32_t)dmat->lowaddr >= MIPS_KSEG0_LARGEST_PHYS) { - /* Note in the else case I just put in what was already - * being passed in dmat->lowaddr. I am not sure - * how this would have worked. Since lowaddr is in the - * max address postion. I would have thought that the - * caller would have wanted dmat->highaddr. That is - * presuming they are asking for physical addresses - * which is what contigmalloc takes. - RRS - */ - maxphys = MIPS_KSEG0_LARGEST_PHYS - 1; - } else { - maxphys = dmat->lowaddr; - } *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); @@ -633,7 +618,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi void *tmpaddr = (void *)*vaddr; if (tmpaddr) { - tmpaddr = (void *)MIPS_PHYS_TO_KSEG1(vtophys(tmpaddr)); + tmpaddr = (void *)pmap_mapdev(vtophys(tmpaddr), + dmat->maxsize); newmap->origbuffer = *vaddr; newmap->allocbuffer = tmpaddr; mips_dcache_wbinv_range((vm_offset_t)*vaddr, @@ -660,6 +646,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void vaddr = map->origbuffer; } + if (map->flags & DMAMAP_UNCACHEABLE) + pmap_unmapdev((vm_offset_t)map->allocbuffer, dmat->maxsize); if (map->flags & DMAMAP_MALLOCUSED) free(vaddr, M_DEVBUF); else @@ -1360,7 +1348,7 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u } bpage->busaddr = pmap_kextract(bpage->vaddr); bpage->vaddr_nocache = - (vm_offset_t)MIPS_PHYS_TO_KSEG1(bpage->busaddr); + (vm_offset_t)pmap_mapdev(bpage->busaddr, PAGE_SIZE); mtx_lock(&bounce_lock); STAILQ_INSERT_TAIL(&bz->bounce_page_list, bpage, links); total_bpages++;