From: Chenbo Xia <chenbo.xia@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, thomas@monjalon.net,
alialnu@nvidia.com, probb@iol.unh.edu, miao.li@intel.com,
stable@dpdk.org, Yahui Cao <yahui.cao@intel.com>,
Sunil Kumar Kori <skori@marvell.com>
Subject: [PATCH] bus/pci: fix missing MMIO APIs in Windows
Date: Thu, 8 Jun 2023 15:43:05 +0800 [thread overview]
Message-ID: <20230608074305.38061-1-chenbo.xia@intel.com> (raw)
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: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@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
next reply other threads:[~2023-06-08 8:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 7:43 Chenbo Xia [this message]
2023-06-08 8:54 ` Ali Alnubani
2023-06-08 8:58 ` Xia, Chenbo
2023-06-08 10:04 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230608074305.38061-1-chenbo.xia@intel.com \
--to=chenbo.xia@intel.com \
--cc=alialnu@nvidia.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=miao.li@intel.com \
--cc=probb@iol.unh.edu \
--cc=skori@marvell.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
--cc=yahui.cao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).