aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-10-14 02:27:48 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-14 02:27:48 -0400
commitbb74b734a68544ad8f1537a33a7e22c73c87ed1c (patch)
tree27c0d6112ee4cef51e41a520137b402670a9f31e
parent42d5f99b1d801b87c45c87d7392f610d5aef351b (diff)
[SPARC64]: Kill ugly __irq_ino() macro.
We have a place to stick INO information in the virt_to_real_irq_table[], which is currently only used for VIRQs. And that is readily accessible from the one __irq_ino() call site. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/irq.c22
-rw-r--r--arch/sparc64/kernel/pci_msi.c2
-rw-r--r--include/asm-sparc64/irq.h4
3 files changed, 15 insertions, 13 deletions
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index dc51bdf853cd..f8f704524ed9 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -122,8 +122,6 @@ 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_ino(irq) \
126 (((struct ino_bucket *)(irq)) - &ivector_table[0])
127#define __bucket(irq) ((struct ino_bucket *)(irq)) 125#define __bucket(irq) ((struct ino_bucket *)(irq))
128#define __irq(bucket) ((unsigned long)(bucket)) 126#define __irq(bucket) ((unsigned long)(bucket))
129 127
@@ -136,7 +134,9 @@ static struct {
136} virt_to_real_irq_table[NR_IRQS]; 134} virt_to_real_irq_table[NR_IRQS];
137static DEFINE_SPINLOCK(virt_irq_alloc_lock); 135static DEFINE_SPINLOCK(virt_irq_alloc_lock);
138 136
139unsigned char virt_irq_alloc(unsigned long real_irq) 137unsigned char virt_irq_alloc(unsigned long real_irq,
138 unsigned int dev_handle,
139 unsigned int dev_ino)
140{ 140{
141 unsigned long flags; 141 unsigned long flags;
142 unsigned char ent; 142 unsigned char ent;
@@ -154,6 +154,8 @@ unsigned char virt_irq_alloc(unsigned long real_irq)
154 ent = 0; 154 ent = 0;
155 } else { 155 } else {
156 virt_to_real_irq_table[ent].irq = real_irq; 156 virt_to_real_irq_table[ent].irq = real_irq;
157 virt_to_real_irq_table[ent].dev_handle = dev_handle;
158 virt_to_real_irq_table[ent].dev_ino = dev_ino;
157 } 159 }
158 160
159 spin_unlock_irqrestore(&virt_irq_alloc_lock, flags); 161 spin_unlock_irqrestore(&virt_irq_alloc_lock, flags);
@@ -554,11 +556,12 @@ static void sun4v_virq_end(unsigned int virt_irq)
554 556
555static void run_pre_handler(unsigned int virt_irq) 557static void run_pre_handler(unsigned int virt_irq)
556{ 558{
557 struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
558 struct irq_handler_data *data = get_irq_chip_data(virt_irq); 559 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
560 unsigned int ino;
559 561
562 ino = virt_to_real_irq_table[virt_irq].dev_ino;
560 if (likely(data->pre_handler)) { 563 if (likely(data->pre_handler)) {
561 data->pre_handler(__irq_ino(__irq(bucket)), 564 data->pre_handler(ino,
562 data->pre_handler_arg1, 565 data->pre_handler_arg1,
563 data->pre_handler_arg2); 566 data->pre_handler_arg2);
564 } 567 }
@@ -633,7 +636,7 @@ unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap)
633 bucket = &ivector_table[ino]; 636 bucket = &ivector_table[ino];
634 virt_irq = bucket_get_virt_irq(__pa(bucket)); 637 virt_irq = bucket_get_virt_irq(__pa(bucket));
635 if (!virt_irq) { 638 if (!virt_irq) {
636 virt_irq = virt_irq_alloc(__irq(bucket)); 639 virt_irq = virt_irq_alloc(__irq(bucket), 0, ino);
637 bucket_set_virt_irq(__pa(bucket), virt_irq); 640 bucket_set_virt_irq(__pa(bucket), virt_irq);
638 set_irq_chip(virt_irq, &sun4u_irq); 641 set_irq_chip(virt_irq, &sun4u_irq);
639 } 642 }
@@ -668,7 +671,7 @@ static unsigned int sun4v_build_common(unsigned long sysino,
668 bucket = &ivector_table[sysino]; 671 bucket = &ivector_table[sysino];
669 virt_irq = bucket_get_virt_irq(__pa(bucket)); 672 virt_irq = bucket_get_virt_irq(__pa(bucket));
670 if (!virt_irq) { 673 if (!virt_irq) {
671 virt_irq = virt_irq_alloc(__irq(bucket)); 674 virt_irq = virt_irq_alloc(__irq(bucket), 0, sysino);
672 bucket_set_virt_irq(__pa(bucket), virt_irq); 675 bucket_set_virt_irq(__pa(bucket), virt_irq);
673 set_irq_chip(virt_irq, chip); 676 set_irq_chip(virt_irq, chip);
674 } 677 }
@@ -716,7 +719,7 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
716 ((unsigned long) bucket + 719 ((unsigned long) bucket +
717 sizeof(struct ino_bucket))); 720 sizeof(struct ino_bucket)));
718 721
719 virt_irq = virt_irq_alloc(__irq(bucket)); 722 virt_irq = virt_irq_alloc(__irq(bucket), devhandle, devino);
720 bucket_set_virt_irq(__pa(bucket), virt_irq); 723 bucket_set_virt_irq(__pa(bucket), virt_irq);
721 set_irq_chip(virt_irq, &sun4v_virq); 724 set_irq_chip(virt_irq, &sun4v_virq);
722 725
@@ -741,9 +744,6 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
741 prom_halt(); 744 prom_halt();
742 } 745 }
743 746
744 virt_to_real_irq_table[virt_irq].dev_handle = devhandle;
745 virt_to_real_irq_table[virt_irq].dev_ino = devino;
746
747 return virt_irq; 747 return virt_irq;
748} 748}
749 749
diff --git a/arch/sparc64/kernel/pci_msi.c b/arch/sparc64/kernel/pci_msi.c
index 0fa33b1f4274..e4920cf960e7 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); 126 *virt_irq_p = virt_irq_alloc(~0, 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 24841c22e81b..fd34d731d1a9 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -59,7 +59,9 @@ extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p,
59extern void sun4u_destroy_msi(unsigned int virt_irq); 59extern void sun4u_destroy_msi(unsigned int virt_irq);
60extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 60extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
61 61
62extern unsigned char virt_irq_alloc(unsigned long real_irq); 62extern unsigned char virt_irq_alloc(unsigned long real_irq,
63 unsigned int dev_handle,
64 unsigned int dev_ino);
63#ifdef CONFIG_PCI_MSI 65#ifdef CONFIG_PCI_MSI
64extern void virt_irq_free(unsigned int virt_irq); 66extern void virt_irq_free(unsigned int virt_irq);
65#endif 67#endif