diff options
Diffstat (limited to 'drivers/pci/msi.c')
-rw-r--r-- | drivers/pci/msi.c | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 07c9f09c856d..26938da8f438 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -25,6 +25,51 @@ | |||
25 | 25 | ||
26 | static int pci_msi_enable = 1; | 26 | static int pci_msi_enable = 1; |
27 | 27 | ||
28 | /* Arch hooks */ | ||
29 | |||
30 | int __attribute__ ((weak)) | ||
31 | arch_msi_check_device(struct pci_dev *dev, int nvec, int type) | ||
32 | { | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | int __attribute__ ((weak)) | ||
37 | arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry) | ||
38 | { | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | int __attribute__ ((weak)) | ||
43 | arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
44 | { | ||
45 | struct msi_desc *entry; | ||
46 | int ret; | ||
47 | |||
48 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
49 | ret = arch_setup_msi_irq(dev, entry); | ||
50 | if (ret) | ||
51 | return ret; | ||
52 | } | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq) | ||
58 | { | ||
59 | return; | ||
60 | } | ||
61 | |||
62 | void __attribute__ ((weak)) | ||
63 | arch_teardown_msi_irqs(struct pci_dev *dev) | ||
64 | { | ||
65 | struct msi_desc *entry; | ||
66 | |||
67 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
68 | if (entry->irq != 0) | ||
69 | arch_teardown_msi_irq(entry->irq); | ||
70 | } | ||
71 | } | ||
72 | |||
28 | static void msi_set_enable(struct pci_dev *dev, int enable) | 73 | static void msi_set_enable(struct pci_dev *dev, int enable) |
29 | { | 74 | { |
30 | int pos; | 75 | int pos; |
@@ -230,7 +275,6 @@ static void pci_intx_for_msi(struct pci_dev *dev, int enable) | |||
230 | pci_intx(dev, enable); | 275 | pci_intx(dev, enable); |
231 | } | 276 | } |
232 | 277 | ||
233 | #ifdef CONFIG_PM | ||
234 | static void __pci_restore_msi_state(struct pci_dev *dev) | 278 | static void __pci_restore_msi_state(struct pci_dev *dev) |
235 | { | 279 | { |
236 | int pos; | 280 | int pos; |
@@ -288,7 +332,7 @@ void pci_restore_msi_state(struct pci_dev *dev) | |||
288 | __pci_restore_msi_state(dev); | 332 | __pci_restore_msi_state(dev); |
289 | __pci_restore_msix_state(dev); | 333 | __pci_restore_msix_state(dev); |
290 | } | 334 | } |
291 | #endif /* CONFIG_PM */ | 335 | EXPORT_SYMBOL_GPL(pci_restore_msi_state); |
292 | 336 | ||
293 | /** | 337 | /** |
294 | * msi_capability_init - configure device's MSI capability structure | 338 | * msi_capability_init - configure device's MSI capability structure |
@@ -683,49 +727,3 @@ void pci_msi_init_pci_dev(struct pci_dev *dev) | |||
683 | { | 727 | { |
684 | INIT_LIST_HEAD(&dev->msi_list); | 728 | INIT_LIST_HEAD(&dev->msi_list); |
685 | } | 729 | } |
686 | |||
687 | |||
688 | /* Arch hooks */ | ||
689 | |||
690 | int __attribute__ ((weak)) | ||
691 | arch_msi_check_device(struct pci_dev* dev, int nvec, int type) | ||
692 | { | ||
693 | return 0; | ||
694 | } | ||
695 | |||
696 | int __attribute__ ((weak)) | ||
697 | arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *entry) | ||
698 | { | ||
699 | return 0; | ||
700 | } | ||
701 | |||
702 | int __attribute__ ((weak)) | ||
703 | arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
704 | { | ||
705 | struct msi_desc *entry; | ||
706 | int ret; | ||
707 | |||
708 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
709 | ret = arch_setup_msi_irq(dev, entry); | ||
710 | if (ret) | ||
711 | return ret; | ||
712 | } | ||
713 | |||
714 | return 0; | ||
715 | } | ||
716 | |||
717 | void __attribute__ ((weak)) arch_teardown_msi_irq(unsigned int irq) | ||
718 | { | ||
719 | return; | ||
720 | } | ||
721 | |||
722 | void __attribute__ ((weak)) | ||
723 | arch_teardown_msi_irqs(struct pci_dev *dev) | ||
724 | { | ||
725 | struct msi_desc *entry; | ||
726 | |||
727 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
728 | if (entry->irq != 0) | ||
729 | arch_teardown_msi_irq(entry->irq); | ||
730 | } | ||
731 | } | ||