summaryrefslogtreecommitdiffstats
path: root/resources/utilities
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-07-18 19:31:16 (EDT)
committer Francis Rowe <info@gluglug.org.uk>2015-09-20 04:06:27 (EDT)
commitd1bb5d6fcc75f07ca6a58b5536906980aff9d253 (patch)
tree7821900fe16ece180a021957371a7c0b798922dd /resources/utilities
parent919af0e6b7cbff2171d370a0b830f2b9d740410b (diff)
downloadlibreboot-d1bb5d6fcc75f07ca6a58b5536906980aff9d253.zip
libreboot-d1bb5d6fcc75f07ca6a58b5536906980aff9d253.tar.gz
libreboot-d1bb5d6fcc75f07ca6a58b5536906980aff9d253.tar.bz2
New board: ThinkPad R500 (experimental)
The ich9deblob and ich9gen utilities were modified, so that they support reading and/or writing descriptor images where the GbE region is not defined. These utilities were also re-factored and tidied up a bit. A quick was noticed during the course of this work, in that Compenent 1 Density was being set to 8MiB constantly, even on systems with 4MiB flash chips. Component 2 Density was set statically to 2MiB. ich9gen now sets both to 4MiB or 8MiB, depending on whether building the descriptor for a 4MiB or 8MiB ROM image. There are still some ACPI bugs (see docs/hcl/r500.html), which will have to be fixed upstream. TODO: get hw reg dumps from a factory R500, and compare with the X200 or T400 dumps.
Diffstat (limited to 'resources/utilities')
-rwxr-xr-xresources/utilities/coreboot-libre/deblob3
-rw-r--r--resources/utilities/ich9deblob/src/demefactory.c9
-rw-r--r--resources/utilities/ich9deblob/src/descriptor/descriptor.c243
-rw-r--r--resources/utilities/ich9deblob/src/descriptor/descriptor.h22
-rw-r--r--resources/utilities/ich9deblob/src/ich9deblob.c102
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen.c23
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen.h3
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c34
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h8
9 files changed, 288 insertions, 159 deletions
diff --git a/resources/utilities/coreboot-libre/deblob b/resources/utilities/coreboot-libre/deblob
index 65611b3..bc488bd 100755
--- a/resources/utilities/coreboot-libre/deblob
+++ b/resources/utilities/coreboot-libre/deblob
@@ -156,6 +156,9 @@ rm -f \
# Purpose unknown. TODO: investigate
# ----------------------------------
+# <Stepan> francis7: util/broadcom/secimage/misc.c is a precalculated crc32 polynome table
+# <Stepan> It's just a standard crc32 implementation
+
rm -f \
"util/broadcom/secimage/misc.c"
diff --git a/resources/utilities/ich9deblob/src/demefactory.c b/resources/utilities/ich9deblob/src/demefactory.c
index 13e0f0b..56618f5 100644
--- a/resources/utilities/ich9deblob/src/demefactory.c
+++ b/resources/utilities/ich9deblob/src/demefactory.c
@@ -52,7 +52,7 @@ int main()
/*
* ------------------------------------------------------------------
- * Extract the descriptor and gbe regions from the factory.rom dump
+ * Extract the descriptor region from the factory.rom dump
* ------------------------------------------------------------------
*/
FILE* fp = NULL;
@@ -98,7 +98,8 @@ int main()
*/
// Disable the ME/TPM:
- descriptorStruct = descriptorDisableMeTpm(descriptorStruct);
+ descriptorStruct = descriptorDisableMe(descriptorStruct);
+ descriptorStruct = descriptorDisableTpm(descriptorStruct);
/* Host/CPU is allowed to read/write all regions. */
descriptorStruct = descriptorHostRegionsUnlocked(descriptorStruct);
@@ -111,7 +112,7 @@ int main()
/*
* ------------------------------------------------------------------
- * Create the file with the modified descriptor and gbe inside
+ * Create the file with the modified descriptor inside
* ------------------------------------------------------------------
*/
@@ -122,7 +123,7 @@ int main()
/*
* ------------------------------------------------------------------
- * Generate ich9gen data (C code that will recreate the deblobbed descriptor+gbe from scratch)
+ * Generate ich9gen data (C code that will recreate the deactivatedME descriptor from scratch)
* ------------------------------------------------------------------
*/
/* Code for generating the Descriptor struct */
diff --git a/resources/utilities/ich9deblob/src/descriptor/descriptor.c b/resources/utilities/ich9deblob/src/descriptor/descriptor.c
index c627afa..5a89813 100644
--- a/resources/utilities/ich9deblob/src/descriptor/descriptor.c
+++ b/resources/utilities/ich9deblob/src/descriptor/descriptor.c
@@ -28,14 +28,13 @@
/*
* ---------------------------------------------------------------------
- * Descriptor functions
+ * Descriptor related functions
* ---------------------------------------------------------------------
*/
/* Set the Host CPU / BIOS region to have read-write access on all regions */
struct DESCRIPTORREGIONRECORD descriptorHostRegionsUnlocked(struct DESCRIPTORREGIONRECORD descriptorStruct)
-{
- /* FLMSTR1 (Host CPU / BIOS) */
+{
descriptorStruct.masterAccessSection.flMstr1.fdRegionReadAccess = 0x1;
descriptorStruct.masterAccessSection.flMstr1.biosRegionReadAccess = 0x1;
descriptorStruct.masterAccessSection.flMstr1.meRegionReadAccess = 0x1;
@@ -46,14 +45,13 @@ struct DESCRIPTORREGIONRECORD descriptorHostRegionsUnlocked(struct DESCRIPTORREG
descriptorStruct.masterAccessSection.flMstr1.meRegionWriteAccess = 0x1;
descriptorStruct.masterAccessSection.flMstr1.gbeRegionWriteAccess = 0x1;
descriptorStruct.masterAccessSection.flMstr1.pdRegionWriteAccess = 0x1;
-
+
return descriptorStruct;
}
/* Set the ME to have *no* read-write access on any region */
struct DESCRIPTORREGIONRECORD descriptorMeRegionsForbidden(struct DESCRIPTORREGIONRECORD descriptorStruct)
-{
- /* FLMSTR2 (ME) */
+{
descriptorStruct.masterAccessSection.flMstr2.fdRegionReadAccess = 0x0;
descriptorStruct.masterAccessSection.flMstr2.biosRegionReadAccess = 0x0;
descriptorStruct.masterAccessSection.flMstr2.meRegionReadAccess = 0x0;
@@ -64,92 +62,84 @@ struct DESCRIPTORREGIONRECORD descriptorMeRegionsForbidden(struct DESCRIPTORREGI
descriptorStruct.masterAccessSection.flMstr2.meRegionWriteAccess = 0x0;
descriptorStruct.masterAccessSection.flMstr2.gbeRegionWriteAccess = 0x0;
descriptorStruct.masterAccessSection.flMstr2.pdRegionWriteAccess = 0x0;
-
+
return descriptorStruct;
}
-
-struct DESCRIPTORREGIONRECORD descriptorMePlatformRegionsRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct)
+
+/* Disable (delete) the ME region */
+struct DESCRIPTORREGIONRECORD descriptorMeRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct)
{
- /*
- * set number of regions from 4 -> 2 (0 based, so 4 means 5 and 2
- * means 3. We want 3 regions: descriptor, gbe and bios, in that order)
- */
- descriptorStruct.flMaps.flMap0.NR = 2;
-
- /*
- * There are 5 regions. Since we set the number now to 3, that means
- * we need to disable 2 regions. ME and Platform will be disabled!
- *
- * To disable a region, set the BASE to 1FFF. Shifted by FLREGIONBITSHIFT,
- * this puts the beginning of that region well outside the ROM image.
- * Also set the LIMIT to 0.
- */
- /* Disable (delete) the ME region */
descriptorStruct.regionSection.flReg2.BASE = 0x1FFF;
descriptorStruct.regionSection.flReg2.LIMIT = 0;
- /* Disable (delete) the Platform region */
+
+ return descriptorStruct;
+}
+
+/* Disable (delete) the Platform region */
+struct DESCRIPTORREGIONRECORD descriptorPlatformRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct)
+{
descriptorStruct.regionSection.flReg4.BASE = 0x1FFF;
descriptorStruct.regionSection.flReg4.LIMIT = 0;
return descriptorStruct;
}
-struct DESCRIPTORREGIONRECORD descriptorDisableMeTpm(struct DESCRIPTORREGIONRECORD descriptorStruct)
+/* Disable the ME in ICHSTRAP0 and MCHSTRAP0 */
+struct DESCRIPTORREGIONRECORD descriptorDisableMe(struct DESCRIPTORREGIONRECORD descriptorStruct)
+{
+ descriptorStruct.ichStraps.ichStrap0.meDisable = 1;
+ descriptorStruct.mchStraps.mchStrap0.meDisable = 1;
+
+ return descriptorStruct;
+}
+
+/* Disable the TPM in MCHSTRAP0 */
+struct DESCRIPTORREGIONRECORD descriptorDisableTpm(struct DESCRIPTORREGIONRECORD descriptorStruct)
{
- descriptorStruct.ichStraps.ichStrap0.meDisable = 1; /* Disable the ME in ICHSTRAP0 */
- descriptorStruct.mchStraps.mchStrap0.meDisable = 1; /* Disable the ME in MCHSTRAP0 */
- descriptorStruct.mchStraps.mchStrap0.tpmDisable = 1; /* Disable the TPM in MCHSTRAP0 */
+ descriptorStruct.mchStraps.mchStrap0.tpmDisable = 1;
return descriptorStruct;
}
+/* Relocate the Gbe region to begin at 4KiB (immediately after the flash descriptor) */
struct DESCRIPTORREGIONRECORD descriptorMoveGbeToStart(struct DESCRIPTORREGIONRECORD descriptorStruct)
{
- /* Relocate the Gbe region to begin at 4KiB (immediately after the flash descriptor) */
descriptorStruct.regionSection.flReg3.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT;
descriptorStruct.regionSection.flReg3.LIMIT = GBEREGIONSIZE_8K >> FLREGIONBITSHIFT;
return descriptorStruct;
}
+/* Disable (delete) the GbE region */
+struct DESCRIPTORREGIONRECORD descriptorGbeRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct)
+{
+ descriptorStruct.regionSection.flReg3.BASE = 0x1FFF;
+ descriptorStruct.regionSection.flReg3.LIMIT = 0;
+
+ return descriptorStruct;
+}
+
+/* BIOS Region begin after descriptor+gbe at first 12KiB, fills the rest of the image */
struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterGbe(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize)
{
- /* BIOS Region begin after descriptor+gbe at first 12KiB, fills the rest of the image */
descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + GBEREGIONSIZE_8K) >> FLREGIONBITSHIFT;
descriptorStruct.regionSection.flReg1.LIMIT = (romSize >> FLREGIONBITSHIFT) - 1;
return descriptorStruct;
}
-
-struct DESCRIPTORREGIONRECORD deblobbedDescriptorStructFromFactory(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize)
+
+/* BIOS Region begin after descriptor at first 4KiB, fills the rest of the image */
+struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterDescriptor(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize)
+{
+ descriptorStruct.regionSection.flReg1.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT;
+ descriptorStruct.regionSection.flReg1.LIMIT = (romSize >> FLREGIONBITSHIFT) - 1;
+
+ return descriptorStruct;
+}
+
+/* Set OEM string to "LIBERATE" */
+struct DESCRIPTORREGIONRECORD descriptorOemString(struct DESCRIPTORREGIONRECORD descriptorStruct)
{
- // Disable the ME/TPM and remove the ME/Platform regions:
- descriptorStruct = descriptorMePlatformRegionsRemoved(descriptorStruct);
- descriptorStruct = descriptorDisableMeTpm(descriptorStruct);
-
- // Move GbE region to the start of the image (after the descriptor)
- descriptorStruct = descriptorMoveGbeToStart(descriptorStruct);
-
- /* BIOS region fills the remaining space */
- descriptorStruct = descriptorBiosRegionFillImageAfterGbe(descriptorStruct, romSize);
-
- /*
- * Set region read/write access
- * -------------
- */
-
- /* Host/CPU is allowed to read/write all regions. */
- descriptorStruct = descriptorHostRegionsUnlocked(descriptorStruct);
- /* The ME is disallowed read-write access to all regions
- * (this is probably redundant, since the ME is already removed from libreboot) */
- descriptorStruct = descriptorMeRegionsForbidden(descriptorStruct);
-
- /*
- * Miscellaneous
- * -------------
- */
-
- /* Set OEM string to "LIBERATE" */
descriptorStruct.oemSection.magicString[0] = 0x4C;
descriptorStruct.oemSection.magicString[1] = 0x49;
descriptorStruct.oemSection.magicString[2] = 0x42;
@@ -158,6 +148,100 @@ struct DESCRIPTORREGIONRECORD deblobbedDescriptorStructFromFactory(struct DESCRI
descriptorStruct.oemSection.magicString[5] = 0x41;
descriptorStruct.oemSection.magicString[6] = 0x54;
descriptorStruct.oemSection.magicString[7] = 0x45;
+
+ return descriptorStruct;
+}
+
+/* Check whether a GbE region is defined by this descriptor.
+ * Not thorough, but should work in most cases */
+int descriptorDefinesGbeRegion(struct DESCRIPTORREGIONRECORD descriptorStruct)
+{
+ if (
+ (descriptorStruct.regionSection.flReg3.BASE == 0x1FFF || descriptorStruct.regionSection.flReg3.BASE == 0xFFF)
+ &&
+ (descriptorStruct.regionSection.flReg3.LIMIT == 0)
+ )
+ return 0; /* has no GbE region */
+ else if (
+ descriptorStruct.ichStraps.ichStrap0.integratedGbe == 0
+ ||
+ descriptorStruct.ichStraps.ichStrap0.lanPhy == 0
+ )
+ return 0; /* has no GbE region */
+ else
+ return 1; /* has a GbE region */
+}
+
+/* Configure the BIOS and GbE regions, as required by libreboot.
+ * Enable or disable the GbE region, based on what's in the descriptor */
+struct DESCRIPTORREGIONRECORD librebootSetGbeBiosDescriptorRegions(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize)
+{
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ {
+ /*
+ * set number of regions from 4 -> 2 (0 based, so 4 means 5 and 2
+ * means 3. We want 3 regions: descriptor, gbe and bios, in that order)
+ */
+ descriptorStruct.flMaps.flMap0.NR = 2;
+ /* Move GbE region to the start of the image (after the descriptor) */
+ descriptorStruct = descriptorMoveGbeToStart(descriptorStruct);
+ /* BIOS region fills the remaining space */
+ descriptorStruct = descriptorBiosRegionFillImageAfterGbe(descriptorStruct, romSize);
+
+ /* GbE region means that an Intel NIC is to be present */
+ descriptorStruct.ichStraps.ichStrap0.integratedGbe = 0x1;
+ descriptorStruct.ichStraps.ichStrap0.lanPhy = 0x1;
+ }
+ else {
+ /*
+ * set number of regions from 4 -> 2 (0 based, so 4 means 5 and 1
+ * means 2. We want 2 regions: descriptor and bios, in that order)
+ */
+ descriptorStruct.flMaps.flMap0.NR = 1;
+ /* Disable the GbE region */
+ descriptorStruct = descriptorGbeRegionRemoved(descriptorStruct);
+ /* BIOS region fills the remaining space, after the descriptor */
+ descriptorStruct = descriptorBiosRegionFillImageAfterDescriptor(descriptorStruct, romSize);
+
+ /* No GbE region means that an onboard NIC is still used, but it's discrete (eg Broadcom) */
+ descriptorStruct.ichStraps.ichStrap0.integratedGbe = 0x0;
+ descriptorStruct.ichStraps.ichStrap0.lanPhy = 0x0;
+ }
+
+ return descriptorStruct;
+}
+
+uint8_t componentDensity(unsigned int romSizeInBytes)
+{
+ /* component density, see Component Section Record. page 848 in the datasheet */
+ switch (romSizeInBytes)
+ {
+ case ROMSIZE_512KB: return 0;
+ case ROMSIZE_1MB: return 1;
+ case ROMSIZE_2MB: return 2;
+ case ROMSIZE_4MB: return 3;
+ case ROMSIZE_8MB: return 4;
+ case ROMSIZE_16MB: return 5;
+ default: return 0x7; /* reserved value */
+ }
+}
+
+/* From a factory.rom image, create a modified descriptor region, suitable
+ * for use by the libreboot project */
+struct DESCRIPTORREGIONRECORD librebootDescriptorStructFromFactory(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize)
+{
+ /* Enable or disable the GbE region, from what's in the descriptor */
+ descriptorStruct = librebootSetGbeBiosDescriptorRegions(descriptorStruct, romSize);
+
+ /* Disable the ME/TPM and remove the ME/Platform regions: */
+ descriptorStruct = descriptorMeRegionRemoved(descriptorStruct);
+ /* Disable the ME/TPM and remove the ME/Platform regions: */
+ descriptorStruct = descriptorPlatformRegionRemoved(descriptorStruct);
+
+ /* Disable the ME itself, so that it doesn't try to start when this descriptor is in use */
+ descriptorStruct = descriptorDisableMe(descriptorStruct);
+ /* Also disable the TPM, by default */
+ descriptorStruct = descriptorDisableTpm(descriptorStruct);
return descriptorStruct;
}
@@ -192,13 +276,7 @@ int notCreatedHFileForDescriptorCFile(char* outFileName, char* cFileName)
fprintf(fp, "#include <string.h>\n");
fprintf(fp, "#include \"../descriptor/descriptor.h\"\n\n");
- fprintf(fp, "/* ROM image sizes in bytes */\n");
- fprintf(fp, "#define ROMSIZE_4MB 0x400000\n");
- fprintf(fp, "#define ROMSIZE_8MB 0x800000\n\n");
-
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize);\n");
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom4M();\n");
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom8M();\n");
+ fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe);\n");
fprintf(fp, "#endif\n");
@@ -234,7 +312,7 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, "/* Generate a 4KiB Descriptor struct, with default values. */\n");
fprintf(fp, "/* Read ../descriptor/descriptor.h for an explanation of the default values used here */\n\n");
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)\n");
+ fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe)\n");
fprintf(fp, "{\n");
fprintf(fp, " int i;\n");
fprintf(fp, " struct DESCRIPTORREGIONRECORD descriptorStruct;\n");
@@ -250,7 +328,8 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, " descriptorStruct.flMaps.flMap0.NC = 0x%01x;\n", descriptorStruct.flMaps.flMap0.NC);
fprintf(fp, " descriptorStruct.flMaps.flMap0.reserved1 = 0x%02x;\n", descriptorStruct.flMaps.flMap0.reserved1);
fprintf(fp, " descriptorStruct.flMaps.flMap0.FRBA = 0x%02x;\n", descriptorStruct.flMaps.flMap0.FRBA);
- fprintf(fp, " descriptorStruct.flMaps.flMap0.NR = 0x%01x; /* see ../descriptor/descriptor.c */\n", descriptorStruct.flMaps.flMap0.NR);
+ fprintf(fp, " /* descriptorStruct.flMaps.flMap0.NR = 0x%01x; */ /* see ../descriptor/descriptor.c */\n", descriptorStruct.flMaps.flMap0.NR);
+ fprintf(fp, " descriptorStruct.flMaps.flMap0.NR = hasGbe ? 0x2 : 0x1; /* see ../descriptor/descriptor.c */\n");
fprintf(fp, " descriptorStruct.flMaps.flMap0.reserved2 = 0x%02x;\n", descriptorStruct.flMaps.flMap0.reserved2);
fprintf(fp, " /* FLMAP1 */\n");
fprintf(fp, " descriptorStruct.flMaps.flMap1.FMBA = 0x%02x;\n", descriptorStruct.flMaps.flMap1.FMBA);
@@ -266,8 +345,10 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
/* Component Section Record */
fprintf(fp, " /* Component Section Record */\n");
fprintf(fp, " /* FLCOMP */\n");
- fprintf(fp, " descriptorStruct.componentSection.flcomp.component1Density = 0x%01x;\n", descriptorStruct.componentSection.flcomp.component1Density);
- fprintf(fp, " descriptorStruct.componentSection.flcomp.component2Density = 0x%01x;\n", descriptorStruct.componentSection.flcomp.component2Density);
+ fprintf(fp, " /* descriptorStruct.componentSection.flcomp.component1Density = 0x%01x; */\n", descriptorStruct.componentSection.flcomp.component1Density);
+ fprintf(fp, " /* descriptorStruct.componentSection.flcomp.component2Density = 0x%01x; */\n", descriptorStruct.componentSection.flcomp.component2Density);
+ fprintf(fp, " descriptorStruct.componentSection.flcomp.component1Density = componentDensity(romSize);\n");
+ fprintf(fp, " descriptorStruct.componentSection.flcomp.component2Density = componentDensity(romSize);\n");
fprintf(fp, " descriptorStruct.componentSection.flcomp.reserved1 = 0x%01x;\n", descriptorStruct.componentSection.flcomp.reserved1);
fprintf(fp, " descriptorStruct.componentSection.flcomp.reserved2 = 0x%02x;\n", descriptorStruct.componentSection.flcomp.reserved2);
fprintf(fp, " descriptorStruct.componentSection.flcomp.reserved3 = 0x%01x;\n", descriptorStruct.componentSection.flcomp.reserved3);
@@ -305,7 +386,7 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, " descriptorStruct.regionSection.flReg0.reserved2 = 0x%01x;\n", descriptorStruct.regionSection.flReg0.reserved2);
fprintf(fp, " /* FLREG1 (BIOS) */\n");
fprintf(fp, " /* descriptorStruct.regionSection.flReg1.BASE = 0x%04x; */\n", descriptorStruct.regionSection.flReg1.BASE);
- fprintf(fp, " descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + GBEREGIONSIZE_8K) >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */\n");
+ fprintf(fp, " descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + (hasGbe ? GBEREGIONSIZE_8K : 0)) >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */\n");
fprintf(fp, " descriptorStruct.regionSection.flReg1.reserved1 = 0x%01x;\n", descriptorStruct.regionSection.flReg1.reserved1);
fprintf(fp, " /* descriptorStruct.regionSection.flReg1.LIMIT = 0x%04x; */\n", descriptorStruct.regionSection.flReg1.LIMIT);
fprintf(fp, " descriptorStruct.regionSection.flReg1.LIMIT = ((romSize >> FLREGIONBITSHIFT) - 1); /* see ../descriptor/descriptor.c */\n");
@@ -317,10 +398,10 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, " descriptorStruct.regionSection.flReg2.reserved2 = 0x%01x;\n", descriptorStruct.regionSection.flReg2.reserved2);
fprintf(fp, " /* FLREG3 (Gbe) */\n");
fprintf(fp, " /* descriptorStruct.regionSection.flReg3.BASE = 0x%04x; */\n", descriptorStruct.regionSection.flReg3.BASE);
- fprintf(fp, " descriptorStruct.regionSection.flReg3.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */\n");
+ fprintf(fp, " descriptorStruct.regionSection.flReg3.BASE = hasGbe ? (DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT) : 0x1fff; /* see ../descriptor/descriptor.c */\n");
fprintf(fp, " descriptorStruct.regionSection.flReg3.reserved1 = 0x%01x;\n", descriptorStruct.regionSection.flReg3.reserved1);
fprintf(fp, " /* descriptorStruct.regionSection.flReg3.LIMIT = 0x%04x; */\n", descriptorStruct.regionSection.flReg3.LIMIT);
- fprintf(fp, " descriptorStruct.regionSection.flReg3.LIMIT = GBEREGIONSIZE_8K >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */\n");
+ fprintf(fp, " descriptorStruct.regionSection.flReg3.LIMIT = hasGbe ? (GBEREGIONSIZE_8K >> FLREGIONBITSHIFT) : 0x0000; /* see ../descriptor/descriptor.c */\n");
fprintf(fp, " descriptorStruct.regionSection.flReg3.reserved2 = 0x%01x;\n", descriptorStruct.regionSection.flReg3.reserved2);
fprintf(fp, " /* FLREG4 (Platform) */\n");
fprintf(fp, " descriptorStruct.regionSection.flReg4.BASE = 0x%04x; /* see ../descriptor/descriptor.c */\n", descriptorStruct.regionSection.flReg4.BASE);
@@ -411,8 +492,8 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.bmcMode = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.bmcMode);
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.tripPointSelect = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.tripPointSelect);
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.reserved2 = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.reserved2);
- fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.integratedGbe = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.integratedGbe);
- fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.lanPhy = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.lanPhy);
+ fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.integratedGbe = hasGbe ? 0x1 : 0x0;\n");
+ fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.lanPhy = hasGbe ? 0x1 : 0x0;\n");
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.reserved3 = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.reserved3);
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.dmiRequesterId = 0x%01x;\n", descriptorStruct.ichStraps.ichStrap0.dmiRequesterId);
fprintf(fp, " descriptorStruct.ichStraps.ichStrap0.smBus2Address = 0x%02x;\n", descriptorStruct.ichStraps.ichStrap0.smBus2Address);
@@ -520,16 +601,6 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor
fprintf(fp, " return descriptorStruct;\n");
fprintf(fp, "}\n\n");
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom4M()\n");
- fprintf(fp, "{\n");
- fprintf(fp, " return generatedDescriptorStruct(ROMSIZE_4MB);\n");
- fprintf(fp, "}\n\n");
-
- fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom8M()\n");
- fprintf(fp, "{\n");
- fprintf(fp, " return generatedDescriptorStruct(ROMSIZE_8MB);\n");
- fprintf(fp, "}\n\n");
-
/* ------------------------------ */
fclose(fp); /* Always close the file when done. */
diff --git a/resources/utilities/ich9deblob/src/descriptor/descriptor.h b/resources/utilities/ich9deblob/src/descriptor/descriptor.h
index 47a619c..64e381c 100644
--- a/resources/utilities/ich9deblob/src/descriptor/descriptor.h
+++ b/resources/utilities/ich9deblob/src/descriptor/descriptor.h
@@ -46,6 +46,14 @@
/* size of the descriptor in bytes */
#define DESCRIPTORREGIONSIZE 0x1000
+/* ROM image sizes in bytes */
+#define ROMSIZE_512KB 0x80000
+#define ROMSIZE_1MB 0x100000
+#define ROMSIZE_2MB 0x200000
+#define ROMSIZE_4MB 0x400000
+#define ROMSIZE_8MB 0x800000
+#define ROMSIZE_16MB 0x1000000
+
/*
* Related to the flash descriptor
* bits 12(0xC)-24(0x18) are represented for words found in the flash descriptor
@@ -305,11 +313,19 @@ struct DESCRIPTORREGIONRECORD
struct DESCRIPTORREGIONRECORD descriptorHostRegionsUnlocked(struct DESCRIPTORREGIONRECORD descriptorStruct);
struct DESCRIPTORREGIONRECORD descriptorMeRegionsForbidden(struct DESCRIPTORREGIONRECORD descriptorStruct);
-struct DESCRIPTORREGIONRECORD descriptorMePlatformRegionsRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct);
-struct DESCRIPTORREGIONRECORD descriptorDisableMeTpm(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD descriptorMeRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD descriptorPlatformRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD descriptorDisableMe(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD descriptorDisableTpm(struct DESCRIPTORREGIONRECORD descriptorStruct);
struct DESCRIPTORREGIONRECORD descriptorMoveGbeToStart(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD descriptorGbeRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct);
struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterGbe(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize);
-struct DESCRIPTORREGIONRECORD deblobbedDescriptorStructFromFactory(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize);
+struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterDescriptor(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize);
+struct DESCRIPTORREGIONRECORD descriptorOemString(struct DESCRIPTORREGIONRECORD descriptorStruct);
+int descriptorDefinesGbeRegion(struct DESCRIPTORREGIONRECORD descriptorStruct);
+struct DESCRIPTORREGIONRECORD librebootSetGbeBiosDescriptorRegions(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize);
+uint8_t componentDensity(unsigned int romSizeInBytes);
+struct DESCRIPTORREGIONRECORD librebootDescriptorStructFromFactory(struct DESCRIPTORREGIONRECORD descriptorStruct, unsigned int romSize);
int notCreatedHFileForDescriptorCFile(char* outFileName, char* cFileName);
int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptorStruct, char* outFileName, char* headerFileName);
void printDescriptorRegionLocations(struct DESCRIPTORREGIONRECORD descriptorStruct, char* romName);
diff --git a/resources/utilities/ich9deblob/src/ich9deblob.c b/resources/utilities/ich9deblob/src/ich9deblob.c
index 72ade04..97db628 100644
--- a/resources/utilities/ich9deblob/src/ich9deblob.c
+++ b/resources/utilities/ich9deblob/src/ich9deblob.c
@@ -5,7 +5,7 @@
* Purpose: disable and remove the ME from ich9m/gm45 systems in coreboot.
*
* Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org>
- * Francis Rowe <info@gluglug.org.uk>
+ * Copyright (C) 2014,2015 Francis Rowe <info@gluglug.org.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@ int main()
char* romFilename = "factory.rom";
char* descriptorGbeFilename = "deblobbed_descriptor.bin";
+ char* descriptorNoGbeFilename = "deblobbed_4kdescriptor.bin";
unsigned int bufferLength;
unsigned int romSize;
@@ -99,22 +100,25 @@ int main()
}
printf("\ndescriptor region read successfully\n");
- gbeRegionStart = descriptorStruct.regionSection.flReg3.BASE << FLREGIONBITSHIFT;
-
- /*
- * Set offset so that we can read the data from
- * the gbe region
- */
- fseek(fp, gbeRegionStart, SEEK_SET);
- /* Read the gbe data from the factory.rom and put it in factoryGbeBuffer8k */
- bufferLength = fread(gbeBuffer8k, 1, GBEREGIONSIZE_8K, fp);
- if (GBEREGIONSIZE_8K != bufferLength)
+ if (descriptorDefinesGbeRegion(descriptorStruct))
{
- printf("\nerror: could not read GBe region from %s (%i) bytes read\n", romFilename, bufferLength);
- fclose(fp);
- return 1;
+ gbeRegionStart = descriptorStruct.regionSection.flReg3.BASE << FLREGIONBITSHIFT;
+
+ /*
+ * Set offset so that we can read the data from
+ * the gbe region
+ */
+ fseek(fp, gbeRegionStart, SEEK_SET);
+ /* Read the gbe data from the factory.rom and put it in factoryGbeBuffer8k */
+ bufferLength = fread(gbeBuffer8k, 1, GBEREGIONSIZE_8K, fp);
+ if (GBEREGIONSIZE_8K != bufferLength)
+ {
+ printf("\nerror: could not read GBe region from %s (%i) bytes read\n", romFilename, bufferLength);
+ fclose(fp);
+ return 1;
+ }
+ printf("\ngbe (8KiB) region read successfully\n");
}
- printf("\ngbe (8KiB) region read successfully\n");
fseek(fp, 0L, SEEK_END);
romSize = ftell(fp);
@@ -124,7 +128,9 @@ int main()
/* Debugging (before modification) */
printDescriptorRegionLocations(descriptorStruct, "Original");
- printGbeChecksumDataFromStruct8k(gbeStruct8k, "Original");
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ printGbeChecksumDataFromStruct8k(gbeStruct8k, "Original");
+ else printf("NO GBE REGION\n");
/*
* ------------------------------------------------------------------
@@ -133,24 +139,45 @@ int main()
*/
/* Delete the ME/Platform regions, place Gbe after the descriptor, resize BIOS region to fill the gap */
- descriptorStruct = deblobbedDescriptorStructFromFactory(descriptorStruct, romSize);
+ descriptorStruct = librebootDescriptorStructFromFactory(descriptorStruct, romSize);
+
+ /* The ME is disallowed read-write access to all regions
+ * (this is probably redundant, since the ME firmware is already removed from libreboot) */
+ descriptorStruct = descriptorMeRegionsForbidden(descriptorStruct);
+ /* Host/CPU is allowed to read/write all regions.
+ * This makes flashrom -p internal work */
+ descriptorStruct = descriptorHostRegionsUnlocked(descriptorStruct);
+
+ /* Set OEM string */
+ descriptorStruct = descriptorOemString(descriptorStruct);
/* Modify the Gbe region (see function for details) */
- gbeStruct8k = deblobbedGbeStructFromFactory(gbeStruct8k);
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ gbeStruct8k = deblobbedGbeStructFromFactory(gbeStruct8k);
/* Debugging (after modifying the descriptor and gbe regions) */
printDescriptorRegionLocations(descriptorStruct, "Modified");
- printGbeChecksumDataFromStruct8k(gbeStruct8k, "Modified");
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ printGbeChecksumDataFromStruct8k(gbeStruct8k, "Modified");
+ else printf("NO GBE REGION\n");
/*
* ------------------------------------------------------------------
* Create the file with the modified descriptor and gbe inside
* ------------------------------------------------------------------
*/
-
printf("\n");
- if (notCreatedDescriptorGbeFile(descriptorStruct, gbeStruct8k, descriptorGbeFilename)) {
- return 1;
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ {
+ if (notCreatedDescriptorGbeFile(descriptorStruct, gbeStruct8k, descriptorGbeFilename)) {
+ return 1;
+ }
+ }
+ else
+ {
+ if (notCreated4kDescriptorFile(descriptorStruct, descriptorNoGbeFilename)) {
+ return 1;
+ }
}
/*
@@ -166,18 +193,29 @@ int main()
if (notCreatedCFileFromDescriptorStruct(descriptorStruct, "mkdescriptor.c", "mkdescriptor.h")) {
return 1;
}
-
- /* Code for generating the Gbe struct */
- /* mkgbe.h */
- if (notCreatedHFileForGbeCFile("mkgbe.h", "mkgbe.c")) {
- return 1;
- } /* and now mkgbe.c */
- if (notCreatedCFileFromGbeStruct4k(gbeStruct8k.backup, "mkgbe.c", "mkgbe.h")) {
- return 1;
+
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ {
+ /* Code for generating the Gbe struct */
+ /* mkgbe.h */
+ if (notCreatedHFileForGbeCFile("mkgbe.h", "mkgbe.c")) {
+ return 1;
+ } /* and now mkgbe.c */
+ if (notCreatedCFileFromGbeStruct4k(gbeStruct8k.backup, "mkgbe.c", "mkgbe.h")) {
+ return 1;
+ }
}
- printf("The modified descriptor and gbe regions have also been dumped as src files: mkdescriptor.c, mkdescriptor.h, mkgbe.c, mkgbe.h\n");
- printf("To use these in ich9gen, place them in src/ich9gen/ and re-build ich9gen.\n\n");
+ if (descriptorDefinesGbeRegion(descriptorStruct))
+ {
+ printf("The modified descriptor and gbe regions have also been dumped as src files: mkdescriptor.c, mkdescriptor.h, mkgbe.c, mkgbe.h\n");
+ printf("To use these in ich9gen, place them in src/ich9gen/ and re-build ich9gen.\n\n");
+ }
+ else
+ {
+ printf("The modified descriptor region have also been dumped as src files: mkdescriptor.c, mkdescriptor.h\n");
+ printf("To use these in ich9gen, place them in src/ich9gen/ and re-build ich9gen.\n\n");
+ }
return 0;
}
diff --git a/resources/utilities/ich9deblob/src/ich9gen.c b/resources/utilities/ich9deblob/src/ich9gen.c
index d07c550..df5da79 100644
--- a/resources/utilities/ich9deblob/src/ich9gen.c
+++ b/resources/utilities/ich9deblob/src/ich9gen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Francis Rowe <info@gluglug.org.uk>
+ * Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,8 +25,10 @@ int main(int argc, char *argv[])
int i, j;
struct GBEREGIONRECORD_8K gbeStruct8k = generatedGbeStruct8k();
- struct DESCRIPTORREGIONRECORD descriptorStruct4M = generatedDescriptorStructRom4M();
- struct DESCRIPTORREGIONRECORD descriptorStruct8M = generatedDescriptorStructRom8M();
+ struct DESCRIPTORREGIONRECORD descriptorStruct4M = generatedDescriptorStruct(ROMSIZE_4MB, WITHGBE);
+ struct DESCRIPTORREGIONRECORD descriptorStruct8M = generatedDescriptorStruct(ROMSIZE_8MB, WITHGBE);
+ struct DESCRIPTORREGIONRECORD descriptorStructNoGbe4M = generatedDescriptorStruct(ROMSIZE_4MB, WITHOUTGBE);
+ struct DESCRIPTORREGIONRECORD descriptorStructNoGbe8M = generatedDescriptorStruct(ROMSIZE_8MB, WITHOUTGBE);
/* Only for the compatibility checks */
struct DESCRIPTORREGIONRECORD dummyDescriptorStruct;
@@ -120,5 +122,20 @@ int main(int argc, char *argv[])
return 1;
}
+ /*
+ * ------------------------------------------------------------------
+ * Generate the 4KiB files (descriptors without GbE), ready to be used in a libreboot image
+ * In these descriptors, the onboard Intel GbE NIC is disabled; a discrete one is used instead
+ * ------------------------------------------------------------------
+ */
+
+ if (notCreated4kDescriptorFile(descriptorStructNoGbe4M, "ich9fdnogbe_4m.bin")) {
+ return 1;
+ }
+
+ if (notCreated4kDescriptorFile(descriptorStructNoGbe8M, "ich9fdnogbe_8m.bin")) {
+ return 1;
+ }
+
return 0;
}
diff --git a/resources/utilities/ich9deblob/src/ich9gen.h b/resources/utilities/ich9deblob/src/ich9gen.h
index 25cf340..38b6ce4 100644
--- a/resources/utilities/ich9deblob/src/ich9gen.h
+++ b/resources/utilities/ich9deblob/src/ich9gen.h
@@ -31,6 +31,9 @@
#include "descriptor/descriptor.h" /* structs describing what's in the descriptor region */
#include "gbe/gbe.h" /* structs describing what's in the gbe region */
+#define WITHGBE 1
+#define WITHOUTGBE 0
+
int main(int argc, char *argv[]);
#endif
diff --git a/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c b/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c
index cc7e022..3503d54 100644
--- a/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c
+++ b/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Francis Rowe <info@gluglug.org.uk>
+ * Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
/* Generate a 4KiB Descriptor struct, with default values. */
/* Read ../descriptor/descriptor.h for an explanation of the default values used here */
-struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
+struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe)
{
int i;
struct DESCRIPTORREGIONRECORD descriptorStruct;
@@ -34,7 +34,7 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
descriptorStruct.flMaps.flMap0.NC = 0x0;
descriptorStruct.flMaps.flMap0.reserved1 = 0x00;
descriptorStruct.flMaps.flMap0.FRBA = 0x04;
- descriptorStruct.flMaps.flMap0.NR = 0x2; /* see ../descriptor/descriptor.c */
+ descriptorStruct.flMaps.flMap0.NR = hasGbe ? 0x2 : 0x1; /* see ../descriptor/descriptor.c */
descriptorStruct.flMaps.flMap0.reserved2 = 0x00;
/* FLMAP1 */
descriptorStruct.flMaps.flMap1.FMBA = 0x06;
@@ -49,8 +49,8 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
/* Component Section Record */
/* FLCOMP */
- descriptorStruct.componentSection.flcomp.component1Density = 0x4;
- descriptorStruct.componentSection.flcomp.component2Density = 0x2;
+ descriptorStruct.componentSection.flcomp.component1Density = componentDensity(romSize);
+ descriptorStruct.componentSection.flcomp.component2Density = componentDensity(romSize);
descriptorStruct.componentSection.flcomp.reserved1 = 0x0;
descriptorStruct.componentSection.flcomp.reserved2 = 0x00;
descriptorStruct.componentSection.flcomp.reserved3 = 0x0;
@@ -76,10 +76,8 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
descriptorStruct.regionSection.flReg0.LIMIT = 0x0000;
descriptorStruct.regionSection.flReg0.reserved2 = 0x0;
/* FLREG1 (BIOS) */
- /* descriptorStruct.regionSection.flReg1.BASE = 0x0003; */
- descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + GBEREGIONSIZE_8K) >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */
+ descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + (hasGbe ? GBEREGIONSIZE_8K : 0)) >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */
descriptorStruct.regionSection.flReg1.reserved1 = 0x0;
- /* descriptorStruct.regionSection.flReg1.LIMIT = 0x07ff; */
descriptorStruct.regionSection.flReg1.LIMIT = ((romSize >> FLREGIONBITSHIFT) - 1); /* see ../descriptor/descriptor.c */
descriptorStruct.regionSection.flReg1.reserved2 = 0x0;
/* FLREG2 (ME) */
@@ -88,11 +86,9 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
descriptorStruct.regionSection.flReg2.LIMIT = 0x0000; /* see ../descriptor/descriptor.c */
descriptorStruct.regionSection.flReg2.reserved2 = 0x0;
/* FLREG3 (Gbe) */
- /* descriptorStruct.regionSection.flReg3.BASE = 0x0001; */
- descriptorStruct.regionSection.flReg3.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */
+ descriptorStruct.regionSection.flReg3.BASE = hasGbe ? (DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT) : 0x1fff; /* see ../descriptor/descriptor.c */
descriptorStruct.regionSection.flReg3.reserved1 = 0x0;
- /* descriptorStruct.regionSection.flReg3.LIMIT = 0x0002; */
- descriptorStruct.regionSection.flReg3.LIMIT = GBEREGIONSIZE_8K >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */
+ descriptorStruct.regionSection.flReg3.LIMIT = hasGbe ? (GBEREGIONSIZE_8K >> FLREGIONBITSHIFT) : 0x0000; /* see ../descriptor/descriptor.c */
descriptorStruct.regionSection.flReg3.reserved2 = 0x0;
/* FLREG4 (Platform) */
descriptorStruct.regionSection.flReg4.BASE = 0x1fff; /* see ../descriptor/descriptor.c */
@@ -161,8 +157,8 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
descriptorStruct.ichStraps.ichStrap0.bmcMode = 0x0;
descriptorStruct.ichStraps.ichStrap0.tripPointSelect = 0x0;
descriptorStruct.ichStraps.ichStrap0.reserved2 = 0x0;
- descriptorStruct.ichStraps.ichStrap0.integratedGbe = 0x1;
- descriptorStruct.ichStraps.ichStrap0.lanPhy = 0x1;
+ descriptorStruct.ichStraps.ichStrap0.integratedGbe = hasGbe ? 0x1 : 0x0;
+ descriptorStruct.ichStraps.ichStrap0.lanPhy = hasGbe ? 0x1 : 0x0;
descriptorStruct.ichStraps.ichStrap0.reserved3 = 0x0;
descriptorStruct.ichStraps.ichStrap0.dmiRequesterId = 0x0;
descriptorStruct.ichStraps.ichStrap0.smBus2Address = 0x00;
@@ -231,13 +227,3 @@ struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize)
return descriptorStruct;
}
-struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom4M()
-{
- return generatedDescriptorStruct(ROMSIZE_4MB);
-}
-
-struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom8M()
-{
- return generatedDescriptorStruct(ROMSIZE_8MB);
-}
-
diff --git a/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h b/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h
index 745f11f..3167a9d 100644
--- a/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h
+++ b/resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h
@@ -23,11 +23,5 @@
#include <stdint.h>
#include "../descriptor/descriptor.h"
-/* ROM image sizes in bytes */
-#define ROMSIZE_4MB 0x400000
-#define ROMSIZE_8MB 0x800000
-
-struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize);
-struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom4M();
-struct DESCRIPTORREGIONRECORD generatedDescriptorStructRom8M();
+struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe);
#endif