Skip to main content

ConfigSpace

Struct ConfigSpace 

Source
pub struct ConfigSpace<'a, S: ConfigSpaceKind = Extended> { /* private fields */ }
Expand description

The PCI configuration space of a device.

Provides typed read and write accessors for configuration registers using the standard pci_read_config_* and pci_write_config_* helpers.

The generic parameter S indicates the maximum size of the configuration space. Use Normal for 256-byte legacy configuration space or Extended for 4096-byte PCIe extended configuration space (default).

Trait Implementations§

Source§

impl<'a, S: ConfigSpaceKind> Io for ConfigSpace<'a, S>

Source§

fn addr(&self) -> usize

Returns the base address of the I/O region. It is always 0 for configuration space.

Source§

fn maxsize(&self) -> usize

Returns the maximum size of the configuration space.

Source§

fn read8(&self, offset: usize) -> u8

Read IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn read16(&self, offset: usize) -> u16

Read IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn read32(&self, offset: usize) -> u32

Read IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn write8(&self, value: u8, offset: usize)

Write IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn write16(&self, value: u16, offset: usize)

Write IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn write32(&self, value: u32, offset: usize)

Write IO data from a given offset known at compile time.

Bound checks are performed on compile time, hence if the offset is not known at compile time, the build will fail.

Source§

fn io_addr<U>(&self, offset: usize) -> Result<usize>

Returns the absolute I/O address for a given offset, performing runtime bound checks.
Source§

fn try_read8(&self, _offset: usize) -> Result<u8>
where Self: IoCapable<u8>,

Fallible 8-bit read with runtime bounds check.
Source§

fn try_read16(&self, _offset: usize) -> Result<u16>
where Self: IoCapable<u16>,

Fallible 16-bit read with runtime bounds check.
Source§

fn try_read32(&self, _offset: usize) -> Result<u32>
where Self: IoCapable<u32>,

Fallible 32-bit read with runtime bounds check.
Source§

fn try_write8(&self, _value: u8, _offset: usize) -> Result
where Self: IoCapable<u8>,

Fallible 8-bit write with runtime bounds check.
Source§

fn try_write16(&self, _value: u16, _offset: usize) -> Result
where Self: IoCapable<u16>,

Fallible 16-bit write with runtime bounds check.
Source§

fn try_write32(&self, _value: u32, _offset: usize) -> Result
where Self: IoCapable<u32>,

Fallible 32-bit write with runtime bounds check.
Source§

impl<'a, S: ConfigSpaceKind> IoKnownSize for ConfigSpace<'a, S>

Source§

const MIN_SIZE: usize = S::SIZE

Minimum usable size of this region.
Source§

fn io_addr_assert<U>(&self, offset: usize) -> usize

Returns the absolute I/O address for a given offset, performing compile-time bound checks.
Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u16> for ConfigSpace<'a, S>

Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u32> for ConfigSpace<'a, S>

Source§

impl<'a, S: ConfigSpaceKind> IoCapable<u8> for ConfigSpace<'a, S>

Auto Trait Implementations§

§

impl<'a, S> Freeze for ConfigSpace<'a, S>

§

impl<'a, S = Extended> !RefUnwindSafe for ConfigSpace<'a, S>

§

impl<'a, S = Extended> !Send for ConfigSpace<'a, S>

§

impl<'a, S = Extended> !Sync for ConfigSpace<'a, S>

§

impl<'a, S> Unpin for ConfigSpace<'a, S>
where S: Unpin,

§

impl<'a, S = Extended> !UnwindSafe for ConfigSpace<'a, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U, const N: u32> TryIntoBounded<T, N> for U
where T: Integer, U: TryInto<T>,

Source§

fn try_into_bounded(self) -> Option<Bounded<T, N>>

Attempts to convert self into a Bounded using N bits. Read more