This source file includes following definitions.
- epf_set_drvdata
- epf_get_drvdata
1
2
3
4
5
6
7
8
9 #ifndef __LINUX_PCI_EPF_H
10 #define __LINUX_PCI_EPF_H
11
12 #include <linux/device.h>
13 #include <linux/mod_devicetable.h>
14 #include <linux/pci.h>
15
16 struct pci_epf;
17
18 enum pci_barno {
19 BAR_0,
20 BAR_1,
21 BAR_2,
22 BAR_3,
23 BAR_4,
24 BAR_5,
25 };
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 struct pci_epf_header {
41 u16 vendorid;
42 u16 deviceid;
43 u8 revid;
44 u8 progif_code;
45 u8 subclass_code;
46 u8 baseclass_code;
47 u8 cache_line_size;
48 u16 subsys_vendor_id;
49 u16 subsys_id;
50 enum pci_interrupt_pin interrupt_pin;
51 };
52
53
54
55
56
57
58
59
60
61 struct pci_epf_ops {
62 int (*bind)(struct pci_epf *epf);
63 void (*unbind)(struct pci_epf *epf);
64 void (*linkup)(struct pci_epf *epf);
65 };
66
67
68
69
70
71
72
73
74
75
76
77
78 struct pci_epf_driver {
79 int (*probe)(struct pci_epf *epf);
80 int (*remove)(struct pci_epf *epf);
81
82 struct device_driver driver;
83 struct pci_epf_ops *ops;
84 struct module *owner;
85 struct list_head epf_group;
86 const struct pci_epf_device_id *id_table;
87 };
88
89 #define to_pci_epf_driver(drv) (container_of((drv), struct pci_epf_driver, \
90 driver))
91
92
93
94
95
96
97 struct pci_epf_bar {
98 dma_addr_t phys_addr;
99 size_t size;
100 enum pci_barno barno;
101 int flags;
102 };
103
104
105
106
107
108
109
110
111
112
113
114
115
116 struct pci_epf {
117 struct device dev;
118 const char *name;
119 struct pci_epf_header *header;
120 struct pci_epf_bar bar[6];
121 u8 msi_interrupts;
122 u16 msix_interrupts;
123 u8 func_no;
124
125 struct pci_epc *epc;
126 struct pci_epf_driver *driver;
127 struct list_head list;
128 };
129
130 #define to_pci_epf(epf_dev) container_of((epf_dev), struct pci_epf, dev)
131
132 #define pci_epf_register_driver(driver) \
133 __pci_epf_register_driver((driver), THIS_MODULE)
134
135 static inline void epf_set_drvdata(struct pci_epf *epf, void *data)
136 {
137 dev_set_drvdata(&epf->dev, data);
138 }
139
140 static inline void *epf_get_drvdata(struct pci_epf *epf)
141 {
142 return dev_get_drvdata(&epf->dev);
143 }
144
145 const struct pci_epf_device_id *
146 pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf);
147 struct pci_epf *pci_epf_create(const char *name);
148 void pci_epf_destroy(struct pci_epf *epf);
149 int __pci_epf_register_driver(struct pci_epf_driver *driver,
150 struct module *owner);
151 void pci_epf_unregister_driver(struct pci_epf_driver *driver);
152 void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
153 size_t align);
154 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar);
155 int pci_epf_bind(struct pci_epf *epf);
156 void pci_epf_unbind(struct pci_epf *epf);
157 void pci_epf_linkup(struct pci_epf *epf);
158 #endif