]> git.proxmox.com Git - mirror_qemu.git/blame - hw/xen/xen-host-pci-device.h
Merge tag 'pull-include-2023-02-06-v2' of https://repo.or.cz/qemu/armbru into staging
[mirror_qemu.git] / hw / xen / xen-host-pci-device.h
CommitLineData
396af688
AP
1#ifndef XEN_HOST_PCI_DEVICE_H
2#define XEN_HOST_PCI_DEVICE_H
3
83c9f4ca 4#include "hw/pci/pci.h"
396af688
AP
5
6enum {
7 XEN_HOST_PCI_REGION_TYPE_IO = 1 << 1,
8 XEN_HOST_PCI_REGION_TYPE_MEM = 1 << 2,
9 XEN_HOST_PCI_REGION_TYPE_PREFETCH = 1 << 3,
10 XEN_HOST_PCI_REGION_TYPE_MEM_64 = 1 << 4,
11};
12
13typedef struct XenHostPCIIORegion {
14 pcibus_t base_addr;
15 pcibus_t size;
16 uint8_t type;
17 uint8_t bus_flags; /* Bus-specific bits */
18} XenHostPCIIORegion;
19
20typedef struct XenHostPCIDevice {
21 uint16_t domain;
22 uint8_t bus;
23 uint8_t dev;
24 uint8_t func;
25
26 uint16_t vendor_id;
27 uint16_t device_id;
79814179 28 uint32_t class_code;
396af688
AP
29 int irq;
30
31 XenHostPCIIORegion io_regions[PCI_NUM_REGIONS - 1];
32 XenHostPCIIORegion rom;
33
34 bool is_virtfn;
35
36 int config_fd;
37} XenHostPCIDevice;
38
376ba75f
C
39void xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain,
40 uint8_t bus, uint8_t dev, uint8_t func,
41 Error **errp);
396af688 42void xen_host_pci_device_put(XenHostPCIDevice *pci_dev);
bce33948 43bool xen_host_pci_device_closed(XenHostPCIDevice *d);
396af688
AP
44
45int xen_host_pci_get_byte(XenHostPCIDevice *d, int pos, uint8_t *p);
46int xen_host_pci_get_word(XenHostPCIDevice *d, int pos, uint16_t *p);
47int xen_host_pci_get_long(XenHostPCIDevice *d, int pos, uint32_t *p);
48int xen_host_pci_get_block(XenHostPCIDevice *d, int pos, uint8_t *buf,
49 int len);
50int xen_host_pci_set_byte(XenHostPCIDevice *d, int pos, uint8_t data);
51int xen_host_pci_set_word(XenHostPCIDevice *d, int pos, uint16_t data);
52int xen_host_pci_set_long(XenHostPCIDevice *d, int pos, uint32_t data);
53int xen_host_pci_set_block(XenHostPCIDevice *d, int pos, uint8_t *buf,
54 int len);
55
56int xen_host_pci_find_ext_cap_offset(XenHostPCIDevice *s, uint32_t cap);
57
175de524 58#endif /* XEN_HOST_PCI_DEVICE_H */