Skip to content
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

Merged
merged 13 commits into from
Nov 25, 2024
Merged

add support for PSU firmware update #1934

merged 13 commits into from
Nov 25, 2024

Conversation

bcantrill
Copy link
Collaborator

No description provided.

Copy link
Member

@hawkw hawkw left a 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.

drv/i2c-devices/src/mwocp68.rs Show resolved Hide resolved
drv/i2c-devices/src/mwocp68.rs Show resolved Hide resolved
drv/i2c-devices/src/mwocp68.rs Outdated Show resolved Hide resolved
drv/i2c-devices/src/mwocp68.rs Outdated Show resolved Hide resolved
drv/psc-psu-update/src/main.rs Show resolved Hide resolved
drv/i2c-devices/src/mwocp68.rs Show resolved Hide resolved
@bcantrill bcantrill self-assigned this Nov 25, 2024
Comment on lines +36 to +43
//
// 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.
//
Copy link
Collaborator

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)

Copy link
Collaborator Author

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 },
Copy link
Collaborator

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).

Copy link
Collaborator Author

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?

Copy link
Collaborator

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),
Copy link
Member

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?

Copy link
Collaborator Author

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?

drv/psc-psu-update/src/main.rs Show resolved Hide resolved
drv/psc-psu-update/src/main.rs Show resolved Hide resolved
@bcantrill bcantrill enabled auto-merge (squash) November 25, 2024 21:29
@bcantrill bcantrill merged commit 3319357 into master Nov 25, 2024
125 checks passed
@bcantrill bcantrill deleted the mwocp branch November 25, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants