Moved DefDevice and DefThermalZone to namespace

This commit is contained in:
Connor Wood
2017-06-19 13:49:37 +01:00
parent 07cf7385e9
commit c58aa38247
3 changed files with 29 additions and 1 deletions

View File

@@ -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);
},
_ => ()
}

View File

@@ -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<Object>),
Event,
FieldUnit,
Integer,

View File

@@ -37,6 +37,25 @@ pub struct MethodInvocation {
}
impl AmlExecutable for Vec<Object> {
fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option<AmlValue> {
for term in self {
term.execute(namespace, scope.clone());
}
None
}
}
impl AmlExecutable for Object {
fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option<AmlValue> {
match *self {
Object::NamespaceModifier(ref d) => d.execute(namespace, scope),
Object::NamedObj(ref d) => d.execute(namespace, scope)
}
}
}
impl AmlExecutable for Vec<TermObj> {
fn execute(&self, namespace: &mut AmlNamespace, scope: String) -> Option<AmlValue> {
for term in self {