diff --git a/src/acpi/aml/namespace.rs b/src/acpi/aml/namespace.rs index ca51fe5..6e6dfa9 100644 --- a/src/acpi/aml/namespace.rs +++ b/src/acpi/aml/namespace.rs @@ -12,6 +12,8 @@ use super::namedobj::{ RegionSpace, FieldFlags }; use super::parser::{AmlExecutionContext, ExecutionState}; use super::AmlError; +use acpi::SdtSignature; + #[derive(Clone)] pub enum FieldSelector { Region(String), @@ -115,7 +117,7 @@ pub enum AmlValue { Alias(String), Buffer(Vec), BufferField(BufferField), - DDBHandle(Vec), + DDBHandle((Vec, SdtSignature)), DebugObject, Device(Device), Event(u64), @@ -252,7 +254,7 @@ impl AmlValue { } } - pub fn get_as_ddb_handle(&self) -> Result, AmlError> { + pub fn get_as_ddb_handle(&self) -> Result<(Vec, SdtSignature), AmlError> { // TODO: Integer conversion match *self { AmlValue::DDBHandle(ref v) => Ok(v.clone()), diff --git a/src/acpi/aml/type1opcode.rs b/src/acpi/aml/type1opcode.rs index 18e43bd..e5c7023 100644 --- a/src/acpi/aml/type1opcode.rs +++ b/src/acpi/aml/type1opcode.rs @@ -7,7 +7,7 @@ use super::namestring::{parse_name_string, parse_super_name}; use time::monotonic; -use acpi::Sdt; +use acpi::{Sdt, load_table, get_sdt_signature}; use super::{parse_aml_table, is_aml_table}; pub fn parse_type1_opcode(data: &[u8], @@ -155,8 +155,9 @@ fn parse_def_load(data: &[u8], let sdt = unsafe { &*(tbl.as_ptr() as *const Sdt) }; if is_aml_table(sdt) { + load_table(get_sdt_signature(sdt)); let delta = parse_aml_table(sdt)?; - ctx.modify(ddb_handle_object.val, AmlValue::DDBHandle(delta)); + ctx.modify(ddb_handle_object.val, AmlValue::DDBHandle((delta, get_sdt_signature(sdt)))); Ok(AmlParseType { val: AmlValue::None, @@ -363,7 +364,7 @@ fn parse_def_unload(data: &[u8], let mut namespace = ctx.prelock(); if let Some(ref mut ns) = *namespace { - for o in delta { + for o in delta.0 { ns.remove(&o); } } diff --git a/src/acpi/aml/type2opcode.rs b/src/acpi/aml/type2opcode.rs index cd94e70..37b3001 100644 --- a/src/acpi/aml/type2opcode.rs +++ b/src/acpi/aml/type2opcode.rs @@ -1367,7 +1367,7 @@ fn parse_def_load_table(data: &[u8], ctx.modify(parameter_path.val, parameter_data.val); return Ok(AmlParseType { - val: AmlValue::DDBHandle(hdl), + val: AmlValue::DDBHandle((hdl, sdt_signature)), len: 2 + signature.len + oem_id.len + oem_table_id.len + root_path.len + parameter_path.len + parameter_data.len }); }