vlpci.c revision 1.7 1 1.7 flxd /* $NetBSD: vlpci.c,v 1.7 2017/04/18 12:17:12 flxd 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.7 flxd __KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.7 2017/04/18 12:17:12 flxd 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.7 flxd
99 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
100 1.1 jakllsch bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 0, off);
101 1.1 jakllsch bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 1, val);
102 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
103 1.1 jakllsch }
104 1.1 jakllsch
105 1.5 macallan static uint8_t
106 1.5 macallan regread_1(struct vlpci_softc * const sc, uint8_t off)
107 1.5 macallan {
108 1.5 macallan uint8_t reg;
109 1.5 macallan
110 1.5 macallan mutex_spin_enter(&sc->sc_lock);
111 1.5 macallan bus_space_write_1(&isa_io_bs_tag, sc->sc_reg_ioh, 0, off);
112 1.5 macallan reg = bus_space_read_1(&isa_io_bs_tag, sc->sc_reg_ioh, 1);
113 1.5 macallan mutex_spin_exit(&sc->sc_lock);
114 1.5 macallan return reg;
115 1.5 macallan }
116 1.5 macallan
117 1.5 macallan static void
118 1.5 macallan vlpci_dump_window(struct vlpci_softc *sc, int num)
119 1.5 macallan {
120 1.5 macallan int regaddr = 0x87 + 3 * num;
121 1.5 macallan uint32_t addr, size;
122 1.5 macallan uint8_t attr;
123 1.5 macallan
124 1.5 macallan addr = regread_1(sc, regaddr) << 24;
125 1.5 macallan addr |= regread_1(sc, regaddr + 1) << 16;
126 1.5 macallan attr = regread_1(sc, regaddr + 2);
127 1.5 macallan size = 0x00010000 << ((attr & 0x1c) >> 2);
128 1.7 flxd printf("memory window #%d at %08x size %08x flags %x\n", num, addr,
129 1.7 flxd size, attr);
130 1.5 macallan }
131 1.5 macallan
132 1.5 macallan static int
133 1.7 flxd vlpci_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable,
134 1.7 flxd bus_space_handle_t *bshp)
135 1.5 macallan {
136 1.7 flxd
137 1.5 macallan *bshp = vlpci_mem_vaddr - 0x02000000 + bpa;
138 1.7 flxd printf("%s: %08lx -> %08lx\n", __func__, bpa, *bshp);
139 1.5 macallan return(0);
140 1.5 macallan }
141 1.5 macallan
142 1.5 macallan static paddr_t
143 1.5 macallan vlpci_mmap(void *cookie, bus_addr_t addr, off_t off, int prot,
144 1.5 macallan int flags)
145 1.5 macallan {
146 1.5 macallan paddr_t ret;
147 1.5 macallan
148 1.5 macallan ret = vlpci_mem_paddr + addr + off;
149 1.5 macallan
150 1.7 flxd if (flags & BUS_SPACE_MAP_PREFETCHABLE)
151 1.5 macallan return (arm_btop(ret) | ARM32_MMAP_WRITECOMBINE);
152 1.7 flxd else
153 1.7 flxd return arm_btop(ret);
154 1.5 macallan }
155 1.5 macallan
156 1.1 jakllsch static int
157 1.1 jakllsch vlpci_match(device_t parent, struct cfdata *match, void *aux)
158 1.1 jakllsch {
159 1.1 jakllsch struct ofbus_attach_args * const oba = aux;
160 1.1 jakllsch
161 1.1 jakllsch if (of_compatible(oba->oba_phandle, compat_strings) < 0)
162 1.1 jakllsch return 0;
163 1.1 jakllsch
164 1.2 flxd return 2; /* beat generic ofbus */
165 1.1 jakllsch }
166 1.1 jakllsch
167 1.1 jakllsch static void
168 1.1 jakllsch vlpci_attach(device_t parent, device_t self, void *aux)
169 1.1 jakllsch {
170 1.1 jakllsch struct vlpci_softc * const sc = device_private(self);
171 1.1 jakllsch pci_chipset_tag_t const pc = &sc->sc_pc;
172 1.1 jakllsch struct pcibus_attach_args pba;
173 1.1 jakllsch
174 1.1 jakllsch aprint_normal("\n");
175 1.1 jakllsch
176 1.1 jakllsch sc->sc_dev = self;
177 1.1 jakllsch mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH);
178 1.1 jakllsch memset(&pba, 0, sizeof(pba));
179 1.1 jakllsch
180 1.1 jakllsch if (bus_space_map(&isa_io_bs_tag, 0xa8, 0x2,
181 1.1 jakllsch 0, &sc->sc_reg_ioh) != 0) {
182 1.1 jakllsch aprint_error_dev(self, "failed to map 0xa8-9\n");
183 1.1 jakllsch return;
184 1.1 jakllsch }
185 1.1 jakllsch if (bus_space_map(&isa_io_bs_tag, 0xcf8, 0x8,
186 1.1 jakllsch 0, &sc->sc_conf_ioh) != 0) {
187 1.1 jakllsch aprint_error_dev(self, "failed to map 0xcf8-f\n");
188 1.1 jakllsch return;
189 1.1 jakllsch }
190 1.1 jakllsch
191 1.1 jakllsch /* Enable VLB/PCI bridge */
192 1.4 jakllsch regwrite_1(sc, 0x96, 0x18); /* enable LOCAL#, compatible mode */
193 1.4 jakllsch regwrite_1(sc, 0x93, 0x60); /* IOCHCK# on IOCHCK#/NMI */
194 1.5 macallan regwrite_1(sc, 0x86, 0x61); /* invert all INTx to IRQ */
195 1.4 jakllsch regwrite_1(sc, 0x97, 0x00); /* don't do per-INTx conversions */
196 1.4 jakllsch regwrite_1(sc, 0x91, 0xbb); /* enable INT[AB] to IRQ 10 */
197 1.4 jakllsch regwrite_1(sc, 0x90, 0xbb); /* enable INT[CD] to IRQ 10 */
198 1.5 macallan /*
199 1.5 macallan * XXX
200 1.5 macallan * set memory size to 255MB, so the bridge knows which cycles go to RAM
201 1.5 macallan * shark's RAM is in the upper half of the lower 256MB, part of the
202 1.5 macallan * lower half is occupied by the graphics chip
203 1.5 macallan * ... or that's the theory. OF puts PCI BARS at 0x02000000 which
204 1.5 macallan * overlaps with when we do this and pci memory access doesn't work.
205 1.5 macallan */
206 1.5 macallan regwrite_1(sc, 0x81, 0x1);
207 1.5 macallan
208 1.5 macallan regwrite_1(sc, 0x82, 0x08); /* PCI dynamic acceleration decoding enable */
209 1.7 flxd regwrite_1(sc, 0x83, 0x08);
210 1.5 macallan printf("reg 0x83 %02x\n", regread_1(sc, 0x83));
211 1.5 macallan
212 1.5 macallan #if 1
213 1.5 macallan /* program window #0 to 0x08000000 */
214 1.5 macallan regwrite_1(sc, 0x87, 0x08);
215 1.5 macallan regwrite_1(sc, 0x88, 0x00);
216 1.5 macallan regwrite_1(sc, 0x89, 0x38); /* VL, unbuffered, 4MB */
217 1.5 macallan #else
218 1.5 macallan regwrite_1(sc, 0x87, 0x00);
219 1.5 macallan regwrite_1(sc, 0x88, 0x00);
220 1.5 macallan regwrite_1(sc, 0x89, 0x00);
221 1.5 macallan #endif
222 1.1 jakllsch
223 1.5 macallan vlpci_mem_paddr = 0x02000000; /* get from OF! */
224 1.7 flxd
225 1.5 macallan /*
226 1.5 macallan * we map in 1MB at 0x02000000, so program window #1 accordingly
227 1.5 macallan */
228 1.5 macallan regwrite_1(sc, 0x8a, vlpci_mem_paddr >> 24);
229 1.5 macallan regwrite_1(sc, 0x8b, (vlpci_mem_paddr >> 16) & 0xff);
230 1.5 macallan regwrite_1(sc, 0x8c, 0x90); /* PCI, unbuffered, 1MB */
231 1.5 macallan
232 1.5 macallan /* now map in some of the memory space */
233 1.5 macallan printf("vlpci_mem_vaddr %08lx\n", vlpci_mem_vaddr);
234 1.5 macallan memcpy(&vlpci_memt, &isa_io_bs_tag, sizeof(struct bus_space));
235 1.5 macallan vlpci_memt.bs_cookie = (void *)vlpci_mem_vaddr;
236 1.5 macallan vlpci_memt.bs_map = vlpci_map;
237 1.5 macallan vlpci_memt.bs_mmap = vlpci_mmap;
238 1.7 flxd
239 1.1 jakllsch pc->pc_conf_v = sc;
240 1.1 jakllsch pc->pc_attach_hook = vlpci_pc_attach_hook;
241 1.1 jakllsch pc->pc_bus_maxdevs = vlpci_pc_bus_maxdevs;
242 1.1 jakllsch pc->pc_make_tag = vlpci_pc_make_tag;
243 1.1 jakllsch pc->pc_decompose_tag = vlpci_pc_decompose_tag;
244 1.1 jakllsch pc->pc_conf_read = vlpci_pc_conf_read;
245 1.1 jakllsch pc->pc_conf_write = vlpci_pc_conf_write;
246 1.4 jakllsch
247 1.4 jakllsch pc->pc_intr_v = sc;
248 1.4 jakllsch pc->pc_intr_map = vlpci_pc_intr_map;
249 1.4 jakllsch pc->pc_intr_string = vlpci_pc_intr_string;
250 1.4 jakllsch pc->pc_intr_evcnt = vlpci_pc_intr_evcnt;
251 1.4 jakllsch pc->pc_intr_establish = vlpci_pc_intr_establish;
252 1.4 jakllsch pc->pc_intr_disestablish = vlpci_pc_intr_disestablish;
253 1.4 jakllsch
254 1.1 jakllsch #ifdef __HAVE_PCI_CONF_HOOK
255 1.1 jakllsch pc->pc_conf_hook = vlpci_pc_conf_hook;
256 1.1 jakllsch #endif
257 1.1 jakllsch pc->pc_conf_interrupt = vlpci_pc_conf_interrupt;
258 1.1 jakllsch
259 1.4 jakllsch /* try to assure IO space is enabled on the default device-function */
260 1.4 jakllsch vlpci_pc_conf_write(sc, vlpci_pc_make_tag(sc, 0, 6, 0),
261 1.4 jakllsch PCI_COMMAND_STATUS_REG,
262 1.4 jakllsch vlpci_pc_conf_read(sc, vlpci_pc_make_tag(sc, 0, 6, 0),
263 1.4 jakllsch PCI_COMMAND_STATUS_REG) |
264 1.4 jakllsch PCI_COMMAND_IO_ENABLE);
265 1.1 jakllsch
266 1.5 macallan pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY;
267 1.4 jakllsch pba.pba_iot = &isa_io_bs_tag;
268 1.5 macallan pba.pba_memt = &vlpci_memt;
269 1.5 macallan pba.pba_dmat = &isa_bus_dma_tag;
270 1.1 jakllsch pba.pba_pc = &sc->sc_pc;
271 1.1 jakllsch pba.pba_bus = 0;
272 1.1 jakllsch
273 1.7 flxd printf("dma %lx %lx, %lx\n", isa_bus_dma_tag._ranges[0].dr_sysbase,
274 1.7 flxd isa_bus_dma_tag._ranges[0].dr_busbase,
275 1.7 flxd isa_bus_dma_tag._ranges[0].dr_len);
276 1.5 macallan
277 1.5 macallan vlpci_dump_window(sc, 0);
278 1.5 macallan vlpci_dump_window(sc, 1);
279 1.5 macallan vlpci_dump_window(sc, 2);
280 1.5 macallan
281 1.1 jakllsch config_found_ia(self, "pcibus", &pba, pcibusprint);
282 1.1 jakllsch }
283 1.1 jakllsch
284 1.1 jakllsch static void
285 1.1 jakllsch vlpci_pc_attach_hook(device_t parent, device_t self,
286 1.1 jakllsch struct pcibus_attach_args *pba)
287 1.1 jakllsch {
288 1.1 jakllsch }
289 1.1 jakllsch
290 1.1 jakllsch static int
291 1.1 jakllsch vlpci_pc_bus_maxdevs(void *v, int busno)
292 1.1 jakllsch {
293 1.7 flxd
294 1.1 jakllsch return busno == 0 ? 32 : 0;
295 1.1 jakllsch }
296 1.1 jakllsch
297 1.1 jakllsch static pcitag_t
298 1.1 jakllsch vlpci_pc_make_tag(void *v, int b, int d, int f)
299 1.1 jakllsch {
300 1.7 flxd
301 1.1 jakllsch return (b << 16) | (d << 11) | (f << 8);
302 1.1 jakllsch }
303 1.1 jakllsch
304 1.1 jakllsch static void
305 1.1 jakllsch vlpci_pc_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp)
306 1.1 jakllsch {
307 1.7 flxd
308 1.1 jakllsch if (bp)
309 1.1 jakllsch *bp = (tag >> 16) & 0xff;
310 1.1 jakllsch if (dp)
311 1.1 jakllsch *dp = (tag >> 11) & 0x1f;
312 1.1 jakllsch if (fp)
313 1.1 jakllsch *fp = (tag >> 8) & 0x7;
314 1.1 jakllsch }
315 1.1 jakllsch
316 1.1 jakllsch static pcireg_t
317 1.1 jakllsch vlpci_pc_conf_read(void *v, pcitag_t tag, int offset)
318 1.1 jakllsch {
319 1.1 jakllsch struct vlpci_softc * const sc = v;
320 1.1 jakllsch pcireg_t ret;
321 1.1 jakllsch
322 1.1 jakllsch KASSERT((offset & 3) == 0);
323 1.3 jakllsch
324 1.3 jakllsch if (offset >= PCI_CONF_SIZE)
325 1.3 jakllsch return 0xffffffff;
326 1.1 jakllsch
327 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
328 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 0,
329 1.1 jakllsch 0x80000000UL|tag|offset);
330 1.1 jakllsch ret = bus_space_read_4(&isa_io_bs_tag, sc->sc_conf_ioh, 4);
331 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
332 1.1 jakllsch
333 1.1 jakllsch #if 0
334 1.1 jakllsch device_printf(sc->sc_dev, "%s tag %x offset %x ret %x\n",
335 1.1 jakllsch __func__, (unsigned int)tag, offset, ret);
336 1.1 jakllsch #endif
337 1.1 jakllsch
338 1.1 jakllsch return ret;
339 1.1 jakllsch }
340 1.1 jakllsch
341 1.1 jakllsch static void
342 1.1 jakllsch vlpci_pc_conf_write(void *v, pcitag_t tag, int offset, pcireg_t val)
343 1.1 jakllsch {
344 1.1 jakllsch struct vlpci_softc * const sc = v;
345 1.1 jakllsch
346 1.1 jakllsch KASSERT((offset & 3) == 0);
347 1.3 jakllsch
348 1.3 jakllsch if (offset >= PCI_CONF_SIZE)
349 1.3 jakllsch return;
350 1.1 jakllsch
351 1.1 jakllsch #if 0
352 1.1 jakllsch device_printf(sc->sc_dev, "%s tag %x offset %x val %x\n",
353 1.1 jakllsch __func__, (unsigned int)tag, offset, val);
354 1.1 jakllsch #endif
355 1.1 jakllsch
356 1.1 jakllsch mutex_spin_enter(&sc->sc_lock);
357 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 0,
358 1.1 jakllsch 0x80000000UL|tag|offset);
359 1.1 jakllsch bus_space_write_4(&isa_io_bs_tag, sc->sc_conf_ioh, 4, val);
360 1.1 jakllsch mutex_spin_exit(&sc->sc_lock);
361 1.1 jakllsch }
362 1.1 jakllsch
363 1.4 jakllsch static int
364 1.4 jakllsch vlpci_pc_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ih)
365 1.4 jakllsch {
366 1.7 flxd
367 1.4 jakllsch switch (pa->pa_intrpin) {
368 1.4 jakllsch default:
369 1.4 jakllsch case 0:
370 1.4 jakllsch return EINVAL;
371 1.4 jakllsch case 1:
372 1.4 jakllsch case 2:
373 1.4 jakllsch case 3:
374 1.4 jakllsch case 4:
375 1.4 jakllsch *ih = 10;
376 1.4 jakllsch return 0;
377 1.4 jakllsch }
378 1.4 jakllsch }
379 1.4 jakllsch
380 1.4 jakllsch static const char *
381 1.4 jakllsch vlpci_pc_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
382 1.4 jakllsch {
383 1.4 jakllsch
384 1.4 jakllsch if (ih == PCI_INTERRUPT_PIN_NONE)
385 1.4 jakllsch return NULL;
386 1.7 flxd snprintf(buf, len, "irq %lu", ih);
387 1.4 jakllsch return buf;
388 1.4 jakllsch }
389 1.4 jakllsch
390 1.4 jakllsch static const struct evcnt *
391 1.4 jakllsch vlpci_pc_intr_evcnt(void *v, pci_intr_handle_t ih)
392 1.4 jakllsch {
393 1.7 flxd
394 1.4 jakllsch return NULL;
395 1.4 jakllsch }
396 1.4 jakllsch
397 1.4 jakllsch static void *
398 1.4 jakllsch vlpci_pc_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
399 1.4 jakllsch int (*callback)(void *), void *arg)
400 1.4 jakllsch {
401 1.7 flxd
402 1.4 jakllsch if (pih == 0)
403 1.4 jakllsch return NULL;
404 1.4 jakllsch
405 1.4 jakllsch return isa_intr_establish(NULL, pih, IST_LEVEL, ipl, callback, arg);
406 1.4 jakllsch }
407 1.4 jakllsch
408 1.4 jakllsch static void
409 1.4 jakllsch vlpci_pc_intr_disestablish(void *v, void *w)
410 1.4 jakllsch {
411 1.6 martin
412 1.6 martin return isa_intr_disestablish(NULL, v);
413 1.4 jakllsch }
414 1.4 jakllsch
415 1.1 jakllsch #ifdef __HAVE_PCI_CONF_HOOK
416 1.1 jakllsch static int
417 1.1 jakllsch vlpci_pc_conf_hook(void *v, int b, int d, int f, pcireg_t id)
418 1.1 jakllsch {
419 1.7 flxd
420 1.5 macallan return PCI_CONF_DEFAULT /*& ~PCI_CONF_ENABLE_BM*/;
421 1.1 jakllsch }
422 1.1 jakllsch #endif
423 1.1 jakllsch
424 1.1 jakllsch static void
425 1.1 jakllsch vlpci_pc_conf_interrupt(void *v, int bus, int dev, int ipin, int swiz,
426 1.1 jakllsch int *ilinep)
427 1.1 jakllsch {
428 1.7 flxd
429 1.1 jakllsch *ilinep = 0xff; /* XXX */
430 1.1 jakllsch }
431