diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-05 22:09:56 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-05 22:09:56 +0000 |
commit | 9b39be33bae986167197ca20baca0006463a644d (patch) | |
tree | 5d74b78b4acc74d1833c9b93594f39e772d999b1 /sys | |
parent | 52130e0b40287687974b2425848640fa2b335d6a (diff) |
In dma_cachectl(), when flushing line by line, only invoke pmap_extract()
once per page and cache the result.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/m88k/m88k/m8820x_machdep.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c index 87ceede118a..e03d0d42b36 100644 --- a/sys/arch/m88k/m88k/m8820x_machdep.c +++ b/sys/arch/m88k/m88k/m8820x_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x_machdep.c,v 1.33 2007/11/24 11:12:55 miod Exp $ */ +/* $OpenBSD: m8820x_machdep.c,v 1.34 2007/12/05 22:09:55 miod Exp $ */ /* * Copyright (c) 2004, 2007, Miodrag Vallat. * @@ -734,32 +734,36 @@ m8820x_dma_cachectl(pmap_t pmap, vaddr_t _va, vsize_t _size, int op) disable_interrupt(psr); CMMU_LOCK; + pa = 0; while (size != 0) { count = (va & PAGE_MASK) == 0 && size >= PAGE_SIZE ? PAGE_SIZE : MC88200_CACHE_LINE; - if (pmap_extract(pmap, va, &pa) != FALSE) { + if ((va & PAGE_MASK) == 0 || pa == 0) { + if (pmap_extract(pmap, va, &pa) == FALSE) + panic("pmap_extract(%p, %p) failed", pmap, va); + } + #ifdef MULTIPROCESSOR - /* writeback on a single cpu... */ - (*flusher)(ci->ci_cpuid, pa, count); - - /* invalidate on all... */ - if (flusher != m8820x_cmmu_sync_cache) { - for (cpu = 0; cpu < MAX_CPUS; cpu++) { - if (!ISSET(m88k_cpus[cpu].ci_flags, - CIF_ALIVE)) - continue; - if (cpu == ci->ci_cpuid) - continue; - m8820x_cmmu_inval_cache(cpu, pa, count); - } + /* writeback on a single cpu... */ + (*flusher)(ci->ci_cpuid, pa, count); + + /* invalidate on all... */ + if (flusher != m8820x_cmmu_sync_cache) { + for (cpu = 0; cpu < MAX_CPUS; cpu++) { + if (!ISSET(m88k_cpus[cpu].ci_flags, CIF_ALIVE)) + continue; + if (cpu == ci->ci_cpuid) + continue; + m8820x_cmmu_inval_cache(cpu, pa, count); } + } #else /* MULTIPROCESSOR */ - (*flusher)(cpu, pa, count); + (*flusher)(cpu, pa, count); #endif /* MULTIPROCESSOR */ - } va += count; + pa += count; size -= count; } |