summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/src/gbe/gbe.c
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-01-10 18:07:56 (EST)
committer Francis Rowe <info@gluglug.org.uk>2015-01-10 18:07:56 (EST)
commitf6da483213c5a9ad026c2740eeff120414492a40 (patch)
tree72c62f49cc617a15a023134c26679c30133aacab /resources/utilities/ich9deblob/src/gbe/gbe.c
parent74adfa0f8c41754d1a74006b6ca5f923fd2af503 (diff)
downloadlibreboot-f6da483213c5a9ad026c2740eeff120414492a40.zip
libreboot-f6da483213c5a9ad026c2740eeff120414492a40.tar.gz
libreboot-f6da483213c5a9ad026c2740eeff120414492a40.tar.bz2
ich9deblob/ich9gen: use portable data types
For those integers that need to be a certain byte size.
Diffstat (limited to 'resources/utilities/ich9deblob/src/gbe/gbe.c')
-rw-r--r--resources/utilities/ich9deblob/src/gbe/gbe.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/resources/utilities/ich9deblob/src/gbe/gbe.c b/resources/utilities/ich9deblob/src/gbe/gbe.c
index 150d149..e8faa51 100644
--- a/resources/utilities/ich9deblob/src/gbe/gbe.c
+++ b/resources/utilities/ich9deblob/src/gbe/gbe.c
@@ -33,15 +33,15 @@
*/
/* Read a 16-bit unsigned int from a supplied region buffer */
-unsigned short gbeGetRegionWordFrom8kBuffer(int index, char* regionData)
+uint16_t gbeGetRegionWordFrom8kBuffer(int index, uint8_t* regionData)
{
- return *((unsigned short*)(regionData + (index * 2)));
+ return *((uint16_t*)(regionData + (index * 2)));
}
/*
* gbe checksum calculation (algorithm based on datasheet)
*/
-unsigned short gbeGetChecksumFrom8kBuffer(char* regionData, unsigned short desiredValue, int byteOffset)
+uint16_t gbeGetChecksumFrom8kBuffer(uint8_t* regionData, uint16_t desiredValue, int byteOffset)
{
int i;
@@ -51,8 +51,8 @@ unsigned short gbeGetChecksumFrom8kBuffer(char* regionData, unsigned short desir
*/
int wordOffset = byteOffset >> 1;
- unsigned short regionWord; /* store words here for adding to checksum */
- unsigned short checksum = 0; /* this gbe's checksum */
+ uint16_t regionWord; /* store words here for adding to checksum */
+ uint16_t checksum = 0; /* this gbe's checksum */
for (i = 0; i < 0x3F; i++) {
regionWord = gbeGetRegionWordFrom8kBuffer(i+wordOffset, regionData);
@@ -63,9 +63,9 @@ 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)
+uint16_t gbeGetChecksumFrom4kStruct(struct GBEREGIONRECORD_4K gbeStruct4k, uint16_t desiredValue)
{
- char gbeBuffer4k[GBEREGIONSIZE_4K];
+ uint8_t gbeBuffer4k[GBEREGIONSIZE_4K];
memcpy(&gbeBuffer4k, &gbeStruct4k, GBEREGIONSIZE_4K);
return gbeGetChecksumFrom8kBuffer(gbeBuffer4k, desiredValue, 0);
}
@@ -79,7 +79,7 @@ struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8
* the backup as desired and then copy it to the main region.
*/
- int i;
+ unsigned int i;
struct GBEREGIONRECORD_8K deblobbedGbeStruct8k;
memcpy(&deblobbedGbeStruct8k, &factoryGbeStruct8k, GBEREGIONSIZE_8K);