acpi_tables: aml: Implement Aml::append_aml_bytes() for Package

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-11-03 14:29:05 +00:00
parent 5902ceb955
commit f7da35857f

View File

@ -157,21 +157,17 @@ pub struct Package<'a> {
}
impl<'a> Aml for Package<'a> {
fn to_aml_bytes(&self) -> Vec<u8> {
let mut bytes = vec![self.children.len() as u8];
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
let mut tmp = vec![self.children.len() as u8];
for child in &self.children {
bytes.append(&mut child.to_aml_bytes());
tmp.append(&mut child.to_aml_bytes());
}
let mut pkg_length = create_pkg_length(&bytes, true);
pkg_length.reverse();
for byte in pkg_length {
bytes.insert(0, byte);
}
let mut pkg_length = create_pkg_length(&tmp, true);
bytes.insert(0, 0x12); /* PackageOp */
bytes
bytes.push(0x12); /* PackageOp */
bytes.append(&mut pkg_length);
bytes.append(&mut tmp);
}
}