tree: ccdb34a2d2220e30fc0f7a6be927183129b65a2f [path history] [tgz]
  1. action.md
  2. and.md
  3. chassis.md
  4. compare_presence.md
  5. compare_vpd.md
  6. config_file.md
  7. configuration.md
  8. device.md
  9. i2c_compare_bit.md
  10. i2c_compare_byte.md
  11. i2c_compare_bytes.md
  12. i2c_interface.md
  13. i2c_write_bit.md
  14. i2c_write_byte.md
  15. i2c_write_bytes.md
  16. if.md
  17. not.md
  18. or.md
  19. pmbus_read_sensor.md
  20. pmbus_write_vout_command.md
  21. presence_detection.md
  22. rail.md
  23. README.md
  24. rule.md
  25. run_rule.md
  26. sensor_monitoring.md
  27. set_device.md
phosphor-regulators/docs/config_file/README.md

phosphor-regulators Configuration File

Overview

The phosphor-regulators application is controlled by a configuration file (config file). The config file defines how to perform the following operations on voltage regulators in the system:

  • Modify regulator configuration, such as output voltage or overcurrent settings
  • Read sensor values

The config file does not control how voltage regulators are enabled or how to monitor their Power Good (pgood) status. Those operations are typically performed by power sequencer hardware and related firmware.

Data Format

The config file is written using the JSON (JavaScript Object Notation) data format.

The config file can be created using any text editor, such as Atom, Notepad++, gedit, Vim, or Emacs. You can select any file name, but it must end with the ".json" suffix, such as regulators.json.

Example

See config_file.json.

Contents

Structure

The config file typically contains the following structure:

  • Array of rules
    • Rules defining how to modify configuration of regulators
    • Rules defining how to read sensors
  • Array of chassis in the system
    • Array of regulator devices in the chassis
      • Array of voltage rails produced by the regulator

Rules provide common, reusable sequences of actions that can be shared by one or more regulators. They are optional and can be omitted if each regulator requires a unique sequence of actions.

Syntax

The config file contains a single JSON config_file object at the root level. That object contains arrays of other JSON objects.

The following JSON object types are supported:

Comments

The JSON data format does not support comments. However, many of the JSON objects in the config file provide an optional "comments" property. The value of this property is an array of strings. Use this property to annotate the config file. The "comments" properties are ignored when the config file is read by the phosphor-regulators application.

Examples:

"comments": [ "IR35221 regulator producing the Vdd rail" ]

"comments": [ "Check if register 0x82 contains 0x7302",
              "Device returns bytes in little-endian order",
              "Ignore most significant bit in each byte" ]

Hexadecimal Values

The JSON number data type does not support the hexadecimal format. For this reason, properties with hexadecimal values use the string data type.

Example:

"address": "0x70"

Validation

After creating or modifying a config file, you need to validate it using the tool validate-regulators-config.py.

The validation tool checks the config file for errors, such as:

  • Invalid JSON syntax (like a missing brace)
  • Unrecognized JSON object or property
  • Duplicate rule or device ID
  • Reference to a rule or device ID that does not exist
  • Infinite loop, such as rule A runs rule B which runs rule A

The tool requires two input files:

The tool has the following command line syntax:

validate-regulators-config.py -c <config file> -s config_schema.json

where <config file> is the name of the config file to validate.

Installation

Standard Directory

/usr/share/phosphor-regulators

The standard version of the config file should be installed in this read-only directory as part of the firmware image install. This is the config file that will normally be used.

Test Directory

/etc/phosphor-regulators

A new version of the config file can be tested by copying it into this writable directory. This avoids the need to build and install a new firmware image on the BMC.

Search Order

The phosphor-regulators application will search first in the test directory for a config file. If no config file is found or the file contains errors, the application will next search in the standard directory.

Loading and Reloading

The config file is loaded when the phosphor-regulators application starts.

To force the application to reload the config file, use the following command on the BMC:

kill -SIGHUP `pidof phosphor-regulators`

Testing

After creating or modifying a config file, you should test it to ensure it provides the desired behavior.

Perform the following steps to test the config file:

  • Run the validation tool to ensure the config file contains no errors.
  • Copy the config file into the test directory on the BMC.
  • Force the phosphor-regulators application to reload its config file, causing it to find and load the file in the test directory.
  • Boot the system. Regulator configuration changes (such as voltage settings) are only applied during the boot.

When finished testing, perform the following steps to revert to the standard config file:

  • Remove the config file from the test directory.
  • Force the phosphor-regulators application to reload its config file, causing it to find and load the file in the standard directory.
  • Boot the system, if necessary, to apply the regulator configuration changes in the standard config file.