[dpdk-stable] [PATCH 20.11] bus/pci: support I/O port operations with musl
Thomas Monjalon
thomas at monjalon.net
Fri May 28 11:21:11 CEST 2021
[ upstream commit 204a7f44bc457b2c75c9eeb56468214664c830f0 ]
Add a fallback for non-GNU libc systems like musl libc for the
non-standard functions outl_p, outw_p and outb_p.
It solves the following errors when building with musl libc:
pci_uio.c: undefined reference to 'outw_p'
pci_uio.c: undefined reference to 'outl_p'
pci_uio.c: undefined reference to 'outb_p'
Bugzilla ID: 35
Fixes: 756ce64b1ecd ("eal: introduce PCI ioport API")
Cc: stable at dpdk.org
Reported-by: Natanael Copa <ncopa at alpinelinux.org>
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Acked-by: David Marchand <david.marchand at redhat.com>
---
drivers/bus/pci/linux/pci_uio.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index f3305a2f28..624b2e2ecf 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -535,21 +535,33 @@ pci_uio_ioport_write(struct rte_pci_ioport *p,
if (len >= 4) {
size = 4;
#if defined(RTE_ARCH_X86)
+#ifdef __GLIBC__
outl_p(*(const uint32_t *)s, reg);
+#else
+ outl(*(const uint32_t *)s, reg);
+#endif
#else
*(volatile uint32_t *)reg = *(const uint32_t *)s;
#endif
} else if (len >= 2) {
size = 2;
#if defined(RTE_ARCH_X86)
+#ifdef __GLIBC__
outw_p(*(const uint16_t *)s, reg);
+#else
+ outw(*(const uint16_t *)s, reg);
+#endif
#else
*(volatile uint16_t *)reg = *(const uint16_t *)s;
#endif
} else {
size = 1;
#if defined(RTE_ARCH_X86)
+#ifdef __GLIBC__
outb_p(*s, reg);
+#else
+ outb(*s, reg);
+#endif
#else
*(volatile uint8_t *)reg = *s;
#endif
--
2.31.1
More information about the stable
mailing list