Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 2017 19:13:40 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r316588 - stable/10/sys/dev/e1000
Message-ID:  <201704061913.v36JDe8S013331@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Thu Apr  6 19:13:40 2017
New Revision: 316588
URL: https://svnweb.freebsd.org/changeset/base/316588

Log:
  Direct commit of fixes to stable/10, resolving PCI passthrough and initialization
  issues when trying to passthrough a i340 (igb) to VMware.
  
  While here, cleanup some bits of em(4) to DTRT as well.
  
  PR:		218113
  Submitted by:	Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>

Modified:
  stable/10/sys/dev/e1000/if_em.c
  stable/10/sys/dev/e1000/if_em.h
  stable/10/sys/dev/e1000/if_igb.c

Modified: stable/10/sys/dev/e1000/if_em.c
==============================================================================
--- stable/10/sys/dev/e1000/if_em.c	Thu Apr  6 19:10:16 2017	(r316587)
+++ stable/10/sys/dev/e1000/if_em.c	Thu Apr  6 19:13:40 2017	(r316588)
@@ -2846,7 +2846,7 @@ em_free_pci_resources(struct adapter *ad
 
 	if (adapter->msix_mem != NULL)
 		bus_release_resource(dev, SYS_RES_MEMORY,
-		    PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
+		    adapter->memrid, adapter->msix_mem);
 
 	if (adapter->memory != NULL)
 		bus_release_resource(dev, SYS_RES_MEMORY,
@@ -2880,9 +2880,9 @@ em_setup_msix(struct adapter *adapter)
 			em_enable_vectors_82574(adapter);
 #endif
 		/* Map the MSIX BAR */
-		int rid = PCIR_BAR(EM_MSIX_BAR);
+		adapter->memrid = PCIR_BAR(EM_MSIX_BAR);
 		adapter->msix_mem = bus_alloc_resource_any(dev,
-		    SYS_RES_MEMORY, &rid, RF_ACTIVE);
+		    SYS_RES_MEMORY, &adapter->memrid, RF_ACTIVE);
        		if (adapter->msix_mem == NULL) {
 			/* May not be enabled */
                		device_printf(adapter->dev,
@@ -2933,7 +2933,7 @@ msix_one:
 msi:
 	if (adapter->msix_mem != NULL) {
 		bus_release_resource(dev, SYS_RES_MEMORY,
-		    PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
+		    adapter->memrid, adapter->msix_mem);
 		adapter->msix_mem = NULL;
 	}
        	val = 1;

Modified: stable/10/sys/dev/e1000/if_em.h
==============================================================================
--- stable/10/sys/dev/e1000/if_em.h	Thu Apr  6 19:10:16 2017	(r316587)
+++ stable/10/sys/dev/e1000/if_em.h	Thu Apr  6 19:13:40 2017	(r316588)
@@ -400,6 +400,7 @@ struct adapter {
 	struct resource *memory;
 	struct resource *flash;
 	struct resource *msix_mem;
+	int		memrid;
 
 	struct resource	*res;
 	void		*tag;

Modified: stable/10/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/10/sys/dev/e1000/if_igb.c	Thu Apr  6 19:10:16 2017	(r316587)
+++ stable/10/sys/dev/e1000/if_igb.c	Thu Apr  6 19:13:40 2017	(r316588)
@@ -2806,7 +2806,7 @@ igb_setup_msix(struct adapter *adapter)
 msi:
        	if (adapter->msix_mem != NULL) {
 		bus_release_resource(dev, SYS_RES_MEMORY,
-		    PCIR_BAR(IGB_MSIX_BAR), adapter->msix_mem);
+		    adapter->memrid, adapter->msix_mem);
 		adapter->msix_mem = NULL;
 	}
        	msgs = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704061913.v36JDe8S013331>