On 8 October 2013 17:55, Rob Herring <robherring2@xxxxxxxxx> wrote: > 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 > Some of this work made it into the kernel... The OF parts of pci_process_bridge_OF_ranges was split into of_pci_range_parser and for_each_of_pci_range [1]. I then refactored some of the pci_process_bridge_OF_ranges functions to use this parser, this was accepted by Microblaze [2] and has been recently acked by Ralf for MIPS but not made it upstream yet [3]. I think I submitted a patch for PowerPC at one point, but not sure what happened to that. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=29b635c00f3ebcdaf7a52c4948f6d948ad3757d3 [2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4f7b6de437544cd1e2e210919cb58cbe5cc3c393 [3] http://www.linux-mips.org/archives/linux-mips/2013-09/msg00125.html I'd like to get involved, but don't have any time at the moment. Thanks, Andrew Murray -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html