This document describes the high-level design of the phosphor-regulators
application.
The low-level design is documented using doxygen comments in the source files.
See README.md for an overview of the functionality provided by this application.
The phosphor-regulators
application is a single-threaded C++ executable. It is a 'daemon' process that runs continually. The application is launched by systemd when the BMC reaches the Ready state and before the chassis is powered on.
The application is driven by a system-specific JSON configuration file. The JSON file is found and parsed at runtime. The parsing process creates a collection of C++ objects. These objects implement the regulator configuration and monitoring behavior that was specified in the JSON file.
main()
.configure
and monitor
methods.Regulator configuration occurs early in the system boot before regulators have been enabled (turned on).
A systemd service file runs the regsctl
utility. This utility invokes the D-Bus configure
method on the phosphor-regulators
application.
This D-Bus method is implemented by the Manager object. The Manager object calls the C++ configure()
method on all the objects representing the system (System, Chassis, Device, and Rail).
The configuration changes are applied to a Device or Rail by executing one or more actions, such as pmbus_write_vout_command.
If an error occurs while executing actions:
Regulator monitoring is enabled during the system boot after regulators are enabled (turned on).
A systemd service file runs the regsctl
utility. This utility invokes the D-Bus monitor
method on the phosphor-regulators
application. The parameter value true
is passed to the method.
This D-Bus method is implemented by the Manager object. The Manager object starts a timer. The timer periodically calls C++ monitoring methods on all the objects representing the system (System, Chassis, Device, and Rail).
Regulator monitoring is disabled at the beginning of system shutdown before regulators are disabled (turned off).
A systemd service file runs the regsctl
utility. This utility invokes the D-Bus monitor
method on the phosphor-regulators
application. The parameter value false
is passed to the method.
This D-Bus method is implemented by the Manager object. The Manager object stops the timer that was periodically calling C++ monitor methods.
When regulator monitoring is enabled, sensor values are read once per second. The timer in the Manager object calls the monitorSensors()
method on all the objects representing the system (System, Chassis, Device, and Rail).
The sensor values for a Rail (such as iout, vout, and temperature) are read using pmbus_read_sensor actions.
The first time a sensor value is read, a corresponding sensor object is created on D-Bus. On subsequent reads, the existing D-Bus sensor object is updated with the new sensor value.
The D-Bus sensor object implements the following interfaces:
An existing D-Bus Sensor object is removed from D-Bus if no corresponding sensor values are read during monitoring. This can occur in the following cases:
If an error occurs while reading the sensors for a Rail:
If a subsequent attempt to read the sensors for the Rail is successful, the following changes will be made to the D-Bus sensor objects:
When regulator monitoring is disabled, the following changes will be made to all of the D-Bus sensor objects:
When regulator monitoring is enabled, phase fault detection is performed every 15 seconds. The timer in the Manager object calls the detectPhaseFaults()
method on all the objects representing the system (System, Chassis, Device).
A phase fault must be detected two consecutive times (15 seconds apart) before an error is logged. This provides "de-glitching" to ignore transient hardware problems.
A phase fault error will only be logged for a regulator once per system boot.
If a different error occurs while detecting phase faults in a regulator: