Home | History | Annotate | Line # | Download | only in ic
uhavar.h revision 1.8
      1  1.8  thorpej /*	$NetBSD: uhavar.h,v 1.8 1998/02/17 03:02:56 thorpej Exp $	*/
      2  1.8  thorpej 
      3  1.8  thorpej /*-
      4  1.8  thorpej  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  1.8  thorpej  * All rights reserved.
      6  1.8  thorpej  *
      7  1.8  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.8  thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.8  thorpej  * NASA Ames Research Center.
     10  1.8  thorpej  *
     11  1.8  thorpej  * Redistribution and use in source and binary forms, with or without
     12  1.8  thorpej  * modification, are permitted provided that the following conditions
     13  1.8  thorpej  * are met:
     14  1.8  thorpej  * 1. Redistributions of source code must retain the above copyright
     15  1.8  thorpej  *    notice, this list of conditions and the following disclaimer.
     16  1.8  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.8  thorpej  *    notice, this list of conditions and the following disclaimer in the
     18  1.8  thorpej  *    documentation and/or other materials provided with the distribution.
     19  1.8  thorpej  * 3. All advertising materials mentioning features or use of this software
     20  1.8  thorpej  *    must display the following acknowledgement:
     21  1.8  thorpej  *	This product includes software developed by the NetBSD
     22  1.8  thorpej  *	Foundation, Inc. and its contributors.
     23  1.8  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.8  thorpej  *    contributors may be used to endorse or promote products derived
     25  1.8  thorpej  *    from this software without specific prior written permission.
     26  1.8  thorpej  *
     27  1.8  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.8  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.8  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.8  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.8  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.8  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.8  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.8  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.8  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.8  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.8  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38  1.8  thorpej  */
     39  1.2  mycroft 
     40  1.2  mycroft /*
     41  1.4  mycroft  * Copyright (c) 1994, 1996, 1997 Charles M. Hannum.  All rights reserved.
     42  1.2  mycroft  *
     43  1.2  mycroft  * Redistribution and use in source and binary forms, with or without
     44  1.2  mycroft  * modification, are permitted provided that the following conditions
     45  1.2  mycroft  * are met:
     46  1.2  mycroft  * 1. Redistributions of source code must retain the above copyright
     47  1.2  mycroft  *    notice, this list of conditions and the following disclaimer.
     48  1.2  mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.2  mycroft  *    notice, this list of conditions and the following disclaimer in the
     50  1.2  mycroft  *    documentation and/or other materials provided with the distribution.
     51  1.2  mycroft  * 3. All advertising materials mentioning features or use of this software
     52  1.2  mycroft  *    must display the following acknowledgement:
     53  1.2  mycroft  *	This product includes software developed by Charles M. Hannum.
     54  1.2  mycroft  * 4. The name of the author may not be used to endorse or promote products
     55  1.2  mycroft  *    derived from this software without specific prior written permission.
     56  1.2  mycroft  *
     57  1.2  mycroft  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     58  1.2  mycroft  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     59  1.2  mycroft  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     60  1.2  mycroft  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     61  1.2  mycroft  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     62  1.2  mycroft  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     63  1.2  mycroft  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     64  1.2  mycroft  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     65  1.2  mycroft  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     66  1.2  mycroft  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     67  1.2  mycroft  */
     68  1.2  mycroft 
     69  1.7  thorpej #include <sys/queue.h>
     70  1.7  thorpej 
     71  1.1  mycroft #define UHA_MSCP_MAX	32	/* store up to 32 MSCPs at one time */
     72  1.1  mycroft #define	MSCP_HASH_SIZE	32	/* hash table size for phystokv */
     73  1.1  mycroft #define	MSCP_HASH_SHIFT	9
     74  1.1  mycroft #define MSCP_HASH(x)	((((long)(x))>>MSCP_HASH_SHIFT) & (MSCP_HASH_SIZE - 1))
     75  1.1  mycroft 
     76  1.1  mycroft struct uha_softc {
     77  1.1  mycroft 	struct device sc_dev;
     78  1.1  mycroft 
     79  1.3  thorpej 	bus_space_tag_t sc_iot;
     80  1.3  thorpej 	bus_space_handle_t sc_ioh;
     81  1.5  thorpej 	bus_dma_tag_t	sc_dmat;
     82  1.1  mycroft 	void *sc_ih;
     83  1.5  thorpej 
     84  1.5  thorpej 	int sc_dmaflags;	/* bus-specific DMA map creation flags */
     85  1.1  mycroft 
     86  1.1  mycroft 	void (*start_mbox) __P((struct uha_softc *, struct uha_mscp *));
     87  1.6   bouyer 	int (*poll) __P((struct uha_softc *, struct scsipi_xfer *, int));
     88  1.1  mycroft 	void (*init) __P((struct uha_softc *));
     89  1.1  mycroft 
     90  1.8  thorpej 	bus_dmamap_t sc_dmamap_mscp;	/* maps the mscps */
     91  1.8  thorpej 	struct uha_mscp *sc_mscps;	/* all our mscps */
     92  1.8  thorpej 
     93  1.1  mycroft 	struct uha_mscp *sc_mscphash[MSCP_HASH_SIZE];
     94  1.1  mycroft 	TAILQ_HEAD(, uha_mscp) sc_free_mscp;
     95  1.1  mycroft 	int sc_nummscps;
     96  1.6   bouyer 	struct scsipi_link sc_link;
     97  1.7  thorpej 
     98  1.7  thorpej 	LIST_HEAD(, scsipi_xfer) sc_queue;
     99  1.7  thorpej 	struct scsipi_xfer *sc_queuelast;
    100  1.1  mycroft };
    101  1.8  thorpej 
    102  1.8  thorpej /*
    103  1.8  thorpej  * Offset of an MSCP from the beginning of the MSCP DMA mapping.
    104  1.8  thorpej  */
    105  1.8  thorpej #define	UHA_MSCP_OFF(m)	(((u_long)(m)) - ((u_long)&sc->sc_mscps[0]))
    106  1.1  mycroft 
    107  1.4  mycroft struct uha_probe_data {
    108  1.4  mycroft 	int sc_irq, sc_drq;
    109  1.4  mycroft 	int sc_scsi_dev;
    110  1.4  mycroft };
    111  1.4  mycroft 
    112  1.4  mycroft void	uha_attach __P((struct uha_softc *, struct uha_probe_data *));
    113  1.1  mycroft void	uha_timeout __P((void *arg));
    114  1.1  mycroft struct	uha_mscp *uha_mscp_phys_kv __P((struct uha_softc *, u_long));
    115  1.1  mycroft void	uha_done __P((struct uha_softc *, struct uha_mscp *));
    116