|
@@ -8,6 +8,7 @@ extern crate std;
|
|
extern crate log;
|
|
extern crate log;
|
|
|
|
|
|
mod fadt;
|
|
mod fadt;
|
|
|
|
+mod hpet;
|
|
mod rsdp;
|
|
mod rsdp;
|
|
mod sdt;
|
|
mod sdt;
|
|
|
|
|
|
@@ -31,6 +32,15 @@ pub enum AcpiError {
|
|
FadtIncorrectSignature,
|
|
FadtIncorrectSignature,
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#[repr(C, packed)]
|
|
|
|
+pub struct GenericAddress {
|
|
|
|
+ address_space: u8,
|
|
|
|
+ bit_width: u8,
|
|
|
|
+ bit_offset: u8,
|
|
|
|
+ access_size: u8,
|
|
|
|
+ address: u64,
|
|
|
|
+}
|
|
|
|
+
|
|
/// Describes a physical mapping created by `AcpiHandler::map_physical_region` and unmapped by
|
|
/// Describes a physical mapping created by `AcpiHandler::map_physical_region` and unmapped by
|
|
/// `AcpiHandler::unmap_physical_region`. The region mapped must be at least `size_of::<T>()`
|
|
/// `AcpiHandler::unmap_physical_region`. The region mapped must be at least `size_of::<T>()`
|
|
/// bytes, but may be bigger.
|
|
/// bytes, but may be bigger.
|
|
@@ -146,3 +156,20 @@ where
|
|
handler.unmap_physical_region(mapping);
|
|
handler.unmap_physical_region(mapping);
|
|
Ok(())
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#[cfg(test)]
|
|
|
|
+mod tests {
|
|
|
|
+ use GenericAddress;
|
|
|
|
+
|
|
|
|
+ impl GenericAddress {
|
|
|
|
+ pub(crate) fn make_testcase() -> GenericAddress {
|
|
|
|
+ GenericAddress {
|
|
|
|
+ address_space: 0 as u8,
|
|
|
|
+ bit_width: 0 as u8,
|
|
|
|
+ bit_offset: 0 as u8,
|
|
|
|
+ access_size: 0 as u8,
|
|
|
|
+ address: 0 as u64,
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|