From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by dpdk.org (Postfix) with ESMTP id 767F5C746 for ; Fri, 29 Jan 2016 19:23:32 +0100 (CET) Received: by mail-pf0-f178.google.com with SMTP id o185so41252516pfb.1 for ; Fri, 29 Jan 2016 10:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CNLiO6pxhqicfI4+IPVc59BWk6Phs5x0SWabFLDlxIg=; b=PQdde2/7QV7v8SYY8G4DH2d/GOLC4rLH6+UwvncAWWDdOBzob89TdLEjN5e7yr4qWX pgtPiBIDwUOcRQIaBbUjWK9MPV0TDoxFUl8G+aMeg1ZAX4A5MesSfA0FgaPt1bOGM6de 6/oaqGh+mo11Jj0mobaCe1dXRPlFHbVW230D/xhRDflPqEF13b/X91zYATQdjRjGkfNl yvBmVMkGaGfDG8BipcL33e1fCnXeaFeF6PFV3gv5DoX7um/xDgs9nvbnHC4iO0jp+4mX TydLd/NtE7XbMSGu/mObdt3KptKZDuKdXpUpPKj51TyDtNBBCShjpYfAnIAcwn+NdPFN +BVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CNLiO6pxhqicfI4+IPVc59BWk6Phs5x0SWabFLDlxIg=; b=I1hfvXJz6IVPwc+ONA2kVAKjfZi6fZf6lgQZ1/Pj1zq1hMFuI+L4LMcgjk3sO8ccOT EEIUYZ5UCpx4FtkVqax5R9Q/Kxd7CrX/nN1QmadmWhSXCpJHZxFhdf1gHRN0ovhyhykN bBIerz2vUKusHr9cQVpkXosSAU5Lcrxy6xvceUky/7Zu9fnQPywhv2KjUJftSNtf/xR6 oaJ3OcF6VdTyv3Yro8D9apWT8k1gHACCdFuBaDtTqfUrIUpL0eKDBHePvQFjBcWuQPjM r69xyhdjuURaOgX643ZAKKR/mljMSwygXPhVEpKzUDNvg8+lPuyTMOp5/fmIsTKjvZ91 QhGw== X-Gm-Message-State: AG10YOR0K94KeJOx16zXzBfcR8dhm+lA6PxpoUR/0Vt3SJMFZ1oLlXwK8I/YFw+t5WEp6vky X-Received: by 10.98.12.29 with SMTP id u29mr15302194pfi.116.1454091811742; Fri, 29 Jan 2016 10:23:31 -0800 (PST) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([106.51.29.23]) by smtp.gmail.com with ESMTPSA id 85sm11161750pfl.18.2016.01.29.10.23.15 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jan 2016 10:23:30 -0800 (PST) From: Santosh Shukla To: dev@dpdk.org Date: Fri, 29 Jan 2016 23:51:54 +0530 Message-Id: <1454091717-32251-5-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1454091717-32251-1-git-send-email-sshukla@mvista.com> References: <0000-cover-letter.patch> <1454091717-32251-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v6 5/8] virtio: move io header and api from virtio_pci.h X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2016 18:23:32 -0000 Moving io api and header file i.e. sys/io.h to separate file virtio_io.h Signed-off-by: Santosh Shukla --- v5-->v6: - included new file virtio_io.h, has in/out api and sys/io.h. drivers/net/virtio/virtio_io.h | 114 +++++++++++++++++++++++++++++++++++++++ drivers/net/virtio/virtio_pci.c | 1 + drivers/net/virtio/virtio_pci.h | 30 ----------- 3 files changed, 115 insertions(+), 30 deletions(-) create mode 100644 drivers/net/virtio/virtio_io.h diff --git a/drivers/net/virtio/virtio_io.h b/drivers/net/virtio/virtio_io.h new file mode 100644 index 0000000..bfa1341 --- /dev/null +++ b/drivers/net/virtio/virtio_io.h @@ -0,0 +1,114 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2016 Cavium Networks. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _VIRTIO_IO_H_ +#define _VIRTIO_IO_H_ + +#include +#include "virtio_logs.h" + +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) + +#ifdef __FreeBSD__ +#include +#include + +static inline void +outb_p(unsigned char data, unsigned int port) +{ + + outb(port, (u_char)data); +} + +static inline void +outw_p(unsigned short data, unsigned int port) +{ + outw(port, (u_short)data); +} + +static inline void +outl_p(unsigned int data, unsigned int port) +{ + outl(port, (u_int)data); +} + +#else +#include +#endif + +#else /* ! X86 */ + +static inline uint8_t +inb(unsigned long addr __rte_unused) +{ + PMD_INIT_LOG(ERR, "inb() not supported for this RTE_ARCH\n"); + return 0; +} + +static inline uint16_t +inw(unsigned long addr __rte_unused) +{ + PMD_INIT_LOG(ERR, "inw() not supported for this RTE_ARCH\n"); + return 0; +} + +static inline uint32_t +inl(unsigned long addr __rte_unused) +{ + PMD_INIT_LOG(ERR, "in() not supported for this RTE_ARCH\n"); + return 0; +} + +static inline void +outb_p(unsigned char data __rte_unused, unsigned int port __rte_unused) +{ + PMD_INIT_LOG(ERR, "outb_p() not supported for this RTE_ARCH\n"); + return; +} + +static inline void +outw_p(unsigned short data __rte_unused, unsigned int port __rte_unused) +{ + PMD_INIT_LOG(ERR, "outw_p() not supported for this RTE_ARCH\n"); + return; +} + +static inline void +outl_p(unsigned int data __rte_unused, unsigned int port __rte_unused) +{ + PMD_INIT_LOG(ERR, "outl_p() not supported for this RTE_ARCH\n"); + return; +} + +#endif /* X86 */ +#endif /* _VIRTIO_IO_H_ */ diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index a9f179f..064f234 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -37,6 +37,7 @@ #include #endif +#include "virtio_io.h" #include "virtio_pci.h" #include "virtio_logs.h" #include "virtqueue.h" diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 99572a0..2fe5835 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -35,14 +35,6 @@ #define _VIRTIO_PCI_H_ #include - -#ifdef __FreeBSD__ -#include -#include -#else -#include -#endif - #include struct virtqueue; @@ -296,28 +288,6 @@ struct virtio_net_config { /* The alignment to use between consumer and producer parts of vring. */ #define VIRTIO_PCI_VRING_ALIGN 4096 -#ifdef __FreeBSD__ - -static inline void -outb_p(unsigned char data, unsigned int port) -{ - - outb(port, (u_char)data); -} - -static inline void -outw_p(unsigned short data, unsigned int port) -{ - outw(port, (u_short)data); -} - -static inline void -outl_p(unsigned int data, unsigned int port) -{ - outl(port, (u_int)data); -} -#endif - static inline int vtpci_with_feature(struct virtio_hw *hw, uint64_t bit) { -- 1.7.9.5