Deleted Added
full compact
isa_dma.c (135262) isa_dma.c (141391)
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

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

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91
33 */
34
35#include <sys/cdefs.h>
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

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

28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * from: @(#)isa.c 7.2 (Berkeley) 5/13/91
33 */
34
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: head/sys/i386/isa/isa_dma.c 135262 2004-09-15 12:09:50Z phk $");
36__FBSDID("$FreeBSD: head/sys/i386/isa/isa_dma.c 141391 2005-02-06 13:46:39Z phk $");
37
38/*
39 * code to manage AT bus
40 *
41 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
42 * Fixed uninitialized variable problem and added code to deal
43 * with DMA page boundaries in isa_dmarangecheck(). Fixed word
44 * mode DMA count compution and reorganized DMA setup code in

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

56#include <sys/module.h>
57#include <vm/vm.h>
58#include <vm/vm_param.h>
59#include <vm/pmap.h>
60#include <i386/isa/isa.h>
61#include <dev/ic/i8237.h>
62#include <isa/isavar.h>
63
37
38/*
39 * code to manage AT bus
40 *
41 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
42 * Fixed uninitialized variable problem and added code to deal
43 * with DMA page boundaries in isa_dmarangecheck(). Fixed word
44 * mode DMA count compution and reorganized DMA setup code in

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

56#include <sys/module.h>
57#include <vm/vm.h>
58#include <vm/vm_param.h>
59#include <vm/pmap.h>
60#include <i386/isa/isa.h>
61#include <dev/ic/i8237.h>
62#include <isa/isavar.h>
63
64/*
65** Register definitions for DMA controller 1 (channels 0..3):
66*/
67#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */
68#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
69#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
70#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */
71
72/*
73** Register definitions for DMA controller 2 (channels 4..7):
74*/
75#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */
76#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
77#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
78#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
79
80static int isa_dmarangecheck(caddr_t va, u_int length, int chan);
81
82static caddr_t dma_bouncebuf[8];
83static u_int dma_bouncebufsize[8];
84static u_int8_t dma_bounced = 0;
85static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */
86static u_int8_t dma_inuse = 0; /* User for acquire/release */
87static u_int8_t dma_auto_mode = 0;

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

483 }
484
485 if (chan >= 4) /* high channels move words */
486 cnt *= 2;
487 return(cnt);
488}
489
490/*
64static int isa_dmarangecheck(caddr_t va, u_int length, int chan);
65
66static caddr_t dma_bouncebuf[8];
67static u_int dma_bouncebufsize[8];
68static u_int8_t dma_bounced = 0;
69static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */
70static u_int8_t dma_inuse = 0; /* User for acquire/release */
71static u_int8_t dma_auto_mode = 0;

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

467 }
468
469 if (chan >= 4) /* high channels move words */
470 cnt *= 2;
471 return(cnt);
472}
473
474/*
475 * Reached terminal count yet ?
476 */
477int
478isa_dmatc(int chan)
479{
480
481 if (chan < 4)
482 return(inb(DMA1_STATUS) & (1 << chan));
483 else
484 return(inb(DMA2_STATUS) & (1 << (chan & 3)));
485}
486
487/*
491 * Stop a DMA transfer currently in progress.
492 */
493int
494isa_dmastop(int chan)
495{
496 if ((dma_inuse & (1 << chan)) == 0)
497 printf("isa_dmastop: channel %d not acquired\n", chan);
498

--- 59 unchanged lines hidden ---
488 * Stop a DMA transfer currently in progress.
489 */
490int
491isa_dmastop(int chan)
492{
493 if ((dma_inuse & (1 << chan)) == 0)
494 printf("isa_dmastop: channel %d not acquired\n", chan);
495

--- 59 unchanged lines hidden ---