| To: | Deng-Cheng Zhu <dczhu@mips.com> |
|---|---|
| Subject: | Re: [PATCH v2 2/2] MIPS: PCI: Pass controller's resources to pci_create_bus() in pcibios_scanbus() |
| From: | Bjorn Helgaas <bhelgaas@google.com> |
| Date: | Thu, 25 Aug 2011 10:09:48 -0600 |
| Cc: | jbarnes@virtuousgeek.org, ralf@linux-mips.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, eyal@mips.com, zenon@mips.com, dengcheng.zhu@gmail.com |
| Dkim-signature: | v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1314288611; bh=cNTGNnam95OslwnUfiwuCIQQoWY=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type:Content-Transfer-Encoding; b=AWZVg1SG0CXXxQCkTsFKn/rVSVBLLQqFRGIO0jok8EcONgUSqrhiQaqfwDanYi4ZV kjBSMDOxscO4HEUziaGPQ== |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=MzUY4udQkTiz3jNMqMMahStHIpzyOhkQU4Gek6/Mb/w=; b=MkrDms4wYxRUh+WzxZRtRt78U3hIev1tQB+CcAnxf7ioTUVGf2wTD5a7B61myWvA1H ZF5hIze1F5YxU7abRoHg== |
| Domainkey-signature: | a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=dkim-signature:mime-version:in-reply-to:references:from:date: message-id:subject:to:cc:content-type: content-transfer-encoding:x-system-of-record; b=yaotez9k1m6Xi/Jj2McGi3OpAKe/bRmKv/BCU1JNTkPdvcgZqFc1XUF28rTsUP6Mt oyngjAHy7Y84y6GHpYCzw== |
| In-reply-to: | <1314271117-32717-3-git-send-email-dczhu@mips.com> |
| References: | <1314271117-32717-1-git-send-email-dczhu@mips.com> <1314271117-32717-3-git-send-email-dczhu@mips.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
On Thu, Aug 25, 2011 at 5:18 AM, Deng-Cheng Zhu <dczhu@mips.com> wrote:
> Use the new interface of pci_create_bus() so that system controller's
> resources are added to the root bus upon bus creation, thereby avoiding
> conflicts with PCI quirks before pcibios_fixup_bus() gets the chance to do
> right things in pci_scan_child_bus(). Also, since we are passing resources
> to pci_create_bus() and setting them up in the bus->resources list as
> opposed to the bus->resource[] array, we have to adopt the list style while
> doing bus fixups later on, or else, for example in this MIPS case, system
> controller's resources will stay in both bus->resources and
> bus->resource[].
> +static void __devinit
> +pcibios_setup_root_resources(struct pci_bus *bus, struct pci_controller
> *ctrl)
> +{
> + pci_bus_remove_resources(bus);
> + pci_bus_add_resource(bus, ctrl->io_resource, 0);
> + pci_bus_add_resource(bus, ctrl->mem_resource, 0);
> +}
> +
> void __devinit pcibios_fixup_bus(struct pci_bus *bus)
> {
> /* Propagate hose info into the subordinate devices. */
> @@ -269,10 +313,9 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
> struct list_head *ln;
> struct pci_dev *dev = bus->self;
>
> - if (!dev) {
> - bus->resource[0] = hose->io_resource;
> - bus->resource[1] = hose->mem_resource;
> - } else if (pci_probe_only &&
> + if (!dev)
> + pcibios_setup_root_resources(bus, hose);
As I mentioned in my other response, I think you can just drop this
whole "if (!dev)" block since the root bus resources should already be
correct. There's no need to move them from the bus->resource[] array
to the bus->resources list.
Someday, if all arches adopt your nice pci_create_bus() extension to
make root bus resources correct from the beginning, there should be no
arch references to the bus->resource[] array left, and then we can
remove it altogether. At least, that's what I was hoping when I added
the list :)
In any case, all the *readers* of bus resources already use the
pci_bus_for_each_resource() interface, which knows how to look at both
the array and the list.
Bjorn
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [RFC PATCH 1/3] MIPS: PCI: Use pci_bus_remove_resources()/pci_bus_add_resource() to set up root resources, Bjorn Helgaas |
|---|---|
| Next by Date: | Re: select() to /dev/rtc0 to wait for clock tick timed out, Matt Turner |
| Previous by Thread: | [PATCH v2 2/2] MIPS: PCI: Pass controller's resources to pci_create_bus() in pcibios_scanbus(), Deng-Cheng Zhu |
| Next by Thread: | [PATCH v3 0/2] Pass resources to pci_create_bus() and fix MIPS PCI resources, Deng-Cheng Zhu |
| Indexes: | [Date] [Thread] [Top] [All Lists] |