From owner-svn-src-head@freebsd.org Fri May 20 08:29:01 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 6A998B43275; Fri, 20 May 2016 08:29:01 +0000 (UTC) (envelope-from andrew@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 4745F1ED3; Fri, 20 May 2016 08:29:01 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4K8T0OK018912; Fri, 20 May 2016 08:29:00 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4K8T0cA018910; Fri, 20 May 2016 08:29:00 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605200829.u4K8T0cA018910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 20 May 2016 08:29:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300290 - in head/sys: arm64/cavium dev/pci 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.22 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, 20 May 2016 08:29:01 -0000 Author: andrew Date: Fri May 20 08:29:00 2016 New Revision: 300290 URL: https://svnweb.freebsd.org/changeset/base/300290 Log: Handle PCI_RES_BUS on the generic and ThunderX PCIe drivers. This has been tested on the Pass 1.1 and 2.0 ThunderX machines in the Netperf cluster. Reviewed by: jhb Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6453 Modified: head/sys/arm64/cavium/thunder_pcie_pem.c head/sys/dev/pci/pci_host_generic.c Modified: head/sys/arm64/cavium/thunder_pcie_pem.c ============================================================================== --- head/sys/arm64/cavium/thunder_pcie_pem.c Fri May 20 08:28:11 2016 (r300289) +++ head/sys/arm64/cavium/thunder_pcie_pem.c Fri May 20 08:29:00 2016 (r300290) @@ -313,6 +313,10 @@ thunder_pem_adjust_resource(device_t dev struct rman *rm; sc = device_get_softc(dev); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_adjust_bus(sc->id, child, res, start, end)); +#endif rm = thunder_pem_rman(sc, type); if (rm == NULL) @@ -619,6 +623,11 @@ thunder_pem_alloc_resource(device_t dev, struct resource *res; device_t parent_dev; +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_alloc_bus(sc->id, child, rid, start, end, + count, flags)); +#endif rm = thunder_pem_rman(sc, type); if (rm == NULL) { /* Find parent device. On ThunderX we know an exact path. */ @@ -675,7 +684,12 @@ thunder_pem_release_resource(device_t de struct resource *res) { device_t parent_dev; +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + struct thunder_pem_softc *sc = device_get_softc(dev); + if (type == PCI_RES_BUS) + return (pci_domain_release_bus(sc->id, child, rid, res)); +#endif /* Find parent device. On ThunderX we know an exact path. */ parent_dev = device_get_parent(device_get_parent(dev)); Modified: head/sys/dev/pci/pci_host_generic.c ============================================================================== --- head/sys/dev/pci/pci_host_generic.c Fri May 20 08:28:11 2016 (r300289) +++ head/sys/dev/pci/pci_host_generic.c Fri May 20 08:29:00 2016 (r300290) @@ -501,7 +501,14 @@ static int generic_pcie_release_resource(device_t dev, device_t child, int type, int rid, struct resource *res) { +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + struct generic_pcie_softc *sc; + if (type == PCI_RES_BUS) { + sc = device_get_softc(dev); + return (pci_domain_release_bus(sc->ecam, child, rid, res)); + } +#endif /* For PCIe devices that do not have FDT nodes, use PCIB method */ if ((int)ofw_bus_get_node(child) <= 0) { return (generic_pcie_release_resource_pcie(dev, @@ -517,7 +524,15 @@ struct resource * pci_host_generic_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) { +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + struct generic_pcie_softc *sc; + if (type == PCI_RES_BUS) { + sc = device_get_softc(dev); + return (pci_domain_alloc_bus(sc->ecam, child, rid, start, end, + count, flags)); + } +#endif /* For PCIe devices that do not have FDT nodes, use PCIB method */ if ((int)ofw_bus_get_node(child) <= 0) return (generic_pcie_alloc_resource_pcie(dev, child, type, rid, @@ -579,6 +594,11 @@ generic_pcie_adjust_resource(device_t de struct rman *rm; sc = device_get_softc(dev); +#if defined(NEW_PCIB) && defined(PCI_RES_BUS) + if (type == PCI_RES_BUS) + return (pci_domain_adjust_bus(sc->ecam, child, res, start, + end)); +#endif rm = generic_pcie_rman(sc, type); if (rm != NULL)