linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: sfr@canb.auug.org.au, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
Date: Thu, 27 Aug 2009 15:46:21 +1000	[thread overview]
Message-ID: <1251351981.20467.37.camel@pasglop> (raw)
In-Reply-To: <20090826060716.30936.40578.stgit@localhost.localdomain>

On Wed, 2009-08-26 at 00:07 -0600, Grant Likely wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
> 
> 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 <grant.likely@secretlab.ca>
> ---
> 
>  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 : "<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);
> +}
> 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 : "<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;
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 4d5b4ce..ba949a2 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -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

  parent reply	other threads:[~2009-08-27  5:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26  6:07 [PATCH V2 1/3] powerpc/pci: Remove dead checks for CONFIG_PPC_OF Grant Likely
2009-08-26  6:07 ` [PATCH V2 2/3] powerpc/pci: move pci_64.c device tree scanning code into pci-common.c Grant Likely
2009-08-26 13:24   ` Kumar Gala
2009-08-26  6:07 ` [PATCH V2 3/3] powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan() Grant Likely
2009-08-26 13:29   ` Kumar Gala
2009-08-26 17:52     ` Grant Likely
2009-08-27  5:46   ` Benjamin Herrenschmidt [this message]
2009-08-28 18:42     ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1251351981.20467.37.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).