Subject: [PATCH v2 3/3] PCI: ARM: add support for generic PCI host controller

From: [email-masked] (Jason Gunthorpe)
Date: Tue, 18 Feb 2014 23:48:50 -0700

On Wed, Feb 19, 2014 at 02:44:27AM +0000, Liviu Dudau wrote:
 
> I wish things were easier!

Yah, I've seen some of this complexity too..

A thought that crosses my head is to try and leave the entire arch
support intact and build a separate 'domain-driver-based' support
that completely replaces the arch support, a domain would use one or
the other but never both.

So pci_domain_nr could become:

  struct pci_domain_driver *drv = pci_get_domain_driver(bus);
  if (drv)
       return drv->domain_nr;
  else
       return _arch_pci_domain_nr(bus);

And other funcs would change effectively the same way.

> And if someone has a good idea on how to determine the domain # from
> DT we can pluck it into the pcibios_root_bridge_prepare() function
> (either the generic version or the arch specific one).

You can probably start with 'of_alias_get_id'..

Jason