Skip to content

Commit 35e66df

Browse files
committed
aml: Notify is ignored instead of an error
Notify was unimplemented, and its arguments didn't even match the types they're resolved to (an object and an integer, not a name string), so any method notifying failed. With no way to tell the operating system yet, it's logged and ignored, as ACPICA does without a notify handler. That's safe: Notify only queues an event for the operating system's handlers, which run later; it returns nothing and changes nothing in the namespace, so the method computes the same. Found on a Dell XPS 13 7390, whose embedded controller's _REG notifies the lid.
1 parent c367e16 commit 35e66df

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

‎src/aml/mod.rs‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -677,13 +677,11 @@ where
677677
}
678678
}
679679
Opcode::Notify => {
680-
// TODO: may need special handling on the node to get path?
681-
extract_args!(op => [Argument::Namestring(name), Argument::Object(value)]);
682-
let value = value.as_integer()?;
683-
684-
info!("Notify {:?} with value {}", name, value);
685-
// TODO: support
686-
return Err(AmlError::LibUnimplemented);
680+
// TODO: support notify handlers (ACPICA without one ignores it too)
681+
extract_args!(op => [Argument::Object(object), Argument::Object(value)]);
682+
let value = value.clone().unwrap_transparent_reference().as_integer()?;
683+
info!("Ignoring Notify of {} with value {}", object, value);
684+
context.retire_op(op);
687685
}
688686
Opcode::FromBCD => self.do_from_bcd(&mut context, op)?,
689687
Opcode::ToBCD => self.do_to_bcd(&mut context, op)?,

‎tests/notify.rs‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use aml_test_tools::handlers::null_handler::NullHandler;
2+
3+
mod test_infra;
4+
5+
#[test]
6+
fn test_notify() {
7+
const AML: &str = r#"
8+
DefinitionBlock ("", "SSDT", 2, "RSACPI", "NOTIFY", 0x00000002) {
9+
Device (LID0) {
10+
Name (_HID, EisaId ("PNP0C0D"))
11+
}
12+
Method (MAIN, 0, NotSerialized) {
13+
Notify (LID0, 0x80)
14+
Local0 = 0x80
15+
Notify (\LID0, Local0)
16+
Return (0)
17+
}
18+
}
19+
"#;
20+
21+
let handler = NullHandler {};
22+
test_infra::run_aml_test(AML, handler);
23+
}

0 commit comments

Comments
 (0)