Parcourir la source

Turns out we need to add the predefined scopes after all

Tables will sometimes assume these exist without actually defining them
with a DefScope, which crashes as the level doesn't exist within the
namespace. Since we no longer have a Legacy Mode, we just define them all.
Isaac Woods il y a 4 ans
Parent
commit
ee45882be5
1 fichiers modifiés avec 10 ajouts et 0 suppressions
  1. 10 0
      aml/src/lib.rs

+ 10 - 0
aml/src/lib.rs

@@ -560,6 +560,16 @@ impl AmlContext {
     }
 
     fn add_predefined_objects(&mut self) {
+        /*
+         * These are the scopes predefined by the spec. Some tables will try to access them without defining them
+         * themselves, and so we have to pre-create them.
+         */
+        self.namespace.add_level(AmlName::from_str("\\_GPE").unwrap(), LevelType::Scope).unwrap();
+        self.namespace.add_level(AmlName::from_str("\\_SB").unwrap(), LevelType::Scope).unwrap();
+        self.namespace.add_level(AmlName::from_str("\\_SI").unwrap(), LevelType::Scope).unwrap();
+        self.namespace.add_level(AmlName::from_str("\\_PR").unwrap(), LevelType::Scope).unwrap();
+        self.namespace.add_level(AmlName::from_str("\\_TZ").unwrap(), LevelType::Scope).unwrap();
+
         /*
          * In the dark ages of ACPI 1.0, before `\_OSI`, `\_OS` was used to communicate to the firmware which OS
          * was running. This was predictably not very good, and so was replaced in ACPI 3.0 with `_OSI`, which