Fix Get and Set SM Signal Fan PWM Command

The Get SM Signal and Set SM Signal IPMI commands function under the
assumption that there is a 1:1 relationship between the fan Pulse Width
Modulator (PWM), and the fan tachometer. Not all hardware follows this
model. The code changes in this commit updates these IPMI commands to handle
the introduction of HW that uses one PWM output to control two fans.

For systems that have a 1:1 PWM/Tachometer relationship, this code improves
upon the original "signal instance" lookup. The "signal instance" now
specifies a "fan number". Systems may not have a linear relationship between
"fan header numbers" and the PWM that controls the fan on that header. Prior
to this commit the "signal instance" had to be the PWM number. Now the Get/Set
commands associate a linear fan number to the respective PWM.

Systems that use one PWM to control multiple fans, and by extension multiple
tachometers use a secondary lookup to determine the fan to modify/read. The
JSON file describing the fan PWM/tachometer is updated to add a "PWMName"
record. The instance number is combined with the PWMName entry to identify
the correct HW to read/modify. The PWMName entry in the JSON file nomenclature
defines two fans (i.e. "PWMName:" "Pwm_3_4"), which are associated to a PWM,
(i.e. "Pwm": 1).

Tested:
On system with default PWM name:
    IPMI command:
    ipmitool raw 0x30 0x14 0x0d 6 0x00     # read fan 7 pwm
    32
    ipmitool raw 0x30 0x15 0x05 6 0x1 0x48 # set fan 7 pwm (72%)
    ipmitool raw 0x30 0x14 0x0d 6 0x00     # read fan 7 pwm
    48
    root@intel-obmc:~# busctl get-property
    xyz.openbmc_project.EntityManager
    /xyz/openbmc_project/inventory/system/chassis/Fan_7
    xyz.openbmc_project.Configuration.AspeedFan.Connector Pwm
        t 12
    (In this system, Fan 7 is connected to PWM 12)

    Dbus tree showing default name:
    busctl tree xyz.openbmc_project.FanSensor
    `-/xyz/openbmc_project/sensors
          |-/xyz/openbmc_project/sensors/fan_pwm
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_1
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_13
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_14
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_15
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_16
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_2
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_3
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_4
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_5
          | `-/xyz/openbmc_project/sensors/fan_pwm/Pwm_6

On system with non-default PWM name:
    IPMI command:
    ipmitool raw 0x30 0x14 0x0d 1 0x00     # read fan 2 pwm
    64
    ipmitool raw 0x30 0x15 0x05 0 0x1 0x48 # set fan 2 pwm
    ipmitool raw 0x30 0x14 0x0d 0 0x00     # read fan 1 pwm
    48                                     # shared with fan 2

    Dbus tree showing non-default PWM name:
    busctl tree xyz.openbmc_project.FanSensor
    `-/xyz/openbmc_project/sensors
          |-/xyz/openbmc_project/sensors/fan_pwm
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_11_12
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_1_2
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_3_4
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_5_6
          | |-/xyz/openbmc_project/sensors/fan_pwm/Pwm_7_8
          | `-/xyz/openbmc_project/sensors/fan_pwm/Pwm_9_10

Change-Id: I9a40256ed892170f8ba88a3a617b5a2e11693c9f
Signed-off-by: Alex Schendel <alex.schendel@intel.com>
2 files changed
tree: a3317ce30699cb2307b5c40158b85e971f3142b7
  1. cmake/
  2. docs/
  3. include/
  4. non-yocto/
  5. src/
  6. tests/
  7. .clang-format
  8. .gitignore
  9. cmake-format.json
  10. CMakeLists.txt
  11. CMakeLists.txt.in
  12. generate-whitelist.py
  13. ipmi-whitelist.conf
  14. LICENSE
  15. OWNERS
  16. README.md
README.md

Intel IPMI OEM support library

This component is intended to provide Intel-specific IPMI[3] command handlers for OpenBMC. These handlers are intended to integrate BMC with servers based on Intel architecture.

Overview

intel-ipmi-oem serves as an extension[1] to OpenBMC IPMI daemon[2]. It is compiled as a shared library and intended to both:

  • override existing implementation of standard IPMI commands to comply with Intel-specific solutions,
  • provide implementation for non-standard OEM extensions.

Capabilities

Related features provided by the library are grouped in separate source files. Main extensions to vanilla OpenBMC IPMI stack are the following:

  • Acquiring SMBIOS data over IPMI
  • Commands for better integration with Intel hardware
  • Firmware update extensions
  • Extended parsing of IPMI Platform Events[4]

References

  1. OpenBMC IPMI Architecture
  2. Phosphor IPMI Host
  3. IPMI Specification v2.0
  4. Intel Platform Events parsing