pub trait DeviceServerHandler<___T: Transport = Channel> {
Show 17 methods
// Required methods
fn get_device_info(
&mut self,
responder: Responder<GetDeviceInfo, ___T>,
) -> impl Future<Output = ()> + Send;
fn get_bar(
&mut self,
request: Request<GetBar, ___T>,
responder: Responder<GetBar, ___T>,
) -> impl Future<Output = ()> + Send;
fn set_bus_mastering(
&mut self,
request: Request<SetBusMastering, ___T>,
responder: Responder<SetBusMastering, ___T>,
) -> impl Future<Output = ()> + Send;
fn reset_device(
&mut self,
responder: Responder<ResetDevice, ___T>,
) -> impl Future<Output = ()> + Send;
fn ack_interrupt(
&mut self,
responder: Responder<AckInterrupt, ___T>,
) -> impl Future<Output = ()> + Send;
fn map_interrupt(
&mut self,
request: Request<MapInterrupt, ___T>,
responder: Responder<MapInterrupt, ___T>,
) -> impl Future<Output = ()> + Send;
fn get_interrupt_modes(
&mut self,
responder: Responder<GetInterruptModes, ___T>,
) -> impl Future<Output = ()> + Send;
fn set_interrupt_mode(
&mut self,
request: Request<SetInterruptMode, ___T>,
responder: Responder<SetInterruptMode, ___T>,
) -> impl Future<Output = ()> + Send;
fn read_config8(
&mut self,
request: Request<ReadConfig8, ___T>,
responder: Responder<ReadConfig8, ___T>,
) -> impl Future<Output = ()> + Send;
fn read_config16(
&mut self,
request: Request<ReadConfig16, ___T>,
responder: Responder<ReadConfig16, ___T>,
) -> impl Future<Output = ()> + Send;
fn read_config32(
&mut self,
request: Request<ReadConfig32, ___T>,
responder: Responder<ReadConfig32, ___T>,
) -> impl Future<Output = ()> + Send;
fn write_config8(
&mut self,
request: Request<WriteConfig8, ___T>,
responder: Responder<WriteConfig8, ___T>,
) -> impl Future<Output = ()> + Send;
fn write_config16(
&mut self,
request: Request<WriteConfig16, ___T>,
responder: Responder<WriteConfig16, ___T>,
) -> impl Future<Output = ()> + Send;
fn write_config32(
&mut self,
request: Request<WriteConfig32, ___T>,
responder: Responder<WriteConfig32, ___T>,
) -> impl Future<Output = ()> + Send;
fn get_capabilities(
&mut self,
request: Request<GetCapabilities, ___T>,
responder: Responder<GetCapabilities, ___T>,
) -> impl Future<Output = ()> + Send;
fn get_extended_capabilities(
&mut self,
request: Request<GetExtendedCapabilities, ___T>,
responder: Responder<GetExtendedCapabilities, ___T>,
) -> impl Future<Output = ()> + Send;
fn get_bti(
&mut self,
request: Request<GetBti, ___T>,
responder: Responder<GetBti, ___T>,
) -> impl Future<Output = ()> + Send;
}Expand description
A server handler for the Device protocol.
See Device for more details.
Required Methods§
Sourcefn get_device_info(
&mut self,
responder: Responder<GetDeviceInfo, ___T>,
) -> impl Future<Output = ()> + Send
fn get_device_info( &mut self, responder: Responder<GetDeviceInfo, ___T>, ) -> impl Future<Output = ()> + Send
Returns a structure containing device information from the configuration header.
Sourcefn get_bar(
&mut self,
request: Request<GetBar, ___T>,
responder: Responder<GetBar, ___T>,
) -> impl Future<Output = ()> + Send
fn get_bar( &mut self, request: Request<GetBar, ___T>, responder: Responder<GetBar, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn set_bus_mastering(
&mut self,
request: Request<SetBusMastering, ___T>,
responder: Responder<SetBusMastering, ___T>,
) -> impl Future<Output = ()> + Send
fn set_bus_mastering( &mut self, request: Request<SetBusMastering, ___T>, responder: Responder<SetBusMastering, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn reset_device(
&mut self,
responder: Responder<ResetDevice, ___T>,
) -> impl Future<Output = ()> + Send
fn reset_device( &mut self, responder: Responder<ResetDevice, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn ack_interrupt(
&mut self,
responder: Responder<AckInterrupt, ___T>,
) -> impl Future<Output = ()> + Send
fn ack_interrupt( &mut self, responder: Responder<AckInterrupt, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn map_interrupt(
&mut self,
request: Request<MapInterrupt, ___T>,
responder: Responder<MapInterrupt, ___T>,
) -> impl Future<Output = ()> + Send
fn map_interrupt( &mut self, request: Request<MapInterrupt, ___T>, responder: Responder<MapInterrupt, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn get_interrupt_modes(
&mut self,
responder: Responder<GetInterruptModes, ___T>,
) -> impl Future<Output = ()> + Send
fn get_interrupt_modes( &mut self, responder: Responder<GetInterruptModes, ___T>, ) -> impl Future<Output = ()> + Send
Returns the supported interrupt modes for a device.
Sourcefn set_interrupt_mode(
&mut self,
request: Request<SetInterruptMode, ___T>,
responder: Responder<SetInterruptMode, ___T>,
) -> impl Future<Output = ()> + Send
fn set_interrupt_mode( &mut self, request: Request<SetInterruptMode, ___T>, responder: Responder<SetInterruptMode, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn read_config8(
&mut self,
request: Request<ReadConfig8, ___T>,
responder: Responder<ReadConfig8, ___T>,
) -> impl Future<Output = ()> + Send
fn read_config8( &mut self, request: Request<ReadConfig8, ___T>, responder: Responder<ReadConfig8, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn read_config16(
&mut self,
request: Request<ReadConfig16, ___T>,
responder: Responder<ReadConfig16, ___T>,
) -> impl Future<Output = ()> + Send
fn read_config16( &mut self, request: Request<ReadConfig16, ___T>, responder: Responder<ReadConfig16, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn read_config32(
&mut self,
request: Request<ReadConfig32, ___T>,
responder: Responder<ReadConfig32, ___T>,
) -> impl Future<Output = ()> + Send
fn read_config32( &mut self, request: Request<ReadConfig32, ___T>, responder: Responder<ReadConfig32, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn write_config8(
&mut self,
request: Request<WriteConfig8, ___T>,
responder: Responder<WriteConfig8, ___T>,
) -> impl Future<Output = ()> + Send
fn write_config8( &mut self, request: Request<WriteConfig8, ___T>, responder: Responder<WriteConfig8, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn write_config16(
&mut self,
request: Request<WriteConfig16, ___T>,
responder: Responder<WriteConfig16, ___T>,
) -> impl Future<Output = ()> + Send
fn write_config16( &mut self, request: Request<WriteConfig16, ___T>, responder: Responder<WriteConfig16, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn write_config32(
&mut self,
request: Request<WriteConfig32, ___T>,
responder: Responder<WriteConfig32, ___T>,
) -> impl Future<Output = ()> + Send
fn write_config32( &mut self, request: Request<WriteConfig32, ___T>, responder: Responder<WriteConfig32, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn get_capabilities(
&mut self,
request: Request<GetCapabilities, ___T>,
responder: Responder<GetCapabilities, ___T>,
) -> impl Future<Output = ()> + Send
fn get_capabilities( &mut self, request: Request<GetCapabilities, ___T>, responder: Responder<GetCapabilities, ___T>, ) -> impl Future<Output = ()> + Send
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.
Sourcefn get_extended_capabilities(
&mut self,
request: Request<GetExtendedCapabilities, ___T>,
responder: Responder<GetExtendedCapabilities, ___T>,
) -> impl Future<Output = ()> + Send
fn get_extended_capabilities( &mut self, request: Request<GetExtendedCapabilities, ___T>, responder: Responder<GetExtendedCapabilities, ___T>, ) -> impl Future<Output = ()> + Send
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.