Home | History | Annotate | Line # | Download | only in podulebus
cosc.c revision 1.13.80.1
      1  1.13.80.1     yamt /*	$NetBSD: cosc.c,v 1.13.80.1 2009/05/04 08:10:26 yamt Exp $	*/
      2        1.1  reinoud 
      3        1.1  reinoud /*
      4        1.1  reinoud  * Copyright (c) 1996 Mark Brinicombe
      5        1.1  reinoud  * All rights reserved.
      6        1.1  reinoud  *
      7        1.1  reinoud  * Redistribution and use in source and binary forms, with or without
      8        1.1  reinoud  * modification, are permitted provided that the following conditions
      9        1.1  reinoud  * are met:
     10        1.1  reinoud  * 1. Redistributions of source code must retain the above copyright
     11        1.1  reinoud  *    notice, this list of conditions and the following disclaimer.
     12        1.1  reinoud  * 2. Redistributions in binary form must reproduce the above copyright
     13        1.1  reinoud  *    notice, this list of conditions and the following disclaimer in the
     14        1.1  reinoud  *    documentation and/or other materials provided with the distribution.
     15        1.1  reinoud  * 3. All advertising materials mentioning features or use of this software
     16        1.1  reinoud  *    must display the following acknowledgement:
     17        1.1  reinoud  *	This product includes software developed by Mark Brinicombe
     18        1.1  reinoud  *      for the NetBSD Project.
     19        1.1  reinoud  * 4. Neither the name of the University nor the names of its contributors
     20        1.1  reinoud  *    may be used to endorse or promote products derived from this software
     21        1.1  reinoud  *    without specific prior written permission.
     22        1.1  reinoud  *
     23        1.1  reinoud  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24        1.1  reinoud  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25        1.1  reinoud  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26        1.1  reinoud  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27        1.1  reinoud  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28        1.1  reinoud  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29        1.1  reinoud  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30        1.1  reinoud  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31        1.1  reinoud  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32        1.1  reinoud  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33        1.1  reinoud  *
     34        1.1  reinoud  *	from: asc.c,v 1.8 1996/06/12 20:46:58 mark Exp
     35        1.1  reinoud  */
     36        1.1  reinoud 
     37        1.1  reinoud /*
     38        1.1  reinoud  * Driver for the MCS Connect 32 SCSI 2 card with AM53C94 SCSI controller.
     39        1.1  reinoud  *
     40        1.1  reinoud  * Thanks to Mike <mcsmike (at) knipp.de> at MCS for loaning a card.
     41        1.1  reinoud  * Thanks to Andreas Gandor <andi (at) knipp.de> for some technical information
     42        1.1  reinoud  */
     43       1.12    lukem 
     44       1.12    lukem #include <sys/cdefs.h>
     45  1.13.80.1     yamt __KERNEL_RCSID(0, "$NetBSD: cosc.c,v 1.13.80.1 2009/05/04 08:10:26 yamt Exp $");
     46        1.1  reinoud 
     47        1.1  reinoud #include <sys/param.h>
     48        1.1  reinoud #include <sys/systm.h>
     49        1.1  reinoud #include <sys/kernel.h>
     50        1.1  reinoud #include <sys/device.h>
     51       1.11  thorpej 
     52       1.11  thorpej #include <uvm/uvm_extern.h>
     53       1.11  thorpej 
     54        1.1  reinoud #include <dev/scsipi/scsi_all.h>
     55        1.1  reinoud #include <dev/scsipi/scsipi_all.h>
     56        1.1  reinoud #include <dev/scsipi/scsiconf.h>
     57        1.1  reinoud #include <machine/bootconfig.h>
     58        1.1  reinoud #include <machine/io.h>
     59        1.3  thorpej #include <machine/intr.h>
     60        1.2  thorpej #include <arm/arm32/katelib.h>
     61        1.1  reinoud #include <acorn32/podulebus/podulebus.h>
     62        1.1  reinoud #include <acorn32/podulebus/escreg.h>
     63        1.1  reinoud #include <acorn32/podulebus/escvar.h>
     64        1.1  reinoud #include <acorn32/podulebus/coscreg.h>
     65        1.1  reinoud #include <acorn32/podulebus/coscvar.h>
     66        1.1  reinoud #include <dev/podulebus/podules.h>
     67        1.1  reinoud 
     68       1.10      chs void coscattach(struct device *, struct device *, void *);
     69       1.10      chs int coscmatch(struct device *, struct cfdata *, void *);
     70        1.1  reinoud 
     71        1.8  thorpej CFATTACH_DECL(cosc, sizeof(struct cosc_softc),
     72        1.9  thorpej     coscmatch, coscattach, NULL, NULL);
     73        1.1  reinoud 
     74       1.10      chs int cosc_intr(void *);
     75       1.10      chs int cosc_setup_dma(struct esc_softc *, void *, int, int);
     76       1.10      chs int cosc_build_dma_chain(struct esc_softc *, struct esc_dma_chain *, void *,
     77       1.10      chs 			 int);
     78       1.10      chs int cosc_need_bump(struct esc_softc *, void *, int);
     79       1.10      chs void cosc_led(struct esc_softc *, int);
     80       1.10      chs void cosc_set_dma_adr(struct esc_softc *, void *);
     81       1.10      chs void cosc_set_dma_tc(struct esc_softc *, unsigned int);
     82       1.10      chs void cosc_set_dma_mode(struct esc_softc *, int);
     83        1.1  reinoud 
     84        1.1  reinoud #if COSC_POLL > 0
     85        1.1  reinoud int cosc_poll = 1;
     86        1.1  reinoud #endif
     87        1.1  reinoud 
     88        1.1  reinoud int
     89  1.13.80.1     yamt coscmatch(struct device *pdp, struct cfdata *cf, void *auxp)
     90        1.1  reinoud {
     91        1.1  reinoud 	struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
     92        1.1  reinoud 
     93        1.1  reinoud 	/* Look for the card */
     94        1.1  reinoud 
     95        1.4    bjh21 	if (pa->pa_product == PODULE_CONNECT32)
     96        1.1  reinoud 		return(1);
     97        1.1  reinoud 
     98        1.1  reinoud 	/* Old versions of the ROM on this card could have the wrong ID */
     99        1.1  reinoud 
    100        1.4    bjh21 	if (pa ->pa_product == PODULE_ACORN_SCSI &&
    101        1.4    bjh21 	    strncmp(pa->pa_podule->description, "MCS", 3) == 0)
    102        1.4    bjh21 		return(1);
    103        1.4    bjh21 	return(0);
    104        1.1  reinoud }
    105        1.1  reinoud 
    106        1.1  reinoud static int dummy[6];
    107        1.1  reinoud 
    108        1.1  reinoud void
    109  1.13.80.1     yamt coscattach(struct device *pdp, struct device *dp, void *auxp)
    110        1.1  reinoud {
    111        1.1  reinoud 	struct cosc_softc *sc = (struct cosc_softc *)dp;
    112        1.1  reinoud 	struct podule_attach_args *pa;
    113        1.1  reinoud 	cosc_regmap_p	   rp = &sc->sc_regmap;
    114        1.1  reinoud 	vu_char		  *esc;
    115        1.1  reinoud 
    116        1.1  reinoud 	pa = (struct podule_attach_args *)auxp;
    117        1.1  reinoud 
    118        1.1  reinoud 	if (pa->pa_podule_number == -1)
    119        1.1  reinoud 		panic("Podule has disappeared !");
    120        1.1  reinoud 
    121        1.1  reinoud 	sc->sc_podule_number = pa->pa_podule_number;
    122        1.1  reinoud 	sc->sc_podule = pa->pa_podule;
    123        1.1  reinoud 	podules[sc->sc_podule_number].attached = 1;
    124        1.1  reinoud 
    125        1.1  reinoud 	printf(":");
    126        1.1  reinoud 
    127        1.1  reinoud 	if (pa->pa_podule->manufacturer == MANUFACTURER_ACORN
    128        1.1  reinoud 	    && pa->pa_podule->product == PODULE_ACORN_SCSI)
    129        1.1  reinoud 		printf(" Faulty expansion card identity\n");
    130        1.1  reinoud 
    131        1.1  reinoud 	sc->sc_iobase = (vu_char *)sc->sc_podule->fast_base;
    132        1.1  reinoud 
    133        1.1  reinoud 	/* Select page zero (so we can see the config info) */
    134        1.1  reinoud 
    135        1.1  reinoud 	sc->sc_iobase[COSC_PAGE_REGISTER] = 0;
    136        1.1  reinoud 
    137        1.1  reinoud 	rp->chipreset = (vu_char *)&dummy[0];
    138        1.1  reinoud 	rp->inten = (vu_char *)&dummy[1];
    139        1.1  reinoud 	rp->status = (vu_char *)&dummy[2];
    140        1.1  reinoud 	rp->term = &sc->sc_iobase[COSC_TERMINATION_CONTROL];
    141        1.1  reinoud 	rp->led = (vu_char *)&dummy[4];
    142        1.1  reinoud 	esc = &sc->sc_iobase[COSC_ESCOFFSET_BASE];
    143        1.1  reinoud 
    144        1.1  reinoud 	rp->esc.esc_tc_low	= &esc[COSC_ESCOFFSET_TCL];
    145        1.1  reinoud 	rp->esc.esc_tc_mid	= &esc[COSC_ESCOFFSET_TCM];
    146        1.1  reinoud 	rp->esc.esc_fifo	= &esc[COSC_ESCOFFSET_FIFO];
    147        1.1  reinoud 	rp->esc.esc_command	= &esc[COSC_ESCOFFSET_COMMAND];
    148        1.1  reinoud 	rp->esc.esc_dest_id	= &esc[COSC_ESCOFFSET_DESTID];
    149        1.1  reinoud 	rp->esc.esc_timeout	= &esc[COSC_ESCOFFSET_TIMEOUT];
    150        1.1  reinoud 	rp->esc.esc_syncper	= &esc[COSC_ESCOFFSET_PERIOD];
    151        1.1  reinoud 	rp->esc.esc_syncoff	= &esc[COSC_ESCOFFSET_OFFSET];
    152        1.1  reinoud 	rp->esc.esc_config1	= &esc[COSC_ESCOFFSET_CONFIG1];
    153        1.1  reinoud 	rp->esc.esc_clkconv	= &esc[COSC_ESCOFFSET_CLOCKCONV];
    154        1.1  reinoud 	rp->esc.esc_test	= &esc[COSC_ESCOFFSET_TEST];
    155        1.1  reinoud 	rp->esc.esc_config2	= &esc[COSC_ESCOFFSET_CONFIG2];
    156        1.1  reinoud 	rp->esc.esc_config3	= &esc[COSC_ESCOFFSET_CONFIG3];
    157        1.1  reinoud 	rp->esc.esc_config4	= &esc[COSC_ESCOFFSET_CONFIG4];
    158        1.1  reinoud 	rp->esc.esc_tc_high	= &esc[COSC_ESCOFFSET_TCH];
    159        1.1  reinoud 	rp->esc.esc_fifo_bot	= &esc[COSC_ESCOFFSET_FIFOBOTTOM];
    160        1.1  reinoud 
    161        1.1  reinoud 	*rp->esc.esc_command = ESC_CMD_RESET_CHIP;
    162        1.1  reinoud 	delay(1000);
    163        1.1  reinoud 	*rp->esc.esc_command = ESC_CMD_NOP;
    164        1.1  reinoud 
    165        1.1  reinoud 	/* See if we recognise the controller */
    166        1.1  reinoud 
    167        1.1  reinoud 	switch (*rp->esc.esc_tc_high) {
    168        1.1  reinoud 		case 0x12:
    169        1.1  reinoud 			printf(" AM53CF94");
    170        1.1  reinoud 			break;
    171        1.1  reinoud 		default:
    172        1.1  reinoud 			printf(" Unknown controller (%02x)", *rp->esc.esc_tc_high);
    173        1.1  reinoud 			break;
    174        1.1  reinoud 	}
    175        1.1  reinoud 
    176        1.1  reinoud 	/* Set termination power */
    177        1.1  reinoud 
    178        1.1  reinoud 	if (sc->sc_iobase[COSC_CONFIG_TERMINATION] & COSC_CONFIG_TERMINATION_ON) {
    179        1.1  reinoud 		printf(" termpwr on");
    180        1.1  reinoud 		sc->sc_iobase[COSC_TERMINATION_CONTROL] = COSC_TERMINATION_ON;
    181        1.1  reinoud 	} else {
    182        1.1  reinoud 		printf(" termpwr off");
    183        1.1  reinoud 		sc->sc_iobase[COSC_TERMINATION_CONTROL] = COSC_TERMINATION_OFF;
    184        1.1  reinoud 	}
    185        1.1  reinoud 
    186        1.1  reinoud 	/* Don't know what this is for */
    187        1.1  reinoud 
    188        1.1  reinoud 	{
    189        1.1  reinoud 		int byte;
    190        1.1  reinoud 		int loop;
    191        1.1  reinoud 
    192        1.1  reinoud 		byte = sc->sc_iobase[COSC_REGISTER_01];
    193        1.1  reinoud 		byte = 0;
    194        1.1  reinoud 		for (loop = 0; loop < 8; ++loop) {
    195        1.1  reinoud 			if (sc->sc_iobase[COSC_REGISTER_00] & 0x01)
    196        1.1  reinoud 				byte |= (1 << loop);
    197        1.1  reinoud 		}
    198        1.1  reinoud 		printf(" byte=%02x", byte);
    199        1.1  reinoud 	}
    200        1.1  reinoud 
    201        1.1  reinoud 	/*
    202        1.1  reinoud 	 * Control register 4 is an AMD special (not on FAS216)
    203        1.1  reinoud 	 *
    204        1.1  reinoud 	 * The powerdown and glitch eater facilities could be useful
    205        1.1  reinoud 	 * Use the podule configuration for this register
    206        1.1  reinoud 	 */
    207        1.1  reinoud 
    208        1.1  reinoud 	sc->sc_softc.sc_config4 = sc->sc_iobase[COSC_CONFIG_CONTROL_REG4];
    209        1.1  reinoud 
    210        1.1  reinoud 	sc->sc_softc.sc_esc	= (esc_regmap_p)rp;
    211        1.1  reinoud /*	sc->sc_softc.sc_spec	= &sc->sc_specific;*/
    212        1.1  reinoud 
    213        1.1  reinoud 	sc->sc_softc.sc_led	= cosc_led;
    214        1.1  reinoud 	sc->sc_softc.sc_setup_dma	= cosc_setup_dma;
    215        1.1  reinoud 	sc->sc_softc.sc_build_dma_chain = cosc_build_dma_chain;
    216        1.1  reinoud 	sc->sc_softc.sc_need_bump	= cosc_need_bump;
    217        1.1  reinoud 
    218        1.1  reinoud 	sc->sc_softc.sc_clock_freq   = 40;   /* Connect32 runs at 40MHz */
    219        1.1  reinoud 	sc->sc_softc.sc_timeout      = 250;  /* Set default timeout to 250ms */
    220        1.1  reinoud 	sc->sc_softc.sc_config_flags = ESC_NO_DMA;
    221        1.1  reinoud 	sc->sc_softc.sc_host_id      = sc->sc_iobase[COSC_CONFIG_CONTROL_REG1] & ESC_DEST_ID_MASK;
    222        1.1  reinoud 
    223        1.1  reinoud 	printf(" hostid=%d", sc->sc_softc.sc_host_id);
    224        1.1  reinoud 
    225        1.1  reinoud #if COSC_POLL > 0
    226        1.1  reinoud         if (boot_args)
    227        1.1  reinoud 		get_bootconf_option(boot_args, "coscpoll",
    228        1.1  reinoud 		    BOOTOPT_TYPE_BOOLEAN, &cosc_poll);
    229        1.1  reinoud 
    230        1.5    bjh21 	if (cosc_poll) {
    231        1.1  reinoud 		printf(" polling");
    232        1.5    bjh21 		sc->sc_softc.sc_adapter.adapt_flags |= SCSIPI_ADAPT_POLL_ONLY;
    233        1.5    bjh21 	}
    234        1.1  reinoud #endif
    235        1.1  reinoud 
    236       1.11  thorpej 	sc->sc_softc.sc_bump_sz = PAGE_SIZE;
    237        1.1  reinoud 	sc->sc_softc.sc_bump_pa = 0x0;
    238        1.1  reinoud 
    239        1.1  reinoud 	escinitialize((struct esc_softc *)sc);
    240        1.1  reinoud 
    241        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_dev = &sc->sc_softc.sc_dev;
    242        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_nchannels = 1;
    243        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_openings = 7;
    244        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_max_periph = 1;
    245        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_ioctl = NULL;
    246        1.1  reinoud 	sc->sc_softc.sc_adapter.adapt_minphys = esc_minphys;
    247        1.5    bjh21 	sc->sc_softc.sc_adapter.adapt_request = esc_scsi_request;
    248        1.1  reinoud 
    249        1.1  reinoud 	sc->sc_softc.sc_channel.chan_adapter = &sc->sc_softc.sc_adapter;
    250        1.1  reinoud 	sc->sc_softc.sc_channel.chan_bustype = &scsi_bustype;
    251        1.1  reinoud 	sc->sc_softc.sc_channel.chan_channel = 0;
    252        1.1  reinoud 	sc->sc_softc.sc_channel.chan_ntargets = 8;
    253        1.1  reinoud 	sc->sc_softc.sc_channel.chan_nluns = 8;
    254        1.1  reinoud 	sc->sc_softc.sc_channel.chan_id = sc->sc_softc.sc_host_id;
    255        1.1  reinoud 
    256        1.1  reinoud 	/* initialise the card */
    257        1.1  reinoud #if 0
    258        1.1  reinoud 	*rp->inten = (COSC_POLL?0:1);
    259        1.1  reinoud 	*rp->led = 0;
    260        1.1  reinoud #endif
    261        1.1  reinoud 
    262        1.1  reinoud 	sc->sc_softc.sc_ih.ih_func = cosc_intr;
    263        1.1  reinoud 	sc->sc_softc.sc_ih.ih_arg  = &sc->sc_softc;
    264        1.1  reinoud 	sc->sc_softc.sc_ih.ih_level = IPL_BIO;
    265        1.1  reinoud 	sc->sc_softc.sc_ih.ih_name = "scsi: cosc";
    266        1.1  reinoud 	sc->sc_softc.sc_ih.ih_maskaddr = sc->sc_podule->irq_addr;
    267        1.1  reinoud 	sc->sc_softc.sc_ih.ih_maskbits = sc->sc_podule->irq_mask;
    268        1.1  reinoud 
    269        1.1  reinoud #if COSC_POLL > 0
    270        1.1  reinoud 	if (!cosc_poll)
    271        1.1  reinoud #endif
    272        1.1  reinoud 	{
    273        1.1  reinoud 		evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
    274        1.1  reinoud 		    dp->dv_xname, "intr");
    275        1.1  reinoud 		sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO,
    276        1.1  reinoud 		    cosc_intr, sc, &sc->sc_intrcnt);
    277        1.1  reinoud 		if (sc->sc_ih == NULL)
    278        1.6   provos 			panic("%s: Cannot install IRQ handler",
    279        1.1  reinoud 			    dp->dv_xname);
    280        1.1  reinoud 	}
    281        1.1  reinoud 
    282        1.1  reinoud 	printf("\n");
    283        1.1  reinoud 
    284        1.1  reinoud 	/* attach all scsi units on us */
    285        1.1  reinoud 	config_found(dp, &sc->sc_softc.sc_channel, scsiprint);
    286        1.1  reinoud }
    287        1.1  reinoud 
    288        1.1  reinoud 
    289        1.1  reinoud /* Turn on/off led */
    290        1.1  reinoud 
    291        1.1  reinoud void
    292  1.13.80.1     yamt cosc_led(struct esc_softc *sc, int mode)
    293        1.1  reinoud {
    294        1.1  reinoud 	cosc_regmap_p		rp;
    295        1.1  reinoud 
    296        1.1  reinoud 	rp = (cosc_regmap_p)sc->sc_esc;
    297        1.1  reinoud 
    298        1.1  reinoud 	if (mode) {
    299        1.1  reinoud 		sc->sc_led_status++;
    300        1.1  reinoud 	} else {
    301        1.1  reinoud 		if (sc->sc_led_status)
    302        1.1  reinoud 			sc->sc_led_status--;
    303        1.1  reinoud 	}
    304        1.1  reinoud /*	*rp->led = (sc->sc_led_status?1:0);*/
    305        1.1  reinoud }
    306        1.1  reinoud 
    307        1.1  reinoud 
    308        1.1  reinoud int
    309  1.13.80.1     yamt cosc_intr(void *arg)
    310        1.1  reinoud {
    311        1.1  reinoud 	struct esc_softc *dev = arg;
    312        1.1  reinoud 	cosc_regmap_p	      rp;
    313        1.1  reinoud 	int		      quickints;
    314        1.1  reinoud 
    315        1.1  reinoud 	rp = (cosc_regmap_p)dev->sc_esc;
    316        1.1  reinoud 
    317        1.1  reinoud 	printf("cosc_intr:%08x %02x\n", (u_int)rp->esc.esc_status, *rp->esc.esc_status);
    318        1.1  reinoud 
    319        1.1  reinoud 	if (*rp->esc.esc_status & ESC_STAT_INTERRUPT_PENDING) {
    320        1.1  reinoud 		quickints = 16;
    321        1.1  reinoud 		do {
    322        1.1  reinoud 			dev->sc_status = *rp->esc.esc_status;
    323        1.1  reinoud 			dev->sc_interrupt = *rp->esc.esc_interrupt;
    324        1.1  reinoud 
    325        1.1  reinoud 			if (dev->sc_interrupt & ESC_INT_RESELECTED) {
    326        1.1  reinoud 				dev->sc_resel[0] = *rp->esc.esc_fifo;
    327        1.1  reinoud 				dev->sc_resel[1] = *rp->esc.esc_fifo;
    328        1.1  reinoud 			}
    329        1.1  reinoud 
    330        1.1  reinoud 			escintr(dev);
    331        1.1  reinoud 
    332        1.1  reinoud 		} while((*rp->esc.esc_status & ESC_STAT_INTERRUPT_PENDING)
    333        1.1  reinoud 			&& --quickints);
    334        1.1  reinoud 	}
    335        1.1  reinoud 
    336        1.1  reinoud 	return(0);	/* Pass interrupt on down the chain */
    337        1.1  reinoud }
    338        1.1  reinoud 
    339        1.1  reinoud 
    340        1.1  reinoud /* Load transfer address into dma register */
    341        1.1  reinoud 
    342        1.1  reinoud void
    343  1.13.80.1     yamt cosc_set_dma_adr(struct esc_softc *sc, void *ptr)
    344        1.1  reinoud {
    345        1.1  reinoud 	printf("cosc_set_dma_adr(sc = 0x%08x, ptr = 0x%08x)\n", (u_int)sc, (u_int)ptr);
    346        1.1  reinoud 	return;
    347        1.1  reinoud }
    348        1.1  reinoud 
    349        1.1  reinoud 
    350        1.1  reinoud /* Set DMA transfer counter */
    351        1.1  reinoud 
    352        1.1  reinoud void
    353  1.13.80.1     yamt cosc_set_dma_tc(struct esc_softc *sc, unsigned int len)
    354        1.1  reinoud {
    355        1.1  reinoud 	printf("cosc_set_dma_tc(sc, len = 0x%08x)", len);
    356        1.1  reinoud 
    357        1.1  reinoud 	/* Set the transfer size on the SCSI controller */
    358        1.1  reinoud 
    359        1.1  reinoud 	*sc->sc_esc->esc_tc_low  = len; len >>= 8;
    360        1.1  reinoud 	*sc->sc_esc->esc_tc_mid  = len; len >>= 8;
    361        1.1  reinoud 	*sc->sc_esc->esc_tc_high = len;
    362        1.1  reinoud }
    363        1.1  reinoud 
    364        1.1  reinoud 
    365        1.1  reinoud /* Set DMA mode */
    366        1.1  reinoud 
    367        1.1  reinoud void
    368  1.13.80.1     yamt cosc_set_dma_mode(struct esc_softc *sc, int mode)
    369        1.1  reinoud {
    370        1.1  reinoud 	printf("cosc_set_dma_mode(sc, mode = %d)", mode);
    371        1.1  reinoud }
    372        1.1  reinoud 
    373        1.1  reinoud 
    374        1.1  reinoud /* Initialize DMA for transfer */
    375        1.1  reinoud 
    376        1.1  reinoud int
    377  1.13.80.1     yamt cosc_setup_dma(struct esc_softc *sc, void *ptr, int len, int mode)
    378        1.1  reinoud {
    379        1.1  reinoud /*	printf("cosc_setup_dma(sc, ptr = 0x%08x, len = 0x%08x, mode = 0x%08x)\n", (u_int)ptr, len, mode);*/
    380        1.1  reinoud 	return(0);
    381        1.1  reinoud 
    382        1.1  reinoud }
    383        1.1  reinoud 
    384        1.1  reinoud 
    385        1.1  reinoud /* Check if address and len is ok for DMA transfer */
    386        1.1  reinoud 
    387        1.1  reinoud int
    388  1.13.80.1     yamt cosc_need_bump(struct esc_softc *sc, void *ptr, int len)
    389        1.1  reinoud {
    390        1.1  reinoud 	int	p;
    391        1.1  reinoud 
    392        1.1  reinoud 	p = (int)ptr & 0x03;
    393        1.1  reinoud 
    394        1.1  reinoud 	if (p) {
    395        1.1  reinoud 		p = 4-p;
    396        1.1  reinoud 
    397        1.1  reinoud 		if (len < 256)
    398        1.1  reinoud 			p = len;
    399        1.1  reinoud 	}
    400        1.1  reinoud 
    401        1.1  reinoud 	return(p);
    402        1.1  reinoud }
    403        1.1  reinoud 
    404        1.1  reinoud 
    405        1.1  reinoud /* Interrupt driven routines */
    406        1.1  reinoud 
    407        1.1  reinoud int
    408  1.13.80.1     yamt cosc_build_dma_chain(struct esc_softc *sc, struct esc_dma_chain *chain, void *p, int l)
    409        1.1  reinoud {
    410        1.1  reinoud 	printf("cosc_build_dma_chain()\n");
    411        1.1  reinoud 	return(0);
    412        1.1  reinoud }
    413