diff options
Diffstat (limited to 'drivers/pci')
| -rw-r--r-- | drivers/pci/msi.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index b0cc82123cc7..ce08d0bffe08 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
| @@ -447,6 +447,24 @@ static void __iomem *msix_map_region(struct pci_dev *dev, unsigned pos, | |||
| 447 | return ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); | 447 | return ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE); |
| 448 | } | 448 | } |
| 449 | 449 | ||
| 450 | static void msix_program_entries(struct pci_dev *dev, | ||
| 451 | struct msix_entry *entries) | ||
| 452 | { | ||
| 453 | struct msi_desc *entry; | ||
| 454 | int i = 0; | ||
| 455 | |||
| 456 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
| 457 | int offset = entries[i].entry * PCI_MSIX_ENTRY_SIZE + | ||
| 458 | PCI_MSIX_ENTRY_VECTOR_CTRL; | ||
| 459 | |||
| 460 | entries[i].vector = entry->irq; | ||
| 461 | set_irq_msi(entry->irq, entry); | ||
| 462 | entry->masked = readl(entry->mask_base + offset); | ||
| 463 | msix_mask_irq(entry, 1); | ||
| 464 | i++; | ||
| 465 | } | ||
| 466 | } | ||
| 467 | |||
| 450 | /** | 468 | /** |
| 451 | * msix_capability_init - configure device's MSI-X capability | 469 | * msix_capability_init - configure device's MSI-X capability |
| 452 | * @dev: pointer to the pci_dev data structure of MSI-X device function | 470 | * @dev: pointer to the pci_dev data structure of MSI-X device function |
| @@ -511,16 +529,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
| 511 | control |= PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE; | 529 | control |= PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE; |
| 512 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | 530 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); |
| 513 | 531 | ||
| 514 | i = 0; | 532 | msix_program_entries(dev, entries); |
| 515 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
| 516 | entries[i].vector = entry->irq; | ||
| 517 | set_irq_msi(entry->irq, entry); | ||
| 518 | j = entries[i].entry; | ||
| 519 | entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE + | ||
| 520 | PCI_MSIX_ENTRY_VECTOR_CTRL); | ||
| 521 | msix_mask_irq(entry, 1); | ||
| 522 | i++; | ||
| 523 | } | ||
| 524 | 533 | ||
| 525 | /* Set MSI-X enabled bits and unmask the function */ | 534 | /* Set MSI-X enabled bits and unmask the function */ |
| 526 | pci_intx_for_msi(dev, 0); | 535 | pci_intx_for_msi(dev, 0); |
