Remove physmap in non-initfs drivers too.
This commit is contained in:
@@ -9,3 +9,5 @@ netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch =
|
||||
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
|
||||
redox_syscall = "0.3"
|
||||
redox-daemon = "0.1"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::sync::Arc;
|
||||
|
||||
use event::EventQueue;
|
||||
use syscall::{EventFlags, Packet, SchemeMut, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::{EventFlags, Packet, SchemeMut};
|
||||
use syscall::error::EWOULDBLOCK;
|
||||
|
||||
pub mod device;
|
||||
@@ -43,7 +43,7 @@ fn main() {
|
||||
|
||||
let mut irq_file = File::open(format!("irq:{}", irq)).expect("alxd: failed to open IRQ file");
|
||||
|
||||
let address = unsafe { syscall::physmap(bar, 128*1024, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("alxd: failed to map address") };
|
||||
let address = unsafe { common::physmap(bar, 128*1024, common::Prot::RW, common::MemoryType::Uncacheable).expect("alxd: failed to map address") as usize };
|
||||
{
|
||||
let device = Arc::new(RefCell::new(unsafe { device::Alx::new(address).expect("alxd: failed to allocate device") }));
|
||||
|
||||
|
||||
@@ -9,3 +9,5 @@ netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch =
|
||||
redox-daemon = "0.1"
|
||||
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
|
||||
redox_syscall = "0.3"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::sync::Arc;
|
||||
|
||||
use event::EventQueue;
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut};
|
||||
|
||||
pub mod device;
|
||||
|
||||
@@ -91,9 +91,9 @@ fn main() {
|
||||
let mut irq_file = unsafe { File::from_raw_fd(irq_fd as RawFd) };
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar, bar_size, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
common::physmap(bar, bar_size, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("e1000d: failed to map address")
|
||||
};
|
||||
} as usize;
|
||||
{
|
||||
let device = Arc::new(RefCell::new(unsafe {
|
||||
device::Intel8254x::new(address).expect("e1000d: failed to allocate device")
|
||||
|
||||
@@ -12,4 +12,5 @@ redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
|
||||
redox_syscall = "0.3"
|
||||
spin = "0.9"
|
||||
|
||||
common = { path = "../common" }
|
||||
pcid = { path = "../pcid" }
|
||||
|
||||
@@ -7,7 +7,6 @@ use std::str;
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
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,8 +158,8 @@ impl IntelHDA {
|
||||
.expect("Could not allocate physical memory for buffer descriptor list.");
|
||||
|
||||
let buff_desc_virt =
|
||||
syscall::physmap(buff_desc_phys, 0x1000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("ihdad: failed to map address for buffer descriptor list.");
|
||||
common::physmap(buff_desc_phys, 0x1000, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("ihdad: failed to map address for buffer descriptor list.") as usize;
|
||||
|
||||
log::debug!("Virt: {:016X}, Phys: {:016X}", buff_desc_virt, buff_desc_phys);
|
||||
|
||||
@@ -170,7 +169,7 @@ impl IntelHDA {
|
||||
syscall::physalloc(0x1000)
|
||||
.expect("Could not allocate physical memory for CORB and RIRB.");
|
||||
|
||||
let cmd_buff_virt = syscall::physmap(cmd_buff_address, 0x1000, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("ihdad: failed to map address for CORB/RIRB buff");
|
||||
let cmd_buff_virt = common::physmap(cmd_buff_address, 0x1000, common::Prot::RW, common::MemoryType::Uncacheable).expect("ihdad: failed to map address for CORB/RIRB buff") as usize;
|
||||
|
||||
log::debug!("Virt: {:016X}, Phys: {:016X}", cmd_buff_virt, cmd_buff_address);
|
||||
let mut module = IntelHDA {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use syscall::{PHYSMAP_WRITE, PHYSMAP_NO_CACHE, PAGE_SIZE};
|
||||
use syscall::PAGE_SIZE;
|
||||
use syscall::error::{Error, EIO, Result};
|
||||
use syscall::io::{Mmio, Io};
|
||||
use std::result;
|
||||
@@ -301,9 +301,9 @@ impl StreamBuffer {
|
||||
};
|
||||
|
||||
let addr = match unsafe {
|
||||
syscall::physmap(phys, page_aligned_size, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
common::physmap(phys, page_aligned_size, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
} {
|
||||
Ok(addr) => addr,
|
||||
Ok(ptr) => ptr as usize,
|
||||
Err(_err) => {
|
||||
unsafe {
|
||||
syscall::physfree(phys, page_aligned_size);
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ use std::usize;
|
||||
use std::fs::File;
|
||||
use std::io::{ErrorKind, Read, Write, Result};
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use syscall::{PHYSMAP_NO_CACHE, PHYSMAP_WRITE, Packet, SchemeBlockMut, EventFlags};
|
||||
use syscall::{Packet, SchemeBlockMut, EventFlags};
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -177,8 +177,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
|
||||
log::info!(" + IHDA {} on: {:#X} size: {}", name, bar_ptr, bar_size);
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr as usize, bar_size as usize, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("ihdad: failed to map address")
|
||||
common::physmap(bar_ptr as usize, bar_size as usize, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("ihdad: failed to map address") as usize
|
||||
};
|
||||
|
||||
//TODO: MSI-X
|
||||
|
||||
@@ -8,3 +8,5 @@ netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git", branch =
|
||||
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
|
||||
redox_syscall = "0.3"
|
||||
redox-daemon = "0.1"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ use std::{env, thread};
|
||||
|
||||
use event::EventQueue;
|
||||
use std::time::Duration;
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut};
|
||||
|
||||
pub mod device;
|
||||
#[rustfmt::skip]
|
||||
@@ -92,8 +92,8 @@ fn main() {
|
||||
File::open(format!("irq:{}", irq)).expect("ixgbed: failed to open IRQ file");
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar, IXGBE_MMIO_SIZE, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("ixgbed: failed to map address")
|
||||
common::physmap(bar, IXGBE_MMIO_SIZE, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("ixgbed: failed to map address") as usize
|
||||
};
|
||||
{
|
||||
let device = Arc::new(RefCell::new(
|
||||
|
||||
@@ -12,4 +12,5 @@ redox_syscall = "0.3"
|
||||
redox-daemon = "0.1"
|
||||
redox-log = "0.1"
|
||||
|
||||
common = { path = "../common" }
|
||||
pcid = { path = "../pcid" }
|
||||
|
||||
@@ -18,7 +18,7 @@ use pcid_interface::{MsiSetFeatureInfo, PcidServerHandle, PciFeature, PciFeature
|
||||
use pcid_interface::irq_helpers::{read_bsp_apic_id, allocate_single_interrupt_vector};
|
||||
use pcid_interface::msi::{MsixCapability, MsixTableEntry};
|
||||
use redox_log::{RedoxLogger, OutputBuilder};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut};
|
||||
use syscall::io::Io;
|
||||
|
||||
pub mod device;
|
||||
@@ -187,8 +187,8 @@ fn get_int_method(pcid_handle: &mut PcidServerHandle) -> Option<File> {
|
||||
};
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr as usize, bar_size as usize, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("rtl8139d: failed to map address")
|
||||
common::physmap(bar_ptr as usize, bar_size as usize, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("rtl8139d: failed to map address") as usize
|
||||
};
|
||||
|
||||
if !(bar_ptr..bar_ptr + bar_size).contains(&(table_base as u64 + table_min_length as u64)) {
|
||||
@@ -345,8 +345,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
|
||||
log::info!(" + RTL8139 {} on: {:#X} size: {}", name, bar_ptr, bar_size);
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr, bar_size, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("rtl8139d: failed to map address")
|
||||
common::physmap(bar_ptr, bar_size, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("rtl8139d: failed to map address") as usize
|
||||
};
|
||||
|
||||
let socket_fd = syscall::open(
|
||||
|
||||
@@ -12,4 +12,5 @@ redox_syscall = "0.3"
|
||||
redox-daemon = "0.1"
|
||||
redox-log = "0.1"
|
||||
|
||||
common = { path = "../common" }
|
||||
pcid = { path = "../pcid" }
|
||||
|
||||
@@ -16,7 +16,7 @@ use pcid_interface::{MsiSetFeatureInfo, PcidServerHandle, PciFeature, PciFeature
|
||||
use pcid_interface::irq_helpers::{read_bsp_apic_id, allocate_single_interrupt_vector};
|
||||
use pcid_interface::msi::{MsixCapability, MsixTableEntry};
|
||||
use redox_log::{RedoxLogger, OutputBuilder};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::{EventFlags, Packet, SchemeBlockMut};
|
||||
use syscall::io::Io;
|
||||
|
||||
pub mod device;
|
||||
@@ -185,8 +185,8 @@ fn get_int_method(pcid_handle: &mut PcidServerHandle) -> Option<File> {
|
||||
};
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr as usize, bar_size as usize, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("rtl8168d: failed to map address")
|
||||
common::physmap(bar_ptr as usize, bar_size as usize, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("rtl8168d: failed to map address") as usize
|
||||
};
|
||||
|
||||
if !(bar_ptr..bar_ptr + bar_size).contains(&(table_base as u64 + table_min_length as u64)) {
|
||||
@@ -343,8 +343,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
|
||||
log::info!(" + RTL8168 {} on: {:#X} size: {}", name, bar_ptr, bar_size);
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr, bar_size, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("rtl8168d: failed to map address")
|
||||
common::physmap(bar_ptr, bar_size, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("rtl8168d: failed to map address") as usize
|
||||
};
|
||||
|
||||
let socket_fd = syscall::open(
|
||||
|
||||
@@ -8,3 +8,5 @@ orbclient = "0.3.27"
|
||||
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
|
||||
redox_syscall = "0.3"
|
||||
redox-daemon = "0.1"
|
||||
|
||||
common = { path = "../common" }
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ use std::fs::File;
|
||||
use std::io::{Result, Read, Write};
|
||||
|
||||
use syscall::call::iopl;
|
||||
use syscall::flag::{EventFlags, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::flag::EventFlags;
|
||||
use syscall::io::{Dma, Io, Mmio, Pio};
|
||||
|
||||
use crate::bga::Bga;
|
||||
@@ -220,7 +220,7 @@ fn main() {
|
||||
let mut irq_file = File::open(format!("irq:{}", irq)).expect("vboxd: failed to open IRQ file");
|
||||
|
||||
let mut port = Pio::<u32>::new(bar0 as u16);
|
||||
let address = unsafe { syscall::physmap(bar1, 4096, PHYSMAP_WRITE | PHYSMAP_NO_CACHE).expect("vboxd: failed to map address") };
|
||||
let address = unsafe { common::physmap(bar1, 4096, common::Prot::RW, common::MemoryType::Uncacheable).expect("vboxd: failed to map address") };
|
||||
{
|
||||
let vmmdev = unsafe { &mut *(address as *mut VboxVmmDev) };
|
||||
|
||||
|
||||
@@ -29,4 +29,5 @@ smallvec = { version = "1", features = ["serde"] }
|
||||
thiserror = "1"
|
||||
toml = "0.5"
|
||||
|
||||
common = { path = "../common" }
|
||||
pcid = { path = "../pcid" }
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ use event::{Event, EventQueue};
|
||||
use redox_log::{RedoxLogger, OutputBuilder};
|
||||
use syscall::data::Packet;
|
||||
use syscall::error::EWOULDBLOCK;
|
||||
use syscall::flag::{EventFlags, PHYSMAP_NO_CACHE, PHYSMAP_WRITE};
|
||||
use syscall::flag::EventFlags;
|
||||
use syscall::scheme::Scheme;
|
||||
use syscall::io::Io;
|
||||
|
||||
@@ -264,8 +264,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
|
||||
};
|
||||
|
||||
let address = unsafe {
|
||||
syscall::physmap(bar_ptr as usize, bar_size as usize, PHYSMAP_WRITE | PHYSMAP_NO_CACHE)
|
||||
.expect("xhcid: failed to map address")
|
||||
common::physmap(bar_ptr as usize, bar_size as usize, common::Prot::RW, common::MemoryType::Uncacheable)
|
||||
.expect("xhcid: failed to map address") as usize
|
||||
};
|
||||
|
||||
let (mut irq_file, interrupt_method) = get_int_method(&mut pcid_handle, address);
|
||||
|
||||
Reference in New Issue
Block a user