Skip to content

Commit 15b608d

Browse files
committed
acpi: rewrite most of the library
- Correct a number of bugs in how we handle mapped regions of SDTs - Simplify API on `AcpiTables` - Move all `alloc`-usage into `platform` - Move all SDT types under new `sdt` module - Move from `ManagedSlice` back to just using `Vec` - Improve documentation throughout the library - Remove `AcpiResult` type in preference of normal `Result`
1 parent 184ddbf commit 15b608d

File tree

17 files changed

+666
-1106
lines changed

17 files changed

+666
-1106
lines changed

acpi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name = "acpi"
33
version = "5.2.0"
44
authors = ["Isaac Woods"]
55
repository = "https://github.com/rust-osdev/acpi"
6-
description = "A pure-Rust library for parsing ACPI tables"
6+
description = "A pure-Rust library for interacting with ACPI"
77
categories = ["hardware-support", "no-std"]
88
readme = "../README.md"
99
license = "MIT/Apache-2.0"
10-
edition = "2021"
10+
edition = "2024"
1111

1212
[dependencies]
1313
bit_field = "0.10.2"

acpi/src/address.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! ACPI defines a Generic Address Structure (GAS), which provides a versatile way to describe register locations
22
//! in a wide range of address spaces.
33
4-
use crate::{AcpiError, AcpiResult};
4+
use crate::AcpiError;
55

66
/// This is the raw form of a Generic Address Structure, and follows the layout found in the ACPI tables.
77
#[derive(Clone, Copy, Debug)]
@@ -83,7 +83,7 @@ pub struct GenericAddress {
8383
}
8484

8585
impl GenericAddress {
86-
pub fn from_raw(raw: RawGenericAddress) -> AcpiResult<GenericAddress> {
86+
pub fn from_raw(raw: RawGenericAddress) -> Result<GenericAddress, AcpiError> {
8787
let address_space = match raw.address_space {
8888
0x00 => AddressSpace::SystemMemory,
8989
0x01 => AddressSpace::SystemIo,

acpi/src/handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ where
5454
/// dropped, it will be used to unmap the structure.
5555
///
5656
/// ### Safety
57-
///
5857
/// The caller must ensure that the physical memory can be safely mapped.
5958
pub unsafe fn new(
6059
physical_start: usize,
@@ -128,7 +127,7 @@ where
128127
/// functionality, such as mapping regions of physical memory. You are free to implement these
129128
/// however you please, as long as they conform to the documentation of each function. The handler is stored in
130129
/// every `PhysicalMapping` so it's able to unmap itself when dropped, so this type needs to be something you can
131-
/// clone/move about freely (e.g. a reference, wrapper over `Rc`, marker struct, etc.).
130+
/// clone/move about freely (e.g. a reference, wrapper over `Arc`, marker struct, etc.).
132131
pub trait AcpiHandler: Clone {
133132
/// Given a physical address and a size, map a region of physical memory that contains `T` (note: the passed
134133
/// size may be larger than `size_of::<T>()`). The address is not neccessarily page-aligned, so the

acpi/src/lib.rs

Lines changed: 171 additions & 432 deletions
Large diffs are not rendered by default.

acpi/src/managed_slice.rs

Lines changed: 0 additions & 81 deletions
This file was deleted.

acpi/src/mcfg.rs

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)