aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic_pasemi_msi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/mpic_pasemi_msi.c')
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index 68aff6076675..656cb772b691 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -22,6 +22,7 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/hw_irq.h> 23#include <asm/hw_irq.h>
24#include <asm/ppc-pci.h> 24#include <asm/ppc-pci.h>
25#include <asm/msi_bitmap.h>
25 26
26#include "mpic.h" 27#include "mpic.h"
27 28
@@ -81,8 +82,8 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
81 continue; 82 continue;
82 83
83 set_irq_msi(entry->irq, NULL); 84 set_irq_msi(entry->irq, NULL);
84 mpic_msi_free_hwirqs(msi_mpic, virq_to_hw(entry->irq), 85 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap,
85 ALLOC_CHUNK); 86 virq_to_hw(entry->irq), ALLOC_CHUNK);
86 irq_dispose_mapping(entry->irq); 87 irq_dispose_mapping(entry->irq);
87 } 88 }
88 89
@@ -91,11 +92,10 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev)
91 92
92static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 93static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
93{ 94{
94 irq_hw_number_t hwirq;
95 unsigned int virq; 95 unsigned int virq;
96 struct msi_desc *entry; 96 struct msi_desc *entry;
97 struct msi_msg msg; 97 struct msi_msg msg;
98 int ret; 98 int hwirq;
99 99
100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n", 100 pr_debug("pasemi_msi_setup_msi_irqs, pdev %p nvec %d type %d\n",
101 pdev, nvec, type); 101 pdev, nvec, type);
@@ -109,17 +109,19 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
109 * few MSIs for someone, but restrictions will apply to how the 109 * few MSIs for someone, but restrictions will apply to how the
110 * sources can be changed independently. 110 * sources can be changed independently.
111 */ 111 */
112 ret = mpic_msi_alloc_hwirqs(msi_mpic, ALLOC_CHUNK); 112 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap,
113 hwirq = ret; 113 ALLOC_CHUNK);
114 if (ret < 0) { 114 if (hwirq < 0) {
115 pr_debug("pasemi_msi: failed allocating hwirq\n"); 115 pr_debug("pasemi_msi: failed allocating hwirq\n");
116 return hwirq; 116 return hwirq;
117 } 117 }
118 118
119 virq = irq_create_mapping(msi_mpic->irqhost, hwirq); 119 virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
120 if (virq == NO_IRQ) { 120 if (virq == NO_IRQ) {
121 pr_debug("pasemi_msi: failed mapping hwirq 0x%lx\n", hwirq); 121 pr_debug("pasemi_msi: failed mapping hwirq 0x%x\n",
122 mpic_msi_free_hwirqs(msi_mpic, hwirq, ALLOC_CHUNK); 122 hwirq);
123 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq,
124 ALLOC_CHUNK);
123 return -ENOSPC; 125 return -ENOSPC;
124 } 126 }
125 127
@@ -133,8 +135,8 @@ static int pasemi_msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
133 set_irq_chip(virq, &mpic_pasemi_msi_chip); 135 set_irq_chip(virq, &mpic_pasemi_msi_chip);
134 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 136 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
135 137
136 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%lx) addr 0x%x\n", 138 pr_debug("pasemi_msi: allocated virq 0x%x (hw 0x%x) " \
137 virq, hwirq, msg.address_lo); 139 "addr 0x%x\n", virq, hwirq, msg.address_lo);
138 140
139 /* Likewise, the device writes [0...511] into the target 141 /* Likewise, the device writes [0...511] into the target
140 * register to generate MSI [512...1023] 142 * register to generate MSI [512...1023]