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
This commit is contained in:
Ruslan Bukin 2020-10-23 21:27:48 +00:00
parent 116bc58260
commit 9729b14985
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366980
3 changed files with 19 additions and 24 deletions

View File

@ -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 */

View File

@ -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_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

View File

@ -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