Always generate absolute address for SMBIOS tables (follow the spec).
This is a big re-factoring, which is a following CL after 1243
(see http://gerrit.chromium.org/gerrit/#change,1243).
In CL 1243, Hungte mentioned the case C & D are annoying and suggested to
remove. This CL is going to removed that. So that, when reading file, the vpd
will try 3 ways to get the 'eps_base' value:
1. try to parse fmap structure and get the offset of VPD partition.
2. try to search "_SM_" signature in file.
3. try to load content from BIOS to learn the eps_base.
Alternatively, user can use -E to force the eps_base value.
For the backward-compatible, we keep the ability to read case B. Once a
write is happening on case B, the offset will be corrected to absolute.
Which means following the SMBIOS spec.
Also did some re-factoring to make code more readable and easy to maintain.
BUS=chrome-os-partner:4010
TEST=Tested all commands in CL 1243, and the following commands:
rm -f /tmp/zero ; touch /tmp/zero
vpd -f /tmp/zero -l # loadFile() error
vpd -f /tmp/zero -O # got a 1537-byte file, the eps_base is 0x1f0000.
rm -f /tmp/zero ; touch /tmp/zero
vpd -f /tmp/zero -E 0x230000 -O # a 1537-byte file, and eps_base is 0x230000.
In addition, I write a testing script that runs combinations and corner cases.
I have run that script on K and Z models and passed.
Reviewed-on: http://gerrit.chromium.org/gerrit/1360
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
(cherry picked from commit edca624b92638efb06933a3ab0eb8b38201815ec)
Change-Id: I0704ec32b4d34e00ef038c2cec52603e3f8a36ba
Reviewed-on: http://gerrit.chromium.org/gerrit/2977
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
6 files changed