mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 13:05:45 +00:00
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:
parent
9269e40ba5
commit
c76fd6df21
@ -7,6 +7,33 @@ pub trait Aml {
|
|||||||
fn to_bytes(&self) -> Vec<u8>;
|
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 {
|
pub struct Path {
|
||||||
root: bool,
|
root: bool,
|
||||||
name_parts: Vec<[u8; 4]>,
|
name_parts: Vec<[u8; 4]>,
|
||||||
|
Loading…
Reference in New Issue
Block a user