PciConfig

Struct PciConfig 

Source
pub struct PciConfig {
    ecam_base: usize,
}
Expand description

PCI configuration space accessor

Provides safe access to PCI configuration space through ECAM mapping.

Fields§

§ecam_base: usize

Base address of ECAM region

Implementations§

Source§

impl PciConfig

Source

pub const fn new(ecam_base: usize) -> Self

Create a new PCI configuration accessor

§Arguments
  • ecam_base - Physical base address of the ECAM region
§Safety

The caller must ensure that the ECAM base address is valid and mapped.

Source

fn config_address(&self, addr: &PciAddress, offset: usize) -> usize

Calculate the physical address for a configuration register

Source

pub fn read_u32(&self, addr: &PciAddress, offset: usize) -> u32

Read a 32-bit value from PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space (must be 4-byte aligned)
§Returns

The 32-bit value read from configuration space

§Safety

This performs a volatile MMIO read. The caller must ensure the address is valid.

Source

pub fn write_u32(&self, addr: &PciAddress, offset: usize, value: u32)

Write a 32-bit value to PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space (must be 4-byte aligned)
  • value - Value to write
§Safety

This performs a volatile MMIO write. The caller must ensure the address is valid.

Source

pub fn read_u16(&self, addr: &PciAddress, offset: usize) -> u16

Read a 16-bit value from PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space (must be 2-byte aligned)
§Returns

The 16-bit value read from configuration space

Source

pub fn write_u16(&self, addr: &PciAddress, offset: usize, value: u16)

Write a 16-bit value to PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space (must be 2-byte aligned)
  • value - Value to write
Source

pub fn read_u8(&self, addr: &PciAddress, offset: usize) -> u8

Read an 8-bit value from PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space
§Returns

The 8-bit value read from configuration space

Source

pub fn write_u8(&self, addr: &PciAddress, offset: usize, value: u8)

Write an 8-bit value to PCI configuration space

§Arguments
  • addr - PCI device address
  • offset - Offset within configuration space
  • value - Value to write
Source

pub fn read_vendor_id(&self, addr: &PciAddress) -> u16

Read vendor ID

Source

pub fn read_device_id(&self, addr: &PciAddress) -> u16

Read device ID

Source

pub fn read_class_code(&self, addr: &PciAddress) -> u32

Read class code (24-bit: base class, sub class, interface)

Source

pub fn read_header_type(&self, addr: &PciAddress) -> u8

Read header type

Auto Trait Implementations§

§

impl Freeze for PciConfig

§

impl RefUnwindSafe for PciConfig

§

impl Send for PciConfig

§

impl Sync for PciConfig

§

impl Unpin for PciConfig

§

impl UnwindSafe for PciConfig

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.