]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/pci/pci_if.m
Import to 0.6.1
[FreeBSD/FreeBSD.git] / 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
31 INTERFACE pci;
32
33 CODE {
34         static int
35         null_msi_count(device_t dev, device_t child)
36         {
37                 return (0);
38         }
39
40         static int
41         null_msix_bar(device_t dev, device_t child)
42         {
43                 return (-1);
44         }
45
46         static device_t
47         null_create_iov_child(device_t bus, device_t pf, uint16_t rid,
48             uint16_t vid, uint16_t did)
49         {
50                 device_printf(bus, "PCI_IOV not implemented on this bus.\n");
51                 return (NULL);
52         }
53 };
54
55 HEADER {
56         struct nvlist;
57 }
58
59
60 METHOD u_int32_t read_config {
61         device_t        dev;
62         device_t        child;
63         int             reg;
64         int             width;
65 };
66
67 METHOD void write_config {
68         device_t        dev;
69         device_t        child;
70         int             reg;
71         u_int32_t       val;
72         int             width;
73 };
74
75 METHOD int get_powerstate {
76         device_t        dev;
77         device_t        child;
78 };
79
80 METHOD int set_powerstate {
81         device_t        dev;
82         device_t        child;
83         int             state;
84 };
85
86 METHOD int get_vpd_ident {
87         device_t        dev;
88         device_t        child;
89         const char      **identptr;
90 };
91
92 METHOD int get_vpd_readonly {
93         device_t        dev;
94         device_t        child;
95         const char      *kw;
96         const char      **vptr;
97 };
98
99 METHOD int enable_busmaster {
100         device_t        dev;
101         device_t        child;
102 };
103
104 METHOD int disable_busmaster {
105         device_t        dev;
106         device_t        child;
107 };
108
109 METHOD int enable_io {
110         device_t        dev;
111         device_t        child;
112         int             space;
113 };
114
115 METHOD int disable_io {
116         device_t        dev;
117         device_t        child;
118         int             space;
119 };
120
121 METHOD int assign_interrupt {
122         device_t        dev;
123         device_t        child;
124 };
125
126 METHOD int find_cap {
127         device_t        dev;
128         device_t        child;
129         int             capability;
130         int             *capreg;
131 };
132
133 METHOD int find_extcap {
134         device_t        dev;
135         device_t        child;
136         int             capability;
137         int             *capreg;
138 };
139
140 METHOD int find_htcap {
141         device_t        dev;
142         device_t        child;
143         int             capability;
144         int             *capreg;
145 };
146
147 METHOD int alloc_msi {
148         device_t        dev;
149         device_t        child;
150         int             *count;
151 };
152
153 METHOD int alloc_msix {
154         device_t        dev;
155         device_t        child;
156         int             *count;
157 };
158
159 METHOD void enable_msi {
160         device_t        dev;
161         device_t        child;
162         uint64_t        address;
163         uint16_t        data;
164 };
165
166 METHOD void enable_msix {
167         device_t        dev;
168         device_t        child;
169         u_int           index;
170         uint64_t        address;
171         uint32_t        data;
172 };
173
174 METHOD void disable_msi {
175         device_t        dev;
176         device_t        child;
177 };
178
179 METHOD int remap_msix {
180         device_t        dev;
181         device_t        child;
182         int             count;
183         const u_int     *vectors;
184 };
185
186 METHOD int release_msi {
187         device_t        dev;
188         device_t        child;
189 };
190
191 METHOD int msi_count {
192         device_t        dev;
193         device_t        child;
194 } DEFAULT null_msi_count;
195
196 METHOD int msix_count {
197         device_t        dev;
198         device_t        child;
199 } DEFAULT null_msi_count;
200
201 METHOD int msix_pba_bar {
202         device_t        dev;
203         device_t        child;
204 } DEFAULT null_msix_bar;
205
206 METHOD int msix_table_bar {
207         device_t        dev;
208         device_t        child;
209 } DEFAULT null_msix_bar;
210
211 METHOD uint16_t get_rid {
212         device_t        dev;
213         device_t        child;
214 };
215
216 METHOD struct pci_devinfo * alloc_devinfo {
217         device_t        dev;
218 };
219
220 METHOD void child_added {
221         device_t        dev;
222         device_t        child;
223 };
224
225 METHOD int iov_attach {
226         device_t        dev;
227         device_t        child;
228         struct nvlist   *pf_schema;
229         struct nvlist   *vf_schema;
230 };
231
232 METHOD int iov_detach {
233         device_t        dev;
234         device_t        child;
235 };
236
237 METHOD device_t create_iov_child {
238         device_t bus;
239         device_t pf;
240         uint16_t rid;
241         uint16_t vid;
242         uint16_t did;
243 } DEFAULT null_create_iov_child;