MMIO read and write APIs were defined in PCI bus. But the corresponding implementations are not done in windows. This patch fixes this.
Bugzilla ID: 1245 Fixes: 095cf6e68b28 ("bus/pci: introduce MMIO read/write") Cc: sta...@dpdk.org Signed-off-by: Chenbo Xia <chenbo....@intel.com> --- drivers/bus/pci/windows/pci.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index df5221d913..45a12bcb52 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -88,6 +88,30 @@ rte_pci_write_config(const struct rte_pci_device *dev __rte_unused, return 0; } +/* Read PCI MMIO space. */ +int +rte_pci_mmio_read(const struct rte_pci_device *dev, int bar, + void *buf, size_t len, off_t offset) +{ + if (bar >= PCI_MAX_RESOURCE || dev->mem_resource[bar].addr == NULL || + (uint64_t)offset + len > dev->mem_resource[bar].len) + return -1; + memcpy(buf, (uint8_t *)dev->mem_resource[bar].addr + offset, len); + return len; +} + +/* Write PCI MMIO space. */ +int +rte_pci_mmio_write(const struct rte_pci_device *dev, int bar, + const void *buf, size_t len, off_t offset) +{ + if (bar >= PCI_MAX_RESOURCE || dev->mem_resource[bar].addr == NULL || + (uint64_t)offset + len > dev->mem_resource[bar].len) + return -1; + memcpy((uint8_t *)dev->mem_resource[bar].addr + offset, buf, len); + return len; +} + enum rte_iova_mode pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused, const struct rte_pci_device *pdev __rte_unused) -- 2.17.1