Browse Source

Add AmlValue variants, clean up fields a little

Just preparing to actually add stuff to the namespace
Isaac Woods 5 years ago
parent
commit
be94946a93
3 changed files with 14 additions and 11 deletions
  1. 1 1
      aml_parser/src/lib.rs
  2. 9 10
      aml_parser/src/term_object.rs
  3. 4 0
      aml_parser/src/value.rs

+ 1 - 1
aml_parser/src/lib.rs

@@ -1,5 +1,5 @@
 #![no_std]
-#![feature(decl_macro)]
+#![feature(decl_macro, type_ascription)]
 
 extern crate alloc;
 

+ 9 - 10
aml_parser/src/term_object.rs

@@ -227,24 +227,23 @@ where
      * object (it seems to be defined in ASL). We treat BufferData as if it was encoded like
      * DefBuffer, and this seems to work so far.
      */
-    // TODO: replace these maps with `with_context` and register the fields in the namespace
     // TODO: parse ConnectField and ExtendedAccessField
-    let reserved_field = opcode(opcode::RESERVED_FIELD).then(pkg_length()).map_with_context(
-        |((), pkg_length), context| {
-            trace!("Adding reserved field with length: {}", pkg_length.raw_length);
-            // TODO: put it in the namespace
-            ((), context)
-        },
-    );
 
-    let access_field = opcode(opcode::ACCESS_FIELD).then(take()).then(take()).map(
-        |(((), access_type), access_attrib)| {
+    /*
+     * Reserved fields shouldn't actually be added to the namespace; they seem to show gaps in
+     * the operation region that aren't used for anything.
+     */
+    let reserved_field = opcode(opcode::RESERVED_FIELD).then(pkg_length()).discard_result();
+
+    let access_field = opcode(opcode::ACCESS_FIELD).then(take()).then(take()).map_with_context(
+        |(((), access_type), access_attrib), context| {
             trace!(
                 "Adding access field with access_type: {}, access_attrib: {}",
                 access_type,
                 access_attrib
             );
             // TODO: put it in the namespace
+            ((), context)
         },
     );
 

+ 4 - 0
aml_parser/src/value.rs

@@ -95,7 +95,11 @@ impl MethodFlags {
 pub enum AmlValue {
     Integer(u64),
     String(String),
+    Scope(BTreeMap<String, AmlValue>),
+    OpRegion { region: RegionSpace, offset: u64, length: u64 },
     Field { flags: FieldFlags, offset: u64, length: u64 },
+    Method { flags: MethodFlags, code: Vec<u8> },
+    Buffer { bytes: Vec<u8>, size: u64 },
     Package(Vec<AmlValue>),
 }