mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 15:31:15 +00:00
acpi_tables: aml: Implement Aml::append_aml_bytes() for number types
Including Byte, Word, DWord and QWord. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
4bd0ac6623
commit
395929f1d4
@ -98,40 +98,36 @@ impl From<&str> for Path {
|
|||||||
pub type Byte = u8;
|
pub type Byte = u8;
|
||||||
|
|
||||||
impl Aml for Byte {
|
impl Aml for Byte {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut bytes = vec![0x0a]; /* BytePrefix */
|
bytes.push(0x0a); /* BytePrefix */
|
||||||
bytes.push(*self);
|
bytes.push(*self);
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Word = u16;
|
pub type Word = u16;
|
||||||
|
|
||||||
impl Aml for Word {
|
impl Aml for Word {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut bytes = vec![0x0bu8]; /* WordPrefix */
|
bytes.push(0x0b); /* WordPrefix */
|
||||||
bytes.append(&mut self.to_le_bytes().to_vec());
|
bytes.append(&mut self.to_le_bytes().to_vec());
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type DWord = u32;
|
pub type DWord = u32;
|
||||||
|
|
||||||
impl Aml for DWord {
|
impl Aml for DWord {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut bytes = vec![0x0c]; /* DWordPrefix */
|
bytes.push(0x0c); /* DWordPrefix */
|
||||||
bytes.append(&mut self.to_le_bytes().to_vec());
|
bytes.append(&mut self.to_le_bytes().to_vec());
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type QWord = u64;
|
pub type QWord = u64;
|
||||||
|
|
||||||
impl Aml for QWord {
|
impl Aml for QWord {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
let mut bytes = vec![0x0e]; /* QWordPrefix */
|
bytes.push(0x0e); /* QWordPrefix */
|
||||||
bytes.append(&mut self.to_le_bytes().to_vec());
|
bytes.append(&mut self.to_le_bytes().to_vec());
|
||||||
bytes
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user