Home | History | Annotate | Line # | Download | only in ic
uhavar.h revision 1.13
      1  1.13    perry /*	$NetBSD: uhavar.h,v 1.13 2005/02/04 02:10:37 perry 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.9  mycroft  * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
      9   1.9  mycroft  * Simulation Facility, 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.2  mycroft  */
     39   1.2  mycroft 
     40   1.7  thorpej #include <sys/queue.h>
     41   1.7  thorpej 
     42   1.1  mycroft #define UHA_MSCP_MAX	32	/* store up to 32 MSCPs at one time */
     43   1.1  mycroft #define	MSCP_HASH_SIZE	32	/* hash table size for phystokv */
     44   1.1  mycroft #define	MSCP_HASH_SHIFT	9
     45   1.1  mycroft #define MSCP_HASH(x)	((((long)(x))>>MSCP_HASH_SHIFT) & (MSCP_HASH_SIZE - 1))
     46   1.1  mycroft 
     47   1.1  mycroft struct uha_softc {
     48   1.1  mycroft 	struct device sc_dev;
     49   1.1  mycroft 
     50   1.3  thorpej 	bus_space_tag_t sc_iot;
     51   1.3  thorpej 	bus_space_handle_t sc_ioh;
     52   1.5  thorpej 	bus_dma_tag_t	sc_dmat;
     53   1.1  mycroft 	void *sc_ih;
     54   1.5  thorpej 
     55   1.5  thorpej 	int sc_dmaflags;	/* bus-specific DMA map creation flags */
     56   1.1  mycroft 
     57  1.13    perry 	void (*start_mbox)(struct uha_softc *, struct uha_mscp *);
     58  1.13    perry 	int (*poll)(struct uha_softc *, struct scsipi_xfer *, int);
     59  1.13    perry 	void (*init)(struct uha_softc *);
     60   1.1  mycroft 
     61   1.8  thorpej 	bus_dmamap_t sc_dmamap_mscp;	/* maps the mscps */
     62   1.8  thorpej 	struct uha_mscp *sc_mscps;	/* all our mscps */
     63   1.8  thorpej 
     64   1.1  mycroft 	struct uha_mscp *sc_mscphash[MSCP_HASH_SIZE];
     65   1.1  mycroft 	TAILQ_HEAD(, uha_mscp) sc_free_mscp;
     66   1.1  mycroft 	int sc_nummscps;
     67  1.12   bouyer 
     68  1.10  thorpej 	struct scsipi_adapter sc_adapter;
     69  1.12   bouyer 	struct scsipi_channel sc_channel;
     70   1.1  mycroft };
     71   1.8  thorpej 
     72   1.8  thorpej /*
     73   1.8  thorpej  * Offset of an MSCP from the beginning of the MSCP DMA mapping.
     74   1.8  thorpej  */
     75   1.8  thorpej #define	UHA_MSCP_OFF(m)	(((u_long)(m)) - ((u_long)&sc->sc_mscps[0]))
     76   1.1  mycroft 
     77   1.4  mycroft struct uha_probe_data {
     78   1.4  mycroft 	int sc_irq, sc_drq;
     79   1.4  mycroft 	int sc_scsi_dev;
     80   1.4  mycroft };
     81   1.4  mycroft 
     82  1.13    perry void	uha_attach(struct uha_softc *, struct uha_probe_data *);
     83  1.13    perry void	uha_timeout(void *arg);
     84  1.13    perry struct	uha_mscp *uha_mscp_phys_kv(struct uha_softc *, u_long);
     85  1.13    perry void	uha_done(struct uha_softc *, struct uha_mscp *);
     86