summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/src/ich9gen
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/ich9deblob/src/ich9gen
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/ich9deblob/src/ich9gen')
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.c34
-rw-r--r--resources/utilities/ich9deblob/src/ich9gen/mkdescriptor.h8
2 files changed, 11 insertions, 31 deletions
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