diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2008-08-05 19:10:03 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-08-20 02:34:58 -0400 |
commit | 25235f712b680d00756a73ee64289137989fc6fd (patch) | |
tree | 3237a42b97fd5f7136ad7a7be9ef3540697cb5f4 /arch/powerpc/sysdev/mpic_u3msi.c | |
parent | 7e7ab3677502a0f798f38bfa1a7d53dd22faa0bc (diff) |
powerpc: Convert the MPIC MSI code to use msi_bitmap
This affects the U3 MSI code as well as the PASEMI MSI code. We keep
some of the MPIC routines as helpers, and also the U3 best-guess
reservation logic. The rest is replaced by the generic code.
And a few printk format changes due to hwirq type change.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
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.c | 22 |
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 | ||
111 | static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | 113 | static 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); |