Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/iommu/intel_dmar.h
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
struct dmar_ctx { | struct dmar_ctx { | ||||
struct iommu_ctx context; | struct iommu_ctx context; | ||||
uint16_t rid; /* (c) pci RID */ | uint16_t rid; /* (c) pci RID */ | ||||
uint64_t last_fault_rec[2]; /* Last fault reported */ | uint64_t last_fault_rec[2]; /* Last fault reported */ | ||||
LIST_ENTRY(dmar_ctx) link; /* (u) Member in the domain list */ | LIST_ENTRY(dmar_ctx) link; /* (u) Member in the domain list */ | ||||
u_int refs; /* (u) References from tags */ | u_int refs; /* (u) References from tags */ | ||||
}; | }; | ||||
#define DMAR_DOMAIN_GAS_INITED 0x0001 | |||||
#define DMAR_DOMAIN_PGTBL_INITED 0x0002 | |||||
#define DMAR_DOMAIN_IDMAP 0x0010 /* Domain uses identity | |||||
page table */ | |||||
#define DMAR_DOMAIN_RMRR 0x0020 /* Domain contains RMRR entry, | |||||
cannot be turned off */ | |||||
#define DMAR_DOMAIN_PGLOCK(dom) VM_OBJECT_WLOCK((dom)->pgtbl_obj) | #define DMAR_DOMAIN_PGLOCK(dom) VM_OBJECT_WLOCK((dom)->pgtbl_obj) | ||||
#define DMAR_DOMAIN_PGTRYLOCK(dom) VM_OBJECT_TRYWLOCK((dom)->pgtbl_obj) | #define DMAR_DOMAIN_PGTRYLOCK(dom) VM_OBJECT_TRYWLOCK((dom)->pgtbl_obj) | ||||
#define DMAR_DOMAIN_PGUNLOCK(dom) VM_OBJECT_WUNLOCK((dom)->pgtbl_obj) | #define DMAR_DOMAIN_PGUNLOCK(dom) VM_OBJECT_WUNLOCK((dom)->pgtbl_obj) | ||||
#define DMAR_DOMAIN_ASSERT_PGLOCKED(dom) \ | #define DMAR_DOMAIN_ASSERT_PGLOCKED(dom) \ | ||||
VM_OBJECT_ASSERT_WLOCKED((dom)->pgtbl_obj) | VM_OBJECT_ASSERT_WLOCKED((dom)->pgtbl_obj) | ||||
#define DMAR_DOMAIN_LOCK(dom) mtx_lock(&(dom)->iodom.lock) | #define DMAR_DOMAIN_LOCK(dom) mtx_lock(&(dom)->iodom.lock) | ||||
#define DMAR_DOMAIN_UNLOCK(dom) mtx_unlock(&(dom)->iodom.lock) | #define DMAR_DOMAIN_UNLOCK(dom) mtx_unlock(&(dom)->iodom.lock) | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | |||||
void dmar_free_ctx_locked(struct dmar_unit *dmar, struct dmar_ctx *ctx); | void dmar_free_ctx_locked(struct dmar_unit *dmar, struct dmar_ctx *ctx); | ||||
void dmar_free_ctx(struct dmar_ctx *ctx); | void dmar_free_ctx(struct dmar_ctx *ctx); | ||||
struct dmar_ctx *dmar_find_ctx_locked(struct dmar_unit *dmar, uint16_t rid); | struct dmar_ctx *dmar_find_ctx_locked(struct dmar_unit *dmar, uint16_t rid); | ||||
void dmar_domain_unload_entry(struct iommu_map_entry *entry, bool free); | void dmar_domain_unload_entry(struct iommu_map_entry *entry, bool free); | ||||
void dmar_domain_unload(struct dmar_domain *domain, | void dmar_domain_unload(struct dmar_domain *domain, | ||||
struct iommu_map_entries_tailq *entries, bool cansleep); | struct iommu_map_entries_tailq *entries, bool cansleep); | ||||
void dmar_domain_free_entry(struct iommu_map_entry *entry, bool free); | void dmar_domain_free_entry(struct iommu_map_entry *entry, bool free); | ||||
void iommu_gas_init_domain(struct iommu_domain *domain); | |||||
void iommu_gas_fini_domain(struct iommu_domain *domain); | |||||
struct iommu_map_entry *iommu_gas_alloc_entry(struct iommu_domain *domain, | |||||
u_int flags); | |||||
void iommu_gas_free_entry(struct iommu_domain *domain, | |||||
struct iommu_map_entry *entry); | |||||
void iommu_gas_free_space(struct iommu_domain *domain, | |||||
struct iommu_map_entry *entry); | |||||
int iommu_gas_map(struct iommu_domain *domain, | |||||
const struct bus_dma_tag_common *common, iommu_gaddr_t size, int offset, | |||||
u_int eflags, u_int flags, vm_page_t *ma, struct iommu_map_entry **res); | |||||
void iommu_gas_free_region(struct iommu_domain *domain, | |||||
struct iommu_map_entry *entry); | |||||
int iommu_gas_map_region(struct iommu_domain *domain, | |||||
struct iommu_map_entry *entry, u_int eflags, u_int flags, vm_page_t *ma); | |||||
int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start, | |||||
iommu_gaddr_t end); | |||||
void dmar_dev_parse_rmrr(struct dmar_domain *domain, int dev_domain, | void dmar_dev_parse_rmrr(struct dmar_domain *domain, int dev_domain, | ||||
int dev_busno, const void *dev_path, int dev_path_len, | int dev_busno, const void *dev_path, int dev_path_len, | ||||
struct iommu_map_entries_tailq *rmrr_entries); | struct iommu_map_entries_tailq *rmrr_entries); | ||||
int dmar_instantiate_rmrr_ctxs(struct iommu_unit *dmar); | int dmar_instantiate_rmrr_ctxs(struct iommu_unit *dmar); | ||||
void dmar_quirks_post_ident(struct dmar_unit *dmar); | void dmar_quirks_post_ident(struct dmar_unit *dmar); | ||||
void dmar_quirks_pre_use(struct iommu_unit *dmar); | void dmar_quirks_pre_use(struct iommu_unit *dmar); | ||||
int dmar_init_irt(struct dmar_unit *unit); | int dmar_init_irt(struct dmar_unit *unit); | ||||
void dmar_fini_irt(struct dmar_unit *unit); | void dmar_fini_irt(struct dmar_unit *unit); | ||||
void dmar_set_buswide_ctx(struct iommu_unit *unit, u_int busno); | void dmar_set_buswide_ctx(struct iommu_unit *unit, u_int busno); | ||||
bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno); | bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int busno); | ||||
/* Map flags */ | |||||
#define IOMMU_MF_CANWAIT 0x0001 | |||||
#define IOMMU_MF_CANSPLIT 0x0002 | |||||
#define IOMMU_MF_RMRR 0x0004 | |||||
#define DMAR_PGF_WAITOK 0x0001 | |||||
#define DMAR_PGF_ZERO 0x0002 | |||||
#define DMAR_PGF_ALLOC 0x0004 | |||||
#define DMAR_PGF_NOALLOC 0x0008 | |||||
#define DMAR_PGF_OBJL 0x0010 | |||||
extern iommu_haddr_t dmar_high; | extern iommu_haddr_t dmar_high; | ||||
extern int haw; | extern int haw; | ||||
extern int dmar_tbl_pagecnt; | extern int dmar_tbl_pagecnt; | ||||
extern int dmar_batch_coalesce; | extern int dmar_batch_coalesce; | ||||
extern int iommu_check_free; | |||||
static inline uint32_t | static inline uint32_t | ||||
dmar_read4(const struct dmar_unit *unit, int reg) | dmar_read4(const struct dmar_unit *unit, int reg) | ||||
{ | { | ||||
return (bus_read_4(unit->regs, reg)); | return (bus_read_4(unit->regs, reg)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |