Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions core/patina_internal_depex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,27 @@ impl Depex {
false
}

/// Report protocol present status in the DEPEX expression.
pub fn report_protocol_present(&self) {
for opcode in self.expression.iter() {
match opcode {
Opcode::Push(guid, present) => {
log::warn!(
target: "patina_dxe_core",
" {guid:?} : {present}"
);
Comment on lines +290 to +293

@makubacki makubacki Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this at warn level coupled with the patina_dxe_core target is a code smell in terms of coupling. Basically, this assumes code exists a certain way in the code (patina_dxe_core) that uses this crate (patina_internal_depex) as a dependency.

This type of print should be at least info or a more verbose type if left at the patina_dxe_core target level.

But I really think this code should really just return something like an iterator of protocols present for a given Depex so all logging stays in the caller.

@os-d os-d Jun 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I just meant don't use a target at all for the logging. It will inherit the patina_internal_depex target if a consumer wants to filter it.

But, to Michael's point, I think that returning an iterator here and letting the caller print it works well.

}
Opcode::End => {
log::warn!(
target: "patina_dxe_core",
" {opcode:?}"
);
}
_ => {}
}
}
}

/// If the depex expression is an associated dependency, it returns the associated dependency.
pub fn is_associated(&self) -> Option<AssociatedDependency> {
match self.expression.first() {
Expand Down
23 changes: 22 additions & 1 deletion patina_dxe_core/src/pi_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,34 @@ impl<P: PlatformInfo> PiDispatcher<P> {

/// Displays drivers that were discovered but not dispatched.
pub fn display_discovered_not_dispatched(&self) {
for driver in &self.dispatcher_context.lock().pending_drivers {
// Summary report
for driver in self.dispatcher_context.lock().pending_drivers.iter() {
log::warn!(
"Driver {} ({:?}) found but not dispatched.",
driver.name.as_deref().unwrap_or("Unnamed"),
guid_fmt!(driver.file_name)
);
}

// Detail report
log::warn!("Begin Detail Report:");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Begin Detail Report" is too ambiguous. Please change to something like "Begin Report of Drivers Not Dispatched".

for driver in self.dispatcher_context.lock().pending_drivers.iter() {
log::warn!(
"Driver {} ({:?}) found but not dispatched. Protocols present:",
driver.name.as_deref().unwrap_or("Unnamed"),
guid_fmt!(driver.file_name)
);

match &driver.depex {
Some(depex) => {
depex.report_protocol_present();
}
_ => {
log::warn!(" No Depex");
}
}
}
log::warn!("End Detail Report.");
}
Comment on lines +117 to 136

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The messages in this "detailed report" should be at info level or higher. I think debug level.

The normal case of a driver not dispatched is already covered by warn above. This is debug information.


/// Initializes the dispatcher by registering for FV protocol installation events.
Expand Down
Loading