Home | History | Annotate | Line # | Download | only in tc
asc_tc.c revision 1.14.8.2
      1  1.14.8.2   thorpej /* $NetBSD: asc_tc.c,v 1.14.8.2 2002/01/10 19:58:37 thorpej Exp $ */
      2       1.1  jonathan 
      3  1.14.8.2   thorpej /*-
      4  1.14.8.2   thorpej  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  1.14.8.2   thorpej  * All rights reserved.
      6  1.14.8.2   thorpej  *
      7  1.14.8.2   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.14.8.2   thorpej  * by Tohru Nishimura.
      9       1.1  jonathan  *
     10  1.14.8.2   thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.14.8.2   thorpej  * modification, are permitted provided that the following conditions
     12  1.14.8.2   thorpej  * are met:
     13  1.14.8.2   thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.14.8.2   thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.14.8.2   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.14.8.2   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.14.8.2   thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.14.8.2   thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.14.8.2   thorpej  *    must display the following acknowledgement:
     20  1.14.8.2   thorpej  *	This product includes software developed by the NetBSD
     21  1.14.8.2   thorpej  *	Foundation, Inc. and its contributors.
     22  1.14.8.2   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.14.8.2   thorpej  *    contributors may be used to endorse or promote products derived
     24  1.14.8.2   thorpej  *    from this software without specific prior written permission.
     25       1.1  jonathan  *
     26  1.14.8.2   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.14.8.2   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.14.8.2   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.14.8.2   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.14.8.2   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.14.8.2   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.14.8.2   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.14.8.2   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.14.8.2   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.14.8.2   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.14.8.2   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37       1.1  jonathan  */
     38       1.1  jonathan 
     39  1.14.8.2   thorpej #include <sys/cdefs.h>
     40  1.14.8.2   thorpej __KERNEL_RCSID(0, "$NetBSD: asc_tc.c,v 1.14.8.2 2002/01/10 19:58:37 thorpej Exp $");
     41  1.14.8.2   thorpej 
     42       1.1  jonathan #include <sys/param.h>
     43       1.1  jonathan #include <sys/systm.h>
     44       1.1  jonathan #include <sys/device.h>
     45  1.14.8.2   thorpej #include <sys/buf.h>
     46      1.10       mrg 
     47  1.14.8.2   thorpej #include <dev/scsipi/scsi_all.h>
     48  1.14.8.2   thorpej #include <dev/scsipi/scsipi_all.h>
     49  1.14.8.2   thorpej #include <dev/scsipi/scsiconf.h>
     50  1.14.8.2   thorpej #include <dev/scsipi/scsi_message.h>
     51       1.1  jonathan 
     52  1.14.8.2   thorpej #include <machine/bus.h>
     53       1.1  jonathan 
     54  1.14.8.2   thorpej #include <dev/ic/ncr53c9xreg.h>
     55  1.14.8.2   thorpej #include <dev/ic/ncr53c9xvar.h>
     56       1.1  jonathan 
     57  1.14.8.2   thorpej #include <dev/tc/tcvar.h>
     58       1.1  jonathan 
     59  1.14.8.2   thorpej struct asc_softc {
     60  1.14.8.2   thorpej 	struct ncr53c9x_softc sc_ncr53c9x;	/* glue to MI code */
     61  1.14.8.2   thorpej 	bus_space_tag_t sc_bst;
     62  1.14.8.2   thorpej 	bus_space_handle_t sc_bsh;
     63  1.14.8.2   thorpej 	bus_dma_tag_t sc_dmat;
     64  1.14.8.2   thorpej 	bus_dmamap_t sc_dmamap;
     65  1.14.8.2   thorpej 	caddr_t *sc_dmaaddr;
     66  1.14.8.2   thorpej 	size_t	*sc_dmalen;
     67  1.14.8.2   thorpej 	size_t	sc_dmasize;
     68  1.14.8.2   thorpej 	int	sc_active;			/* DMA active ? */
     69  1.14.8.2   thorpej 	int	sc_ispullup;			/* DMA into main memory? */
     70       1.1  jonathan 
     71  1.14.8.2   thorpej 	/* XXX XXX XXX */
     72  1.14.8.2   thorpej 	caddr_t sc_base, sc_bounce, sc_target;
     73  1.14.8.2   thorpej };
     74  1.14.8.2   thorpej 
     75  1.14.8.2   thorpej static int  asc_tc_match __P((struct device *, struct cfdata *, void *));
     76  1.14.8.2   thorpej static void asc_tc_attach __P((struct device *, struct device *, void *));
     77       1.1  jonathan 
     78       1.1  jonathan struct cfattach asc_tc_ca = {
     79       1.1  jonathan 	sizeof(struct asc_softc), asc_tc_match, asc_tc_attach
     80       1.1  jonathan };
     81       1.1  jonathan 
     82  1.14.8.2   thorpej static u_char	asc_read_reg __P((struct ncr53c9x_softc *, int));
     83  1.14.8.2   thorpej static void	asc_write_reg __P((struct ncr53c9x_softc *, int, u_char));
     84  1.14.8.2   thorpej static int	asc_dma_isintr __P((struct ncr53c9x_softc *));
     85  1.14.8.2   thorpej static void	asc_tc_reset __P((struct ncr53c9x_softc *));
     86  1.14.8.2   thorpej static int	asc_tc_intr __P((struct ncr53c9x_softc *));
     87  1.14.8.2   thorpej static int	asc_tc_setup __P((struct ncr53c9x_softc *, caddr_t *,
     88  1.14.8.2   thorpej 						size_t *, int, size_t *));
     89  1.14.8.2   thorpej static void	asc_tc_go __P((struct ncr53c9x_softc *));
     90  1.14.8.2   thorpej static void	asc_tc_stop __P((struct ncr53c9x_softc *));
     91  1.14.8.2   thorpej static int	asc_dma_isactive __P((struct ncr53c9x_softc *));
     92  1.14.8.2   thorpej static void	asc_clear_latched_intr __P((struct ncr53c9x_softc *));
     93  1.14.8.2   thorpej 
     94  1.14.8.2   thorpej static struct ncr53c9x_glue asc_tc_glue = {
     95  1.14.8.2   thorpej         asc_read_reg,
     96  1.14.8.2   thorpej         asc_write_reg,
     97  1.14.8.2   thorpej         asc_dma_isintr,
     98  1.14.8.2   thorpej         asc_tc_reset,
     99  1.14.8.2   thorpej         asc_tc_intr,
    100  1.14.8.2   thorpej         asc_tc_setup,
    101  1.14.8.2   thorpej         asc_tc_go,
    102  1.14.8.2   thorpej         asc_tc_stop,
    103  1.14.8.2   thorpej         asc_dma_isactive,
    104  1.14.8.2   thorpej         asc_clear_latched_intr,
    105  1.14.8.2   thorpej };
    106  1.14.8.2   thorpej 
    107       1.1  jonathan /*
    108  1.14.8.2   thorpej  * Parameters specific to PMAZ-A TC option card.
    109       1.1  jonathan  */
    110  1.14.8.2   thorpej #define PMAZ_OFFSET_53C94	0x0		/* from module base */
    111  1.14.8.2   thorpej #define PMAZ_OFFSET_DMAR	0x40000		/* DMA Address Register */
    112  1.14.8.2   thorpej #define PMAZ_OFFSET_RAM		0x80000		/* 128KB SRAM buffer */
    113  1.14.8.2   thorpej #define PMAZ_OFFSET_ROM		0xc0000		/* diagnostic ROM */
    114  1.14.8.2   thorpej 
    115  1.14.8.2   thorpej #define PMAZ_RAM_SIZE		0x20000		/* 128k (32k*32) */
    116  1.14.8.2   thorpej #define PER_TGT_DMA_SIZE	((PMAZ_RAM_SIZE/7) & ~(sizeof(int)-1))
    117  1.14.8.2   thorpej 
    118  1.14.8.2   thorpej #define PMAZ_DMAR_WRITE		0x80000000	/* DMA direction bit */
    119  1.14.8.2   thorpej #define PMAZ_DMAR_MASK		0x1ffff		/* 17 bits, 128k */
    120  1.14.8.2   thorpej #define PMAZ_DMA_ADDR(x)	((unsigned long)(x) & PMAZ_DMAR_MASK)
    121       1.1  jonathan 
    122       1.7    mhitch static int
    123  1.14.8.2   thorpej asc_tc_match(parent, cfdata, aux)
    124       1.1  jonathan 	struct device *parent;
    125  1.14.8.2   thorpej 	struct cfdata *cfdata;
    126       1.1  jonathan 	void *aux;
    127       1.1  jonathan {
    128  1.14.8.2   thorpej 	struct tc_attach_args *d = aux;
    129  1.14.8.2   thorpej 
    130  1.14.8.2   thorpej 	if (strncmp("PMAZ-AA ", d->ta_modname, TC_ROM_LLEN))
    131       1.1  jonathan 		return (0);
    132       1.1  jonathan 
    133       1.1  jonathan 	return (1);
    134       1.1  jonathan }
    135       1.1  jonathan 
    136  1.14.8.2   thorpej static void
    137       1.1  jonathan asc_tc_attach(parent, self, aux)
    138  1.14.8.2   thorpej 	struct device *parent, *self;
    139       1.1  jonathan 	void *aux;
    140       1.1  jonathan {
    141  1.14.8.2   thorpej 	struct tc_attach_args *ta = aux;
    142  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)self;
    143  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc = &asc->sc_ncr53c9x;
    144       1.1  jonathan 
    145       1.1  jonathan 	/*
    146  1.14.8.2   thorpej 	 * Set up glue for MI code early; we use some of it here.
    147       1.1  jonathan 	 */
    148  1.14.8.2   thorpej 	sc->sc_glue = &asc_tc_glue;
    149  1.14.8.2   thorpej 	asc->sc_bst = ta->ta_memt;
    150  1.14.8.2   thorpej 	asc->sc_dmat = ta->ta_dmat;
    151  1.14.8.2   thorpej 	if (bus_space_map(asc->sc_bst, ta->ta_addr,
    152  1.14.8.2   thorpej 		PMAZ_OFFSET_RAM + PMAZ_RAM_SIZE, 0, &asc->sc_bsh)) {
    153  1.14.8.2   thorpej 		printf("%s: unable to map device\n", sc->sc_dev.dv_xname);
    154  1.14.8.2   thorpej 		return;
    155  1.14.8.2   thorpej 	}
    156  1.14.8.2   thorpej 	asc->sc_base = (caddr_t)ta->ta_addr;	/* XXX XXX XXX */
    157  1.14.8.2   thorpej 
    158  1.14.8.2   thorpej 	tc_intr_establish(parent, ta->ta_cookie, IPL_BIO, ncr53c9x_intr, sc);
    159  1.14.8.2   thorpej 
    160  1.14.8.2   thorpej 	sc->sc_id = 7;
    161  1.14.8.2   thorpej 	sc->sc_freq = (ta->ta_busspeed) ? 25000000 : 12500000;
    162  1.14.8.2   thorpej 
    163  1.14.8.2   thorpej 	/* gimme Mhz */
    164  1.14.8.2   thorpej 	sc->sc_freq /= 1000000;
    165       1.1  jonathan 
    166       1.1  jonathan 	/*
    167  1.14.8.2   thorpej 	 * XXX More of this should be in ncr53c9x_attach(), but
    168  1.14.8.2   thorpej 	 * XXX should we really poke around the chip that much in
    169  1.14.8.2   thorpej 	 * XXX the MI code?  Think about this more...
    170       1.1  jonathan 	 */
    171       1.1  jonathan 
    172       1.1  jonathan 	/*
    173  1.14.8.2   thorpej 	 * Set up static configuration info.
    174       1.1  jonathan 	 */
    175  1.14.8.2   thorpej 	sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB;
    176  1.14.8.2   thorpej 	sc->sc_cfg2 = NCRCFG2_SCSI2;
    177  1.14.8.2   thorpej 	sc->sc_cfg3 = 0;
    178  1.14.8.2   thorpej 	sc->sc_rev = NCR_VARIANT_NCR53C94;
    179       1.7    mhitch 
    180       1.7    mhitch 	/*
    181  1.14.8.2   thorpej 	 * XXX minsync and maxxfer _should_ be set up in MI code,
    182  1.14.8.2   thorpej 	 * XXX but it appears to have some dependency on what sort
    183  1.14.8.2   thorpej 	 * XXX of DMA we're hooked up to, etc.
    184       1.7    mhitch 	 */
    185       1.7    mhitch 
    186       1.7    mhitch 	/*
    187  1.14.8.2   thorpej 	 * This is the value used to start sync negotiations
    188  1.14.8.2   thorpej 	 * Note that the NCR register "SYNCTP" is programmed
    189  1.14.8.2   thorpej 	 * in "clocks per byte", and has a minimum value of 4.
    190  1.14.8.2   thorpej 	 * The SCSI period used in negotiation is one-fourth
    191  1.14.8.2   thorpej 	 * of the time (in nanoseconds) needed to transfer one byte.
    192  1.14.8.2   thorpej 	 * Since the chip's clock is given in MHz, we have the following
    193  1.14.8.2   thorpej 	 * formula: 4 * period = (1000 / freq) * 4
    194       1.7    mhitch 	 */
    195  1.14.8.2   thorpej 	sc->sc_minsync = (1000 / sc->sc_freq) * 5 / 4;
    196       1.7    mhitch 
    197  1.14.8.2   thorpej 	sc->sc_maxxfer = 64 * 1024;
    198       1.1  jonathan 
    199  1.14.8.2   thorpej 	/* Do the common parts of attachment. */
    200  1.14.8.2   thorpej 	sc->sc_adapter.adapt_minphys = minphys;
    201  1.14.8.2   thorpej 	sc->sc_adapter.adapt_request = ncr53c9x_scsipi_request;
    202  1.14.8.2   thorpej 	ncr53c9x_attach(sc);
    203  1.14.8.2   thorpej }
    204  1.14.8.2   thorpej 
    205  1.14.8.2   thorpej static void
    206  1.14.8.2   thorpej asc_tc_reset(sc)
    207  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    208  1.14.8.2   thorpej {
    209  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    210       1.1  jonathan 
    211  1.14.8.2   thorpej 	asc->sc_active = 0;
    212       1.1  jonathan }
    213       1.1  jonathan 
    214  1.14.8.2   thorpej static int
    215  1.14.8.2   thorpej asc_tc_intr(sc)
    216  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    217  1.14.8.2   thorpej {
    218  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    219  1.14.8.2   thorpej 	int trans, resid;
    220  1.14.8.2   thorpej 
    221  1.14.8.2   thorpej 	resid = 0;
    222  1.14.8.2   thorpej 	if (!asc->sc_ispullup &&
    223  1.14.8.2   thorpej 	    (resid = (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF)) != 0) {
    224  1.14.8.2   thorpej 		NCR_DMA(("asc_tc_intr: empty FIFO of %d ", resid));
    225  1.14.8.2   thorpej 		DELAY(1);
    226  1.14.8.2   thorpej 	}
    227  1.14.8.2   thorpej 
    228  1.14.8.2   thorpej 	resid += NCR_READ_REG(sc, NCR_TCL);
    229  1.14.8.2   thorpej 	resid += NCR_READ_REG(sc, NCR_TCM) << 8;
    230  1.14.8.2   thorpej 
    231  1.14.8.2   thorpej 	trans = asc->sc_dmasize - resid;
    232  1.14.8.2   thorpej 
    233  1.14.8.2   thorpej 	if (asc->sc_ispullup)
    234  1.14.8.2   thorpej 		memcpy(asc->sc_target, asc->sc_bounce, trans);
    235  1.14.8.2   thorpej 	*asc->sc_dmalen -= trans;
    236  1.14.8.2   thorpej 	*asc->sc_dmaaddr += trans;
    237  1.14.8.2   thorpej 	asc->sc_active = 0;
    238  1.14.8.2   thorpej 
    239  1.14.8.2   thorpej 	return (0);
    240  1.14.8.2   thorpej }
    241  1.14.8.2   thorpej 
    242  1.14.8.2   thorpej static int
    243  1.14.8.2   thorpej asc_tc_setup(sc, addr, len, datain, dmasize)
    244  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    245  1.14.8.2   thorpej 	caddr_t *addr;
    246  1.14.8.2   thorpej 	size_t *len;
    247  1.14.8.2   thorpej 	int datain;
    248  1.14.8.2   thorpej 	size_t *dmasize;
    249  1.14.8.2   thorpej {
    250  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    251  1.14.8.2   thorpej 	u_int32_t tc_dmar;
    252  1.14.8.2   thorpej 	size_t size;
    253  1.14.8.2   thorpej 
    254  1.14.8.2   thorpej 	asc->sc_dmaaddr = addr;
    255  1.14.8.2   thorpej 	asc->sc_dmalen = len;
    256  1.14.8.2   thorpej 	asc->sc_ispullup = datain;
    257  1.14.8.2   thorpej 
    258  1.14.8.2   thorpej 	NCR_DMA(("asc_tc_setup: start %ld@%p, %s\n", (long)*asc->sc_dmalen,
    259  1.14.8.2   thorpej 		*asc->sc_dmaaddr, datain ? "IN" : "OUT"));
    260  1.14.8.2   thorpej 
    261  1.14.8.2   thorpej 	size = *dmasize;
    262  1.14.8.2   thorpej 	if (size > PER_TGT_DMA_SIZE)
    263  1.14.8.2   thorpej 		size = PER_TGT_DMA_SIZE;
    264  1.14.8.2   thorpej 	*dmasize = asc->sc_dmasize = size;
    265  1.14.8.2   thorpej 
    266  1.14.8.2   thorpej 	NCR_DMA(("asc_tc_setup: dmasize = %ld\n", (long)asc->sc_dmasize));
    267  1.14.8.2   thorpej 
    268  1.14.8.2   thorpej 	asc->sc_bounce = asc->sc_base + PMAZ_OFFSET_RAM;
    269  1.14.8.2   thorpej 	asc->sc_bounce += PER_TGT_DMA_SIZE *
    270  1.14.8.2   thorpej 	    sc->sc_nexus->xs->xs_periph->periph_target;
    271  1.14.8.2   thorpej 	asc->sc_target = *addr;
    272  1.14.8.2   thorpej 
    273  1.14.8.2   thorpej 	if (!asc->sc_ispullup)
    274  1.14.8.2   thorpej 		memcpy(asc->sc_bounce, asc->sc_target, size);
    275  1.14.8.2   thorpej 
    276  1.14.8.2   thorpej #if 1
    277  1.14.8.2   thorpej 	if (asc->sc_ispullup)
    278  1.14.8.2   thorpej 		tc_dmar = PMAZ_DMA_ADDR(asc->sc_bounce);
    279  1.14.8.2   thorpej 	else
    280  1.14.8.2   thorpej 		tc_dmar = PMAZ_DMAR_WRITE | PMAZ_DMA_ADDR(asc->sc_bounce);
    281  1.14.8.2   thorpej 	bus_space_write_4(asc->sc_bst, asc->sc_bsh, PMAZ_OFFSET_DMAR, tc_dmar);
    282  1.14.8.2   thorpej 	asc->sc_active = 1;
    283  1.14.8.2   thorpej #endif
    284  1.14.8.2   thorpej 	return (0);
    285  1.14.8.2   thorpej }
    286  1.14.8.2   thorpej 
    287  1.14.8.2   thorpej static void
    288  1.14.8.2   thorpej asc_tc_go(sc)
    289  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    290  1.14.8.2   thorpej {
    291  1.14.8.2   thorpej #if 0
    292  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    293  1.14.8.2   thorpej 	u_int32_t tc_dmar;
    294  1.14.8.2   thorpej 
    295  1.14.8.2   thorpej 	if (asc->sc_ispullup)
    296  1.14.8.2   thorpej 		tc_dmar = PMAZ_DMA_ADDR(asc->sc_bounce);
    297  1.14.8.2   thorpej 	else
    298  1.14.8.2   thorpej 		tc_dmar = PMAZ_DMAR_WRITE | PMAZ_DMA_ADDR(asc->sc_bounce);
    299  1.14.8.2   thorpej 	bus_space_write_4(asc->sc_bst, asc->sc_bsh, PMAZ_OFFSET_DMAR, tc_dmar);
    300  1.14.8.2   thorpej 	asc->sc_active = 1;
    301  1.14.8.2   thorpej #endif
    302  1.14.8.2   thorpej }
    303  1.14.8.2   thorpej 
    304  1.14.8.2   thorpej /* NEVER CALLED BY MI 53C9x ENGINE INDEED */
    305  1.14.8.2   thorpej static void
    306  1.14.8.2   thorpej asc_tc_stop(sc)
    307  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    308  1.14.8.2   thorpej {
    309  1.14.8.2   thorpej #if 0
    310  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    311  1.14.8.2   thorpej 
    312  1.14.8.2   thorpej 	if (asc->sc_ispullup)
    313  1.14.8.2   thorpej 		memcpy(asc->sc_target, asc->sc_bounce, asc->sc_dmasize);
    314  1.14.8.2   thorpej 	asc->sc_active = 0;
    315  1.14.8.2   thorpej #endif
    316  1.14.8.2   thorpej }
    317       1.1  jonathan 
    318       1.1  jonathan /*
    319  1.14.8.2   thorpej  * Glue functions.
    320       1.1  jonathan  */
    321  1.14.8.2   thorpej static u_char
    322  1.14.8.2   thorpej asc_read_reg(sc, reg)
    323  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    324  1.14.8.2   thorpej 	int reg;
    325  1.14.8.2   thorpej {
    326  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    327  1.14.8.2   thorpej 	u_char v;
    328  1.14.8.2   thorpej 
    329  1.14.8.2   thorpej 	v = bus_space_read_4(asc->sc_bst, asc->sc_bsh,
    330  1.14.8.2   thorpej 	    reg * sizeof(u_int32_t)) & 0xff;
    331  1.14.8.2   thorpej 
    332  1.14.8.2   thorpej 	return (v);
    333  1.14.8.2   thorpej }
    334  1.14.8.2   thorpej 
    335  1.14.8.2   thorpej static void
    336  1.14.8.2   thorpej asc_write_reg(sc, reg, val)
    337  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    338  1.14.8.2   thorpej 	int reg;
    339  1.14.8.2   thorpej 	u_char val;
    340  1.14.8.2   thorpej {
    341  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    342  1.14.8.2   thorpej 
    343  1.14.8.2   thorpej 	bus_space_write_4(asc->sc_bst, asc->sc_bsh,
    344  1.14.8.2   thorpej 	    reg * sizeof(u_int32_t), val);
    345  1.14.8.2   thorpej }
    346  1.14.8.2   thorpej 
    347  1.14.8.2   thorpej static int
    348  1.14.8.2   thorpej asc_dma_isintr(sc)
    349  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    350  1.14.8.2   thorpej {
    351  1.14.8.2   thorpej 	return !!(NCR_READ_REG(sc, NCR_STAT) & NCRSTAT_INT);
    352  1.14.8.2   thorpej }
    353  1.14.8.2   thorpej 
    354       1.7    mhitch static int
    355  1.14.8.2   thorpej asc_dma_isactive(sc)
    356  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    357       1.1  jonathan {
    358  1.14.8.2   thorpej 	struct asc_softc *asc = (struct asc_softc *)sc;
    359       1.1  jonathan 
    360  1.14.8.2   thorpej 	return (asc->sc_active);
    361       1.1  jonathan }
    362       1.1  jonathan 
    363       1.1  jonathan static void
    364  1.14.8.2   thorpej asc_clear_latched_intr(sc)
    365  1.14.8.2   thorpej 	struct ncr53c9x_softc *sc;
    366       1.1  jonathan {
    367       1.1  jonathan }
    368