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