From 44dbb6e5e4160ff8663df9f176bb6313cabb8ad1 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Tue, 23 Dec 2014 21:20:47 -0500 Subject: ich9deblob: add define for 0xBABA gbe checksum and use it --- (limited to 'resources/utilities/ich9deblob') diff --git a/resources/utilities/ich9deblob/gbe/gbe.c b/resources/utilities/ich9deblob/gbe/gbe.c index 3caa3ee..417f37b 100644 --- a/resources/utilities/ich9deblob/gbe/gbe.c +++ b/resources/utilities/ich9deblob/gbe/gbe.c @@ -86,7 +86,7 @@ struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8 struct GBEREGIONRECORD_8K deblobbedGbeStruct8k; memcpy(&deblobbedGbeStruct8k, &factoryGbeStruct8k, GBEREGIONSIZE_8K); - deblobbedGbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(deblobbedGbeStruct8k.backup, 0xBABA); + deblobbedGbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(deblobbedGbeStruct8k.backup, GBECHECKSUMTOTAL); memcpy(&deblobbedGbeStruct8k.main, &deblobbedGbeStruct8k.backup, GBEREGIONSIZE_4K); return deblobbedGbeStruct8k; @@ -108,7 +108,7 @@ void printGbeChecksumDataFromStruct4k(struct GBEREGIONRECORD_4K gbeStruct4k, cha "%s Gbe (%s): calculated Gbe checksum: 0x%hx and actual GBe checksum: 0x%hx\n", romName, regionName, - gbeGetChecksumFrom4kStruct(gbeStruct4k, 0xBABA), + gbeGetChecksumFrom4kStruct(gbeStruct4k, GBECHECKSUMTOTAL), gbeStruct4k.checkSum ); } diff --git a/resources/utilities/ich9deblob/gbe/gbe.h b/resources/utilities/ich9deblob/gbe/gbe.h index 17d6a93..27ad4d7 100644 --- a/resources/utilities/ich9deblob/gbe/gbe.h +++ b/resources/utilities/ich9deblob/gbe/gbe.h @@ -43,6 +43,13 @@ */ #define GBEREGIONSIZE_4K 0x1000 +/* + * When adding up the first 0x3F 16-bit words + * in a 4KiB GBE region, it should be equal + * to 0xBABA + */ +#define GBECHECKSUMTOTAL 0xBABA + /* * These will have a modified descriptor+gbe based on what's in the factory.rom * These will be joined into a single 12KiB buffer (descriptor, then gbe) and saved to a file @@ -59,7 +66,7 @@ struct GBEREGIONRECORD_4K { unsigned char macAddress[6]; /* 0x03 words, or 0x06 bytes */ unsigned char otherStuff[120]; /* 0x3c words, or 0x7E bytes */ - unsigned short checkSum; /* when added to the sum of all words above, this should be 0xBABA */ + unsigned short checkSum; /* when added to the sum of all words above, this should match GBECHECKSUMTOTAL */ unsigned char padding1[3968]; }; -- cgit v0.9.1