From: Andrew Jones <drjones@redhat.com>
To: Alexander Gordeev <agordeev@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu
Subject: Re: [kvm-unit-tests PATCH 10/11] arm/pci: PCI devices basic info printing
Date: Fri, 15 Jan 2016 16:38:02 +0100 [thread overview]
Message-ID: <20160115153802.GP3915@hawk.localdomain> (raw)
In-Reply-To: <9122dc5a32fc248e2cde597f02fa8efb9cb21591.1452341807.git.agordeev@redhat.com>
On Sat, Jan 09, 2016 at 01:22:57PM +0100, Alexander Gordeev wrote:
> Cc: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
> ---
> lib/pci-host-generic.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/lib/pci-host-generic.c b/lib/pci-host-generic.c
> index 2d218a4..50cf09a 100644
> --- a/lib/pci-host-generic.c
> +++ b/lib/pci-host-generic.c
> @@ -352,6 +352,35 @@ static phys_addr_t pci_alloc_res(struct pci_host_bridge *host,
> return addr;
> }
>
> +static void pci_dev_print(void *conf)
> +{
> + u16 vendor_id = pci_config_readw(conf, PCI_VENDOR_ID);
> + u16 device_id = pci_config_readw(conf, PCI_DEVICE_ID);
> + u8 header = pci_config_readb(conf, PCI_HEADER_TYPE);
> + u8 progif = pci_config_readb(conf, PCI_CLASS_PROG);
> + u8 subcl = pci_config_readb(conf, PCI_CLASS_DEVICE);
> + u8 class = pci_config_readb(conf, PCI_CLASS_DEVICE + 1);
> +
> + printf("conf %p vendor_id %04x device_id %04x type %d "
> + "progif %02x class %02x subcl %02x\n",
> + conf, vendor_id, device_id, header,
> + progif, class, subcl);
> +}
> +
> +static void pci_dev_bar_print(int bar, pci_res_type_t type,
> + phys_addr_t addr, u64 size, bool is64)
> +{
> + const char *desc = addr_space_desc[type];
> +
> + if (is64) {
> + printf("\tBAR#%d,%d [%-7s %02x-%02x]\n",
> + bar, bar + 1, desc, addr, addr + size - 1);
> + } else {
> + printf("\tBAR#%d [%-7s %02x-%02x]\n",
> + bar, desc, addr, addr + size - 1);
> + }
> +}
> +
> int pci_bus_scan(struct pci *pci)
> {
> void *conf;
> @@ -365,6 +394,8 @@ int pci_bus_scan(struct pci *pci)
> int nr_dev = 0;
>
> for_each_pci_dev(pci, dev, conf) {
> + pci_dev_print(conf);
> +
> /* We are only interested in normal PCI devices */
> if (pci_config_readb(conf, PCI_HEADER_TYPE) !=
> PCI_HEADER_TYPE_NORMAL)
> @@ -375,6 +406,9 @@ int pci_bus_scan(struct pci *pci)
> break;
> addr = pci_alloc_res(pci->sysdata, type, size);
> pci_set_bar(conf, bar, addr, is64);
> +
> + pci_dev_bar_print(bar, type, addr, size, is64);
> +
> if (is64)
> bar++;
>
> --
> 1.8.3.1
>
I don't think we'll want to print on every bus scan. We should have a
special pci_dump_devices or something that can be called if needed.
Otherwise looks good
drew
next prev parent reply other threads:[~2016-01-15 15:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-09 12:22 [kvm-unit-tests PATCH 00/11] pci/arm: add PCI bus support Alexander Gordeev
2016-01-09 12:22 ` [kvm-unit-tests PATCH 01/11] arm/pci: Device tree PCI probing Alexander Gordeev
2016-01-13 15:13 ` Andrew Jones
2016-01-28 15:17 ` Alexander Gordeev
2016-01-28 16:40 ` Andrew Jones
2016-02-05 11:48 ` Alexander Gordeev
2016-02-05 12:18 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 02/11] arm/pci: PCI bus scanning Alexander Gordeev
2016-01-13 15:58 ` Andrew Jones
2016-02-02 9:34 ` Alexander Gordeev
2016-02-02 11:20 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 03/11] arm/pci: Read devices BARs Alexander Gordeev
2016-01-09 12:22 ` [kvm-unit-tests PATCH 04/11] arm/pci: Allocate and assign memory/io space resources Alexander Gordeev
2016-01-09 12:22 ` [kvm-unit-tests PATCH 05/11] arm/pci: Add pci_find_dev() and pci_bar_addr() functions Alexander Gordeev
2016-01-15 15:17 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 06/11] arm/pci: PCI testdev existence test Alexander Gordeev
2016-01-09 12:22 ` [kvm-unit-tests PATCH 07/11] arm/pci: PCI device operation test Alexander Gordeev
2016-01-15 15:32 ` Andrew Jones
2016-02-04 12:18 ` Alexander Gordeev
2016-02-04 15:31 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 08/11] arm/pci: PCI device read/write test Alexander Gordeev
2016-01-15 15:33 ` Andrew Jones
2016-02-04 12:03 ` Alexander Gordeev
2016-01-15 15:34 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 09/11] arm/pci: PCI host bridge info printing Alexander Gordeev
2016-01-15 15:35 ` Andrew Jones
2016-01-09 12:22 ` [kvm-unit-tests PATCH 10/11] arm/pci: PCI devices basic " Alexander Gordeev
2016-01-15 15:38 ` Andrew Jones [this message]
2016-01-09 12:22 ` [kvm-unit-tests PATCH 11/11] arm/pci: PCI testdev test flavour printing Alexander Gordeev
2016-01-15 15:39 ` Andrew Jones
2016-01-15 15:42 ` [kvm-unit-tests PATCH 00/11] pci/arm: add PCI bus support Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160115153802.GP3915@hawk.localdomain \
--to=drjones@redhat.com \
--cc=agordeev@redhat.com \
--cc=kvmarm@lists.cs.columbia.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.