diff --git a/src/aml/mod.rs b/src/aml/mod.rs index 2654f233..b567eae0 100644 --- a/src/aml/mod.rs +++ b/src/aml/mod.rs @@ -810,9 +810,9 @@ where let result = if object.typ() == ObjectType::Reference { object.clone().unwrap_reference() } else if object.typ() == ObjectType::String { - let path = AmlName::from_str(&object.as_string().unwrap())? - .resolve(&context.current_scope)?; - self.namespace.lock().get(path)?.clone() + let path = AmlName::from_str(&object.as_string().unwrap())?; + let (_, object) = self.namespace.lock().search(&path, &context.current_scope)?; + object.clone() } else { return Err(AmlError::ObjectNotOfExpectedType { expected: ObjectType::Reference, @@ -1334,7 +1334,7 @@ where let region_name = context.namestring()?; let field_flags = context.next()?; - let region = self.namespace.lock().get(region_name.resolve(&context.current_scope)?)?.clone(); + let (_, region) = self.namespace.lock().search(®ion_name, &context.current_scope)?.clone(); let kind = FieldUnitKind::Normal { region }; self.parse_field_list(&mut context, kind, start_pc, pkg_length, field_flags)?; } diff --git a/tests/name_search.rs b/tests/name_search.rs new file mode 100644 index 00000000..39610ca0 --- /dev/null +++ b/tests/name_search.rs @@ -0,0 +1,47 @@ +use aml_test_tools::handlers::null_handler::NullHandler; + +mod test_infra; + +#[test] +fn test_name_search_1() { + const AML: &str = r#" +DefinitionBlock("", "DSDT", 1, "RSACPI", "NAMING", 1) { + Scope (\) { + Device (AMW0) { + Name (_HID, EisaId ("PNP0C14")) + + OperationRegion (\RAMX, SystemMemory, 0x1000, 0x0100) + Field (RAMX, ByteAcc, NoLock, Preserve) + { + WFUN, 32, + } + } + } +} +"#; + + let handler = NullHandler {}; + test_infra::run_aml_test(AML, handler); +} + +#[test] +fn test_name_search_2() { + const AML: &str = r#" +DefinitionBlock("", "DSDT", 1, "RSACPI", "NAMING", 1) { + Scope (\) { + OperationRegion (RAMX, SystemMemory, 0x1000, 0x0100) + Device (AMW0) { + Name (_HID, EisaId ("PNP0C14")) + + Field (\RAMX, ByteAcc, NoLock, Preserve) + { + WFUN, 32, + } + } + } +} +"#; + + let handler = NullHandler {}; + test_infra::run_aml_test(AML, handler); +}