linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Powerpc PCI cleanups (mainly iSeries)
@ 2007-12-06  7:00 Stephen Rothwell
  2007-12-06  7:02 ` [PATCH 01/19] [POWERPC] clean up pci-bridge.h Stephen Rothwell
                   ` (23 more replies)
  0 siblings, 24 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06  7:00 UTC (permalink / raw)
  To: ppc-dev

Hi all,

I started out looking for ways to remove our dependencies on pci_dn and
got sidetracked into clening up the iSeries PCI code.  The intention of
the following set of patches is that there be no semantic changes
(mostly).

Overall diffstat looks like this:
 arch/powerpc/kernel/pci-common.c           |   31 +--
 arch/powerpc/kernel/pci_32.c               |    6 +-
 arch/powerpc/kernel/pci_64.c               |   40 +--
 arch/powerpc/kernel/pci_dn.c               |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
 arch/powerpc/platforms/iseries/pci.c       |  426 +++++++++++-----------------
 arch/powerpc/platforms/iseries/pci.h       |   20 +-
 arch/powerpc/platforms/iseries/setup.c     |    2 +
 arch/powerpc/platforms/iseries/vpdinfo.c   |   17 +-
 arch/powerpc/platforms/powermac/pci.c      |    2 +-
 arch/powerpc/platforms/pseries/iommu.c     |    2 +-
 include/asm-powerpc/pci-bridge.h           |  156 ++++------
 include/asm-powerpc/ppc-pci.h              |    3 -
 14 files changed, 266 insertions(+), 445 deletions(-)

This entire set sits on top of benh's "Make isa_mem_base common to 32 and
64 bits" and "Merge pci_process_bridge_OF_ranges" patches and my
"iommu_free_table doesn't need the device_node" and "pSeries: remove
dependency on pci_dn bussubno" patches posted earlier.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 01/19] [POWERPC] clean up pci-bridge.h
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
@ 2007-12-06  7:02 ` Stephen Rothwell
  2007-12-06  7:06 ` [PATCH 02/19] [POWERPC] consolidate pci_controller Stephen Rothwell
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06  7:02 UTC (permalink / raw)
  To: ppc-dev

No semantic changes.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/pci-bridge.h |   95 +++++++++++++++++---------------------
 1 files changed, 42 insertions(+), 53 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index bf217e1..f4afdc6 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -1,16 +1,17 @@
 #ifndef _ASM_POWERPC_PCI_BRIDGE_H
 #define _ASM_POWERPC_PCI_BRIDGE_H
 #ifdef __KERNEL__
-
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
 #include <linux/pci.h>
 #include <linux/list.h>
 #include <linux/ioport.h>
 
 #ifndef CONFIG_PPC64
-
-struct device_node;
-struct pci_controller;
-
 /*
  * Structure of a PCI controller (host bridge)
  */
@@ -52,11 +53,11 @@ struct pci_controller {
 	 *   set.
 	 *  BIG_ENDIAN - cfg_addr is a big endian register
 	 */
-#define PPC_INDIRECT_TYPE_SET_CFG_TYPE		(0x00000001)
-#define PPC_INDIRECT_TYPE_EXT_REG		(0x00000002)
-#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS	(0x00000004)
-#define PPC_INDIRECT_TYPE_NO_PCIE_LINK		(0x00000008)
-#define PPC_INDIRECT_TYPE_BIG_ENDIAN		(0x00000010)
+#define PPC_INDIRECT_TYPE_SET_CFG_TYPE		0x00000001
+#define PPC_INDIRECT_TYPE_EXT_REG		0x00000002
+#define PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS	0x00000004
+#define PPC_INDIRECT_TYPE_NO_PCIE_LINK		0x00000008
+#define PPC_INDIRECT_TYPE_BIG_ENDIAN		0x00000010
 	u32 indirect_type;
 
 	/* Currently, we limit ourselves to 1 IO range and 3 mem
@@ -82,18 +83,18 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)
 
 /* These are used for config access before all the PCI probing
    has been done. */
-int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn,
-			   int where, u8 *val);
-int early_read_config_word(struct pci_controller *hose, int bus, int dev_fn,
-			   int where, u16 *val);
-int early_read_config_dword(struct pci_controller *hose, int bus, int dev_fn,
-			    int where, u32 *val);
-int early_write_config_byte(struct pci_controller *hose, int bus, int dev_fn,
-			    int where, u8 val);
-int early_write_config_word(struct pci_controller *hose, int bus, int dev_fn,
-			    int where, u16 val);
-int early_write_config_dword(struct pci_controller *hose, int bus, int dev_fn,
-			     int where, u32 val);
+extern int early_read_config_byte(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u8 *val);
+extern int early_read_config_word(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u16 *val);
+extern int early_read_config_dword(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u32 *val);
+extern int early_write_config_byte(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u8 val);
+extern int early_write_config_word(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u16 val);
+extern int early_write_config_dword(struct pci_controller *hose, int bus,
+			int dev_fn, int where, u32 val);
 
 extern int early_find_capability(struct pci_controller *hose, int bus,
 				 int dev_fn, int cap);
@@ -105,15 +106,7 @@ extern void setup_grackle(struct pci_controller *hose);
 extern void __init update_bridge_resource(struct pci_dev *dev,
 					  struct resource *res);
 
-#else
-
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
+#else	/* CONFIG_PPC64 */
 
 /*
  * Structure of a PCI controller (host bridge)
@@ -160,8 +153,8 @@ struct pci_controller {
  * PCI stuff, for nodes representing PCI devices, pointed to
  * by device_node->data.
  */
-struct pci_controller;
 struct iommu_table;
+struct device_node;
 
 struct pci_dn {
 	int	busno;			/* pci bus number */
@@ -180,9 +173,9 @@ struct pci_dn {
 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
 	int	eeh_config_addr;
 	int	eeh_pe_config_addr; /* new-style partition endpoint address */
-	int 	eeh_check_count;	/* # times driver ignored error */
-	int 	eeh_freeze_count;	/* # times this device froze up. */
-	int 	eeh_false_positives;	/* # times this device reported #ff's */
+	int	eeh_check_count;	/* # times driver ignored error */
+	int	eeh_freeze_count;	/* # times this device froze up. */
+	int	eeh_false_positives;	/* # times this device reported #ff's */
 	u32	config_space[16];	/* saved PCI config space */
 #endif
 };
@@ -190,7 +183,7 @@ struct pci_dn {
 /* Get the pointer to a device_node's pci_dn */
 #define PCI_DN(dn)	((struct pci_dn *) (dn)->data)
 
-struct device_node *fetch_dev_dn(struct pci_dev *dev);
+extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
 
 /* Get a device_node from a pci_dev.  This code must be fast except
  * in the case where the sysdata is incorrect and needs to be fixed
@@ -228,14 +221,14 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
 }
 
 /** Find the bus corresponding to the indicated device node */
-struct pci_bus * pcibios_find_pci_bus(struct device_node *dn);
+extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn);
 
 /** Remove all of the PCI devices under this bus */
-void pcibios_remove_pci_devices(struct pci_bus *bus);
+extern void pcibios_remove_pci_devices(struct pci_bus *bus);
 
 /** Discover new pci devices under this bus, and add them */
-void pcibios_add_pci_devices(struct pci_bus * bus);
-void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus);
+extern void pcibios_add_pci_devices(struct pci_bus *bus);
+extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus);
 
 extern int pcibios_remove_root_bus(struct pci_controller *phb);
 
@@ -271,20 +264,18 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
 #define PHB_SET_NODE(PHB, NODE)		((PHB)->node = -1)
 #endif
 
-#endif /* CONFIG_PPC64 */
+#endif	/* CONFIG_PPC64 */
 
 /* Get the PCI host controller for an OF device */
-extern struct pci_controller*
-pci_find_hose_for_OF_device(struct device_node* node);
+extern struct pci_controller *pci_find_hose_for_OF_device(
+			struct device_node* node);
 
 /* Fill up host controller resources from the OF node */
-extern void
-pci_process_bridge_OF_ranges(struct pci_controller *hose,
-			   struct device_node *dev, int primary);
+extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
+			struct device_node *dev, int primary);
 
 /* Allocate & free a PCI host bridge structure */
-extern struct pci_controller *
-pcibios_alloc_controller(struct device_node *dev);
+extern struct pci_controller *pcibios_alloc_controller(struct device_node *dev);
 extern void pcibios_free_controller(struct pci_controller *phb);
 
 #ifdef CONFIG_PCI
@@ -299,9 +290,7 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
 {
 	return 0;
 }
-#endif
+#endif	/* CONFIG_PCI */
 
-
-
-#endif /* __KERNEL__ */
-#endif
+#endif	/* __KERNEL__ */
+#endif	/* _ASM_POWERPC_PCI_BRIDGE_H */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/19] [POWERPC] consolidate pci_controller
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
  2007-12-06  7:02 ` [PATCH 01/19] [POWERPC] clean up pci-bridge.h Stephen Rothwell
@ 2007-12-06  7:06 ` Stephen Rothwell
  2007-12-11  0:00   ` Stephen Rothwell
  2007-12-06 14:46 ` [PATCH 03/19] [POWERPC] iSeries: move find_Device_Node to avoid a forward declaration Stephen Rothwell
                   ` (21 subsequent siblings)
  23 siblings, 1 reply; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06  7:06 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/pci-bridge.h |   62 +++++++++++--------------------------
 1 files changed, 19 insertions(+), 43 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index f4afdc6..beb09b5 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -11,22 +11,29 @@
 #include <linux/list.h>
 #include <linux/ioport.h>
 
-#ifndef CONFIG_PPC64
 /*
  * Structure of a PCI controller (host bridge)
  */
 struct pci_controller {
 	struct pci_bus *bus;
 	char is_dynamic;
+#ifdef CONFIG_PPC64
+	int node;
+#endif
 	void *arch_data;
 	struct list_head list_node;
 	struct device *parent;
 
 	int first_busno;
 	int last_busno;
+#ifndef CONFIG_PPC64
 	int self_busno;
+#endif
 
 	void __iomem *io_base_virt;
+#ifdef CONFIG_PPC64
+	void *io_base_alloc;
+#endif
 	resource_size_t io_base_phys;
 
 	/* Some machines (PReP) have a non 1:1 mapping of
@@ -39,6 +46,7 @@ struct pci_controller {
 	volatile unsigned int __iomem *cfg_addr;
 	volatile void __iomem *cfg_data;
 
+#ifndef CONFIG_PPC64
 	/*
 	 * Used for variants of PCI indirect handling and possible quirks:
 	 *  SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
@@ -59,15 +67,24 @@ struct pci_controller {
 #define PPC_INDIRECT_TYPE_NO_PCIE_LINK		0x00000008
 #define PPC_INDIRECT_TYPE_BIG_ENDIAN		0x00000010
 	u32 indirect_type;
-
+#endif	/* !CONFIG_PPC64 */
 	/* Currently, we limit ourselves to 1 IO range and 3 mem
 	 * ranges since the common pci_bus structure can't handle more
 	 */
 	struct resource	io_resource;
 	struct resource mem_resources[3];
 	int global_number;		/* PCI domain number */
+#ifdef CONFIG_PPC64
+	unsigned long buid;
+	unsigned long dma_window_base_cur;
+	unsigned long dma_window_size;
+
+	void *private_data;
+#endif	/* CONFIG_PPC64 */
 };
 
+#ifndef CONFIG_PPC64
+
 static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
 {
 	return bus->sysdata;
@@ -109,47 +126,6 @@ extern void __init update_bridge_resource(struct pci_dev *dev,
 #else	/* CONFIG_PPC64 */
 
 /*
- * Structure of a PCI controller (host bridge)
- */
-struct pci_controller {
-	struct pci_bus *bus;
-	char is_dynamic;
-	int node;
-	void *arch_data;
-	struct list_head list_node;
-	struct device *parent;
-
-	int first_busno;
-	int last_busno;
-
-	void __iomem *io_base_virt;
-	void *io_base_alloc;
-	resource_size_t io_base_phys;
-
-	/* Some machines have a non 1:1 mapping of
-	 * the PCI memory space in the CPU bus space
-	 */
-	resource_size_t pci_mem_offset;
-	unsigned long pci_io_size;
-
-	struct pci_ops *ops;
-	volatile unsigned int __iomem *cfg_addr;
-	volatile void __iomem *cfg_data;
-
-	/* Currently, we limit ourselves to 1 IO range and 3 mem
-	 * ranges since the common pci_bus structure can't handle more
-	 */
-	struct resource io_resource;
-	struct resource mem_resources[3];
-	int global_number;
-	unsigned long buid;
-	unsigned long dma_window_base_cur;
-	unsigned long dma_window_size;
-
-	void *private_data;
-};
-
-/*
  * PCI stuff, for nodes representing PCI devices, pointed to
  * by device_node->data.
  */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 03/19] [POWERPC] iSeries: move find_Device_Node to avoid a forward declaration
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
  2007-12-06  7:02 ` [PATCH 01/19] [POWERPC] clean up pci-bridge.h Stephen Rothwell
  2007-12-06  7:06 ` [PATCH 02/19] [POWERPC] consolidate pci_controller Stephen Rothwell
@ 2007-12-06 14:46 ` Stephen Rothwell
  2007-12-06 14:48 ` [PATCH 04/19] [POWERPC] iSeries: cleanup PCI retry code a little Stephen Rothwell
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:46 UTC (permalink / raw)
  To: ppc-dev

Also remove another unnecessary forward declaration.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   39 ++++++++++++++--------------------
 1 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index a74d1e1..e4e6ae0 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -45,16 +45,9 @@
 #include "pci.h"
 #include "call_pci.h"
 
-/*
- * Forward declares of prototypes.
- */
-static struct device_node *find_Device_Node(int bus, int devfn);
-
 static int Pci_Retry_Max = 3;	/* Only retry 3 times  */
 static int Pci_Error_Flag = 1;	/* Set Retry Error on. */
 
-static struct pci_ops iSeries_pci_ops;
-
 /*
  * Table defines
  * Each Entry size is 4 MB * 1024 Entries = 4GB I/O address space.
@@ -155,6 +148,22 @@ static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
 }
 
 /*
+ * Look down the chain to find the matching Device Device
+ */
+static struct device_node *find_Device_Node(int bus, int devfn)
+{
+	struct device_node *node;
+
+	for (node = NULL; (node = of_find_all_nodes(node)); ) {
+		struct pci_dn *pdn = PCI_DN(node);
+
+		if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
+			return node;
+	}
+	return NULL;
+}
+
+/*
  * iSeries_pci_final_fixup(void)
  */
 void __init iSeries_pci_final_fixup(void)
@@ -214,22 +223,6 @@ void __init iSeries_pci_final_fixup(void)
 	mf_display_src(0xC9000200);
 }
 
-/*
- * Look down the chain to find the matching Device Device
- */
-static struct device_node *find_Device_Node(int bus, int devfn)
-{
-	struct device_node *node;
-
-	for (node = NULL; (node = of_find_all_nodes(node)); ) {
-		struct pci_dn *pdn = PCI_DN(node);
-
-		if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn))
-			return node;
-	}
-	return NULL;
-}
-
 #if 0
 /*
  * Returns the device node for the passed pci_dev
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 04/19] [POWERPC] iSeries: cleanup PCI retry code a little
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (2 preceding siblings ...)
  2007-12-06 14:46 ` [PATCH 03/19] [POWERPC] iSeries: move find_Device_Node to avoid a forward declaration Stephen Rothwell
@ 2007-12-06 14:48 ` Stephen Rothwell
  2007-12-06 14:49 ` [PATCH 05/19] [POWERPC] iSeries: deCamelCase pci.c Stephen Rothwell
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:48 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index e4e6ae0..8ef3226 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -45,8 +45,8 @@
 #include "pci.h"
 #include "call_pci.h"
 
-static int Pci_Retry_Max = 3;	/* Only retry 3 times  */
-static int Pci_Error_Flag = 1;	/* Set Retry Error on. */
+#define PCI_RETRY_MAX	3
+static int limit_pci_retries = 1;	/* Set Retry Error on. */
 
 /*
  * Table defines
@@ -338,8 +338,8 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
 		 * Bump the retry and check for retry count exceeded.
 		 * If, Exceeded, panic the system.
 		 */
-		if (((*retry) > Pci_Retry_Max) &&
-				(Pci_Error_Flag > 0)) {
+		if (((*retry) > PCI_RETRY_MAX) &&
+				(limit_pci_retries > 0)) {
 			mf_display_src(0xB6000103);
 			panic_timeout = 0;
 			panic("PCI: Hardware I/O Error, SRC B6000103, "
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 05/19] [POWERPC] iSeries: deCamelCase pci.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (3 preceding siblings ...)
  2007-12-06 14:48 ` [PATCH 04/19] [POWERPC] iSeries: cleanup PCI retry code a little Stephen Rothwell
@ 2007-12-06 14:49 ` Stephen Rothwell
  2007-12-06 14:50 ` [PATCH 06/19] [POWERPC] iSeries: remove some dead code from pci.c Stephen Rothwell
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:49 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |  216 +++++++++++++++++-----------------
 1 files changed, 108 insertions(+), 108 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 8ef3226..705f52c 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -138,19 +138,19 @@ static void __init allocate_device_bars(struct pci_dev *dev)
  * PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx
  * PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx
  */
-static void pci_Log_Error(char *Error_Text, int Bus, int SubBus,
-		int AgentId, int HvRc)
+static void pci_log_error(char *error, int bus, int subbus,
+		int agent, int hv_res)
 {
-	if (HvRc == 0x0302)
+	if (hv_res == 0x0302)
 		return;
 	printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X",
-	       Error_Text, Bus, SubBus, AgentId, HvRc);
+	       error, bus, subbus, agent, hv_res);
 }
 
 /*
  * Look down the chain to find the matching Device Device
  */
-static struct device_node *find_Device_Node(int bus, int devfn)
+static struct device_node *find_device_node(int bus, int devfn)
 {
 	struct device_node *node;
 
@@ -170,14 +170,14 @@ void __init iSeries_pci_final_fixup(void)
 {
 	struct pci_dev *pdev = NULL;
 	struct device_node *node;
-	int DeviceCount = 0;
+	int num_dev = 0;
 
 	/* Fix up at the device node and pci_dev relationship */
 	mf_display_src(0xC9000100);
 
 	printk("pcibios_final_fixup\n");
 	for_each_pci_dev(pdev) {
-		node = find_Device_Node(pdev->bus->number, pdev->devfn);
+		node = find_device_node(pdev->bus->number, pdev->devfn);
 		printk("pci dev %p (%x.%x), node %p\n", pdev,
 		       pdev->bus->number, pdev->devfn, node);
 
@@ -194,7 +194,7 @@ void __init iSeries_pci_final_fixup(void)
 				err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
 						*agent, irq);
 				if (err)
-					pci_Log_Error("Connect Bus Unit",
+					pci_log_error("Connect Bus Unit",
 						pdn->busno, pdn->bussubno, *agent, err);
 				else {
 					err = HvCallPci_configStore8(pdn->busno, pdn->bussubno,
@@ -202,18 +202,18 @@ void __init iSeries_pci_final_fixup(void)
 							PCI_INTERRUPT_LINE,
 							irq);
 					if (err)
-						pci_Log_Error("PciCfgStore Irq Failed!",
+						pci_log_error("PciCfgStore Irq Failed!",
 							pdn->busno, pdn->bussubno, *agent, err);
 				}
 				if (!err)
 					pdev->irq = irq;
 			}
 
-			++DeviceCount;
+			++num_dev;
 			pdev->sysdata = (void *)node;
 			PCI_DN(node)->pcidev = pdev;
 			allocate_device_bars(pdev);
-			iSeries_Device_Information(pdev, DeviceCount);
+			iSeries_Device_Information(pdev, num_dev);
 			iommu_devnode_init_iSeries(pdev, node);
 		} else
 			printk("PCI: Device Tree not found for 0x%016lX\n",
@@ -229,13 +229,13 @@ void __init iSeries_pci_final_fixup(void)
  * Sanity Check Node PciDev to passed pci_dev
  * If none is found, returns a NULL which the client must handle.
  */
-static struct device_node *get_Device_Node(struct pci_dev *pdev)
+static struct device_node *get_device_node(struct pci_dev *pdev)
 {
 	struct device_node *node;
 
 	node = pdev->sysdata;
 	if (node == NULL || PCI_DN(node)->pcidev != pdev)
-		node = find_Device_Node(pdev->bus->number, pdev->devfn);
+		node = find_device_node(pdev->bus->number, pdev->devfn);
 	return node;
 }
 #endif
@@ -262,7 +262,7 @@ static u64 hv_cfg_write_func[4] = {
 static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 		int offset, int size, u32 *val)
 {
-	struct device_node *node = find_Device_Node(bus->number, devfn);
+	struct device_node *node = find_device_node(bus->number, devfn);
 	u64 fn;
 	struct HvCallPci_LoadReturn ret;
 
@@ -292,7 +292,7 @@ static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn,
 		int offset, int size, u32 val)
 {
-	struct device_node *node = find_Device_Node(bus->number, devfn);
+	struct device_node *node = find_device_node(bus->number, devfn);
 	u64 fn;
 	u64 ret;
 
@@ -324,15 +324,15 @@ static struct pci_ops iSeries_pci_ops = {
  * PCI: Device 23.90 ReadL Retry( 1)
  * PCI: Device 23.90 ReadL Retry Successful(1)
  */
-static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
+static int check_return_code(char *type, struct device_node *dn,
 		int *retry, u64 ret)
 {
 	if (ret != 0)  {
-		struct pci_dn *pdn = PCI_DN(DevNode);
+		struct pci_dn *pdn = PCI_DN(dn);
 
 		(*retry)++;
 		printk("PCI: %s: Device 0x%04X:%02X  I/O Error(%2d): 0x%04X\n",
-				TextHdr, pdn->busno, pdn->devfn,
+				type, pdn->busno, pdn->devfn,
 				*retry, (int)ret);
 		/*
 		 * Bump the retry and check for retry count exceeded.
@@ -356,28 +356,28 @@ static int CheckReturnCode(char *TextHdr, struct device_node *DevNode,
  * the exposure of being device global.
  */
 static inline struct device_node *xlate_iomm_address(
-		const volatile void __iomem *IoAddress,
-		u64 *dsaptr, u64 *BarOffsetPtr)
+		const volatile void __iomem *addr,
+		u64 *dsaptr, u64 *bar_offset)
 {
-	unsigned long OrigIoAddr;
-	unsigned long BaseIoAddr;
-	unsigned long TableIndex;
-	struct device_node *DevNode;
+	unsigned long orig_addr;
+	unsigned long base_addr;
+	unsigned long ind;
+	struct device_node *dn;
 
-	OrigIoAddr = (unsigned long __force)IoAddress;
-	if ((OrigIoAddr < BASE_IO_MEMORY) || (OrigIoAddr >= max_io_memory))
+	orig_addr = (unsigned long __force)addr;
+	if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory))
 		return NULL;
-	BaseIoAddr = OrigIoAddr - BASE_IO_MEMORY;
-	TableIndex = BaseIoAddr / IOMM_TABLE_ENTRY_SIZE;
-	DevNode = iomm_table[TableIndex];
-
-	if (DevNode != NULL) {
-		int barnum = iobar_table[TableIndex];
-		*dsaptr = iseries_ds_addr(DevNode) | (barnum << 24);
-		*BarOffsetPtr = BaseIoAddr % IOMM_TABLE_ENTRY_SIZE;
+	base_addr = orig_addr - BASE_IO_MEMORY;
+	ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
+	dn = iomm_table[ind];
+
+	if (dn != NULL) {
+		int barnum = iobar_table[ind];
+		*dsaptr = iseries_ds_addr(dn) | (barnum << 24);
+		*bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE;
 	} else
-		panic("PCI: Invalid PCI IoAddress detected!\n");
-	return DevNode;
+		panic("PCI: Invalid PCI IO address detected!\n");
+	return dn;
 }
 
 /*
@@ -385,16 +385,16 @@ static inline struct device_node *xlate_iomm_address(
  * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
  * else, data is returned in Big Endian format.
  */
-static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
+static u8 iSeries_read_byte(const volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -403,27 +403,27 @@ static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Read_Byte: invalid access at IO address %p\n",
-			       IoAddress);
+			printk(KERN_ERR "iSeries_read_byte: invalid access at IO address %p\n",
+			       addr);
 		return 0xff;
 	}
 	do {
-		HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, BarOffset, 0);
-	} while (CheckReturnCode("RDB", DevNode, &retry, ret.rc) != 0);
+		HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
+	} while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
 
 	return ret.value;
 }
 
-static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
+static u16 iSeries_read_word(const volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -432,28 +432,28 @@ static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Read_Word: invalid access at IO address %p\n",
-			       IoAddress);
+			printk(KERN_ERR "iSeries_read_word: invalid access at IO address %p\n",
+			       addr);
 		return 0xffff;
 	}
 	do {
 		HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
-				BarOffset, 0);
-	} while (CheckReturnCode("RDW", DevNode, &retry, ret.rc) != 0);
+				bar_offset, 0);
+	} while (check_return_code("RDW", dn, &retry, ret.rc) != 0);
 
 	return ret.value;
 }
 
-static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
+static u32 iSeries_read_long(const volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -462,14 +462,14 @@ static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Read_Long: invalid access at IO address %p\n",
-			       IoAddress);
+			printk(KERN_ERR "iSeries_read_long: invalid access at IO address %p\n",
+			       addr);
 		return 0xffffffff;
 	}
 	do {
 		HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
-				BarOffset, 0);
-	} while (CheckReturnCode("RDL", DevNode, &retry, ret.rc) != 0);
+				bar_offset, 0);
+	} while (check_return_code("RDL", dn, &retry, ret.rc) != 0);
 
 	return ret.value;
 }
@@ -478,16 +478,16 @@ static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress)
  * Write MM I/O Instructions for the iSeries
  *
  */
-static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
+static void iSeries_write_byte(u8 data, volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	u64 rc;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -496,24 +496,24 @@ static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Write_Byte: invalid access at IO address %p\n", IoAddress);
+			printk(KERN_ERR "iSeries_write_byte: invalid access at IO address %p\n", addr);
 		return;
 	}
 	do {
-		rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0);
-	} while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0);
+		rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0);
+	} while (check_return_code("WWB", dn, &retry, rc) != 0);
 }
 
-static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
+static void iSeries_write_word(u16 data, volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	u64 rc;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -522,25 +522,25 @@ static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Write_Word: invalid access at IO address %p\n",
-			       IoAddress);
+			printk(KERN_ERR "iSeries_write_word: invalid access at IO address %p\n",
+			       addr);
 		return;
 	}
 	do {
-		rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, data, 0);
-	} while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0);
+		rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0);
+	} while (check_return_code("WWW", dn, &retry, rc) != 0);
 }
 
-static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
+static void iSeries_write_long(u32 data, volatile void __iomem *addr)
 {
-	u64 BarOffset;
+	u64 bar_offset;
 	u64 dsa;
 	int retry = 0;
 	u64 rc;
-	struct device_node *DevNode =
-		xlate_iomm_address(IoAddress, &dsa, &BarOffset);
+	struct device_node *dn =
+		xlate_iomm_address(addr, &dsa, &bar_offset);
 
-	if (DevNode == NULL) {
+	if (dn == NULL) {
 		static unsigned long last_jiffies;
 		static int num_printed;
 
@@ -549,63 +549,63 @@ static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress)
 			num_printed = 0;
 		}
 		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_Write_Long: invalid access at IO address %p\n",
-			       IoAddress);
+			printk(KERN_ERR "iSeries_write_long: invalid access at IO address %p\n",
+			       addr);
 		return;
 	}
 	do {
-		rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, data, 0);
-	} while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0);
+		rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0);
+	} while (check_return_code("WWL", dn, &retry, rc) != 0);
 }
 
 static u8 iseries_readb(const volatile void __iomem *addr)
 {
-	return iSeries_Read_Byte(addr);
+	return iSeries_read_byte(addr);
 }
 
 static u16 iseries_readw(const volatile void __iomem *addr)
 {
-	return le16_to_cpu(iSeries_Read_Word(addr));
+	return le16_to_cpu(iSeries_read_word(addr));
 }
 
 static u32 iseries_readl(const volatile void __iomem *addr)
 {
-	return le32_to_cpu(iSeries_Read_Long(addr));
+	return le32_to_cpu(iSeries_read_long(addr));
 }
 
 static u16 iseries_readw_be(const volatile void __iomem *addr)
 {
-	return iSeries_Read_Word(addr);
+	return iSeries_read_word(addr);
 }
 
 static u32 iseries_readl_be(const volatile void __iomem *addr)
 {
-	return iSeries_Read_Long(addr);
+	return iSeries_read_long(addr);
 }
 
 static void iseries_writeb(u8 data, volatile void __iomem *addr)
 {
-	iSeries_Write_Byte(data, addr);
+	iSeries_write_byte(data, addr);
 }
 
 static void iseries_writew(u16 data, volatile void __iomem *addr)
 {
-	iSeries_Write_Word(cpu_to_le16(data), addr);
+	iSeries_write_word(cpu_to_le16(data), addr);
 }
 
 static void iseries_writel(u32 data, volatile void __iomem *addr)
 {
-	iSeries_Write_Long(cpu_to_le32(data), addr);
+	iSeries_write_long(cpu_to_le32(data), addr);
 }
 
 static void iseries_writew_be(u16 data, volatile void __iomem *addr)
 {
-	iSeries_Write_Word(data, addr);
+	iSeries_write_word(data, addr);
 }
 
 static void iseries_writel_be(u32 data, volatile void __iomem *addr)
 {
-	iSeries_Write_Long(data, addr);
+	iSeries_write_long(data, addr);
 }
 
 static void iseries_readsb(const volatile void __iomem *addr, void *buf,
@@ -613,7 +613,7 @@ static void iseries_readsb(const volatile void __iomem *addr, void *buf,
 {
 	u8 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_Read_Byte(addr);
+		*(dst++) = iSeries_read_byte(addr);
 }
 
 static void iseries_readsw(const volatile void __iomem *addr, void *buf,
@@ -621,7 +621,7 @@ static void iseries_readsw(const volatile void __iomem *addr, void *buf,
 {
 	u16 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_Read_Word(addr);
+		*(dst++) = iSeries_read_word(addr);
 }
 
 static void iseries_readsl(const volatile void __iomem *addr, void *buf,
@@ -629,7 +629,7 @@ static void iseries_readsl(const volatile void __iomem *addr, void *buf,
 {
 	u32 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_Read_Long(addr);
+		*(dst++) = iSeries_read_long(addr);
 }
 
 static void iseries_writesb(volatile void __iomem *addr, const void *buf,
@@ -637,7 +637,7 @@ static void iseries_writesb(volatile void __iomem *addr, const void *buf,
 {
 	const u8 *src = buf;
 	while(count-- > 0)
-		iSeries_Write_Byte(*(src++), addr);
+		iSeries_write_byte(*(src++), addr);
 }
 
 static void iseries_writesw(volatile void __iomem *addr, const void *buf,
@@ -645,7 +645,7 @@ static void iseries_writesw(volatile void __iomem *addr, const void *buf,
 {
 	const u16 *src = buf;
 	while(count-- > 0)
-		iSeries_Write_Word(*(src++), addr);
+		iSeries_write_word(*(src++), addr);
 }
 
 static void iseries_writesl(volatile void __iomem *addr, const void *buf,
@@ -653,7 +653,7 @@ static void iseries_writesl(volatile void __iomem *addr, const void *buf,
 {
 	const u32 *src = buf;
 	while(count-- > 0)
-		iSeries_Write_Long(*(src++), addr);
+		iSeries_write_long(*(src++), addr);
 }
 
 static void iseries_memset_io(volatile void __iomem *addr, int c,
@@ -662,7 +662,7 @@ static void iseries_memset_io(volatile void __iomem *addr, int c,
 	volatile char __iomem *d = addr;
 
 	while (n-- > 0)
-		iSeries_Write_Byte(c, d++);
+		iSeries_write_byte(c, d++);
 }
 
 static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
@@ -672,7 +672,7 @@ static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
 	const volatile char __iomem *s = src;
 
 	while (n-- > 0)
-		*d++ = iSeries_Read_Byte(s++);
+		*d++ = iSeries_read_byte(s++);
 }
 
 static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
@@ -682,7 +682,7 @@ static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
 	volatile char __iomem *d = dest;
 
 	while (n-- > 0)
-		iSeries_Write_Byte(*s++, d++);
+		iSeries_write_byte(*s++, d++);
 }
 
 /* We only set MMIO ops. The default PIO ops will be default
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 06/19] [POWERPC] iSeries: remove some dead code from pci.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (4 preceding siblings ...)
  2007-12-06 14:49 ` [PATCH 05/19] [POWERPC] iSeries: deCamelCase pci.c Stephen Rothwell
@ 2007-12-06 14:50 ` Stephen Rothwell
  2007-12-06 14:51 ` [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup Stephen Rothwell
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:50 UTC (permalink / raw)
  To: ppc-dev

and an unnecessary cast.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   19 +------------------
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 705f52c..cff832a 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -210,7 +210,7 @@ void __init iSeries_pci_final_fixup(void)
 			}
 
 			++num_dev;
-			pdev->sysdata = (void *)node;
+			pdev->sysdata = node;
 			PCI_DN(node)->pcidev = pdev;
 			allocate_device_bars(pdev);
 			iSeries_Device_Information(pdev, num_dev);
@@ -223,23 +223,6 @@ void __init iSeries_pci_final_fixup(void)
 	mf_display_src(0xC9000200);
 }
 
-#if 0
-/*
- * Returns the device node for the passed pci_dev
- * Sanity Check Node PciDev to passed pci_dev
- * If none is found, returns a NULL which the client must handle.
- */
-static struct device_node *get_device_node(struct pci_dev *pdev)
-{
-	struct device_node *node;
-
-	node = pdev->sysdata;
-	if (node == NULL || PCI_DN(node)->pcidev != pdev)
-		node = find_device_node(pdev->bus->number, pdev->devfn);
-	return node;
-}
-#endif
-
 /*
  * Config space read and write functions.
  * For now at least, we look for the device node for the bus and devfn
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (5 preceding siblings ...)
  2007-12-06 14:50 ` [PATCH 06/19] [POWERPC] iSeries: remove some dead code from pci.c Stephen Rothwell
@ 2007-12-06 14:51 ` Stephen Rothwell
  2007-12-06 18:33   ` Olof Johansson
  2007-12-06 14:52 ` [PATCH 08/19] [POWERPC] iSeries: consoldiate PCI IO error check Stephen Rothwell
                   ` (16 subsequent siblings)
  23 siblings, 1 reply; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:51 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   68 +++++++++++++++++----------------
 1 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index cff832a..8e2ac3d 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -177,47 +177,49 @@ void __init iSeries_pci_final_fixup(void)
 
 	printk("pcibios_final_fixup\n");
 	for_each_pci_dev(pdev) {
+		struct pci_dn *pdn;
+		const u32 *agent;
+
 		node = find_device_node(pdev->bus->number, pdev->devfn);
 		printk("pci dev %p (%x.%x), node %p\n", pdev,
 		       pdev->bus->number, pdev->devfn, node);
+		if (!node) {
+			printk("PCI: Device Tree not found for 0x%016lX\n",
+					(unsigned long)pdev);
+			continue;
+		}
 
-		if (node != NULL) {
-			struct pci_dn *pdn = PCI_DN(node);
-			const u32 *agent;
-
-			agent = of_get_property(node, "linux,agent-id", NULL);
-			if ((pdn != NULL) && (agent != NULL)) {
-				u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
-						pdn->bussubno);
-				int err;
-
-				err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
-						*agent, irq);
+		pdn = PCI_DN(node);
+		agent = of_get_property(node, "linux,agent-id", NULL);
+		if (pdn && agent) {
+			u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
+					pdn->bussubno);
+			int err;
+
+			err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
+					*agent, irq);
+			if (err)
+				pci_log_error("Connect Bus Unit",
+					pdn->busno, pdn->bussubno, *agent, err);
+			else {
+				err = HvCallPci_configStore8(pdn->busno,
+					pdn->bussubno, *agent,
+					PCI_INTERRUPT_LINE, irq);
 				if (err)
-					pci_log_error("Connect Bus Unit",
-						pdn->busno, pdn->bussubno, *agent, err);
-				else {
-					err = HvCallPci_configStore8(pdn->busno, pdn->bussubno,
-							*agent,
-							PCI_INTERRUPT_LINE,
-							irq);
-					if (err)
-						pci_log_error("PciCfgStore Irq Failed!",
-							pdn->busno, pdn->bussubno, *agent, err);
-				}
-				if (!err)
+					pci_log_error("PciCfgStore Irq Failed!",
+						pdn->busno, pdn->bussubno,
+						*agent, err);
+				else
 					pdev->irq = irq;
 			}
+		}
 
-			++num_dev;
-			pdev->sysdata = node;
-			PCI_DN(node)->pcidev = pdev;
-			allocate_device_bars(pdev);
-			iSeries_Device_Information(pdev, num_dev);
-			iommu_devnode_init_iSeries(pdev, node);
-		} else
-			printk("PCI: Device Tree not found for 0x%016lX\n",
-					(unsigned long)pdev);
+		num_dev++;
+		pdev->sysdata = node;
+		PCI_DN(node)->pcidev = pdev;
+		allocate_device_bars(pdev);
+		iSeries_Device_Information(pdev, num_dev);
+		iommu_devnode_init_iSeries(pdev, node);
 	}
 	iSeries_activate_IRQs();
 	mf_display_src(0xC9000200);
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 08/19] [POWERPC] iSeries: consoldiate PCI IO error check
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (6 preceding siblings ...)
  2007-12-06 14:51 ` [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup Stephen Rothwell
@ 2007-12-06 14:52 ` Stephen Rothwell
  2007-12-06 14:53 ` [PATCH 09/19] [POWERPC] iSeries: remove one layer of IO routines Stephen Rothwell
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:52 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |  105 ++++++++-------------------------
 1 files changed, 26 insertions(+), 79 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 8e2ac3d..105b23d 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -342,7 +342,7 @@ static int check_return_code(char *type, struct device_node *dn,
  */
 static inline struct device_node *xlate_iomm_address(
 		const volatile void __iomem *addr,
-		u64 *dsaptr, u64 *bar_offset)
+		u64 *dsaptr, u64 *bar_offset, const char *func)
 {
 	unsigned long orig_addr;
 	unsigned long base_addr;
@@ -350,8 +350,20 @@ static inline struct device_node *xlate_iomm_address(
 	struct device_node *dn;
 
 	orig_addr = (unsigned long __force)addr;
-	if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory))
+	if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
+		static unsigned long last_jiffies;
+		static int num_printed;
+
+		if ((jiffies - last_jiffies) > 60 * HZ) {
+			last_jiffies = jiffies;
+			num_printed = 0;
+		}
+		if (num_printed++ < 10)
+			printk(KERN_ERR
+				"iSeries_%s: invalid access at IO address %p\n",
+				func, addr);
 		return NULL;
+	}
 	base_addr = orig_addr - BASE_IO_MEMORY;
 	ind = base_addr / IOMM_TABLE_ENTRY_SIZE;
 	dn = iomm_table[ind];
@@ -377,21 +389,10 @@ static u8 iSeries_read_byte(const volatile void __iomem *addr)
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
-
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
+		xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte");
 
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_read_byte: invalid access at IO address %p\n",
-			       addr);
+	if (dn == NULL)
 		return 0xff;
-	}
 	do {
 		HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0);
 	} while (check_return_code("RDB", dn, &retry, ret.rc) != 0);
@@ -406,21 +407,10 @@ static u16 iSeries_read_word(const volatile void __iomem *addr)
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
-
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
+		xlate_iomm_address(addr, &dsa, &bar_offset, "read_word");
 
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_read_word: invalid access at IO address %p\n",
-			       addr);
+	if (dn == NULL)
 		return 0xffff;
-	}
 	do {
 		HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa,
 				bar_offset, 0);
@@ -436,21 +426,10 @@ static u32 iSeries_read_long(const volatile void __iomem *addr)
 	int retry = 0;
 	struct HvCallPci_LoadReturn ret;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
-
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
+		xlate_iomm_address(addr, &dsa, &bar_offset, "read_long");
 
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_read_long: invalid access at IO address %p\n",
-			       addr);
+	if (dn == NULL)
 		return 0xffffffff;
-	}
 	do {
 		HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa,
 				bar_offset, 0);
@@ -470,20 +449,10 @@ static void iSeries_write_byte(u8 data, volatile void __iomem *addr)
 	int retry = 0;
 	u64 rc;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
+		xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte");
 
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
-
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_write_byte: invalid access at IO address %p\n", addr);
+	if (dn == NULL)
 		return;
-	}
 	do {
 		rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0);
 	} while (check_return_code("WWB", dn, &retry, rc) != 0);
@@ -496,21 +465,10 @@ static void iSeries_write_word(u16 data, volatile void __iomem *addr)
 	int retry = 0;
 	u64 rc;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
-
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
+		xlate_iomm_address(addr, &dsa, &bar_offset, "write_word");
 
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_write_word: invalid access at IO address %p\n",
-			       addr);
+	if (dn == NULL)
 		return;
-	}
 	do {
 		rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0);
 	} while (check_return_code("WWW", dn, &retry, rc) != 0);
@@ -523,21 +481,10 @@ static void iSeries_write_long(u32 data, volatile void __iomem *addr)
 	int retry = 0;
 	u64 rc;
 	struct device_node *dn =
-		xlate_iomm_address(addr, &dsa, &bar_offset);
+		xlate_iomm_address(addr, &dsa, &bar_offset, "write_long");
 
-	if (dn == NULL) {
-		static unsigned long last_jiffies;
-		static int num_printed;
-
-		if ((jiffies - last_jiffies) > 60 * HZ) {
-			last_jiffies = jiffies;
-			num_printed = 0;
-		}
-		if (num_printed++ < 10)
-			printk(KERN_ERR "iSeries_write_long: invalid access at IO address %p\n",
-			       addr);
+	if (dn == NULL)
 		return;
-	}
 	do {
 		rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0);
 	} while (check_return_code("WWL", dn, &retry, rc) != 0);
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 09/19] [POWERPC] iSeries: remove one layer of IO routines
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (7 preceding siblings ...)
  2007-12-06 14:52 ` [PATCH 08/19] [POWERPC] iSeries: consoldiate PCI IO error check Stephen Rothwell
@ 2007-12-06 14:53 ` Stephen Rothwell
  2007-12-06 14:54 ` [PATCH 10/19] [POWERPC] iSeries: remove pci_dn dependency from iSeries_Device_Information Stephen Rothwell
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:53 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   68 +++++++++------------------------
 1 files changed, 19 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 105b23d..8844d3e 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -382,7 +382,7 @@ static inline struct device_node *xlate_iomm_address(
  * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal
  * else, data is returned in Big Endian format.
  */
-static u8 iSeries_read_byte(const volatile void __iomem *addr)
+static u8 iseries_readb(const volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -400,7 +400,7 @@ static u8 iSeries_read_byte(const volatile void __iomem *addr)
 	return ret.value;
 }
 
-static u16 iSeries_read_word(const volatile void __iomem *addr)
+static u16 iseries_readw_be(const volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -419,7 +419,7 @@ static u16 iSeries_read_word(const volatile void __iomem *addr)
 	return ret.value;
 }
 
-static u32 iSeries_read_long(const volatile void __iomem *addr)
+static u32 iseries_readl_be(const volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -442,7 +442,7 @@ static u32 iSeries_read_long(const volatile void __iomem *addr)
  * Write MM I/O Instructions for the iSeries
  *
  */
-static void iSeries_write_byte(u8 data, volatile void __iomem *addr)
+static void iseries_writeb(u8 data, volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -458,7 +458,7 @@ static void iSeries_write_byte(u8 data, volatile void __iomem *addr)
 	} while (check_return_code("WWB", dn, &retry, rc) != 0);
 }
 
-static void iSeries_write_word(u16 data, volatile void __iomem *addr)
+static void iseries_writew_be(u16 data, volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -474,7 +474,7 @@ static void iSeries_write_word(u16 data, volatile void __iomem *addr)
 	} while (check_return_code("WWW", dn, &retry, rc) != 0);
 }
 
-static void iSeries_write_long(u32 data, volatile void __iomem *addr)
+static void iseries_writel_be(u32 data, volatile void __iomem *addr)
 {
 	u64 bar_offset;
 	u64 dsa;
@@ -490,54 +490,24 @@ static void iSeries_write_long(u32 data, volatile void __iomem *addr)
 	} while (check_return_code("WWL", dn, &retry, rc) != 0);
 }
 
-static u8 iseries_readb(const volatile void __iomem *addr)
-{
-	return iSeries_read_byte(addr);
-}
-
 static u16 iseries_readw(const volatile void __iomem *addr)
 {
-	return le16_to_cpu(iSeries_read_word(addr));
+	return le16_to_cpu(iseries_readw_be(addr));
 }
 
 static u32 iseries_readl(const volatile void __iomem *addr)
 {
-	return le32_to_cpu(iSeries_read_long(addr));
-}
-
-static u16 iseries_readw_be(const volatile void __iomem *addr)
-{
-	return iSeries_read_word(addr);
-}
-
-static u32 iseries_readl_be(const volatile void __iomem *addr)
-{
-	return iSeries_read_long(addr);
-}
-
-static void iseries_writeb(u8 data, volatile void __iomem *addr)
-{
-	iSeries_write_byte(data, addr);
+	return le32_to_cpu(iseries_readl_be(addr));
 }
 
 static void iseries_writew(u16 data, volatile void __iomem *addr)
 {
-	iSeries_write_word(cpu_to_le16(data), addr);
+	iseries_writew_be(cpu_to_le16(data), addr);
 }
 
 static void iseries_writel(u32 data, volatile void __iomem *addr)
 {
-	iSeries_write_long(cpu_to_le32(data), addr);
-}
-
-static void iseries_writew_be(u16 data, volatile void __iomem *addr)
-{
-	iSeries_write_word(data, addr);
-}
-
-static void iseries_writel_be(u32 data, volatile void __iomem *addr)
-{
-	iSeries_write_long(data, addr);
+	iseries_writel(cpu_to_le32(data), addr);
 }
 
 static void iseries_readsb(const volatile void __iomem *addr, void *buf,
@@ -545,7 +515,7 @@ static void iseries_readsb(const volatile void __iomem *addr, void *buf,
 {
 	u8 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_read_byte(addr);
+		*(dst++) = iseries_readb(addr);
 }
 
 static void iseries_readsw(const volatile void __iomem *addr, void *buf,
@@ -553,7 +523,7 @@ static void iseries_readsw(const volatile void __iomem *addr, void *buf,
 {
 	u16 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_read_word(addr);
+		*(dst++) = iseries_readw_be(addr);
 }
 
 static void iseries_readsl(const volatile void __iomem *addr, void *buf,
@@ -561,7 +531,7 @@ static void iseries_readsl(const volatile void __iomem *addr, void *buf,
 {
 	u32 *dst = buf;
 	while(count-- > 0)
-		*(dst++) = iSeries_read_long(addr);
+		*(dst++) = iseries_readl_be(addr);
 }
 
 static void iseries_writesb(volatile void __iomem *addr, const void *buf,
@@ -569,7 +539,7 @@ static void iseries_writesb(volatile void __iomem *addr, const void *buf,
 {
 	const u8 *src = buf;
 	while(count-- > 0)
-		iSeries_write_byte(*(src++), addr);
+		iseries_writeb(*(src++), addr);
 }
 
 static void iseries_writesw(volatile void __iomem *addr, const void *buf,
@@ -577,7 +547,7 @@ static void iseries_writesw(volatile void __iomem *addr, const void *buf,
 {
 	const u16 *src = buf;
 	while(count-- > 0)
-		iSeries_write_word(*(src++), addr);
+		iseries_writew_be(*(src++), addr);
 }
 
 static void iseries_writesl(volatile void __iomem *addr, const void *buf,
@@ -585,7 +555,7 @@ static void iseries_writesl(volatile void __iomem *addr, const void *buf,
 {
 	const u32 *src = buf;
 	while(count-- > 0)
-		iSeries_write_long(*(src++), addr);
+		iseries_writel_be(*(src++), addr);
 }
 
 static void iseries_memset_io(volatile void __iomem *addr, int c,
@@ -594,7 +564,7 @@ static void iseries_memset_io(volatile void __iomem *addr, int c,
 	volatile char __iomem *d = addr;
 
 	while (n-- > 0)
-		iSeries_write_byte(c, d++);
+		iseries_writeb(c, d++);
 }
 
 static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
@@ -604,7 +574,7 @@ static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src,
 	const volatile char __iomem *s = src;
 
 	while (n-- > 0)
-		*d++ = iSeries_read_byte(s++);
+		*d++ = iseries_readb(s++);
 }
 
 static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
@@ -614,7 +584,7 @@ static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src,
 	volatile char __iomem *d = dest;
 
 	while (n-- > 0)
-		iSeries_write_byte(*s++, d++);
+		iseries_writeb(*s++, d++);
 }
 
 /* We only set MMIO ops. The default PIO ops will be default
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 10/19] [POWERPC] iSeries: remove pci_dn dependency from iSeries_Device_Information
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (8 preceding siblings ...)
  2007-12-06 14:53 ` [PATCH 09/19] [POWERPC] iSeries: remove one layer of IO routines Stephen Rothwell
@ 2007-12-06 14:54 ` Stephen Rothwell
  2007-12-06 14:55 ` [PATCH 11/19] [POWERPC] iSeries: iseries_ds_addr is only used in pci.c Stephen Rothwell
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:54 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c     |    3 ++-
 arch/powerpc/platforms/iseries/pci.h     |    3 ++-
 arch/powerpc/platforms/iseries/vpdinfo.c |   17 ++---------------
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 8844d3e..3cf51c6 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -218,7 +218,8 @@ void __init iSeries_pci_final_fixup(void)
 		pdev->sysdata = node;
 		PCI_DN(node)->pcidev = pdev;
 		allocate_device_bars(pdev);
-		iSeries_Device_Information(pdev, num_dev);
+		iSeries_Device_Information(pdev, num_dev, pdn->busno,
+				pdn->bussubno);
 		iommu_devnode_init_iSeries(pdev, node);
 	}
 	iSeries_activate_IRQs();
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index 730986b..3cb18fa 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -58,7 +58,8 @@ static inline u64 iseries_ds_addr(struct device_node *node)
 			+ ((u64)0x10 << 32);
 }
 
-extern void	iSeries_Device_Information(struct pci_dev*, int);
+extern void	iSeries_Device_Information(struct pci_dev *PciDev, int count,
+			u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
 extern void	iSeries_pci_final_fixup(void);
 #else
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
index 9f83878..25dc0bb 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -31,7 +31,6 @@
 #include <asm/types.h>
 #include <asm/resource.h>
 #include <asm/abs_addr.h>
-#include <asm/pci-bridge.h>
 #include <asm/iseries/hv_types.h>
 
 #include "pci.h"
@@ -244,25 +243,13 @@ out_free:
  * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
  * controller
  */
-void __init iSeries_Device_Information(struct pci_dev *PciDev, int count)
+void __init iSeries_Device_Information(struct pci_dev *PciDev, int count,
+		u16 bus, HvSubBusNumber subbus)
 {
-	struct device_node *DevNode = PciDev->sysdata;
-	struct pci_dn *pdn;
-	u16 bus;
 	u8 frame = 0;
 	char card[4];
-	HvSubBusNumber subbus;
 	HvAgentId agent;
 
-	if (DevNode == NULL) {
-		printk("%d. PCI: iSeries_Device_Information DevNode is NULL\n",
-				count);
-		return;
-	}
-
-	pdn = PCI_DN(DevNode);
-	bus = pdn->busno;
-	subbus = pdn->bussubno;
 	agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
 			ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
 
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 11/19] [POWERPC] iSeries: iseries_ds_addr is only used in pci.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (9 preceding siblings ...)
  2007-12-06 14:54 ` [PATCH 10/19] [POWERPC] iSeries: remove pci_dn dependency from iSeries_Device_Information Stephen Rothwell
@ 2007-12-06 14:55 ` Stephen Rothwell
  2007-12-06 14:56 ` [PATCH 12/19] [POWERPC] iSeries: reduce dependence on pci_dn bussubno Stephen Rothwell
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:55 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   11 +++++++++++
 arch/powerpc/platforms/iseries/pci.h |   13 +------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 3cf51c6..b46d8c5 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -69,6 +69,17 @@ static const char pci_io_text[] = "iSeries PCI I/O";
 static DEFINE_SPINLOCK(iomm_table_lock);
 
 /*
+ * Generate a Direct Select Address for the Hypervisor
+ */
+static inline u64 iseries_ds_addr(struct device_node *node)
+{
+	struct pci_dn *pdn = PCI_DN(node);
+
+	return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
+			+ ((u64)0x10 << 32);
+}
+
+/*
  * iomm_table_allocate_entry
  *
  * Adds pci_dev entry in address translation table
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index 3cb18fa..3af9cf1 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -30,7 +30,7 @@
  * End Change Activity
  */
 
-#include <asm/pci-bridge.h>
+#include <asm/iseries/hv_types.h>
 
 struct pci_dev;				/* For Forward Reference */
 
@@ -47,17 +47,6 @@ struct pci_dev;				/* For Forward Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)		((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)	((subbus >> 2) & 0x7)
 
-/*
- * Generate a Direct Select Address for the Hypervisor
- */
-static inline u64 iseries_ds_addr(struct device_node *node)
-{
-	struct pci_dn *pdn = PCI_DN(node);
-
-	return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
-			+ ((u64)0x10 << 32);
-}
-
 extern void	iSeries_Device_Information(struct pci_dev *PciDev, int count,
 			u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 12/19] [POWERPC] iSeries: reduce dependence on pci_dn bussubno
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (10 preceding siblings ...)
  2007-12-06 14:55 ` [PATCH 11/19] [POWERPC] iSeries: iseries_ds_addr is only used in pci.c Stephen Rothwell
@ 2007-12-06 14:56 ` Stephen Rothwell
  2007-12-06 14:58 ` [PATCH 13/19] [POWERPC] iSeries: make pcibios_final_fixup not depend on pci_dn Stephen Rothwell
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:56 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index b46d8c5..7e00e35 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -190,6 +190,7 @@ void __init iSeries_pci_final_fixup(void)
 	for_each_pci_dev(pdev) {
 		struct pci_dn *pdn;
 		const u32 *agent;
+		const u32 *sub_bus;
 
 		node = find_device_node(pdev->bus->number, pdev->devfn);
 		printk("pci dev %p (%x.%x), node %p\n", pdev,
@@ -202,23 +203,23 @@ void __init iSeries_pci_final_fixup(void)
 
 		pdn = PCI_DN(node);
 		agent = of_get_property(node, "linux,agent-id", NULL);
-		if (pdn && agent) {
-			u8 irq = iSeries_allocate_IRQ(pdn->busno, 0,
-					pdn->bussubno);
+		sub_bus = of_get_property(node, "linux,subbus", NULL);
+		if (pdn && agent && sub_bus) {
+			u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, *sub_bus);
 			int err;
 
-			err = HvCallXm_connectBusUnit(pdn->busno, pdn->bussubno,
+			err = HvCallXm_connectBusUnit(pdn->busno, *sub_bus,
 					*agent, irq);
 			if (err)
 				pci_log_error("Connect Bus Unit",
-					pdn->busno, pdn->bussubno, *agent, err);
+					pdn->busno, *sub_bus, *agent, err);
 			else {
 				err = HvCallPci_configStore8(pdn->busno,
-					pdn->bussubno, *agent,
+					*sub_bus, *agent,
 					PCI_INTERRUPT_LINE, irq);
 				if (err)
 					pci_log_error("PciCfgStore Irq Failed!",
-						pdn->busno, pdn->bussubno,
+						pdn->busno, *sub_bus,
 						*agent, err);
 				else
 					pdev->irq = irq;
@@ -229,8 +230,7 @@ void __init iSeries_pci_final_fixup(void)
 		pdev->sysdata = node;
 		PCI_DN(node)->pcidev = pdev;
 		allocate_device_bars(pdev);
-		iSeries_Device_Information(pdev, num_dev, pdn->busno,
-				pdn->bussubno);
+		iSeries_Device_Information(pdev, num_dev, pdn->busno, *sub_bus);
 		iommu_devnode_init_iSeries(pdev, node);
 	}
 	iSeries_activate_IRQs();
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 13/19] [POWERPC] iSeries: make pcibios_final_fixup not depend on pci_dn
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (11 preceding siblings ...)
  2007-12-06 14:56 ` [PATCH 12/19] [POWERPC] iSeries: reduce dependence on pci_dn bussubno Stephen Rothwell
@ 2007-12-06 14:58 ` Stephen Rothwell
  2007-12-06 14:59 ` [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial Stephen Rothwell
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:58 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 7e00e35..4bcf446 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -188,39 +188,36 @@ void __init iSeries_pci_final_fixup(void)
 
 	printk("pcibios_final_fixup\n");
 	for_each_pci_dev(pdev) {
-		struct pci_dn *pdn;
 		const u32 *agent;
 		const u32 *sub_bus;
+		unsigned char bus = pdev->bus->number;
 
-		node = find_device_node(pdev->bus->number, pdev->devfn);
-		printk("pci dev %p (%x.%x), node %p\n", pdev,
-		       pdev->bus->number, pdev->devfn, node);
+		node = find_device_node(bus, pdev->devfn);
+		printk("pci dev %p (%x.%x), node %p\n", pdev, bus,
+			pdev->devfn, node);
 		if (!node) {
 			printk("PCI: Device Tree not found for 0x%016lX\n",
 					(unsigned long)pdev);
 			continue;
 		}
 
-		pdn = PCI_DN(node);
 		agent = of_get_property(node, "linux,agent-id", NULL);
 		sub_bus = of_get_property(node, "linux,subbus", NULL);
-		if (pdn && agent && sub_bus) {
-			u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, *sub_bus);
+		if (agent && sub_bus) {
+			u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus);
 			int err;
 
-			err = HvCallXm_connectBusUnit(pdn->busno, *sub_bus,
+			err = HvCallXm_connectBusUnit(bus, *sub_bus,
 					*agent, irq);
 			if (err)
 				pci_log_error("Connect Bus Unit",
-					pdn->busno, *sub_bus, *agent, err);
+					bus, *sub_bus, *agent, err);
 			else {
-				err = HvCallPci_configStore8(pdn->busno,
-					*sub_bus, *agent,
-					PCI_INTERRUPT_LINE, irq);
+				err = HvCallPci_configStore8(bus, *sub_bus,
+					*agent, PCI_INTERRUPT_LINE, irq);
 				if (err)
 					pci_log_error("PciCfgStore Irq Failed!",
-						pdn->busno, *sub_bus,
-						*agent, err);
+						bus, *sub_bus, *agent, err);
 				else
 					pdev->irq = irq;
 			}
@@ -230,7 +227,7 @@ void __init iSeries_pci_final_fixup(void)
 		pdev->sysdata = node;
 		PCI_DN(node)->pcidev = pdev;
 		allocate_device_bars(pdev);
-		iSeries_Device_Information(pdev, num_dev, pdn->busno, *sub_bus);
+		iSeries_Device_Information(pdev, num_dev, bus, *sub_bus);
 		iommu_devnode_init_iSeries(pdev, node);
 	}
 	iSeries_activate_IRQs();
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (12 preceding siblings ...)
  2007-12-06 14:58 ` [PATCH 13/19] [POWERPC] iSeries: make pcibios_final_fixup not depend on pci_dn Stephen Rothwell
@ 2007-12-06 14:59 ` Stephen Rothwell
  2007-12-11  0:02   ` Stephen Rothwell
  2007-12-06 15:00 ` [PATCH 15/19] [POWERPC] iSeries: call iSeries_pcibios_init from setup_arch Stephen Rothwell
                   ` (9 subsequent siblings)
  23 siblings, 1 reply; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 14:59 UTC (permalink / raw)
  To: ppc-dev

and it becomes clear that we should use zalloc_maybe_bootmem.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci-common.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 0bf969e..252dd1e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -54,27 +54,17 @@ static int global_phb_number;		/* Global phb counter */
 resource_size_t isa_mem_base    = 0;
 
 
-/*
- * pci_controller(phb) initialized common variables.
- */
-static void __devinit pci_setup_pci_controller(struct pci_controller *hose)
-{
-	memset(hose, 0, sizeof(struct pci_controller));
-
-	spin_lock(&hose_spinlock);
-	hose->global_number = global_phb_number++;
-	list_add_tail(&hose->list_node, &hose_list);
-	spin_unlock(&hose_spinlock);
-}
-
-struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
+struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
 	struct pci_controller *phb;
 
-	phb = alloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
+	phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
 	if (phb == NULL)
 		return NULL;
-	pci_setup_pci_controller(phb);
+	spin_lock(&hose_spinlock);
+	phb->global_number = global_phb_number++;
+	list_add_tail(&phb->list_node, &hose_list);
+	spin_unlock(&hose_spinlock);
 	phb->arch_data = dev;
 	phb->is_dynamic = mem_init_done;
 #ifdef CONFIG_PPC64
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 15/19] [POWERPC] iSeries: call iSeries_pcibios_init from setup_arch
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (13 preceding siblings ...)
  2007-12-06 14:59 ` [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial Stephen Rothwell
@ 2007-12-06 15:00 ` Stephen Rothwell
  2007-12-06 15:01 ` [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries Stephen Rothwell
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:00 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_64.c           |    3 ---
 arch/powerpc/platforms/iseries/pci.h   |    4 +++-
 arch/powerpc/platforms/iseries/setup.c |    2 ++
 include/asm-powerpc/ppc-pci.h          |    3 ---
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 13a3615..b58f091 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -519,9 +519,6 @@ static int __init pcibios_init(void)
 	 */
 	ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
 
-	if (firmware_has_feature(FW_FEATURE_ISERIES))
-		iSeries_pcibios_init();
-
 	printk(KERN_DEBUG "PCI: Probing PCI hardware\n");
 
 	/* Scan all of the recorded PCI controllers.  */
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index 3af9cf1..b142873 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -50,9 +50,11 @@ struct pci_dev;				/* For Forward Reference */
 extern void	iSeries_Device_Information(struct pci_dev *PciDev, int count,
 			u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
+extern void	iSeries_pcibios_init(void);
 extern void	iSeries_pci_final_fixup(void);
 #else
-static void	iSeries_pci_final_fixup(void) { }
+static inline void	iSeries_pcibios_init(void) { }
+static inline void	iSeries_pci_final_fixup(void) { }
 #endif
 
 #endif /* _PLATFORMS_ISERIES_PCI_H */
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 2175a71..5616219 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -495,6 +495,8 @@ static void __init iSeries_setup_arch(void)
 			itVpdAreas.xSlicMaxLogicalProcs);
 	printk("Max physical processors = %d\n",
 			itVpdAreas.xSlicMaxPhysicalProcs);
+
+	iSeries_pcibios_init();
 }
 
 static void iSeries_show_cpuinfo(struct seq_file *m)
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index fda5e3d..854ab71 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -46,9 +46,6 @@ extern void init_pci_config_tokens (void);
 extern unsigned long get_phb_buid (struct device_node *);
 extern int rtas_setup_phb(struct pci_controller *phb);
 
-/* From iSeries PCI */
-extern void iSeries_pcibios_init(void);
-
 extern unsigned long pci_probe_only;
 
 /* ---- EEH internal-use-only related routines ---- */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (14 preceding siblings ...)
  2007-12-06 15:00 ` [PATCH 15/19] [POWERPC] iSeries: call iSeries_pcibios_init from setup_arch Stephen Rothwell
@ 2007-12-06 15:01 ` Stephen Rothwell
  2007-12-11  0:03   ` Stephen Rothwell
  2007-12-06 15:03 ` [PATCH 17/19] [POWERPC] remove some iSeries platform checks from the PCI code Stephen Rothwell
                   ` (7 subsequent siblings)
  23 siblings, 1 reply; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:01 UTC (permalink / raw)
  To: ppc-dev

so remove a firmware feature test.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_64.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index b58f091..42ff9c9 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -581,12 +581,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 /* Decide whether to display the domain number in /proc */
 int pci_proc_domain(struct pci_bus *bus)
 {
-	if (firmware_has_feature(FW_FEATURE_ISERIES))
-		return 0;
-	else {
-		struct pci_controller *hose = pci_bus_to_host(bus);
-		return hose->buid != 0;
-	}
+	struct pci_controller *hose = pci_bus_to_host(bus);
+	return hose->buid != 0;
 }
 
 
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 17/19] [POWERPC] remove some iSeries platform checks from the PCI code
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (15 preceding siblings ...)
  2007-12-06 15:01 ` [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries Stephen Rothwell
@ 2007-12-06 15:03 ` Stephen Rothwell
  2007-12-06 15:04 ` [PATCH 18/19] [POWERPC] Don't special case pci_domain_nr() for iSeries Stephen Rothwell
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:03 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_64.c         |   23 ++++++++---------------
 arch/powerpc/platforms/iseries/pci.c |    2 ++
 2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 42ff9c9..acf1219 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -31,7 +31,6 @@
 #include <asm/byteorder.h>
 #include <asm/machdep.h>
 #include <asm/ppc-pci.h>
-#include <asm/firmware.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
@@ -197,9 +196,6 @@ static void __init pcibios_claim_of_setup(void)
 {
 	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);
 }
@@ -477,8 +473,7 @@ void __devinit scan_phb(struct pci_controller *hose)
 	bus->secondary = hose->first_busno;
 	hose->bus = bus;
 
-	if (!firmware_has_feature(FW_FEATURE_ISERIES))
-		pcibios_map_io_space(bus);
+	pcibios_map_io_space(bus);
 
 	bus->resource[0] = res = &hose->io_resource;
 	if (res->flags && request_resource(&ioport_resource, res)) {
@@ -527,15 +522,13 @@ static int __init pcibios_init(void)
 		pci_bus_add_devices(hose->bus);
 	}
 
-	if (!firmware_has_feature(FW_FEATURE_ISERIES)) {
-		if (pci_probe_only)
-			pcibios_claim_of_setup();
-		else
-			/* FIXME: `else' will be removed when
-			   pci_assign_unassigned_resources() is able to work
-			   correctly with [partially] allocated PCI tree. */
-			pci_assign_unassigned_resources();
-	}
+	if (pci_probe_only)
+		pcibios_claim_of_setup();
+	else
+		/* FIXME: `else' will be removed when
+		   pci_assign_unassigned_resources() is able to work
+		   correctly with [partially] allocated PCI tree. */
+		pci_assign_unassigned_resources();
 
 	/* Call machine dependent final fixup */
 	if (ppc_md.pcibios_fixup)
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 4bcf446..db0a17e 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -646,6 +646,8 @@ void __init iSeries_pcibios_init(void)
 	/* Install IO hooks */
 	ppc_pci_io = iseries_pci_io;
 
+	pci_probe_only = 1;
+
 	/* iSeries has no IO space in the common sense, it needs to set
 	 * the IO base to 0
 	 */
-- 
1.5.3.7


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 18/19] [POWERPC] Don't special case pci_domain_nr() for iSeries
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (16 preceding siblings ...)
  2007-12-06 15:03 ` [PATCH 17/19] [POWERPC] remove some iSeries platform checks from the PCI code Stephen Rothwell
@ 2007-12-06 15:04 ` Stephen Rothwell
  2007-12-06 15:05 ` [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node * Stephen Rothwell
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:04 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci-common.c     |    9 ++-------
 arch/powerpc/platforms/iseries/pci.c |    2 ++
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 252dd1e..e0d4a2a 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -118,15 +118,10 @@ int pcibios_vaddr_is_ioport(void __iomem *address)
  */
 int pci_domain_nr(struct pci_bus *bus)
 {
-	if (firmware_has_feature(FW_FEATURE_ISERIES))
-		return 0;
-	else {
-		struct pci_controller *hose = pci_bus_to_host(bus);
+	struct pci_controller *hose = pci_bus_to_host(bus);
 
-		return hose->global_number;
-	}
+	return hose->global_number;
 }
-
 EXPORT_SYMBOL(pci_domain_nr);
 
 #ifdef CONFIG_PPC_OF
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index db0a17e..3071a30 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -673,6 +673,8 @@ void __init iSeries_pcibios_init(void)
 		phb = pcibios_alloc_controller(node);
 		if (phb == NULL)
 			continue;
+		/* All legacy iSeries PHBs are in domain zero */
+		phb->global_number = 0;
 
 		phb->pci_mem_offset = bus;
 		phb->first_busno = bus;
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (17 preceding siblings ...)
  2007-12-06 15:04 ` [PATCH 18/19] [POWERPC] Don't special case pci_domain_nr() for iSeries Stephen Rothwell
@ 2007-12-06 15:05 ` Stephen Rothwell
  2007-12-06 16:56   ` Jon Loeliger
  2007-12-09  7:27   ` Benjamin Herrenschmidt
  2007-12-06 15:07 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (4 subsequent siblings)
  23 siblings, 2 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:05 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_32.c               |    6 +++---
 arch/powerpc/kernel/pci_64.c               |    6 ++----
 arch/powerpc/kernel/pci_dn.c               |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
 arch/powerpc/platforms/powermac/pci.c      |    2 +-
 arch/powerpc/platforms/pseries/iommu.c     |    2 +-
 include/asm-powerpc/pci-bridge.h           |    5 +++--
 8 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e1151b5..3a05f4f 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -661,8 +661,8 @@ pcibios_make_OF_bus_map(void)
 
 	/* For each hose, we begin searching bridges */
 	list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
-		struct device_node* node;	
-		node = (struct device_node *)hose->arch_data;
+		struct device_node* node = hose->arch_data;
+
 		if (!node)
 			continue;
 		make_one_node_map(node, hose->first_busno);
@@ -813,7 +813,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
 	hose = pci_find_hose_for_OF_device(node);
 	if (!hose || !hose->arch_data)
 		return -ENODEV;
-	if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
+	if (!scan_OF_pci_childs(hose->arch_data->child,
 			find_OF_pci_device_filter, (void *)node))
 		return -ENODEV;
 	reg = of_get_property(node, "reg", NULL);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index acf1219..b452031 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -612,8 +612,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
 	if (hose->io_base_alloc == 0)
 		return 0;
 
-	DBG("IO unmapping for PHB %s\n",
-	    ((struct device_node *)hose->arch_data)->full_name);
+	DBG("IO unmapping for PHB %s\n", hose->arch_data->full_name);
 	DBG("  alloc=0x%p\n", hose->io_base_alloc);
 
 	/* This is a PHB, we fully unmap the IO area */
@@ -672,8 +671,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
 	hose->io_base_virt = (void __iomem *)(area->addr +
 					      hose->io_base_phys - phys_page);
 
-	DBG("IO mapping for PHB %s\n",
-	    ((struct device_node *)hose->arch_data)->full_name);
+	DBG("IO mapping for PHB %s\n", hose->arch_data->full_name);
 	DBG("  phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
 	    hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
 	DBG("  size=0x%016lx (alloc=0x%016lx)\n",
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index b483903..f326e91 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -133,7 +133,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
  */
 void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
 {
-	struct device_node * dn = (struct device_node *) phb->arch_data;
+	struct device_node *dn = phb->arch_data;
 	struct pci_dn *pdn;
 
 	/* PHB nodes themselves must not match */
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 59c121a..d084829 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -123,7 +123,7 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 	struct device_node* node;
 	struct resource rsrc;
 
-	node = (struct device_node *)hose->arch_data;
+	node = hose->arch_data;
 	of_address_to_resource(node, 0, &rsrc);
 
 	if ((rsrc.start & 0xfffff) == primary_phb_addr) {
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 32a531a..49b2bee 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -116,7 +116,7 @@ static int mpc86xx_exclude_device(struct pci_controller *hose,
 	struct device_node* node;	
 	struct resource rsrc;
 
-	node = (struct device_node *)hose->arch_data;
+	node = hose->arch_data;
 	of_address_to_resource(node, 0, &rsrc);
 
 	if ((rsrc.start & 0xfffff) == 0x8000) {
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index ec49099..472f44b 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -778,7 +778,7 @@ static void __init setup_u4_pcie(struct pci_controller* hose)
 
 static void __init setup_u3_ht(struct pci_controller* hose)
 {
-	struct device_node *np = (struct device_node *)hose->arch_data;
+	struct device_node *np = hose->arch_data;
 	struct pci_controller *other = NULL;
 	int i, cur;
 
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index ebb9313..a446e0b 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -251,7 +251,7 @@ static void iommu_table_setparms(struct pci_controller *phb,
 	const unsigned long *basep;
 	const u32 *sizep;
 
-	node = (struct device_node *)phb->arch_data;
+	node = phb->arch_data;
 
 	basep = of_get_property(node, "linux,tce-base", NULL);
 	sizep = of_get_property(node, "linux,tce-size", NULL);
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index beb09b5..4bad3e7 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -11,6 +11,8 @@
 #include <linux/list.h>
 #include <linux/ioport.h>
 
+struct device_node;
+
 /*
  * Structure of a PCI controller (host bridge)
  */
@@ -20,7 +22,7 @@ struct pci_controller {
 #ifdef CONFIG_PPC64
 	int node;
 #endif
-	void *arch_data;
+	struct device_node *arch_data;
 	struct list_head list_node;
 	struct device *parent;
 
@@ -130,7 +132,6 @@ extern void __init update_bridge_resource(struct pci_dev *dev,
  * by device_node->data.
  */
 struct iommu_table;
-struct device_node;
 
 struct pci_dn {
 	int	busno;			/* pci bus number */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: Powerpc PCI cleanups (mainly iSeries)
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (18 preceding siblings ...)
  2007-12-06 15:05 ` [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node * Stephen Rothwell
@ 2007-12-06 15:07 ` Stephen Rothwell
  2007-12-06 15:44   ` Josh Boyer
  2007-12-07  5:08 ` [PATCH 1/3] [POWERPC] iSeries: DeCamelCase vpdinfo.c Stephen Rothwell
                   ` (3 subsequent siblings)
  23 siblings, 1 reply; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-06 15:07 UTC (permalink / raw)
  To: ppc-dev

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> I started out looking for ways to remove our dependencies on pci_dn and
> got sidetracked into clening up the iSeries PCI code.  The intention of
> the following set of patches is that there be no semantic changes
> (mostly).

Some of these will clearly conflict with Benh's PCI work.  We will sot
that out between us.  :-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Powerpc PCI cleanups (mainly iSeries)
  2007-12-06 15:07 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
@ 2007-12-06 15:44   ` Josh Boyer
  2007-12-09  7:29     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 35+ messages in thread
From: Josh Boyer @ 2007-12-06 15:44 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev

On Fri, 7 Dec 2007 02:07:26 +1100
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > I started out looking for ways to remove our dependencies on pci_dn and
> > got sidetracked into clening up the iSeries PCI code.  The intention of
> > the following set of patches is that there be no semantic changes
> > (mostly).
> 
> Some of these will clearly conflict with Benh's PCI work.  We will sot
> that out between us.  :-)

In the meantime...

My tree is going to carry BenH's patches since they're obviously
important to 4xx.  If these conflicts get sorted out soon, that would
be good :).  At some point I'm going to start sending stuff to Paul.

josh

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *
  2007-12-06 15:05 ` [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node * Stephen Rothwell
@ 2007-12-06 16:56   ` Jon Loeliger
  2007-12-09  7:27   ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 35+ messages in thread
From: Jon Loeliger @ 2007-12-06 16:56 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev

On Thu, 2007-12-06 at 09:05, Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  arch/powerpc/kernel/pci_32.c               |    6 +++---
>  arch/powerpc/kernel/pci_64.c               |    6 ++----
>  arch/powerpc/kernel/pci_dn.c               |    2 +-
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
>  arch/powerpc/platforms/powermac/pci.c      |    2 +-
>  arch/powerpc/platforms/pseries/iommu.c     |    2 +-
>  include/asm-powerpc/pci-bridge.h           |    5 +++--
>  8 files changed, 13 insertions(+), 14 deletions(-)

I see that 86xx tinkering, so...

Acked-by:  Jon Loeliger <jdl@freescale.com>

that.

Thanks,
jdl

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup
  2007-12-06 14:51 ` [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup Stephen Rothwell
@ 2007-12-06 18:33   ` Olof Johansson
  0 siblings, 0 replies; 35+ messages in thread
From: Olof Johansson @ 2007-12-06 18:33 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev

On Fri, Dec 07, 2007 at 01:51:48AM +1100, Stephen Rothwell wrote:
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  arch/powerpc/platforms/iseries/pci.c |   68 +++++++++++++++++----------------
>  1 files changed, 35 insertions(+), 33 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
> index cff832a..8e2ac3d 100644
> --- a/arch/powerpc/platforms/iseries/pci.c
> +++ b/arch/powerpc/platforms/iseries/pci.c
> @@ -177,47 +177,49 @@ void __init iSeries_pci_final_fixup(void)
>  
>  	printk("pcibios_final_fixup\n");
>  	for_each_pci_dev(pdev) {
> +		struct pci_dn *pdn;
> +		const u32 *agent;
> +
>  		node = find_device_node(pdev->bus->number, pdev->devfn);
>  		printk("pci dev %p (%x.%x), node %p\n", pdev,
>  		       pdev->bus->number, pdev->devfn, node);
> +		if (!node) {
> +			printk("PCI: Device Tree not found for 0x%016lX\n",
> +					(unsigned long)pdev);

Hi,

Care to add KERN_ levels, while you're touching it? (both printks above
lack them).


-Olof

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/3] [POWERPC] iSeries: DeCamelCase vpdinfo.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (19 preceding siblings ...)
  2007-12-06 15:07 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
@ 2007-12-07  5:08 ` Stephen Rothwell
  2007-12-07  5:09 ` [PATCH 2/3] [POWERPC] iSeries: clean up and simplify vdpinfo.c Stephen Rothwell
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-07  5:08 UTC (permalink / raw)
  To: ppc-dev

This is a purely mechanical transformation.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c     |    2 +-
 arch/powerpc/platforms/iseries/pci.h     |    2 +-
 arch/powerpc/platforms/iseries/vpdinfo.c |  188 +++++++++++++++---------------
 3 files changed, 95 insertions(+), 97 deletions(-)

These three follow on from the 19 I posted last night.

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 3071a30..5466975 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -227,7 +227,7 @@ void __init iSeries_pci_final_fixup(void)
 		pdev->sysdata = node;
 		PCI_DN(node)->pcidev = pdev;
 		allocate_device_bars(pdev);
-		iSeries_Device_Information(pdev, num_dev, bus, *sub_bus);
+		iseries_device_information(pdev, num_dev, bus, *sub_bus);
 		iommu_devnode_init_iSeries(pdev, node);
 	}
 	iSeries_activate_IRQs();
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index b142873..5f517cf 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -47,7 +47,7 @@ struct pci_dev;				/* For Forward Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)		((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)	((subbus >> 2) & 0x7)
 
-extern void	iSeries_Device_Information(struct pci_dev *PciDev, int count,
+extern void	iseries_device_information(struct pci_dev *pdev, int count,
 			u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
 extern void	iSeries_pcibios_init(void);
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
index 25dc0bb..f9415bf 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -44,113 +44,111 @@
 /*
  * Bus Vpd Tags
  */
-#define  VpdEndOfAreaTag   0x79
-#define  VpdIdStringTag    0x82
-#define  VpdVendorAreaTag  0x84
+#define VPD_END_OF_AREA		0x79
+#define VPD_ID_STRING		0x82
+#define VPD_VENDOR_AREA		0x84
 
 /*
  * Mfg Area Tags
  */
-#define  VpdFruFrameId    0x4649     // "FI"
-#define  VpdSlotMapFormat 0x4D46     // "MF"
-#define  VpdSlotMap       0x534D     // "SM"
+#define VPD_FRU_FRAME_ID	0x4649	/* "FI" */
+#define VPD_SLOT_MAP_FORMAT	0x4D46	/* "MF" */
+#define VPD_SLOT_MAP		0x534D	/* "SM" */
 
 /*
  * Structures of the areas
  */
-struct MfgVpdAreaStruct {
-	u16 Tag;
-	u8  TagLength;
-	u8  AreaData1;
-	u8  AreaData2;
+struct mfg_vpd_area {
+	u16	tag;
+	u8	length;
+	u8	data1;
+	u8	data2;
 };
-typedef struct MfgVpdAreaStruct MfgArea;
 #define MFG_ENTRY_SIZE   3
 
-struct SlotMapStruct {
-	u8   AgentId;
-	u8   SecondaryAgentId;
-	u8   PhbId;
-	char CardLocation[3];
-	char Parms[8];
-	char Reserved[2];
+struct slot_map {
+	u8	agent;
+	u8	secondary_agent;
+	u8	phb;
+	char	card_location[3];
+	char	parms[8];
+	char	reserved[2];
 };
-typedef struct SlotMapStruct SlotMap;
 #define SLOT_ENTRY_SIZE   16
 
 /*
  * Parse the Slot Area
  */
-static void __init iSeries_Parse_SlotArea(SlotMap *MapPtr, int MapLen,
-		HvAgentId agent, u8 *PhbId, char card[4])
+static void __init iseries_parse_slot_area(struct slot_map *map, int len,
+		HvAgentId agent, u8 *phb, char card[4])
 {
-	int SlotMapLen = MapLen;
-	SlotMap *SlotMapPtr = MapPtr;
+	int slot_map_len = len;
+	struct slot_map *slot_map = map;
 
 	/*
 	 * Parse Slot label until we find the one requested
 	 */
-	while (SlotMapLen > 0) {
-		if (SlotMapPtr->AgentId == agent) {
+	while (slot_map_len > 0) {
+		if (slot_map->agent == agent) {
 			/*
 			 * If Phb wasn't found, grab the entry first one found.
 			 */
-			if (*PhbId == 0xff)
-				*PhbId = SlotMapPtr->PhbId;
+			if (*phb == 0xff)
+				*phb = slot_map->phb;
 			/* Found it, extract the data. */
-			if (SlotMapPtr->PhbId == *PhbId) {
-				memcpy(card, &SlotMapPtr->CardLocation, 3);
+			if (slot_map->phb == *phb) {
+				memcpy(card, &slot_map->card_location, 3);
 				card[3]  = 0;
 				break;
 			}
 		}
 		/* Point to the next Slot */
-		SlotMapPtr = (SlotMap *)((char *)SlotMapPtr + SLOT_ENTRY_SIZE);
-		SlotMapLen -= SLOT_ENTRY_SIZE;
+		slot_map = (struct slot_map *)((char *)slot_map + SLOT_ENTRY_SIZE);
+		slot_map_len -= SLOT_ENTRY_SIZE;
 	}
 }
 
 /*
  * Parse the Mfg Area
  */
-static void __init iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
-		HvAgentId agent, u8 *PhbId,
+static void __init iseries_parse_mfg_area(u8 *area, int len,
+		HvAgentId agent, u8 *phb,
 		u8 *frame, char card[4])
 {
-	MfgArea *MfgAreaPtr = (MfgArea *)AreaData;
-	int MfgAreaLen = AreaLen;
-	u16 SlotMapFmt = 0;
+	struct mfg_vpd_area *mfg_area = (struct mfg_vpd_area *)area;
+	int mfg_area_len = len;
+	u16 slot_map_fmt = 0;
 
 	/* Parse Mfg Data */
-	while (MfgAreaLen > 0) {
-		int MfgTagLen = MfgAreaPtr->TagLength;
+	while (mfg_area_len > 0) {
+		int mfg_tag_len = mfg_area->length;
 		/* Frame ID         (FI 4649020310 ) */
-		if (MfgAreaPtr->Tag == VpdFruFrameId)		/* FI  */
-			*frame = MfgAreaPtr->AreaData1;
+		if (mfg_area->tag == VPD_FRU_FRAME_ID)
+			*frame = mfg_area->data1;
 		/* Slot Map Format  (MF 4D46020004 ) */
-		else if (MfgAreaPtr->Tag == VpdSlotMapFormat)	/* MF  */
-			SlotMapFmt = (MfgAreaPtr->AreaData1 * 256)
-				+ MfgAreaPtr->AreaData2;
+		else if (mfg_area->tag == VPD_SLOT_MAP_FORMAT)
+			slot_map_fmt = (mfg_area->data1 * 256)
+				+ mfg_area->data2;
 		/* Slot Map         (SM 534D90 */
-		else if (MfgAreaPtr->Tag == VpdSlotMap)	{	/* SM  */
-			SlotMap *SlotMapPtr;
+		else if (mfg_area->tag == VPD_SLOT_MAP) {
+			struct slot_map *slot_map;
 
-			if (SlotMapFmt == 0x1004)
-				SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
+			if (slot_map_fmt == 0x1004)
+				slot_map = (struct slot_map *)((char *)mfg_area
 						+ MFG_ENTRY_SIZE + 1);
 			else
-				SlotMapPtr = (SlotMap *)((char *)MfgAreaPtr
+				slot_map = (struct slot_map *)((char *)mfg_area
 						+ MFG_ENTRY_SIZE);
-			iSeries_Parse_SlotArea(SlotMapPtr, MfgTagLen,
-					agent, PhbId, card);
+			iseries_parse_slot_area(slot_map, mfg_tag_len,
+					agent, phb, card);
 		}
 		/*
 		 * Point to the next Mfg Area
 		 * Use defined size, sizeof give wrong answer
 		 */
-		MfgAreaPtr = (MfgArea *)((char *)MfgAreaPtr + MfgTagLen
+		mfg_area = (struct mfg_vpd_area *)((char *)mfg_area + mfg_tag_len
 				+ MFG_ENTRY_SIZE);
-		MfgAreaLen -= (MfgTagLen + MFG_ENTRY_SIZE);
+		mfg_area_len -= (mfg_tag_len + MFG_ENTRY_SIZE);
 	}
 }
 
@@ -158,79 +156,79 @@ static void __init iSeries_Parse_MfgArea(u8 *AreaData, int AreaLen,
  * Look for "BUS".. Data is not Null terminated.
  * PHBID of 0xFF indicates PHB was not found in VPD Data.
  */
-static int __init iSeries_Parse_PhbId(u8 *AreaPtr, int AreaLength)
+static int __init iseries_parse_phbid(u8 *area, int len)
 {
-	u8 *PhbPtr = AreaPtr;
-	int DataLen = AreaLength;
-	char PhbId = 0xFF;
+	u8 *phb_ptr = area;
+	int data_len = len;
+	char phb = 0xFF;
 
-	while (DataLen > 0) {
-		if ((*PhbPtr == 'B') && (*(PhbPtr + 1) == 'U')
-				&& (*(PhbPtr + 2) == 'S')) {
-			PhbPtr += 3;
-			while (*PhbPtr == ' ')
-				++PhbPtr;
-			PhbId = (*PhbPtr & 0x0F);
+	while (data_len > 0) {
+		if ((*phb_ptr == 'B') && (*(phb_ptr + 1) == 'U')
+				&& (*(phb_ptr + 2) == 'S')) {
+			phb_ptr += 3;
+			while (*phb_ptr == ' ')
+				++phb_ptr;
+			phb = (*phb_ptr & 0x0F);
 			break;
 		}
-		++PhbPtr;
-		--DataLen;
+		++phb_ptr;
+		--data_len;
 	}
-	return PhbId;
+	return phb;
 }
 
 /*
  * Parse out the VPD Areas
  */
-static void __init iSeries_Parse_Vpd(u8 *VpdData, int VpdDataLen,
+static void __init iseries_parse_vpd(u8 *data, int vpd_data_len,
 		HvAgentId agent, u8 *frame, char card[4])
 {
-	u8 *TagPtr = VpdData;
-	int DataLen = VpdDataLen - 3;
-	u8 PhbId = 0xff;
+	u8 *tag_ptr = data;
+	int data_len = vpd_data_len - 3;
+	u8 phb = 0xff;
 
-	while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) {
-		int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256);
-		u8 *AreaData  = TagPtr + 3;
+	while ((*tag_ptr != VPD_END_OF_AREA) && (data_len > 0)) {
+		int len = *(tag_ptr + 1) + (*(tag_ptr + 2) * 256);
+		u8 *area  = tag_ptr + 3;
 
-		if (*TagPtr == VpdIdStringTag)
-			PhbId = iSeries_Parse_PhbId(AreaData, AreaLen);
-		else if (*TagPtr == VpdVendorAreaTag)
-			iSeries_Parse_MfgArea(AreaData, AreaLen,
-					agent, &PhbId, frame, card);
+		if (*tag_ptr == VPD_ID_STRING)
+			phb = iseries_parse_phbid(area, len);
+		else if (*tag_ptr == VPD_VENDOR_AREA)
+			iseries_parse_mfg_area(area, len,
+					agent, &phb, frame, card);
 		/* Point to next Area. */
-		TagPtr  = AreaData + AreaLen;
-		DataLen -= AreaLen;
+		tag_ptr  = area + len;
+		data_len -= len;
 	}
 }
 
-static int __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent,
+static int __init iseries_get_location_code(u16 bus, HvAgentId agent,
 		u8 *frame, char card[4])
 {
 	int status = 0;
-	int BusVpdLen = 0;
-	u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
+	int bus_vpd_len = 0;
+	u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
 
-	if (BusVpdPtr == NULL) {
+	if (bus_vpd == NULL) {
 		printk("PCI: Bus VPD Buffer allocation failure.\n");
 		return 0;
 	}
-	BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr),
+	bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd),
 					BUS_VPDSIZE);
-	if (BusVpdLen == 0) {
+	if (bus_vpd_len == 0) {
 		printk("PCI: Bus VPD Buffer zero length.\n");
 		goto out_free;
 	}
-	/* printk("PCI: BusVpdPtr: %p, %d\n",BusVpdPtr, BusVpdLen); */
+	/* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */
 	/* Make sure this is what I think it is */
-	if (*BusVpdPtr != VpdIdStringTag) {	/* 0x82 */
+	if (*bus_vpd != VPD_ID_STRING) {
 		printk("PCI: Bus VPD Buffer missing starting tag.\n");
 		goto out_free;
 	}
-	iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card);
+	iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card);
 	status = 1;
 out_free:
-	kfree(BusVpdPtr);
+	kfree(bus_vpd);
 	return status;
 }
 
@@ -243,7 +241,7 @@ out_free:
  * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
  * controller
  */
-void __init iSeries_Device_Information(struct pci_dev *PciDev, int count,
+void __init iseries_device_information(struct pci_dev *pdev, int count,
 		u16 bus, HvSubBusNumber subbus)
 {
 	u8 frame = 0;
@@ -253,10 +251,10 @@ void __init iSeries_Device_Information(struct pci_dev *PciDev, int count,
 	agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
 			ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
 
-	if (iSeries_Get_Location_Code(bus, agent, &frame, card)) {
+	if (iseries_get_location_code(bus, agent, &frame, card)) {
 		printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, "
 			"Card %4s  0x%04X\n", count, bus,
-			PCI_SLOT(PciDev->devfn), PciDev->vendor, frame,
-			card, (int)(PciDev->class >> 8));
+			PCI_SLOT(pdev->devfn), pdev->vendor, frame,
+			card, (int)(pdev->class >> 8));
 	}
 }
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/3] [POWERPC] iSeries: clean up and simplify vdpinfo.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (20 preceding siblings ...)
  2007-12-07  5:08 ` [PATCH 1/3] [POWERPC] iSeries: DeCamelCase vpdinfo.c Stephen Rothwell
@ 2007-12-07  5:09 ` Stephen Rothwell
  2007-12-07  5:10 ` [PATCH 3/3] [POWERPC] iSeries: merge vpdinfo.c intp pci.c Stephen Rothwell
  2007-12-11  0:06 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-07  5:09 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/vpdinfo.c |  100 ++++++++++++++----------------
 1 files changed, 46 insertions(+), 54 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
index f9415bf..aec82e3 100644
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ b/arch/powerpc/platforms/iseries/vpdinfo.c
@@ -82,62 +82,56 @@ struct slot_map {
 static void __init iseries_parse_slot_area(struct slot_map *map, int len,
 		HvAgentId agent, u8 *phb, char card[4])
 {
-	int slot_map_len = len;
-	struct slot_map *slot_map = map;
-
 	/*
 	 * Parse Slot label until we find the one requested
 	 */
-	while (slot_map_len > 0) {
-		if (slot_map->agent == agent) {
+	while (len > 0) {
+		if (map->agent == agent) {
 			/*
 			 * If Phb wasn't found, grab the entry first one found.
 			 */
 			if (*phb == 0xff)
-				*phb = slot_map->phb;
+				*phb = map->phb;
 			/* Found it, extract the data. */
-			if (slot_map->phb == *phb) {
-				memcpy(card, &slot_map->card_location, 3);
+			if (map->phb == *phb) {
+				memcpy(card, &map->card_location, 3);
 				card[3]  = 0;
 				break;
 			}
 		}
 		/* Point to the next Slot */
-		slot_map = (struct slot_map *)((char *)slot_map + SLOT_ENTRY_SIZE);
-		slot_map_len -= SLOT_ENTRY_SIZE;
+		map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
+		len -= SLOT_ENTRY_SIZE;
 	}
 }
 
 /*
  * Parse the Mfg Area
  */
-static void __init iseries_parse_mfg_area(u8 *area, int len,
-		HvAgentId agent, u8 *phb,
-		u8 *frame, char card[4])
+static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
+		HvAgentId agent, u8 *phb, u8 *frame, char card[4])
 {
-	struct mfg_vpd_area *mfg_area = (struct mfg_vpd_area *)area;
-	int mfg_area_len = len;
 	u16 slot_map_fmt = 0;
 
 	/* Parse Mfg Data */
-	while (mfg_area_len > 0) {
-		int mfg_tag_len = mfg_area->length;
+	while (len > 0) {
+		int mfg_tag_len = area->length;
 		/* Frame ID         (FI 4649020310 ) */
-		if (mfg_area->tag == VPD_FRU_FRAME_ID)
-			*frame = mfg_area->data1;
+		if (area->tag == VPD_FRU_FRAME_ID)
+			*frame = area->data1;
 		/* Slot Map Format  (MF 4D46020004 ) */
-		else if (mfg_area->tag == VPD_SLOT_MAP_FORMAT)
-			slot_map_fmt = (mfg_area->data1 * 256)
-				+ mfg_area->data2;
+		else if (area->tag == VPD_SLOT_MAP_FORMAT)
+			slot_map_fmt = (area->data1 * 256)
+				+ area->data2;
 		/* Slot Map         (SM 534D90 */
-		else if (mfg_area->tag == VPD_SLOT_MAP) {
+		else if (area->tag == VPD_SLOT_MAP) {
 			struct slot_map *slot_map;
 
 			if (slot_map_fmt == 0x1004)
-				slot_map = (struct slot_map *)((char *)mfg_area
+				slot_map = (struct slot_map *)((char *)area
 						+ MFG_ENTRY_SIZE + 1);
 			else
-				slot_map = (struct slot_map *)((char *)mfg_area
+				slot_map = (struct slot_map *)((char *)area
 						+ MFG_ENTRY_SIZE);
 			iseries_parse_slot_area(slot_map, mfg_tag_len,
 					agent, phb, card);
@@ -146,9 +140,9 @@ static void __init iseries_parse_mfg_area(u8 *area, int len,
 		 * Point to the next Mfg Area
 		 * Use defined size, sizeof give wrong answer
 		 */
-		mfg_area = (struct mfg_vpd_area *)((char *)mfg_area + mfg_tag_len
+		area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len
 				+ MFG_ENTRY_SIZE);
-		mfg_area_len -= (mfg_tag_len + MFG_ENTRY_SIZE);
+		len -= (mfg_tag_len + MFG_ENTRY_SIZE);
 	}
 }
 
@@ -156,48 +150,46 @@ static void __init iseries_parse_mfg_area(u8 *area, int len,
  * Look for "BUS".. Data is not Null terminated.
  * PHBID of 0xFF indicates PHB was not found in VPD Data.
  */
-static int __init iseries_parse_phbid(u8 *area, int len)
+static u8 __init iseries_parse_phbid(u8 *area, int len)
 {
-	u8 *phb_ptr = area;
-	int data_len = len;
-	char phb = 0xFF;
-
-	while (data_len > 0) {
-		if ((*phb_ptr == 'B') && (*(phb_ptr + 1) == 'U')
-				&& (*(phb_ptr + 2) == 'S')) {
-			phb_ptr += 3;
-			while (*phb_ptr == ' ')
-				++phb_ptr;
-			phb = (*phb_ptr & 0x0F);
-			break;
+	while (len > 0) {
+		if ((*area == 'B') && (*(area + 1) == 'U')
+				&& (*(area + 2) == 'S')) {
+			area += 3;
+			while (*area == ' ')
+				area++;
+			return *area & 0x0F;
 		}
-		++phb_ptr;
-		--data_len;
+		area++;
+		len--;
 	}
-	return phb;
+	return 0xff;
 }
 
 /*
  * Parse out the VPD Areas
  */
-static void __init iseries_parse_vpd(u8 *data, int vpd_data_len,
+static void __init iseries_parse_vpd(u8 *data, int data_len,
 		HvAgentId agent, u8 *frame, char card[4])
 {
-	u8 *tag_ptr = data;
-	int data_len = vpd_data_len - 3;
 	u8 phb = 0xff;
 
-	while ((*tag_ptr != VPD_END_OF_AREA) && (data_len > 0)) {
-		int len = *(tag_ptr + 1) + (*(tag_ptr + 2) * 256);
-		u8 *area  = tag_ptr + 3;
+	while (data_len > 0) {
+		int len;
+		u8 tag = *data;
 
-		if (*tag_ptr == VPD_ID_STRING)
-			phb = iseries_parse_phbid(area, len);
-		else if (*tag_ptr == VPD_VENDOR_AREA)
-			iseries_parse_mfg_area(area, len,
+		if (tag == VPD_END_OF_AREA)
+			break;
+		len = *(data + 1) + (*(data + 2) * 256);
+		data += 3;
+		data_len -= 3;
+		if (tag == VPD_ID_STRING)
+			phb = iseries_parse_phbid(data, len);
+		else if (tag == VPD_VENDOR_AREA)
+			iseries_parse_mfg_area((struct mfg_vpd_area *)data, len,
 					agent, &phb, frame, card);
 		/* Point to next Area. */
-		tag_ptr  = area + len;
+		data += len;
 		data_len -= len;
 	}
 }
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/3] [POWERPC] iSeries: merge vpdinfo.c intp pci.c
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (21 preceding siblings ...)
  2007-12-07  5:09 ` [PATCH 2/3] [POWERPC] iSeries: clean up and simplify vdpinfo.c Stephen Rothwell
@ 2007-12-07  5:10 ` Stephen Rothwell
  2007-12-11  0:06 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-07  5:10 UTC (permalink / raw)
  To: ppc-dev

There was only one global function in vpdinfo.c and it was only called
from pci.c, so merge them and make the function static.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/Makefile  |    2 +-
 arch/powerpc/platforms/iseries/pci.c     |  218 ++++++++++++++++++++++++++
 arch/powerpc/platforms/iseries/pci.h     |    6 -
 arch/powerpc/platforms/iseries/vpdinfo.c |  252 ------------------------------
 4 files changed, 219 insertions(+), 259 deletions(-)
 delete mode 100644 arch/powerpc/platforms/iseries/vpdinfo.c

diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index a65f1b4..cc7161f 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -5,7 +5,7 @@ extra-y += dt.o
 obj-y += exception.o
 obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
 	hvcall.o proc.o htab.o iommu.o misc.o irq.o
-obj-$(CONFIG_PCI) += pci.o vpdinfo.o
+obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_SMP) += smp.o
 obj-$(CONFIG_VIOPATH) += viopath.o vio.o
 obj-$(CONFIG_MODULES) += ksyms.o
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 5466975..68f248b 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2001 Allan Trautman, IBM Corporation
+ * Copyright (C) 2005,2007  Stephen Rothwell, IBM Corp
  *
  * iSeries specific routines for PCI.
  *
@@ -26,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 
+#include <asm/types.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/prom.h>
@@ -35,6 +37,7 @@
 #include <asm/abs_addr.h>
 #include <asm/firmware.h>
 
+#include <asm/iseries/hv_types.h>
 #include <asm/iseries/hv_call_xm.h>
 #include <asm/iseries/mf.h>
 #include <asm/iseries/iommu.h>
@@ -80,6 +83,221 @@ static inline u64 iseries_ds_addr(struct device_node *node)
 }
 
 /*
+ * Size of Bus VPD data
+ */
+#define BUS_VPDSIZE      1024
+
+/*
+ * Bus Vpd Tags
+ */
+#define VPD_END_OF_AREA		0x79
+#define VPD_ID_STRING		0x82
+#define VPD_VENDOR_AREA		0x84
+
+/*
+ * Mfg Area Tags
+ */
+#define VPD_FRU_FRAME_ID	0x4649	/* "FI" */
+#define VPD_SLOT_MAP_FORMAT	0x4D46	/* "MF" */
+#define VPD_SLOT_MAP		0x534D	/* "SM" */
+
+/*
+ * Structures of the areas
+ */
+struct mfg_vpd_area {
+	u16	tag;
+	u8	length;
+	u8	data1;
+	u8	data2;
+};
+#define MFG_ENTRY_SIZE   3
+
+struct slot_map {
+	u8	agent;
+	u8	secondary_agent;
+	u8	phb;
+	char	card_location[3];
+	char	parms[8];
+	char	reserved[2];
+};
+#define SLOT_ENTRY_SIZE   16
+
+/*
+ * Parse the Slot Area
+ */
+static void __init iseries_parse_slot_area(struct slot_map *map, int len,
+		HvAgentId agent, u8 *phb, char card[4])
+{
+	/*
+	 * Parse Slot label until we find the one requested
+	 */
+	while (len > 0) {
+		if (map->agent == agent) {
+			/*
+			 * If Phb wasn't found, grab the entry first one found.
+			 */
+			if (*phb == 0xff)
+				*phb = map->phb;
+			/* Found it, extract the data. */
+			if (map->phb == *phb) {
+				memcpy(card, &map->card_location, 3);
+				card[3]  = 0;
+				break;
+			}
+		}
+		/* Point to the next Slot */
+		map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
+		len -= SLOT_ENTRY_SIZE;
+	}
+}
+
+/*
+ * Parse the Mfg Area
+ */
+static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
+		HvAgentId agent, u8 *phb, u8 *frame, char card[4])
+{
+	u16 slot_map_fmt = 0;
+
+	/* Parse Mfg Data */
+	while (len > 0) {
+		int mfg_tag_len = area->length;
+		/* Frame ID         (FI 4649020310 ) */
+		if (area->tag == VPD_FRU_FRAME_ID)
+			*frame = area->data1;
+		/* Slot Map Format  (MF 4D46020004 ) */
+		else if (area->tag == VPD_SLOT_MAP_FORMAT)
+			slot_map_fmt = (area->data1 * 256)
+				+ area->data2;
+		/* Slot Map         (SM 534D90 */
+		else if (area->tag == VPD_SLOT_MAP) {
+			struct slot_map *slot_map;
+
+			if (slot_map_fmt == 0x1004)
+				slot_map = (struct slot_map *)((char *)area
+						+ MFG_ENTRY_SIZE + 1);
+			else
+				slot_map = (struct slot_map *)((char *)area
+						+ MFG_ENTRY_SIZE);
+			iseries_parse_slot_area(slot_map, mfg_tag_len,
+					agent, phb, card);
+		}
+		/*
+		 * Point to the next Mfg Area
+		 * Use defined size, sizeof give wrong answer
+		 */
+		area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len
+				+ MFG_ENTRY_SIZE);
+		len -= (mfg_tag_len + MFG_ENTRY_SIZE);
+	}
+}
+
+/*
+ * Look for "BUS".. Data is not Null terminated.
+ * PHBID of 0xFF indicates PHB was not found in VPD Data.
+ */
+static u8 __init iseries_parse_phbid(u8 *area, int len)
+{
+	while (len > 0) {
+		if ((*area == 'B') && (*(area + 1) == 'U')
+				&& (*(area + 2) == 'S')) {
+			area += 3;
+			while (*area == ' ')
+				area++;
+			return *area & 0x0F;
+		}
+		area++;
+		len--;
+	}
+	return 0xff;
+}
+
+/*
+ * Parse out the VPD Areas
+ */
+static void __init iseries_parse_vpd(u8 *data, int data_len,
+		HvAgentId agent, u8 *frame, char card[4])
+{
+	u8 phb = 0xff;
+
+	while (data_len > 0) {
+		int len;
+		u8 tag = *data;
+
+		if (tag == VPD_END_OF_AREA)
+			break;
+		len = *(data + 1) + (*(data + 2) * 256);
+		data += 3;
+		data_len -= 3;
+		if (tag == VPD_ID_STRING)
+			phb = iseries_parse_phbid(data, len);
+		else if (tag == VPD_VENDOR_AREA)
+			iseries_parse_mfg_area((struct mfg_vpd_area *)data, len,
+					agent, &phb, frame, card);
+		/* Point to next Area. */
+		data += len;
+		data_len -= len;
+	}
+}
+
+static int __init iseries_get_location_code(u16 bus, HvAgentId agent,
+		u8 *frame, char card[4])
+{
+	int status = 0;
+	int bus_vpd_len = 0;
+	u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
+
+	if (bus_vpd == NULL) {
+		printk("PCI: Bus VPD Buffer allocation failure.\n");
+		return 0;
+	}
+	bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd),
+					BUS_VPDSIZE);
+	if (bus_vpd_len == 0) {
+		printk("PCI: Bus VPD Buffer zero length.\n");
+		goto out_free;
+	}
+	/* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */
+	/* Make sure this is what I think it is */
+	if (*bus_vpd != VPD_ID_STRING) {
+		printk("PCI: Bus VPD Buffer missing starting tag.\n");
+		goto out_free;
+	}
+	iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card);
+	status = 1;
+out_free:
+	kfree(bus_vpd);
+	return status;
+}
+
+/*
+ * Prints the device information.
+ * - Pass in pci_dev* pointer to the device.
+ * - Pass in the device count
+ *
+ * Format:
+ * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
+ * controller
+ */
+static void __init iseries_device_information(struct pci_dev *pdev, int count,
+		u16 bus, HvSubBusNumber subbus)
+{
+	u8 frame = 0;
+	char card[4];
+	HvAgentId agent;
+
+	agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
+			ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
+
+	if (iseries_get_location_code(bus, agent, &frame, card)) {
+		printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, "
+			"Card %4s  0x%04X\n", count, bus,
+			PCI_SLOT(pdev->devfn), pdev->vendor, frame,
+			card, (int)(pdev->class >> 8));
+	}
+}
+
+/*
  * iomm_table_allocate_entry
  *
  * Adds pci_dev entry in address translation table
diff --git a/arch/powerpc/platforms/iseries/pci.h b/arch/powerpc/platforms/iseries/pci.h
index 5f517cf..180aa74 100644
--- a/arch/powerpc/platforms/iseries/pci.h
+++ b/arch/powerpc/platforms/iseries/pci.h
@@ -30,10 +30,6 @@
  * End Change Activity
  */
 
-#include <asm/iseries/hv_types.h>
-
-struct pci_dev;				/* For Forward Reference */
-
 /*
  * Decodes Linux DevFn to iSeries DevFn, bridge device, or function.
  * For Linux, see PCI_SLOT and PCI_FUNC in include/linux/pci.h
@@ -47,8 +43,6 @@ struct pci_dev;				/* For Forward Reference */
 #define ISERIES_GET_DEVICE_FROM_SUBBUS(subbus)		((subbus >> 5) & 0x7)
 #define ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)	((subbus >> 2) & 0x7)
 
-extern void	iseries_device_information(struct pci_dev *pdev, int count,
-			u16 bus, HvSubBusNumber subbus);
 #ifdef CONFIG_PCI
 extern void	iSeries_pcibios_init(void);
 extern void	iSeries_pci_final_fixup(void);
diff --git a/arch/powerpc/platforms/iseries/vpdinfo.c b/arch/powerpc/platforms/iseries/vpdinfo.c
deleted file mode 100644
index aec82e3..0000000
--- a/arch/powerpc/platforms/iseries/vpdinfo.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * This code gets the card location of the hardware
- * Copyright (C) 2001  <Allan H Trautman> <IBM Corp>
- * Copyright (C) 2005  Stephen Rothwel, IBM Corp
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the:
- * Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330,
- * Boston, MA  02111-1307  USA
- *
- * Change Activity:
- *   Created, Feb 2, 2001
- *   Ported to ppc64, August 20, 2001
- * End Change Activity
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-
-#include <asm/types.h>
-#include <asm/resource.h>
-#include <asm/abs_addr.h>
-#include <asm/iseries/hv_types.h>
-
-#include "pci.h"
-#include "call_pci.h"
-
-/*
- * Size of Bus VPD data
- */
-#define BUS_VPDSIZE      1024
-
-/*
- * Bus Vpd Tags
- */
-#define VPD_END_OF_AREA		0x79
-#define VPD_ID_STRING		0x82
-#define VPD_VENDOR_AREA		0x84
-
-/*
- * Mfg Area Tags
- */
-#define VPD_FRU_FRAME_ID	0x4649	/* "FI" */
-#define VPD_SLOT_MAP_FORMAT	0x4D46	/* "MF" */
-#define VPD_SLOT_MAP		0x534D	/* "SM" */
-
-/*
- * Structures of the areas
- */
-struct mfg_vpd_area {
-	u16	tag;
-	u8	length;
-	u8	data1;
-	u8	data2;
-};
-#define MFG_ENTRY_SIZE   3
-
-struct slot_map {
-	u8	agent;
-	u8	secondary_agent;
-	u8	phb;
-	char	card_location[3];
-	char	parms[8];
-	char	reserved[2];
-};
-#define SLOT_ENTRY_SIZE   16
-
-/*
- * Parse the Slot Area
- */
-static void __init iseries_parse_slot_area(struct slot_map *map, int len,
-		HvAgentId agent, u8 *phb, char card[4])
-{
-	/*
-	 * Parse Slot label until we find the one requested
-	 */
-	while (len > 0) {
-		if (map->agent == agent) {
-			/*
-			 * If Phb wasn't found, grab the entry first one found.
-			 */
-			if (*phb == 0xff)
-				*phb = map->phb;
-			/* Found it, extract the data. */
-			if (map->phb == *phb) {
-				memcpy(card, &map->card_location, 3);
-				card[3]  = 0;
-				break;
-			}
-		}
-		/* Point to the next Slot */
-		map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE);
-		len -= SLOT_ENTRY_SIZE;
-	}
-}
-
-/*
- * Parse the Mfg Area
- */
-static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len,
-		HvAgentId agent, u8 *phb, u8 *frame, char card[4])
-{
-	u16 slot_map_fmt = 0;
-
-	/* Parse Mfg Data */
-	while (len > 0) {
-		int mfg_tag_len = area->length;
-		/* Frame ID         (FI 4649020310 ) */
-		if (area->tag == VPD_FRU_FRAME_ID)
-			*frame = area->data1;
-		/* Slot Map Format  (MF 4D46020004 ) */
-		else if (area->tag == VPD_SLOT_MAP_FORMAT)
-			slot_map_fmt = (area->data1 * 256)
-				+ area->data2;
-		/* Slot Map         (SM 534D90 */
-		else if (area->tag == VPD_SLOT_MAP) {
-			struct slot_map *slot_map;
-
-			if (slot_map_fmt == 0x1004)
-				slot_map = (struct slot_map *)((char *)area
-						+ MFG_ENTRY_SIZE + 1);
-			else
-				slot_map = (struct slot_map *)((char *)area
-						+ MFG_ENTRY_SIZE);
-			iseries_parse_slot_area(slot_map, mfg_tag_len,
-					agent, phb, card);
-		}
-		/*
-		 * Point to the next Mfg Area
-		 * Use defined size, sizeof give wrong answer
-		 */
-		area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len
-				+ MFG_ENTRY_SIZE);
-		len -= (mfg_tag_len + MFG_ENTRY_SIZE);
-	}
-}
-
-/*
- * Look for "BUS".. Data is not Null terminated.
- * PHBID of 0xFF indicates PHB was not found in VPD Data.
- */
-static u8 __init iseries_parse_phbid(u8 *area, int len)
-{
-	while (len > 0) {
-		if ((*area == 'B') && (*(area + 1) == 'U')
-				&& (*(area + 2) == 'S')) {
-			area += 3;
-			while (*area == ' ')
-				area++;
-			return *area & 0x0F;
-		}
-		area++;
-		len--;
-	}
-	return 0xff;
-}
-
-/*
- * Parse out the VPD Areas
- */
-static void __init iseries_parse_vpd(u8 *data, int data_len,
-		HvAgentId agent, u8 *frame, char card[4])
-{
-	u8 phb = 0xff;
-
-	while (data_len > 0) {
-		int len;
-		u8 tag = *data;
-
-		if (tag == VPD_END_OF_AREA)
-			break;
-		len = *(data + 1) + (*(data + 2) * 256);
-		data += 3;
-		data_len -= 3;
-		if (tag == VPD_ID_STRING)
-			phb = iseries_parse_phbid(data, len);
-		else if (tag == VPD_VENDOR_AREA)
-			iseries_parse_mfg_area((struct mfg_vpd_area *)data, len,
-					agent, &phb, frame, card);
-		/* Point to next Area. */
-		data += len;
-		data_len -= len;
-	}
-}
-
-static int __init iseries_get_location_code(u16 bus, HvAgentId agent,
-		u8 *frame, char card[4])
-{
-	int status = 0;
-	int bus_vpd_len = 0;
-	u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL);
-
-	if (bus_vpd == NULL) {
-		printk("PCI: Bus VPD Buffer allocation failure.\n");
-		return 0;
-	}
-	bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd),
-					BUS_VPDSIZE);
-	if (bus_vpd_len == 0) {
-		printk("PCI: Bus VPD Buffer zero length.\n");
-		goto out_free;
-	}
-	/* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */
-	/* Make sure this is what I think it is */
-	if (*bus_vpd != VPD_ID_STRING) {
-		printk("PCI: Bus VPD Buffer missing starting tag.\n");
-		goto out_free;
-	}
-	iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card);
-	status = 1;
-out_free:
-	kfree(bus_vpd);
-	return status;
-}
-
-/*
- * Prints the device information.
- * - Pass in pci_dev* pointer to the device.
- * - Pass in the device count
- *
- * Format:
- * PCI: Bus  0, Device 26, Vendor 0x12AE  Frame  1, Card  C10  Ethernet
- * controller
- */
-void __init iseries_device_information(struct pci_dev *pdev, int count,
-		u16 bus, HvSubBusNumber subbus)
-{
-	u8 frame = 0;
-	char card[4];
-	HvAgentId agent;
-
-	agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus),
-			ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus));
-
-	if (iseries_get_location_code(bus, agent, &frame, card)) {
-		printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, "
-			"Card %4s  0x%04X\n", count, bus,
-			PCI_SLOT(pdev->devfn), pdev->vendor, frame,
-			card, (int)(pdev->class >> 8));
-	}
-}
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *
  2007-12-06 15:05 ` [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node * Stephen Rothwell
  2007-12-06 16:56   ` Jon Loeliger
@ 2007-12-09  7:27   ` Benjamin Herrenschmidt
  2007-12-10  3:33     ` Stephen Rothwell
  1 sibling, 1 reply; 35+ messages in thread
From: Benjamin Herrenschmidt @ 2007-12-09  7:27 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: ppc-dev


On Fri, 2007-12-07 at 02:05 +1100, Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---

Ah excellent, I had that on my to-do list for some time. However, we
should also rename it as I'm getting more and more pressure to put a
real void * arch_data in here for use by a specific PCI host bridge
implementation...

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Powerpc PCI cleanups (mainly iSeries)
  2007-12-06 15:44   ` Josh Boyer
@ 2007-12-09  7:29     ` Benjamin Herrenschmidt
  2007-12-09 14:40       ` Josh Boyer
  0 siblings, 1 reply; 35+ messages in thread
From: Benjamin Herrenschmidt @ 2007-12-09  7:29 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Stephen Rothwell, ppc-dev


On Thu, 2007-12-06 at 09:44 -0600, Josh Boyer wrote:
> On Fri, 7 Dec 2007 02:07:26 +1100
> Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> > On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > >
> > > I started out looking for ways to remove our dependencies on pci_dn and
> > > got sidetracked into clening up the iSeries PCI code.  The intention of
> > > the following set of patches is that there be no semantic changes
> > > (mostly).
> > 
> > Some of these will clearly conflict with Benh's PCI work.  We will sot
> > that out between us.  :-)
> 
> In the meantime...
> 
> My tree is going to carry BenH's patches since they're obviously
> important to 4xx.  If these conflicts get sorted out soon, that would
> be good :).  At some point I'm going to start sending stuff to Paul.

The PCI merge serie of my patches shoudn't go through your tree (it's a
separate serie from my 4xx stuff and isn't quite ready just yet...).

I'll sync with Stephen.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: Powerpc PCI cleanups (mainly iSeries)
  2007-12-09  7:29     ` Benjamin Herrenschmidt
@ 2007-12-09 14:40       ` Josh Boyer
  0 siblings, 0 replies; 35+ messages in thread
From: Josh Boyer @ 2007-12-09 14:40 UTC (permalink / raw)
  To: benh; +Cc: Stephen Rothwell, ppc-dev

On Sun, 09 Dec 2007 18:29:26 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> 
> On Thu, 2007-12-06 at 09:44 -0600, Josh Boyer wrote:
> > On Fri, 7 Dec 2007 02:07:26 +1100
> > Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > 
> > > On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > > >
> > > > I started out looking for ways to remove our dependencies on pci_dn and
> > > > got sidetracked into clening up the iSeries PCI code.  The intention of
> > > > the following set of patches is that there be no semantic changes
> > > > (mostly).
> > > 
> > > Some of these will clearly conflict with Benh's PCI work.  We will sot
> > > that out between us.  :-)
> > 
> > In the meantime...
> > 
> > My tree is going to carry BenH's patches since they're obviously
> > important to 4xx.  If these conflicts get sorted out soon, that would
> > be good :).  At some point I'm going to start sending stuff to Paul.
> 
> The PCI merge serie of my patches shoudn't go through your tree (it's a
> separate serie from my 4xx stuff and isn't quite ready just yet...).

I wasn't talking about your series of 10 patches.  You'll have
conflicts in your series of 25 too, though those should be fairly minor.

josh

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node *
  2007-12-09  7:27   ` Benjamin Herrenschmidt
@ 2007-12-10  3:33     ` Stephen Rothwell
  0 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-10  3:33 UTC (permalink / raw)
  To: benh; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---

This version also renames the arch_data field to dn.

 arch/powerpc/kernel/isa-bridge.c               |    2 +-
 arch/powerpc/kernel/pci-common.c               |    4 ++--
 arch/powerpc/kernel/pci_32.c                   |   10 +++++-----
 arch/powerpc/kernel/pci_64.c                   |    8 +++-----
 arch/powerpc/kernel/pci_dn.c                   |    2 +-
 arch/powerpc/kernel/prom_parse.c               |    2 +-
 arch/powerpc/kernel/rtas_pci.c                 |    2 +-
 arch/powerpc/platforms/82xx/pq2.c              |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c       |    2 +-
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c     |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c     |    2 +-
 arch/powerpc/platforms/cell/io-workarounds.c   |    4 ++--
 arch/powerpc/platforms/celleb/io-workarounds.c |    4 ++--
 arch/powerpc/platforms/celleb/pci.c            |    2 +-
 arch/powerpc/platforms/maple/pci.c             |    2 +-
 arch/powerpc/platforms/powermac/pci.c          |    6 +++---
 arch/powerpc/platforms/pseries/iommu.c         |    2 +-
 include/asm-powerpc/pci-bridge.h               |    5 +++--
 18 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c
index 965bfcc..ee172aa 100644
--- a/arch/powerpc/kernel/isa-bridge.c
+++ b/arch/powerpc/kernel/isa-bridge.c
@@ -145,7 +145,7 @@ void __init isa_bridge_find_early(struct pci_controller *hose)
 	for_each_node_by_type(np, "isa") {
 		/* Look for our hose being a parent */
 		for (parent = of_get_parent(np); parent;) {
-			if (parent == hose->arch_data) {
+			if (parent == hose->dn) {
 				of_node_put(parent);
 				break;
 			}
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index e0d4a2a..8f80591 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -65,7 +65,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 	phb->global_number = global_phb_number++;
 	list_add_tail(&phb->list_node, &hose_list);
 	spin_unlock(&hose_spinlock);
-	phb->arch_data = dev;
+	phb->dn = dev;
 	phb->is_dynamic = mem_init_done;
 #ifdef CONFIG_PPC64
 	if (dev) {
@@ -140,7 +140,7 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
 	while(node) {
 		struct pci_controller *hose, *tmp;
 		list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
-			if (hose->arch_data == node)
+			if (hose->dn == node)
 				return hose;
 		node = node->parent;
 	}
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e1151b5..20a1192 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -661,8 +661,8 @@ pcibios_make_OF_bus_map(void)
 
 	/* For each hose, we begin searching bridges */
 	list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
-		struct device_node* node;	
-		node = (struct device_node *)hose->arch_data;
+		struct device_node* node = hose->dn;
+
 		if (!node)
 			continue;
 		make_one_node_map(node, hose->first_busno);
@@ -741,7 +741,7 @@ static struct device_node *scan_OF_for_pci_bus(struct pci_bus *bus)
 		struct pci_controller *hose = pci_bus_to_host(bus);
 		if (hose == NULL)
 			return NULL;
-		return of_node_get(hose->arch_data);
+		return of_node_get(hose->dn);
 	}
 
 	/* not a root bus, we need to get our parent */
@@ -811,9 +811,9 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
 		return -ENODEV;
 	/* Make sure it's really a PCI device */
 	hose = pci_find_hose_for_OF_device(node);
-	if (!hose || !hose->arch_data)
+	if (!hose || !hose->dn)
 		return -ENODEV;
-	if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
+	if (!scan_OF_pci_childs(hose->dn->child,
 			find_OF_pci_device_filter, (void *)node))
 		return -ENODEV;
 	reg = of_get_property(node, "reg", NULL);
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index acf1219..bf06926 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -458,7 +458,7 @@ EXPORT_SYMBOL(of_scan_pci_bridge);
 void __devinit scan_phb(struct pci_controller *hose)
 {
 	struct pci_bus *bus;
-	struct device_node *node = hose->arch_data;
+	struct device_node *node = hose->dn;
 	int i, mode;
 	struct resource *res;
 
@@ -612,8 +612,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
 	if (hose->io_base_alloc == 0)
 		return 0;
 
-	DBG("IO unmapping for PHB %s\n",
-	    ((struct device_node *)hose->arch_data)->full_name);
+	DBG("IO unmapping for PHB %s\n", hose->dn->full_name);
 	DBG("  alloc=0x%p\n", hose->io_base_alloc);
 
 	/* This is a PHB, we fully unmap the IO area */
@@ -672,8 +671,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
 	hose->io_base_virt = (void __iomem *)(area->addr +
 					      hose->io_base_phys - phys_page);
 
-	DBG("IO mapping for PHB %s\n",
-	    ((struct device_node *)hose->arch_data)->full_name);
+	DBG("IO mapping for PHB %s\n", hose->dn->full_name);
 	DBG("  phys=0x%016lx, virt=0x%p (alloc=0x%p)\n",
 	    hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
 	DBG("  size=0x%016lx (alloc=0x%016lx)\n",
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index b483903..85d4d89 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -133,7 +133,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
  */
 void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
 {
-	struct device_node * dn = (struct device_node *) phb->arch_data;
+	struct device_node *dn = phb->dn;
 	struct pci_dn *pdn;
 
 	/* PHB nodes themselves must not match */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index b5c96af..6bdfaf3 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -273,7 +273,7 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
 #else
 			struct pci_controller *host;
 			host = pci_bus_to_host(pdev->bus);
-			ppnode = host ? host->arch_data : NULL;
+			ppnode = host ? host->dn : NULL;
 #endif
 			/* No node for host bridge ? give up */
 			if (ppnode == NULL)
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 21f14e5..3650eb5 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -260,7 +260,7 @@ static int phb_set_bus_ranges(struct device_node *dev,
 
 int __devinit rtas_setup_phb(struct pci_controller *phb)
 {
-	struct device_node *dev = phb->arch_data;
+	struct device_node *dev = phb->dn;
 
 	if (is_python(dev))
 		python_countermeasures(dev);
diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index a497cba..11d1db8 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -59,7 +59,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np)
 	if (!hose)
 		return;
 
-	hose->arch_data = np;
+	hose->dn = np;
 
 	setup_indirect_pci(hose, r.start + 0x100, r.start + 0x104, 0);
 	pci_process_bridge_OF_ranges(hose, np, 1);
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 59c121a..bdb3d0b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -123,7 +123,7 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 	struct device_node* node;
 	struct resource rsrc;
 
-	node = (struct device_node *)hose->arch_data;
+	node = hose->dn;
 	of_address_to_resource(node, 0, &rsrc);
 
 	if ((rsrc.start & 0xfffff) == primary_phb_addr) {
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 6390895..c6d2f48 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -124,7 +124,7 @@ static void __devinit quirk_uli5229(struct pci_dev *dev)
 static void __devinit final_uli5288(struct pci_dev *dev)
 {
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-	struct device_node *hosenode = hose ? hose->arch_data : NULL;
+	struct device_node *hosenode = hose ? hose->dn : NULL;
 	struct of_irq oirq;
 	int virq, pin = 2;
 	u32 laddr[3];
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 32a531a..14f4e52 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -116,7 +116,7 @@ static int mpc86xx_exclude_device(struct pci_controller *hose,
 	struct device_node* node;	
 	struct resource rsrc;
 
-	node = (struct device_node *)hose->arch_data;
+	node = hose->dn;
 	of_address_to_resource(node, 0, &rsrc);
 
 	if ((rsrc.start & 0xfffff) == 0x8000) {
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 9d7c2ef..b86076e 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -238,7 +238,7 @@ static void __init spider_pci_setup_chip(struct spider_pci_bus *bus)
 static void __init spider_pci_add_one(struct pci_controller *phb)
 {
 	struct spider_pci_bus *bus = &spider_pci_busses[spider_pci_count];
-	struct device_node *np = phb->arch_data;
+	struct device_node *np = phb->dn;
 	struct resource rsrc;
 	void __iomem *regs;
 
@@ -317,7 +317,7 @@ static int __init spider_pci_workaround_init(void)
 	 * update this code to cope with dynamically added busses
 	 */
 	list_for_each_entry(phb, &hose_list, list_node) {
-		struct device_node *np = phb->arch_data;
+		struct device_node *np = phb->dn;
 		const char *model = of_get_property(np, "model", NULL);
 
 		/* If no model property or name isn't exactly "pci", skip */
diff --git a/arch/powerpc/platforms/celleb/io-workarounds.c b/arch/powerpc/platforms/celleb/io-workarounds.c
index 32b9cec..b939c0e 100644
--- a/arch/powerpc/platforms/celleb/io-workarounds.c
+++ b/arch/powerpc/platforms/celleb/io-workarounds.c
@@ -222,7 +222,7 @@ void __init celleb_pci_add_one(struct pci_controller *phb,
 			       void (*dummy_read)(struct pci_controller *))
 {
 	struct celleb_pci_bus *bus = &celleb_pci_busses[celleb_pci_count];
-	struct device_node *np = phb->arch_data;
+	struct device_node *np = phb->dn;
 
 	if (celleb_pci_count >= MAX_CELLEB_PCI_BUS) {
 		printk(KERN_ERR "Too many pci bridges, workarounds"
@@ -262,7 +262,7 @@ int __init celleb_pci_workaround_init(void)
 	}
 
 	list_for_each_entry(phb, &hose_list, list_node) {
-		node = phb->arch_data;
+		node = phb->dn;
 		match = of_match_node(celleb_pci_workaround_match, node);
 
 		if (match) {
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 13ec4a6..5d399e0 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -480,7 +480,7 @@ static struct of_device_id celleb_phb_match[] __initdata = {
 
 int __init celleb_setup_phb(struct pci_controller *phb)
 {
-	struct device_node *dev = phb->arch_data;
+	struct device_node *dev = phb->dn;
 	const struct of_device_id *match;
 	int (*setup_func)(struct device_node *, struct pci_controller *);
 
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 771ed0c..3ffa0ac 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -558,7 +558,7 @@ void __init maple_pci_init(void)
 	 * safe assumptions hopefully.
 	 */
 	if (u3_agp) {
-		struct device_node *np = u3_agp->arch_data;
+		struct device_node *np = u3_agp->dn;
 		PCI_DN(np)->busno = 0xf0;
 		for (np = np->child; np; np = np->sibling)
 			PCI_DN(np)->busno = 0xf0;
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index ec49099..778c249 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -319,7 +319,7 @@ static int u3_ht_skip_device(struct pci_controller *hose,
 	if (bus->self)
 		busdn = pci_device_to_OF_node(bus->self);
 	else
-		busdn = hose->arch_data;
+		busdn = hose->dn;
 	for (dn = busdn->child; dn; dn = dn->sibling)
 		if (PCI_DN(dn) && PCI_DN(dn)->devfn == devfn)
 			break;
@@ -778,7 +778,7 @@ static void __init setup_u4_pcie(struct pci_controller* hose)
 
 static void __init setup_u3_ht(struct pci_controller* hose)
 {
-	struct device_node *np = (struct device_node *)hose->arch_data;
+	struct device_node *np = hose->dn;
 	struct pci_controller *other = NULL;
 	int i, cur;
 
@@ -1032,7 +1032,7 @@ void __init pmac_pci_init(void)
 	 * future though
 	 */
 	if (u3_agp) {
-		struct device_node *np = u3_agp->arch_data;
+		struct device_node *np = u3_agp->dn;
 		PCI_DN(np)->busno = 0xf0;
 		for (np = np->child; np; np = np->sibling)
 			PCI_DN(np)->busno = 0xf0;
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index ebb9313..a65c763 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -251,7 +251,7 @@ static void iommu_table_setparms(struct pci_controller *phb,
 	const unsigned long *basep;
 	const u32 *sizep;
 
-	node = (struct device_node *)phb->arch_data;
+	node = phb->dn;
 
 	basep = of_get_property(node, "linux,tce-base", NULL);
 	sizep = of_get_property(node, "linux,tce-size", NULL);
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index beb09b5..6b81e22 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -11,6 +11,8 @@
 #include <linux/list.h>
 #include <linux/ioport.h>
 
+struct device_node;
+
 /*
  * Structure of a PCI controller (host bridge)
  */
@@ -20,7 +22,7 @@ struct pci_controller {
 #ifdef CONFIG_PPC64
 	int node;
 #endif
-	void *arch_data;
+	struct device_node *dn;
 	struct list_head list_node;
 	struct device *parent;
 
@@ -130,7 +132,6 @@ extern void __init update_bridge_resource(struct pci_dev *dev,
  * by device_node->data.
  */
 struct iommu_table;
-struct device_node;
 
 struct pci_dn {
 	int	busno;			/* pci bus number */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 02/19] [POWERPC] consolidate pci_controller
  2007-12-06  7:06 ` [PATCH 02/19] [POWERPC] consolidate pci_controller Stephen Rothwell
@ 2007-12-11  0:00   ` Stephen Rothwell
  0 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-11  0:00 UTC (permalink / raw)
  To: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/pci-bridge.h |   65 +++++++++++++-------------------------
 1 files changed, 22 insertions(+), 43 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index e021314..f67d262 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -11,33 +11,44 @@
 #include <linux/list.h>
 #include <linux/ioport.h>
 
-#ifndef CONFIG_PPC64
 /*
  * Structure of a PCI controller (host bridge)
  */
 struct pci_controller {
 	struct pci_bus *bus;
 	char is_dynamic;
+#ifdef CONFIG_PPC64
+	int node;
+#endif
 	void *arch_data;
 	struct list_head list_node;
 	struct device *parent;
 
 	int first_busno;
 	int last_busno;
+#ifndef CONFIG_PPC64
 	int self_busno;
+#endif
 
 	void __iomem *io_base_virt;
+#ifdef CONFIG_PPC64
+	void *io_base_alloc;
+#endif
 	resource_size_t io_base_phys;
 
 	/* Some machines (PReP) have a non 1:1 mapping of
 	 * the PCI memory space in the CPU bus space
 	 */
 	resource_size_t pci_mem_offset;
+#ifdef CONFIG_PPC64
+	unsigned long pci_io_size;
+#endif
 
 	struct pci_ops *ops;
 	volatile unsigned int __iomem *cfg_addr;
 	volatile void __iomem *cfg_data;
 
+#ifndef CONFIG_PPC64
 	/*
 	 * Used for variants of PCI indirect handling and possible quirks:
 	 *  SET_CFG_TYPE - used on 4xx or any PHB that does explicit type0/1
@@ -58,15 +69,24 @@ struct pci_controller {
 #define PPC_INDIRECT_TYPE_NO_PCIE_LINK		0x00000008
 #define PPC_INDIRECT_TYPE_BIG_ENDIAN		0x00000010
 	u32 indirect_type;
-
+#endif	/* !CONFIG_PPC64 */
 	/* Currently, we limit ourselves to 1 IO range and 3 mem
 	 * ranges since the common pci_bus structure can't handle more
 	 */
 	struct resource	io_resource;
 	struct resource mem_resources[3];
 	int global_number;		/* PCI domain number */
+#ifdef CONFIG_PPC64
+	unsigned long buid;
+	unsigned long dma_window_base_cur;
+	unsigned long dma_window_size;
+
+	void *private_data;
+#endif	/* CONFIG_PPC64 */
 };
 
+#ifndef CONFIG_PPC64
+
 static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
 {
 	return bus->sysdata;
@@ -108,47 +128,6 @@ extern void __init update_bridge_resource(struct pci_dev *dev,
 #else	/* CONFIG_PPC64 */
 
 /*
- * Structure of a PCI controller (host bridge)
- */
-struct pci_controller {
-	struct pci_bus *bus;
-	char is_dynamic;
-	int node;
-	void *arch_data;
-	struct list_head list_node;
-	struct device *parent;
-
-	int first_busno;
-	int last_busno;
-
-	void __iomem *io_base_virt;
-	void *io_base_alloc;
-	resource_size_t io_base_phys;
-
-	/* Some machines have a non 1:1 mapping of
-	 * the PCI memory space in the CPU bus space
-	 */
-	resource_size_t pci_mem_offset;
-	unsigned long pci_io_size;
-
-	struct pci_ops *ops;
-	volatile unsigned int __iomem *cfg_addr;
-	volatile void __iomem *cfg_data;
-
-	/* Currently, we limit ourselves to 1 IO range and 3 mem
-	 * ranges since the common pci_bus structure can't handle more
-	 */
-	struct resource io_resource;
-	struct resource mem_resources[3];
-	int global_number;
-	unsigned long buid;
-	unsigned long dma_window_base_cur;
-	unsigned long dma_window_size;
-
-	void *private_data;
-};
-
-/*
  * PCI stuff, for nodes representing PCI devices, pointed to
  * by device_node->data.
  */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial
  2007-12-06 14:59 ` [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial Stephen Rothwell
@ 2007-12-11  0:02   ` Stephen Rothwell
  0 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-11  0:02 UTC (permalink / raw)
  To: ppc-dev

and it becomes clear that we should use zalloc_maybe_bootmem.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci-common.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 15ec71a..78cdb70 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,27 +50,18 @@ static DEFINE_SPINLOCK(hose_spinlock);
 /* XXX kill that some day ... */
 static int global_phb_number;		/* Global phb counter */
 
-/*
- * pci_controller(phb) initialized common variables.
- */
-static void __devinit pci_setup_pci_controller(struct pci_controller *hose)
-{
-	memset(hose, 0, sizeof(struct pci_controller));
 
-	spin_lock(&hose_spinlock);
-	hose->global_number = global_phb_number++;
-	list_add_tail(&hose->list_node, &hose_list);
-	spin_unlock(&hose_spinlock);
-}
-
-struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
+struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
 	struct pci_controller *phb;
 
-	phb = alloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
+	phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
 	if (phb == NULL)
 		return NULL;
-	pci_setup_pci_controller(phb);
+	spin_lock(&hose_spinlock);
+	phb->global_number = global_phb_number++;
+	list_add_tail(&phb->list_node, &hose_list);
+	spin_unlock(&hose_spinlock);
 	phb->arch_data = dev;
 	phb->is_dynamic = mem_init_done;
 #ifdef CONFIG_PPC64
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries
  2007-12-06 15:01 ` [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries Stephen Rothwell
@ 2007-12-11  0:03   ` Stephen Rothwell
  0 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-11  0:03 UTC (permalink / raw)
  To: ppc-dev

so remove a firmware feature test.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_64.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 69364f3..7e74aa2 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -581,12 +581,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 /* Decide whether to display the domain number in /proc */
 int pci_proc_domain(struct pci_bus *bus)
 {
-	if (firmware_has_feature(FW_FEATURE_ISERIES))
-		return 0;
-	else {
-		struct pci_controller *hose = pci_bus_to_host(bus);
-		return hose->buid != 0;
-	}
+	struct pci_controller *hose = pci_bus_to_host(bus);
+	return hose->buid != 0;
 }
 
 void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: Powerpc PCI cleanups (mainly iSeries)
  2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
                   ` (22 preceding siblings ...)
  2007-12-07  5:10 ` [PATCH 3/3] [POWERPC] iSeries: merge vpdinfo.c intp pci.c Stephen Rothwell
@ 2007-12-11  0:06 ` Stephen Rothwell
  23 siblings, 0 replies; 35+ messages in thread
From: Stephen Rothwell @ 2007-12-11  0:06 UTC (permalink / raw)
  To: ppc-dev

[-- Attachment #1: Type: text/plain, Size: 3082 bytes --]

On Thu, 6 Dec 2007 18:00:45 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
> 
> I started out looking for ways to remove our dependencies on pci_dn and
> got sidetracked into clening up the iSeries PCI code.  The intention of
> the following set of patches is that there be no semantic changes
> (mostly).

I have rebased this series to remove the dependency on benh's patches and
will repost (as replies to the originals) only those that changed
(numbers 2, 14, 16 and I repoested 19 yesterday).

> Overall diffstat looks like this:
>  arch/powerpc/kernel/pci-common.c           |   31 +--
>  arch/powerpc/kernel/pci_32.c               |    6 +-
>  arch/powerpc/kernel/pci_64.c               |   40 +--
>  arch/powerpc/kernel/pci_dn.c               |    2 +-
>  arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
>  arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
>  arch/powerpc/platforms/iseries/pci.c       |  426 +++++++++++-----------------
>  arch/powerpc/platforms/iseries/pci.h       |   20 +-
>  arch/powerpc/platforms/iseries/setup.c     |    2 +
>  arch/powerpc/platforms/iseries/vpdinfo.c   |   17 +-
>  arch/powerpc/platforms/powermac/pci.c      |    2 +-
>  arch/powerpc/platforms/pseries/iommu.c     |    2 +-
>  include/asm-powerpc/pci-bridge.h           |  156 ++++------
>  include/asm-powerpc/ppc-pci.h              |    3 -
>  14 files changed, 266 insertions(+), 445 deletions(-)

Now:
 arch/powerpc/kernel/isa-bridge.c               |    2 +-
 arch/powerpc/kernel/pci-common.c               |   34 +--
 arch/powerpc/kernel/pci_32.c                   |   10 +-
 arch/powerpc/kernel/pci_64.c                   |   42 +--
 arch/powerpc/kernel/pci_dn.c                   |    2 +-
 arch/powerpc/kernel/prom_parse.c               |    2 +-
 arch/powerpc/kernel/rtas_pci.c                 |    2 +-
 arch/powerpc/platforms/82xx/pq2.c              |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c       |    2 +-
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c     |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c     |    2 +-
 arch/powerpc/platforms/cell/io-workarounds.c   |    4 +-
 arch/powerpc/platforms/celleb/io-workarounds.c |    4 +-
 arch/powerpc/platforms/celleb/pci.c            |    2 +-
 arch/powerpc/platforms/iseries/pci.c           |  426 +++++++++--------------
 arch/powerpc/platforms/iseries/pci.h           |   20 +-
 arch/powerpc/platforms/iseries/setup.c         |    2 +
 arch/powerpc/platforms/iseries/vpdinfo.c       |   17 +-
 arch/powerpc/platforms/maple/pci.c             |    2 +-
 arch/powerpc/platforms/powermac/pci.c          |    6 +-
 arch/powerpc/platforms/pseries/iommu.c         |    2 +-
 include/asm-powerpc/pci-bridge.h               |  159 ++++------
 include/asm-powerpc/ppc-pci.h                  |    3 -
 23 files changed, 287 insertions(+), 462 deletions(-)

The extra files are from the arch_data rename posted earlier.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2007-12-11  0:06 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-06  7:00 Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
2007-12-06  7:02 ` [PATCH 01/19] [POWERPC] clean up pci-bridge.h Stephen Rothwell
2007-12-06  7:06 ` [PATCH 02/19] [POWERPC] consolidate pci_controller Stephen Rothwell
2007-12-11  0:00   ` Stephen Rothwell
2007-12-06 14:46 ` [PATCH 03/19] [POWERPC] iSeries: move find_Device_Node to avoid a forward declaration Stephen Rothwell
2007-12-06 14:48 ` [PATCH 04/19] [POWERPC] iSeries: cleanup PCI retry code a little Stephen Rothwell
2007-12-06 14:49 ` [PATCH 05/19] [POWERPC] iSeries: deCamelCase pci.c Stephen Rothwell
2007-12-06 14:50 ` [PATCH 06/19] [POWERPC] iSeries: remove some dead code from pci.c Stephen Rothwell
2007-12-06 14:51 ` [PATCH 07/19] [POWERPC] iSeries: unindent and clean iSeries_pci_final_fixup Stephen Rothwell
2007-12-06 18:33   ` Olof Johansson
2007-12-06 14:52 ` [PATCH 08/19] [POWERPC] iSeries: consoldiate PCI IO error check Stephen Rothwell
2007-12-06 14:53 ` [PATCH 09/19] [POWERPC] iSeries: remove one layer of IO routines Stephen Rothwell
2007-12-06 14:54 ` [PATCH 10/19] [POWERPC] iSeries: remove pci_dn dependency from iSeries_Device_Information Stephen Rothwell
2007-12-06 14:55 ` [PATCH 11/19] [POWERPC] iSeries: iseries_ds_addr is only used in pci.c Stephen Rothwell
2007-12-06 14:56 ` [PATCH 12/19] [POWERPC] iSeries: reduce dependence on pci_dn bussubno Stephen Rothwell
2007-12-06 14:58 ` [PATCH 13/19] [POWERPC] iSeries: make pcibios_final_fixup not depend on pci_dn Stephen Rothwell
2007-12-06 14:59 ` [PATCH 14/19] [POWERPC] Inline pci_setup_pci_controller as it has become trivial Stephen Rothwell
2007-12-11  0:02   ` Stephen Rothwell
2007-12-06 15:00 ` [PATCH 15/19] [POWERPC] iSeries: call iSeries_pcibios_init from setup_arch Stephen Rothwell
2007-12-06 15:01 ` [PATCH 16/19] [POWERPC] iSeries: hose->buid is always zero for iSeries Stephen Rothwell
2007-12-11  0:03   ` Stephen Rothwell
2007-12-06 15:03 ` [PATCH 17/19] [POWERPC] remove some iSeries platform checks from the PCI code Stephen Rothwell
2007-12-06 15:04 ` [PATCH 18/19] [POWERPC] Don't special case pci_domain_nr() for iSeries Stephen Rothwell
2007-12-06 15:05 ` [PATCH 19/19] [POWERPC] pci_controller->arch_data really is a struct device_node * Stephen Rothwell
2007-12-06 16:56   ` Jon Loeliger
2007-12-09  7:27   ` Benjamin Herrenschmidt
2007-12-10  3:33     ` Stephen Rothwell
2007-12-06 15:07 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell
2007-12-06 15:44   ` Josh Boyer
2007-12-09  7:29     ` Benjamin Herrenschmidt
2007-12-09 14:40       ` Josh Boyer
2007-12-07  5:08 ` [PATCH 1/3] [POWERPC] iSeries: DeCamelCase vpdinfo.c Stephen Rothwell
2007-12-07  5:09 ` [PATCH 2/3] [POWERPC] iSeries: clean up and simplify vdpinfo.c Stephen Rothwell
2007-12-07  5:10 ` [PATCH 3/3] [POWERPC] iSeries: merge vpdinfo.c intp pci.c Stephen Rothwell
2007-12-11  0:06 ` Powerpc PCI cleanups (mainly iSeries) Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).