Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2018 19:48:50 +0000 (UTC)
From:      "Landon J. Fuller" <landonf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331746 - in head/sys: dev/bhnd/bhndb mips/broadcom
Message-ID:  <201803291948.w2TJmogQ087678@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: landonf
Date: Thu Mar 29 19:48:50 2018
New Revision: 331746
URL: https://svnweb.freebsd.org/changeset/base/331746

Log:
  bhnd(4): Use the new BHND_CAP_BP64 capability flag to exclude DMA
  translations unsupported by the backplane.

Modified:
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/mips/broadcom/bhnd_nexus.c

Modified: head/sys/dev/bhnd/bhndb/bhndb.c
==============================================================================
--- head/sys/dev/bhnd/bhndb/bhndb.c	Thu Mar 29 19:48:17 2018	(r331745)
+++ head/sys/dev/bhnd/bhndb/bhndb.c	Thu Mar 29 19:48:50 2018	(r331746)
@@ -2128,7 +2128,14 @@ bhndb_get_dma_translation(device_t dev, device_t child
 	if (sc->bus_res->res->dma_tags == NULL)
 		return (ENODEV);
 
-	/* Find the best matching descriptor for the requested type */
+	/* Is the requested width supported? */
+	if (width > BHND_DMA_ADDR_32BIT) {
+		/* Backplane must support 64-bit addressing */
+		if (!(sc->chipid.chip_caps & BHND_CAP_BP64))
+			width = BHND_DMA_ADDR_32BIT;
+	}
+
+	/* Find the best matching descriptor for the requested width */
 	addr_mask = BHND_DMA_ADDR_BITMASK(width);
 
 	match = NULL;

Modified: head/sys/mips/broadcom/bhnd_nexus.c
==============================================================================
--- head/sys/mips/broadcom/bhnd_nexus.c	Thu Mar 29 19:48:17 2018	(r331745)
+++ head/sys/mips/broadcom/bhnd_nexus.c	Thu Mar 29 19:48:50 2018	(r331746)
@@ -234,10 +234,11 @@ bhnd_nexus_get_dma_translation(device_t dev, device_t 
 	KASSERT(width > 0 && width <= BHND_DMA_ADDR_64BIT,
 	    ("invalid width %u", width));
 
+	/* Is the requested width supported? */
 	if (width > BHND_DMA_ADDR_32BIT) {
 		/* Backplane must support 64-bit addressing */
-		if (!(bp->cc_caps & CHIPC_CAP_BKPLN64))
-			return (ENOENT);
+		if (!(bp->cid.chip_caps & BHND_CAP_BP64))
+			width = BHND_DMA_ADDR_32BIT;
 	}
 
 	/* No DMA address translation required */



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