diff options
author | Paul Mackerras <paulus@samba.org> | 2007-09-13 11:24:25 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-09-13 11:24:25 -0400 |
commit | b2315372eac9cd9f622c32a93e323cf6f0f03462 (patch) | |
tree | 9e1faa7cdcddf5d90bec4fb9523742d4cce699a1 /arch/sparc64/kernel | |
parent | 5326152fa182b0a16e4abf913ce403e3c7ab53b7 (diff) | |
parent | c87ce65868bbf9bbea9c3f112ff8315302daf8f2 (diff) |
Merge branch 'linux-2.6' into for-2.6.24
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/irq.c | 27 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci.c | 14 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sun4v.c | 18 |
3 files changed, 43 insertions, 16 deletions
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index 384abf410cf0..23956096b3bf 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 | ||
224 | void 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 | |||
232 | u32 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 | |||
222 | static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq) | 241 | static 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 3d93e9203ba2..e8dac81d8a0d 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; |
@@ -745,7 +744,7 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, | |||
745 | { | 744 | { |
746 | struct device_node *child; | 745 | struct device_node *child; |
747 | const u32 *reg; | 746 | const u32 *reg; |
748 | int reglen, devfn; | 747 | int reglen, devfn, prev_devfn; |
749 | struct pci_dev *dev; | 748 | struct pci_dev *dev; |
750 | 749 | ||
751 | if (ofpci_verbose) | 750 | if (ofpci_verbose) |
@@ -753,14 +752,25 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, | |||
753 | node->full_name, bus->number); | 752 | node->full_name, bus->number); |
754 | 753 | ||
755 | child = NULL; | 754 | child = NULL; |
755 | prev_devfn = -1; | ||
756 | while ((child = of_get_next_child(node, child)) != NULL) { | 756 | while ((child = of_get_next_child(node, child)) != NULL) { |
757 | if (ofpci_verbose) | 757 | if (ofpci_verbose) |
758 | printk(" * %s\n", child->full_name); | 758 | printk(" * %s\n", child->full_name); |
759 | reg = of_get_property(child, "reg", ®len); | 759 | reg = of_get_property(child, "reg", ®len); |
760 | if (reg == NULL || reglen < 20) | 760 | if (reg == NULL || reglen < 20) |
761 | continue; | 761 | continue; |
762 | |||
762 | devfn = (reg[0] >> 8) & 0xff; | 763 | devfn = (reg[0] >> 8) & 0xff; |
763 | 764 | ||
765 | /* This is a workaround for some device trees | ||
766 | * which list PCI devices twice. On the V100 | ||
767 | * for example, device number 3 is listed twice. | ||
768 | * Once as "pm" and once again as "lomp". | ||
769 | */ | ||
770 | if (devfn == prev_devfn) | ||
771 | continue; | ||
772 | prev_devfn = devfn; | ||
773 | |||
764 | /* create a new pci_dev for this device */ | 774 | /* create a new pci_dev for this device */ |
765 | dev = of_create_pci_dev(pbm, child, bus, devfn, 0); | 775 | dev = of_create_pci_dev(pbm, child, bus, devfn, 0); |
766 | if (!dev) | 776 | if (!dev) |
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c index 466f4aa8fc82..da724b13e89e 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 | ||
994 | out_err: | 994 | out_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", |