pci_machdep.h revision 1.13 1 1.13 christos /* $NetBSD: pci_machdep.h,v 1.13 2014/03/29 19:28:29 christos 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.2 garbled
43 1.2 garbled /*
44 1.2 garbled * Types provided to machine-independent PCI code
45 1.2 garbled */
46 1.2 garbled typedef struct genppc_pci_chipset *pci_chipset_tag_t;
47 1.12 matt typedef void *pci_msi_handle_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.11 matt #endif
67 1.11 matt
68 1.11 matt
69 1.11 matt #if defined(_KERNEL) && (defined(_MODULE) || defined(__PCI_NOINLINE))
70 1.11 matt void pci_attach_hook(device_t, device_t,
71 1.11 matt struct pcibus_attach_args *);
72 1.11 matt
73 1.11 matt int pci_bus_maxdevs(pci_chipset_tag_t, int);
74 1.11 matt pcitag_t pci_make_tag(pci_chipset_tag_t, int, int, int);
75 1.11 matt pcireg_t pci_conf_read(pci_chipset_tag_t, pcitag_t, int);
76 1.11 matt void pci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
77 1.11 matt void pci_decompose_tag(pci_chipset_tag_t, pcitag_t,
78 1.11 matt int *, int *, int *);
79 1.11 matt
80 1.13 christos const char * pci_intr_string(pci_chipset_tag_t, pci_intr_handle_t,
81 1.13 christos char *, size_t);
82 1.11 matt const struct evcnt *
83 1.11 matt pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
84 1.11 matt void * pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
85 1.11 matt int, int (*)(void *), void *);
86 1.11 matt void pci_intr_disestablish(pci_chipset_tag_t, void *);
87 1.11 matt int pci_intr_map(const struct pci_attach_args *,
88 1.11 matt pci_intr_handle_t *ihp);
89 1.11 matt int pci_intr_setattr(pci_chipset_tag_t, pci_intr_handle_t *,
90 1.11 matt int, uint64_t);
91 1.11 matt
92 1.12 matt int pci_msi_request(const struct pci_attach_args *,
93 1.12 matt pci_msi_handle_t *, size_t, int, int);
94 1.12 matt int pci_msi_type(pci_chipset_tag_t, pci_msi_handle_t);
95 1.12 matt size_t pci_msi_available(pci_chipset_tag_t, pci_msi_handle_t);
96 1.12 matt const char * pci_msi_string(pci_chipset_tag_t, pci_msi_handle_t, size_t);
97 1.12 matt const struct evcnt *
98 1.12 matt pci_msi_evcnt(pci_chipset_tag_t, pci_msi_handle_t, size_t);
99 1.12 matt void * pci_msi_establish(pci_chipset_tag_t, pci_msi_handle_t, size_t,
100 1.12 matt int, int (*)(void *), void *);
101 1.12 matt void * pci_msix_establish(pci_chipset_tag_t, pci_msi_handle_t, size_t,
102 1.12 matt size_t, int, int (*)(void *), void *);
103 1.12 matt void pci_msi_disestablish(pci_chipset_tag_t, void *);
104 1.12 matt void pci_msi_free(pci_chipset_tag_t, pci_msi_handle_t, size_t);
105 1.12 matt void pci_msi_release(pci_chipset_tag_t, pci_msi_handle_t);
106 1.12 matt
107 1.11 matt void pci_conf_interrupt(pci_chipset_tag_t, int, int, int,
108 1.11 matt int, int *);
109 1.11 matt int pci_conf_hook(pci_chipset_tag_t, int, int, int, pcireg_t);
110 1.11 matt #endif /* _KERNEL && (_MODULE || __PCI_NOINLINE) */
111 1.2 garbled
112 1.2 garbled /* Per bus information structure */
113 1.2 garbled struct genppc_pci_chipset_businfo {
114 1.2 garbled SIMPLEQ_ENTRY(genppc_pci_chipset_businfo) next;
115 1.2 garbled prop_dictionary_t pbi_properties; /* chipset properties */
116 1.2 garbled };
117 1.2 garbled
118 1.11 matt #if !defined(_MODULE)
119 1.2 garbled /*
120 1.2 garbled * Generic PPC PCI structure and type definitions.
121 1.2 garbled * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
122 1.2 garbled */
123 1.2 garbled struct genppc_pci_chipset {
124 1.2 garbled void *pc_conf_v;
125 1.9 matt void (*pc_attach_hook)(device_t, device_t,
126 1.9 matt struct pcibus_attach_args *);
127 1.9 matt int (*pc_bus_maxdevs)(void *, int);
128 1.2 garbled pcitag_t (*pc_make_tag)(void *, int, int, int);
129 1.2 garbled pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
130 1.2 garbled void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
131 1.2 garbled
132 1.2 garbled void *pc_intr_v;
133 1.10 dyoung int (*pc_intr_map)(const struct pci_attach_args *,
134 1.2 garbled pci_intr_handle_t *);
135 1.13 christos const char *(*pc_intr_string)(void *, pci_intr_handle_t, char *,
136 1.13 christos size_t);
137 1.2 garbled const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
138 1.2 garbled void *(*pc_intr_establish)(void *, pci_intr_handle_t,
139 1.2 garbled int, int (*)(void *), void *);
140 1.2 garbled void (*pc_intr_disestablish)(void *, void *);
141 1.11 matt int (*pc_intr_setattr)(void *, pci_intr_handle_t *,
142 1.11 matt int, uint64_t);
143 1.11 matt
144 1.12 matt void *pc_msi_v;
145 1.12 matt int (*pc_msi_request)(const struct pci_attach_args *,
146 1.12 matt pci_msi_handle_t *, size_t, int, int);
147 1.12 matt int (*pc_msi_type)(void *, pci_msi_handle_t);
148 1.12 matt size_t (*pc_msi_available)(void *, pci_msi_handle_t);
149 1.12 matt const char * (*pc_msi_string)(void *, pci_msi_handle_t, size_t);
150 1.12 matt const struct evcnt *
151 1.12 matt (*pc_msi_evcnt)(void *, pci_msi_handle_t, size_t);
152 1.12 matt void * (*pc_msi_establish)(void *, pci_msi_handle_t, size_t,
153 1.12 matt int, int (*)(void *), void *);
154 1.12 matt void * (*pc_msix_establish)(void *, pci_msi_handle_t, size_t,
155 1.12 matt size_t, int, int (*)(void *), void *);
156 1.12 matt void (*pc_msi_disestablish)(void *, void *);
157 1.12 matt void (*pc_msi_free)(void *, pci_msi_handle_t, size_t);
158 1.12 matt void (*pc_msi_release)(void *, pci_msi_handle_t);
159 1.12 matt
160 1.11 matt void (*pc_conf_interrupt)(void *, int, int, int, int, int *);
161 1.2 garbled void (*pc_decompose_tag)(void *, pcitag_t, int *,
162 1.2 garbled int *, int *);
163 1.11 matt int (*pc_conf_hook)(void *, int, int, int, pcireg_t);
164 1.2 garbled
165 1.11 matt uint32_t *pc_addr;
166 1.11 matt uint32_t *pc_data;
167 1.2 garbled int pc_node;
168 1.3 garbled int pc_ihandle;
169 1.2 garbled int pc_bus;
170 1.2 garbled bus_space_tag_t pc_memt;
171 1.2 garbled bus_space_tag_t pc_iot;
172 1.2 garbled
173 1.2 garbled SIMPLEQ_HEAD(, genppc_pci_chipset_businfo) pc_pbi;
174 1.2 garbled };
175 1.2 garbled
176 1.11 matt #ifdef _KERNEL
177 1.11 matt
178 1.11 matt #ifdef __PCI_NOINLINE
179 1.11 matt #define __pci_inline
180 1.11 matt #else
181 1.11 matt #define __pci_inline static inline
182 1.11 matt #endif
183 1.11 matt
184 1.2 garbled /*
185 1.2 garbled * Functions provided to machine-independent PCI code.
186 1.2 garbled */
187 1.11 matt __pci_inline void
188 1.11 matt pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
189 1.11 matt {
190 1.11 matt (*pcibus_attach_args_pc(pba)->pc_attach_hook)(parent, self, pba);
191 1.11 matt }
192 1.11 matt
193 1.11 matt __pci_inline int
194 1.11 matt pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
195 1.11 matt {
196 1.11 matt return (*pc->pc_bus_maxdevs)(pc->pc_conf_v, busno);
197 1.11 matt }
198 1.11 matt
199 1.11 matt __pci_inline pcitag_t
200 1.11 matt pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
201 1.11 matt {
202 1.11 matt return (*pc->pc_make_tag)(pc->pc_conf_v, bus, device, function);
203 1.11 matt }
204 1.11 matt
205 1.11 matt __pci_inline pcireg_t
206 1.11 matt pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
207 1.11 matt {
208 1.11 matt return (*pc->pc_conf_read)(pc->pc_conf_v, tag, reg);
209 1.11 matt }
210 1.11 matt
211 1.11 matt __pci_inline void
212 1.11 matt pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val)
213 1.11 matt {
214 1.11 matt (*pc->pc_conf_write)(pc->pc_conf_v, tag, reg, val);
215 1.11 matt }
216 1.11 matt
217 1.11 matt __pci_inline void
218 1.11 matt pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp)
219 1.11 matt {
220 1.11 matt (*pc->pc_decompose_tag)(pc->pc_conf_v, tag, bp, dp, fp);
221 1.11 matt }
222 1.11 matt
223 1.11 matt __pci_inline int
224 1.11 matt pci_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
225 1.11 matt {
226 1.11 matt return (*pci_attach_args_pc(pa)->pc_intr_map)(pa, ihp);
227 1.11 matt }
228 1.11 matt
229 1.11 matt __pci_inline const char *
230 1.13 christos pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char * buf,
231 1.13 christos size_t len)
232 1.11 matt {
233 1.13 christos return (*pc->pc_intr_string)(pc->pc_intr_v, ih, buf, len);
234 1.11 matt }
235 1.11 matt
236 1.11 matt __pci_inline const struct evcnt *
237 1.11 matt pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
238 1.11 matt {
239 1.11 matt return (*pc->pc_intr_evcnt)(pc->pc_intr_v, ih);
240 1.11 matt }
241 1.11 matt
242 1.11 matt __pci_inline void *
243 1.11 matt pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int ipl,
244 1.11 matt int (*handler)(void *), void *arg)
245 1.11 matt {
246 1.11 matt return (*pc->pc_intr_establish)(pc->pc_intr_v, ih, ipl, handler, arg);
247 1.11 matt }
248 1.11 matt
249 1.11 matt __pci_inline void
250 1.11 matt pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
251 1.11 matt {
252 1.11 matt (*pc->pc_intr_disestablish)(pc->pc_intr_v, cookie);
253 1.11 matt }
254 1.11 matt
255 1.11 matt __pci_inline int
256 1.11 matt pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ihp, int attr,
257 1.11 matt uint64_t data)
258 1.11 matt {
259 1.11 matt return (*pc->pc_intr_setattr)(pc->pc_intr_v, ihp, attr, data);
260 1.11 matt }
261 1.11 matt
262 1.11 matt
263 1.11 matt __pci_inline void
264 1.11 matt pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int device, int pin,
265 1.11 matt int swiz, int *iline)
266 1.11 matt {
267 1.11 matt (*pc->pc_conf_interrupt)(pc->pc_conf_v, bus, device, pin, swiz, iline);
268 1.11 matt }
269 1.11 matt
270 1.11 matt __pci_inline int
271 1.11 matt pci_conf_hook(pci_chipset_tag_t pc, int bus, int device, int function,
272 1.11 matt pcireg_t id)
273 1.11 matt {
274 1.11 matt return (*pc->pc_conf_hook)(pc->pc_conf_v, bus, device, function, id);
275 1.11 matt }
276 1.2 garbled
277 1.12 matt __pci_inline int
278 1.12 matt pci_msi_request(const struct pci_attach_args *pa, pci_msi_handle_t *msihp,
279 1.12 matt size_t nmsi, int ipl, int capid)
280 1.12 matt {
281 1.12 matt return (*pci_attach_args_pc(pa)->pc_msi_request)(pa, msihp, nmsi,
282 1.12 matt ipl, capid);
283 1.12 matt }
284 1.12 matt
285 1.12 matt __pci_inline int
286 1.12 matt pci_msi_type(pci_chipset_tag_t pc, pci_msi_handle_t msih)
287 1.12 matt {
288 1.12 matt return (*pc->pc_msi_type)(pc->pc_msi_v, msih);
289 1.12 matt }
290 1.12 matt
291 1.12 matt __pci_inline size_t
292 1.12 matt pci_msi_available(pci_chipset_tag_t pc, pci_msi_handle_t msih)
293 1.12 matt {
294 1.12 matt return (*pc->pc_msi_available)(pc->pc_msi_v, msih);
295 1.12 matt }
296 1.12 matt
297 1.12 matt __pci_inline const char *
298 1.12 matt pci_msi_string(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
299 1.12 matt {
300 1.12 matt return (*pc->pc_msi_string)(pc->pc_msi_v, msih, msirq);
301 1.12 matt }
302 1.12 matt
303 1.12 matt __pci_inline const struct evcnt *
304 1.12 matt pci_msi_evcnt(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
305 1.12 matt {
306 1.12 matt return (*pc->pc_msi_evcnt)(pc->pc_msi_v, msih, msirq);
307 1.12 matt }
308 1.12 matt
309 1.12 matt __pci_inline void *
310 1.12 matt pci_msi_establish(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq,
311 1.12 matt int ipl, int (*func)(void *), void *arg)
312 1.12 matt {
313 1.12 matt return (*pc->pc_msi_establish)(pc->pc_msi_v, msih, msirq, ipl,
314 1.12 matt func, arg);
315 1.12 matt }
316 1.12 matt
317 1.12 matt __pci_inline void *
318 1.12 matt pci_msix_establish(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t vec,
319 1.12 matt size_t msirq, int ipl, int (*func)(void *), void *arg)
320 1.12 matt {
321 1.12 matt return (*pc->pc_msix_establish)(pc->pc_msi_v, msih, vec, msirq, ipl,
322 1.12 matt func, arg);
323 1.12 matt }
324 1.12 matt
325 1.12 matt __pci_inline void
326 1.12 matt pci_msi_disestablish(pci_chipset_tag_t pc, void *ih)
327 1.12 matt {
328 1.12 matt (*pc->pc_msi_disestablish)(pc->pc_msi_v, ih);
329 1.12 matt }
330 1.12 matt
331 1.12 matt __pci_inline void
332 1.12 matt pci_msi_free(pci_chipset_tag_t pc, pci_msi_handle_t msih, size_t msirq)
333 1.12 matt {
334 1.12 matt (*pc->pc_msi_free)(pc->pc_msi_v, msih, msirq);
335 1.12 matt }
336 1.12 matt
337 1.12 matt __pci_inline void
338 1.12 matt pci_msi_release(pci_chipset_tag_t pc, pci_msi_handle_t msih)
339 1.12 matt {
340 1.12 matt (*pc->pc_msi_release)(pc->pc_msi_v, msih);
341 1.12 matt }
342 1.12 matt
343 1.11 matt #undef __pci_inline
344 1.2 garbled
345 1.2 garbled /*
346 1.2 garbled * Generic PowerPC PCI functions. Override if necc.
347 1.2 garbled */
348 1.2 garbled
349 1.9 matt int genppc_pci_bus_maxdevs(void *, int);
350 1.12 matt
351 1.12 matt int genppc_pci_intr_map(const struct pci_attach_args *,
352 1.12 matt pci_intr_handle_t *);
353 1.13 christos const char *genppc_pci_intr_string(void *, pci_intr_handle_t, char *, size_t);
354 1.2 garbled const struct evcnt *genppc_pci_intr_evcnt(void *, pci_intr_handle_t);
355 1.2 garbled void *genppc_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
356 1.2 garbled void *);
357 1.2 garbled void genppc_pci_intr_disestablish(void *, void *);
358 1.11 matt int genppc_pci_intr_setattr(void *, pci_intr_handle_t *, int, uint64_t);
359 1.12 matt
360 1.12 matt int genppc_pci_msi_request(const struct pci_attach_args *, pci_msi_handle_t *,
361 1.12 matt size_t, int, int);
362 1.12 matt int genppc_pci_msi_type(void *, pci_msi_handle_t);
363 1.12 matt size_t genppc_pci_msi_available(void *, pci_msi_handle_t);
364 1.12 matt const struct evcnt *genppc_pci_msi_evcnt(void *, pci_msi_handle_t, size_t);
365 1.12 matt const char *genppc_pci_msi_string(void *, pci_msi_handle_t, size_t);
366 1.12 matt void *genppc_pci_msi_establish(void *, pci_msi_handle_t, size_t,
367 1.12 matt int, int (*)(void *), void *);
368 1.12 matt void *genppc_pci_msix_establish(void *, pci_msi_handle_t, size_t,
369 1.12 matt size_t, int, int (*)(void *), void *);
370 1.12 matt void genppc_pci_msi_disestablish(void *, void *);
371 1.12 matt void genppc_pci_msi_free(void *, pci_msi_handle_t, size_t);
372 1.12 matt void genppc_pci_msi_release(void *, pci_msi_handle_t);
373 1.12 matt void genppc_pci_chipset_msi_init(pci_chipset_tag_t);
374 1.12 matt
375 1.12 matt #define GENPPC_PCI_MSI_INITIALIZER \
376 1.12 matt .pc_msi_request = genppc_pci_msi_request, \
377 1.12 matt .pc_msi_type = genppc_pci_msi_type, \
378 1.12 matt .pc_msi_available = genppc_pci_msi_available, \
379 1.12 matt .pc_msi_evcnt = genppc_pci_msi_evcnt, \
380 1.12 matt .pc_msi_string = genppc_pci_msi_string, \
381 1.12 matt .pc_msi_establish = genppc_pci_msi_establish, \
382 1.12 matt .pc_msix_establish = genppc_pci_msix_establish, \
383 1.12 matt .pc_msi_disestablish = genppc_pci_msi_disestablish, \
384 1.12 matt .pc_msi_free = genppc_pci_msi_free, \
385 1.12 matt .pc_msi_release = genppc_pci_msi_release
386 1.12 matt
387 1.11 matt void genppc_pci_conf_interrupt(void *, int, int, int, int, int *);
388 1.11 matt int genppc_pci_conf_hook(void *, int, int, int, pcireg_t);
389 1.2 garbled
390 1.2 garbled /* generic indirect PCI functions */
391 1.9 matt void genppc_pci_indirect_attach_hook(device_t, device_t,
392 1.2 garbled struct pcibus_attach_args *);
393 1.2 garbled pcitag_t genppc_pci_indirect_make_tag(void *, int, int, int);
394 1.2 garbled pcireg_t genppc_pci_indirect_conf_read(void *, pcitag_t, int);
395 1.2 garbled void genppc_pci_indirect_conf_write(void *, pcitag_t, int, pcireg_t);
396 1.2 garbled void genppc_pci_indirect_decompose_tag(void *, pcitag_t, int *, int *, int *);
397 1.2 garbled
398 1.3 garbled /* generic OFW method PCI functions */
399 1.9 matt void genppc_pci_ofmethod_attach_hook(device_t, device_t,
400 1.3 garbled struct pcibus_attach_args *);
401 1.3 garbled pcitag_t genppc_pci_ofmethod_make_tag(void *, int, int, int);
402 1.3 garbled pcireg_t genppc_pci_ofmethod_conf_read(void *, pcitag_t, int);
403 1.3 garbled void genppc_pci_ofmethod_conf_write(void *, pcitag_t, int, pcireg_t);
404 1.3 garbled void genppc_pci_ofmethod_decompose_tag(void *, pcitag_t, int *, int *, int *);
405 1.3 garbled
406 1.2 garbled /* Generic OFW PCI functions */
407 1.2 garbled
408 1.2 garbled int genofw_find_picnode(int);
409 1.2 garbled void genofw_find_ofpics(int);
410 1.2 garbled void genofw_fixup_picnode_offsets(void);
411 1.4 garbled void genofw_setup_pciintr_map(void *, struct genppc_pci_chipset_businfo *, int);
412 1.2 garbled int genofw_find_node_by_devfunc(int, int, int, int);
413 1.10 dyoung int genofw_pci_intr_map(const struct pci_attach_args *, pci_intr_handle_t *);
414 1.11 matt int genofw_pci_conf_hook(void *, int, int, int, pcireg_t);
415 1.2 garbled
416 1.2 garbled /* OFW PCI structures and defines */
417 1.2 garbled #define PICNODE_TYPE_OPENPIC 1
418 1.2 garbled #define PICNODE_TYPE_8259 2
419 1.2 garbled #define PICNODE_TYPE_HEATHROW 3
420 1.2 garbled #define PICNODE_TYPE_OHARE 4
421 1.7 garbled #define PICNODE_TYPE_IVR 5
422 1.2 garbled
423 1.2 garbled typedef struct _ofw_pic_node_t {
424 1.2 garbled int node;
425 1.2 garbled int parent;
426 1.2 garbled int16_t cells;
427 1.2 garbled int16_t intrs;
428 1.2 garbled int16_t offset;
429 1.2 garbled int16_t type;
430 1.2 garbled } ofw_pic_node_t;
431 1.2 garbled
432 1.2 garbled #endif /* _KERNEL */
433 1.2 garbled
434 1.11 matt #endif /* !_MODULE */
435 1.11 matt
436 1.2 garbled #endif /* _PCI_MACHDEP_H_ */
437