On 10/08/2013 11:32 AM, Bjorn Helgaas wrote: > [+cc Grant, Rob, devicetree list] > > On Tue, Oct 8, 2013 at 8:42 AM, Liviu Dudau <Liviu.Dudau@xxxxxxx> wrote: >> Hello, >> >> I am working on adding PCIe support for a new architecture and looking >> at various existing implementations of pcibios functions I've realised >> that some architectures share a lot of common code. As I don't like to >> repeat the pattern again without any good reasons, I am wondering if >> there is any appetite for carving out those common functions into >> a generic place under drivers/pci/pcibios.c where they can be reused. >> >> Things that I am specifically looking at are pcibios_{alloc,free}_controller, >> pci_process_bridge_OF_ranges and anything that will make adding support >> for PCI/PCIe in a new architecture easier. Candidates for promoting >> to a generic place are the functions found in both powerpc and microblaze >> as they seem to be mostly identical, they support DT bindings and are >> 64bits ready. > > I'm very much in favor of unifying code to reduce duplication across > architectures. > > In general, the pcibios_*() interfaces are things used by the PCI core > (drivers/pci) but implemented by the architecture. The specific cases > you mentioned are not actually used by the PCI core, so my inclination > would be to name them something else and possibly put them somewhere > other than drivers/pci. > > I wonder if pci_process_bridge_OF_ranges() would fit somewhere in > drivers/of? The implementations I looked at are mostly concerned with > parsing OF resources, and they don't have much to do with PCI > directly. This was being done until Ben weighed in: https://lkml.org/lkml/2013/5/4/103 Rob > pcibios_alloc_controller() is implemented by microblaze, powerpc, and > xtensa. Each of those arches defines its own "struct pci_controller", > so it won't be completely trivial to unify this. I tried to start > some unification with the "struct pci_host_bridge" in the core, but > haven't made much progress there. > > Bjorn > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html