Repository navigation
Conversation
Notify resolves its operand as a SuperName, so a name, an argument, a local or a reference all reach the same object; the interpreter finds the namespace entry holding that object and passes its absolute path and the notification value to the new Handler::handle_notify. The default ignores the notification, as ACPICA does with no notify handler installed.
|
Thanks for this @lexoliu! I'd like to spend some time discussing with Isaac about exactly what our Notify support should look like, so it might take a while before we progress this - apologies. For example: Is a single Notify handler appropriate? Maybe we want to follow the model of ACPICA and Windows where notification handlers are installed against namespace objects, rather than having a single notify handler for the entire namespace. OTOH, we might well decide this is a sensible implementation for now and do something fancier later. Please bear with us! |
martin-hughes
left a comment
There was a problem hiding this comment.
Hi @lexoliu - thanks for your patience!
Isaac and I think using a single notify method on the Handler1 is a reasonable way to go so I've reviewed your PR. We appreciate your work on this!
There's nothing too major in my comments, although I'd like to hear your thoughts about merging NotifyRecorder and CheckCommandHandler.
Footnotes
-
as opposed to having handlers installed against specific objects ↩
There was a problem hiding this comment.
Nitpick: cargo fmt slightly changes your code in path_of - please could you run cargo fmt?
| } | ||
|
|
||
| /// A [`NullHandler`] that records every notification it receives. | ||
| #[derive(Clone, Default)] |
There was a problem hiding this comment.
Please could the tests be grouped together? (As opposed to having this handler in the middle)
Did you consider merging this with CheckCommandHandler?
|
|
||
| impl WrappedObject { | ||
| /// Returns `true` if both wrappers refer to the same underlying object. | ||
| pub(crate) fn ptr_eq(&self, other: &WrappedObject) -> bool { |
There was a problem hiding this comment.
Please move this function into the main impl block instead of starting a new one.
| let path = AmlName::from_str("\\_SB_.CPUS.C001").unwrap(); | ||
| let expected: Vec<_> = [0x01, 0x02, 0x80, 0x03, 0x04].into_iter().map(|value| (path.clone(), value)).collect(); | ||
| assert_eq!(*notifications.lock().unwrap(), expected); | ||
| } |
There was a problem hiding this comment.
Please would you add a test of the error path? e.g.
Local0 = 1 // Local0 does not refer to a namespace object
Notify(Local0, 2)
Notifyis how firmware tells the OS about hotplug and status changes — QEMU's CPU and PCI hotplug AML, battery and thermal events — but the interpreter currently drops it. This addsHandler::handle_notify(&AmlName, u64), mirroring ACPICA's notify handlers; the default implementation still ignores the notification.The operand is still resolved as a
SuperName, soNotify (Arg0, …)and aRefOfheld in a local keep working; the interpreter looks up which namespace entry holds the resolved object and hands the handler its absolute path. An object that no entry holds is reported asAmlError::ObjectNotInNamespace.tests/notify.rscovers relative, absolute and parent-prefixed names, an argument, and a reference in a local.