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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to