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