acpi_tables: aml: Implement AML Zero, One, Ones

These are special encodings for representing zero, one or all ones in a
single byte.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-10-22 18:47:58 +01:00
parent 9269e40ba5
commit c76fd6df21

View File

@ -7,6 +7,33 @@ pub trait Aml {
fn to_bytes(&self) -> Vec<u8>;
}
pub const ZERO: Zero = Zero {};
pub struct Zero {}
impl Aml for Zero {
fn to_bytes(&self) -> Vec<u8> {
vec![0u8]
}
}
pub const ONE: One = One {};
pub struct One {}
impl Aml for One {
fn to_bytes(&self) -> Vec<u8> {
vec![1u8]
}
}
pub const ONES: Ones = Ones {};
pub struct Ones {}
impl Aml for Ones {
fn to_bytes(&self) -> Vec<u8> {
vec![0xffu8]
}
}
pub struct Path {
root: bool,
name_parts: Vec<[u8; 4]>,