aarch64/fb: flush data cache around mailbox accesses

can run on real raspi3
master
equation314 6 years ago
parent 5987c2068b
commit 48cf25716f

2
kernel/Cargo.lock generated

@ -1,7 +1,7 @@
[[package]]
name = "aarch64"
version = "2.2.2"
source = "git+https://github.com/equation314/aarch64#95e875933967067908bf1da66bf74db24d450062"
source = "git+https://github.com/equation314/aarch64#9770a21c00f5d74c32ed044ca200f0459caca828"
dependencies = [
"bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",

@ -8,7 +8,7 @@ use lazy_static::lazy_static;
use alloc::string::String;
use core::mem;
use spin::Mutex;
use aarch64::barrier;
use aarch64::{asm, barrier};
lazy_static! {
static ref MAILBOX: Mutex<Mailbox> = Mutex::new(Mailbox::new());
@ -185,14 +185,16 @@ macro_rules! send_request {
end_tag: RPI_FIRMWARE_PROPERTY_END,
});
unsafe { barrier::wmb() }
let start = &req as *const _ as u32;
let end = start + req.0.buf_size;
{
let addr = &req as *const _ as u32;
// flush data cache around mailbox accesses
let mut mbox = MAILBOX.lock();
mbox.write(MailboxChannel::Property, addr);
asm::flush_dcache_range(start as usize, end as usize);
mbox.write(MailboxChannel::Property, start);
mbox.read(MailboxChannel::Property);
asm::flush_dcache_range(start as usize, end as usize);
}
unsafe { barrier::rmb() }
match req.0.req_resp_code {
RPI_FIRMWARE_STATUS_SUCCESS => Ok(req.0.buf),

Loading…
Cancel
Save