From 9729b14985832614fe7a8e372a9dcccaffc7d05d Mon Sep 17 00:00:00 2001
From: Ruslan Bukin
Date: Fri, 23 Oct 2020 21:27:48 +0000
Subject: [PATCH] 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
---
sys/dev/ahci/ahci_pci.c | 4 ----
sys/kern/subr_bus_dma.c | 19 +++++++++++++++++++
sys/x86/x86/busdma_machdep.c | 20 --------------------
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c
index 0646d3a19c00..51b1c68cb462 100644
--- a/sys/dev/ahci/ahci_pci.c
+++ b/sys/dev/ahci/ahci_pci.c
@@ -27,8 +27,6 @@
#include
__FBSDID("$FreeBSD$");
-#include "opt_iommu.h"
-
#include
#include
#include
@@ -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 */
diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c
index 030a5721585a..6248dd520511 100644
--- a/sys/kern/subr_bus_dma.c
+++ b/sys/kern/subr_bus_dma.c
@@ -33,6 +33,7 @@
__FBSDID("$FreeBSD$");
#include "opt_bus.h"
+#include "opt_iommu.h"
#include
#include
@@ -785,3 +786,21 @@ bus_dma_template_fill(bus_dma_template_t *t, bus_dma_param_t *kv, u_int count)
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
diff --git a/sys/x86/x86/busdma_machdep.c b/sys/x86/x86/busdma_machdep.c
index 92eab0cae842..d0f0526a75c7 100644
--- a/sys/x86/x86/busdma_machdep.c
+++ b/sys/x86/x86/busdma_machdep.c
@@ -34,7 +34,6 @@
__FBSDID("$FreeBSD$");
#include "opt_acpi.h"
-#include "opt_iommu.h"
#include
#include
@@ -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