+static int fru_parse_multirec(unsigned long addr)
+{
+ struct fru_multirec_hdr mrc;
+ u8 checksum = 0;
+ u8 hdr_len = sizeof(struct fru_multirec_hdr);
+ int mac_len = 0;
+
+ debug("%s: multirec addr %lx\n", __func__, addr);
+
+ do {
+ memcpy(&mrc.rec_type, (void *)addr, hdr_len);
+
+ checksum = fru_checksum((u8 *)addr, hdr_len);
+ if (checksum) {
+ debug("%s header CRC error\n", __func__);
+ return -EINVAL;
+ }
+
+ if (mrc.rec_type == FRU_MULTIREC_TYPE_OEM) {
+ struct fru_multirec_mac *mac = (void *)addr + hdr_len;
+ u32 type = FRU_DUT_MACID;
+
+ if (CONFIG_IS_ENABLED(FRU_SC))
+ type = FRU_SC_MACID;
+
+ if (mac->ver == type) {
+ mac_len = mrc.len - FRU_MULTIREC_MAC_OFFSET;
+ memcpy(&fru_data.mac.macid, mac->macid, mac_len);
+ }
+ }
+ addr += mrc.len + hdr_len;
+ } while (!(mrc.type & FRU_LAST_REC));
+
+ return 0;
+}
+