aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 03:52:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-31 03:52:43 -0400
commitd66ac4752e891f319fa931ab72efb3352fafa50b (patch)
tree8a7c1b152a9103927962d6f398eff8bc76a6dab2
parent0ee13079906f0e0b185b13a1fbdaf24d853baa8d (diff)
parent5f92c329364c0bf2d3a356da5e8759fbe349f9d1 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [SPARC64]: Fix several bugs in MSI handling. [SPARC64]: Fix type and constant sizes wrt. sun4u IMAP/ICLR handling.
-rw-r--r--arch/sparc64/kernel/irq.c27
-rw-r--r--arch/sparc64/kernel/pci.c1
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c18
-rw-r--r--include/asm-sparc64/device.h2
-rw-r--r--include/asm-sparc64/irq.h25
5 files changed, 45 insertions, 28 deletions
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 384abf410cf..23956096b3b 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -217,8 +217,27 @@ struct irq_handler_data {
217 void (*pre_handler)(unsigned int, void *, void *); 217 void (*pre_handler)(unsigned int, void *, void *);
218 void *pre_handler_arg1; 218 void *pre_handler_arg1;
219 void *pre_handler_arg2; 219 void *pre_handler_arg2;
220
221 u32 msi;
220}; 222};
221 223
224void sparc64_set_msi(unsigned int virt_irq, u32 msi)
225{
226 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
227
228 if (data)
229 data->msi = msi;
230}
231
232u32 sparc64_get_msi(unsigned int virt_irq)
233{
234 struct irq_handler_data *data = get_irq_chip_data(virt_irq);
235
236 if (data)
237 return data->msi;
238 return 0xffffffff;
239}
240
222static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq) 241static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq)
223{ 242{
224 unsigned int real_irq = virt_to_real_irq(virt_irq); 243 unsigned int real_irq = virt_to_real_irq(virt_irq);
@@ -308,7 +327,7 @@ static void sun4u_irq_disable(unsigned int virt_irq)
308 327
309 if (likely(data)) { 328 if (likely(data)) {
310 unsigned long imap = data->imap; 329 unsigned long imap = data->imap;
311 u32 tmp = upa_readq(imap); 330 unsigned long tmp = upa_readq(imap);
312 331
313 tmp &= ~IMAP_VALID; 332 tmp &= ~IMAP_VALID;
314 upa_writeq(tmp, imap); 333 upa_writeq(tmp, imap);
@@ -741,7 +760,7 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
741 break; 760 break;
742 } 761 }
743 if (devino >= msi_end) 762 if (devino >= msi_end)
744 return 0; 763 return -ENOSPC;
745 764
746 sysino = sun4v_devino_to_sysino(devhandle, devino); 765 sysino = sun4v_devino_to_sysino(devhandle, devino);
747 bucket = &ivector_table[sysino]; 766 bucket = &ivector_table[sysino];
@@ -755,8 +774,8 @@ unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
755 774
756 data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC); 775 data = kzalloc(sizeof(struct irq_handler_data), GFP_ATOMIC);
757 if (unlikely(!data)) { 776 if (unlikely(!data)) {
758 prom_printf("IRQ: kzalloc(irq_handler_data) failed.\n"); 777 virt_irq_free(*virt_irq_p);
759 prom_halt(); 778 return -ENOMEM;
760 } 779 }
761 set_irq_chip_data(bucket->virt_irq, data); 780 set_irq_chip_data(bucket->virt_irq, data);
762 781
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 3d93e9203ba..139b4cff801 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -393,7 +393,6 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
393 sd->host_controller = pbm; 393 sd->host_controller = pbm;
394 sd->prom_node = node; 394 sd->prom_node = node;
395 sd->op = of_find_device_by_node(node); 395 sd->op = of_find_device_by_node(node);
396 sd->msi_num = 0xffffffff;
397 396
398 sd = &sd->op->dev.archdata; 397 sd = &sd->op->dev.archdata;
399 sd->iommu = pbm->iommu; 398 sd->iommu = pbm->iommu;
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 466f4aa8fc8..da724b13e89 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -940,13 +940,13 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
940 if (msi_num < 0) 940 if (msi_num < 0)
941 return msi_num; 941 return msi_num;
942 942
943 devino = sun4v_build_msi(pbm->devhandle, virt_irq_p, 943 err = sun4v_build_msi(pbm->devhandle, virt_irq_p,
944 pbm->msiq_first_devino, 944 pbm->msiq_first_devino,
945 (pbm->msiq_first_devino + 945 (pbm->msiq_first_devino +
946 pbm->msiq_num)); 946 pbm->msiq_num));
947 err = -ENOMEM; 947 if (err < 0)
948 if (!devino)
949 goto out_err; 948 goto out_err;
949 devino = err;
950 950
951 msiqid = ((devino - pbm->msiq_first_devino) + 951 msiqid = ((devino - pbm->msiq_first_devino) +
952 pbm->msiq_first); 952 pbm->msiq_first);
@@ -971,7 +971,7 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
971 if (pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_VALID)) 971 if (pci_sun4v_msi_setvalid(pbm->devhandle, msi_num, HV_MSIVALID_VALID))
972 goto out_err; 972 goto out_err;
973 973
974 pdev->dev.archdata.msi_num = msi_num; 974 sparc64_set_msi(*virt_irq_p, msi_num);
975 975
976 if (entry->msi_attrib.is_64) { 976 if (entry->msi_attrib.is_64) {
977 msg.address_hi = pbm->msi64_start >> 32; 977 msg.address_hi = pbm->msi64_start >> 32;
@@ -993,8 +993,6 @@ static int pci_sun4v_setup_msi_irq(unsigned int *virt_irq_p,
993 993
994out_err: 994out_err:
995 free_msi(pbm, msi_num); 995 free_msi(pbm, msi_num);
996 sun4v_destroy_msi(*virt_irq_p);
997 *virt_irq_p = 0;
998 return err; 996 return err;
999 997
1000} 998}
@@ -1006,7 +1004,7 @@ static void pci_sun4v_teardown_msi_irq(unsigned int virt_irq,
1006 unsigned long msiqid, err; 1004 unsigned long msiqid, err;
1007 unsigned int msi_num; 1005 unsigned int msi_num;
1008 1006
1009 msi_num = pdev->dev.archdata.msi_num; 1007 msi_num = sparc64_get_msi(virt_irq);
1010 err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi_num, &msiqid); 1008 err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi_num, &msiqid);
1011 if (err) { 1009 if (err) {
1012 printk(KERN_ERR "%s: getmsiq gives error %lu\n", 1010 printk(KERN_ERR "%s: getmsiq gives error %lu\n",
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
index d5a4559b955..5111e8717be 100644
--- a/include/asm-sparc64/device.h
+++ b/include/asm-sparc64/device.h
@@ -16,8 +16,6 @@ struct dev_archdata {
16 16
17 struct device_node *prom_node; 17 struct device_node *prom_node;
18 struct of_device *op; 18 struct of_device *op;
19
20 unsigned int msi_num;
21}; 19};
22 20
23#endif /* _ASM_SPARC64_DEVICE_H */ 21#endif /* _ASM_SPARC64_DEVICE_H */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index e6c436ef935..c00ad152771 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -16,21 +16,21 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17 17
18/* IMAP/ICLR register defines */ 18/* IMAP/ICLR register defines */
19#define IMAP_VALID 0x80000000 /* IRQ Enabled */ 19#define IMAP_VALID 0x80000000UL /* IRQ Enabled */
20#define IMAP_TID_UPA 0x7c000000 /* UPA TargetID */ 20#define IMAP_TID_UPA 0x7c000000UL /* UPA TargetID */
21#define IMAP_TID_JBUS 0x7c000000 /* JBUS TargetID */ 21#define IMAP_TID_JBUS 0x7c000000UL /* JBUS TargetID */
22#define IMAP_TID_SHIFT 26 22#define IMAP_TID_SHIFT 26
23#define IMAP_AID_SAFARI 0x7c000000 /* Safari AgentID */ 23#define IMAP_AID_SAFARI 0x7c000000UL /* Safari AgentID */
24#define IMAP_AID_SHIFT 26 24#define IMAP_AID_SHIFT 26
25#define IMAP_NID_SAFARI 0x03e00000 /* Safari NodeID */ 25#define IMAP_NID_SAFARI 0x03e00000UL /* Safari NodeID */
26#define IMAP_NID_SHIFT 21 26#define IMAP_NID_SHIFT 21
27#define IMAP_IGN 0x000007c0 /* IRQ Group Number */ 27#define IMAP_IGN 0x000007c0UL /* IRQ Group Number */
28#define IMAP_INO 0x0000003f /* IRQ Number */ 28#define IMAP_INO 0x0000003fUL /* IRQ Number */
29#define IMAP_INR 0x000007ff /* Full interrupt number*/ 29#define IMAP_INR 0x000007ffUL /* Full interrupt number*/
30 30
31#define ICLR_IDLE 0x00000000 /* Idle state */ 31#define ICLR_IDLE 0x00000000UL /* Idle state */
32#define ICLR_TRANSMIT 0x00000001 /* Transmit state */ 32#define ICLR_TRANSMIT 0x00000001UL /* Transmit state */
33#define ICLR_PENDING 0x00000003 /* Pending state */ 33#define ICLR_PENDING 0x00000003UL /* Pending state */
34 34
35/* The largest number of unique interrupt sources we support. 35/* The largest number of unique interrupt sources we support.
36 * If this needs to ever be larger than 255, you need to change 36 * If this needs to ever be larger than 255, you need to change
@@ -53,6 +53,9 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
53extern void sun4v_destroy_msi(unsigned int virt_irq); 53extern void sun4v_destroy_msi(unsigned int virt_irq);
54extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 54extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
55 55
56extern void sparc64_set_msi(unsigned int virt_irq, u32 msi);
57extern u32 sparc64_get_msi(unsigned int virt_irq);
58
56extern void fixup_irqs(void); 59extern void fixup_irqs(void);
57 60
58static __inline__ void set_softint(unsigned long bits) 61static __inline__ void set_softint(unsigned long bits)