pci_machdep.c revision 1.26 1 1.26 thorpej /* $NetBSD: pci_machdep.c,v 1.26 2020/09/25 03:40:11 thorpej Exp $ */
2 1.25 thorpej
3 1.25 thorpej /*-
4 1.25 thorpej * Copyright (c) 2020 The NetBSD Foundation, Inc.
5 1.25 thorpej * All rights reserved.
6 1.25 thorpej *
7 1.25 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.25 thorpej * by Jason R. Thorpe.
9 1.25 thorpej *
10 1.25 thorpej * Redistribution and use in source and binary forms, with or without
11 1.25 thorpej * modification, are permitted provided that the following conditions
12 1.25 thorpej * are met:
13 1.25 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.25 thorpej * notice, this list of conditions and the following disclaimer.
15 1.25 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.25 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.25 thorpej * documentation and/or other materials provided with the distribution.
18 1.25 thorpej *
19 1.25 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.25 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.25 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.25 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.25 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.25 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.25 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.25 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.25 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.25 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.25 thorpej * POSSIBILITY OF SUCH DAMAGE.
30 1.25 thorpej */
31 1.1 cgd
32 1.1 cgd /*
33 1.5 cgd * Copyright (c) 1995, 1996 Carnegie-Mellon University.
34 1.3 cgd * All rights reserved.
35 1.1 cgd *
36 1.3 cgd * Author: Chris G. Demetriou
37 1.19 matt *
38 1.3 cgd * Permission to use, copy, modify and distribute this software and
39 1.3 cgd * its documentation is hereby granted, provided that both the copyright
40 1.3 cgd * notice and this permission notice appear in all copies of the
41 1.3 cgd * software, derivative works or modified versions, and any portions
42 1.3 cgd * thereof, and that both notices appear in supporting documentation.
43 1.19 matt *
44 1.19 matt * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 1.19 matt * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
46 1.3 cgd * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 1.19 matt *
48 1.3 cgd * Carnegie Mellon requests users of this software to return to
49 1.1 cgd *
50 1.3 cgd * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
51 1.3 cgd * School of Computer Science
52 1.3 cgd * Carnegie Mellon University
53 1.3 cgd * Pittsburgh PA 15213-3890
54 1.3 cgd *
55 1.3 cgd * any improvements or extensions that they make and grant Carnegie the
56 1.3 cgd * rights to redistribute these changes.
57 1.1 cgd */
58 1.1 cgd
59 1.1 cgd /*
60 1.1 cgd * Machine-specific functions for PCI autoconfiguration.
61 1.1 cgd */
62 1.9 cgd
63 1.10 cgd #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
64 1.10 cgd
65 1.26 thorpej __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.26 2020/09/25 03:40:11 thorpej Exp $");
66 1.1 cgd
67 1.1 cgd #include <sys/types.h>
68 1.1 cgd #include <sys/param.h>
69 1.1 cgd #include <sys/time.h>
70 1.1 cgd #include <sys/systm.h>
71 1.1 cgd #include <sys/errno.h>
72 1.1 cgd #include <sys/device.h>
73 1.26 thorpej #include <sys/cpu.h>
74 1.14 mrg
75 1.1 cgd #include <dev/isa/isavar.h>
76 1.3 cgd #include <dev/pci/pcireg.h>
77 1.1 cgd #include <dev/pci/pcivar.h>
78 1.2 cgd #include <dev/pci/pcidevs.h>
79 1.1 cgd
80 1.7 cgd #include "vga_pci.h"
81 1.7 cgd #if NVGA_PCI
82 1.13 drochner #include <dev/ic/mc6845reg.h>
83 1.13 drochner #include <dev/ic/pcdisplayvar.h>
84 1.12 drochner #include <dev/pci/vga_pcivar.h>
85 1.3 cgd #endif
86 1.3 cgd
87 1.2 cgd #include "tga.h"
88 1.3 cgd #if NTGA
89 1.12 drochner #include <dev/pci/tgavar.h>
90 1.3 cgd #endif
91 1.1 cgd
92 1.20 tsutsui #include <machine/rpb.h>
93 1.20 tsutsui
94 1.1 cgd void
95 1.17 dsl pci_display_console(bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc, int bus, int device, int function)
96 1.1 cgd {
97 1.23 uebayasi #if NVGA_PCI || NTGA
98 1.4 cgd pcitag_t tag;
99 1.24 rin pcireg_t id;
100 1.4 cgd int match, nmatch;
101 1.23 uebayasi #endif
102 1.24 rin #if NVGA_PCI
103 1.24 rin pcireg_t class;
104 1.24 rin #endif
105 1.16 dsl int (*fn)(bus_space_tag_t, bus_space_tag_t, pci_chipset_tag_t,
106 1.16 dsl int, int, int);
107 1.1 cgd
108 1.23 uebayasi #if NVGA_PCI || NTGA
109 1.4 cgd tag = pci_make_tag(pc, bus, device, function);
110 1.4 cgd id = pci_conf_read(pc, tag, PCI_ID_REG);
111 1.2 cgd if (id == 0 || id == 0xffffffff)
112 1.2 cgd panic("pci_display_console: no device at %d/%d/%d",
113 1.2 cgd bus, device, function);
114 1.24 rin # if NVGA_PCI
115 1.4 cgd class = pci_conf_read(pc, tag, PCI_CLASS_REG);
116 1.24 rin # endif
117 1.4 cgd
118 1.23 uebayasi match = 0;
119 1.23 uebayasi #endif
120 1.4 cgd fn = NULL;
121 1.2 cgd
122 1.7 cgd #if NVGA_PCI
123 1.7 cgd nmatch = DEVICE_IS_VGA_PCI(class, id);
124 1.4 cgd if (nmatch > match) {
125 1.4 cgd match = nmatch;
126 1.12 drochner fn = vga_pci_cnattach;
127 1.2 cgd }
128 1.3 cgd #endif
129 1.2 cgd #if NTGA
130 1.4 cgd nmatch = DEVICE_IS_TGA(class, id);
131 1.15 elric if (nmatch > match)
132 1.15 elric nmatch = tga_cnmatch(iot, memt, pc, tag);
133 1.4 cgd if (nmatch > match) {
134 1.4 cgd match = nmatch;
135 1.12 drochner fn = tga_cnattach;
136 1.2 cgd }
137 1.3 cgd #endif
138 1.2 cgd
139 1.4 cgd if (fn != NULL)
140 1.6 cgd (*fn)(iot, memt, pc, bus, device, function);
141 1.4 cgd else
142 1.4 cgd panic("pci_display_console: unconfigured device at %d/%d/%d",
143 1.2 cgd bus, device, function);
144 1.1 cgd }
145 1.20 tsutsui
146 1.20 tsutsui void
147 1.20 tsutsui device_pci_register(device_t dev, void *aux)
148 1.20 tsutsui {
149 1.20 tsutsui struct pci_attach_args *pa = aux;
150 1.20 tsutsui struct ctb *ctb;
151 1.20 tsutsui prop_dictionary_t dict;
152 1.20 tsutsui
153 1.20 tsutsui /* set properties for PCI framebuffers */
154 1.20 tsutsui ctb = (struct ctb *)(((char *)hwrpb) + hwrpb->rpb_ctb_off);
155 1.20 tsutsui if (PCI_CLASS(pa->pa_class) == PCI_CLASS_DISPLAY &&
156 1.20 tsutsui ctb->ctb_term_type == CTB_GRAPHICS) {
157 1.20 tsutsui /* XXX should consider multiple displays? */
158 1.20 tsutsui dict = device_properties(dev);
159 1.20 tsutsui prop_dictionary_set_bool(dict, "is_console", true);
160 1.20 tsutsui }
161 1.20 tsutsui }
162 1.25 thorpej
163 1.25 thorpej int
164 1.25 thorpej alpha_pci_generic_intr_map(const struct pci_attach_args * const pa,
165 1.25 thorpej pci_intr_handle_t * const ihp)
166 1.25 thorpej {
167 1.25 thorpej pcitag_t const bustag = pa->pa_intrtag;
168 1.25 thorpej int const buspin = pa->pa_intrpin;
169 1.25 thorpej int const line = pa->pa_intrline;
170 1.25 thorpej pci_chipset_tag_t const pc = pa->pa_pc;
171 1.25 thorpej int bus, device, function;
172 1.25 thorpej
173 1.25 thorpej if (buspin == 0) {
174 1.25 thorpej /* No IRQ used. */
175 1.25 thorpej return 1;
176 1.25 thorpej }
177 1.25 thorpej if (buspin < 0 || buspin > 4) {
178 1.25 thorpej printf("%s: bad interrupt pin %d\n", __func__, buspin);
179 1.25 thorpej return 1;
180 1.25 thorpej }
181 1.25 thorpej
182 1.25 thorpej pci_decompose_tag(pc, bustag, &bus, &device, &function);
183 1.25 thorpej
184 1.25 thorpej /*
185 1.25 thorpej * The console firmware places the interrupt mapping in the "line"
186 1.25 thorpej * value. A valaue of (char)-1 indicates there is no mapping.
187 1.25 thorpej */
188 1.25 thorpej if (line == 0xff) {
189 1.25 thorpej printf("%s: no mapping for %d/%d/%d\n", __func__,
190 1.25 thorpej bus, device, function);
191 1.25 thorpej return 1;
192 1.25 thorpej }
193 1.25 thorpej
194 1.25 thorpej if (line < 0 || line >= pc->pc_nirq) {
195 1.25 thorpej printf("%s: bad line %d for %d/%d/%d\n", __func__,
196 1.25 thorpej line, bus, device, function);
197 1.25 thorpej return 1;
198 1.25 thorpej }
199 1.25 thorpej
200 1.25 thorpej alpha_pci_intr_handle_init(ihp, line, 0);
201 1.25 thorpej return 0;
202 1.25 thorpej }
203 1.25 thorpej
204 1.25 thorpej const char *
205 1.25 thorpej alpha_pci_generic_intr_string(pci_chipset_tag_t const pc,
206 1.25 thorpej pci_intr_handle_t const ih, char * const buf, size_t const len)
207 1.25 thorpej {
208 1.25 thorpej const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
209 1.25 thorpej
210 1.25 thorpej KASSERT(irq < pc->pc_nirq);
211 1.25 thorpej
212 1.25 thorpej snprintf(buf, len, "%s %u", pc->pc_intr_desc, irq);
213 1.25 thorpej return buf;
214 1.25 thorpej }
215 1.25 thorpej
216 1.25 thorpej const struct evcnt *
217 1.25 thorpej alpha_pci_generic_intr_evcnt(pci_chipset_tag_t const pc,
218 1.25 thorpej pci_intr_handle_t const ih)
219 1.25 thorpej {
220 1.25 thorpej const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
221 1.25 thorpej
222 1.25 thorpej KASSERT(irq < pc->pc_nirq);
223 1.25 thorpej
224 1.25 thorpej return alpha_shared_intr_evcnt(pc->pc_shared_intrs, irq);
225 1.25 thorpej }
226 1.25 thorpej
227 1.25 thorpej void *
228 1.25 thorpej alpha_pci_generic_intr_establish(pci_chipset_tag_t const pc,
229 1.25 thorpej pci_intr_handle_t const ih, int const level,
230 1.25 thorpej int (*func)(void *), void *arg)
231 1.25 thorpej {
232 1.25 thorpej const u_int irq = alpha_pci_intr_handle_get_irq(&ih);
233 1.25 thorpej const u_int flags = alpha_pci_intr_handle_get_flags(&ih);
234 1.25 thorpej void *cookie;
235 1.25 thorpej
236 1.25 thorpej KASSERT(irq < pc->pc_nirq);
237 1.25 thorpej
238 1.26 thorpej cookie = alpha_shared_intr_alloc_intrhand(pc->pc_shared_intrs,
239 1.25 thorpej irq, IST_LEVEL, level, flags, func, arg, pc->pc_intr_desc);
240 1.25 thorpej
241 1.26 thorpej if (cookie == NULL)
242 1.26 thorpej return NULL;
243 1.26 thorpej
244 1.26 thorpej mutex_enter(&cpu_lock);
245 1.26 thorpej
246 1.26 thorpej if (! alpha_shared_intr_link(pc->pc_shared_intrs, cookie,
247 1.26 thorpej pc->pc_intr_desc)) {
248 1.26 thorpej mutex_exit(&cpu_lock);
249 1.26 thorpej alpha_shared_intr_free_intrhand(cookie);
250 1.26 thorpej return NULL;
251 1.26 thorpej }
252 1.26 thorpej
253 1.26 thorpej if (alpha_shared_intr_firstactive(pc->pc_shared_intrs, irq)) {
254 1.25 thorpej scb_set(pc->pc_vecbase + SCB_IDXTOVEC(irq),
255 1.25 thorpej alpha_pci_generic_iointr, pc);
256 1.25 thorpej pc->pc_intr_enable(pc, irq);
257 1.25 thorpej }
258 1.26 thorpej
259 1.26 thorpej mutex_exit(&cpu_lock);
260 1.26 thorpej
261 1.25 thorpej return cookie;
262 1.25 thorpej }
263 1.25 thorpej
264 1.25 thorpej void
265 1.25 thorpej alpha_pci_generic_intr_disestablish(pci_chipset_tag_t const pc,
266 1.25 thorpej void * const cookie)
267 1.25 thorpej {
268 1.25 thorpej struct alpha_shared_intrhand * const ih = cookie;
269 1.25 thorpej const u_int irq = ih->ih_num;
270 1.25 thorpej
271 1.26 thorpej mutex_enter(&cpu_lock);
272 1.25 thorpej
273 1.26 thorpej if (alpha_shared_intr_firstactive(pc->pc_shared_intrs, irq)) {
274 1.25 thorpej pc->pc_intr_disable(pc, irq);
275 1.25 thorpej alpha_shared_intr_set_dfltsharetype(pc->pc_shared_intrs,
276 1.25 thorpej irq, IST_NONE);
277 1.25 thorpej scb_free(pc->pc_vecbase + SCB_IDXTOVEC(irq));
278 1.25 thorpej }
279 1.25 thorpej
280 1.26 thorpej alpha_shared_intr_unlink(pc->pc_shared_intrs, cookie, pc->pc_intr_desc);
281 1.26 thorpej
282 1.26 thorpej mutex_exit(&cpu_lock);
283 1.26 thorpej
284 1.26 thorpej alpha_shared_intr_free_intrhand(cookie);
285 1.25 thorpej }
286 1.25 thorpej
287 1.25 thorpej void
288 1.25 thorpej alpha_pci_generic_iointr(void * const arg, unsigned long const vec)
289 1.25 thorpej {
290 1.25 thorpej pci_chipset_tag_t const pc = arg;
291 1.25 thorpej const u_int irq = SCB_VECTOIDX(vec - pc->pc_vecbase);
292 1.25 thorpej
293 1.25 thorpej if (!alpha_shared_intr_dispatch(pc->pc_shared_intrs, irq)) {
294 1.25 thorpej alpha_shared_intr_stray(pc->pc_shared_intrs, irq,
295 1.25 thorpej pc->pc_intr_desc);
296 1.25 thorpej if (ALPHA_SHARED_INTR_DISABLE(pc->pc_shared_intrs, irq)) {
297 1.25 thorpej pc->pc_intr_disable(pc, irq);
298 1.25 thorpej }
299 1.25 thorpej } else {
300 1.25 thorpej alpha_shared_intr_reset_strays(pc->pc_shared_intrs, irq);
301 1.25 thorpej }
302 1.25 thorpej }
303 1.25 thorpej
304 1.25 thorpej #define ALPHA_PCI_INTR_HANDLE_IRQ __BITS(0,31)
305 1.25 thorpej #define ALPHA_PCI_INTR_HANDLE_FLAGS __BITS(32,63)
306 1.25 thorpej
307 1.25 thorpej void
308 1.25 thorpej alpha_pci_intr_handle_init(pci_intr_handle_t * const ihp, u_int const irq,
309 1.25 thorpej u_int const flags)
310 1.25 thorpej {
311 1.25 thorpej ihp->value = __SHIFTIN(irq, ALPHA_PCI_INTR_HANDLE_IRQ) |
312 1.25 thorpej __SHIFTIN(flags, ALPHA_PCI_INTR_HANDLE_FLAGS);
313 1.25 thorpej }
314 1.25 thorpej
315 1.25 thorpej void
316 1.25 thorpej alpha_pci_intr_handle_set_irq(pci_intr_handle_t * const ihp, u_int const irq)
317 1.25 thorpej {
318 1.25 thorpej ihp->value = (ihp->value & ALPHA_PCI_INTR_HANDLE_FLAGS) |
319 1.25 thorpej __SHIFTIN(irq, ALPHA_PCI_INTR_HANDLE_IRQ);
320 1.25 thorpej }
321 1.25 thorpej
322 1.25 thorpej u_int
323 1.25 thorpej alpha_pci_intr_handle_get_irq(const pci_intr_handle_t * const ihp)
324 1.25 thorpej {
325 1.25 thorpej return __SHIFTOUT(ihp->value, ALPHA_PCI_INTR_HANDLE_IRQ);
326 1.25 thorpej }
327 1.25 thorpej
328 1.25 thorpej void
329 1.25 thorpej alpha_pci_intr_handle_set_flags(pci_intr_handle_t * const ihp,
330 1.25 thorpej u_int const flags)
331 1.25 thorpej {
332 1.25 thorpej ihp->value = (ihp->value & ALPHA_PCI_INTR_HANDLE_IRQ) |
333 1.25 thorpej __SHIFTIN(flags, ALPHA_PCI_INTR_HANDLE_FLAGS);
334 1.25 thorpej }
335 1.25 thorpej
336 1.25 thorpej u_int
337 1.25 thorpej alpha_pci_intr_handle_get_flags(const pci_intr_handle_t * const ihp)
338 1.25 thorpej {
339 1.25 thorpej return __SHIFTOUT(ihp->value, ALPHA_PCI_INTR_HANDLE_FLAGS);
340 1.25 thorpej }
341 1.25 thorpej
342 1.25 thorpej /*
343 1.25 thorpej * MI PCI back-end entry points.
344 1.25 thorpej */
345 1.25 thorpej
346 1.25 thorpej void
347 1.25 thorpej pci_attach_hook(device_t const parent, device_t const self,
348 1.25 thorpej struct pcibus_attach_args * const pba)
349 1.25 thorpej {
350 1.25 thorpej pci_chipset_tag_t const pc = pba->pba_pc;
351 1.25 thorpej
352 1.25 thorpej KASSERT(pc->pc_attach_hook != NULL);
353 1.25 thorpej pc->pc_attach_hook(parent, self, pba);
354 1.25 thorpej }
355 1.25 thorpej
356 1.25 thorpej int
357 1.25 thorpej pci_bus_maxdevs(pci_chipset_tag_t const pc, int const busno)
358 1.25 thorpej {
359 1.25 thorpej KASSERT(pc->pc_bus_maxdevs != NULL);
360 1.25 thorpej return pc->pc_bus_maxdevs(pc->pc_conf_v, busno);
361 1.25 thorpej }
362 1.25 thorpej
363 1.25 thorpej pcitag_t
364 1.25 thorpej pci_make_tag(pci_chipset_tag_t const pc, int const bus, int const dev,
365 1.25 thorpej int const func)
366 1.25 thorpej {
367 1.25 thorpej KASSERT(pc->pc_make_tag != NULL);
368 1.25 thorpej return pc->pc_make_tag(pc->pc_conf_v, bus, dev, func);
369 1.25 thorpej }
370 1.25 thorpej
371 1.25 thorpej void
372 1.25 thorpej pci_decompose_tag(pci_chipset_tag_t const pc, pcitag_t const tag,
373 1.25 thorpej int * const busp, int * const devp, int * const funcp)
374 1.25 thorpej {
375 1.25 thorpej KASSERT(pc->pc_decompose_tag != NULL);
376 1.25 thorpej pc->pc_decompose_tag(pc->pc_conf_v, tag, busp, devp, funcp);
377 1.25 thorpej }
378 1.25 thorpej
379 1.25 thorpej pcireg_t
380 1.25 thorpej pci_conf_read(pci_chipset_tag_t const pc, pcitag_t const tag, int const reg)
381 1.25 thorpej {
382 1.25 thorpej KASSERT(pc->pc_conf_read != NULL);
383 1.25 thorpej return pc->pc_conf_read(pc->pc_conf_v, tag, reg);
384 1.25 thorpej }
385 1.25 thorpej
386 1.25 thorpej void
387 1.25 thorpej pci_conf_write(pci_chipset_tag_t const pc, pcitag_t const tag, int const reg,
388 1.25 thorpej pcireg_t const val)
389 1.25 thorpej {
390 1.25 thorpej KASSERT(pc->pc_conf_write != NULL);
391 1.25 thorpej pc->pc_conf_write(pc->pc_conf_v, tag, reg, val);
392 1.25 thorpej }
393 1.25 thorpej
394 1.25 thorpej int
395 1.25 thorpej pci_intr_map(const struct pci_attach_args * const pa,
396 1.25 thorpej pci_intr_handle_t * const ihp)
397 1.25 thorpej {
398 1.25 thorpej pci_chipset_tag_t const pc = pa->pa_pc;
399 1.25 thorpej
400 1.25 thorpej KASSERT(pc->pc_intr_map != NULL);
401 1.25 thorpej return pc->pc_intr_map(pa, ihp);
402 1.25 thorpej }
403 1.25 thorpej
404 1.25 thorpej const char *
405 1.25 thorpej pci_intr_string(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
406 1.25 thorpej char * const buf, size_t const len)
407 1.25 thorpej {
408 1.25 thorpej KASSERT(pc->pc_intr_string != NULL);
409 1.25 thorpej return pc->pc_intr_string(pc, ih, buf, len);
410 1.25 thorpej }
411 1.25 thorpej
412 1.25 thorpej const struct evcnt *
413 1.25 thorpej pci_intr_evcnt(pci_chipset_tag_t const pc, pci_intr_handle_t const ih)
414 1.25 thorpej {
415 1.25 thorpej KASSERT(pc->pc_intr_evcnt != NULL);
416 1.25 thorpej return pc->pc_intr_evcnt(pc, ih);
417 1.25 thorpej }
418 1.25 thorpej
419 1.25 thorpej void *
420 1.25 thorpej pci_intr_establish(pci_chipset_tag_t const pc, pci_intr_handle_t const ih,
421 1.25 thorpej int const ipl, int (*func)(void *), void *arg)
422 1.25 thorpej {
423 1.25 thorpej KASSERT(pc->pc_intr_establish != NULL);
424 1.25 thorpej return pc->pc_intr_establish(pc, ih, ipl, func, arg);
425 1.25 thorpej }
426 1.25 thorpej
427 1.25 thorpej void
428 1.25 thorpej pci_intr_disestablish(pci_chipset_tag_t const pc, void * const cookie)
429 1.25 thorpej {
430 1.25 thorpej KASSERT(pc->pc_intr_disestablish != NULL);
431 1.25 thorpej pc->pc_intr_disestablish(pc, cookie);
432 1.25 thorpej }
433 1.25 thorpej
434 1.25 thorpej int
435 1.25 thorpej pci_intr_setattr(pci_chipset_tag_t const pc __unused,
436 1.25 thorpej pci_intr_handle_t * const ihp, int const attr, uint64_t const data)
437 1.25 thorpej {
438 1.25 thorpej u_int flags = alpha_pci_intr_handle_get_flags(ihp);
439 1.25 thorpej
440 1.25 thorpej switch (attr) {
441 1.25 thorpej case PCI_INTR_MPSAFE:
442 1.25 thorpej if (data)
443 1.25 thorpej flags |= ALPHA_INTR_MPSAFE;
444 1.25 thorpej else
445 1.25 thorpej flags &= ~ALPHA_INTR_MPSAFE;
446 1.25 thorpej break;
447 1.25 thorpej
448 1.25 thorpej default:
449 1.25 thorpej return ENODEV;
450 1.25 thorpej }
451 1.25 thorpej
452 1.25 thorpej alpha_pci_intr_handle_set_flags(ihp, flags);
453 1.25 thorpej return 0;
454 1.25 thorpej }
455