xref: /onnv-gate/usr/src/uts/sparc/ml/sparc_ddi.s (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 2005 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/*
30*0Sstevel@tonic-gate * Assembler routines to make some DDI routines go faster.
31*0Sstevel@tonic-gate * These routines should ONLY be ISA-dependent.
32*0Sstevel@tonic-gate */
33*0Sstevel@tonic-gate
34*0Sstevel@tonic-gate#if defined(lint)
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gate#include <sys/types.h>
37*0Sstevel@tonic-gate#include <sys/systm.h>
38*0Sstevel@tonic-gate#include <sys/file.h>
39*0Sstevel@tonic-gate#include <sys/sunddi.h>
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gate#else	/* lint */
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate#include <sys/asm_linkage.h>
44*0Sstevel@tonic-gate#include <sys/clock.h>
45*0Sstevel@tonic-gate#include <sys/intreg.h>
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gate#include "assym.h"		/* for FKIOCTL etc. */
48*0Sstevel@tonic-gate
49*0Sstevel@tonic-gate#endif	/* lint */
50*0Sstevel@tonic-gate
51*0Sstevel@tonic-gate
52*0Sstevel@tonic-gate/*
53*0Sstevel@tonic-gate * Layered driver routines.
54*0Sstevel@tonic-gate *
55*0Sstevel@tonic-gate * At the time of writing, the compiler converts
56*0Sstevel@tonic-gate *
57*0Sstevel@tonic-gate * a() { return (b()); }
58*0Sstevel@tonic-gate *
59*0Sstevel@tonic-gate * into
60*0Sstevel@tonic-gate *	save, call b, restore
61*0Sstevel@tonic-gate *
62*0Sstevel@tonic-gate * Though this is sort of ok, if the called routine is leaf routine,
63*0Sstevel@tonic-gate * then we just burnt a register window.
64*0Sstevel@tonic-gate *
65*0Sstevel@tonic-gate * When the compiler understands this optimization, many
66*0Sstevel@tonic-gate * of these routines can go back to C again.
67*0Sstevel@tonic-gate */
68*0Sstevel@tonic-gate
69*0Sstevel@tonic-gate#define	FLATCALL(routine)	\
70*0Sstevel@tonic-gate	mov	%o7, %g1;	\
71*0Sstevel@tonic-gate	call	routine;	\
72*0Sstevel@tonic-gate	mov	%g1, %o7
73*0Sstevel@tonic-gate
74*0Sstevel@tonic-gate#ifdef	lint
75*0Sstevel@tonic-gate
76*0Sstevel@tonic-gateint
77*0Sstevel@tonic-gateddi_copyin(const void *buf, void *kernbuf, size_t size, int flags)
78*0Sstevel@tonic-gate{
79*0Sstevel@tonic-gate	if (flags & FKIOCTL)
80*0Sstevel@tonic-gate		return (kcopy(buf, kernbuf, size) ? -1 : 0);
81*0Sstevel@tonic-gate	return (copyin(buf, kernbuf, size));
82*0Sstevel@tonic-gate}
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gate#else	/* lint */
85*0Sstevel@tonic-gate
86*0Sstevel@tonic-gate	ENTRY(ddi_copyin)
87*0Sstevel@tonic-gate	set	FKIOCTL, %o4
88*0Sstevel@tonic-gate	andcc	%o3, %o4, %g0
89*0Sstevel@tonic-gate	bne	.do_kcopy	! share code with ddi_copyout
90*0Sstevel@tonic-gate	FLATCALL(copyin)
91*0Sstevel@tonic-gate	/*NOTREACHED*/
92*0Sstevel@tonic-gate
93*0Sstevel@tonic-gate.do_kcopy:
94*0Sstevel@tonic-gate	save	%sp, -SA(MINFRAME), %sp
95*0Sstevel@tonic-gate	mov	%i2, %o2
96*0Sstevel@tonic-gate	mov	%i1, %o1
97*0Sstevel@tonic-gate	call	kcopy
98*0Sstevel@tonic-gate	mov	%i0, %o0
99*0Sstevel@tonic-gate	orcc	%g0, %o0, %i0	! if kcopy returns EFAULT ..
100*0Sstevel@tonic-gate	bne,a	1f
101*0Sstevel@tonic-gate	mov	-1, %i0		! .. we return -1
102*0Sstevel@tonic-gate1:	ret
103*0Sstevel@tonic-gate	restore
104*0Sstevel@tonic-gate	SET_SIZE(ddi_copyin)
105*0Sstevel@tonic-gate
106*0Sstevel@tonic-gate#endif	/* lint */
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gate#ifdef	lint
109*0Sstevel@tonic-gate
110*0Sstevel@tonic-gateint
111*0Sstevel@tonic-gateddi_copyout(const void *buf, void *kernbuf, size_t size, int flags)
112*0Sstevel@tonic-gate{
113*0Sstevel@tonic-gate	if (flags & FKIOCTL)
114*0Sstevel@tonic-gate		return (kcopy(buf, kernbuf, size) ? -1 : 0);
115*0Sstevel@tonic-gate	return (copyout(buf, kernbuf, size));
116*0Sstevel@tonic-gate}
117*0Sstevel@tonic-gate
118*0Sstevel@tonic-gate#else	/* lint */
119*0Sstevel@tonic-gate
120*0Sstevel@tonic-gate	ENTRY(ddi_copyout)
121*0Sstevel@tonic-gate	set	FKIOCTL, %o4
122*0Sstevel@tonic-gate	andcc	%o3, %o4, %g0
123*0Sstevel@tonic-gate	bne	.do_kcopy	! share code with ddi_copyin
124*0Sstevel@tonic-gate	FLATCALL(copyout)
125*0Sstevel@tonic-gate	/*NOTREACHED*/
126*0Sstevel@tonic-gate	SET_SIZE(ddi_copyout)
127*0Sstevel@tonic-gate
128*0Sstevel@tonic-gate#endif	/* lint */
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate/*
131*0Sstevel@tonic-gate * DDI spine wrapper routines - here so as to not have to
132*0Sstevel@tonic-gate * buy register windows when climbing the device tree (which cost!)
133*0Sstevel@tonic-gate */
134*0Sstevel@tonic-gate
135*0Sstevel@tonic-gate#if	defined(lint)
136*0Sstevel@tonic-gate
137*0Sstevel@tonic-gate/*ARGSUSED*/
138*0Sstevel@tonic-gateint
139*0Sstevel@tonic-gateddi_ctlops(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t op, void *a, void *v)
140*0Sstevel@tonic-gate{
141*0Sstevel@tonic-gate	return (DDI_SUCCESS);
142*0Sstevel@tonic-gate}
143*0Sstevel@tonic-gate
144*0Sstevel@tonic-gate#else	/* lint */
145*0Sstevel@tonic-gate
146*0Sstevel@tonic-gate	ENTRY(ddi_ctlops)
147*0Sstevel@tonic-gate	tst	%o0		! dip != 0?
148*0Sstevel@tonic-gate	be,pn	%ncc, 2f	! nope
149*0Sstevel@tonic-gate	tst	%o1		! rdip != 0?
150*0Sstevel@tonic-gate	be,pn	%ncc, 2f	! nope
151*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_CTL], %o0
152*0Sstevel@tonic-gate				! dip = (dev_info_t *)DEVI(dip)->devi_bus_ctl;
153*0Sstevel@tonic-gate	brz,pn	%o0, 2f
154*0Sstevel@tonic-gate	nop			! Delay slot
155*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
156*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
157*0Sstevel@tonic-gate	ldn	[%g1 + OPS_CTL], %g1	! dip->dev_ops->devo_bus_ops->bus_ctl
158*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
159*0Sstevel@tonic-gate	nop			! as if we had never been here
160*0Sstevel@tonic-gate2:	retl
161*0Sstevel@tonic-gate	sub	%g0, 1, %o0	! return (DDI_FAILURE);
162*0Sstevel@tonic-gate	SET_SIZE(ddi_ctlops)
163*0Sstevel@tonic-gate
164*0Sstevel@tonic-gate#endif	/* lint */
165*0Sstevel@tonic-gate
166*0Sstevel@tonic-gate#if	defined(lint)
167*0Sstevel@tonic-gate
168*0Sstevel@tonic-gate/* ARGSUSED */
169*0Sstevel@tonic-gateint
170*0Sstevel@tonic-gateddi_dma_map(dev_info_t *dip, dev_info_t *rdip,
171*0Sstevel@tonic-gate    struct ddi_dma_req *dmareqp, ddi_dma_handle_t *handlep)
172*0Sstevel@tonic-gate{
173*0Sstevel@tonic-gate	return (DDI_SUCCESS);
174*0Sstevel@tonic-gate}
175*0Sstevel@tonic-gate
176*0Sstevel@tonic-gate#else	/* lint */
177*0Sstevel@tonic-gate
178*0Sstevel@tonic-gate	ENTRY(ddi_dma_map)
179*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_MAP], %o0
180*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_map;
181*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
182*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
183*0Sstevel@tonic-gate	ldn	[%g1 + OPS_MAP], %g1 ! dip->dev_ops->devo_bus_ops->bus_dma_map
184*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
185*0Sstevel@tonic-gate	nop			! as if we had never been here
186*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_map)
187*0Sstevel@tonic-gate
188*0Sstevel@tonic-gate#endif	/* lint */
189*0Sstevel@tonic-gate
190*0Sstevel@tonic-gate#if	defined(lint)
191*0Sstevel@tonic-gate
192*0Sstevel@tonic-gate/* ARGSUSED */
193*0Sstevel@tonic-gateint
194*0Sstevel@tonic-gateddi_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attr,
195*0Sstevel@tonic-gate	int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep)
196*0Sstevel@tonic-gate{
197*0Sstevel@tonic-gate	return (DDI_SUCCESS);
198*0Sstevel@tonic-gate}
199*0Sstevel@tonic-gate
200*0Sstevel@tonic-gate#else	/* lint */
201*0Sstevel@tonic-gate
202*0Sstevel@tonic-gate	ENTRY(ddi_dma_allochdl)
203*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_ALLOCHDL], %o0
204*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_allochdl;
205*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
206*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
207*0Sstevel@tonic-gate	ldn	[%g1 + OPS_ALLOCHDL], %g1
208*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_allochdl
209*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
210*0Sstevel@tonic-gate	nop			! as if we had never been here
211*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_allochdl)
212*0Sstevel@tonic-gate
213*0Sstevel@tonic-gate#endif	/* lint */
214*0Sstevel@tonic-gate
215*0Sstevel@tonic-gate#if	defined(lint)
216*0Sstevel@tonic-gate
217*0Sstevel@tonic-gate/* ARGSUSED */
218*0Sstevel@tonic-gateint
219*0Sstevel@tonic-gateddi_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handlep)
220*0Sstevel@tonic-gate{
221*0Sstevel@tonic-gate	return (DDI_SUCCESS);
222*0Sstevel@tonic-gate}
223*0Sstevel@tonic-gate
224*0Sstevel@tonic-gate#else	/* lint */
225*0Sstevel@tonic-gate
226*0Sstevel@tonic-gate	ENTRY(ddi_dma_freehdl)
227*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_FREEHDL], %o0
228*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_freehdl;
229*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
230*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
231*0Sstevel@tonic-gate	ldn	[%g1 + OPS_FREEHDL], %g1
232*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_freehdl
233*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
234*0Sstevel@tonic-gate	nop			! as if we had never been here
235*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_freehdl)
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gate#endif	/* lint */
238*0Sstevel@tonic-gate
239*0Sstevel@tonic-gate#if	defined(lint)
240*0Sstevel@tonic-gate
241*0Sstevel@tonic-gate/* ARGSUSED */
242*0Sstevel@tonic-gateint
243*0Sstevel@tonic-gateddi_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip,
244*0Sstevel@tonic-gate	ddi_dma_handle_t handle, struct ddi_dma_req *dmareq,
245*0Sstevel@tonic-gate	ddi_dma_cookie_t *cp, u_int *ccountp)
246*0Sstevel@tonic-gate{
247*0Sstevel@tonic-gate	return (DDI_SUCCESS);
248*0Sstevel@tonic-gate}
249*0Sstevel@tonic-gate
250*0Sstevel@tonic-gate#else	/* lint */
251*0Sstevel@tonic-gate
252*0Sstevel@tonic-gate	ENTRY(ddi_dma_bindhdl)
253*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_BINDHDL], %o0
254*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_bindhdl;
255*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
256*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
257*0Sstevel@tonic-gate	ldn	[%g1 + OPS_BINDHDL], %g1
258*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_bindhdl
259*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
260*0Sstevel@tonic-gate	nop			! as if we had never been here
261*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_bindhdl)
262*0Sstevel@tonic-gate
263*0Sstevel@tonic-gate#endif	/* lint */
264*0Sstevel@tonic-gate
265*0Sstevel@tonic-gate#if	defined(lint)
266*0Sstevel@tonic-gate
267*0Sstevel@tonic-gate/* ARGSUSED */
268*0Sstevel@tonic-gateint
269*0Sstevel@tonic-gateddi_dma_unbindhdl(dev_info_t *dip, dev_info_t *rdip,
270*0Sstevel@tonic-gate	ddi_dma_handle_t handle)
271*0Sstevel@tonic-gate{
272*0Sstevel@tonic-gate	return (DDI_SUCCESS);
273*0Sstevel@tonic-gate}
274*0Sstevel@tonic-gate
275*0Sstevel@tonic-gate#else	/* lint */
276*0Sstevel@tonic-gate
277*0Sstevel@tonic-gate	ENTRY(ddi_dma_unbindhdl)
278*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_UNBINDHDL], %o0
279*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
280*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
281*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
282*0Sstevel@tonic-gate	ldn	[%g1 + OPS_UNBINDHDL], %g1
283*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_unbindhdl
284*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
285*0Sstevel@tonic-gate	nop			! as if we had never been here
286*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_unbindhdl)
287*0Sstevel@tonic-gate
288*0Sstevel@tonic-gate#endif	/* lint */
289*0Sstevel@tonic-gate
290*0Sstevel@tonic-gate#if	defined(lint)
291*0Sstevel@tonic-gate
292*0Sstevel@tonic-gate/* ARGSUSED */
293*0Sstevel@tonic-gateint
294*0Sstevel@tonic-gateddi_dma_flush(dev_info_t *dip, dev_info_t *rdip,
295*0Sstevel@tonic-gate	ddi_dma_handle_t handle, off_t off, size_t len,
296*0Sstevel@tonic-gate	u_int cache_flags)
297*0Sstevel@tonic-gate{
298*0Sstevel@tonic-gate	return (DDI_SUCCESS);
299*0Sstevel@tonic-gate}
300*0Sstevel@tonic-gate
301*0Sstevel@tonic-gate#else	/* lint */
302*0Sstevel@tonic-gate
303*0Sstevel@tonic-gate	ENTRY(ddi_dma_flush)
304*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_FLUSH], %o0
305*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_flush;
306*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
307*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
308*0Sstevel@tonic-gate	ldn	[%g1 + OPS_FLUSH], %g1
309*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_flush
310*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
311*0Sstevel@tonic-gate	nop			! as if we had never been here
312*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_flush)
313*0Sstevel@tonic-gate
314*0Sstevel@tonic-gate#endif	/* lint */
315*0Sstevel@tonic-gate
316*0Sstevel@tonic-gate#if	defined(lint)
317*0Sstevel@tonic-gate
318*0Sstevel@tonic-gate/* ARGSUSED */
319*0Sstevel@tonic-gateint
320*0Sstevel@tonic-gateddi_dma_win(dev_info_t *dip, dev_info_t *rdip,
321*0Sstevel@tonic-gate	ddi_dma_handle_t handle, uint_t win, off_t *offp,
322*0Sstevel@tonic-gate	size_t *lenp, ddi_dma_cookie_t *cookiep, uint_t *ccountp)
323*0Sstevel@tonic-gate{
324*0Sstevel@tonic-gate	return (DDI_SUCCESS);
325*0Sstevel@tonic-gate}
326*0Sstevel@tonic-gate
327*0Sstevel@tonic-gate#else	/* lint */
328*0Sstevel@tonic-gate
329*0Sstevel@tonic-gate	ENTRY(ddi_dma_win)
330*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_WIN], %o0
331*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_win;
332*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
333*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
334*0Sstevel@tonic-gate	ldn	[%g1 + OPS_WIN], %g1
335*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_win
336*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
337*0Sstevel@tonic-gate	nop			! as if we had never been here
338*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_win)
339*0Sstevel@tonic-gate
340*0Sstevel@tonic-gate#endif	/* lint */
341*0Sstevel@tonic-gate
342*0Sstevel@tonic-gate#if	defined(lint)
343*0Sstevel@tonic-gate
344*0Sstevel@tonic-gate/* ARGSUSED */
345*0Sstevel@tonic-gateint
346*0Sstevel@tonic-gateddi_dma_sync(ddi_dma_handle_t h, off_t o, size_t l, u_int whom)
347*0Sstevel@tonic-gate{
348*0Sstevel@tonic-gate	return (DDI_SUCCESS);
349*0Sstevel@tonic-gate}
350*0Sstevel@tonic-gate
351*0Sstevel@tonic-gate#else	/* lint */
352*0Sstevel@tonic-gate
353*0Sstevel@tonic-gate	ENTRY(ddi_dma_sync)
354*0Sstevel@tonic-gate	ld	[%o0 + DMA_HANDLE_RFLAGS], %o4	! hp->dmai_rflags;
355*0Sstevel@tonic-gate	sethi	%hi(DMP_NOSYNC), %o5
356*0Sstevel@tonic-gate	and	%o4, %o5, %o4
357*0Sstevel@tonic-gate	cmp	%o4, %o5
358*0Sstevel@tonic-gate	bne	1f
359*0Sstevel@tonic-gate	mov	%o3, %o5
360*0Sstevel@tonic-gate	retl
361*0Sstevel@tonic-gate	clr	%o0
362*0Sstevel@tonic-gate1:	mov	%o1, %o3
363*0Sstevel@tonic-gate	ldn	[%o0 + DMA_HANDLE_RDIP], %o1	! dip = hp->dmai_rdip;
364*0Sstevel@tonic-gate	mov	%o0, %g2
365*0Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_FLUSH], %o0
366*0Sstevel@tonic-gate			! dip = DEVI(dip)->devi_bus_dma_flush;
367*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
368*0Sstevel@tonic-gate	mov	%o2, %o4
369*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
370*0Sstevel@tonic-gate	mov	%g2, %o2
371*0Sstevel@tonic-gate	ldn	[%g1 + OPS_FLUSH], %g1
372*0Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_flush
373*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
374*0Sstevel@tonic-gate	nop			! as if we had never been here
375*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_sync)
376*0Sstevel@tonic-gate
377*0Sstevel@tonic-gate#endif	/* lint */
378*0Sstevel@tonic-gate
379*0Sstevel@tonic-gate#if	defined(lint)
380*0Sstevel@tonic-gate
381*0Sstevel@tonic-gate/* ARGSUSED */
382*0Sstevel@tonic-gateint
383*0Sstevel@tonic-gateddi_dma_unbind_handle(ddi_dma_handle_t h)
384*0Sstevel@tonic-gate{
385*0Sstevel@tonic-gate	return (DDI_SUCCESS);
386*0Sstevel@tonic-gate}
387*0Sstevel@tonic-gate
388*0Sstevel@tonic-gate#else	/* lint */
389*0Sstevel@tonic-gate
390*0Sstevel@tonic-gate	ENTRY(ddi_dma_unbind_handle)
391*0Sstevel@tonic-gate	ldn	[%o0 + DMA_HANDLE_RDIP], %o1	! dip = hp->dmai_rdip;
392*0Sstevel@tonic-gate	mov	%o0, %o2
393*0Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_UNBINDFUNC ], %g1
394*0Sstevel@tonic-gate		    ! funcp = DEVI(dip)->devi_bus_dma_unbindfunc;
395*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
396*0Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_UNBINDHDL], %o0
397*0Sstevel@tonic-gate		    ! hdip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
398*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_unbind_handle)
399*0Sstevel@tonic-gate
400*0Sstevel@tonic-gate#endif	/* lint */
401*0Sstevel@tonic-gate
402*0Sstevel@tonic-gate
403*0Sstevel@tonic-gate#if	defined(lint)
404*0Sstevel@tonic-gate
405*0Sstevel@tonic-gate/*ARGSUSED*/
406*0Sstevel@tonic-gateint
407*0Sstevel@tonic-gateddi_dma_mctl(register dev_info_t *dip, dev_info_t *rdip,
408*0Sstevel@tonic-gate    ddi_dma_handle_t handle, enum ddi_dma_ctlops request,
409*0Sstevel@tonic-gate    off_t *offp, size_t *lenp, caddr_t *objp, u_int flags)
410*0Sstevel@tonic-gate{
411*0Sstevel@tonic-gate	return (DDI_SUCCESS);
412*0Sstevel@tonic-gate}
413*0Sstevel@tonic-gate
414*0Sstevel@tonic-gate#else	/* lint */
415*0Sstevel@tonic-gate
416*0Sstevel@tonic-gate	ENTRY(ddi_dma_mctl)
417*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_CTL], %o0
418*0Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_ctl;
419*0Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
420*0Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
421*0Sstevel@tonic-gate	ldn	[%g1 + OPS_MCTL], %g1 ! dip->dev_ops->devo_bus_ops->bus_dma_ctl
422*0Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
423*0Sstevel@tonic-gate	nop			! as if we had never been here
424*0Sstevel@tonic-gate	SET_SIZE(ddi_dma_mctl)
425*0Sstevel@tonic-gate
426*0Sstevel@tonic-gate#endif	/* lint */
427