Support to dump old VPD format, which is used on CR-48 only.

For convenience, all utilities cares about VPD may call this without
considering the model name (we use mosys for VPD info on CR-48).

The VPD 1.2 is a binary structure. This patch adds its UUID into the list,
and slightly re-factors the structure to parse SMBIOS tables. Two print methods
are used for data: zero-terminated string and the binary data, including
UUID and MAC address.

Note that we only support read-only mode. Not support write-back mode yet.

Also includes some minor fixes:
+ Add a workaround for mosys r169 bug: missing structure terminator.
+ Fixed the minor bug in normalizing the VPD area name.
  So that we can read the old FMAP naming convention seamlessly.

BUG=chromium-os:17629
TEST=Tested on the following platforms.
Mario (manual test):
  flashrom -w mario/mario.bin
  vpd -l              # see the old VPD 1.2 content.
                      # also see the warning for partial read fail.
  vpd -l -i "RW VPD"  # expected error because ODM wrote garbage here.
                      # SMBIOS signature is not matched.
  rm /var/log/vpd_2.0.txt; dump_vpd_log  #  confirmed chrome:system
Alex (regression):
  ./main.py --boards=zgb
  ./main.py --boards=chroot --storage=FILE
chroot (regression):
  ./main.py --boards=chroot,zgb,alex,kaen --storages=FILE

Change-Id: I3595bd290c8a68bb06627a91fc2ee81ab779185e
Reviewed-on: http://gerrit.chromium.org/gerrit/4552
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
4 files changed
tree: c8e3bad137226efd5cb4e7d9b1dea81351776334
  1. include/
  2. lib/
  3. util/
  4. LICENSE
  5. Makefile
  6. README
  7. vpd.c