isavar.h revision 1.37 1 /* $NetBSD: isavar.h,v 1.37 1999/03/19 05:13:18 cgd Exp $ */
2
3 /*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 /*
41 * Copyright (c) 1995 Chris G. Demetriou
42 * Copyright (c) 1992 Berkeley Software Design, Inc.
43 * All rights reserved.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions
47 * are met:
48 * 1. Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer.
50 * 2. Redistributions in binary form must reproduce the above copyright
51 * notice, this list of conditions and the following disclaimer in the
52 * documentation and/or other materials provided with the distribution.
53 * 3. All advertising materials mentioning features or use of this software
54 * must display the following acknowledgement:
55 * This product includes software developed by Berkeley Software
56 * Design, Inc.
57 * 4. The name of Berkeley Software Design must not be used to endorse
58 * or promote products derived from this software without specific
59 * prior written permission.
60 *
61 * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``AS IS'' AND
62 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64 * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN, INC. BE LIABLE
65 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71 * SUCH DAMAGE.
72 *
73 * BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
74 */
75
76 #ifndef _DEV_ISA_ISAVAR_H_
77 #define _DEV_ISA_ISAVAR_H_
78
79 /*
80 * Definitions for ISA autoconfiguration.
81 */
82
83 #include <sys/queue.h>
84 #include <machine/bus.h>
85
86 /*
87 * Structures and definitions needed by the machine-dependent header.
88 */
89 struct isabus_attach_args;
90
91 #include <machine/isa_machdep.h>
92
93 /*
94 * ISA bus attach arguments
95 */
96 struct isabus_attach_args {
97 char *iba_busname; /* XXX should be common */
98 bus_space_tag_t iba_iot; /* isa i/o space tag */
99 bus_space_tag_t iba_memt; /* isa mem space tag */
100 bus_dma_tag_t iba_dmat; /* isa DMA tag */
101 isa_chipset_tag_t iba_ic;
102 };
103
104 /*
105 * ISA driver attach arguments
106 */
107 struct isa_attach_args {
108 bus_space_tag_t ia_iot; /* isa i/o space tag */
109 bus_space_tag_t ia_memt; /* isa mem space tag */
110 bus_dma_tag_t ia_dmat; /* DMA tag */
111
112 isa_chipset_tag_t ia_ic;
113
114 int ia_iobase; /* base i/o address */
115 int ia_iosize; /* span of ports used */
116 int ia_irq; /* interrupt request */
117 int ia_drq; /* DMA request */
118 int ia_drq2; /* second DMA request */
119 int ia_maddr; /* physical i/o mem addr */
120 u_int ia_msize; /* size of i/o memory */
121 void *ia_aux; /* driver specific */
122 };
123
124 #include "locators.h"
125
126 #define IOBASEUNK ISACF_PORT_DEFAULT /* i/o address is unknown */
127 #define IRQUNK ISACF_IRQ_DEFAULT /* interrupt request line is unknown */
128 #define DRQUNK ISACF_DRQ_DEFAULT /* DMA request line is unknown */
129 #define MADDRUNK ISACF_IOMEM_DEFAULT /* shared memory address is unknown */
130
131 /*
132 * ISA master bus
133 */
134 struct isa_softc {
135 struct device sc_dev; /* base device */
136
137 bus_space_tag_t sc_iot; /* isa io space tag */
138 bus_space_tag_t sc_memt; /* isa mem space tag */
139 bus_dma_tag_t sc_dmat; /* isa DMA tag */
140
141 isa_chipset_tag_t sc_ic;
142 };
143
144 #define cf_iobase cf_loc[ISACF_PORT]
145 #define cf_iosize cf_loc[ISACF_SIZE]
146 #define cf_maddr cf_loc[ISACF_IOMEM]
147 #define cf_msize cf_loc[ISACF_IOSIZ]
148 #define cf_irq cf_loc[ISACF_IRQ]
149 #define cf_drq cf_loc[ISACF_DRQ]
150 #define cf_drq2 cf_loc[ISACF_DRQ2]
151
152 /*
153 * ISA interrupt handler manipulation.
154 *
155 * To establish an ISA interrupt handler, a driver calls isa_intr_establish()
156 * with the interrupt number, type, level, function, and function argument of
157 * the interrupt it wants to handle. Isa_intr_establish() returns an opaque
158 * handle to an event descriptor if it succeeds, and returns NULL on failure.
159 * (XXX: some drivers can't handle this, since the former behaviour was to
160 * invoke panic() on failure). When the system does not accept any of the
161 * interrupt types supported by the driver, the driver should fail the attach.
162 * Interrupt handlers should return 0 for "interrupt not for me", 1 for
163 * "I took care of it", or -1 for "I guess it was mine, but I wasn't
164 * expecting it."
165 *
166 * To remove an interrupt handler, the driver calls isa_intr_disestablish()
167 * with the handle returned by isa_intr_establish() for that handler.
168 */
169
170 /* ISA interrupt sharing types */
171 char *isa_intr_typename __P((int type));
172
173 /*
174 * Some ISA devices (e.g. on a VLB) can perform 32-bit DMA. This
175 * flag is passed to bus_dmamap_create() to indicate that fact.
176 */
177 #define ISABUS_DMA_32BIT BUS_DMA_BUS1
178
179 #endif /* _DEV_ISA_ISAVAR_H_ */
180