Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2016 04:35:41 +0000 (UTC)
From:      Dexuan Cui <dexuan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309127 - in head/sys/dev/hyperv: pcib vmbus
Message-ID:  <201611250435.uAP4Zf57019106@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dexuan
Date: Fri Nov 25 04:35:40 2016
New Revision: 309127
URL: https://svnweb.freebsd.org/changeset/base/309127

Log:
  hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined
  
  vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at
  least shouldn't break build.
  
  Reviewed by:	sephe
  Approved by:	sephe (mentor)
  MFC after:	3 days
  Sponsored by:	Microsoft

Modified:
  head/sys/dev/hyperv/pcib/vmbus_pcib.c
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/pcib/vmbus_pcib.c
==============================================================================
--- head/sys/dev/hyperv/pcib/vmbus_pcib.c	Fri Nov 25 01:24:35 2016	(r309126)
+++ head/sys/dev/hyperv/pcib/vmbus_pcib.c	Fri Nov 25 04:35:40 2016	(r309127)
@@ -27,6 +27,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef NEW_PCIB
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/types.h>
@@ -1789,3 +1791,5 @@ DEFINE_CLASS_0(pcib, vmbus_pcib_driver, 
 DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, pcib_devclass, 0, 0);
 MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1);
 MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1);
+
+#endif /* NEW_PCIB */

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c	Fri Nov 25 01:24:35 2016	(r309126)
+++ head/sys/dev/hyperv/vmbus/vmbus.c	Fri Nov 25 04:35:40 2016	(r309127)
@@ -1020,16 +1020,21 @@ static struct resource *
 vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid,
     rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 {
-	struct vmbus_softc *sc = device_get_softc(dev);
 	device_t parent = device_get_parent(dev);
 	struct resource *res;
 
-	if (type != SYS_RES_MEMORY)
-		res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start,
-		    end, count, flags);
-	else
+#ifdef NEW_PCIB
+	if (type == SYS_RES_MEMORY) {
+		struct vmbus_softc *sc = device_get_softc(dev);
+
 		res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type,
 		    rid, start, end, count, flags);
+	} else
+#endif
+	{
+		res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start,
+		    end, count, flags);
+	}
 
 	return (res);
 }
@@ -1100,6 +1105,7 @@ vmbus_get_vcpu_id_method(device_t bus, d
 	return (VMBUS_PCPU_GET(sc, vcpuid, cpu));
 }
 
+#ifdef NEW_PCIB
 #define VTPM_BASE_ADDR 0xfed40000
 #define FOUR_GB (1ULL << 32)
 
@@ -1231,6 +1237,7 @@ vmbus_free_mmio_res(device_t dev)
 
 	pcib_host_res_free(dev, &sc->vmbus_mmio_res);
 }
+#endif	/* NEW_PCIB */
 
 static int
 vmbus_probe(device_t dev)
@@ -1269,7 +1276,9 @@ vmbus_doattach(struct vmbus_softc *sc)
 	if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
 		return (0);
 
+#ifdef NEW_PCIB
 	vmbus_get_mmio_res(sc->vmbus_dev);
+#endif
 
 	sc->vmbus_flags |= VMBUS_FLAG_ATTACHED;
 
@@ -1417,7 +1426,9 @@ vmbus_detach(device_t dev)
 	mtx_destroy(&sc->vmbus_prichan_lock);
 	mtx_destroy(&sc->vmbus_chan_lock);
 
+#ifdef NEW_PCIB
 	vmbus_free_mmio_res(dev);
+#endif
 
 	return (0);
 }

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h	Fri Nov 25 01:24:35 2016	(r309126)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h	Fri Nov 25 04:35:40 2016	(r309127)
@@ -128,8 +128,10 @@ struct vmbus_softc {
 	struct mtx		vmbus_chan_lock;
 	TAILQ_HEAD(, vmbus_channel) vmbus_chans;
 
+#ifdef NEW_PCIB
 	/* The list of usable MMIO ranges for PCIe pass-through */
 	struct pcib_host_resources vmbus_mmio_res;
+#endif
 };
 
 #define VMBUS_FLAG_ATTACHED	0x0001	/* vmbus was attached */



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