Home | History | Annotate | Line # | Download | only in dev
sivar.h revision 1.8.20.1
      1  1.8.20.1   ad /*	$NetBSD: sivar.h,v 1.8.20.1 2007/02/09 21:03:50 ad 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.8.20.1   ad 	vaddr_t		dh_dmaaddr;	/* VA of buffer in DVMA space */
     66  1.8.20.1   ad 	vsize_t		dh_dmalen;	/* Length of KVA mapping. */
     67       1.1  gwr };
     68       1.1  gwr 
     69       1.1  gwr /*
     70       1.1  gwr  * The first structure member has to be the ncr5380_softc
     71       1.1  gwr  * so we can just cast to go back and fourth between them.
     72       1.1  gwr  */
     73       1.1  gwr struct si_softc {
     74       1.1  gwr 	struct ncr5380_softc	ncr_sc;
     75  1.8.20.1   ad 	bus_space_tag_t		sc_bst;
     76  1.8.20.1   ad 	bus_space_handle_t	sc_bsh;
     77       1.1  gwr 	volatile struct si_regs	*sc_regs;
     78  1.8.20.1   ad 	bus_dma_tag_t		sc_dmat;
     79  1.8.20.1   ad 	bus_dmamap_t		sc_dmap;
     80       1.1  gwr 	int		sc_adapter_type;
     81       1.1  gwr 	int		sc_adapter_iv_am;	/* int. vec + address modifier */
     82       1.2  gwr 	int 	sc_options;			/* options for this instance */
     83       1.1  gwr 	int 	sc_reqlen;  		/* requested transfer length */
     84       1.1  gwr 	struct si_dma_handle *sc_dma;
     85       1.1  gwr 	/* DMA command block for the OBIO controller. */
     86       1.1  gwr 	void *sc_dmacmd;
     87       1.1  gwr };
     88       1.2  gwr 
     89       1.5  gwr /* Options for disconnect/reselect, DMA, and interrupts. */
     90       1.5  gwr #define SI_NO_DISCONNECT    0xff
     91       1.5  gwr #define SI_NO_PARITY_CHK  0xff00
     92       1.5  gwr #define SI_FORCE_POLLING 0x10000
     93       1.5  gwr #define SI_DISABLE_DMA   0x20000
     94       1.2  gwr /* The options are taken from the config file (PR#1929) */
     95       1.1  gwr 
     96       1.1  gwr extern int si_debug;
     97       1.1  gwr 
     98       1.7  chs void si_attach(struct si_softc *);
     99       1.7  chs int  si_intr(void *);
    100       1.1  gwr 
    101       1.7  chs void si_dma_alloc(struct ncr5380_softc *);
    102       1.7  chs void si_dma_free(struct ncr5380_softc *);
    103       1.7  chs void si_dma_poll(struct ncr5380_softc *);
    104