Author: br
Date: Fri Oct 23 21:27:48 2020
New Revision: 366980
URL: https://svnweb.freebsd.org/changeset/base/366980

Log:
  Move the iommu stubs to a generic place, so they are available on all the
  platforms.
  
  This allows to not depend on the IOMMU macro in AHCI driver.
  
  Requested by: kib
  Suggested by: andrew
  Reviewed by:  kib
  Sponsored by: Innovate DSbD
  Differential Revision:        https://reviews.freebsd.org/D26887

Modified:
  head/sys/dev/ahci/ahci_pci.c
  head/sys/kern/subr_bus_dma.c
  head/sys/x86/x86/busdma_machdep.c

Modified: head/sys/dev/ahci/ahci_pci.c
==============================================================================
--- head/sys/dev/ahci/ahci_pci.c        Fri Oct 23 18:29:36 2020        
(r366979)
+++ head/sys/dev/ahci/ahci_pci.c        Fri Oct 23 21:27:48 2020        
(r366980)
@@ -27,8 +27,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_iommu.h"
-
 #include <sys/param.h>
 #include <sys/module.h>
 #include <sys/systm.h>
@@ -501,7 +499,6 @@ ahci_pci_attach(device_t dev)
                i++;
        ctlr->quirks = ahci_ids[i].quirks;
 
-#ifdef IOMMU
        if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) {
                /*
                 * The controller issues DMA requests from PCI function 1,
@@ -510,7 +507,6 @@ ahci_pci_attach(device_t dev)
                 */
                bus_dma_iommu_set_buswide(dev);
        }
-#endif
 
        /* Limit speed for my onboard JMicron external port.
         * It is not eSATA really, limit to SATA 1 */

Modified: head/sys/kern/subr_bus_dma.c
==============================================================================
--- head/sys/kern/subr_bus_dma.c        Fri Oct 23 18:29:36 2020        
(r366979)
+++ head/sys/kern/subr_bus_dma.c        Fri Oct 23 21:27:48 2020        
(r366980)
@@ -33,6 +33,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_bus.h"
+#include "opt_iommu.h"
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -785,3 +786,21 @@ bus_dma_template_fill(bus_dma_template_t *t, bus_dma_p
        return;
 }
 
+#ifndef IOMMU
+bool bus_dma_iommu_set_buswide(device_t dev);
+int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
+    vm_paddr_t start, vm_size_t length, int flags);
+
+bool
+bus_dma_iommu_set_buswide(device_t dev)
+{
+       return (false);
+}
+
+int
+bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
+    vm_paddr_t start, vm_size_t length, int flags)
+{
+       return (0);
+}
+#endif

Modified: head/sys/x86/x86/busdma_machdep.c
==============================================================================
--- head/sys/x86/x86/busdma_machdep.c   Fri Oct 23 18:29:36 2020        
(r366979)
+++ head/sys/x86/x86/busdma_machdep.c   Fri Oct 23 21:27:48 2020        
(r366980)
@@ -34,7 +34,6 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
-#include "opt_iommu.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,22 +267,3 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
        tc = (struct bus_dma_tag_common *)dmat;
        return (tc->impl->tag_destroy(dmat));
 }
-
-#ifndef IOMMU
-bool bus_dma_iommu_set_buswide(device_t dev);
-int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,   
-    vm_paddr_t start, vm_size_t length, int flags);
-
-bool
-bus_dma_iommu_set_buswide(device_t dev)
-{
-       return (false);
-}
-
-int
-bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map,
-    vm_paddr_t start, vm_size_t length, int flags)
-{
-       return (0);
-}
-#endif
_______________________________________________
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