From f3e86bdf263381c63877e1ff04d0a8bef280ba96 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 3 Nov 2021 14:29:05 +0000 Subject: [PATCH] acpi_tables: aml: Implement Aml::append_aml_bytes() for OpRegion As it relies on primitive types that have already been ported Aml::append_aml_bytes can be used for the child values. Signed-off-by: Rob Bradford --- acpi_tables/src/aml.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/acpi_tables/src/aml.rs b/acpi_tables/src/aml.rs index fef589627..9829b6660 100644 --- a/acpi_tables/src/aml.rs +++ b/acpi_tables/src/aml.rs @@ -761,15 +761,13 @@ impl OpRegion { } impl Aml for OpRegion { - fn to_aml_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - bytes.append(&mut self.path.to_aml_bytes()); + fn append_aml_bytes(&self, bytes: &mut Vec) { + bytes.push(0x5b); /* ExtOpPrefix */ + bytes.push(0x80); /* OpRegionOp */ + self.path.append_aml_bytes(bytes); bytes.push(self.space as u8); - bytes.extend_from_slice(&self.offset.to_aml_bytes()); /* RegionOffset */ - bytes.extend_from_slice(&self.length.to_aml_bytes()); /* RegionLen */ - bytes.insert(0, 0x80); /* OpRegionOp */ - bytes.insert(0, 0x5b); /* ExtOpPrefix */ - bytes + self.offset.append_aml_bytes(bytes); /* RegionOffset */ + self.length.append_aml_bytes(bytes); /* RegionLen */ } }