Struct AcpicaOperation

Source
pub struct AcpicaOperation<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool>;
Expand description

The interface to ACPICA functions. The state of ACPICA’s initialization is tracked using const generics on this type.

ACPICA is not initialized all at once - it has multiple initialization functions for different systems. This struct keeps track of the calling of these functions using the type parameters T, for whether ACPICA tables are initialized, and S for whether the ACPICA subsystem is enabled. An AcpiOperation<false, false> can be obtained from register_interface, which also calls AcpiInitializeSubsystem.

Subsystem initialization code could look like the following:

    let interface = todo!(); // In real code this would be an object implementing the AcpiHandler trait

    let initialization = register_interface(interface)?;
    let initialization = initialization.load_tables()?;
    let initialization = initialization.enable_subsystem()?;
    let initialization = initialization.initialize_objects()?;

Implementations§

Source§

impl<const TI: bool, const TL: bool, const E: bool, const I: bool> AcpicaOperation<TI, TL, E, I>

Source

pub fn debug_trace( &self, name: &str, level: u32, layer: u32, flags: u32, ) -> Result<(), AcpiError>

Rust binding to the ACPICA AcpiDebugTrace function.

§Panics
  • If the OS interface has not been set up using register_interface
  • If name contains null bytes, including at the end.

TODO: Find enums for layer, level, and flags

Source§

impl AcpicaOperation<true, true, true, true>

Source

pub unsafe fn enter_sleep_state_prep( &mut self, state: u8, ) -> Result<(), AcpiError>

TODO: docs

Source

pub unsafe fn enter_sleep_state(&mut self, state: u8) -> Result<(), AcpiError>

TODO: docs

Source

pub fn get_timer(&mut self) -> u32

TODO: docs

Source§

impl AcpicaOperation<true, true, true, true>

Source

pub fn scan_devices<F: Fn(AcpiHandle, u32) -> Option<T>, T>( &self, function: F, ) -> Option<T>

Calls a callback for each device in the AML namespace

Source§

impl<const TL: bool, const E: bool, const I: bool> AcpicaOperation<true, TL, E, I>

Source

pub fn table(&self, signature: [u8; 4]) -> Option<AcpiTableHeader<'_>>

Gets a table by its signature, if it is present on the system.

Source

pub fn tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>

Returns an iterator over all the tables detected by ACPICA. If you want to find a specific common table, there may be a dedicated method for finding it instead, for instance dsdt, madt, fadt, etc.

Source

pub fn ssdt_tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>

Gets an iterator over all of the loaded SSDT tables.

Source

pub fn uefi_tables(&self) -> impl Iterator<Item = Uefi<'_>>

Gets an iterator over all of the loaded UEFI tables.

Source

pub fn dsdt(&self) -> AcpiTableHeader<'_>

Gets the DSDT

Source

pub fn madt(&self) -> Madt<'_>

Gets the MADT

Source

pub fn fadt(&self) -> Fadt<'_>

Gets the FADT

Source

pub fn mcfg(&self) -> Option<Mcfg<'_>>

Gets the MCFG

Source§

impl AcpicaOperation<false, false, false, false>

Source

pub fn initialize_tables( self, ) -> Result<AcpicaOperation<true, false, false, false>, AcpiError>

Calls the ACPICA function AcpiInitializeTables.

This function causes ACPICA to parse all the tables pointed to by the RSDT/XSDT

Source§

impl AcpicaOperation<true, false, false, false>

Source

pub fn load_tables( self, ) -> Result<AcpicaOperation<true, true, false, false>, AcpiError>

Calls the ACPICA function AcpiLoadTables.

This function causes ACPICA to parse and execute AML code in order to build the AML namespace.

Source§

impl AcpicaOperation<true, true, false, false>

Source

pub fn enable_subsystem( self, ) -> Result<AcpicaOperation<true, true, true, false>, AcpiError>

Calls the ACPICA function AcpiEnableSubsystem.

This function causes ACPICA to enter ACPI mode and start receiving ACPI interrupts.

Source§

impl AcpicaOperation<true, true, true, false>

Source

pub fn initialize_objects( self, ) -> Result<AcpicaOperationFullyInitialized, AcpiError>

Calls the ACPICA function AcpiEnableSubsystem.

This function causes ACPICA to enter ACPI mode and start receiving ACPI interrupts.

Trait Implementations§

Source§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> Debug for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> Freeze for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> RefUnwindSafe for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> Send for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> Sync for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> Unpin for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

§

impl<const TABLES_INITIALIZED: bool, const TABLES_LOADED: bool, const SUBSYSTEM_ENABLED: bool, const OBJECTS_INITIALIZED: bool> UnwindSafe for AcpicaOperation<TABLES_INITIALIZED, TABLES_LOADED, SUBSYSTEM_ENABLED, OBJECTS_INITIALIZED>

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

Source§

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

Source§

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.