aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/pci_fire.c21
-rw-r--r--arch/sparc64/kernel/pci_psycho.c21
-rw-r--r--arch/sparc64/kernel/pci_sabre.c25
-rw-r--r--arch/sparc64/kernel/pci_schizo.c32
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c31
5 files changed, 68 insertions, 62 deletions
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc64/kernel/pci_fire.c
index 477928aad538..4fb1ef92cb16 100644
--- a/arch/sparc64/kernel/pci_fire.c
+++ b/arch/sparc64/kernel/pci_fire.c
@@ -515,13 +515,13 @@ static int __devinit fire_probe(struct of_device *op,
515 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 515 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
516 if (!p) { 516 if (!p) {
517 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 517 printk(KERN_ERR PFX "Cannot allocate controller info.\n");
518 goto out_free; 518 goto out_err;
519 } 519 }
520 520
521 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 521 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
522 if (!iommu) { 522 if (!iommu) {
523 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); 523 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n");
524 goto out_free; 524 goto out_free_controller;
525 } 525 }
526 526
527 p->pbm_A.iommu = iommu; 527 p->pbm_A.iommu = iommu;
@@ -529,21 +529,20 @@ static int __devinit fire_probe(struct of_device *op,
529 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 529 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
530 if (!iommu) { 530 if (!iommu) {
531 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); 531 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n");
532 goto out_free; 532 goto out_free_iommu_A;
533 } 533 }
534 534
535 p->pbm_B.iommu = iommu; 535 p->pbm_B.iommu = iommu;
536 536
537 return pci_fire_pbm_init(p, dp, portid); 537 return pci_fire_pbm_init(p, dp, portid);
538 538
539out_free: 539out_free_iommu_A:
540 if (p) { 540 kfree(p->pbm_A.iommu);
541 if (p->pbm_A.iommu) 541
542 kfree(p->pbm_A.iommu); 542out_free_controller:
543 if (p->pbm_B.iommu) 543 kfree(p);
544 kfree(p->pbm_B.iommu); 544
545 kfree(p); 545out_err:
546 }
547 return err; 546 return err;
548} 547}
549 548
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 708212a6e7eb..5ee84c5b9636 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1051,13 +1051,13 @@ static int __devinit psycho_probe(struct of_device *op,
1051 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1051 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1052 if (!p) { 1052 if (!p) {
1053 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 1053 printk(KERN_ERR PFX "Cannot allocate controller info.\n");
1054 goto out_free; 1054 goto out_err;
1055 } 1055 }
1056 1056
1057 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1057 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1058 if (!iommu) { 1058 if (!iommu) {
1059 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); 1059 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n");
1060 goto out_free; 1060 goto out_free_controller;
1061 } 1061 }
1062 1062
1063 p->pbm_A.iommu = p->pbm_B.iommu = iommu; 1063 p->pbm_A.iommu = p->pbm_B.iommu = iommu;
@@ -1069,7 +1069,7 @@ static int __devinit psycho_probe(struct of_device *op,
1069 err = -ENODEV; 1069 err = -ENODEV;
1070 if (!pr_regs) { 1070 if (!pr_regs) {
1071 printk(KERN_ERR PFX "No reg property.\n"); 1071 printk(KERN_ERR PFX "No reg property.\n");
1072 goto out_free; 1072 goto out_free_iommu;
1073 } 1073 }
1074 1074
1075 p->pbm_A.controller_regs = pr_regs[2].phys_addr; 1075 p->pbm_A.controller_regs = pr_regs[2].phys_addr;
@@ -1082,7 +1082,7 @@ static int __devinit psycho_probe(struct of_device *op,
1082 1082
1083 err = psycho_iommu_init(&p->pbm_A); 1083 err = psycho_iommu_init(&p->pbm_A);
1084 if (err) 1084 if (err)
1085 goto out_free; 1085 goto out_free_iommu;
1086 1086
1087 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000); 1087 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000);
1088 1088
@@ -1090,12 +1090,13 @@ static int __devinit psycho_probe(struct of_device *op,
1090 1090
1091 return 0; 1091 return 0;
1092 1092
1093out_free: 1093out_free_iommu:
1094 if (p) { 1094 kfree(p->pbm_A.iommu);
1095 if (p->pbm_A.iommu) 1095
1096 kfree(p->pbm_A.iommu); 1096out_free_controller:
1097 kfree(p); 1097 kfree(p);
1098 } 1098
1099out_err:
1099 return err; 1100 return err;
1100} 1101}
1101 1102
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index cc476e9a275e..eee8fdca3820 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -786,13 +786,13 @@ static int __devinit sabre_probe(struct of_device *op,
786 p = kzalloc(sizeof(*p), GFP_ATOMIC); 786 p = kzalloc(sizeof(*p), GFP_ATOMIC);
787 if (!p) { 787 if (!p) {
788 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 788 printk(KERN_ERR PFX "Cannot allocate controller info.\n");
789 goto out_free; 789 goto out_err;
790 } 790 }
791 791
792 iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC); 792 iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
793 if (!iommu) { 793 if (!iommu) {
794 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n"); 794 printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n");
795 goto out_free; 795 goto out_free_controller;
796 } 796 }
797 797
798 pbm = &p->pbm_A; 798 pbm = &p->pbm_A;
@@ -813,7 +813,7 @@ static int __devinit sabre_probe(struct of_device *op,
813 err = -ENODEV; 813 err = -ENODEV;
814 if (!pr_regs) { 814 if (!pr_regs) {
815 printk(KERN_ERR PFX "No reg property\n"); 815 printk(KERN_ERR PFX "No reg property\n");
816 goto out_free; 816 goto out_free_iommu;
817 } 817 }
818 818
819 /* 819 /*
@@ -843,7 +843,7 @@ static int __devinit sabre_probe(struct of_device *op,
843 vdma = of_get_property(dp, "virtual-dma", NULL); 843 vdma = of_get_property(dp, "virtual-dma", NULL);
844 if (!vdma) { 844 if (!vdma) {
845 printk(KERN_ERR PFX "No virtual-dma property\n"); 845 printk(KERN_ERR PFX "No virtual-dma property\n");
846 goto out_free; 846 goto out_free_iommu;
847 } 847 }
848 848
849 dma_mask = vdma[0]; 849 dma_mask = vdma[0];
@@ -863,12 +863,12 @@ static int __devinit sabre_probe(struct of_device *op,
863 break; 863 break;
864 default: 864 default:
865 printk(KERN_ERR PFX "Strange virtual-dma size.\n"); 865 printk(KERN_ERR PFX "Strange virtual-dma size.\n");
866 goto out_free; 866 goto out_free_iommu;
867 } 867 }
868 868
869 err = sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask); 869 err = sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask);
870 if (err) 870 if (err)
871 goto out_free; 871 goto out_free_iommu;
872 872
873 /* 873 /*
874 * Look for APB underneath. 874 * Look for APB underneath.
@@ -876,12 +876,13 @@ static int __devinit sabre_probe(struct of_device *op,
876 sabre_pbm_init(p, pbm, dp); 876 sabre_pbm_init(p, pbm, dp);
877 return 0; 877 return 0;
878 878
879out_free: 879out_free_iommu:
880 if (p) { 880 kfree(p->pbm_A.iommu);
881 if (p->pbm_A.iommu) 881
882 kfree(p->pbm_A.iommu); 882out_free_controller:
883 kfree(p); 883 kfree(p);
884 } 884
885out_err:
885 return err; 886 return err;
886} 887}
887 888
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 18fdd887b4ac..bd7612aae17e 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1443,14 +1443,16 @@ static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_ty
1443 struct pci_pbm_info *pbm; 1443 struct pci_pbm_info *pbm;
1444 struct iommu *iommu; 1444 struct iommu *iommu;
1445 u32 portid; 1445 u32 portid;
1446 int err;
1446 1447
1447 portid = of_getintprop_default(dp, "portid", 0xff); 1448 portid = of_getintprop_default(dp, "portid", 0xff);
1448 1449
1450 err = -ENOMEM;
1449 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) { 1451 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
1450 if (portid_compare(pbm->portid, portid, chip_type)) { 1452 if (portid_compare(pbm->portid, portid, chip_type)) {
1451 if (schizo_pbm_init(pbm->parent, dp, 1453 if (schizo_pbm_init(pbm->parent, dp,
1452 portid, chip_type)) 1454 portid, chip_type))
1453 return -ENOMEM; 1455 goto out_err;
1454 return 0; 1456 return 0;
1455 } 1457 }
1456 } 1458 }
@@ -1458,13 +1460,13 @@ static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_ty
1458 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 1460 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
1459 if (!p) { 1461 if (!p) {
1460 printk(KERN_ERR PFX "Cannot allocate controller info.\n"); 1462 printk(KERN_ERR PFX "Cannot allocate controller info.\n");
1461 goto out_free; 1463 goto out_err;
1462 } 1464 }
1463 1465
1464 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1466 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1465 if (!iommu) { 1467 if (!iommu) {
1466 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n"); 1468 printk(KERN_ERR PFX "Cannot allocate PBM A iommu.\n");
1467 goto out_free; 1469 goto out_free_controller;
1468 } 1470 }
1469 1471
1470 p->pbm_A.iommu = iommu; 1472 p->pbm_A.iommu = iommu;
@@ -1472,25 +1474,27 @@ static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_ty
1472 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1474 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1473 if (!iommu) { 1475 if (!iommu) {
1474 printk(KERN_ERR PFX "Cannot allocate PBM B iommu.\n"); 1476 printk(KERN_ERR PFX "Cannot allocate PBM B iommu.\n");
1475 goto out_free; 1477 goto out_free_iommu_A;
1476 } 1478 }
1477 1479
1478 p->pbm_B.iommu = iommu; 1480 p->pbm_B.iommu = iommu;
1479 1481
1480 if (schizo_pbm_init(p, dp, portid, chip_type)) 1482 if (schizo_pbm_init(p, dp, portid, chip_type))
1481 goto out_free; 1483 goto out_free_iommu_B;
1482 1484
1483 return 0; 1485 return 0;
1484 1486
1485out_free: 1487out_free_iommu_B:
1486 if (p) { 1488 kfree(p->pbm_B.iommu);
1487 if (p->pbm_A.iommu) 1489
1488 kfree(p->pbm_A.iommu); 1490out_free_iommu_A:
1489 if (p->pbm_B.iommu) 1491 kfree(p->pbm_A.iommu);
1490 kfree(p->pbm_B.iommu); 1492
1491 kfree(p); 1493out_free_controller:
1492 } 1494 kfree(p);
1493 return -ENOMEM; 1495
1496out_err:
1497 return err;
1494} 1498}
1495 1499
1496static int __devinit schizo_probe(struct of_device *op, 1500static int __devinit schizo_probe(struct of_device *op,
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index fea51a054be5..21864f065323 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -949,7 +949,7 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
949 struct device_node *dp; 949 struct device_node *dp;
950 struct iommu *iommu; 950 struct iommu *iommu;
951 u32 devhandle; 951 u32 devhandle;
952 int i; 952 int i, err;
953 953
954 dp = op->node; 954 dp = op->node;
955 955
@@ -970,9 +970,10 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
970 } 970 }
971 971
972 regs = of_get_property(dp, "reg", NULL); 972 regs = of_get_property(dp, "reg", NULL);
973 err = -ENODEV;
973 if (!regs) { 974 if (!regs) {
974 printk(KERN_ERR PFX "Could not find config registers\n"); 975 printk(KERN_ERR PFX "Could not find config registers\n");
975 return -ENODEV; 976 goto out_err;
976 } 977 }
977 devhandle = (regs->phys_addr >> 32UL) & 0x0fffffff; 978 devhandle = (regs->phys_addr >> 32UL) & 0x0fffffff;
978 979
@@ -982,11 +983,12 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
982 } 983 }
983 } 984 }
984 985
986 err = -ENOMEM;
985 for_each_possible_cpu(i) { 987 for_each_possible_cpu(i) {
986 unsigned long page = get_zeroed_page(GFP_ATOMIC); 988 unsigned long page = get_zeroed_page(GFP_ATOMIC);
987 989
988 if (!page) 990 if (!page)
989 return -ENOMEM; 991 goto out_err;
990 992
991 per_cpu(iommu_batch, i).pglist = (u64 *) page; 993 per_cpu(iommu_batch, i).pglist = (u64 *) page;
992 } 994 }
@@ -994,13 +996,13 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
994 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC); 996 p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
995 if (!p) { 997 if (!p) {
996 printk(KERN_ERR PFX "Could not allocate pci_controller_info\n"); 998 printk(KERN_ERR PFX "Could not allocate pci_controller_info\n");
997 goto out_free; 999 goto out_err;
998 } 1000 }
999 1001
1000 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1002 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1001 if (!iommu) { 1003 if (!iommu) {
1002 printk(KERN_ERR PFX "Could not allocate pbm A iommu\n"); 1004 printk(KERN_ERR PFX "Could not allocate pbm A iommu\n");
1003 goto out_free; 1005 goto out_free_controller;
1004 } 1006 }
1005 1007
1006 p->pbm_A.iommu = iommu; 1008 p->pbm_A.iommu = iommu;
@@ -1008,22 +1010,21 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
1008 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC); 1010 iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
1009 if (!iommu) { 1011 if (!iommu) {
1010 printk(KERN_ERR PFX "Could not allocate pbm B iommu\n"); 1012 printk(KERN_ERR PFX "Could not allocate pbm B iommu\n");
1011 goto out_free; 1013 goto out_free_iommu_A;
1012 } 1014 }
1013 1015
1014 p->pbm_B.iommu = iommu; 1016 p->pbm_B.iommu = iommu;
1015 1017
1016 return pci_sun4v_pbm_init(p, dp, devhandle); 1018 return pci_sun4v_pbm_init(p, dp, devhandle);
1017 1019
1018out_free: 1020out_free_iommu_A:
1019 if (p) { 1021 kfree(p->pbm_A.iommu);
1020 if (p->pbm_A.iommu) 1022
1021 kfree(p->pbm_A.iommu); 1023out_free_controller:
1022 if (p->pbm_B.iommu) 1024 kfree(p);
1023 kfree(p->pbm_B.iommu); 1025
1024 kfree(p); 1026out_err:
1025 } 1027 return err;
1026 return -ENOMEM;
1027} 1028}
1028 1029
1029static struct of_device_id __initdata pci_sun4v_match[] = { 1030static struct of_device_id __initdata pci_sun4v_match[] = {