[POWERPC] Fix cell "new style" mapping and add debug

This fixes a typo in the "new style" code for mapping SPE resources,
which causes it to try to map the same resource 4 times.

It also adds some pr_debug's that are useful to track down issues with
the firmware when bringinh up new machines.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by Benjamin Herrenschmidt and committed by Paul Mackerras ab56dbdd ae883cab

+33 -8
+33 -8
arch/powerpc/platforms/cell/spu_base.c
··· 655 656 for (i=0; i < 3; i++) { 657 ret = of_irq_map_one(np, i, &oirq); 658 - if (ret) 659 goto err; 660 - 661 ret = -EINVAL; 662 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 663 oirq.specifier, oirq.size); 664 - if (spu->irqs[i] == NO_IRQ) 665 goto err; 666 } 667 return 0; 668 ··· 686 struct resource resource = { }; 687 int ret; 688 689 - ret = of_address_to_resource(node, 0, &resource); 690 if (ret) 691 goto out; 692 ··· 709 710 ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store, 711 &spu->local_store_phys); 712 - if (ret) 713 goto out; 714 ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem, 715 &spu->problem_phys); 716 - if (ret) 717 goto out_unmap; 718 ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2, 719 NULL); 720 - if (ret) 721 goto out_unmap; 722 723 if (!firmware_has_feature(FW_FEATURE_LPAR)) 724 ret = spu_map_resource(node, 3, (void __iomem**)&spu->priv1, 725 NULL); 726 - if (ret) 727 goto out_unmap; 728 return 0; 729 730 out_unmap:
··· 655 656 for (i=0; i < 3; i++) { 657 ret = of_irq_map_one(np, i, &oirq); 658 + if (ret) { 659 + pr_debug("spu_new: failed to get irq %d\n", i); 660 goto err; 661 + } 662 ret = -EINVAL; 663 + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 664 + oirq.controller->full_name); 665 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 666 oirq.specifier, oirq.size); 667 + if (spu->irqs[i] == NO_IRQ) { 668 + pr_debug("spu_new: failed to map it !\n"); 669 goto err; 670 + } 671 } 672 return 0; 673 ··· 681 struct resource resource = { }; 682 int ret; 683 684 + ret = of_address_to_resource(node, nr, &resource); 685 if (ret) 686 goto out; 687 ··· 704 705 ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store, 706 &spu->local_store_phys); 707 + if (ret) { 708 + pr_debug("spu_new: failed to map %s resource 0\n", 709 + node->full_name); 710 goto out; 711 + } 712 ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem, 713 &spu->problem_phys); 714 + if (ret) { 715 + pr_debug("spu_new: failed to map %s resource 1\n", 716 + node->full_name); 717 goto out_unmap; 718 + } 719 ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2, 720 NULL); 721 + if (ret) { 722 + pr_debug("spu_new: failed to map %s resource 2\n", 723 + node->full_name); 724 goto out_unmap; 725 + } 726 727 if (!firmware_has_feature(FW_FEATURE_LPAR)) 728 ret = spu_map_resource(node, 3, (void __iomem**)&spu->priv1, 729 NULL); 730 + if (ret) { 731 + pr_debug("spu_new: failed to map %s resource 3\n", 732 + node->full_name); 733 goto out_unmap; 734 + } 735 + pr_debug("spu_new: %s maps:\n", node->full_name); 736 + pr_debug(" local store : 0x%016lx -> 0x%p\n", 737 + spu->local_store_phys, spu->local_store); 738 + pr_debug(" problem state : 0x%016lx -> 0x%p\n", 739 + spu->problem_phys, spu->problem); 740 + pr_debug(" priv2 : 0x%p\n", spu->priv2); 741 + pr_debug(" priv1 : 0x%p\n", spu->priv1); 742 + 743 return 0; 744 745 out_unmap: