Ensure that MMIO memory is mapped without caching
This commit is contained in:
@@ -6,7 +6,7 @@ use std::str;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use syscall::PHYSMAP_WRITE;
|
||||
use syscall::{PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::error::{Error, EACCES, EBADF, Result, EINVAL};
|
||||
use syscall::flag::{SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
use syscall::io::{Mmio, Io};
|
||||
@@ -159,7 +159,7 @@ impl IntelHDA {
|
||||
};
|
||||
|
||||
let buff_desc_virt = unsafe {
|
||||
syscall::physmap(buff_desc_phys, 0x1000, PHYSMAP_WRITE)
|
||||
syscall::physmap(buff_desc_phys, 0x1000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("ihdad: failed to map address for buffer descriptor list.")
|
||||
};
|
||||
|
||||
@@ -172,7 +172,7 @@ impl IntelHDA {
|
||||
.expect("Could not allocate physical memory for CORB and RIRB.")
|
||||
};
|
||||
|
||||
let cmd_buff_virt = unsafe { syscall::physmap(cmd_buff_address, 0x1000, PHYSMAP_WRITE).expect("ihdad: failed to map address for CORB/RIRB buff") };
|
||||
let cmd_buff_virt = unsafe { syscall::physmap(cmd_buff_address, 0x1000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("ihdad: failed to map address for CORB/RIRB buff") };
|
||||
|
||||
print!("Virt: {:016X}, Phys: {:016X}\n", cmd_buff_virt, cmd_buff_address);
|
||||
let mut module = IntelHDA {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use syscall::PHYSMAP_WRITE;
|
||||
use syscall::{PHYSMAP_WRITE, PHYSMAP_NO_CACHE};
|
||||
use syscall::error::{Error, EIO, Result};
|
||||
use syscall::io::{Mmio, Io};
|
||||
use std::result;
|
||||
@@ -301,7 +301,7 @@ impl StreamBuffer {
|
||||
};
|
||||
|
||||
let addr = match unsafe {
|
||||
syscall::physmap(phys, block_length * block_count, PHYSMAP_WRITE)
|
||||
syscall::physmap(phys, block_length * block_count, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
} {
|
||||
Ok(addr) => addr,
|
||||
Err(err) => {
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ use std::{env, usize};
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write, Result};
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd};
|
||||
use syscall::{PHYSMAP_WRITE, Packet, SchemeBlockMut};
|
||||
use syscall::{PHYSMAP_NO_CACHE, PHYSMAP_WRITE, Packet, SchemeBlockMut};
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -47,7 +47,7 @@ fn main() {
|
||||
|
||||
// Daemonize
|
||||
if unsafe { syscall::clone(0).unwrap() } == 0 {
|
||||
let address = unsafe { syscall::physmap(bar, 0x4000, PHYSMAP_WRITE).expect("ihdad: failed to map address") };
|
||||
let address = unsafe { syscall::physmap(bar, 0x4000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("ihdad: failed to map address") };
|
||||
{
|
||||
let mut irq_file = File::open(format!("irq:{}", irq)).expect("IHDA: failed to open IRQ file");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user