isa_dma.c (128019) | isa_dma.c (135262) |
---|---|
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 --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * from: isa_dma.c,v 1.3 1999/05/09 23:56:00 peter Exp $ | 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 --- 17 unchanged lines hidden (view full) --- 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 * from: isa_dma.c,v 1.3 1999/05/09 23:56:00 peter Exp $ |
34 * $FreeBSD: head/sys/ia64/isa/isa_dma.c 128019 2004-04-07 20:46:16Z imp $ | 34 * $FreeBSD: head/sys/ia64/isa/isa_dma.c 135262 2004-09-15 12:09:50Z phk $ |
35 */ 36 37/* 38 * code to manage AT bus 39 * 40 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 41 * Fixed uninitialized variable problem and added code to deal 42 * with DMA page boundaries in isa_dmarangecheck(). Fixed word --- 43 unchanged lines hidden (view full) --- 86#define VALID_DMA_MASK (7) 87 88/* high byte of address is stored in this port for i-th dma channel */ 89static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; 90 91/* 92 * Setup a DMA channel's bounce buffer. 93 */ | 35 */ 36 37/* 38 * code to manage AT bus 39 * 40 * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): 41 * Fixed uninitialized variable problem and added code to deal 42 * with DMA page boundaries in isa_dmarangecheck(). Fixed word --- 43 unchanged lines hidden (view full) --- 86#define VALID_DMA_MASK (7) 87 88/* high byte of address is stored in this port for i-th dma channel */ 89static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; 90 91/* 92 * Setup a DMA channel's bounce buffer. 93 */ |
94void 95isa_dmainit(chan, bouncebufsize) 96 int chan; 97 u_int bouncebufsize; | 94int 95isa_dma_init(int chan, u_int bouncebufsize, int flag __unused) |
98{ 99 static int initted = 0; 100 bus_addr_t boundary = chan >= 4 ? 0x20000 : 0x10000; 101 102 if (!initted) { 103 /* 104 * Reset the DMA hardware. 105 */ 106 outb(DMA1_RESET, 0); 107 outb(DMA2_RESET, 0); 108 isa_dmacascade(4); 109 110 initted = 1; 111 } 112 113#ifdef DIAGNOSTIC 114 if (chan & ~VALID_DMA_MASK) | 96{ 97 static int initted = 0; 98 bus_addr_t boundary = chan >= 4 ? 0x20000 : 0x10000; 99 100 if (!initted) { 101 /* 102 * Reset the DMA hardware. 103 */ 104 outb(DMA1_RESET, 0); 105 outb(DMA2_RESET, 0); 106 isa_dmacascade(4); 107 108 initted = 1; 109 } 110 111#ifdef DIAGNOSTIC 112 if (chan & ~VALID_DMA_MASK) |
115 panic("isa_dmainit: channel out of range"); | 113 panic("isa_dma_init: channel out of range"); |
116 117 if (dma_tag[chan] || dma_map[chan]) | 114 115 if (dma_tag[chan] || dma_map[chan]) |
118 panic("isa_dmainit: impossible request"); | 116 panic("isa_dma_init: impossible request"); |
119#endif 120 121 if (bus_dma_tag_create(/*parent*/NULL, 122 /*alignment*/2, 123 /*boundary*/boundary, 124 /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, 125 /*highaddr*/BUS_SPACE_MAXADDR, 126 /*filter*/NULL, /*filterarg*/NULL, 127 /*maxsize*/bouncebufsize, 128 /*nsegments*/1, /*maxsegz*/0x3ffff, 129 /*flags*/BUS_DMA_ISA, 130 /*lockfunc*/busdma_lock_mutex, 131 /*lockarg*/&Giant, 132 &dma_tag[chan]) != 0) { | 117#endif 118 119 if (bus_dma_tag_create(/*parent*/NULL, 120 /*alignment*/2, 121 /*boundary*/boundary, 122 /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, 123 /*highaddr*/BUS_SPACE_MAXADDR, 124 /*filter*/NULL, /*filterarg*/NULL, 125 /*maxsize*/bouncebufsize, 126 /*nsegments*/1, /*maxsegz*/0x3ffff, 127 /*flags*/BUS_DMA_ISA, 128 /*lockfunc*/busdma_lock_mutex, 129 /*lockarg*/&Giant, 130 &dma_tag[chan]) != 0) { |
133 panic("isa_dmainit: unable to create dma tag\n"); | 131 panic("isa_dma_init: unable to create dma tag\n"); |
134 } 135 136 if (bus_dmamap_create(dma_tag[chan], 0, &dma_map[chan])) { | 132 } 133 134 if (bus_dmamap_create(dma_tag[chan], 0, &dma_map[chan])) { |
137 panic("isa_dmainit: unable to create dma map\n"); | 135 panic("isa_dma_init: unable to create dma map\n"); |
138 } 139 | 136 } 137 |
138 return (0); |
|
140} 141 142/* 143 * Register a DMA channel's usage. Usually called from a device driver 144 * in open() or during its initialization. 145 */ 146int 147isa_dma_acquire(chan) --- 198 unchanged lines hidden (view full) --- 346 * isa_dmastart() once because they use Auto DMA mode. If we 347 * leave this in, drivers that do this will print this continuously. 348 */ 349 if (dma_busy & (1 << chan)) 350 printf("isa_dmastart: channel %d busy\n", chan); 351#endif 352 353 if (!dma_tag || !dma_map[chan]) | 139} 140 141/* 142 * Register a DMA channel's usage. Usually called from a device driver 143 * in open() or during its initialization. 144 */ 145int 146isa_dma_acquire(chan) --- 198 unchanged lines hidden (view full) --- 345 * isa_dmastart() once because they use Auto DMA mode. If we 346 * leave this in, drivers that do this will print this continuously. 347 */ 348 if (dma_busy & (1 << chan)) 349 printf("isa_dmastart: channel %d busy\n", chan); 350#endif 351 352 if (!dma_tag || !dma_map[chan]) |
354 panic("isa_dmastart: called without isa_dmainit"); | 353 panic("isa_dmastart: called without isa_dma_init"); |
355 356 dma_busy |= (1 << chan); 357 358 if (flags & ISADMA_RAW) { 359 dma_auto_mode |= (1 << chan); 360 } else { 361 dma_auto_mode &= ~(1 << chan); 362 } --- 152 unchanged lines hidden --- | 354 355 dma_busy |= (1 << chan); 356 357 if (flags & ISADMA_RAW) { 358 dma_auto_mode |= (1 << chan); 359 } else { 360 dma_auto_mode &= ~(1 << chan); 361 } --- 152 unchanged lines hidden --- |