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: releng/11.2/sys/dev/pci/pci_if.m 331111 2018-03-17 20:20:29Z bryanv $
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 static int
56 compat_iov_attach(device_t bus, device_t dev, struct nvlist *pf_schema,
57 struct nvlist *vf_schema)
58 {
59 return (PCI_IOV_ATTACH_NAME(bus, dev, pf_schema, vf_schema,
60 device_get_nameunit(dev)));
61 }
62 };
63
64 HEADER {
65 struct nvlist;
66
67 enum pci_id_type {
68 PCI_ID_RID,
69 PCI_ID_MSI,
70 };
71 }
72
73
74 METHOD u_int32_t read_config {
75 device_t dev;
76 device_t child;
77 int reg;
78 int width;
79 };
80
81 METHOD void write_config {
82 device_t dev;
83 device_t child;
84 int reg;
85 u_int32_t val;
86 int width;
87 };
88
89 METHOD int get_powerstate {
90 device_t dev;
91 device_t child;
92 };
93
94 METHOD int set_powerstate {
95 device_t dev;
96 device_t child;
97 int state;
98 };
99
100 METHOD int get_vpd_ident {
101 device_t dev;
102 device_t child;
103 const char **identptr;
104 };
105
106 METHOD int get_vpd_readonly {
107 device_t dev;
108 device_t child;
109 const char *kw;
110 const char **vptr;
111 };
112
113 METHOD int enable_busmaster {
114 device_t dev;
115 device_t child;
116 };
117
118 METHOD int disable_busmaster {
119 device_t dev;
120 device_t child;
121 };
122
123 METHOD int enable_io {
124 device_t dev;
125 device_t child;
126 int space;
127 };
128
129 METHOD int disable_io {
130 device_t dev;
131 device_t child;
132 int space;
133 };
134
135 METHOD int assign_interrupt {
136 device_t dev;
137 device_t child;
138 };
139
140 METHOD int find_cap {
141 device_t dev;
142 device_t child;
143 int capability;
144 int *capreg;
145 };
146
147 METHOD int find_next_cap {
148 device_t dev;
149 device_t child;
150 int capability;
151 int start;
152 int *capreg;
153 };
154
155 METHOD int find_extcap {
156 device_t dev;
157 device_t child;
158 int capability;
159 int *capreg;
160 };
161
162 METHOD int find_next_extcap {
163 device_t dev;
164 device_t child;
165 int capability;
166 int start;
167 int *capreg;
168 };
169
170 METHOD int find_htcap {
171 device_t dev;
172 device_t child;
173 int capability;
174 int *capreg;
175 };
176
177 METHOD int find_next_htcap {
178 device_t dev;
179 device_t child;
180 int capability;
181 int start;
182 int *capreg;
183 };
184
185 METHOD int alloc_msi {
186 device_t dev;
187 device_t child;
188 int *count;
189 };
190
191 METHOD int alloc_msix {
192 device_t dev;
193 device_t child;
194 int *count;
195 };
196
197 METHOD void enable_msi {
198 device_t dev;
199 device_t child;
200 uint64_t address;
201 uint16_t data;
202 };
203
204 METHOD void enable_msix {
205 device_t dev;
206 device_t child;
207 u_int index;
208 uint64_t address;
209 uint32_t data;
210 };
211
212 METHOD void disable_msi {
213 device_t dev;
214 device_t child;
215 };
216
217 METHOD int remap_msix {
218 device_t dev;
219 device_t child;
220 int count;
221 const u_int *vectors;
222 };
223
224 METHOD int release_msi {
225 device_t dev;
226 device_t child;
227 };
228
229 METHOD int msi_count {
230 device_t dev;
231 device_t child;
232 } DEFAULT null_msi_count;
233
234 METHOD int msix_count {
235 device_t dev;
236 device_t child;
237 } DEFAULT null_msi_count;
238
239 METHOD int msix_pba_bar {
240 device_t dev;
241 device_t child;
242 } DEFAULT null_msix_bar;
243
244 METHOD int msix_table_bar {
245 device_t dev;
246 device_t child;
247 } DEFAULT null_msix_bar;
248
249 METHOD int get_id {
250 device_t dev;
251 device_t child;
252 enum pci_id_type type;
253 uintptr_t *id;
254 };
255
256 METHOD struct pci_devinfo * alloc_devinfo {
257 device_t dev;
258 };
259
260 METHOD void child_added {
261 device_t dev;
262 device_t child;
263 };
264
265 METHOD int iov_attach {
266 device_t dev;
267 device_t child;
268 struct nvlist *pf_schema;
269 struct nvlist *vf_schema;
270 } DEFAULT compat_iov_attach;
271
272 METHOD int iov_attach_name {
273 device_t dev;
274 device_t child;
275 struct nvlist *pf_schema;
276 struct nvlist *vf_schema;
277 const char *name;
278 };
279
280 METHOD int iov_detach {
281 device_t dev;
282 device_t child;
283 };
284
285 METHOD device_t create_iov_child {
286 device_t bus;
287 device_t pf;
288 uint16_t rid;
289 uint16_t vid;
290 uint16_t did;
291 } DEFAULT null_create_iov_child;
Cache object: 7b2c7100ab26699a2799412cfd6a7568
|