17 #include <asm/hw_irq.h>
24 static struct mpic *msi_mpic;
38 static struct irq_chip mpic_u3msi_chip = {
39 .irq_shutdown = mpic_u3msi_mask_irq,
40 .irq_mask = mpic_u3msi_mask_irq,
41 .irq_unmask = mpic_u3msi_unmask_irq,
48 static u64 read_ht_magic_addr(
struct pci_dev *pdev,
unsigned int pos)
62 addr = addr | ((
u64)tmp << 32);
67 static u64 find_ht_magic_addr(
struct pci_dev *pdev,
unsigned int hwirq)
75 return read_ht_magic_addr(bus->
self, pos);
81 static u64 find_u4_magic_addr(
struct pci_dev *pdev,
unsigned int hwirq)
103 return 0xf8004000 | (hwirq << 4);
108 static int u3msi_msi_check_device(
struct pci_dev *pdev,
int nvec,
int type)
111 pr_debug(
"u3msi: MSI-X untested, trying anyway.\n");
114 if (find_ht_magic_addr(pdev, 0) == 0 &&
115 find_u4_magic_addr(pdev, 0) == 0) {
116 pr_debug(
"u3msi: no magic address found for %s\n",
124 static void u3msi_teardown_msi_irqs(
struct pci_dev *pdev)
141 static int u3msi_setup_msi_irqs(
struct pci_dev *pdev,
int nvec,
int type)
152 pr_debug(
"u3msi: failed allocating hwirq\n");
156 addr = find_ht_magic_addr(pdev, hwirq);
158 addr = find_u4_magic_addr(pdev, hwirq);
159 msg.address_lo = addr & 0xFFFFFFFF;
160 msg.address_hi = addr >> 32;
164 pr_debug(
"u3msi: failed mapping hwirq 0x%x\n", hwirq);
173 pr_debug(
"u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
174 virq, hwirq, (
unsigned long)addr);
176 printk(
"u3msi: allocated virq 0x%x (hw 0x%x) addr 0x%lx\n",
177 virq, hwirq, (
unsigned long)addr);
193 pr_debug(
"u3msi: Error allocating bitmap!\n");
197 pr_debug(
"u3msi: Registering MPIC U3 MSI callbacks.\n");
203 ppc_md.setup_msi_irqs = u3msi_setup_msi_irqs;
204 ppc_md.teardown_msi_irqs = u3msi_teardown_msi_irqs;
205 ppc_md.msi_check_device = u3msi_msi_check_device;