fn map_into_iommu(
        iommu: &Arc<Iommu>,
        vmo: Arc<VmObject>,
        offset: usize,
        size: usize,
        perms: IommuPerms,
    ) -> ZxResult<Vec<DevVAddr>> {
        if vmo.is_contiguous() {
            let (vaddr, _mapped_len) = iommu.map_contiguous(vmo, offset, size, perms)?;
            Ok(vec![vaddr])
        } else {
            assert_eq!(size % iommu.minimum_contiguity(), 0);
            let mut mapped_addrs: Vec<DevVAddr> = Vec::new();
            let mut remaining = size;
            let mut cur_offset = offset;
            while remaining > 0 {
                let (mut vaddr, mapped_len) =
                    iommu.map(vmo.clone(), cur_offset, remaining, perms)?;
                assert_eq!(mapped_len % iommu.minimum_contiguity(), 0);
                for _ in 0..mapped_len / iommu.minimum_contiguity() {
                    mapped_addrs.push(vaddr);
                    vaddr += iommu.minimum_contiguity();
                }
                remaining -= mapped_len;
                cur_offset += mapped_len;
            }
            Ok(mapped_addrs)
        }
    }
/// Used during initialization to set up the IOMMU state for this PMT.
Used during initialization to set up the IOMMU state for this PMT.
Used during initialization to set up the IOMMU state for this PMT .
fn map_into_iommu(
        iommu: &Arc<Iommu>,
        vmo: Arc<VmObject>,
        offset: usize,
        size: usize,
        perms: IommuPerms,
    ) -> ZxResult<Vec<DevVAddr>> {
        if vmo.is_contiguous() {
            let (vaddr, _mapped_len) = iommu.map_contiguous(vmo, offset, size, perms)?;
            Ok(vec![vaddr])
        } else {
            assert_eq!(size % iommu.minimum_contiguity(), 0);
            let mut mapped_addrs: Vec<DevVAddr> = Vec::new();
            let mut remaining = size;
            let mut cur_offset = offset;
            while remaining > 0 {
                let (mut vaddr, mapped_len) =
                    iommu.map(vmo.clone(), cur_offset, remaining, perms)?;
                assert_eq!(mapped_len % iommu.minimum_contiguity(), 0);
                for _ in 0..mapped_len / iommu.minimum_contiguity() {
                    mapped_addrs.push(vaddr);
                    vaddr += iommu.minimum_contiguity();
                }
                remaining -= mapped_len;
                cur_offset += mapped_len;
            }
            Ok(mapped_addrs)
        }
    }
fn map_into_iommu ( iommu : & Arc < Iommu > , vmo : Arc < VmObject > , offset : usize , size : usize , perms : IommuPerms , ) -> ZxResult < Vec < DevVAddr > > { if vmo . is_contiguous ( ) { let ( vaddr , _mapped_len ) = iommu . map_contiguous ( vmo , offset , size , perms ) ? ; Ok ( vec ! [ vaddr ] ) } else { assert_eq ! ( size iommu minimum_contiguity ( ) 0 ) ; let mut mapped_addrs : Vec < DevVAddr > = Vec :: new ( ) ; let mut remaining = size ; let mut cur_offset = offset ; while remaining > 0 { let ( mut vaddr , mapped_len ) = iommu . map ( vmo . clone ( ) , cur_offset , remaining , perms ) ? ; assert_eq ! ( mapped_len iommu minimum_contiguity ( ) 0 ) ; for _ in 0 .. mapped_len / iommu . minimum_contiguity ( ) { mapped_addrs . push ( vaddr ) ; vaddr += iommu . minimum_contiguity ( ) ; } remaining -= mapped_len ; cur_offset += mapped_len ; } Ok ( mapped_addrs ) } }
Used during initialization to set up the IOMMU state for this PMT.
Used during initialization to set up the IOMMU state for this PMT .
iommu
&Arc<Iommu>
vmo
Arc<VmObject>
offset
usize
size
usize
perms
IommuPerms
iommu
&Arc<Iommu>
vmo
Arc<VmObject>
offset
usize
size
usize
perms
IommuPerms