FreeBSD/sys/sparc64/sparc64/iommu.c
/*
 * Try to find a suitably-sized (and if requested, -aligned) slab of DVMA
 * memory with IO page offset voffs.
 */
Try to find a suitably-sized (and if requested, -aligned) slab of DVMA
memory with IO page offset voffs.
Try to find a suitably - sized ( and if requested - aligned ) slab of DVMA memory with IO page offset voffs .
static bus_addr_t
iommu_dvma_vfindseg(bus_dmamap_t map, vm_offset_t voffs, bus_size_t size,
    bus_addr_t amask)
{
	struct bus_dmamap_res *r;
	bus_addr_t dvmaddr, dvmend;
	KASSERT(!map->dm_onq, ("%s: map on queue!", __func__));
	SLIST_FOREACH(r, &map->dm_reslist, dr_link) {
		dvmaddr = round_io_page(BDR_START(r) + r->dr_used);
		dvmaddr = (dvmaddr + amask) & ~amask;
		dvmaddr += voffs;
		dvmend = dvmaddr + size;
		if (dvmend <= BDR_END(r)) {
			r->dr_used = dvmend - BDR_START(r);
			return (dvmaddr);
		}
	}
	return (0);
}
static bus_addr_t iommu_dvma_vfindseg ( bus_dmamap_t map , vm_offset_t voffs , bus_size_t size , bus_addr_t amask ) { struct bus_dmamap_res * r ; bus_addr_t dvmaddr , dvmend ; KASSERT ( ! map -> dm_onq , ( " " , __func__ ) ) ; SLIST_FOREACH ( r , & map -> dm_reslist , dr_link ) { dvmaddr = round_io_page ( BDR_START ( r ) + r -> dr_used ) ; dvmaddr = ( dvmaddr + amask ) & ~ amask ; dvmaddr += voffs ; dvmend = dvmaddr + size ; if ( dvmend <= BDR_END ( r ) ) { r -> dr_used = dvmend - BDR_START ( r ) ; return ( dvmaddr ) ; } } return ( 0 ) ; }
Try to find a suitably-sized (and if requested, -aligned) slab of DVMA
 memory with IO page offset voffs.
Try to find a suitably - sized ( and if requested - aligned ) slab of DVMA memory with IO page offset voffs .
/* Alignment can only work with voffs == 0. */