From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Anton Blanchard <anton@samba.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH v2 4/7] powerpc/PCI: convert devtree bus addresses to resource
Date: Sat, 17 Mar 2012 14:33:09 +1100 [thread overview]
Message-ID: <1331955189.3105.177.camel@pasglop> (raw)
In-Reply-To: <20120316234814.6649.47469.stgit@bhelgaas.mtv.corp.google.com>
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, ®ion);
> }
> }
>
> @@ -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, ®ion);
> }
> sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
> bus->number);
next prev parent reply other threads:[~2012-03-17 3:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
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
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=1331955189.3105.177.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=anton@samba.org \
--cc=bhelgaas@google.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).