Deleted Added
full compact
cbus_dma.c (79008) cbus_dma.c (79224)
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/pc98/cbus/cbus_dma.c 79008 2001-06-30 05:29:11Z imp $
37 * $FreeBSD: head/sys/pc98/cbus/cbus_dma.c 79224 2001-07-04 16:20:28Z dillon $
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

--- 198 unchanged lines hidden (view full) ---

244 */
245void
246isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
247{
248 vm_offset_t phys;
249 int waport;
250 caddr_t newaddr;
251
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

--- 198 unchanged lines hidden (view full) ---

244 */
245void
246isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
247{
248 vm_offset_t phys;
249 int waport;
250 caddr_t newaddr;
251
252 GIANT_REQUIRED;
253
252#ifdef DIAGNOSTIC
253 if (chan & ~VALID_DMA_MASK)
254 panic("isa_dmastart: channel out of range");
255
256 if ((chan < 4 && nbytes > (1<<16))
257 || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
258 panic("isa_dmastart: impossible request");
259

--- 22 unchanged lines hidden (view full) ---

282
283 /* copy bounce buffer on write */
284 if (!(flags & ISADMA_READ))
285 bcopy(addr, newaddr, nbytes);
286 addr = newaddr;
287 }
288
289 /* translate to physical */
254#ifdef DIAGNOSTIC
255 if (chan & ~VALID_DMA_MASK)
256 panic("isa_dmastart: channel out of range");
257
258 if ((chan < 4 && nbytes > (1<<16))
259 || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
260 panic("isa_dmastart: impossible request");
261

--- 22 unchanged lines hidden (view full) ---

284
285 /* copy bounce buffer on write */
286 if (!(flags & ISADMA_READ))
287 bcopy(addr, newaddr, nbytes);
288 addr = newaddr;
289 }
290
291 /* translate to physical */
290 mtx_lock(&vm_mtx); /*
291 * XXX: need to hold for longer period to
292 * ensure that mappings don't change
293 */
294 phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
292 phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
295 mtx_unlock(&vm_mtx);
296
297 if (flags & ISADMA_RAW) {
298 dma_auto_mode |= (1 << chan);
299 } else {
300 dma_auto_mode &= ~(1 << chan);
301 }
302
303#ifdef PC98

--- 129 unchanged lines hidden (view full) ---

433 */
434
435static int
436isa_dmarangecheck(caddr_t va, u_int length, int chan)
437{
438 vm_offset_t phys, priorpage = 0, endva;
439 u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
440
293
294 if (flags & ISADMA_RAW) {
295 dma_auto_mode |= (1 << chan);
296 } else {
297 dma_auto_mode &= ~(1 << chan);
298 }
299
300#ifdef PC98

--- 129 unchanged lines hidden (view full) ---

430 */
431
432static int
433isa_dmarangecheck(caddr_t va, u_int length, int chan)
434{
435 vm_offset_t phys, priorpage = 0, endva;
436 u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
437
438 GIANT_REQUIRED;
439
441 endva = (vm_offset_t)round_page((vm_offset_t)va + length);
442 for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
440 endva = (vm_offset_t)round_page((vm_offset_t)va + length);
441 for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
443 mtx_lock(&vm_mtx);
444 phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
442 phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
445 mtx_unlock(&vm_mtx);
446#ifdef EPSON_BOUNCEDMA
447#define ISARAM_END 0xf00000
448#else
449#define ISARAM_END RAM_END
450#endif
451 if (phys == 0)
452 panic("isa_dmacheck: no physical page present");
453 if (phys >= ISARAM_END)

--- 171 unchanged lines hidden ---
443#ifdef EPSON_BOUNCEDMA
444#define ISARAM_END 0xf00000
445#else
446#define ISARAM_END RAM_END
447#endif
448 if (phys == 0)
449 panic("isa_dmacheck: no physical page present");
450 if (phys >= ISARAM_END)

--- 171 unchanged lines hidden ---