Lines Matching defs:virtfn
17 #define VIRTFN_ID_LEN 17 /* "virtfn%u\0" for 2^32 - 1 */
156 static void pci_read_vf_config_common(struct pci_dev *virtfn)
158 struct pci_dev *physfn = virtfn->physfn;
169 pci_read_config_dword(virtfn, PCI_CLASS_REVISION,
171 pci_read_config_byte(virtfn, PCI_HEADER_TYPE,
173 pci_read_config_word(virtfn, PCI_SUBSYSTEM_VENDOR_ID,
175 pci_read_config_word(virtfn, PCI_SUBSYSTEM_ID,
180 struct pci_dev *virtfn, int id)
185 sprintf(buf, "virtfn%u", id);
186 rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
189 rc = sysfs_create_link(&virtfn->dev.kobj, &dev->dev.kobj, "physfn");
193 kobject_uevent(&virtfn->dev.kobj, KOBJ_CHANGE);
293 struct pci_dev *virtfn;
302 virtfn = pci_alloc_dev(bus);
303 if (!virtfn)
306 virtfn->devfn = pci_iov_virtfn_devfn(dev, id);
307 virtfn->vendor = dev->vendor;
308 virtfn->device = iov->vf_device;
309 virtfn->is_virtfn = 1;
310 virtfn->physfn = pci_dev_get(dev);
311 virtfn->no_command_memory = 1;
314 pci_read_vf_config_common(virtfn);
316 rc = pci_setup_device(virtfn);
320 virtfn->dev.parent = dev->dev.parent;
321 virtfn->multifunction = 0;
327 virtfn->resource[i].name = pci_name(virtfn);
328 virtfn->resource[i].flags = res->flags;
330 virtfn->resource[i].start = res->start + size * id;
331 virtfn->resource[i].end = virtfn->resource[i].start + size - 1;
332 rc = request_resource(res, &virtfn->resource[i]);
336 pci_device_add(virtfn, virtfn->bus);
337 rc = pci_iov_sysfs_link(dev, virtfn, id);
341 pci_bus_add_device(virtfn);
346 pci_stop_and_remove_bus_device(virtfn);
358 struct pci_dev *virtfn;
360 virtfn = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus),
363 if (!virtfn)
366 sprintf(buf, "virtfn%u", id);
369 * pci_stop_dev() could have been called for this virtfn already,
370 * so the directory for the virtfn may have been removed before.
373 if (virtfn->dev.kobj.sd)
374 sysfs_remove_link(&virtfn->dev.kobj, "physfn");
376 pci_stop_and_remove_bus_device(virtfn);
377 virtfn_remove_bus(dev->bus, virtfn->bus);
380 pci_dev_put(virtfn);