aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-01 21:32:22 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-01 21:32:22 -0400
commite822358ac24550d889895d5866797ae8c9b188c2 (patch)
treead231109cba4725ea349fd7186bf6dc293cf3045
parent7cc288add44c392dfc8c1dbf0e3a26a69a14fa70 (diff)
sparc64: Pass proper parent device down into root pci_create_bus() call.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/pci.c6
-rw-r--r--arch/sparc64/kernel/pci_fire.c18
-rw-r--r--arch/sparc64/kernel/pci_psycho.c14
-rw-r--r--arch/sparc64/kernel/pci_sabre.c13
-rw-r--r--arch/sparc64/kernel/pci_schizo.c19
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c14
6 files changed, 45 insertions, 39 deletions
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 2da32e4c985b..8e18fdf32a60 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -673,15 +673,15 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
673 pci_bus_register_of_sysfs(child_bus); 673 pci_bus_register_of_sysfs(child_bus);
674} 674}
675 675
676struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) 676struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
677 struct device *parent)
677{ 678{
678 struct device_node *node = pbm->prom_node; 679 struct device_node *node = pbm->prom_node;
679 struct pci_bus *bus; 680 struct pci_bus *bus;
680 681
681 printk("PCI: Scanning PBM %s\n", node->full_name); 682 printk("PCI: Scanning PBM %s\n", node->full_name);
682 683
683 /* XXX parent device? XXX */ 684 bus = pci_create_bus(parent, pbm->pci_first_busno, pbm->pci_ops, pbm);
684 bus = pci_create_bus(NULL, pbm->pci_first_busno, pbm->pci_ops, pbm);
685 if (!bus) { 685 if (!bus) {
686 printk(KERN_ERR "Failed to create bus for %s\n", 686 printk(KERN_ERR "Failed to create bus for %s\n",
687 node->full_name); 687 node->full_name);
diff --git a/arch/sparc64/kernel/pci_fire.c b/arch/sparc64/kernel/pci_fire.c
index 4fb1ef92cb16..1b44153f9077 100644
--- a/arch/sparc64/kernel/pci_fire.c
+++ b/arch/sparc64/kernel/pci_fire.c
@@ -33,13 +33,6 @@
33 "i" (ASI_PHYS_BYPASS_EC_E) \ 33 "i" (ASI_PHYS_BYPASS_EC_E) \
34 : "memory") 34 : "memory")
35 35
36static void __init pci_fire_scan_bus(struct pci_pbm_info *pbm)
37{
38 pbm->pci_bus = pci_scan_one_pbm(pbm);
39
40 /* XXX register error interrupt handlers XXX */
41}
42
43#define FIRE_IOMMU_CONTROL 0x40000UL 36#define FIRE_IOMMU_CONTROL 0x40000UL
44#define FIRE_IOMMU_TSBBASE 0x40008UL 37#define FIRE_IOMMU_TSBBASE 0x40008UL
45#define FIRE_IOMMU_FLUSH 0x40100UL 38#define FIRE_IOMMU_FLUSH 0x40100UL
@@ -439,9 +432,10 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
439} 432}
440 433
441static int __init pci_fire_pbm_init(struct pci_controller_info *p, 434static int __init pci_fire_pbm_init(struct pci_controller_info *p,
442 struct device_node *dp, u32 portid) 435 struct of_device *op, u32 portid)
443{ 436{
444 const struct linux_prom64_registers *regs; 437 const struct linux_prom64_registers *regs;
438 struct device_node *dp = op->node;
445 struct pci_pbm_info *pbm; 439 struct pci_pbm_info *pbm;
446 int err; 440 int err;
447 441
@@ -483,7 +477,9 @@ static int __init pci_fire_pbm_init(struct pci_controller_info *p,
483 477
484 pci_fire_msi_init(pbm); 478 pci_fire_msi_init(pbm);
485 479
486 pci_fire_scan_bus(pbm); 480 pbm->pci_bus = pci_scan_one_pbm(pbm, &op->dev);
481
482 /* XXX register error interrupt handlers XXX */
487 483
488 return 0; 484 return 0;
489} 485}
@@ -508,7 +504,7 @@ static int __devinit fire_probe(struct of_device *op,
508 portid = of_getintprop_default(dp, "portid", 0xff); 504 portid = of_getintprop_default(dp, "portid", 0xff);
509 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) { 505 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
510 if (portid_compare(pbm->portid, portid)) 506 if (portid_compare(pbm->portid, portid))
511 return pci_fire_pbm_init(pbm->parent, dp, portid); 507 return pci_fire_pbm_init(pbm->parent, op, portid);
512 } 508 }
513 509
514 err = -ENOMEM; 510 err = -ENOMEM;
@@ -534,7 +530,7 @@ static int __devinit fire_probe(struct of_device *op,
534 530
535 p->pbm_B.iommu = iommu; 531 p->pbm_B.iommu = iommu;
536 532
537 return pci_fire_pbm_init(p, dp, portid); 533 return pci_fire_pbm_init(p, op, portid);
538 534
539out_free_iommu_A: 535out_free_iommu_A:
540 kfree(p->pbm_A.iommu); 536 kfree(p->pbm_A.iommu);
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 5ee84c5b9636..47db875d0236 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -803,11 +803,12 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
803 pci_config_write8(addr, 64); 803 pci_config_write8(addr, 64);
804} 804}
805 805
806static void __init psycho_scan_bus(struct pci_pbm_info *pbm) 806static void __init psycho_scan_bus(struct pci_pbm_info *pbm,
807 struct device *parent)
807{ 808{
808 pbm_config_busmastering(pbm); 809 pbm_config_busmastering(pbm);
809 pbm->is_66mhz_capable = 0; 810 pbm->is_66mhz_capable = 0;
810 pbm->pci_bus = pci_scan_one_pbm(pbm); 811 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
811 812
812 /* After the PCI bus scan is complete, we can register 813 /* After the PCI bus scan is complete, we can register
813 * the error interrupt handlers. 814 * the error interrupt handlers.
@@ -971,8 +972,9 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
971#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL 972#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL
972 973
973static void __init psycho_pbm_init(struct pci_controller_info *p, 974static void __init psycho_pbm_init(struct pci_controller_info *p,
974 struct device_node *dp, int is_pbm_a) 975 struct of_device *op, int is_pbm_a)
975{ 976{
977 struct device_node *dp = op->node;
976 struct property *prop; 978 struct property *prop;
977 struct pci_pbm_info *pbm; 979 struct pci_pbm_info *pbm;
978 980
@@ -1015,7 +1017,7 @@ static void __init psycho_pbm_init(struct pci_controller_info *p,
1015 1017
1016 psycho_pbm_strbuf_init(pbm, is_pbm_a); 1018 psycho_pbm_strbuf_init(pbm, is_pbm_a);
1017 1019
1018 psycho_scan_bus(pbm); 1020 psycho_scan_bus(pbm, &op->dev);
1019} 1021}
1020 1022
1021#define PSYCHO_CONFIGSPACE 0x001000000UL 1023#define PSYCHO_CONFIGSPACE 0x001000000UL
@@ -1042,7 +1044,7 @@ static int __devinit psycho_probe(struct of_device *op,
1042 1044
1043 if (p->pbm_A.portid == upa_portid) { 1045 if (p->pbm_A.portid == upa_portid) {
1044 is_pbm_a = (p->pbm_A.prom_node == NULL); 1046 is_pbm_a = (p->pbm_A.prom_node == NULL);
1045 psycho_pbm_init(p, dp, is_pbm_a); 1047 psycho_pbm_init(p, op, is_pbm_a);
1046 return 0; 1048 return 0;
1047 } 1049 }
1048 } 1050 }
@@ -1086,7 +1088,7 @@ static int __devinit psycho_probe(struct of_device *op,
1086 1088
1087 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000); 1089 is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000);
1088 1090
1089 psycho_pbm_init(p, dp, is_pbm_a); 1091 psycho_pbm_init(p, op, is_pbm_a);
1090 1092
1091 return 0; 1093 return 0;
1092 1094
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index eee8fdca3820..707d6d6130f7 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -634,7 +634,8 @@ static void apb_init(struct pci_bus *sabre_bus)
634 } 634 }
635} 635}
636 636
637static void __init sabre_scan_bus(struct pci_pbm_info *pbm) 637static void __init sabre_scan_bus(struct pci_pbm_info *pbm,
638 struct device *parent)
638{ 639{
639 static int once; 640 static int once;
640 641
@@ -662,7 +663,7 @@ static void __init sabre_scan_bus(struct pci_pbm_info *pbm)
662 } 663 }
663 once++; 664 once++;
664 665
665 pbm->pci_bus = pci_scan_one_pbm(pbm); 666 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
666 if (!pbm->pci_bus) 667 if (!pbm->pci_bus)
667 return; 668 return;
668 669
@@ -734,8 +735,10 @@ static int sabre_iommu_init(struct pci_pbm_info *pbm,
734} 735}
735 736
736static void __init sabre_pbm_init(struct pci_controller_info *p, 737static void __init sabre_pbm_init(struct pci_controller_info *p,
737 struct pci_pbm_info *pbm, struct device_node *dp) 738 struct pci_pbm_info *pbm, struct of_device *op)
738{ 739{
740 struct device_node *dp = op->node;
741
739 pbm->name = dp->full_name; 742 pbm->name = dp->full_name;
740 printk("%s: SABRE PCI Bus Module\n", pbm->name); 743 printk("%s: SABRE PCI Bus Module\n", pbm->name);
741 744
@@ -753,7 +756,7 @@ static void __init sabre_pbm_init(struct pci_controller_info *p,
753 756
754 pci_determine_mem_io_space(pbm); 757 pci_determine_mem_io_space(pbm);
755 758
756 sabre_scan_bus(pbm); 759 sabre_scan_bus(pbm, &op->dev);
757} 760}
758 761
759static int __devinit sabre_probe(struct of_device *op, 762static int __devinit sabre_probe(struct of_device *op,
@@ -873,7 +876,7 @@ static int __devinit sabre_probe(struct of_device *op,
873 /* 876 /*
874 * Look for APB underneath. 877 * Look for APB underneath.
875 */ 878 */
876 sabre_pbm_init(p, pbm, dp); 879 sabre_pbm_init(p, pbm, op);
877 return 0; 880 return 0;
878 881
879out_free_iommu: 882out_free_iommu:
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index bd7612aae17e..64904b180f49 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -1085,14 +1085,15 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
1085 pci_config_write8(addr, 64); 1085 pci_config_write8(addr, 64);
1086} 1086}
1087 1087
1088static void __devinit schizo_scan_bus(struct pci_pbm_info *pbm) 1088static void __devinit schizo_scan_bus(struct pci_pbm_info *pbm,
1089 struct device *parent)
1089{ 1090{
1090 pbm_config_busmastering(pbm); 1091 pbm_config_busmastering(pbm);
1091 pbm->is_66mhz_capable = 1092 pbm->is_66mhz_capable =
1092 (of_find_property(pbm->prom_node, "66mhz-capable", NULL) 1093 (of_find_property(pbm->prom_node, "66mhz-capable", NULL)
1093 != NULL); 1094 != NULL);
1094 1095
1095 pbm->pci_bus = pci_scan_one_pbm(pbm); 1096 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
1096 1097
1097 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) 1098 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO)
1098 tomatillo_register_error_handlers(pbm); 1099 tomatillo_register_error_handlers(pbm);
@@ -1338,10 +1339,11 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1338} 1339}
1339 1340
1340static int __devinit schizo_pbm_init(struct pci_controller_info *p, 1341static int __devinit schizo_pbm_init(struct pci_controller_info *p,
1341 struct device_node *dp, u32 portid, 1342 struct of_device *op, u32 portid,
1342 int chip_type) 1343 int chip_type)
1343{ 1344{
1344 const struct linux_prom64_registers *regs; 1345 const struct linux_prom64_registers *regs;
1346 struct device_node *dp = op->node;
1345 struct pci_pbm_info *pbm; 1347 struct pci_pbm_info *pbm;
1346 const char *chipset_name; 1348 const char *chipset_name;
1347 int is_pbm_a, err; 1349 int is_pbm_a, err;
@@ -1422,7 +1424,7 @@ static int __devinit schizo_pbm_init(struct pci_controller_info *p,
1422 1424
1423 schizo_pbm_strbuf_init(pbm); 1425 schizo_pbm_strbuf_init(pbm);
1424 1426
1425 schizo_scan_bus(pbm); 1427 schizo_scan_bus(pbm, &op->dev);
1426 1428
1427 return 0; 1429 return 0;
1428} 1430}
@@ -1437,8 +1439,9 @@ static inline int portid_compare(u32 x, u32 y, int chip_type)
1437 return (x == y); 1439 return (x == y);
1438} 1440}
1439 1441
1440static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_type) 1442static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type)
1441{ 1443{
1444 struct device_node *dp = op->node;
1442 struct pci_controller_info *p; 1445 struct pci_controller_info *p;
1443 struct pci_pbm_info *pbm; 1446 struct pci_pbm_info *pbm;
1444 struct iommu *iommu; 1447 struct iommu *iommu;
@@ -1450,7 +1453,7 @@ static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_ty
1450 err = -ENOMEM; 1453 err = -ENOMEM;
1451 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) { 1454 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
1452 if (portid_compare(pbm->portid, portid, chip_type)) { 1455 if (portid_compare(pbm->portid, portid, chip_type)) {
1453 if (schizo_pbm_init(pbm->parent, dp, 1456 if (schizo_pbm_init(pbm->parent, op,
1454 portid, chip_type)) 1457 portid, chip_type))
1455 goto out_err; 1458 goto out_err;
1456 return 0; 1459 return 0;
@@ -1479,7 +1482,7 @@ static int __devinit __schizo_init(struct device_node *dp, unsigned long chip_ty
1479 1482
1480 p->pbm_B.iommu = iommu; 1483 p->pbm_B.iommu = iommu;
1481 1484
1482 if (schizo_pbm_init(p, dp, portid, chip_type)) 1485 if (schizo_pbm_init(p, op, portid, chip_type))
1483 goto out_free_iommu_B; 1486 goto out_free_iommu_B;
1484 1487
1485 return 0; 1488 return 0;
@@ -1500,7 +1503,7 @@ out_err:
1500static int __devinit schizo_probe(struct of_device *op, 1503static int __devinit schizo_probe(struct of_device *op,
1501 const struct of_device_id *match) 1504 const struct of_device_id *match)
1502{ 1505{
1503 return __schizo_init(op->node, (unsigned long) match->data); 1506 return __schizo_init(op, (unsigned long) match->data);
1504} 1507}
1505 1508
1506/* The ordering of this table is very important. Some Tomatillo 1509/* The ordering of this table is very important. Some Tomatillo
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index 21864f065323..4839c503c88d 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -543,7 +543,8 @@ static const struct dma_ops sun4v_dma_ops = {
543 .sync_sg_for_cpu = dma_4v_sync_sg_for_cpu, 543 .sync_sg_for_cpu = dma_4v_sync_sg_for_cpu,
544}; 544};
545 545
546static void __init pci_sun4v_scan_bus(struct pci_pbm_info *pbm) 546static void __init pci_sun4v_scan_bus(struct pci_pbm_info *pbm,
547 struct device *parent)
547{ 548{
548 struct property *prop; 549 struct property *prop;
549 struct device_node *dp; 550 struct device_node *dp;
@@ -551,7 +552,7 @@ static void __init pci_sun4v_scan_bus(struct pci_pbm_info *pbm)
551 dp = pbm->prom_node; 552 dp = pbm->prom_node;
552 prop = of_find_property(dp, "66mhz-capable", NULL); 553 prop = of_find_property(dp, "66mhz-capable", NULL);
553 pbm->is_66mhz_capable = (prop != NULL); 554 pbm->is_66mhz_capable = (prop != NULL);
554 pbm->pci_bus = pci_scan_one_pbm(pbm); 555 pbm->pci_bus = pci_scan_one_pbm(pbm, parent);
555 556
556 /* XXX register error interrupt handlers XXX */ 557 /* XXX register error interrupt handlers XXX */
557} 558}
@@ -894,8 +895,9 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
894#endif /* !(CONFIG_PCI_MSI) */ 895#endif /* !(CONFIG_PCI_MSI) */
895 896
896static int __init pci_sun4v_pbm_init(struct pci_controller_info *p, 897static int __init pci_sun4v_pbm_init(struct pci_controller_info *p,
897 struct device_node *dp, u32 devhandle) 898 struct of_device *op, u32 devhandle)
898{ 899{
900 struct device_node *dp = op->node;
899 struct pci_pbm_info *pbm; 901 struct pci_pbm_info *pbm;
900 int err; 902 int err;
901 903
@@ -934,7 +936,7 @@ static int __init pci_sun4v_pbm_init(struct pci_controller_info *p,
934 936
935 pci_sun4v_msi_init(pbm); 937 pci_sun4v_msi_init(pbm);
936 938
937 pci_sun4v_scan_bus(pbm); 939 pci_sun4v_scan_bus(pbm, &op->dev);
938 940
939 return 0; 941 return 0;
940} 942}
@@ -979,7 +981,7 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
979 981
980 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) { 982 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
981 if (pbm->devhandle == (devhandle ^ 0x40)) { 983 if (pbm->devhandle == (devhandle ^ 0x40)) {
982 return pci_sun4v_pbm_init(pbm->parent, dp, devhandle); 984 return pci_sun4v_pbm_init(pbm->parent, op, devhandle);
983 } 985 }
984 } 986 }
985 987
@@ -1015,7 +1017,7 @@ static int __devinit pci_sun4v_probe(struct of_device *op,
1015 1017
1016 p->pbm_B.iommu = iommu; 1018 p->pbm_B.iommu = iommu;
1017 1019
1018 return pci_sun4v_pbm_init(p, dp, devhandle); 1020 return pci_sun4v_pbm_init(p, op, devhandle);
1019 1021
1020out_free_iommu_A: 1022out_free_iommu_A:
1021 kfree(p->pbm_A.iommu); 1023 kfree(p->pbm_A.iommu);