From a8605043c58cb0afd157d11431125b988f7af455 Mon Sep 17 00:00:00 2001 From: Francis Rowe Date: Tue, 23 Dec 2014 17:08:37 -0500 Subject: ich9deblob: rename GBEREGIONSIZE to GBEREGIONSIZE_8K --- (limited to 'resources/utilities/ich9deblob') diff --git a/resources/utilities/ich9deblob/gbe/gbe.h b/resources/utilities/ich9deblob/gbe/gbe.h index de3b27d..3b25ddf 100644 --- a/resources/utilities/ich9deblob/gbe/gbe.h +++ b/resources/utilities/ich9deblob/gbe/gbe.h @@ -37,7 +37,7 @@ #include /* Size of gbe region in bytes */ -#define GBEREGIONSIZE 0x2000 +#define GBEREGIONSIZE_8K 0x2000 /* * These will have a modified descriptor+gbe based on what's in the factory.rom @@ -112,8 +112,8 @@ unsigned short gbeGetChecksumFrom8kBuffer(char* regionData, unsigned short desir /* checksum calculation for 4k gbe struct (algorithm based on datasheet) */ unsigned short gbeGetChecksumFrom4kStruct(struct GBEREGIONRECORD_4K gbeStruct4k, unsigned short desiredValue) { - char gbeBuffer4k[GBEREGIONSIZE>>1]; - memcpy(&gbeBuffer4k, &gbeStruct4k, GBEREGIONSIZE>>1); + char gbeBuffer4k[GBEREGIONSIZE_8K>>1]; + memcpy(&gbeBuffer4k, &gbeStruct4k, GBEREGIONSIZE_8K>>1); return gbeGetChecksumFrom8kBuffer(gbeBuffer4k, desiredValue, 0); } @@ -127,10 +127,10 @@ struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8 */ struct GBEREGIONRECORD_8K deblobbedGbeStruct8k; - memcpy(&deblobbedGbeStruct8k, &factoryGbeStruct8k, GBEREGIONSIZE); + memcpy(&deblobbedGbeStruct8k, &factoryGbeStruct8k, GBEREGIONSIZE_8K); deblobbedGbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(deblobbedGbeStruct8k.backup, 0xBABA); - memcpy(&deblobbedGbeStruct8k.main, &deblobbedGbeStruct8k.backup, GBEREGIONSIZE>>1); + memcpy(&deblobbedGbeStruct8k.main, &deblobbedGbeStruct8k.backup, GBEREGIONSIZE_8K>>1); /* * Debugging: diff --git a/resources/utilities/ich9deblob/ich9deblob.c b/resources/utilities/ich9deblob/ich9deblob.c index 94bc2c2..f223d44 100644 --- a/resources/utilities/ich9deblob/ich9deblob.c +++ b/resources/utilities/ich9deblob/ich9deblob.c @@ -65,9 +65,9 @@ int main(int argc, char *argv[]) * gbe region. Well have actual gbe buffer mapped to it (from the factory.rom dump) * and then it will be modified to correct the main region */ - char factoryGbeBuffer8k[GBEREGIONSIZE]; + char factoryGbeBuffer8k[GBEREGIONSIZE_8K]; struct GBEREGIONRECORD_8K factoryGbeStruct8k; - char deblobbedGbeBuffer8k[GBEREGIONSIZE]; + char deblobbedGbeBuffer8k[GBEREGIONSIZE_8K]; struct GBEREGIONRECORD_8K deblobbedGbeStruct8k; /* @@ -152,8 +152,8 @@ int main(int argc, char *argv[]) */ fseek(fileStream, factoryGbeRegionStart, SEEK_SET); /* Read the gbe data from the factory.rom and put it in factoryGbeBuffer8k */ - bufferLength = fread(factoryGbeBuffer8k, sizeof(char), GBEREGIONSIZE, fileStream); - if (GBEREGIONSIZE != bufferLength) + bufferLength = fread(factoryGbeBuffer8k, sizeof(char), GBEREGIONSIZE_8K, fileStream); + if (GBEREGIONSIZE_8K != bufferLength) { printf("\nerror: could not read GBe region from factory.rom (%i) bytes read\n", bufferLength); return 1; @@ -167,11 +167,11 @@ int main(int argc, char *argv[]) * gbe over the struct so that it can then be modified * for libreboot's purpose */ - memcpy(&factoryGbeStruct8k, &factoryGbeBuffer8k, GBEREGIONSIZE); + memcpy(&factoryGbeStruct8k, &factoryGbeBuffer8k, GBEREGIONSIZE_8K); /* * the original factoryGbeStruct8k is only reference. Changes go here: */ - memcpy(&deblobbedGbeStruct8k, &factoryGbeBuffer8k, GBEREGIONSIZE); + memcpy(&deblobbedGbeStruct8k, &factoryGbeBuffer8k, GBEREGIONSIZE_8K); /* * Get size of ROM image @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) * deblobbed descriptor region */ memcpy(&deblobbedDescriptorBuffer, &deblobbedDescriptorStruct, DESCRIPTORREGIONSIZE); /* descriptor */ - memcpy(&deblobbedGbeBuffer8k, &deblobbedGbeStruct8k, GBEREGIONSIZE); /* gbe */ + memcpy(&deblobbedGbeBuffer8k, &deblobbedGbeStruct8k, GBEREGIONSIZE_8K); /* gbe */ /* delete old file before continuing */ remove(deblobbedDescriptorFilename); @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) } /* add gbe to the end of the file */ - if (GBEREGIONSIZE != fwrite(deblobbedGbeBuffer8k, sizeof(char), GBEREGIONSIZE, fileStream)) + if (GBEREGIONSIZE_8K != fwrite(deblobbedGbeBuffer8k, sizeof(char), GBEREGIONSIZE_8K, fileStream)) { printf("\nerror: writing GBe region failed\n"); return 1; diff --git a/resources/utilities/ich9deblob/x86compatibility.c b/resources/utilities/ich9deblob/x86compatibility.c index 6ee3fec..fb0bb73 100644 --- a/resources/utilities/ich9deblob/x86compatibility.c +++ b/resources/utilities/ich9deblob/x86compatibility.c @@ -44,8 +44,8 @@ int structSizesIncorrect(struct DESCRIPTORREGIONRECORD descriptorDummy, struct G printf("\nerror: compiler incompatibility: descriptor struct length is %i bytes (should be %i)\n", descriptorRegionStructSize, DESCRIPTORREGIONSIZE); return 1; } - if (GBEREGIONSIZE != gbeRegion8kStructSize){ - printf("\nerror: compiler incompatibility: gbe struct length is %i bytes (should be %i)\n", gbeRegion8kStructSize, GBEREGIONSIZE); + if (GBEREGIONSIZE_8K != gbeRegion8kStructSize){ + printf("\nerror: compiler incompatibility: gbe struct length is %i bytes (should be %i)\n", gbeRegion8kStructSize, GBEREGIONSIZE_8K); return 1; } -- cgit v0.9.1