Home | History | Annotate | Line # | Download | only in dev
sivar.h revision 1.1
      1  1.1  gwr /*	$NetBSD: sivar.h,v 1.1 1996/03/26 15:01:15 gwr Exp $	*/
      2  1.1  gwr 
      3  1.1  gwr /*
      4  1.1  gwr  * Copyright (c) 1995 David Jones, Gordon W. Ross
      5  1.1  gwr  * All rights reserved.
      6  1.1  gwr  *
      7  1.1  gwr  * Redistribution and use in source and binary forms, with or without
      8  1.1  gwr  * modification, are permitted provided that the following conditions
      9  1.1  gwr  * are met:
     10  1.1  gwr  * 1. Redistributions of source code must retain the above copyright
     11  1.1  gwr  *    notice, this list of conditions and the following disclaimer.
     12  1.1  gwr  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  gwr  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  gwr  *    documentation and/or other materials provided with the distribution.
     15  1.1  gwr  * 3. The name of the authors may not be used to endorse or promote products
     16  1.1  gwr  *    derived from this software without specific prior written permission.
     17  1.1  gwr  * 4. All advertising materials mentioning features or use of this software
     18  1.1  gwr  *    must display the following acknowledgement:
     19  1.1  gwr  *      This product includes software developed by
     20  1.1  gwr  *      David Jones and Gordon Ross
     21  1.1  gwr  *
     22  1.1  gwr  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
     23  1.1  gwr  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  1.1  gwr  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1  gwr  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  1.1  gwr  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27  1.1  gwr  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  1.1  gwr  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  1.1  gwr  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  1.1  gwr  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31  1.1  gwr  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  1.1  gwr  */
     33  1.1  gwr 
     34  1.1  gwr /*
     35  1.1  gwr  * This file defines the interface between si.c and
     36  1.1  gwr  * the bus-specific files: si_obio.c, si_vme.c
     37  1.1  gwr  */
     38  1.1  gwr 
     39  1.1  gwr /*
     40  1.1  gwr  * Transfers smaller than this are done using PIO
     41  1.1  gwr  * (on assumption they're not worth DMA overhead)
     42  1.1  gwr  */
     43  1.1  gwr #define	MIN_DMA_LEN 128
     44  1.1  gwr 
     45  1.1  gwr /*
     46  1.1  gwr  * Transfers lager than 65535 bytes need to be split-up.
     47  1.1  gwr  * (Some of the FIFO logic has only 16 bits counters.)
     48  1.1  gwr  * Make the size an integer multiple of the page size
     49  1.1  gwr  * to avoid buf/cluster remap problems.  (paranoid?)
     50  1.1  gwr  */
     51  1.1  gwr #define	MAX_DMA_LEN 0xE000
     52  1.1  gwr 
     53  1.1  gwr /*
     54  1.1  gwr  * This structure is used to keep track of mapped DMA requests.
     55  1.1  gwr  */
     56  1.1  gwr struct si_dma_handle {
     57  1.1  gwr 	int 		dh_flags;
     58  1.1  gwr #define	SIDH_BUSY	1		/* This DH is in use */
     59  1.1  gwr #define	SIDH_OUT	2		/* DMA does data out (write) */
     60  1.1  gwr 	u_char *	dh_addr;	/* KVA of start of buffer */
     61  1.1  gwr 	int 		dh_maplen;	/* Length of KVA mapping. */
     62  1.1  gwr 	long		dh_dvma;	/* VA of buffer in DVMA space */
     63  1.1  gwr };
     64  1.1  gwr 
     65  1.1  gwr /*
     66  1.1  gwr  * The first structure member has to be the ncr5380_softc
     67  1.1  gwr  * so we can just cast to go back and fourth between them.
     68  1.1  gwr  */
     69  1.1  gwr struct si_softc {
     70  1.1  gwr 	struct ncr5380_softc	ncr_sc;
     71  1.1  gwr 	volatile struct si_regs	*sc_regs;
     72  1.1  gwr 	int		sc_adapter_type;
     73  1.1  gwr 	int		sc_adapter_iv_am;	/* int. vec + address modifier */
     74  1.1  gwr 	int 	sc_reqlen;  		/* requested transfer length */
     75  1.1  gwr 	struct si_dma_handle *sc_dma;
     76  1.1  gwr 	/* DMA command block for the OBIO controller. */
     77  1.1  gwr 	void *sc_dmacmd;
     78  1.1  gwr };
     79  1.1  gwr 
     80  1.1  gwr extern int si_debug;
     81  1.1  gwr 
     82  1.1  gwr void si_attach __P((struct si_softc *));
     83  1.1  gwr int  si_intr __P((void *));
     84  1.1  gwr 
     85  1.1  gwr void si_reset_adapter __P((struct ncr5380_softc *));
     86  1.1  gwr 
     87  1.1  gwr void si_dma_alloc __P((struct ncr5380_softc *));
     88  1.1  gwr void si_dma_free __P((struct ncr5380_softc *));
     89  1.1  gwr void si_dma_poll __P((struct ncr5380_softc *));
     90