• Thierry Reding's avatar
    PCI: tegra: Implement a proper resource hierarchy · 41534e53
    Thierry Reding authored
    Currently the resource hierarchy generated from the PCIe host bridge is
    completely flat:
    
        $ cat /proc/iomem
        00000000-00000fff : /pcie-controller@00003000/pci@1,0
        00003000-000037ff : pads
        00003800-000039ff : afi
        10000000-1fffffff : cs
        28000000-28003fff : r8169
        28004000-28004fff : r8169
        ...
    
    The host bridge driver doesn't request all the resources that are used.
    Windows allocated to each of the root ports aren't tracked, so there is no
    way for resources allocated to individual devices to be matched up with the
    correct parent resource by the PCI core.
    
    This patch addresses this in two steps.  It first takes the union of all
    regions associated with the PCIe host bridge (control registers, root port
    registers, configuration space, I/O and prefetchable as well as non-
    prefetchable memory regions) and uses it as the new root of the resource
    hierarchy.
    
    Subsequently, regions are allocated from within this new root resource so
    that the resource tree looks much more like what's expected:
    
        # cat /proc/iomem
        00000000-3fffffff : /pcie-controller@00003000
          00000000-00000fff : /pcie-controller@00003000/pci@1,0
          00003000-000037ff : pads
          00003800-000039ff : afi
          10000000-1fffffff : cs
          20000000-27ffffff : non-prefetchable
          28000000-3fffffff : prefetchable
            28000000-280fffff : PCI Bus 0000:01
              28000000-28003fff : 0000:01:00.0
                28000000-28003fff : r8169
              28004000-28004fff : 0000:01:00.0
                28004000-28004fff : r8169
        ...
    Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    41534e53
pci-tegra.c 48.9 KB