1 #ifndef XEN_HOST_PCI_DEVICE_H
2 #define XEN_HOST_PCI_DEVICE_H
4 #include "hw/pci/pci.h"
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,
13 typedef struct XenHostPCIIORegion
{
17 uint8_t bus_flags
; /* Bus-specific bits */
20 typedef struct XenHostPCIDevice
{
26 /* different from the above in case of stubdomain */
27 uint16_t local_domain
;
37 XenHostPCIIORegion io_regions
[PCI_NUM_REGIONS
- 1];
38 XenHostPCIIORegion rom
;
45 void xen_host_pci_device_get(XenHostPCIDevice
*d
, uint16_t domain
,
46 uint8_t bus
, uint8_t dev
, uint8_t func
,
48 void xen_host_pci_device_put(XenHostPCIDevice
*pci_dev
);
49 bool xen_host_pci_device_closed(XenHostPCIDevice
*d
);
51 int xen_host_pci_get_byte(XenHostPCIDevice
*d
, int pos
, uint8_t *p
);
52 int xen_host_pci_get_word(XenHostPCIDevice
*d
, int pos
, uint16_t *p
);
53 int xen_host_pci_get_long(XenHostPCIDevice
*d
, int pos
, uint32_t *p
);
54 int xen_host_pci_get_block(XenHostPCIDevice
*d
, int pos
, uint8_t *buf
,
56 int xen_host_pci_set_byte(XenHostPCIDevice
*d
, int pos
, uint8_t data
);
57 int xen_host_pci_set_word(XenHostPCIDevice
*d
, int pos
, uint16_t data
);
58 int xen_host_pci_set_long(XenHostPCIDevice
*d
, int pos
, uint32_t data
);
59 int xen_host_pci_set_block(XenHostPCIDevice
*d
, int pos
, uint8_t *buf
,
62 int xen_host_pci_find_ext_cap_offset(XenHostPCIDevice
*s
, uint32_t cap
);
64 #endif /* XEN_HOST_PCI_DEVICE_H */