-
Notifications
You must be signed in to change notification settings - Fork 122
firmware_uefi: add diagnostics service for uefi logs #1209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
firmware_uefi: add diagnostics service for uefi logs #1209
Conversation
use zerocopy::Immutable; | ||
use zerocopy::KnownLayout; | ||
|
||
// Advanced Logger Info signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ///
doc comments here, please. Also, can we require doc comments?
return Err(EntryParseError::Timestamp(entry.time_stamp)); | ||
} | ||
|
||
// Validate the message length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest leaving out comments that don't say anything more than what the code is obviously doing.
/// UEFI Advanced Logger Info Header, which is shared | ||
/// with the Advanced Logger Package in UEFI. The entries | ||
/// live right after. | ||
#[repr(C, packed)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this packed? It looks like it has natural alignment for all fields. Marking it packed just makes more work for yourself since you can't take references to fields inside it.
} | ||
|
||
// Process any remaining accumulated message | ||
if is_accumulating && !accumulated_message.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk of code is duplicated. Find a way to avoid this duplication (e.g., define a closure and call that closure in the two places).
…e of overflow instead, avoid allocation for message, remove explicit endianness, remove unnecessary comments, use kv pairs in trace statements, change to log_message for actual message, remove prefix
This PR focuses on a new diagnostics service for firmware_uefi.
UEFI will write the GPA of the advanced logger buffer (which we formally call EFI Diagnostics here) to an Io port intercept called
SET_EFI_DIAGNOSTICS_GPA
.UEFI will also write to a different Io port intercept called
PROCESS_EFI_DIAGNOSTICS
, which signals us to process the EFI Diagnostics buffer.The diagnostics subsystem's role is to read into guest memory from the specified GPA, collect advanced logger entries and log them to our tracing facilities. This will get triggered by the following conditions:
PROCESS_EFI_DIAGNOSTICS
)PROCESS_EFI_DIAGNOSTICS
)