From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.tetrasec.net (mx1.tetrasec.net [74.117.190.25]) by dpdk.org (Postfix) with ESMTP id 493304C96 for ; Wed, 13 Mar 2019 18:07:23 +0100 (CET) Received: from mx1.tetrasec.net (mail.local [127.0.0.1]) by mx1.tetrasec.net (Postfix) with ESMTP id C12E39E1D55; Wed, 13 Mar 2019 17:07:22 +0000 (UTC) Received: from ncopa-desktop.lan (67.63.200.37.customer.cdi.no [37.200.63.67]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: n@tanael.org) by mx1.tetrasec.net (Postfix) with ESMTPSA id 069999E1D60; Wed, 13 Mar 2019 17:07:21 +0000 (UTC) From: Natanael Copa To: dev@dpdk.org Cc: Natanael Copa Date: Wed, 13 Mar 2019 18:06:45 +0100 Message-Id: <20190313170657.16688-4-ncopa@alpinelinux.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190313170657.16688-1-ncopa@alpinelinux.org> References: <20190313170657.16688-1-ncopa@alpinelinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH v3 03/15] bus/pci: add fallback for out[lwb]_p for non GNU libc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2019 17:07:23 -0000 Add a fallback for non-GNU libc systems like musl libc for the non-standard functions outl_p, outw_p and outb_p. This ifixes the following buildtime errors when building with musl libc: pci_uio.c:(.text+0xaa1): undefined reference to `outw_p' pci_uio.c:(.text+0xac5): undefined reference to `outl_p' pci_uio.c:(.text+0xadf): undefined reference to `outb_p' fixes https://bugs.dpdk.org/show_bug.cgi?id=3D35 Signed-off-by: Natanael Copa --- drivers/bus/pci/linux/pci_uio.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_= uio.c index 09ecbb7aa..e1dd8c875 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -14,6 +14,32 @@ =20 #if defined(RTE_ARCH_X86) #include +#if defined(__GLIBC__) +#define pci_uio_outl_p outl_p +#define pci_uio_outw_p outw_p +#define pci_uio_outb_p outb_p +#else +static inline void +pci_uio_outl_p(unsigned int value, unsigned short int port) +{ + __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} + +static inline void +pci_uio_outw_p(unsigned short int value, unsigned short int port) +{ + __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} + +static inline void +pci_uio_outb_p(unsigned char value, unsigned short int port) +{ + __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80" : : "a" (value), + "Nd" (port)); +} +#endif #endif =20 #include @@ -527,21 +553,21 @@ pci_uio_ioport_write(struct rte_pci_ioport *p, if (len >=3D 4) { size =3D 4; #if defined(RTE_ARCH_X86) - outl_p(*(const uint32_t *)s, reg); + pci_uio_outl_p(*(const uint32_t *)s, reg); #else *(volatile uint32_t *)reg =3D *(const uint32_t *)s; #endif } else if (len >=3D 2) { size =3D 2; #if defined(RTE_ARCH_X86) - outw_p(*(const uint16_t *)s, reg); + pci_uio_outw_p(*(const uint16_t *)s, reg); #else *(volatile uint16_t *)reg =3D *(const uint16_t *)s; #endif } else { size =3D 1; #if defined(RTE_ARCH_X86) - outb_p(*s, reg); + pci_uio_outb_p(*s, reg); #else *(volatile uint8_t *)reg =3D *s; #endif --=20 2.21.0