Home | History | Annotate | Line # | Download | only in dev
esp_obio.c revision 1.10.8.4
      1  1.10.8.4  thorpej /*	$NetBSD: esp_obio.c,v 1.10.8.4 2002/12/11 06:12:03 thorpej Exp $	*/
      2  1.10.8.2  nathanw 
      3  1.10.8.2  nathanw /*-
      4  1.10.8.2  nathanw  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
      5  1.10.8.2  nathanw  * All rights reserved.
      6  1.10.8.2  nathanw  *
      7  1.10.8.2  nathanw  * This code is derived from software contributed to The NetBSD Foundation
      8  1.10.8.2  nathanw  * by Charles M. Hannum; Jason R. Thorpe of the Numerical Aerospace
      9  1.10.8.2  nathanw  * Simulation Facility, NASA Ames Research Center; Paul Kranenburg.
     10  1.10.8.2  nathanw  *
     11  1.10.8.2  nathanw  * Redistribution and use in source and binary forms, with or without
     12  1.10.8.2  nathanw  * modification, are permitted provided that the following conditions
     13  1.10.8.2  nathanw  * are met:
     14  1.10.8.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     15  1.10.8.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     16  1.10.8.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.10.8.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     18  1.10.8.2  nathanw  *    documentation and/or other materials provided with the distribution.
     19  1.10.8.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     20  1.10.8.2  nathanw  *    must display the following acknowledgement:
     21  1.10.8.2  nathanw  *	This product includes software developed by the NetBSD
     22  1.10.8.2  nathanw  *	Foundation, Inc. and its contributors.
     23  1.10.8.2  nathanw  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.10.8.2  nathanw  *    contributors may be used to endorse or promote products derived
     25  1.10.8.2  nathanw  *    from this software without specific prior written permission.
     26  1.10.8.2  nathanw  *
     27  1.10.8.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.10.8.2  nathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.10.8.2  nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.10.8.2  nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.10.8.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.10.8.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.10.8.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.10.8.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.10.8.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.10.8.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.10.8.2  nathanw  * POSSIBILITY OF SUCH DAMAGE.
     38  1.10.8.2  nathanw  */
     39  1.10.8.2  nathanw 
     40  1.10.8.2  nathanw #include <sys/types.h>
     41  1.10.8.2  nathanw #include <sys/param.h>
     42  1.10.8.2  nathanw #include <sys/systm.h>
     43  1.10.8.2  nathanw #include <sys/kernel.h>
     44  1.10.8.2  nathanw #include <sys/errno.h>
     45  1.10.8.2  nathanw #include <sys/device.h>
     46  1.10.8.2  nathanw #include <sys/buf.h>
     47  1.10.8.2  nathanw 
     48  1.10.8.2  nathanw #include <dev/scsipi/scsi_all.h>
     49  1.10.8.2  nathanw #include <dev/scsipi/scsipi_all.h>
     50  1.10.8.2  nathanw #include <dev/scsipi/scsiconf.h>
     51  1.10.8.2  nathanw #include <dev/scsipi/scsi_message.h>
     52  1.10.8.2  nathanw 
     53  1.10.8.2  nathanw #include <machine/bus.h>
     54  1.10.8.2  nathanw #include <machine/autoconf.h>
     55  1.10.8.2  nathanw #include <machine/intr.h>
     56  1.10.8.2  nathanw 
     57  1.10.8.2  nathanw #include <dev/ic/lsi64854reg.h>
     58  1.10.8.2  nathanw #include <dev/ic/lsi64854var.h>
     59  1.10.8.2  nathanw 
     60  1.10.8.2  nathanw #include <dev/ic/ncr53c9xreg.h>
     61  1.10.8.2  nathanw #include <dev/ic/ncr53c9xvar.h>
     62  1.10.8.2  nathanw 
     63  1.10.8.2  nathanw #include <dev/sbus/sbusvar.h>
     64  1.10.8.2  nathanw 
     65  1.10.8.2  nathanw struct esp_softc {
     66  1.10.8.2  nathanw 	struct ncr53c9x_softc sc_ncr53c9x;	/* glue to MI code */
     67  1.10.8.2  nathanw 	bus_space_tag_t		sc_bustag;
     68  1.10.8.2  nathanw 	bus_dma_tag_t		sc_dmatag;
     69  1.10.8.2  nathanw 	bus_space_handle_t	sc_reg;		/* the registers */
     70  1.10.8.2  nathanw 	struct lsi64854_softc	*sc_dma;	/* pointer to my dma */
     71  1.10.8.2  nathanw };
     72  1.10.8.2  nathanw 
     73  1.10.8.2  nathanw 
     74  1.10.8.2  nathanw void	espattach_obio	__P((struct device *, struct device *, void *));
     75  1.10.8.2  nathanw int	espmatch_obio	__P((struct device *, struct cfdata *, void *));
     76  1.10.8.2  nathanw 
     77  1.10.8.2  nathanw /* Linkup to the rest of the kernel */
     78  1.10.8.3  nathanw CFATTACH_DECL(esp_obio, sizeof(struct esp_softc),
     79  1.10.8.3  nathanw     espmatch_obio, espattach_obio, NULL, NULL);
     80  1.10.8.2  nathanw 
     81  1.10.8.2  nathanw /*
     82  1.10.8.2  nathanw  * Functions and the switch for the MI code.
     83  1.10.8.2  nathanw  */
     84  1.10.8.2  nathanw static u_char	esp_read_reg __P((struct ncr53c9x_softc *, int));
     85  1.10.8.2  nathanw static void	esp_write_reg __P((struct ncr53c9x_softc *, int, u_char));
     86  1.10.8.2  nathanw static int	esp_dma_isintr __P((struct ncr53c9x_softc *));
     87  1.10.8.2  nathanw static void	esp_dma_reset __P((struct ncr53c9x_softc *));
     88  1.10.8.2  nathanw static int	esp_dma_intr __P((struct ncr53c9x_softc *));
     89  1.10.8.2  nathanw static int	esp_dma_setup __P((struct ncr53c9x_softc *, caddr_t *,
     90  1.10.8.2  nathanw 				    size_t *, int, size_t *));
     91  1.10.8.2  nathanw static void	esp_dma_go __P((struct ncr53c9x_softc *));
     92  1.10.8.2  nathanw static void	esp_dma_stop __P((struct ncr53c9x_softc *));
     93  1.10.8.2  nathanw static int	esp_dma_isactive __P((struct ncr53c9x_softc *));
     94  1.10.8.2  nathanw 
     95  1.10.8.2  nathanw static struct ncr53c9x_glue esp_obio_glue = {
     96  1.10.8.2  nathanw 	esp_read_reg,
     97  1.10.8.2  nathanw 	esp_write_reg,
     98  1.10.8.2  nathanw 	esp_dma_isintr,
     99  1.10.8.2  nathanw 	esp_dma_reset,
    100  1.10.8.2  nathanw 	esp_dma_intr,
    101  1.10.8.2  nathanw 	esp_dma_setup,
    102  1.10.8.2  nathanw 	esp_dma_go,
    103  1.10.8.2  nathanw 	esp_dma_stop,
    104  1.10.8.2  nathanw 	esp_dma_isactive,
    105  1.10.8.2  nathanw 	NULL,			/* gl_clear_latched_intr */
    106  1.10.8.2  nathanw };
    107  1.10.8.2  nathanw 
    108  1.10.8.2  nathanw int
    109  1.10.8.2  nathanw espmatch_obio(parent, cf, aux)
    110  1.10.8.2  nathanw 	struct device *parent;
    111  1.10.8.2  nathanw 	struct cfdata *cf;
    112  1.10.8.2  nathanw 	void *aux;
    113  1.10.8.2  nathanw {
    114  1.10.8.2  nathanw 	union obio_attach_args *uoba = aux;
    115  1.10.8.2  nathanw 	struct obio4_attach_args *oba;
    116  1.10.8.2  nathanw 
    117  1.10.8.2  nathanw 	if (uoba->uoba_isobio4 == 0)
    118  1.10.8.2  nathanw 		return (0);
    119  1.10.8.2  nathanw 
    120  1.10.8.2  nathanw 	oba = &uoba->uoba_oba4;
    121  1.10.8.2  nathanw 	return (bus_space_probe(oba->oba_bustag, oba->oba_paddr,
    122  1.10.8.2  nathanw 				1,	/* probe size */
    123  1.10.8.2  nathanw 				0,	/* offset */
    124  1.10.8.2  nathanw 				0,	/* flags */
    125  1.10.8.2  nathanw 				NULL, NULL));
    126  1.10.8.2  nathanw }
    127  1.10.8.2  nathanw 
    128  1.10.8.2  nathanw void
    129  1.10.8.2  nathanw espattach_obio(parent, self, aux)
    130  1.10.8.2  nathanw 	struct device *parent, *self;
    131  1.10.8.2  nathanw 	void *aux;
    132  1.10.8.2  nathanw {
    133  1.10.8.2  nathanw 	union obio_attach_args *uoba = aux;
    134  1.10.8.2  nathanw 	struct obio4_attach_args *oba = &uoba->uoba_oba4;
    135  1.10.8.2  nathanw 	struct esp_softc *esc = (void *)self;
    136  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x;
    137  1.10.8.2  nathanw 
    138  1.10.8.2  nathanw 	esc->sc_bustag = oba->oba_bustag;
    139  1.10.8.2  nathanw 	esc->sc_dmatag = oba->oba_dmatag;
    140  1.10.8.2  nathanw 
    141  1.10.8.2  nathanw 	sc->sc_id = 7;
    142  1.10.8.2  nathanw 	sc->sc_freq = 24000000;
    143  1.10.8.2  nathanw 
    144  1.10.8.2  nathanw 	/*
    145  1.10.8.2  nathanw 	 * Find the DMA by poking around the dma device structures
    146  1.10.8.2  nathanw 	 */
    147  1.10.8.2  nathanw 	esc->sc_dma = (struct lsi64854_softc *)
    148  1.10.8.2  nathanw 			getdevunit("dma", sc->sc_dev.dv_unit);
    149  1.10.8.2  nathanw 
    150  1.10.8.2  nathanw 	/*
    151  1.10.8.2  nathanw 	 * and a back pointer to us, for DMA
    152  1.10.8.2  nathanw 	 */
    153  1.10.8.2  nathanw 	if (esc->sc_dma)
    154  1.10.8.2  nathanw 		esc->sc_dma->sc_client = sc;
    155  1.10.8.2  nathanw 	else {
    156  1.10.8.2  nathanw 		printf("\n");
    157  1.10.8.2  nathanw 		panic("espattach: no dma found");
    158  1.10.8.2  nathanw 	}
    159  1.10.8.2  nathanw 
    160  1.10.8.2  nathanw 	if (bus_space_map(oba->oba_bustag, oba->oba_paddr,
    161  1.10.8.2  nathanw 			  16,	/* size (of ncr53c9xreg) */
    162  1.10.8.2  nathanw 			  BUS_SPACE_MAP_LINEAR,
    163  1.10.8.2  nathanw 			  &esc->sc_reg) != 0) {
    164  1.10.8.2  nathanw 		printf("%s @ obio: cannot map registers\n", self->dv_xname);
    165  1.10.8.2  nathanw 		return;
    166  1.10.8.2  nathanw 	}
    167  1.10.8.2  nathanw 
    168  1.10.8.2  nathanw 	/*
    169  1.10.8.2  nathanw 	 * Set up glue for MI code early; we use some of it here.
    170  1.10.8.2  nathanw 	 */
    171  1.10.8.2  nathanw 	sc->sc_glue = &esp_obio_glue;
    172  1.10.8.2  nathanw 
    173  1.10.8.2  nathanw 	/* gimme Mhz */
    174  1.10.8.2  nathanw 	sc->sc_freq /= 1000000;
    175  1.10.8.2  nathanw 
    176  1.10.8.2  nathanw 	/*
    177  1.10.8.2  nathanw 	 * XXX More of this should be in ncr53c9x_attach(), but
    178  1.10.8.2  nathanw 	 * XXX should we really poke around the chip that much in
    179  1.10.8.2  nathanw 	 * XXX the MI code?  Think about this more...
    180  1.10.8.2  nathanw 	 */
    181  1.10.8.2  nathanw 
    182  1.10.8.2  nathanw 	/*
    183  1.10.8.2  nathanw 	 * It is necessary to try to load the 2nd config register here,
    184  1.10.8.2  nathanw 	 * to find out what rev the esp chip is, else the ncr53c9x_reset
    185  1.10.8.2  nathanw 	 * will not set up the defaults correctly.
    186  1.10.8.2  nathanw 	 */
    187  1.10.8.2  nathanw 	sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB;
    188  1.10.8.2  nathanw 	sc->sc_cfg2 = NCRCFG2_SCSI2 | NCRCFG2_RPE;
    189  1.10.8.2  nathanw 	sc->sc_cfg3 = NCRCFG3_CDB;
    190  1.10.8.2  nathanw 	NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2);
    191  1.10.8.2  nathanw 
    192  1.10.8.2  nathanw 	if ((NCR_READ_REG(sc, NCR_CFG2) & ~NCRCFG2_RSVD) !=
    193  1.10.8.2  nathanw 	    (NCRCFG2_SCSI2 | NCRCFG2_RPE)) {
    194  1.10.8.2  nathanw 		sc->sc_rev = NCR_VARIANT_ESP100;
    195  1.10.8.2  nathanw 	} else {
    196  1.10.8.2  nathanw 		sc->sc_cfg2 = NCRCFG2_SCSI2;
    197  1.10.8.2  nathanw 		NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2);
    198  1.10.8.2  nathanw 		sc->sc_cfg3 = 0;
    199  1.10.8.2  nathanw 		NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    200  1.10.8.2  nathanw 		sc->sc_cfg3 = (NCRCFG3_CDB | NCRCFG3_FCLK);
    201  1.10.8.2  nathanw 		NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    202  1.10.8.2  nathanw 		if (NCR_READ_REG(sc, NCR_CFG3) !=
    203  1.10.8.2  nathanw 		    (NCRCFG3_CDB | NCRCFG3_FCLK)) {
    204  1.10.8.2  nathanw 			sc->sc_rev = NCR_VARIANT_ESP100A;
    205  1.10.8.2  nathanw 		} else {
    206  1.10.8.2  nathanw 			/* NCRCFG2_FE enables > 64K transfers */
    207  1.10.8.2  nathanw 			sc->sc_cfg2 |= NCRCFG2_FE;
    208  1.10.8.2  nathanw 			sc->sc_cfg3 = 0;
    209  1.10.8.2  nathanw 			NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    210  1.10.8.2  nathanw 			sc->sc_rev = NCR_VARIANT_ESP200;
    211  1.10.8.2  nathanw 		}
    212  1.10.8.2  nathanw 	}
    213  1.10.8.2  nathanw 
    214  1.10.8.2  nathanw 	/*
    215  1.10.8.2  nathanw 	 * XXX minsync and maxxfer _should_ be set up in MI code,
    216  1.10.8.2  nathanw 	 * XXX but it appears to have some dependency on what sort
    217  1.10.8.2  nathanw 	 * XXX of DMA we're hooked up to, etc.
    218  1.10.8.2  nathanw 	 */
    219  1.10.8.2  nathanw 
    220  1.10.8.2  nathanw 	/*
    221  1.10.8.2  nathanw 	 * This is the value used to start sync negotiations
    222  1.10.8.2  nathanw 	 * Note that the NCR register "SYNCTP" is programmed
    223  1.10.8.2  nathanw 	 * in "clocks per byte", and has a minimum value of 4.
    224  1.10.8.2  nathanw 	 * The SCSI period used in negotiation is one-fourth
    225  1.10.8.2  nathanw 	 * of the time (in nanoseconds) needed to transfer one byte.
    226  1.10.8.2  nathanw 	 * Since the chip's clock is given in MHz, we have the following
    227  1.10.8.2  nathanw 	 * formula: 4 * period = (1000 / freq) * 4
    228  1.10.8.2  nathanw 	 */
    229  1.10.8.2  nathanw 	sc->sc_minsync = 1000 / sc->sc_freq;
    230  1.10.8.2  nathanw 
    231  1.10.8.2  nathanw 	/*
    232  1.10.8.2  nathanw 	 * Alas, we must now modify the value a bit, because it's
    233  1.10.8.2  nathanw 	 * only valid when can switch on FASTCLK and FASTSCSI bits
    234  1.10.8.2  nathanw 	 * in config register 3...
    235  1.10.8.2  nathanw 	 */
    236  1.10.8.2  nathanw 	switch (sc->sc_rev) {
    237  1.10.8.2  nathanw 	case NCR_VARIANT_ESP100:
    238  1.10.8.2  nathanw 		sc->sc_maxxfer = 64 * 1024;
    239  1.10.8.2  nathanw 		sc->sc_minsync = 0;	/* No synch on old chip? */
    240  1.10.8.2  nathanw 		break;
    241  1.10.8.2  nathanw 
    242  1.10.8.2  nathanw 	case NCR_VARIANT_ESP100A:
    243  1.10.8.2  nathanw 		sc->sc_maxxfer = 64 * 1024;
    244  1.10.8.2  nathanw 		/* Min clocks/byte is 5 */
    245  1.10.8.2  nathanw 		sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5);
    246  1.10.8.2  nathanw 		break;
    247  1.10.8.2  nathanw 
    248  1.10.8.2  nathanw 	case NCR_VARIANT_ESP200:
    249  1.10.8.2  nathanw 		sc->sc_maxxfer = 16 * 1024 * 1024;
    250  1.10.8.2  nathanw 		/* XXX - do actually set FAST* bits */
    251  1.10.8.2  nathanw 		break;
    252  1.10.8.2  nathanw 	}
    253  1.10.8.2  nathanw 
    254  1.10.8.2  nathanw 	/* Establish interrupt channel */
    255  1.10.8.4  thorpej 	bus_intr_establish(esc->sc_bustag, oba->oba_pri, IPL_BIO,
    256  1.10.8.2  nathanw 			   ncr53c9x_intr, sc);
    257  1.10.8.2  nathanw 
    258  1.10.8.2  nathanw 	/* register interrupt stats */
    259  1.10.8.2  nathanw 	evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
    260  1.10.8.2  nathanw 	    sc->sc_dev.dv_xname, "intr");
    261  1.10.8.2  nathanw 
    262  1.10.8.2  nathanw 	/* Do the common parts of attachment. */
    263  1.10.8.2  nathanw 	sc->sc_adapter.adapt_minphys = minphys;
    264  1.10.8.2  nathanw 	sc->sc_adapter.adapt_request = ncr53c9x_scsipi_request;
    265  1.10.8.2  nathanw 	ncr53c9x_attach(sc);
    266  1.10.8.2  nathanw 	sc->sc_features |= NCR_F_DMASELECT;
    267  1.10.8.2  nathanw }
    268  1.10.8.2  nathanw 
    269  1.10.8.2  nathanw /*
    270  1.10.8.2  nathanw  * Glue functions.
    271  1.10.8.2  nathanw  */
    272  1.10.8.2  nathanw 
    273  1.10.8.2  nathanw u_char
    274  1.10.8.2  nathanw esp_read_reg(sc, reg)
    275  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    276  1.10.8.2  nathanw 	int reg;
    277  1.10.8.2  nathanw {
    278  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    279  1.10.8.2  nathanw 
    280  1.10.8.2  nathanw 	return (bus_space_read_1(esc->sc_bustag, esc->sc_reg, reg * 4));
    281  1.10.8.2  nathanw }
    282  1.10.8.2  nathanw 
    283  1.10.8.2  nathanw void
    284  1.10.8.2  nathanw esp_write_reg(sc, reg, v)
    285  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    286  1.10.8.2  nathanw 	int reg;
    287  1.10.8.2  nathanw 	u_char v;
    288  1.10.8.2  nathanw {
    289  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    290  1.10.8.2  nathanw 
    291  1.10.8.2  nathanw 	bus_space_write_1(esc->sc_bustag, esc->sc_reg, reg * 4, v);
    292  1.10.8.2  nathanw }
    293  1.10.8.2  nathanw 
    294  1.10.8.2  nathanw int
    295  1.10.8.2  nathanw esp_dma_isintr(sc)
    296  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    297  1.10.8.2  nathanw {
    298  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    299  1.10.8.2  nathanw 
    300  1.10.8.2  nathanw 	return (DMA_ISINTR(esc->sc_dma));
    301  1.10.8.2  nathanw }
    302  1.10.8.2  nathanw 
    303  1.10.8.2  nathanw void
    304  1.10.8.2  nathanw esp_dma_reset(sc)
    305  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    306  1.10.8.2  nathanw {
    307  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    308  1.10.8.2  nathanw 
    309  1.10.8.2  nathanw 	DMA_RESET(esc->sc_dma);
    310  1.10.8.2  nathanw }
    311  1.10.8.2  nathanw 
    312  1.10.8.2  nathanw int
    313  1.10.8.2  nathanw esp_dma_intr(sc)
    314  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    315  1.10.8.2  nathanw {
    316  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    317  1.10.8.2  nathanw 
    318  1.10.8.2  nathanw 	return (DMA_INTR(esc->sc_dma));
    319  1.10.8.2  nathanw }
    320  1.10.8.2  nathanw 
    321  1.10.8.2  nathanw int
    322  1.10.8.2  nathanw esp_dma_setup(sc, addr, len, datain, dmasize)
    323  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    324  1.10.8.2  nathanw 	caddr_t *addr;
    325  1.10.8.2  nathanw 	size_t *len;
    326  1.10.8.2  nathanw 	int datain;
    327  1.10.8.2  nathanw 	size_t *dmasize;
    328  1.10.8.2  nathanw {
    329  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    330  1.10.8.2  nathanw 
    331  1.10.8.2  nathanw 	return (DMA_SETUP(esc->sc_dma, addr, len, datain, dmasize));
    332  1.10.8.2  nathanw }
    333  1.10.8.2  nathanw 
    334  1.10.8.2  nathanw void
    335  1.10.8.2  nathanw esp_dma_go(sc)
    336  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    337  1.10.8.2  nathanw {
    338  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    339  1.10.8.2  nathanw 
    340  1.10.8.2  nathanw 	DMA_GO(esc->sc_dma);
    341  1.10.8.2  nathanw }
    342  1.10.8.2  nathanw 
    343  1.10.8.2  nathanw void
    344  1.10.8.2  nathanw esp_dma_stop(sc)
    345  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    346  1.10.8.2  nathanw {
    347  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    348  1.10.8.2  nathanw 	u_int32_t csr;
    349  1.10.8.2  nathanw 
    350  1.10.8.2  nathanw 	csr = L64854_GCSR(esc->sc_dma);
    351  1.10.8.2  nathanw 	csr &= ~D_EN_DMA;
    352  1.10.8.2  nathanw 	L64854_SCSR(esc->sc_dma, csr);
    353  1.10.8.2  nathanw }
    354  1.10.8.2  nathanw 
    355  1.10.8.2  nathanw int
    356  1.10.8.2  nathanw esp_dma_isactive(sc)
    357  1.10.8.2  nathanw 	struct ncr53c9x_softc *sc;
    358  1.10.8.2  nathanw {
    359  1.10.8.2  nathanw 	struct esp_softc *esc = (struct esp_softc *)sc;
    360  1.10.8.2  nathanw 
    361  1.10.8.2  nathanw 	return (DMA_ISACTIVE(esc->sc_dma));
    362  1.10.8.2  nathanw }
    363