Module Name: src Committed By: matt Date: Thu Apr 10 02:44:05 UTC 2014
Modified Files: src/sys/arch/arm/arm32: bus_dma.c Log Message: Deal with non-4KB pages properly. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/arm/arm32/bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/arm32/bus_dma.c diff -u src/sys/arch/arm/arm32/bus_dma.c:1.85 src/sys/arch/arm/arm32/bus_dma.c:1.86 --- src/sys/arch/arm/arm32/bus_dma.c:1.85 Sun Apr 6 09:53:59 2014 +++ src/sys/arch/arm/arm32/bus_dma.c Thu Apr 10 02:44:05 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.85 2014/04/06 09:53:59 skrll Exp $ */ +/* $NetBSD: bus_dma.c,v 1.86 2014/04/10 02:44:05 matt Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include "opt_arm_bus_space.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.85 2014/04/06 09:53:59 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.86 2014/04/10 02:44:05 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -766,7 +766,8 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_ static void _bus_dmamap_sync_segment(vaddr_t va, paddr_t pa, vsize_t len, int ops, bool readonly_p) { - KASSERT((va & PAGE_MASK) == (pa & PAGE_MASK)); + KASSERTMSG((va & PAGE_MASK) == (pa & PAGE_MASK), + "va %#lx pa %#lx", va, pa); #if 0 printf("sync_segment: va=%#lx pa=%#lx len=%#lx ops=%#x ro=%d\n", va, pa, len, ops, readonly_p); @@ -1502,8 +1503,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, (vaddr & L2_L_OFFSET); coherent = (pte & L2_L_CACHE_MASK) == 0; } else { - curaddr = (pte & L2_S_FRAME) | - (vaddr & L2_S_OFFSET); + curaddr = (pte & ~PAGE_MASK) | + (vaddr & PAGE_MASK); coherent = (pte & L2_S_CACHE_MASK) == 0; } } @@ -1511,6 +1512,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, (void) pmap_extract(pmap, vaddr, &curaddr); coherent = false; } + KASSERTMSG((vaddr & PAGE_MASK) == (curaddr & PAGE_MASK), + "va %#lx curaddr %#lx", vaddr, curaddr); /* * Compute the segment size, and adjust counts.