pub enum DeviceRequest {
Show 17 variants GetDeviceInfo { responder: DeviceGetDeviceInfoResponder, }, GetBar { bar_id: u32, responder: DeviceGetBarResponder, }, SetBusMastering { enabled: bool, responder: DeviceSetBusMasteringResponder, }, ResetDevice { responder: DeviceResetDeviceResponder, }, AckInterrupt { responder: DeviceAckInterruptResponder, }, MapInterrupt { which_irq: u32, responder: DeviceMapInterruptResponder, }, GetInterruptModes { responder: DeviceGetInterruptModesResponder, }, SetInterruptMode { mode: InterruptMode, requested_irq_count: u32, responder: DeviceSetInterruptModeResponder, }, ReadConfig8 { offset: u16, responder: DeviceReadConfig8Responder, }, ReadConfig16 { offset: u16, responder: DeviceReadConfig16Responder, }, ReadConfig32 { offset: u16, responder: DeviceReadConfig32Responder, }, WriteConfig8 { offset: u16, value: u8, responder: DeviceWriteConfig8Responder, }, WriteConfig16 { offset: u16, value: u16, responder: DeviceWriteConfig16Responder, }, WriteConfig32 { offset: u16, value: u32, responder: DeviceWriteConfig32Responder, }, GetCapabilities { id: CapabilityId, responder: DeviceGetCapabilitiesResponder, }, GetExtendedCapabilities { id: ExtendedCapabilityId, responder: DeviceGetExtendedCapabilitiesResponder, }, GetBti { index: u32, responder: DeviceGetBtiResponder, },
}

Variants§

§

GetDeviceInfo

Returns a structure containing device information from the configuration header.

§

GetBar

Retrieves information for a specified Base Address Register (BAR). If the BAR contains MSI-X capability tables then an attempt will be made to return an MMIO region excluding those tables, if possible. Otherwise, an error will be returned.

Parameters: |bar_id|: The id of the BAR being requested. Valid range is [0, 6).

Errors: |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method. |ZX_ERR_INTERNAL|: A bus driver error has occurred. |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range. |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.

Fields

§bar_id: u32
§

SetBusMastering

Enables or disables the bus mastering capability for the device.

Parameters: |enable|: true to enable bus mastering, false to disable.

Errors: |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.

Fields

§enabled: bool
§

ResetDevice

Initiates a function level reset for the device. This is a synchronous operation that will not return ontil the reset is complete. Interrupt operation of the device must be disabled before initiating a reset.

Errors: |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|. |ZX_ERR_NOT_SUPPORTED|: The device does not support reset. |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the expected amount of time and is presumed to no longer be operating properly.

§

AckInterrupt

Alerts the bus driver to deassert the raised legacy interrupt so that it may be waited on again. Only used if |SetInterruptMode| was called with |PCI_INTERRUPT_MODE_LEGACY|.

Errors: |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.

§

MapInterrupt

Maps a device’s interrupt to a zx:interrupt. The device’s interrupt mode must already be configured with |SetInterruptMode|, and |which_irq| must be >= to the number of interrupts reported for that interrupt mode by |GetInterruptModes|. A Legacy interrupt may be mapped multiple times, but the handles will point to the same interrupt object. MSI & MSI-X interrupts may only have one outstanding mapping at a time per interrupt. Outstanding MSI & MSI-X interrupt handles must be closed before attempting to change the interrupt mode in a subsequent call to |SetInterruptMode|.

Parameters: |which_irq|: The id of the interrupt to map.

Errors: |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is already mapped to a valid handle. |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device. |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.

Fields

§which_irq: u32
§

GetInterruptModes

Returns the supported interrupt modes for a device.

§

SetInterruptMode

Configures the interrupt mode for a device. When changing from one interrupt mode to another the driver must ensure existing interrupt handles are closed beforehand.

Parameters: |mode|: The |InterruptMode| to request from the bus driver. |requested_irq_count|: The number of interrupts requested.

Errors: |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while existing handles to mapped MSIs exist. |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0. |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.

Fields

§requested_irq_count: u32
§

ReadConfig8

Reads a byte from the device’s configuration space. |Offset| must be within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a device will be PCIe.

Parameters: |offset|: The offset into the device’s configuration space to read.

Errors: |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§

ReadConfig16

Reads two bytes from the device’s configuration space. |Offset| must be within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a device will be PCIe.

Parameters: |offset|: The offset into the device’s configuration space to read.

Errors: |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§

ReadConfig32

Reads four bytes from the device’s configuration space. |Offset| must be within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a device will be PCIe.

Parameters: |offset|: The offset into the device’s configuration space to read.

Errors: |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§

WriteConfig8

Writes a byte to the device’s configuration space. The acceptable ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40, 0xFFF] if PCIe. For most purposes a device will be PCIe.

Parameters |offset|: The offset into the device’s configuration space to read. |value|: The value to write.

Errors: |ZX_ERR_ACCESS_DENIED|: |offset| is within the device’s configuration header. |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§value: u8
§

WriteConfig16

Writes two bytes to the device’s configuration space. The acceptable ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40, 0xFFE] if PCIe. For most purposes a device will be PCIe.

Parameters |offset|: The offset into the device’s configuration space to read. |value|: The value to write.

Errors: |ZX_ERR_ACCESS_DENIED|: |offset| is within the device’s configuration header. |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§value: u16
§

WriteConfig32

Writes four bytes to the device’s configuration space. The acceptable ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40, 0xFFC] if PCIe. For most purposes a device will be PCIe.

Parameters |offset|: The offset into the device’s configuration space to read. |value|: The value to write.

Errors: |ZX_ERR_ACCESS_DENIED|: |offset| is within the device’s configuration header. |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.

Fields

§offset: u16
§value: u32
§

GetCapabilities

Returns a vector of offsets in configuration space corresponding to capabilities matching the provided capability |id|. If no corresponding match is found then the vector will be empty.

Parameters: |id|: the capability id to search for.

§

GetExtendedCapabilities

Returns a vector of offsets in configuration space corresponding to extended capabilities matching the provided extended capability |id|. If no corresponding match is found then the vector will be empty.

Parameters: |id|: the capability id to search for

§

GetBti

Returns the Bus Transaction Intiator (BTI) at a given index for the device.

Parameters: |index|: the BTI to request.

Errors: |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.

Fields

§index: u32

Implementations§

source§

impl DeviceRequest

source

pub fn into_get_device_info(self) -> Option<DeviceGetDeviceInfoResponder>

source

pub fn into_get_bar(self) -> Option<(u32, DeviceGetBarResponder)>

source

pub fn into_set_bus_mastering( self ) -> Option<(bool, DeviceSetBusMasteringResponder)>

source

pub fn into_reset_device(self) -> Option<DeviceResetDeviceResponder>

source

pub fn into_ack_interrupt(self) -> Option<DeviceAckInterruptResponder>

source

pub fn into_map_interrupt(self) -> Option<(u32, DeviceMapInterruptResponder)>

source

pub fn into_get_interrupt_modes( self ) -> Option<DeviceGetInterruptModesResponder>

source

pub fn into_set_interrupt_mode( self ) -> Option<(InterruptMode, u32, DeviceSetInterruptModeResponder)>

source

pub fn into_read_config8(self) -> Option<(u16, DeviceReadConfig8Responder)>

source

pub fn into_read_config16(self) -> Option<(u16, DeviceReadConfig16Responder)>

source

pub fn into_read_config32(self) -> Option<(u16, DeviceReadConfig32Responder)>

source

pub fn into_write_config8( self ) -> Option<(u16, u8, DeviceWriteConfig8Responder)>

source

pub fn into_write_config16( self ) -> Option<(u16, u16, DeviceWriteConfig16Responder)>

source

pub fn into_write_config32( self ) -> Option<(u16, u32, DeviceWriteConfig32Responder)>

source

pub fn into_get_capabilities( self ) -> Option<(CapabilityId, DeviceGetCapabilitiesResponder)>

source

pub fn into_get_extended_capabilities( self ) -> Option<(ExtendedCapabilityId, DeviceGetExtendedCapabilitiesResponder)>

source

pub fn into_get_bti(self) -> Option<(u32, DeviceGetBtiResponder)>

source

pub fn method_name(&self) -> &'static str

Name of the method defined in FIDL

Trait Implementations§

source§

impl Debug for DeviceRequest

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
§

impl<T> Encode<Ambiguous1> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T> Encode<Ambiguous2> for T

§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more