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