Support Gigabyte FRU located at non-zero offsets

Some Gigabyte EEPROMs store FRU data at an offset rather than at the
beginning of the device. To handle this, support for detecting a
"GIGABYTE" marker has been added.

Change-Id: I7399b22ad3bb596b357084c79f25a8d33617ec50
Signed-off-by: Mark Kuo <makuo@nvidia.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/src/fru_device/fru_utils.cpp b/src/fru_device/fru_utils.cpp
index 8c4298e..13e619f 100644
--- a/src/fru_device/fru_utils.cpp
+++ b/src/fru_device/fru_utils.cpp
@@ -751,6 +751,18 @@
         return findFRUHeader(reader, errorHelp, blockData, baseOffset);
     }
 
+    // check if blockData starts with gigabyteHeader
+    const std::vector<uint8_t> gigabyteHeader = {'G', 'I', 'G', 'A',
+                                                 'B', 'Y', 'T', 'E'};
+    if (blockData.size() >= gigabyteHeader.size() &&
+        std::equal(gigabyteHeader.begin(), gigabyteHeader.end(),
+                   blockData.begin()))
+    {
+        // look for the FRU header at offset 0x4000
+        baseOffset = 0x4000;
+        return findFRUHeader(reader, errorHelp, blockData, baseOffset);
+    }
+
     lg2::debug("Illegal header {HEADER} base offset {OFFSET}", "HEADER",
                errorHelp, "OFFSET", baseOffset);