Crate acpi

Crate acpi 

Source
Expand description

acpi is a Rust library for interacting with the Advanced Configuration and Power Interface, a complex framework for power management and device discovery and configuration. ACPI is used on modern x64, as well as some ARM and RISC-V platforms. An operating system needs to interact with ACPI to correctly set up a platform’s interrupt controllers, perform power management, and fully support many other platform capabilities.

This crate provides a limited API that can be used without an allocator, for example for use from a bootloader. This API will allow you to search for the RSDP, enumerate over the available tables, and interact with the tables using their raw structures. All other functionality is behind an alloc feature (enabled by default) and requires an allocator.

With an allocator, this crate also provides higher-level interfaces to the static tables, as well as a dynamic interpreter for AML - the bytecode format encoded in the DSDT and SSDT tables.

§Usage

To use the library, you will need to provide an implementation of the Handler trait, which allows the library to make requests such as mapping a particular region of physical memory into the virtual address space.

Next, you’ll need to get the physical address of either the RSDP, or the RSDT/XSDT. The method for doing this depends on the platform you’re running on and how you were booted. If you know the system was booted via the BIOS, you can use rsdp::Rsdp::search_for_on_bios. UEFI provides a separate mechanism for getting the address of the RSDP.

You then need to construct an instance of AcpiTables, which can be done in a few ways depending on how much information you have:

Once you have an AcpiTables, you can search for relevant tables, or use the higher-level interfaces, such as [PlatformInfo], [PciConfigRegions], or HpetInfo.

Re-exports§

pub use sdt::fadt::PowerProfile;
pub use sdt::hpet::HpetInfo;
pub use sdt::madt::MadtError;

Modules§

address
ACPI defines a Generic Address Structure (GAS), which provides a versatile way to describe register locations in a wide range of address spaces.
aml
platform
registers
rsdp
sdt

Structs§

AcpiTables
AcpiTables should be constructed after finding the RSDP or RSDT/XSDT and allows enumeration of the system’s ACPI tables.
AmlTable
Handle
A Handle is an opaque reference to an object that is managed by the host on behalf of this library.
PciAddress
The address of a PCIe function.
PhysicalMapping
Describes a physical mapping created by Handler::map_physical_region and unmapped by Handler::unmap_physical_region. The region mapped must be at least size_of::<T>() bytes, but may be bigger.

Enums§

AcpiError

Traits§

AcpiTable
All types representing ACPI tables should implement this trait.
Handler
An implementation of this trait must be provided to allow acpi to perform operations that interface with the underlying hardware and other systems in your host implementation. This interface is designed to be flexible to allow usage of the library from a variety of settings.