Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

2009-08-28 Thread Grant Likely
On Wed, Aug 26, 2009 at 11:46 PM, Benjamin
Herrenschmidt wrote:
> On Wed, 2009-08-26 at 00:07 -0600, Grant Likely wrote:
>> From: Grant Likely 
>>
>> 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

Oops, yup.  I also broke CONFIG_PPC_OF_PLATFORM_PCI in of_platform.c.
Fixed now.

> I think iSeries might break too.

iSeries has its own unrelated scan_phb() implementation.  I don't
think I broke it.

> Try a ppc64_defconfig.

Done.

> I tentatively applied the other patches to -test

Thanks.  New scan_phb() patch to follow.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

2009-08-26 Thread Benjamin Herrenschmidt
On Wed, 2009-08-26 at 00:07 -0600, Grant Likely wrote:
> From: Grant Likely 
> 
> 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.

> Signed-off-by: Grant Likely 
> ---
> 
>  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(-)
> 
> 
> diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
> index 9ae2e3e..feebfed 100644
> --- a/arch/powerpc/include/asm/pci.h
> +++ b/arch/powerpc/include/asm/pci.h
> @@ -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 */
> diff --git a/arch/powerpc/kernel/pci-common.c 
> b/arch/powerpc/kernel/pci-common.c
> index 44497a8..8a16dbe 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -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 : "");
> +
> + /* 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);
> +}
> diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> index 1e807fe..4e415e1 100644
> --- a/arch/powerpc/kernel/pci_32.c
> +++ b/arch/powerpc/kernel/pci_32.c
> @@ -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 : "");
> -
> - /* 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) & 0xu;
>   res->end = (res->end + io_offset) & 0x

Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

2009-08-26 Thread Grant Likely
On Wed, Aug 26, 2009 at 7:29 AM, Kumar Gala wrote:
>
> On Aug 26, 2009, at 1:07 AM, Grant Likely wrote:
>
>> +/**
>> + * 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)
>> +{
>> +
>
> Just a nit, but why not data -> sysdata since that's what we using it as.

okay.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()

2009-08-26 Thread Kumar Gala


On Aug 26, 2009, at 1:07 AM, Grant Likely wrote:


+/**
+ * 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)

+{
+


Just a nit, but why not data -> sysdata since that's what we using it  
as.


- k
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev