Struct rstubs::arch::int::ioapic::IoApic

source ·
pub struct IoApic {
    pub base: AtomicPtr<u32>,
    overrides: [AtomicU8; 16],
}
Expand description

The I/O APIC’s Core component is the IO-redirection table. This table is used to configure a flexible mapping between the interrupt number and the external interruption. Entries within this table have a width of 64 bit.

Fields§

§base: AtomicPtr<u32>

Base address of the IOAPIC registers.

It contains two memory-mapped registers: IOREGSEL at base and IOWIN at base + 0x10.

§overrides: [AtomicU8; 16]

Implementations§

source§

impl IoApic

source

pub const DEFAULT_BASE: usize = 4_273_995_776usize

source

pub const SLOT_MAX: u8 = 24u8

source

pub const fn new() -> Self

Create a new instance that has to be initialize with Self::init.

source

pub fn set_override(&self, source: usize, global: u8)

Override a slot id, redirecting it

source

pub fn init(&self, id: u8, panic_vector: u8)

Initializes the I/O APIC.

This function will initialize the I/O APIC by initializing the IO-redirection table with sane default values. The default interrupt-vector number is chosen such that, in case the interrupt is issued, the panic handler is executed. In the beginning, all external interrupts are disabled within the I/O APIC. Apart from the redirection table, the id (read from the system description tables during boot) needs to be passed in.

source

pub fn config(&self, device: Device, vector: u8, trigger_level: bool)

Creates a mapping between an interrupt vector and an external interrupt.

source

fn config_raw(&self, slot: u8, vector: u8, trigger_level: bool)

Configures the redirection slots with:

  • lowest priority delivery to all cores
  • high polarity
  • masked (you can enable the keyboard later)
  • tigger level and vector based on the arguments

Note: Do not overwrite any reserved bits of the registers (read-modify-write).

source

pub fn enable(&self, device: Device, enabled: bool)

Enables or disables interrupts for the given device.

source

pub fn enabled(&self, device: Device) -> bool

Returns whether interrupts for the device are active.

source

fn slot(&self, device: Device) -> u8

Get the slot for the device (respecting redirections from the ACPI Tables).

source

fn write<T: Register>(&self, addr: u32, reg: T)

Write a value to a register.

Access to the actual IOAPIC registers can be obtained by performing the following steps:

  1. Write the number of the IOAPIC register to the address stored in IOREGSEL
  2. Read the value from / write the value to the address referred to by IOWIN.
source

fn read<T: Register>(&self, addr: u32) -> T

Read a value from a register.

source

fn update<T: Register>(&self, addr: u32, f: impl FnOnce(T) -> T)

Read-modify-update the value of a register.

Auto Trait Implementations§

§

impl !Freeze for IoApic

§

impl RefUnwindSafe for IoApic

§

impl Send for IoApic

§

impl Sync for IoApic

§

impl Unpin for IoApic

§

impl UnwindSafe for IoApic

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
§

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

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

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.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

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

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.