vlpci.c revision 1.6 1 1.6 martin /* $NetBSD: vlpci.c,v 1.6 2017/03/12 10:19:40 martin Exp $ */
2 1.1 jakllsch
3 1.1 jakllsch /*
4 1.1 jakllsch * Copyright (c) 2017 Jonathan A. Kollasch
5 1.1 jakllsch * All rights reserved.
6 1.1 jakllsch *
7 1.1 jakllsch * Redistribution and use in source and binary forms, with or without
8 1.1 jakllsch * modification, are permitted provided that the following conditions
9 1.1 jakllsch * are met:
10 1.1 jakllsch * 1. Redistributions of source code must retain the above copyright
11 1.1 jakllsch * notice, this list of conditions and the following disclaimer.
12 1.1 jakllsch * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jakllsch * notice, this list of conditions and the following disclaimer in the
14 1.1 jakllsch * documentation and/or other materials provided with the distribution.
15 1.1 jakllsch *
16 1.1 jakllsch * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 1.1 jakllsch * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1 jakllsch * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1 jakllsch * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 1.1 jakllsch * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 1.1 jakllsch * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 1.1 jakllsch * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 1.1 jakllsch * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 1.1 jakllsch * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 1.1 jakllsch * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 1.1 jakllsch * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1 jakllsch */
28 1.1 jakllsch
29 1.1 jakllsch #include <sys/cdefs.h>
30 1.6 martin __KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.6 2017/03/12 10:19:40 martin Exp $");
31 1.1 jakllsch
32 1.1 jakllsch #include "opt_pci.h"
33 1.1 jakllsch #include "pci.h"
34 1.1 jakllsch
35 1.1 jakllsch #include <sys/param.h>
36 1.1 jakllsch #include <sys/bus.h>
37 1.1 jakllsch #include <sys/device.h>
38 1.1 jakllsch #include <sys/extent.h>
39 1.1 jakllsch #include <sys/mutex.h>
40 1.5 macallan #include <uvm/uvm.h>
41 1.5 macallan #include <machine/pio.h>
42 1.5 macallan #include <machine/pmap.h>
43 1.5 macallan #include <machine/ofw.h>
44 1.1 jakllsch
45 1.1 jakllsch #include <dev/isa/isavar.h>
46 1.1 jakllsch
47 1.1 jakllsch #include <dev/ofw/openfirm.h>
48 1.1 jakllsch
49 1.1 jakllsch #include <dev/pci/pcivar.h>
50 1.1 jakllsch #include <dev/pci/pciconf.h>
51 1.1 jakllsch #include <arm/pci_machdep.h>
52 1.1 jakllsch
53 1.1 jakllsch static int vlpci_match(device_t, struct cfdata *, void *);
54 1.1 jakllsch static void vlpci_attach(device_t, device_t, void *);
55 1.1 jakllsch
56 1.1 jakllsch static void vlpci_pc_attach_hook(device_t, device_t,
57 1.1 jakllsch struct pcibus_attach_args *);
58 1.1 jakllsch static int vlpci_pc_bus_maxdevs(void *, int);
59 1.1 jakllsch static pcitag_t vlpci_pc_make_tag(void *, int, int, int);
60 1.1 jakllsch static void vlpci_pc_decompose_tag(void *, pcitag_t, int *, int *, int *);
61 1.1 jakllsch static pcireg_t vlpci_pc_conf_read(void *, pcitag_t, int);
62 1.1 jakllsch static void vlpci_pc_conf_write(void *, pcitag_t, int, pcireg_t);
63 1.4 jakllsch
64 1.4 jakllsch static int vlpci_pc_intr_map(const struct pci_attach_args *,
65 1.4 jakllsch pci_intr_handle_t *);
66 1.4 jakllsch static const char * vlpci_pc_intr_string(void *, pci_intr_handle_t, char *,
67 1.4 jakllsch size_t);
68 1.4 jakllsch static const struct evcnt * vlpci_pc_intr_evcnt(void *, pci_intr_handle_t);
69 1.4 jakllsch static void * vlpci_pc_intr_establish(void *, pci_intr_handle_t, int,
70 1.4 jakllsch int (*)(void *), void *);
71 1.4 jakllsch static void vlpci_pc_intr_disestablish(void *, void *);
72 1.4 jakllsch
73 1.1 jakllsch #ifdef __HAVE_PCI_CONF_HOOK
74 1.1 jakllsch static int vlpci_pc_conf_hook(void *, int, int, int, pcireg_t);
75 1.1 jakllsch #endif
76 1.1 jakllsch static void vlpci_pc_conf_interrupt(void *, int, int, int, int, int *);
77 1.1 jakllsch
78 1.1 jakllsch struct vlpci_softc {
79 1.1 jakllsch device_t sc_dev;
80 1.1 jakllsch kmutex_t sc_lock;
81 1.1 jakllsch bus_space_handle_t sc_conf_ioh;
82 1.1 jakllsch bus_space_handle_t sc_reg_ioh;
83 1.1 jakllsch struct arm32_pci_chipset sc_pc;
84 1.1 jakllsch };
85 1.1 jakllsch
86 1.1 jakllsch CFATTACH_DECL_NEW(vlpci, sizeof(struct vlpci_softc),
87 1.1 jakllsch vlpci_match, vlpci_attach, NULL, NULL);
88 1.1 jakllsch
89 1.1 jakllsch static const char * const compat_strings[] = { "via,vt82c505", NULL };
90 1.1 jakllsch
91 1.5 macallan vaddr_t vlpci_mem_vaddr = 0;
92 1.5 macallan paddr_t vlpci_mem_paddr;
93 1.5 macallan struct bus_space vlpci_memt;
94 1.5 macallan
95 1.1 jakllsch static void
96 1.1 jakllsch regwrite_1(struct vlpci_softc * const sc, uint8_t off, uint8_t val)
97 1.1 jakllsch {
98 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
99 1.1 jakllsch bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 0, off);
100 1.1 jakllsch bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 1, val);
101 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
102 1.1 jakllsch }
103 1.1 jakllsch
104 1.5 macallan static uint8_t
105 1.5 macallan regread_1(struct vlpci_softc * const sc, uint8_t off)
106 1.5 macallan {
107 1.5 macallan uint8_t reg;
108 1.5 macallan
109 1.5 macallan mutex_spin_enter(&sc->sc_lock);
110 1.5 macallan bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 0, off);
111 1.5 macallan reg = bus_space_read_1(&isa_io_bs_tag, sc->sc_reg_ioh, 1);
112 1.5 macallan mutex_spin_exit(&sc->sc_lock);
113 1.5 macallan return reg;
114 1.5 macallan }
115 1.5 macallan
116 1.5 macallan static void
117 1.5 macallan vlpci_dump_window(struct vlpci_softc *sc, int num)
118 1.5 macallan {
119 1.5 macallan int regaddr = 0x87 + 3 * num;
120 1.5 macallan uint32_t addr, size;
121 1.5 macallan uint8_t attr;
122 1.5 macallan
123 1.5 macallan addr = regread_1(sc, regaddr) << 24;
124 1.5 macallan addr |= regread_1(sc, regaddr + 1) << 16;
125 1.5 macallan attr = regread_1(sc, regaddr + 2);
126 1.5 macallan size = 0x00010000 << ((attr & 0x1c) >> 2);
127 1.5 macallan printf("memory window #%d at %08x size %08x flags %x\n", num, addr, size, attr);
128 1.5 macallan }
129 1.5 macallan
130 1.5 macallan static int
131 1.5 macallan vlpci_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, bus_space_handle_t *bshp)
132 1.5 macallan {
133 1.5 macallan *bshp = vlpci_mem_vaddr - 0x02000000 + bpa;
134 1.5 macallan printf("%s: %08lx -> %08lx\n", __func__, bpa, *bshp);
135 1.5 macallan return(0);
136 1.5 macallan }
137 1.5 macallan
138 1.5 macallan static paddr_t
139 1.5 macallan vlpci_mmap(void *cookie, bus_addr_t addr, off_t off, int prot,
140 1.5 macallan int flags)
141 1.5 macallan {
142 1.5 macallan paddr_t ret;
143 1.5 macallan
144 1.5 macallan ret = vlpci_mem_paddr + addr + off;
145 1.5 macallan
146 1.5 macallan if (flags & BUS_SPACE_MAP_PREFETCHABLE) {
147 1.5 macallan return (arm_btop(ret) | ARM32_MMAP_WRITECOMBINE);
148 1.5 macallan } else
149 1.5 macallan return arm_btop(ret);
150 1.5 macallan }
151 1.5 macallan
152 1.1 jakllsch static int
153 1.1 jakllsch vlpci_match(device_t parent, struct cfdata *match, void *aux)
154 1.1 jakllsch {
155 1.1 jakllsch struct ofbus_attach_args * const oba = aux;
156 1.1 jakllsch
157 1.1 jakllsch if (of_compatible(oba->oba_phandle, compat_strings) < 0)
158 1.1 jakllsch return 0;
159 1.1 jakllsch
160 1.2 flxd return 2; /* beat generic ofbus */
161 1.1 jakllsch }
162 1.1 jakllsch
163 1.1 jakllsch static void
164 1.1 jakllsch vlpci_attach(device_t parent, device_t self, void *aux)
165 1.1 jakllsch {
166 1.1 jakllsch struct vlpci_softc * const sc = device_private(self);
167 1.1 jakllsch pci_chipset_tag_t const pc = &sc->sc_pc;
168 1.1 jakllsch struct pcibus_attach_args pba;
169 1.1 jakllsch
170 1.1 jakllsch aprint_normal("\n");
171 1.1 jakllsch
172 1.1 jakllsch sc->sc_dev = self;
173 1.1 jakllsch mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
174 1.1 jakllsch memset(&pba, 0, sizeof(pba));
175 1.1 jakllsch
176 1.1 jakllsch if (bus_space_map(&isa_io_bs_tag, 0xa8, 0x2,
177 1.1 jakllsch 0, &sc->sc_reg_ioh) != 0) {
178 1.1 jakllsch aprint_error_dev(self, "failed to map 0xa8-9\n");
179 1.1 jakllsch return;
180 1.1 jakllsch }
181 1.1 jakllsch if (bus_space_map(&isa_io_bs_tag, 0xcf8, 0x8,
182 1.1 jakllsch 0, &sc->sc_conf_ioh) != 0) {
183 1.1 jakllsch aprint_error_dev(self, "failed to map 0xcf8-f\n");
184 1.1 jakllsch return;
185 1.1 jakllsch }
186 1.1 jakllsch
187 1.1 jakllsch /* Enable VLB/PCI bridge */
188 1.4 jakllsch regwrite_1(sc, 0x96, 0x18); /* enable LOCAL#, compatible mode */
189 1.4 jakllsch regwrite_1(sc, 0x93, 0x60); /* IOCHCK# on IOCHCK#/NMI */
190 1.5 macallan regwrite_1(sc, 0x86, 0x61); /* invert all INTx to IRQ */
191 1.4 jakllsch regwrite_1(sc, 0x97, 0x00); /* don't do per-INTx conversions */
192 1.4 jakllsch regwrite_1(sc, 0x91, 0xbb); /* enable INT[AB] to IRQ 10 */
193 1.4 jakllsch regwrite_1(sc, 0x90, 0xbb); /* enable INT[CD] to IRQ 10 */
194 1.5 macallan /*
195 1.5 macallan * XXX
196 1.5 macallan * set memory size to 255MB, so the bridge knows which cycles go to RAM
197 1.5 macallan * shark's RAM is in the upper half of the lower 256MB, part of the
198 1.5 macallan * lower half is occupied by the graphics chip
199 1.5 macallan * ... or that's the theory. OF puts PCI BARS at 0x02000000 which
200 1.5 macallan * overlaps with when we do this and pci memory access doesn't work.
201 1.5 macallan */
202 1.5 macallan regwrite_1(sc, 0x81, 0x1);
203 1.5 macallan
204 1.5 macallan regwrite_1(sc, 0x82, 0x08); /* PCI dynamic acceleration decoding enable */
205 1.5 macallan regwrite_1(sc, 0x83, 0x08);
206 1.5 macallan printf("reg 0x83 %02x\n", regread_1(sc, 0x83));
207 1.5 macallan
208 1.5 macallan #if 1
209 1.5 macallan /* program window #0 to 0x08000000 */
210 1.5 macallan regwrite_1(sc, 0x87, 0x08);
211 1.5 macallan regwrite_1(sc, 0x88, 0x00);
212 1.5 macallan regwrite_1(sc, 0x89, 0x38); /* VL, unbuffered, 4MB */
213 1.5 macallan #else
214 1.5 macallan regwrite_1(sc, 0x87, 0x00);
215 1.5 macallan regwrite_1(sc, 0x88, 0x00);
216 1.5 macallan regwrite_1(sc, 0x89, 0x00);
217 1.5 macallan #endif
218 1.1 jakllsch
219 1.5 macallan vlpci_mem_paddr = 0x02000000; /* get from OF! */
220 1.5 macallan
221 1.5 macallan /*
222 1.5 macallan * we map in 1MB at 0x02000000, so program window #1 accordingly
223 1.5 macallan */
224 1.5 macallan regwrite_1(sc, 0x8a, vlpci_mem_paddr >> 24);
225 1.5 macallan regwrite_1(sc, 0x8b, (vlpci_mem_paddr >> 16) & 0xff);
226 1.5 macallan regwrite_1(sc, 0x8c, 0x90); /* PCI, unbuffered, 1MB */
227 1.5 macallan
228 1.5 macallan /* now map in some of the memory space */
229 1.5 macallan printf("vlpci_mem_vaddr %08lx\n", vlpci_mem_vaddr);
230 1.5 macallan memcpy(&vlpci_memt, &isa_io_bs_tag, sizeof(struct bus_space));
231 1.5 macallan vlpci_memt.bs_cookie = (void *)vlpci_mem_vaddr;
232 1.5 macallan vlpci_memt.bs_map = vlpci_map;
233 1.5 macallan vlpci_memt.bs_mmap = vlpci_mmap;
234 1.5 macallan
235 1.1 jakllsch pc->pc_conf_v = sc;
236 1.1 jakllsch pc->pc_attach_hook = vlpci_pc_attach_hook;
237 1.1 jakllsch pc->pc_bus_maxdevs = vlpci_pc_bus_maxdevs;
238 1.1 jakllsch pc->pc_make_tag = vlpci_pc_make_tag;
239 1.1 jakllsch pc->pc_decompose_tag = vlpci_pc_decompose_tag;
240 1.1 jakllsch pc->pc_conf_read = vlpci_pc_conf_read;
241 1.1 jakllsch pc->pc_conf_write = vlpci_pc_conf_write;
242 1.4 jakllsch
243 1.4 jakllsch pc->pc_intr_v = sc;
244 1.4 jakllsch pc->pc_intr_map = vlpci_pc_intr_map;
245 1.4 jakllsch pc->pc_intr_string = vlpci_pc_intr_string;
246 1.4 jakllsch pc->pc_intr_evcnt = vlpci_pc_intr_evcnt;
247 1.4 jakllsch pc->pc_intr_establish = vlpci_pc_intr_establish;
248 1.4 jakllsch pc->pc_intr_disestablish = vlpci_pc_intr_disestablish;
249 1.4 jakllsch
250 1.1 jakllsch #ifdef __HAVE_PCI_CONF_HOOK
251 1.1 jakllsch pc->pc_conf_hook = vlpci_pc_conf_hook;
252 1.1 jakllsch #endif
253 1.1 jakllsch pc->pc_conf_interrupt = vlpci_pc_conf_interrupt;
254 1.1 jakllsch
255 1.4 jakllsch /* try to assure IO space is enabled on the default device-function */
256 1.4 jakllsch vlpci_pc_conf_write(sc, vlpci_pc_make_tag(sc, 0, 6, 0),
257 1.4 jakllsch PCI_COMMAND_STATUS_REG,
258 1.4 jakllsch vlpci_pc_conf_read(sc, vlpci_pc_make_tag(sc, 0, 6, 0),
259 1.4 jakllsch PCI_COMMAND_STATUS_REG) |
260 1.4 jakllsch PCI_COMMAND_IO_ENABLE);
261 1.1 jakllsch
262 1.5 macallan pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY;
263 1.4 jakllsch pba.pba_iot = &isa_io_bs_tag;
264 1.5 macallan pba.pba_memt = &vlpci_memt;
265 1.5 macallan pba.pba_dmat = &isa_bus_dma_tag;
266 1.1 jakllsch pba.pba_pc = &sc->sc_pc;
267 1.1 jakllsch pba.pba_bus = 0;
268 1.1 jakllsch
269 1.5 macallan printf("dma %lx %lx, %lx\n", isa_bus_dma_tag._ranges[0].dr_sysbase,
270 1.5 macallan isa_bus_dma_tag._ranges[0].dr_busbase,
271 1.5 macallan isa_bus_dma_tag._ranges[0].dr_len);
272 1.5 macallan
273 1.5 macallan vlpci_dump_window(sc, 0);
274 1.5 macallan vlpci_dump_window(sc, 1);
275 1.5 macallan vlpci_dump_window(sc, 2);
276 1.5 macallan
277 1.1 jakllsch config_found_ia(self, "pcibus", &pba, pcibusprint);
278 1.1 jakllsch }
279 1.1 jakllsch
280 1.1 jakllsch static void
281 1.1 jakllsch vlpci_pc_attach_hook(device_t parent, device_t self,
282 1.1 jakllsch struct pcibus_attach_args *pba)
283 1.1 jakllsch {
284 1.1 jakllsch }
285 1.1 jakllsch
286 1.1 jakllsch static int
287 1.1 jakllsch vlpci_pc_bus_maxdevs(void *v, int busno)
288 1.1 jakllsch {
289 1.1 jakllsch return busno == 0 ? 32 : 0;
290 1.1 jakllsch }
291 1.1 jakllsch
292 1.1 jakllsch static pcitag_t
293 1.1 jakllsch vlpci_pc_make_tag(void *v, int b, int d, int f)
294 1.1 jakllsch {
295 1.1 jakllsch return (b << 16) | (d << 11) | (f << 8);
296 1.1 jakllsch }
297 1.1 jakllsch
298 1.1 jakllsch static void
299 1.1 jakllsch vlpci_pc_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp)
300 1.1 jakllsch {
301 1.1 jakllsch if (bp)
302 1.1 jakllsch *bp = (tag >> 16) & 0xff;
303 1.1 jakllsch if (dp)
304 1.1 jakllsch *dp = (tag >> 11) & 0x1f;
305 1.1 jakllsch if (fp)
306 1.1 jakllsch *fp = (tag >> 8) & 0x7;
307 1.1 jakllsch }
308 1.1 jakllsch
309 1.1 jakllsch static pcireg_t
310 1.1 jakllsch vlpci_pc_conf_read(void *v, pcitag_t tag, int offset)
311 1.1 jakllsch {
312 1.1 jakllsch struct vlpci_softc * const sc = v;
313 1.1 jakllsch pcireg_t ret;
314 1.1 jakllsch
315 1.1 jakllsch KASSERT((offset & 3) == 0);
316 1.3 jakllsch
317 1.3 jakllsch if (offset >= PCI_CONF_SIZE)
318 1.3 jakllsch return 0xffffffff;
319 1.1 jakllsch
320 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
321 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 0,
322 1.1 jakllsch 0x80000000UL|tag|offset);
323 1.1 jakllsch ret = bus_space_read_4(&isa_io_bs_tag, sc->sc_conf_ioh, 4);
324 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
325 1.1 jakllsch
326 1.1 jakllsch #if 0
327 1.1 jakllsch device_printf(sc->sc_dev, "%s tag %x offset %x ret %x\n",
328 1.1 jakllsch __func__, (unsigned int)tag, offset, ret);
329 1.1 jakllsch #endif
330 1.1 jakllsch
331 1.1 jakllsch return ret;
332 1.1 jakllsch }
333 1.1 jakllsch
334 1.1 jakllsch static void
335 1.1 jakllsch vlpci_pc_conf_write(void *v, pcitag_t tag, int offset, pcireg_t val)
336 1.1 jakllsch {
337 1.1 jakllsch struct vlpci_softc * const sc = v;
338 1.1 jakllsch
339 1.1 jakllsch KASSERT((offset & 3) == 0);
340 1.3 jakllsch
341 1.3 jakllsch if (offset >= PCI_CONF_SIZE)
342 1.3 jakllsch return;
343 1.1 jakllsch
344 1.1 jakllsch #if 0
345 1.1 jakllsch device_printf(sc->sc_dev, "%s tag %x offset %x val %x\n",
346 1.1 jakllsch __func__, (unsigned int)tag, offset, val);
347 1.1 jakllsch #endif
348 1.1 jakllsch
349 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
350 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 0,
351 1.1 jakllsch 0x80000000UL|tag|offset);
352 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 4, val);
353 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
354 1.1 jakllsch }
355 1.1 jakllsch
356 1.4 jakllsch static int
357 1.4 jakllsch vlpci_pc_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ih)
358 1.4 jakllsch {
359 1.4 jakllsch switch (pa->pa_intrpin) {
360 1.4 jakllsch default:
361 1.4 jakllsch case 0:
362 1.4 jakllsch return EINVAL;
363 1.4 jakllsch case 1:
364 1.4 jakllsch case 2:
365 1.4 jakllsch case 3:
366 1.4 jakllsch case 4:
367 1.4 jakllsch *ih = 10;
368 1.4 jakllsch return 0;
369 1.4 jakllsch }
370 1.4 jakllsch }
371 1.4 jakllsch
372 1.4 jakllsch static const char *
373 1.4 jakllsch vlpci_pc_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
374 1.4 jakllsch {
375 1.4 jakllsch
376 1.4 jakllsch if (ih == PCI_INTERRUPT_PIN_NONE)
377 1.4 jakllsch return NULL;
378 1.4 jakllsch snprintf(buf, len, "irq %2lu", ih);
379 1.4 jakllsch return buf;
380 1.4 jakllsch }
381 1.4 jakllsch
382 1.4 jakllsch static const struct evcnt *
383 1.4 jakllsch vlpci_pc_intr_evcnt(void *v, pci_intr_handle_t ih)
384 1.4 jakllsch {
385 1.4 jakllsch return NULL;
386 1.4 jakllsch }
387 1.4 jakllsch
388 1.4 jakllsch static void *
389 1.4 jakllsch vlpci_pc_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
390 1.4 jakllsch int (*callback)(void *), void *arg)
391 1.4 jakllsch {
392 1.4 jakllsch if (pih == 0)
393 1.4 jakllsch return NULL;
394 1.4 jakllsch
395 1.4 jakllsch return isa_intr_establish(NULL, pih, IST_LEVEL, ipl, callback, arg);
396 1.4 jakllsch }
397 1.4 jakllsch
398 1.4 jakllsch static void
399 1.4 jakllsch vlpci_pc_intr_disestablish(void *v, void *w)
400 1.4 jakllsch {
401 1.6 martin
402 1.6 martin return isa_intr_disestablish(NULL, v);
403 1.4 jakllsch }
404 1.4 jakllsch
405 1.1 jakllsch #ifdef __HAVE_PCI_CONF_HOOK
406 1.1 jakllsch static int
407 1.1 jakllsch vlpci_pc_conf_hook(void *v, int b, int d, int f, pcireg_t id)
408 1.1 jakllsch {
409 1.5 macallan return PCI_CONF_DEFAULT /*& ~PCI_CONF_ENABLE_BM*/;
410 1.1 jakllsch }
411 1.1 jakllsch #endif
412 1.1 jakllsch
413 1.1 jakllsch static void
414 1.1 jakllsch vlpci_pc_conf_interrupt(void *v, int bus, int dev, int ipin, int swiz,
415 1.1 jakllsch int *ilinep)
416 1.1 jakllsch {
417 1.1 jakllsch *ilinep = 0xff; /* XXX */
418 1.1 jakllsch }
419