mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 11:35:46 +00:00
acpi_tables: aml: Implement Aml::append_aml_bytes() for AmlStr and AmlString
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
93647f0313
commit
d92489e0a4
@ -276,26 +276,25 @@ impl Aml for Usize {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_aml_string(v: &str) -> Vec<u8> {
|
fn append_aml_string(v: &str, bytes: &mut Vec<u8>) {
|
||||||
let mut data = vec![0x0D]; /* String Op */
|
bytes.push(0x0D); /* String Op */
|
||||||
data.extend_from_slice(v.as_bytes());
|
bytes.extend_from_slice(v.as_bytes());
|
||||||
data.push(0x0); /* NullChar */
|
bytes.push(0x0); /* NullChar */
|
||||||
data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type AmlStr = &'static str;
|
pub type AmlStr = &'static str;
|
||||||
|
|
||||||
impl Aml for AmlStr {
|
impl Aml for AmlStr {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
create_aml_string(self)
|
append_aml_string(self, bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type AmlString = String;
|
pub type AmlString = String;
|
||||||
|
|
||||||
impl Aml for AmlString {
|
impl Aml for AmlString {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8> {
|
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
|
||||||
create_aml_string(self)
|
append_aml_string(self, bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user