[PATCH] ppc64: pci cleanup

Anton Blanchard anton at samba.org
Sun Nov 14 17:10:36 EST 2004


Cleanup ppc64 pci code.

Signed-off-by: Anton Blanchard <anton at samba.org>

diff -puN arch/ppc64/kernel/iSeries_pci.c~pci1 arch/ppc64/kernel/iSeries_pci.c
--- gr_base/arch/ppc64/kernel/iSeries_pci.c~pci1	2004-11-12 04:50:33.577644518 -0600
+++ gr_base-anton/arch/ppc64/kernel/iSeries_pci.c	2004-11-12 04:50:33.624636852 -0600
@@ -292,7 +292,6 @@ void iSeries_pcibios_init(void)
 	iomm_table_initialize();
 	find_and_init_phbs();
 	io_page_mask = -1;
-	/* pci_assign_all_busses = 0;		SFRXXX*/
 	PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Exit.\n"); 
 }
 
diff -puN arch/ppc64/kernel/maple_pci.c~pci1 arch/ppc64/kernel/maple_pci.c
--- gr_base/arch/ppc64/kernel/maple_pci.c~pci1	2004-11-12 04:50:33.582643702 -0600
+++ gr_base-anton/arch/ppc64/kernel/maple_pci.c	2004-11-12 04:50:33.620637504 -0600
@@ -32,9 +32,6 @@
 #define DBG(x...)
 #endif
 
-extern int pci_probe_only;
-extern int pci_read_irq_line(struct pci_dev *pci_dev);
-
 static struct pci_controller *u3_agp, *u3_ht;
 
 static int __init fixup_one_level_bus_range(struct device_node *node, int higher)
@@ -377,7 +374,7 @@ void __init maple_pcibios_fixup(void)
 
 	DBG(" -> maple_pcibios_fixup\n");
 
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
+	for_each_pci_dev(dev)
 		pci_read_irq_line(dev);
 
 	/* Do the mapping of the IO space */
diff -puN arch/ppc64/kernel/pSeries_pci.c~pci1 arch/ppc64/kernel/pSeries_pci.c
--- gr_base/arch/ppc64/kernel/pSeries_pci.c~pci1	2004-11-12 04:50:33.587642887 -0600
+++ gr_base-anton/arch/ppc64/kernel/pSeries_pci.c	2004-11-12 04:50:33.622637178 -0600
@@ -26,7 +26,6 @@
 #include <linux/kernel.h>
 #include <linux/threads.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
@@ -37,7 +36,6 @@
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
-#include <asm/ppcdebug.h>
 #include <asm/naca.h>
 #include <asm/iommu.h>
 #include <asm/rtas.h>
@@ -53,7 +51,6 @@ static int ibm_write_pci_config;
 
 static int s7a_workaround;
 
-extern unsigned long pci_probe_only;
 extern struct mpic *pSeries_mpic;
 
 static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val)
@@ -248,17 +245,16 @@ static enum phb_types get_phb_type(struc
 	return type;
 }
 
-int get_phb_reg_prop(struct device_node *dev, unsigned int addr_size_words,
-		struct reg_property64 *reg)
+static int get_phb_reg_prop(struct device_node *dev,
+			    unsigned int addr_size_words,
+			    struct reg_property64 *reg)
 {
 	unsigned int *ui_ptr = NULL, len;
 
 	/* Found a PHB, now figure out where his registers are mapped. */
 	ui_ptr = (unsigned int *) get_property(dev, "reg", &len);
-	if (ui_ptr == NULL) {
-		PPCDBG(PPCDBG_PHBINIT, "\tget reg failed.\n"); 
+	if (ui_ptr == NULL)
 		return 1;
-	}
 
 	if (addr_size_words == 1) {
 		reg->address = ((struct reg_property32 *)ui_ptr)->address;
@@ -270,7 +266,8 @@ int get_phb_reg_prop(struct device_node 
 	return 0;
 }
 
-int phb_set_bus_ranges(struct device_node *dev, struct pci_controller *phb)
+static int phb_set_bus_ranges(struct device_node *dev,
+			      struct pci_controller *phb)
 {
 	int *bus_range;
 	unsigned int len;
diff -puN arch/ppc64/kernel/pci.c~pci1 arch/ppc64/kernel/pci.c
--- gr_base/arch/ppc64/kernel/pci.c~pci1	2004-11-12 04:50:33.593641908 -0600
+++ gr_base-anton/arch/ppc64/kernel/pci.c	2004-11-12 04:50:33.615638320 -0600
@@ -16,14 +16,9 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/init.h>
-#include <linux/capability.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/list.h>
 
@@ -33,11 +28,8 @@
 #include <asm/pci-bridge.h>
 #include <asm/byteorder.h>
 #include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/ppcdebug.h>
-#include <asm/naca.h>
-#include <asm/iommu.h>
 #include <asm/machdep.h>
+#include <asm/udbg.h>
 
 #include "pci.h"
 
@@ -50,8 +42,10 @@
 unsigned long pci_probe_only = 1;
 unsigned long pci_assign_all_buses = 0;
 
-/* legal IO pages under MAX_ISA_PORT.  This is to ensure we don't touch
-   devices we don't have access to. */
+/*
+ * legal IO pages under MAX_ISA_PORT.  This is to ensure we don't touch
+ * devices we don't have access to.
+ */
 unsigned long io_page_mask;
 
 EXPORT_SYMBOL(io_page_mask);
@@ -702,7 +696,7 @@ void __init pci_setup_phb_io(struct pci_
 	struct device_node *isa_dn;
 
 	hose->io_base_virt = reserve_phb_iospace(size);
-	PPCDBG(PPCDBG_PHBINIT, "phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
+	DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
 		hose->global_number, hose->io_base_phys,
 		(unsigned long) hose->io_base_virt);
 
@@ -733,7 +727,7 @@ void __devinit pci_setup_phb_io_dynamic(
 
 	hose->io_base_virt = __ioremap(hose->io_base_phys, size,
 					_PAGE_NO_CACHE);
-	PPCDBG(PPCDBG_PHBINIT, "phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
+	DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
 		hose->global_number, hose->io_base_phys,
 		(unsigned long) hose->io_base_virt);
 
@@ -833,13 +827,10 @@ void phbs_remap_io(void)
 }
 
 
-/*********************************************************************** 
- * pci_find_hose_for_OF_device
- *
+/*
  * This function finds the PHB that matching device_node in the 
  * OpenFirmware by scanning all the pci_controllers.
- * 
- ***********************************************************************/
+ */
 struct pci_controller* pci_find_hose_for_OF_device(struct device_node *node)
 {
 	while (node) {
@@ -972,44 +963,31 @@ void __devinit pcibios_fixup_bus(struct 
 }
 EXPORT_SYMBOL(pcibios_fixup_bus);
 
-/******************************************************************
- * pci_read_irq_line
- *
- * Reads the Interrupt Pin to determine if interrupt is use by card.
+/*
+ * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the 
  * openfirmware and sets it in the pci_dev and pci_config line.
- *
- ******************************************************************/
+ */
 int pci_read_irq_line(struct pci_dev *pci_dev)
 {
 	u8 intpin;
 	struct device_node *node;
 
     	pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &intpin);
-
-	if (intpin == 0) {
-		PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Interrupt used by device.\n",
-		       pci_name(pci_dev));
-		return 0;	
-	}
+	if (intpin == 0)
+		return 0;
 
 	node = pci_device_to_OF_node(pci_dev);
-	if (node == NULL) { 
-		PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s Device Node not found.\n",
-		       pci_name(pci_dev));
-		return -1;	
-	}
-	if (node->n_intrs == 0) 	{
-		PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s No Device OF interrupts defined.\n",
-		       pci_name(pci_dev));
-		return -1;	
-	}
+	if (node == NULL) 
+		return -1;
+
+	if (node->n_intrs == 0)
+		return -1;
+
 	pci_dev->irq = node->intrs[0].line;
 
 	pci_write_config_byte(pci_dev, PCI_INTERRUPT_LINE, pci_dev->irq);
-	
-	PPCDBG(PPCDBG_BUSWALK,"\tDevice: %s pci_dev->irq = 0x%02X\n",
-	       pci_name(pci_dev), pci_dev->irq);
+
 	return 0;
 }
 EXPORT_SYMBOL(pci_read_irq_line);
diff -puN arch/ppc64/kernel/pci.h~pci1 arch/ppc64/kernel/pci.h
--- gr_base/arch/ppc64/kernel/pci.h~pci1	2004-11-12 04:50:33.597641256 -0600
+++ gr_base-anton/arch/ppc64/kernel/pci.h	2004-11-12 04:50:33.616638157 -0600
@@ -25,16 +25,11 @@ extern void pci_setup_phb_io_dynamic(str
 extern struct list_head hose_list;
 extern int global_phb_number;
 
-/*******************************************************************
- * Platform functions that are brand specific implementation. 
- *******************************************************************/
 extern unsigned long find_and_init_phbs(void);
 
 extern struct pci_dev *ppc64_isabridge_dev;	/* may be NULL if no ISA bus */
 
-/*******************************************************************
- * PCI device_node operations
- *******************************************************************/
+/* PCI device_node operations */
 struct device_node;
 typedef void *(*traverse_func)(struct device_node *me, void *data);
 void *traverse_pci_devices(struct device_node *start, traverse_func pre,
@@ -55,5 +50,7 @@ void pci_addr_cache_remove_device(struct
 void init_pci_config_tokens (void);
 unsigned long get_phb_buid (struct device_node *);
 
+extern int pci_probe_only;
+extern int pci_read_irq_line(struct pci_dev *pci_dev);
 
 #endif /* __PPC_KERNEL_PCI_H__ */
diff -puN arch/ppc64/kernel/pmac_pci.c~pci1 arch/ppc64/kernel/pmac_pci.c
--- gr_base/arch/ppc64/kernel/pmac_pci.c~pci1	2004-11-12 04:50:33.603640277 -0600
+++ gr_base-anton/arch/ppc64/kernel/pmac_pci.c	2004-11-12 04:50:33.618637830 -0600
@@ -39,9 +39,6 @@
 #define DBG(x...)
 #endif
 
-extern int pci_probe_only;
-extern int pci_read_irq_line(struct pci_dev *pci_dev);
-
 /* XXX Could be per-controller, but I don't think we risk anything by
  * assuming we won't have both UniNorth and Bandit */
 static int has_uninorth;
_



More information about the Linuxppc64-dev mailing list