From owner-svn-src-head@freebsd.org Fri Nov 25 04:35:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B624C54238; Fri, 25 Nov 2016 04:35:42 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 16268D4F; Fri, 25 Nov 2016 04:35:42 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAP4ZfkN019109; Fri, 25 Nov 2016 04:35:41 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAP4Zf57019106; Fri, 25 Nov 2016 04:35:41 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611250435.uAP4Zf57019106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Fri, 25 Nov 2016 04:35:41 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2016 04:35:42 -0000 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 __FBSDID("$FreeBSD$"); +#ifdef NEW_PCIB + #include #include #include @@ -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 */