#acpi #osdev #api-bindings

nightly no-std acpica-bindings

Incomplete rust bindings to Intel's ACPICA kernel subsystem

3 releases

0.1.2 Dec 24, 2023
0.1.1 Dec 17, 2023
0.1.0 Dec 17, 2023

#1663 in Hardware support

MIT license

1.5MB
10K SLoC

ACPICA Rust Bindings

Rust bindings to the ACPICA kernel subsystem for interacting with ACPI tables and AML code. See the crate level documentation for info on using the library

Changing Version of ACPICA

The source code of ACPICA is included as a tarball in the crate root. To update the version, download the new code from the downloads page, and replace the tarball with this file. Then run cargo clean to remove the object files from the old version.

This library's build script automatically makes some changes to the source code to configure it for in-kernel use. Updates to the ACPICA code without updates to the rust code may make the library stop compiling, or stop working even if it compiles.


lib.rs:

ACPICA bindings

Incomplete rust bindings to Intel's ACPICA kernel subsystem. This crate is very much still under development - I am adding features as they are needed by my OS project. If you are using this crate, expect lots of compiler warnings and todo!s.

Build Dependencies

This crate builds ACPICA from source, using the cc crate. This crate requires the presence of a C compiler on the system - see that crate's documentation for more information.

The crate also uses unstable rust features, so needs a nightly or beta compiler.

Runtime Dependencies

As the crate is designed to be used in an OS kernel, it has minimal dependencies. The crate does require dynamic memory allocation, however.

The crate also uses the [log] crate for logging.

Usage

The ACPICA kernel subsystem calls into OS code using various functions prefixed with AcpiOs. These are translated by this library into calls to methods on the AcpiHandler trait. An object implementing this trait must be passed to register_handler before any ACPI functionality can be used. Initializing the library could look like this:

struct HandlerStruct {}

impl AcpiHandler for HandlerStruct {
    // ...
}

let handler = HandlerStruct {};

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

Dependencies