From owner-svn-src-all@FreeBSD.ORG  Mon Jun 16 04:16:31 2014
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id D72781EC;
 Mon, 16 Jun 2014 04:16:31 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id C4A8B21B8;
 Mon, 16 Jun 2014 04:16:31 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5G4GVGT051667;
 Mon, 16 Jun 2014 04:16:31 GMT (envelope-from bryanv@svn.freebsd.org)
Received: (from bryanv@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5G4GV0n051664;
 Mon, 16 Jun 2014 04:16:31 GMT (envelope-from bryanv@svn.freebsd.org)
Message-Id: <201406160416.s5G4GV0n051664@svn.freebsd.org>
From: Bryan Venteicher <bryanv@FreeBSD.org>
Date: Mon, 16 Jun 2014 04:16:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r267521 - head/sys/dev/virtio/pci
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 16 Jun 2014 04:16:31 -0000

Author: bryanv
Date: Mon Jun 16 04:16:31 2014
New Revision: 267521
URL: http://svnweb.freebsd.org/changeset/base/267521

Log:
  Remove kernel specific macro out of the VirtIO PCI header file
  
  The eventual goal is to share this file with userland, so
  remove the macro that is only specific for virtio_pci(4).
  Instead, add the VIRTIO_PCI_CONFIG_OFF macro from Linux to
  get the config size whether MSIX is enabled or not.
  
  MFC after:	1 week

Modified:
  head/sys/dev/virtio/pci/virtio_pci.c
  head/sys/dev/virtio/pci/virtio_pci.h

Modified: head/sys/dev/virtio/pci/virtio_pci.c
==============================================================================
--- head/sys/dev/virtio/pci/virtio_pci.c	Mon Jun 16 04:12:33 2014	(r267520)
+++ head/sys/dev/virtio/pci/virtio_pci.c	Mon Jun 16 04:16:31 2014	(r267521)
@@ -170,6 +170,9 @@ static void	vtpci_config_intr(void *);
 
 #define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt
 
+#define VIRTIO_PCI_CONFIG(_sc) \
+    VIRTIO_PCI_CONFIG_OFF((((_sc)->vtpci_flags & VTPCI_FLAG_MSIX)) != 0)
+
 /*
  * I/O port read/write wrappers.
  */

Modified: head/sys/dev/virtio/pci/virtio_pci.h
==============================================================================
--- head/sys/dev/virtio/pci/virtio_pci.h	Mon Jun 16 04:12:33 2014	(r267520)
+++ head/sys/dev/virtio/pci/virtio_pci.h	Mon Jun 16 04:16:31 2014	(r267521)
@@ -72,8 +72,7 @@
  * The remaining space is defined by each driver as the per-driver
  * configuration space.
  */
-#define VIRTIO_PCI_CONFIG(sc) \
-    (((sc)->vtpci_flags & VTPCI_FLAG_MSIX) ? 24 : 20)
+#define VIRTIO_PCI_CONFIG_OFF(msix_enabled)     ((msix_enabled) ? 24 : 20)
 
 /*
  * How many bits to shift physical queue address written to QUEUE_PFN.