On Sat, Jan 09, 2016 at 01:22:56PM +0100, Alexander Gordeev wrote:
> Cc: Andrew Jones <[email protected]>
> Signed-off-by: Alexander Gordeev <[email protected]>
> ---
>  lib/pci-host-generic.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/lib/pci-host-generic.c b/lib/pci-host-generic.c
> index 3d9c271..2d218a4 100644
> --- a/lib/pci-host-generic.c
> +++ b/lib/pci-host-generic.c
> @@ -19,6 +19,15 @@
>            dev >= 0;                                  \
>            dev = find_next_dev(pci, dev, &conf))
>  
> +static char *addr_space_desc[] = {
> +     [PCI_RES_TYPE_CONF]             = "CONF",
> +     [PCI_RES_TYPE_IO]               = "IO",
> +     [PCI_RES_TYPE_MEM32]            = "MEM32",
> +     [PCI_RES_TYPE_MEM64]            = "MEM64",
> +     [PCI_RES_TYPE_PREFMEM32]        = "MEM32/p",
> +     [PCI_RES_TYPE_PREFMEM64]        = "MEM64/p"
> +};
> +
>  static pci_res_type_t flags_to_type(u32 of_flags)
>  {
>       return ((of_flags & 0x40000000) >> 28) | ((of_flags >> 24) & 0x03);
> @@ -105,6 +114,28 @@ static void pci_host_addr_space_init(struct 
> pci_addr_space as[], int nr_as,
>       }
>  }
>  
> +static void pci_host_bridge_print(struct pci_host_bridge *host)
> +{
> +     printf("PCIe start %016llx size %016llx "
> +            "bus %02x bus_max %02x #spaces %d\n\n",
> +             host->cpu_range.start, host->cpu_range.size,
> +             host->bus, host->bus_max, host->nr_addr_spaces);
> +}
> +
> +static void pci_address_spaces_print(struct pci_addr_space as[], int nr_as)
> +{
> +     int i;
> +
> +     for (i = 0; i < nr_as; i++, as++) {
> +             printf("%s address space:\n"
> +                    "CPU: start %016llx size %016llx\n"
> +                    "PCI: start %016llx size %016llx\n\n",
> +                     addr_space_desc[flags_to_type(as->of_flags)],
> +                     as->cpu_range.start, as->cpu_range.size,
> +                     as->pci_range.start, as->pci_range.size);
> +     }
> +}
> +
>  /*
>   * Probe DT for a generic PCI host controller
>   * See kernel Documentation/devicetree/bindings/pci/host-generic-pci.txt
> @@ -180,9 +211,13 @@ static struct pci_host_bridge 
> *pci_host_bridge_probe(void)
>       host->bus_max           = bus_max;
>       host->nr_addr_spaces    = nr_addr_spaces;
>  
> +     pci_host_bridge_print(host);
> +
>       pci_host_addr_space_init(&host->addr_space[0], nr_addr_spaces,
>                                (u32*)prop->data, nr_range_cells);
>  
> +     pci_address_spaces_print(&host->addr_space[0], host->nr_addr_spaces);
> +
>       return host;
>  }

Looks good

drew
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to