static void __init cell_add_phb(struct device_node *node, int index) { struct pci_controller *phb; struct resource r; phb = pcibios_alloc_controller(node); if (!phb) return; setup_phb(node, phb); if (of_address_to_resource(node, 0, &r) == 0) phb->buid = r.start; pci_process_bridge_OF_ranges(phb, node, 0); pci_setup_phb_io(phb, index == 0); }
struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn) { struct device_node *root = of_find_node_by_path("/"); unsigned int root_size_cells = 0; struct pci_controller *phb; int primary; root_size_cells = prom_n_size_cells(root); primary = list_empty(&hose_list); phb = pcibios_alloc_controller(dn); if (!phb) return NULL; setup_phb(dn, phb, root_size_cells); pci_process_bridge_OF_ranges(phb, dn, primary); pci_setup_phb_io_dynamic(phb, primary); of_node_put(root); pci_devs_phb_init_dynamic(phb); scan_phb(phb); return phb; }
unsigned long __init find_and_init_phbs(void) { struct device_node *node; struct pci_controller *phb; unsigned int root_size_cells = 0; unsigned int index; unsigned int *opprop = NULL; struct device_node *root = of_find_node_by_path("/"); if (ppc64_interrupt_controller == IC_OPEN_PIC) { opprop = (unsigned int *)get_property(root, "platform-open-pic", NULL); } root_size_cells = prom_n_size_cells(root); index = 0; for (node = of_get_next_child(root, NULL); node != NULL; node = of_get_next_child(root, node)) { if (node->type == NULL || strcmp(node->type, "pci") != 0) continue; phb = pcibios_alloc_controller(node); if (!phb) continue; setup_phb(node, phb, root_size_cells); pci_process_bridge_OF_ranges(phb, node, 0); pci_setup_phb_io(phb, index == 0); #ifdef CONFIG_PPC_PSERIES if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) { int addr = root_size_cells * (index + 2) - 1; mpic_assign_isu(pSeries_mpic, index, opprop[addr]); } #endif index++; } of_node_put(root); pci_devs_phb_init(); /* * pci_probe_only and pci_assign_all_buses can be set via properties * in chosen. */ if (of_chosen) { int *prop; prop = (int *)get_property(of_chosen, "linux,pci-probe-only", NULL); if (prop) pci_probe_only = *prop; prop = (int *)get_property(of_chosen, "linux,pci-assign-all-buses", NULL); if (prop) pci_assign_all_buses = *prop; } return 0; }