On Thursday 27 February 2014 14:21:03 Liviu Dudau wrote:
On Thu, Feb 27, 2014 at 02:08:44PM +0000, Arnd Bergmann wrote:
I think using pci_address_to_pio() at that point is just wrong in either way. Before the host is fully registered, you can't actually look up the port number -- you are only trying to assign one at this time.
The implementation that Will wrote for ARM would work here: find the next available virtual I/O range, call pci_ioremap_io on range->pci_addr and then return the virtual address. Unfortunately that code is not architecture independent at this time, and we will first have to come up with something that can be made to work for powerpc, microblaze, mips and arm.
No, no, no... we cannot use the virtual address as the start of the resource as this will later be used when doing pcibios_resource_to_bus().
My mistake: I meant to say return the offset into the virtual window, i.e. what IORESOURCE_IO space is about.
What we need here is a portable way of converting from PCI range that uses physical CPU addresses to a IORESOURCE_IO type resource that uses logical IO addresses. Using logical IO values works, as Bjorn's code treats it as physical address.
Right.
Arnd