aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci_32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/pci_32.c')
-rw-r--r--arch/powerpc/kernel/pci_32.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index ae04f9418363..5b05a09a6bdf 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -669,6 +669,7 @@ pcibios_make_OF_bus_map(void)
669 int i; 669 int i;
670 struct pci_controller* hose; 670 struct pci_controller* hose;
671 struct property *map_prop; 671 struct property *map_prop;
672 struct device_node *dn;
672 673
673 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL); 674 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
674 if (!pci_to_OF_bus_map) { 675 if (!pci_to_OF_bus_map) {
@@ -690,12 +691,13 @@ pcibios_make_OF_bus_map(void)
690 continue; 691 continue;
691 make_one_node_map(node, hose->first_busno); 692 make_one_node_map(node, hose->first_busno);
692 } 693 }
693 map_prop = of_find_property(find_path_device("/"), 694 dn = of_find_node_by_path("/");
694 "pci-OF-bus-map", NULL); 695 map_prop = of_find_property(dn, "pci-OF-bus-map", NULL);
695 if (map_prop) { 696 if (map_prop) {
696 BUG_ON(pci_bus_count > map_prop->length); 697 BUG_ON(pci_bus_count > map_prop->length);
697 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); 698 memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count);
698 } 699 }
700 of_node_put(dn);
699#ifdef DEBUG 701#ifdef DEBUG
700 printk("PCI->OF bus map:\n"); 702 printk("PCI->OF bus map:\n");
701 for (i=0; i<pci_bus_count; i++) { 703 for (i=0; i<pci_bus_count; i++) {
@@ -1006,14 +1008,19 @@ void __init
1006pci_create_OF_bus_map(void) 1008pci_create_OF_bus_map(void)
1007{ 1009{
1008 struct property* of_prop; 1010 struct property* of_prop;
1009 1011 struct device_node *dn;
1012
1010 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256); 1013 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
1011 if (of_prop && find_path_device("/")) { 1014 if (!of_prop)
1015 return;
1016 dn = of_find_node_by_path("/");
1017 if (dn) {
1012 memset(of_prop, -1, sizeof(struct property) + 256); 1018 memset(of_prop, -1, sizeof(struct property) + 256);
1013 of_prop->name = "pci-OF-bus-map"; 1019 of_prop->name = "pci-OF-bus-map";
1014 of_prop->length = 256; 1020 of_prop->length = 256;
1015 of_prop->value = &of_prop[1]; 1021 of_prop->value = &of_prop[1];
1016 prom_add_property(find_path_device("/"), of_prop); 1022 prom_add_property(dn, of_prop);
1023 of_node_put(dn);
1017 } 1024 }
1018} 1025}
1019 1026