aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/pci_sabre.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/pci_sabre.c')
-rw-r--r--arch/sparc64/kernel/pci_sabre.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 707d6d6130f7..8f779b58d65a 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -734,8 +734,8 @@ static int sabre_iommu_init(struct pci_pbm_info *pbm,
734 return 0; 734 return 0;
735} 735}
736 736
737static void __init sabre_pbm_init(struct pci_controller_info *p, 737static void __init sabre_pbm_init(struct pci_pbm_info *pbm,
738 struct pci_pbm_info *pbm, struct of_device *op) 738 struct of_device *op)
739{ 739{
740 struct device_node *dp = op->node; 740 struct device_node *dp = op->node;
741 741
@@ -750,7 +750,6 @@ static void __init sabre_pbm_init(struct pci_controller_info *p,
750 pbm->index = pci_num_pbms++; 750 pbm->index = pci_num_pbms++;
751 751
752 pbm->chip_type = PBM_CHIP_TYPE_SABRE; 752 pbm->chip_type = PBM_CHIP_TYPE_SABRE;
753 pbm->parent = p;
754 pbm->prom_node = dp; 753 pbm->prom_node = dp;
755 pci_get_pbm_props(pbm); 754 pci_get_pbm_props(pbm);
756 755
@@ -764,7 +763,6 @@ static int __devinit sabre_probe(struct of_device *op,
764{ 763{
765 const struct linux_prom64_registers *pr_regs; 764 const struct linux_prom64_registers *pr_regs;
766 struct device_node *dp = op->node; 765 struct device_node *dp = op->node;
767 struct pci_controller_info *p;
768 struct pci_pbm_info *pbm; 766 struct pci_pbm_info *pbm;
769 u32 upa_portid, dma_mask; 767 u32 upa_portid, dma_mask;
770 struct iommu *iommu; 768 struct iommu *iommu;
@@ -786,26 +784,22 @@ static int __devinit sabre_probe(struct of_device *op,
786 } 784 }
787 785
788 err = -ENOMEM; 786 err = -ENOMEM;
789 p = kzalloc(sizeof(*p), GFP_ATOMIC); 787 pbm = kzalloc(sizeof(*pbm), GFP_KERNEL);
790 if (!p) { 788 if (!pbm) {
791 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 789 printk(KERN_ERR PFX "Cannot allocate pci_pbm_info.\n");
792 goto out_err; 790 goto out_err;
793 } 791 }
794 792
795 iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC); 793 iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
796 if (!iommu) { 794 if (!iommu) {
797 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); 795 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n");
798 goto out_free_controller; 796 goto out_free_controller;
799 } 797 }
800 798
801 pbm = &p->pbm_A;
802 pbm->iommu = iommu; 799 pbm->iommu = iommu;
803 800
804 upa_portid = of_getintprop_default(dp, "upa-portid", 0xff); 801 upa_portid = of_getintprop_default(dp, "upa-portid", 0xff);
805 802
806 pbm->next = pci_pbm_root;
807 pci_pbm_root = pbm;
808
809 pbm->portid = upa_portid; 803 pbm->portid = upa_portid;
810 804
811 /* 805 /*
@@ -840,8 +834,7 @@ static int __devinit sabre_probe(struct of_device *op,
840 SABRE_PCICTRL_ARBPARK | SABRE_PCICTRL_AEN)); 834 SABRE_PCICTRL_ARBPARK | SABRE_PCICTRL_AEN));
841 835
842 /* Now map in PCI config space for entire SABRE. */ 836 /* Now map in PCI config space for entire SABRE. */
843 pbm->config_space = 837 pbm->config_space = pbm->controller_regs + SABRE_CONFIGSPACE;
844 (pbm->controller_regs + SABRE_CONFIGSPACE);
845 838
846 vdma = of_get_property(dp, "virtual-dma", NULL); 839 vdma = of_get_property(dp, "virtual-dma", NULL);
847 if (!vdma) { 840 if (!vdma) {
@@ -876,14 +869,20 @@ static int __devinit sabre_probe(struct of_device *op,
876 /* 869 /*
877 * Look for APB underneath. 870 * Look for APB underneath.
878 */ 871 */
879 sabre_pbm_init(p, pbm, op); 872 sabre_pbm_init(pbm, op);
873
874 pbm->next = pci_pbm_root;
875 pci_pbm_root = pbm;
876
877 dev_set_drvdata(&op->dev, pbm);
878
880 return 0; 879 return 0;
881 880
882out_free_iommu: 881out_free_iommu:
883 kfree(p->pbm_A.iommu); 882 kfree(pbm->iommu);
884 883
885out_free_controller: 884out_free_controller:
886 kfree(p); 885 kfree(pbm);
887 886
888out_err: 887out_err:
889 return err; 888 return err;