Lines Matching refs:dev
126 struct pci_dev *dev;
301 static int vmd_msi_prepare(struct irq_domain *domain, struct device *dev,
304 struct pci_dev *pdev = to_pci_dev(dev);
338 pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG, ®);
341 pci_write_config_word(vmd->dev, PCI_REG_VMCONFIG, reg);
384 if (offset + len >= resource_size(&vmd->dev->resource[VMD_CFGBAR]))
487 dev_dbg(&pci_dev->dev, "Looking for ACPI companion (address 0x%x)\n",
490 return acpi_find_child_device(ACPI_COMPANION(bridge->dev.parent), addr,
520 u8 dev, functions, fn, hdr_type;
524 for (dev = 0; dev < 32; dev++) {
526 PCI_DEVFN(dev, 0), 0);
533 PCI_DEVFN(dev, fn), 0);
567 vmd->dev->resource[VMD_MEMBAR1].child = &vmd->resources[1];
568 vmd->dev->resource[VMD_MEMBAR2].child = &vmd->resources[2];
573 vmd->dev->resource[VMD_MEMBAR1].child = NULL;
574 vmd->dev->resource[VMD_MEMBAR2].child = NULL;
597 struct pci_dev *dev = vmd->dev;
604 ret = pci_read_config_dword(dev, PCI_REG_VMLOCK, &vmlock);
611 membar2 = pci_iomap(dev, VMD_MEMBAR2, 0);
616 pci_iounmap(dev, membar2);
621 int pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
624 pci_read_config_dword(dev, pos + 4, ®);
628 pci_read_config_dword(dev, pos + 8, ®);
629 pci_read_config_dword(dev, pos + 12, ®u);
632 pci_read_config_dword(dev, pos + 16, ®);
633 pci_read_config_dword(dev, pos + 20, ®u);
639 *offset1 = dev->resource[VMD_MEMBAR1].start -
641 *offset2 = dev->resource[VMD_MEMBAR2].start -
649 struct pci_dev *dev = vmd->dev;
652 pci_read_config_word(dev, PCI_REG_VMCAP, ®);
654 pci_read_config_word(dev, PCI_REG_VMCONFIG, ®);
667 pci_err(dev, "Unknown Bus Offset Setting (%d)\n",
692 struct pci_dev *dev = vmd->dev;
695 vmd->msix_count = pci_msix_vec_count(dev);
699 vmd->msix_count = pci_alloc_irq_vectors(dev, vmd->first_vec + 1,
704 vmd->irqs = devm_kcalloc(&dev->dev, vmd->msix_count, sizeof(*vmd->irqs),
715 vmd->irqs[i].virq = pci_irq_vector(dev, i);
716 err = devm_request_irq(&dev->dev, vmd->irqs[i].virq,
791 struct pci_dev *dev;
821 res = &vmd->dev->resource[VMD_CFGBAR];
846 res = &vmd->dev->resource[VMD_MEMBAR1];
859 res = &vmd->dev->resource[VMD_MEMBAR2];
872 sd->vmd_dev = vmd->dev;
877 sd->node = pcibus_to_node(vmd->dev->bus);
910 vmd->bus = pci_create_root_bus(&vmd->dev->dev, vmd->busn_start,
918 vmd_copy_host_bridge_flags(pci_find_host_bridge(vmd->dev->bus),
923 dev_set_msi_domain(&vmd->bus->dev, vmd->irq_domain);
925 dev_set_msi_domain(&vmd->bus->dev,
926 dev_get_msi_domain(&vmd->dev->dev));
942 dev = list_first_entry(&child->devices,
944 ret = pci_reset_bus(dev);
946 pci_warn(dev, "can't reset device: %d\n", ret);
968 WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj,
973 static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
979 if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20))
982 vmd = devm_kzalloc(&dev->dev, sizeof(*vmd), GFP_KERNEL);
986 vmd->dev = dev;
991 vmd->name = devm_kasprintf(&dev->dev, GFP_KERNEL, "vmd%d",
998 err = pcim_enable_device(dev);
1002 vmd->cfgbar = pcim_iomap(dev, VMD_CFGBAR, 0);
1008 pci_set_master(dev);
1009 if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) &&
1010 dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
1019 pci_set_drvdata(dev, vmd);
1024 dev_info(&vmd->dev->dev, "Bound to PCI domain %04x\n",
1041 static void vmd_remove(struct pci_dev *dev)
1043 struct vmd_dev *vmd = pci_get_drvdata(dev);
1045 sysfs_remove_link(&vmd->dev->dev.kobj, "domain");
1054 static void vmd_shutdown(struct pci_dev *dev)
1056 struct vmd_dev *vmd = pci_get_drvdata(dev);
1062 static int vmd_suspend(struct device *dev)
1064 struct pci_dev *pdev = to_pci_dev(dev);
1069 devm_free_irq(dev, vmd->irqs[i].virq, &vmd->irqs[i]);
1074 static int vmd_resume(struct device *dev)
1076 struct pci_dev *pdev = to_pci_dev(dev);
1086 err = devm_request_irq(dev, vmd->irqs[i].virq,