pub use super::asm::flush_icache_all;
#[inline]
pub unsafe fn clean_dcache_range_to_pou(_range: crate::cache::CacheRange) {}
#[cfg(feature = "riscv-thead-mae")]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum TheadDataCacheOperation {
Clean,
CleanInvalidate,
}
#[cfg(feature = "riscv-thead-mae")]
pub unsafe fn maintain_thead_dcache(
operation: TheadDataCacheOperation,
range: crate::cache::PhysicalCacheRange,
) {
if range.is_empty() {
return;
}
range.for_each_line(64, |line| {
unsafe {
match operation {
TheadDataCacheOperation::Clean => {
core::arch::asm!(".long 0x0295000b", in("a0") line, options(nostack))
}
TheadDataCacheOperation::CleanInvalidate => {
core::arch::asm!(".long 0x02b5000b", in("a0") line, options(nostack))
}
}
}
});
unsafe {
core::arch::asm!(".long 0x01b0000b", options(nostack));
}
}