Lines Matching refs:d
27 struct pci_dev *d = pci_malloc(a, sizeof(struct pci_dev)); in pci_alloc_dev() local
29 memset(d, 0, sizeof(*d)); in pci_alloc_dev()
30 d->access = a; in pci_alloc_dev()
31 d->methods = a->methods; in pci_alloc_dev()
32 d->hdrtype = -1; in pci_alloc_dev()
33 d->numa_node = -1; in pci_alloc_dev()
34 if (d->methods->init_dev) in pci_alloc_dev()
35 d->methods->init_dev(d); in pci_alloc_dev()
36 return d; in pci_alloc_dev()
40 pci_link_dev(struct pci_access *a, struct pci_dev *d) in pci_link_dev() argument
42 d->next = a->devices; in pci_link_dev()
43 a->devices = d; in pci_link_dev()
52 if (d->domain > 0xffff) in pci_link_dev()
53 d->domain_16 = 0xffff; in pci_link_dev()
55 d->domain_16 = d->domain; in pci_link_dev()
63 struct pci_dev *d = pci_alloc_dev(a); in pci_get_dev() local
65 d->domain = domain; in pci_get_dev()
66 d->bus = bus; in pci_get_dev()
67 d->dev = dev; in pci_get_dev()
68 d->func = func; in pci_get_dev()
69 return d; in pci_get_dev()
73 pci_free_properties(struct pci_dev *d) in pci_free_properties() argument
77 while (p = d->properties) in pci_free_properties()
79 d->properties = p->next; in pci_free_properties()
84 void pci_free_dev(struct pci_dev *d) in pci_free_dev() argument
86 if (d->methods->cleanup_dev) in pci_free_dev()
87 d->methods->cleanup_dev(d); in pci_free_dev()
89 pci_free_caps(d); in pci_free_dev()
90 pci_free_properties(d); in pci_free_dev()
91 pci_mfree(d); in pci_free_dev()
95 pci_read_data(struct pci_dev *d, void *buf, int pos, int len) in pci_read_data() argument
98 d->access->error("Unaligned read: pos=%02x, len=%d", pos, len); in pci_read_data()
99 if (pos + len <= d->cache_len) in pci_read_data()
100 memcpy(buf, d->cache + pos, len); in pci_read_data()
101 else if (!d->methods->read(d, pos, buf, len)) in pci_read_data()
106 pci_read_byte(struct pci_dev *d, int pos) in pci_read_byte() argument
109 pci_read_data(d, &buf, pos, 1); in pci_read_byte()
114 pci_read_word(struct pci_dev *d, int pos) in pci_read_word() argument
117 pci_read_data(d, &buf, pos, 2); in pci_read_word()
122 pci_read_long(struct pci_dev *d, int pos) in pci_read_long() argument
125 pci_read_data(d, &buf, pos, 4); in pci_read_long()
130 pci_read_block(struct pci_dev *d, int pos, byte *buf, int len) in pci_read_block() argument
132 return d->methods->read(d, pos, buf, len); in pci_read_block()
136 pci_read_vpd(struct pci_dev *d, int pos, byte *buf, int len) in pci_read_vpd() argument
138 return d->methods->read_vpd ? d->methods->read_vpd(d, pos, buf, len) : 0; in pci_read_vpd()
142 pci_write_data(struct pci_dev *d, void *buf, int pos, int len) in pci_write_data() argument
145 d->access->error("Unaligned write: pos=%02x,len=%d", pos, len); in pci_write_data()
146 if (pos + len <= d->cache_len) in pci_write_data()
147 memcpy(d->cache + pos, buf, len); in pci_write_data()
148 return d->methods->write(d, pos, buf, len); in pci_write_data()
152 pci_write_byte(struct pci_dev *d, int pos, byte data) in pci_write_byte() argument
154 return pci_write_data(d, &data, pos, 1); in pci_write_byte()
158 pci_write_word(struct pci_dev *d, int pos, word data) in pci_write_word() argument
161 return pci_write_data(d, &buf, pos, 2); in pci_write_word()
165 pci_write_long(struct pci_dev *d, int pos, u32 data) in pci_write_long() argument
168 return pci_write_data(d, &buf, pos, 4); in pci_write_long()
172 pci_write_block(struct pci_dev *d, int pos, byte *buf, int len) in pci_write_block() argument
174 if (pos < d->cache_len) in pci_write_block()
176 int l = (pos + len >= d->cache_len) ? (d->cache_len - pos) : len; in pci_write_block()
177 memcpy(d->cache + pos, buf, l); in pci_write_block()
179 return d->methods->write(d, pos, buf, len); in pci_write_block()
183 pci_reset_properties(struct pci_dev *d) in pci_reset_properties() argument
185 d->known_fields = 0; in pci_reset_properties()
186 d->phy_slot = NULL; in pci_reset_properties()
187 d->module_alias = NULL; in pci_reset_properties()
188 d->label = NULL; in pci_reset_properties()
189 pci_free_caps(d); in pci_reset_properties()
190 pci_free_properties(d); in pci_reset_properties()
194 pci_fill_info_v313(struct pci_dev *d, int flags) in pci_fill_info_v313() argument
200 pci_reset_properties(d); in pci_fill_info_v313()
202 if (uflags & ~d->known_fields) in pci_fill_info_v313()
203 d->methods->fill_info(d, uflags); in pci_fill_info_v313()
204 return d->known_fields; in pci_fill_info_v313()
209 STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v313(d, flags));
210 DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v313);
211 DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v313);
212 DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v313);
213 DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v313);
214 DEFINE_ALIAS(int pci_fill_info_v34(struct pci_dev *d, int flags), pci_fill_info_v313);
215 DEFINE_ALIAS(int pci_fill_info_v35(struct pci_dev *d, int flags), pci_fill_info_v313);
216 DEFINE_ALIAS(int pci_fill_info_v38(struct pci_dev *d, int flags), pci_fill_info_v313);
227 pci_setup_cache(struct pci_dev *d, byte *cache, int len) in pci_setup_cache() argument
229 d->cache = cache; in pci_setup_cache()
230 d->cache_len = len; in pci_setup_cache()
234 pci_set_property(struct pci_dev *d, u32 key, char *value) in pci_set_property() argument
237 struct pci_property **pp = &d->properties; in pci_set_property()
253 p = pci_malloc(d->access, sizeof(*p) + strlen(value)); in pci_set_property()
263 pci_get_string_property(struct pci_dev *d, u32 prop) in pci_get_string_property() argument
267 for (p = d->properties; p; p = p->next) in pci_get_string_property()