All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shukla <sshukla@mvista.com>
To: dev@dpdk.org
Subject: [PATCH v6 5/8] virtio: move io header and api from virtio_pci.h
Date: Fri, 29 Jan 2016 23:51:54 +0530	[thread overview]
Message-ID: <1454091717-32251-5-git-send-email-sshukla@mvista.com> (raw)
In-Reply-To: <1454091717-32251-1-git-send-email-sshukla@mvista.com>

Moving io api and header file i.e. sys/io.h to separate file virtio_io.h

Signed-off-by: Santosh Shukla <sshukla@mvista.com>
---
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 <rte_common.h>
+#include "virtio_logs.h"
+
+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686)
+
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <machine/cpufunc.h>
+
+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 <sys/io.h>
+#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 <fcntl.h>
 #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 <stdint.h>
-
-#ifdef __FreeBSD__
-#include <sys/types.h>
-#include <machine/cpufunc.h>
-#else
-#include <sys/io.h>
-#endif
-
 #include <rte_ethdev.h>
 
 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

  parent reply	other threads:[~2016-01-29 18:23 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 18:31 [PATCH v2 0/8] rtc: enable adjustment of clock offset Joshua Clayton
2016-01-04 18:31 ` [rtc-linux] " Joshua Clayton
     [not found] ` <0000-cover-letter.patch>
2016-01-04 18:31   ` [PATCH v2 1/8] rtc-pcf2123: define registers and bit macros Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 2/8] rtc-pcf2123: clean up reads from the chip Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 3/8] rtc-pcf2123: clean up writes to the rtc chip Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 4/8] rtc-pcf2123: refactor chip reset into a function Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 5/8] rtc-pcf2123: avoid resetting the clock if possible Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 6/8] rtc: Add functions to set and read clock offset Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 7/8] rtc: implement a sysfs interface for " Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-31 11:41     ` Alexandre Belloni
2016-01-31 11:41       ` [rtc-linux] " Alexandre Belloni
2016-02-01 20:56       ` Joshua Clayton
2016-02-01 20:56         ` [rtc-linux] " Joshua Clayton
2016-02-02 10:41         ` Alexandre Belloni
2016-02-02 10:41           ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-02-04 22:07             ` Alexandre Belloni
2016-02-04 22:07               ` [rtc-linux] " Alexandre Belloni
2016-02-04 23:32               ` Joshua Clayton
2016-02-04 23:32                 ` [rtc-linux] " Joshua Clayton
2016-02-05 14:39                 ` Alexandre Belloni
2016-02-05 14:39                   ` [rtc-linux] " Alexandre Belloni
2016-02-05 20:41                   ` [PATCH v4 " Joshua Clayton
2016-02-05 20:41                     ` [rtc-linux] " Joshua Clayton
2016-02-05 20:41                     ` [PATCH v4 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton
2016-02-05 20:41                       ` [rtc-linux] " Joshua Clayton
2016-02-05 20:41                     ` [PATCH v4 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton
2016-02-05 20:41                       ` [rtc-linux] " Joshua Clayton
2016-02-23 18:47                     ` [PATCH v4 1/3] rtc: Add functions to set and read rtc offset Joshua Clayton
2016-02-23 18:47                       ` [rtc-linux] " Joshua Clayton
2016-02-23 21:44                       ` Alexandre Belloni
2016-02-23 21:44                         ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 2/3] rtc: implement a sysfs interface for clock offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-02-04 22:12             ` Alexandre Belloni
2016-02-04 22:12               ` [rtc-linux] " Alexandre Belloni
2016-02-03 17:16           ` [PATCH v3 3/3] rtc-pcf2123: implement read_offset and set_offset Joshua Clayton
2016-02-03 17:16             ` [rtc-linux] " Joshua Clayton
2016-01-04 18:31   ` [PATCH v2 8/8] " Joshua Clayton
2016-01-04 18:31     ` [rtc-linux] " Joshua Clayton
2016-01-29 18:21   ` [PATCH v6 1/8] eal: pci: add api to rd/wr pci bar region Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 2/8] linuxapp/vfio: ignore mapping for ioport region Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 3/8] eal/linux: never check iopl for arm Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 4/8] virtio: Introduce config RTE_VIRTIO_INC_VECTOR Santosh Shukla
2016-01-29 18:21     ` Santosh Shukla [this message]
2016-01-29 18:21     ` [PATCH v6 6/8] virtio: add vfio api to rd/wr ioport space Santosh Shukla
2016-02-01 12:48       ` Yuanhan Liu
2016-02-02  4:30         ` Santosh Shukla
2016-02-02  5:19           ` Yuanhan Liu
2016-02-02  6:02             ` Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 7/8] virtio: extend pci rw api for vfio Santosh Shukla
2016-01-29 18:21     ` [PATCH v6 8/8] virtio: do not parse if interface is vfio Santosh Shukla
2016-02-01 13:48     ` [PATCH v6 1/8] eal: pci: add api to rd/wr pci bar region Yuanhan Liu
2016-02-02  4:14       ` Santosh Shukla
2016-02-02  5:43         ` Yuanhan Liu
2016-02-02  5:50           ` David Marchand
2016-02-02  8:49             ` Yuanhan Liu
2016-02-02 15:51               ` Santosh Shukla
2016-02-02 16:18                 ` Santosh Shukla
2016-02-03  9:50                   ` Santosh Shukla
2016-02-03 11:50                     ` Yuanhan Liu
2016-02-05 17:56                       ` David Marchand
2016-02-03 11:43                   ` Yuanhan Liu
2016-02-02  7:00           ` Santosh Shukla
2016-02-02  7:01             ` Santosh Shukla
2016-02-08 10:03   ` [PATCH v8 3/4] eal/linux: vfio: ignore mapping for ioport region Santosh Shukla
2016-02-08 10:03     ` [PATCH v8 4/4] eal/linux: vfio: add pci ioport support Santosh Shukla
2016-02-08 14:13       ` Burakov, Anatoly
2016-02-09  9:04         ` David Marchand
2016-02-18  5:25           ` Santosh Shukla
2016-02-18 14:00             ` Thomas Monjalon
2016-01-26 14:56 ` [PATCH v2 0/8] rtc: enable adjustment of clock offset Joshua Clayton
2016-01-26 14:56   ` [rtc-linux] " Joshua Clayton
2016-01-26 16:00   ` Alexandre Belloni
2016-01-26 16:00     ` [rtc-linux] " Alexandre Belloni
2016-01-31 11:29     ` Alexandre Belloni
2016-01-31 11:29       ` [rtc-linux] " Alexandre Belloni

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=1454091717-32251-5-git-send-email-sshukla@mvista.com \
    --to=sshukla@mvista.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.