diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2012-06-26 15:05:33 -0500 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-06-26 15:05:33 -0500 |
| commit | 7a542b67b32742ff5fe286f819df891d1df7bf56 (patch) | |
| tree | cc85c3d9c0c381ae32178616c5956879cd554cb4 /hw/xen-host-pci-device.h | |
| parent | b1a6609e754330c657a057a96322e574c129bc29 (diff) | |
| parent | 3854ca577dad92c4fe97b4a6ebce360e25407af7 (diff) | |
| download | focaccia-qemu-7a542b67b32742ff5fe286f819df891d1df7bf56.tar.gz focaccia-qemu-7a542b67b32742ff5fe286f819df891d1df7bf56.zip | |
Merge remote-tracking branch 'sstabellini/xen-pt' into staging
* sstabellini/xen-pt: Introduce Xen PCI Passthrough, MSI Introduce apic-msidef.h Introduce Xen PCI Passthrough, PCI config space helpers Introduce Xen PCI Passthrough, qdevice qdev-properties: Introduce pci-host-devaddr. pci.c: Add opaque argument to pci_for_each_device. Introduce XenHostPCIDevice to access a pci device on the host. configure: Introduce --enable-xen-pci-passthrough. pci_ids: Add INTEL_82599_SFP_VF id.
Diffstat (limited to 'hw/xen-host-pci-device.h')
| -rw-r--r-- | hw/xen-host-pci-device.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/hw/xen-host-pci-device.h b/hw/xen-host-pci-device.h new file mode 100644 index 0000000000..0079daca51 --- /dev/null +++ b/hw/xen-host-pci-device.h @@ -0,0 +1,55 @@ +#ifndef XEN_HOST_PCI_DEVICE_H +#define XEN_HOST_PCI_DEVICE_H + +#include "pci.h" + +enum { + XEN_HOST_PCI_REGION_TYPE_IO = 1 << 1, + XEN_HOST_PCI_REGION_TYPE_MEM = 1 << 2, + XEN_HOST_PCI_REGION_TYPE_PREFETCH = 1 << 3, + XEN_HOST_PCI_REGION_TYPE_MEM_64 = 1 << 4, +}; + +typedef struct XenHostPCIIORegion { + pcibus_t base_addr; + pcibus_t size; + uint8_t type; + uint8_t bus_flags; /* Bus-specific bits */ +} XenHostPCIIORegion; + +typedef struct XenHostPCIDevice { + uint16_t domain; + uint8_t bus; + uint8_t dev; + uint8_t func; + + uint16_t vendor_id; + uint16_t device_id; + int irq; + + XenHostPCIIORegion io_regions[PCI_NUM_REGIONS - 1]; + XenHostPCIIORegion rom; + + bool is_virtfn; + + int config_fd; +} XenHostPCIDevice; + +int xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain, + uint8_t bus, uint8_t dev, uint8_t func); +void xen_host_pci_device_put(XenHostPCIDevice *pci_dev); + +int xen_host_pci_get_byte(XenHostPCIDevice *d, int pos, uint8_t *p); +int xen_host_pci_get_word(XenHostPCIDevice *d, int pos, uint16_t *p); +int xen_host_pci_get_long(XenHostPCIDevice *d, int pos, uint32_t *p); +int xen_host_pci_get_block(XenHostPCIDevice *d, int pos, uint8_t *buf, + int len); +int xen_host_pci_set_byte(XenHostPCIDevice *d, int pos, uint8_t data); +int xen_host_pci_set_word(XenHostPCIDevice *d, int pos, uint16_t data); +int xen_host_pci_set_long(XenHostPCIDevice *d, int pos, uint32_t data); +int xen_host_pci_set_block(XenHostPCIDevice *d, int pos, uint8_t *buf, + int len); + +int xen_host_pci_find_ext_cap_offset(XenHostPCIDevice *s, uint32_t cap); + +#endif /* !XEN_HOST_PCI_DEVICE_H_ */ |