From c58aa38247a08ab7b8370ea66cb8cf8700f59324 Mon Sep 17 00:00:00 2001 From: Connor Wood Date: Mon, 19 Jun 2017 13:49:37 +0100 Subject: [PATCH] Moved DefDevice and DefThermalZone to namespace --- src/acpi/aml/namedobj.rs | 8 ++++++++ src/acpi/aml/namespace.rs | 3 ++- src/acpi/aml/termlist.rs | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/acpi/aml/namedobj.rs b/src/acpi/aml/namedobj.rs index 26cca7b..aeb2637 100644 --- a/src/acpi/aml/namedobj.rs +++ b/src/acpi/aml/namedobj.rs @@ -163,6 +163,14 @@ impl AmlExecutable for NamedObj { namespace.push_to(local_scope_string, AmlNamespaceContents::Value( AmlValue::Method(method.clone()))); }, + NamedObj::DefDevice { ref name, ref obj_list } => { + let local_scope_string = get_namespace_string(scope, name.clone()); + obj_list.execute(namespace, local_scope_string); + }, + NamedObj::DefThermalZone { ref name, ref obj_list } => { + let local_scope_string = get_namespace_string(scope, name.clone()); + obj_list.execute(namespace, local_scope_string); + }, _ => () } diff --git a/src/acpi/aml/namespace.rs b/src/acpi/aml/namespace.rs index 9f7343e..f869cea 100644 --- a/src/acpi/aml/namespace.rs +++ b/src/acpi/aml/namespace.rs @@ -5,6 +5,7 @@ use collections::vec::Vec; use core::str::FromStr; use super::namedobj::{ RegionSpace, FieldFlags, Method }; +use super::termlist::Object; #[derive(Debug, Clone)] pub struct AmlNamespace { @@ -38,7 +39,7 @@ pub enum AmlValue { BufferField, DDBHandle, DebugObject, - Device, + Device(Vec), Event, FieldUnit, Integer, diff --git a/src/acpi/aml/termlist.rs b/src/acpi/aml/termlist.rs index b236584..b998784 100644 --- a/src/acpi/aml/termlist.rs +++ b/src/acpi/aml/termlist.rs @@ -37,6 +37,25 @@ pub struct MethodInvocation { } +impl AmlExecutable for Vec { + fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option { + for term in self { + term.execute(namespace, scope.clone()); + } + + None + } +} + +impl AmlExecutable for Object { + fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option { + match *self { + Object::NamespaceModifier(ref d) => d.execute(namespace, scope), + Object::NamedObj(ref d) => d.execute(namespace, scope) + } + } +} + impl AmlExecutable for Vec { fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option { for term in self {