]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/libqos/pci.h
4 * Copyright IBM, Corp. 2012-2013
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
18 #define QPCI_PIO_LIMIT 0x10000
20 #define QPCI_DEVFN(dev, fn) (((dev) << 3) | (fn))
22 typedef struct QPCIDevice QPCIDevice
;
23 typedef struct QPCIBus QPCIBus
;
26 uint8_t (*pio_readb
)(QPCIBus
*bus
, uint32_t addr
);
27 uint16_t (*pio_readw
)(QPCIBus
*bus
, uint32_t addr
);
28 uint32_t (*pio_readl
)(QPCIBus
*bus
, uint32_t addr
);
30 void (*pio_writeb
)(QPCIBus
*bus
, uint32_t addr
, uint8_t value
);
31 void (*pio_writew
)(QPCIBus
*bus
, uint32_t addr
, uint16_t value
);
32 void (*pio_writel
)(QPCIBus
*bus
, uint32_t addr
, uint32_t value
);
34 void (*memread
)(QPCIBus
*bus
, uint32_t addr
, void *buf
, size_t len
);
35 void (*memwrite
)(QPCIBus
*bus
, uint32_t addr
, const void *buf
, size_t len
);
37 uint8_t (*config_readb
)(QPCIBus
*bus
, int devfn
, uint8_t offset
);
38 uint16_t (*config_readw
)(QPCIBus
*bus
, int devfn
, uint8_t offset
);
39 uint32_t (*config_readl
)(QPCIBus
*bus
, int devfn
, uint8_t offset
);
41 void (*config_writeb
)(QPCIBus
*bus
, int devfn
,
42 uint8_t offset
, uint8_t value
);
43 void (*config_writew
)(QPCIBus
*bus
, int devfn
,
44 uint8_t offset
, uint16_t value
);
45 void (*config_writel
)(QPCIBus
*bus
, int devfn
,
46 uint8_t offset
, uint32_t value
);
48 uint16_t pio_alloc_ptr
;
49 uint64_t mmio_alloc_ptr
, mmio_limit
;
61 void qpci_device_foreach(QPCIBus
*bus
, int vendor_id
, int device_id
,
62 void (*func
)(QPCIDevice
*dev
, int devfn
, void *data
),
64 QPCIDevice
*qpci_device_find(QPCIBus
*bus
, int devfn
);
66 void qpci_device_enable(QPCIDevice
*dev
);
67 uint8_t qpci_find_capability(QPCIDevice
*dev
, uint8_t id
);
68 void qpci_msix_enable(QPCIDevice
*dev
);
69 void qpci_msix_disable(QPCIDevice
*dev
);
70 bool qpci_msix_pending(QPCIDevice
*dev
, uint16_t entry
);
71 bool qpci_msix_masked(QPCIDevice
*dev
, uint16_t entry
);
72 uint16_t qpci_msix_table_size(QPCIDevice
*dev
);
74 uint8_t qpci_config_readb(QPCIDevice
*dev
, uint8_t offset
);
75 uint16_t qpci_config_readw(QPCIDevice
*dev
, uint8_t offset
);
76 uint32_t qpci_config_readl(QPCIDevice
*dev
, uint8_t offset
);
78 void qpci_config_writeb(QPCIDevice
*dev
, uint8_t offset
, uint8_t value
);
79 void qpci_config_writew(QPCIDevice
*dev
, uint8_t offset
, uint16_t value
);
80 void qpci_config_writel(QPCIDevice
*dev
, uint8_t offset
, uint32_t value
);
82 uint8_t qpci_io_readb(QPCIDevice
*dev
, void *data
);
83 uint16_t qpci_io_readw(QPCIDevice
*dev
, void *data
);
84 uint32_t qpci_io_readl(QPCIDevice
*dev
, void *data
);
86 void qpci_io_writeb(QPCIDevice
*dev
, void *data
, uint8_t value
);
87 void qpci_io_writew(QPCIDevice
*dev
, void *data
, uint16_t value
);
88 void qpci_io_writel(QPCIDevice
*dev
, void *data
, uint32_t value
);
90 void qpci_memread(QPCIDevice
*bus
, void *data
, void *buf
, size_t len
);
91 void qpci_memwrite(QPCIDevice
*bus
, void *data
, const void *buf
, size_t len
);
93 void *qpci_iomap(QPCIDevice
*dev
, int barno
, uint64_t *sizeptr
);
94 void qpci_iounmap(QPCIDevice
*dev
, void *data
);
95 void *qpci_legacy_iomap(QPCIDevice
*dev
, uint16_t addr
);
97 void qpci_plug_device_test(const char *driver
, const char *id
,
98 uint8_t slot
, const char *opts
);
99 void qpci_unplug_acpi_device_test(const char *id
, uint8_t slot
);