isa_dma.c (61994) | isa_dma.c (77081) |
---|---|
1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 | 1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 |
37 * $FreeBSD: head/sys/i386/isa/isa_dma.c 61994 2000-06-23 07:44:33Z msmith $ | 37 * $FreeBSD: head/sys/i386/isa/isa_dma.c 77081 2001-05-23 22:13:58Z alfred $ |
38 */ 39 40/* 41 * code to manage AT bus 42 * 43 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 44 * Fixed uninitialized variable problem and added code to deal 45 * with DMA page boundaries in isa_dmarangecheck(). Fixed word 46 * mode DMA count compution and reorganized DMA setup code in 47 * isa_dmastart() 48 */ 49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/bus.h> 53#include <sys/kernel.h> 54#include <sys/malloc.h> | 38 */ 39 40/* 41 * code to manage AT bus 42 * 43 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 44 * Fixed uninitialized variable problem and added code to deal 45 * with DMA page boundaries in isa_dmarangecheck(). Fixed word 46 * mode DMA count compution and reorganized DMA setup code in 47 * isa_dmastart() 48 */ 49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/bus.h> 53#include <sys/kernel.h> 54#include <sys/malloc.h> |
55#include <sys/lock.h> 56#include <sys/mutex.h> |
|
55#include <sys/module.h> 56#include <vm/vm.h> 57#include <vm/vm_param.h> 58#include <vm/pmap.h> 59#include <i386/isa/isa.h> 60#include <i386/isa/ic/i8237.h> 61#include <isa/isavar.h> 62 --- 184 unchanged lines hidden (view full) --- 247 248 /* copy bounce buffer on write */ 249 if (!(flags & ISADMA_READ)) 250 bcopy(addr, newaddr, nbytes); 251 addr = newaddr; 252 } 253 254 /* translate to physical */ | 57#include <sys/module.h> 58#include <vm/vm.h> 59#include <vm/vm_param.h> 60#include <vm/pmap.h> 61#include <i386/isa/isa.h> 62#include <i386/isa/ic/i8237.h> 63#include <isa/isavar.h> 64 --- 184 unchanged lines hidden (view full) --- 249 250 /* copy bounce buffer on write */ 251 if (!(flags & ISADMA_READ)) 252 bcopy(addr, newaddr, nbytes); 253 addr = newaddr; 254 } 255 256 /* translate to physical */ |
257 mtx_lock(&vm_mtx); /* 258 * XXX: need to hold for longer period to 259 * ensure that mappings don't change 260 */ |
|
255 phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr); | 261 phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr); |
262 mtx_unlock(&vm_mtx); |
|
256 257 if (flags & ISADMA_RAW) { 258 dma_auto_mode |= (1 << chan); 259 } else { 260 dma_auto_mode &= ~(1 << chan); 261 } 262 263 if ((chan & 4) == 0) { --- 104 unchanged lines hidden (view full) --- 368static int 369isa_dmarangecheck(caddr_t va, u_int length, int chan) 370{ 371 vm_offset_t phys, priorpage = 0, endva; 372 u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); 373 374 endva = (vm_offset_t)round_page((vm_offset_t)va + length); 375 for (; va < (caddr_t) endva ; va += PAGE_SIZE) { | 263 264 if (flags & ISADMA_RAW) { 265 dma_auto_mode |= (1 << chan); 266 } else { 267 dma_auto_mode &= ~(1 << chan); 268 } 269 270 if ((chan & 4) == 0) { --- 104 unchanged lines hidden (view full) --- 375static int 376isa_dmarangecheck(caddr_t va, u_int length, int chan) 377{ 378 vm_offset_t phys, priorpage = 0, endva; 379 u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); 380 381 endva = (vm_offset_t)round_page((vm_offset_t)va + length); 382 for (; va < (caddr_t) endva ; va += PAGE_SIZE) { |
383 mtx_lock(&vm_mtx); |
|
376 phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); | 384 phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); |
385 mtx_unlock(&vm_mtx); |
|
377#define ISARAM_END RAM_END 378 if (phys == 0) 379 panic("isa_dmacheck: no physical page present"); 380 if (phys >= ISARAM_END) 381 return (1); 382 if (priorpage) { 383 if (priorpage + PAGE_SIZE != phys) 384 return (1); --- 160 unchanged lines hidden --- | 386#define ISARAM_END RAM_END 387 if (phys == 0) 388 panic("isa_dmacheck: no physical page present"); 389 if (phys >= ISARAM_END) 390 return (1); 391 if (priorpage) { 392 if (priorpage + PAGE_SIZE != phys) 393 return (1); --- 160 unchanged lines hidden --- |