[][src]Struct sunrise_ahci::disk::Disk

pub struct Disk {
    pub(super) px: &'static mut Px,
    pub(super) rfis: ZeroBox<ReceivedFis>,
    pub(super) cmd_list: ZeroBox<CmdHeaderArray>,
    pub(super) cmd_tables: [Option<ZeroBox<CmdTable>>; 32],
    pub(super) sectors: u64,
    pub(super) supports_48_bit: bool,
}

An AHCI Disk

Manages an AHCI port, and provides functions to read and write sectors.

Memory

A disk is responsible for all allocated memory in use by the port. When dropped, the port is put to a stop, pointers to these regions are cleared from the hardware, and the regions are eventually de-allocated.

Lifetime

A Disk holds a reference to its Port Control Registers, which is located in the root HBA Memory Registers mapping (the one found at BAR5).

As this root mapping will never be unmapped, the lifetime of this reference is 'static.

Fields

px: &'static mut Px

Pointer back to the corresponding Port Control Registers, found at BAR5[100h]-BAR5[10FFh].

rfis: ZeroBox<ReceivedFis>

The allocated Received FIS memory zone that the port uses.

cmd_list: ZeroBox<CmdHeaderArray>

The allocated Command List memory zone that the port uses.

cmd_tables: [Option<ZeroBox<CmdTable>>; 32]

An allocated Command Table for each implemented Command List slot.

sectors: u64

Number of addressable sectors of this disk. Each sector is 512 octets.

supports_48_bit: bool

Indicates if the device supports 48 bit addresses.

Implementations

impl Disk[src]

fn sector_count(&self) -> Result<u64, Error>[src]

Returns the number of addressable 512-octet sectors for this disk.

fn read_dma(
    &mut self,
    buffer: *mut u8,
    buffer_len: usize,
    lba: u64,
    sector_count: u64
) -> Result<(), Error>
[src]

Reads sectors from disk.

Reads sector_count sectors starting from lba.

fn write_dma(
    &mut self,
    buffer: *const u8,
    buffer_len: usize,
    lba: u64,
    sector_count: u64
) -> Result<(), Error>
[src]

Writes sectors to disk.

Writes sector_count sectors starting from lba.

Trait Implementations

impl Debug for Disk[src]

impl Drop for Disk[src]

fn drop(&mut self)[src]

Dropping a disk brings the port to a stop, and clears the pointers from the hardware.

Auto Trait Implementations

impl RefUnwindSafe for Disk

impl Send for Disk

impl Sync for Disk

impl Unpin for Disk

impl !UnwindSafe for Disk

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SizedIPCBuffer for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.