Home | History | Annotate | Line # | Download | only in dev
esp.c revision 1.1
      1  1.1  dbj /*	$NetBSD: esp.c,v 1.1 1998/07/05 07:53:45 dbj Exp $	*/
      2  1.1  dbj 
      3  1.1  dbj /*-
      4  1.1  dbj  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  1.1  dbj  * All rights reserved.
      6  1.1  dbj  *
      7  1.1  dbj  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  dbj  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.1  dbj  * NASA Ames Research Center.
     10  1.1  dbj  *
     11  1.1  dbj  * Redistribution and use in source and binary forms, with or without
     12  1.1  dbj  * modification, are permitted provided that the following conditions
     13  1.1  dbj  * are met:
     14  1.1  dbj  * 1. Redistributions of source code must retain the above copyright
     15  1.1  dbj  *    notice, this list of conditions and the following disclaimer.
     16  1.1  dbj  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1  dbj  *    notice, this list of conditions and the following disclaimer in the
     18  1.1  dbj  *    documentation and/or other materials provided with the distribution.
     19  1.1  dbj  * 3. All advertising materials mentioning features or use of this software
     20  1.1  dbj  *    must display the following acknowledgement:
     21  1.1  dbj  *	This product includes software developed by the NetBSD
     22  1.1  dbj  *	Foundation, Inc. and its contributors.
     23  1.1  dbj  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.1  dbj  *    contributors may be used to endorse or promote products derived
     25  1.1  dbj  *    from this software without specific prior written permission.
     26  1.1  dbj  *
     27  1.1  dbj  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.1  dbj  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.1  dbj  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.1  dbj  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.1  dbj  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.1  dbj  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.1  dbj  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.1  dbj  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.1  dbj  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.1  dbj  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.1  dbj  * POSSIBILITY OF SUCH DAMAGE.
     38  1.1  dbj  */
     39  1.1  dbj 
     40  1.1  dbj /*
     41  1.1  dbj  * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.
     42  1.1  dbj  *
     43  1.1  dbj  * Redistribution and use in source and binary forms, with or without
     44  1.1  dbj  * modification, are permitted provided that the following conditions
     45  1.1  dbj  * are met:
     46  1.1  dbj  * 1. Redistributions of source code must retain the above copyright
     47  1.1  dbj  *    notice, this list of conditions and the following disclaimer.
     48  1.1  dbj  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1  dbj  *    notice, this list of conditions and the following disclaimer in the
     50  1.1  dbj  *    documentation and/or other materials provided with the distribution.
     51  1.1  dbj  * 3. All advertising materials mentioning features or use of this software
     52  1.1  dbj  *    must display the following acknowledgement:
     53  1.1  dbj  *	This product includes software developed by Charles M. Hannum.
     54  1.1  dbj  * 4. The name of the author may not be used to endorse or promote products
     55  1.1  dbj  *    derived from this software without specific prior written permission.
     56  1.1  dbj  *
     57  1.1  dbj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     58  1.1  dbj  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     59  1.1  dbj  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     60  1.1  dbj  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     61  1.1  dbj  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     62  1.1  dbj  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     63  1.1  dbj  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     64  1.1  dbj  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     65  1.1  dbj  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     66  1.1  dbj  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     67  1.1  dbj  */
     68  1.1  dbj 
     69  1.1  dbj /*
     70  1.1  dbj  * Copyright (c) 1994 Peter Galbavy
     71  1.1  dbj  * Copyright (c) 1995 Paul Kranenburg
     72  1.1  dbj  * All rights reserved.
     73  1.1  dbj  *
     74  1.1  dbj  * Redistribution and use in source and binary forms, with or without
     75  1.1  dbj  * modification, are permitted provided that the following conditions
     76  1.1  dbj  * are met:
     77  1.1  dbj  * 1. Redistributions of source code must retain the above copyright
     78  1.1  dbj  *    notice, this list of conditions and the following disclaimer.
     79  1.1  dbj  * 2. Redistributions in binary form must reproduce the above copyright
     80  1.1  dbj  *    notice, this list of conditions and the following disclaimer in the
     81  1.1  dbj  *    documentation and/or other materials provided with the distribution.
     82  1.1  dbj  * 3. All advertising materials mentioning features or use of this software
     83  1.1  dbj  *    must display the following acknowledgement:
     84  1.1  dbj  *	This product includes software developed by Peter Galbavy
     85  1.1  dbj  * 4. The name of the author may not be used to endorse or promote products
     86  1.1  dbj  *    derived from this software without specific prior written permission.
     87  1.1  dbj  *
     88  1.1  dbj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     89  1.1  dbj  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     90  1.1  dbj  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     91  1.1  dbj  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     92  1.1  dbj  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     93  1.1  dbj  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     94  1.1  dbj  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     95  1.1  dbj  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     96  1.1  dbj  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     97  1.1  dbj  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     98  1.1  dbj  * POSSIBILITY OF SUCH DAMAGE.
     99  1.1  dbj  */
    100  1.1  dbj 
    101  1.1  dbj /*
    102  1.1  dbj  * Based on aic6360 by Jarle Greipsland
    103  1.1  dbj  *
    104  1.1  dbj  * Acknowledgements: Many of the algorithms used in this driver are
    105  1.1  dbj  * inspired by the work of Julian Elischer (julian (at) tfs.com) and
    106  1.1  dbj  * Charles Hannum (mycroft (at) duality.gnu.ai.mit.edu).  Thanks a million!
    107  1.1  dbj  */
    108  1.1  dbj 
    109  1.1  dbj /*
    110  1.1  dbj  * Grabbed from the sparc port at revision 1.73 for the NeXT.
    111  1.1  dbj  * Darrin B. Jewell <dbj (at) netbsd.org>  Sat Jul  4 15:41:32 1998
    112  1.1  dbj  */
    113  1.1  dbj 
    114  1.1  dbj #include <sys/types.h>
    115  1.1  dbj #include <sys/param.h>
    116  1.1  dbj #include <sys/systm.h>
    117  1.1  dbj #include <sys/kernel.h>
    118  1.1  dbj #include <sys/errno.h>
    119  1.1  dbj #include <sys/ioctl.h>
    120  1.1  dbj #include <sys/device.h>
    121  1.1  dbj #include <sys/buf.h>
    122  1.1  dbj #include <sys/proc.h>
    123  1.1  dbj #include <sys/user.h>
    124  1.1  dbj #include <sys/queue.h>
    125  1.1  dbj 
    126  1.1  dbj #include <dev/scsipi/scsi_all.h>
    127  1.1  dbj #include <dev/scsipi/scsipi_all.h>
    128  1.1  dbj #include <dev/scsipi/scsiconf.h>
    129  1.1  dbj #include <dev/scsipi/scsi_message.h>
    130  1.1  dbj 
    131  1.1  dbj #include <machine/bus.h>
    132  1.1  dbj #include <machine/autoconf.h>
    133  1.1  dbj #include <machine/cpu.h>
    134  1.1  dbj 
    135  1.1  dbj #include <dev/ic/ncr53c9xreg.h>
    136  1.1  dbj #include <dev/ic/ncr53c9xvar.h>
    137  1.1  dbj 
    138  1.1  dbj #include <next68k/next68k/isr.h>
    139  1.1  dbj 
    140  1.1  dbj #include <next68k/dev/nextdmareg.h>
    141  1.1  dbj #include <next68k/dev/nextdmavar.h>
    142  1.1  dbj 
    143  1.1  dbj #include "espreg.h"
    144  1.1  dbj #include "espvar.h"
    145  1.1  dbj 
    146  1.1  dbj void	espattach_intio	__P((struct device *, struct device *, void *));
    147  1.1  dbj int	espmatch_intio	__P((struct device *, struct cfdata *, void *));
    148  1.1  dbj 
    149  1.1  dbj void	espattach	__P((struct esp_softc *));
    150  1.1  dbj 
    151  1.1  dbj /* Linkup to the rest of the kernel */
    152  1.1  dbj struct cfattach esp_ca = {
    153  1.1  dbj 	sizeof(struct esp_softc), espmatch_intio, espattach_intio
    154  1.1  dbj };
    155  1.1  dbj 
    156  1.1  dbj struct scsipi_adapter esp_switch = {
    157  1.1  dbj 	ncr53c9x_scsi_cmd,
    158  1.1  dbj 	minphys,		/* no max at this level; handled by DMA code */
    159  1.1  dbj 	NULL,
    160  1.1  dbj 	NULL,
    161  1.1  dbj };
    162  1.1  dbj 
    163  1.1  dbj struct scsipi_device esp_dev = {
    164  1.1  dbj 	NULL,			/* Use default error handler */
    165  1.1  dbj 	NULL,			/* have a queue, served by this */
    166  1.1  dbj 	NULL,			/* have no async handler */
    167  1.1  dbj 	NULL,			/* Use default 'done' routine */
    168  1.1  dbj };
    169  1.1  dbj 
    170  1.1  dbj /*
    171  1.1  dbj  * Functions and the switch for the MI code.
    172  1.1  dbj  */
    173  1.1  dbj u_char	esp_read_reg __P((struct ncr53c9x_softc *, int));
    174  1.1  dbj void	esp_write_reg __P((struct ncr53c9x_softc *, int, u_char));
    175  1.1  dbj int	esp_dma_isintr __P((struct ncr53c9x_softc *));
    176  1.1  dbj void	esp_dma_reset __P((struct ncr53c9x_softc *));
    177  1.1  dbj int	esp_dma_intr __P((struct ncr53c9x_softc *));
    178  1.1  dbj int	esp_dma_setup __P((struct ncr53c9x_softc *, caddr_t *,
    179  1.1  dbj 	    size_t *, int, size_t *));
    180  1.1  dbj void	esp_dma_go __P((struct ncr53c9x_softc *));
    181  1.1  dbj void	esp_dma_stop __P((struct ncr53c9x_softc *));
    182  1.1  dbj int	esp_dma_isactive __P((struct ncr53c9x_softc *));
    183  1.1  dbj 
    184  1.1  dbj struct ncr53c9x_glue esp_glue = {
    185  1.1  dbj 	esp_read_reg,
    186  1.1  dbj 	esp_write_reg,
    187  1.1  dbj 	esp_dma_isintr,
    188  1.1  dbj 	esp_dma_reset,
    189  1.1  dbj 	esp_dma_intr,
    190  1.1  dbj 	esp_dma_setup,
    191  1.1  dbj 	esp_dma_go,
    192  1.1  dbj 	esp_dma_stop,
    193  1.1  dbj 	esp_dma_isactive,
    194  1.1  dbj 	NULL,			/* gl_clear_latched_intr */
    195  1.1  dbj };
    196  1.1  dbj 
    197  1.1  dbj int
    198  1.1  dbj espmatch_intio(parent, cf, aux)
    199  1.1  dbj 	struct device *parent;
    200  1.1  dbj 	struct cfdata *cf;
    201  1.1  dbj 	void *aux;
    202  1.1  dbj {
    203  1.1  dbj   /* should probably probe here */
    204  1.1  dbj   /* Should also probably set up data from config */
    205  1.1  dbj 
    206  1.1  dbj /* this code isn't working yet, don't match on it */
    207  1.1  dbj 	return(0);
    208  1.1  dbj }
    209  1.1  dbj 
    210  1.1  dbj void
    211  1.1  dbj espattach_intio(parent, self, aux)
    212  1.1  dbj 	struct device *parent, *self;
    213  1.1  dbj 	void *aux;
    214  1.1  dbj {
    215  1.1  dbj 	struct esp_softc *esc = (void *)self;
    216  1.1  dbj 	struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x;
    217  1.1  dbj 
    218  1.1  dbj 	esc->sc_bst = NEXT68K_INTIO_BUS_SPACE;
    219  1.1  dbj 	if (bus_space_map(esc->sc_bst, NEXT_P_SCSI,
    220  1.1  dbj 			ESP_DEVICE_SIZE, 0, &esc->sc_bsh)) {
    221  1.1  dbj     panic("\n%s: can't map ncr53c90 registers\n",
    222  1.1  dbj 				sc->sc_dev.dv_xname);
    223  1.1  dbj 	}
    224  1.1  dbj 
    225  1.1  dbj 	sc->sc_id = 7;
    226  1.1  dbj 	sc->sc_freq = 20;							/* Mhz */
    227  1.1  dbj 
    228  1.1  dbj 	/* @@@ Some ESP_DCTL bits probably need setting */
    229  1.1  dbj 
    230  1.1  dbj 	/* Set up SCSI DMA */
    231  1.1  dbj 	{
    232  1.1  dbj 		esc->sc_scsi_dma.nd_bst = NEXT68K_INTIO_BUS_SPACE;
    233  1.1  dbj 
    234  1.1  dbj 		if (bus_space_map(esc->sc_scsi_dma.nd_bst, NEXT_P_SCSI_CSR,
    235  1.1  dbj 				sizeof(struct dma_dev),0, &esc->sc_scsi_dma.nd_bsh)) {
    236  1.1  dbj 			panic("\n%s: can't map scsi DMA registers\n",
    237  1.1  dbj 					sc->sc_dev.dv_xname);
    238  1.1  dbj 		}
    239  1.1  dbj 
    240  1.1  dbj 		esc->sc_scsi_dma.nd_intr = NEXT_I_SCSI_DMA;
    241  1.1  dbj 		esc->sc_scsi_dma.nd_chaining_flag = 0;
    242  1.1  dbj 		esc->sc_scsi_dma.nd_shutdown_cb  = NULL;
    243  1.1  dbj 		esc->sc_scsi_dma.nd_continue_cb  = NULL;
    244  1.1  dbj 		esc->sc_scsi_dma.nd_completed_cb = NULL;
    245  1.1  dbj 		esc->sc_scsi_dma.nd_cb_arg       = NULL;
    246  1.1  dbj 		nextdma_config(&esc->sc_scsi_dma);
    247  1.1  dbj 
    248  1.1  dbj 	}
    249  1.1  dbj 
    250  1.1  dbj 	espattach(esc);
    251  1.1  dbj }
    252  1.1  dbj /*
    253  1.1  dbj  * Attach this instance, and then all the sub-devices
    254  1.1  dbj  */
    255  1.1  dbj void
    256  1.1  dbj espattach(esc)
    257  1.1  dbj 	struct esp_softc *esc;
    258  1.1  dbj {
    259  1.1  dbj 	struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x;
    260  1.1  dbj 
    261  1.1  dbj 	/*
    262  1.1  dbj 	 * Set up glue for MI code early; we use some of it here.
    263  1.1  dbj 	 */
    264  1.1  dbj 	sc->sc_glue = &esp_glue;
    265  1.1  dbj 
    266  1.1  dbj 	/*
    267  1.1  dbj 	 * XXX More of this should be in ncr53c9x_attach(), but
    268  1.1  dbj 	 * XXX should we really poke around the chip that much in
    269  1.1  dbj 	 * XXX the MI code?  Think about this more...
    270  1.1  dbj 	 */
    271  1.1  dbj 
    272  1.1  dbj 	/*
    273  1.1  dbj 	 * It is necessary to try to load the 2nd config register here,
    274  1.1  dbj 	 * to find out what rev the esp chip is, else the ncr53c9x_reset
    275  1.1  dbj 	 * will not set up the defaults correctly.
    276  1.1  dbj 	 */
    277  1.1  dbj 	sc->sc_cfg1 = sc->sc_id | NCRCFG1_PARENB;
    278  1.1  dbj 	sc->sc_cfg2 = NCRCFG2_SCSI2 | NCRCFG2_RPE;
    279  1.1  dbj 	sc->sc_cfg3 = NCRCFG3_CDB;
    280  1.1  dbj 	NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2);
    281  1.1  dbj 
    282  1.1  dbj 	if ((NCR_READ_REG(sc, NCR_CFG2) & ~NCRCFG2_RSVD) !=
    283  1.1  dbj 	    (NCRCFG2_SCSI2 | NCRCFG2_RPE)) {
    284  1.1  dbj 		sc->sc_rev = NCR_VARIANT_ESP100;
    285  1.1  dbj 	} else {
    286  1.1  dbj 		sc->sc_cfg2 = NCRCFG2_SCSI2;
    287  1.1  dbj 		NCR_WRITE_REG(sc, NCR_CFG2, sc->sc_cfg2);
    288  1.1  dbj 		sc->sc_cfg3 = 0;
    289  1.1  dbj 		NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    290  1.1  dbj 		sc->sc_cfg3 = (NCRCFG3_CDB | NCRCFG3_FCLK);
    291  1.1  dbj 		NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    292  1.1  dbj 		if (NCR_READ_REG(sc, NCR_CFG3) !=
    293  1.1  dbj 		    (NCRCFG3_CDB | NCRCFG3_FCLK)) {
    294  1.1  dbj 			sc->sc_rev = NCR_VARIANT_ESP100A;
    295  1.1  dbj 		} else {
    296  1.1  dbj 			/* NCRCFG2_FE enables > 64K transfers */
    297  1.1  dbj 			sc->sc_cfg2 |= NCRCFG2_FE;
    298  1.1  dbj 			sc->sc_cfg3 = 0;
    299  1.1  dbj 			NCR_WRITE_REG(sc, NCR_CFG3, sc->sc_cfg3);
    300  1.1  dbj 			sc->sc_rev = NCR_VARIANT_ESP200;
    301  1.1  dbj 		}
    302  1.1  dbj 	}
    303  1.1  dbj 
    304  1.1  dbj 	/*
    305  1.1  dbj 	 * XXX minsync and maxxfer _should_ be set up in MI code,
    306  1.1  dbj 	 * XXX but it appears to have some dependency on what sort
    307  1.1  dbj 	 * XXX of DMA we're hooked up to, etc.
    308  1.1  dbj 	 */
    309  1.1  dbj 
    310  1.1  dbj 	/*
    311  1.1  dbj 	 * This is the value used to start sync negotiations
    312  1.1  dbj 	 * Note that the NCR register "SYNCTP" is programmed
    313  1.1  dbj 	 * in "clocks per byte", and has a minimum value of 4.
    314  1.1  dbj 	 * The SCSI period used in negotiation is one-fourth
    315  1.1  dbj 	 * of the time (in nanoseconds) needed to transfer one byte.
    316  1.1  dbj 	 * Since the chip's clock is given in MHz, we have the following
    317  1.1  dbj 	 * formula: 4 * period = (1000 / freq) * 4
    318  1.1  dbj 	 */
    319  1.1  dbj 	sc->sc_minsync = 1000 / sc->sc_freq;
    320  1.1  dbj 
    321  1.1  dbj 	/*
    322  1.1  dbj 	 * Alas, we must now modify the value a bit, because it's
    323  1.1  dbj 	 * only valid when can switch on FASTCLK and FASTSCSI bits
    324  1.1  dbj 	 * in config register 3...
    325  1.1  dbj 	 */
    326  1.1  dbj 	switch (sc->sc_rev) {
    327  1.1  dbj 	case NCR_VARIANT_ESP100:
    328  1.1  dbj 		sc->sc_maxxfer = 64 * 1024;
    329  1.1  dbj 		sc->sc_minsync = 0;	/* No synch on old chip? */
    330  1.1  dbj 		break;
    331  1.1  dbj 
    332  1.1  dbj 	case NCR_VARIANT_ESP100A:
    333  1.1  dbj 		sc->sc_maxxfer = 64 * 1024;
    334  1.1  dbj 		/* Min clocks/byte is 5 */
    335  1.1  dbj 		sc->sc_minsync = ncr53c9x_cpb2stp(sc, 5);
    336  1.1  dbj 		break;
    337  1.1  dbj 
    338  1.1  dbj 	case NCR_VARIANT_ESP200:
    339  1.1  dbj 		sc->sc_maxxfer = 16 * 1024 * 1024;
    340  1.1  dbj 		/* XXX - do actually set FAST* bits */
    341  1.1  dbj 		break;
    342  1.1  dbj 	}
    343  1.1  dbj 
    344  1.1  dbj 	/* Establish interrupt channel */
    345  1.1  dbj 	isrlink_autovec((int(*)__P((void*)))ncr53c9x_intr, sc,
    346  1.1  dbj 			NEXT_I_IPL(NEXT_I_SCSI), 0);
    347  1.1  dbj 	INTR_ENABLE(NEXT_I_SCSI);
    348  1.1  dbj 
    349  1.1  dbj 	/* register interrupt stats */
    350  1.1  dbj 	evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
    351  1.1  dbj 
    352  1.1  dbj 	/* Do the common parts of attachment. */
    353  1.1  dbj 	ncr53c9x_attach(sc, &esp_switch, &esp_dev);
    354  1.1  dbj 
    355  1.1  dbj #if 0
    356  1.1  dbj 	/* Turn on target selection using the `dma' method */
    357  1.1  dbj 	ncr53c9x_dmaselect = 1;
    358  1.1  dbj 
    359  1.1  dbj 	bootpath_store(1, NULL);
    360  1.1  dbj #endif
    361  1.1  dbj 
    362  1.1  dbj }
    363  1.1  dbj 
    364  1.1  dbj /*
    365  1.1  dbj  * Glue functions.
    366  1.1  dbj  */
    367  1.1  dbj 
    368  1.1  dbj u_char
    369  1.1  dbj esp_read_reg(sc, reg)
    370  1.1  dbj 	struct ncr53c9x_softc *sc;
    371  1.1  dbj 	int reg;
    372  1.1  dbj {
    373  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    374  1.1  dbj 
    375  1.1  dbj 	return(bus_space_read_1(esc->sc_bst, esc->sc_bsh, reg));
    376  1.1  dbj }
    377  1.1  dbj 
    378  1.1  dbj void
    379  1.1  dbj esp_write_reg(sc, reg, val)
    380  1.1  dbj 	struct ncr53c9x_softc *sc;
    381  1.1  dbj 	int reg;
    382  1.1  dbj 	u_char val;
    383  1.1  dbj {
    384  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    385  1.1  dbj 
    386  1.1  dbj 	bus_space_write_1(esc->sc_bst, esc->sc_bsh, reg, val);
    387  1.1  dbj }
    388  1.1  dbj 
    389  1.1  dbj int
    390  1.1  dbj esp_dma_isintr(sc)
    391  1.1  dbj 	struct ncr53c9x_softc *sc;
    392  1.1  dbj {
    393  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    394  1.1  dbj 	panic("Not yet implemented");
    395  1.1  dbj 	return (0);
    396  1.1  dbj }
    397  1.1  dbj 
    398  1.1  dbj void
    399  1.1  dbj esp_dma_reset(sc)
    400  1.1  dbj 	struct ncr53c9x_softc *sc;
    401  1.1  dbj {
    402  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    403  1.1  dbj 	panic("Not yet implemented");
    404  1.1  dbj }
    405  1.1  dbj 
    406  1.1  dbj int
    407  1.1  dbj esp_dma_intr(sc)
    408  1.1  dbj 	struct ncr53c9x_softc *sc;
    409  1.1  dbj {
    410  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    411  1.1  dbj 	panic("Not yet implemented");
    412  1.1  dbj 	return (0);
    413  1.1  dbj }
    414  1.1  dbj 
    415  1.1  dbj int
    416  1.1  dbj esp_dma_setup(sc, addr, len, datain, dmasize)
    417  1.1  dbj 	struct ncr53c9x_softc *sc;
    418  1.1  dbj 	caddr_t *addr;
    419  1.1  dbj 	size_t *len;
    420  1.1  dbj 	int datain;
    421  1.1  dbj 	size_t *dmasize;
    422  1.1  dbj {
    423  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    424  1.1  dbj 	panic("Not yet implemented");
    425  1.1  dbj 	return (0);
    426  1.1  dbj }
    427  1.1  dbj 
    428  1.1  dbj void
    429  1.1  dbj esp_dma_go(sc)
    430  1.1  dbj 	struct ncr53c9x_softc *sc;
    431  1.1  dbj {
    432  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    433  1.1  dbj 	panic("Not yet implemented");
    434  1.1  dbj }
    435  1.1  dbj 
    436  1.1  dbj void
    437  1.1  dbj esp_dma_stop(sc)
    438  1.1  dbj 	struct ncr53c9x_softc *sc;
    439  1.1  dbj {
    440  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    441  1.1  dbj 	panic("Not yet implemented");
    442  1.1  dbj }
    443  1.1  dbj 
    444  1.1  dbj int
    445  1.1  dbj esp_dma_isactive(sc)
    446  1.1  dbj 	struct ncr53c9x_softc *sc;
    447  1.1  dbj {
    448  1.1  dbj 	struct esp_softc *esc = (struct esp_softc *)sc;
    449  1.1  dbj 	panic("Not yet implemented");
    450  1.1  dbj 	return(0);
    451  1.1  dbj }
    452