diff options
-rw-r--r-- | arch/sparc64/kernel/irq.c | 19 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_msi.c | 2 | ||||
-rw-r--r-- | include/asm-sparc64/irq.h | 3 |
3 files changed, 10 insertions, 14 deletions
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 2be6bcbe50ca..695b9e40cd80 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c | |||
@@ -122,19 +122,16 @@ static void bucket_set_virt_irq(unsigned long bucket_pa, | |||
122 | "i" (ASI_PHYS_USE_EC)); | 122 | "i" (ASI_PHYS_USE_EC)); |
123 | } | 123 | } |
124 | 124 | ||
125 | #define __irq(bucket) ((unsigned long)(bucket)) | ||
126 | |||
127 | #define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa) | 125 | #define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa) |
128 | 126 | ||
129 | static struct { | 127 | static struct { |
130 | unsigned long irq; | ||
131 | unsigned int dev_handle; | 128 | unsigned int dev_handle; |
132 | unsigned int dev_ino; | 129 | unsigned int dev_ino; |
130 | unsigned int in_use; | ||
133 | } virt_to_real_irq_table[NR_IRQS]; | 131 | } virt_to_real_irq_table[NR_IRQS]; |
134 | static DEFINE_SPINLOCK(virt_irq_alloc_lock); | 132 | static DEFINE_SPINLOCK(virt_irq_alloc_lock); |
135 | 133 | ||
136 | unsigned char virt_irq_alloc(unsigned long real_irq, | 134 | unsigned char virt_irq_alloc(unsigned int dev_handle, |
137 | unsigned int dev_handle, | ||
138 | unsigned int dev_ino) | 135 | unsigned int dev_ino) |
139 | { | 136 | { |
140 | unsigned long flags; | 137 | unsigned long flags; |
@@ -145,16 +142,16 @@ unsigned char virt_irq_alloc(unsigned long real_irq, | |||
145 | spin_lock_irqsave(&virt_irq_alloc_lock, flags); | 142 | spin_lock_irqsave(&virt_irq_alloc_lock, flags); |
146 | 143 | ||
147 | for (ent = 1; ent < NR_IRQS; ent++) { | 144 | for (ent = 1; ent < NR_IRQS; ent++) { |
148 | if (!virt_to_real_irq_table[ent].irq) | 145 | if (!virt_to_real_irq_table[ent].in_use) |
149 | break; | 146 | break; |
150 | } | 147 | } |
151 | if (ent >= NR_IRQS) { | 148 | if (ent >= NR_IRQS) { |
152 | printk(KERN_ERR "IRQ: Out of virtual IRQs.\n"); | 149 | printk(KERN_ERR "IRQ: Out of virtual IRQs.\n"); |
153 | ent = 0; | 150 | ent = 0; |
154 | } else { | 151 | } else { |
155 | virt_to_real_irq_table[ent].irq = real_irq; | ||
156 | virt_to_real_irq_table[ent].dev_handle = dev_handle; | 152 | virt_to_real_irq_table[ent].dev_handle = dev_handle; |
157 | virt_to_real_irq_table[ent].dev_ino = dev_ino; | 153 | virt_to_real_irq_table[ent].dev_ino = dev_ino; |
154 | virt_to_real_irq_table[ent].in_use = 1; | ||
158 | } | 155 | } |
159 | 156 | ||
160 | spin_unlock_irqrestore(&virt_irq_alloc_lock, flags); | 157 | spin_unlock_irqrestore(&virt_irq_alloc_lock, flags); |
@@ -172,7 +169,7 @@ void virt_irq_free(unsigned int virt_irq) | |||
172 | 169 | ||
173 | spin_lock_irqsave(&virt_irq_alloc_lock, flags); | 170 | spin_lock_irqsave(&virt_irq_alloc_lock, flags); |
174 | 171 | ||
175 | virt_to_real_irq_table[virt_irq].irq = 0; | 172 | virt_to_real_irq_table[virt_irq].in_use = 0; |
176 | 173 | ||
177 | spin_unlock_irqrestore(&virt_irq_alloc_lock, flags); | 174 | spin_unlock_irqrestore(&virt_irq_alloc_lock, flags); |
178 | } | 175 | } |
@@ -583,7 +580,7 @@ unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap) | |||
583 | bucket = &ivector_table[ino]; | 580 | bucket = &ivector_table[ino]; |
584 | virt_irq = bucket_get_virt_irq(__pa(bucket)); | 581 | virt_irq = bucket_get_virt_irq(__pa(bucket)); |
585 | if (!virt_irq) { | 582 | if (!virt_irq) { |
586 | virt_irq = virt_irq_alloc(__irq(bucket), 0, ino); | 583 | virt_irq = virt_irq_alloc(0, ino); |
587 | bucket_set_virt_irq(__pa(bucket), virt_irq); | 584 | bucket_set_virt_irq(__pa(bucket), virt_irq); |
588 | set_irq_chip(virt_irq, &sun4u_irq); | 585 | set_irq_chip(virt_irq, &sun4u_irq); |
589 | } | 586 | } |
@@ -618,7 +615,7 @@ static unsigned int sun4v_build_common(unsigned long sysino, | |||
618 | bucket = &ivector_table[sysino]; | 615 | bucket = &ivector_table[sysino]; |
619 | virt_irq = bucket_get_virt_irq(__pa(bucket)); | 616 | virt_irq = bucket_get_virt_irq(__pa(bucket)); |
620 | if (!virt_irq) { | 617 | if (!virt_irq) { |
621 | virt_irq = virt_irq_alloc(__irq(bucket), 0, sysino); | 618 | virt_irq = virt_irq_alloc(0, sysino); |
622 | bucket_set_virt_irq(__pa(bucket), virt_irq); | 619 | bucket_set_virt_irq(__pa(bucket), virt_irq); |
623 | set_irq_chip(virt_irq, chip); | 620 | set_irq_chip(virt_irq, chip); |
624 | } | 621 | } |
@@ -666,7 +663,7 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) | |||
666 | ((unsigned long) bucket + | 663 | ((unsigned long) bucket + |
667 | sizeof(struct ino_bucket))); | 664 | sizeof(struct ino_bucket))); |
668 | 665 | ||
669 | virt_irq = virt_irq_alloc(__irq(bucket), devhandle, devino); | 666 | virt_irq = virt_irq_alloc(devhandle, devino); |
670 | bucket_set_virt_irq(__pa(bucket), virt_irq); | 667 | bucket_set_virt_irq(__pa(bucket), virt_irq); |
671 | set_irq_chip(virt_irq, &sun4v_virq); | 668 | set_irq_chip(virt_irq, &sun4v_virq); |
672 | 669 | ||
diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc64/kernel/pci_msi.c index e4920cf960e7..31a165fd3e48 100644 --- a/arch/sparc64/kernel/pci_msi.c +++ b/arch/sparc64/kernel/pci_msi.c | |||
@@ -123,7 +123,7 @@ int sparc64_setup_msi_irq(unsigned int *virt_irq_p, | |||
123 | int msi, err; | 123 | int msi, err; |
124 | u32 msiqid; | 124 | u32 msiqid; |
125 | 125 | ||
126 | *virt_irq_p = virt_irq_alloc(~0, 0, 0); | 126 | *virt_irq_p = virt_irq_alloc(0, 0); |
127 | err = -ENOMEM; | 127 | err = -ENOMEM; |
128 | if (!*virt_irq_p) | 128 | if (!*virt_irq_p) |
129 | goto out_err; | 129 | goto out_err; |
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h index fd34d731d1a9..182dba05c702 100644 --- a/include/asm-sparc64/irq.h +++ b/include/asm-sparc64/irq.h | |||
@@ -59,8 +59,7 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p, | |||
59 | extern void sun4u_destroy_msi(unsigned int virt_irq); | 59 | extern void sun4u_destroy_msi(unsigned int virt_irq); |
60 | extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); | 60 | extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); |
61 | 61 | ||
62 | extern unsigned char virt_irq_alloc(unsigned long real_irq, | 62 | extern unsigned char virt_irq_alloc(unsigned int dev_handle, |
63 | unsigned int dev_handle, | ||
64 | unsigned int dev_ino); | 63 | unsigned int dev_ino); |
65 | #ifdef CONFIG_PCI_MSI | 64 | #ifdef CONFIG_PCI_MSI |
66 | extern void virt_irq_free(unsigned int virt_irq); | 65 | extern void virt_irq_free(unsigned int virt_irq); |