Move Io/Pio/Mmio from redox_syscall to common

* Fix Mmio repr from transparent to packed.
* Rename Mmio::from to Mmio::new.
* Remove dead imports around affected code.
* Minor formatting.
This commit is contained in:
Kamil Koczurek
2024-09-27 23:31:03 +02:00
parent ea5ccbc84d
commit d2c82add9d
50 changed files with 421 additions and 59 deletions
Generated
+4
View File
@@ -165,6 +165,8 @@ dependencies = [
"fdt 0.1.5",
"libredox 0.1.3",
"redox-daemon",
"redox-scheme",
"redox_event",
"redox_syscall 0.5.3",
]
@@ -172,6 +174,7 @@ dependencies = [
name = "bgad"
version = "0.1.0"
dependencies = [
"common",
"libredox 0.1.3",
"orbclient",
"pcid",
@@ -955,6 +958,7 @@ dependencies = [
name = "pcspkrd"
version = "0.1.0"
dependencies = [
"common",
"libredox 0.1.3",
"redox-daemon",
"redox_syscall 0.5.3",
+1 -1
View File
@@ -34,7 +34,7 @@ members = [
"storage/bcm2835-sdhcid",
"storage/driver-block",
"storage/ided",
"storage/lived", # TODO: not really a driver...
"storage/lived", # TODO: not really a driver...
"storage/nvmed",
"storage/usbscsid",
"storage/virtio-blkd",
+1 -1
View File
@@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
use std::{fmt, mem};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use syscall::io::{Io, Pio};
use common::io::{Io, Pio};
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use thiserror::Error;
+1 -1
View File
@@ -1,6 +1,6 @@
use std::ops::{Deref, DerefMut};
use syscall::io::Mmio;
use common::io::Mmio;
// TODO: Only wrap with Mmio where there are hardware-registers. (Some of these structs seem to be
// ring buffer entries, which are not to be treated the same way).
+1 -1
View File
@@ -10,7 +10,7 @@ use std::convert::TryFrom;
use std::ops::Deref;
use std::{fmt, mem};
use syscall::io::Io as _;
use common::io::Io as _;
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
+2 -1
View File
@@ -3,7 +3,8 @@ use rustc_hash::FxHashMap;
use std::fmt::LowerHex;
use std::mem::size_of;
use std::sync::{Arc, Mutex};
use syscall::{Io, Pio, PAGE_SIZE};
use syscall::PAGE_SIZE;
use common::io::{Io, Pio};
const PAGE_MASK: usize = !(PAGE_SIZE - 1);
const OFFSET_MASK: usize = PAGE_SIZE - 1;
+2 -2
View File
@@ -5,10 +5,10 @@ use std::collections::BTreeMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use syscall::error::{Error, EACCES, EBADF, Result, EINVAL, ENOENT};
use syscall::io::{Mmio, Pio, Io};
use common::io::Pio;
use syscall::scheme::SchemeBlockMut;
use common::dma::Dma;
use common::{dma::Dma, io::{Io, Mmio}};
use spin::Mutex;
const NUM_SUB_BUFFS: usize = 32;
+1 -1
View File
@@ -1,5 +1,5 @@
use common::dma::Dma;
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use super::common::*;
+1 -1
View File
@@ -8,9 +8,9 @@ use std::collections::BTreeMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use common::dma::Dma;
use common::io::{Mmio, Io};
use syscall::error::{Error, EACCES, EBADF, Result, EINVAL};
use syscall::flag::{SEEK_SET, SEEK_CUR, SEEK_END};
use syscall::io::{Mmio, Io};
use syscall::scheme::SchemeBlockMut;
use spin::Mutex;
+1 -1
View File
@@ -1,7 +1,7 @@
use common::dma::Dma;
use common::io::{Mmio, Io};
use syscall::PAGE_SIZE;
use syscall::error::{Error, EIO, Result};
use syscall::io::{Mmio, Io};
use std::result;
use std::cmp::min;
use std::ptr::copy_nonoverlapping;
+1
View File
@@ -5,6 +5,7 @@ authors = ["Tibor Nagy <xnagytibor@gmail.com>"]
edition = "2018"
[dependencies]
common = { path = "../../common" }
redox_syscall = "0.5"
redox-daemon = "0.1"
libredox = "0.1.3"
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Pio};
use common::io::{Io, Pio};
pub struct Pcspkr {
command: Pio<u8>,
+2 -1
View File
@@ -4,8 +4,9 @@ use std::{thread, time};
use std::collections::BTreeMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use common::io::{Pio, Io, ReadOnly, WriteOnly};
use syscall::error::{Error, EACCES, EBADF, Result, ENODEV};
use syscall::io::{Pio, Io, ReadOnly, WriteOnly};
use syscall::scheme::SchemeBlockMut;
use spin::Mutex;
+95
View File
@@ -0,0 +1,95 @@
use core::{
cmp::PartialEq,
ops::{BitAnd, BitOr, Not},
};
mod mmio;
mod pio;
pub use mmio::*;
pub use pio::*;
/// IO abstraction
pub trait Io {
/// Value type for IO, usually some unsigned number
type Value: Copy
+ PartialEq
+ BitAnd<Output = Self::Value>
+ BitOr<Output = Self::Value>
+ Not<Output = Self::Value>;
/// Read the underlying valu2e
fn read(&self) -> Self::Value;
/// Write the underlying value
fn write(&mut self, value: Self::Value);
/// Check whether the underlying value contains bit flags
#[inline(always)]
fn readf(&self, flags: Self::Value) -> bool {
(self.read() & flags) as Self::Value == flags
}
/// Enable or disable specific bit flags
#[inline(always)]
fn writef(&mut self, flags: Self::Value, value: bool) {
let tmp: Self::Value = match value {
true => self.read() | flags,
false => self.read() & !flags,
};
self.write(tmp);
}
}
/// Read-only IO
#[repr(transparent)]
pub struct ReadOnly<I> {
inner: I,
}
impl<I: Io> ReadOnly<I> {
/// Wraps IO
pub const fn new(inner: I) -> ReadOnly<I> {
ReadOnly { inner }
}
}
impl<I: Io> ReadOnly<I> {
/// Calls [Io::read]
#[inline(always)]
pub fn read(&self) -> I::Value {
self.inner.read()
}
/// Calls [Io::readf]
#[inline(always)]
pub fn readf(&self, flags: I::Value) -> bool {
self.inner.readf(flags)
}
}
#[repr(transparent)]
/// Write-only IO
pub struct WriteOnly<I> {
inner: I,
}
impl<I: Io> WriteOnly<I> {
/// Wraps IO
pub const fn new(inner: I) -> WriteOnly<I> {
WriteOnly { inner }
}
}
impl<I: Io> WriteOnly<I> {
/// Calls [Io::write]
#[inline(always)]
pub fn write(&mut self, value: I::Value) {
self.inner.write(value)
}
#[inline(always)]
/// Calls [Io::writef]
pub fn writef(&mut self, flags: I::Value, value: bool) {
self.inner.writef(flags, value)
}
}
+169
View File
@@ -0,0 +1,169 @@
use core::{mem::MaybeUninit, ptr};
use super::Io;
/// MMIO abstraction
#[repr(packed)]
pub struct Mmio<T> {
value: MaybeUninit<T>,
}
impl<T> Mmio<T> {
/// Creates a zeroed instance
pub unsafe fn zeroed() -> Self {
Self {
value: MaybeUninit::zeroed(),
}
}
/// Creates an unitialized instance
pub unsafe fn uninit() -> Self {
Self {
value: MaybeUninit::uninit(),
}
}
/// Creates a new instance
pub const fn new(value: T) -> Self {
Self {
value: MaybeUninit::new(value),
}
}
}
// Generic implementation (WARNING: requires aligned pointers!)
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
impl<T> Io for Mmio<T>
where
T: Copy + PartialEq + BitAnd<Output = T> + BitOr<Output = T> + Not<Output = T>,
{
type Value = T;
fn read(&self) -> T {
unsafe { ptr::read_volatile(ptr::addr_of!(self.value).cast::<T>()) }
}
fn write(&mut self, value: T) {
unsafe { ptr::write_volatile(ptr::addr_of_mut!(self.value).cast::<T>(), value) };
}
}
// x86 u8 implementation
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
impl Io for Mmio<u8> {
type Value = u8;
fn read(&self) -> Self::Value {
unsafe {
let value: Self::Value;
let ptr: *const Self::Value = ptr::addr_of!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov {}, [{}]",
out(reg_byte) value,
in(reg) ptr
);
value
}
}
fn write(&mut self, value: Self::Value) {
unsafe {
let ptr: *mut Self::Value = ptr::addr_of_mut!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov [{}], {}",
in(reg) ptr,
in(reg_byte) value,
);
}
}
}
// x86 u16 implementation
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
impl Io for Mmio<u16> {
type Value = u16;
fn read(&self) -> Self::Value {
unsafe {
let value: Self::Value;
let ptr: *const Self::Value = ptr::addr_of!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov {:x}, [{}]",
out(reg) value,
in(reg) ptr
);
value
}
}
fn write(&mut self, value: Self::Value) {
unsafe {
let ptr: *mut Self::Value = ptr::addr_of_mut!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov [{}], {:x}",
in(reg) ptr,
in(reg) value,
);
}
}
}
// x86 u32 implementation
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
impl Io for Mmio<u32> {
type Value = u32;
fn read(&self) -> Self::Value {
unsafe {
let value: Self::Value;
let ptr: *const Self::Value = ptr::addr_of!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov {:e}, [{}]",
out(reg) value,
in(reg) ptr
);
value
}
}
fn write(&mut self, value: Self::Value) {
unsafe {
let ptr: *mut Self::Value = ptr::addr_of_mut!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov [{}], {:e}",
in(reg) ptr,
in(reg) value,
);
}
}
}
// x86 u64 implementation (x86_64 only)
#[cfg(target_arch = "x86_64")]
impl Io for Mmio<u64> {
type Value = u64;
fn read(&self) -> Self::Value {
unsafe {
let value: Self::Value;
let ptr: *const Self::Value = ptr::addr_of!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov {:r}, [{}]",
out(reg) value,
in(reg) ptr
);
value
}
}
fn write(&mut self, value: Self::Value) {
unsafe {
let ptr: *mut Self::Value = ptr::addr_of_mut!(self.value).cast::<Self::Value>();
core::arch::asm!(
"mov [{}], {:r}",
in(reg) ptr,
in(reg) value,
);
}
}
}
+89
View File
@@ -0,0 +1,89 @@
use core::{arch::asm, marker::PhantomData};
use super::Io;
/// Generic PIO
#[derive(Copy, Clone)]
pub struct Pio<T> {
port: u16,
value: PhantomData<T>,
}
impl<T> Pio<T> {
/// Create a PIO from a given port
pub const fn new(port: u16) -> Self {
Pio::<T> {
port,
value: PhantomData,
}
}
}
/// Read/Write for byte PIO
impl Io for Pio<u8> {
type Value = u8;
/// Read
#[inline(always)]
fn read(&self) -> u8 {
let value: u8;
unsafe {
asm!("in al, dx", in("dx") self.port, out("al") value, options(nostack, nomem, preserves_flags));
}
value
}
/// Write
#[inline(always)]
fn write(&mut self, value: u8) {
unsafe {
asm!("out dx, al", in("dx") self.port, in("al") value, options(nostack, nomem, preserves_flags));
}
}
}
/// Read/Write for word PIO
impl Io for Pio<u16> {
type Value = u16;
/// Read
#[inline(always)]
fn read(&self) -> u16 {
let value: u16;
unsafe {
asm!("in ax, dx", in("dx") self.port, out("ax") value, options(nostack, nomem, preserves_flags));
}
value
}
/// Write
#[inline(always)]
fn write(&mut self, value: u16) {
unsafe {
asm!("out dx, ax", in("dx") self.port, in("ax") value, options(nostack, nomem, preserves_flags));
}
}
}
/// Read/Write for doubleword PIO
impl Io for Pio<u32> {
type Value = u32;
/// Read
#[inline(always)]
fn read(&self) -> u32 {
let value: u32;
unsafe {
asm!("in eax, dx", in("dx") self.port, out("eax") value, options(nostack, nomem, preserves_flags));
}
value
}
/// Write
#[inline(always)]
fn write(&mut self, value: u32) {
unsafe {
asm!("out dx, eax", in("dx") self.port, in("eax") value, options(nostack, nomem, preserves_flags));
}
}
}
+3 -1
View File
@@ -12,6 +12,8 @@ use syscall::PAGE_SIZE;
/// The Direct Memory Access (DMA) API for drivers
pub mod dma;
/// MMIO utilities
pub mod io;
mod logger;
/// The Scatter Gather List (SGL) API for drivers.
pub mod sgl;
@@ -128,7 +130,7 @@ pub unsafe fn physmap(
// TODO: arraystring?
//Return an error rather than potentially crash the kernel.
if(base_phys == 0) {
if base_phys == 0 {
return Err(Error::new(EINVAL));
}
+1
View File
@@ -8,5 +8,6 @@ orbclient = "0.3.47"
redox-daemon = "0.1"
redox_syscall = "0.5"
common = { path = "../../common" }
pcid = { path = "../../pcid" }
libredox = "0.1.3"
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Pio};
use common::io::{Io, Pio};
const BGA_INDEX_XRES: u16 = 1;
const BGA_INDEX_YRES: u16 = 2;
+1 -1
View File
@@ -3,7 +3,7 @@ use std::convert::TryInto;
use syscall::error::{Error, EACCES, EINVAL, EIO, EWOULDBLOCK, Result};
use syscall::flag::{EventFlags, O_NONBLOCK};
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use syscall::scheme;
use common::dma::Dma;
+1 -1
View File
@@ -3,8 +3,8 @@ use std::convert::TryInto;
use driver_network::NetworkAdapter;
use syscall::error::{Error, EIO, EMSGSIZE, Result};
use syscall::io::{Mmio, Io, ReadOnly};
use common::io::{Mmio, Io, ReadOnly};
use common::dma::Dma;
const RX_BUFFER_SIZE: usize = 64 * 1024;
+1 -1
View File
@@ -3,7 +3,7 @@ use std::convert::TryInto;
use driver_network::NetworkAdapter;
use syscall::error::{Error, Result, EMSGSIZE};
use syscall::io::{Mmio, Io, ReadOnly};
use common::io::{Mmio, Io, ReadOnly};
use common::dma::Dma;
+1 -1
View File
@@ -3,7 +3,7 @@ use std::convert::TryFrom;
use std::sync::Mutex;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
use syscall::io::{Io as _, Pio};
use common::io::{Io as _, Pio};
use log::info;
use pci_types::{ConfigRegionAccess, PciAddress};
+1 -1
View File
@@ -3,7 +3,7 @@ use std::fmt;
use crate::driver_interface::PciBar;
use serde::{Deserialize, Serialize};
use syscall::{Io, Mmio};
use common::io::{Io, Mmio};
/// The address and data to use for MSI and MSI-X.
///
+1 -1
View File
@@ -1,5 +1,5 @@
use log::{debug, error, info, trace};
use syscall::io::{Io, Pio, ReadOnly, WriteOnly};
use common::io::{Io, Pio, ReadOnly, WriteOnly};
use std::fmt;
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::Mmio;
use common::io::Mmio;
#[repr(u8)]
pub enum FisType {
+1 -1
View File
@@ -3,7 +3,7 @@ use std::mem::size_of;
use std::ops::DerefMut;
use std::{ptr, u32};
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use syscall::error::{Error, Result, EIO};
use super::fis::{FisType, FisRegH2D};
+1 -1
View File
@@ -1,6 +1,6 @@
use driver_block::Disk;
use log::{error, info};
use syscall::io::Io;
use common::io::Io;
use self::disk_ata::DiskATA;
use self::disk_atapi::DiskATAPI;
+2 -1
View File
@@ -5,9 +5,10 @@ use std::fmt::Write;
use driver_block::{Disk, DiskWrapper};
use syscall::schemev2::NewFdFlags;
use syscall::{
Error, EACCES, EBADF, EINVAL, EISDIR, ENOENT, ENOLCK, EOVERFLOW, Result, Io, Stat, MODE_DIR,
Error, EACCES, EBADF, EINVAL, EISDIR, ENOENT, ENOLCK, EOVERFLOW, Result, Stat, MODE_DIR,
MODE_FILE, O_DIRECTORY, O_STAT,
};
use common::io::Io as _;
use redox_scheme::{CallerCtx, OpenResult, SchemeBlockMut};
use crate::ahci::hba::HbaMem;
+3 -2
View File
@@ -1,6 +1,7 @@
use std::{sync::{Mutex, RwLock}, time::{self, Duration}, thread};
use syscall::{io::Mmio, Io, Error, Result, EINVAL};
use common::io::{Io, Mmio};
use driver_block::Disk;
use std::{sync::RwLock, thread, time::Duration};
use syscall::{Error, Result, EINVAL};
#[cfg(target_arch = "aarch64")]
#[inline(always)]
+2 -4
View File
@@ -6,12 +6,10 @@ use std::{
};
use driver_block::Disk;
use syscall::{
error::{Error, Result, EIO},
io::{Io, Pio, ReadOnly, WriteOnly},
};
use syscall::error::{Error, Result, EIO};
use common::dma::Dma;
use common::io::{Io, Pio, ReadOnly, WriteOnly};
static TIMEOUT: Duration = Duration::new(1, 0);
+2 -1
View File
@@ -12,8 +12,9 @@ use std::{
thread::{self, sleep},
time::Duration,
};
use common::io::Io as _;
use syscall::{
data::{Event, Packet}, error::{Error, ENODEV}, flag::EVENT_READ, io::Io, scheme::SchemeBlockMut, EAGAIN, EINTR, EWOULDBLOCK
data::{Event, Packet}, error::{Error, ENODEV}, flag::EVENT_READ, scheme::SchemeBlockMut, EAGAIN, EINTR, EWOULDBLOCK
};
use crate::{
+1 -1
View File
@@ -13,7 +13,7 @@ use libredox::flag;
use pcid_interface::{PciFeature, PciFeatureInfo, PciFunction, PciFunctionHandle};
use redox_scheme::{CallRequest, RequestKind, SignalBehavior, Socket, V2};
use syscall::{
Event, Mmio, Packet, Result, SchemeBlockMut,
Event, Packet, Result, SchemeBlockMut,
PAGE_SIZE,
};
+1 -1
View File
@@ -10,7 +10,7 @@ use crossbeam_channel::Sender;
use smallvec::{smallvec, SmallVec};
use syscall::error::{Error, Result, EINVAL, EIO};
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use common::dma::Dma;
+1 -1
View File
@@ -8,7 +8,7 @@ use std::{cmp, str};
use syscall::schemev2::NewFdFlags;
use syscall::{
Error, Io, Result, Stat, EACCES, EBADF, EINVAL, EISDIR, ENOENT, ENOLCK, EOVERFLOW, MODE_DIR,
Error, Result, Stat, EACCES, EBADF, EINVAL, EISDIR, ENOENT, ENOLCK, EOVERFLOW, MODE_DIR,
MODE_FILE, O_DIRECTORY, O_STAT, SEEK_CUR, SEEK_END, SEEK_SET,
};
use redox_scheme::{CallerCtx, OpenResult, SchemeBlockMut};
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Pio};
use common::io::{Io, Pio};
const BGA_INDEX_XRES: u16 = 1;
const BGA_INDEX_YRES: u16 = 2;
+1 -1
View File
@@ -8,7 +8,7 @@ use std::io::{Result, Read, Write};
use pcid_interface::{PciBar, PciFunctionHandle};
use syscall::flag::EventFlags;
use syscall::io::{Io, Mmio, Pio};
use common::io::{Io, Mmio, Pio};
use common::dma::Dma;
+1 -1
View File
@@ -49,7 +49,7 @@ use event::{Event, RawEventQueue};
use syscall::data::Packet;
use syscall::error::EWOULDBLOCK;
use syscall::flag::EventFlags;
use syscall::io::Io;
use common::io::Io;
use syscall::scheme::Scheme;
use crate::xhci::{InterruptMethod, Xhci};
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
/// Represents the memory-mapped Capability Registers of the XHCI
///
+1 -1
View File
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
use log::debug;
use syscall::error::Result;
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use syscall::PAGE_SIZE;
use common::dma::Dma;
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
#[repr(packed)]
pub struct Doorbell(Mmio<u32>);
+1 -1
View File
@@ -1,5 +1,5 @@
use syscall::error::Result;
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use common::dma::Dma;
+2 -2
View File
@@ -1,7 +1,7 @@
use std::ops::Range;
use std::ptr::NonNull;
use std::{fmt, mem, ptr, slice};
use syscall::{Io, Mmio};
use common::io::{Io, Mmio};
pub struct ExtendedCapabilitiesIter {
base: *const u8,
@@ -111,7 +111,7 @@ pub enum Lp {
impl ProtocolSpeed {
pub const fn from_raw(raw: u32) -> Self {
Self { a: Mmio::from(raw) }
Self { a: Mmio::new(raw) }
}
pub fn is_lowspeed(&self) -> bool {
self.psim() == 1500 && self.psie() == Psie::Kbps && !self.pfd()
+4 -6
View File
@@ -1,20 +1,16 @@
use std::collections::BTreeMap;
use std::fs::File;
use std::future::Future;
use std::io::prelude::*;
use std::pin::Pin;
use std::sync::atomic::{self, AtomicUsize};
use std::sync::{Arc, Mutex};
use std::{io, mem, task, thread};
use std::task;
use std::os::unix::io::AsRawFd;
use crossbeam_channel::{Receiver, Sender};
use futures::Stream;
use log::{debug, error, info, trace, warn};
use syscall::Io;
use event::{Event, EventQueue, RawEventQueue};
use event::RawEventQueue;
use super::doorbell::Doorbell;
use super::event::EventRing;
@@ -22,6 +18,8 @@ use super::ring::Ring;
use super::trb::{Trb, TrbCompletionCode, TrbType};
use super::Xhci;
use common::io::Io as _;
/// Short-term states (as in, they are removed when the waker is consumed, but probably pushed back
/// by the future unless it completed).
#[derive(Debug)]
+1 -1
View File
@@ -21,7 +21,7 @@ use std::sync::{Arc, Mutex, MutexGuard, Weak};
use std::{mem, process, slice, sync::atomic, task, thread};
use syscall::error::{Error, Result, EBADF, EBADMSG, EIO, ENOENT};
use syscall::io::Io;
use common::io::Io;
use syscall::PAGE_SIZE;
use chashmap::CHashMap;
+1 -1
View File
@@ -1,6 +1,6 @@
use std::num::NonZeroU8;
use std::slice;
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use super::CapabilityRegs;
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
bitflags! {
pub struct PortFlags: u32 {
+1 -1
View File
@@ -1,4 +1,4 @@
use syscall::io::Mmio;
use common::io::Mmio;
#[repr(packed)]
pub struct Interrupter {
+1 -1
View File
@@ -28,7 +28,7 @@ use log::{debug, error, info, trace, warn};
use serde::{Deserialize, Serialize};
use smallvec::{smallvec, SmallVec};
use syscall::io::Io;
use common::io::Io;
use syscall::scheme::Scheme;
use syscall::{
Error, Result, Stat, EACCES, EBADF, EBADFD, EBADMSG, EEXIST, EINVAL, EIO, EISDIR, ENOENT,
+5 -5
View File
@@ -1,6 +1,6 @@
use crate::usb;
use std::{fmt, mem};
use syscall::io::{Io, Mmio};
use common::io::{Io, Mmio};
use super::context::StreamContextType;
@@ -118,10 +118,10 @@ pub struct Trb {
impl Clone for Trb {
fn clone(&self) -> Self {
Self {
data_low: Mmio::from(self.data_low.read()),
data_high: Mmio::from(self.data_high.read()),
status: Mmio::from(self.status.read()),
control: Mmio::from(self.control.read()),
data_low: Mmio::new(self.data_low.read()),
data_high: Mmio::new(self.data_high.read()),
status: Mmio::new(self.status.read()),
control: Mmio::new(self.control.read()),
}
}
}