summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/ich9deblob.c
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2014-12-22 15:06:08 (EST)
committer Francis Rowe <info@gluglug.org.uk>2014-12-22 15:06:08 (EST)
commit982d724f3fc21c78e33f65e2fe3d2cce6482a4f9 (patch)
tree807a14cbe44a331f0ec1bc9ac52cd5e42359d28f /resources/utilities/ich9deblob/ich9deblob.c
parent5ff75cb1f5135e7f04328e82418f8e3519ecf526 (diff)
downloadlibreboot-982d724f3fc21c78e33f65e2fe3d2cce6482a4f9.zip
libreboot-982d724f3fc21c78e33f65e2fe3d2cce6482a4f9.tar.gz
libreboot-982d724f3fc21c78e33f65e2fe3d2cce6482a4f9.tar.bz2
ich9deblob: reduce compatibility checks to a single function call
Diffstat (limited to 'resources/utilities/ich9deblob/ich9deblob.c')
-rw-r--r--resources/utilities/ich9deblob/ich9deblob.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/resources/utilities/ich9deblob/ich9deblob.c b/resources/utilities/ich9deblob/ich9deblob.c
index 32c2f1f..ad4960c 100644
--- a/resources/utilities/ich9deblob/ich9deblob.c
+++ b/resources/utilities/ich9deblob/ich9deblob.c
@@ -65,6 +65,7 @@ int systemIsBigEndian();
int structBitfieldWrongOrder();
int structMembersWrongOrder();
struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k);
+int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k);
int main(int argc, char *argv[])
{
@@ -101,10 +102,7 @@ int main(int argc, char *argv[])
// -----------------------------------------------------------------------------------------------
// Compatibility checks. This version of ich9deblob is not yet porable.
- if (structSizesIncorrect(factoryDescriptorStruct, factoryGbeStruct8k)) return 1;
- if (systemIsBigEndian()) return 1;
- if (structBitfieldWrongOrder()) return 1;
- if (structMembersWrongOrder()) return 1;
+ if (systemOrCompilerIncompatible(factoryDescriptorStruct, factoryGbeStruct8k)) return 1;
// -----------------------------------------------------------------------------------------------
@@ -390,6 +388,16 @@ int structBitfieldWrongOrder() {
return 0;
}
+// Compatibility checks. This version of ich9deblob is not yet porable.
+int systemOrCompilerIncompatible(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k)
+{
+ if (structSizesIncorrect(descriptorStruct, gbeStruct8k)) return 1;
+ if (systemIsBigEndian()) return 1;
+ if (structBitfieldWrongOrder()) return 1;
+ if (structMembersWrongOrder()) return 1;
+ return 0;
+}
+
struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k)
{
// Correct the main gbe region. By default, the X200 (as shipped from Lenovo) comes