sensorhandler: Fix Get Sensor Reading threshold bit mapping

IPMI v2.0 (Spec rev 1.1), Table 35 "Get Sensor Reading" defines the
Present threshold comparison status byte as:
  [7:6] = 1b (reserved, must read as 1)
  [5]   = >= Upper Non-Recoverable (UNR)
  [4]   = >= Upper Critical (UC)
  [3]   = >= Upper Non-Critical (UNC)
  [2]   = <= Lower Non-Recoverable (LNR)
  [1]   = <= Lower Critical (LC)
  [0]   = <= Lower Non-Critical (LNC)

Previous implementation packed UC/UNC/LC/LNC into bits [3:0] and left
[7:6] unset. This is out of spec and causes the IPMI raw Get Sensor
Reading response to return an incorrect threshold status byte, leading
to misinterpretation by clients.

This change:
  * Sets bits [7:6] to 1 as required by the spec.
  * Maps UC/UNC/LC/LNC to bits [4]/[3]/[1]/[0], respectively.
  * Leaves UNR/LNR ([5]/[2]) as 0 for now (unused in OpenBMC).

Impact: fixes the byte returned by IPMI raw Get Sensor Reading and
makes threshold status reporting spec compliant. No D-Bus or API change.

Testing:
  - bitbake phosphor-host-ipmid builds successfully
  - on target, ipmitool raw 0x04 0x2d <sensor#> and ipmitool sensor get
    show [7:6] = 11b and expected UC, UNC, LC, LNC bit positions

Change-Id: I0a0b07e8fe82357d39329054fed7966bb67f6f91
Signed-off-by: You Peng Wu <twpeng50606@gmail.com>
1 file changed
tree: c87a8092edbac61bf0e4b3e90e9c3227705b69a6
  1. app/
  2. dbus-sdr/
  3. docs/
  4. include/
  5. libipmid/
  6. oem/
  7. scripts/
  8. softoff/
  9. subprojects/
  10. test/
  11. transport/
  12. user_channel/
  13. xyz/
  14. .build.sh
  15. .clang-format
  16. .clang-tidy
  17. .gitignore
  18. .shellcheck
  19. .travis.yml
  20. apphandler.cpp
  21. apphandler.hpp
  22. chassishandler.cpp
  23. chassishandler.hpp
  24. dcmihandler.cpp
  25. dcmihandler.hpp
  26. error-HostEvent.hpp
  27. fruread.hpp
  28. generate_whitelist.sh
  29. generate_whitelist_create.sh
  30. globalhandler.cpp
  31. groupext.cpp
  32. host-cmd-manager.cpp
  33. host-cmd-manager.hpp
  34. host-interface.cpp
  35. host-interface.hpp
  36. host-ipmid-whitelist.conf
  37. ipmi_fru_info_area.cpp
  38. ipmi_fru_info_area.hpp
  39. ipmiallowlist.hpp
  40. ipmid-new.cpp
  41. ipmisensor.cpp
  42. LICENSE
  43. meson.build
  44. meson.options
  45. OWNERS
  46. read_fru_data.cpp
  47. read_fru_data.hpp
  48. README.md
  49. sbmrhandler.cpp
  50. selutility.cpp
  51. selutility.hpp
  52. sensordatahandler.cpp
  53. sensordatahandler.hpp
  54. sensorhandler.cpp
  55. sensorhandler.hpp
  56. settings.cpp
  57. settings.hpp
  58. storageaddsel.cpp
  59. storageaddsel.hpp
  60. storagehandler.cpp
  61. sys_info_param.cpp
  62. sys_info_param.hpp
  63. systemintfcmds.cpp
  64. systemintfcmds.hpp
  65. transportconstants.hpp
  66. transporthandler.cpp
  67. transporthandler.hpp
  68. whitelist-filter.cpp
README.md

phosphor-host-ipmid

Compile ipmid with default options

meson builddir
ninja -C builddir

Compile ipmid with yocto defaults

meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled
ninja -C builddir

If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in ipmid/subprojects.

Enable/Disable meson wrap feature

meson builddir -Dwrap_mode=nofallback
ninja -C builddir

Enable debug traces

meson builddir -Dbuildtype=debug
ninja -C builddir

Generate test coverage report

meson builddir -Db_coverage=true -Dtests=enabled
ninja -C builddir test
ninja -C builddir coverage