Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/aml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(&region_name, &context.current_scope)?.clone();
let kind = FieldUnitKind::Normal { region };
self.parse_field_list(&mut context, kind, start_pc, pkg_length, field_flags)?;
}
Expand Down
47 changes: 47 additions & 0 deletions tests/name_search.rs
Original file line number Diff line number Diff line change
@@ -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);
}
Loading