a588eafe | 20-Sep-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Throw if gpio line is not found
The find_line() API does not throw if errno is ENOENT and instead returns an empty line: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindin
psu-ng: Throw if gpio line is not found
The find_line() API does not throw if errno is ENOENT and instead returns an empty line: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindings/cxx/chip.cpp?h=v1.6.x#n131
Add a throw if the line is empty to signal the caller that an error occurred, otherwise the caller won't know that the line is empty until a read() request returns an error, in which case is unknown if the read() failed because the line didn't exist or because of some other error.
This change also serves as a test to determine if a gpio exists. For gpios that are not expected to exist on all systems, it can be determined at the time the gpio is constructed and avoid making read() calls to it that would be expected to fail.
Tested: Tried to initialize a non-existent gpio and verified an exception was thrown: Oct 04 14:30:10 rain111bmc phosphor-psu-monitor[1744]: Failed to find line: Line does not exist: test-exception Oct 04 14:30:10 rain111bmc phosphor-psu-monitor[1744]: Line does not exist: test-exception Oct 04 14:30:10 rain111bmc systemd[1]: phosphor-psu-monitor.service: Main process exited, code=exited, status=254/n/a Oct 04 14:30:10 rain111bmc systemd[1]: phosphor-psu-monitor.service: Failed with result 'exit-code'.
Change-Id: Ic48eec566f5fb6e15ea8f553744cbd33dc49ec69 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
0c9a33d6 | 13-Sep-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
clang updates
The openbmc CI was recently updated to clang-12 which requires some formatting updates to the code: https://github.com/openbmc/openbmc-build-scripts/commit/4569bf49daaebff06be048242690
clang updates
The openbmc CI was recently updated to clang-12 which requires some formatting updates to the code: https://github.com/openbmc/openbmc-build-scripts/commit/4569bf49daaebff06be0482426908bb5497fad08
Make those updates and refresh the clang-format file with the one from docs: https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format
Change-Id: Ieb3626526373a053ec84431e7560003f229f338d Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
69f10ad0 | 02-Sep-2021 |
Patrick Williams <patrick@stwcx.xyz> |
exception: switch to public sdbus exception
SdBusError was intended to be a private error type inside sdbusplus. Switch all catch locations to use the general sdbusplus::exception type.
Signed-off-
exception: switch to public sdbus exception
SdBusError was intended to be a private error type inside sdbusplus. Switch all catch locations to use the general sdbusplus::exception type.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I4c07309c31740d17e90aa7831a6ac469643333ac
show more ...
|
ecbecbc8 | 31-Aug-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Do not create duplicate power supplies
When the entity-manager is restarted, the interfaces watched for the power supply data will get re-added. If the data on the added interfaces matches a
psu-ng: Do not create duplicate power supplies
When the entity-manager is restarted, the interfaces watched for the power supply data will get re-added. If the data on the added interfaces matches an already existing power supply, skip creating the power supply object.
Change-Id: Iccd56d842e808dcd5c192d5cc2dc1947fbdb03f6 Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
show more ...
|
d8b8cb15 | 15-Jul-2021 |
B. J. Wyman <bjwyman@gmail.com> |
psu-ng: Add accessor to get GPIO line name
Update the utilities to give the line name for a GPIO.
Add accessor to power supply class to get the name of the presence GPIO line.
Signed-off-by: B. J.
psu-ng: Add accessor to get GPIO line name
Update the utilities to give the line name for a GPIO.
Add accessor to power supply class to get the name of the presence GPIO line.
Signed-off-by: B. J. Wyman <bjwyman@gmail.com> Change-Id: Ic10fd81c6de024dbcb27088c5935ac9947af9465
show more ...
|
4175ffb7 | 02-Aug-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Read and validate input voltage
Read the input voltage reported by pmbus for each PSU. Determine the actual voltage based on predefined thresholds. Then validate the actual voltage is suppor
psu-ng: Read and validate input voltage
Read the input voltage reported by pmbus for each PSU. Determine the actual voltage based on predefined thresholds. Then validate the actual voltage is supported for the PSU model.
Tested: Verified in Rainier 2U that the 2 present PSUs had a pmbus voltage value of 208000 mV, which is then translated to a 220V PSU, and that value is validated against the supported configuration. Verified the additional data strings by printing them with debug statements: Aug 05 18:50:15 p10bmc phosphor-psu-monitor[3615]: ACTUAL_VOLTAGE: 208.000000 Aug 05 18:50:15 p10bmc phosphor-psu-monitor[3615]: CALLOUT_INVENTORY_PATH: /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0 Aug 05 18:50:15 p10bmc phosphor-psu-monitor[3615]: EXPECTED_VOLTAGE: 220
Change-Id: Ic8c3b567c8265e90bce420f98ac6f1e131ff713b Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
93f7ee9f | 15-Jul-2021 |
B. J. Wyman <bjwyman@gmail.com> |
psu-ng: Remove unnecessary debug trace
The "release() line" trace was added as a DEBUG journal trace. It was thought that this could be useful in debugging situations, but some recent testing with t
psu-ng: Remove unnecessary debug trace
The "release() line" trace was added as a DEBUG journal trace. It was thought that this could be useful in debugging situations, but some recent testing with that enabled shows that this is not the case.
With the power supply daemon monitoring the GPIO presence lines once a second, and four possible lines to monitor, the tracing is QUITE excessive.
Signed-off-by: B. J. Wyman <bjwyman@gmail.com> Change-Id: Ib6ae27e5aff108e17cd7ebc8215126bf1a8e7d5e
show more ...
|
f2ba146b | 24-Jun-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Do not log error for expected missing PSUs
Some systems like Rainier 2U support less PSUs than the number of PSU slots. Therefore, check the expected number of PSUs in the supported configur
psu-ng: Do not log error for expected missing PSUs
Some systems like Rainier 2U support less PSUs than the number of PSU slots. Therefore, check the expected number of PSUs in the supported configuration and log an error for missing PSUs if the total number does not match. Continue to set the Fault for the PSU that's not present to mark it as already checked, to avoid creating multiple errors.
Tested: Verified on Rainier 2U that no error log was created for missing PSU.
Change-Id: Ie9a512b2e10a9a63a2007b0559a1b7368828e351 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
4d9aaf91 | 30-Jun-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Move PSU validation logic to its own function
Move the PSU validation logic into a separate function so that it can be called from additional places, such as the analyze() function, which wi
psu-ng: Move PSU validation logic to its own function
Move the PSU validation logic into a separate function so that it can be called from additional places, such as the analyze() function, which will check if the required PSUs are present before logging an error for missing PSUs. Also use std::count_if to get the number of present PSUs to make the logic cleaner.
The only difference with the new function is that there's no difference between a failure due to mismatched model names and failure due to missing PSUs. The original logic would set the validation flag on mismatched model names to not run again. The new scenario is that if EM starts after psu-monitor and there is one or more PSUs with a mismatched model name, then the same error will be created every time there's a new EM PSU interface added.
Tested: Verified with debug logs that the validation logic remained the same after the change.
Change-Id: Iced7afc34f566be1ce479c03639b780ecd7fdd53 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
681b2a36 | 20-Apr-2021 |
B. J. Wyman <bjwyman@gmail.com> |
psu-ng: Add in ability to get presence via GPIO
The device tree and entity-manager (D-Bus) properties have the power supply GPIO presence lines named, so we can use those GPIO line names to find the
psu-ng: Add in ability to get presence via GPIO
The device tree and entity-manager (D-Bus) properties have the power supply GPIO presence lines named, so we can use those GPIO line names to find the GPIO device to read for determining power supply presence.
Some systems have the power supply presence lines in a gpio-keys section (notably IBM Rainier). To facilitate continued function while running with a device tree that has not removed those device tree entries, allow for a fallback to the old inventory D-Bus propertiesChanged or interfaceAdded matches for presence.
Change-Id: I5002aa62e5b460463cc26328c889a3786b467a3c Signed-off-by: B. J. Wyman <bjwyman@gmail.com>
show more ...
|
70e7f939 | 10-Jun-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Validate supported model and count
Check that the power supply model and number match the expected combination specified in the supported configurations. Log an error if no match is found.
psu-ng: Validate supported model and count
Check that the power supply model and number match the expected combination specified in the supported configurations. Log an error if no match is found.
Tested: Verified an error log is created if there was a mismatch in Rainier 2U.
Change-Id: I2c81fac8f0bdb7f1205a3f81104b0ba419f1192f Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
8f16fb5e | 31-Mar-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Validate configuration during power on
Create a function to validate the power supply configuration. Initially, check that all power supplies are of the same model, and if not, create an err
psu-ng: Validate configuration during power on
Create a function to validate the power supply configuration. Initially, check that all power supplies are of the same model, and if not, create an error log. This function will later add checks for total number of power supplies and expected input voltage.
The validation is run on every power on. To cover the case where entity manager has not run yet on power, trigger the validation on interfaces added signal. Use a boolean flag to determine if the validation needs to be run to avoid running it multiple times.
Tested: Verified the validation was successful on Rainier. Verified the error log data: $ curl -k -H "X-Auth-Token: $token" \ https://${bmc}/xyz/openbmc_project/logging/entry/2 { "data": { "AdditionalData": [ "ACTUAL_MODEL=51E8", "CALLOUT_INVENTORY_PATH=/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1", "EXPECTED_MODEL=51E9" ], "Associations": [], "Id": 2, "Message": "xyz.openbmc_project.Power.PowerSupply.Error.NotSupported", "Path": "/var/lib/phosphor-logging/extensions/pels/logs/2021040718580625_50000002",
Change-Id: Ib8dd23465bfd36b510197a88d41fc8419862f33b Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
d3a70d98 | 04-Jun-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Update supported configuration properties
The Supported Configuration schema has been updated to have a single model instead of array of models, and to have an array of input voltages instea
psu-ng: Update supported configuration properties
The Supported Configuration schema has been updated to have a single model instead of array of models, and to have an array of input voltages instead of a single voltage. In addition, update the name of the supported number of power supplies from max to count, so that it better reflects that a specific number of power supplies are expected, and not an 'up to' max number.
Change-Id: I7a4bfa9b195ce7b9d13802dbb234018c6f217fda Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
cb091801 | 26-Apr-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Call updateInventory() in PSU constructor
After adding the changes to get configuration data from entity-manager, the timing with how processes start up changed a bit.
We used to get bus, a
psu-ng: Call updateInventory() in PSU constructor
After adding the changes to get configuration data from entity-manager, the timing with how processes start up changed a bit.
We used to get bus, address, and inventory path information from the JSON file, created the power supplies, prior to the phosphor-gpio-presence application doing the interfaces added call for the Present property. Then we would get the interfaces added signal, which would call updateInventory().
With the entity-manager changes, it appears that we typically startup before the Presence interface added, and before the bus, address, and other information from entity-manager is ready. The Present property gets added, the entity-manager adds the IBMCFFPSConnector information, then we create the power suppplies, but now there is no call to updateInventory() as we missed the interfaces added signal for the Present property.
We probably should have been calling updateInventory() in the constructor all this time. If the power supply is not present at that time, it just skips doing anything. If it is present, it will update the VPD properties on the D-Bus inventory interface.
Tested: Created rainier image containing phosphor-power changes. Flashed image to Rainier 2S4U system. Removed powersupply* directories from /var/lib/phosphor-inventory-manager persisted data tree. Rebooted BMC. Verify D-Bus for powersupply* has VPD keyword properties updated.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: Iabff937b25910faeca6ffe8aa1f376132e514a81
show more ...
|
3c530fbd | 13-Apr-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Fix failing CI tests due to IBM_VPD
When c12c53b985b9ac12c3c83df47371e7c2c70ae21b merged, the CI tests for the phosphor-power repository started intermittently failing.
The expected calls f
psu-ng: Fix failing CI tests due to IBM_VPD
When c12c53b985b9ac12c3c83df47371e7c2c70ae21b merged, the CI tests for the phosphor-power repository started intermittently failing.
The expected calls for updateInventory() do not apply if the ibm-vpd=false, which is the default.
Add #if IBM_VPD check around test calls that are only expected if that is enabled.
Tested: x86sdk $ meson --reconfigure ... -Dibm-vpd=false ... x86build $ ninja -C x86build $ ./x86build/phosphor-power-supply/test/phosphor-power-supply-tests Verify no tests FAILED. x86sdk $ meson --reconfigure ... -Dibm-vpd=true ... x86build $ ninja -C x86build $ ./x86build/phosphor-power-supply/test/phosphor-power-supply-tests Verify no tests FAILED. Run openbmc-build-scripts/scripts/build-unit-test-docker Verify SUCCESS.
See: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-build-scripts/+/42141 (Fix for meson problem in CI) https://github.com/openbmc/docs/blob/master/testing/local-ci-build.md (How to run local CI)
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I4d481d7a493157b298e28d87cb2d962a8bdf5ccf
show more ...
|
c12c53b9 | 06-Apr-2021 |
Chanh Nguyen <chanh@os.amperecomputing.com> |
psu-ng: Change the IBM_VPD checking condition
By default, the IBM_VPD will be defined as 0 (False). We used the "#ifdef IBM_VPD" to check the define IBM_VPD, it's not correct completely. The source
psu-ng: Change the IBM_VPD checking condition
By default, the IBM_VPD will be defined as 0 (False). We used the "#ifdef IBM_VPD" to check the define IBM_VPD, it's not correct completely. The source code of IBM VPD always runs in both TRUE or FALSE.
Signed-off-by: Chanh Nguyen <chanh@os.amperecomputing.com> Change-Id: I7e6e9c5c2c62de3a1b7f52d2be1caf6b44f0a2f4
show more ...
|
572a9051 | 30-Mar-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Store power supply model name
Store the model name for each power supply so that the monitor app can perform checks such as verifying that all power supplies are of the same model and if tha
psu-ng: Store power supply model name
Store the model name for each power supply so that the monitor app can perform checks such as verifying that all power supplies are of the same model and if that model is supported by the system.
Tested: Called the new get name interface from the monitor app and verified it was populated for each of the present power supplies.
Change-Id: I79a0e4d3d45a8f3d2dfb6733806d4319ad4cb30c Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
9ea66a67 | 24-Mar-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Created map of supported PS configurations
The supported configutation entity manager object provides at a minimum the supported type and model for the system. Check for "PowerSupply" type,
psu-ng: Created map of supported PS configurations
The supported configutation entity manager object provides at a minimum the supported type and model for the system. Check for "PowerSupply" type, and PSU model. Then store the rest of the properties if present such as max count and input voltage.
Replace MaxCount with RedundantCount since that's the property to be used with power supplies. Use a multimap since there may be mutiple supported configurations for the same model, example, the system could support 2 PSU model 51E9 with input voltage 220, or 4 PSU of the same model 51E9 with input voltage 110. The multimap would then look like: 51E9: 2, 220 51E9: 4, 110
The monitor app can then read the PSU model that's present, and search for all the supported combinations that the system supports for that model.
Tested: Verified that multiple supported configuration objects in Rainier populated the multimap as expected.
Change-Id: I44283f56f9e5defb37f42c5149cec63d902efd76 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
8b7786af | 24-Mar-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Remove JSON parsing code
Remove the JSON parsing code/functions from the PSUManager class.
Remove the constructor using the JSON configfile path as it is no longer used.
Remove the getJSON
psu-ng: Remove JSON parsing code
Remove the JSON parsing code/functions from the PSUManager class.
Remove the constructor using the JSON configfile path as it is no longer used.
Remove the getJSONProperties function, as it is no longer used.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: Iec7fcc167dbd2eb21bc6769af46594bb2d53e3ea
show more ...
|
b3028762 | 09-Nov-2020 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Change main to call non-JSON PSUManager
Change the main function to create the PSU manager object using the constructor that will pull configuration from D-Bus rather than from a JSON config
psu-ng: Change main to call non-JSON PSUManager
Change the main function to create the PSU manager object using the constructor that will pull configuration from D-Bus rather than from a JSON configuration file.
Since the JSON configuration file parsing information is no longer passed down to the constructor, remove the argument parsing and default file handling code.
Update the README to remove the JSON configuration information, add the D-Bus configuration information.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I04f0d532f862bb4e8aa2e7a88dc06327c90d777d
show more ...
|
510acaab | 05-Nov-2020 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Add method to get PSU conf from D-Bus.
Add a getPSUProperties method that will get the power supply unit configuration information from the D-Bus properties populated by entity-manager. The
psu-ng: Add method to get PSU conf from D-Bus.
Add a getPSUProperties method that will get the power supply unit configuration information from the D-Bus properties populated by entity-manager. The IBM common form factor power supplies will have these properties under the interface called xyz.openbmc_project.Configuration.IBMCFFPSConnector. See I45b724238cffe6fb7f1f8f9947fa1c2c9e9e8015 for changes to add the necessary updates to entity-manager.
The D-Bus property for I2CAddress is a uint64_t type, while the JSON configuration file had a string. Move the PowerSupply constructor to the cpp file, updated to take in uint16_t for the i2caddr.
Update PSUManager::getJSONProperties() to convert Address from string to uint16_t.
Add in a PSUManager constructor to use the getPSUProperties() function.
Add code to handle interfacesAdded from entity-manager prior to getPSUProperties() or getSystemProperties().
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I553e8982cf008828823cea2c0f017ff23c9070ab
show more ...
|
e1074d8e | 16-Mar-2021 |
Adriana Kobylak <anoo@us.ibm.com> |
psu-ng: Process all Supported Configuration sets
The chassis may have more than one Supported Configuration interface, such as supporting 2 power supplies of a certain type or 4 power supplies of an
psu-ng: Process all Supported Configuration sets
The chassis may have more than one Supported Configuration interface, such as supporting 2 power supplies of a certain type or 4 power supplies of another. Therefore need to loop through the subtree results to process each. Create a new helper function to initialize the system properties to avoid duplicate code with the interfaces added callback. To account for the multiple configurations, a subsequent commit would convert the existing sys_properties member into a vector of sys_properties to store each configuration.
Also remove removing the interfaces added match, because with multiple configuration interfaces, it is not known how many interfaces the system supports, and the interfaces added signal gets trigger for each one.
Tested: Verified the maxPowerSupplies value was as expected on Rainier 2U and adding a second Supported Configuration interface it was processed (overwrote the first value).
Change-Id: Ie9eed6d7acdaa9ed92e2da2be978b4bed37eab2b Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
show more ...
|
3e42913f | 18-Mar-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Rename supportedConfIfaceAdded
Rename the supportConfIfaceAdded function to entityMangerIfaceAdded, as it will be used to handle the SupporteConfiguration interface being added, as well as t
psu-ng: Rename supportedConfIfaceAdded
Rename the supportConfIfaceAdded function to entityMangerIfaceAdded, as it will be used to handle the SupporteConfiguration interface being added, as well as the IBMCFFPSConnecor interface.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: Ib2a1564b5467153d8a960a1b39b2df4afa1147f8
show more ...
|
31649017 | 18-Mar-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Move entity-manager interaces added
Move the code for handling interfacesAdded from entity-manager to the PSUManager constructor. Plans on using this for both the system properties from Supp
psu-ng: Move entity-manager interaces added
Move the code for handling interfacesAdded from entity-manager to the PSUManager constructor. Plans on using this for both the system properties from SupportedConfiguration and the IBMCFFPSConnector properties.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I440ffdf5a3ad77f58dc521ba743e5c984659cc69
show more ...
|
a1830a8d | 12-Mar-2021 |
Brandon Wyman <bjwyman@gmail.com> |
psu-ng: Move test getUtils and freeUtils to cpp
While debugging an SDK build issue regarding optimization and _FORTIFY_SORUCE, it was discovered that the tests for phosphor-power-supply fail to link
psu-ng: Move test getUtils and freeUtils to cpp
While debugging an SDK build issue regarding optimization and _FORTIFY_SORUCE, it was discovered that the tests for phosphor-power-supply fail to link if meson is run with --buildtype debugoptimized.
Tested: Builds with --buildtype debug Builds with --buildtype debugoptimized Builds with --buildtype plain
Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: I095ecd83c85d5ed488f83cb3ede79c20701969a2
show more ...
|