History log of /openbmc/phosphor-power/tools/power-utils/main.cpp (Results 1 – 11 of 11)
Revision Date Author Comments
# f9b426b4 31-Jan-2025 Faisal Awada <faisal@us.ibm.com>

psutils: Enhance PSU Update retry logic

- Update retry logic to align with IBM chart specifications.
- Add firmware file existence check before starting PSU update process.
- Switched log to lg2 in

psutils: Enhance PSU Update retry logic

- Update retry logic to align with IBM chart specifications.
- Add firmware file existence check before starting PSU update process.
- Switched log to lg2 in the updater for consistency.
- Fixed device intermittent issue during binding device.
- Modified the update flow to proceed even if the device driver is not
available in sysfs.

These changes improve the robustness of the PSU update process and
enhance logging for better debug isolation.

Test:
- Verified the updater does not start if the firmware file is missing.
- Checked some of the logs correctly reflect the changes using lg2
- Confirmed the PSU binds every time after FW update.
- Test PSU update process continue when the device driver not
available in sysfs.

Change-Id: Iaff5eaf9b9f3ee02d109cf3218f9b0614fa2bd92
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 ...


# 0fbc2f6a 05-Nov-2024 Shawn McCarney <shawnmm@us.ibm.com>

psutils: Add --get-model option

Add a --get-model command line option to the psutils tool. This option
obtains the PSU model using information in sysfs.

Supports both methods of obtaining informat

psutils: Add --get-model option

Add a --get-model command line option to the psutils tool. This option
obtains the PSU model using information in sysfs.

Supports both methods of obtaining information about a PSU:
* psu.json file
* D-Bus

Tested:
* Verified --get-version still works
* With psu.json file
* Without psu.json file
* Verified new --get-model property works
* With psu.json file
* Without psu.json file
* Tested all error paths
* See the following gist for the complete test plan:
https://gist.github.com/smccarney/859ffaaa94ce12992af1b24e6c899962

Change-Id: If1be01f4b70ad9d80ce01402c57730990fd2c2ea
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 ...


# 5dce1a74 19-Aug-2024 Faisal Awada <faisal@us.ibm.com>

power-utils: Retrieve Firmware Version from sysfs

Added support to retrieve firmware version from sysfs. This required the
following code additions and modifications:

1 - Locate the target PSU obje

power-utils: Retrieve Firmware Version from sysfs

Added support to retrieve firmware version from sysfs. This required the
following code additions and modifications:

1 - Locate the target PSU object and retrieve 'i2cBus' and 'i2cAddress'.
2 - Obtain PMBus interface access.
3 - Read the firmware version from sysfs.

Tested:
The new code was loaded onto a system, and the firmware version was
successfully read from sysfs. Verified getVersion using psu.json file
did not change.

Change-Id: I791788f45e4d682578efbed33e3832a833644dad
Signed-off-by: Faisal Awada <faisal@us.ibm.com>

show more ...


# 48781aef 10-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: If66f68c96df4baf8dc07abf8729a3cb7657e932d
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# d1bc4cec 13-Dec-2019 Brandon Wyman <bjwyman@gmail.com>

Update .clang-format to latest version from docs

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: Ie6e7f43e7554429704dca86b21320c90aed18791


# d19df255 25-Oct-2019 Lei YU <mine260309@gmail.com>

power-utils: Initially add --update option

This option is used to update the PSU firmware, usage:

psutils --update <psu-inventory-path> <image-dir>

Signed-off-by: Lei YU <mine260309@gmail.com>
Ch

power-utils: Initially add --update option

This option is used to update the PSU firmware, usage:

psutils --update <psu-inventory-path> <image-dir>

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I3958e360f04bb0ace9eea41d9f81e4533432701c

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


# 0bf1b782 29-Aug-2019 Lei YU <mine260309@gmail.com>

Add power-utils

The power-utils is added to support psu code manager as vendor-specifc
tool.
In this commit, the util returns the PSU version based on the PSU
inventory path, where the inventory pat

Add power-utils

The power-utils is added to support psu code manager as vendor-specifc
tool.
In this commit, the util returns the PSU version based on the PSU
inventory path, where the inventory path are mapped to the PSU sysfs
device directory based on a json config.

Tested: Verify the version is returned correctly on Witherspoon:
$ ./psutils --getversion \
/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
01100110
And it returns non-zero when it fails to get the version without
throwing exception.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Ib60f3aa50ce581d55fe4cd62642f30398e25be83

show more ...