FreeBSD/sys/sparc64/sparc64/iommu.c
/*
 * Remove mappings created by iommu_enter().  Flush the streaming buffer,
 * but do not synchronize it.  Returns whether a streaming buffer flush
 * was performed.
 */
Remove mappings created by iommu_enter().  Flush the streaming buffer,
but do not synchronize it.  Returns whether a streaming buffer flush
was performed.
Remove mappings created by iommu_enter () . Flush the streaming buffer but do not synchronize it . Returns whether a streaming buffer flush was performed .
static int
iommu_remove(struct iommu_state *is, vm_offset_t va, vm_size_t len)
{
	int slot, streamed = 0;
#ifdef IOMMU_DIAG
	iommu_diag(is, va);
#endif
	KASSERT(va >= is->is_dvmabase,
	    ("%s: va 0x%lx not in DVMA space", __func__, (u_long)va));
	KASSERT(va + len >= va,
	    ("%s: va 0x%lx + len 0x%lx wraps", __func__, (long)va, (long)len));
	va = trunc_io_page(va);
	while (len > 0) {
		if ((IOMMU_GET_TTE(is, va) & IOTTE_STREAM) != 0) {
			streamed = 1;
			iommu_strbuf_flush(is, va);
		}
		len -= ulmin(len, IO_PAGE_SIZE);
		IOMMU_SET_TTE(is, va, 0);
		iommu_tlb_flush(is, va);
		if ((is->is_flags & IOMMU_FLUSH_CACHE) != 0) {
			slot = IOTSBSLOT(va);
			if (len <= IO_PAGE_SIZE || slot % 8 == 7)
				IOMMU_WRITE8(is, is_iommu, IMR_CACHE_FLUSH,
				    is->is_ptsb + slot * 8);
		}
		va += IO_PAGE_SIZE;
	}
	return (streamed);
}
static int iommu_remove ( struct iommu_state * is , vm_offset_t va , vm_size_t len ) { int slot , streamed = 0 ; #ifdef IOMMU_DIAG iommu_diag ( is , va ) ; #endif KASSERT ( va >= is -> is_dvmabase , ( " " , __func__ , ( u_long ) va ) ) ; KASSERT ( va + len >= va , ( " " , __func__ , ( long ) va , ( long ) len ) ) ; va = trunc_io_page ( va ) ; while ( len > 0 ) { if ( ( IOMMU_GET_TTE ( is , va ) & IOTTE_STREAM ) != 0 ) { streamed = 1 ; iommu_strbuf_flush ( is , va ) ; } len -= ulmin ( len , IO_PAGE_SIZE ) ; IOMMU_SET_TTE ( is , va , 0 ) ; iommu_tlb_flush ( is , va ) ; if ( ( is -> is_flags & IOMMU_FLUSH_CACHE ) != 0 ) { slot = IOTSBSLOT ( va ) ; if ( len <= IO_PAGE_SIZE || slot % 8 == 7 ) IOMMU_WRITE8 ( is , is_iommu , IMR_CACHE_FLUSH , is -> is_ptsb + slot * 8 ) ; } va += IO_PAGE_SIZE ; } return ( streamed ) ; }
Remove mappings created by iommu_enter().
Remove mappings created by iommu_enter () .