diff options
author | Leah Rowe <leah@retroboot.org> | 2021-03-16 19:37:19 +0000 |
---|---|---|
committer | Leah Rowe <leah@retroboot.org> | 2021-03-16 19:42:34 +0000 |
commit | 53749b0c6f7c5778bdd1ec2b91cd230626752579 (patch) | |
tree | 73a4f366101afefb4dd8dddbaf9d0221af7d6a9f /src/ich9gen |
Diffstat (limited to 'src/ich9gen')
-rw-r--r-- | src/ich9gen/mkdescriptor.c | 229 | ||||
-rw-r--r-- | src/ich9gen/mkdescriptor.h | 27 | ||||
-rw-r--r-- | src/ich9gen/mkgbe.c | 257 | ||||
-rw-r--r-- | src/ich9gen/mkgbe.h | 29 |
4 files changed, 542 insertions, 0 deletions
diff --git a/src/ich9gen/mkdescriptor.c b/src/ich9gen/mkdescriptor.c new file mode 100644 index 0000000..3b97a97 --- /dev/null +++ b/src/ich9gen/mkdescriptor.c @@ -0,0 +1,229 @@ +/* + * Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mkdescriptor.h" + +/* 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, int hasGbe) +{ + int i; + struct DESCRIPTORREGIONRECORD descriptorStruct; + + /* Flash Valid Signature Register */ + descriptorStruct.flValSig.signature = 0x0ff0a55a; + + /* Flash Map Registers */ + /* FLMAP0 */ + descriptorStruct.flMaps.flMap0.FCBA = 0x01; + descriptorStruct.flMaps.flMap0.NC = 0x0; + descriptorStruct.flMaps.flMap0.reserved1 = 0x00; + descriptorStruct.flMaps.flMap0.FRBA = 0x04; + descriptorStruct.flMaps.flMap0.NR = hasGbe ? 0x2 : 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.flMaps.flMap0.reserved2 = 0x00; + /* FLMAP1 */ + descriptorStruct.flMaps.flMap1.FMBA = 0x06; + descriptorStruct.flMaps.flMap1.NM = 0x2; + descriptorStruct.flMaps.flMap1.reserved = 0x00; + descriptorStruct.flMaps.flMap1.FISBA = 0x10; + descriptorStruct.flMaps.flMap1.ISL = 0x02; + /* FLMAP2 */ + descriptorStruct.flMaps.flMap2.FMSBA = 0x20; + descriptorStruct.flMaps.flMap2.MSL = 0x01; + descriptorStruct.flMaps.flMap2.reserved = 0x0000; + + /* Component Section Record */ + /* FLCOMP */ + 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; + descriptorStruct.componentSection.flcomp.readClockFrequency = 0x0; + descriptorStruct.componentSection.flcomp.fastReadSupport = 0x1; + descriptorStruct.componentSection.flcomp.fastreadClockFrequency = 0x1; + descriptorStruct.componentSection.flcomp.writeEraseClockFrequency = 0x0; + descriptorStruct.componentSection.flcomp.readStatusClockFrequency = 0x0; + descriptorStruct.componentSection.flcomp.reserved4 = 0x0; + /* FLILL */ + descriptorStruct.componentSection.flill = 0x00000000; + /* FLPB */ + descriptorStruct.componentSection.flpb = 0x00000000; + /* Padding */ + for (i = 0; i < 36; i++) { + descriptorStruct.componentSection.padding[i] = 0xFF; + } + + /* Flash Descriptor Region Section */ + /* FLREG0 (Descriptor) */ + descriptorStruct.regionSection.flReg0.BASE = 0x0000; + descriptorStruct.regionSection.flReg0.reserved1 = 0x0; + descriptorStruct.regionSection.flReg0.LIMIT = 0x0000; + descriptorStruct.regionSection.flReg0.reserved2 = 0x0; + /* FLREG1 (BIOS) */ + descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + (hasGbe ? GBEREGIONSIZE_8K : 0)) >> FLREGIONBITSHIFT; /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg1.reserved1 = 0x0; + descriptorStruct.regionSection.flReg1.LIMIT = ((romSize >> FLREGIONBITSHIFT) - 1); /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg1.reserved2 = 0x0; + /* FLREG2 (ME) */ + descriptorStruct.regionSection.flReg2.BASE = 0x1fff; /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg2.reserved1 = 0x0; + descriptorStruct.regionSection.flReg2.LIMIT = 0x0000; /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg2.reserved2 = 0x0; + /* FLREG3 (Gbe) */ + descriptorStruct.regionSection.flReg3.BASE = hasGbe ? (DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT) : 0x1fff; /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg3.reserved1 = 0x0; + 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 */ + descriptorStruct.regionSection.flReg4.reserved1 = 0x0; + descriptorStruct.regionSection.flReg4.LIMIT = 0x0000; /* see ../descriptor/descriptor.c */ + descriptorStruct.regionSection.flReg4.reserved2 = 0x0; + /* Padding */ + for (i = 0; i < 12; i++) { + descriptorStruct.regionSection.padding[i] = 0xFF; + } + + /* Master Access Section */ + /* FLMSTR1 (Host CPU / BIOS) */ + descriptorStruct.masterAccessSection.flMstr1.requesterId = 0x0000; + descriptorStruct.masterAccessSection.flMstr1.fdRegionReadAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.biosRegionReadAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.meRegionReadAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.gbeRegionReadAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.pdRegionReadAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.reserved1 = 0x0; + descriptorStruct.masterAccessSection.flMstr1.fdRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.biosRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.meRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.gbeRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.pdRegionWriteAccess = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr1.reserved2 = 0x0; + /* FLMSTR2 (ME) */ + descriptorStruct.masterAccessSection.flMstr2.requesterId = 0x0000; + descriptorStruct.masterAccessSection.flMstr2.fdRegionReadAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.biosRegionReadAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.meRegionReadAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.gbeRegionReadAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.pdRegionReadAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.reserved1 = 0x0; + descriptorStruct.masterAccessSection.flMstr2.fdRegionWriteAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.biosRegionWriteAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.meRegionWriteAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.gbeRegionWriteAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.pdRegionWriteAccess = 0x0; /* see ../descriptor/descriptor.c */ + descriptorStruct.masterAccessSection.flMstr2.reserved2 = 0x0; + /* FLMSTR3 (Gbe) */ + descriptorStruct.masterAccessSection.flMstr3.requesterId = 0x0218; + descriptorStruct.masterAccessSection.flMstr3.fdRegionReadAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.biosRegionReadAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.meRegionReadAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.gbeRegionReadAccess = 0x1; + descriptorStruct.masterAccessSection.flMstr3.pdRegionReadAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.reserved1 = 0x0; + descriptorStruct.masterAccessSection.flMstr3.fdRegionWriteAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.biosRegionWriteAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.meRegionWriteAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.gbeRegionWriteAccess = 0x1; + descriptorStruct.masterAccessSection.flMstr3.pdRegionWriteAccess = 0x0; + descriptorStruct.masterAccessSection.flMstr3.reserved2 = 0x0; + /* Padding */ + for (i = 0; i < 148; i++) { + descriptorStruct.masterAccessSection.padding[i] = 0xFF; + } + + /* ICH straps */ + /* ICHSTRAP0 */ + descriptorStruct.ichStraps.ichStrap0.meDisable = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.ichStraps.ichStrap0.reserved1 = 0x04; + descriptorStruct.ichStraps.ichStrap0.tcoMode = 0x1; + descriptorStruct.ichStraps.ichStrap0.smBusAddress = 0x64; + descriptorStruct.ichStraps.ichStrap0.bmcMode = 0x0; + descriptorStruct.ichStraps.ichStrap0.tripPointSelect = 0x0; + descriptorStruct.ichStraps.ichStrap0.reserved2 = 0x0; + 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; + /* ICHSTRAP1 */ + descriptorStruct.ichStraps.ichStrap1.northMlink = 0x1; + descriptorStruct.ichStraps.ichStrap1.southMlink = 0x1; + descriptorStruct.ichStraps.ichStrap1.meSmbus = 0x1; + descriptorStruct.ichStraps.ichStrap1.sstDynamic = 0x1; + descriptorStruct.ichStraps.ichStrap1.reserved1 = 0x0; + descriptorStruct.ichStraps.ichStrap1.northMlink2 = 0x1; + descriptorStruct.ichStraps.ichStrap1.reserved2 = 0x00; + descriptorStruct.ichStraps.ichStrap1.reserved3 = 0x0000; + /* Padding */ + for (i = 0; i < 248; i++) { + descriptorStruct.ichStraps.padding[i] = 0xFF; + } + + /* MCH straps */ + /* MCHSTRAP0 */ + descriptorStruct.mchStraps.mchStrap0.meDisable = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.mchStraps.mchStrap0.meBootFromFlash = 0x0; + descriptorStruct.mchStraps.mchStrap0.tpmDisable = 0x1; /* see ../descriptor/descriptor.c */ + descriptorStruct.mchStraps.mchStrap0.reserved1 = 0x7; + descriptorStruct.mchStraps.mchStrap0.spiFingerprint = 0x1; + descriptorStruct.mchStraps.mchStrap0.meAlternateDisable = 0x0; + descriptorStruct.mchStraps.mchStrap0.reserved2 = 0xff; + descriptorStruct.mchStraps.mchStrap0.reserved3 = 0xffff; + /* Padding */ + for (i = 0; i < 3292; i++) { + descriptorStruct.mchStraps.padding[i] = 0xFF; + } + + /* ME VSCC Table */ + descriptorStruct.meVsccTable.jid0 = 0x001720c2; + descriptorStruct.meVsccTable.vscc0 = 0x20052005; + descriptorStruct.meVsccTable.jid1 = 0x001730ef; + descriptorStruct.meVsccTable.vscc1 = 0x20052005; + descriptorStruct.meVsccTable.jid2 = 0x0000481f; + descriptorStruct.meVsccTable.vscc2 = 0x20152015; + /* Padding */ + for (i = 0; i < 4; i++) { + descriptorStruct.meVsccTable.padding[i] = 0xFF; + } + + /* Descriptor Map 2 Record */ + descriptorStruct.descriptor2Map.meVsccTableBaseAddress = 0xee; + descriptorStruct.descriptor2Map.meVsccTableLength = 0x06; + descriptorStruct.descriptor2Map.reserved = 0x0000; + + /* OEM section */ + /* see ../descriptor/descriptor.c */ + /* Magic String (ascii characters) */ + descriptorStruct.oemSection.magicString[0] = 0x4c; + descriptorStruct.oemSection.magicString[1] = 0x49; + descriptorStruct.oemSection.magicString[2] = 0x42; + descriptorStruct.oemSection.magicString[3] = 0x45; + descriptorStruct.oemSection.magicString[4] = 0x52; + descriptorStruct.oemSection.magicString[5] = 0x41; + descriptorStruct.oemSection.magicString[6] = 0x54; + descriptorStruct.oemSection.magicString[7] = 0x45; + /* Padding */ + for (i = 0; i < 248; i++) { + descriptorStruct.oemSection.padding[i] = 0xFF; + } + + return descriptorStruct; +} + diff --git a/src/ich9gen/mkdescriptor.h b/src/ich9gen/mkdescriptor.h new file mode 100644 index 0000000..8663db8 --- /dev/null +++ b/src/ich9gen/mkdescriptor.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2014 Leah Rowe <info@minifree.org> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ICH9GEN_MKDESCRIPTOR_H +#define ICH9GEN_MKDESCRIPTOR_H + +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include "../descriptor/descriptor.h" + +struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe); +#endif diff --git a/src/ich9gen/mkgbe.c b/src/ich9gen/mkgbe.c new file mode 100644 index 0000000..1653265 --- /dev/null +++ b/src/ich9gen/mkgbe.c @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2014 Leah Rowe <info@minifree.org> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mkgbe.h" + +/* Generate a 4KiB Gbe struct, with default values. */ +/* Read ../gbe/gbe.h for an explanation of the default values used here */ + +struct GBEREGIONRECORD_4K generatedGbeStruct4k() +{ + int i; + struct GBEREGIONRECORD_4K gbeStruct4k; + + /* MAC address (words 00h to 02h) */ + /* see ../gbe/gbe.c */ + gbeStruct4k.macAddress[0] = 0x00; + gbeStruct4k.macAddress[1] = 0xf5; + gbeStruct4k.macAddress[2] = 0xf0; + gbeStruct4k.macAddress[3] = 0x40; + gbeStruct4k.macAddress[4] = 0x71; + gbeStruct4k.macAddress[5] = 0xfe; + + /* Word 03h (Reserved) */ + gbeStruct4k.reservedWord03h.reserved1_0 = 0x00; + gbeStruct4k.reservedWord03h.reserved1_1 = 0x0; + gbeStruct4k.reservedWord03h.ibaLom = 0x1; + gbeStruct4k.reservedWord03h.reserved2 = 0x0; + + /* Word 04h (Reserved) */ + gbeStruct4k.reservedWord04h = 0xffff; + + /* Word 05h (Image Version Information) */ + gbeStruct4k.imageVersionInformation = 0x1083; + + /* Words 06h and 07h (Reserved) */ + gbeStruct4k.reservedWords06h07h[0] = 0xffff; + gbeStruct4k.reservedWords06h07h[1] = 0xffff; + + /* Word 08h and 09h (PBA Low and PBA High) */ + gbeStruct4k.pbaLow = 0x1008; + gbeStruct4k.pbaHigh = 0xffff; + + /* Word 0Ah (PCI Initialization Control Word) */ + gbeStruct4k.pciInitializationControlWord.loadVendorDeviceId = 0x1; + gbeStruct4k.pciInitializationControlWord.loadSubsystemId = 0x1; + gbeStruct4k.pciInitializationControlWord.reserved1 = 0x0; + gbeStruct4k.pciInitializationControlWord.reserved2 = 0x0; + gbeStruct4k.pciInitializationControlWord.pmEnable = 0x1; + gbeStruct4k.pciInitializationControlWord.auxPwr = 0x1; + gbeStruct4k.pciInitializationControlWord.reserved3 = 0x0; + gbeStruct4k.pciInitializationControlWord.reserved4 = 0x1; + + /* Word 0Bh (Subsystem ID) */ + gbeStruct4k.subsystemId = 0x20ee; + + /* Word 0Ch (Subsystem Vendor ID) */ + gbeStruct4k.subsystemVendorId = 0x17aa; + + /* Word 0Dh (Device ID) */ + gbeStruct4k.deviceId = 0x10f5; + + /* Word 0Eh (Vendor ID) */ + gbeStruct4k.vendorId = 0x8086; + + /* Word 0Fh (Device Revision ID) */ + gbeStruct4k.deviceRevId = 0x0000; + + /* Word 10h (LAN Power Consumption) */ + gbeStruct4k.lanPowerConsumption.lanD3Power = 0x01; + gbeStruct4k.lanPowerConsumption.reserved = 0x0; + gbeStruct4k.lanPowerConsumption.lanD0Power = 0x0d; + + /* Words 11h and 12h (Reserved) */ + gbeStruct4k.reservedWords11h12h[0] = 0x0000; + gbeStruct4k.reservedWords11h12h[1] = 0x0000; + + /* Word 13h (Shared Initialization Control Word) */ + gbeStruct4k.sharedInitializationControlWord.reserved1 = 0x5; + gbeStruct4k.sharedInitializationControlWord.forceDuplex = 0x0; + gbeStruct4k.sharedInitializationControlWord.forceSpeedEnable = 0x0; + gbeStruct4k.sharedInitializationControlWord.reserved2_0 = 0x0; + gbeStruct4k.sharedInitializationControlWord.reserved2_1 = 0x0; + gbeStruct4k.sharedInitializationControlWord.phyPowerDownEnable = 0x1; + gbeStruct4k.sharedInitializationControlWord.reserved3 = 0x1; + gbeStruct4k.sharedInitializationControlWord.reserved4 = 0x0; + gbeStruct4k.sharedInitializationControlWord.sign = 0x2; + + /* Word 14h (Extended Configuration Control Word 1) */ + gbeStruct4k.extendedConfigurationControlWord1.extendedConfigurationPointer = 0x020; + gbeStruct4k.extendedConfigurationControlWord1.oemWriteEnable = 0x1; + gbeStruct4k.extendedConfigurationControlWord1.reserved1 = 0x1; + gbeStruct4k.extendedConfigurationControlWord1.reserved2 = 0x0; + gbeStruct4k.extendedConfigurationControlWord1.reserved3 = 0x0; + + /* Word 15h (Extended Configuration Control Word 2) */ + gbeStruct4k.extendedConfigurationControlWord2.reserved = 0x00; + gbeStruct4k.extendedConfigurationControlWord2.extendedPhyLength = 0x0a; + + /* Word 16h (Extended Configuration Control Word 3) */ + gbeStruct4k.extendedConfigurationControlWord3 = 0x0000; + + /* Word 17h (LED 1 Configuration and Power Management) */ + gbeStruct4k.ledCtl1.led1Mode = 0xb; + gbeStruct4k.ledCtl1.reserved1 = 0x0; + gbeStruct4k.ledCtl1.led1BlinkMode = 0x0; + gbeStruct4k.ledCtl1.led1Invert = 0x0; + gbeStruct4k.ledCtl1.led1Blink = 0x1; + gbeStruct4k.ledCtl1.reserved2 = 0x1; + gbeStruct4k.ledCtl1.lpluEnable = 0x0; + gbeStruct4k.ledCtl1.lpluEnableNonD0a = 0x1; + gbeStruct4k.ledCtl1.gbeDisableNonD0a = 0x1; + gbeStruct4k.ledCtl1.reserved3 = 0x0; + gbeStruct4k.ledCtl1.gbeDisable = 0x0; + gbeStruct4k.ledCtl1.reserved4 = 0x1; + + /* Word 18h (LED 0 and 2 Configuration Defaults) */ + gbeStruct4k.ledCtl02.led0Mode = 0x2; + gbeStruct4k.ledCtl02.reserved1 = 0x0; + gbeStruct4k.ledCtl02.led0BlinkMode = 0x0; + gbeStruct4k.ledCtl02.led0Invert = 0x0; + gbeStruct4k.ledCtl02.led0Blink = 0x0; + gbeStruct4k.ledCtl02.led2Mode = 0x6; + gbeStruct4k.ledCtl02.reserved2 = 0x0; + gbeStruct4k.ledCtl02.led2BlinkMode = 0x0; + gbeStruct4k.ledCtl02.led2Invert = 0x0; + gbeStruct4k.ledCtl02.led2Blink = 0x0; + + /* Word 19h (Reserved) */ + gbeStruct4k.reservedWord19h = 0x2b40; + + /* Word 1Ah (Reserved) */ + gbeStruct4k.reservedWord1Ah = 0x0043; + + /* Word 1Bh (Reserved) */ + gbeStruct4k.reservedWord1Bh = 0x0000; + + /* Word 1Ch (Reserved) */ + gbeStruct4k.reservedWord1Ch = 0x10f5; + + /* Word 1Dh (Reserved) */ + gbeStruct4k.reservedWord1Dh = 0xbaad; + + /* Word 1Eh (Device ID for Intel 82567LM gigabit ethernet controller) */ + gbeStruct4k._82567lmDeviceId = 0x10f5; + + /* Word 1Fh (Device ID for Intel 82567LF gigabit ethernet controller) */ + gbeStruct4k._82567lfDeviceId = 0x10bf; + + /* Word 20h (Reserved) */ + gbeStruct4k.reservedWord20h = 0xbaad; + + /* Word 21h (Device ID for Intel 82567V gigabit ethernet controller) */ + gbeStruct4k._82567vDeviceId = 0x10cb; + + /* Word 22h (Reserved) */ + gbeStruct4k.reservedWord22h = 0xbaad; + + /* Word 23h (Reserved) */ + gbeStruct4k.reservedWord23h = 0xbaad; + + /* Words 24h to 2Fh (Reserved) */ + gbeStruct4k.reservedWords24to2Fh[0] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[1] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[2] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[3] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[4] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[5] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[6] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[7] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[8] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[9] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[10] = 0x0000; + gbeStruct4k.reservedWords24to2Fh[11] = 0x0000; + + /* Words 30h to 3Eh (PXE Software Region) */ + /* Boot Agent Main Setup Options (Word 30h) */ + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.protocolSelect = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved1 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.defaultBootSelection = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved2 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.promptTime = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.displaySetupMessage = 0x1; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved3 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceSpeed = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.forceFullDuplex = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.reserved4 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.efiPresence = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentMainSetupOptions.pxePresence = 0x0; + /* Boot Agent Configuration Customization Options (Word 31h) */ + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableSetupMenu = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableTitleMessage = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableProtocolSelect = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableBootSelection = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableLegacyWakeupSupport = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.disableFlashUpdate = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved1 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.ibaBootOrderSetupMode = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.reserved2 = 0x0; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions31h.signature = 0x1; + /* Boot Agent Configuration Customization Options (Word 32h) */ + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.buildNumber = 0x18; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.minorVersionNumber = 0x3; + gbeStruct4k.pxeSoftwareRegion.bootAgentConfigurationCustomizationOptions32h.majorVersionNumber = 0x1; + /* IBA Capabilities (Word 33h) */ + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.baseCodePresent = 0x1; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.undiCapabilityPresent = 0x1; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved1 = 0x1; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.efiUndiCapabilityPresent = 0x0; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_0 = 0x0; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.reserved2_1 = 0x00; + gbeStruct4k.pxeSoftwareRegion.ibaCapabilities.signature = 0x1; + /* Padding (Words 34h to 3Eh) */ + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[0] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[1] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[2] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[3] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[4] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[5] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[6] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[7] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[8] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[9] = 0xffff; + gbeStruct4k.pxeSoftwareRegion.paddingWords34hTo3Eh[10] = 0xffff; + + /* Word 3Fh (Checksum) */ + gbeStruct4k.checkSum = gbeGetChecksumFrom4kStruct(gbeStruct4k, GBECHECKSUMTOTAL); + + /* The rest of Gbe (word 40h or byte 80h onwards) is just padding (0xFF) */ + for (i = 0; i < 3968; i++) { + gbeStruct4k.padding[i] = 0xFF; + } + + return gbeStruct4k; +} + +struct GBEREGIONRECORD_8K generatedGbeStruct8k() +{ + struct GBEREGIONRECORD_8K gbeStruct8k; + gbeStruct8k.main = generatedGbeStruct4k(); + memcpy(&gbeStruct8k.backup, &gbeStruct8k.main, GBEREGIONSIZE_4K); + return gbeStruct8k; +} + diff --git a/src/ich9gen/mkgbe.h b/src/ich9gen/mkgbe.h new file mode 100644 index 0000000..1697417 --- /dev/null +++ b/src/ich9gen/mkgbe.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014 Leah Rowe <info@minifree.org> + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ICH9GEN_MKGBE_H +#define ICH9GEN_MKGBE_H + +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include "../gbe/gbe.h" + +struct GBEREGIONRECORD_4K generatedGbeStruct4k(); +struct GBEREGIONRECORD_8K generatedGbeStruct8k(); + +#endif |