powerpc/pci: Remove dead checks for CONFIG_PPC_OF
PATCH v2 1/3 powerpc/pci: Remove dead checks for CONFIG_PPC_OF
From: Grant Likely <[email protected]>
PPC_OF is always selected for arch/powerpc. This patch removes the stale #defines
---
arch/powerpc/kernel/pci-common.c | 8 -------- arch/powerpc/kernel/pci_32.c | 9 --------- 2 files changed, 0 insertions(+), 17 deletions(-)
arch/powerpc/kernel/pci-common.c +0 -8
@@ -176,8 +176,6 @@ int pci_domain_nr(struct pci_bus *bus) }EXPORT_SYMBOL (pci_domain_nr); -#ifdef CONFIG_PPC_OF -/* This routine is meant to be used early during boot, when the * PCI bus numbers have not yet been assigned, and you need to * issue PCI config cycles to an OF device.
@@ -210,17 +208,11 @@ static ssize_t pci_show_devspec(struct device *dev,return sprintf (buf,"%s" , np->full_name); } static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); -#endif /* CONFIG_PPC_OF */ /* Add sysfs properties */ int pcibios_add_platform_entries (struct pci_dev *pdev) { -#ifdef CONFIG_PPC_OF return device_create_file (&pdev->dev, &dev_attr_devspec); -#else -return 0 ; -#endif /* CONFIG_PPC_OF */ - }char __devinit *pcibios_setup (char *str)
arch/powerpc/kernel/pci_32.c +0 -9
@@ -34,9 +34,7 @@ int pcibios_assign_bus_offset = 1;void pcibios_make_OF_bus_map (void );static void fixup_cpc710_pci64 (struct pci_dev * dev); -#ifdef CONFIG_PPC_OF static u8 * pci_to_OF_bus_map; -#endif /* By default, we don't re-assign bus numbers. We do this only on * some pmacs
@@ -83,7 +81,6 @@ fixup_cpc710_pci64(struct pci_dev* dev) }DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_IBM ,PCI_DEVICE_ID_IBM_CPC710_PCI64 , fixup_cpc710_pci64); -#ifdef CONFIG_PPC_OF /* * Functions below are used on OpenFirmware machines. */
@@ -357,12 +354,6 @@ pci_create_OF_bus_map(void) } } -#else /* CONFIG_PPC_OF */ -void pcibios_make_OF_bus_map (void ) -{ -} -#endif /* CONFIG_PPC_OF */ -static void __devinit pcibios_scan_phb (struct pci_controller *hose) {struct pci_bus *bus;
PATCH v2 2/3 powerpc/pci: move pci_64.c device tree scanning code into pci-common.c
From: Grant Likely <[email protected]>
The PCI device tree scanning code in pci_64.c is some useful functionality. It allows PCI devices to be described in the device tree instead of being probed for, which in turn allows pci devices to use all of the device tree facilities to describe complex PCI bus architectures like GPIO and IRQ routing (perhaps not a common situation for desktop or server systems, but useful for embedded systems with on-board PCI devices).
This patch moves the device tree scanning into pci-common.c so it is available for 32-bit powerpc machines too.
---
arch/powerpc/include/asm/pci-bridge.h | 5 arch/powerpc/include/asm/pci.h | 5 arch/powerpc/kernel/Makefile | 2 arch/powerpc/kernel/pci-common.c | 1 arch/powerpc/kernel/pci_64.c | 289 --------------------------- arch/powerpc/kernel/pci_of_scan.c | 358 +++++++++++++++++++++++++++++++++ 6 files changed, 364 insertions(+), 296 deletions(-) create mode 100644 arch/powerpc/kernel/pci_of_scan.c
arch/powerpc/include/asm/pci-bridge.h +0 -5
@@ -284,11 +284,6 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)extern int pcibios_unmap_io_space (struct pci_bus *bus);extern int pcibios_map_io_space (struct pci_bus *bus); -/* Return values for ppc_md.pci_probe_mode function */ -#define PCI_PROBE_NONE -1/* Don't look at this bus at all */ -#define PCI_PROBE_NORMAL 0/* Do normal PCI probing */ -#define PCI_PROBE_DEVTREE 1/* Instantiate from device tree */ -#ifdef CONFIG_NUMA #define PHB_SET_NODE (PHB ,NODE ) ((PHB)->node = (NODE))#else
arch/powerpc/include/asm/pci.h +5 -0
@@ -22,6 +22,11 @@#include <asm-generic/pci-dma-compat.h> +/* Return values for ppc_md.pci_probe_mode function */ +#define PCI_PROBE_NONE -1/* Don't look at this bus at all */ +#define PCI_PROBE_NORMAL 0/* Do normal PCI probing */ +#define PCI_PROBE_DEVTREE 1/* Instantiate from device tree */ +#define PCIBIOS_MIN_IO 0x1000#define PCIBIOS_MIN_MEM 0x10000000
arch/powerpc/kernel/Makefile +1 -1
@@ -88,7 +88,7 @@ obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ - pci-common.o + pci-common.o pci_of_scan.o obj-$(CONFIG_PCI_MSI) += msi.o obj-$(CONFIG_KEXEC) += machine_kexec.o crash.o \ machine_kexec_$(CONFIG_WORD_SIZE).o
arch/powerpc/kernel/pci-common.c +0 -1
@@ -1617,4 +1617,3 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose) (unsigned long)hose->io_base_virt - _IO_BASE); } -
arch/powerpc/kernel/pci_64.c +0 -289
295 lines not on this page · raw message
arch/powerpc/kernel/pci_of_scan.c new file +358 -0
358 lines not on this page · raw message
Re: [PATCH V2 2/3] powerpc/pci: move pci_64.c device tree scanning code into pci-common.c
Quoted 24 lines · Grant Likely
From: Grant Likely <[email protected]>
The PCI device tree scanning code in
pci_64.cis some useful functionality. It allows PCI devices to be described in the device tree instead of being probed for, which in turn allows pci devices to use all of the device tree facilities to describe complex PCI bus architectures like GPIO and IRQ routing (perhaps not a common situation for desktop or server systems, but useful for embedded systems with on-board PCI devices).This patch moves the device tree scanning into
pci-common.cso it is available for 32-bit powerpc machines too.Signed-off-by Grant Likely <[email protected]>---
arch/powerpc/include/asm/pci-bridge.h | 5 arch/powerpc/include/asm/pci.h | 5 arch/powerpc/kernel/Makefile | 2 arch/powerpc/kernel/pci-common.c | 1 arch/powerpc/kernel/pci_64.c | 289 --------------------------- arch/powerpc/kernel/pci_of_scan.c | 358 ++++++++++++++++++++++++ +++++++++ 6 files changed, 364 insertions(+), 296 deletions(-)
Quoted 2 lines
create mode 100644
arch/powerpc/kernel/pci_of_scan.c
- k
PATCH v2 3/3 powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
In reply to Grant LikelyFrom: Grant Likely <[email protected]>
The two versions are doing almost exactly the same thing. No need to maintain them as separate files. This patch also has the side effect of making the PCI device tree scanning code available to 32 bit powerpc machines, but no board ports actually make use of this feature at this point.
---
arch/powerpc/include/asm/pci.h | 2 ++ arch/powerpc/kernel/pci-common.c | 48 ++++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/pci_32.c | 25 ++------------------ arch/powerpc/kernel/pci_64.c | 46 +++++------------------------------- 4 files changed, 58 insertions(+), 63 deletions(-)
arch/powerpc/include/asm/pci.h +2 -0
@@ -233,6 +233,8 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,extern void pcibios_setup_bus_devices (struct pci_bus *bus);extern void pcibios_setup_bus_self (struct pci_bus *bus); +extern void pcibios_setup_phb_io_space (struct pci_controller *hose); +extern void pcibios_scan_phb (struct pci_controller *hose,void *data);#endif /* __KERNEL__ */ #endif /* __ASM_POWERPC_PCI_H */
arch/powerpc/kernel/pci-common.c +48 -0
51 lines not on this page · raw message
arch/powerpc/kernel/pci_32.c +2 -23
@@ -354,36 +354,15 @@ pci_create_OF_bus_map(void) } } -static void __devinit pcibios_scan_phb (struct pci_controller *hose) +void __devinit pcibios_setup_phb_io_space (struct pci_controller *hose) { -struct pci_bus *bus; -struct device_node *node = hose->dn;unsigned long io_offset;struct resource *res = &hose->io_resource; -pr_debug ("PCI: Scanning PHB %s\n" , - node ? node->full_name :"<NO NAME>" ); - -/* Create an empty bus for the toplevel */ - bus =pci_create_bus (hose->parent, hose->first_busno, hose->ops, hose); -if (bus ==NULL ) { -printk (KERN_ERR "Failed to create bus for PCI domain %04x\n" , - hose->global_number); -return ; - } - bus->secondary = hose->first_busno; - hose->bus = bus; -/* Fixup IO space offset */ io_offset = (unsigned long )hose->io_base_virt - isa_io_base; res->start = (res->start + io_offset) &0xffffffffu ; res->end = (res->end + io_offset) &0xffffffffu ; - -/* Wire up PHB bus resources */ -pcibios_setup_phb_resources (hose); - -/* Scan children */ - hose->last_busno = bus->subordinate =pci_scan_child_bus (bus); }static int __init pcibios_init (void )
@@ -401,7 +380,7 @@ static int __init pcibios_init(void)if (pci_assign_all_buses) hose->first_busno = next_busno; hose->last_busno =0xff ; -pcibios_scan_phb (hose); +pcibios_scan_phb (hose, hose);pci_bus_add_devices (hose->bus);if (pci_assign_all_buses || next_busno <= hose->last_busno) next_busno = hose->last_busno + pcibios_assign_bus_offset;
arch/powerpc/kernel/pci_64.c +6 -40
64 lines not on this page · raw message
Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
Quoted 13 lines · Grant Likely
+/**
+ *pci_scan_phb- Given apci_controller, setup and scan the PCI bus
+ * @hose: Pointer to the PCI host controller instance structure
+ * @data: value to use for sysdata pointer. ppc32 and ppc64 differ here
+ *
+ * Note: the 'data' pointer is a temporary measure. As 32 and 64 bit
+ * pci code gets merged, this parameter should become unnecessary because
+ * both will use the same value.
+ */
+void__devinitpcibios_scan_phb(struct pci_controller *hose, void *data)
Review
Quoted 2 lines
(quoted diff) +2
-0+{ +
Just a nit, but why not data -> sysdata since that's what we using it as.
- k
Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
On Wed, Aug 26, 2009 at 7:29 AM, Kumar Gala<[email protected]> wrot= e:
Quoted 7 lines · Grant Likely
Quoted 5 lines
+/**
+ *pci_scan_phb- Given apci_controller, setup and scan the PCI bus
+ * @hose: Pointer to the PCI host controller instance structure
+ * @data: value to use for sysdata pointer. =A0ppc32 and ppc64 differ h=
ere
Quoted 3 lines
Quoted 3 lines
+ *
+ * Note: the 'data' pointer is a temporary measure. =A0As 32 and 64 bit
+ * pci code gets merged, this parameter should become unnecessary becau=
se
Quoted 3 lines
Quoted 3 lines
+ * both will use the same value.
+ */
+void__devinitpcibios_scan_phb(structpci_controller*hose, void *data=
)
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+{ +Just a nit, but why not data -> sysdata since that's what we using it as.
okay.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
In reply to Grant LikelyQuoted 7 lines · Grant Likely
From: Grant Likely <[email protected]>
The two versions are doing almost exactly the same thing. No need to maintain them as separate files. This patch also has the side effect of making the PCI device tree scanning code available to 32 bit powerpc machines, but no board ports actually make use of this feature at this point.
You missed various calls to scan_phb() in arch/powerpc :-)
At least pSeries with dynamic LPAR is broken, I think iSeries might break too. Try a ppc64_defconfig.
I tentatively applied the other patches to -test
Cheers,
Ben.
Quoted 201 lines
Signed-off-by Grant Likely <[email protected]>---
arch/powerpc/include/asm/pci.h | 2 ++ arch/powerpc/kernel/pci-common.c | 48 ++++++++++++++++++++++++++++++++++++++ arch/powerpc/kernel/pci_32.c | 25 ++------------------ arch/powerpc/kernel/pci_64.c | 46 +++++------------------------------- 4 files changed, 58 insertions(+), 63 deletions(-)arch/powerpc/include/asm/pci.h +2
-0@@ -233,6 +233,8 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,extern void pcibios_setup_bus_devices (struct pci_bus *bus);extern void pcibios_setup_bus_self (struct pci_bus *bus); +extern void pcibios_setup_phb_io_space (struct pci_controller *hose); +extern void pcibios_scan_phb (struct pci_controller *hose,void *data);#endif /* __KERNEL__ */ #endif /* __ASM_POWERPC_PCI_H */ arch/powerpc/kernel/pci-common.c +48
-0@@ -1617,3 +1617,51 @@ void __devinit pcibios_setup_phb_resources(struct pci_controller *hose) (unsigned long)hose->io_base_virt - _IO_BASE); } + +/** +* pci_scan_phb - Given a pci_controller, setup and scan the PCI bus +* @hose: Pointer to the PCI host controller instance structure +* @data: value to use for sysdata pointer. ppc32 and ppc64 differ here +* +* Note: the 'data' pointer is a temporary measure. As 32 and 64 bit +* pci code gets merged, this parameter should become unnecessary because +* both will use the same value. +*/ +void __devinit pcibios_scan_phb (struct pci_controller *hose,void *data) +{ +struct pci_bus *bus; +struct device_node *node = hose->dn; +int mode; + +pr_debug ("PCI: Scanning PHB %s\n" , + node ? node->full_name :"<NO NAME>" ); + +/* Create an empty bus for the toplevel */ + bus =pci_create_bus (hose->parent, hose->first_busno, hose->ops, data); +if (bus ==NULL ) { +pr_err ("Failed to create bus for PCI domain %04x\n" , + hose->global_number); +return ; + } + bus->secondary = hose->first_busno; + hose->bus = bus; + +/* Get some IO space for the new PHB */ +pcibios_setup_phb_io_space (hose); + +/* Wire up PHB bus resources */ +pcibios_setup_phb_resources (hose); + +/* Get probe mode and perform scan */ + mode =PCI_PROBE_NORMAL ; +if (node && ppc_md.pci_probe_mode) + mode = ppc_md.pci_probe_mode (bus); +pr_debug (" probe mode: %d\n" , mode); +if (mode ==PCI_PROBE_DEVTREE ) { + bus->subordinate = hose->last_busno; +of_scan_bus (node, bus); + } + +if (mode ==PCI_PROBE_NORMAL ) + hose->last_busno = bus->subordinate =pci_scan_child_bus (bus); +}arch/powerpc/kernel/pci_32.c +2
-23@@ -354,36 +354,15 @@ pci_create_OF_bus_map(void) } } -static void __devinit pcibios_scan_phb (struct pci_controller *hose) +void __devinit pcibios_setup_phb_io_space (struct pci_controller *hose) { -struct pci_bus *bus; -struct device_node *node = hose->dn;unsigned long io_offset;struct resource *res = &hose->io_resource; -pr_debug ("PCI: Scanning PHB %s\n" , - node ? node->full_name :"<NO NAME>" ); - -/* Create an empty bus for the toplevel */ - bus =pci_create_bus (hose->parent, hose->first_busno, hose->ops, hose); -if (bus ==NULL ) { -printk (KERN_ERR "Failed to create bus for PCI domain %04x\n" , - hose->global_number); -return ; - } - bus->secondary = hose->first_busno; - hose->bus = bus; -/* Fixup IO space offset */ io_offset = (unsigned long )hose->io_base_virt - isa_io_base; res->start = (res->start + io_offset) &0xffffffffu ; res->end = (res->end + io_offset) &0xffffffffu ; - -/* Wire up PHB bus resources */ -pcibios_setup_phb_resources (hose); - -/* Scan children */ - hose->last_busno = bus->subordinate =pci_scan_child_bus (bus); }static int __init pcibios_init (void )@@ -401,7 +380,7 @@ static int __init pcibios_init(void)if (pci_assign_all_buses) hose->first_busno = next_busno; hose->last_busno =0xff ; -pcibios_scan_phb (hose); +pcibios_scan_phb (hose, hose);pci_bus_add_devices (hose->bus);if (pci_assign_all_buses || next_busno <= hose->last_busno) next_busno = hose->last_busno + pcibios_assign_bus_offset;arch/powerpc/kernel/pci_64.c +6
-40@@ -43,45 +43,6 @@ unsigned long pci_probe_only = 1;unsigned long pci_io_base =ISA_IO_BASE ;EXPORT_SYMBOL (pci_io_base); -void __devinit scan_phb (struct pci_controller *hose) -{ -struct pci_bus *bus; -struct device_node *node = hose->dn; -int mode; - -pr_debug ("PCI: Scanning PHB %s\n" , - node ? node->full_name :"<NO NAME>" ); - -/* Create an empty bus for the toplevel */ - bus =pci_create_bus (hose->parent, hose->first_busno, hose->ops, node); -if (bus ==NULL ) { -printk (KERN_ERR "Failed to create bus for PCI domain %04x\n" , - hose->global_number); -return ; - } - bus->secondary = hose->first_busno; - hose->bus = bus; - -/* Get some IO space for the new PHB */ -pcibios_map_io_space (bus); - -/* Wire up PHB bus resources */ -pcibios_setup_phb_resources (hose); - -/* Get probe mode and perform scan */ - mode =PCI_PROBE_NORMAL ; -if (node && ppc_md.pci_probe_mode) - mode = ppc_md.pci_probe_mode (bus); -pr_debug (" probe mode: %d\n" , mode); -if (mode ==PCI_PROBE_DEVTREE ) { - bus->subordinate = hose->last_busno; -of_scan_bus (node, bus); - } - -if (mode ==PCI_PROBE_NORMAL ) - hose->last_busno = bus->subordinate =pci_scan_child_bus (bus); -} -static int __init pcibios_init (void ) {struct pci_controller *hose, *tmp;@@ -103,7 +64,7 @@ static int __init pcibios_init(void)/* Scan all of the recorded PCI controllers. */ list_for_each_entry_safe (hose, tmp, &hose_list, list_node) { -scan_phb (hose); +pcibios_scan_phb (hose, hose->dn);pci_bus_add_devices (hose->bus); }@@ -237,6 +198,11 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus) }EXPORT_SYMBOL_GPL (pcibios_map_io_space); +void __devinit pcibios_setup_phb_io_space (struct pci_controller *hose) +{ +pcibios_map_io_space (hose->bus); +} +#define IOBASE_BRIDGE_NUMBER 0#define IOBASE_MEMORY 1#define IOBASE_IO 2
Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Grant Likely
From: Grant Likely <[email protected]>
The two versions are doing almost exactly the same thing. =A0No need to maintain them as separate files. =A0This patch also has the side effect of making the PCI device tree scanning code available to 32 bit powerpc machines, but no board ports actually make use of this feature at this point.
Quoted 3 lines
You missed various calls to
scan_phb()inarch/powerpc:-)At least pSeries with dynamic LPAR is broken
Oops, yup. I also broke CONFIG_PPC_OF_PLATFORM_PCI in of_platform.c. Fixed now.
Quoted 1 line
I think iSeries might break too.
iSeries has its own unrelated scan_phb() implementation. I don't think I broke it.
Quoted 1 line
Try a
ppc64_defconfig.
Done.
Quoted 1 line
I tentatively applied the other patches to -test
Thanks. New scan_phb() patch to follow.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.