pci_machdep.h revision 1.14 1 1.14 nonaka /* $NetBSD: pci_machdep.h,v 1.14 2016/10/19 00:08:42 nonaka Exp $ */
2 1.2 garbled
3 1.2 garbled /*-
4 1.2 garbled * Copyright (c) 2002,2007 The NetBSD Foundation, Inc.
5 1.2 garbled * All rights reserved.
6 1.2 garbled *
7 1.2 garbled * This code is derived from software contributed to The NetBSD Foundation
8 1.2 garbled * by Klaus Klein and Tim Rightnour
9 1.2 garbled *
10 1.2 garbled * Redistribution and use in source and binary forms, with or without
11 1.2 garbled * modification, are permitted provided that the following conditions
12 1.2 garbled * are met:
13 1.2 garbled * 1. Redistributions of source code must retain the above copyright
14 1.2 garbled * notice, this list of conditions and the following disclaimer.
15 1.2 garbled * 2. Redistributions in binary form must reproduce the above copyright
16 1.2 garbled * notice, this list of conditions and the following disclaimer in the
17 1.2 garbled * documentation and/or other materials provided with the distribution.
18 1.2 garbled *
19 1.2 garbled * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.2 garbled * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.2 garbled * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.2 garbled * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.2 garbled * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.2 garbled * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.2 garbled * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.2 garbled * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.2 garbled * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.2 garbled * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.2 garbled * POSSIBILITY OF SUCH DAMAGE.
30 1.2 garbled */
31 1.2 garbled
32 1.2 garbled #ifndef _PCI_MACHDEP_H_
33 1.2 garbled #define _PCI_MACHDEP_H_
34 1.2 garbled
35 1.2 garbled #include <prop/proplib.h>
36 1.2 garbled
37 1.2 garbled /*
38 1.2 garbled * Machine-specific definitions for PCI autoconfiguration.
39 1.2 garbled */
40 1.2 garbled
41 1.2 garbled #define __HAVE_PCI_CONF_HOOK
42 1.14 nonaka #define __HAVE_PCI_MSI_MSIX
43 1.2 garbled
44 1.2 garbled /*
45 1.2 garbled * Types provided to machine-independent PCI code
46 1.2 garbled */
47 1.2 garbled typedef struct genppc_pci_chipset *pci_chipset_tag_t;
48 1.2 garbled typedef int pcitag_t;
49 1.2 garbled typedef int pci_intr_handle_t;
50 1.2 garbled
51 1.2 garbled /*
52 1.2 garbled * Forward declarations.
53 1.2 garbled */
54 1.2 garbled struct pci_attach_args;
55 1.11 matt struct pcibus_attach_args;
56 1.11 matt
57 1.11 matt static inline pci_chipset_tag_t pcibus_attach_args_pc(
58 1.11 matt struct pcibus_attach_args *);
59 1.11 matt static inline pci_chipset_tag_t pci_attach_args_pc(
60 1.11 matt const struct pci_attach_args *);
61 1.11 matt
62 1.11 matt #include <dev/pci/pcireg.h>
63 1.11 matt
64 1.11 matt #ifdef _KERNEL
65 1.11 matt extern struct powerpc_bus_dma_tag pci_bus_dma_tag;
66 1.14 nonaka
67 1.14 nonaka typedef enum {
68 1.14 nonaka PCI_INTR_TYPE_INTX = 0,
69 1.14 nonaka PCI_INTR_TYPE_MSI,
70 1.14 nonaka PCI_INTR_TYPE_MSIX,
71 1.14 nonaka PCI_INTR_TYPE_SIZE,
72 1.14 nonaka } pci_intr_type_t;
73 1.11 matt #endif
74 1.11 matt
75 1.11 matt
76 1.11 matt #if defined(_KERNEL) && (defined(_MODULE) || defined(__PCI_NOINLINE))
77 1.11 matt void pci_attach_hook(device_t, device_t,
78 1.11 matt struct pcibus_attach_args *);
79 1.11 matt
80 1.11 matt int pci_bus_maxdevs(pci_chipset_tag_t, int);
81 1.11 matt pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
82 1.11 matt pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
83 1.11 matt void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
84 1.11 matt void pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
85 1.11 matt int *, int *, int *);
86 1.11 matt
87 1.13 christos const char * pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
88 1.13 christos char *, size_t);
89 1.11 matt const struct evcnt *
90 1.11 matt pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
91 1.11 matt void * pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
92 1.11 matt int, int (*)(void *), void *);
93 1.14 nonaka void * pci_intr_establish_xname(pci_chipset_tag_t, pci_intr_handle_t,
94 1.14 nonaka int, int (*)(void *), void *, const char *);
95 1.11 matt void pci_intr_disestablish(pci_chipset_tag_t, void *);
96 1.11 matt int pci_intr_map(const struct pci_attach_args *,
97 1.11 matt pci_intr_handle_t *ihp);
98 1.11 matt int pci_intr_setattr(pci_chipset_tag_t, pci_intr_handle_t *,
99 1.11 matt int, uint64_t);
100 1.11 matt
101 1.14 nonaka pci_intr_type_t pci_intr_type(pci_chipset_tag_t, pci_intr_handle_t);
102 1.14 nonaka int pci_intr_alloc(const struct pci_attach_args *,
103 1.14 nonaka pci_intr_handle_t **, int *, pci_intr_type_t);
104 1.14 nonaka void pci_intr_release(pci_chipset_tag_t, pci_intr_handle_t *, int);
105 1.14 nonaka int pci_intx_alloc(const struct pci_attach_args *,
106 1.14 nonaka pci_intr_handle_t **);
107 1.14 nonaka
108 1.14 nonaka /* experimental MSI support */
109 1.14 nonaka int pci_msi_alloc(const struct pci_attach_args *,
110 1.14 nonaka pci_intr_handle_t **, int *);
111 1.14 nonaka int pci_msi_alloc_exact(const struct pci_attach_args *,
112 1.14 nonaka pci_intr_handle_t **, int);
113 1.14 nonaka
114 1.14 nonaka /* experimental MSI-X support */
115 1.14 nonaka int pci_msix_alloc(const struct pci_attach_args *,
116 1.14 nonaka pci_intr_handle_t **, int *);
117 1.14 nonaka int pci_msix_alloc_exact(const struct pci_attach_args *,
118 1.14 nonaka pci_intr_handle_t **, int);
119 1.14 nonaka int pci_msix_alloc_map(const struct pci_attach_args *,
120 1.14 nonaka pci_intr_handle_t **, u_int *, int);
121 1.12 matt
122 1.11 matt void pci_conf_interrupt(pci_chipset_tag_t, int, int, int,
123 1.11 matt int, int *);
124 1.11 matt int pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
125 1.11 matt #endif /* _KERNEL && (_MODULE || __PCI_NOINLINE) */
126 1.2 garbled
127 1.2 garbled /* Per bus information structure */
128 1.2 garbled struct genppc_pci_chipset_businfo {
129 1.2 garbled SIMPLEQ_ENTRY(genppc_pci_chipset_businfo) next;
130 1.2 garbled prop_dictionary_t pbi_properties; /* chipset properties */
131 1.2 garbled };
132 1.2 garbled
133 1.11 matt #if !defined(_MODULE)
134 1.2 garbled /*
135 1.2 garbled * Generic PPC PCI structure and type definitions.
136 1.2 garbled * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
137 1.2 garbled */
138 1.2 garbled struct genppc_pci_chipset {
139 1.2 garbled void *pc_conf_v;
140 1.9 matt void (*pc_attach_hook)(device_t, device_t,
141 1.9 matt struct pcibus_attach_args *);
142 1.9 matt int (*pc_bus_maxdevs)(void *, int);
143 1.2 garbled pcitag_t (*pc_make_tag)(void *, int, int, int);
144 1.2 garbled pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
145 1.2 garbled void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
146 1.2 garbled
147 1.2 garbled void *pc_intr_v;
148 1.10 dyoung int (*pc_intr_map)(const struct pci_attach_args *,
149 1.2 garbled pci_intr_handle_t *);
150 1.13 christos const char *(*pc_intr_string)(void *, pci_intr_handle_t, char *,
151 1.13 christos size_t);
152 1.2 garbled const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
153 1.2 garbled void *(*pc_intr_establish)(void *, pci_intr_handle_t,
154 1.14 nonaka int, int (*)(void *), void *, const char *);
155 1.2 garbled void (*pc_intr_disestablish)(void *, void *);
156 1.11 matt int (*pc_intr_setattr)(void *, pci_intr_handle_t *,
157 1.11 matt int, uint64_t);
158 1.11 matt
159 1.14 nonaka pci_intr_type_t (*pc_intr_type)(void *, pci_intr_handle_t);
160 1.14 nonaka int (*pc_intr_alloc)(const struct pci_attach_args *,
161 1.14 nonaka pci_intr_handle_t **, int *, pci_intr_type_t);
162 1.14 nonaka void (*pc_intr_release)(void *, pci_intr_handle_t *, int);
163 1.14 nonaka int (*pc_intx_alloc)(const struct pci_attach_args *,
164 1.14 nonaka pci_intr_handle_t **);
165 1.14 nonaka
166 1.14 nonaka /* experimental MSI support */
167 1.12 matt void *pc_msi_v;
168 1.14 nonaka int (*pc_msi_alloc)(const struct pci_attach_args *,
169 1.14 nonaka pci_intr_handle_t **, int *, bool);
170 1.14 nonaka
171 1.14 nonaka /* experimental MSI-X support */
172 1.14 nonaka void *pc_msix_v;
173 1.14 nonaka int (*pc_msix_alloc)(const struct pci_attach_args *,
174 1.14 nonaka pci_intr_handle_t **, u_int *, int *, bool);
175 1.12 matt
176 1.11 matt void (*pc_conf_interrupt)(void *, int, int, int, int, int *);
177 1.2 garbled void (*pc_decompose_tag)(void *, pcitag_t, int *,
178 1.2 garbled int *, int *);
179 1.11 matt int (*pc_conf_hook)(void *, int, int, int, pcireg_t);
180 1.2 garbled
181 1.11 matt uint32_t *pc_addr;
182 1.11 matt uint32_t *pc_data;
183 1.2 garbled int pc_node;
184 1.3 garbled int pc_ihandle;
185 1.2 garbled int pc_bus;
186 1.2 garbled bus_space_tag_t pc_memt;
187 1.2 garbled bus_space_tag_t pc_iot;
188 1.2 garbled
189 1.2 garbled SIMPLEQ_HEAD(, genppc_pci_chipset_businfo) pc_pbi;
190 1.2 garbled };
191 1.2 garbled
192 1.11 matt #ifdef _KERNEL
193 1.11 matt
194 1.11 matt #ifdef __PCI_NOINLINE
195 1.11 matt #define __pci_inline
196 1.11 matt #else
197 1.11 matt #define __pci_inline static inline
198 1.11 matt #endif
199 1.11 matt
200 1.2 garbled /*
201 1.2 garbled * Functions provided to machine-independent PCI code.
202 1.2 garbled */
203 1.11 matt __pci_inline void
204 1.11 matt pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
205 1.11 matt {
206 1.11 matt (*pcibus_attach_args_pc(pba)->pc_attach_hook)(parent, self, pba);
207 1.11 matt }
208 1.11 matt
209 1.11 matt __pci_inline int
210 1.11 matt pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
211 1.11 matt {
212 1.11 matt return (*pc->pc_bus_maxdevs)(pc->pc_conf_v, busno);
213 1.11 matt }
214 1.11 matt
215 1.11 matt __pci_inline pcitag_t
216 1.11 matt pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
217 1.11 matt {
218 1.11 matt return (*pc->pc_make_tag)(pc->pc_conf_v, bus, device, function);
219 1.11 matt }
220 1.11 matt
221 1.11 matt __pci_inline pcireg_t
222 1.11 matt pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
223 1.11 matt {
224 1.11 matt return (*pc->pc_conf_read)(pc->pc_conf_v, tag, reg);
225 1.11 matt }
226 1.11 matt
227 1.11 matt __pci_inline void
228 1.11 matt pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val)
229 1.11 matt {
230 1.11 matt (*pc->pc_conf_write)(pc->pc_conf_v, tag, reg, val);
231 1.11 matt }
232 1.11 matt
233 1.11 matt __pci_inline void
234 1.11 matt pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp)
235 1.11 matt {
236 1.11 matt (*pc->pc_decompose_tag)(pc->pc_conf_v, tag, bp, dp, fp);
237 1.11 matt }
238 1.11 matt
239 1.11 matt __pci_inline int
240 1.11 matt pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
241 1.11 matt {
242 1.11 matt return (*pci_attach_args_pc(pa)->pc_intr_map)(pa, ihp);
243 1.11 matt }
244 1.11 matt
245 1.11 matt __pci_inline const char *
246 1.13 christos pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char * buf,
247 1.13 christos size_t len)
248 1.11 matt {
249 1.13 christos return (*pc->pc_intr_string)(pc->pc_intr_v, ih, buf, len);
250 1.11 matt }
251 1.11 matt
252 1.11 matt __pci_inline const struct evcnt *
253 1.11 matt pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
254 1.11 matt {
255 1.11 matt return (*pc->pc_intr_evcnt)(pc->pc_intr_v, ih);
256 1.11 matt }
257 1.11 matt
258 1.11 matt __pci_inline void *
259 1.11 matt pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int ipl,
260 1.11 matt int (*handler)(void *), void *arg)
261 1.11 matt {
262 1.14 nonaka return (*pc->pc_intr_establish)(pc->pc_intr_v, ih, ipl, handler, arg,
263 1.14 nonaka NULL);
264 1.14 nonaka }
265 1.14 nonaka
266 1.14 nonaka __pci_inline void *
267 1.14 nonaka pci_intr_establish_xname(pci_chipset_tag_t pc, pci_intr_handle_t ih, int ipl,
268 1.14 nonaka int (*handler)(void *), void *arg, const char *xname)
269 1.14 nonaka {
270 1.14 nonaka return (*pc->pc_intr_establish)(pc->pc_intr_v, ih, ipl, handler, arg,
271 1.14 nonaka xname);
272 1.11 matt }
273 1.11 matt
274 1.11 matt __pci_inline void
275 1.11 matt pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
276 1.11 matt {
277 1.11 matt (*pc->pc_intr_disestablish)(pc->pc_intr_v, cookie);
278 1.11 matt }
279 1.11 matt
280 1.11 matt __pci_inline int
281 1.11 matt pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ihp, int attr,
282 1.11 matt uint64_t data)
283 1.11 matt {
284 1.11 matt return (*pc->pc_intr_setattr)(pc->pc_intr_v, ihp, attr, data);
285 1.11 matt }
286 1.11 matt
287 1.14 nonaka __pci_inline pci_intr_type_t
288 1.14 nonaka pci_intr_type(pci_chipset_tag_t pc, pci_intr_handle_t ih)
289 1.11 matt {
290 1.14 nonaka return (*pc->pc_intr_type)(pc->pc_intr_v, ih);
291 1.11 matt }
292 1.11 matt
293 1.11 matt __pci_inline int
294 1.14 nonaka pci_intr_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
295 1.14 nonaka int *count, pci_intr_type_t max_type)
296 1.11 matt {
297 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
298 1.14 nonaka return (*pc->pc_intr_alloc)(pa, ihps, count, max_type);
299 1.11 matt }
300 1.2 garbled
301 1.14 nonaka __pci_inline void
302 1.14 nonaka pci_intr_release(pci_chipset_tag_t pc, pci_intr_handle_t *ihp, int count)
303 1.12 matt {
304 1.14 nonaka (*pc->pc_intr_release)(pc->pc_intr_v, ihp, count);
305 1.12 matt }
306 1.12 matt
307 1.12 matt __pci_inline int
308 1.14 nonaka pci_intx_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps)
309 1.12 matt {
310 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
311 1.14 nonaka return (*pc->pc_intx_alloc)(pa, ihps);
312 1.12 matt }
313 1.12 matt
314 1.14 nonaka
315 1.14 nonaka __pci_inline void
316 1.14 nonaka pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int device, int pin,
317 1.14 nonaka int swiz, int *iline)
318 1.12 matt {
319 1.14 nonaka (*pc->pc_conf_interrupt)(pc->pc_conf_v, bus, device, pin, swiz, iline);
320 1.12 matt }
321 1.12 matt
322 1.14 nonaka __pci_inline int
323 1.14 nonaka pci_conf_hook(pci_chipset_tag_t pc, int bus, int device, int function,
324 1.14 nonaka pcireg_t id)
325 1.12 matt {
326 1.14 nonaka return (*pc->pc_conf_hook)(pc->pc_conf_v, bus, device, function, id);
327 1.12 matt }
328 1.12 matt
329 1.12 matt
330 1.14 nonaka /* experimental MSI support */
331 1.14 nonaka __pci_inline int
332 1.14 nonaka pci_msi_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
333 1.14 nonaka int *count)
334 1.12 matt {
335 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
336 1.14 nonaka return (*pc->pc_msi_alloc)(pa, ihps, count, false);
337 1.12 matt }
338 1.12 matt
339 1.14 nonaka __pci_inline int
340 1.14 nonaka pci_msi_alloc_exact(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
341 1.14 nonaka int count)
342 1.12 matt {
343 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
344 1.14 nonaka return (*pc->pc_msi_alloc)(pa, ihps, &count, true);
345 1.12 matt }
346 1.12 matt
347 1.14 nonaka /* experimental MSI-X support */
348 1.14 nonaka __pci_inline int
349 1.14 nonaka pci_msix_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
350 1.14 nonaka int *count)
351 1.12 matt {
352 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
353 1.14 nonaka return (*pc->pc_msix_alloc)(pa, ihps, NULL, count, false);
354 1.12 matt }
355 1.12 matt
356 1.14 nonaka __pci_inline int
357 1.14 nonaka pci_msix_alloc_exact(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
358 1.14 nonaka int count)
359 1.12 matt {
360 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
361 1.14 nonaka return (*pc->pc_msix_alloc)(pa, ihps, NULL, &count, true);
362 1.12 matt }
363 1.12 matt
364 1.14 nonaka __pci_inline int
365 1.14 nonaka pci_msix_alloc_map(const struct pci_attach_args *pa, pci_intr_handle_t **ihps,
366 1.14 nonaka u_int *table_indexes, int count)
367 1.12 matt {
368 1.14 nonaka pci_chipset_tag_t pc = pci_attach_args_pc(pa);
369 1.14 nonaka return (*pc->pc_msix_alloc)(pa, ihps, table_indexes, &count, true);
370 1.12 matt }
371 1.12 matt
372 1.11 matt #undef __pci_inline
373 1.2 garbled
374 1.2 garbled /*
375 1.2 garbled * Generic PowerPC PCI functions. Override if necc.
376 1.2 garbled */
377 1.2 garbled
378 1.9 matt int genppc_pci_bus_maxdevs(void *, int);
379 1.12 matt
380 1.12 matt int genppc_pci_intr_map(const struct pci_attach_args *,
381 1.12 matt pci_intr_handle_t *);
382 1.13 christos const char *genppc_pci_intr_string(void *, pci_intr_handle_t, char *, size_t);
383 1.2 garbled const struct evcnt *genppc_pci_intr_evcnt(void *, pci_intr_handle_t);
384 1.2 garbled void *genppc_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
385 1.14 nonaka void *, const char *);
386 1.2 garbled void genppc_pci_intr_disestablish(void *, void *);
387 1.11 matt int genppc_pci_intr_setattr(void *, pci_intr_handle_t *, int, uint64_t);
388 1.14 nonaka pci_intr_type_t genppc_pci_intr_type(void *, pci_intr_handle_t);
389 1.14 nonaka int genppc_pci_intr_alloc(const struct pci_attach_args *, pci_intr_handle_t **,
390 1.14 nonaka int *, pci_intr_type_t);
391 1.14 nonaka void genppc_pci_intr_release(void *, pci_intr_handle_t *, int);
392 1.14 nonaka int genppc_pci_intx_alloc(const struct pci_attach_args *, pci_intr_handle_t **);
393 1.14 nonaka
394 1.14 nonaka /* experimental MSI support */
395 1.14 nonaka int genppc_pci_msi_alloc(const struct pci_attach_args *, pci_intr_handle_t **,
396 1.14 nonaka int *, bool);
397 1.14 nonaka
398 1.14 nonaka /* experimental MSI-X support */
399 1.14 nonaka int genppc_pci_msix_alloc(const struct pci_attach_args *, pci_intr_handle_t **,
400 1.14 nonaka u_int *, int *, bool);
401 1.12 matt
402 1.14 nonaka void genppc_pci_chipset_msi_init(pci_chipset_tag_t pc);
403 1.14 nonaka void genppc_pci_chipset_msix_init(pci_chipset_tag_t pc);
404 1.12 matt
405 1.12 matt #define GENPPC_PCI_MSI_INITIALIZER \
406 1.14 nonaka .pc_msi_alloc = genppc_pci_msi_alloc
407 1.14 nonaka
408 1.14 nonaka #define GENPPC_PCI_MSIX_INITIALIZER \
409 1.14 nonaka .pc_msix_alloc = genppc_pci_msix_alloc
410 1.12 matt
411 1.11 matt void genppc_pci_conf_interrupt(void *, int, int, int, int, int *);
412 1.11 matt int genppc_pci_conf_hook(void *, int, int, int, pcireg_t);
413 1.2 garbled
414 1.2 garbled /* generic indirect PCI functions */
415 1.9 matt void genppc_pci_indirect_attach_hook(device_t, device_t,
416 1.2 garbled struct pcibus_attach_args *);
417 1.2 garbled pcitag_t genppc_pci_indirect_make_tag(void *, int, int, int);
418 1.2 garbled pcireg_t genppc_pci_indirect_conf_read(void *, pcitag_t, int);
419 1.2 garbled void genppc_pci_indirect_conf_write(void *, pcitag_t, int, pcireg_t);
420 1.2 garbled void genppc_pci_indirect_decompose_tag(void *, pcitag_t, int *, int *, int *);
421 1.2 garbled
422 1.3 garbled /* generic OFW method PCI functions */
423 1.9 matt void genppc_pci_ofmethod_attach_hook(device_t, device_t,
424 1.3 garbled struct pcibus_attach_args *);
425 1.3 garbled pcitag_t genppc_pci_ofmethod_make_tag(void *, int, int, int);
426 1.3 garbled pcireg_t genppc_pci_ofmethod_conf_read(void *, pcitag_t, int);
427 1.3 garbled void genppc_pci_ofmethod_conf_write(void *, pcitag_t, int, pcireg_t);
428 1.3 garbled void genppc_pci_ofmethod_decompose_tag(void *, pcitag_t, int *, int *, int *);
429 1.3 garbled
430 1.2 garbled /* Generic OFW PCI functions */
431 1.2 garbled
432 1.2 garbled int genofw_find_picnode(int);
433 1.2 garbled void genofw_find_ofpics(int);
434 1.2 garbled void genofw_fixup_picnode_offsets(void);
435 1.4 garbled void genofw_setup_pciintr_map(void *, struct genppc_pci_chipset_businfo *, int);
436 1.2 garbled int genofw_find_node_by_devfunc(int, int, int, int);
437 1.10 dyoung int genofw_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
438 1.11 matt int genofw_pci_conf_hook(void *, int, int, int, pcireg_t);
439 1.2 garbled
440 1.2 garbled /* OFW PCI structures and defines */
441 1.2 garbled #define PICNODE_TYPE_OPENPIC 1
442 1.2 garbled #define PICNODE_TYPE_8259 2
443 1.2 garbled #define PICNODE_TYPE_HEATHROW 3
444 1.2 garbled #define PICNODE_TYPE_OHARE 4
445 1.7 garbled #define PICNODE_TYPE_IVR 5
446 1.2 garbled
447 1.2 garbled typedef struct _ofw_pic_node_t {
448 1.2 garbled int node;
449 1.2 garbled int parent;
450 1.2 garbled int16_t cells;
451 1.2 garbled int16_t intrs;
452 1.2 garbled int16_t offset;
453 1.2 garbled int16_t type;
454 1.2 garbled } ofw_pic_node_t;
455 1.2 garbled
456 1.2 garbled #endif /* _KERNEL */
457 1.2 garbled
458 1.11 matt #endif /* !_MODULE */
459 1.11 matt
460 1.2 garbled #endif /* _PCI_MACHDEP_H_ */
461