Skip to contentSkip to conversation

powerpc/pci: Pull ppc32 PCI features into common

PATCH In review Kumar Gala 2 participants 3 messages Aug 26, 2009 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 powerpc/pci: Pull ppc32 PCI features into common

Some of the PCI features we have in ppc32 we will need on ppc64 platforms in the future. These include support for:

* ppc_md.pci_exclude_device
* indirect config cycles
* early config cycles

We also simplified the logic in fake_pci_bus() to assume it will always get a valid pci_controller. Since all current callers seem to pass it one.

---
 arch/powerpc/include/asm/machdep.h    |    6 +-
 arch/powerpc/include/asm/pci-bridge.h |   35 +++++++---------
 arch/powerpc/kernel/pci-common.c      |   70 ++++++++++++++++++++++++++++++++
 arch/powerpc/kernel/pci_32.c          |   71 ---------------------------------
 4 files changed, 89 insertions(+), 93 deletions(-)
arch/powerpc/include/asm/machdep.h +3 -3
index 11d1fc3..9efa2be 100644
@@ -209,14 +209,14 @@ struct machdep_calls {
 	/*
 	 * optional PCI "hooks"
 	 */
-	/* Called in indirect_* to avoid touching devices */
-	int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
-
 	/* Called at then very end of pcibios_init() */
 	void (*pcibios_after_init)(void);
 
 #endif /* CONFIG_PPC32 */
 
+	/* Called in indirect_* to avoid touching devices */
+	int (*pci_exclude_device)(struct pci_controller *, unsigned char, unsigned char);
+
 	/* Called after PPC generic resource fixup to perform
 	   machine specific fixups */
 	void (*pcibios_fixup_resources)(struct pci_dev *);
arch/powerpc/include/asm/pci-bridge.h +16 -19
index 4c61fa0..e074420 100644
@@ -77,9 +77,7 @@ struct pci_controller {
 
 	int first_busno;
 	int last_busno;
-#ifndef CONFIG_PPC64
 	int self_busno;
-#endif
 
 	void __iomem *io_base_virt;
 #ifdef CONFIG_PPC64
@@ -104,7 +102,6 @@ struct pci_controller {
 	unsigned int __iomem *cfg_addr;
 	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
@@ -128,7 +125,6 @@ struct pci_controller {
 #define PPC_INDIRECT_TYPE_BIG_ENDIAN		0x00000010
 #define PPC_INDIRECT_TYPE_BROKEN_MRM		0x00000020
 	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
 	 */
@@ -146,21 +142,6 @@ struct pci_controller {
 #endif	/* CONFIG_PPC64 */
 };
 
-#ifndef CONFIG_PPC64
-
-static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
-{
-	return bus->sysdata;
-}
-
-static inline int isa_vaddr_is_ioport(void __iomem *address)
-{
-	/* No specific ISA handling on ppc32 at this stage, it
-	 * all goes through PCI
-	 */
-	return 0;
-}
-
 /* These are used for config access before all the PCI probing
    has been done. */
 extern int early_read_config_byte(struct pci_controller *hose, int bus,
@@ -182,6 +163,22 @@ extern int early_find_capability(struct pci_controller *hose, int bus,
 extern void setup_indirect_pci(struct pci_controller* hose,
 			       resource_size_t cfg_addr,
 			       resource_size_t cfg_data, u32 flags);
+
+#ifndef CONFIG_PPC64
+
+static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
+{
+	return bus->sysdata;
+}
+
+static inline int isa_vaddr_is_ioport(void __iomem *address)
+{
+	/* No specific ISA handling on ppc32 at this stage, it
+	 * all goes through PCI
+	 */
+	return 0;
+}
+
 #else	/* CONFIG_PPC64 */
 
 /*
arch/powerpc/kernel/pci-common.c +70 -0

73 lines not on this page · raw message

arch/powerpc/kernel/pci_32.c +0 -71

75 lines not on this page · raw message

Signature · 1 line
1.6.0.6
author
#1 lore raw
Quoted 12 lines · Kumar Gala

Some of the PCI features we have in ppc32 we will need on ppc64 platforms in the future. These include support for:

* ppc_md.pci_exclude_device
* indirect config cycles
* early config cycles

We also simplified the logic in fake_pci_bus() to assume it will always get a valid pci_controller. Since all current callers seem to pass it one.

Quoted 8 lines

---

arch/powerpc/include/asm/machdep.h    |    6 +-
arch/powerpc/include/asm/pci-bridge.h |   35 +++++++---------
arch/powerpc/kernel/pci-common.c      |   70 ++++++++++++++++++++++++ 
++++++++
arch/powerpc/kernel/pci_32.c          |   71  
---------------------------------
4 files changed, 89 insertions(+), 93 deletions(-)

Ben, Grant

This should just be a refresh of the patch mentioned here:

http://patchwork.ozlabs.org/patch/26648/

with the commit message cleaned up and rebased on 'next'.

- k

Acked-by on v1 1/1
#2 lore raw
In reply to Kumar Gala

On Tue, Aug 25, 2009 at 8:20 PM, Kumar Gala<[email protected]> wrot= e:

Quoted 7 lines

Some of the PCI features we have in ppc32 we will need on ppc64 platforms in the future. =A0These include support for:

* ppc_md.pci_exclude_device
* indirect config cycles
* early config cycles

Quoted 5 lines

We also simplified the logic in fake_pci_bus() to assume it will always get a valid pci_controller. =A0Since all current callers seem to pass it one.

Looks okay to me.

g.