aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic_u3msi.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/mpic_u3msi.c')
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 6e2f8686fdfc..0a8f5a9e87c9 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -16,6 +16,7 @@
16#include <asm/prom.h> 16#include <asm/prom.h>
17#include <asm/hw_irq.h> 17#include <asm/hw_irq.h>
18#include <asm/ppc-pci.h> 18#include <asm/ppc-pci.h>
19#include <asm/msi_bitmap.h>
19 20
20#include "mpic.h" 21#include "mpic.h"
21 22
@@ -101,7 +102,8 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
101 continue; 102 continue;
102 103
103 set_irq_msi(entry->irq, NULL); 104 set_irq_msi(entry->irq, NULL);
104 mpic_msi_free_hwirqs(msi_mpic, virq_to_hw(entry->irq), 1); 105 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap,
106 virq_to_hw(entry->irq), 1);
105 irq_dispose_mapping(entry->irq); 107 irq_dispose_mapping(entry->irq);
106 } 108 }
107 109
@@ -110,29 +112,27 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
110 112
111static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 113static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
112{ 114{
113 irq_hw_number_t hwirq;
114 unsigned int virq; 115 unsigned int virq;
115 struct msi_desc *entry; 116 struct msi_desc *entry;
116 struct msi_msg msg; 117 struct msi_msg msg;
117 u64 addr; 118 u64 addr;
118 int ret; 119 int hwirq;
119 120
120 addr = find_ht_magic_addr(pdev); 121 addr = find_ht_magic_addr(pdev);
121 msg.address_lo = addr & 0xFFFFFFFF; 122 msg.address_lo = addr & 0xFFFFFFFF;
122 msg.address_hi = addr >> 32; 123 msg.address_hi = addr >> 32;
123 124
124 list_for_each_entry(entry, &pdev->msi_list, list) { 125 list_for_each_entry(entry, &pdev->msi_list, list) {
125 ret = mpic_msi_alloc_hwirqs(msi_mpic, 1); 126 hwirq = msi_bitmap_alloc_hwirqs(&msi_mpic->msi_bitmap, 1);
126 if (ret < 0) { 127 if (hwirq < 0) {
127 pr_debug("u3msi: failed allocating hwirq\n"); 128 pr_debug("u3msi: failed allocating hwirq\n");
128 return ret; 129 return hwirq;
129 } 130 }
130 hwirq = ret;
131 131
132 virq = irq_create_mapping(msi_mpic->irqhost, hwirq); 132 virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
133 if (virq == NO_IRQ) { 133 if (virq == NO_IRQ) {
134 pr_debug("u3msi: failed mapping hwirq 0x%lx\n", hwirq); 134 pr_debug("u3msi: failed mapping hwirq 0x%x\n", hwirq);
135 mpic_msi_free_hwirqs(msi_mpic, hwirq, 1); 135 msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, 1);
136 return -ENOSPC; 136 return -ENOSPC;
137 } 137 }
138 138
@@ -140,8 +140,8 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
140 set_irq_chip(virq, &mpic_u3msi_chip); 140 set_irq_chip(virq, &mpic_u3msi_chip);
141 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 141 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
142 142
143 pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) addr 0x%lx\n", 143 pr_debug("u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
144 virq, hwirq, addr); 144 virq, hwirq, (unsigned long)addr);
145 145
146 msg.data = hwirq; 146 msg.data = hwirq;
147 write_msi_msg(virq, &msg); 147 write_msi_msg(virq, &msg);