From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: hackup pcibios support for commmon bridge code
Date: Thu, 24 Apr 2014 18:54:10 -0500 [thread overview]
Message-ID: <CAL_JsqKCdLa8N6J-z7GpKw3ffOdugTwiz-bJn4SxyWp7F2V0Kw@mail.gmail.com> (raw)
In-Reply-To: <20140424232000.GN29593@google.com>
On Thu, Apr 24, 2014 at 6:20 PM, Bjorn Helgaas <bhelgaas@google.com> wrote:
> On Thu, Mar 27, 2014 at 05:46:36PM -0500, Rob Herring wrote:
>> From: Rob Herring <robh@kernel.org>
>>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>> arch/arm/kernel/bios32.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 63 insertions(+)
>>
>> diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
>> index 317da88..31ec14a 100644
>> --- a/arch/arm/kernel/bios32.c
>> +++ b/arch/arm/kernel/bios32.c
>> @@ -11,6 +11,7 @@
>> #include <linux/slab.h>
>> #include <linux/init.h>
>> #include <linux/io.h>
>> +#include <linux/of_pci.h>
>>
>> #include <asm/mach-types.h>
>> #include <asm/mach/map.h>
>> @@ -337,6 +338,15 @@ void pcibios_fixup_bus(struct pci_bus *bus)
>> list_for_each_entry(dev, &bus->devices, bus_list) {
>> u16 cmd;
>>
>> + /* Ignore fully discovered devices */
>> + if (dev->is_added)
>> + continue;
>> +
>> + set_dev_node(&dev->dev, pcibus_to_node(dev->bus));
>
> We already do this in pci_device_add(); why do we need it here, too?
Because it was in the arm64 code. I'm not really sure.
>> + /* Read default IRQs and fixup if necessary */
>> + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
>
> Could this be done in pcibios_enable_device() or some other per-device
> interface()? I'd like to get rid of pcibios_fixup_bus() eventually.
Probably. This should return NO_IRQ in the !OF case. We'd need to make
sure that works.
I had a loop at pcibios_fixup_bus across architectures and could make
no sense of why things were done in here. It all seemed a bit random
and left me with questions like shouldn't something always be needed.
Probably a lot of pieces are redundant now that didn't use to be. It
needs someone that knows more about PCI than me to look at.
>> pci_read_config_word(dev, PCI_COMMAND, &cmd);
>> cmd |= features;
>> pci_write_config_word(dev, PCI_COMMAND, cmd);
>> @@ -681,3 +691,56 @@ void __init pci_map_io_early(unsigned long pfn)
>> pci_io_desc.pfn = pfn;
>> iotable_init(&pci_io_desc, 1);
>> }
>> +
>> +struct ioresource {
>> + struct list_head list;
>> + phys_addr_t start;
>> + resource_size_t size;
>> +};
>> +
>> +static LIST_HEAD(io_list);
>> +
>> +int pci_register_io_range(phys_addr_t address, resource_size_t size)
>> +{
>> + struct ioresource *res;
>> + resource_size_t allocated_size = 0;
>> +
>> + /* find if the range has not been already allocated */
>> + list_for_each_entry(res, &io_list, list) {
>> + if (address >= res->start &&
>> + address + size <= res->start + size)
>> + return 0;
>> + allocated_size += res->size;
>> + }
>> +
>> + /* range not already registered, check for space */
>> + if (allocated_size + size > IO_SPACE_LIMIT)
>> + return -E2BIG;
>> +
>> + /* add the range in the list */
>> + res = kzalloc(sizeof(*res), GFP_KERNEL);
>> + if (!res)
>> + return -ENOMEM;
>> + res->start = address;
>> + res->size = size;
>> +
>> + list_add_tail(&res->list, &io_list);
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_register_io_range);
>> +
>> +unsigned long pci_address_to_pio(phys_addr_t address)
>> +{
>> + struct ioresource *res;
>> +
>> + list_for_each_entry(res, &io_list, list) {
>> + if (address >= res->start &&
>> + address < res->start + res->size) {
>> + return res->start - address;
>> + }
>> + }
>> +
>> + return (unsigned long)-1;
>> +}
>> +EXPORT_SYMBOL_GPL(pci_address_to_pio);
>
> ISTR some discussion about this, so maybe this has already been addressed,
> but it doesn't seem right to export generically-named symbols like these
> from the ARM arch code. And they don't look very ARM-specific.
Right, I expect these to go away with Liviu's the next version.
Rob
next prev parent reply other threads:[~2014-04-24 23:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 22:46 [PATCH 0/3] Versatile PCI DT support Rob Herring
2014-03-27 22:46 ` [PATCH 1/3] ARM: hackup pcibios support for commmon bridge code Rob Herring
2014-04-24 23:20 ` Bjorn Helgaas
2014-04-24 23:54 ` Rob Herring [this message]
2014-03-27 22:46 ` [PATCH 2/3] dt/bindings: add versatile PCI binding Rob Herring
2014-03-27 22:46 ` [PATCH 3/3] pci: add DT based ARM Versatile PCI host driver Rob Herring
2014-04-24 23:24 ` Bjorn Helgaas
2014-04-24 23:37 ` Rob Herring
2014-04-25 0:06 ` Bjorn Helgaas
2014-03-28 11:46 ` [PATCH 0/3] Versatile PCI DT support Liviu Dudau
2014-04-24 23:10 ` Bjorn Helgaas
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=CAL_JsqKCdLa8N6J-z7GpKw3ffOdugTwiz-bJn4SxyWp7F2V0Kw@mail.gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).