FreeBSD/sys/x86/iommu/intel_utils.c
/*
 * Load the root entry pointer into the hardware, busily waiting for
 * the completion.
 */
Load the root entry pointer into the hardware, busily waiting for
the completion.
Load the root entry pointer into the hardware busily waiting for the completion .
int
dmar_load_root_entry_ptr(struct dmar_unit *unit)
{
	vm_page_t root_entry;
	DMAR_ASSERT_LOCKED(unit);
	VM_OBJECT_RLOCK(unit->ctx_obj);
	root_entry = vm_page_lookup(unit->ctx_obj, 0);
	VM_OBJECT_RUNLOCK(unit->ctx_obj);
	dmar_write8(unit, DMAR_RTADDR_REG, VM_PAGE_TO_PHYS(root_entry));
	dmar_write4(unit, DMAR_GCMD_REG, unit->hw_gcmd | DMAR_GCMD_SRTP);
	while ((dmar_read4(unit, DMAR_GSTS_REG) & DMAR_GSTS_RTPS) == 0)
		cpu_spinwait();
	return (0);
}
int dmar_load_root_entry_ptr ( struct dmar_unit * unit ) { vm_page_t root_entry ; DMAR_ASSERT_LOCKED ( unit ) ; VM_OBJECT_RLOCK ( unit -> ctx_obj ) ; root_entry = vm_page_lookup ( unit -> ctx_obj , 0 ) ; VM_OBJECT_RUNLOCK ( unit -> ctx_obj ) ; dmar_write8 ( unit , DMAR_RTADDR_REG , VM_PAGE_TO_PHYS ( root_entry ) ) ; dmar_write4 ( unit , DMAR_GCMD_REG , unit -> hw_gcmd | DMAR_GCMD_SRTP ) ; while ( ( dmar_read4 ( unit , DMAR_GSTS_REG ) & DMAR_GSTS_RTPS ) == 0 ) cpu_spinwait ( ) ; return ( 0 ) ; }
Load the root entry pointer into the hardware, busily waiting for
 the completion.
Load the root entry pointer into the hardware busily waiting for the completion .
/*
	 * Access to the GCMD register must be serialized while the
	 * command is submitted.
	 */ /* XXXKIB should have a timeout */