FreeBSD/Linux Kernel Cross Reference
sys/dev/pci/pci_if.m
1 #-
2 # Copyright (c) 1998 Doug Rabson
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
13 #
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 # SUCH DAMAGE.
25 #
26 # $FreeBSD$
27 #
28
29 #include <sys/bus.h>
30 #include <dev/pci/pcivar.h>
31
32 INTERFACE pci;
33
34 CODE {
35 static int
36 null_msi_count(device_t dev, device_t child)
37 {
38 return (0);
39 }
40
41 static int
42 null_msix_bar(device_t dev, device_t child)
43 {
44 return (-1);
45 }
46
47 static device_t
48 null_create_iov_child(device_t bus, device_t pf, uint16_t rid,
49 uint16_t vid, uint16_t did)
50 {
51 device_printf(bus, "PCI_IOV not implemented on this bus.\n");
52 return (NULL);
53 }
54 };
55
56 HEADER {
57 struct nvlist;
58
59 enum pci_id_type {
60 PCI_ID_RID,
61 PCI_ID_MSI,
62 PCI_ID_OFW_IOMMU,
63 };
64
65 enum pci_feature {
66 PCI_FEATURE_HP, /* Hot Plug feature */
67 PCI_FEATURE_AER, /* Advanced Error Reporting */
68 };
69 }
70
71
72 METHOD u_int32_t read_config {
73 device_t dev;
74 device_t child;
75 int reg;
76 int width;
77 };
78
79 METHOD void write_config {
80 device_t dev;
81 device_t child;
82 int reg;
83 u_int32_t val;
84 int width;
85 };
86
87 METHOD int get_powerstate {
88 device_t dev;
89 device_t child;
90 };
91
92 METHOD int set_powerstate {
93 device_t dev;
94 device_t child;
95 int state;
96 };
97
98 METHOD int get_vpd_ident {
99 device_t dev;
100 device_t child;
101 const char **identptr;
102 };
103
104 METHOD int get_vpd_readonly {
105 device_t dev;
106 device_t child;
107 const char *kw;
108 const char **vptr;
109 };
110
111 METHOD int enable_busmaster {
112 device_t dev;
113 device_t child;
114 };
115
116 METHOD int disable_busmaster {
117 device_t dev;
118 device_t child;
119 };
120
121 METHOD int enable_io {
122 device_t dev;
123 device_t child;
124 int space;
125 };
126
127 METHOD int disable_io {
128 device_t dev;
129 device_t child;
130 int space;
131 };
132
133 METHOD int assign_interrupt {
134 device_t dev;
135 device_t child;
136 };
137
138 METHOD int find_cap {
139 device_t dev;
140 device_t child;
141 int capability;
142 int *capreg;
143 };
144
145 METHOD int find_next_cap {
146 device_t dev;
147 device_t child;
148 int capability;
149 int start;
150 int *capreg;
151 };
152
153 METHOD int find_extcap {
154 device_t dev;
155 device_t child;
156 int capability;
157 int *capreg;
158 };
159
160 METHOD int find_next_extcap {
161 device_t dev;
162 device_t child;
163 int capability;
164 int start;
165 int *capreg;
166 };
167
168 METHOD int find_htcap {
169 device_t dev;
170 device_t child;
171 int capability;
172 int *capreg;
173 };
174
175 METHOD int find_next_htcap {
176 device_t dev;
177 device_t child;
178 int capability;
179 int start;
180 int *capreg;
181 };
182
183 METHOD int alloc_msi {
184 device_t dev;
185 device_t child;
186 int *count;
187 };
188
189 METHOD int alloc_msix {
190 device_t dev;
191 device_t child;
192 int *count;
193 };
194
195 METHOD void enable_msi {
196 device_t dev;
197 device_t child;
198 uint64_t address;
199 uint16_t data;
200 };
201
202 METHOD void enable_msix {
203 device_t dev;
204 device_t child;
205 u_int index;
206 uint64_t address;
207 uint32_t data;
208 };
209
210 METHOD void disable_msi {
211 device_t dev;
212 device_t child;
213 };
214
215 METHOD int remap_msix {
216 device_t dev;
217 device_t child;
218 int count;
219 const u_int *vectors;
220 };
221
222 METHOD int release_msi {
223 device_t dev;
224 device_t child;
225 };
226
227 METHOD int msi_count {
228 device_t dev;
229 device_t child;
230 } DEFAULT null_msi_count;
231
232 METHOD int msix_count {
233 device_t dev;
234 device_t child;
235 } DEFAULT null_msi_count;
236
237 METHOD int msix_pba_bar {
238 device_t dev;
239 device_t child;
240 } DEFAULT null_msix_bar;
241
242 METHOD int msix_table_bar {
243 device_t dev;
244 device_t child;
245 } DEFAULT null_msix_bar;
246
247 METHOD int get_id {
248 device_t dev;
249 device_t child;
250 enum pci_id_type type;
251 uintptr_t *id;
252 };
253
254 METHOD struct pci_devinfo * alloc_devinfo {
255 device_t dev;
256 };
257
258 METHOD void child_added {
259 device_t dev;
260 device_t child;
261 };
262
263 METHOD int iov_attach {
264 device_t dev;
265 device_t child;
266 struct nvlist *pf_schema;
267 struct nvlist *vf_schema;
268 const char *name;
269 };
270
271 METHOD int iov_detach {
272 device_t dev;
273 device_t child;
274 };
275
276 METHOD device_t create_iov_child {
277 device_t bus;
278 device_t pf;
279 uint16_t rid;
280 uint16_t vid;
281 uint16_t did;
282 } DEFAULT null_create_iov_child;
Cache object: 91a9052becf96afa558e763570454f48
|