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