Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 08:29:00 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
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
Message-ID:  <201605200829.u4K8T0cA018910@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



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