linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource
       [not found] <20120316234653.6649.59492.stgit@bhelgaas.mtv.corp.google.com>
@ 2012-03-16 23:48 ` Bjorn Helgaas
  2012-03-17  3:33   ` Benjamin Herrenschmidt
  2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: linux-pci, linuxppc-dev, Anton Blanchard

Normal PCI enumeration via PCI config space uses __pci_read_base(), where
the PCI core applies any bus-to-resource offset.  But powerpc doesn't use
that path when enumerating via the device tree.

In 6c5705fec63d, I converted powerpc to use the PCI core bus-to-resource
conversion, but I missed these powerpc-specific paths.  Some powerpc
platforms fail to boot ("Cannot allocate resource region," "device not
available," etc.) between that commit and this one.

This adds the corresponding bus-to-resource conversion in the paths that
read BAR values from the OF device tree.

CC: Anton Blanchard <anton@samba.org>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/powerpc/kernel/pci_of_scan.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index b37d0b5..89dde17 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
 {
 	u64 base, size;
 	unsigned int flags;
+	struct pci_bus_region region;
 	struct resource *res;
 	const u32 *addrs;
 	u32 i;
@@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
 			printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
 			continue;
 		}
-		res->start = base;
-		res->end = base + size - 1;
 		res->flags = flags;
 		res->name = pci_name(dev);
+		region.start = base;
+		region.end = base + size - 1;
+		pcibios_bus_to_resource(dev, res, &region);
 	}
 }
 
@@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
 	struct pci_bus *bus;
 	const u32 *busrange, *ranges;
 	int len, i, mode;
+	struct pci_bus_region region;
 	struct resource *res;
 	unsigned int flags;
 	u64 size;
@@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
 			res = bus->resource[i];
 			++i;
 		}
-		res->start = of_read_number(&ranges[1], 2);
-		res->end = res->start + size - 1;
 		res->flags = flags;
+		region.start = of_read_number(&ranges[1], 2);
+		region.end = region.start + size - 1;
+		pcibios_bus_to_resource(dev, res, &region);
 	}
 	sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
 		bus->number);

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

* [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi
       [not found] <20120316234653.6649.59492.stgit@bhelgaas.mtv.corp.google.com>
  2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
@ 2012-03-16 23:48 ` Bjorn Helgaas
  2012-03-17  3:33   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2012-03-16 23:48 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: Olof Johansson, linux-pci, linuxppc-dev

We believe there's no reason to prevent reallocation on PA Semi, so
revert to the default of "allow reallocation if necessary."

CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Tested-by: Olof Johansson <olof@lixom.net>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 arch/powerpc/platforms/pasemi/pci.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index b27d886..aa86271 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -229,9 +229,6 @@ void __init pas_pci_init(void)
 
 	/* Setup the linkage between OF nodes and PHBs */
 	pci_devs_phb_init();
-
-	/* Use the common resource allocation mechanism */
-	pci_add_flags(PCI_PROBE_ONLY);
 }
 
 void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)

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

* Re: [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource
  2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
@ 2012-03-17  3:33   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2012-03-17  3:33 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linuxppc-dev, Anton Blanchard, Jesse Barnes

On Fri, 2012-03-16 at 17:48 -0600, Bjorn Helgaas wrote:
> Normal PCI enumeration via PCI config space uses __pci_read_base(), where
> the PCI core applies any bus-to-resource offset.  But powerpc doesn't use
> that path when enumerating via the device tree.
> 
> In 6c5705fec63d, I converted powerpc to use the PCI core bus-to-resource
> conversion, but I missed these powerpc-specific paths.  Some powerpc
> platforms fail to boot ("Cannot allocate resource region," "device not
> available," etc.) between that commit and this one.
> 
> This adds the corresponding bus-to-resource conversion in the paths that
> read BAR values from the OF device tree.
> 
> CC: Anton Blanchard <anton@samba.org>

Acked-By: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> CC: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  arch/powerpc/kernel/pci_of_scan.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
> index b37d0b5..89dde17 100644
> --- a/arch/powerpc/kernel/pci_of_scan.c
> +++ b/arch/powerpc/kernel/pci_of_scan.c
> @@ -75,6 +75,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
>  {
>  	u64 base, size;
>  	unsigned int flags;
> +	struct pci_bus_region region;
>  	struct resource *res;
>  	const u32 *addrs;
>  	u32 i;
> @@ -106,10 +107,11 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
>  			printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
>  			continue;
>  		}
> -		res->start = base;
> -		res->end = base + size - 1;
>  		res->flags = flags;
>  		res->name = pci_name(dev);
> +		region.start = base;
> +		region.end = base + size - 1;
> +		pcibios_bus_to_resource(dev, res, &region);
>  	}
>  }
>  
> @@ -209,6 +211,7 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
>  	struct pci_bus *bus;
>  	const u32 *busrange, *ranges;
>  	int len, i, mode;
> +	struct pci_bus_region region;
>  	struct resource *res;
>  	unsigned int flags;
>  	u64 size;
> @@ -270,9 +273,10 @@ void __devinit of_scan_pci_bridge(struct pci_dev *dev)
>  			res = bus->resource[i];
>  			++i;
>  		}
> -		res->start = of_read_number(&ranges[1], 2);
> -		res->end = res->start + size - 1;
>  		res->flags = flags;
> +		region.start = of_read_number(&ranges[1], 2);
> +		region.end = region.start + size - 1;
> +		pcibios_bus_to_resource(dev, res, &region);
>  	}
>  	sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
>  		bus->number);

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

* Re: [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi
  2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
@ 2012-03-17  3:33   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2012-03-17  3:33 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Olof Johansson, linux-pci, linuxppc-dev, Jesse Barnes

On Fri, 2012-03-16 at 17:48 -0600, Bjorn Helgaas wrote:
> We believe there's no reason to prevent reallocation on PA Semi, so
> revert to the default of "allow reallocation if necessary."
> 

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: linuxppc-dev@lists.ozlabs.org
> Tested-by: Olof Johansson <olof@lixom.net>
> Acked-by: Olof Johansson <olof@lixom.net>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  arch/powerpc/platforms/pasemi/pci.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
> index b27d886..aa86271 100644
> --- a/arch/powerpc/platforms/pasemi/pci.c
> +++ b/arch/powerpc/platforms/pasemi/pci.c
> @@ -229,9 +229,6 @@ void __init pas_pci_init(void)
>  
>  	/* Setup the linkage between OF nodes and PHBs */
>  	pci_devs_phb_init();
> -
> -	/* Use the common resource allocation mechanism */
> -	pci_add_flags(PCI_PROBE_ONLY);
>  }
>  
>  void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)

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

end of thread, other threads:[~2012-03-17  3:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20120316234653.6649.59492.stgit@bhelgaas.mtv.corp.google.com>
2012-03-16 23:48 ` [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource Bjorn Helgaas
2012-03-17  3:33   ` Benjamin Herrenschmidt
2012-03-16 23:48 ` [PATCH v2 5/7] powerpc/PCI: allow reallocation on PA Semi Bjorn Helgaas
2012-03-17  3:33   ` Benjamin Herrenschmidt

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).