aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libqos/pci.c')
-rw-r--r--tests/libqos/pci.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c
index c3f3382b7c..55b01df37b 100644
--- a/tests/libqos/pci.c
+++ b/tests/libqos/pci.c
@@ -224,33 +224,68 @@ void qpci_config_writel(QPCIDevice *dev, uint8_t offset, uint32_t value)
uint8_t qpci_io_readb(QPCIDevice *dev, void *data)
{
- return dev->bus->io_readb(dev->bus, data);
+ uintptr_t addr = (uintptr_t)data;
+
+ if (addr < QPCI_PIO_LIMIT) {
+ return dev->bus->pio_readb(dev->bus, addr);
+ } else {
+ return dev->bus->mmio_readb(dev->bus, addr);
+ }
}
uint16_t qpci_io_readw(QPCIDevice *dev, void *data)
{
- return dev->bus->io_readw(dev->bus, data);
+ uintptr_t addr = (uintptr_t)data;
+
+ if (addr < QPCI_PIO_LIMIT) {
+ return dev->bus->pio_readw(dev->bus, addr);
+ } else {
+ return dev->bus->mmio_readw(dev->bus, addr);
+ }
}
uint32_t qpci_io_readl(QPCIDevice *dev, void *data)
{
- return dev->bus->io_readl(dev->bus, data);
-}
+ uintptr_t addr = (uintptr_t)data;
+ if (addr < QPCI_PIO_LIMIT) {
+ return dev->bus->pio_readl(dev->bus, addr);
+ } else {
+ return dev->bus->mmio_readl(dev->bus, addr);
+ }
+}
void qpci_io_writeb(QPCIDevice *dev, void *data, uint8_t value)
{
- dev->bus->io_writeb(dev->bus, data, value);
+ uintptr_t addr = (uintptr_t)data;
+
+ if (addr < QPCI_PIO_LIMIT) {
+ dev->bus->pio_writeb(dev->bus, addr, value);
+ } else {
+ dev->bus->mmio_writeb(dev->bus, addr, value);
+ }
}
void qpci_io_writew(QPCIDevice *dev, void *data, uint16_t value)
{
- dev->bus->io_writew(dev->bus, data, value);
+ uintptr_t addr = (uintptr_t)data;
+
+ if (addr < QPCI_PIO_LIMIT) {
+ dev->bus->pio_writew(dev->bus, addr, value);
+ } else {
+ dev->bus->mmio_writew(dev->bus, addr, value);
+ }
}
void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value)
{
- dev->bus->io_writel(dev->bus, data, value);
+ uintptr_t addr = (uintptr_t)data;
+
+ if (addr < QPCI_PIO_LIMIT) {
+ dev->bus->pio_writel(dev->bus, addr, value);
+ } else {
+ dev->bus->mmio_writel(dev->bus, addr, value);
+ }
}
void *qpci_iomap(QPCIDevice *dev, int barno, uint64_t *sizeptr)