summaryrefslogtreecommitdiffstats
path: root/resources/utilities
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2014-12-22 13:58:44 (EST)
committer Francis Rowe <info@gluglug.org.uk>2014-12-22 13:58:44 (EST)
commit5657256aa9bbecef196fc609d25e263743287430 (patch)
tree3c90a3f461368d9723ca00f85a71b90ea2a67d39 /resources/utilities
parent4908830fdc561d76843220722e594d8e456d45b6 (diff)
downloadlibreboot-5657256aa9bbecef196fc609d25e263743287430.zip
libreboot-5657256aa9bbecef196fc609d25e263743287430.tar.gz
libreboot-5657256aa9bbecef196fc609d25e263743287430.tar.bz2
ich9deblob: move Gbe deblobbing to a separate function
Diffstat (limited to 'resources/utilities')
-rw-r--r--resources/utilities/ich9deblob/ich9deblob.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/resources/utilities/ich9deblob/ich9deblob.c b/resources/utilities/ich9deblob/ich9deblob.c
index 216c8d0..e2801e1 100644
--- a/resources/utilities/ich9deblob/ich9deblob.c
+++ b/resources/utilities/ich9deblob/ich9deblob.c
@@ -64,6 +64,7 @@ int structSizesIncorrect(struct DESCRIPTORREGIONRECORD descriptorDummy, struct G
int systemIsBigEndian();
int structBitfieldWrongOrder();
int structMembersWrongOrder();
+struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k);
int main(int argc, char *argv[])
{
@@ -191,12 +192,8 @@ int main(int argc, char *argv[])
// ----------------------------------------------------------------------------------------------------------------
- // Correct the main gbe region. By default, the X200 (as shipped from Lenovo) comes
- // with a broken main gbe region, where the backup gbe region is used instead. Modify
- // the descriptor so that the main region is usable.
-
- deblobbedGbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(deblobbedGbeStruct8k.backup, 0xBABA);
- memcpy(&deblobbedGbeStruct8k.main, &deblobbedGbeStruct8k.backup, GBEREGIONSIZE>>1);
+ // Modify the Gbe descriptor (see function for details)
+ deblobbedGbeStruct8k = deblobbedGbeStructFromFactory(factoryGbeStruct8k);
// ----------------------------------------------------------------------------------------------------------------
@@ -390,6 +387,21 @@ int structBitfieldWrongOrder() {
return 0;
}
+struct GBEREGIONRECORD_8K deblobbedGbeStructFromFactory(struct GBEREGIONRECORD_8K factoryGbeStruct8k)
+{
+ // Correct the main gbe region. By default, the X200 (as shipped from Lenovo) comes
+ // with a broken main gbe region, where the backup gbe region is used instead. Modify
+ // the descriptor so that the main region is usable.
+
+ struct GBEREGIONRECORD_8K deblobbedGbeStruct8k;
+ memcpy(&deblobbedGbeStruct8k, &factoryGbeStruct8k, GBEREGIONSIZE);
+
+ deblobbedGbeStruct8k.backup.checkSum = gbeGetChecksumFrom4kStruct(deblobbedGbeStruct8k.backup, 0xBABA);
+ memcpy(&deblobbedGbeStruct8k.main, &deblobbedGbeStruct8k.backup, GBEREGIONSIZE>>1);
+
+ return deblobbedGbeStruct8k;
+}
+
// Modify the flash descriptor, to remove the ME/AMT, and disable all other regions
// Only Flash Descriptor, Gbe and BIOS regions (BIOS region fills romSize-12k) are left.
// Tested on ThinkPad X200 and X200S. X200T and other GM45 targets may also work.