Explorar el Código

Add namespace values for devices and thermal zones

We originally did not bother (devices and thermal zones just have namespace
levels), but it's much easier to assume that there will be correctly placed
namespace values for these objects in certain places, including when trying
to create concat type representations of all objects.
Isaac Woods hace 3 años
padre
commit
667b64a3ef
Se han modificado 2 ficheros con 13 adiciones y 0 borrados
  1. 8 0
      aml/src/term_object.rs
  2. 5 0
      aml/src/value.rs

+ 8 - 0
aml/src/term_object.rs

@@ -419,6 +419,10 @@ where
                 .then(name_string())
                 .map_with_context(|(length, name), context| {
                     let resolved_name = try_with_context!(context, name.resolve(&context.current_scope));
+                    try_with_context!(
+                        context,
+                        context.namespace.add_value(resolved_name.clone(), AmlValue::Device)
+                    );
                     try_with_context!(
                         context,
                         context.namespace.add_level(resolved_name.clone(), LevelType::Device)
@@ -557,6 +561,10 @@ where
                 .then(name_string())
                 .map_with_context(|(pkg_length, name), context| {
                     let resolved_name = try_with_context!(context, name.resolve(&context.current_scope));
+                    try_with_context!(
+                        context,
+                        context.namespace.add_value(resolved_name.clone(), AmlValue::ThermalZone)
+                    );
                     try_with_context!(
                         context,
                         context.namespace.add_level(resolved_name.clone(), LevelType::ThermalZone)

+ 5 - 0
aml/src/value.rs

@@ -138,6 +138,7 @@ pub enum AmlType {
     DebugObject,
     Event,
     FieldUnit,
+    Device,
     Integer,
     Method,
     Mutex,
@@ -187,6 +188,7 @@ pub enum AmlValue {
         offset: u64,
         length: u64,
     },
+    Device,
     Method {
         flags: MethodFlags,
         code: MethodCode,
@@ -205,6 +207,7 @@ pub enum AmlValue {
         system_level: u8,
         resource_order: u16,
     },
+    ThermalZone,
 }
 
 impl AmlValue {
@@ -235,12 +238,14 @@ impl AmlValue {
             AmlValue::String(_) => AmlType::String,
             AmlValue::OpRegion { .. } => AmlType::OpRegion,
             AmlValue::Field { .. } => AmlType::FieldUnit,
+            AmlValue::Device => AmlType::Device,
             AmlValue::Method { .. } => AmlType::Method,
             AmlValue::Buffer(_) => AmlType::Buffer,
             AmlValue::Processor { .. } => AmlType::Processor,
             AmlValue::Mutex { .. } => AmlType::Mutex,
             AmlValue::Package(_) => AmlType::Package,
             AmlValue::PowerResource { .. } => AmlType::PowerResource,
+            AmlValue::ThermalZone => AmlType::ThermalZone,
         }
     }