Handle CPU Module and FRU in write VPD

Test-
1. Using vpd-tool
 ./vpd-tool --readKeyword   --object  /system/chassis/motherboard --record VINI --keyword SN
{
    "/system/chassis/motherboard": {
        "SN": "YL2E2D010000"
    }
}
 ./vpd-tool --writeKeyword    --object  /system/chassis/motherboard --record VINI --keyword SN --value 0x303030

 ./vpd-tool --readKeyword   --object  /system/chassis/motherboard --record VINI --keyword SN           {
    "/system/chassis/motherboard": {
        "SN": "000E2D010000"
    }
}

COM interface-

Change-Id: I39ee0448483be581da254f5633b0817637292dff
-------------
.SN                                                  property  ay        12 48 48 48 69 50 68 48 49 48 48 48 48   emits-change writable

Common Interface-
----------------
xyz.openbmc_project.Inventory.Decorator.Asset        interface -         -                                        -
.SerialNumber                                        property  s         "000E2D010000"                           emits-change writable

sys path updated-
--------
00000110  35 53 4e 0c 30 30 30 45  32 44 30 31 30 30 30 30  |5SN.000E2D010000|

2. Tested on simics with spi driver supported image for 1 DCM
verified CPUs and other FRUs to work as expected.

1- busctl call WriteKeyword ossay  "/system/chassis/motherboard/cpu0" "VINI" "DR" 1 65
Updating CI, so updated cpu0, cpu1 and spi2 vpd.

2- busctl call WriteKeyword ossay  "/system/chassis/motherboard/cpu1" "VINI" "DR" 1 66
Updating CI, so updated cpu0, cpu1 and spi2 vpd.

3- busctl call WriteKeyword ossay  "/system/chassis/motherboard/cpu0" "VINI" "CC" 1 67
Not a CI, so only cpu0 and spi2 vpd updated.

4- busctl call WriteKeyword ossay  "/system/chassis/motherboard/cpu1" "VINI" "CC" 1 67
Not a CI, so only cpu1 and spi6 vpd updated.

cpu1 updated 1 Byte data of DR (7)-
busctl call WriteKeyword ossay "/system/chassis/motherboard/cpu1" "VINI" "DR" 1 55

Read file info at spi2.0/spi2.00/nvmem offset 0x30000-
000001a0  04 56 49 4e 49 44 52 10  37 20 57 41 59 20 20 50  |.VINIDR.7 WAY  P|  <--DR updated 1 Byte

Change-Id: I5e99c1ac4e09b2d0e05be18a10d1d50eba22fea2
Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
4 files changed
tree: bb59869fab55f86f3694888d52445923df8a88f5
  1. examples/
  2. test/
  3. vpd-manager/
  4. vpdecc/
  5. .clang-format
  6. .gitignore
  7. app.cpp
  8. args.cpp
  9. args.hpp
  10. const.hpp
  11. defines.hpp
  12. extra-properties-example.yaml
  13. extra-properties.mako.hpp
  14. extra-properties.py
  15. ibm_vpd_app.cpp
  16. impl.cpp
  17. impl.hpp
  18. keyword_vpd_parser.cpp
  19. keyword_vpd_parser.hpp
  20. LICENSE
  21. MAINTAINERS
  22. memory_vpd_parser.cpp
  23. memory_vpd_parser.hpp
  24. meson.build
  25. meson_options.txt
  26. parser.cpp
  27. parser.hpp
  28. README.md
  29. store.hpp
  30. types.hpp
  31. utilInterface.hpp
  32. utils.cpp
  33. utils.hpp
  34. vpd_tool.cpp
  35. vpd_tool_impl.cpp
  36. vpd_tool_impl.hpp
  37. write.cpp
  38. write.hpp
  39. writefru.mako.hpp
  40. writefru.py
  41. writefru.yaml
README.md

#Overview This repository hosts code for OpenPower and IBM IPZ format VPD parsers. Both OpenPower VPD and IPZ VPD formats are structured binaries that consist of records and keywords. A record is a collection of multiple keywords. More information about the format can be found here.

The repository consists of two distinct applications, which are:

OpenPower VPD Parser

This is a build-time YAML driven application that parses the OpenPower VPD format and uses the YAML configuration (see extra-properties-example.yaml and writefru.yaml) to determine:

  • The supported records and keywords.
  • How VPD data is translated into D-Bus interfaces and properties.

The application instance must be passed in the file path to the VPD (this can, for example, be a sysfs path exposed by the EEPROM device driver) and also the D-Bus object path(s) that EEPROM data needs to be published under.

IBM VPD Parser

This parser is can be built by passing in the --enable-ibm-parser configure option. This parser differs from the OpenPower VPD parser in the following ways:

  • It parses all the records and keywords from the VPD, including large keywords (Keywords that begin with a # and are > 255 bytes in length).
  • It relies on a runtime JSON configuration (see examples/inventory.json) to determine the D-Bus object path(s) that hold interfaces and properties representing the VPD for a given VPD file path.

Making the application runtime JSON driven allows us to support multiple systems (with different FRU configurations) to be supported in a single code image as well as making the application more flexible for future improvements.

TODOs and Future Improvements

  1. The long-term goal is to completely do away with the build time YAML driven configurations and instead reconcile the OpenPower VPD parser and the IBM VPD parser applications into a single runtime JSON driven application.
  2. Add details to the README on how to configure and build the application.
  3. More JSON documentation.
  4. Support for more IBM VPD formats.
  5. VPD Write and tool documentation.