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