History log of /openbmc/phosphor-power/ (Results 1 – 25 of 842)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
57fb664c21-Feb-2025 Faisal Awada <faisal@us.ibm.com>

psutil: Add PSU Event Log Reporting Methods

This commit introduces new methods in the Updater class to log errors
and create Platform Event Logs for PSU failures and I2C-related
issues. The followin

psutil: Add PSU Event Log Reporting Methods

This commit introduces new methods in the Updater class to log errors
and create Platform Event Logs for PSU failures and I2C-related
issues. The following methods are added:

- createServiceableEventLog:
Creates a serviceable Platform Event Log using
xyz.openbmc_project.Logging.Create. Takes an error name, severity, and
additional data as parameters. Retrieves the logging service and calls
the D-Bus method to create the log.

- getI2CAdditionalData:
Retrieves I2C-related callout data, including I2C bus ID, address, and
error number. Formats the ID and address as hexadecimal strings and
returns them as a map.

- callOutI2CEventLog:
Reports a Event Log for I2C failures. Collects PSU inventory path,
priority, and I2C-specific callout data. Merges any additional
provided data and creates a Event Log.

- callOutPsuEventLog:
Reports a Event Log for general PSU failures. Includes PSU inventory
callout information and priority.

- callOutSWEventLog:
Reports Event Log for software-related PSU file issues.Logs errors
using predefined PSU firmware file issue messages. These changes
improve fault logging and troubleshooting capabilities in PSU
management by ensuring proper logging and event recording.

- callOutGoodEventLog:
Reports a successful PSU firmware update Event Log along with the
firmware level.

- Added accessor functions to provide control over Event logging,
allowing:
- Enabling/disabling Event logging at runtime.
- Tracking if Event Log has been logged in the current session.

Accessor functions:
- enableEventLogging()
- disableEventLogging()
- isEventLogEnabled()
- enableEventLoggedThisSession()
- isEventLoggedThisSession()

Test:
Verified each function correctly generates Event Log in openBmc. The
test was conducted by writing a standalone test program that:
1 - Calls createServiceableEventLog() with various error names,
severity levels, and additionalData then check the generated Event Log.
2 - Calls getI2CAdditionalData() and verifies the returned data
contains the correct I2C bus ID, Address and error number.
3 - Calls callOutI2CEventLog() with simulated I2C error and checks the
generated Event Log.
4 - Calls callOutPsuEventLog() and callOutSWEventLog() with different
input data and verifies the correct error messages are logged.

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

show more ...

cb36acd018-Feb-2025 Shawn McCarney <shawnmm@us.ibm.com>

pseq: Initial support for Balcones

Implement initial power sequencing support for the Balcones system.
Create the JSON file that defines the rails and how to isolate a pgood
failure.

Tested:
* Buil

pseq: Initial support for Balcones

Implement initial power sequencing support for the Balcones system.
Create the JSON file that defines the rails and how to isolate a pgood
failure.

Tested:
* Built BMC image
* Loaded image in simulation
* Verified Balcones.json file existed in
/usr/share/phosphor-power-sequencer directory

Change-Id: I6ac93a097275a6d95065a49d5dfc880738601c50
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

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

516e22fe01-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>

92261f8801-Feb-2025 Patrick Williams <patrick@stwcx.xyz>

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

Change-Id: I8bc99b559079b8454b11bff0be5ddfb6e55e71ba
Signed-off-by: Patrick Williams <p

clang-format: update latest spec and reformat

Copy the latest format file from the docs repository and apply.

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

show more ...

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

757ad6a915-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Replace NULL with nullptr

Replaced all instances of NULL with nullptr to improve type safety
and clarity, as nullptr is the modern C++ standard for null pointers.

Tested: Build verified

clang-tidy: Replace NULL with nullptr

Replaced all instances of NULL with nullptr to improve type safety
and clarity, as nullptr is the modern C++ standard for null pointers.

Tested: Build verified

Change-Id: I426e95bee023cc673d936a0705f233becab23100
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

28a2ca4b13-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Remove unused private field

The following errors were reported during clang-tidy enablement due
to unused private field.

'''
tools/i2c/i2c.hpp:43:13: error: private field 'busId' is no

clang-tidy: Remove unused private field

The following errors were reported during clang-tidy enablement due
to unused private field.

'''
tools/i2c/i2c.hpp:43:13: error: private field 'busId' is not used [-Werror
'''

The fix involves removing these unused private field 'busId'.

Tested: Build and unit testing verified.

Change-Id: I1fac353707e250ff661d4f42abdb1a2e9bb3a689
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

5ed2eb4c07-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Remove unused lambda captures

The following errors were reported during clang-tidy enablement due
to unused lambda captures.

'''
cold-redundancy/cold_redundancy.cpp:50:23: error: lambda

clang-tidy: Remove unused lambda captures

The following errors were reported during clang-tidy enablement due
to unused lambda captures.

'''
cold-redundancy/cold_redundancy.cpp:50:23: error: lambda capture 'objectServer' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:59:44: error: lambda capture 'io' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:59:49: error: lambda capture 'objectServer' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:50:18: error: lambda capture 'io' is not used [-Werror
'''

The fix involves removing these unused lambda captures.

Tested: Build and unit testing verified.

Change-Id: If18b25f6ab09f3c369899777ba313400604a24ec
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

2cad31a418-Dec-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-19

clang-format-19 isn't compatible with the clang-format-18 output, so we
need to reformat the code with the latest version. A few parameters
in clang-tidy have b

clang-format: re-format for clang-19

clang-format-19 isn't compatible with the clang-format-18 output, so we
need to reformat the code with the latest version. A few parameters
in clang-tidy have been deprecated, so adjust the style file
accordingly.

See Ie2f6eb3b043f2d655c9df806815afd7971fd0947 for updated style.
See I88192b41ab7a95599a90915013579608af7bc56f for clang-19 enablement.

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

show more ...

f0c0c47b07-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Suppress unused variable warnings

The following errors were reported during clang-tidy enablement due to
multiple unused variables. This temporary fix suppresses the warnings
using a pra

clang-tidy: Suppress unused variable warnings

The following errors were reported during clang-tidy enablement due to
multiple unused variables. This temporary fix suppresses the warnings
using a pragma approach until a permanent solution is
implemented.

Changes:
- Commented out unused variables to suppress the -Wunused-variable
warnings.

'''
../tools/power-utils/aei_updater.cpp:36:15: error: unused variable 'MEM_STRETCH_DELAY' [-Werror
../tools/power-utils/aei_updater.cpp:40:19: error: unused variable 'I2C_SMBUS_BLOCK_MAX' [-Werror
../tools/power-utils/aei_updater.cpp:41:19: error: unused variable 'FW_READ_BLOCK_SIZE' [-Werror
../tools/power-utils/aei_updater.cpp:43:19: error: unused variable 'READ_SEQ_ST_CML_SIZE' [-Werror
../tools/power-utils/aei_updater.cpp:45:19: error: unused variable 'START_SEQUENCE_INDEX' [-Werror
../tools/power-utils/aei_updater.cpp:46:19: error: unused variable 'STATUS_CML_INDEX' [-Werror
../tools/power-utils/aei_updater.cpp:63:19: error: unused variable 'B_CHKSUM_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:64:19: error: unused variable 'B_CHKSUM_SUCCESS' [-Werror
../tools/power-utils/aei_updater.cpp:66:19: error: unused variable 'B_MEM_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:67:19: error: unused variable 'B_ALIGN_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:68:19: error: unused variable 'B_KEY_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:69:19: error: unused variable 'B_START_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:70:19: error: unused variable 'B_IMG_MISSMATCH_ERR' [-Werror
../tools/power-utils/aei_updater.cpp:73:19: error: unused variable 'B_ISP_MODE_CHKSUM_GOOD' [-Werror
../tools/power-utils/aei_updater.cpp:74:19: error: unused variable 'B_PRGM_BUSY' [-Werror
../tools/power-utils/aei_updater.cpp:35:15: error: unused variable 'MEM_WRITE_DELAY' [-Werror
'''

Tested: Build and unit testing verified.

Change-Id: Idbe50bfc465f12f0cf4fd7e382a6f04879f08dba
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

f9886b9f07-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Suppress pessimizing-move warning

This commit introduces a temporary fix to suppress the
"moving a temporary object prevents copy elision" warning
using pragma directives. This is necess

clang-tidy: Suppress pessimizing-move warning

This commit introduces a temporary fix to suppress the
"moving a temporary object prevents copy elision" warning
using pragma directives. This is necessary to support the
ongoing Clang-Tidy migration.

'''
power-supply/record_manager.cpp:83:28:
error: moving a temporary object prevents copy elision [-Werror
1m/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:552:2:
error: 'result_of<(lambda at ../power-supply/power_supply.cpp:50:31) &()>' is deprecated: use 'std::invoke_result' instead [-Werror
1m/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/functional:552:2:
error: 'result_of<(lambda at ../power-supply/power_supply.cpp:62:31) &()>' is deprecated: use 'std::invoke_result' instead [-Werror
'''

Changes:
- Added pragma directives to suppress the -Wpessimizing-move warning
in specific code sections.

Tested: Build and unit testing verified.

Change-Id: I464674a5da5992368627a6b2f54fabc65c402aea
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

e1a0759506-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Suppress unused private field warning

Addressed warnings reported during clang-tidy enablement by marking
unused private fields with the [[maybe_unused]] keyword in multiple
instances. T

clang-tidy: Suppress unused private field warning

Addressed warnings reported during clang-tidy enablement by marking
unused private fields with the [[maybe_unused]] keyword in multiple
instances. This temporarily suppresses the warnings until a permanent
solution is implemented.

'''
./phosphor-regulators/src/manager.hpp:199:31: error: private field 'eventLoop' is not used [-Werror
./phosphor-regulators/src/dbus_sensor.hpp:316:23: error: private field 'bus' is not used [-Werror
'''

Tested: Verified build and unit testing.

Change-Id: I5c4424deaee8440c619f8d541ee6203c4d9d738b
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

b59b1fa206-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Suppress move assignment warning

The following error was reported during clang-tidy enablement due to
the explicitly defaulted move assignment operator being implicitly
deleted. This tem

clang-tidy: Suppress move assignment warning

The following error was reported during clang-tidy enablement due to
the explicitly defaulted move assignment operator being implicitly
deleted. This temporary fix suppresses the warning using Meson build
configuration until a permanent solution is implemented.

'''
phosphor-regulators/src/config_file_parser_error.hpp:39:28:
error: explicitly defaulted move assignment operator is implicitly deleted [-Werro
phosphor-regulators/src/pmbus_error.hpp:38:17:
error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
phosphor-regulators/src/write_verification_error.hpp:41:29:
error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
pmbus.hpp:216:12: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
gpio.hpp:53:11: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
pmbus.hpp:214:12: error: explicitly defaulted copy assignment operator is implicitly deleted [-Werror
device.hpp:25:13: error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
phosphor-power-sequencer/src/config_file_parser_error.hpp:37:28:
error: explicitly defaulted copy assignment operator is implicitly deleted [-Werror
power-sequencer/mihawk-cpld.hpp:32:17:
error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
power-sequencer/ucd90160.hpp:38:15:
error: explicitly defaulted move assignment operator is implicitly deleted [-Werror
'''

Tested: Verified build and unit testing.

Change-Id: I123e7ba0fdcd7d3e8f74c8e333a3294046a152d7
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

12c4a42006-Dec-2024 Jayanth Othayoth <ojayanth@gmail.com>

clang-tidy: Fix override errors

The following errors were reported during the clang-tidy enablement
build due to overridden functions not being marked with the override
keyword. The proposed fix is

clang-tidy: Fix override errors

The following errors were reported during the clang-tidy enablement
build due to overridden functions not being marked with the override
keyword. The proposed fix is to add the override keyword where it
was missing.

'''
1m../tools/i2c/i2c.hpp:176:10:
error: 'open' overrides a member function but is not marked 'override' [-Werror
1m../tools/i2c/i2c.hpp:179:10:
error: 'isOpen' overrides a member function but is not marked 'override' [-Werror
1m../tools/i2c/i2c.hpp:185:10:
error: 'close' overrides a member function but is not marked 'override' [-Werror
'''

Tested: Verified Build and unit testing.

Change-Id: Iad01481761c6a4339e051c183c3dd238baf19d70
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>

show more ...

8dca507523-Nov-2024 Faisal Awada <faisal@us.ibm.com>

psutils: Add new functions to AEI Updater class

The following functions handle the critical stages of firmware update,
including validation, reading, preparation, and reboot verification.
Error han

psutils: Add new functions to AEI Updater class

The following functions handle the critical stages of firmware update,
including validation, reading, preparation, and reboot verification.
Error handling and logging are incorporated to isolate issues during the
update.

getFirmwarePath()
Retrieves the firmware file path from the image directory. Uses
getFWFilenamePath to fetch the path. Logs an error if the firmware path
is not found and returns an empty string otherwise returns firmware
path.

isFirmwareFileValid()
Validates the firmware file at the given path using validateFWFile.
Ensure the firmware file exists and meets requirements before proceeding
with the update. Logs an error if validation fails.

openFirmwareFile()
Opens the firmware file at the specified path for reading in binary
mode. Logs an error if the file cannot be opened.

readFirmwareBlock()
Reads a block of data from the firmware file.Uses readFirmwareBytes to
read the specified number of bytes.

prepareCommandBlock()
Prepares a command block for writing firmware data to the PSU. Adds
metadata, data, and a CRC8 checksum. Packages firmware data in a format
suitable for I2C transmission.

ispReboot()
Sends a reboot command to the status register to apply new firmware.

ispReadRebootStatus()
Reads the reboot status from ISP, returns true for success otherwise
false.

Tested:
- Validated that the firmware path retrieves the correct file.
- A validation error is logged when the file is empty or path is
incorrect.
- Removed read permission on the firmware file and verified that an
error was logged.
- Verify the block of data read as specified in the specification.
- Printed the command block and verified that the command and data are
ready to be sent to the PSU via I2C.
- Downloaded the firmware and verified that the command block, ISP
reboot and reboot status are working as expected.

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

show more ...

5a582d3c15-Nov-2024 Faisal Awada <faisal@us.ibm.com>

psutils: Partial AEI Updater class

The AeiUpdater class within the aeiUpdater namespace, responsible for
updating AEI PSU firmware via I2C communication. The code focuses on
executing various stage

psutils: Partial AEI Updater class

The AeiUpdater class within the aeiUpdater namespace, responsible for
updating AEI PSU firmware via I2C communication. The code focuses on
executing various stages of the firmware update process, ensuring each
step performed and validated correctly. The following partial functions
of the key component of the class:

doUpdate()
This method initiates the firmware update process. It checks and sets
the ISP (In-System Programming) mode using writeIspKey(),
writeIspMode(), and writeIspStatusReset().

writeIspKey()
Unlocks the ISP by writing a specific key to the KEY_REGISTER. Handles
exceptions for any I2C communication errors and logs the failure.

writeIspMode()
Sends a command to enter ISP mode and checks the status register.
Retries on failure, with a maximum retry limit. Checks the status
register to confirm the mode has been set. Logs any I2C errors
encountered.

writeIspStatusReset()
Resets ISP status register, clearing any existing status flags. Verifies
the reset by reading the status register, retrying as needed. Logs any
I2C errors encountered.

Test:
Tested the function listed in the class on a system with AEI PSU:

- Validated the PSU ISP key was accepted and no error logged.
- Validated an error was logged when I used wrong key.
- Validated the PSU entered to ISP mode by reading back status register
and confirmed the bit is set.
- Validated the PSU status reset by reading the back status register and
confirmed the bit is set.

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

show more ...

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

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

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

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

37c2612b24-Oct-2024 Shawn McCarney <shawnmm@us.ibm.com>

psutils: Do not pad PSU version with blanks

When `psutils --get-version <inventory_path>` is run, it returns the
firmware version for the specified PSU inventory path.

If no psu.json file is found,

psutils: Do not pad PSU version with blanks

When `psutils --get-version <inventory_path>` is run, it returns the
firmware version for the specified PSU inventory path.

If no psu.json file is found, the PSU I2C bus and address are obtained
from D-Bus. The PSU version is then obtained from a file in sysfs.

The contents of the sysfs file are currently treated as VPD. Invalid
characters are replaced with spaces, and the value is padded with spaces
if needed to reach an expected VPD length.

If an error occurs trying to read the sysfs file, the version is
initially set to "". However, since it is being treated as VPD it is
later padded with blanks. Since the version is not an empty string, it
is treated as valid by psutils and the PSU code update application.
This causes subsequent code update issues.

Modify psutils so that the contents of the sysfs file are treated as a
simple string. If an error occurs, set the version to "". This will
cause psutils and the PSU code update application to correctly conclude
that an error occurred and the version is not valid.

Tested:
* psutils --get-version
* psu.json file exists
* Test where getting the version works
* Verify file contents are obtained
* Verify psutils prints out the version
* Verify psutils exits with a return code of 0
* Test where getting the version fails
* Verify exception is written to the journal
* Verify psutils prints out an empty string
* Verify psutils exits with a return code of 1
* psu.json file does not exist; PSU information is obtained from D-Bus
* Test where getting the version works
* Verify file contents are obtained
* Verify psutils prints out the version
* Verify psutils exits with a return code of 0
* Test where getting the version fails
* Verify exception is written to the journal
* Verify psutils prints out an empty string
* Verify psutils exits with a return code of 1

Change-Id: I131ba1b73f5ee96606bcfe86943da258196eca62
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

a3ff7e7115-Oct-2024 Shawn McCarney <shawnmm@us.ibm.com>

I2CInterface: Add process call methods

Add C++ methods to perform the following SMBus commands:
* Process Call
* Block Write-Block Read Process Call

For Block Write-Block Read Process Call, impleme

I2CInterface: Add process call methods

Add C++ methods to perform the following SMBus commands:
* Process Call
* Block Write-Block Read Process Call

For Block Write-Block Read Process Call, implement support for writes up
to 255 bytes. SMBus 2.0 supported a maximum of 32 bytes, and SMBus 3.0
supports a maximum of 255 bytes. The current Linux SMBus function only
supports 32 byte writes. Provide an alternate implementation using the
lower level I2C_RDWR ioctl() to support up to 255 bytes.

Tested:
* Verified Process Call worked correctly
* Verified Block Write-Block Read Process Call worked correctly
* When using SMBus function
* When using I2C_RDWR ioctl()
* Tested error cases
* See complete test plan at
https://gist.github.com/smccarney/96eda4c7c11fe4f89e4491c768f76047

Change-Id: Icc1ba840741b1e26a50fe32bad8b2181a01dbb24
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>

show more ...

df2f4cb803-Sep-2024 Patrick Williams <patrick@stwcx.xyz>

meson: switch code dependency to libsystemd

For a while now systemd has packaged a separate `libsystemd`. For
meson dependency, `systemd` should be used when looking for systemd
service file paths

meson: switch code dependency to libsystemd

For a while now systemd has packaged a separate `libsystemd`. For
meson dependency, `systemd` should be used when looking for systemd
service file paths and `libsystemd` should be used for `sd_*` functions.

Update the dependency accordingly.

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

show more ...

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

12345678910>>...34