Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/iommu/busdma_iommu.c
Show First 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
ctx = iommu_instantiate_ctx(unit, child, false); | ctx = iommu_instantiate_ctx(unit, child, false); | ||||
res = ctx == NULL ? NULL : (bus_dma_tag_t)ctx->tag; | res = ctx == NULL ? NULL : (bus_dma_tag_t)ctx->tag; | ||||
return (res); | return (res); | ||||
} | } | ||||
bool | bool | ||||
bus_dma_dmar_set_buswide(device_t dev) | bus_dma_iommu_set_buswide(device_t dev) | ||||
{ | { | ||||
struct iommu_unit *unit; | struct iommu_unit *unit; | ||||
device_t parent; | device_t parent; | ||||
u_int busno, slot, func; | u_int busno, slot, func; | ||||
parent = device_get_parent(dev); | parent = device_get_parent(dev); | ||||
if (device_get_devclass(parent) != devclass_find("pci")) | if (device_get_devclass(parent) != devclass_find("pci")) | ||||
return (false); | return (false); | ||||
unit = iommu_find(dev, bootverbose); | unit = iommu_find(dev, bootverbose); | ||||
if (unit == NULL) | if (unit == NULL) | ||||
return (false); | return (false); | ||||
busno = pci_get_bus(dev); | busno = pci_get_bus(dev); | ||||
slot = pci_get_slot(dev); | slot = pci_get_slot(dev); | ||||
func = pci_get_function(dev); | func = pci_get_function(dev); | ||||
if (slot != 0 || func != 0) { | if (slot != 0 || func != 0) { | ||||
if (bootverbose) { | if (bootverbose) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"dmar%d pci%d:%d:%d requested buswide busdma\n", | "iommu%d pci%d:%d:%d requested buswide busdma\n", | ||||
unit->unit, busno, slot, func); | unit->unit, busno, slot, func); | ||||
} | } | ||||
return (false); | return (false); | ||||
} | } | ||||
dmar_set_buswide_ctx(unit, busno); | iommu_set_buswide_ctx(unit, busno); | ||||
return (true); | return (true); | ||||
} | } | ||||
static MALLOC_DEFINE(M_IOMMU_DMAMAP, "iommu_dmamap", "IOMMU DMA Map"); | static MALLOC_DEFINE(M_IOMMU_DMAMAP, "iommu_dmamap", "IOMMU DMA Map"); | ||||
static void iommu_bus_schedule_dmamap(struct iommu_unit *unit, | static void iommu_bus_schedule_dmamap(struct iommu_unit *unit, | ||||
struct bus_dmamap_iommu *map); | struct bus_dmamap_iommu *map); | ||||
▲ Show 20 Lines • Show All 648 Lines • ▼ Show 20 Lines | if (unit->delayed_taskqueue == NULL) | ||||
return; | return; | ||||
taskqueue_drain(unit->delayed_taskqueue, &unit->dmamap_load_task); | taskqueue_drain(unit->delayed_taskqueue, &unit->dmamap_load_task); | ||||
taskqueue_free(unit->delayed_taskqueue); | taskqueue_free(unit->delayed_taskqueue); | ||||
unit->delayed_taskqueue = NULL; | unit->delayed_taskqueue = NULL; | ||||
} | } | ||||
int | int | ||||
bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, | bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, | ||||
vm_paddr_t start, vm_size_t length, int flags) | vm_paddr_t start, vm_size_t length, int flags) | ||||
{ | { | ||||
struct bus_dma_tag_common *tc; | struct bus_dma_tag_common *tc; | ||||
struct bus_dma_tag_iommu *tag; | struct bus_dma_tag_iommu *tag; | ||||
struct bus_dmamap_iommu *map; | struct bus_dmamap_iommu *map; | ||||
struct iommu_ctx *ctx; | struct iommu_ctx *ctx; | ||||
struct iommu_domain *domain; | struct iommu_domain *domain; | ||||
struct iommu_map_entry *entry; | struct iommu_map_entry *entry; | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |