[RFC/PATCH 8/12] powerpc: Use FW_FEATURE_ISERIES in pci_64.c

Michael Ellerman michael at ellerman.id.au
Tue Jan 17 14:22:37 EST 2006


Convert from #ifdef ISERIES to FW_FEATURE_ISERIES tests in pci_64.c

 arch/powerpc/kernel/pci_64.c |   50 +++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 23 deletions(-)

Index: linux/arch/powerpc/kernel/pci_64.c
===================================================================
--- linux.orig/arch/powerpc/kernel/pci_64.c
+++ linux/arch/powerpc/kernel/pci_64.c
@@ -252,12 +252,14 @@ void pcibios_free_controller(struct pci_
 		kfree(phb);
 }
 
-#ifndef CONFIG_PPC_ISERIES
 void __devinit pcibios_claim_one_bus(struct pci_bus *b)
 {
 	struct pci_dev *dev;
 	struct pci_bus *child_bus;
 
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return;
+
 	list_for_each_entry(dev, &b->devices, bus_list) {
 		int i;
 
@@ -281,10 +283,12 @@ static void __init pcibios_claim_of_setu
 {
 	struct pci_bus *b;
 
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return;
+
 	list_for_each_entry(b, &pci_root_buses, node)
 		pcibios_claim_one_bus(b);
 }
-#endif
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
 static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
@@ -601,9 +605,8 @@ static int __init pcibios_init(void)
 	 */
 	ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
 
-#ifdef CONFIG_PPC_ISERIES
-	iSeries_pcibios_init(); 
-#endif
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		iSeries_pcibios_init();
 
 	printk("PCI: Probing PCI hardware\n");
 
@@ -611,15 +614,15 @@ static int __init pcibios_init(void)
 	list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
 		scan_phb(hose);
 
-#ifndef CONFIG_PPC_ISERIES
-	if (pci_probe_only)
-		pcibios_claim_of_setup();
-	else
+	if (!firmware_has_feature(FW_FEATURE_ISERIES)) {
 		/* FIXME: `else' will be removed when
-		   pci_assign_unassigned_resources() is able to work
-		   correctly with [partially] allocated PCI tree. */
-		pci_assign_unassigned_resources();
-#endif /* !CONFIG_PPC_ISERIES */
+		 pci_assign_unassigned_resources() is able to work
+		 correctly with [partially] allocated PCI tree. */
+		if (pci_probe_only)
+			pcibios_claim_of_setup();
+		else
+			pci_assign_unassigned_resources();
+	}
 
 	/* Call machine dependent final fixup */
 	if (ppc_md.pcibios_fixup)
@@ -682,13 +685,13 @@ int pcibios_enable_device(struct pci_dev
  */
 int pci_domain_nr(struct pci_bus *bus)
 {
-#ifdef CONFIG_PPC_ISERIES
-	return 0;
-#else
-	struct pci_controller *hose = pci_bus_to_host(bus);
+	struct pci_controller *hose;
 
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return 0;
+
+	hose = pci_bus_to_host(bus);
 	return hose->global_number;
-#endif
 }
 
 EXPORT_SYMBOL(pci_domain_nr);
@@ -696,12 +699,13 @@ EXPORT_SYMBOL(pci_domain_nr);
 /* Decide whether to display the domain number in /proc */
 int pci_proc_domain(struct pci_bus *bus)
 {
-#ifdef CONFIG_PPC_ISERIES
-	return 0;
-#else
-	struct pci_controller *hose = pci_bus_to_host(bus);
+	struct pci_controller *hose;
+
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return 0;
+
+	hose = pci_bus_to_host(bus);
 	return hose->buid;
-#endif
 }
 
 /*



More information about the Linuxppc64-dev mailing list