Lines Matching refs:dev

18  * @dev: the PCI device to operate on
22 * Linux IRQ will be saved at @dev->irq. The driver must invoke
30 int pci_enable_msi(struct pci_dev *dev)
32 int rc = __pci_enable_msi_range(dev, 1, 1, NULL);
41 * @dev: the PCI device to operate on
45 * The PCI device Linux IRQ (@dev->irq) is restored to its default
51 void pci_disable_msi(struct pci_dev *dev)
53 if (!pci_msi_enabled() || !dev || !dev->msi_enabled)
56 msi_lock_descs(&dev->dev);
57 pci_msi_shutdown(dev);
58 pci_free_msi_irqs(dev);
59 msi_unlock_descs(&dev->dev);
65 * @dev: the PCI device to operate on
71 int pci_msix_vec_count(struct pci_dev *dev)
75 if (!dev->msix_cap)
78 pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control);
85 * @dev: the PCI device to operate on
108 int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries,
111 return __pci_enable_msix_range(dev, entries, minvec, maxvec, NULL, 0);
119 * @dev: PCI device to operate on
123 bool pci_msix_can_alloc_dyn(struct pci_dev *dev)
125 if (!dev->msix_cap)
128 return pci_msi_domain_supports(dev, MSI_FLAG_PCI_MSIX_ALLOC_DYN, DENY_LEGACY);
136 * @dev: PCI device to operate on
149 struct msi_map pci_msix_alloc_irq_at(struct pci_dev *dev, unsigned int index,
154 if (!dev->msix_enabled)
157 if (!pci_msix_can_alloc_dyn(dev))
160 return msi_domain_alloc_irq_at(&dev->dev, MSI_DEFAULT_DOMAIN, index, affdesc, NULL);
167 * @dev: The PCI device to operate on
172 void pci_msix_free_irq(struct pci_dev *dev, struct msi_map map)
176 if (WARN_ON_ONCE(!pci_msix_can_alloc_dyn(dev)))
178 msi_domain_free_irqs_range(&dev->dev, MSI_DEFAULT_DOMAIN, map.index, map.index);
184 * @dev: the PCI device to operate on
188 * The PCI device Linux IRQ (@dev->irq) is restored to its default pin
194 void pci_disable_msix(struct pci_dev *dev)
196 if (!pci_msi_enabled() || !dev || !dev->msix_enabled)
199 msi_lock_descs(&dev->dev);
200 pci_msix_shutdown(dev);
201 pci_free_msi_irqs(dev);
202 msi_unlock_descs(&dev->dev);
208 * @dev: the PCI device to operate on
234 int pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
237 return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs,
245 * @dev: the PCI device to operate on
254 int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
270 nvecs = __pci_enable_msix_range(dev, NULL, min_vecs, max_vecs,
277 nvecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, affd);
284 if (min_vecs == 1 && dev->irq) {
292 pci_intx(dev, 1);
303 * @dev: the PCI device to operate on
313 int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
317 if (!dev->msi_enabled && !dev->msix_enabled)
318 return !nr ? dev->irq : -EINVAL;
320 irq = msi_get_virq(&dev->dev, nr);
327 * @dev: the PCI device to operate on
342 const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
344 int idx, irq = pci_irq_vector(dev, nr);
363 idx = dev->msi_enabled ? nr : 0;
370 * @dev: The PCI device to operate on
395 struct msi_map pci_ims_alloc_irq(struct pci_dev *dev, union msi_instance_cookie *icookie,
398 return msi_domain_alloc_irq_at(&dev->dev, MSI_SECONDARY_DOMAIN, MSI_ANY_INDEX,
406 * @dev: The PCI device to operate on
410 void pci_ims_free_irq(struct pci_dev *dev, struct msi_map map)
414 msi_domain_free_irqs_range(&dev->dev, MSI_SECONDARY_DOMAIN, map.index, map.index);
420 * @dev: the PCI device to operate on
426 void pci_free_irq_vectors(struct pci_dev *dev)
428 pci_disable_msix(dev);
429 pci_disable_msi(dev);
435 * @dev: the PCI device to operate on
441 void pci_restore_msi_state(struct pci_dev *dev)
443 __pci_restore_msi_state(dev);
444 __pci_restore_msix_state(dev);