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>
impl<const TI: bool, const TL: bool, const E: bool, const I: bool> AcpicaOperation<TI, TL, E, I>
Sourcepub fn debug_trace(
&self,
name: &str,
level: u32,
layer: u32,
flags: u32,
) -> Result<(), AcpiError>
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>
impl AcpicaOperation<true, true, true, true>
Source§impl AcpicaOperation<true, true, true, true>
impl AcpicaOperation<true, true, true, true>
Sourcepub fn scan_devices<F: Fn(AcpiHandle, u32) -> Option<T>, T>(
&self,
function: F,
) -> Option<T>
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>
impl<const TL: bool, const E: bool, const I: bool> AcpicaOperation<true, TL, E, I>
Sourcepub fn table(&self, signature: [u8; 4]) -> Option<AcpiTableHeader<'_>>
pub fn table(&self, signature: [u8; 4]) -> Option<AcpiTableHeader<'_>>
Gets a table by its signature, if it is present on the system.
Sourcepub fn tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>
pub fn tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>
Sourcepub fn ssdt_tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>
pub fn ssdt_tables(&self) -> impl Iterator<Item = AcpiTableHeader<'_>>
Gets an iterator over all of the loaded SSDT tables.
Sourcepub fn uefi_tables(&self) -> impl Iterator<Item = Uefi<'_>>
pub fn uefi_tables(&self) -> impl Iterator<Item = Uefi<'_>>
Gets an iterator over all of the loaded UEFI tables.
Sourcepub fn dsdt(&self) -> AcpiTableHeader<'_>
pub fn dsdt(&self) -> AcpiTableHeader<'_>
Gets the DSDT
Source§impl AcpicaOperation<false, false, false, false>
impl AcpicaOperation<false, false, false, false>
Sourcepub fn initialize_tables(
self,
) -> Result<AcpicaOperation<true, false, false, false>, AcpiError>
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>
impl AcpicaOperation<true, false, false, false>
Sourcepub fn load_tables(
self,
) -> Result<AcpicaOperation<true, true, false, false>, AcpiError>
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>
impl AcpicaOperation<true, true, false, false>
Sourcepub fn enable_subsystem(
self,
) -> Result<AcpicaOperation<true, true, true, false>, AcpiError>
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>
impl AcpicaOperation<true, true, true, false>
Sourcepub fn initialize_objects(
self,
) -> Result<AcpicaOperationFullyInitialized, AcpiError>
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.