Home | History | Annotate | Line # | Download | only in isa
uha_isa.c revision 1.22
      1  1.22   thorpej /*	$NetBSD: uha_isa.c,v 1.22 2002/01/07 21:47:13 thorpej Exp $	*/
      2   1.2   mycroft 
      3  1.17   mycroft /*-
      4  1.17   mycroft  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  1.17   mycroft  * All rights reserved.
      6  1.17   mycroft  *
      7  1.17   mycroft  * This code is derived from software contributed to The NetBSD Foundation
      8  1.17   mycroft  * by Charles M. Hannum.
      9   1.2   mycroft  *
     10   1.2   mycroft  * Redistribution and use in source and binary forms, with or without
     11   1.2   mycroft  * modification, are permitted provided that the following conditions
     12   1.2   mycroft  * are met:
     13   1.2   mycroft  * 1. Redistributions of source code must retain the above copyright
     14   1.2   mycroft  *    notice, this list of conditions and the following disclaimer.
     15   1.2   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.2   mycroft  *    notice, this list of conditions and the following disclaimer in the
     17   1.2   mycroft  *    documentation and/or other materials provided with the distribution.
     18   1.2   mycroft  * 3. All advertising materials mentioning features or use of this software
     19   1.2   mycroft  *    must display the following acknowledgement:
     20  1.17   mycroft  *        This product includes software developed by the NetBSD
     21  1.17   mycroft  *        Foundation, Inc. and its contributors.
     22  1.17   mycroft  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.17   mycroft  *    contributors may be used to endorse or promote products derived
     24  1.17   mycroft  *    from this software without specific prior written permission.
     25   1.2   mycroft  *
     26  1.17   mycroft  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.17   mycroft  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.17   mycroft  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.17   mycroft  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.17   mycroft  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.17   mycroft  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.17   mycroft  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.17   mycroft  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.17   mycroft  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.17   mycroft  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.17   mycroft  * POSSIBILITY OF SUCH DAMAGE.
     37   1.2   mycroft  */
     38  1.20     lukem 
     39  1.20     lukem #include <sys/cdefs.h>
     40  1.22   thorpej __KERNEL_RCSID(0, "$NetBSD: uha_isa.c,v 1.22 2002/01/07 21:47:13 thorpej Exp $");
     41  1.16  jonathan 
     42  1.16  jonathan #include "opt_ddb.h"
     43   1.2   mycroft 
     44   1.1   mycroft #include <sys/param.h>
     45   1.3  christos #include <sys/systm.h>
     46   1.1   mycroft #include <sys/device.h>
     47   1.1   mycroft #include <sys/kernel.h>
     48   1.1   mycroft #include <sys/proc.h>
     49   1.1   mycroft #include <sys/user.h>
     50   1.1   mycroft 
     51   1.1   mycroft #include <machine/bus.h>
     52   1.1   mycroft #include <machine/intr.h>
     53   1.1   mycroft 
     54   1.9    bouyer #include <dev/scsipi/scsi_all.h>
     55   1.9    bouyer #include <dev/scsipi/scsipi_all.h>
     56   1.9    bouyer #include <dev/scsipi/scsiconf.h>
     57   1.1   mycroft 
     58   1.1   mycroft #include <dev/isa/isavar.h>
     59   1.1   mycroft #include <dev/isa/isadmavar.h>
     60   1.1   mycroft 
     61   1.1   mycroft #include <dev/ic/uhareg.h>
     62   1.1   mycroft #include <dev/ic/uhavar.h>
     63   1.1   mycroft 
     64   1.1   mycroft #define	UHA_ISA_IOSIZE	16
     65   1.1   mycroft 
     66   1.8   thorpej int	uha_isa_probe __P((struct device *, struct cfdata *, void *));
     67   1.1   mycroft void	uha_isa_attach __P((struct device *, struct device *, void *));
     68   1.1   mycroft 
     69   1.1   mycroft struct cfattach uha_isa_ca = {
     70   1.1   mycroft 	sizeof(struct uha_softc), uha_isa_probe, uha_isa_attach
     71   1.1   mycroft };
     72   1.1   mycroft 
     73   1.6  jonathan #ifndef	DDB
     74   1.6  jonathan #define Debugger() panic("should call debugger here (uha_isa.c)")
     75   1.6  jonathan #endif /* ! DDB */
     76   1.1   mycroft 
     77   1.7   mycroft int	u14_find __P((bus_space_tag_t, bus_space_handle_t,
     78   1.7   mycroft 	    struct uha_probe_data *));
     79   1.7   mycroft void	u14_start_mbox __P((struct uha_softc *, struct uha_mscp *));
     80   1.9    bouyer int	u14_poll __P((struct uha_softc *, struct scsipi_xfer *, int));
     81   1.7   mycroft int	u14_intr __P((void *));
     82   1.7   mycroft void	u14_init __P((struct uha_softc *));
     83   1.1   mycroft 
     84   1.1   mycroft /*
     85   1.1   mycroft  * Check the slots looking for a board we recognise
     86   1.1   mycroft  * If we find one, note it's address (slot) and call
     87   1.1   mycroft  * the actual probe routine to check it out.
     88   1.1   mycroft  */
     89   1.1   mycroft int
     90   1.1   mycroft uha_isa_probe(parent, match, aux)
     91   1.1   mycroft 	struct device *parent;
     92   1.8   thorpej 	struct cfdata *match;
     93   1.8   thorpej 	void *aux;
     94   1.1   mycroft {
     95   1.1   mycroft 	struct isa_attach_args *ia = aux;
     96   1.5   thorpej 	bus_space_tag_t iot = ia->ia_iot;
     97   1.5   thorpej 	bus_space_handle_t ioh;
     98   1.7   mycroft 	struct uha_probe_data upd;
     99   1.1   mycroft 	int rv;
    100  1.10   thorpej 
    101  1.22   thorpej 	if (ia->ia_nio < 1)
    102  1.22   thorpej 		return (0);
    103  1.22   thorpej 	if (ia->ia_nirq < 1)
    104  1.22   thorpej 		return (0);
    105  1.22   thorpej 	if (ia->ia_ndrq < 1)
    106  1.22   thorpej 		return (0);
    107  1.22   thorpej 
    108  1.22   thorpej 	if (ISA_DIRECT_CONFIG(ia))
    109  1.22   thorpej 		return (0);
    110  1.22   thorpej 
    111  1.10   thorpej 	/* Disallow wildcarded i/o address. */
    112  1.22   thorpej 	if (ia->ia_io[0].ir_addr == ISACF_PORT_DEFAULT)
    113  1.10   thorpej 		return (0);
    114   1.1   mycroft 
    115  1.22   thorpej 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh))
    116   1.1   mycroft 		return (0);
    117   1.1   mycroft 
    118   1.7   mycroft 	rv = u14_find(iot, ioh, &upd);
    119   1.1   mycroft 
    120   1.5   thorpej 	bus_space_unmap(iot, ioh, UHA_ISA_IOSIZE);
    121   1.1   mycroft 
    122   1.1   mycroft 	if (rv) {
    123  1.22   thorpej 		if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT &&
    124  1.22   thorpej 		    ia->ia_irq[0].ir_irq != upd.sc_irq)
    125   1.1   mycroft 			return (0);
    126  1.22   thorpej 		if (ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT &&
    127  1.22   thorpej 		    ia->ia_drq[0].ir_drq != upd.sc_drq)
    128   1.1   mycroft 			return (0);
    129  1.22   thorpej 
    130  1.22   thorpej 		ia->ia_nio = 1;
    131  1.22   thorpej 		ia->ia_io[0].ir_size = UHA_ISA_IOSIZE;
    132  1.22   thorpej 
    133  1.22   thorpej 		ia->ia_nirq = 1;
    134  1.22   thorpej 		ia->ia_irq[0].ir_irq = upd.sc_irq;
    135  1.22   thorpej 
    136  1.22   thorpej 		ia->ia_ndrq = 1;
    137  1.22   thorpej 		ia->ia_drq[0].ir_drq = upd.sc_drq;
    138  1.22   thorpej 
    139  1.22   thorpej 		ia->ia_niomem = 0;
    140   1.1   mycroft 	}
    141   1.1   mycroft 	return (rv);
    142   1.1   mycroft }
    143   1.1   mycroft 
    144   1.1   mycroft /*
    145   1.1   mycroft  * Attach all the sub-devices we can find
    146   1.1   mycroft  */
    147   1.1   mycroft void
    148   1.1   mycroft uha_isa_attach(parent, self, aux)
    149   1.1   mycroft 	struct device *parent, *self;
    150   1.1   mycroft 	void *aux;
    151   1.1   mycroft {
    152   1.1   mycroft 	struct isa_attach_args *ia = aux;
    153   1.1   mycroft 	struct uha_softc *sc = (void *)self;
    154   1.5   thorpej 	bus_space_tag_t iot = ia->ia_iot;
    155   1.8   thorpej 	bus_dma_tag_t dmat = ia->ia_dmat;
    156   1.5   thorpej 	bus_space_handle_t ioh;
    157   1.7   mycroft 	struct uha_probe_data upd;
    158   1.1   mycroft 	isa_chipset_tag_t ic = ia->ia_ic;
    159  1.15   thorpej 	int error;
    160   1.1   mycroft 
    161   1.4  christos 	printf("\n");
    162   1.1   mycroft 
    163  1.22   thorpej 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, UHA_ISA_IOSIZE, 0, &ioh)) {
    164  1.11   thorpej 		printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
    165  1.11   thorpej 		return;
    166  1.11   thorpej 	}
    167   1.1   mycroft 
    168   1.5   thorpej 	sc->sc_iot = iot;
    169   1.1   mycroft 	sc->sc_ioh = ioh;
    170   1.8   thorpej 	sc->sc_dmat = dmat;
    171  1.11   thorpej 	if (!u14_find(iot, ioh, &upd)) {
    172  1.11   thorpej 		printf("%s: u14_find failed\n", sc->sc_dev.dv_xname);
    173  1.11   thorpej 		return;
    174  1.11   thorpej 	}
    175   1.1   mycroft 
    176   1.8   thorpej 	if (upd.sc_drq != -1) {
    177   1.8   thorpej 		sc->sc_dmaflags = 0;
    178  1.15   thorpej 		if ((error = isa_dmacascade(ic, upd.sc_drq)) != 0) {
    179  1.15   thorpej 			printf("%s: unable to cascade DRQ, error = %d\n",
    180  1.15   thorpej 			    sc->sc_dev.dv_xname, error);
    181  1.15   thorpej 			return;
    182  1.15   thorpej 		}
    183   1.8   thorpej 	} else {
    184   1.8   thorpej 		/*
    185   1.8   thorpej 		 * We have a VLB controller, and can do 32-bit DMA.
    186   1.8   thorpej 		 */
    187   1.8   thorpej 		sc->sc_dmaflags = ISABUS_DMA_32BIT;
    188   1.8   thorpej 	}
    189   1.1   mycroft 
    190   1.7   mycroft 	sc->sc_ih = isa_intr_establish(ic, upd.sc_irq, IST_EDGE, IPL_BIO,
    191   1.1   mycroft 	    u14_intr, sc);
    192   1.1   mycroft 	if (sc->sc_ih == NULL) {
    193   1.4  christos 		printf("%s: couldn't establish interrupt\n",
    194   1.1   mycroft 		    sc->sc_dev.dv_xname);
    195   1.1   mycroft 		return;
    196   1.1   mycroft 	}
    197   1.1   mycroft 
    198   1.1   mycroft 	/* Save function pointers for later use. */
    199   1.1   mycroft 	sc->start_mbox = u14_start_mbox;
    200   1.1   mycroft 	sc->poll = u14_poll;
    201   1.1   mycroft 	sc->init = u14_init;
    202   1.1   mycroft 
    203   1.7   mycroft 	uha_attach(sc, &upd);
    204   1.1   mycroft }
    205   1.1   mycroft 
    206   1.1   mycroft /*
    207   1.1   mycroft  * Start the board, ready for normal operation
    208   1.1   mycroft  */
    209   1.1   mycroft int
    210   1.5   thorpej u14_find(iot, ioh, sc)
    211   1.5   thorpej 	bus_space_tag_t iot;
    212   1.5   thorpej 	bus_space_handle_t ioh;
    213   1.7   mycroft 	struct uha_probe_data *sc;
    214   1.1   mycroft {
    215   1.1   mycroft 	u_int16_t model, config;
    216   1.1   mycroft 	int irq, drq;
    217   1.1   mycroft 	int resetcount = 4000;	/* 4 secs? */
    218   1.1   mycroft 
    219   1.5   thorpej 	model = (bus_space_read_1(iot, ioh, U14_ID + 0) << 8) |
    220   1.5   thorpej 		(bus_space_read_1(iot, ioh, U14_ID + 1) << 0);
    221   1.1   mycroft 	if ((model & 0xfff0) != 0x5640)
    222   1.1   mycroft 		return (0);
    223   1.1   mycroft 
    224   1.5   thorpej 	config = (bus_space_read_1(iot, ioh, U14_CONFIG + 0) << 8) |
    225   1.5   thorpej 		 (bus_space_read_1(iot, ioh, U14_CONFIG + 1) << 0);
    226   1.1   mycroft 
    227   1.1   mycroft 	switch (model & 0x000f) {
    228   1.1   mycroft 	case 0x0000:
    229   1.1   mycroft 		switch (config & U14_DMA_MASK) {
    230   1.1   mycroft 		case U14_DMA_CH5:
    231   1.1   mycroft 			drq = 5;
    232   1.1   mycroft 			break;
    233   1.1   mycroft 		case U14_DMA_CH6:
    234   1.1   mycroft 			drq = 6;
    235   1.1   mycroft 			break;
    236   1.1   mycroft 		case U14_DMA_CH7:
    237   1.1   mycroft 			drq = 7;
    238   1.1   mycroft 			break;
    239   1.1   mycroft 		default:
    240   1.4  christos 			printf("u14_find: illegal drq setting %x\n",
    241   1.1   mycroft 			    config & U14_DMA_MASK);
    242   1.1   mycroft 			return (0);
    243   1.1   mycroft 		}
    244   1.1   mycroft 		break;
    245   1.1   mycroft 	case 0x0001:
    246   1.1   mycroft 		/* This is a 34f, and doesn't need an ISA DMA channel. */
    247   1.1   mycroft 		drq = -1;
    248   1.1   mycroft 		break;
    249   1.3  christos 	default:
    250   1.4  christos 		printf("u14_find: unknown model %x\n", model);
    251   1.3  christos 		return (0);
    252   1.1   mycroft 	}
    253   1.1   mycroft 
    254   1.1   mycroft 	switch (config & U14_IRQ_MASK) {
    255   1.1   mycroft 	case U14_IRQ10:
    256   1.1   mycroft 		irq = 10;
    257   1.1   mycroft 		break;
    258   1.1   mycroft 	case U14_IRQ11:
    259   1.1   mycroft 		irq = 11;
    260   1.1   mycroft 		break;
    261   1.1   mycroft 	case U14_IRQ14:
    262   1.1   mycroft 		irq = 14;
    263   1.1   mycroft 		break;
    264   1.1   mycroft 	case U14_IRQ15:
    265   1.1   mycroft 		irq = 15;
    266   1.1   mycroft 		break;
    267   1.1   mycroft 	default:
    268   1.4  christos 		printf("u14_find: illegal irq setting %x\n",
    269   1.1   mycroft 		    config & U14_IRQ_MASK);
    270   1.1   mycroft 		return (0);
    271   1.1   mycroft 	}
    272   1.1   mycroft 
    273   1.5   thorpej 	bus_space_write_1(iot, ioh, U14_LINT, UHA_ASRST);
    274   1.1   mycroft 
    275   1.1   mycroft 	while (--resetcount) {
    276   1.5   thorpej 		if (bus_space_read_1(iot, ioh, U14_LINT))
    277   1.1   mycroft 			break;
    278   1.1   mycroft 		delay(1000);	/* 1 mSec per loop */
    279   1.1   mycroft 	}
    280   1.1   mycroft 	if (!resetcount) {
    281   1.4  christos 		printf("u14_find: board timed out during reset\n");
    282   1.1   mycroft 		return (0);
    283   1.1   mycroft 	}
    284   1.1   mycroft 
    285   1.1   mycroft 	/* if we want to fill in softc, do so now */
    286   1.7   mycroft 	if (sc) {
    287   1.1   mycroft 		sc->sc_irq = irq;
    288   1.1   mycroft 		sc->sc_drq = drq;
    289   1.1   mycroft 		sc->sc_scsi_dev = config & U14_HOSTID_MASK;
    290   1.1   mycroft 	}
    291   1.1   mycroft 
    292   1.1   mycroft 	return (1);
    293   1.1   mycroft }
    294   1.1   mycroft 
    295   1.1   mycroft /*
    296   1.1   mycroft  * Function to send a command out through a mailbox
    297   1.1   mycroft  */
    298   1.1   mycroft void
    299   1.1   mycroft u14_start_mbox(sc, mscp)
    300   1.1   mycroft 	struct uha_softc *sc;
    301   1.1   mycroft 	struct uha_mscp *mscp;
    302   1.1   mycroft {
    303   1.5   thorpej 	bus_space_tag_t iot = sc->sc_iot;
    304   1.5   thorpej 	bus_space_handle_t ioh = sc->sc_ioh;
    305   1.1   mycroft 	int spincount = 100000;	/* 1s should be enough */
    306   1.1   mycroft 
    307   1.1   mycroft 	while (--spincount) {
    308   1.5   thorpej 		if ((bus_space_read_1(iot, ioh, U14_LINT) & U14_LDIP) == 0)
    309   1.1   mycroft 			break;
    310   1.1   mycroft 		delay(100);
    311   1.1   mycroft 	}
    312   1.1   mycroft 	if (!spincount) {
    313   1.4  christos 		printf("%s: uha_start_mbox, board not responding\n",
    314   1.1   mycroft 		    sc->sc_dev.dv_xname);
    315   1.1   mycroft 		Debugger();
    316   1.1   mycroft 	}
    317   1.1   mycroft 
    318   1.8   thorpej 	bus_space_write_4(iot, ioh, U14_OGMPTR,
    319  1.12   thorpej 	    sc->sc_dmamap_mscp->dm_segs[0].ds_addr + UHA_MSCP_OFF(mscp));
    320   1.1   mycroft 	if (mscp->flags & MSCP_ABORT)
    321   1.5   thorpej 		bus_space_write_1(iot, ioh, U14_LINT, U14_ABORT);
    322   1.1   mycroft 	else
    323   1.5   thorpej 		bus_space_write_1(iot, ioh, U14_LINT, U14_OGMFULL);
    324   1.1   mycroft 
    325  1.18   thorpej 	if ((mscp->xs->xs_control & XS_CTL_POLL) == 0)
    326  1.19   thorpej 		callout_reset(&mscp->xs->xs_callout,
    327  1.19   thorpej 		    (mscp->timeout * hz) / 1000, uha_timeout, mscp);
    328   1.1   mycroft }
    329   1.1   mycroft 
    330   1.1   mycroft /*
    331   1.1   mycroft  * Function to poll for command completion when in poll mode.
    332   1.1   mycroft  *
    333   1.1   mycroft  *	wait = timeout in msec
    334   1.1   mycroft  */
    335   1.1   mycroft int
    336   1.1   mycroft u14_poll(sc, xs, count)
    337   1.1   mycroft 	struct uha_softc *sc;
    338   1.9    bouyer 	struct scsipi_xfer *xs;
    339   1.1   mycroft 	int count;
    340   1.1   mycroft {
    341   1.5   thorpej 	bus_space_tag_t iot = sc->sc_iot;
    342   1.5   thorpej 	bus_space_handle_t ioh = sc->sc_ioh;
    343   1.1   mycroft 
    344   1.1   mycroft 	while (count) {
    345   1.1   mycroft 		/*
    346   1.1   mycroft 		 * If we had interrupts enabled, would we
    347   1.1   mycroft 		 * have got an interrupt?
    348   1.1   mycroft 		 */
    349   1.5   thorpej 		if (bus_space_read_1(iot, ioh, U14_SINT) & U14_SDIP)
    350   1.1   mycroft 			u14_intr(sc);
    351  1.18   thorpej 		if (xs->xs_status & XS_STS_DONE)
    352   1.1   mycroft 			return (0);
    353   1.1   mycroft 		delay(1000);
    354   1.1   mycroft 		count--;
    355   1.1   mycroft 	}
    356   1.1   mycroft 	return (1);
    357   1.1   mycroft }
    358   1.1   mycroft 
    359   1.1   mycroft /*
    360   1.1   mycroft  * Catch an interrupt from the adaptor
    361   1.1   mycroft  */
    362   1.1   mycroft int
    363   1.1   mycroft u14_intr(arg)
    364   1.1   mycroft 	void *arg;
    365   1.1   mycroft {
    366   1.1   mycroft 	struct uha_softc *sc = arg;
    367   1.5   thorpej 	bus_space_tag_t iot = sc->sc_iot;
    368   1.5   thorpej 	bus_space_handle_t ioh = sc->sc_ioh;
    369   1.1   mycroft 	struct uha_mscp *mscp;
    370   1.1   mycroft 	u_char uhastat;
    371   1.1   mycroft 	u_long mboxval;
    372   1.1   mycroft 
    373   1.1   mycroft #ifdef	UHADEBUG
    374   1.4  christos 	printf("%s: uhaintr ", sc->sc_dev.dv_xname);
    375   1.1   mycroft #endif /*UHADEBUG */
    376   1.1   mycroft 
    377   1.5   thorpej 	if ((bus_space_read_1(iot, ioh, U14_SINT) & U14_SDIP) == 0)
    378   1.1   mycroft 		return (0);
    379   1.1   mycroft 
    380   1.1   mycroft 	for (;;) {
    381   1.1   mycroft 		/*
    382   1.1   mycroft 		 * First get all the information and then
    383   1.1   mycroft 		 * acknowledge the interrupt
    384   1.1   mycroft 		 */
    385   1.5   thorpej 		uhastat = bus_space_read_1(iot, ioh, U14_SINT);
    386   1.5   thorpej 		mboxval = bus_space_read_4(iot, ioh, U14_ICMPTR);
    387   1.1   mycroft 		/* XXX Send an ABORT_ACK instead? */
    388   1.5   thorpej 		bus_space_write_1(iot, ioh, U14_SINT, U14_ICM_ACK);
    389   1.1   mycroft 
    390   1.1   mycroft #ifdef	UHADEBUG
    391   1.4  christos 		printf("status = 0x%x ", uhastat);
    392   1.1   mycroft #endif /*UHADEBUG*/
    393   1.1   mycroft 
    394   1.1   mycroft 		/*
    395   1.1   mycroft 		 * Process the completed operation
    396   1.1   mycroft 		 */
    397   1.1   mycroft 		mscp = uha_mscp_phys_kv(sc, mboxval);
    398   1.1   mycroft 		if (!mscp) {
    399   1.4  christos 			printf("%s: BAD MSCP RETURNED!\n",
    400   1.1   mycroft 			    sc->sc_dev.dv_xname);
    401   1.1   mycroft 			continue;	/* whatever it was, it'll timeout */
    402   1.1   mycroft 		}
    403   1.1   mycroft 
    404  1.19   thorpej 		callout_stop(&mscp->xs->xs_callout);
    405   1.1   mycroft 		uha_done(sc, mscp);
    406   1.1   mycroft 
    407   1.5   thorpej 		if ((bus_space_read_1(iot, ioh, U14_SINT) & U14_SDIP) == 0)
    408   1.1   mycroft 			return (1);
    409   1.1   mycroft 	}
    410   1.1   mycroft }
    411   1.1   mycroft 
    412   1.1   mycroft void
    413   1.1   mycroft u14_init(sc)
    414   1.1   mycroft 	struct uha_softc *sc;
    415   1.1   mycroft {
    416   1.5   thorpej 	bus_space_tag_t iot = sc->sc_iot;
    417   1.5   thorpej 	bus_space_handle_t ioh = sc->sc_ioh;
    418   1.1   mycroft 
    419   1.1   mycroft 	/* make sure interrupts are enabled */
    420   1.1   mycroft #ifdef UHADEBUG
    421   1.4  christos 	printf("u14_init: lmask=%02x, smask=%02x\n",
    422   1.5   thorpej 	    bus_space_read_1(iot, ioh, U14_LMASK),
    423   1.5   thorpej 	    bus_space_read_1(iot, ioh, U14_SMASK));
    424   1.1   mycroft #endif
    425   1.5   thorpej 	bus_space_write_1(iot, ioh, U14_LMASK, 0xd1);	/* XXX */
    426   1.5   thorpej 	bus_space_write_1(iot, ioh, U14_SMASK, 0x91);	/* XXX */
    427   1.1   mycroft }
    428