Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/iommu/busdma_dmar.h
Show All 28 Lines | |||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef __X86_IOMMU_BUSDMA_DMAR_H | #ifndef __X86_IOMMU_BUSDMA_DMAR_H | ||||
#define __X86_IOMMU_BUSDMA_DMAR_H | #define __X86_IOMMU_BUSDMA_DMAR_H | ||||
struct dmar_map_entry; | struct iommu_map_entry; | ||||
TAILQ_HEAD(dmar_map_entries_tailq, dmar_map_entry); | TAILQ_HEAD(iommu_map_entries_tailq, iommu_map_entry); | ||||
struct bus_dma_tag_dmar { | struct bus_dma_tag_iommu { | ||||
struct bus_dma_tag_common common; | struct bus_dma_tag_common common; | ||||
struct dmar_ctx *ctx; | struct iommu_device *ctx; | ||||
device_t owner; | device_t owner; | ||||
int map_count; | int map_count; | ||||
bus_dma_segment_t *segments; | bus_dma_segment_t *segments; | ||||
}; | }; | ||||
struct bus_dmamap_dmar { | struct bus_dmamap_iommu { | ||||
struct bus_dma_tag_dmar *tag; | struct bus_dma_tag_iommu *tag; | ||||
struct memdesc mem; | struct memdesc mem; | ||||
bus_dmamap_callback_t *callback; | bus_dmamap_callback_t *callback; | ||||
void *callback_arg; | void *callback_arg; | ||||
struct dmar_map_entries_tailq map_entries; | struct iommu_map_entries_tailq map_entries; | ||||
TAILQ_ENTRY(bus_dmamap_dmar) delay_link; | TAILQ_ENTRY(bus_dmamap_iommu) delay_link; | ||||
bool locked; | bool locked; | ||||
bool cansleep; | bool cansleep; | ||||
int flags; | int flags; | ||||
}; | }; | ||||
#define BUS_DMAMAP_DMAR_MALLOC 0x0001 | #define BUS_DMAMAP_IOMMU_MALLOC 0x0001 | ||||
#define BUS_DMAMAP_DMAR_KMEM_ALLOC 0x0002 | #define BUS_DMAMAP_IOMMU_KMEM_ALLOC 0x0002 | ||||
extern struct bus_dma_impl bus_dma_dmar_impl; | extern struct bus_dma_impl bus_dma_iommu_impl; | ||||
struct iommu_unit { | |||||
struct mtx lock; | |||||
int unit; | |||||
int dma_enabled; | |||||
/* Busdma delayed map load */ | |||||
struct task dmamap_load_task; | |||||
TAILQ_HEAD(, bus_dmamap_iommu) delayed_maps; | |||||
struct taskqueue *delayed_taskqueue; | |||||
}; | |||||
struct iommu_domain { | |||||
struct iommu_unit *iommu; /* (c) */ | |||||
kib: You moved structures' definitions together with the locking annotations, but did not copied the… | |||||
Done Inline ActionsI had to change struct bus_dma_tag_iommu to struct bus_dma_tag_iommu * in sys/iommu.h, otherwise it wont build br: I had to change struct bus_dma_tag_iommu to struct bus_dma_tag_iommu * in sys/iommu.h… | |||||
struct mtx lock; /* (c) */ | |||||
struct task unload_task; /* (c) */ | |||||
struct iommu_map_entries_tailq unload_entries; /* (d) Entries to | |||||
unload */ | |||||
}; | |||||
struct iommu_device { | |||||
Done Inline ActionsI t is not a device, I already commented on this. It is still iommu translation context. kib: I t is not a device, I already commented on this. It is still iommu translation context. | |||||
Done Inline ActionsAgree, device renamed to ctx! br: Agree, device renamed to ctx! | |||||
struct iommu_domain *domain; /* (c) */ | |||||
struct bus_dma_tag_iommu tag; /* (c) Root tag */ | |||||
u_long loads; /* atomic updates, for stat only */ | |||||
u_long unloads; /* same */ | |||||
u_int flags; /* (u) */ | |||||
}; | |||||
#define IOMMU_LOCK(unit) mtx_lock(&(unit)->lock) | |||||
#define IOMMU_UNLOCK(unit) mtx_unlock(&(unit)->lock) | |||||
#define IOMMU_ASSERT_LOCKED(unit) mtx_assert(&(unit)->lock, MA_OWNED) | |||||
bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child); | bus_dma_tag_t acpi_iommu_get_dma_tag(device_t dev, device_t child); | ||||
#endif | #endif |
You moved structures' definitions together with the locking annotations, but did not copied the legend.
Also I do not like the move of iommu_unit/devce (still device ?) into bsudma_dmar.h. I think this part deserves a new header in sys/sys.