Vpd-tool: Hardware option fix

The -H hardware flag is given when the user wants to update hardware.
When -H flag is given, the user must provide the eeprom path and not
the object path in -O/object option.

Test:
1. When dbus object path is given with -H Hardware flag - tool throws error.

root@rainier:/tmp# ./vpd-tool -u -H -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K CC -V 0x7172
Invalid EEPROM path : /system/chassis/motherboard/vdd_vrm1. The given EEPROM path doesn't exist. Provide valid EEPROM path when -H flag is used. Refer help option. root@rainier:/tmp#

2. To update directly on hardware -
( - this updates the keyword on ONLY hardware for those keywords which are not mentioned in /usr/share/vpd/dbus_properties.json)
( - if the given keyword is present in dbus_properties.json => then both HARDWARE AND DBUS are updated.)

./vpd-tool -u -H -O /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a580.i2c-bus/i2c-10/10-0050/10-00500/nvmem -R VINI -K CC -V 0x7172
Tested that both hardware and dbus is updated as the record-keyword VINI-CC is a part of dbus_properties.json.

3. To update on dbus and hardware ( no matter whether or not the record-keyword is present in dbus_properties.json.)

 ./vpd-tool -u -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K DR -V 0x7172

4. Help option
root@rainier:/tmp# ./vpd-tool --help
VPD Command line tool to dump the inventory and to read and update the keywords
Usage: ./vpd-tool [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  -O,--object TEXT            Enter the Object Path
  -R,--record TEXT            Enter the Record Name
  -K,--keyword TEXT           Enter the Keyword
  -V,--value TEXT             Enter the value. The value to be updated should be either in ascii or in hex. ascii eg: 01234; hex eg: 0x30313233
  -o,--dumpObject Needs: --object
                              Dump the given object from the inventory. { vpd-tool-exe --dumpObject/-o --object/-O object-name }
  -i,--dumpInventory          Dump all the inventory objects. { vpd-tool-exe --dumpInventory/-i }
  -r,--readKeyword Needs: --object --record --keyword
                              Read the data of the given keyword. { vpd-tool-exe --readKeyword/-r --object/-O "object-name" --record/-R "record-name" --keyword/-K "keyword-name" }
  -w,-u,--writeKeyword,--updateKeyword Needs: --object --record --keyword --value
                              Update the value. { vpd-tool-exe --writeKeyword/-w/--updateKeyword/-u --object/-O object-name --record/-R record-name --keyword/-K keyword-name --value/-V value-to-be-updated }
  -f,-F,--forceReset          Force Collect for Hardware. { vpd-tool-exe --forceReset/-f/-F }
  -H,--Hardware               This is a supplementary flag to write directly to hardware. When the -H flag is given, User should provide valid hardware/eeprom path (and not dbus object path) in the -O/--object path.


Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: Id6b808422651043c8e7115b5aeb19cb3102bbe85
1 file changed
tree: 322e624b73450d0a4718ea5bd07c2bc992a33dd9
  1. examples/
  2. test/
  3. vpd-manager/
  4. vpd-parser/
  5. vpdecc/
  6. .clang-format
  7. .gitignore
  8. app.cpp
  9. args.cpp
  10. args.hpp
  11. common_utility.cpp
  12. common_utility.hpp
  13. const.hpp
  14. defines.hpp
  15. extra-properties-example.yaml
  16. extra-properties.mako.hpp
  17. extra-properties.py
  18. ibm_vpd_app.cpp
  19. ibm_vpd_utils.cpp
  20. ibm_vpd_utils.hpp
  21. impl.cpp
  22. impl.hpp
  23. LICENSE
  24. MAINTAINERS
  25. meson.build
  26. meson_options.txt
  27. README.md
  28. store.hpp
  29. types.hpp
  30. utilInterface.hpp
  31. vpd_exceptions.hpp
  32. vpd_tool.cpp
  33. vpd_tool_impl.cpp
  34. vpd_tool_impl.hpp
  35. write.cpp
  36. write.hpp
  37. writefru.mako.hpp
  38. writefru.py
  39. 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.