Handle IOBoard VPD for Barreleye
Due to changes to the IOBoard VPD for Barreleye to include the MAC
address, the fru parser needs hardening to handle these changes.
First do not try to read data if the area length is 0. Second
adjust the area length as the checksum is now at a 4 byte
boundary instead of 8. Add a new argument to phosphor-read-eeprom
to activate this handling.
Fixes openbmc/ipmi-fru-parser#19
Change-Id: I8f47205712f1f4be43e1c14359070f27e7f704b8
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/readeeprom.C b/readeeprom.C
index b78f35e..08830f5 100644
--- a/readeeprom.C
+++ b/readeeprom.C
@@ -17,6 +17,7 @@
int main(int argc, char **argv)
{
int rc = 0;
+ bool iob = false;
uint8_t fruid = 0;
// Handle to per process system bus
@@ -34,7 +35,7 @@
}
auto fruid_str = (*cli_options)["fruid"];
- if (eeprom_file == ArgumentParser::empty_string)
+ if (fruid_str == ArgumentParser::empty_string)
{
// User has not passed in the appropriate argument value
exit_with_error("fruid data not found.", argv);
@@ -48,6 +49,12 @@
exit_with_error("Invalid fruid.", argv);
}
+ auto iob_str = (*cli_options)["iob"];
+ if (iob_str == ArgumentParser::true_string)
+ {
+ iob = true;
+ }
+
// Finished getting options out, so release the parser.
cli_options.release();
@@ -62,7 +69,7 @@
// Now that we have the file that contains the eeprom data, go read it and
// update the Inventory DB.
bool bmc_fru = true;
- rc = ipmi_validate_fru_area(fruid, eeprom_file.c_str(), bus_type, bmc_fru);
+ rc = ipmi_validate_fru_area(fruid, eeprom_file.c_str(), bus_type, bmc_fru, iob);
}
// Cleanup