pci_machdep.h revision 1.2.2.4 1 1.2.2.4 skrll /* $NetBSD: pci_machdep.h,v 1.2.2.4 2004/09/21 13:17:19 skrll Exp $ */
2 1.2.2.2 skrll
3 1.2.2.2 skrll /*
4 1.2.2.2 skrll * Copyright (c) 1996 Carnegie-Mellon University.
5 1.2.2.2 skrll * All rights reserved.
6 1.2.2.2 skrll *
7 1.2.2.2 skrll * Author: Chris G. Demetriou
8 1.2.2.2 skrll *
9 1.2.2.2 skrll * Permission to use, copy, modify and distribute this software and
10 1.2.2.2 skrll * its documentation is hereby granted, provided that both the copyright
11 1.2.2.2 skrll * notice and this permission notice appear in all copies of the
12 1.2.2.2 skrll * software, derivative works or modified versions, and any portions
13 1.2.2.2 skrll * thereof, and that both notices appear in supporting documentation.
14 1.2.2.2 skrll *
15 1.2.2.2 skrll * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 1.2.2.2 skrll * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 1.2.2.2 skrll * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 1.2.2.2 skrll *
19 1.2.2.2 skrll * Carnegie Mellon requests users of this software to return to
20 1.2.2.2 skrll *
21 1.2.2.2 skrll * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 1.2.2.2 skrll * School of Computer Science
23 1.2.2.2 skrll * Carnegie Mellon University
24 1.2.2.2 skrll * Pittsburgh PA 15213-3890
25 1.2.2.2 skrll *
26 1.2.2.2 skrll * any improvements or extensions that they make and grant Carnegie the
27 1.2.2.2 skrll * rights to redistribute these changes.
28 1.2.2.2 skrll */
29 1.2.2.2 skrll
30 1.2.2.2 skrll /*
31 1.2.2.2 skrll * Machine-specific definitions for PCI autoconfiguration.
32 1.2.2.2 skrll */
33 1.2.2.2 skrll
34 1.2.2.2 skrll #define __HAVE_PCI_CONF_HOOK
35 1.2.2.2 skrll
36 1.2.2.2 skrll /*
37 1.2.2.2 skrll * Types provided to machine-independent PCI code
38 1.2.2.2 skrll */
39 1.2.2.2 skrll typedef struct ibmnws_pci_chipset *pci_chipset_tag_t;
40 1.2.2.2 skrll typedef int pcitag_t;
41 1.2.2.2 skrll typedef int pci_intr_handle_t;
42 1.2.2.2 skrll
43 1.2.2.2 skrll /*
44 1.2.2.2 skrll * Forward declarations.
45 1.2.2.2 skrll */
46 1.2.2.2 skrll struct pci_attach_args;
47 1.2.2.2 skrll
48 1.2.2.2 skrll /*
49 1.2.2.2 skrll * ibmnws-specific PCI structure and type definitions.
50 1.2.2.2 skrll * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
51 1.2.2.2 skrll */
52 1.2.2.2 skrll struct ibmnws_pci_chipset {
53 1.2.2.2 skrll void *pc_conf_v;
54 1.2.2.2 skrll void (*pc_attach_hook)(struct device *,
55 1.2.2.2 skrll struct device *, struct pcibus_attach_args *);
56 1.2.2.2 skrll int (*pc_bus_maxdevs)(void *, int);
57 1.2.2.2 skrll pcitag_t (*pc_make_tag)(void *, int, int, int);
58 1.2.2.2 skrll pcireg_t (*pc_conf_read)(void *, pcitag_t, int);
59 1.2.2.2 skrll void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t);
60 1.2.2.2 skrll
61 1.2.2.2 skrll void *pc_intr_v;
62 1.2.2.2 skrll int (*pc_intr_map)(struct pci_attach_args *,
63 1.2.2.2 skrll pci_intr_handle_t *);
64 1.2.2.2 skrll const char *(*pc_intr_string)(void *, pci_intr_handle_t);
65 1.2.2.2 skrll const struct evcnt *(*pc_intr_evcnt)(void *, pci_intr_handle_t);
66 1.2.2.2 skrll void *(*pc_intr_establish)(void *, pci_intr_handle_t,
67 1.2.2.2 skrll int, int (*)(void *), void *);
68 1.2.2.2 skrll void (*pc_intr_disestablish)(void *, void *);
69 1.2.2.2 skrll void (*pc_conf_interrupt)(void *, int, int, int, int, int *);
70 1.2.2.2 skrll void (*pc_decompose_tag)(void *, pcitag_t, int *,
71 1.2.2.2 skrll int *, int *);
72 1.2.2.2 skrll int (*pc_conf_hook)(void *, int, int, int, pcireg_t);
73 1.2.2.2 skrll };
74 1.2.2.2 skrll
75 1.2.2.2 skrll /*
76 1.2.2.2 skrll * Functions provided to machine-independent PCI code.
77 1.2.2.2 skrll */
78 1.2.2.2 skrll #define pci_attach_hook(p, s, pba) \
79 1.2.2.2 skrll (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba))
80 1.2.2.2 skrll #define pci_bus_maxdevs(c, b) \
81 1.2.2.2 skrll (*(c)->pc_bus_maxdevs)((c)->pc_conf_v, (b))
82 1.2.2.2 skrll #define pci_make_tag(c, b, d, f) \
83 1.2.2.2 skrll (*(c)->pc_make_tag)((c)->pc_conf_v, (b), (d), (f))
84 1.2.2.2 skrll #define pci_conf_read(c, t, r) \
85 1.2.2.2 skrll (*(c)->pc_conf_read)((c)->pc_conf_v, (t), (r))
86 1.2.2.2 skrll #define pci_conf_write(c, t, r, v) \
87 1.2.2.2 skrll (*(c)->pc_conf_write)((c)->pc_conf_v, (t), (r), (v))
88 1.2.2.2 skrll #define pci_intr_map(pa, ihp) \
89 1.2.2.2 skrll (*(pa)->pa_pc->pc_intr_map)((pa), (ihp))
90 1.2.2.2 skrll #define pci_intr_string(c, ih) \
91 1.2.2.2 skrll (*(c)->pc_intr_string)((c)->pc_intr_v, (ih))
92 1.2.2.2 skrll #define pci_intr_evcnt(c, ih) \
93 1.2.2.2 skrll (*(c)->pc_intr_evcnt)((c)->pc_intr_v, (ih))
94 1.2.2.2 skrll #define pci_intr_establish(c, ih, l, h, a) \
95 1.2.2.2 skrll (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a))
96 1.2.2.2 skrll #define pci_intr_disestablish(c, iv) \
97 1.2.2.2 skrll (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv))
98 1.2.2.2 skrll #define pci_conf_interrupt(c, b, d, p, s, ip) \
99 1.2.2.2 skrll (*(c)->pc_conf_interrupt)((c)->pc_conf_v, (b), (d), (p), (s), (ip))
100 1.2.2.2 skrll #define pci_decompose_tag(c, t, bp, dp, fp) \
101 1.2.2.2 skrll (*(c)->pc_decompose_tag)((c)->pc_conf_v, (t), (bp), (dp), (fp))
102 1.2.2.2 skrll #define pci_conf_hook(c, b, d, f, i) \
103 1.2.2.2 skrll (*(c)->pc_conf_hook)((c)->pc_conf_v, (b), (d), (f), (i))
104 1.2.2.2 skrll
105 1.2.2.2 skrll #ifdef _KERNEL
106 1.2.2.2 skrll /*
107 1.2.2.2 skrll * ibmnws-specific PCI functions.
108 1.2.2.2 skrll * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
109 1.2.2.2 skrll */
110 1.2.2.2 skrll int ibmnws_pci_bus_maxdevs(void *, int);
111 1.2.2.2 skrll int ibmnws_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
112 1.2.2.2 skrll const char *ibmnws_pci_intr_string(void *, pci_intr_handle_t);
113 1.2.2.2 skrll const struct evcnt *ibmnws_pci_intr_evcnt(void *, pci_intr_handle_t);
114 1.2.2.2 skrll void *ibmnws_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *),
115 1.2.2.2 skrll void *);
116 1.2.2.2 skrll void ibmnws_pci_intr_disestablish(void *, void *);
117 1.2.2.2 skrll void ibmnws_pci_conf_interrupt(void *, int, int, int, int, int *);
118 1.2.2.2 skrll int ibmnws_pci_conf_hook(void *, int, int, int, pcireg_t);
119 1.2.2.2 skrll
120 1.2.2.2 skrll void ibmnws_pci_get_chipset_tag_direct(pci_chipset_tag_t);
121 1.2.2.2 skrll void ibmnws_pci_get_chipset_tag_indirect(pci_chipset_tag_t);
122 1.2.2.2 skrll
123 1.2.2.2 skrll /*
124 1.2.2.2 skrll * ibmnws-specific PCI data.
125 1.2.2.2 skrll * NOT TO BE USED DIRECTLY BY MACHINE INDEPENDENT CODE.
126 1.2.2.2 skrll */
127 1.2.2.2 skrll extern struct powerpc_bus_dma_tag pci_bus_dma_tag;
128 1.2.2.2 skrll #endif
129