-
Notifications
You must be signed in to change notification settings - Fork 97
gateway: add sp_component_vpd_get
#11273
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1bf7e6b
gateway: update MGS, a whole bunch of barcode stuff
hawkw a0d289b
gateway: formatting, parsing roundtrip tests, etc
hawkw be1b6a6
wip
hawkw 8857f1e
draw the rest of the owl
hawkw 0c3abe2
fixy
hawkw 9cef4d0
hakari
hawkw 89f8e6a
you have to also update faux-mgs
hawkw b33b354
Merge branch 'main' into eliza/mgs-vpd
hawkw d4dc8e7
post rebase unbreaking of things
hawkw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| pub use gateway_types_versions::latest::component_vpd::*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 152 additions & 0 deletions
152
gateway-types/versions/src/component_vpd/component_vpd.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| use schemars::JsonSchema; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| #[serde(tag = "type", rename_all = "snake_case")] | ||
| #[allow(clippy::large_enum_variant)] | ||
| pub enum ComponentVpd { | ||
| OxideBarcode(OxideBarcode), | ||
| Mpn1Barcode(Mpn1Barcode), | ||
| SledFanTray(SledFanTray), | ||
| Tmp11x(Tmp11x), | ||
| Pmbus(PmbusDevice), | ||
| } | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| pub struct OxideBarcode { | ||
| pub part_number: String, | ||
| pub revision: u32, | ||
| pub serial_number: String, | ||
| } | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| pub struct Mpn1Barcode { | ||
| pub manufacturer: String, | ||
| pub part_number: String, | ||
| pub revision: String, | ||
| pub serial_number: String, | ||
| } | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| #[serde(tag = "type", rename_all = "snake_case")] | ||
| pub enum Barcode { | ||
| Oxide(OxideBarcode), | ||
| Mpn1(Mpn1Barcode), | ||
| } | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| pub struct SledFanTray { | ||
| pub identity: OxideBarcode, | ||
| pub vpd_board_identity: OxideBarcode, | ||
| pub fan0: Barcode, | ||
| pub fan1: Barcode, | ||
| pub fan2: Barcode, | ||
| } | ||
|
|
||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| pub struct Tmp11x { | ||
| pub device_id: u16, | ||
| pub eeprom1: u16, | ||
| pub eeprom2: u16, | ||
| pub eeprom3: u16, | ||
| } | ||
|
|
||
| /// PMBus vital product data (VPD) read from a PMBus device. | ||
| /// | ||
| /// If the device does not support a particular VPD command, the field in this | ||
| /// struct corresponding to that command will be `None`. Otherwise, the value | ||
| /// contains the exact bytes returned by the device, including an empty value or | ||
| /// any NUL bytes returned by the device. | ||
| #[derive( | ||
| Debug, | ||
| Clone, | ||
| PartialEq, | ||
| Eq, | ||
| PartialOrd, | ||
| Ord, | ||
| Deserialize, | ||
| Serialize, | ||
| JsonSchema, | ||
| )] | ||
| pub struct PmbusDevice { | ||
| /// `MFR_ID` (PMBus command 0x99). | ||
| pub mfr_id: Option<Vec<u8>>, | ||
| /// `MFR_MODEL` (PMBus command 0x9A). | ||
| pub mfr_model: Option<Vec<u8>>, | ||
| /// `MFR_REVISION` (PMBus command 0x9B). | ||
| pub mfr_revision: Option<Vec<u8>>, | ||
| /// `MFR_LOCATION` (PMBus command 0x9C). | ||
| pub mfr_location: Option<Vec<u8>>, | ||
| /// `MFR_DATE` (PMBus command 0x9D). | ||
| pub mfr_date: Option<Vec<u8>>, | ||
| /// `MFR_SERIAL` (PMBus command 0x9E). | ||
| pub mfr_serial: Option<Vec<u8>>, | ||
| /// `IC_DEVICE_ID` (PMBus command 0xAD). | ||
| pub ic_device_id: Option<Vec<u8>>, | ||
| /// `IC_DEVICE_REV` (PMBus command 0xAE). | ||
| pub ic_device_rev: Option<Vec<u8>>, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
|
||
| //! Version `COMPONENT_VPD` of the Gateway API. | ||
| //! | ||
| //! This version adds APIs for reading vital product data from an SP component. | ||
|
|
||
| pub mod component_vpd; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Entirely for my own curiosity - who/what is going to end up parsing the contents of these fields?
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.
The problem with these is that their contents vary a lot based on the device. In the immediate future, my plans are mainly to use the PMBus VPD fields for the MWOCP68/MWOCP67 rectifiers in the gateway hardware-component metrics for the power shelf, and use them to start inventorying the PSUs (see #11047). The PSUs are currently the only field-replaceable units whose identity is determined via these PMBus commands, so I think we won't immediately be reading them for other devices, but we may eventually.