aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic_u3msi.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-09-20 02:36:51 -0400
committerPaul Mackerras <paulus@samba.org>2007-10-02 19:11:42 -0400
commit21ccdd31e9c70f42b00d9ea152f6c4e0ff3f536e (patch)
treec54c610501be73cf2634e951e9d75c4e20820370 /arch/powerpc/sysdev/mpic_u3msi.c
parentd385366a9b96fc3f4705f8513adccceaa0515f97 (diff)
[POWERPC] Inline u3msi_compose_msi_msg()
In the MPIC U3 MSI code, we call u3msi_compose_msi_msg() once for each MSI. This is overkill, as the address is per pci device, not per MSI. So setup the address once, and just set the data per MSI. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpic_u3msi.c')
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 255b2f53beda..1d5a40899b74 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -108,26 +108,17 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
108 return; 108 return;
109} 109}
110 110
111static void u3msi_compose_msi_msg(struct pci_dev *pdev, int virq,
112 struct msi_msg *msg)
113{
114 u64 addr;
115
116 addr = find_ht_magic_addr(pdev);
117 msg->address_lo = addr & 0xFFFFFFFF;
118 msg->address_hi = addr >> 32;
119 msg->data = virq_to_hw(virq);
120
121 pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) at address 0x%lx\n",
122 virq, virq_to_hw(virq), addr);
123}
124
125static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 111static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
126{ 112{
127 irq_hw_number_t hwirq; 113 irq_hw_number_t hwirq;
128 unsigned int virq; 114 unsigned int virq;
129 struct msi_desc *entry; 115 struct msi_desc *entry;
130 struct msi_msg msg; 116 struct msi_msg msg;
117 u64 addr;
118
119 addr = find_ht_magic_addr(pdev);
120 msg.address_lo = addr & 0xFFFFFFFF;
121 msg.address_hi = addr >> 32;
131 122
132 list_for_each_entry(entry, &pdev->msi_list, list) { 123 list_for_each_entry(entry, &pdev->msi_list, list) {
133 hwirq = mpic_msi_alloc_hwirqs(msi_mpic, 1); 124 hwirq = mpic_msi_alloc_hwirqs(msi_mpic, 1);
@@ -147,7 +138,10 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
147 set_irq_chip(virq, &mpic_u3msi_chip); 138 set_irq_chip(virq, &mpic_u3msi_chip);
148 set_irq_type(virq, IRQ_TYPE_EDGE_RISING); 139 set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
149 140
150 u3msi_compose_msi_msg(pdev, virq, &msg); 141 pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) addr 0x%lx\n",
142 virq, hwirq, addr);
143
144 msg.data = hwirq;
151 write_msi_msg(virq, &msg); 145 write_msi_msg(virq, &msg);
152 146
153 hwirq++; 147 hwirq++;