o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().

This function isn't ACPI dependent and we may use it on FDT systems
  as well.
o Don't repeat the function declaration, include iommu.h instead.

Reviewed by:	andrew, kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D26584
This commit is contained in:
Ruslan Bukin 2020-09-29 15:10:56 +00:00
parent 752c1d14e3
commit 025730aad6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366257
5 changed files with 13 additions and 7 deletions

View File

@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/taskqueue.h>
#include <sys/tree.h>
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
@ -49,6 +51,8 @@ __FBSDID("$FreeBSD$");
#include <dev/pci/pcivar.h>
#include <dev/pci/pci_private.h>
#include <dev/iommu/iommu.h>
#include "pcib_if.h"
#include "pci_if.h"
@ -456,7 +460,6 @@ acpi_pci_detach(device_t dev)
}
#ifdef ACPI_DMAR
bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
static bus_dma_tag_t
acpi_pci_get_dma_tag(device_t bus, device_t child)
{
@ -464,7 +467,7 @@ acpi_pci_get_dma_tag(device_t bus, device_t child)
if (device_get_parent(child) == bus) {
/* try iommu and return if it works */
tag = acpi_iommu_get_dma_tag(bus, child);
tag = iommu_get_dma_tag(bus, child);
} else
tag = NULL;
if (tag == NULL)

View File

@ -270,7 +270,7 @@ iommu_instantiate_ctx(struct iommu_unit *unit, device_t dev, bool rmrr)
}
bus_dma_tag_t
acpi_iommu_get_dma_tag(device_t dev, device_t child)
iommu_get_dma_tag(device_t dev, device_t child)
{
struct iommu_unit *unit;
struct iommu_ctx *ctx;

View File

@ -61,6 +61,4 @@ struct bus_dmamap_iommu {
extern struct bus_dma_impl bus_dma_iommu_impl;
bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
#endif

View File

@ -232,6 +232,8 @@ 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);
bus_dma_tag_t iommu_get_dma_tag(device_t dev, device_t child);
SYSCTL_DECL(_hw_iommu);
#endif /* !_SYS_IOMMU_H_ */

View File

@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$");
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <sys/tree.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@ -77,6 +79,8 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/controller/ohcireg.h>
#include <dev/usb/controller/uhcireg.h>
#include <dev/iommu/iommu.h>
#include "pcib_if.h"
#include "pci_if.h"
@ -5680,7 +5684,6 @@ pci_get_resource_list (device_t dev, device_t child)
}
#ifdef ACPI_DMAR
bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child);
bus_dma_tag_t
pci_get_dma_tag(device_t bus, device_t dev)
{
@ -5689,7 +5692,7 @@ pci_get_dma_tag(device_t bus, device_t dev)
if (device_get_parent(dev) == bus) {
/* try iommu and return if it works */
tag = acpi_iommu_get_dma_tag(bus, dev);
tag = iommu_get_dma_tag(bus, dev);
} else
tag = NULL;
if (tag == NULL) {