pci_eb164.c revision 1.30.2.3 1 1.30.2.3 nathanw /* $NetBSD: pci_eb164.c,v 1.30.2.3 2002/10/18 02:34:23 nathanw Exp $ */
2 1.30.2.2 nathanw
3 1.30.2.2 nathanw /*-
4 1.30.2.2 nathanw * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.30.2.2 nathanw * All rights reserved.
6 1.30.2.2 nathanw *
7 1.30.2.2 nathanw * This code is derived from software contributed to The NetBSD Foundation
8 1.30.2.2 nathanw * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.30.2.2 nathanw * NASA Ames Research Center.
10 1.30.2.2 nathanw *
11 1.30.2.2 nathanw * Redistribution and use in source and binary forms, with or without
12 1.30.2.2 nathanw * modification, are permitted provided that the following conditions
13 1.30.2.2 nathanw * are met:
14 1.30.2.2 nathanw * 1. Redistributions of source code must retain the above copyright
15 1.30.2.2 nathanw * notice, this list of conditions and the following disclaimer.
16 1.30.2.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
17 1.30.2.2 nathanw * notice, this list of conditions and the following disclaimer in the
18 1.30.2.2 nathanw * documentation and/or other materials provided with the distribution.
19 1.30.2.2 nathanw * 3. All advertising materials mentioning features or use of this software
20 1.30.2.2 nathanw * must display the following acknowledgement:
21 1.30.2.2 nathanw * This product includes software developed by the NetBSD
22 1.30.2.2 nathanw * Foundation, Inc. and its contributors.
23 1.30.2.2 nathanw * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.30.2.2 nathanw * contributors may be used to endorse or promote products derived
25 1.30.2.2 nathanw * from this software without specific prior written permission.
26 1.30.2.2 nathanw *
27 1.30.2.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.30.2.2 nathanw * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.30.2.2 nathanw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.30.2.2 nathanw * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.30.2.2 nathanw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.30.2.2 nathanw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.30.2.2 nathanw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.30.2.2 nathanw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.30.2.2 nathanw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.30.2.2 nathanw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.30.2.2 nathanw * POSSIBILITY OF SUCH DAMAGE.
38 1.30.2.2 nathanw */
39 1.30.2.2 nathanw
40 1.30.2.2 nathanw /*
41 1.30.2.2 nathanw * Copyright (c) 1995, 1996 Carnegie-Mellon University.
42 1.30.2.2 nathanw * All rights reserved.
43 1.30.2.2 nathanw *
44 1.30.2.2 nathanw * Author: Chris G. Demetriou
45 1.30.2.2 nathanw *
46 1.30.2.2 nathanw * Permission to use, copy, modify and distribute this software and
47 1.30.2.2 nathanw * its documentation is hereby granted, provided that both the copyright
48 1.30.2.2 nathanw * notice and this permission notice appear in all copies of the
49 1.30.2.2 nathanw * software, derivative works or modified versions, and any portions
50 1.30.2.2 nathanw * thereof, and that both notices appear in supporting documentation.
51 1.30.2.2 nathanw *
52 1.30.2.2 nathanw * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
53 1.30.2.2 nathanw * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
54 1.30.2.2 nathanw * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
55 1.30.2.2 nathanw *
56 1.30.2.2 nathanw * Carnegie Mellon requests users of this software to return to
57 1.30.2.2 nathanw *
58 1.30.2.2 nathanw * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
59 1.30.2.2 nathanw * School of Computer Science
60 1.30.2.2 nathanw * Carnegie Mellon University
61 1.30.2.2 nathanw * Pittsburgh PA 15213-3890
62 1.30.2.2 nathanw *
63 1.30.2.2 nathanw * any improvements or extensions that they make and grant Carnegie the
64 1.30.2.2 nathanw * rights to redistribute these changes.
65 1.30.2.2 nathanw */
66 1.30.2.2 nathanw
67 1.30.2.2 nathanw #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
68 1.30.2.2 nathanw
69 1.30.2.3 nathanw __KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.30.2.3 2002/10/18 02:34:23 nathanw Exp $");
70 1.30.2.2 nathanw
71 1.30.2.2 nathanw #include <sys/types.h>
72 1.30.2.2 nathanw #include <sys/param.h>
73 1.30.2.2 nathanw #include <sys/time.h>
74 1.30.2.2 nathanw #include <sys/systm.h>
75 1.30.2.2 nathanw #include <sys/errno.h>
76 1.30.2.2 nathanw #include <sys/malloc.h>
77 1.30.2.2 nathanw #include <sys/device.h>
78 1.30.2.2 nathanw #include <sys/syslog.h>
79 1.30.2.2 nathanw
80 1.30.2.2 nathanw #include <uvm/uvm_extern.h>
81 1.30.2.2 nathanw
82 1.30.2.2 nathanw #include <machine/autoconf.h>
83 1.30.2.2 nathanw #include <machine/rpb.h>
84 1.30.2.2 nathanw
85 1.30.2.2 nathanw #include <dev/pci/pcireg.h>
86 1.30.2.2 nathanw #include <dev/pci/pcivar.h>
87 1.30.2.2 nathanw #include <dev/pci/pciidereg.h>
88 1.30.2.2 nathanw #include <dev/pci/pciidevar.h>
89 1.30.2.2 nathanw
90 1.30.2.2 nathanw #include <alpha/pci/ciareg.h>
91 1.30.2.2 nathanw #include <alpha/pci/ciavar.h>
92 1.30.2.2 nathanw
93 1.30.2.2 nathanw #include <alpha/pci/pci_eb164.h>
94 1.30.2.2 nathanw
95 1.30.2.2 nathanw #include "sio.h"
96 1.30.2.2 nathanw #if NSIO
97 1.30.2.2 nathanw #include <alpha/pci/siovar.h>
98 1.30.2.2 nathanw #endif
99 1.30.2.2 nathanw
100 1.30.2.2 nathanw int dec_eb164_intr_map __P((struct pci_attach_args *, pci_intr_handle_t *));
101 1.30.2.2 nathanw const char *dec_eb164_intr_string __P((void *, pci_intr_handle_t));
102 1.30.2.2 nathanw const struct evcnt *dec_eb164_intr_evcnt __P((void *, pci_intr_handle_t));
103 1.30.2.2 nathanw void *dec_eb164_intr_establish __P((void *, pci_intr_handle_t,
104 1.30.2.2 nathanw int, int (*func)(void *), void *));
105 1.30.2.2 nathanw void dec_eb164_intr_disestablish __P((void *, void *));
106 1.30.2.2 nathanw
107 1.30.2.2 nathanw void *dec_eb164_pciide_compat_intr_establish __P((void *, struct device *,
108 1.30.2.2 nathanw struct pci_attach_args *, int, int (*)(void *), void *));
109 1.30.2.2 nathanw
110 1.30.2.2 nathanw #define EB164_SIO_IRQ 4
111 1.30.2.2 nathanw #define EB164_MAX_IRQ 24
112 1.30.2.2 nathanw #define PCI_STRAY_MAX 5
113 1.30.2.2 nathanw
114 1.30.2.2 nathanw struct alpha_shared_intr *eb164_pci_intr;
115 1.30.2.2 nathanw
116 1.30.2.2 nathanw bus_space_tag_t eb164_intrgate_iot;
117 1.30.2.2 nathanw bus_space_handle_t eb164_intrgate_ioh;
118 1.30.2.2 nathanw
119 1.30.2.2 nathanw void eb164_iointr __P((void *arg, unsigned long vec));
120 1.30.2.2 nathanw extern void eb164_intr_enable __P((int irq)); /* pci_eb164_intr.S */
121 1.30.2.2 nathanw extern void eb164_intr_disable __P((int irq)); /* pci_eb164_intr.S */
122 1.30.2.2 nathanw
123 1.30.2.2 nathanw void
124 1.30.2.2 nathanw pci_eb164_pickintr(ccp)
125 1.30.2.2 nathanw struct cia_config *ccp;
126 1.30.2.2 nathanw {
127 1.30.2.2 nathanw bus_space_tag_t iot = &ccp->cc_iot;
128 1.30.2.2 nathanw pci_chipset_tag_t pc = &ccp->cc_pc;
129 1.30.2.2 nathanw char *cp;
130 1.30.2.2 nathanw int i;
131 1.30.2.2 nathanw
132 1.30.2.2 nathanw pc->pc_intr_v = ccp;
133 1.30.2.2 nathanw pc->pc_intr_map = dec_eb164_intr_map;
134 1.30.2.2 nathanw pc->pc_intr_string = dec_eb164_intr_string;
135 1.30.2.2 nathanw pc->pc_intr_evcnt = dec_eb164_intr_evcnt;
136 1.30.2.2 nathanw pc->pc_intr_establish = dec_eb164_intr_establish;
137 1.30.2.2 nathanw pc->pc_intr_disestablish = dec_eb164_intr_disestablish;
138 1.30.2.2 nathanw
139 1.30.2.2 nathanw pc->pc_pciide_compat_intr_establish =
140 1.30.2.2 nathanw dec_eb164_pciide_compat_intr_establish;
141 1.30.2.2 nathanw
142 1.30.2.2 nathanw eb164_intrgate_iot = iot;
143 1.30.2.2 nathanw if (bus_space_map(eb164_intrgate_iot, 0x804, 3, 0,
144 1.30.2.2 nathanw &eb164_intrgate_ioh) != 0)
145 1.30.2.2 nathanw panic("pci_eb164_pickintr: couldn't map interrupt PLD");
146 1.30.2.2 nathanw for (i = 0; i < EB164_MAX_IRQ; i++)
147 1.30.2.2 nathanw eb164_intr_disable(i);
148 1.30.2.2 nathanw
149 1.30.2.2 nathanw eb164_pci_intr = alpha_shared_intr_alloc(EB164_MAX_IRQ, 8);
150 1.30.2.2 nathanw for (i = 0; i < EB164_MAX_IRQ; i++) {
151 1.30.2.2 nathanw /*
152 1.30.2.2 nathanw * Systems with a Pyxis seem to have problems with
153 1.30.2.2 nathanw * stray interrupts, so just ignore them. Sigh,
154 1.30.2.2 nathanw * I hate buggy hardware.
155 1.30.2.2 nathanw */
156 1.30.2.2 nathanw alpha_shared_intr_set_maxstrays(eb164_pci_intr, i,
157 1.30.2.2 nathanw (ccp->cc_flags & CCF_ISPYXIS) ? 0 : PCI_STRAY_MAX);
158 1.30.2.2 nathanw
159 1.30.2.2 nathanw cp = alpha_shared_intr_string(eb164_pci_intr, i);
160 1.30.2.2 nathanw sprintf(cp, "irq %d", i);
161 1.30.2.2 nathanw evcnt_attach_dynamic(alpha_shared_intr_evcnt(
162 1.30.2.2 nathanw eb164_pci_intr, i), EVCNT_TYPE_INTR, NULL,
163 1.30.2.2 nathanw "eb164", cp);
164 1.30.2.2 nathanw }
165 1.30.2.2 nathanw
166 1.30.2.2 nathanw #if NSIO
167 1.30.2.2 nathanw sio_intr_setup(pc, iot);
168 1.30.2.2 nathanw eb164_intr_enable(EB164_SIO_IRQ);
169 1.30.2.2 nathanw #endif
170 1.30.2.2 nathanw }
171 1.30.2.2 nathanw
172 1.30.2.2 nathanw int
173 1.30.2.2 nathanw dec_eb164_intr_map(pa, ihp)
174 1.30.2.2 nathanw struct pci_attach_args *pa;
175 1.30.2.2 nathanw pci_intr_handle_t *ihp;
176 1.30.2.2 nathanw {
177 1.30.2.2 nathanw pcitag_t bustag = pa->pa_intrtag;
178 1.30.2.2 nathanw int buspin = pa->pa_intrpin, line = pa->pa_intrline;
179 1.30.2.2 nathanw pci_chipset_tag_t pc = pa->pa_pc;
180 1.30.2.2 nathanw int bus, device, function;
181 1.30.2.2 nathanw u_int64_t variation;
182 1.30.2.2 nathanw
183 1.30.2.2 nathanw if (buspin == 0) {
184 1.30.2.2 nathanw /* No IRQ used. */
185 1.30.2.2 nathanw return 1;
186 1.30.2.2 nathanw }
187 1.30.2.2 nathanw if (buspin > 4) {
188 1.30.2.2 nathanw printf("dec_eb164_intr_map: bad interrupt pin %d\n", buspin);
189 1.30.2.2 nathanw return 1;
190 1.30.2.2 nathanw }
191 1.30.2.2 nathanw
192 1.30.2.2 nathanw pci_decompose_tag(pc, bustag, &bus, &device, &function);
193 1.30.2.2 nathanw
194 1.30.2.2 nathanw variation = hwrpb->rpb_variation & SV_ST_MASK;
195 1.30.2.2 nathanw
196 1.30.2.2 nathanw /*
197 1.30.2.2 nathanw *
198 1.30.2.2 nathanw * The AlphaPC 164 and AlphaPC 164LX have a CMD PCI IDE controller
199 1.30.2.2 nathanw * at bus 0 device 11. These are wired to compatibility mode,
200 1.30.2.2 nathanw * so do not map their interrupts.
201 1.30.2.2 nathanw *
202 1.30.2.2 nathanw * The AlphaPC 164SX has PCI IDE on functions 1 and 2 of the
203 1.30.2.2 nathanw * Cypress PCI-ISA bridge at bus 0 device 8. These, too, are
204 1.30.2.2 nathanw * wired to compatibility mode.
205 1.30.2.2 nathanw *
206 1.30.2.2 nathanw * Real EB164s have ISA IDE on the Super I/O chip.
207 1.30.2.2 nathanw */
208 1.30.2.2 nathanw if (bus == 0) {
209 1.30.2.2 nathanw if (variation >= SV_ST_ALPHAPC164_366 &&
210 1.30.2.2 nathanw variation <= SV_ST_ALPHAPC164LX_600) {
211 1.30.2.2 nathanw if (device == 8)
212 1.30.2.2 nathanw panic("dec_eb164_intr_map: SIO device");
213 1.30.2.2 nathanw if (device == 11)
214 1.30.2.2 nathanw return (1);
215 1.30.2.2 nathanw } else if (variation >= SV_ST_ALPHAPC164SX_400 &&
216 1.30.2.2 nathanw variation <= SV_ST_ALPHAPC164SX_600) {
217 1.30.2.2 nathanw if (device == 8) {
218 1.30.2.2 nathanw if (function == 0)
219 1.30.2.2 nathanw panic("dec_eb164_intr_map: SIO device");
220 1.30.2.2 nathanw return (1);
221 1.30.2.2 nathanw }
222 1.30.2.2 nathanw } else {
223 1.30.2.2 nathanw if (device == 8)
224 1.30.2.2 nathanw panic("dec_eb164_intr_map: SIO device");
225 1.30.2.2 nathanw }
226 1.30.2.2 nathanw }
227 1.30.2.2 nathanw
228 1.30.2.2 nathanw /*
229 1.30.2.2 nathanw * The console places the interrupt mapping in the "line" value.
230 1.30.2.2 nathanw * A value of (char)-1 indicates there is no mapping.
231 1.30.2.2 nathanw */
232 1.30.2.2 nathanw if (line == 0xff) {
233 1.30.2.2 nathanw printf("dec_eb164_intr_map: no mapping for %d/%d/%d\n",
234 1.30.2.2 nathanw bus, device, function);
235 1.30.2.2 nathanw return (1);
236 1.30.2.2 nathanw }
237 1.30.2.2 nathanw
238 1.30.2.2 nathanw if (line > EB164_MAX_IRQ)
239 1.30.2.3 nathanw panic("dec_eb164_intr_map: eb164 irq too large (%d)",
240 1.30.2.2 nathanw line);
241 1.30.2.2 nathanw
242 1.30.2.2 nathanw *ihp = line;
243 1.30.2.2 nathanw return (0);
244 1.30.2.2 nathanw }
245 1.30.2.2 nathanw
246 1.30.2.2 nathanw const char *
247 1.30.2.2 nathanw dec_eb164_intr_string(ccv, ih)
248 1.30.2.2 nathanw void *ccv;
249 1.30.2.2 nathanw pci_intr_handle_t ih;
250 1.30.2.2 nathanw {
251 1.30.2.2 nathanw #if 0
252 1.30.2.2 nathanw struct cia_config *ccp = ccv;
253 1.30.2.2 nathanw #endif
254 1.30.2.2 nathanw static char irqstr[15]; /* 11 + 2 + NULL + sanity */
255 1.30.2.2 nathanw
256 1.30.2.2 nathanw if (ih > EB164_MAX_IRQ)
257 1.30.2.3 nathanw panic("dec_eb164_intr_string: bogus eb164 IRQ 0x%lx", ih);
258 1.30.2.2 nathanw sprintf(irqstr, "eb164 irq %ld", ih);
259 1.30.2.2 nathanw return (irqstr);
260 1.30.2.2 nathanw }
261 1.30.2.2 nathanw
262 1.30.2.2 nathanw const struct evcnt *
263 1.30.2.2 nathanw dec_eb164_intr_evcnt(ccv, ih)
264 1.30.2.2 nathanw void *ccv;
265 1.30.2.2 nathanw pci_intr_handle_t ih;
266 1.30.2.2 nathanw {
267 1.30.2.2 nathanw #if 0
268 1.30.2.2 nathanw struct cia_config *ccp = ccv;
269 1.30.2.2 nathanw #endif
270 1.30.2.2 nathanw
271 1.30.2.2 nathanw if (ih > EB164_MAX_IRQ)
272 1.30.2.3 nathanw panic("dec_eb164_intr_string: bogus eb164 IRQ 0x%lx", ih);
273 1.30.2.2 nathanw return (alpha_shared_intr_evcnt(eb164_pci_intr, ih));
274 1.30.2.2 nathanw }
275 1.30.2.2 nathanw
276 1.30.2.2 nathanw void *
277 1.30.2.2 nathanw dec_eb164_intr_establish(ccv, ih, level, func, arg)
278 1.30.2.2 nathanw void *ccv, *arg;
279 1.30.2.2 nathanw pci_intr_handle_t ih;
280 1.30.2.2 nathanw int level;
281 1.30.2.2 nathanw int (*func) __P((void *));
282 1.30.2.2 nathanw {
283 1.30.2.2 nathanw #if 0
284 1.30.2.2 nathanw struct cia_config *ccp = ccv;
285 1.30.2.2 nathanw #endif
286 1.30.2.2 nathanw void *cookie;
287 1.30.2.2 nathanw
288 1.30.2.2 nathanw if (ih > EB164_MAX_IRQ)
289 1.30.2.3 nathanw panic("dec_eb164_intr_establish: bogus eb164 IRQ 0x%lx", ih);
290 1.30.2.2 nathanw
291 1.30.2.2 nathanw cookie = alpha_shared_intr_establish(eb164_pci_intr, ih, IST_LEVEL,
292 1.30.2.2 nathanw level, func, arg, "eb164 irq");
293 1.30.2.2 nathanw
294 1.30.2.2 nathanw if (cookie != NULL &&
295 1.30.2.2 nathanw alpha_shared_intr_firstactive(eb164_pci_intr, ih)) {
296 1.30.2.2 nathanw scb_set(0x900 + SCB_IDXTOVEC(ih), eb164_iointr, NULL);
297 1.30.2.2 nathanw eb164_intr_enable(ih);
298 1.30.2.2 nathanw }
299 1.30.2.2 nathanw return (cookie);
300 1.30.2.2 nathanw }
301 1.30.2.2 nathanw
302 1.30.2.2 nathanw void
303 1.30.2.2 nathanw dec_eb164_intr_disestablish(ccv, cookie)
304 1.30.2.2 nathanw void *ccv, *cookie;
305 1.30.2.2 nathanw {
306 1.30.2.2 nathanw #if 0
307 1.30.2.2 nathanw struct cia_config *ccp = ccv;
308 1.30.2.2 nathanw #endif
309 1.30.2.2 nathanw struct alpha_shared_intrhand *ih = cookie;
310 1.30.2.2 nathanw unsigned int irq = ih->ih_num;
311 1.30.2.2 nathanw int s;
312 1.30.2.2 nathanw
313 1.30.2.2 nathanw s = splhigh();
314 1.30.2.2 nathanw
315 1.30.2.2 nathanw alpha_shared_intr_disestablish(eb164_pci_intr, cookie,
316 1.30.2.2 nathanw "eb164 irq");
317 1.30.2.2 nathanw if (alpha_shared_intr_isactive(eb164_pci_intr, irq) == 0) {
318 1.30.2.2 nathanw eb164_intr_disable(irq);
319 1.30.2.2 nathanw alpha_shared_intr_set_dfltsharetype(eb164_pci_intr, irq,
320 1.30.2.2 nathanw IST_NONE);
321 1.30.2.2 nathanw scb_free(0x900 + SCB_IDXTOVEC(irq));
322 1.30.2.2 nathanw }
323 1.30.2.2 nathanw
324 1.30.2.2 nathanw splx(s);
325 1.30.2.2 nathanw }
326 1.30.2.2 nathanw
327 1.30.2.2 nathanw void *
328 1.30.2.2 nathanw dec_eb164_pciide_compat_intr_establish(v, dev, pa, chan, func, arg)
329 1.30.2.2 nathanw void *v;
330 1.30.2.2 nathanw struct device *dev;
331 1.30.2.2 nathanw struct pci_attach_args *pa;
332 1.30.2.2 nathanw int chan;
333 1.30.2.2 nathanw int (*func) __P((void *));
334 1.30.2.2 nathanw void *arg;
335 1.30.2.2 nathanw {
336 1.30.2.2 nathanw pci_chipset_tag_t pc = pa->pa_pc;
337 1.30.2.2 nathanw void *cookie = NULL;
338 1.30.2.2 nathanw int bus, irq;
339 1.30.2.2 nathanw
340 1.30.2.2 nathanw pci_decompose_tag(pc, pa->pa_tag, &bus, NULL, NULL);
341 1.30.2.2 nathanw
342 1.30.2.2 nathanw /*
343 1.30.2.2 nathanw * If this isn't PCI bus #0, all bets are off.
344 1.30.2.2 nathanw */
345 1.30.2.2 nathanw if (bus != 0)
346 1.30.2.2 nathanw return (NULL);
347 1.30.2.2 nathanw
348 1.30.2.2 nathanw irq = PCIIDE_COMPAT_IRQ(chan);
349 1.30.2.2 nathanw #if NSIO
350 1.30.2.2 nathanw cookie = sio_intr_establish(NULL /*XXX*/, irq, IST_EDGE, IPL_BIO,
351 1.30.2.2 nathanw func, arg);
352 1.30.2.2 nathanw if (cookie == NULL)
353 1.30.2.2 nathanw return (NULL);
354 1.30.2.2 nathanw printf("%s: %s channel interrupting at %s\n", dev->dv_xname,
355 1.30.2.2 nathanw PCIIDE_CHANNEL_NAME(chan), sio_intr_string(NULL /*XXX*/, irq));
356 1.30.2.2 nathanw #endif
357 1.30.2.2 nathanw return (cookie);
358 1.30.2.2 nathanw }
359 1.30.2.2 nathanw
360 1.30.2.2 nathanw void
361 1.30.2.2 nathanw eb164_iointr(arg, vec)
362 1.30.2.2 nathanw void *arg;
363 1.30.2.2 nathanw unsigned long vec;
364 1.30.2.2 nathanw {
365 1.30.2.2 nathanw int irq;
366 1.30.2.2 nathanw
367 1.30.2.2 nathanw irq = SCB_VECTOIDX(vec - 0x900);
368 1.30.2.2 nathanw
369 1.30.2.2 nathanw if (!alpha_shared_intr_dispatch(eb164_pci_intr, irq)) {
370 1.30.2.2 nathanw alpha_shared_intr_stray(eb164_pci_intr, irq,
371 1.30.2.2 nathanw "eb164 irq");
372 1.30.2.2 nathanw if (ALPHA_SHARED_INTR_DISABLE(eb164_pci_intr, irq))
373 1.30.2.2 nathanw eb164_intr_disable(irq);
374 1.30.2.2 nathanw }
375 1.30.2.2 nathanw }
376 1.30.2.2 nathanw
377 1.30.2.2 nathanw #if 0 /* THIS DOES NOT WORK! see pci_eb164_intr.S. */
378 1.30.2.2 nathanw u_int8_t eb164_intr_mask[3] = { 0xff, 0xff, 0xff };
379 1.30.2.2 nathanw
380 1.30.2.2 nathanw void
381 1.30.2.2 nathanw eb164_intr_enable(irq)
382 1.30.2.2 nathanw int irq;
383 1.30.2.2 nathanw {
384 1.30.2.2 nathanw int byte = (irq / 8), bit = (irq % 8);
385 1.30.2.2 nathanw
386 1.30.2.2 nathanw #if 1
387 1.30.2.2 nathanw printf("eb164_intr_enable: enabling %d (%d:%d)\n", irq, byte, bit);
388 1.30.2.2 nathanw #endif
389 1.30.2.2 nathanw eb164_intr_mask[byte] &= ~(1 << bit);
390 1.30.2.2 nathanw
391 1.30.2.2 nathanw bus_space_write_1(eb164_intrgate_iot, eb164_intrgate_ioh, byte,
392 1.30.2.2 nathanw eb164_intr_mask[byte]);
393 1.30.2.2 nathanw }
394 1.30.2.2 nathanw
395 1.30.2.2 nathanw void
396 1.30.2.2 nathanw eb164_intr_disable(irq)
397 1.30.2.2 nathanw int irq;
398 1.30.2.2 nathanw {
399 1.30.2.2 nathanw int byte = (irq / 8), bit = (irq % 8);
400 1.30.2.2 nathanw
401 1.30.2.2 nathanw #if 1
402 1.30.2.2 nathanw printf("eb164_intr_disable: disabling %d (%d:%d)\n", irq, byte, bit);
403 1.30.2.2 nathanw #endif
404 1.30.2.2 nathanw eb164_intr_mask[byte] |= (1 << bit);
405 1.30.2.2 nathanw
406 1.30.2.2 nathanw bus_space_write_1(eb164_intrgate_iot, eb164_intrgate_ioh, byte,
407 1.30.2.2 nathanw eb164_intr_mask[byte]);
408 1.30.2.2 nathanw }
409 1.30.2.2 nathanw #endif
410