mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 03:56:42 +00:00
Refactor the source structure in aster_frame::mm
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
e8595b95fe
commit
7095b37e7e
@ -4,7 +4,9 @@ use alloc::{collections::LinkedList, sync::Arc};
|
||||
|
||||
use align_ext::AlignExt;
|
||||
use aster_frame::{
|
||||
mm::{Daddr, DmaDirection, DmaStream, HasDaddr, VmAllocOptions, VmReader, VmWriter, PAGE_SIZE},
|
||||
mm::{
|
||||
Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE,
|
||||
},
|
||||
sync::SpinLock,
|
||||
};
|
||||
use pod::Pod;
|
||||
@ -27,7 +29,7 @@ impl TxBuffer {
|
||||
} else {
|
||||
let segment = {
|
||||
let nframes = (nbytes.align_up(PAGE_SIZE)) / PAGE_SIZE;
|
||||
VmAllocOptions::new(nframes).alloc_contiguous().unwrap()
|
||||
FrameAllocOptions::new(nframes).alloc_contiguous().unwrap()
|
||||
};
|
||||
DmaStream::map(segment, DmaDirection::ToDevice, false).unwrap()
|
||||
};
|
||||
|
@ -9,7 +9,9 @@ use alloc::{
|
||||
use core::ops::Range;
|
||||
|
||||
use aster_frame::{
|
||||
mm::{Daddr, DmaDirection, DmaStream, HasDaddr, VmAllocOptions, VmReader, VmWriter, PAGE_SIZE},
|
||||
mm::{
|
||||
Daddr, DmaDirection, DmaStream, FrameAllocOptions, HasDaddr, VmReader, VmWriter, PAGE_SIZE,
|
||||
},
|
||||
sync::{RwLock, SpinLock},
|
||||
};
|
||||
use bitvec::{array::BitArray, prelude::Lsb0};
|
||||
@ -145,7 +147,7 @@ impl DmaPage {
|
||||
pool: Weak<DmaPool>,
|
||||
) -> Result<Self, aster_frame::Error> {
|
||||
let dma_stream = {
|
||||
let vm_segment = VmAllocOptions::new(1).alloc_contiguous()?;
|
||||
let vm_segment = FrameAllocOptions::new(1).alloc_contiguous()?;
|
||||
|
||||
DmaStream::map(vm_segment, direction, is_cache_coherent)
|
||||
.map_err(|_| aster_frame::Error::AccessDenied)?
|
||||
|
Reference in New Issue
Block a user