-
Notifications
You must be signed in to change notification settings - Fork 182
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
add support for PSU firmware update #1934
Conversation
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 looks good to me! i had some very minor drive-by suggestions which may or may not be useful.
// | ||
// The boot loader command -- sent via BOOT_LOADER_CMD -- is unfortunately odd | ||
// in that its command code is overloaded with BOOT_LOADER_STATUS. (That is, | ||
// a read to the command code is BOOT_LOADER_STATUS, a write is | ||
// BOOT_LOADER_CMD.) This is behavior that the PMBus crate didn't necessarily | ||
// envision, so it can't necessarily help us out; we define the single-byte | ||
// payload codes here rather than declaratively in the PMBus crate. | ||
// |
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.
Nit: triple ///
to actually generate a docstring, which is highlighted differently for those of us using syntax highlighting
(Also, leading and trailing empty lines are unidiomatic, but I know it will take some prying to remove them from your hands)
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.
It's definitely not intended to be a doc comment, just an implementation comment -- which hopefully gives me a stay of execution on the added vertical spacing for readability. ;)
|
||
/// A block has been written; the next offset is at [`offset`], and the | ||
/// running checksum is in [`checksum`] | ||
WroteBlock { offset: usize, checksum: u64 }, |
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.
Nit: it looks like we only use a u16
for the checksum, so we could store a u16
and use wrapping_add
(instead of unchecked arithmetic and trusting that we'll never overflow a u64
).
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 don't want to chuck the higher bits of the checksum even though the part only wants the low 16 -- but agreed on the unchecked arithmetic; what about using a wrapping_add
on the checksum?
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.
Yeah, sounds good
BackingOff(u8), | ||
UpdateFailed, | ||
UpdateFailedState(Option<UpdateState>), | ||
UpdateFailure(Mwocp68Error), |
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.
Perhaps we ought to put a #[count(skip)]
here to count the error variants?
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.
Slightly confused; do you mean to add a #[count(children)]
to the members?
No description provided.