516e22fe | 01-Feb-2025 |
Patrick Williams <patrick@stwcx.xyz> |
meson: reformat with meson formatter
Apply the `meson format` results.
Change-Id: Ie0fb147f556c18eb226736dd9b688afba5636a9b Signed-off-by: Patrick Williams <patrick@stwcx.xyz> |
5ace9fb7 | 07-Jan-2025 |
Faisal Awada <faisal@us.ibm.com> |
psutils: Add necessary firmware update functions
doUpdate: Adds the main logic for orchestrating the PSU firmware update process, including ISP setup, firmware download, and verification.
performI2
psutils: Add necessary firmware update functions
doUpdate: Adds the main logic for orchestrating the PSU firmware update process, including ISP setup, firmware download, and verification.
performI2cWriteReadWithRetries: Introduces functionality to perform I2C write-read operations with configurable retries, and error handling for robustness.
performI2cReadWrite: Provides the implementation for direct I2C write-read operations with a customizable delay to ensure timing requirements are met.
downloadPsuFirmware: Implements the functionality to read and process PSU firmware in blocks, ensuring data integrity during transfer.
verifyDownloadFwStatus: Adds a mechanism to validate the success of firmware downloads by checking the PSU's checksum status register.
getClassInstance: Add logic to dynamically instantiate updater class based on PSU model.
Test: Placed latest firmware and MANIFEST files in "/usr/share/obmc/51E9" then retrieved the current PSU FW level. Ran "psutils" on the command line as follow: /usr/bin/psutils --update /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1 /usr/share/obmc/51E9
Retrieved the FW level and verified the PSU FW was updated as expected.
Signed-off-by: Faisal Awada <faisal@us.ibm.com> Change-Id: I65d0c015eab0322110e85b954a38590332aaa67a Signed-off-by: Faisal Awada <faisal@us.ibm.com>
show more ...
|
23dee383 | 11-Nov-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
psutils: Move functions from updater to utils
Move common, utility functions from updater.*pp to utils.*pp. This will enable those functions to be used by other command line options in the psutils
psutils: Move functions from updater to utils
Move common, utility functions from updater.*pp to utils.*pp. This will enable those functions to be used by other command line options in the psutils tool.
Modify --get-version and --get-model to use the new utility functions.
Also update --get-version to provide a single getVersion() function that handles the existence of the psu.json file as a low-level implementation detail.
Tested: * Verified all automated tests run successfully * Verified --get-version still works * With psu.json file * Without psu.json file * Verified --get-model still works * With psu.json file * Without psu.json file * Verified --update still gets correct device path, device name, and I2C bus/address from functions that moved to utils.*pp * The complete test plan is available at https://gist.github.com/smccarney/c049e24655d32e22cab9d521d145774a
Change-Id: I51ceca10957dc9a924d0d7516dc29632a6ed82d3 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
14572cf4 | 06-Nov-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
psutils: Move utility functions to utils.*pp
The files named version.hpp and version.cpp implement the --get-version option of the psutils tool.
However, the files also contain some utility functio
psutils: Move utility functions to utils.*pp
The files named version.hpp and version.cpp implement the --get-version option of the psutils tool.
However, the files also contain some utility functions that would be helpful for implementing other command line options, such as --update or the planned new option --get-model.
Move the utility functions into new files named utils.hpp and utils.cpp. The functions will be defined within a namespace named 'utils'.
Tested: * Verified automated testcases ran successfully * Verified --get-version option worked correctly * When using a psu.json file * When using D-Bus information
Change-Id: If902ee4581fce000af37073ac2e7a7b0ade01f78 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
ec61bbd7 | 04-Nov-2024 |
Faisal Awada <faisal@us.ibm.com> |
Utility functions for download firmware
Added set of utility functions to be used within the classes for managing the PSU firmware updates. Here is a breakdown of the key functions:
- getDevicePath
Utility functions for download firmware
Added set of utility functions to be used within the classes for managing the PSU firmware updates. Here is a breakdown of the key functions:
- getDevicePath(): Construct the PSU device path using I2C bus and address.
- getClassInstance(): Determines the appropriate updater class to use based on PSU model number.
- getFWFilenamePath(): Searches a directory for a firmware file matching a specified prefix and file extension (.bin or .hex).
- calculateCRC8(): Computes the CRC-8 checksum for transferred data.
- delay(): Pauses execution for a specified number of milliseconds.
- bigEndianToLittleEndian(): Converts a 32-bit value from big-endian to little-endian.
- validateFWFile(): Checks if a firmware file exists and is non-empty.
- openFirmwareFile(): Opens a firmware file in binary mode, returning a file stream if successful.
- readFirmwareBytes(): Reads specified number of data bytes from a firmware file into a buffer. Return data read or null to the caller.
- usePsuJsonFile(): Wrapper to check the existence of the PSU JSON file.
- Class accessors to private data: getPsuInventoryPath(): Accessor for PSU inventory path. getDevPath(): Accessor for device path. getDevName(): Accessor for device name. getImageDir(): Accessor for image directory. getI2C(): I2C interface accessor.
Tested every function manually:
- getDevicePath() (using busctl): - Validate I2C bus and address values through psuInventoryPath validate expected result - Modified psuInventoryPath to invalid path validate returned invalid path.
- getClassInstance(): - Validate with matching model number the function instantiate appropriate class. - Validate the default class instantiated.
- getFWFilenamePath(): - Validate return of the correct file name in the PSU FW directory - Validate null returns when FW files don't exist
- calculaterCRC8(): - Validate single byte 0x0 result 0x0, single byte 0x01 result 0x07
- delay(): - Verified the task suspend execution.
- bigEndianToLittleEndian(): - Verified input 0x12345678 resulted in 0x78563412
- validateFWFile(): - Validate the existence of the file otherwise an error is logged - Validate the file size is greater than 0 otherwise an error is logged.
- openFirmwareFile(): - Validate ifstream object is returned and was able to read from. - Validate error logged if the file name is null - validate error logged when unable to open the file
- readFirmwareBytes(): - Validate data read from FW file - Validate number of bytes read.
- usePsuJsonFile(): - Added JSON file to simulator and validated true return.
Change-Id: I0b8b24ae7d37724dab608d2c4977c1b42d4e1632 Signed-off-by: Faisal Awada <faisal@us.ibm.com>
show more ...
|
5c6a693e | 29-Nov-2023 |
Patrick Williams <patrick@stwcx.xyz> |
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer retur
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer return true for auto features. Instead, the expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: I37fcb391dcb215a86a60c26f7512f6ccb8312dc4 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
888bebde | 31-May-2023 |
Patrick Williams <patrick@stwcx.xyz> |
meson: add necessary subprojects
Add subprojects for all the direct dependencies of the project such that the project can be built outside of a Yocto SDK on a typical Linux development system.
-
meson: add necessary subprojects
Add subprojects for all the direct dependencies of the project such that the project can be built outside of a Yocto SDK on a typical Linux development system.
- Update the .gitignore to ignore the subproject source directories. - Update the .gitignore to ignore alternative build subdirectory names as is typical with most projects in the openbmc organization. - Add wrap files for direct dependencies, copied from other repositories that already have the same dependencies. - Modify the meson.build dependency for libgpiod so that the C++ bindings are included. - Add many missing dependencies throughout. - Sort all dependencies alphabetically for consistency.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0feb6f0f175e6dba0b00a2c2b666eb0801575734
show more ...
|
dc8e9312 | 14-Feb-2020 |
Brandon Wyman <bjwyman@gmail.com> |
Add OE-SDK option to Meson
Add option to enable oe-sdk which will setup linker arguments to allow for building and running tests with the x86 SDK.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> C
Add OE-SDK option to Meson
Add option to enable oe-sdk which will setup linker arguments to allow for building and running tests with the x86 SDK.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I8279b7d862e29235d2d4eae39405cc35a51b762f
show more ...
|
b1216b96 | 21-Jan-2020 |
Shawn McCarney <shawnmm@us.ibm.com> |
Create libi2c_dev_mock.a to solve linker errors
The i2c::create() function is currently defined in mocked_i2c_interface.hpp. This causes linker errors if that header file is included by multiple .c
Create libi2c_dev_mock.a to solve linker errors
The i2c::create() function is currently defined in mocked_i2c_interface.hpp. This causes linker errors if that header file is included by multiple .cpp files in the same test executable.
Moved i2c::create() to mocked_i2c_interface.cpp so that it is only defined once. Created the static library libi2c_dev_mock.a that contains mocked_i2c_interface.o.
Test executables that need the mock version of i2c::create() should link with libi2c_dev_mock.a.
Normal executables that need the real version of i2c::create() should link with libi2c_dev.a as before. This has not changed.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com> Change-Id: Ic00203c5429c1a2162327905ba547602258c6b0d
show more ...
|
1d103428 | 29-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Add i2c block transaction support
The previous code always uses SMBus block read/write. On some PSU (e.g. FP5280G2's PSU) the I2C block read/write is required, so add that support.
Specificall
i2c: Add i2c block transaction support
The previous code always uses SMBus block read/write. On some PSU (e.g. FP5280G2's PSU) the I2C block read/write is required, so add that support.
Specifically, add a Mode enum class and add the parameter for block read/write to indicate whether SMBus or I2C block read/write is to be called.
Tested: Verify the code works on FP5280G2 with I2C block write.
Note: Currently there is no case for I2C block read, so that function is not tested.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I5f77ffe6900d14f3703dae7241799a7b37c5a726
show more ...
|
34fb8bda | 07-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Implement write function
Implement I2CDevice::write() by invoking i2c_smbus_write_xxx() APIs. The code is referenced from i2c-tools' i2cset.c:
https://github.com/ev3dev/i2c-tools/blob/ev3dev-
i2c: Implement write function
Implement I2CDevice::write() by invoking i2c_smbus_write_xxx() APIs. The code is referenced from i2c-tools' i2cset.c:
https://github.com/ev3dev/i2c-tools/blob/ev3dev-stretch/tools/i2cset.c
Tested: Verify on Witherspoon that it writes the PSU unlock upgrade command and boot flag successfully.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I9fb014c787ef3ebb2f7793a0d012b1d652ef069f
show more ...
|
92e89eb5 | 06-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Implement read function
Implement I2CDevice::read() by invoking i2c_smbus_read_xxx() APIs. The code is referenced from i2c-tools' i2cget.c:
https://github.com/ev3dev/i2c-tools/blob/ev3dev-str
i2c: Implement read function
Implement I2CDevice::read() by invoking i2c_smbus_read_xxx() APIs. The code is referenced from i2c-tools' i2cget.c:
https://github.com/ev3dev/i2c-tools/blob/ev3dev-stretch/tools/i2cget.c
Tested: Verify on Witherspoon that it reads the PSU ppgrade mode status register (1 byte) and CRC16 register (2 bytes) correctly.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I8759b6a35229f81120acf77f08429f7f79458b8b
show more ...
|
7c2fbbb6 | 06-Nov-2019 |
Lei YU <mine260309@gmail.com> |
power-utils: Initially use i2c in updater
Create I2CDevice in updater and invoke read() in doUpdate(), that could be used in future. Use mocked I2CInterface in updater's unit test case.
Tested: Man
power-utils: Initially use i2c in updater
Create I2CDevice in updater and invoke read() in doUpdate(), that could be used in future. Use mocked I2CInterface in updater's unit test case.
Tested: Manually verify on Witherspoon that the i2c device is opened and closed during PSU code update.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ie3d9f0565a2ceb000f489647a58ca967a2ef0c38
show more ...
|
9ab6d750 | 28-Oct-2019 |
Lei YU <mine260309@gmail.com> |
power-utils: Initially add Updater class
The Updater class is used to do PSU code update, initially add it that does unbind/bind driver and set PSU present to false/true during the update.
Tested:
power-utils: Initially add Updater class
The Updater class is used to do PSU code update, initially add it that does unbind/bind driver and set PSU present to false/true during the update.
Tested: Manually verify on Witherspoon that the driver is unbind/bind, and the PSU present property is set to false/true during the PSU update: psutils --update \ /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 \ /tmp/images/xxxxxxxx
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Ic0a9df7687303caeb9a7f21ba00dc33ee76482db
show more ...
|
093b5917 | 22-Oct-2019 |
Lei YU <mine260309@gmail.com> |
power-utils: Add --compare option
This option is to get a latest version from a list of PSU versions.
Due to the --compare option requires a list of strings and only one option is supported at the
power-utils: Add --compare option
This option is to get a latest version from a list of PSU versions.
Due to the --compare option requires a list of strings and only one option is supported at the same time, it's easier to switch to CLI11 to parse the arguments.
Also add --raw option that outputs the text without linefeed.
Tested: Verify both --get-version and --compare works on Witherspoon.
Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: Idec75e3a5699eba8ba587e74824431993fe10c4c
show more ...
|