Skip to content

Commit 5e6608d

Browse files
committed
Add changes for acpi crates for March 2021
1 parent 4885237 commit 5e6608d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

content/this-month/2021-03/index.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ date = 0000-01-01
66
month = "March 2021"
77
authors = [
88
"phil-opp",
9+
"IsaacWoods",
910
# add yourself here
1011
]
1112
+++
@@ -79,6 +80,34 @@ The `volatile` crate provides a safe wrapper type for implementing volatile read
7980

8081
Thanks to [@KernelFreeze](https://github.com/KernelFreeze) for their contribution!
8182

83+
### [`acpi`](https://github.com/rust-osdev/acpi)
84+
85+
The `acpi` repository contains crates for parsing the ACPI tables – data structures that the firmware of modern
86+
computers use to relay information about the hardware to the OS. This month has seen substantial changes to both
87+
the `acpi` and `aml` crates:
88+
89+
- [We made the types that represent raw ACPI tables public](https://github.com/rust-osdev/acpi/pull/86). This allows library users to work directly with tables such as the
90+
[FADT](https://docs.rs/acpi/2.3.1/acpi/fadt/struct.Fadt.html) if they need to, which is needed to access power
91+
management features we don't yet expose. <span class="gray">(published as `acpi v2.3.1`)</span>
92+
- [Native functions are now supported by the AML interpreter!](https://github.com/rust-osdev/acpi/pull/88). A
93+
'native function' is an AML method that is defined in Rust, rather than using AML bytecode. This is useful for
94+
defining "up-call" methods (where a method is provided by the OS, and called by the firmware), and will hopefully
95+
by useful in the future for patching methods in broken tables. A native method can easily be created with
96+
the [`AmlValue::native_method` constructor](https://docs.rs/aml/0.11.0/aml/value/enum.AmlValue.html#method.native_method).
97+
- However, supporting native functions needed a bit of breakage - `AmlValue` no longer implements `PartialEq` or `Eq`. This actually improves correctness,
98+
as correctly comparing two `AmlValue`s may require type conversions to be done, and so should be done with the
99+
[`AmlValue::cmp`](https://docs.rs/aml/0.11.0/aml/value/enum.AmlValue.html#method.cmp) method, but does make `aml
100+
v0.11.0` a breaking change.
101+
- We also used this opportunity to remove the `legacy_mode` parameter to `AmlContext::new`, which will affect all
102+
crate users, but makes user's lives simpler - handling old tables will now be done automatically.
103+
- Fallout from `AmlValue` no longer being `Eq` also led to some cleanups in how control flow is handled in the
104+
interpreter. This is not likely to affect users, but the "fake" error `AmlError::Return` has been removed, which
105+
is also technically a breaking change in `aml v0.11.0`.
106+
- The AML interpreter now correctly supplies the `\_OS`, `\_OSI`, and `\_REV` objects. These objects were designed
107+
to allow firmware to detect OS support for new AML features, but [come with a bit of baggage](https://www.kernel.org/doc/html/latest/firmware-guide/acpi/osi.html).
108+
This is important for supporting running on real hardware, which often assumes the existance of these objects.
109+
<span class="gray">(published as `aml v0.11.0`)</span>
110+
82111
## Personal Projects
83112

84113
In this section, we describe updates to personal projects that are not directly related to the `rust-osdev` organization. Feel free to [create a pull request](https://github.com/rust-osdev/homepage/pulls) with the updates of your OS project for the next post.

0 commit comments

Comments
 (0)