aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-10-14 02:50:38 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-14 02:50:38 -0400
commit256c1df36bbec6530c6f9b5a840cc5e87315c19e (patch)
treea5ee78dc315414ce42e9765f44fdc87e3033fe83 /arch/sparc64
parent771823007fa2acb15a726e7e1f8502d4f350b1fa (diff)
[SPARC64]: virt_irq --> bucket mapping no longer necessary
We used to need this to compute virt_irq --> ino, but that is no longer necessary. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/irq.c19
-rw-r--r--arch/sparc64/kernel/pci_msi.c2
2 files changed, 9 insertions, 12 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
129static struct { 127static 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];
134static DEFINE_SPINLOCK(virt_irq_alloc_lock); 132static DEFINE_SPINLOCK(virt_irq_alloc_lock);
135 133
136unsigned char virt_irq_alloc(unsigned long real_irq, 134unsigned 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;