xref: /onnv-gate/usr/src/uts/common/io/dma_engine.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
30*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
31*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate /*
34*0Sstevel@tonic-gate  * This is the implementation of the kernel DMA interface for the
35*0Sstevel@tonic-gate  * AT Class machines using Intel 8237A DMAC.
36*0Sstevel@tonic-gate  *
37*0Sstevel@tonic-gate  * The following routines in the interface are implemented:
38*0Sstevel@tonic-gate  *	i_dmae_init()
39*0Sstevel@tonic-gate  *	_dmae_nxcookie()
40*0Sstevel@tonic-gate  *	i_dmae_acquire()
41*0Sstevel@tonic-gate  *	i_dmae_free()
42*0Sstevel@tonic-gate  *	i_dmae_prog()
43*0Sstevel@tonic-gate  *	i_dmae_swsetup()
44*0Sstevel@tonic-gate  *	i_dmae_swstart()
45*0Sstevel@tonic-gate  *	i_dmae_stop()
46*0Sstevel@tonic-gate  *	i_dmae_enable()
47*0Sstevel@tonic-gate  *	i_dmae_disable()
48*0Sstevel@tonic-gate  *	i_dmae_get_best_mode()
49*0Sstevel@tonic-gate  *	i_dmae_get_chan_stat()
50*0Sstevel@tonic-gate  *
51*0Sstevel@tonic-gate  */
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate #include <sys/types.h>
54*0Sstevel@tonic-gate #include <sys/param.h>
55*0Sstevel@tonic-gate #include <sys/buf.h>
56*0Sstevel@tonic-gate #include <sys/kmem.h>
57*0Sstevel@tonic-gate #include <sys/sunddi.h>
58*0Sstevel@tonic-gate #include <sys/cmn_err.h>
59*0Sstevel@tonic-gate #include <sys/dma_engine.h>
60*0Sstevel@tonic-gate #include <sys/dma_i8237A.h>
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate #ifdef DEBUG
63*0Sstevel@tonic-gate #include <sys/promif.h>
64*0Sstevel@tonic-gate static int dmaedebug = 0;
65*0Sstevel@tonic-gate #define	dprintf(x)	if (dmaedebug) prom_printf x
66*0Sstevel@tonic-gate #else
67*0Sstevel@tonic-gate #define	dprintf(x)
68*0Sstevel@tonic-gate #endif
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate static struct dmae_chnl dmae_stat[NCHANS];
72*0Sstevel@tonic-gate static uintptr_t dmae_call_list[NCHANS] = {0, 0, 0, 0, 0, 0, 0, 0};
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate /*
75*0Sstevel@tonic-gate  *  routine: i_dmae_init()
76*0Sstevel@tonic-gate  *  purpose: called to initialize the dma interface, the DMAC, and any
77*0Sstevel@tonic-gate  *           dma data structures. Called during system initialization.
78*0Sstevel@tonic-gate  *  caller:  main()
79*0Sstevel@tonic-gate  *  calls:   d37A_init()
80*0Sstevel@tonic-gate  */
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate int
i_dmae_init(dev_info_t * dip)83*0Sstevel@tonic-gate i_dmae_init(dev_info_t *dip)
84*0Sstevel@tonic-gate {
85*0Sstevel@tonic-gate 	int chnl;
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate 	dprintf(("i_dmae_init: initializing dma.\n"));
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate 	/* initialize semaphore map */
90*0Sstevel@tonic-gate 	for (chnl = 0; chnl < NCHANS; chnl++) {
91*0Sstevel@tonic-gate 		sema_init(&dmae_stat[chnl].dch_lock, 1, NULL, SEMA_DRIVER,
92*0Sstevel@tonic-gate 		    (void *)NULL);
93*0Sstevel@tonic-gate 	}
94*0Sstevel@tonic-gate 	return (d37A_init(dip));
95*0Sstevel@tonic-gate }
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate /*
99*0Sstevel@tonic-gate  *  routine: i_dmae_acquire()
100*0Sstevel@tonic-gate  *  purpose: Request the semaphore for the indicated channel.
101*0Sstevel@tonic-gate  *           A call_back function can be passed if caller does/cannot
102*0Sstevel@tonic-gate  *           wait for the semaphore.
103*0Sstevel@tonic-gate  *  caller:  drivers
104*0Sstevel@tonic-gate  *  calls:   sema_p(), sema_tryp(), ddi_set_callback()
105*0Sstevel@tonic-gate  */
106*0Sstevel@tonic-gate int
i_dmae_acquire(dev_info_t * dip,int chnl,int (* dmae_waitfp)(),caddr_t arg)107*0Sstevel@tonic-gate i_dmae_acquire(dev_info_t *dip, int chnl, int (*dmae_waitfp)(), caddr_t arg)
108*0Sstevel@tonic-gate {
109*0Sstevel@tonic-gate #if defined(lint)
110*0Sstevel@tonic-gate 	dip = dip;
111*0Sstevel@tonic-gate #endif
112*0Sstevel@tonic-gate 	dprintf(("i_dmae_acquire: channel %d, waitfp %p\n",
113*0Sstevel@tonic-gate 	    chnl, (void *)dmae_waitfp));
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate 	if (!d37A_dma_valid(chnl))
116*0Sstevel@tonic-gate 		return (DDI_FAILURE);
117*0Sstevel@tonic-gate 
118*0Sstevel@tonic-gate 	if (dmae_waitfp == DDI_DMA_SLEEP) {
119*0Sstevel@tonic-gate 		sema_p(&dmae_stat[chnl].dch_lock);
120*0Sstevel@tonic-gate 	} else if (sema_tryp(&dmae_stat[chnl].dch_lock) == 0) {
121*0Sstevel@tonic-gate 		if (dmae_waitfp == DDI_DMA_DONTWAIT) {
122*0Sstevel@tonic-gate 			dprintf(("_dma_acquire: channel %d is busy.\n", chnl));
123*0Sstevel@tonic-gate 		} else {
124*0Sstevel@tonic-gate 			ddi_set_callback(dmae_waitfp, arg,
125*0Sstevel@tonic-gate 			    &dmae_call_list[chnl]);
126*0Sstevel@tonic-gate 		}
127*0Sstevel@tonic-gate 		return (DDI_DMA_NORESOURCES);
128*0Sstevel@tonic-gate 	}
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate 	/*
131*0Sstevel@tonic-gate 	 * XXX -  save dip for authentication later ??
132*0Sstevel@tonic-gate 	 */
133*0Sstevel@tonic-gate 	dprintf(("_dma_acquire: channel %d now allocated.\n", chnl));
134*0Sstevel@tonic-gate 	return (DDI_SUCCESS);
135*0Sstevel@tonic-gate }
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate /*
139*0Sstevel@tonic-gate  *  routine: i_dmae_free()
140*0Sstevel@tonic-gate  *  purpose: Release the channel semaphore on chnl. Assumes caller actually
141*0Sstevel@tonic-gate  *           owns the semaphore (no check made for this).
142*0Sstevel@tonic-gate  *  caller:  drivers
143*0Sstevel@tonic-gate  *  calls:   none
144*0Sstevel@tonic-gate  */
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate int
i_dmae_free(dev_info_t * dip,int chnl)147*0Sstevel@tonic-gate i_dmae_free(dev_info_t *dip, int chnl)
148*0Sstevel@tonic-gate {
149*0Sstevel@tonic-gate #if defined(lint)
150*0Sstevel@tonic-gate 	dip = dip;
151*0Sstevel@tonic-gate #endif
152*0Sstevel@tonic-gate 	dprintf(("i_dmae_free: channel %d\n", chnl));
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate 	d37A_dma_release(chnl);
155*0Sstevel@tonic-gate 	/*
156*0Sstevel@tonic-gate 	 * XXX - should dip be authenticated as the one that did acquire?
157*0Sstevel@tonic-gate 	 */
158*0Sstevel@tonic-gate 	sema_v(&dmae_stat[chnl].dch_lock);
159*0Sstevel@tonic-gate 
160*0Sstevel@tonic-gate 	if (dmae_call_list[chnl])
161*0Sstevel@tonic-gate 		ddi_run_callback(&dmae_call_list[chnl]);
162*0Sstevel@tonic-gate 	return (DDI_SUCCESS);
163*0Sstevel@tonic-gate }
164*0Sstevel@tonic-gate 
165*0Sstevel@tonic-gate /*
166*0Sstevel@tonic-gate  *  routine: i_dmae_get_best_mode()
167*0Sstevel@tonic-gate  *  purpose: confirm that data is aligned for efficient flyby mode
168*0Sstevel@tonic-gate  *  caller:  driver routines.
169*0Sstevel@tonic-gate  *  calls:   d37A_get_best_mode.
170*0Sstevel@tonic-gate  */
171*0Sstevel@tonic-gate 
172*0Sstevel@tonic-gate uchar_t
i_dmae_get_best_mode(dev_info_t * dip,struct ddi_dmae_req * dmaereqp)173*0Sstevel@tonic-gate i_dmae_get_best_mode(dev_info_t *dip, struct ddi_dmae_req *dmaereqp)
174*0Sstevel@tonic-gate {
175*0Sstevel@tonic-gate #if defined(lint)
176*0Sstevel@tonic-gate 	dip = dip;
177*0Sstevel@tonic-gate #endif
178*0Sstevel@tonic-gate 	return (d37A_get_best_mode(dmaereqp));
179*0Sstevel@tonic-gate }
180*0Sstevel@tonic-gate 
181*0Sstevel@tonic-gate /*
182*0Sstevel@tonic-gate  *  routine: _dmae_nxcookie()
183*0Sstevel@tonic-gate  *  purpose: service the interrupt by calling device driver routine for next
184*0Sstevel@tonic-gate  *		DMA cookie.
185*0Sstevel@tonic-gate  *  caller:  d37A_intr()
186*0Sstevel@tonic-gate  *  calls:   routine provided in request structure
187*0Sstevel@tonic-gate  */
188*0Sstevel@tonic-gate 
189*0Sstevel@tonic-gate ddi_dma_cookie_t *
_dmae_nxcookie(int chnl)190*0Sstevel@tonic-gate _dmae_nxcookie(int chnl)
191*0Sstevel@tonic-gate {
192*0Sstevel@tonic-gate 	ddi_dma_cookie_t *cookiep = NULL;
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate 	dprintf(("_dmae_nxcookie: chnl %d\n", chnl));
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate 	if (dmae_stat[chnl].proc) {
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate 		cookiep = dmae_stat[chnl].proc(dmae_stat[chnl].procparms);
199*0Sstevel@tonic-gate 		/*
200*0Sstevel@tonic-gate 		 * expect a cookie pointer from user's routine;
201*0Sstevel@tonic-gate 		 * null cookie pointer will terminate chaining
202*0Sstevel@tonic-gate 		 */
203*0Sstevel@tonic-gate 	}
204*0Sstevel@tonic-gate 	return (cookiep);
205*0Sstevel@tonic-gate }
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate 
208*0Sstevel@tonic-gate /*
209*0Sstevel@tonic-gate  *  routine: i_dmae_prog()
210*0Sstevel@tonic-gate  *  purpose: Program channel for the to_be_initiated_by_hardware operation.
211*0Sstevel@tonic-gate  *           _dma_acquire is called to request the channel semaphore and
212*0Sstevel@tonic-gate  *	     mode is passed as the sleep parameter.
213*0Sstevel@tonic-gate  *	     The channel is enabled after it is setup.
214*0Sstevel@tonic-gate  *	     Note that the ddi_dmae_req pointer can be to NULL if the mode
215*0Sstevel@tonic-gate  *	     registers have already been setup by a prior call; this implements
216*0Sstevel@tonic-gate  *	     a prog_next() to update the address and count registers.
217*0Sstevel@tonic-gate  *  caller:  driver routines
218*0Sstevel@tonic-gate  *  calls:   d37A_prog_chan()
219*0Sstevel@tonic-gate  */
220*0Sstevel@tonic-gate 
221*0Sstevel@tonic-gate int
i_dmae_prog(dev_info_t * dip,struct ddi_dmae_req * dmaereqp,ddi_dma_cookie_t * cp,int chnl)222*0Sstevel@tonic-gate i_dmae_prog(dev_info_t *dip, struct ddi_dmae_req *dmaereqp,
223*0Sstevel@tonic-gate     ddi_dma_cookie_t *cp, int chnl)
224*0Sstevel@tonic-gate {
225*0Sstevel@tonic-gate 	struct dmae_chnl *dcp;
226*0Sstevel@tonic-gate 	int rval;
227*0Sstevel@tonic-gate 
228*0Sstevel@tonic-gate #if defined(lint)
229*0Sstevel@tonic-gate 	dip = dip;
230*0Sstevel@tonic-gate #endif
231*0Sstevel@tonic-gate 	rval = d37A_prog_chan(dmaereqp, cp, chnl);
232*0Sstevel@tonic-gate 	if (rval != DDI_SUCCESS) {
233*0Sstevel@tonic-gate 		dprintf(("i_dmae_prog: failure on channel %d dmaereq=%p\n",
234*0Sstevel@tonic-gate 		    chnl, (void *)dmaereqp));
235*0Sstevel@tonic-gate 	} else {
236*0Sstevel@tonic-gate 		dprintf(("i_dmae_prog: channel %d dmaereq=%p\n",
237*0Sstevel@tonic-gate 		    chnl, (void *)dmaereqp));
238*0Sstevel@tonic-gate 		dcp = &dmae_stat[chnl];
239*0Sstevel@tonic-gate 		dcp->dch_cookiep = cp;
240*0Sstevel@tonic-gate 		if (dmaereqp) {
241*0Sstevel@tonic-gate 			dcp->proc = dmaereqp->proc;
242*0Sstevel@tonic-gate 			dcp->procparms = dmaereqp->procparms;
243*0Sstevel@tonic-gate 		}
244*0Sstevel@tonic-gate 		d37A_dma_enable(chnl);
245*0Sstevel@tonic-gate 	}
246*0Sstevel@tonic-gate 	return (rval);
247*0Sstevel@tonic-gate }
248*0Sstevel@tonic-gate 
249*0Sstevel@tonic-gate 
250*0Sstevel@tonic-gate /*
251*0Sstevel@tonic-gate  *  routine: i_dmae_swsetup()
252*0Sstevel@tonic-gate  *  purpose: Setup chan for the operation given in dmacbptr.
253*0Sstevel@tonic-gate  *           _dma_acquire is first called
254*0Sstevel@tonic-gate  *           to request the channel semaphore for chnl; mode is
255*0Sstevel@tonic-gate  *           passed to _dma_acquire().
256*0Sstevel@tonic-gate  *  caller:  driver routines
257*0Sstevel@tonic-gate  *  calls:   d37A_dma_swsetup()
258*0Sstevel@tonic-gate  */
259*0Sstevel@tonic-gate 
260*0Sstevel@tonic-gate int
i_dmae_swsetup(dev_info_t * dip,struct ddi_dmae_req * dmaereqp,ddi_dma_cookie_t * cp,int chnl)261*0Sstevel@tonic-gate i_dmae_swsetup(dev_info_t *dip, struct ddi_dmae_req *dmaereqp,
262*0Sstevel@tonic-gate     ddi_dma_cookie_t *cp, int chnl)
263*0Sstevel@tonic-gate {
264*0Sstevel@tonic-gate 	struct dmae_chnl *dcp;
265*0Sstevel@tonic-gate 	int rval;
266*0Sstevel@tonic-gate 
267*0Sstevel@tonic-gate #if defined(lint)
268*0Sstevel@tonic-gate 	dip = dip;
269*0Sstevel@tonic-gate #endif
270*0Sstevel@tonic-gate 	rval = d37A_dma_swsetup(dmaereqp, cp, chnl);
271*0Sstevel@tonic-gate 	if (rval != DDI_SUCCESS) {
272*0Sstevel@tonic-gate 		dprintf(("i_dmae_swsetup: failure on channel %d dmaereq=%p\n",
273*0Sstevel@tonic-gate 		    chnl, (void *)dmaereqp));
274*0Sstevel@tonic-gate 	} else {
275*0Sstevel@tonic-gate 		dprintf(("i_dmae_swsetup: channel %d: dmaereq=%p\n",
276*0Sstevel@tonic-gate 		    chnl, (void *)dmaereqp));
277*0Sstevel@tonic-gate 		dcp = &dmae_stat[chnl];
278*0Sstevel@tonic-gate 		dcp->dch_cookiep = cp;
279*0Sstevel@tonic-gate 		dcp->proc = dmaereqp->proc;
280*0Sstevel@tonic-gate 		dcp->procparms = dmaereqp->procparms;
281*0Sstevel@tonic-gate 	}
282*0Sstevel@tonic-gate 	return (rval);
283*0Sstevel@tonic-gate }
284*0Sstevel@tonic-gate 
285*0Sstevel@tonic-gate 
286*0Sstevel@tonic-gate /*
287*0Sstevel@tonic-gate  *  routine: i_dmae_swstart()
288*0Sstevel@tonic-gate  *  purpose: Start the operation setup by i_dmae_swsetup().
289*0Sstevel@tonic-gate  *  caller:  driver routines
290*0Sstevel@tonic-gate  *  calls:   d37A_dma_swstart().
291*0Sstevel@tonic-gate  */
292*0Sstevel@tonic-gate 
293*0Sstevel@tonic-gate void
i_dmae_swstart(dev_info_t * dip,int chnl)294*0Sstevel@tonic-gate i_dmae_swstart(dev_info_t *dip, int chnl)
295*0Sstevel@tonic-gate {
296*0Sstevel@tonic-gate #if defined(lint)
297*0Sstevel@tonic-gate 	dip = dip;
298*0Sstevel@tonic-gate #endif
299*0Sstevel@tonic-gate 	dprintf(("i_dmae_swstart: channel %d.\n", chnl));
300*0Sstevel@tonic-gate 
301*0Sstevel@tonic-gate 	d37A_dma_swstart(chnl);
302*0Sstevel@tonic-gate }
303*0Sstevel@tonic-gate 
304*0Sstevel@tonic-gate 
305*0Sstevel@tonic-gate /*
306*0Sstevel@tonic-gate  *  routine: i_dmae_stop()
307*0Sstevel@tonic-gate  *  purpose: stop DMA activity on chnl.
308*0Sstevel@tonic-gate  *  caller:  driver routines
309*0Sstevel@tonic-gate  *  calls:   splhi(), _dma_relse(), splx(),
310*0Sstevel@tonic-gate  *           d37A_dma_stop().
311*0Sstevel@tonic-gate  */
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate void
i_dmae_stop(dev_info_t * dip,int chnl)314*0Sstevel@tonic-gate i_dmae_stop(dev_info_t *dip, int chnl)
315*0Sstevel@tonic-gate {
316*0Sstevel@tonic-gate #if defined(lint)
317*0Sstevel@tonic-gate 	dip = dip;
318*0Sstevel@tonic-gate #endif
319*0Sstevel@tonic-gate 	dprintf(("i_dmae_stop: channel %d\n", chnl));
320*0Sstevel@tonic-gate 
321*0Sstevel@tonic-gate 	/* call d37A the stop the channel */
322*0Sstevel@tonic-gate 	d37A_dma_stop(chnl);
323*0Sstevel@tonic-gate 
324*0Sstevel@tonic-gate 	dmae_stat[chnl].dch_cookiep = NULL;
325*0Sstevel@tonic-gate }
326*0Sstevel@tonic-gate 
327*0Sstevel@tonic-gate 
328*0Sstevel@tonic-gate /*
329*0Sstevel@tonic-gate  *  routine: i_dmae_enable()
330*0Sstevel@tonic-gate  *  purpose: Allow the hardware tied to channel chnl to request service
331*0Sstevel@tonic-gate  *           from the DMAC. i_dmae_prog() should have been called prior
332*0Sstevel@tonic-gate  *           to this.
333*0Sstevel@tonic-gate  *  caller:  driver routines.
334*0Sstevel@tonic-gate  *  calls:   d37A_dma_enable()
335*0Sstevel@tonic-gate  */
336*0Sstevel@tonic-gate 
337*0Sstevel@tonic-gate void
i_dmae_enable(dev_info_t * dip,int chnl)338*0Sstevel@tonic-gate i_dmae_enable(dev_info_t *dip, int chnl)
339*0Sstevel@tonic-gate {
340*0Sstevel@tonic-gate #if defined(lint)
341*0Sstevel@tonic-gate 	dip = dip;
342*0Sstevel@tonic-gate #endif
343*0Sstevel@tonic-gate 	dprintf(("i_dmae_enable: channel %d\n", chnl));
344*0Sstevel@tonic-gate 
345*0Sstevel@tonic-gate 	d37A_dma_enable(chnl);
346*0Sstevel@tonic-gate }
347*0Sstevel@tonic-gate 
348*0Sstevel@tonic-gate 
349*0Sstevel@tonic-gate /*
350*0Sstevel@tonic-gate  *  routine: i_dmae_disable()
351*0Sstevel@tonic-gate  *  purpose: Called to mask off hardware requests on channel chnl. Assumes
352*0Sstevel@tonic-gate  *           the caller owns the channel.
353*0Sstevel@tonic-gate  *  caller:  driver routines.
354*0Sstevel@tonic-gate  *  calls:   d37A_dma_disable()
355*0Sstevel@tonic-gate  */
356*0Sstevel@tonic-gate 
357*0Sstevel@tonic-gate void
i_dmae_disable(dev_info_t * dip,int chnl)358*0Sstevel@tonic-gate i_dmae_disable(dev_info_t *dip, int chnl)
359*0Sstevel@tonic-gate {
360*0Sstevel@tonic-gate #if defined(lint)
361*0Sstevel@tonic-gate 	dip = dip;
362*0Sstevel@tonic-gate #endif
363*0Sstevel@tonic-gate 	/* dprintf(("i_dmae_disable: disable channel %d.\n", chnl)); */
364*0Sstevel@tonic-gate 
365*0Sstevel@tonic-gate 	d37A_dma_disable(chnl);
366*0Sstevel@tonic-gate 
367*0Sstevel@tonic-gate 	dmae_stat[chnl].dch_cookiep = NULL;
368*0Sstevel@tonic-gate }
369*0Sstevel@tonic-gate 
370*0Sstevel@tonic-gate 
371*0Sstevel@tonic-gate /*
372*0Sstevel@tonic-gate  *  routine: i_dmae_get_chan_stat()
373*0Sstevel@tonic-gate  *  purpose: Obtain the current channel status from the DMAC
374*0Sstevel@tonic-gate  *  caller:  driver routines.
375*0Sstevel@tonic-gate  *  calls:   d37A_get_chan_stat()
376*0Sstevel@tonic-gate  */
377*0Sstevel@tonic-gate 
378*0Sstevel@tonic-gate void
i_dmae_get_chan_stat(dev_info_t * dip,int chnl,ulong_t * addressp,int * countp)379*0Sstevel@tonic-gate i_dmae_get_chan_stat(dev_info_t *dip, int chnl, ulong_t *addressp, int *countp)
380*0Sstevel@tonic-gate {
381*0Sstevel@tonic-gate #if defined(lint)
382*0Sstevel@tonic-gate 	dip = dip;
383*0Sstevel@tonic-gate #endif
384*0Sstevel@tonic-gate 	dprintf(("i_dmae_get_chan_stat: channel %d", chnl));
385*0Sstevel@tonic-gate 
386*0Sstevel@tonic-gate 	d37A_get_chan_stat(chnl, addressp, countp);
387*0Sstevel@tonic-gate }
388