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() -> IoApic

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)

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>(&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>(&self, addr: u32) -> T

Read a value from a register.

source

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

Read-modify-update the value of a register.

Auto Trait Implementations§

§

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
§

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.