Page 1 of 1

Help with ACPI in Rust

Posted: Sun Apr 10, 2022 4:29 am
by skyesp
Hiya all. I must admit I have hit a bit of a roadblock when trying to get started with acpi (or perhaps integrating acpica). I am working in Rust, and I am wondering if anyone could help me get started on integrating acpi into my kernel.
Does anyone know how to start with this? I have seen the ACPICA manual, but it seems a bit unwieldy with over 300 pages, so I am wondering what the best approach would be. I know of the libacpica crate, but the documentation is very lacking as far as I can find, so perhaps one of you lovely people knows how to use it?
Looking forward to your helpful replies :D

Re: Help with ACPI in Rust

Posted: Wed Apr 13, 2022 10:14 pm
by davmac314
skyesp wrote:Does anyone know how to start with this? I have seen the ACPICA manual, but it seems a bit unwieldy with over 300 pages, so I am wondering what the best approach would be
I'm not trying to be mean, but don't you think there's a reason those 300 pages exist...

Maybe start by reading the intro sections at least, until you get an overall feel for how it works. If you don't understand something in particular you can ask specific questions but "how do I start with ACPICA, without reading the actual documentation" is not likely to go down well.

Oh, and the bad news: to understand ACPICA you probably want to read the ACPI spec as well.

Re: Help with ACPI in Rust

Posted: Wed Apr 13, 2022 11:16 pm
by Ethin
There's an acpi crate for Rust (just called "acpi") but it doesn't parse all devices. So you'll have to do some of that yourself. And either way you should probably learn how all that works anyhow.

Re: Help with ACPI in Rust

Posted: Thu Apr 14, 2022 12:45 pm
by isaacwoods
Oh, and the bad news: to understand ACPICA you probably want to read the ACPI spec as well.
It's absolutely necessary to read the actual ACPI spec, but I think it's reasonable to wonder why you need another 300 pages to understand the implementation. While it has the benefit of being the reference implementation, ACPICA is a real mess and I'd argue is very difficult to use correctly outside of Linux.
There's an acpi crate for Rust (just called "acpi") but it doesn't parse all devices. So you'll have to do some of that yourself. And either way you should probably learn how all that works anyhow.
The crate is, I'd say, a much better experience than ACPICA, and should be complete enough to get you started on QEMU or something.

Relatedly, if anyone does come across anything that is not supported, please do file an issue, or feel free to contribute (something as large and annoying to implement as ACPI could really do with a single implementation; the C side has managed this pretty well with `lai` so it'd be good to say the same for Rust).

Re: Help with ACPI in Rust

Posted: Fri Apr 15, 2022 3:05 am
by davmac314
isaacwoods wrote:It's absolutely necessary to read the actual ACPI spec, but I think it's reasonable to wonder why you need another 300 pages to understand the implementation.
Yeah, I may have misinterpreted the question (as "help with APCICA" rather than "help with APCI, I've looked at APCICA and want alternatives").

skyesp, sorry if I was off-handed.