[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC V1 07/11] host-pci-device: Add host_pci_find
From: |
Stefano Stabellini |
Subject: |
Re: [Qemu-devel] [PATCH RFC V1 07/11] host-pci-device: Add host_pci_find_ext_cap_offset |
Date: |
Wed, 5 Oct 2011 12:07:44 +0100 |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
On Tue, 4 Oct 2011, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <address@hidden>
any reason why we shouldn't merge this patch with patch #1?
> ---
> hw/host-pci-device.c | 31 +++++++++++++++++++++++++++++++
> hw/host-pci-device.h | 2 ++
> 2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/hw/host-pci-device.c b/hw/host-pci-device.c
> index b3f2899..2a889d5 100644
> --- a/hw/host-pci-device.c
> +++ b/hw/host-pci-device.c
> @@ -162,6 +162,37 @@ int host_pci_write_block(HostPCIDevice *d, int pos,
> uint8_t *buf, int len)
> return host_pci_config_write(d, pos, buf, len);
> }
>
> +uint32_t host_pci_find_ext_cap_offset(HostPCIDevice *d, uint32_t cap)
> +{
> + uint32_t header = 0;
> + int max_cap = 480;
> + int pos = 0x100;
> +
> + do {
> + header = host_pci_read_long(d, pos);
> + /*
> + * If we have no capabilities, this is indicated by cap ID,
> + * cap version and next pointer all being 0.
> + */
> + if (header == 0) {
> + break;
> + }
> +
> + if (PCI_EXT_CAP_ID(header) == cap) {
> + return pos;
> + }
> +
> + pos = PCI_EXT_CAP_NEXT(header);
> + if (pos < 0x100) {
> + break;
> + }
> +
> + max_cap--;
> + } while (max_cap > 0);
> +
> + return 0;
> +}
> +
> HostPCIDevice *host_pci_device_get(uint8_t bus, uint8_t dev, uint8_t func)
> {
> HostPCIDevice *d = NULL;
> diff --git a/hw/host-pci-device.h b/hw/host-pci-device.h
> index 0137507..2734eb3 100644
> --- a/hw/host-pci-device.h
> +++ b/hw/host-pci-device.h
> @@ -33,4 +33,6 @@ int host_pci_write_word(HostPCIDevice *d, int pos, uint16_t
> data);
> int host_pci_write_long(HostPCIDevice *d, int pos, uint32_t data);
> int host_pci_write_block(HostPCIDevice *d, int pos, uint8_t *buf, int len);
>
> +uint32_t host_pci_find_ext_cap_offset(HostPCIDevice *s, uint32_t cap);
> +
> #endif /* !HW_HOST_PCI_DEVICE */
> --
> Anthony PERARD
>
- [Qemu-devel] [PATCH RFC V1 03/11] pci_ids: Add INTEL_82599_VF id., (continued)
- [Qemu-devel] [PATCH RFC V1 03/11] pci_ids: Add INTEL_82599_VF id., Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 05/11] pci_regs: Add PCI_EXP_TYPE_PCIE_BRIDGE, Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 06/11] pci.c: Add pci_check_bar_overlap, Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 11/11] config/make: Introduce --enable-xen-pci-passthrough, built it., Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 08/11] Introduce Xen PCI Passthrough, qdevice (1/3), Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 10/11] Introduce Xen PCI Passthrough, MSI (3/3), Anthony PERARD, 2011/10/04
- [Qemu-devel] [PATCH RFC V1 07/11] host-pci-device: Add host_pci_find_ext_cap_offset, Anthony PERARD, 2011/10/04
- Re: [Qemu-devel] [PATCH RFC V1 07/11] host-pci-device: Add host_pci_find_ext_cap_offset,
Stefano Stabellini <=
- [Qemu-devel] [PATCH RFC V1 09/11] Introduce Xen PCI Passthrough, PCI config space helpers (2/3), Anthony PERARD, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Avi Kivity, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Anthony Liguori, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Stefano Stabellini, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Alex Williamson, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Stefano Stabellini, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Avi Kivity, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Jan Kiszka, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Avi Kivity, 2011/10/04
- Re: [Qemu-devel] [Xen-devel] [PATCH RFC V1 00/11] Xen PCI Passthrough, Stefano Stabellini, 2011/10/04