xref: /titanic_53/usr/src/uts/sparc/ml/sparc_ddi.s (revision cd21e7c548ae2a3b5e522244bf798f2a6b4ba02d)
17c478bd9Sstevel@tonic-gate/*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
227c478bd9Sstevel@tonic-gate/*
237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate */
26*cd21e7c5SGarrett D'Amore/*
27*cd21e7c5SGarrett D'Amore * Copyright 2012  Garrett D'Amore <garrett@damore.org>.  All rights reserved.
28*cd21e7c5SGarrett D'Amore */
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate/*
317c478bd9Sstevel@tonic-gate * Assembler routines to make some DDI routines go faster.
327c478bd9Sstevel@tonic-gate * These routines should ONLY be ISA-dependent.
337c478bd9Sstevel@tonic-gate */
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate#if defined(lint)
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate#include <sys/types.h>
387c478bd9Sstevel@tonic-gate#include <sys/systm.h>
397c478bd9Sstevel@tonic-gate#include <sys/file.h>
407c478bd9Sstevel@tonic-gate#include <sys/sunddi.h>
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate#else	/* lint */
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h>
457c478bd9Sstevel@tonic-gate#include <sys/clock.h>
467c478bd9Sstevel@tonic-gate#include <sys/intreg.h>
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate#include "assym.h"		/* for FKIOCTL etc. */
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate#endif	/* lint */
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate/*
547c478bd9Sstevel@tonic-gate * Layered driver routines.
557c478bd9Sstevel@tonic-gate *
567c478bd9Sstevel@tonic-gate * At the time of writing, the compiler converts
577c478bd9Sstevel@tonic-gate *
587c478bd9Sstevel@tonic-gate * a() { return (b()); }
597c478bd9Sstevel@tonic-gate *
607c478bd9Sstevel@tonic-gate * into
617c478bd9Sstevel@tonic-gate *	save, call b, restore
627c478bd9Sstevel@tonic-gate *
637c478bd9Sstevel@tonic-gate * Though this is sort of ok, if the called routine is leaf routine,
647c478bd9Sstevel@tonic-gate * then we just burnt a register window.
657c478bd9Sstevel@tonic-gate *
667c478bd9Sstevel@tonic-gate * When the compiler understands this optimization, many
677c478bd9Sstevel@tonic-gate * of these routines can go back to C again.
687c478bd9Sstevel@tonic-gate */
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gate#define	FLATCALL(routine)	\
717c478bd9Sstevel@tonic-gate	mov	%o7, %g1;	\
727c478bd9Sstevel@tonic-gate	call	routine;	\
737c478bd9Sstevel@tonic-gate	mov	%g1, %o7
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate#ifdef	lint
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateint
787c478bd9Sstevel@tonic-gateddi_copyin(const void *buf, void *kernbuf, size_t size, int flags)
797c478bd9Sstevel@tonic-gate{
807c478bd9Sstevel@tonic-gate	if (flags & FKIOCTL)
817c478bd9Sstevel@tonic-gate		return (kcopy(buf, kernbuf, size) ? -1 : 0);
827c478bd9Sstevel@tonic-gate	return (copyin(buf, kernbuf, size));
837c478bd9Sstevel@tonic-gate}
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate#else	/* lint */
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate	ENTRY(ddi_copyin)
887c478bd9Sstevel@tonic-gate	set	FKIOCTL, %o4
897c478bd9Sstevel@tonic-gate	andcc	%o3, %o4, %g0
907c478bd9Sstevel@tonic-gate	bne	.do_kcopy	! share code with ddi_copyout
917c478bd9Sstevel@tonic-gate	FLATCALL(copyin)
927c478bd9Sstevel@tonic-gate	/*NOTREACHED*/
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate.do_kcopy:
957c478bd9Sstevel@tonic-gate	save	%sp, -SA(MINFRAME), %sp
967c478bd9Sstevel@tonic-gate	mov	%i2, %o2
977c478bd9Sstevel@tonic-gate	mov	%i1, %o1
987c478bd9Sstevel@tonic-gate	call	kcopy
997c478bd9Sstevel@tonic-gate	mov	%i0, %o0
1007c478bd9Sstevel@tonic-gate	orcc	%g0, %o0, %i0	! if kcopy returns EFAULT ..
1017c478bd9Sstevel@tonic-gate	bne,a	1f
1027c478bd9Sstevel@tonic-gate	mov	-1, %i0		! .. we return -1
1037c478bd9Sstevel@tonic-gate1:	ret
1047c478bd9Sstevel@tonic-gate	restore
1057c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_copyin)
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate#endif	/* lint */
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gate#ifdef	lint
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gateint
1127c478bd9Sstevel@tonic-gateddi_copyout(const void *buf, void *kernbuf, size_t size, int flags)
1137c478bd9Sstevel@tonic-gate{
1147c478bd9Sstevel@tonic-gate	if (flags & FKIOCTL)
1157c478bd9Sstevel@tonic-gate		return (kcopy(buf, kernbuf, size) ? -1 : 0);
1167c478bd9Sstevel@tonic-gate	return (copyout(buf, kernbuf, size));
1177c478bd9Sstevel@tonic-gate}
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gate#else	/* lint */
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate	ENTRY(ddi_copyout)
1227c478bd9Sstevel@tonic-gate	set	FKIOCTL, %o4
1237c478bd9Sstevel@tonic-gate	andcc	%o3, %o4, %g0
1247c478bd9Sstevel@tonic-gate	bne	.do_kcopy	! share code with ddi_copyin
1257c478bd9Sstevel@tonic-gate	FLATCALL(copyout)
1267c478bd9Sstevel@tonic-gate	/*NOTREACHED*/
1277c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_copyout)
1287c478bd9Sstevel@tonic-gate
1297c478bd9Sstevel@tonic-gate#endif	/* lint */
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate/*
1327c478bd9Sstevel@tonic-gate * DDI spine wrapper routines - here so as to not have to
1337c478bd9Sstevel@tonic-gate * buy register windows when climbing the device tree (which cost!)
1347c478bd9Sstevel@tonic-gate */
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate#if	defined(lint)
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate/*ARGSUSED*/
1397c478bd9Sstevel@tonic-gateint
1407c478bd9Sstevel@tonic-gateddi_ctlops(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t op, void *a, void *v)
1417c478bd9Sstevel@tonic-gate{
1427c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
1437c478bd9Sstevel@tonic-gate}
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate#else	/* lint */
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gate	ENTRY(ddi_ctlops)
1487c478bd9Sstevel@tonic-gate	tst	%o0		! dip != 0?
1497c478bd9Sstevel@tonic-gate	be,pn	%ncc, 2f	! nope
1507c478bd9Sstevel@tonic-gate	tst	%o1		! rdip != 0?
1517c478bd9Sstevel@tonic-gate	be,pn	%ncc, 2f	! nope
1527c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_CTL], %o0
1537c478bd9Sstevel@tonic-gate				! dip = (dev_info_t *)DEVI(dip)->devi_bus_ctl;
1547c478bd9Sstevel@tonic-gate	brz,pn	%o0, 2f
1557c478bd9Sstevel@tonic-gate	nop			! Delay slot
1567c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
1577c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
1587c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_CTL], %g1	! dip->dev_ops->devo_bus_ops->bus_ctl
1597c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
1607c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
1617c478bd9Sstevel@tonic-gate2:	retl
1627c478bd9Sstevel@tonic-gate	sub	%g0, 1, %o0	! return (DDI_FAILURE);
1637c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_ctlops)
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate#endif	/* lint */
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gate#if	defined(lint)
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate/* ARGSUSED */
1707c478bd9Sstevel@tonic-gateint
1717c478bd9Sstevel@tonic-gateddi_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attr,
1727c478bd9Sstevel@tonic-gate	int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep)
1737c478bd9Sstevel@tonic-gate{
1747c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
1757c478bd9Sstevel@tonic-gate}
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate#else	/* lint */
1787c478bd9Sstevel@tonic-gate
1797c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_allochdl)
1807c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_ALLOCHDL], %o0
1817c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_allochdl;
1827c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
1837c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
1847c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_ALLOCHDL], %g1
1857c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_allochdl
1867c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
1877c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
1887c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_allochdl)
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate#endif	/* lint */
1917c478bd9Sstevel@tonic-gate
1927c478bd9Sstevel@tonic-gate#if	defined(lint)
1937c478bd9Sstevel@tonic-gate
1947c478bd9Sstevel@tonic-gate/* ARGSUSED */
1957c478bd9Sstevel@tonic-gateint
1967c478bd9Sstevel@tonic-gateddi_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handlep)
1977c478bd9Sstevel@tonic-gate{
1987c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
1997c478bd9Sstevel@tonic-gate}
2007c478bd9Sstevel@tonic-gate
2017c478bd9Sstevel@tonic-gate#else	/* lint */
2027c478bd9Sstevel@tonic-gate
2037c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_freehdl)
2047c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_FREEHDL], %o0
2057c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_freehdl;
2067c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
2077c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
2087c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_FREEHDL], %g1
2097c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_freehdl
2107c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
2117c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
2127c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_freehdl)
2137c478bd9Sstevel@tonic-gate
2147c478bd9Sstevel@tonic-gate#endif	/* lint */
2157c478bd9Sstevel@tonic-gate
2167c478bd9Sstevel@tonic-gate#if	defined(lint)
2177c478bd9Sstevel@tonic-gate
2187c478bd9Sstevel@tonic-gate/* ARGSUSED */
2197c478bd9Sstevel@tonic-gateint
2207c478bd9Sstevel@tonic-gateddi_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip,
2217c478bd9Sstevel@tonic-gate	ddi_dma_handle_t handle, struct ddi_dma_req *dmareq,
2227c478bd9Sstevel@tonic-gate	ddi_dma_cookie_t *cp, u_int *ccountp)
2237c478bd9Sstevel@tonic-gate{
2247c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
2257c478bd9Sstevel@tonic-gate}
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate#else	/* lint */
2287c478bd9Sstevel@tonic-gate
2297c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_bindhdl)
2307c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_BINDHDL], %o0
2317c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_bindhdl;
2327c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
2337c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
2347c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_BINDHDL], %g1
2357c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_bindhdl
2367c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
2377c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
2387c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_bindhdl)
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gate#endif	/* lint */
2417c478bd9Sstevel@tonic-gate
2427c478bd9Sstevel@tonic-gate#if	defined(lint)
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate/* ARGSUSED */
2457c478bd9Sstevel@tonic-gateint
2467c478bd9Sstevel@tonic-gateddi_dma_unbindhdl(dev_info_t *dip, dev_info_t *rdip,
2477c478bd9Sstevel@tonic-gate	ddi_dma_handle_t handle)
2487c478bd9Sstevel@tonic-gate{
2497c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
2507c478bd9Sstevel@tonic-gate}
2517c478bd9Sstevel@tonic-gate
2527c478bd9Sstevel@tonic-gate#else	/* lint */
2537c478bd9Sstevel@tonic-gate
2547c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_unbindhdl)
2557c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_UNBINDHDL], %o0
2567c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
2577c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
2587c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
2597c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_UNBINDHDL], %g1
2607c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_unbindhdl
2617c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
2627c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
2637c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_unbindhdl)
2647c478bd9Sstevel@tonic-gate
2657c478bd9Sstevel@tonic-gate#endif	/* lint */
2667c478bd9Sstevel@tonic-gate
2677c478bd9Sstevel@tonic-gate#if	defined(lint)
2687c478bd9Sstevel@tonic-gate
2697c478bd9Sstevel@tonic-gate/* ARGSUSED */
2707c478bd9Sstevel@tonic-gateint
2717c478bd9Sstevel@tonic-gateddi_dma_flush(dev_info_t *dip, dev_info_t *rdip,
2727c478bd9Sstevel@tonic-gate	ddi_dma_handle_t handle, off_t off, size_t len,
2737c478bd9Sstevel@tonic-gate	u_int cache_flags)
2747c478bd9Sstevel@tonic-gate{
2757c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
2767c478bd9Sstevel@tonic-gate}
2777c478bd9Sstevel@tonic-gate
2787c478bd9Sstevel@tonic-gate#else	/* lint */
2797c478bd9Sstevel@tonic-gate
2807c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_flush)
2817c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_FLUSH], %o0
2827c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_flush;
2837c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
2847c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
2857c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_FLUSH], %g1
2867c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_flush
2877c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
2887c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
2897c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_flush)
2907c478bd9Sstevel@tonic-gate
2917c478bd9Sstevel@tonic-gate#endif	/* lint */
2927c478bd9Sstevel@tonic-gate
2937c478bd9Sstevel@tonic-gate#if	defined(lint)
2947c478bd9Sstevel@tonic-gate
2957c478bd9Sstevel@tonic-gate/* ARGSUSED */
2967c478bd9Sstevel@tonic-gateint
2977c478bd9Sstevel@tonic-gateddi_dma_win(dev_info_t *dip, dev_info_t *rdip,
2987c478bd9Sstevel@tonic-gate	ddi_dma_handle_t handle, uint_t win, off_t *offp,
2997c478bd9Sstevel@tonic-gate	size_t *lenp, ddi_dma_cookie_t *cookiep, uint_t *ccountp)
3007c478bd9Sstevel@tonic-gate{
3017c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
3027c478bd9Sstevel@tonic-gate}
3037c478bd9Sstevel@tonic-gate
3047c478bd9Sstevel@tonic-gate#else	/* lint */
3057c478bd9Sstevel@tonic-gate
3067c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_win)
3077c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_WIN], %o0
3087c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_win;
3097c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
3107c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
3117c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_WIN], %g1
3127c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_win
3137c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
3147c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
3157c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_win)
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gate#endif	/* lint */
3187c478bd9Sstevel@tonic-gate
3197c478bd9Sstevel@tonic-gate#if	defined(lint)
3207c478bd9Sstevel@tonic-gate
3217c478bd9Sstevel@tonic-gate/* ARGSUSED */
3227c478bd9Sstevel@tonic-gateint
3237c478bd9Sstevel@tonic-gateddi_dma_sync(ddi_dma_handle_t h, off_t o, size_t l, u_int whom)
3247c478bd9Sstevel@tonic-gate{
3257c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
3267c478bd9Sstevel@tonic-gate}
3277c478bd9Sstevel@tonic-gate
3287c478bd9Sstevel@tonic-gate#else	/* lint */
3297c478bd9Sstevel@tonic-gate
3307c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_sync)
3317c478bd9Sstevel@tonic-gate	ld	[%o0 + DMA_HANDLE_RFLAGS], %o4	! hp->dmai_rflags;
3327c478bd9Sstevel@tonic-gate	sethi	%hi(DMP_NOSYNC), %o5
3337c478bd9Sstevel@tonic-gate	and	%o4, %o5, %o4
3347c478bd9Sstevel@tonic-gate	cmp	%o4, %o5
3357c478bd9Sstevel@tonic-gate	bne	1f
3367c478bd9Sstevel@tonic-gate	mov	%o3, %o5
3377c478bd9Sstevel@tonic-gate	retl
3387c478bd9Sstevel@tonic-gate	clr	%o0
3397c478bd9Sstevel@tonic-gate1:	mov	%o1, %o3
3407c478bd9Sstevel@tonic-gate	ldn	[%o0 + DMA_HANDLE_RDIP], %o1	! dip = hp->dmai_rdip;
3417c478bd9Sstevel@tonic-gate	mov	%o0, %g2
3427c478bd9Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_FLUSH], %o0
3437c478bd9Sstevel@tonic-gate			! dip = DEVI(dip)->devi_bus_dma_flush;
3447c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
3457c478bd9Sstevel@tonic-gate	mov	%o2, %o4
3467c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
3477c478bd9Sstevel@tonic-gate	mov	%g2, %o2
3487c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_FLUSH], %g1
3497c478bd9Sstevel@tonic-gate			! dip->dev_ops->devo_bus_ops->bus_dma_flush
3507c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
3517c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
3527c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_sync)
3537c478bd9Sstevel@tonic-gate
3547c478bd9Sstevel@tonic-gate#endif	/* lint */
3557c478bd9Sstevel@tonic-gate
3567c478bd9Sstevel@tonic-gate#if	defined(lint)
3577c478bd9Sstevel@tonic-gate
3587c478bd9Sstevel@tonic-gate/* ARGSUSED */
3597c478bd9Sstevel@tonic-gateint
3607c478bd9Sstevel@tonic-gateddi_dma_unbind_handle(ddi_dma_handle_t h)
3617c478bd9Sstevel@tonic-gate{
3627c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
3637c478bd9Sstevel@tonic-gate}
3647c478bd9Sstevel@tonic-gate
3657c478bd9Sstevel@tonic-gate#else	/* lint */
3667c478bd9Sstevel@tonic-gate
3677c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_unbind_handle)
3687c478bd9Sstevel@tonic-gate	ldn	[%o0 + DMA_HANDLE_RDIP], %o1	! dip = hp->dmai_rdip;
3697c478bd9Sstevel@tonic-gate	mov	%o0, %o2
3707c478bd9Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_UNBINDFUNC ], %g1
3717c478bd9Sstevel@tonic-gate		    ! funcp = DEVI(dip)->devi_bus_dma_unbindfunc;
3727c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
3737c478bd9Sstevel@tonic-gate	ldn	[%o1 + DEVI_BUS_DMA_UNBINDHDL], %o0
3747c478bd9Sstevel@tonic-gate		    ! hdip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
3757c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_unbind_handle)
3767c478bd9Sstevel@tonic-gate
3777c478bd9Sstevel@tonic-gate#endif	/* lint */
3787c478bd9Sstevel@tonic-gate
3797c478bd9Sstevel@tonic-gate
3807c478bd9Sstevel@tonic-gate#if	defined(lint)
3817c478bd9Sstevel@tonic-gate
3827c478bd9Sstevel@tonic-gate/*ARGSUSED*/
3837c478bd9Sstevel@tonic-gateint
3847c478bd9Sstevel@tonic-gateddi_dma_mctl(register dev_info_t *dip, dev_info_t *rdip,
3857c478bd9Sstevel@tonic-gate    ddi_dma_handle_t handle, enum ddi_dma_ctlops request,
3867c478bd9Sstevel@tonic-gate    off_t *offp, size_t *lenp, caddr_t *objp, u_int flags)
3877c478bd9Sstevel@tonic-gate{
3887c478bd9Sstevel@tonic-gate	return (DDI_SUCCESS);
3897c478bd9Sstevel@tonic-gate}
3907c478bd9Sstevel@tonic-gate
3917c478bd9Sstevel@tonic-gate#else	/* lint */
3927c478bd9Sstevel@tonic-gate
3937c478bd9Sstevel@tonic-gate	ENTRY(ddi_dma_mctl)
3947c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_BUS_DMA_CTL], %o0
3957c478bd9Sstevel@tonic-gate			! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_ctl;
3967c478bd9Sstevel@tonic-gate	ldn	[%o0 + DEVI_DEV_OPS], %g1	! dip->dev_ops
3977c478bd9Sstevel@tonic-gate	ldn	[%g1 + DEVI_BUS_OPS], %g1	! dip->dev_ops->devo_bus_ops
3987c478bd9Sstevel@tonic-gate	ldn	[%g1 + OPS_MCTL], %g1 ! dip->dev_ops->devo_bus_ops->bus_dma_ctl
3997c478bd9Sstevel@tonic-gate	jmpl	%g1, %g0	! bop off to new routine
4007c478bd9Sstevel@tonic-gate	nop			! as if we had never been here
4017c478bd9Sstevel@tonic-gate	SET_SIZE(ddi_dma_mctl)
4027c478bd9Sstevel@tonic-gate
4037c478bd9Sstevel@tonic-gate#endif	/* lint */
404