Lines Matching refs:virtfn

156 static void pci_read_vf_config_common(struct pci_dev *virtfn)  in pci_read_vf_config_common()  argument
158 struct pci_dev *physfn = virtfn->physfn; in pci_read_vf_config_common()
169 pci_read_config_dword(virtfn, PCI_CLASS_REVISION, in pci_read_vf_config_common()
171 pci_read_config_byte(virtfn, PCI_HEADER_TYPE, in pci_read_vf_config_common()
173 pci_read_config_word(virtfn, PCI_SUBSYSTEM_VENDOR_ID, in pci_read_vf_config_common()
175 pci_read_config_word(virtfn, PCI_SUBSYSTEM_ID, in pci_read_vf_config_common()
180 struct pci_dev *virtfn, int id) in pci_iov_sysfs_link() argument
186 rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf); in pci_iov_sysfs_link()
189 rc = sysfs_create_link(&virtfn->dev.kobj, &dev->dev.kobj, "physfn"); in pci_iov_sysfs_link()
193 kobject_uevent(&virtfn->dev.kobj, KOBJ_CHANGE); in pci_iov_sysfs_link()
293 struct pci_dev *virtfn; in pci_iov_add_virtfn() local
302 virtfn = pci_alloc_dev(bus); in pci_iov_add_virtfn()
303 if (!virtfn) in pci_iov_add_virtfn()
306 virtfn->devfn = pci_iov_virtfn_devfn(dev, id); in pci_iov_add_virtfn()
307 virtfn->vendor = dev->vendor; in pci_iov_add_virtfn()
308 virtfn->device = iov->vf_device; in pci_iov_add_virtfn()
309 virtfn->is_virtfn = 1; in pci_iov_add_virtfn()
310 virtfn->physfn = pci_dev_get(dev); in pci_iov_add_virtfn()
311 virtfn->no_command_memory = 1; in pci_iov_add_virtfn()
314 pci_read_vf_config_common(virtfn); in pci_iov_add_virtfn()
316 rc = pci_setup_device(virtfn); in pci_iov_add_virtfn()
320 virtfn->dev.parent = dev->dev.parent; in pci_iov_add_virtfn()
321 virtfn->multifunction = 0; in pci_iov_add_virtfn()
327 virtfn->resource[i].name = pci_name(virtfn); in pci_iov_add_virtfn()
328 virtfn->resource[i].flags = res->flags; in pci_iov_add_virtfn()
330 virtfn->resource[i].start = res->start + size * id; in pci_iov_add_virtfn()
331 virtfn->resource[i].end = virtfn->resource[i].start + size - 1; in pci_iov_add_virtfn()
332 rc = request_resource(res, &virtfn->resource[i]); in pci_iov_add_virtfn()
336 pci_device_add(virtfn, virtfn->bus); in pci_iov_add_virtfn()
337 rc = pci_iov_sysfs_link(dev, virtfn, id); in pci_iov_add_virtfn()
341 pci_bus_add_device(virtfn); in pci_iov_add_virtfn()
346 pci_stop_and_remove_bus_device(virtfn); in pci_iov_add_virtfn()
358 struct pci_dev *virtfn; in pci_iov_remove_virtfn() local
360 virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), in pci_iov_remove_virtfn()
363 if (!virtfn) in pci_iov_remove_virtfn()
373 if (virtfn->dev.kobj.sd) in pci_iov_remove_virtfn()
374 sysfs_remove_link(&virtfn->dev.kobj, "physfn"); in pci_iov_remove_virtfn()
376 pci_stop_and_remove_bus_device(virtfn); in pci_iov_remove_virtfn()
377 virtfn_remove_bus(dev->bus, virtfn->bus); in pci_iov_remove_virtfn()
380 pci_dev_put(virtfn); in pci_iov_remove_virtfn()