Struct devices::irqchip::Routes

source ·
pub struct Routes {
    routes: Vec<Vec<IrqSource>>,
}
Expand description

A container for x86 IrqRoutes, grouped by GSI.

Fields§

§routes: Vec<Vec<IrqSource>>

A list of routes, indexed by GSI. Each GSI can map to zero or more routes, so this is a Vec of Vecs. Specifically, a GSI can map to:

  • no routes; or
  • one IrqSource::Msi route; or
  • one or more IrqSource::Irqchip routes (PicPrimary, PicSecondary, or Ioapic)

Implementations§

source§

impl Routes

source

pub fn new() -> Self

Constructs a new Routes with an empty routing table.

source

pub fn add(&mut self, route: IrqRoute) -> Result<()>

Inserts a route, replacing any existing route that conflicts. Two routes conflict if they have the same GSI, and they’re both IrqSource::Irqchip routes with the same chip or they’re both IrqSource::Msi. Returns Err if an IrqSource::Irqchip and IrqSource::Msi route have the same GSI.

source

pub fn replace_all(&mut self, routes: &[IrqRoute]) -> Result<()>

Deletes all existing routes and replaces them with routes. If two routes in routes conflict with each other, the one earlier in the slice is dropped.

source

pub fn default_pic_ioapic_routes(ioapic_pins: usize) -> Vec<IrqRoute>

Default x86 routing table. Pins 0-7 go to primary pic and ioapic, pins 8-15 go to secondary pic and ioapic, and pins 16-23 go only to the ioapic.

source

pub fn get_routes(&self) -> Vec<IrqRoute>

Gets the routes as a flat Vec of IrqRoutes.

source

fn conflict(source: &IrqSource, other: &IrqSource) -> bool

Determines whether or not two irq routes on the same GSI conflict. Returns true if they conflict.

source

fn same_source(source: &IrqSource, other: &IrqSource) -> bool

Determines whether two routes have the same IrqSource variant (IrqSource::Irqchip or IrqSource::Msi).

source

fn get_mut(&mut self, irq: usize) -> &mut Vec<IrqSource>

Returns the routes vec for irq. If irq is past the end of self.routes, then self.routes is first resized with empty vecs.

Trait Implementations§

source§

impl Default for Routes

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Index<usize> for Routes

source§

fn index(&self, irq: usize) -> &Self::Output

Returns all routes for irq, or an empty slice if no routes registered for irq.

§

type Output = [IrqSource]

The returned type after indexing.

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> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V